summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/a1bus/a1bus.cpp3
-rw-r--r--src/devices/bus/a2bus/a2bus.cpp1
-rw-r--r--src/devices/bus/a2bus/a2eauxslot.cpp1
-rw-r--r--src/devices/bus/a2bus/pc_xporter.cpp50
-rw-r--r--src/devices/bus/a2bus/pc_xporter.h1
-rw-r--r--src/devices/bus/bml3/bml3bus.cpp1
-rw-r--r--src/devices/bus/coco/cococart.cpp1
-rw-r--r--src/devices/bus/comx35/clm.cpp1
-rw-r--r--src/devices/bus/comx35/clm.h3
-rw-r--r--src/devices/bus/cpc/cpcexp.cpp1
-rw-r--r--src/devices/bus/gameboy/gb_slot.cpp28
-rw-r--r--src/devices/bus/generic/slot.cpp3
-rw-r--r--src/devices/bus/generic/slot.h16
-rw-r--r--src/devices/bus/intv/ecs.cpp424
-rw-r--r--src/devices/bus/intv/ecs.h20
-rw-r--r--src/devices/bus/intv_ctrl/ctrl.cpp95
-rw-r--r--src/devices/bus/intv_ctrl/ctrl.h76
-rw-r--r--src/devices/bus/intv_ctrl/ecs_ctrl.cpp448
-rw-r--r--src/devices/bus/intv_ctrl/ecs_ctrl.h171
-rw-r--r--src/devices/bus/intv_ctrl/handctrl.cpp179
-rw-r--r--src/devices/bus/intv_ctrl/handctrl.h55
-rw-r--r--src/devices/bus/iq151/iq151.cpp1
-rw-r--r--src/devices/bus/iq151/video32.cpp24
-rw-r--r--src/devices/bus/iq151/video32.h4
-rw-r--r--src/devices/bus/iq151/video64.cpp24
-rw-r--r--src/devices/bus/iq151/video64.h4
-rw-r--r--src/devices/bus/isa/isa.cpp5
-rw-r--r--src/devices/bus/kc/kc.cpp1
-rw-r--r--src/devices/bus/kc/rom.cpp2
-rw-r--r--src/devices/bus/macpds/macpds.cpp3
-rw-r--r--src/devices/bus/msx_slot/bunsetsu.cpp28
-rw-r--r--src/devices/bus/msx_slot/bunsetsu.h10
-rw-r--r--src/devices/bus/msx_slot/disk.h12
-rw-r--r--src/devices/bus/msx_slot/fs4600.cpp14
-rw-r--r--src/devices/bus/msx_slot/fs4600.h4
-rw-r--r--src/devices/bus/msx_slot/music.h2
-rw-r--r--src/devices/bus/msx_slot/panasonic08.cpp14
-rw-r--r--src/devices/bus/msx_slot/panasonic08.h4
-rw-r--r--src/devices/bus/msx_slot/rom.cpp16
-rw-r--r--src/devices/bus/msx_slot/rom.h4
-rw-r--r--src/devices/bus/msx_slot/sony08.cpp14
-rw-r--r--src/devices/bus/msx_slot/sony08.h4
-rw-r--r--src/devices/bus/nubus/nubus.cpp3
-rw-r--r--src/devices/bus/pc_kbd/pc_kbdc.cpp1
-rw-r--r--src/devices/bus/sms_ctrl/lphaser.cpp11
-rw-r--r--src/devices/bus/sms_ctrl/lphaser.h2
-rw-r--r--src/devices/bus/sms_ctrl/paddle.cpp8
-rw-r--r--src/devices/bus/sms_ctrl/paddle.h4
-rw-r--r--src/devices/bus/sms_ctrl/sports.cpp20
-rw-r--r--src/devices/bus/sms_ctrl/sports.h8
-rw-r--r--src/devices/bus/sms_ctrl/sportsjp.cpp88
-rw-r--r--src/devices/bus/sms_ctrl/sportsjp.h9
-rw-r--r--src/devices/bus/snes_ctrl/joypad.h2
-rw-r--r--src/devices/bus/snes_ctrl/mouse.h2
-rw-r--r--src/devices/bus/snes_ctrl/multitap.h2
-rw-r--r--src/devices/bus/snes_ctrl/pachinko.h2
-rw-r--r--src/devices/bus/snes_ctrl/sscope.h2
-rw-r--r--src/devices/bus/snes_ctrl/twintap.h2
-rw-r--r--src/devices/bus/ti99_peb/pcode.cpp208
-rw-r--r--src/devices/bus/ti99_peb/pcode.h21
-rw-r--r--src/devices/bus/ti99_peb/peribox.cpp2
-rw-r--r--src/devices/bus/ti99_peb/spchsyn.cpp105
-rw-r--r--src/devices/bus/ti99_peb/spchsyn.h6
-rw-r--r--src/devices/bus/ti99x/998board.cpp2318
-rw-r--r--src/devices/bus/ti99x/998board.h606
-rw-r--r--src/devices/bus/ti99x/datamux.cpp404
-rw-r--r--src/devices/bus/ti99x/datamux.h100
-rw-r--r--src/devices/bus/ti99x/genboard.cpp70
-rw-r--r--src/devices/bus/ti99x/genboard.h8
-rw-r--r--src/devices/bus/ti99x/grom.cpp269
-rw-r--r--src/devices/bus/ti99x/grom.h108
-rw-r--r--src/devices/bus/ti99x/gromport.cpp465
-rw-r--r--src/devices/bus/ti99x/gromport.h83
-rw-r--r--src/devices/bus/ti99x/ti99defs.h48
-rw-r--r--src/devices/bus/ti99x/videowrp.cpp160
-rw-r--r--src/devices/bus/ti99x/videowrp.h102
-rw-r--r--src/devices/bus/tvc/tvc.cpp1
-rw-r--r--src/devices/bus/vtech/memexp/carts.cpp1
-rw-r--r--src/devices/bus/vtech/memexp/carts.h1
-rw-r--r--src/devices/bus/vtech/memexp/rs232.cpp4
-rw-r--r--src/devices/bus/vtech/memexp/rs232.h2
-rw-r--r--src/devices/bus/vtech/memexp/rtty.cpp88
-rw-r--r--src/devices/bus/vtech/memexp/rtty.h45
-rw-r--r--src/devices/bus/x68k/x68kexp.cpp1
-rw-r--r--src/devices/bus/z88/z88.cpp1
-rw-r--r--src/devices/cpu/avr8/avr8.cpp5
-rw-r--r--src/devices/cpu/avr8/avr8.h7
-rw-r--r--src/devices/cpu/drcbec.cpp16
-rw-r--r--src/devices/cpu/drcbex64.cpp133
-rw-r--r--src/devices/cpu/drcbex64.h2
-rw-r--r--src/devices/cpu/drcbex86.cpp104
-rw-r--r--src/devices/cpu/drcbex86.h2
-rw-r--r--src/devices/cpu/drcuml.cpp1
-rw-r--r--src/devices/cpu/drcumlsh.h4
-rw-r--r--src/devices/cpu/hmcs40/hmcs40.cpp10
-rw-r--r--src/devices/cpu/hmcs40/hmcs40d.cpp4
-rw-r--r--src/devices/cpu/hmcs40/hmcs40op.cpp4
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.cpp2
-rw-r--r--src/devices/cpu/m6809/m6809.cpp4
-rw-r--r--src/devices/cpu/mips/mips3.cpp157
-rw-r--r--src/devices/cpu/mips/mips3drc.cpp4
-rw-r--r--src/devices/cpu/powerpc/ppcdrc.cpp56
-rw-r--r--src/devices/cpu/rsp/rsp.cpp2
-rw-r--r--src/devices/cpu/rsp/rspdrc.cpp4
-rw-r--r--src/devices/cpu/sh2/sh2.cpp4
-rw-r--r--src/devices/cpu/sh2/sh2drc.cpp5
-rw-r--r--src/devices/cpu/sh4/sh4.cpp101
-rw-r--r--src/devices/cpu/sm510/kb1013vk1-2.h41
-rw-r--r--src/devices/cpu/sm510/kb1013vk1-2core.cpp135
-rw-r--r--src/devices/cpu/sm510/kb1013vk1-2op.cpp21
-rw-r--r--src/devices/cpu/sm510/sm500.h82
-rw-r--r--src/devices/cpu/sm510/sm500core.cpp153
-rw-r--r--src/devices/cpu/sm510/sm500op.cpp95
-rw-r--r--src/devices/cpu/sm510/sm510.cpp48
-rw-r--r--src/devices/cpu/sm510/sm510.h133
-rw-r--r--src/devices/cpu/sm510/sm510core.cpp3
-rw-r--r--src/devices/cpu/sm510/sm510d.cpp157
-rw-r--r--src/devices/cpu/sm510/sm510op.cpp19
-rw-r--r--src/devices/cpu/sm510/sm511core.cpp3
-rw-r--r--src/devices/cpu/uml.cpp19
-rw-r--r--src/devices/cpu/uml.h6
-rw-r--r--src/devices/cpu/x86emit.h7
-rw-r--r--src/devices/machine/at28c16.cpp33
-rw-r--r--src/devices/machine/at28c16.h1
-rw-r--r--src/devices/machine/at45dbxx.cpp7
-rw-r--r--src/devices/machine/ds1204.cpp3
-rw-r--r--src/devices/machine/ds1204.h2
-rw-r--r--src/devices/machine/ds2401.cpp9
-rw-r--r--src/devices/machine/eeprom.cpp27
-rw-r--r--src/devices/machine/eeprom.h2
-rw-r--r--src/devices/machine/er2055.cpp15
-rw-r--r--src/devices/machine/er2055.h2
-rw-r--r--src/devices/machine/gt64xxx.cpp3
-rw-r--r--src/devices/machine/gt64xxx.h2
-rw-r--r--src/devices/machine/hp_taco.cpp1551
-rw-r--r--src/devices/machine/hp_taco.h201
-rw-r--r--src/devices/machine/i2cmem.cpp17
-rw-r--r--src/devices/machine/i2cmem.h2
-rw-r--r--src/devices/machine/i6300esb.cpp3
-rw-r--r--src/devices/machine/i6300esb.h1
-rw-r--r--src/devices/machine/intelfsh.cpp59
-rw-r--r--src/devices/machine/intelfsh.h10
-rw-r--r--src/devices/machine/k033906.cpp5
-rw-r--r--src/devices/machine/k033906.h7
-rw-r--r--src/devices/machine/k053252.cpp13
-rw-r--r--src/devices/machine/k053252.h5
-rw-r--r--src/devices/machine/mc146818.cpp9
-rw-r--r--src/devices/machine/mc146818.h2
-rw-r--r--src/devices/machine/mos6530n.cpp1
-rw-r--r--src/devices/machine/mos6530n.h3
-rw-r--r--src/devices/machine/netlist.cpp11
-rw-r--r--src/devices/machine/netlist.h4
-rw-r--r--src/devices/machine/nvram.cpp5
-rw-r--r--src/devices/machine/nvram.h1
-rw-r--r--src/devices/machine/pci.cpp3
-rw-r--r--src/devices/machine/pci.h2
-rw-r--r--src/devices/machine/pla.cpp6
-rw-r--r--src/devices/machine/pla.h2
-rw-r--r--src/devices/machine/rp5h01.cpp15
-rw-r--r--src/devices/machine/rp5h01.h5
-rw-r--r--src/devices/machine/rtc9701.cpp21
-rw-r--r--src/devices/machine/serflash.cpp34
-rw-r--r--src/devices/machine/serflash.h4
-rw-r--r--src/devices/machine/tc009xlvc.cpp23
-rw-r--r--src/devices/machine/tc009xlvc.h5
-rw-r--r--src/devices/machine/timekpr.cpp27
-rw-r--r--src/devices/machine/timekpr.h2
-rw-r--r--src/devices/machine/vrc4373.cpp4
-rw-r--r--src/devices/machine/vrc4373.h1
-rw-r--r--src/devices/machine/x2212.cpp60
-rw-r--r--src/devices/machine/x2212.h11
-rw-r--r--src/devices/machine/x76f041.cpp3
-rw-r--r--src/devices/machine/x76f041.h2
-rw-r--r--src/devices/machine/x76f100.cpp3
-rw-r--r--src/devices/machine/x76f100.h2
-rw-r--r--src/devices/sound/2608intf.cpp7
-rw-r--r--src/devices/sound/2608intf.h1
-rw-r--r--src/devices/sound/2610intf.cpp6
-rw-r--r--src/devices/sound/2610intf.h1
-rw-r--r--src/devices/sound/8950intf.cpp5
-rw-r--r--src/devices/sound/8950intf.h1
-rw-r--r--src/devices/sound/digitalk.cpp3
-rw-r--r--src/devices/sound/digitalk.h2
-rw-r--r--src/devices/sound/gaelco.cpp8
-rw-r--r--src/devices/sound/gaelco.h8
-rw-r--r--src/devices/sound/iremga20.cpp9
-rw-r--r--src/devices/sound/iremga20.h3
-rw-r--r--src/devices/sound/k005289.cpp8
-rw-r--r--src/devices/sound/k005289.h2
-rw-r--r--src/devices/sound/k007232.cpp2
-rw-r--r--src/devices/sound/k053260.cpp16
-rw-r--r--src/devices/sound/k053260.h9
-rw-r--r--src/devices/sound/k054539.cpp38
-rw-r--r--src/devices/sound/k054539.h8
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.cpp14
-rw-r--r--src/devices/sound/l7a1045_l6028_dsp_a.h3
-rw-r--r--src/devices/sound/nile.cpp5
-rw-r--r--src/devices/sound/nile.h2
-rw-r--r--src/devices/sound/okim6295.cpp1
-rw-r--r--src/devices/sound/okim6295.h1
-rw-r--r--src/devices/sound/tc8830f.cpp18
-rw-r--r--src/devices/sound/tc8830f.h3
-rw-r--r--src/devices/sound/tms5110.cpp10
-rw-r--r--src/devices/sound/tms5110.h9
-rw-r--r--src/devices/sound/tms5220.cpp214
-rw-r--r--src/devices/sound/tms5220.h8
-rw-r--r--src/devices/sound/vlm5030.cpp6
-rw-r--r--src/devices/sound/vlm5030.h1
-rw-r--r--src/devices/sound/ymf278b.cpp2
-rw-r--r--src/devices/sound/ymz280b.cpp7
-rw-r--r--src/devices/sound/ymz770.cpp25
-rw-r--r--src/devices/sound/ymz770.h3
-rw-r--r--src/devices/video/bufsprite.h2
-rw-r--r--src/devices/video/ef9345.cpp8
-rw-r--r--src/devices/video/ef9345.h2
-rw-r--r--src/devices/video/ef9364.cpp4
-rw-r--r--src/devices/video/ef9364.h2
-rw-r--r--src/devices/video/ef9365.cpp4
-rw-r--r--src/devices/video/ef9365.h2
-rw-r--r--src/devices/video/epic12.cpp14
-rw-r--r--src/devices/video/hd44352.cpp5
-rw-r--r--src/devices/video/hd44352.h1
-rw-r--r--src/devices/video/hd44780.cpp12
-rw-r--r--src/devices/video/hd44780.h2
-rw-r--r--src/devices/video/msm6222b.cpp19
-rw-r--r--src/devices/video/msm6222b.h3
-rw-r--r--src/devices/video/tms9927.cpp13
-rw-r--r--src/devices/video/tms9927.h7
-rw-r--r--src/emu/addrmap.h11
-rw-r--r--src/emu/audit.cpp1
-rw-r--r--src/emu/clifront.cpp3
-rw-r--r--src/emu/debug/debugcmd.h1
-rw-r--r--src/emu/debug/debugcon.h1
-rw-r--r--src/emu/devcpu.cpp25
-rw-r--r--src/emu/devcpu.h14
-rw-r--r--src/emu/devfind.cpp55
-rw-r--r--src/emu/devfind.h37
-rw-r--r--src/emu/device.cpp23
-rw-r--r--src/emu/device.h13
-rw-r--r--src/emu/diimage.cpp11
-rw-r--r--src/emu/diimage.h20
-rw-r--r--src/emu/dimemory.h3
-rw-r--r--src/emu/diserial.cpp4
-rw-r--r--src/emu/drivers/empty.cpp1
-rw-r--r--src/emu/emu.h6
-rw-r--r--src/emu/emumem.cpp (renamed from src/emu/memory.cpp)3
-rw-r--r--src/emu/emumem.h (renamed from src/emu/memory.h)8
-rw-r--r--src/emu/emuopts.cpp61
-rw-r--r--src/emu/emuopts.h8
-rw-r--r--src/emu/image.cpp4
-rw-r--r--src/emu/info.cpp831
-rw-r--r--src/emu/inpttype.h2
-rw-r--r--src/emu/ioport.cpp72
-rw-r--r--src/emu/language.cpp1
-rw-r--r--src/emu/layout/svg.lay8
-rw-r--r--src/emu/luaengine.cpp663
-rw-r--r--src/emu/luaengine.h46
-rw-r--r--src/emu/machine.cpp18
-rw-r--r--src/emu/machine.h53
-rw-r--r--src/emu/machine.ipp77
-rw-r--r--src/emu/mconfig.cpp1
-rw-r--r--src/emu/mconfig.h7
-rw-r--r--src/emu/render.cpp31
-rw-r--r--src/emu/render.h6
-rw-r--r--src/emu/rendlay.cpp2
-rw-r--r--src/emu/rendlay.h3
-rw-r--r--src/emu/screen.cpp149
-rw-r--r--src/emu/screen.h14
-rw-r--r--src/emu/ui/ctrlmenu.cpp149
-rw-r--r--src/emu/ui/ctrlmenu.h41
-rw-r--r--src/emu/ui/dsplmenu.cpp224
-rw-r--r--src/emu/ui/dsplmenu.h44
-rw-r--r--src/emu/ui/filemngr.cpp3
-rw-r--r--src/emu/ui/imgcntrl.cpp1
-rw-r--r--src/emu/ui/mainmenu.cpp63
-rw-r--r--src/emu/ui/mainmenu.h1
-rw-r--r--src/emu/ui/menu.cpp85
-rw-r--r--src/emu/ui/menu.h27
-rw-r--r--src/emu/ui/miscmenu.cpp121
-rw-r--r--src/emu/ui/optsmenu.cpp20
-rw-r--r--src/emu/ui/optsmenu.h3
-rw-r--r--src/emu/ui/pluginopt.cpp112
-rw-r--r--src/emu/ui/pluginopt.h38
-rw-r--r--src/emu/ui/selgame.cpp37
-rw-r--r--src/emu/ui/selgame.h3
-rw-r--r--src/emu/ui/selsoft.cpp14
-rw-r--r--src/emu/ui/simpleselgame.cpp3
-rw-r--r--src/emu/ui/sliders.cpp62
-rw-r--r--src/emu/ui/sliders.h4
-rw-r--r--src/emu/ui/slotopt.cpp2
-rw-r--r--src/emu/ui/submenu.cpp361
-rw-r--r--src/emu/ui/submenu.h158
-rw-r--r--src/emu/ui/ui.cpp254
-rw-r--r--src/emu/ui/ui.h16
-rw-r--r--src/emu/ui/utils.cpp9
-rw-r--r--src/emu/ui/utils.h1
-rw-r--r--src/lib/netlist/build/makefile9
-rw-r--r--src/lib/netlist/devices/nld_system.h6
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx.cpp4
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx.h4
-rw-r--r--src/lib/netlist/nl_base.cpp52
-rw-r--r--src/lib/netlist/nl_base.h36
-rw-r--r--src/lib/netlist/nl_setup.cpp5
-rw-r--r--src/lib/netlist/nl_util.h41
-rw-r--r--src/lib/netlist/plib/plists.h2
-rw-r--r--src/lib/netlist/plib/pstate.h45
-rw-r--r--src/lib/netlist/prg/nltool.cpp9
-rw-r--r--src/lib/netlist/solver/mat_cr.h14
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h106
-rw-r--r--src/lib/netlist/solver/nld_ms_direct.h382
-rw-r--r--src/lib/netlist/solver/nld_ms_direct1.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_direct2.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_direct_lu.h12
-rw-r--r--src/lib/netlist/solver/nld_ms_sm.h215
-rw-r--r--src/lib/netlist/solver/nld_ms_sor_mat.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_w.h217
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp77
-rw-r--r--src/lib/util/chdcodec.cpp29
-rw-r--r--src/lib/util/chdcodec.h1
-rw-r--r--src/lib/util/delegate.h2
-rw-r--r--src/lib/util/nanosvg.cpp6
-rw-r--r--src/lib/util/options.cpp18
-rw-r--r--src/lib/util/options.h5
-rw-r--r--src/lib/util/plaparse.h2
-rw-r--r--src/lib/util/un7z.cpp152
-rw-r--r--src/lib/util/unzip.cpp1103
-rw-r--r--src/lib/util/vbiparse.h1
-rw-r--r--src/lib/util/zippath.cpp98
-rw-r--r--src/mame/arcade.flt3
-rw-r--r--src/mame/audio/atarijsa.cpp25
-rw-r--r--src/mame/audio/atarijsa.h7
-rw-r--r--src/mame/audio/seibu.cpp30
-rw-r--r--src/mame/audio/seibu.h13
-rw-r--r--src/mame/audio/wpcsnd.cpp8
-rw-r--r--src/mame/audio/wpcsnd.h3
-rw-r--r--src/mame/drivers/actfancr.cpp14
-rw-r--r--src/mame/drivers/aerofgt.cpp14
-rw-r--r--src/mame/drivers/airbustr.cpp1
-rw-r--r--src/mame/drivers/aleck64.cpp4
-rw-r--r--src/mame/drivers/angelkds.cpp20
-rw-r--r--src/mame/drivers/apple2e.cpp31
-rw-r--r--src/mame/drivers/appoooh.cpp54
-rw-r--r--src/mame/drivers/artmagic.cpp2
-rw-r--r--src/mame/drivers/asterix.cpp5
-rw-r--r--src/mame/drivers/attckufo.cpp219
-rw-r--r--src/mame/drivers/backfire.cpp4
-rw-r--r--src/mame/drivers/bbusters.cpp55
-rw-r--r--src/mame/drivers/bishi.cpp5
-rw-r--r--src/mame/drivers/blackt96.cpp1
-rw-r--r--src/mame/drivers/boogwing.cpp4
-rw-r--r--src/mame/drivers/cabal.cpp10
-rw-r--r--src/mame/drivers/calorie.cpp18
-rw-r--r--src/mame/drivers/cbuster.cpp3
-rw-r--r--src/mame/drivers/cchance.cpp1
-rw-r--r--src/mame/drivers/cclimber.cpp75
-rw-r--r--src/mame/drivers/champbwl.cpp2
-rw-r--r--src/mame/drivers/chihiro.cpp37
-rw-r--r--src/mame/drivers/cninja.cpp18
-rw-r--r--src/mame/drivers/cobra.cpp4
-rw-r--r--src/mame/drivers/crospang.cpp1
-rw-r--r--src/mame/drivers/crshrace.cpp1
-rw-r--r--src/mame/drivers/cshooter.cpp423
-rw-r--r--src/mame/drivers/cv1k.cpp52
-rw-r--r--src/mame/drivers/darius.cpp1
-rw-r--r--src/mame/drivers/darkseal.cpp3
-rw-r--r--src/mame/drivers/dassault.cpp4
-rw-r--r--src/mame/drivers/dblewing.cpp2
-rw-r--r--src/mame/drivers/dbz.cpp6
-rw-r--r--src/mame/drivers/deadang.cpp8
-rw-r--r--src/mame/drivers/dec0.cpp27
-rw-r--r--src/mame/drivers/dec8.cpp32
-rw-r--r--src/mame/drivers/deco156.cpp4
-rw-r--r--src/mame/drivers/deco32.cpp23
-rw-r--r--src/mame/drivers/dfruit.cpp1
-rw-r--r--src/mame/drivers/dietgo.cpp2
-rw-r--r--src/mame/drivers/djboy.cpp1
-rw-r--r--src/mame/drivers/djmain.cpp3
-rw-r--r--src/mame/drivers/dreambal.cpp1
-rw-r--r--src/mame/drivers/esd16.cpp1
-rw-r--r--src/mame/drivers/f1gp.cpp3
-rw-r--r--src/mame/drivers/fb01.cpp2
-rw-r--r--src/mame/drivers/fidel6502.cpp112
-rw-r--r--src/mame/drivers/fidel68k.cpp3
-rw-r--r--src/mame/drivers/fidelz80.cpp1
-rw-r--r--src/mame/drivers/funkyjet.cpp2
-rw-r--r--src/mame/drivers/galastrm.cpp1
-rw-r--r--src/mame/drivers/galaxi.cpp35
-rw-r--r--src/mame/drivers/galaxian.cpp49
-rw-r--r--src/mame/drivers/galpanic.cpp1
-rw-r--r--src/mame/drivers/gba.cpp2
-rw-r--r--src/mame/drivers/geneve.cpp12
-rw-r--r--src/mame/drivers/gijoe.cpp8
-rw-r--r--src/mame/drivers/glasgow.cpp560
-rw-r--r--src/mame/drivers/gotcha.cpp1
-rw-r--r--src/mame/drivers/groundfx.cpp1
-rw-r--r--src/mame/drivers/gstriker.cpp1
-rw-r--r--src/mame/drivers/gticlub.cpp15
-rw-r--r--src/mame/drivers/gunbustr.cpp1
-rw-r--r--src/mame/drivers/harddriv.cpp89
-rw-r--r--src/mame/drivers/hh_hmcs40.cpp23
-rw-r--r--src/mame/drivers/hh_sm510.cpp197
-rw-r--r--src/mame/drivers/hh_ucom4.cpp1
-rw-r--r--src/mame/drivers/himesiki.cpp76
-rw-r--r--src/mame/drivers/hornet.cpp11
-rw-r--r--src/mame/drivers/hp9845.cpp13
-rw-r--r--src/mame/drivers/hvyunit.cpp1
-rw-r--r--src/mame/drivers/igs009.cpp72
-rw-r--r--src/mame/drivers/intv.cpp120
-rw-r--r--src/mame/drivers/inufuku.cpp1
-rw-r--r--src/mame/drivers/jaguar.cpp1
-rw-r--r--src/mame/drivers/jclub2.cpp8
-rw-r--r--src/mame/drivers/jongkyo.cpp45
-rw-r--r--src/mame/drivers/jungleyo.cpp158
-rw-r--r--src/mame/drivers/kaneko16.cpp19
-rw-r--r--src/mame/drivers/karnov.cpp6
-rw-r--r--src/mame/drivers/konamigx.cpp69
-rw-r--r--src/mame/drivers/ksys573.cpp21
-rw-r--r--src/mame/drivers/lastbank.cpp1
-rw-r--r--src/mame/drivers/leapster.cpp2
-rw-r--r--src/mame/drivers/lemmings.cpp2
-rw-r--r--src/mame/drivers/lethal.cpp5
-rw-r--r--src/mame/drivers/m92.cpp152
-rw-r--r--src/mame/drivers/macs.cpp164
-rw-r--r--src/mame/drivers/madmotor.cpp9
-rw-r--r--src/mame/drivers/magic10.cpp606
-rw-r--r--src/mame/drivers/mhavoc.cpp83
-rw-r--r--src/mame/drivers/mirage.cpp2
-rw-r--r--src/mame/drivers/model1.cpp6
-rw-r--r--src/mame/drivers/model2.cpp20
-rw-r--r--src/mame/drivers/model3.cpp39
-rw-r--r--src/mame/drivers/moo.cpp18
-rw-r--r--src/mame/drivers/mystwarr.cpp65
-rw-r--r--src/mame/drivers/n64.cpp5
-rw-r--r--src/mame/drivers/namcond1.cpp110
-rw-r--r--src/mame/drivers/naomi.cpp18
-rw-r--r--src/mame/drivers/nc.cpp1
-rw-r--r--src/mame/drivers/neogeo_noslot.cpp26
-rw-r--r--src/mame/drivers/ninjakd2.cpp66
-rw-r--r--src/mame/drivers/nmg5.cpp1
-rw-r--r--src/mame/drivers/nwk-tr.cpp8
-rw-r--r--src/mame/drivers/opwolf.cpp7
-rw-r--r--src/mame/drivers/overdriv.cpp6
-rw-r--r--src/mame/drivers/pbaction.cpp41
-rw-r--r--src/mame/drivers/pc.cpp15
-rw-r--r--src/mame/drivers/pcktgal.cpp2
-rw-r--r--src/mame/drivers/pengo.cpp43
-rw-r--r--src/mame/drivers/pipedrm.cpp1
-rw-r--r--src/mame/drivers/pktgaldx.cpp2
-rw-r--r--src/mame/drivers/playch10.cpp37
-rw-r--r--src/mame/drivers/qdrmfgp.cpp10
-rw-r--r--src/mame/drivers/r9751.cpp35
-rw-r--r--src/mame/drivers/raiden2.cpp37
-rw-r--r--src/mame/drivers/rastan.cpp1
-rw-r--r--src/mame/drivers/rbisland.cpp2
-rw-r--r--src/mame/drivers/rohga.cpp14
-rw-r--r--src/mame/drivers/rungun.cpp3
-rw-r--r--src/mame/drivers/sandscrp.cpp1
-rw-r--r--src/mame/drivers/segae.cpp67
-rw-r--r--src/mame/drivers/segag80r.cpp60
-rw-r--r--src/mame/drivers/segas16a.cpp66
-rw-r--r--src/mame/drivers/segas18.cpp2
-rw-r--r--src/mame/drivers/segas24.cpp2
-rw-r--r--src/mame/drivers/segasp.cpp2
-rw-r--r--src/mame/drivers/segaybd.cpp36
-rw-r--r--src/mame/drivers/senjyo.cpp84
-rw-r--r--src/mame/drivers/seta.cpp41
-rw-r--r--src/mame/drivers/sg1000a.cpp38
-rw-r--r--src/mame/drivers/silvmil.cpp1
-rw-r--r--src/mame/drivers/simpl156.cpp2
-rw-r--r--src/mame/drivers/simpsons.cpp5
-rw-r--r--src/mame/drivers/skylncr.cpp34
-rw-r--r--src/mame/drivers/slapshot.cpp2
-rw-r--r--src/mame/drivers/sms.cpp8
-rw-r--r--src/mame/drivers/snk68.cpp1
-rw-r--r--src/mame/drivers/snowbros.cpp1
-rw-r--r--src/mame/drivers/speglsht.cpp6
-rw-r--r--src/mame/drivers/spy.cpp2
-rw-r--r--src/mame/drivers/spyhuntertec.cpp92
-rw-r--r--src/mame/drivers/srmp2.cpp3
-rw-r--r--src/mame/drivers/sshangha.cpp3
-rw-r--r--src/mame/drivers/ssv.cpp1
-rw-r--r--src/mame/drivers/stadhero.cpp5
-rw-r--r--src/mame/drivers/subsino2.cpp18
-rw-r--r--src/mame/drivers/supbtime.cpp4
-rw-r--r--src/mame/drivers/super80.cpp1
-rw-r--r--src/mame/drivers/superchs.cpp1
-rw-r--r--src/mame/drivers/suprloco.cpp29
-rw-r--r--src/mame/drivers/suprslam.cpp1
-rw-r--r--src/mame/drivers/system1.cpp1085
-rw-r--r--src/mame/drivers/taito_f2.cpp40
-rw-r--r--src/mame/drivers/taito_h.cpp3
-rw-r--r--src/mame/drivers/taito_o.cpp1
-rw-r--r--src/mame/drivers/taito_x.cpp4
-rw-r--r--src/mame/drivers/taito_z.cpp2
-rw-r--r--src/mame/drivers/taitoair.cpp1
-rw-r--r--src/mame/drivers/taotaido.cpp1
-rw-r--r--src/mame/drivers/tasman.cpp54
-rw-r--r--src/mame/drivers/thedealr.cpp1
-rw-r--r--src/mame/drivers/thedeep.cpp3
-rw-r--r--src/mame/drivers/ti99_4p.cpp89
-rw-r--r--src/mame/drivers/ti99_4x.cpp237
-rw-r--r--src/mame/drivers/ti99_8.cpp498
-rw-r--r--src/mame/drivers/tnzs.cpp7
-rw-r--r--src/mame/drivers/topspeed.cpp2
-rw-r--r--src/mame/drivers/tourvis.cpp22
-rw-r--r--src/mame/drivers/triforce.cpp2
-rw-r--r--src/mame/drivers/tumbleb.cpp7
-rw-r--r--src/mame/drivers/tumblep.cpp2
-rw-r--r--src/mame/drivers/turbo.cpp47
-rw-r--r--src/mame/drivers/twincobr.cpp6
-rw-r--r--src/mame/drivers/undrfire.cpp2
-rw-r--r--src/mame/drivers/vaportra.cpp5
-rw-r--r--src/mame/drivers/vendetta.cpp7
-rw-r--r--src/mame/drivers/vsnes.cpp38
-rw-r--r--src/mame/drivers/welltris.cpp1
-rw-r--r--src/mame/drivers/xexex.cpp8
-rw-r--r--src/mame/drivers/xmen.cpp10
-rw-r--r--src/mame/drivers/zaxxon.cpp132
-rw-r--r--src/mame/drivers/zr107.cpp10
-rw-r--r--src/mame/includes/angelkds.h1
-rw-r--r--src/mame/includes/appoooh.h1
-rw-r--r--src/mame/includes/artmagic.h2
-rw-r--r--src/mame/includes/cybiko.h1
-rw-r--r--src/mame/includes/fidelz80.h1
-rw-r--r--src/mame/includes/harddriv.h5
-rw-r--r--src/mame/includes/intv.h10
-rw-r--r--src/mame/includes/konamigx.h4
-rw-r--r--src/mame/includes/model1.h19
-rw-r--r--src/mame/includes/model3.h3
-rw-r--r--src/mame/includes/naomi.h1
-rw-r--r--src/mame/includes/nb1414m4.h2
-rw-r--r--src/mame/includes/pbaction.h1
-rw-r--r--src/mame/includes/playch10.h1
-rw-r--r--src/mame/includes/segas18.h2
-rw-r--r--src/mame/includes/segaybd.h2
-rw-r--r--src/mame/includes/system1.h38
-rw-r--r--src/mame/includes/turbo.h1
-rw-r--r--src/mame/includes/xbox.h61
-rw-r--r--src/mame/includes/zaxxon.h2
-rw-r--r--src/mame/layout/cc40.lay30
-rw-r--r--src/mame/layout/fidel_sc12.lay115
-rw-r--r--src/mame/layout/fidel_sc9.lay437
-rw-r--r--src/mame/layout/lantutor.lay4
-rw-r--r--src/mame/layout/spyhunttec.lay174
-rw-r--r--src/mame/layout/ti74.lay12
-rw-r--r--src/mame/layout/ti95.lay6
-rw-r--r--src/mame/machine/awboard.cpp26
-rw-r--r--src/mame/machine/awboard.h7
-rw-r--r--src/mame/machine/dec_lk201.cpp25
-rw-r--r--src/mame/machine/decocass_tape.cpp17
-rw-r--r--src/mame/machine/decocass_tape.h1
-rw-r--r--src/mame/machine/fd1089.cpp17
-rw-r--r--src/mame/machine/fd1089.h3
-rw-r--r--src/mame/machine/fd1094.cpp36
-rw-r--r--src/mame/machine/fd1094.h7
-rw-r--r--src/mame/machine/harddriv.cpp16
-rw-r--r--src/mame/machine/intv.cpp93
-rw-r--r--src/mame/machine/m1comm.cpp2
-rw-r--r--src/mame/machine/m1comm.h1
-rw-r--r--src/mame/machine/m3comm.cpp437
-rw-r--r--src/mame/machine/m3comm.h82
-rw-r--r--src/mame/machine/mhavoc.cpp3
-rw-r--r--src/mame/machine/model1.cpp456
-rw-r--r--src/mame/machine/naomibd.cpp5
-rw-r--r--src/mame/machine/naomibd.h3
-rw-r--r--src/mame/machine/naomigd.h2
-rw-r--r--src/mame/machine/naomim1.cpp7
-rw-r--r--src/mame/machine/naomim1.h2
-rw-r--r--src/mame/machine/naomim2.cpp5
-rw-r--r--src/mame/machine/naomim2.h1
-rw-r--r--src/mame/machine/naomim4.cpp22
-rw-r--r--src/mame/machine/naomim4.h7
-rw-r--r--src/mame/machine/naomirom.cpp3
-rw-r--r--src/mame/machine/naomirom.h1
-rw-r--r--src/mame/machine/pc9801_118.cpp2
-rw-r--r--src/mame/machine/pc9801_26.cpp2
-rw-r--r--src/mame/machine/s32comm.cpp2
-rw-r--r--src/mame/machine/s32comm.h2
-rw-r--r--src/mame/machine/segacrp2.cpp124
-rw-r--r--src/mame/machine/segacrp2.h7
-rw-r--r--src/mame/machine/segacrp2_device.cpp371
-rw-r--r--src/mame/machine/segacrp2_device.h123
-rw-r--r--src/mame/machine/segacrpt.cpp254
-rw-r--r--src/mame/machine/segacrpt.h4
-rw-r--r--src/mame/machine/segacrpt_device.cpp1091
-rw-r--r--src/mame/machine/segacrpt_device.h296
-rw-r--r--src/mame/machine/segaic16.cpp22
-rw-r--r--src/mame/machine/segaic16.h6
-rw-r--r--src/mame/machine/st0016.cpp25
-rw-r--r--src/mame/machine/st0016.h9
-rw-r--r--src/mame/machine/xbox.cpp168
-rw-r--r--src/mame/machine/zs01.cpp3
-rw-r--r--src/mame/machine/zs01.h1
-rw-r--r--src/mame/mame.lst27
-rw-r--r--src/mame/nl.lst25
-rw-r--r--src/mame/osd/windows/mame/mame.icobin372526 -> 0 bytes
-rw-r--r--src/mame/osd/windows/mame/mame.man15
-rw-r--r--src/mame/osd/windows/mame/mame.rc14
-rw-r--r--src/mame/osd/windows/mess/mess.icobin372526 -> 0 bytes
-rw-r--r--src/mame/osd/windows/mess/mess.man15
-rw-r--r--src/mame/osd/windows/mess/mess.rc14
-rw-r--r--src/mame/video/733_asr.cpp19
-rw-r--r--src/mame/video/733_asr.h5
-rw-r--r--src/mame/video/911_vdt.cpp17
-rw-r--r--src/mame/video/911_vdt.h5
-rw-r--r--src/mame/video/atarirle.cpp13
-rw-r--r--src/mame/video/atarirle.h3
-rw-r--r--src/mame/video/battlex.cpp2
-rw-r--r--src/mame/video/bbusters.cpp8
-rw-r--r--src/mame/video/bfm_adr2.cpp90
-rw-r--r--src/mame/video/bfm_adr2.h7
-rw-r--r--src/mame/video/decbac06.h3
-rw-r--r--src/mame/video/deckarn.cpp13
-rw-r--r--src/mame/video/deckarn.h6
-rw-r--r--src/mame/video/decmxc06.cpp13
-rw-r--r--src/mame/video/decmxc06.h6
-rw-r--r--src/mame/video/deco16ic.cpp15
-rw-r--r--src/mame/video/deco16ic.h4
-rw-r--r--src/mame/video/deco_zoomspr.cpp13
-rw-r--r--src/mame/video/deco_zoomspr.h5
-rw-r--r--src/mame/video/decospr.cpp15
-rw-r--r--src/mame/video/decospr.h5
-rw-r--r--src/mame/video/k001604.cpp61
-rw-r--r--src/mame/video/k001604.h22
-rw-r--r--src/mame/video/k037122.cpp38
-rw-r--r--src/mame/video/k037122.h17
-rw-r--r--src/mame/video/k051316.cpp14
-rw-r--r--src/mame/video/k051316.h3
-rw-r--r--src/mame/video/k051960.cpp16
-rw-r--r--src/mame/video/k051960.h10
-rw-r--r--src/mame/video/k052109.cpp26
-rw-r--r--src/mame/video/k052109.h9
-rw-r--r--src/mame/video/k053244_k053245.cpp7
-rw-r--r--src/mame/video/k053244_k053245.h3
-rw-r--r--src/mame/video/k053246_k053247_k055673.cpp64
-rw-r--r--src/mame/video/k053246_k053247_k055673.h35
-rw-r--r--src/mame/video/k053250.cpp19
-rw-r--r--src/mame/video/k053250.h1
-rw-r--r--src/mame/video/k054156_k054157_k056832.cpp145
-rw-r--r--src/mame/video/k054156_k054157_k056832.h29
-rw-r--r--src/mame/video/kan_pand.cpp13
-rw-r--r--src/mame/video/kan_pand.h5
-rw-r--r--src/mame/video/konami_helper.cpp5
-rw-r--r--src/mame/video/konami_helper.h2
-rw-r--r--src/mame/video/mystwarr.cpp2
-rw-r--r--src/mame/video/pc080sn.cpp13
-rw-r--r--src/mame/video/pc080sn.h5
-rw-r--r--src/mame/video/pcd.cpp19
-rw-r--r--src/mame/video/pcd.h4
-rw-r--r--src/mame/video/powervr2.cpp2
-rw-r--r--src/mame/video/sega16sp.cpp37
-rw-r--r--src/mame/video/sega16sp.h17
-rw-r--r--src/mame/video/segaic24.cpp46
-rw-r--r--src/mame/video/segaic24.h11
-rw-r--r--src/mame/video/senjyo.cpp1
-rw-r--r--src/mame/video/seta001.cpp13
-rw-r--r--src/mame/video/seta001.h5
-rw-r--r--src/mame/video/snk68_spr.cpp11
-rw-r--r--src/mame/video/snk68_spr.h6
-rw-r--r--src/mame/video/st0020.cpp37
-rw-r--r--src/mame/video/st0020.h13
-rw-r--r--src/mame/video/tc0080vco.cpp15
-rw-r--r--src/mame/video/tc0080vco.h5
-rw-r--r--src/mame/video/tc0150rod.cpp5
-rw-r--r--src/mame/video/tc0150rod.h2
-rw-r--r--src/mame/video/tc0480scp.cpp15
-rw-r--r--src/mame/video/tc0480scp.h5
-rw-r--r--src/mame/video/vsystem_spr.cpp13
-rw-r--r--src/mame/video/vsystem_spr.h4
-rw-r--r--src/mame/video/vsystem_spr2.cpp13
-rw-r--r--src/mame/video/vsystem_spr2.h4
-rw-r--r--src/mame/video/vtvideo.cpp11
-rw-r--r--src/mame/video/vtvideo.h8
-rw-r--r--src/mame/video/ygv608.cpp168
-rw-r--r--src/mame/video/ygv608.h13
-rw-r--r--src/osd/eminline.h3
-rw-r--r--src/osd/modules/font/font_dwrite.cpp2
-rw-r--r--src/osd/modules/input/input_common.cpp2
-rw-r--r--src/osd/modules/input/input_common.h28
-rw-r--r--src/osd/modules/input/input_dinput.cpp572
-rw-r--r--src/osd/modules/input/input_dinput.h177
-rw-r--r--src/osd/modules/input/input_sdl.cpp35
-rw-r--r--src/osd/modules/input/input_winhybrid.cpp413
-rw-r--r--src/osd/modules/input/input_xinput.cpp406
-rw-r--r--src/osd/modules/input/input_xinput.h140
-rw-r--r--src/osd/modules/ipc/raw_tcp_connection.cpp29
-rw-r--r--src/osd/modules/ipc/raw_tcp_connection.h30
-rw-r--r--src/osd/modules/ipc/raw_tcp_server.cpp42
-rw-r--r--src/osd/modules/ipc/raw_tcp_server.h36
-rw-r--r--src/osd/modules/ipc/rtc_tcp_connection.cpp150
-rw-r--r--src/osd/modules/ipc/rtc_tcp_connection.h33
-rw-r--r--src/osd/modules/ipc/rtc_tcp_server.cpp42
-rw-r--r--src/osd/modules/ipc/rtc_tcp_server.h36
-rw-r--r--src/osd/modules/ipc/tcp_connection.cpp414
-rw-r--r--src/osd/modules/ipc/tcp_connection.h137
-rw-r--r--src/osd/modules/ipc/tcp_server.cpp279
-rw-r--r--src/osd/modules/ipc/tcp_server.h72
-rw-r--r--src/osd/modules/lib/osdlib.h10
-rw-r--r--src/osd/modules/lib/osdlib_macosx.cpp83
-rw-r--r--src/osd/modules/lib/osdlib_unix.cpp27
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp74
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp48
-rw-r--r--src/osd/modules/lib/osdobj_common.h11
-rw-r--r--src/osd/modules/opengl/gl_shader_mgr.h2
-rw-r--r--src/osd/modules/osdwindow.cpp8
-rw-r--r--src/osd/modules/osdwindow.h112
-rw-r--r--src/osd/modules/output/console.cpp32
-rw-r--r--src/osd/modules/output/network.cpp86
-rw-r--r--src/osd/modules/output/none.cpp32
-rw-r--r--src/osd/modules/output/output_module.h30
-rw-r--r--src/osd/modules/render/bgfx/chain.cpp13
-rw-r--r--src/osd/modules/render/bgfx/chain.h7
-rw-r--r--src/osd/modules/render/bgfx/chainentry.cpp3
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp414
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.h58
-rw-r--r--src/osd/modules/render/bgfx/chainreader.cpp7
-rw-r--r--src/osd/modules/render/bgfx/effectmanager.cpp4
-rw-r--r--src/osd/modules/render/bgfx/inputpair.cpp2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/default/fs_blit.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_blit.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/default/varying.def.sc6
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/default/vs_blit.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_blit.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc14
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_color.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_color.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_deconverge.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_deconverge.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_defocus.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_distortion.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_decode.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_ntsc_decode.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_encode.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_ntsc_encode.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_phosphor.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_phosphor.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_post.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_prescale.sc (renamed from src/osd/modules/render/bgfx/shaders/fs_prescale.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/varying.def.sc9
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc14
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_color.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_color.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_deconverge.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_deconverge.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_defocus.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_defocus.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_distortion.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_distortion.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_decode.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_ntsc_decode.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_encode.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_ntsc_encode.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_phosphor.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_phosphor.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_post.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_post.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_prescale.sc (renamed from src/osd/modules/render/bgfx/shaders/vs_prescale.sc)2
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/unfiltered/fs_blit.sc14
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/unfiltered/varying.def.sc6
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/unfiltered/vs_blit.sc14
-rw-r--r--src/osd/modules/render/bgfx/shaders/fs_gui.sc2
-rw-r--r--src/osd/modules/render/bgfx/shaders/fs_screen.sc2
-rw-r--r--src/osd/modules/render/bgfx/shaders/makefile22
-rw-r--r--src/osd/modules/render/bgfx/shaders/shader.mk147
-rw-r--r--src/osd/modules/render/bgfx/shaders/varying.def.sc4
-rw-r--r--src/osd/modules/render/bgfx/shaders/vs_gui.sc2
-rw-r--r--src/osd/modules/render/bgfx/shaders/vs_screen.sc2
-rw-r--r--src/osd/modules/render/bgfx/slider.cpp4
-rw-r--r--src/osd/modules/render/bgfx/statereader.cpp2
-rw-r--r--src/osd/modules/render/bgfx/statereader.h5
-rw-r--r--src/osd/modules/render/bgfx/target.cpp2
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.cpp28
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.h3
-rw-r--r--src/osd/modules/render/bgfx/targetreader.cpp23
-rw-r--r--src/osd/modules/render/bgfx/targetreader.h3
-rw-r--r--src/osd/modules/render/bgfx/texture.cpp2
-rw-r--r--src/osd/modules/render/bgfx/texturemanager.cpp35
-rw-r--r--src/osd/modules/render/bgfx/texturemanager.h1
-rw-r--r--src/osd/modules/render/bgfxutil.cpp67
-rw-r--r--src/osd/modules/render/bgfxutil.h18
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp69
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.h8
-rw-r--r--src/osd/modules/render/d3dtarget.h14
-rw-r--r--src/osd/modules/render/drawbgfx.cpp273
-rw-r--r--src/osd/modules/render/drawbgfx.h19
-rw-r--r--src/osd/modules/render/drawd3d.cpp15
-rw-r--r--src/osd/modules/render/drawd3d.h12
-rw-r--r--src/osd/modules/render/sdlglcontext.h1
-rw-r--r--src/osd/modules/render/sliderdirtynotifier.h22
-rw-r--r--src/osd/modules/sync/osdsync.cpp118
-rw-r--r--src/osd/modules/sync/osdsync.h222
-rw-r--r--src/osd/modules/sync/work_osd.cpp297
-rw-r--r--src/osd/osdcore.cpp23
-rw-r--r--src/osd/osdcore.h5
-rw-r--r--src/osd/osdepend.h5
-rw-r--r--src/osd/sdl/README_SDL20.txt130
-rw-r--r--src/osd/sdl/emscripten_post.js10
-rw-r--r--src/osd/sdl/ledutil.sh95
-rw-r--r--src/osd/sdl/main.cpp61
-rw-r--r--src/osd/sdl/man/LICENSE116
-rw-r--r--src/osd/sdl/man/README.md5
-rw-r--r--src/osd/sdl/man/castool.146
-rw-r--r--src/osd/sdl/man/chdman.1255
-rw-r--r--src/osd/sdl/man/floptool.147
-rw-r--r--src/osd/sdl/man/imgtool.1157
-rw-r--r--src/osd/sdl/man/jedutil.149
-rw-r--r--src/osd/sdl/man/ldplayer.152
-rw-r--r--src/osd/sdl/man/ldresample.146
-rw-r--r--src/osd/sdl/man/ldverify.125
-rw-r--r--src/osd/sdl/man/mame.61176
-rw-r--r--src/osd/sdl/man/mess.61183
-rw-r--r--src/osd/sdl/man/romcmp.156
-rw-r--r--src/osd/sdl/man/testkeys.127
-rw-r--r--src/osd/sdl/osdsdl.h10
-rw-r--r--src/osd/sdl/osxutils.h21
-rw-r--r--src/osd/sdl/osxutils.mm34
-rw-r--r--src/osd/sdl/output.cpp143
-rw-r--r--src/osd/sdl/sdlmain.cpp16
-rw-r--r--src/osd/sdl/sdlos_macosx.cpp101
-rw-r--r--src/osd/sdl/sdlos_unix.cpp50
-rw-r--r--src/osd/sdl/sdlos_win32.cpp102
-rw-r--r--src/osd/sdl/testkeys.cpp117
-rw-r--r--src/osd/sdl/video.cpp25
-rw-r--r--src/osd/sdl/video.h82
-rw-r--r--src/osd/sdl/watchdog.cpp9
-rw-r--r--src/osd/sdl/watchdog.h8
-rw-r--r--src/osd/sdl/window.cpp98
-rw-r--r--src/osd/sdl/window.h43
-rw-r--r--src/osd/strconv.h11
-rw-r--r--src/osd/windows/ledutil.cpp710
-rw-r--r--src/osd/windows/main.cpp32
-rw-r--r--src/osd/windows/output.cpp320
-rw-r--r--src/osd/windows/output.h86
-rw-r--r--src/osd/windows/video.cpp11
-rw-r--r--src/osd/windows/video.h70
-rw-r--r--src/osd/windows/winclip.cpp89
-rw-r--r--src/osd/windows/window.cpp27
-rw-r--r--src/osd/windows/window.h8
-rw-r--r--src/osd/windows/winmain.cpp228
-rw-r--r--src/osd/windows/winmain.h34
-rw-r--r--src/tools/aueffectutil-Info.plist (renamed from src/osd/sdl/aueffectutil-Info.plist)0
-rw-r--r--src/tools/aueffectutil.mm (renamed from src/osd/sdl/aueffectutil.mm)0
-rw-r--r--src/tools/unidasm.cpp6
828 files changed, 24274 insertions, 19661 deletions
diff --git a/src/devices/bus/a1bus/a1bus.cpp b/src/devices/bus/a1bus/a1bus.cpp
index c3ebc73c6de..5b29e44049f 100644
--- a/src/devices/bus/a1bus/a1bus.cpp
+++ b/src/devices/bus/a1bus/a1bus.cpp
@@ -7,7 +7,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "a1bus.h"
@@ -146,7 +145,7 @@ void a1bus_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mi
m_maincpu = machine().device<cpu_device>(m_cputag);
address_space &space = m_maincpu->space(AS_PROGRAM);
space.install_readwrite_bank(start, end, mask, mirror, tag );
- machine().root_device().membank(tag)->set_base(data);
+ machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
// interrupt request from a1bus card
diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp
index 5fd03495c87..2083a607690 100644
--- a/src/devices/bus/a2bus/a2bus.cpp
+++ b/src/devices/bus/a2bus/a2bus.cpp
@@ -71,7 +71,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "a2bus.h"
diff --git a/src/devices/bus/a2bus/a2eauxslot.cpp b/src/devices/bus/a2bus/a2eauxslot.cpp
index f1d4836d37b..c362c23abe5 100644
--- a/src/devices/bus/a2bus/a2eauxslot.cpp
+++ b/src/devices/bus/a2bus/a2eauxslot.cpp
@@ -9,7 +9,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "a2eauxslot.h"
diff --git a/src/devices/bus/a2bus/pc_xporter.cpp b/src/devices/bus/a2bus/pc_xporter.cpp
index 8159a5bd9b2..49d71fe455a 100644
--- a/src/devices/bus/a2bus/pc_xporter.cpp
+++ b/src/devices/bus/a2bus/pc_xporter.cpp
@@ -5,7 +5,7 @@
pcxporter.cpp
Implementation of the Applied Engineering PC Transporter card
- Preliminary version by R. Belmont
+ Preliminary version by R. Belmont, additional reverse-engineering by Peter Ferrie
The PC Transporter is basically a PC-XT on an Apple II card.
Features include:
@@ -37,18 +37,42 @@
plus used for general storage by the system.
RAM from 0xB0000-0xBFFFF is the CGA framebuffer as usual.
+ C800-CBFF?: RAM, used as scratchpad space by the software
CF00: PC memory pointer (bits 0-7)
CF01: PC memory pointer (bits 8-15)
CF02: PC memory pointer (bits 16-23)
CF03: read/write PC memory at the pointer and increment the pointer
CF04: read/write PC memory at the pointer and *don't* increment the pointer
+ CF2C: CGA 6845 register select (port 3D0/3D2/3D4/3D6)
+ CF2D: CGA 6845 data read/write (port 3D1/3D3/3D5/3D7)
+ CF2E: CGA mode select (port 3D8)
+ CF2F: CGA color select (port 3D9)
TODO:
- - A2 probably also can access the V30's I/O space: where's that at? CF0E/CF0F
- are suspects...
+ - What's going on at CF0E/CF0F?
+ - How is the V30 started/stopped?
- There's likely A2 ROM at CnXX and C800-CBFF to support the "Slinky" memory
expansion card emulation function inside one of the custom ASICs. Need to
dump this...
+
+ The final stages before the software settles into its loop are:
+
+ 20 to C800 at cf30
+ 00 to C800 at cf31
+ 12 to C800 at cf2b
+ 21 to C800 at cf25
+ 33 to C800 at cf24
+ 80 to C800 at cf31
+ 20 to C800 at cf30
+ loop:
+ Read $C800 at cf36
+ Read $C800 at cf31
+ Read $C800 at cf31
+ Read $C800 at cf36
+ Read $C800 at cf31
+ Read $C800 at cf31
+ 80 to C800 at cf31
+ loop end: (return to loop)
*********************************************************************/
@@ -176,7 +200,7 @@ UINT8 a2bus_pcxporter_device::read_c800(address_space &space, UINT16 offset)
if (offset < 0x400)
{
- return 0xff;
+ return m_c800_ram[offset];
}
else
{
@@ -195,12 +219,20 @@ UINT8 a2bus_pcxporter_device::read_c800(address_space &space, UINT16 offset)
case 0x703: // read with increment
rv = m_ram[m_offset];
- m_offset++;
+ // don't increment if the debugger's reading
+ if (!space.debugger_access())
+ {
+ m_offset++;
+ }
return rv;
case 0x704: // read w/o increment
rv = m_ram[m_offset];
- return rv;
+ return rv;
+
+ default:
+ printf("Read $C800 at %x\n", offset + 0xc800);
+ break;
}
return m_regs[offset];
@@ -214,6 +246,7 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN
{
if (offset < 0x400)
{
+ m_c800_ram[offset] = data;
}
else
{
@@ -245,6 +278,11 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN
case 0x704: // write w/o increment
m_ram[m_offset] = data;
break;
+
+ case 0x72c: // CGA 6845 register select
+ case 0x72d: // CGA 6845 data read/write
+ case 0x72e: // CGA mode select
+ break;
default:
printf("%02x to C800 at %x\n", data, offset + 0xc800);
diff --git a/src/devices/bus/a2bus/pc_xporter.h b/src/devices/bus/a2bus/pc_xporter.h
index f7359de699a..36675c09c04 100644
--- a/src/devices/bus/a2bus/pc_xporter.h
+++ b/src/devices/bus/a2bus/pc_xporter.h
@@ -44,6 +44,7 @@ protected:
private:
UINT8 m_ram[768*1024];
+ UINT8 m_c800_ram[0x400];
UINT8 m_regs[0x400];
UINT32 m_offset;
};
diff --git a/src/devices/bus/bml3/bml3bus.cpp b/src/devices/bus/bml3/bml3bus.cpp
index 0438cc58997..620743dbe68 100644
--- a/src/devices/bus/bml3/bml3bus.cpp
+++ b/src/devices/bus/bml3/bml3bus.cpp
@@ -43,7 +43,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "bml3bus.h"
diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp
index 66cbc1dc121..3e6b2ee2c6f 100644
--- a/src/devices/bus/coco/cococart.cpp
+++ b/src/devices/bus/coco/cococart.cpp
@@ -10,7 +10,6 @@
#include "emu.h"
#include "cococart.h"
-#include "emuopts.h"
/***************************************************************************
PARAMETERS
diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp
index 15aa7f88295..6929a01d6eb 100644
--- a/src/devices/bus/comx35/clm.cpp
+++ b/src/devices/bus/comx35/clm.cpp
@@ -175,6 +175,7 @@ machine_config_constructor comx_clm_device::device_mconfig_additions() const
comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, COMX_CLM, "COMX 80 Column Card", tag, owner, clock, "comx_clm", __FILE__),
device_comx_expansion_card_interface(mconfig, *this),
+ device_gfx_interface(mconfig, *this, nullptr, "palette"),
m_crtc(*this, MC6845_TAG),
m_palette(*this, "palette"),
m_rom(*this, "c000"),
diff --git a/src/devices/bus/comx35/clm.h b/src/devices/bus/comx35/clm.h
index 131a57b2cd9..5b2da54d905 100644
--- a/src/devices/bus/comx35/clm.h
+++ b/src/devices/bus/comx35/clm.h
@@ -24,7 +24,8 @@
// ======================> comx_clm_device
class comx_clm_device : public device_t,
- public device_comx_expansion_card_interface
+ public device_comx_expansion_card_interface,
+ public device_gfx_interface
{
public:
// construction/destruction
diff --git a/src/devices/bus/cpc/cpcexp.cpp b/src/devices/bus/cpc/cpcexp.cpp
index 69ad0887282..43b35ac57f2 100644
--- a/src/devices/bus/cpc/cpcexp.cpp
+++ b/src/devices/bus/cpc/cpcexp.cpp
@@ -9,7 +9,6 @@
#include "emu.h"
-#include "emuopts.h"
#include "cpcexp.h"
diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp
index 47236928fb7..18f2ca83c21 100644
--- a/src/devices/bus/gameboy/gb_slot.cpp
+++ b/src/devices/bus/gameboy/gb_slot.cpp
@@ -783,8 +783,7 @@ void base_gb_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len)
{0x5A01, "Bitmap Brothers/Mindscape"},
{0x5301, "American Sammy"},
{0x4701, "Spectrum Holobyte"},
- {0x1801, "Hudson Soft"},
- {0x0000, nullptr}
+ {0x1801, "Hudson Soft"}
};
static const int ramsize[8] = { 0, 2, 8, 32, 128, 64, 0, 0 };
@@ -817,24 +816,23 @@ void base_gb_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len)
soft[16] = '\0';
logerror("Cart Information\n");
logerror("\tName: %s\n", soft);
- logerror("\tType: %s [0x%2X]\n", (ROM[0x0147] <= 32) ? cart_types[ROM[0x0147]] : "", ROM[0x0147] );
+ logerror("\tType: %s [0x%02X]\n", (ROM[0x0147] <= 32) ? cart_types[ROM[0x0147]] : "", ROM[0x0147] );
logerror("\tGame Boy: %s\n", (ROM[0x0143] == 0xc0) ? "No" : "Yes" );
- logerror("\tSuper GB: %s [0x%2X]\n", (ROM[0x0146] == 0x03) ? "Yes" : "No", ROM[0x0146] );
- logerror("\tColor GB: %s [0x%2X]\n", (ROM[0x0143] == 0x80 || ROM[0x0143] == 0xc0) ? "Yes" : "No", ROM[0x0143] );
- logerror("\tROM Size: %d 16kB Banks [0x%2X]\n", rom_banks, ROM[0x0148]);
- logerror("\tRAM Size: %d kB [0x%2X]\n", ramsize[ROM[0x0149] & 0x07], ROM[0x0149]);
- logerror("\tLicense code: 0x%2X%2X\n", ROM[0x0145], ROM[0x0144] );
+ logerror("\tSuper GB: %s [0x%02X]\n", (ROM[0x0146] == 0x03) ? "Yes" : "No", ROM[0x0146] );
+ logerror("\tColor GB: %s [0x%02X]\n", (ROM[0x0143] == 0x80 || ROM[0x0143] == 0xc0) ? "Yes" : "No", ROM[0x0143] );
+ logerror("\tROM Size: %d 16kB Banks [0x%02X]\n", rom_banks, ROM[0x0148]);
+ logerror("\tRAM Size: %d kB [0x%02X]\n", ramsize[ROM[0x0149] & 0x07], ROM[0x0149]);
+ logerror("\tLicense code: 0x%02X%02X\n", ROM[0x0145], ROM[0x0144] );
tmp = (ROM[0x014b] << 8) + ROM[0x014a];
for (i = 0; i < ARRAY_LENGTH(companies); i++)
if (tmp == companies[i].code)
break;
- logerror("\tManufacturer ID: 0x%2X", tmp);
- logerror(" [%s]\n", (i < ARRAY_LENGTH(companies)) ? companies[i].name : "?");
- logerror("\tVersion Number: 0x%2X\n", ROM[0x014c]);
- logerror("\tComplement Check: 0x%2X\n", ROM[0x014d]);
- logerror("\tChecksum: 0x%2X\n", ((ROM[0x014e] << 8) + ROM[0x014f]));
+ logerror("\tManufacturer ID: 0x%02X [%s]\n", tmp, (i < ARRAY_LENGTH(companies)) ? companies[i].name : "?");
+ logerror("\tVersion Number: 0x%02X\n", ROM[0x014c]);
+ logerror("\tComplement Check: 0x%02X\n", ROM[0x014d]);
+ logerror("\tChecksum: 0x%04X\n", ((ROM[0x014e] << 8) + ROM[0x014f]));
tmp = (ROM[0x0103] << 8) + ROM[0x0102];
- logerror("\tStart Address: 0x%2X\n", tmp);
+ logerror("\tStart Address: 0x%04X\n", tmp);
// Additional checks
if (rom_banks == 256)
@@ -851,6 +849,6 @@ void base_gb_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len)
csum &= 0xffff;
if (csum != tmp)
- logerror("\nWarning loading cartridge: Checksum is wrong (Actual %X vs Internal %X)\n", csum, tmp);
+ logerror("\nWarning loading cartridge: Checksum is wrong (Actual 0x%04X vs Internal 0x%04X)\n", csum, tmp);
}
diff --git a/src/devices/bus/generic/slot.cpp b/src/devices/bus/generic/slot.cpp
index 4f3af4df411..5ac81616206 100644
--- a/src/devices/bus/generic/slot.cpp
+++ b/src/devices/bus/generic/slot.cpp
@@ -38,7 +38,8 @@ const device_type GENERIC_SOCKET = &device_creator<generic_slot_device>;
device_generic_cart_interface::device_generic_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_rom(nullptr),
- m_rom_size(0)
+ m_rom_size(0),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h
index 6a12c1cd84c..eaf901fd310 100644
--- a/src/devices/bus/generic/slot.h
+++ b/src/devices/bus/generic/slot.h
@@ -28,8 +28,8 @@ public:
virtual void rom_alloc(size_t size, int width, endianness_t end, const char *tag);
virtual void ram_alloc(UINT32 size);
- UINT8* get_rom_base() { return m_rom; }
- UINT32 get_rom_size() { return m_rom_size; }
+ UINT8* get_rom_base() { if (m_region.found()) return m_region->base(); return m_rom; }
+ UINT32 get_rom_size() { if (m_region.found()) return m_region->bytes(); return m_rom_size; }
UINT8* get_ram_base() { return &m_ram[0]; }
UINT32 get_ram_size() { return m_ram.size(); }
@@ -40,6 +40,9 @@ public:
UINT8 *m_rom;
UINT32 m_rom_size;
dynamic_buffer m_ram;
+
+ // this replaces m_rom for non-user configurable carts!
+ optional_memory_region m_region;
};
@@ -137,8 +140,8 @@ public:
virtual void rom_alloc(size_t size, int width, endianness_t end) { if (m_cart) m_cart->rom_alloc(size, width, end, tag()); }
virtual void ram_alloc(UINT32 size) { if (m_cart) m_cart->ram_alloc(size); }
- UINT8* get_rom_base() { if (m_cart) return m_cart->get_rom_base(); return nullptr; }
- UINT8* get_ram_base() { if (m_cart) return m_cart->get_ram_base(); return nullptr; }
+ UINT8* get_rom_base() { if (m_cart) return m_cart->get_rom_base(); return nullptr; }
+ UINT8* get_ram_base() { if (m_cart) return m_cart->get_ram_base(); return nullptr; }
UINT32 get_rom_size() { if (m_cart) return m_cart->get_rom_size(); return 0; }
void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
@@ -173,4 +176,9 @@ extern const device_type GENERIC_SOCKET;
MCFG_DEVICE_ADD(_tag, GENERIC_SOCKET, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, NULL, false) \
MCFG_GENERIC_INTERFACE(_dev_intf)
+
+#define MCFG_GENERIC_CARTSLOT_ADD_WITH_DEFAULT(_tag, _slot_intf, _dev_intf, _default) \
+ MCFG_DEVICE_ADD(_tag, GENERIC_SOCKET, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _default, false) \
+ MCFG_GENERIC_INTERFACE(_dev_intf)
#endif
diff --git a/src/devices/bus/intv/ecs.cpp b/src/devices/bus/intv/ecs.cpp
index b9da2d9803b..bbee4f3074b 100644
--- a/src/devices/bus/intv/ecs.cpp
+++ b/src/devices/bus/intv/ecs.cpp
@@ -31,15 +31,6 @@ intv_ecs_device::intv_ecs_device(const machine_config &mconfig, const char *tag,
: intv_rom_device(mconfig, INTV_ROM_ECS, "Intellivision ECS Expansion", tag, owner, clock, "intv_ecs", __FILE__),
m_snd(*this, "ay8914"),
m_subslot(*this, "subslot"),
- m_keybd(*this, "ROW"),
- m_synth(*this, "SYNTH"),
- m_cntrlsel(*this, "CNTRLSEL"),
- m_options(*this, "OPTIONS"),
- m_keypad(*this, "KEYPAD"),
- m_disc(*this, "DISC"),
- m_discx(*this, "DISCX"),
- m_discy(*this, "DISCY"),
- m_psg_porta(0),
m_voice_enabled(false),
m_ramd0_enabled(false),
m_ram88_enabled(false)
@@ -65,7 +56,6 @@ void intv_ecs_device::device_start()
}
save_item(NAME(m_bank_base));
- save_item(NAME(m_psg_porta));
}
void intv_ecs_device::device_reset()
@@ -102,135 +92,17 @@ void intv_ecs_device::late_subslot_setup()
// MACHINE_CONFIG_FRAGMENT( sub_slot )
//-------------------------------------------------
-UINT8 intv_ecs_device::intv_control_r(int hand)
-{
- static const UINT8 keypad_table[] =
- {
- 0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB,
- 0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E
- };
-
- static const UINT8 disc_table[] =
- {
- 0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE,
- 0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB
- };
-
- static const UINT8 discyx_table[5][5] =
- {
- { 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 },
- { 0xE7, 0xE3, 0xFB, 0xE9, 0xF9 },
- { 0xF7, 0xF7, 0xFF, 0xFD, 0xFD },
- { 0xF6, 0xE6, 0xFE, 0xEC, 0xED },
- { 0xE6, 0xEE, 0xFE, 0xFC, 0xEC }
- };
-
- int x, y;
- UINT8 val = 0xff;
-
- /* keypad */
- x = m_keypad[hand]->read();
- for (y = 0; y < 16; y++)
- {
- if (x & (1 << y))
- {
- val &= keypad_table[y];
- }
- }
-
- y = (m_options->read() >> ((hand + 2) * 2)) & 3;
- switch (y)
- {
- case 0: /* disc == digital 8-way */
- case 1: /* disc == digital 16-way */
- default:
-
- x = m_disc[hand]->read();
- if (!!x && (!y || !(x & 0x7777)))
- {
- // merge cardinals to form true diagonals
- y = ((x >> 2) & (x << 2)) | ((x >> (16 - 2)) & (x >> 2));
- x = y | (x & ~((y << 2) | (y >> 2) | (y << (16 - 2))));
- }
-
- // only one disc direction is allowed
- x &= -x;
-
- for (y = 0; y < 16; y++)
- {
- if (x & (1 << y))
- {
- val &= disc_table[y];
- }
- }
- break;
-
- case 2: /* disc == _fake_ analog */
-
- x = m_discx[hand]->read();
- y = m_discy[hand]->read();
- val &= discyx_table[y / 32][x / 32];
- }
-
- return val;
-}
-
-READ8_MEMBER( intv_ecs_device::ay_porta_r )
-{
- if (m_cntrlsel->read() == 0)
- return intv_control_r(0);
- else
- return 0xff; // not sure what to return here, maybe it should be last output?
-}
-
-READ8_MEMBER( intv_ecs_device::ay_portb_r )
-{
- switch (m_cntrlsel->read())
- {
- case 0x00: // hand controller
- return intv_control_r(1);
-
- case 0x01: // synthesizer keyboard
- {
- UINT8 val = 0xff;
- // return correct result if more than one bit of 0xFE is set
- for (int i = 0; i < 7; i++)
- {
- if (BIT(m_psg_porta, i))
- val &= m_synth[i]->read();
- }
- return val;
- }
- case 0x02: // ecs keyboard
- {
- UINT8 val = 0xff;
- // return correct result if more than one bit of 0xFE is set
- for (int i = 0; i < 7; i++)
- {
- if (BIT(m_psg_porta, i))
- val &= m_keybd[i]->read();
- }
- return val;
- }
- default:
- return 0xff;
- }
-}
-
-WRITE8_MEMBER( intv_ecs_device::ay_porta_w )
-{
- m_psg_porta = (~data) & 0xff;
-}
static MACHINE_CONFIG_FRAGMENT( sub_slot )
MCFG_SPEAKER_STANDARD_MONO("mono_ecs")
MCFG_SOUND_ADD("ay8914", AY8914, XTAL_3_579545MHz/2)
- MCFG_AY8910_PORT_A_READ_CB(READ8(intv_ecs_device, ay_porta_r))
- MCFG_AY8910_PORT_B_READ_CB(READ8(intv_ecs_device, ay_portb_r))
- MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(intv_ecs_device, ay_porta_w))
+ MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("ctrl_port", intvecs_control_port_device, portA_r))
+ MCFG_AY8910_PORT_B_READ_CB(DEVREAD8("ctrl_port", intvecs_control_port_device, portB_r))
+ MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("ctrl_port", intvecs_control_port_device, portA_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono_ecs", 0.33)
+ MCFG_INTVECS_CONTROL_PORT_ADD("ctrl_port", intvecs_control_port_devices, "keybd")
MCFG_INTV_CARTRIDGE_ADD("subslot", intv_cart, nullptr)
MACHINE_CONFIG_END
@@ -254,294 +126,6 @@ const rom_entry *intv_ecs_device::device_rom_region() const
}
-static INPUT_PORTS_START( intv_ecs_kbd )
-/*
- ECS matrix scanned by setting 0xFE bits to output and reading 0xFF
- ECS Keyboard Layout:
- FF\FE Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
- Bit 0 NC RTN 0 ESC P ; . (left)
- Bit 1 L O 8 9 I K M ,
- Bit 2 J U 6 7 Y H B N
- Bit 3 G T 4 5 R F C V
- Bit 4 D E 2 3 W S Z X
- Bit 5 A CTL (right) 1 Q (up) (down) (space)
- Bit 6 SHIFT NC NC NC NC NC NC NC
-
- Shifted keys that differ from pc:
- Key : 1 2 5 6 7 (left) (right) (up) (down)
- Shift + key: = " + - / % ' ^ ?
- */
-
- PORT_START("ROW.0")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('%') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.1")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.2")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('-') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.3")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.4")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.5")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_RCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('\'') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('=') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('^') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('?') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
-
- PORT_START("ROW.6")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
-INPUT_PORTS_END
-
-static INPUT_PORTS_START( intv_ecs_synth )
-/*
- ECS Synthesizer Layout:
- FF\FE Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
- Bit 0 G2 Gb2 F2 E2 Eb2 D2 Db2 C2
- Bit 1 Eb3 D3 Db3 C3 B2 Bb2 A2 Ab2
- Bit 2 B3 Bb3 A3 Ab3 G3 Gb3 F3 E3
- Bit 3 G4 Gb4 F4 E4 Eb4 D4 Db4 C4
- Bit 4 Eb5 D5 Db5 C5 B4 Bb4 A4 Ab4
- Bit 5 B5 Bb5 A5 Ab5 G5 Gb5 F5 E5
- Bit 6 C6 NC NC NC NC NC NC NC
- */
- PORT_START("SYNTH.0")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.1")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.2")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.3")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.4")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.5")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
-
- PORT_START("SYNTH.6")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C6") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x01)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
-INPUT_PORTS_END
-
-static INPUT_PORTS_START( intv_ecs_pads )
- // First ECS Hand Controller
- PORT_START("KEYPAD.0")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 1") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 6") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 7") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 8") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 9") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 Clear") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 0") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P3 Enter") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 Upper") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 Lower-Left") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P3 Lower-Right") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("DISC.0")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("P3 Up") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,NOTEQUALS,0x20)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Up-Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Right-Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("P3 Right") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,NOTEQUALS,0x20)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Right-Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Down-Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("P3 Down") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,NOTEQUALS,0x20)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Down-Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Left-Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("P3 Left") PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,NOTEQUALS,0x20)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Left-Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Up-Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x10)
-
- PORT_START("DISCX.0")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("P3 X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x20)
-
- PORT_START("DISCY.0")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("P3 Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_PLAYER(3) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0x30,EQUALS,0x20)
-
- // Second ECS Hand Controller
- PORT_START("KEYPAD.1")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 1") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 2") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 3") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 4") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 5") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 6") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 7") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 8") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 9") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 Clear") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 0") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P4 Enter") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 Upper") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 Lower-Left") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P4 Lower-Right") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("DISC.1")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("P4 Up") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,NOTEQUALS,0x80)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Up-Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Right-Up-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("P4 Right") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,NOTEQUALS,0x80)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Right-Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Down-Down-Right") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("P4 Down") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,NOTEQUALS,0x80)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Down-Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Left-Down-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("P4 Left") PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,NOTEQUALS,0x80)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Left-Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Up-Up-Left") PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x40)
-
- PORT_START("DISCX.1")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("P4 X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x80)
-
- PORT_START("DISCY.1")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("P4 Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_PLAYER(4) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00) PORT_CONDITION("OPTIONS",0xC0,EQUALS,0x80)
-INPUT_PORTS_END
-
-static INPUT_PORTS_START( intv_ecs )
- PORT_INCLUDE( intv_ecs_pads )
- PORT_INCLUDE( intv_ecs_synth )
- PORT_INCLUDE( intv_ecs_kbd )
-
- PORT_START("OPTIONS")
- PORT_CONFNAME( 0x30, 0x00, "ECS P3 Disc" ) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_CONFSETTING( 0x00, "Digital 8-way" )
- PORT_CONFSETTING( 0x10, "Digital 16-way" )
- PORT_CONFSETTING( 0x20, "Analog" )
- PORT_CONFNAME( 0xC0, 0x00, "ECS P4 Disc" ) PORT_CONDITION("CNTRLSEL",0x0f,EQUALS,0x00)
- PORT_CONFSETTING( 0x00, "Digital 8-way" )
- PORT_CONFSETTING( 0x40, "Digital 16-way" )
- PORT_CONFSETTING( 0x80, "Analog" )
-
- PORT_START("CNTRLSEL")
- PORT_CONFNAME( 0x0F, 0x02, "ECS Controller")
- PORT_CONFSETTING( 0x00, "Gamepads" )
- PORT_CONFSETTING( 0x01, "Piano" )
- PORT_CONFSETTING( 0x02, "Keyboard" )
-INPUT_PORTS_END
-
-ioport_constructor intv_ecs_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( intv_ecs );
-}
-
-
/*-------------------------------------------------
Paged ROM handling
-------------------------------------------------*/
diff --git a/src/devices/bus/intv/ecs.h b/src/devices/bus/intv/ecs.h
index 3dc2f37e7b6..ce22d4f7481 100644
--- a/src/devices/bus/intv/ecs.h
+++ b/src/devices/bus/intv/ecs.h
@@ -6,7 +6,7 @@
#include "slot.h"
#include "rom.h"
#include "sound/ay8910.h"
-
+#include "bus/intv_ctrl/ecs_ctrl.h"
// ======================> intv_ecs_device
@@ -21,7 +21,6 @@ public:
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
- virtual ioport_constructor device_input_ports() const override;
virtual const rom_entry *device_rom_region() const override;
// reading and writing
@@ -38,9 +37,6 @@ public:
// AY8914
virtual DECLARE_READ16_MEMBER(read_ay) override;
virtual DECLARE_WRITE16_MEMBER(write_ay) override;
- DECLARE_READ8_MEMBER(ay_porta_r);
- DECLARE_READ8_MEMBER(ay_portb_r);
- DECLARE_WRITE8_MEMBER(ay_porta_w);
// passthru accesses
virtual DECLARE_READ16_MEMBER(read_rom04) override { return m_subslot->read_rom04(space, offset, mem_mask); }
@@ -117,30 +113,16 @@ public:
virtual void late_subslot_setup() override;
- UINT8 intv_control_r(int hand);
-
private:
required_device<ay8914_device> m_snd;
required_device<intv_cart_slot_device> m_subslot;
- required_ioport_array<7> m_keybd;
- required_ioport_array<7> m_synth;
- required_ioport m_cntrlsel;
- required_ioport m_options;
- required_ioport_array<2> m_keypad;
- required_ioport_array<2> m_disc;
- required_ioport_array<2> m_discx;
- required_ioport_array<2> m_discy;
int m_bank_base[0x10];
- UINT8 m_psg_porta;
bool m_voice_enabled, m_ramd0_enabled, m_ram88_enabled;
};
-
-
-
// device type definition
extern const device_type INTV_ROM_ECS;
diff --git a/src/devices/bus/intv_ctrl/ctrl.cpp b/src/devices/bus/intv_ctrl/ctrl.cpp
new file mode 100644
index 00000000000..4d57c558d0e
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/ctrl.cpp
@@ -0,0 +1,95 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision controller port emulation
+
+**********************************************************************/
+
+#include "ctrl.h"
+// slot devices
+#include "handctrl.h"
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type INTV_CONTROL_PORT = &device_creator<intv_control_port_device>;
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_intv_control_port_interface - constructor
+//-------------------------------------------------
+
+device_intv_control_port_interface::device_intv_control_port_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+ m_port = dynamic_cast<intv_control_port_device *>(device.owner());
+}
+
+
+//-------------------------------------------------
+// ~device_intv_control_port_interface - destructor
+//-------------------------------------------------
+
+device_intv_control_port_interface::~device_intv_control_port_interface()
+{
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// intv_control_port_device - constructor
+//-------------------------------------------------
+
+intv_control_port_device::intv_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, INTV_CONTROL_PORT, "Mattel Intellivision control port", tag, owner, clock, "intv_control_port", __FILE__),
+ device_slot_interface(mconfig, *this), m_device(nullptr)
+{
+}
+
+
+//-------------------------------------------------
+// intv_control_port_device - destructor
+//-------------------------------------------------
+
+intv_control_port_device::~intv_control_port_device()
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void intv_control_port_device::device_start()
+{
+ m_device = dynamic_cast<device_intv_control_port_interface *>(get_card_device());
+}
+
+
+UINT8 intv_control_port_device::read_ctrl()
+{
+ UINT8 data = 0;
+ if (m_device)
+ data |= m_device->read_ctrl();
+ return data;
+}
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( intv_control_port_devices )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( intv_control_port_devices )
+ SLOT_INTERFACE("handctrl", INTV_HANDCTRL)
+SLOT_INTERFACE_END
+
diff --git a/src/devices/bus/intv_ctrl/ctrl.h b/src/devices/bus/intv_ctrl/ctrl.h
new file mode 100644
index 00000000000..b29891efe87
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/ctrl.h
@@ -0,0 +1,76 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision controller port emulation
+
+**********************************************************************/
+
+
+#pragma once
+
+#ifndef __INTV_CONTROL_PORT__
+#define __INTV_CONTROL_PORT__
+
+#include "emu.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class intv_control_port_device;
+
+// ======================> device_intv_control_port_interface
+
+class device_intv_control_port_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_intv_control_port_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_intv_control_port_interface();
+
+ virtual UINT8 read_ctrl() { return 0; };
+
+protected:
+ intv_control_port_device *m_port;
+};
+
+// ======================> intv_control_port_device
+
+class intv_control_port_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ intv_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~intv_control_port_device();
+
+ DECLARE_READ8_MEMBER( ctrl_r ) { return read_ctrl(); }
+ UINT8 read_ctrl();
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ device_intv_control_port_interface *m_device;
+};
+
+
+// device type definition
+extern const device_type INTV_CONTROL_PORT;
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INTV_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, INTV_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
+SLOT_INTERFACE_EXTERN( intv_control_port_devices );
+
+
+#endif
diff --git a/src/devices/bus/intv_ctrl/ecs_ctrl.cpp b/src/devices/bus/intv_ctrl/ecs_ctrl.cpp
new file mode 100644
index 00000000000..19bc059531a
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/ecs_ctrl.cpp
@@ -0,0 +1,448 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision ECS hack for controller port emulation
+
+ FIXME: This device is the best I could come up with to emulate
+ the fact that Keyboard and Synth controllers for the ECS should be
+ plugged in both ECS control ports, while the 3rd and 4th additional
+ hand controller should only be plugged in a single port.
+ Since the core currently does not allow a single device mounted
+ in more than a slot, this has been worked around with this device
+ which supports as options
+ - ECS keyboard
+ - ECS synth
+ - a pair of Intellivision controller
+
+ All the code for both the controller port and the slot devices has
+ been included in this single source file to make easier to clean
+ them up once we extend the core to support this kind of setup
+ (necessary for Atari 2600 Compumate as well)
+
+**********************************************************************/
+
+#include "ecs_ctrl.h"
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type INTVECS_CONTROL_PORT = &device_creator<intvecs_control_port_device>;
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_intvecs_control_port_interface - constructor
+//-------------------------------------------------
+
+device_intvecs_control_port_interface::device_intvecs_control_port_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+ m_port = dynamic_cast<intvecs_control_port_device *>(device.owner());
+}
+
+
+//-------------------------------------------------
+// ~device_intvecs_control_port_interface - destructor
+//-------------------------------------------------
+
+device_intvecs_control_port_interface::~device_intvecs_control_port_interface()
+{
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// intvecs_control_port_device - constructor
+//-------------------------------------------------
+
+intvecs_control_port_device::intvecs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, INTVECS_CONTROL_PORT, "Mattel Intellivision ECS control port (HACK)", tag, owner, clock, "intvecs_control_port", __FILE__),
+ device_slot_interface(mconfig, *this), m_device(nullptr)
+{
+}
+
+
+//-------------------------------------------------
+// intvecs_control_port_device - destructor
+//-------------------------------------------------
+
+intvecs_control_port_device::~intvecs_control_port_device()
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void intvecs_control_port_device::device_start()
+{
+ m_device = dynamic_cast<device_intvecs_control_port_interface *>(get_card_device());
+}
+
+
+UINT8 intvecs_control_port_device::read_portA()
+{
+ UINT8 data = 0;
+ if (m_device)
+ data |= m_device->read_portA();
+ return data;
+}
+
+UINT8 intvecs_control_port_device::read_portB()
+{
+ UINT8 data = 0;
+ if (m_device)
+ data |= m_device->read_portB();
+ return data;
+}
+
+void intvecs_control_port_device::write_portA(UINT8 data)
+{
+ if (m_device)
+ m_device->write_portA(data);
+}
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( intvecs_control_port_devices )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( intvecs_control_port_devices )
+ SLOT_INTERFACE("ctrls", ECS_CTRLS)
+ SLOT_INTERFACE("keybd", ECS_KEYBD)
+ SLOT_INTERFACE("synth", ECS_SYNTH)
+SLOT_INTERFACE_END
+
+
+
+
+
+//**************************************************************************
+// ACTUAL SLOT DEVICES - included here until core issues are solved...
+//**************************************************************************
+
+
+//-------------------------------------------------
+// ECS_CTRLS - A pair of hand controllers
+//-------------------------------------------------
+
+const device_type ECS_CTRLS = &device_creator<intvecs_ctrls_device>;
+
+static SLOT_INTERFACE_START( intvecs_controller )
+ SLOT_INTERFACE("handctrl", INTV_HANDCTRL)
+SLOT_INTERFACE_END
+
+static MACHINE_CONFIG_FRAGMENT( intvecs_ctrls )
+ MCFG_INTV_CONTROL_PORT_ADD("port1", intvecs_controller, "handctrl")
+ MCFG_INTV_CONTROL_PORT_ADD("port2", intvecs_controller, "handctrl")
+MACHINE_CONFIG_END
+
+
+machine_config_constructor intvecs_ctrls_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( intvecs_ctrls );
+}
+
+intvecs_ctrls_device::intvecs_ctrls_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, ECS_CTRLS, "Mattel Intellivision ECS Hand Controller x2 (HACK)", tag, owner, clock, "intvecs_ctrls", __FILE__),
+ device_intvecs_control_port_interface(mconfig, *this),
+ m_hand1(*this, "port1"),
+ m_hand2(*this, "port2")
+{
+}
+
+void intvecs_ctrls_device::device_start()
+{
+}
+
+void intvecs_ctrls_device::device_reset()
+{
+}
+
+UINT8 intvecs_ctrls_device::read_portA()
+{
+ return m_hand1->read_ctrl();
+}
+
+UINT8 intvecs_ctrls_device::read_portB()
+{
+ return m_hand2->read_ctrl();
+}
+
+//-------------------------------------------------
+// ECS_KEYBD - Keyboard
+//-------------------------------------------------
+
+const device_type ECS_KEYBD = &device_creator<intvecs_keybd_device>;
+
+static INPUT_PORTS_START( intvecs_keybd )
+/*
+ ECS matrix scanned by setting 0xFE bits to output and reading 0xFF
+ ECS Keyboard Layout:
+ FF\FE Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
+ Bit 0 NC RTN 0 ESC P ; . (left)
+ Bit 1 L O 8 9 I K M ,
+ Bit 2 J U 6 7 Y H B N
+ Bit 3 G T 4 5 R F C V
+ Bit 4 D E 2 3 W S Z X
+ Bit 5 A CTL (right) 1 Q (up) (down) (space)
+ Bit 6 SHIFT NC NC NC NC NC NC NC
+
+ Shifted keys that differ from pc:
+ Key : 1 2 5 6 7 (left) (right) (up) (down)
+ Shift + key: = " + - / % ' ^ ?
+ */
+
+ PORT_START("ROW.0")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('%')
+
+ PORT_START("ROW.1")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
+
+ PORT_START("ROW.2")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('-')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
+
+ PORT_START("ROW.3")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
+
+ PORT_START("ROW.4")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
+
+ PORT_START("ROW.5")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_RCONTROL) PORT_CODE(KEYCODE_LCONTROL)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('\'')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('=')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('^')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('?')
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
+
+ PORT_START("ROW.6")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
+INPUT_PORTS_END
+
+ioport_constructor intvecs_keybd_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( intvecs_keybd );
+}
+
+intvecs_keybd_device::intvecs_keybd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, ECS_KEYBD, "Mattel Intellivision ECS Keyboard", tag, owner, clock, "intvecs_keybd", __FILE__),
+ device_intvecs_control_port_interface(mconfig, *this),
+ m_keybd(*this, "ROW")
+{
+}
+
+void intvecs_keybd_device::device_start()
+{
+ save_item(NAME(m_psg_portA));
+}
+
+void intvecs_keybd_device::device_reset()
+{
+ m_psg_portA = 0;
+}
+
+UINT8 intvecs_keybd_device::read_portB()
+{
+ UINT8 val = 0xff;
+ // return correct result if more than one bit of 0xFE is set
+ for (int i = 0; i < 7; i++)
+ {
+ if (BIT(m_psg_portA, i))
+ val &= m_keybd[i]->read();
+ }
+ return val;
+}
+
+void intvecs_keybd_device::write_portA(UINT8 data)
+{
+ m_psg_portA = (~data) & 0xff;
+}
+
+
+
+//-------------------------------------------------
+// ECS_SYNTH - Synth
+//-------------------------------------------------
+
+const device_type ECS_SYNTH = &device_creator<intvecs_synth_device>;
+
+
+static INPUT_PORTS_START( intvecs_synth )
+/*
+ ECS Synthesizer Layout:
+ FF\FE Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
+ Bit 0 G2 Gb2 F2 E2 Eb2 D2 Db2 C2
+ Bit 1 Eb3 D3 Db3 C3 B2 Bb2 A2 Ab2
+ Bit 2 B3 Bb3 A3 Ab3 G3 Gb3 F3 E3
+ Bit 3 G4 Gb4 F4 E4 Eb4 D4 Db4 C4
+ Bit 4 Eb5 D5 Db5 C5 B4 Bb4 A4 Ab4
+ Bit 5 B5 Bb5 A5 Ab5 G5 Gb5 F5 E5
+ Bit 6 C6 NC NC NC NC NC NC NC
+ */
+ PORT_START("SYNTH.0")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G2")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb2")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E2")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb2")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D2")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C2")
+
+ PORT_START("SYNTH.1")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb3")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D3")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db3")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb2")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab2")
+
+ PORT_START("SYNTH.2")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B3")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb3")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A3")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab3")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G3")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb3")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E3")
+
+ PORT_START("SYNTH.3")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G4")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb4")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E4")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb4")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C4")
+
+ PORT_START("SYNTH.4")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Eb5")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D5")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Db5")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C5")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B4")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb4")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab4")
+
+ PORT_START("SYNTH.5")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B5")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bb5")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A5")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ab5")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G5")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gb5")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5")
+
+ PORT_START("SYNTH.6")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C6")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
+INPUT_PORTS_END
+
+
+ioport_constructor intvecs_synth_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( intvecs_synth );
+}
+
+
+intvecs_synth_device::intvecs_synth_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, ECS_SYNTH, "Mattel Intellivision ECS Synthetizer", tag, owner, clock, "intvecs_synth", __FILE__),
+ device_intvecs_control_port_interface(mconfig, *this),
+ m_synth(*this, "SYNTH")
+{
+}
+
+void intvecs_synth_device::device_start()
+{
+ save_item(NAME(m_psg_portA));
+}
+
+void intvecs_synth_device::device_reset()
+{
+ m_psg_portA = 0;
+}
+
+UINT8 intvecs_synth_device::read_portB()
+{
+ UINT8 val = 0xff;
+ // return correct result if more than one bit of 0xFE is set
+ for (int i = 0; i < 7; i++)
+ {
+ if (BIT(m_psg_portA, i))
+ val &= m_synth[i]->read();
+ }
+ return val;
+}
+
+void intvecs_synth_device::write_portA(UINT8 data)
+{
+ m_psg_portA = (~data) & 0xff;
+}
+
diff --git a/src/devices/bus/intv_ctrl/ecs_ctrl.h b/src/devices/bus/intv_ctrl/ecs_ctrl.h
new file mode 100644
index 00000000000..40d94ca5d1b
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/ecs_ctrl.h
@@ -0,0 +1,171 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision ECS hack for controller port emulation
+
+**********************************************************************/
+
+
+#pragma once
+
+#ifndef __INTVECS_CONTROL_PORT__
+#define __INTVECS_CONTROL_PORT__
+
+#include "emu.h"
+#include "bus/intv_ctrl/ctrl.h"
+#include "bus/intv_ctrl/handctrl.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class intvecs_control_port_device;
+
+// ======================> device_intvecs_control_port_interface
+
+class device_intvecs_control_port_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_intvecs_control_port_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_intvecs_control_port_interface();
+
+ virtual UINT8 read_portA() { return 0xff; };
+ virtual UINT8 read_portB() { return 0xff; };
+ virtual void write_portA(UINT8 data) { };
+
+protected:
+ intvecs_control_port_device *m_port;
+};
+
+// ======================> intvecs_control_port_device
+
+class intvecs_control_port_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ intvecs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~intvecs_control_port_device();
+
+ DECLARE_READ8_MEMBER( portA_r ) { return read_portA(); }
+ DECLARE_READ8_MEMBER( portB_r ) { return read_portB(); }
+ DECLARE_WRITE8_MEMBER( portA_w ) { return write_portA(data); }
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ UINT8 read_portA();
+ UINT8 read_portB();
+ void write_portA(UINT8 data);
+
+ device_intvecs_control_port_interface *m_device;
+};
+
+
+// device type definition
+extern const device_type INTVECS_CONTROL_PORT;
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_INTVECS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, INTVECS_CONTROL_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
+SLOT_INTERFACE_EXTERN( intvecs_control_port_devices );
+
+
+//**************************************************************************
+// ACTUAL SLOT DEVICES - included here until core issues are solved...
+//**************************************************************************
+
+// ======================> intvecs_ctrls_device
+
+class intvecs_ctrls_device : public device_t,
+ public device_intvecs_control_port_interface
+{
+public:
+ // construction/destruction
+ intvecs_ctrls_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual UINT8 read_portA() override;
+ virtual UINT8 read_portB() override;
+
+private:
+ required_device<intv_control_port_device> m_hand1;
+ required_device<intv_control_port_device> m_hand2;
+};
+
+// ======================> intvecs_keybd_device
+
+class intvecs_keybd_device : public device_t,
+ public device_intvecs_control_port_interface
+{
+public:
+ // construction/destruction
+ intvecs_keybd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual UINT8 read_portB() override;
+ virtual void write_portA(UINT8 data) override;
+
+private:
+ UINT8 m_psg_portA;
+ required_ioport_array<7> m_keybd;
+};
+
+// ======================> intvecs_synth_device
+
+class intvecs_synth_device : public device_t,
+ public device_intvecs_control_port_interface
+{
+public:
+ // construction/destruction
+ intvecs_synth_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual UINT8 read_portB() override;
+ virtual void write_portA(UINT8 data) override;
+
+private:
+ UINT8 m_psg_portA;
+ required_ioport_array<7> m_synth;
+};
+
+
+// device type definition
+extern const device_type ECS_CTRLS;
+extern const device_type ECS_KEYBD;
+extern const device_type ECS_SYNTH;
+
+
+
+#endif
diff --git a/src/devices/bus/intv_ctrl/handctrl.cpp b/src/devices/bus/intv_ctrl/handctrl.cpp
new file mode 100644
index 00000000000..512f9f32adc
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/handctrl.cpp
@@ -0,0 +1,179 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision Hand Controllers
+
+**********************************************************************/
+
+#include "handctrl.h"
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type INTV_HANDCTRL = &device_creator<intv_handctrl_device>;
+
+
+static INPUT_PORTS_START( intv_handctrl )
+ PORT_START("KEYPAD")
+ PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
+ PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
+ PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)
+ PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)
+ PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)
+ PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
+ PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
+ PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)
+ PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
+ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Clear") PORT_CODE(KEYCODE_DEL_PAD)
+ PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)
+ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER_PAD)
+ PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Upper") PORT_PLAYER(1)
+ PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Lower-Left") PORT_PLAYER(1)
+ PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Lower-Right") PORT_PLAYER(1)
+ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED )
+
+ PORT_START("DISC_DG")
+ PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Up") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Up-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Down-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Down") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Down-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Up-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
+
+ PORT_START("DISC_AN_X")
+ PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01)
+
+ PORT_START("DISC_AN_Y")
+ PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01)
+
+
+ PORT_START("OPTIONS")
+ PORT_CONFNAME( 0x01, 0x01, "Controller Disc Emulation" )
+ PORT_CONFSETTING( 0x00, "Digital" )
+ PORT_CONFSETTING( 0x01, "Analog" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor intv_handctrl_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( intv_handctrl );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// intv_handctrl_device - constructor
+//-------------------------------------------------
+
+intv_handctrl_device::intv_handctrl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, INTV_HANDCTRL, "Mattel Intellivision Hand Controller", tag, owner, clock, "intv_hand", __FILE__),
+ device_intv_control_port_interface(mconfig, *this),
+ m_cfg(*this, "OPTIONS"),
+ m_keypad(*this, "KEYPAD"),
+ m_disc_dig(*this, "DISC_DG"),
+ m_disc_anx(*this, "DISC_AN_X"),
+ m_disc_any(*this, "DISC_AN_Y")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void intv_handctrl_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void intv_handctrl_device::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// read_ctrl
+//-------------------------------------------------
+
+UINT8 intv_handctrl_device::read_ctrl()
+{
+ static const UINT8 keypad_table[] =
+ {
+ 0xff, 0x3f, 0x9f, 0x5f, 0xd7, 0xb7, 0x77, 0xdb,
+ 0xbb, 0x7b, 0xdd, 0xbd, 0x7d, 0xde, 0xbe, 0x7e
+ };
+
+ static const UINT8 disc_table[] =
+ {
+ 0xf3, 0xe3, 0xe7, 0xf7, 0xf6, 0xe6, 0xee, 0xfe,
+ 0xfc, 0xec, 0xed, 0xfd, 0xf9, 0xe9, 0xeb, 0xfb
+ };
+
+ static const UINT8 discyx_table[5][5] =
+ {
+ { 0xe3, 0xf3, 0xfb, 0xeb, 0xe9 },
+ { 0xe7, 0xe3, 0xfb, 0xe9, 0xf9 },
+ { 0xf7, 0xf7, 0xff, 0xfd, 0xfd },
+ { 0xf6, 0xe6, 0xfe, 0xec, 0xed },
+ { 0xe6, 0xee, 0xfe, 0xfc, 0xec }
+ };
+
+ int x, y;
+ UINT8 res = 0xff;
+
+ /* keypad */
+ x = m_keypad->read();
+ for (int i = 0; i < 16; i++)
+ {
+ if (BIT(x, i))
+ res &= keypad_table[i];
+ }
+
+ switch (m_cfg->read() & 1)
+ {
+ /* disc == digital */
+ case 0:
+ default:
+ x = m_disc_dig->read();
+ for (int i = 0; i < 16; i++)
+ {
+ if (BIT(x, i))
+ res &= disc_table[i];
+ }
+ break;
+
+ /* disc == _fake_ analog */
+ case 1:
+ x = m_disc_anx->read();
+ y = m_disc_any->read();
+ res &= discyx_table[y / 32][x / 32];
+ break;
+ }
+
+ return res;
+}
+
diff --git a/src/devices/bus/intv_ctrl/handctrl.h b/src/devices/bus/intv_ctrl/handctrl.h
new file mode 100644
index 00000000000..5b6fc4a3fb9
--- /dev/null
+++ b/src/devices/bus/intv_ctrl/handctrl.h
@@ -0,0 +1,55 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli
+/**********************************************************************
+
+ Mattel Intellivision Hand Controller
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __INTV_HANDCTRL__
+#define __INTV_HANDCTRL__
+
+
+#include "emu.h"
+#include "ctrl.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> intv_handctrl_device
+
+class intv_handctrl_device : public device_t,
+ public device_intv_control_port_interface
+{
+public:
+ // construction/destruction
+ intv_handctrl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // device_intv_control_port_interface overrides
+ virtual UINT8 read_ctrl() override;
+
+private:
+ required_ioport m_cfg;
+ required_ioport m_keypad;
+ required_ioport m_disc_dig;
+ required_ioport m_disc_anx;
+ required_ioport m_disc_any;
+};
+
+
+// device type definition
+extern const device_type INTV_HANDCTRL;
+
+
+#endif
diff --git a/src/devices/bus/iq151/iq151.cpp b/src/devices/bus/iq151/iq151.cpp
index 3d4ef7abe05..16839150b5a 100644
--- a/src/devices/bus/iq151/iq151.cpp
+++ b/src/devices/bus/iq151/iq151.cpp
@@ -8,7 +8,6 @@
#include "emu.h"
#include "iq151.h"
-#include "emuopts.h"
#define LOG 0
diff --git a/src/devices/bus/iq151/video32.cpp b/src/devices/bus/iq151/video32.cpp
index a5ce59a51db..91724700a03 100644
--- a/src/devices/bus/iq151/video32.cpp
+++ b/src/devices/bus/iq151/video32.cpp
@@ -36,13 +36,6 @@ static const gfx_layout iq151_video32_charlayout =
8*8 /* every char takes 8 bytes */
};
-static GFXDECODE_START( video32 )
-GFXDECODE_END
-
-static MACHINE_CONFIG_FRAGMENT( video32 )
- MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video32)
-MACHINE_CONFIG_END
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -59,9 +52,8 @@ const device_type IQ151_VIDEO32 = &device_creator<iq151_video32_device>;
iq151_video32_device::iq151_video32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, IQ151_VIDEO32, "IQ151 video32", tag, owner, clock, "iq151_video32", __FILE__),
- device_iq151cart_interface( mconfig, *this ), m_videoram(nullptr), m_chargen(nullptr),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "^^palette")
+ device_gfx_interface(mconfig, *this, nullptr, "^^palette"),
+ device_iq151cart_interface( mconfig, *this ), m_videoram(nullptr), m_chargen(nullptr)
{
}
@@ -75,7 +67,7 @@ void iq151_video32_device::device_start()
m_videoram = (UINT8*)memregion("videoram")->base();
m_chargen = (UINT8*)memregion("chargen")->base();
- m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, iq151_video32_charlayout, m_chargen, 0, 1, 0));
+ set_gfx(0, std::make_unique<gfx_element>(palette(), iq151_video32_charlayout, m_chargen, 0, 1, 0));
}
//-------------------------------------------------
@@ -92,16 +84,6 @@ void iq151_video32_device::device_reset()
}
//-------------------------------------------------
-// machine_config_additions - device-specific
-// machine configurations
-//-------------------------------------------------
-
-machine_config_constructor iq151_video32_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( video32 );
-}
-
-//-------------------------------------------------
// device_rom_region
//-------------------------------------------------
diff --git a/src/devices/bus/iq151/video32.h b/src/devices/bus/iq151/video32.h
index d8b3a1e93eb..10937728696 100644
--- a/src/devices/bus/iq151/video32.h
+++ b/src/devices/bus/iq151/video32.h
@@ -16,6 +16,7 @@
class iq151_video32_device :
public device_t,
+ public device_gfx_interface,
public device_iq151cart_interface
{
public:
@@ -24,7 +25,6 @@ public:
// optional information overrides
virtual const rom_entry *device_rom_region() const override;
- virtual machine_config_constructor device_mconfig_additions() const override;
protected:
// device-level overrides
@@ -39,8 +39,6 @@ protected:
private:
UINT8 * m_videoram;
UINT8 * m_chargen;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
diff --git a/src/devices/bus/iq151/video64.cpp b/src/devices/bus/iq151/video64.cpp
index d58cca76aec..afb7462804d 100644
--- a/src/devices/bus/iq151/video64.cpp
+++ b/src/devices/bus/iq151/video64.cpp
@@ -36,13 +36,6 @@ static const gfx_layout iq151_video64_charlayout =
8*8 /* every char takes 8 bytes */
};
-static GFXDECODE_START( video64 )
-GFXDECODE_END
-
-static MACHINE_CONFIG_FRAGMENT( video64 )
- MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video64)
-MACHINE_CONFIG_END
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -59,9 +52,8 @@ const device_type IQ151_VIDEO64 = &device_creator<iq151_video64_device>;
iq151_video64_device::iq151_video64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, IQ151_VIDEO64, "IQ151 video64", tag, owner, clock, "iq151_video64", __FILE__),
- device_iq151cart_interface( mconfig, *this ), m_videoram(nullptr), m_chargen(nullptr),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "^^palette")
+ device_gfx_interface(mconfig, *this, nullptr, "^^palette"),
+ device_iq151cart_interface( mconfig, *this ), m_videoram(nullptr), m_chargen(nullptr)
{
}
@@ -74,7 +66,7 @@ void iq151_video64_device::device_start()
m_videoram = (UINT8*)memregion("videoram")->base();
m_chargen = (UINT8*)memregion("chargen")->base();
- m_gfxdecode->set_gfx(0,std::make_unique<gfx_element>(m_palette, iq151_video64_charlayout, m_chargen, 0, 1, 0));
+ set_gfx(0,std::make_unique<gfx_element>(palette(), iq151_video64_charlayout, m_chargen, 0, 1, 0));
}
//-------------------------------------------------
@@ -91,16 +83,6 @@ void iq151_video64_device::device_reset()
}
//-------------------------------------------------
-// machine_config_additions - device-specific
-// machine configurations
-//-------------------------------------------------
-
-machine_config_constructor iq151_video64_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( video64 );
-}
-
-//-------------------------------------------------
// device_rom_region
//-------------------------------------------------
diff --git a/src/devices/bus/iq151/video64.h b/src/devices/bus/iq151/video64.h
index 0162e107e31..f8d6d675f45 100644
--- a/src/devices/bus/iq151/video64.h
+++ b/src/devices/bus/iq151/video64.h
@@ -16,6 +16,7 @@
class iq151_video64_device :
public device_t,
+ public device_gfx_interface,
public device_iq151cart_interface
{
public:
@@ -24,7 +25,6 @@ public:
// optional information overrides
virtual const rom_entry *device_rom_region() const override;
- virtual machine_config_constructor device_mconfig_additions() const override;
protected:
// device-level overrides
@@ -40,8 +40,6 @@ protected:
private:
UINT8 * m_videoram;
UINT8 * m_chargen;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp
index 9b07bdce8e0..8f1dac61ccb 100644
--- a/src/devices/bus/isa/isa.cpp
+++ b/src/devices/bus/isa/isa.cpp
@@ -7,7 +7,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "isa.h"
@@ -323,7 +322,7 @@ void isa8_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t m
void isa8_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data)
{
m_prgspace->install_readwrite_bank(start, end, mask, mirror, tag );
- machine().root_device().membank(tag)->set_base(data);
+ machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
void isa8_device::unmap_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror)
@@ -340,7 +339,7 @@ void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, offs_t ma
} else {
m_prgspace->install_read_bank(start, end, mask, mirror, tag);
m_prgspace->unmap_write(start, end, mask, mirror);
- machine().root_device().membank(tag)->set_base(machine().root_device().memregion(dev->subtag(region).c_str())->base());
+ machine().root_device().membank(siblingtag(tag).c_str())->set_base(machine().root_device().memregion(dev->subtag(region).c_str())->base());
}
}
diff --git a/src/devices/bus/kc/kc.cpp b/src/devices/bus/kc/kc.cpp
index a5a46802998..05afba8ed7a 100644
--- a/src/devices/bus/kc/kc.cpp
+++ b/src/devices/bus/kc/kc.cpp
@@ -106,7 +106,6 @@
#include "emu.h"
#include "kc.h"
-#include "emuopts.h"
#define LOG 0
diff --git a/src/devices/bus/kc/rom.cpp b/src/devices/bus/kc/rom.cpp
index 404089110a0..883b36eb739 100644
--- a/src/devices/bus/kc/rom.cpp
+++ b/src/devices/bus/kc/rom.cpp
@@ -43,7 +43,7 @@ const device_type KC_M033 = &device_creator<kc_m033_device>;
//-------------------------------------------------
kc_8k_device::kc_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, KC_STANDARD, "Standard", tag, owner, clock, "kc_8k", __FILE__),
+ : device_t(mconfig, KC_STANDARD, "Standard 8K ROM module", tag, owner, clock, "kc_8k", __FILE__),
device_kcexp_interface( mconfig, *this ), m_slot(nullptr), m_mei(0), m_rom(nullptr), m_enabled(0), m_base(0)
{
}
diff --git a/src/devices/bus/macpds/macpds.cpp b/src/devices/bus/macpds/macpds.cpp
index 61fae5f3a17..bc626ac1831 100644
--- a/src/devices/bus/macpds/macpds.cpp
+++ b/src/devices/bus/macpds/macpds.cpp
@@ -9,7 +9,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "macpds.h"
@@ -127,7 +126,7 @@ void macpds_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t m
m_maincpu = machine().device<cpu_device>(m_cputag);
address_space &space = m_maincpu->space(AS_PROGRAM);
space.install_readwrite_bank(start, end, mask, mirror, tag );
- machine().root_device().membank(tag)->set_base(data);
+ machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
void macpds_device::set_irq_line(int line, int state)
diff --git a/src/devices/bus/msx_slot/bunsetsu.cpp b/src/devices/bus/msx_slot/bunsetsu.cpp
index 1289a84704b..e7cc47e4c2a 100644
--- a/src/devices/bus/msx_slot/bunsetsu.cpp
+++ b/src/devices/bus/msx_slot/bunsetsu.cpp
@@ -13,36 +13,12 @@ const device_type MSX_SLOT_BUNSETSU = &device_creator<msx_slot_bunsetsu_device>;
msx_slot_bunsetsu_device::msx_slot_bunsetsu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: msx_slot_rom_device(mconfig, MSX_SLOT_BUNSETSU, "MSX Internal BUNSETSU", tag, owner, clock, "msx_slot_bunsetsu", __FILE__)
- , m_bunsetsu_region(nullptr)
- , m_bunsetsu_region_tag(nullptr)
+ , m_bunsetsu_region(*this, 0x20000)
, m_bunsetsu_address(0)
{
}
-void msx_slot_bunsetsu_device::device_start()
-{
- msx_slot_rom_device::device_start();
-
- if (m_bunsetsu_region_tag == nullptr)
- {
- fatalerror("msx_slot_bunsetsu_device: no bunsetsu region tag specified\n");
- }
-
- m_bunsetsu_region = owner()->memregion(m_bunsetsu_region_tag);
-
- if (m_bunsetsu_region == nullptr)
- {
- fatalerror("msx_slot_bunsetsu_device: Unable to find region with tag '%s'\n", m_bunsetsu_region_tag);
- }
-
- if (m_bunsetsu_region->bytes() != 0x20000)
- {
- fatalerror("msx_slot_bunsetsu_device: Bunsetsu region must be 0x20000 bytes.\n");
- }
-}
-
-
void msx_slot_bunsetsu_device::device_reset()
{
m_bunsetsu_address = 0;
@@ -53,7 +29,7 @@ READ8_MEMBER(msx_slot_bunsetsu_device::read)
{
if (offset == 0xbfff)
{
- return m_bunsetsu_region->u8(m_bunsetsu_address++ & 0x1ffff);
+ return m_bunsetsu_region[m_bunsetsu_address++ & 0x1ffff];
}
return msx_slot_rom_device::read(space, offset);
}
diff --git a/src/devices/bus/msx_slot/bunsetsu.h b/src/devices/bus/msx_slot/bunsetsu.h
index 701e6bb8640..90e1cbd5bf5 100644
--- a/src/devices/bus/msx_slot/bunsetsu.h
+++ b/src/devices/bus/msx_slot/bunsetsu.h
@@ -12,25 +12,23 @@ extern const device_type MSX_SLOT_BUNSETSU;
#define MCFG_MSX_SLOT_BUNSETSU_ADD(_tag, _startpage, _numpages, _region, _offset, _bunsetsu_region_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_BUNSETSU, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
- msx_slot_bunsetsu_device::set_bunsetsu_region_tag(*device, _bunsetsu_region_tag);
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
+ msx_slot_bunsetsu_device::set_bunsetsu_region_tag(*device, "^" _bunsetsu_region_tag);
class msx_slot_bunsetsu_device : public msx_slot_rom_device
{
public:
msx_slot_bunsetsu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration helpers
- static void set_bunsetsu_region_tag(device_t &device, const char *tag) { dynamic_cast<msx_slot_bunsetsu_device &>(device).m_bunsetsu_region_tag = tag; }
+ static void set_bunsetsu_region_tag(device_t &device, const char *tag) { dynamic_cast<msx_slot_bunsetsu_device &>(device).m_bunsetsu_region.set_tag(tag); }
- virtual void device_start() override;
virtual void device_reset() override;
virtual DECLARE_READ8_MEMBER(read) override;
virtual DECLARE_WRITE8_MEMBER(write) override;
private:
- memory_region *m_bunsetsu_region;
- const char *m_bunsetsu_region_tag;
+ required_region_ptr<UINT8> m_bunsetsu_region;
UINT32 m_bunsetsu_address;
};
diff --git a/src/devices/bus/msx_slot/disk.h b/src/devices/bus/msx_slot/disk.h
index fb0bdad5cdf..d5ce0982f82 100644
--- a/src/devices/bus/msx_slot/disk.h
+++ b/src/devices/bus/msx_slot/disk.h
@@ -27,35 +27,35 @@ extern const device_type MSX_SLOT_DISK6;
#define MCFG_MSX_SLOT_DISK1_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK1, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag);
#define MCFG_MSX_SLOT_DISK2_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK2, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag);
#define MCFG_MSX_SLOT_DISK3_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK3, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag);
#define MCFG_MSX_SLOT_DISK4_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK4, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag);
#define MCFG_MSX_SLOT_DISK5_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag, _floppy2_tag, _floppy3_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK5, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag); \
@@ -64,7 +64,7 @@ extern const device_type MSX_SLOT_DISK6;
#define MCFG_MSX_SLOT_DISK6_ADD(_tag, _startpage, _numpages, _region, _offset, _fdc_tag, _floppy0_tag, _floppy1_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_DISK6, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_disk_device::set_fdc_tag(*device, _fdc_tag); \
msx_slot_disk_device::set_floppy0_tag(*device, _floppy0_tag); \
msx_slot_disk_device::set_floppy1_tag(*device, _floppy1_tag);
diff --git a/src/devices/bus/msx_slot/fs4600.cpp b/src/devices/bus/msx_slot/fs4600.cpp
index e6d6d8b9b9f..8c33b51a692 100644
--- a/src/devices/bus/msx_slot/fs4600.cpp
+++ b/src/devices/bus/msx_slot/fs4600.cpp
@@ -15,7 +15,7 @@ msx_slot_fs4600_device::msx_slot_fs4600_device(const machine_config &mconfig, co
: device_t(mconfig, MSX_SLOT_FS4600, "MSX Internal FS4600 Firmware", tag, owner, clock, "msx_slot_fs4600", __FILE__)
, msx_internal_slot_interface()
, m_nvram(*this, "nvram")
- , m_region(nullptr)
+ , m_rom_region(*this)
, m_region_offset(0)
, m_rom(nullptr)
, m_sram_address(0)
@@ -45,25 +45,17 @@ void msx_slot_fs4600_device::set_rom_start(device_t &device, const char *region,
{
msx_slot_fs4600_device &dev = downcast<msx_slot_fs4600_device &>(device);
- dev.m_region = region;
+ dev.m_rom_region.set_tag(region);
dev.m_region_offset = offset;
}
void msx_slot_fs4600_device::device_start()
{
- assert(m_region != nullptr );
-
- memory_region *m_rom_region = owner()->memregion(m_region);
-
// Sanity checks
- if (m_rom_region == nullptr )
- {
- fatalerror("Rom slot '%s': Unable to find memory region '%s'\n", tag(), m_region);
- }
if (m_rom_region->bytes() < m_region_offset + 0x100000)
{
- fatalerror("Memory region '%s' is too small for the FS4600 firmware\n", m_region);
+ fatalerror("Memory region '%s' is too small for the FS4600 firmware\n", m_rom_region.finder_tag());
}
m_rom = m_rom_region->base() + m_region_offset;
diff --git a/src/devices/bus/msx_slot/fs4600.h b/src/devices/bus/msx_slot/fs4600.h
index 57ae25aa47e..a1b0cdb4792 100644
--- a/src/devices/bus/msx_slot/fs4600.h
+++ b/src/devices/bus/msx_slot/fs4600.h
@@ -12,7 +12,7 @@ extern const device_type MSX_SLOT_FS4600;
#define MCFG_MSX_SLOT_FS4600_ADD(_tag, _startpage, _numpages, _region, _offset) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_FS4600, _startpage, _numpages) \
- msx_slot_fs4600_device::set_rom_start(*device, _region, _offset);
+ msx_slot_fs4600_device::set_rom_start(*device, "^" _region, _offset);
class msx_slot_fs4600_device : public device_t,
public msx_internal_slot_interface
@@ -33,7 +33,7 @@ public:
private:
required_device<nvram_device> m_nvram;
- const char *m_region;
+ required_memory_region m_rom_region;
UINT32 m_region_offset;
const UINT8 *m_rom;
UINT8 m_selected_bank[4];
diff --git a/src/devices/bus/msx_slot/music.h b/src/devices/bus/msx_slot/music.h
index eb2501b6746..3165982aaf0 100644
--- a/src/devices/bus/msx_slot/music.h
+++ b/src/devices/bus/msx_slot/music.h
@@ -14,7 +14,7 @@ extern const device_type MSX_SLOT_MUSIC;
#define MCFG_MSX_SLOT_MUSIC_ADD(_tag, _startpage, _numpages, _region, _offset, _ym2413_tag) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_MUSIC, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset); \
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset); \
msx_slot_music_device::set_ym2413_tag(*device, _ym2413_tag);
class msx_slot_music_device : public msx_slot_rom_device
{
diff --git a/src/devices/bus/msx_slot/panasonic08.cpp b/src/devices/bus/msx_slot/panasonic08.cpp
index ec9fdcf20ea..b6da40189e7 100644
--- a/src/devices/bus/msx_slot/panasonic08.cpp
+++ b/src/devices/bus/msx_slot/panasonic08.cpp
@@ -20,7 +20,7 @@ msx_slot_panasonic08_device::msx_slot_panasonic08_device(const machine_config &m
: device_t(mconfig, MSX_SLOT_PANASONIC08, "MSX Internal Panasonic08", tag, owner, clock, "msx_slot_panasonic08", __FILE__)
, msx_internal_slot_interface()
, m_nvram(*this, "nvram")
- , m_region(nullptr)
+ , m_rom_region(*this)
, m_region_offset(0)
, m_rom(nullptr)
, m_control(0)
@@ -48,25 +48,17 @@ void msx_slot_panasonic08_device::set_rom_start(device_t &device, const char *re
{
msx_slot_panasonic08_device &dev = downcast<msx_slot_panasonic08_device &>(device);
- dev.m_region = region;
+ dev.m_rom_region.set_tag(region);
dev.m_region_offset = offset;
}
void msx_slot_panasonic08_device::device_start()
{
- assert(m_region != nullptr );
-
- memory_region *m_rom_region = owner()->memregion(m_region);
-
// Sanity checks
- if (m_rom_region == nullptr )
- {
- fatalerror("Rom slot '%s': Unable to find memory region '%s'\n", tag(), m_region);
- }
if (m_rom_region->bytes() < m_region_offset + 0x200000)
{
- fatalerror("Memory region '%s' is too small for the FS4600 firmware\n", m_region);
+ fatalerror("Memory region '%s' is too small for the FS4600 firmware\n", m_rom_region.finder_tag());
}
m_sram.resize(0x4000);
diff --git a/src/devices/bus/msx_slot/panasonic08.h b/src/devices/bus/msx_slot/panasonic08.h
index d42ebd308f5..18295c78598 100644
--- a/src/devices/bus/msx_slot/panasonic08.h
+++ b/src/devices/bus/msx_slot/panasonic08.h
@@ -12,7 +12,7 @@ extern const device_type MSX_SLOT_PANASONIC08;
#define MCFG_MSX_SLOT_PANASONIC08_ADD(_tag, _startpage, _numpages, _region, _offset) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_PANASONIC08, _startpage, _numpages) \
- msx_slot_panasonic08_device::set_rom_start(*device, _region, _offset);
+ msx_slot_panasonic08_device::set_rom_start(*device, "^" _region, _offset);
class msx_slot_panasonic08_device : public device_t,
public msx_internal_slot_interface
@@ -33,7 +33,7 @@ public:
private:
required_device<nvram_device> m_nvram;
- const char *m_region;
+ required_memory_region m_rom_region;
UINT32 m_region_offset;
const UINT8 *m_rom;
UINT8 m_selected_bank[8];
diff --git a/src/devices/bus/msx_slot/rom.cpp b/src/devices/bus/msx_slot/rom.cpp
index 2d4593bed2b..5a6bef72e91 100644
--- a/src/devices/bus/msx_slot/rom.cpp
+++ b/src/devices/bus/msx_slot/rom.cpp
@@ -10,7 +10,7 @@ const device_type MSX_SLOT_ROM = &device_creator<msx_slot_rom_device>;
msx_slot_rom_device::msx_slot_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MSX_SLOT_ROM, "MSX Internal ROM", tag, owner, clock, "msx_slot_rom", __FILE__)
, msx_internal_slot_interface()
- , m_region(nullptr)
+ , m_rom_region(*this)
, m_region_offset(0)
, m_rom(nullptr)
{
@@ -20,7 +20,7 @@ msx_slot_rom_device::msx_slot_rom_device(const machine_config &mconfig, const ch
msx_slot_rom_device::msx_slot_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
, msx_internal_slot_interface()
- , m_region(nullptr)
+ , m_rom_region(*this)
, m_region_offset(0)
, m_rom(nullptr)
{
@@ -31,25 +31,17 @@ void msx_slot_rom_device::set_rom_start(device_t &device, const char *region, UI
{
msx_slot_rom_device &dev = downcast<msx_slot_rom_device &>(device);
- dev.m_region = region;
+ dev.m_rom_region.set_tag(region);
dev.m_region_offset = offset;
}
void msx_slot_rom_device::device_start()
{
- assert(m_region != nullptr );
-
- memory_region *m_rom_region = owner()->memregion(m_region);
-
// Sanity checks
- if (m_rom_region == nullptr )
- {
- fatalerror("Rom slot '%s': Unable to find memory region '%s'\n", tag(), m_region);
- }
if (m_rom_region->bytes() < m_region_offset + m_size)
{
- fatalerror("Memory region '%s' is too small for rom slot '%s'\n", m_region, tag());
+ fatalerror("Memory region '%s' is too small for rom slot '%s'\n", m_rom_region.finder_tag(), tag());
}
m_rom = m_rom_region->base() + m_region_offset;
diff --git a/src/devices/bus/msx_slot/rom.h b/src/devices/bus/msx_slot/rom.h
index e46fea28186..98679eaa452 100644
--- a/src/devices/bus/msx_slot/rom.h
+++ b/src/devices/bus/msx_slot/rom.h
@@ -7,7 +7,7 @@
#define MCFG_MSX_SLOT_ROM_ADD(_tag, _startpage, _numpages, _region, _offset) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_ROM, _startpage, _numpages) \
- msx_slot_rom_device::set_rom_start(*device, _region, _offset);
+ msx_slot_rom_device::set_rom_start(*device, "^" _region, _offset);
class msx_slot_rom_device : public device_t,
public msx_internal_slot_interface
@@ -24,7 +24,7 @@ public:
virtual DECLARE_READ8_MEMBER(read) override;
private:
- const char *m_region;
+ required_memory_region m_rom_region;
UINT32 m_region_offset;
const UINT8 *m_rom;
};
diff --git a/src/devices/bus/msx_slot/sony08.cpp b/src/devices/bus/msx_slot/sony08.cpp
index 2f48869c291..551f69062a7 100644
--- a/src/devices/bus/msx_slot/sony08.cpp
+++ b/src/devices/bus/msx_slot/sony08.cpp
@@ -17,7 +17,7 @@ msx_slot_sony08_device::msx_slot_sony08_device(const machine_config &mconfig, co
: device_t(mconfig, MSX_SLOT_SONY08, "MSX Internal SONY08", tag, owner, clock, "msx_slot_sony08", __FILE__)
, msx_internal_slot_interface()
, m_nvram(*this, "nvram")
- , m_region(nullptr)
+ , m_rom_region(*this)
, m_region_offset(0)
, m_rom(nullptr)
{
@@ -45,25 +45,17 @@ void msx_slot_sony08_device::set_rom_start(device_t &device, const char *region,
{
msx_slot_sony08_device &dev = downcast<msx_slot_sony08_device &>(device);
- dev.m_region = region;
+ dev.m_rom_region.set_tag(region);
dev.m_region_offset = offset;
}
void msx_slot_sony08_device::device_start()
{
- assert(m_region != nullptr );
-
- memory_region *m_rom_region = owner()->memregion(m_region);
-
// Sanity checks
- if (m_rom_region == nullptr )
- {
- fatalerror("Rom slot '%s': Unable to find memory region '%s'\n", tag(), m_region);
- }
if (m_rom_region->bytes() < m_region_offset + 0x100000)
{
- fatalerror("Memory region '%s' is too small for the SONY08 firmware\n", m_region);
+ fatalerror("Memory region '%s' is too small for the SONY08 firmware\n", m_rom_region.finder_tag());
}
m_rom = m_rom_region->base() + m_region_offset;
diff --git a/src/devices/bus/msx_slot/sony08.h b/src/devices/bus/msx_slot/sony08.h
index ebef6145c4f..87b10934511 100644
--- a/src/devices/bus/msx_slot/sony08.h
+++ b/src/devices/bus/msx_slot/sony08.h
@@ -12,7 +12,7 @@ extern const device_type MSX_SLOT_SONY08;
#define MCFG_MSX_SLOT_SONY08_ADD(_tag, _startpage, _numpages, _region, _offset) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_SONY08, _startpage, _numpages) \
- msx_slot_sony08_device::set_rom_start(*device, _region, _offset);
+ msx_slot_sony08_device::set_rom_start(*device, "^" _region, _offset);
class msx_slot_sony08_device : public device_t,
public msx_internal_slot_interface
@@ -33,7 +33,7 @@ public:
private:
required_device<nvram_device> m_nvram;
- const char *m_region;
+ required_memory_region m_rom_region;
UINT32 m_region_offset;
const UINT8 *m_rom;
UINT8 m_selected_bank[8];
diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp
index 175139f19c2..50206fe1422 100644
--- a/src/devices/bus/nubus/nubus.cpp
+++ b/src/devices/bus/nubus/nubus.cpp
@@ -9,7 +9,6 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "nubus.h"
@@ -219,7 +218,7 @@ void nubus_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mi
m_maincpu = machine().device<cpu_device>(m_cputag);
address_space &space = m_maincpu->space(AS_PROGRAM);
space.install_readwrite_bank(start, end, mask, mirror, tag );
- machine().root_device().membank(tag)->set_base(data);
+ machine().root_device().membank(siblingtag(tag).c_str())->set_base(data);
}
void nubus_device::set_irq_line(int slot, int state)
diff --git a/src/devices/bus/pc_kbd/pc_kbdc.cpp b/src/devices/bus/pc_kbd/pc_kbdc.cpp
index 9f920c6d5dd..987c51eda63 100644
--- a/src/devices/bus/pc_kbd/pc_kbdc.cpp
+++ b/src/devices/bus/pc_kbd/pc_kbdc.cpp
@@ -14,7 +14,6 @@ The following basic program can be useful for identifying scancodes:
#include "emu.h"
-#include "emuopts.h"
#include "pc_kbdc.h"
diff --git a/src/devices/bus/sms_ctrl/lphaser.cpp b/src/devices/bus/sms_ctrl/lphaser.cpp
index 8a49c9a1554..ccf240d9eec 100644
--- a/src/devices/bus/sms_ctrl/lphaser.cpp
+++ b/src/devices/bus/sms_ctrl/lphaser.cpp
@@ -12,6 +12,13 @@ Release data from the Sega Retro project:
Year: 1989 Country/region: BR Model code: 010470
Year: 198? Country/region: KR Model code: ?
+Notes:
+
+ The Light Phaser gun doesn't work with the Japanese SMS and Sega Mark III.
+ There are reports about Light Phaser working on the second Korean SMS
+ version, and a Korean advert shows support on the first version (Gam*Boy I,
+ although based on Japanese SMS).
+
**********************************************************************/
#include "lphaser.h"
@@ -29,7 +36,7 @@ const device_type SMS_LIGHT_PHASER = &device_creator<sms_light_phaser_device>;
#define LGUN_X_INTERVAL 4
-CUSTOM_INPUT_MEMBER( sms_light_phaser_device::th_pin_r )
+READ_LINE_MEMBER( sms_light_phaser_device::th_pin_r )
{
// The returned value is inverted due to IP_ACTIVE_LOW mapping.
return ~m_sensor_last_state;
@@ -46,7 +53,7 @@ INPUT_CHANGED_MEMBER( sms_light_phaser_device::position_changed )
static INPUT_PORTS_START( sms_light_phaser )
PORT_START("CTRL_PORT")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (trigger)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r, nullptr)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER(DEVICE_SELF, sms_light_phaser_device, th_pin_r)
PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("LPHASER_X")
diff --git a/src/devices/bus/sms_ctrl/lphaser.h b/src/devices/bus/sms_ctrl/lphaser.h
index 7d2f9ca1ed6..860b8d4007f 100644
--- a/src/devices/bus/sms_ctrl/lphaser.h
+++ b/src/devices/bus/sms_ctrl/lphaser.h
@@ -34,7 +34,7 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- DECLARE_CUSTOM_INPUT_MEMBER( th_pin_r );
+ DECLARE_READ_LINE_MEMBER( th_pin_r );
DECLARE_INPUT_CHANGED_MEMBER( position_changed );
protected:
diff --git a/src/devices/bus/sms_ctrl/paddle.cpp b/src/devices/bus/sms_ctrl/paddle.cpp
index f502b9ad196..964a00f5133 100644
--- a/src/devices/bus/sms_ctrl/paddle.cpp
+++ b/src/devices/bus/sms_ctrl/paddle.cpp
@@ -38,7 +38,7 @@ const device_type SMS_PADDLE = &device_creator<sms_paddle_device>;
#define PADDLE_INTERVAL attotime::from_hz(XTAL_53_693175MHz/15/100)
-CUSTOM_INPUT_MEMBER( sms_paddle_device::dir_pins_r )
+CUSTOM_INPUT_MEMBER( sms_paddle_device::rldu_pins_r )
{
UINT8 data = m_paddle_x->read();
@@ -50,7 +50,7 @@ CUSTOM_INPUT_MEMBER( sms_paddle_device::dir_pins_r )
}
-CUSTOM_INPUT_MEMBER( sms_paddle_device::tr_pin_r )
+READ_LINE_MEMBER( sms_paddle_device::tr_pin_r )
{
// The returned value is inverted due to IP_ACTIVE_LOW mapping.
return ~m_read_state;
@@ -59,11 +59,11 @@ CUSTOM_INPUT_MEMBER( sms_paddle_device::tr_pin_r )
static INPUT_PORTS_START( sms_paddle )
PORT_START("CTRL_PORT")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, dir_pins_r, nullptr) // Directional pins
+ PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, rldu_pins_r, nullptr) // R,L,D,U
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_paddle_device, tr_pin_r, nullptr)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER( DEVICE_SELF, sms_paddle_device, tr_pin_r ) // TR
PORT_START("PADDLE_X") // Paddle knob
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255)
diff --git a/src/devices/bus/sms_ctrl/paddle.h b/src/devices/bus/sms_ctrl/paddle.h
index fae7a93fb19..968abe1b345 100644
--- a/src/devices/bus/sms_ctrl/paddle.h
+++ b/src/devices/bus/sms_ctrl/paddle.h
@@ -33,8 +33,8 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- DECLARE_CUSTOM_INPUT_MEMBER( dir_pins_r );
- DECLARE_CUSTOM_INPUT_MEMBER( tr_pin_r );
+ DECLARE_CUSTOM_INPUT_MEMBER( rldu_pins_r ); // Right, Left, Down and Up lines.
+ DECLARE_READ_LINE_MEMBER( tr_pin_r );
protected:
// device-level overrides
diff --git a/src/devices/bus/sms_ctrl/sports.cpp b/src/devices/bus/sms_ctrl/sports.cpp
index b4bd54d81a1..54fa867a8c1 100644
--- a/src/devices/bus/sms_ctrl/sports.cpp
+++ b/src/devices/bus/sms_ctrl/sports.cpp
@@ -82,21 +82,21 @@ void sms_sports_pad_device::device_timer(emu_timer &timer, device_timer_id id, i
}
-CUSTOM_INPUT_MEMBER( sms_sports_pad_device::th_pin_r )
+READ_LINE_MEMBER( sms_sports_pad_device::th_pin_r )
{
- return m_last_data;
+ return m_th_pin_state;
}
-INPUT_CHANGED_MEMBER( sms_sports_pad_device::th_pin_w )
+WRITE_LINE_MEMBER( sms_sports_pad_device::th_pin_w )
{
m_read_state = (m_read_state + 1) & 3;
m_sportspad_timer->adjust(m_interval);
- m_last_data = newval;
+ m_th_pin_state = state;
}
-CUSTOM_INPUT_MEMBER( sms_sports_pad_device::dir_pins_r )
+CUSTOM_INPUT_MEMBER( sms_sports_pad_device::rldu_pins_r )
{
UINT8 data = 0;
@@ -123,17 +123,17 @@ CUSTOM_INPUT_MEMBER( sms_sports_pad_device::dir_pins_r )
static INPUT_PORTS_START( sms_sports_pad )
PORT_START("SPORTS_IN")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, dir_pins_r, nullptr) // Directional pins
+ PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, rldu_pins_r, nullptr) // R,L,D,U
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r, nullptr)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_r) // TH
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2)
PORT_START("SPORTS_OUT")
PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) // Directional pins
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // TL (Button 1)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_CHANGED_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w, nullptr)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, sms_sports_pad_device, th_pin_w) // TH
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // TR (Button 2)
PORT_START("SPORTS_X") /* Sports Pad X axis */
@@ -171,7 +171,7 @@ sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, cons
m_sports_x(*this, "SPORTS_X"),
m_sports_y(*this, "SPORTS_Y"),
m_read_state(0),
- m_last_data(0),
+ m_th_pin_state(0),
m_x_axis_reset_value(0x80), // value 0x80 helps when start playing paddle games.
m_y_axis_reset_value(0x80),
m_interval(SPORTS_PAD_INTERVAL), m_sportspad_timer(nullptr)
@@ -188,7 +188,7 @@ void sms_sports_pad_device::device_start()
m_sportspad_timer = timer_alloc(TIMER_SPORTSPAD);
save_item(NAME(m_read_state));
- save_item(NAME(m_last_data));
+ save_item(NAME(m_th_pin_state));
save_item(NAME(m_x_axis_reset_value));
save_item(NAME(m_y_axis_reset_value));
}
diff --git a/src/devices/bus/sms_ctrl/sports.h b/src/devices/bus/sms_ctrl/sports.h
index fe98c9e5e70..5ca209e748d 100644
--- a/src/devices/bus/sms_ctrl/sports.h
+++ b/src/devices/bus/sms_ctrl/sports.h
@@ -33,9 +33,9 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- DECLARE_CUSTOM_INPUT_MEMBER( dir_pins_r );
- DECLARE_CUSTOM_INPUT_MEMBER( th_pin_r );
- DECLARE_INPUT_CHANGED_MEMBER( th_pin_w );
+ DECLARE_CUSTOM_INPUT_MEMBER( rldu_pins_r ); // Right, Left, Down and Up lines.
+ DECLARE_READ_LINE_MEMBER( th_pin_r );
+ DECLARE_WRITE_LINE_MEMBER( th_pin_w );
protected:
// device-level overrides
@@ -52,7 +52,7 @@ private:
required_ioport m_sports_y;
UINT8 m_read_state;
- UINT8 m_last_data;
+ UINT8 m_th_pin_state;
UINT8 m_x_axis_reset_value;
UINT8 m_y_axis_reset_value;
const attotime m_interval;
diff --git a/src/devices/bus/sms_ctrl/sportsjp.cpp b/src/devices/bus/sms_ctrl/sportsjp.cpp
index fef04df69e8..e9b148c19e9 100644
--- a/src/devices/bus/sms_ctrl/sportsjp.cpp
+++ b/src/devices/bus/sms_ctrl/sportsjp.cpp
@@ -22,6 +22,13 @@ Notes:
used by the US model, due to the missing TH line on Sega Mark III
controller ports.
+ A bug was discovered in the player 2 input handling code of the only known
+ good ROM dump of Sports Pad Soccer (JP):
+ size="131072" crc="41c948bf" sha1="7634ce39e87049dad1ee4f32a80d728e4bd1f81f"
+ At address $12D1, instead read the upper 2 bits of port $DC and lower 2 bits
+ of port $DD (to obtain the lower nibble of the current axis for player 2),
+ the code wrongly reads the lower nibble of port $DC, that is player 1 data.
+
**********************************************************************/
#include "sportsjp.h"
@@ -39,38 +46,24 @@ const device_type SMS_SPORTS_PAD_JP = &device_creator<sms_sports_pad_jp_device>;
-DECLARE_CUSTOM_INPUT_MEMBER( sms_sports_pad_jp_device::dir_pins_r )
-{
- UINT8 data = 0;
-
- switch (m_read_state)
- {
- case 0:
- data = m_sports_jp_x->read() >> 4;
- break;
- case 1:
- data = m_sports_jp_x->read();
- break;
- case 2:
- data = m_sports_jp_y->read() >> 4;
- break;
- case 3:
- data = m_sports_jp_y->read();
- break;
- }
-
- // The returned value is inverted due to IP_ACTIVE_LOW mapping.
- return ~(data & 0x0f);
-}
+// The returned value is inverted due to IP_ACTIVE_LOW mapping.
+READ_LINE_MEMBER( sms_sports_pad_jp_device::tl_pin_r ) { return ~m_tl_pin_state; }
+READ_LINE_MEMBER( sms_sports_pad_jp_device::tr_pin_r ) { return ~m_tr_pin_state; }
+CUSTOM_INPUT_MEMBER( sms_sports_pad_jp_device::rldu_pins_r ) { return ~(m_rldu_pins_state & 0x0f); }
static INPUT_PORTS_START( sms_sports_pad_jp )
PORT_START("SPORTS_JP_IN")
- PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_jp_device, dir_pins_r, nullptr) // Directional pins
+ PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sms_sports_pad_jp_device, rldu_pins_r, nullptr) // R,L,D,U
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL (Button 1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER( DEVICE_SELF, sms_sports_pad_jp_device, tl_pin_r ) // TL
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) // TR (Button 2)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER( DEVICE_SELF, sms_sports_pad_jp_device, tr_pin_r ) // TR
+
+ PORT_START("SPORTS_JP_BT") /* Sports Pad buttons nibble */
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
+ PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("SPORTS_JP_X") /* Sports Pad X axis */
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40)
@@ -103,9 +96,12 @@ sms_sports_pad_jp_device::sms_sports_pad_jp_device(const machine_config &mconfig
device_t(mconfig, SMS_SPORTS_PAD_JP, "Sega SMS Sports Pad JP", tag, owner, clock, "sms_sports_pad_jp", __FILE__),
device_sms_control_port_interface(mconfig, *this),
m_sports_jp_in(*this, "SPORTS_JP_IN"),
+ m_sports_jp_bt(*this, "SPORTS_JP_BT"),
m_sports_jp_x(*this, "SPORTS_JP_X"),
m_sports_jp_y(*this, "SPORTS_JP_Y"),
- m_read_state(0),
+ m_rldu_pins_state(0x0f),
+ m_tl_pin_state(1),
+ m_tr_pin_state(1),
m_interval(SPORTS_PAD_JP_INTERVAL)
{
}
@@ -120,7 +116,9 @@ void sms_sports_pad_jp_device::device_start()
m_start_time = machine().time();
save_item(NAME(m_start_time));
- save_item(NAME(m_read_state));
+ save_item(NAME(m_rldu_pins_state));
+ save_item(NAME(m_tl_pin_state));
+ save_item(NAME(m_tr_pin_state));
}
@@ -130,41 +128,41 @@ void sms_sports_pad_jp_device::device_start()
UINT8 sms_sports_pad_jp_device::peripheral_r()
{
- UINT8 data;
int num_intervals = (machine().time() - m_start_time).as_double() / m_interval.as_double();
- m_read_state = num_intervals % 5;
-
- data = m_sports_jp_in->read();
- switch (m_read_state)
+ switch (num_intervals % 5)
{
case 0:
// X high nibble
- data &= ~0x20; // TL 0
- data &= ~0x80; // TR 0
+ m_rldu_pins_state = m_sports_jp_x->read() >> 4;
+ m_tl_pin_state = 0;
+ m_tr_pin_state = 0;
break;
case 1:
// X low nibble
- data |= 0x20; // TL 1
- data &= ~0x80; // TR 0
+ m_rldu_pins_state = m_sports_jp_x->read();
+ m_tl_pin_state = 1;
+ m_tr_pin_state = 0;
break;
case 2:
// Y high nibble
- data &= ~0x20; // TL 0
- data &= ~0x80; // TR 0
+ m_rldu_pins_state = m_sports_jp_y->read() >> 4;
+ m_tl_pin_state = 0;
+ m_tr_pin_state = 0;
break;
case 3:
// Y low nibble
- data |= 0x20; // TL 1
- data &= ~0x80; // TR 0
+ m_rldu_pins_state = m_sports_jp_y->read();
+ m_tl_pin_state = 1;
+ m_tr_pin_state = 0;
break;
case 4:
// buttons 1 and 2
- data = (data & 0x20) >> 5 | (data & 0x80) >> 6 | 0xfc;
- data |= 0x20; // TL 1
- data |= 0x80; // TR 1
+ m_rldu_pins_state = m_sports_jp_bt->read();
+ m_tl_pin_state = 1;
+ m_tr_pin_state = 1;
break;
}
- return data;
+ return m_sports_jp_in->read();
}
diff --git a/src/devices/bus/sms_ctrl/sportsjp.h b/src/devices/bus/sms_ctrl/sportsjp.h
index ad438d12bb1..3e82c18dd85 100644
--- a/src/devices/bus/sms_ctrl/sportsjp.h
+++ b/src/devices/bus/sms_ctrl/sportsjp.h
@@ -33,7 +33,9 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
- CUSTOM_INPUT_MEMBER( dir_pins_r );
+ DECLARE_CUSTOM_INPUT_MEMBER( rldu_pins_r ); // Right, Left, Down and Up lines.
+ DECLARE_READ_LINE_MEMBER( tl_pin_r );
+ DECLARE_READ_LINE_MEMBER( tr_pin_r );
protected:
// device-level overrides
@@ -44,10 +46,13 @@ protected:
private:
required_ioport m_sports_jp_in;
+ required_ioport m_sports_jp_bt;
required_ioport m_sports_jp_x;
required_ioport m_sports_jp_y;
- UINT8 m_read_state;
+ UINT8 m_rldu_pins_state;
+ UINT8 m_tl_pin_state;
+ UINT8 m_tr_pin_state;
attotime m_start_time;
const attotime m_interval;
};
diff --git a/src/devices/bus/snes_ctrl/joypad.h b/src/devices/bus/snes_ctrl/joypad.h
index 8daa922f20a..7ba3ea3e514 100644
--- a/src/devices/bus/snes_ctrl/joypad.h
+++ b/src/devices/bus/snes_ctrl/joypad.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual void write_strobe(UINT8 data) override;
virtual void port_poll() override;
diff --git a/src/devices/bus/snes_ctrl/mouse.h b/src/devices/bus/snes_ctrl/mouse.h
index 53602b96be3..39daae165d2 100644
--- a/src/devices/bus/snes_ctrl/mouse.h
+++ b/src/devices/bus/snes_ctrl/mouse.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual void write_strobe(UINT8 data) override;
virtual void port_poll() override;
diff --git a/src/devices/bus/snes_ctrl/multitap.h b/src/devices/bus/snes_ctrl/multitap.h
index e978a9d13ca..edc6ee110dc 100644
--- a/src/devices/bus/snes_ctrl/multitap.h
+++ b/src/devices/bus/snes_ctrl/multitap.h
@@ -37,7 +37,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual UINT8 read_pin5() override;
virtual void write_strobe(UINT8 data) override;
diff --git a/src/devices/bus/snes_ctrl/pachinko.h b/src/devices/bus/snes_ctrl/pachinko.h
index 149d5775157..d340a1c8689 100644
--- a/src/devices/bus/snes_ctrl/pachinko.h
+++ b/src/devices/bus/snes_ctrl/pachinko.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual void write_strobe(UINT8 data) override;
virtual void port_poll() override;
diff --git a/src/devices/bus/snes_ctrl/sscope.h b/src/devices/bus/snes_ctrl/sscope.h
index 064ee0c941d..d625bc237ea 100644
--- a/src/devices/bus/snes_ctrl/sscope.h
+++ b/src/devices/bus/snes_ctrl/sscope.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual void write_strobe(UINT8 data) override;
virtual void port_poll() override;
diff --git a/src/devices/bus/snes_ctrl/twintap.h b/src/devices/bus/snes_ctrl/twintap.h
index 5adf0bf1cc1..085a9ead09c 100644
--- a/src/devices/bus/snes_ctrl/twintap.h
+++ b/src/devices/bus/snes_ctrl/twintap.h
@@ -36,7 +36,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- // device_sms_control_port_interface overrides
+ // device_snes_control_port_interface overrides
virtual UINT8 read_pin4() override;
virtual void write_strobe(UINT8 data) override;
virtual void port_poll() override;
diff --git a/src/devices/bus/ti99_peb/pcode.cpp b/src/devices/bus/ti99_peb/pcode.cpp
index 57ee6462874..ff0d9b4c9d5 100644
--- a/src/devices/bus/ti99_peb/pcode.cpp
+++ b/src/devices/bus/ti99_peb/pcode.cpp
@@ -92,43 +92,87 @@
#define ACTIVE_TAG "ACTIVE"
-#define LOG logerror
-#define VERBOSE 1
+#define TRACE_ROM 0
+#define TRACE_GROM 0
+#define TRACE_CRU 0
+#define TRACE_SWITCH 0
ti_pcode_card_device::ti_pcode_card_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: ti_expansion_card_device(mconfig, TI99_P_CODE, "TI-99 P-Code Card", tag, owner, clock, "ti99_pcode", __FILE__), m_rom(nullptr), m_bank_select(0), m_switch(false)
+: ti_expansion_card_device(mconfig, TI99_P_CODE, "TI-99 P-Code Card", tag, owner, clock, "ti99_pcode", __FILE__),
+ m_rom(nullptr),
+ m_bank_select(0),
+ m_active(false),
+ m_clock_count(0),
+ m_clockhigh(false),
+ m_inDsrArea(false),
+ m_isrom0(false),
+ m_isrom12(false),
+ m_isgrom(false),
+ m_address(0)
{
}
+SETADDRESS_DBIN_MEMBER( ti_pcode_card_device::setaddress_dbin )
+{
+ // Do not allow setaddress for the debugger. It will mess up the
+ // setaddress/memory access pairs when the CPU enters wait states.
+ if (space.debugger_access()) return;
+
+ m_address = offset;
+ m_inDsrArea = ((m_address & m_select_mask)==m_select_value);
+
+ line_state a14 = ((m_address & 2)!=0)? ASSERT_LINE : CLEAR_LINE;
+
+ m_isrom0 = ((m_address & 0xf000)==0x4000);
+ m_isrom12 = ((m_address & 0xf000)==0x5000);
+
+ // Valid access (GROM write with DBIN=0 or read with DBIN=1)
+ bool validaccess = (state==CLEAR_LINE || (m_address & 0x0400)==0);
+
+ // GROM access 0101 1011 1111 1100
+ m_isgrom = ((m_address & 0xfbfd)==0x5bfc) && validaccess;
+
+ if (validaccess)
+ {
+ int lines = (state==ASSERT_LINE)? 1 : 0;
+ if (a14==ASSERT_LINE) lines |= 2;
+ line_state select = m_isgrom? ASSERT_LINE : CLEAR_LINE;
+
+ // always deliver to GROM so that the select line may be cleared
+ for (int i=0; i < 8; i++)
+ m_grom[i]->set_lines(space, lines, select);
+ }
+}
+
READ8Z_MEMBER( ti_pcode_card_device::readz )
{
- if (m_switch && m_selected && ((offset & m_select_mask)==m_select_value))
+ if (m_active && m_inDsrArea && m_selected)
{
- // GROM access
- if ((offset & GROMMASK)==GROMREAD)
+ if (m_isrom0)
{
- for (auto & elem : m_grom) elem->readz(space, offset, value, mem_mask);
- if (VERBOSE>5) LOG("ti99_pcode: read from grom %04x: %02x\n", offset&0xffff, *value);
+ *value = m_rom[m_address & 0x0fff];
+ if (TRACE_ROM) logerror("Read from rom %04x: %02x\n", offset&0xffff, *value);
}
else
{
- if ((offset & 0x1000) == 0x0000)
+ if (m_isgrom)
{
- /* Accesses ROM 4732 (4K) */
- // 0000 xxxx xxxx xxxx
- *value = m_rom[offset & 0x0fff];
- if (VERBOSE>5) LOG("ti99_pcode: read from rom %04x: %02x\n", offset&0xffff, *value);
+ for (auto& elem : m_grom) elem->readz(space, m_address, value);
+ if (TRACE_GROM) logerror("Read from grom %04x: %02x\n", m_address&0xffff, *value);
}
else
{
- // Accesses ROM 4764 (2*4K)
- // We have two banks here which are activated according
- // to the setting of CRU bit 4
- // Bank 0 is the ROM above
- // 0001 xxxx xxxx xxxx Bank 1
- // 0010 xxxx xxxx xxxx Bank 2
- *value = m_rom[(m_bank_select<<12) | (offset & 0x0fff)];
- if (VERBOSE>5) LOG("ti99_pcode: read from rom %04x (%02x): %02x\n", offset&0xffff, m_bank_select, *value);
+ if (m_isrom12)
+ {
+ // Accesses ROM 4764 (2*4K)
+ // We have two banks here which are activated according
+ // to the setting of CRU bit 4
+ // Bank 0 is the ROM above
+ // 0001 xxxx xxxx xxxx Bank 1
+ // 0010 xxxx xxxx xxxx Bank 2
+ *value = m_rom[(m_bank_select<<12) | (m_address & 0x0fff)];
+ if (TRACE_ROM) logerror("Read from rom %04x (%02x): %02x\n", m_address&0xffff, m_bank_select, *value);
+ }
}
}
}
@@ -140,28 +184,14 @@ READ8Z_MEMBER( ti_pcode_card_device::readz )
*/
WRITE8_MEMBER( ti_pcode_card_device::write )
{
- if (m_switch && m_selected)
+ if (m_active && m_isgrom && m_selected)
{
- if ((offset & m_select_mask)==m_select_value)
- {
- if (VERBOSE>5) LOG("ti99_pcode: write to address %04x: %02x\n", offset & 0xffff, data);
- // 0101 1111 1111 11x0
- if ((offset & GROMMASK) == GROMWRITE)
- {
- for (auto & elem : m_grom) elem->write(space, offset, data, mem_mask);
- }
- }
+ for (auto & elem : m_grom) elem->write(space, m_address, data);
}
}
/*
Common READY* line from the GROMs.
- At this time we do not emulate GROM READY* since the CPU emulation does
- not yet process READY*. If it did, however, we would have to do a similar
- handling as in peribox (with INTA*): The common READY* line is a logical
- AND of all single READY lines. If any GROM pulls it down, the line goes
- down, and only if all GROMs release it, it pulls up again. We should think
- about a general solution.
*/
WRITE_LINE_MEMBER( ti_pcode_card_device::ready_line )
{
@@ -169,6 +199,22 @@ WRITE_LINE_MEMBER( ti_pcode_card_device::ready_line )
}
/*
+ CLKOUT line from the CPU. This line is divided by 8 to generate a 375 Khz
+ clock input for the GROMs, which are thus running at a lower rate than
+ those in the console driven by the VDP (477 kHz).
+*/
+WRITE_LINE_MEMBER( ti_pcode_card_device::clock_in)
+{
+ m_clock_count = (m_clock_count+1) & 0x03; // four pulses high, four pulses low
+ if (m_clock_count==0)
+ {
+ // Toggle
+ m_clockhigh = !m_clockhigh;
+ for (auto & elem : m_grom) elem->gclock_in(m_clockhigh? ASSERT_LINE : CLEAR_LINE);
+ }
+}
+
+/*
CRU read handler. The P-Code card does not offer CRU read lines, so
we just ignore any request. (Note that CRU lines are not like memory; you
may be able to write to them, but not necessarily read them again.)
@@ -198,55 +244,22 @@ WRITE8_MEMBER(ti_pcode_card_device::cruwrite)
if (addr==0x80) // Bit 4 is on address line 8
{
m_bank_select = (data+1); // we're calling this bank 1 and bank 2
- if (VERBOSE>5) LOG("ti99_pcode: select rom bank %d\n", m_bank_select);
+ if (TRACE_CRU) logerror("Select rom bank %d\n", m_bank_select);
}
}
}
-static GROM_CONFIG(pgrom0_config)
-{
- false, 0, PCODE_GROM_TAG, 0x0000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom1_config)
-{
- false, 1, PCODE_GROM_TAG, 0x2000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom2_config)
-{
- false, 2, PCODE_GROM_TAG, 0x4000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom3_config)
-{
- false, 3, PCODE_GROM_TAG, 0x6000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom4_config)
-{
- false, 4, PCODE_GROM_TAG, 0x8000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom5_config)
-{
- false, 5, PCODE_GROM_TAG, 0xa000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom6_config)
-{
- false, 6, PCODE_GROM_TAG, 0xc000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(pgrom7_config)
-{
- false, 7, PCODE_GROM_TAG, 0xe000, 0x1800, GROMFREQ
-};
-
void ti_pcode_card_device::device_start()
{
m_cru_base = 0x1f00;
- m_grom[0] = static_cast<ti99_grom_device*>(subdevice(PGROM0_TAG));
- m_grom[1] = static_cast<ti99_grom_device*>(subdevice(PGROM1_TAG));
- m_grom[2] = static_cast<ti99_grom_device*>(subdevice(PGROM2_TAG));
- m_grom[3] = static_cast<ti99_grom_device*>(subdevice(PGROM3_TAG));
- m_grom[4] = static_cast<ti99_grom_device*>(subdevice(PGROM4_TAG));
- m_grom[5] = static_cast<ti99_grom_device*>(subdevice(PGROM5_TAG));
- m_grom[6] = static_cast<ti99_grom_device*>(subdevice(PGROM6_TAG));
- m_grom[7] = static_cast<ti99_grom_device*>(subdevice(PGROM7_TAG));
+ m_grom[0] = downcast<tmc0430_device*>(subdevice(PGROM0_TAG));
+ m_grom[1] = downcast<tmc0430_device*>(subdevice(PGROM1_TAG));
+ m_grom[2] = downcast<tmc0430_device*>(subdevice(PGROM2_TAG));
+ m_grom[3] = downcast<tmc0430_device*>(subdevice(PGROM3_TAG));
+ m_grom[4] = downcast<tmc0430_device*>(subdevice(PGROM4_TAG));
+ m_grom[5] = downcast<tmc0430_device*>(subdevice(PGROM5_TAG));
+ m_grom[6] = downcast<tmc0430_device*>(subdevice(PGROM6_TAG));
+ m_grom[7] = downcast<tmc0430_device*>(subdevice(PGROM7_TAG));
m_rom = memregion(PCODE_ROM_TAG)->base();
}
@@ -264,8 +277,15 @@ void ti_pcode_card_device::device_reset()
}
m_bank_select = 1;
m_selected = false;
+ m_clock_count = 0;
+ m_clockhigh = false;
+
+ m_active = ioport(ACTIVE_TAG)->read();
- m_switch = ioport(ACTIVE_TAG)->read();
+ m_isrom0 = false;
+ m_isrom12 = false;
+ m_isgrom = false;
+ m_address = 0;
}
void ti_pcode_card_device::device_config_complete()
@@ -274,28 +294,20 @@ void ti_pcode_card_device::device_config_complete()
INPUT_CHANGED_MEMBER( ti_pcode_card_device::switch_changed )
{
- if (VERBOSE>7) LOG("ti_pcode_card_device: switch changed to %d\n", newval);
- m_switch = (newval != 0);
+ if (TRACE_SWITCH) logerror("Switch changed to %d\n", newval);
+ m_active = (newval != 0);
}
MACHINE_CONFIG_FRAGMENT( ti99_pcode )
- MCFG_GROM_ADD( PGROM0_TAG, pgrom0_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM1_TAG, pgrom1_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM2_TAG, pgrom2_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM3_TAG, pgrom3_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM4_TAG, pgrom4_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM5_TAG, pgrom5_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM6_TAG, pgrom6_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
- MCFG_GROM_ADD( PGROM7_TAG, pgrom7_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM0_TAG, 0, PCODE_GROM_TAG, 0x0000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM1_TAG, 1, PCODE_GROM_TAG, 0x2000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM2_TAG, 2, PCODE_GROM_TAG, 0x4000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM3_TAG, 3, PCODE_GROM_TAG, 0x6000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM4_TAG, 4, PCODE_GROM_TAG, 0x8000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM5_TAG, 5, PCODE_GROM_TAG, 0xa000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM6_TAG, 6, PCODE_GROM_TAG, 0xc000, WRITELINE(ti_pcode_card_device, ready_line))
+ MCFG_GROM_ADD( PGROM7_TAG, 7, PCODE_GROM_TAG, 0xe000, WRITELINE(ti_pcode_card_device, ready_line))
MACHINE_CONFIG_END
INPUT_PORTS_START( ti99_pcode )
diff --git a/src/devices/bus/ti99_peb/pcode.h b/src/devices/bus/ti99_peb/pcode.h
index c2a81a1395c..71664682261 100644
--- a/src/devices/bus/ti99_peb/pcode.h
+++ b/src/devices/bus/ti99_peb/pcode.h
@@ -17,7 +17,7 @@
#include "emu.h"
#include "peribox.h"
-#include "bus/ti99x/grom.h"
+#include "machine/tmc0430.h"
extern const device_type TI99_P_CODE;
@@ -29,6 +29,9 @@ public:
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
DECLARE_WRITE8_MEMBER(cruwrite) override;
+ DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override;
+
+ DECLARE_WRITE_LINE_MEMBER(clock_in) override;
DECLARE_WRITE_LINE_MEMBER( ready_line );
DECLARE_INPUT_CHANGED_MEMBER( switch_changed );
@@ -42,10 +45,22 @@ protected:
virtual ioport_constructor device_input_ports() const override;
private:
- ti99_grom_device* m_grom[8];
+ tmc0430_device* m_grom[8];
UINT8* m_rom;
int m_bank_select;
- bool m_switch;
+ bool m_active;
+ int m_clock_count;
+ bool m_clockhigh;
+
+ // Address in card area
+ bool m_inDsrArea;
+
+ bool m_isrom0;
+ bool m_isrom12;
+ bool m_isgrom;
+
+ // Recent address
+ int m_address;
};
#endif
diff --git a/src/devices/bus/ti99_peb/peribox.cpp b/src/devices/bus/ti99_peb/peribox.cpp
index a89f86d13ef..52274505533 100644
--- a/src/devices/bus/ti99_peb/peribox.cpp
+++ b/src/devices/bus/ti99_peb/peribox.cpp
@@ -259,7 +259,7 @@ WRITE8_MEMBER(peribox_device::write)
SETADDRESS_DBIN_MEMBER(peribox_device::setaddress_dbin)
{
// Ignore the address when the TI-99/8 transmits the high-order 8 bits
- // if (!m_memen) return;
+ if (!m_memen) return;
for (int i=2; i <= 8; i++)
{
diff --git a/src/devices/bus/ti99_peb/spchsyn.cpp b/src/devices/bus/ti99_peb/spchsyn.cpp
index 1fb447f6d17..76c94cc7842 100644
--- a/src/devices/bus/ti99_peb/spchsyn.cpp
+++ b/src/devices/bus/ti99_peb/spchsyn.cpp
@@ -25,15 +25,15 @@
#include "sound/wave.h"
#include "machine/spchrom.h"
-#define TMS5220_ADDRESS_MASK 0x3FFFFUL /* 18-bit mask for tms5220 address */
-
-#define VERBOSE 1
-#define LOG logerror
+#define TRACE_MEM 0
+#define TRACE_ADDR 0
+#define TRACE_READY 0
/****************************************************************************/
ti_speech_synthesizer_device::ti_speech_synthesizer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: ti_expansion_card_device(mconfig, TI99_SPEECH, "TI-99 Speech synthesizer (on adapter card)", tag, owner, clock, "ti99_speech", __FILE__), m_vsp(nullptr), m_read_mode(false)
+: ti_expansion_card_device(mconfig, TI99_SPEECH, "TI-99 Speech synthesizer (on adapter card)", tag, owner, clock, "ti99_speech", __FILE__),
+ m_vsp(nullptr), m_reading(false), m_sbe(false)
{
}
@@ -45,16 +45,15 @@ READ8Z_MEMBER( ti_speech_synthesizer_device::readz )
{
if (space.debugger_access()) return;
- if ((offset & m_select_mask)==m_select_value)
+ if (m_sbe)
{
- *value = m_vsp->status_r(space, offset, 0xff) & 0xff;
- if (VERBOSE>4) LOG("spchsyn: read value = %02x\n", *value);
+ *value = m_vsp->status_r(space, 0, 0xff) & 0xff;
+ if (TRACE_MEM) logerror("read value = %02x\n", *value);
// We should clear the lines at this point. The TI-99/4A clears the
// lines by setting the address bus to a different value, but the
// Geneve may behave differently. This may not 100% reflect the real
// situation, but it ensures a safe processing.
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(TRUE);
+ m_vsp->combined_rsq_wsq_w(space, 0, ~0);
}
}
@@ -65,10 +64,10 @@ WRITE8_MEMBER( ti_speech_synthesizer_device::write )
{
if (space.debugger_access()) return;
- if ((offset & m_select_mask)==(m_select_value | 0x0400))
+ if (m_sbe)
{
- if (VERBOSE>4) LOG("spchsyn: write value = %02x\n", data);
- m_vsp->data_w(space, offset, data);
+ if (TRACE_MEM) logerror("write value = %02x\n", data);
+ m_vsp->data_w(space, 0, data);
// Note that we must NOT clear the lines here. Find the lines in the
// READY callback below.
}
@@ -76,41 +75,29 @@ WRITE8_MEMBER( ti_speech_synthesizer_device::write )
SETADDRESS_DBIN_MEMBER( ti_speech_synthesizer_device::setaddress_dbin )
{
- if ((offset & m_select_mask & ~0x0400)==m_select_value)
+ // 1001 00xx xxxx xxx0 DBIN=1
+ // 1001 01xx xxxx xxx0 DBIN=0
+ // 1111 1000 0000 0001 mask
+ m_space = &space;
+ m_reading = (state==ASSERT_LINE);
+
+ bool valid = (((offset & 0x0400)==0) == m_reading);
+ m_sbe = ((offset & m_select_mask)==m_select_value) && valid;
+
+ if (m_sbe)
{
- if (VERBOSE>4) LOG("spchsyn: set address = %04x, dbin = %d\n", offset, state);
- m_read_mode = (state==ASSERT_LINE);
- bool readop = (offset & 0x0400)==0;
-
- if (m_read_mode != readop)
- {
- // reset all; this is not a valid access
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(TRUE);
- }
- else
- {
- if (readop)
- {
- // Caution: We MUST first clear (TRUE) one line to avoid
- // both RS* and WS* be asserted (otherwise tms5220 will report "illegal")
- m_vsp->wsq_w(TRUE);
- m_vsp->rsq_w(FALSE);
- }
- else
- {
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(FALSE);
- }
- }
+ if (TRACE_ADDR) logerror("set address = %04x, dbin = %d\n", offset, state);
+
+ // Caution: In the current tms5220 emulation, care must be taken
+ // to clear one line before asserting the other line, or otherwise
+ // both RS* and WS* are active, which is illegal.
+ // Alternatively, we'll use the combined settings method
+
+ m_vsp->combined_rsq_wsq_w(space, 0, m_reading? ~RS : ~WS);
}
else
- {
// If other address, turn off RS* and WS* (negative logic!)
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(TRUE);
- return;
- }
+ m_vsp->combined_rsq_wsq_w(space, 0, ~0);
}
/****************************************************************************/
@@ -121,40 +108,41 @@ WRITE_LINE_MEMBER( ti_speech_synthesizer_device::speech_ready )
// and we have to adapt a /READY to a READY line.
// The real synthesizer board uses a transistor for that purpose.
m_slot->set_ready((state==0)? ASSERT_LINE : CLEAR_LINE);
- if (VERBOSE>5) LOG("spchsyn: READY = %d\n", (state==0));
+ if (TRACE_READY) logerror("READY = %d\n", (state==0));
- if ((state==0) && !m_read_mode)
- {
+ if ((state==0) && !m_reading)
// Clear the lines only when we are done with writing.
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(TRUE);
- }
+ m_vsp->combined_rsq_wsq_w(*m_space, 0, ~0);
}
void ti_speech_synthesizer_device::device_start()
{
- m_read_mode = false;
}
void ti_speech_synthesizer_device::device_config_complete()
{
m_vsp = subdevice<cd2501e_device>("speechsyn");
+
+ // Need to configure the speech ROM for inverse bit order
+ speechrom_device* mem = subdevice<speechrom_device>("vsm");
+ mem->set_reverse_bit_order(true);
}
void ti_speech_synthesizer_device::device_reset()
{
- if (VERBOSE>5) LOG("spchsyn: reset\n");
if (m_genmod)
{
- m_select_mask = 0x1ffc01;
+ m_select_mask = 0x1ff801;
m_select_value = 0x179000;
}
else
{
- m_select_mask = 0x7fc01;
+ m_select_mask = 0x7f801;
m_select_value = 0x79000;
}
- m_read_mode = false;
+
+ m_reading = false;
+ m_sbe = false;
}
MACHINE_CONFIG_FRAGMENT( ti99_speech )
@@ -169,11 +157,8 @@ MACHINE_CONFIG_END
ROM_START( ti99_speech )
ROM_REGION(0x8000, "vsm", 0)
- // Note: the following line is actually wrong; the speech roms in the ti 99/4a and 99/8 are two VSM roms labeled CD2325A and CD2326A, and contain the same data as the following line rom does, but with the byte bit order reversed. This bit ordering issue needs to be fixed elsewhere in the code here before the original/real roms can be used.
- ROM_LOAD_OPTIONAL("spchrom.bin", 0x0000, 0x8000, CRC(58b155f7) SHA1(382292295c00dff348d7e17c5ce4da12a1d87763)) /* system speech ROM */
- // correct lines are:
- // ROM_LOAD_OPTIONAL("cd2325a.u2a", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe)) // at location u2, bottom of stack
- // ROM_LOAD_OPTIONAL("cd2326a.u2b", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020)) // at location u2, top of stack
+ ROM_LOAD("cd2325a.u2a", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe)) // at location u2, bottom of stack
+ ROM_LOAD("cd2326a.u2b", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020)) // at location u2, top of stack
ROM_END
machine_config_constructor ti_speech_synthesizer_device::device_mconfig_additions() const
diff --git a/src/devices/bus/ti99_peb/spchsyn.h b/src/devices/bus/ti99_peb/spchsyn.h
index 44e7aca54c4..e5c8d19f49b 100644
--- a/src/devices/bus/ti99_peb/spchsyn.h
+++ b/src/devices/bus/ti99_peb/spchsyn.h
@@ -40,8 +40,10 @@ protected:
virtual void device_config_complete() override;
private:
- cd2501e_device *m_vsp;
- bool m_read_mode;
+ address_space* m_space;
+ cd2501e_device* m_vsp;
+ bool m_reading;
+ bool m_sbe; // Signal "Speech block enable"
};
#endif
diff --git a/src/devices/bus/ti99x/998board.cpp b/src/devices/bus/ti99x/998board.cpp
index 0d1f081ed1b..89d7224fc98 100644
--- a/src/devices/bus/ti99x/998board.cpp
+++ b/src/devices/bus/ti99x/998board.cpp
@@ -14,71 +14,797 @@
Note: The TI-99/8's internal codename was "Armadillo"
-==============================
- Mapper (codename "Amigo")
-==============================
- Initial setting of mapper (as defined in the power-up routine, TI-99/4A mode)
+ +-------+ +--------+
+ | CPU |========LogAddrBus======| Mapper |====PhysAddrBus==========
+ | TMS | || | AMIGO | ||
+ | 9995 | +----------+ | | +----------+
+ | | | Logical | +--------+ | Physical |
+ +-------+ | space | | | space |
+ | decoder | | | decoder |
+ | VAQUERRO | | | MOFETTA |
+ +----------+ | +----------+
+ | | |
+ +--------------------+ | +---------------------+
+ | Devices | | | Devices |
+ | +-------+ | | |
+ | ROM0 | SRAM | | | DRAM (POLLO) |
+ | Video | ---- | | | ROM1 |
+ | Speech | Maps--+--+ | Cartridge port |
+ | GROM +-------+ | PEB |
+ | Sound | | Hexbus (OSO) |
+ +--------------------+ +---------------------+
+
+ Custom chips
+ ------------
+ The chipset of the TI-99/8 consists of five specifically programmed chips.
+ All are nicknamed after some Spanish words (albeit sometimes misspelled)
+
+ VAQUERRO: Logical Address Space decoder ("Vaquero" = "Cowboy")
+ MOFETTA : Physical Address Space decoder ("Mofeta" = "Skunk")
+ AMIGO : Mapper ("Amigo" = "Friend")
+ OSO : Hexbus adapter ("Oso" = "Bear")
+ POLLO : DRAM controller (Not emulated) ("Pollo" = "Chicken")
+
+ See the comments for the respective chip implementation for details.
+
+
+ ROM contents
+ ------------
+ The ROM0 chip is accessible at addresses 0000-1FFF in the logical address
+ space of the compatibility mode. It contains the GPL interpreter. In
+ native mode the ROM0 chip is invisible.
+
+ ROM0
+ offset Logical address Name
+ -----------------------------------
+ 0000 0000-1FFF ROM0
+
+
+ The ROM1 chip contains 32 KiB of various system software. It is located in
+ the physical address space, so it must be mapped into the logical address
+ space by defining an appropriate map.
+
+ ROM1
+ offset Physical address Name
+ ----------------------------------------------------------
+ 0000 FFA000-FFDFFF ROM1
+ 4000 FF4000-FF5FFF @CRU>2700 Text-to-speech ROM/DSR
+ 6000 FF4000-FF5FFF @CRU>1700 Hexbus DSR
+
+ The DSR portions have to be selected via the CRU bits >1700 or >2700.
- 0 00ff0000 -> Unmapped; logical address 0000...0fff = ROM0
- 1 00ff0000 -> Unmapped; logical address 1000...1fff = ROM0
- 2 00000800 -> DRAM; 2000 = 000800, 2fff = 0017ff
- 3 00001800 -> DRAM; 3000 = 001800, 3fff = 0027ff
- 4 00ff4000 -> DSR space (internal / ioport)
- 5 00ff5000 -> DSR space (internal / ioport)
- 6 00ff6000 -> Cartridge space (6000..6fff)
- 7 00ff7000 -> Cartridge space (7000..7fff)
- 8 00ff0000 -> Unmapped; device ports (VDP) and SRAM
- 9 00ff0000 -> Unmapped; device ports (Speech, GROM)
- A 00002800 -> DRAM; a000 = 002800, afff = 0037ff
- B 00003800 -> DRAM; b000 = 003800, bfff = 0047ff
- C 00004800 -> DRAM; c000 = 004800, cfff = 0057ff
- D 00005800 -> DRAM; d000 = 005800, dfff = 0067ff
- E 00006800 -> DRAM; e000 = 006800, efff = 0077ff
- F 00007800 -> DRAM; f000 = 007800, ffff = 0087ff
- Format of map table entry (not emulated)
+ CRU map (I/O address space)
+ ===========================
+ 0000-003e: TMS9901 system interface (see ti99_8.c)
+ 1700-17fe: Hexbus
+ 2000-26fe: Future external devices
+ 2700-27fe: Additional ROM ("internal DSR")
+ 2702 : System reset (when set to 1)
+ 2800-3ffe: Future external devices
+ 4000-fffe: Future external devices
- +------+------+------+------+---+---+---+---------+----------+---------+
- | WProt| XProt| RProt| * | 0 | 0 | 0 | Upper | High | Low |
- +------+------+------+------+---+---+---+---------+----------+---------+
+ The TMS9995 offers the full 15-bit CRU address space. Devices designed for
+ the TI-99/4A should only be accessed in the area 1000-1ffe. They will (by
+ design) incompletely decode the CRU address and be mirrored in the higher
+ areas.
- WProt: Write protection if set to 1
- XProt: Execute protection if set to 1
- RProt: Read protection if set to 1
+ Note that the cartridge port of the TI-99/8 offers support for 16K ROM
+ cartridges, but lacks CRU support.
- When a protection violation occurs, the tms9901 INT1* pin is pulled low
- (active). The pin remains low until the mapper status register is read.
+ Michael Zapf, October 2010
+ February 2012: Rewritten as class
+ March 2016: Redesigned for custom chip emulation
- Address handling
- ----------------
- Physical address is (Upper * 2^16) + (High * 2^8) + Low
+ Informations taken from
+ [1] ARMADILLO PRODUCT SPECIFICATIONS
+ [2] TI-99/8 Graphics Programming Language interpreter
- The mapper calculates the actual physical address by looking up the
- table entry from the first four bits of the logical address and then
- *adding* the remaining 12 bits of the logical address on the map value.
+***************************************************************************/
- The value 0xff0000 is used to indicate a non-mapped area.
+// TODO:
+// - PEB
- Mapper control register
- -----------------------
- The mapper control register is used to initiate a map load/save operation.
+#include "998board.h"
- +---+---+---+---+---+---+---+---+
- | 0 | 0 | 0 | 0 | Map File | RW|
- +---+---+---+---+---+---+---+---+
+#define TRACE_CRU 0
+#define TRACE_ADDRESS 0
+#define TRACE_MAP 0
+#define TRACE_OSO 0
+#define TRACE_DECODE 0
+#define TRACE_READY 0
+#define TRACE_MEM 0
+#define TRACE_CLOCK 0
+#define TRACE_DETAIL 0
+#define TRACE_MOFETTA 0
+#define TRACE_AMIGO 0
+#define TRACE_WS 0
+#define TRACE_CPURY 0
+#define TRACE_GROM 0
+#define TRACE_PUNMAP 0
- The map file is a number from 0-7 indicating the set of map values for the
- operation, which means the location in SRAM where the next 64 values are
- loaded from or stored into.
+mainboard8_device::mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, MAINBOARD8, "TI-99/8 Mainboard", tag, owner, clock, "ti998_mainboard", __FILE__),
+ m_A14_set(false),
+ m_pending_write(false),
+ m_speech_ready(true),
+ m_sound_ready(true),
+ m_pbox_ready(true),
+ m_ready(*this),
+ m_console_reset(*this),
+ m_hold_line(*this),
+ m_vaquerro(*this, VAQUERRO_TAG),
+ m_mofetta(*this, MOFETTA_TAG),
+ m_amigo(*this, AMIGO_TAG),
+ m_oso(*this, OSO_TAG)
+{
+}
- RW = 1: load from SRAM into mapper
- RW = 0: store from mapper into SRAM
+// =============== CRU bus access ==================
- When read, the mapper register returns the violation flags:
- +------+------+------+---+---+---+---+---+
- | WProt| XProt| RProt| 0 | 0 | 0 | 0 | 0 |
- +------+------+------+---+---+---+---+---+
+READ8Z_MEMBER(mainboard8_device::crureadz)
+{
+ m_peb->crureadz(space, offset, value);
+}
+
+/*
+ CRU handling. Mofetta is the only chip that bothers to handle it, beside the PEB
+*/
+WRITE8_MEMBER(mainboard8_device::cruwrite)
+{
+ m_mofetta->cruwrite(space, offset, data);
+ m_peb->cruwrite(space, offset, data);
+}
+
+// =============== Memory bus access ==================
+
+WRITE_LINE_MEMBER( mainboard8_device::dbin_in )
+{
+ m_dbin_level = (line_state)state;
+}
+
+SETOFFSET_MEMBER( mainboard8_device::setoffset )
+{
+ if (TRACE_ADDRESS) logerror("set %s %04x\n", (m_dbin_level==ASSERT_LINE)? "R" : "W", offset);
+
+ // No data is waiting on the data bus
+ m_pending_write = false;
+
+ // Memory cycle begins
+ m_vaquerro->memen_in(ASSERT_LINE);
+ m_amigo->memen_in(ASSERT_LINE);
+
+ // Save the logical address
+ m_logical_address = offset;
+ m_physical_address = 0;
+
+ // In TI's bit order, A14 is the second line from the right side (2^1)
+ m_A14_set = ((m_logical_address & 2)!=0); // Needed for clock_in
+
+ // Check for match in logical space
+ m_vaquerro->set_address(space, m_logical_address, m_dbin_level);
+
+ // Select GROMs if addressed
+ select_groms();
+
+ // Speech select lines will always be asserted/cleared as soon as the address is available
+ m_speech->wsq_w((m_vaquerro->spwt_out() == ASSERT_LINE)? FALSE : TRUE);
+ m_speech->rsq_w((m_vaquerro->sprd_out() == ASSERT_LINE)? FALSE : TRUE);
+
+ // If it is a logical space address, tell the mapper to stay inactive
+ line_state lasreq = (line_state)m_vaquerro->lascsq_out();
+ m_amigo->lascs_in(lasreq);
+ m_mofetta->lascs_in(lasreq);
+
+ // Need to set the address in any case so that the lines can be cleared
+ m_amigo->set_address(space, m_logical_address);
+
+ // AMIGO is the one to control the READY line to the CPU
+ // MOFETTA does not contribute to READY
+ m_ready(m_amigo->cpury_out());
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::reset_console )
+{
+ m_console_reset(state);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::hold_cpu )
+{
+ m_hold_line(state);
+}
+
+/*
+ HOLD Acknowledge from the CPU
+*/
+WRITE_LINE_MEMBER( mainboard8_device::holda_line )
+{
+ m_amigo->holda_in(state);
+}
+
+/*
+ Clock line from the CPU. Forward to the custom chips.
+*/
+WRITE_LINE_MEMBER( mainboard8_device::clock_in )
+{
+ if (TRACE_CLOCK) logerror("CLKOUT = %d\n", state);
+
+ // Propagate to Vaquerro; may change GGRDY (trailing edge) and the GROM select lines
+ m_vaquerro->clock_in((line_state)state);
+
+ // Set the incoming ready line of Amigo (Mapper) before the clock
+ bool readycomb = ((m_vaquerro->ggrdy_out()==ASSERT_LINE) && m_speech_ready && m_sound_ready && m_pbox_ready);
+ m_amigo->srdy_in(readycomb? ASSERT_LINE : CLEAR_LINE);
+
+ // This may change the incoming READY lines of Vaquerro
+ if (state==CLEAR_LINE) select_groms();
+
+ m_amigo->clock_in((line_state)state);
+
+ // Mofetta only needs the clock to produce the GROM clock
+ m_mofetta->clock_in(state);
+
+ m_mofetta->skdrcs_in(m_amigo->skdrcs_out());
+
+ int gromclk = m_mofetta->gromclk_out();
+
+ if (gromclk != m_gromclk) // when it changed, propagate to the GROMs
+ {
+ m_gromclk = gromclk;
+ for (int i=0; i < 8; i++)
+ {
+ if (i < 3)
+ {
+ m_sgrom[i]->gclock_in(gromclk);
+ m_p3grom[i]->gclock_in(gromclk);
+ }
+ m_tsgrom[i]->gclock_in(gromclk);
+ m_p8grom[i]->gclock_in(gromclk);
+ }
+ m_gromport->gclock_in(gromclk);
+ }
+
+ // Check video for writing
+ if (m_pending_write && m_vaquerro->vdpwt_out()==ASSERT_LINE)
+ {
+ if (m_A14_set) m_video->register_write(*m_space, 0, m_latched_data);
+ else m_video->vram_write(*m_space, 0, m_latched_data);
+ m_pending_write = false;
+ if (TRACE_MEM) logerror("Write %04x (video) <- %02x\n", m_logical_address, m_latched_data);
+ cycle_end();
+ return;
+ }
+
+ // Propagate the READY signal
+ m_ready(m_amigo->cpury_out());
+
+ // In case we're reading, the CPU will now do the READ operation.
+ // Otherwise we must do the write operation now which we postponed before.
+
+ if (m_pending_write && (state==CLEAR_LINE))
+ {
+ if (m_amigo->skdrcs_out()==ASSERT_LINE)
+ {
+ m_dram[m_physical_address & 0xffff] = m_latched_data;
+ m_pending_write = false;
+ if (TRACE_MEM) logerror("Write %04x (phys %06x, DRAM) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
+ }
+
+ if (m_mofetta->alccs_out()==ASSERT_LINE)
+ {
+ m_oso->write(*m_space, m_physical_address>>1, m_latched_data);
+ m_pending_write = false;
+ if (TRACE_MEM) logerror("Write %04x (phys %06x, OSO) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
+ }
+
+ if (m_mofetta->cmas_out()==ASSERT_LINE)
+ {
+ m_gromport->romgq_line(ASSERT_LINE);
+ m_gromport->write(*m_space, m_physical_address & 0x3fff, m_latched_data);
+ m_pending_write = false;
+ if (TRACE_MEM) logerror("Write %04x (phys %06x, cartridge) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
+ }
+ else
+ {
+ m_gromport->romgq_line(CLEAR_LINE);
+ }
+
+ if (m_mofetta->dbc_out()==ASSERT_LINE)
+ {
+ m_peb->write(*m_space, m_physical_address, m_latched_data);
+ m_pending_write = false;
+ if (TRACE_MEM) logerror("Write %04x (phys %06x, PEB) <- %02x\n", m_logical_address, m_physical_address, m_latched_data);
+ }
+ }
+
+ if (m_dbin_level==CLEAR_LINE && !m_pending_write) // Memory cycle ends
+ cycle_end();
+}
+
+void mainboard8_device::select_groms()
+{
+ // Select the GROM libs
+ // Note that we must also deselect them again, so we have to visit each
+ // one of them
+
+ int select = m_vaquerro->gromcs_out();
+
+ // Avoid to be called too often; this would have a bad penalty on emulation performance
+ // This simple check actually increases bench performance from 120% to 240%
+ if (select != m_prev_grom)
+ {
+ m_prev_grom = select;
+ int lines = (m_dbin_level==ASSERT_LINE)? GROM_M_LINE : 0;
+ if (m_A14_set) lines |= GROM_MO_LINE;
+
+ for (int i=0; i < 8; i++)
+ {
+ if (i < 3)
+ {
+ m_sgrom[i]->set_lines(*m_space, lines, select & SGMSEL);
+ m_p3grom[i]->set_lines(*m_space, lines, select & P3GSEL);
+ }
+ m_tsgrom[i]->set_lines(*m_space, lines, select & TSGSEL);
+ m_p8grom[i]->set_lines(*m_space, lines, select & P8GSEL);
+ }
+ // Write to the cartridge port. The GROMs on cartridges are accesses as system GROMs
+ if (select & SGMSEL) m_gromport->romgq_line(CLEAR_LINE);
+ m_gromport->set_gromlines(*m_space, lines, select & SGMSEL);
+ }
+
+ // If we're planning to write to the GROMs, let's do it right now
+ if (select !=0 && m_pending_write)
+ {
+ m_pending_write = false;
+ switch (select)
+ {
+ case SGMSEL:
+ for (int i=0; i < 3; i++)
+ {
+ m_sgrom[i]->write(*m_space, 0, m_latched_data);
+ }
+ if (TRACE_MEM) logerror("Write GS <- %02x\n", m_latched_data);
+ m_gromport->write(*m_space, 0, m_latched_data);
+ break;
+
+ case TSGSEL:
+ for (int i=0; i < 8; i++)
+ {
+ m_tsgrom[i]->write(*m_space, 0, m_latched_data);
+ }
+ if (TRACE_MEM) logerror("Write GT <- %02x\n", m_latched_data);
+ break;
+
+ case P8GSEL:
+ for (int i=0; i < 8; i++)
+ {
+ m_p8grom[i]->write(*m_space, 0, m_latched_data);
+ }
+ if (TRACE_MEM) logerror("Write G8 <- %02x\n", m_latched_data);
+ break;
+
+ case P3GSEL:
+ for (int i=0; i < 3; i++)
+ {
+ m_p3grom[i]->write(*m_space, 0, m_latched_data);
+ }
+ if (TRACE_MEM) logerror("Write G3 <- %02x\n", m_latched_data);
+ break;
+
+ default:
+ logerror("Error: Multiple GROM libs selected: SGM=%d TSG=%d P8G=%d P3G=%d\n", (select & SGMSEL)!=0, (select & TSGSEL)!=0, (select & P8GSEL)!=0, (select & P3GSEL)!=0);
+ break;
+ }
+ }
+}
+
+void mainboard8_device::set_paddress(int address)
+{
+ // Keep this value as the current address
+ m_physical_address = (m_physical_address << 16) | address;
+ if (TRACE_DETAIL) logerror("Setting physical address %06x\n", m_physical_address);
+
+ m_mofetta->set_address(*m_space, address, m_dbin_level);
+ m_peb->setaddress_dbin(*m_space, address, m_dbin_level);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::msast_in )
+{
+ if (TRACE_DETAIL) logerror("msast = %d\n", state);
+
+ // Start physical space cycle on the trailing edge
+ if (state==CLEAR_LINE)
+ {
+ m_mofetta->pmemen_in(ASSERT_LINE);
+ m_peb->memen_in(ASSERT_LINE);
+ }
+ m_mofetta->msast_in(state);
+ m_peb->msast_in(state);
+}
+
+
+READ8_MEMBER( mainboard8_device::read )
+{
+ UINT8 value = 0;
+ const char* what;
+
+ // =================================================
+ // Logical space
+ // =================================================
+ if (m_amigo->mapper_accessed())
+ {
+ value = m_amigo->read(space, 0);
+ what = "mapper";
+ goto readdone;
+ }
+
+ if (m_amigo->sramcs_out()==ASSERT_LINE)
+ {
+ value = m_sram[m_logical_address & 0x07ff];
+ what = "SRAM";
+ goto readdone;
+ }
+
+ if (m_vaquerro->lascsq_out()==ASSERT_LINE)
+ {
+ // VDP access
+ if (m_vaquerro->vdprd_out()==ASSERT_LINE)
+ {
+ value = m_A14_set? m_video->register_read(space, 0) : m_video->vram_read(space, 0);
+ what = "video";
+ goto readdone;
+ }
+
+ // System ROM0
+ if (m_vaquerro->sromcs_out()==ASSERT_LINE)
+ {
+ value = m_rom0[m_logical_address & 0x1fff];
+ what = "ROM0";
+ goto readdone;
+ }
+
+ // Speech
+ if (m_vaquerro->sprd_out()==ASSERT_LINE)
+ {
+ value = m_speech->status_r(space, 0) & 0xff;
+ what = "speech";
+ goto readdone;
+ }
+
+ // GROMs
+ switch (m_vaquerro->gromcs_out())
+ {
+ case SGMSEL:
+ for (int i=0; i < 3; i++)
+ {
+ m_sgrom[i]->readz(space, 0, &value);
+ }
+ m_gromport->readz(space, 0, &value);
+ if (TRACE_GROM && !m_A14_set) logerror("GS>%04x\n", m_sgrom[0]->debug_get_address()-1);
+ what = "system GROM";
+ goto readdone;
+
+ case TSGSEL:
+ for (int i=0; i < 8; i++)
+ {
+ m_tsgrom[i]->readz(space, 0, &value);
+ }
+ if (TRACE_GROM && !m_A14_set) logerror("GT>%04x\n", m_tsgrom[0]->debug_get_address()-1);
+ what = "TTS GROM";
+ goto readdone;
+
+ case P8GSEL:
+ for (int i=0; i < 8; i++)
+ {
+ m_p8grom[i]->readz(space, 0, &value);
+ }
+ if (TRACE_GROM && !m_A14_set) logerror("G8>%04x\n", m_p8grom[0]->debug_get_address()-1);
+ what = "P8 GROM";
+ goto readdone;
+
+ case P3GSEL:
+ for (int i=0; i < 3; i++)
+ {
+ m_p3grom[i]->readz(space, 0, &value);
+ }
+ if (TRACE_GROM && !m_A14_set) logerror("G3>%04x\n", m_p3grom[0]->debug_get_address()-1);
+ what = "P3 GROM";
+ goto readdone;
+ default:
+ break;
+ }
+
+ // These messages appear in fact every time that a GPL command writes
+ // an immediate value to a write-only address (like 9400) because the
+ // GPL interpreter always tries to load the value from the provided memory address first
+
+ logerror("Read %04x (unmapped) ignored\n", m_logical_address);
+
+ // Memory cycle ends
+ cycle_end();
+ return 0;
+ }
+ else
+ {
+ // =================================================
+ // Physical space
+ // =================================================
+ if (m_amigo->skdrcs_out()==ASSERT_LINE)
+ {
+ value = m_dram[m_physical_address & 0xffff];
+ what = "DRAM";
+ goto readdonephys;
+ }
+
+ if (m_mofetta->rom1cs_out()==ASSERT_LINE)
+ {
+ int address = (m_physical_address & 0x1fff);
+ if (m_mofetta->rom1am_out()==ASSERT_LINE) address |= 0x4000;
+ if (m_mofetta->rom1al_out()==ASSERT_LINE) address |= 0x2000;
+ value = m_rom1[address];
+
+ if (TRACE_MEM) logerror("Read %04x (ROM1@%04x) -> %02x\n", m_logical_address, address, value);
+ cycle_end();
+ return value;
+ }
+
+ if (m_mofetta->alccs_out()==ASSERT_LINE)
+ {
+ value = m_oso->read(*m_space, m_physical_address>>1);
+ what = "OSO";
+ goto readdonephys;
+ }
+
+ if (m_mofetta->prcs_out()==ASSERT_LINE)
+ {
+ value = m_pascalrom[m_physical_address & 0x3fff];
+ what = "PASCAL";
+ goto readdonephys;
+ }
+
+ if (m_mofetta->cmas_out()==ASSERT_LINE)
+ {
+ m_gromport->romgq_line(ASSERT_LINE);
+ m_gromport->readz(*m_space, m_physical_address & 0x3fff, &value);
+ what = "Cartridge";
+ goto readdonephys;
+ }
+
+ if (m_mofetta->dbc_out()==ASSERT_LINE)
+ {
+ m_peb->readz(*m_space, m_physical_address & 0xffff, &value);
+ what = "PEB";
+ goto readdonephys;
+ }
+
+ if (TRACE_PUNMAP) logerror("Read %04x (phys %06x, unmapped) ignored\n", m_logical_address, m_physical_address);
+
+ // Memory cycle ends
+ cycle_end();
+ return 0;
+ }
+
+
+readdone:
+ if (TRACE_MEM) logerror("Read %04x (%s) -> %02x\n", m_logical_address, what, value);
+ cycle_end();
+ return value;
+
+readdonephys:
+ if (TRACE_MEM) logerror("Read %04x (phys %06x, %s) -> %02x\n", m_logical_address, m_physical_address, what, value);
+ cycle_end();
+ return value;
+}
+
+void mainboard8_device::cycle_end()
+{
+ // Memory cycle ends
+ m_vaquerro->memen_in(CLEAR_LINE);
+ m_amigo->memen_in(CLEAR_LINE);
+ m_mofetta->pmemen_in(CLEAR_LINE);
+ m_peb->memen_in(CLEAR_LINE);
+}
+
+/*
+ When writing, the emulation relies on a push mechanism; the write
+ operation follows the setaddress operation immediately.
+
+ If the READY line is pulled down due to the mapping process, we must
+ store the data bus value until the physical address is available.
+*/
+WRITE8_MEMBER( mainboard8_device::write )
+{
+ m_latched_data = data;
+ m_space = &space;
+ m_pending_write = true;
+
+ // Some logical space devices can be written immediately
+ // GROMs and video must wait to be selected
+ if (m_amigo->mapper_accessed())
+ {
+ if (TRACE_MEM) logerror("Write %04x (mapper) <- %02x\n", m_logical_address, data);
+ m_amigo->write(space, 0, data);
+ m_pending_write = false;
+ }
+
+ // Sound ... we have to put it before SRAM because in compatibility mode the
+ // sound address lies within the SRAM area
+ if (m_vaquerro->sccs_out()==ASSERT_LINE)
+ {
+ if (TRACE_MEM) logerror("Write %04x (sound) <- %02x\n", m_logical_address, data);
+ m_sound->write(space, 0, data); // Sound chip will lower READY after this access
+ m_pending_write = false;
+ }
+ else
+ {
+ // SRAM
+ if (m_amigo->sramcs_out()==ASSERT_LINE)
+ {
+ if (TRACE_MEM) logerror("Write %04x (SRAM) <- %02x\n", m_logical_address, data);
+ m_sram[m_logical_address & 0x07ff] = data;
+ m_pending_write = false;
+ }
+ }
+
+ // Speech
+ if (m_vaquerro->spwt_out()==ASSERT_LINE)
+ {
+ if (TRACE_MEM) logerror("Write %04x (speech) <- %02x\n", m_logical_address, data);
+ m_speech->data_w(space, 0, data);
+ m_pending_write = false;
+ }
+
+ if (!m_pending_write)
+ cycle_end();
+
+ // The remaining physical devices will respond as soon as the physical address is completely set
+}
+
+/*
+ Set 99/4A compatibility mode (CRUS=1)
+*/
+WRITE_LINE_MEMBER( mainboard8_device::crus_in )
+{
+ if (TRACE_CRU) logerror("%s CRUS\n", (state==1)? "Assert" : "Clear");
+ m_vaquerro->crus_in(state);
+ m_amigo->crus_in(state);
+}
+
+/*
+ Set mapper /PTGEN line ("Pascal and Text-to-speech GROMs enable").
+ Note that PTGEN is negative logic.
+*/
+WRITE_LINE_MEMBER( mainboard8_device::ptgen_in )
+{
+ if (TRACE_CRU) logerror("%s PTGEN*\n", (state==0)? "Assert" : "Clear");
+ m_vaquerro->crusgl_in((state==0)? ASSERT_LINE : CLEAR_LINE);
+}
+
+
+/*
+ READY lines, to be combined
+*/
+WRITE_LINE_MEMBER( mainboard8_device::system_grom_ready )
+{
+ m_vaquerro->sgmry(state);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::ptts_grom_ready )
+{
+ m_vaquerro->tsgry(state);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::p8_grom_ready )
+{
+ m_vaquerro->p8gry(state);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::p3_grom_ready )
+{
+ m_vaquerro->p3gry(state);
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::sound_ready )
+{
+ m_sound_ready = state;
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::speech_ready )
+{
+ // The TMS5200 implementation uses TRUE/FALSE, not ASSERT/CLEAR semantics
+ m_speech_ready = (state==FALSE)? ASSERT_LINE : CLEAR_LINE;
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::pbox_ready )
+{
+ m_pbox_ready = state;
+}
+
+WRITE_LINE_MEMBER( mainboard8_device::ggrdy_in )
+{
+ m_amigo->srdy_in((state==ASSERT_LINE && m_speech_ready && m_sound_ready && m_pbox_ready)? ASSERT_LINE : CLEAR_LINE);
+}
+
+static const char *const glib0[] = { SYSGROM0_TAG, SYSGROM1_TAG, SYSGROM2_TAG };
+static const char *const glib1[] = { GLIB10_TAG, GLIB11_TAG, GLIB12_TAG, GLIB13_TAG, GLIB14_TAG, GLIB15_TAG, GLIB16_TAG, GLIB17_TAG };
+static const char *const glib2[] = { GLIB20_TAG, GLIB21_TAG, GLIB22_TAG, GLIB23_TAG, GLIB24_TAG, GLIB25_TAG, GLIB26_TAG, GLIB27_TAG };
+static const char *const glib3[] = { GLIB30_TAG, GLIB31_TAG, GLIB32_TAG };
+
+void mainboard8_device::device_start()
+{
+ logerror("Starting main board\n");
+ // Lines going to the main driver class, then to the CPU
+ m_ready.resolve_safe(); // READY
+ m_console_reset.resolve_safe(); // RESET
+ m_hold_line.resolve_safe(); // HOLD
+
+ // Setting up the links to the GROMs
+ for (int i=0; i < 8; i++)
+ {
+ if (i < 3)
+ {
+ m_sgrom[i] = downcast<tmc0430_device*>(machine().device(glib0[i]));
+ m_p3grom[i] = downcast<tmc0430_device*>(machine().device(glib3[i]));
+ }
+ m_tsgrom[i] = downcast<tmc0430_device*>(machine().device(glib1[i]));
+ m_p8grom[i] = downcast<tmc0430_device*>(machine().device(glib2[i]));
+ }
+
+ // Link to speech synthesizer
+ m_speech = downcast<cd2501ecd_device*>(machine().device(SPEECHSYN_TAG));
+
+ // Link to sound chip
+ m_sound = downcast<sn76496_base_device*>(machine().device(TISOUNDCHIP_TAG));
+
+ // Link to video
+ m_video = downcast<tms9118_device*>(machine().device(VDP_TAG));
+
+ // Link to cartridge port
+ m_gromport = downcast<gromport_device*>(machine().device(GROMPORT_TAG));
+
+ // Link to PEB
+ m_peb = downcast<peribox_device*>(machine().device(PERIBOX_TAG));
+
+ // Configure RAM and AMIGO
+ m_sram = std::make_unique<UINT8[]>(SRAM_SIZE);
+ m_dram = std::make_unique<UINT8[]>(DRAM_SIZE);
+
+ m_amigo->connect_sram(m_sram.get());
+
+ m_rom0 = machine().root_device().memregion(ROM0_REG)->base();
+ m_rom1 = machine().root_device().memregion(ROM1_REG)->base();
+ m_pascalrom = machine().root_device().memregion(PASCAL_REG)->base();
+}
+
+void mainboard8_device::device_reset()
+{
+ logerror("Resetting main board\n");
+ m_last_ready = CLEAR_LINE;
+ m_speech_ready = true;
+ m_sound_ready = true;
+ m_pbox_ready = true;
+ m_pending_write = false;
+ m_prev_grom = 0;
+ m_A14_set = false;
+}
+
+MACHINE_CONFIG_FRAGMENT( ti998_mainboard )
+ MCFG_DEVICE_ADD(VAQUERRO_TAG, VAQUERRO, 0)
+ MCFG_DEVICE_ADD(MOFETTA_TAG, MOFETTA, 0)
+ MCFG_DEVICE_ADD(AMIGO_TAG, AMIGO, 0)
+ MCFG_DEVICE_ADD(OSO_TAG, OSO, 0)
+MACHINE_CONFIG_END
+
+machine_config_constructor mainboard8_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( ti998_mainboard );
+}
+const device_type MAINBOARD8 = &device_creator<mainboard8_device>;
+
+
+/***************************************************************************
+ ===== VAQUERRO: Logical Address Space decoder =====
Logical address space (LAS)
===========================
@@ -150,649 +876,976 @@
f850-f85f: P-Code library #1 GROM read/write
f860-f86f: P-Code library #2 GROM read/write
- Physical address space (PAS)
- ============================
- The PAS is 24 bits wide and accessed via the custom mapper chip nicknamed
- "Amigo". The mapper exchanges map definitions with SRAM (see LAS). That
- means, a map can be prepared in SRAM, and for activating it, the mapper
- is accessed on its port, telling it to load or save a map.
-
- 000000-00ffff: 64 KiB console DRAM
- 010000-efffff: undefined
- f00000-f03fff: P-Code ROM (not mentioned in [1])
- f04000-feffff: undefined
- ff0000 : unmapped (code for mapper)
- ff0001-ff3fff: undefined
- ff4000-ff5fff: DSR ROM in Peripheral Box, Hexbus DSR (CRU 1700) or additional ROM (CRU 2700)
- ff6000-ff9fff: Cartridge ROM space
- ffa000-ffdfff: 16 KiB ROM1
- ffe000-ffe00f: Interrupt level sense
- ffe010-ffffff: undefined
+***************************************************************************/
- CRU map (I/O address space)
- ===========================
- 0000-003e: TMS9901 system interface (see ti99_8.c)
- 1700-17fe: Hexbus
- 2000-26fe: Future external devices
- 2700-27fe: Additional ROM ("internal DSR")
- 2702: System reset (when set to 1)
- 2800-3ffe: Future external devices
- 4000-fffe: Future external devices
+vaquerro_device::vaquerro_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+: device_t(mconfig, VAQUERRO, "Logical Address Space Decoder", tag, owner, clock, "ti998_vaquerro", __FILE__),
+ m_crus(ASSERT_LINE),
+ m_crugl(ASSERT_LINE),
+ m_ggrdy(ASSERT_LINE)
+{
+}
- The TMS9995 offers the full 15-bit CRU address space. Devices designed for
- the TI-99/4A should only be accessed in the area 1000-1ffe. They will (by
- design) incompletely decode the CRU address and be mirrored in the higher areas.
+SETADDRESS_DBIN_MEMBER( vaquerro_device::set_address )
+{
+ // Do the decoding
+ // state = dbin, offset = address
- Michael Zapf, October 2010
- February 2012: Rewritten as class
+ bool reading = (state==ASSERT_LINE);
+ bool sgfap = false;
+ bool tsgfap = false;
+ bool p8gfap = false;
+ bool p3gfap = false;
+ bool vfap = false;
- Informations taken from
- [1] ARMADILLO PRODUCT SPECIFICATIONS
- [2] TI-99/8 Graphics Programming Language interpreter
+ m_a14 = ((offset & 2)!=0)? ASSERT_LINE : CLEAR_LINE; // Needed for clock_in
-***************************************************************************/
+ m_dbin_level = (line_state)state;
-#include "998board.h"
+ int offbase = (offset & 0xfff1);
-#define TRACE_CRU 0
-#define TRACE_MEM 0
-#define TRACE_MAP 0
-#define TRACE_CONFIG 0
-#define TRACE_OSO 0
-#define TRACE_SPEECH 0
-#define TRACE_DETAIL 0
+ // =================== TI (compatibility) mode ======================
+ if (m_crus == ASSERT_LINE)
+ {
+ if (TRACE_DETAIL) logerror("Compatibility mode\n");
-mainboard8_device::mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : bus8z_device(mconfig, MAINBOARD8, "TI-99/8 Main board", tag, owner, clock, "ti998_mainboard", __FILE__),
- m_ready(*this), m_dsr_selected(false), m_hexbus_selected(false), m_CRUS(false), m_PTGE(false), m_waitcount(0), m_sram(nullptr), m_dram(nullptr), m_rom0(nullptr), m_rom1(nullptr), m_pcode(nullptr),
- m_oso(*this, OSO_TAG)
- { }
+ // SPRD (Speech read)
+ m_sprd = ((offbase==0x9000) && reading);
-/***************************************************************************
- CRU access
-***************************************************************************/
+ // SPWT (Speech write)
+ m_spwt = ((offbase==0x9400) && !reading);
-#define HEXBUS_CRU_BASE 0x1700
-#define MAPPER_CRU_BASE 0x2700
+ // Sound
+ m_sccs = ((offbase==0x8400)&& !reading);
-READ8Z_MEMBER(mainboard8_device::crureadz)
+ // ROM0
+ m_sromcs = (((offset & 0xe000)==0x0000) && reading);
+
+ // Video select
+ vfap = ((offbase==0x8800) && reading) || ((offbase==0x8c00) && !reading);
+
+ // System GROM
+ sgfap = ((offbase==0x9800) && reading) || ((offbase==0x9c00) && !reading);
+ }
+ // ====================== Native mode ======================
+ else
+ {
+ if (TRACE_DETAIL) logerror("Native mode\n");
+
+ // SPRD (Speech read)
+ m_sprd = ((offbase==0xf820) && reading);
+
+ // SPWT (Speech write)
+ m_spwt = ((offbase==0xf820) && !reading);
+
+ // Sound
+ m_sccs = ((offbase==0xf800) && !reading);
+
+ // Video
+ vfap = (offbase==0xf810);
+
+ // System GROM (read and write)
+ sgfap = (offbase==0xf830);
+ }
+
+ // These lines are not decoded for compatibility or native mode, only
+ // the line CRUGL determines whether they become visible.
+ tsgfap = (offbase==0xf840) && m_crugl;
+ p8gfap = (offbase==0xf850) && m_crugl;
+ p3gfap = (offbase==0xf860) && m_crugl;
+
+ // The LASREQ line says whether Vaquerro does the job, or whether it is Mofetta's turn.
+ m_grom_or_video = sgfap || tsgfap || p8gfap || p3gfap || vfap ;
+
+ m_lasreq = (m_sprd || m_spwt || m_sccs || m_sromcs || m_grom_or_video);
+
+ if (TRACE_DETAIL) logerror("sgfap=%d tsgfap=%d p8gfap=%d p3gfap=%d vfap=%d\n", sgfap, tsgfap, p8gfap, p3gfap, vfap);
+
+ // Pass the selection to the wait state generators
+ // and pick up the current select line states
+ m_sgmws.select_in(sgfap);
+ m_tsgws.select_in(tsgfap);
+ m_p8gws.select_in(p8gfap);
+ m_p3gws.select_in(p3gfap);
+ m_vidws.select_in(vfap);
+
+ m_gromsel = m_sgmws.select_out() | m_tsgws.select_out() | m_p8gws.select_out() | m_p3gws.select_out();
+
+ m_vdprd = (reading && (m_vidws.select_out()!=0));
+ m_vdpwt = (!reading && (m_vidws.select_out()!=0));
+
+ if (m_grom_or_video)
+ {
+ // We don't see the current selection now; only with next clock pulse.
+ m_mainboard->ggrdy_in(m_sry);
+ if (TRACE_READY) logerror("GGRDY = %d\n", m_sry);
+ }
+}
+
+WRITE_LINE_MEMBER( vaquerro_device::crusgl_in )
+{
+ m_crugl = (state==ASSERT_LINE);
+}
+
+WRITE_LINE_MEMBER( vaquerro_device::crus_in )
+{
+ m_crus = (line_state)state;
+}
+
+WRITE_LINE_MEMBER( vaquerro_device::memen_in )
{
- if (TRACE_CRU) logerror("%s: read CRU %04x ignored\n", tag(), offset);
- // Nothing here.
+ m_memen = (state==ASSERT_LINE);
}
/*
- CRU handling. We handle the internal device at CRU address 0x2700 via
- this mapper component.
+ Called by Mofetta
*/
-WRITE8_MEMBER(mainboard8_device::cruwrite)
+READ_LINE_MEMBER( vaquerro_device::lascsq_out )
{
- if ((offset & 0xff00)==MAPPER_CRU_BASE)
- {
- int bit = (offset & 0xff)>>1;
- switch (bit)
- {
- case 0:
- // Turn on/off the internal DSR
- m_dsr_selected = (data!=0);
- if (TRACE_CRU) logerror("%s: DSR select = %d\n", tag(), data);
- break;
- case 1:
- if (TRACE_CRU) logerror("%s: System reset by CRU request\n", tag());
- machine().schedule_soft_reset();
- break;
- }
- return;
- }
+ return (m_lasreq && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
- if ((offset & 0xff00)==HEXBUS_CRU_BASE)
- {
- int bit = (offset & 0xff)>>1;
- switch (bit)
- {
- case 0:
- // Turn on/off the Hexbus DSR
- m_hexbus_selected = (data!=0);
- if (TRACE_CRU) logerror("%s: Hexbus select = %d\n", tag(), data);
- break;
- default:
- if (TRACE_CRU) logerror("%s: Set CRU>%04x (Hexbus) to %d\n", tag(), offset,data);
- break;
- }
- return;
- }
+/*
+ Incoming ready lines from the GROM library
+*/
+WRITE_LINE_MEMBER( vaquerro_device::sgmry )
+{
+ if (TRACE_READY) logerror("Incoming SGMRY = %d\n", state);
+ m_sgmws.ready_in((line_state)state);
+}
- if ((offset & 0xff00)>=0x0100)
- {
- if (TRACE_CRU) logerror("%s: Set CRU>%04x (unknown) to %d\n", tag(), offset,data);
- return;
- }
+WRITE_LINE_MEMBER( vaquerro_device::tsgry )
+{
+ if (TRACE_READY) logerror("Incoming TSGRY = %d\n", state);
+ m_tsgws.ready_in((line_state)state);
}
-void mainboard8_device::CRUS_set(bool state)
+WRITE_LINE_MEMBER( vaquerro_device::p8gry )
{
- if (TRACE_CRU) logerror("%s: set CRUS=%d\n", tag(), state);
- m_CRUS = state;
+ if (TRACE_READY) logerror("Incoming 8GRY = %d\n", state);
+ m_p8gws.ready_in((line_state)state);
+}
+
+WRITE_LINE_MEMBER( vaquerro_device::p3gry )
+{
+ if (TRACE_READY) logerror("Incoming P3GRY = %d\n", state);
+ m_p3gws.ready_in((line_state)state);
}
/*
- Note that PTGEN is negative logic. We invert these semantics here.
+ Outgoing READY
*/
-void mainboard8_device::PTGE_set(bool state)
+READ_LINE_MEMBER( vaquerro_device::ggrdy_out )
{
- if (TRACE_CRU) logerror("%s: set PTGEN=%d\n", tag(), state? 1:0);
- m_PTGE = state;
+ if (TRACE_READY) logerror("GGRDY out = %d\n", m_ggrdy);
+ return m_ggrdy;
}
-/***************************************************************************
- Access by address map
-***************************************************************************/
+/*
+ Select lines
+*/
+
+// =========================
+
+int vaquerro_device::gromcs_out()
+{
+ return m_gromsel;
+}
+
+// =========================
+
+READ_LINE_MEMBER( vaquerro_device::vdprd_out )
+{
+ return (m_vdprd && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( vaquerro_device::vdpwt_out )
+{
+ return (m_vdpwt && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( vaquerro_device::sprd_out )
+{
+ return (m_sprd && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( vaquerro_device::spwt_out )
+{
+ return (m_spwt && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( vaquerro_device::sromcs_out )
+{
+ return (m_sromcs && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( vaquerro_device::sccs_out )
+{
+ return (m_sccs && m_memen)? ASSERT_LINE : CLEAR_LINE;
+}
/*
- This method is called via the address map.
+ Incoming clock signal.
+
+ The Vaquerro has a Wait State generation logic circuit for the video
+ processor and all 4 GROM libraries. Each one has its separate generator.
+ The GROMs get a 16 cycle wait period after their access, while the video
+ processors gets an 8 cycle wait period. If during that period another
+ access occurs, the system READY line will be cleared, triggering wait
+ states in the CPU.
*/
-READ8_MEMBER( mainboard8_device::readm )
+WRITE_LINE_MEMBER( vaquerro_device::clock_in )
{
- UINT8 value = 0;
- bool found;
- if (TRACE_DETAIL) logerror("%s: read from %04x\n", tag(), offset);
- found = access_logical_r(space, offset, &value, mem_mask);
- m_waitcount = 2;
+ line_state level = (line_state)state;
- if (!found)
- {
- // In that case, the address decoder could not find a suitable device.
- // This means the logical address is transformed by the mapper.
- // NOTE: Use "+", not OR. The offset is not a prefix.
- UINT32 pas_address = m_pas_offset[(offset & 0xf000)>>12] + (offset & 0xfff);
+ // Propagate to the wait state generators (note that we need both clock levels)
+ m_sgmws.clock_in(level);
+ m_tsgws.clock_in(level);
+ m_p8gws.clock_in(level);
+ m_p3gws.clock_in(level);
+ m_vidws.clock_in(level);
+
+ // Collect the selections
+ // Each one has its own indication, defined at init time
+ m_gromsel = m_sgmws.select_out() | m_tsgws.select_out() | m_p8gws.select_out() | m_p3gws.select_out();
+
+ bool reading = (m_dbin_level==ASSERT_LINE);
- // So now let's do the same as above with physical addresses
- access_physical_r(space, pas_address, &value, mem_mask);
+ m_vdprd = (reading && (m_vidws.select_out()!=0));
+ m_vdpwt = (!reading && (m_vidws.select_out()!=0));
- // The PAS area requires one more wait state, as the address bus
- // is multiplexed
- m_waitcount = 3;
+ // Get the READY levels from the GROMs
+ if (level==CLEAR_LINE)
+ {
+ m_sry = m_sgmws.ready_out() || m_tsgws.ready_out() || m_p8gws.ready_out() || m_p3gws.ready_out() || m_vidws.ready_out();
+ if (TRACE_WS) logerror("ready_out = (%d, %d, %d, %d, %d)\n", m_sgmws.ready_out(), m_tsgws.ready_out(), m_p8gws.ready_out(), m_p3gws.ready_out(),m_vidws.ready_out());
}
- // Insert wait states and let CPU enter wait state
- m_ready(CLEAR_LINE);
+ // If the output gate is closed, propagate ASSERT_LINE (pulled up)
+ m_ggrdy = (!m_grom_or_video || m_sry)? ASSERT_LINE : CLEAR_LINE;
+}
- return value;
+
+void vaquerro_device::device_start()
+{
+ logerror("Starting\n");
+ m_mainboard = downcast<mainboard8_device*>(owner());
+ m_sgmws.init(SGMSEL);
+ m_tsgws.init(TSGSEL);
+ m_p8gws.init(P8GSEL);
+ m_p3gws.init(P3GSEL);
+ m_vidws.init(VIDSEL);
}
-WRITE8_MEMBER( mainboard8_device::writem )
+void vaquerro_device::device_reset()
{
- bool found;
+ m_ggrdy = ASSERT_LINE;
+ m_vdpwt = m_vdprd = CLEAR_LINE;
+ m_gromsel = 0;
+ m_sgmws.treset_in(ASSERT_LINE);
+ m_tsgws.treset_in(ASSERT_LINE);
+ m_p8gws.treset_in(ASSERT_LINE);
+ m_p3gws.treset_in(ASSERT_LINE);
+ m_vidws.treset_in(ASSERT_LINE);
+}
- // Look for components responding to the logical address
- found = access_logical_w(space, offset, data, mem_mask);
- m_waitcount = 2;
+/*
+ Wait state generation logic inside Vaquerro
+
+ Analysis of the logic diagram of the Vaquerro delivers the following
+ behavior (for the first GROM library; similar behavior applies for the
+ other libraries). Note that the CLKOUT line is inverted.
+
+ 1. When the GROMs are unselected by address (SGFAP), the SRY line is Z
+ (System READY). The GROM ready line (SGMRY) has no effect.
+ 2. When SGFAP is asserted while the internal counter is off, the
+ READY line changes from Z to Low and the GROM select line (SGCS) is
+ asserted (both immediately, before the next tick edge). SGMRY has no effect.
+ The circuit state is constant during further clock ticks.
+ 3. After being selected, when SGMRY is asserted (GROM is ready), SRY
+ changes to High on the next trailing edge. This will allow the
+ CPU to complete the GROM access on the next cycle,
+ and the address bus will change, typically deselecting the GROMs.
+ Until this deselection, the circuit state remains constant
+ (SGCS asserted, READY=H).
+ 4. When the GROMs are deselected, SRY changes to Z, and SGCS is cleared
+ (immediately). A counter is started at 0 that is incremented on each clock
+ tick (leading edge).
+ 5. When SGFAP is asserted while the counter is less that 15, SRY changes
+ to Low immediately. SGCS remains cleared, so the GROMs are not selected.
+ While SGFAP stays cleared, the counter completes its way to 15,
+ then 0, and turns off.
+ 6. When the counter reaches 15, it returns to 0 on the next tick
+ (leading). On the following trailing edge, the GROM select line is
+ asserted, while the READY line remains Low.
+ 7. Continue at 3.
+*/
+void waitstate_generator::select_in(bool addressed)
+{
+ m_addressed = addressed;
+}
- if (!found)
- {
- // In that case, the address decoder could not find a suitable device.
- // This means the logical address is transformed by the mapper.
- // NOTE: Use "+", not OR. The offset is not a prefix.
- UINT32 pas_address = m_pas_offset[(offset & 0xf000)>>12] + (offset & 0xfff);
+int waitstate_generator::select_out()
+{
+ return (!m_counting && m_addressed)? m_selvalue : 0;
+}
- // So now let's do the same as above with physical addresses
- access_physical_w(space, pas_address, data, mem_mask);
+/*
+ Should be low by default.
+*/
+line_state waitstate_generator::ready_out()
+{
+ return (m_ready && !m_counting && m_generate)? ASSERT_LINE : CLEAR_LINE;
+}
- // The PAS area requires one more wait state, as the address bus
- // is multiplexed
- m_waitcount = 3;
- }
+bool waitstate_generator::is_counting()
+{
+ return m_counting;
+}
- // Insert wait states and let CPU enter wait state
- m_ready(CLEAR_LINE);
+bool waitstate_generator::is_generating()
+{
+ return m_generate;
+}
+
+bool waitstate_generator::is_ready()
+{
+ return m_ready;
}
-/***************************************************************************
- Indirect calls (mapper calls itself)
-***************************************************************************/
/*
- This method is called by the mapper itself for
- f870 (NATIVE): mapper: ignore
- 8810 (TI99EM): mapper: ignore
- ff4000 (PHYSIC): DSR
+ READY in. This may only show an effect with the next trailing edge of CLKOUT.
*/
-READ8Z_MEMBER( mainboard8_device::readz )
+void grom_waitstate_generator::ready_in(line_state ready)
{
- if ((offset & 0xffe000)==0xff4000)
+ m_ready = (ready==ASSERT_LINE);
+}
+
+void grom_waitstate_generator::clock_in(line_state clkout)
+{
+ if (clkout == ASSERT_LINE)
+ {
+ if (m_counting) m_counter++;
+ }
+ else
{
- if (m_dsr_selected)
+ if (m_counting && m_counter==16)
{
- // Starts at 0x4000 in the image
- *value = m_rom1[0x4000 | (offset & 0x1fff)];
- if (TRACE_MEM) logerror("%s: (intDSR) %04x -> %02x\n", tag(), offset, *value);
+ m_counter = 0;
+ m_counting = false;
}
else
{
- if (m_hexbus_selected)
- {
- if ((offset & 0x1ff0)==0x1ff0)
- {
- *value = m_oso->read(space, (offset>>1) & 0x0003);
- }
- else
- {
- // Starts at 0x6000 in the image
- *value = m_rom1[0x6000 | (offset & 0x1fff)];
- if (TRACE_MEM) logerror("%s: (HexDSR) %04x -> %02x\n", tag(), offset, *value);
- }
- }
+ if (!m_addressed && m_generate) m_counting = true;
+ m_generate = ((m_addressed || m_counting) && (m_counter != 15));
}
}
+}
+
+void waitstate_generator::treset_in(line_state reset)
+{
+ if (reset==ASSERT_LINE)
+ {
+ m_counter = 0;
+ m_generate = m_counting = m_addressed = false;
+ }
+}
+
+void video_waitstate_generator::clock_in(line_state clkout)
+{
+ if (clkout == ASSERT_LINE)
+ {
+ if (m_counting) m_counter++;
+ }
else
{
- if (((offset & 0xfff0)==0xf870 && m_CRUS==false)||(((offset & 0xfff0)==0x8810 && m_CRUS==true)))
+ if (m_counting && m_counter==7)
+ {
+ m_counter = 0;
+ m_counting = false;
+ }
+ else
{
- if (TRACE_MEM) logerror("%s: read access to mapper ignored: %04x\n", tag(), offset);
+ if (!m_addressed && m_generate) m_counting = true;
+ m_generate = ((m_addressed || m_counting) && (m_counter != 6));
}
}
}
+const device_type VAQUERRO = &device_creator<vaquerro_device>;
+
+/***************************************************************************
+ ===== MOFETTA: Physical Address Space decoder =====
+
+ Physical address space (PAS)
+ ============================
+ The PAS is 24 bits wide and accessed via the custom mapper chip nicknamed
+ "Amigo". The mapper exchanges map definitions with SRAM (see LAS). That
+ means, a map can be prepared in SRAM, and for activating it, the mapper
+ is accessed on its port, telling it to load or save a map.
+
+ 000000-00ffff: 64 KiB console DRAM
+ 010000-efffff: undefined
+
+ f00000-f03fff: PASCAL support ROM (not mentioned in [1])
+
+ f04000-feffff: undefined
+ ff0000 : unmapped (code for mapper)
+ ff0001-ff3fff: undefined
+ ff4000-ff5fff: DSR ROM in Peripheral Box, Hexbus DSR (CRU 1700) or additional ROM (CRU 2700)
+ ff6000-ff9fff: Cartridge ROM space
+ ffa000-ffdfff: 16 KiB ROM1
+ ffe000-ffe00f: Interrupt level sense
+ ffe010-ffffff: undefined
+
+
+***************************************************************************/
+
+enum
+{
+ UNDEF=0,
+ DRAM,
+ PASCAL,
+ INTERNAL
+};
+
+mofetta_device::mofetta_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, MOFETTA, "Physical Address Space Decoder", tag, owner, clock, "ti998_mofetta", __FILE__),
+ m_gotfirstword(false)
+{
+}
+
+SETADDRESS_DBIN_MEMBER( mofetta_device::set_address )
+{
+ if (!m_gotfirstword)
+ {
+ // Store the first word and wait for clearing of MSAST
+ if (TRACE_MOFETTA) logerror("Got the upper word of the address: %04x\n", offset);
+ m_address_latch = offset;
+ }
+ else
+ {
+ // Second part - now decode the address
+ if (TRACE_MOFETTA) logerror("Got the lower word of the address: %04x\n", offset);
+
+ bool acs, tcs, rcs, acsx;
+ bool reading = (state==ASSERT_LINE);
+ int offbase = (offset & 0xe000);
+
+ // PASCAL ROM select (16K)
+ m_prcs = (m_prefix == 0xf0) && ((offset & 0xc000) == 0x0000);
+
+ // Hexbus select
+ acs = (m_prefix == 0xff) && (offbase == 0x4000) && m_alcpg;
+
+ // Internal DSR select (ff4000-ff5fff @ CRU>2700)
+ tcs = (m_prefix == 0xff) && (offbase == 0x4000) && m_txspg;
+
+ // Hexbus select (ff4000-ff5fef @ CRU>1700), excluding OSO
+ acsx = acs && ((offset & 0x1ff0)!=0x1ff0);
+
+ // Upper 16K of ROM1
+ m_rom1am = !((offbase == 0xa000) || (offbase == 0xc000));
+
+ // ROM select
+ rcs = (m_prefix == 0xff) && reading && !m_rom1am;
+
+ // ROM1 select (containing 16K ROM, 8K TTS, 8K ACS)
+ m_rom1cs = tcs || rcs || acsx;
+
+ // Accessing OSO (ff5ff0 @ CRU>1700)
+ m_alccs = acs && ((offset & 0x1ff0)==0x1ff0);
+
+ // Second half of ROM or ACS
+ m_rom1al = reading && (m_prefix == 0xff) && ((offbase == 0xc000) || acs);
+
+ // Cartridge port (ff6000-ff9fff)
+ m_cmas = (m_prefix == 0xff) && ((offbase == 0x6000) || (offbase == 0x8000));
+
+ m_gotfirstword = false;
+ }
+}
+
/*
- This method is called by the mapper itself for
- ff4000 (PHYSIC): DSR. ignore
+ Mofetta delivers the GROMCLK. In the 99/4A, this clock is produced by the VDP.
+ Apart from that, Mofetta does not need the CLKOUT.
+*/
+WRITE_LINE_MEMBER( mofetta_device::clock_in )
+{
+ if (state == CLEAR_LINE) // TODO: Correct edge?
+ {
+ m_gromclock_count++;
+ if (m_gromclock_count >=3)
+ {
+ m_gromclk_up = !m_gromclk_up;
+ m_gromclock_count = 0;
+ }
+ }
+}
+
+READ_LINE_MEMBER( mofetta_device::alccs_out )
+{
+ return (m_alccs && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( mofetta_device::gromclk_out )
+{
+ return m_gromclk_up? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( mofetta_device::rom1cs_out )
+{
+ return (m_rom1cs && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+READ_LINE_MEMBER( mofetta_device::rom1am_out )
+{
+ return (m_rom1am && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( mofetta_device::rom1al_out )
+{
+ return (m_rom1al && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( mofetta_device::prcs_out )
+{
+ return (m_prcs && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+READ_LINE_MEMBER( mofetta_device::cmas_out )
+{
+ return (m_cmas && m_pmemen)? ASSERT_LINE : CLEAR_LINE;
+}
+
+/*
+ Asserted when a PEB access occurs
*/
-WRITE8_MEMBER( mainboard8_device::write )
+READ_LINE_MEMBER( mofetta_device::dbc_out )
+{
+ return (m_lasreq || m_cmas || m_rom1cs || m_skdrcs || !m_pmemen)? CLEAR_LINE : ASSERT_LINE;
+}
+
+WRITE8_MEMBER(mofetta_device::cruwrite)
{
- if ((offset & 0xffe000)==0xff4000)
+ if ((offset & 0xff00)==0x2700)
{
- if (m_hexbus_selected)
+ if ((offset & 0x0002)!=0)
{
- if ((offset & 0x1ff0)==0x1ff0)
- {
- m_oso->write(space, (offset>>1) & 0x0003, data);
- }
- else
- {
- logerror("%s: Write access to Hexbus DSR address %06x ignored\n", tag(), offset);
- }
+ // SWRST (Software reset)
+ // Value seems to be irrelevant
+ if (TRACE_CRU) logerror("Doing a software reset by SBO 2702\n");
+ m_mainboard->reset_console(ASSERT_LINE);
+ m_mainboard->reset_console(CLEAR_LINE);
}
else
{
- if (m_dsr_selected)
- {
- logerror("%s: Write access to internal DSR address %06x ignored\n", tag(), offset);
- }
- else
- {
- logerror("%s: Write access to unmapped DSR space at address %06x ignored\n", tag(), offset);
- }
+ m_txspg = (data!=0); // CRU>2700
+ if (TRACE_CRU) logerror("Turning %s CRU>2700\n", m_txspg? "on" : "off");
}
}
else
{
- if (((offset & 0xfff0)==0xf870 && m_CRUS==false)||(((offset & 0xfff0)==0x8810 && m_CRUS==true)))
+ if ((offset & 0xff00)==0x1700)
{
- mapwrite(offset, data);
+ m_alcpg = (data!=0); // CRU>1700
+ if (TRACE_CRU) logerror("Turning %s CRU>1700\n", m_alcpg? "on" : "off");
}
}
}
/*
- Reconfigure mapper. Writing to this address copies the values in the
- SRAM into the mapper and vice versa.
- Format:
- 0000 bbbl; bbb=bank, l=load
-
- TODO: Emulate properly, making use of HOLD
+ Setting or clearing the MSAST line.
*/
-void mainboard8_device::mapwrite(int offset, UINT8 data)
+WRITE_LINE_MEMBER( mofetta_device::msast_in )
{
- if ((data & 0xf0)==0x00)
+ if (state == ASSERT_LINE)
{
- int bankindx = (data & 0x0e)>>1;
- if (data & 1)
+ if (m_msast == CLEAR_LINE) // Leading edge
{
- if (TRACE_MAP) logerror("%s: load mapper from SRAM, bank %d\n", tag(), bankindx);
- // Load from SRAM
- // In reality the CPU is put on HOLD during this transfer
- for (int i=0; i < 16; i++)
- {
- int ptr = (bankindx << 6);
- m_pas_offset[i] = (m_sram[(i<<2) + ptr] << 24) | (m_sram[(i<<2)+ ptr+1] << 16)
- | (m_sram[(i<<2) + ptr+2] << 8) | (m_sram[(i<<2) + ptr+3]);
- if (TRACE_MAP) logerror("%s: load %d=%08x\n", tag(), i, m_pas_offset[i]);
- }
- }
- else
- {
- if (TRACE_MAP) logerror("%s: store mapper to SRAM, bank %d\n", tag(), bankindx);
- // Store in SRAM
- for (int i=0; i < 16; i++)
- {
- int ptr = (bankindx << 6);
- m_sram[(i<<2) + ptr] = (m_pas_offset[i] >> 24)& 0xff;
- m_sram[(i<<2) + ptr +1] = (m_pas_offset[i] >> 16)& 0xff;
- m_sram[(i<<2) + ptr +2] = (m_pas_offset[i] >> 8)& 0xff;
- m_sram[(i<<2) + ptr +3] = (m_pas_offset[i])& 0xff;
- if (TRACE_MAP) logerror("%s: save %d=%08x\n", tag(), i, m_pas_offset[i]);
- }
+ m_gotfirstword = true; // Process first word
+ // We now have the first part, containing the flags and the upper byte.
+ m_prefix = m_address_latch & 0xff;
}
}
+ // TODO: Evaluate the first three bits
+ m_msast = (line_state)state;
}
-/***************************************************************************
- Lookup methods.
-***************************************************************************/
+WRITE_LINE_MEMBER( mofetta_device::pmemen_in )
+{
+ m_pmemen = (state==ASSERT_LINE);
+}
-bool mainboard8_device::access_logical_r(address_space& space, offs_t offset, UINT8 *value, UINT8 mem_mask )
+WRITE_LINE_MEMBER( mofetta_device::lascs_in )
{
- bool found = false;
- logically_addressed_device *ldev = m_logcomp.first();
- bus8z_device *bdev;
+ m_lasreq = (state==ASSERT_LINE);
+}
- if (TRACE_DETAIL) logerror("%s: offset=%04x; CRUS=%d, PTGEN=%d\n", tag(), offset, m_CRUS? 1:0, m_PTGE? 0:1);
- while (ldev != nullptr)
- {
- if (TRACE_DETAIL) logerror("%s: checking node=%s\n", tag(), ldev->m_config->name);
- // Check the mode
- if (((ldev->m_config->mode == NATIVE) && (m_CRUS==false))
- || ((ldev->m_config->mode == TI99EM) && (m_CRUS==true))
- || ((ldev->m_config->mode == PATGEN) && (m_PTGE==true)))
- {
- if ((offset & ldev->m_config->address_mask)==ldev->m_config->select_pattern)
- {
- switch (ldev->m_kind)
- {
- case MAP8_SRAM:
- *value = m_sram[offset & ~ldev->m_config->address_mask];
- if (TRACE_MEM) logerror("%s: (SRAM) %04x -> %02x\n", tag(), offset, *value);
- break;
- case MAP8_ROM0:
- // Starts at 0000
- *value = m_rom0[offset & ~ldev->m_config->address_mask];
- if (TRACE_MEM) logerror("%s: (ROM0) %04x -> %02x\n", tag(), offset, *value);
- break;
- case MAP8_DEV:
- // device
- bdev = static_cast<bus8z_device*>(ldev->m_device);
- bdev->readz(space, offset, value, mem_mask);
- if (TRACE_MEM) logerror("%s: (dev %s) %04x -> %02x\n", tag(), ldev->m_config->name, offset, *value);
- break;
- default:
- if (TRACE_MEM) logerror("%s: Invalid kind for read access: %d\n", tag(), ldev->m_kind);
- }
- found = true;
- if (ldev->m_config->stop==STOP) break;
- }
- }
- ldev = ldev->m_next;
- }
- return found;
+WRITE_LINE_MEMBER( mofetta_device::skdrcs_in )
+{
+ m_skdrcs = (state==ASSERT_LINE);
}
-bool mainboard8_device::access_logical_w(address_space& space, offs_t offset, UINT8 data, UINT8 mem_mask )
+void mofetta_device::device_start()
{
- bool found = false;
- logically_addressed_device *ldev = m_logcomp.first();
- bus8z_device *bdev;
+ logerror("Starting\n");
+ m_mainboard = downcast<mainboard8_device*>(owner());
+}
- while (ldev != nullptr)
- {
- // Check the mode
- if (((ldev->m_config->mode == NATIVE) && (m_CRUS==false))
- || ((ldev->m_config->mode == TI99EM) && (m_CRUS==true))
- || ((ldev->m_config->mode == PATGEN) && (m_PTGE==true)))
- {
- if ((offset & ldev->m_config->address_mask)==(ldev->m_config->select_pattern | ldev->m_config->write_select))
- {
- switch (ldev->m_kind)
- {
- case MAP8_SRAM:
- m_sram[offset & ~ldev->m_config->address_mask] = data;
- if (TRACE_MEM) logerror("%s: (SRAM) %04x <- %02x\n", tag(), offset, data);
- break;
- case MAP8_ROM0:
- if (TRACE_MEM) logerror("%s: (ROM0) %04x <- %02x (ignored)\n", tag(), offset, data);
- break;
- case MAP8_DEV:
- // device
- bdev = static_cast<bus8z_device*>(ldev->m_device);
- bdev->write(space, offset, data, mem_mask);
- if (TRACE_MEM) logerror("%s: (dev %s) %04x <- %02x\n", tag(), ldev->m_config->name, offset, data);
- break;
- default:
- if (TRACE_MEM) logerror("%s: Invalid kind for write access: %d\n", tag(), ldev->m_kind);
- }
- found = true;
- if (ldev->m_config->stop==STOP) break;
- }
- }
- ldev = ldev->m_next;
- }
- return found;
+void mofetta_device::device_reset()
+{
+ m_gotfirstword = false;
+ m_alcpg = false;
+ m_txspg = false;
+ m_prefix = 0;
+}
+
+
+const device_type MOFETTA = &device_creator<mofetta_device>;
+
+/***************************************************************************
+
+ ==============================
+ Mapper (codename "Amigo")
+ ==============================
+
+ Unfortunately, we do not have logic diagrams for Amigo, so we have to
+ guess how it is actually working.
+
+ Initial setting of mapper (as defined in the power-up routine, TI-99/4A mode)
+
+ 0 00ff0000 -> Unmapped; logical address 0000...0fff = ROM0
+ 1 00ff0000 -> Unmapped; logical address 1000...1fff = ROM0
+ 2 00000800 -> DRAM; 2000 = 000800, 2fff = 0017ff
+ 3 00001800 -> DRAM; 3000 = 001800, 3fff = 0027ff
+ 4 00ff4000 -> DSR space (internal / ioport)
+ 5 00ff5000 -> DSR space (internal / ioport)
+ 6 00ff6000 -> Cartridge space (6000..6fff)
+ 7 00ff7000 -> Cartridge space (7000..7fff)
+ 8 00ff0000 -> Unmapped; device ports (VDP) and SRAM
+ 9 00ff0000 -> Unmapped; device ports (Speech, GROM)
+ A 00002800 -> DRAM; a000 = 002800, afff = 0037ff
+ B 00003800 -> DRAM; b000 = 003800, bfff = 0047ff
+ C 00004800 -> DRAM; c000 = 004800, cfff = 0057ff
+ D 00005800 -> DRAM; d000 = 005800, dfff = 0067ff
+ E 00006800 -> DRAM; e000 = 006800, efff = 0077ff
+ F 00007800 -> DRAM; f000 = 007800, ffff = 0087ff
+
+ Format of map table entry
+
+ +--+---+---+---+---+---+---+---+ +-----------+ +----------+ +---------+
+ | W| X | R | 0 | 0 | 0 | 0 | 0 | | Upper (8) | | High (8) | | Low (8) |
+ +--+---+---+---+---+---+---+---+ +-----------+ +----------+ +---------+
+
+ W: Write protection if set to 1
+ X: Execute protection if set to 1
+ R: Read protection if set to 1
+
+ When a protection violation occurs, the tms9901 INT1* pin is pulled low
+ (active). The pin remains low until the mapper status register is read.
+
+ Address handling
+ ----------------
+ Physical address is (Upper * 2^16) + (High * 2^8) + Low
+
+ The mapper calculates the actual physical address by looking up the
+ table entry from the first four bits of the logical address and then
+ *adding* the remaining 12 bits of the logical address on the map value.
+
+ The value 0xff0000 is used to indicate a non-mapped area.
+
+ Mapper control register
+ -----------------------
+ The mapper control register is used to initiate a map load/save operation.
+
+ +---+---+---+---+---+---+---+---+
+ | 0 | 0 | 0 | 0 | Map File | RW|
+ +---+---+---+---+---+---+---+---+
+
+ The map file is a number from 0-7 indicating the set of map values for the
+ operation, which means the location in SRAM where the next 64 values are
+ loaded from or stored into.
+
+ RW = 1: load from SRAM into mapper
+ RW = 0: store from mapper into SRAM
+
+ When read, the mapper register returns the violation flags:
+ +---+---+---+---+---+---+---+---+
+ | W | X | R | 0 | 0 | 0 | 0 | 0 |
+ +---+---+---+---+---+---+---+---+
+
+***************************************************************************/
+
+amigo_device::amigo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+: device_t(mconfig, AMIGO, "Address space mapper", tag, owner, clock, "ti998_amigo", __FILE__),
+ m_logical_space(true),
+ m_crus(ASSERT_LINE)
+{
}
+enum
+{
+ IDLE = 0,
+ CREATE_PADDR,
+ ADDR_MSW,
+ ADDR_LSW,
+ SRAMLOAD,
+ SRAMSAVE
+};
-void mainboard8_device::access_physical_r( address_space& space, offs_t pas_address, UINT8 *value, UINT8 mem_mask )
+/*
+ Incoming READY line (SRDY)
+*/
+WRITE_LINE_MEMBER( amigo_device::srdy_in )
{
- physically_addressed_device *pdev = m_physcomp.first();
- bus8z_device *bdev;
+ if (TRACE_READY) logerror("Incoming SRDY = %d\n", state);
+ m_srdy = (line_state)state;
- while (pdev != nullptr)
+ // If the access is going to logical space, pass through the READY line
+ if (m_logical_space)
{
- if ((pas_address & pdev->m_config->address_mask)==pdev->m_config->select_pattern)
- {
- switch (pdev->m_kind)
- {
- case MAP8_DRAM:
- *value = m_dram[pas_address & ~pdev->m_config->address_mask];
- if (TRACE_MEM) logerror("%s: (DRAM) %06x -> %02x\n", tag(), pas_address, *value);
- break;
- case MAP8_ROM1A0:
- // Starts at 0000 in the image, 8K
- *value = m_rom1[pas_address & 0x1fff];
- if (TRACE_MEM) logerror("%s: (ROM) %06x -> %02x\n", tag(), pas_address, *value);
- break;
- case MAP8_ROM1C0:
- // Starts at 2000 in the image, 8K
- *value = m_rom1[0x2000 | (pas_address & 0x1fff)];
- if (TRACE_MEM) logerror("%s: (ROM) %06x -> %02x\n", tag(), pas_address, *value);
- break;
- case MAP8_PCODE:
- *value = m_pcode[pas_address & 0x3fff];
- if (TRACE_MEM) logerror("%s: (PCODE) %06x -> %02x\n", tag(), pas_address, *value);
- break;
- case MAP8_INTS:
- // Interrupt sense
- logerror("%s: ILSENSE not implemented.\n", tag());
- break;
- case MAP8_DEV:
- // devices
- bdev = static_cast<bus8z_device*>(pdev->m_device);
- bdev->readz(space, pas_address, value, mem_mask);
- if (TRACE_MEM) logerror("%s: (dev %s) %06x -> %02x\n", tag(), pdev->m_config->name, pas_address, *value);
- break;
- default:
- logerror("%s: Invalid kind for physical read access: %d\n", tag(), pdev->m_kind);
- }
- if (pdev->m_config->stop==STOP) break;
- }
- pdev = pdev->m_next;
+ if (TRACE_CPURY) logerror("Setting CPURY = %d (SRDY)\n", m_ready_out);
+ m_ready_out = m_srdy;
}
}
-void mainboard8_device::access_physical_w( address_space& space, offs_t pas_address, UINT8 data, UINT8 mem_mask )
+WRITE_LINE_MEMBER( amigo_device::memen_in )
{
- physically_addressed_device *pdev = m_physcomp.first();
- bus8z_device *bdev;
+ m_memen = (state==ASSERT_LINE);
+}
- while (pdev != nullptr)
- {
- if ((pas_address & pdev->m_config->address_mask)==(pdev->m_config->select_pattern | pdev->m_config->write_select))
- {
- switch (pdev->m_kind)
- {
- case MAP8_DRAM:
- m_dram[pas_address & ~pdev->m_config->address_mask] = data;
- if (TRACE_MEM) logerror("%s: (DRAM) %06x <- %02x\n", tag(), pas_address, data);
- break;
- case MAP8_ROM1A0:
- case MAP8_ROM1C0:
- if (TRACE_MEM) logerror("%s: (ROM1) %06x <- %02x (ignored)\n", tag(), pas_address, data);
- break;
- case MAP8_PCODE:
- if (TRACE_MEM) logerror("%s: (PCODE) %06x <- %02x (ignored)\n", tag(), pas_address, data);
- break;
- case MAP8_INTS:
- // Interrupt sense
- logerror("%s: write to ilsense ignored\n", tag());
- break;
- case MAP8_DEV:
- // devices
- bdev = static_cast<bus8z_device*>(pdev->m_device);
- if (TRACE_MEM) logerror("%s: (dev %s) %06x <- %02x\n", tag(), pdev->m_config->name, pas_address, data);
- bdev->write(space, pas_address, data, mem_mask);
- break;
- default:
- logerror("%s: Invalid kind for physical write access: %d\n", tag(), pdev->m_kind);
- }
- if (pdev->m_config->stop==STOP) break;
- }
- pdev = pdev->m_next;
- }
+/*
+ Polled from the mainboard
+*/
+READ_LINE_MEMBER( amigo_device::cpury_out )
+{
+ return m_ready_out;
}
/*
- The mapper is connected to the clock line in order to operate
- the wait state counter.
+ Polled from the mainboard
*/
-void mainboard8_device::clock_in(int clock)
+READ_LINE_MEMBER( amigo_device::sramcs_out )
{
- if (clock==ASSERT_LINE && m_waitcount!=0)
- {
- m_waitcount--;
- if (m_waitcount==0) m_ready(ASSERT_LINE);
- }
+ return m_sram_accessed && m_memen? ASSERT_LINE : CLEAR_LINE;
}
+/*
+ SKDRCS line (maybe "Sixty-four Kilobyte DRam Chip Select"). We assume that
+ Amigo asserts the select line not before the whole address was written.
+ This is actually more than needed because we only have 64K DRAM (which
+ would only need a 16 bit address), and Amigo itself selects it.
+*/
+READ_LINE_MEMBER( amigo_device::skdrcs_out )
+{
+ return m_dram_accessed && (m_amstate == IDLE) && m_memen? ASSERT_LINE : CLEAR_LINE;
+}
-/***************************************************************************
- DEVICE LIFECYCLE FUNCTIONS
-***************************************************************************/
/*
- We need to do all of the configuration in device_start since we don't have all
- required links earlier.
+ Incoming CRUS line. Needed to set the mapper config addresses.
+*/
+WRITE_LINE_MEMBER( amigo_device::crus_in )
+{
+ m_crus = (line_state)state;
+}
- Note that device_reset is too late; the initial context switch occurs earlier.
+/*
+ Incoming LASCS line.
*/
-void mainboard8_device::device_start()
+WRITE_LINE_MEMBER( amigo_device::lascs_in )
{
- logerror("%s: Starting mapper\n", tag());
+ m_logical_space = (state==ASSERT_LINE);
+}
+
+/*
+ The logical address bus has been set. The Amigo chip now has to map this
+ address to a physical address. There are three phases (3 clock ticks):
+ 1. Sample the logical address lines, determine the map register
+ (first four bits), create the physical address by adding the remaining
+ 12 bits and the map register contents
+ 2. Set the physical address bus with the first 16 bits of the physical
+ address. Assert the MSAST line.
+ 3. Set the physical address bus with the second 16 bits of the physical
+ address. Clear the MSAST line. Forward any incoming READY=0 to the CPU.
+*/
+SETOFFSET_MEMBER( amigo_device::set_address )
+{
+ // Check whether the mapper itself is accessed
+ int mapaddr = (m_crus==ASSERT_LINE)? 0x8810 : 0xf870;
+ m_mapper_accessed = ((offset & 0xfff1)==mapaddr);
+
+ // or SRAM
+ int sramaddr = (m_crus==ASSERT_LINE)? 0x8000 : 0xf000;
+ m_sram_accessed = ((offset & 0xf800)==sramaddr);
+
+ m_logical_space |= (m_mapper_accessed || m_sram_accessed);
+
+ // Is the address not in the logical address space?
+ if (!m_logical_space)
+ {
+ if (TRACE_AMIGO) logerror("Amigo decoding; %04x is a physical address.\n", offset);
+ // Build the physical address
+ // The first three bits are the protection bits (Write, Execute, Read)
+ // Theoretically, the addition of the logical address could mess up those
+ // first three bits, but the physical address is only 24 bits wide, so we
+ // have a space of 5 zeros between the protection bits and the address.
+ // We should just clear those five bits after the addition.
+
+ m_physical_address = ((offset & 0x0fff) + m_base_register[(offset >> 12) & 0x000f]) & 0x00ffffff;
- // String values of the pseudo constants, used in the configuration.
- const char *const pseudodev[7] = { SRAMNAME, ROM0NAME, ROM1A0NAME, ROM1C0NAME, DRAMNAME, PCODENAME, INTSNAME };
+ // TODO: Process flags
- const mapper8_config *conf = reinterpret_cast<const mapper8_config *>(static_config());
+ // Is it DRAM?
+ m_dram_accessed = (m_physical_address & 0x00ff0000)==0;
- const mapper8_list_entry *entry = conf->devlist;
- m_ready.resolve_safe();
+ // This takes one clock pulse.
+ m_amstate = CREATE_PADDR;
- m_sram = machine().root_device().memregion(SRAM_TAG)->base();
- m_dram = machine().root_device().memregion(DRAM_TAG)->base();
- m_rom0 = machine().root_device().memregion(ROM0_TAG)->base();
- m_rom1 = machine().root_device().memregion(ROM1_TAG)->base();
- m_pcode = machine().root_device().memregion(PCODEROM_TAG)->base();
+ // Pull down READY
+ m_ready_out = CLEAR_LINE;
+
+ if (TRACE_CPURY) logerror("Setting CPURY = %d (PAS)\n", m_ready_out);
+ }
+ else
+ {
+ // This was a logical space access. Pass through READY.
+ m_dram_accessed = false;
+ m_amstate = IDLE;
+ m_ready_out = m_srdy;
+ if (TRACE_CPURY) logerror("Setting CPURY = %d (LAS)\n", m_ready_out);
+ }
+}
+
+/*
+ Read the mapper status bits
+*/
+READ8_MEMBER( amigo_device::read )
+{
+ // Read the protection status bits and reset them
+ UINT8 value = m_protflag;
+ m_protflag = 0;
+ return value;
+}
- // Clear the lists
- m_logcomp.reset();
- m_physcomp.reset();
+/*
+ Configure the mapper. This is the only reason to write to the AMIGO.
+*/
+WRITE8_MEMBER( amigo_device::write )
+{
+ // Load or save map file
+ if ((data & 0xf0)==0x00)
+ {
+ // Need to HOLD the CPU
+ m_amstate = ((data & 1)==1)? SRAMLOAD : SRAMSAVE;
+ m_sram_address = (data & 0x0e) << 5;
+ m_hold_acknowledged = false;
+ m_basereg = 0;
+ m_mapvalue = 0;
+ m_mainboard->hold_cpu(ASSERT_LINE);
+ }
+ else logerror("Invalid value written to Amigo: %02x\n", data);
+}
- // Now building the list of active devices at this mapper.
- // Coyping partly from datamux.c.
- if ( entry != nullptr )
+WRITE_LINE_MEMBER( amigo_device::clock_in )
+{
+ if (state==CLEAR_LINE)
{
- bool done = false;
- for (int i=0; !done; i++)
+ switch (m_amstate)
{
- if (entry[i].name == nullptr)
- {
- done = true;
- }
- else
- {
- device_t *dev = nullptr;
- mapper8_device_kind kind = MAP8_UNDEF;
-
- for (int j=1; (j < 8) && (kind == MAP8_UNDEF); j++)
- {
- // Pseudo devices are enumerated as 1 ... 6 (see MAP8_SRAM etc.)
- if (strcmp(entry[i].name, pseudodev[j-1])==0) kind = (mapper8_device_kind)j;
- }
- if (kind==MAP8_UNDEF)
- {
- // This entry points to a "real" device, not to a special constant
- kind = MAP8_DEV;
- dev = machine().device(entry[i].name);
- }
- if (kind != MAP8_DEV || dev != nullptr)
- {
- if (entry[i].mode != PHYSIC)
- {
- auto ad = new logically_addressed_device(kind, (device_t*)dev, entry[i]);
- m_logcomp.append(*ad);
- if (TRACE_CONFIG) logerror("%s: Device %s mounted into logical address space.\n", tag(), entry[i].name);
- }
- else
- {
- auto ad = new physically_addressed_device(kind, (device_t*)dev, entry[i]);
- m_physcomp.append(*ad);
- if (TRACE_CONFIG) logerror("%s: Device %s mounted into physical address space.\n", tag(), entry[i].name);
- }
- }
- else
- {
- if (TRACE_CONFIG) logerror("%s: Device %s not found.\n", tag(), entry[i].name);
- }
- }
+ case IDLE:
+ break;
+ case CREATE_PADDR:
+ // Address has been created
+ m_amstate = ADDR_MSW;
+ break;
+ case ADDR_MSW:
+ // Transmit the first word (without the protection bits)
+ m_mainboard->set_paddress((m_physical_address >> 16) & 0x00ff);
+ m_amstate = ADDR_LSW;
+ break;
+ case ADDR_LSW:
+ m_mainboard->msast_in(ASSERT_LINE); // Pulse MSAST
+ m_mainboard->msast_in(CLEAR_LINE);
+ m_mainboard->set_paddress(m_physical_address & 0xffff);
+ m_amstate = IDLE;
+ m_ready_out = m_srdy; // Propagate incoming READY
+ break;
+
+ case SRAMLOAD:
+ if (m_hold_acknowledged) mapper_load();
+ break;
+
+ case SRAMSAVE:
+ if (m_hold_acknowledged) mapper_save();
+ break;
+
+ default:
+ logerror("Invalid state in mapper: %d\n", m_amstate);
}
}
- if (TRACE_CONFIG) logerror("%s: Mapper logical device count = %d\n", tag(), m_logcomp.count());
- if (TRACE_CONFIG) logerror("%s: Mapper physical device count = %d\n", tag(), m_physcomp.count());
+}
- m_dsr_selected = false;
- m_CRUS = true;
- m_PTGE = false;
+void amigo_device::mapper_load()
+{
+ m_mapvalue = (m_mapvalue << 8) | m_sram[m_sram_address++];
- // Clean mapper
- for (auto & elem : m_pas_offset) elem = 0;
+ if ((m_sram_address & 0x03)==0)
+ {
+ if (TRACE_MAP) logerror("Loaded basereg %02d = %08x\n", m_basereg, m_mapvalue);
+ m_base_register[m_basereg++] = m_mapvalue;
+ }
+ if (m_basereg == 16)
+ {
+ m_amstate = IDLE;
+ m_mainboard->hold_cpu(CLEAR_LINE);
+ }
}
-void mainboard8_device::device_reset()
+void amigo_device::mapper_save()
{
- m_dsr_selected = false;
- m_CRUS = true;
- m_PTGE = false;
- m_waitcount = 0;
- m_hexbus_selected = false;
+ if ((m_sram_address & 0x03)==0)
+ {
+ if (m_basereg == 16)
+ {
+ m_amstate = IDLE;
+ m_mainboard->hold_cpu(CLEAR_LINE);
+ return;
+ }
+ else
+ {
+ m_mapvalue = m_base_register[m_basereg];
+ if (TRACE_MAP) logerror("Saving basereg %02d = %08x\n", m_basereg, m_mapvalue);
+ m_basereg++;
+ }
+ }
- // Clean mapper
- for (auto & elem : m_pas_offset) elem = 0;
+ m_sram[m_sram_address++] = (m_mapvalue >> 24) & 0xff;
+ m_mapvalue = m_mapvalue << 8;
+}
- m_ready(ASSERT_LINE);
+WRITE_LINE_MEMBER( amigo_device::holda_in )
+{
+ if (TRACE_MAP) logerror("HOLD acknowledged = %d\n", state);
+ m_hold_acknowledged = (state==ASSERT_LINE);
}
-MACHINE_CONFIG_FRAGMENT( ti998_mainboard )
- MCFG_DEVICE_ADD(OSO_TAG, OSO, 0)
-MACHINE_CONFIG_END
+void amigo_device::device_start()
+{
+ logerror("Starting\n");
+ m_mainboard = downcast<mainboard8_device*>(owner());
+}
-machine_config_constructor mainboard8_device::device_mconfig_additions() const
+void amigo_device::device_reset()
{
- return MACHINE_CONFIG_NAME( ti998_mainboard );
+ m_logical_space = true;
}
-const device_type MAINBOARD8 = &device_creator<mainboard8_device>;
+const device_type AMIGO = &device_creator<amigo_device>;
/***************************************************************************
- Custom chips of the TI-99/8
-
===== OSO: Hexbus interface =====
The Hexbus is a 4-bit peripheral bus with master/slave coordination. Bytes
@@ -858,12 +1911,12 @@ enum
SHSK = 0x01
};
-ti998_oso_device::ti998_oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: device_t(mconfig, OSO, "OSO Hexbus interface", tag, owner, clock, "ti998_oso", __FILE__), m_data(0), m_status(0), m_control(0), m_xmit(0)
+oso_device::oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+: device_t(mconfig, OSO, "Hexbus interface", tag, owner, clock, "oso", __FILE__), m_data(0), m_status(0), m_control(0), m_xmit(0)
{
}
-READ8_MEMBER( ti998_oso_device::read )
+READ8_MEMBER( oso_device::read )
{
int value = 0;
offset &= 0x03;
@@ -871,36 +1924,36 @@ READ8_MEMBER( ti998_oso_device::read )
{
case 0:
// read 5FF8: read data register
- if (TRACE_OSO) logerror("%s: Read data register = %02x\n", tag(), value);
+ if (TRACE_OSO) logerror("Read data register = %02x\n", value);
value = m_data;
break;
case 1:
// read 5FFA: read status register
value = m_status;
- if (TRACE_OSO) logerror("%s: Read status %02x\n", tag(), value);
+ if (TRACE_OSO) logerror("Read status %02x\n", value);
break;
case 2:
// read 5FFC: read control register
value = m_control;
- if (TRACE_OSO) logerror("%s: Read control register = %02x\n", tag(), value);
+ if (TRACE_OSO) logerror("Read control register = %02x\n", value);
break;
case 3:
// read 5FFE: read transmit register
value = m_xmit;
- if (TRACE_OSO) logerror("%s: Read transmit register = %02x\n", tag(), value);
+ if (TRACE_OSO) logerror("Read transmit register = %02x\n", value);
break;
}
return value;
}
-WRITE8_MEMBER( ti998_oso_device::write )
+WRITE8_MEMBER( oso_device::write )
{
offset &= 0x03;
switch (offset)
{
case 0:
// write 5FF8: write transmit register
- if (TRACE_OSO) logerror("%s: Write transmit register %02x\n", tag(), data);
+ if (TRACE_OSO) logerror("Write transmit register %02x\n", data);
m_xmit = data;
// We set the status register directly in order to prevent lock-ups
// until we have a complete Hexbus implementation
@@ -908,169 +1961,20 @@ WRITE8_MEMBER( ti998_oso_device::write )
break;
case 1:
// write 5FFA: write control register
- if (TRACE_OSO) logerror("%s: Write control register %02x\n", tag(), data);
+ if (TRACE_OSO) logerror("Write control register %02x\n", data);
m_control = data;
break;
default:
// write 5FFC, 5FFE: undefined
- if (TRACE_OSO) logerror("%s: Invalid write on %04x: %02x\n", tag(), (offset<<1) | 0x5ff0, data);
+ if (TRACE_OSO) logerror("Invalid write on %04x: %02x\n", (offset<<1) | 0x5ff0, data);
break;
}
}
-void ti998_oso_device::device_start()
+void oso_device::device_start()
{
+ logerror("Starting\n");
m_status = m_xmit = m_control = m_data = 0;
}
-const device_type OSO = &device_creator<ti998_oso_device>;
-
-
-// ========================================================================
-
-/****************************************************************************
-
- TI-99/8 Speech synthesizer subsystem
-
- The TI-99/8 contains a speech synthesizer inside the console, so we cannot
- reuse the spchsyn implementation of the P-Box speech synthesizer.
- Accordingly, this is not a ti_expansion_card_device.
-
- For comments on real timing see ti99/spchsyn.c
-
- Note that before the REAL_TIMING can be used we must first establish
- the set_address logic in 998board.
-
-*****************************************************************************/
-
-#define TMS5220_ADDRESS_MASK 0x3FFFFUL /* 18-bit mask for tms5220 address */
-#define SPEECHSYN_TAG "speechsyn"
-#define REAL_TIMING 0
-
-ti998_spsyn_device::ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: bus8z_device(mconfig, SPEECH8, "TI-99/8 Onboard Speech synthesizer", tag, owner, clock, "ti998_speech", __FILE__), m_vsp(nullptr),
- m_ready(*this)
-{
-}
-
-/*
- Memory read
-*/
-#if REAL_TIMING
-// ====== This is the version with real timing =======
-READ8Z_MEMBER( ti998_spsyn_device::readz )
-{
- m_vsp->wsq_w(TRUE);
- m_vsp->rsq_w(FALSE);
- *value = m_vsp->read(offset) & 0xff;
- if (TRACE_SPEECH) logerror("%s: read value = %02x\n", tag(), *value);
-}
-
-/*
- Memory write
-*/
-WRITE8_MEMBER( ti998_spsyn_device::write )
-{
- m_vsp->rsq_w(m_vsp, TRUE);
- m_vsp->wsq_w(m_vsp, FALSE);
- if (TRACE_SPEECH) logerror("%s: write value = %02x\n", tag(), data);
- m_vsp->write(offset, data);
-}
-
-#else
-// ====== This is the version without real timing =======
-
-READ8Z_MEMBER( ti998_spsyn_device::readz )
-{
- machine().device("maincpu")->execute().adjust_icount(-(18+3)); /* this is just a minimum, it can be more */
- *value = m_vsp->status_r(space, offset, 0xff) & 0xff;
- if (TRACE_SPEECH) logerror("%s: read value = %02x\n", tag(), *value);
-}
-
-/*
- Memory write
-*/
-WRITE8_MEMBER( ti998_spsyn_device::write )
-{
- machine().device("maincpu")->execute().adjust_icount(-(54+3)); /* this is just an approx. minimum, it can be much more */
-
- /* RN: the stupid design of the tms5220 core means that ready is cleared */
- /* when there are 15 bytes in FIFO. It should be 16. Of course, if */
- /* it were the case, we would need to store the value on the bus, */
- /* which would be more complex. */
- if (!m_vsp->readyq_r())
- {
- attotime time_to_ready = attotime::from_double(m_vsp->time_to_ready());
- int cycles_to_ready = machine().device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready);
- if (TRACE_SPEECH && TRACE_DETAIL) logerror("%s: time to ready: %f -> %d\n", tag(), time_to_ready.as_double(), (int) cycles_to_ready);
-
- machine().device("maincpu")->execute().adjust_icount(-cycles_to_ready);
- machine().scheduler().timer_set(attotime::zero, FUNC_NULL);
- }
- if (TRACE_SPEECH) logerror("%s: write value = %02x\n", tag(), data);
- m_vsp->data_w(space, offset, data);
-}
-#endif
-
-/**************************************************************************/
-
-WRITE_LINE_MEMBER( ti998_spsyn_device::speech8_ready )
-{
- // The TMS5200 implementation uses TRUE/FALSE, not ASSERT/CLEAR semantics
- m_ready((state==0)? ASSERT_LINE : CLEAR_LINE);
- if (TRACE_SPEECH) logerror("%s: READY = %d\n", tag(), (state==0));
-
-#if REAL_TIMING
- // Need to do that here (see explanations in spchsyn.c)
- if (state==0)
- {
- m_vsp->rsq_w(TRUE);
- m_vsp->wsq_w(TRUE);
- }
-#endif
-}
-
-void ti998_spsyn_device::device_start()
-{
- m_ready.resolve_safe();
- m_vsp = subdevice<tms5220_device>(SPEECHSYN_TAG);
- speechrom_device* mem = subdevice<speechrom_device>("vsm");
- mem->set_reverse_bit_order(true);
-}
-
-void ti998_spsyn_device::device_reset()
-{
- if (TRACE_SPEECH) logerror("%s: reset\n", tag());
-}
-
-// Unlike the TI-99/4A, the 99/8 uses the CD2501ECD
-// The CD2501ECD is a tms5200/cd2501e with the rate control from the tms5220c added in.
-// (it's probably actually a tms5220c die with the cd2501e/tms5200 lpc rom masked onto it)
-MACHINE_CONFIG_FRAGMENT( ti998_speech )
- MCFG_DEVICE_ADD("vsm", SPEECHROM, 0)
-
- MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD(SPEECHSYN_TAG, CD2501ECD, 640000L)
- MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(ti998_spsyn_device, speech8_ready))
- MCFG_TMS52XX_SPEECHROM("vsm")
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
-MACHINE_CONFIG_END
-
-/* Verified on a real machine: TI-99/8 uses the same speech rom contents
- as the TI speech synthesizer. */
-ROM_START( ti998_speech )
- ROM_REGION(0x8000, "vsm", 0)
- ROM_LOAD("cd2325a.vsm", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe))
- ROM_LOAD("cd2326a.vsm", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020))
-ROM_END
-
-machine_config_constructor ti998_spsyn_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( ti998_speech );
-}
-
-const rom_entry *ti998_spsyn_device::device_rom_region() const
-{
- return ROM_NAME( ti998_speech );
-}
-const device_type SPEECH8 = &device_creator<ti998_spsyn_device>;
+const device_type OSO = &device_creator<oso_device>;
diff --git a/src/devices/bus/ti99x/998board.h b/src/devices/bus/ti99x/998board.h
index 9231d9be647..0a9367953c5 100644
--- a/src/devices/bus/ti99x/998board.h
+++ b/src/devices/bus/ti99x/998board.h
@@ -18,113 +18,365 @@
#include "emu.h"
#include "ti99defs.h"
+#include "machine/tmc0430.h"
+#include "video/tms9928a.h"
+#include "sound/sn76496.h"
#include "sound/tms5220.h"
+#include "gromport.h"
+#include "bus/ti99_peb/peribox.h"
extern const device_type MAINBOARD8;
-extern const device_type OSO;
-extern const device_type SPEECH8;
+#define VAQUERRO_TAG "vaquerro"
+#define MOFETTA_TAG "mofetta"
+#define AMIGO_TAG "amigo"
#define OSO_TAG "oso"
-#define SPEECHSYN_TAG "speechsyn"
-
-#define NATIVE 0
-#define TI99EM 1
-#define PATGEN 2
-#define PHYSIC 3
-#define CONT 0
-#define STOP 1
-
-#define SRAMNAME "SRAM"
-#define ROM0NAME "ROM0"
-#define ROM1A0NAME "ROM1A"
-#define ROM1C0NAME "ROM1C"
-#define INTSNAME "INTS"
-#define DRAMNAME "DRAM"
-#define PCODENAME "PCODE"
#define SRAM_SIZE 2048
#define DRAM_SIZE 65536
-// We use these constants in the read/write functions.
-enum mapper8_device_kind
+class mainboard8_device;
+extern const device_type VAQUERRO;
+extern const device_type MOFETTA;
+extern const device_type AMIGO;
+extern const device_type OSO;
+
+
+enum
{
- MAP8_UNDEF = 0,
- MAP8_SRAM,
- MAP8_ROM0,
- MAP8_ROM1A0,
- MAP8_ROM1C0,
- MAP8_DRAM,
- MAP8_PCODE,
- MAP8_INTS,
- MAP8_DEV // device by name
+ SGMSEL = 1,
+ TSGSEL = 2,
+ P8GSEL = 4,
+ P3GSEL = 8,
+ VIDSEL = 16
};
-struct mapper8_list_entry
+/*
+ Wait state generator (part of Vaquerro)
+*/
+class waitstate_generator
{
- const char* name; // Name of the device (used for looking up the device)
- int mode; // Mode of the system which applies to this entry
- int stop; // Mapper shall stop searching for a matching device when this entry applies
- UINT32 select_pattern; // State of the address line bits when addressing this device
- UINT32 address_mask; // Bits of the address bus used to address this device
- UINT32 write_select; // Additional bits set when doing write accesses to this device
-};
+public:
+ waitstate_generator() :
+ m_counting(false),
+ m_generate(false),
+ m_counter(0),
+ m_addressed(true),
+ m_ready(true) { };
+ void select_in(bool addressed);
+ virtual void ready_in(line_state ready) =0;
+ virtual void clock_in(line_state clkout) =0;
+ void treset_in(line_state reset);
+
+ int select_out();
+ void init(int select_value) { m_selvalue = select_value; }
+
+ line_state ready_out();
+
+ bool is_counting();
+ bool is_generating();
+ bool is_ready();
-#define MAPPER8_CONFIG(name) \
- const mapper8_config(name) =
+protected:
+ // Two flipflops
+ bool m_counting;
+ bool m_generate;
+ // Counter
+ int m_counter;
+
+ // Select value (indicates selected line)
+ int m_selvalue;
+
+ // Line state flags
+ bool m_addressed;
+ bool m_ready;
+};
-#define MCFG_MAINBOARD8_READY_CALLBACK(_write) \
- devcb = &mainboard8_device::set_ready_wr_callback(*device, DEVCB_##_write);
+class grom_waitstate_generator : public waitstate_generator
+{
+public:
+ void ready_in(line_state ready) override;
+ void clock_in(line_state clkout) override;
+};
-struct mapper8_config
+class video_waitstate_generator : public waitstate_generator
{
- const mapper8_list_entry *devlist;
+public:
+ void ready_in(line_state ready) override { };
+ void clock_in(line_state clkout) override;
};
/*
- Device list of the mapper.
+ Custom chip: Vaquerro
*/
-class logically_addressed_device
+class vaquerro_device : public device_t
{
- friend class simple_list<logically_addressed_device>;
- friend class mainboard8_device;
-
public:
- logically_addressed_device(mapper8_device_kind kind, device_t *busdevice, const mapper8_list_entry &entry)
- : m_next(nullptr), m_kind(kind), m_device(busdevice), m_config(&entry) { };
+ vaquerro_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void device_start() override;
+ void device_reset() override;
+
+ line_state ready();
+ void treset();
+
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_SETADDRESS_DBIN_MEMBER( set_address );
+
+ DECLARE_READ_LINE_MEMBER( sprd_out );
+ DECLARE_READ_LINE_MEMBER( spwt_out );
+ DECLARE_READ_LINE_MEMBER( sccs_out );
+ DECLARE_READ_LINE_MEMBER( sromcs_out );
+
+ // Collective select line query
+ int gromcs_out();
+
+ DECLARE_READ_LINE_MEMBER( vdprd_out );
+ DECLARE_READ_LINE_MEMBER( vdpwt_out );
+ DECLARE_READ_LINE_MEMBER( lascsq_out );
+ DECLARE_READ_LINE_MEMBER( ggrdy_out );
+ DECLARE_WRITE_LINE_MEMBER( hold_cpu );
+
+ DECLARE_WRITE_LINE_MEMBER( crus_in );
+ DECLARE_WRITE_LINE_MEMBER( crusgl_in );
+ DECLARE_WRITE_LINE_MEMBER( clock_in );
+ DECLARE_WRITE_LINE_MEMBER( memen_in );
+
+ DECLARE_WRITE_LINE_MEMBER( sgmry );
+ DECLARE_WRITE_LINE_MEMBER( tsgry );
+ DECLARE_WRITE_LINE_MEMBER( p8gry );
+ DECLARE_WRITE_LINE_MEMBER( p3gry );
private:
- logically_addressed_device *m_next; // needed for simple_list
- mapper8_device_kind m_kind; // named device or predefined
- device_t *m_device; // the actual device
- const mapper8_list_entry *m_config;
+ // Memory cycle state
+ bool m_memen;
+
+ // Waiting for video
+ bool m_video_wait;
+
+ // State of the CRUS line
+ line_state m_crus;
+
+ // Are the GROM libraries turned on?
+ bool m_crugl;
+
+ // Do we have a logical address space match?
+ bool m_lasreq = false;
+
+ // Keep the decoding result (opens the SRY gate)
+ bool m_grom_or_video = false;
+
+ // Select lines
+ bool m_spwt;
+ bool m_sccs;
+ bool m_sromcs;
+ bool m_sprd;
+ bool m_vdprd;
+ bool m_vdpwt;
+
+ // Collective GROM select state
+ int m_gromsel;
+
+ // Outgoing READY
+ line_state m_ggrdy;
+
+ // Outgoing READY latch (common flipflop driving SRY)
+ bool m_sry;
+
+ // Holds the A14 address line state. We need this for the clock_in method.
+ line_state m_a14;
+
+ // Keeps the recent DBIN level
+ line_state m_dbin_level;
+
+ // Wait state logic components
+ grom_waitstate_generator m_sgmws, m_tsgws, m_p8gws, m_p3gws;
+ video_waitstate_generator m_vidws;
+
+ // Pointer to mainboard
+ mainboard8_device* m_mainboard;
};
/*
- Device list of the mapper.
+ Custom chip: Mofetta
*/
-class physically_addressed_device
+class mofetta_device : public device_t
{
- friend class simple_list<physically_addressed_device>;
- friend class mainboard8_device;
+public:
+ mofetta_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ void device_start() override;
+ void device_reset() override;
+
+ DECLARE_WRITE8_MEMBER( cruwrite );
+ DECLARE_SETADDRESS_DBIN_MEMBER( set_address );
+
+ DECLARE_WRITE_LINE_MEMBER( clock_in );
+ DECLARE_WRITE_LINE_MEMBER( msast_in );
+ DECLARE_WRITE_LINE_MEMBER( lascs_in );
+ DECLARE_WRITE_LINE_MEMBER( pmemen_in );
+ DECLARE_WRITE_LINE_MEMBER( skdrcs_in );
+
+ DECLARE_READ8_MEMBER( rom1cs_out );
+ DECLARE_READ_LINE_MEMBER( gromclk_out );
+
+ DECLARE_READ_LINE_MEMBER( alccs_out );
+ DECLARE_READ_LINE_MEMBER( prcs_out );
+ DECLARE_READ_LINE_MEMBER( cmas_out );
+ DECLARE_READ_LINE_MEMBER( dbc_out );
+
+ DECLARE_READ_LINE_MEMBER( rom1cs_out );
+ DECLARE_READ_LINE_MEMBER( rom1am_out );
+ DECLARE_READ_LINE_MEMBER( rom1al_out );
+
+private:
+ // Memory cycle state
+ bool m_pmemen;
+
+ // Logical access
+ bool m_lasreq;
+ // DRAM access
+ bool m_skdrcs;
+
+ // Holds the decoding result; essentially names the selected line
+ bool m_gromclk_up;
+
+ // Have we got the upper word of the address?
+ bool m_gotfirstword;
+
+ // Address latch
+ int m_address_latch;
+
+ // Most significant byte of the 24-bit address
+ int m_prefix;
+
+ // CRU select of the 1700 device
+ bool m_alcpg;
+
+ // CRU select of the 2700 device
+ bool m_txspg;
+
+ // ROM1 select lines
+ bool m_rom1cs;
+ bool m_rom1am;
+ bool m_rom1al;
+
+ // OSO select
+ bool m_alccs;
+
+ // Pascal ROM select line
+ bool m_prcs;
+
+ // Cartridge port select line
+ bool m_cmas;
+
+ // GROM clock count (as frequency divider)
+ int m_gromclock_count;
+
+ // Remember last msast state for edge detection
+ line_state m_msast;
+
+ // Pointer to mainboard
+ mainboard8_device* m_mainboard;
+};
+
+/*
+ Custom chip: Amigo
+*/
+class amigo_device : public device_t
+{
public:
- physically_addressed_device(mapper8_device_kind kind, device_t *busdevice, const mapper8_list_entry &entry)
- : m_next(nullptr), m_kind(kind), m_device(busdevice), m_config(&entry) { };
+ amigo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ void device_start() override;
+ void device_reset() override;
+
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_SETOFFSET_MEMBER( set_address );
+
+ DECLARE_WRITE_LINE_MEMBER( srdy_in );
+ DECLARE_WRITE_LINE_MEMBER( clock_in );
+ DECLARE_WRITE_LINE_MEMBER( crus_in );
+ DECLARE_WRITE_LINE_MEMBER( lascs_in );
+ DECLARE_WRITE_LINE_MEMBER( memen_in );
+
+ DECLARE_WRITE_LINE_MEMBER( holda_in );
+
+ DECLARE_READ_LINE_MEMBER( cpury_out );
+ DECLARE_READ_LINE_MEMBER( sramcs_out );
+ DECLARE_READ_LINE_MEMBER( skdrcs_out );
+
+ void connect_sram(UINT8* sram) { m_sram = sram; }
+ bool mapper_accessed() { return m_mapper_accessed; }
private:
- physically_addressed_device *m_next; // needed for simple_list
- mapper8_device_kind m_kind; // named device or predefined
- device_t *m_device; // the actual device
- const mapper8_list_entry *m_config;
+ // Memory cycle state
+ bool m_memen;
+
+ // DMA methods for loading/saving maps
+ void mapper_load();
+ void mapper_save();
+
+ // Address mapper registers. Each offset is selected by the first 4 bits
+ // of the logical address.
+ UINT32 m_base_register[16];
+
+ // Indicates a logical space access
+ bool m_logical_space;
+
+ // Physical address
+ UINT32 m_physical_address;
+
+ // Pointer to SRAM where AMIGO needs to upload/download its map values
+ UINT8* m_sram;
+
+ // Pointer to mainboard
+ mainboard8_device* m_mainboard;
+
+ // Keep the system ready state
+ line_state m_srdy;
+
+ // Outgoing READY level
+ line_state m_ready_out;
+
+ // Keep the CRUS setting
+ line_state m_crus;
+
+ // State of the address creation
+ int m_amstate;
+
+ // Protection flags
+ int m_protflag;
+
+ // Accessing SRAM
+ bool m_sram_accessed;
+
+ // Accessing DRAM
+ bool m_dram_accessed;
+
+ // Accessing the mapper
+ bool m_mapper_accessed;
+
+ // HOLDA flag
+ bool m_hold_acknowledged;
+
+ // Address in SRAM during DMA
+ UINT32 m_sram_address;
+
+ // Number of the currently loaded/save base register
+ int m_basereg;
+
+ // Latched value for mapper DMA transfer
+ UINT32 m_mapvalue;
};
/*
Custom chip: OSO
*/
-class ti998_oso_device : public device_t
+class oso_device : public device_t
{
public:
- ti998_oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
void device_start() override;
@@ -136,139 +388,169 @@ private:
UINT8 m_xmit;
};
-/*
- Speech support
-*/
-#define MCFG_SPEECH8_READY_CALLBACK(_write) \
- devcb = &ti998_spsyn_device::set_ready_wr_callback(*device, DEVCB_##_write);
-
-class ti998_spsyn_device : public bus8z_device
+class mainboard8_device : public device_t
{
public:
- ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
- template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<ti998_spsyn_device &>(device).m_ready.set_callback(object); }
-
- DECLARE_READ8Z_MEMBER(readz) override;
- DECLARE_WRITE8_MEMBER(write) override;
-
- DECLARE_READ8Z_MEMBER(crureadz) { };
- DECLARE_WRITE8_MEMBER(cruwrite) { };
+ mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- DECLARE_WRITE_LINE_MEMBER( speech8_ready );
+ // Memory space
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+ DECLARE_SETOFFSET_MEMBER( setoffset );
+
+ // I/O space
+ DECLARE_READ8Z_MEMBER( crureadz );
+ DECLARE_WRITE8_MEMBER( cruwrite );
+
+ // Control lines
+ DECLARE_WRITE_LINE_MEMBER( clock_in );
+ DECLARE_WRITE_LINE_MEMBER( dbin_in );
+ DECLARE_WRITE_LINE_MEMBER( msast_in );
+ DECLARE_WRITE_LINE_MEMBER( crus_in );
+ DECLARE_WRITE_LINE_MEMBER( ptgen_in );
+ DECLARE_WRITE_LINE_MEMBER( reset_console );
+ DECLARE_WRITE_LINE_MEMBER( hold_cpu );
+ DECLARE_WRITE_LINE_MEMBER( ggrdy_in );
+
+ DECLARE_WRITE_LINE_MEMBER( holda_line );
+
+ template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object)
+ {
+ return downcast<mainboard8_device &>(device).m_ready.set_callback(object);
+ }
+
+ template<class _Object> static devcb_base &set_reset_wr_callback(device_t &device, _Object object)
+ {
+ return downcast<mainboard8_device &>(device).m_console_reset.set_callback(object);
+ }
+
+ template<class _Object> static devcb_base &set_hold_wr_callback(device_t &device, _Object object)
+ {
+ return downcast<mainboard8_device &>(device).m_hold_line.set_callback(object);
+ }
+
+ void set_paddress(int address);
+
+ // Ready lines from GROMs
+ DECLARE_WRITE_LINE_MEMBER( system_grom_ready );
+ DECLARE_WRITE_LINE_MEMBER( ptts_grom_ready );
+ DECLARE_WRITE_LINE_MEMBER( p8_grom_ready );
+ DECLARE_WRITE_LINE_MEMBER( p3_grom_ready );
+ DECLARE_WRITE_LINE_MEMBER( sound_ready );
+ DECLARE_WRITE_LINE_MEMBER( speech_ready );
+ DECLARE_WRITE_LINE_MEMBER( pbox_ready );
+
+ // Emulation
+ // void set_gromport(gromport_device* dev) { m_gromport = dev; }
protected:
- virtual void device_start() override;
- virtual void device_reset(void) override;
- virtual const rom_entry *device_rom_region() const override;
- virtual machine_config_constructor device_mconfig_additions() const override;
+ void device_start(void) override;
+ void device_reset(void) override;
+ machine_config_constructor device_mconfig_additions() const override;
private:
- tms5220_device *m_vsp;
-// UINT8 *m_speechrom; // pointer to speech ROM data
-// int m_load_pointer; // which 4-bit nibble will be affected by load address
-// int m_rombits_count; // current bit position in ROM
-// UINT32 m_sprom_address; // 18 bit pointer in ROM
-// UINT32 m_sprom_length; // length of data pointed by speechrom_data, from 0 to 2^18
-
- // Ready line to the CPU
- devcb_write_line m_ready;
-};
+ // Holds the state of the A14 line
+ bool m_A14_set;
-#define MCFG_TISPEECH8_ADD(_tag, _conf) \
- MCFG_DEVICE_ADD(_tag, TI99_SPEECH8, 0) \
- MCFG_DEVICE_CONFIG(_conf)
+ // Propagates the end of the memory cycle
+ void cycle_end();
+ // Original logical address.
+ int m_logical_address;
-/*
- Main class
-*/
-class mainboard8_device : public bus8z_device
-{
-public:
- mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ // Mapped physical address.
+ int m_physical_address;
- template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<mainboard8_device &>(device).m_ready.set_callback(object); }
+ // Hold the address space value so that we can use it in other methods.
+ address_space* m_space;
- DECLARE_READ8_MEMBER( readm); // used from address map
- DECLARE_WRITE8_MEMBER( writem ); // used from address map
+ // Indicates that a byte is waiting on the data bus (see m_latched_data)
+ bool m_pending_write;
- DECLARE_READ8Z_MEMBER( readz ) override;
- DECLARE_WRITE8_MEMBER( write ) override;
+ // Hold the value of the data bus. In a real machine, the data bus continues
+ // to show that value, but in this emulation we have a push mechanism.
+ UINT8 m_latched_data;
- DECLARE_READ8Z_MEMBER(crureadz);
- DECLARE_WRITE8_MEMBER(cruwrite);
+ // Hold the level of the GROMCLK line
+ int m_gromclk;
- void CRUS_set(bool state);
- void PTGE_set(bool state);
+ // Selecting GROM libraries
+ void select_groms();
- void clock_in(int state);
+ // Previous select state
+ int m_prev_grom;
-protected:
- void device_start(void) override;
- void device_reset(void) override;
- machine_config_constructor device_mconfig_additions() const override;
+ // Ready states
+ bool m_speech_ready;
+ bool m_sound_ready;
+ bool m_pbox_ready;
-private:
- bool access_logical_r(address_space& space, offs_t offset, UINT8 *value, UINT8 mem_mask );
- bool access_logical_w(address_space& space, offs_t offset, UINT8 data, UINT8 mem_mask );
- void access_physical_r(address_space& space, offs_t offset, UINT8 *value, UINT8 mem_mask );
- void access_physical_w(address_space& space, offs_t offset, UINT8 data, UINT8 mem_mask );
- void mapwrite(int offset, UINT8 data);
+ // Keeps the recent DBIN level
+ line_state m_dbin_level;
// Ready line to the CPU
devcb_write_line m_ready;
- // All devices that are attached to the 16-bit address bus.
- simple_list<logically_addressed_device> m_logcomp;
+ // Reset line to the main system
+ devcb_write_line m_console_reset;
+
+ // Hold line to the main system
+ devcb_write_line m_hold_line;
- // All devices that are attached to the 24-bit mapped address bus.
- simple_list<physically_addressed_device> m_physcomp;
+ // Custom chips
+ required_device<vaquerro_device> m_vaquerro;
+ required_device<mofetta_device> m_mofetta;
+ required_device<amigo_device> m_amigo;
+ required_device<oso_device> m_oso;
- // Select bit for the internal DSR.
- bool m_dsr_selected;
+ // Debugging
+ line_state m_last_ready;
- // Select bit for the Hexbus DSR.
- bool m_hexbus_selected;
+ // Video processor
+ tms9118_device* m_video;
- // 99/4A compatibility mode. Name is taken from the spec. If 1, 99/4A compatibility is active.
- bool m_CRUS;
+ // Sound generator
+ sn76496_base_device* m_sound;
- // P-Code mode. Name is taken from the spec. If 0, P-Code libraries are available.
- // May be read as "Pascal and Text-to-speech GROM libraries Enable (Negative)"
- // Note: this is negative logic. GROMs are present only for PTGEN=0
- // We use PTGE as the inverse signal.
- bool m_PTGE;
+ // Speech processor
+ cd2501ecd_device* m_speech;
- // Counter for the wait states.
- int m_waitcount;
+ // System GROM library
+ tmc0430_device* m_sgrom[3];
- // Address mapper registers. Each offset is selected by the first 4 bits
- // of the logical address.
- UINT32 m_pas_offset[16];
+ // Text-to-speech GROM library
+ tmc0430_device* m_tsgrom[8];
- // SRAM area of the system. Directly connected to the address decoder.
- UINT8 *m_sram;
+ // Pascal 8 GROM library
+ tmc0430_device* m_p8grom[8];
- // DRAM area of the system. Connected to the mapped address bus.
- UINT8 *m_dram;
+ // Pascal 3 GROM library
+ tmc0430_device* m_p3grom[3];
- // ROM area of the system. Directly connected to the logical address decoder.
- UINT8 *m_rom0;
+ // Gromport (cartridge port)
+ gromport_device* m_gromport;
- // ROM area of the system. Directly connected to the physical address decoder.
- UINT8 *m_rom1;
+ // Peripheral box
+ peribox_device* m_peb;
- // P-Code ROM area of the system. Directly connected to the physical address decoder.
- UINT8 *m_pcode;
+ // Memory
+ std::unique_ptr<UINT8[]> m_sram;
+ std::unique_ptr<UINT8[]> m_dram;
- // Custom chips
- required_device<ti998_oso_device> m_oso;
+ // ROM area of the system.
+ UINT8* m_rom0;
+ UINT8* m_rom1;
+ UINT8* m_pascalrom;
};
+#define MCFG_MAINBOARD8_READY_CALLBACK(_write) \
+ devcb = &mainboard8_device::set_ready_wr_callback(*device, DEVCB_##_write);
+
+#define MCFG_MAINBOARD8_RESET_CALLBACK(_write) \
+ devcb = &mainboard8_device::set_reset_wr_callback(*device, DEVCB_##_write);
+
+#define MCFG_MAINBOARD8_HOLD_CALLBACK(_write) \
+ devcb = &mainboard8_device::set_hold_wr_callback(*device, DEVCB_##_write);
-#define MCFG_MAINBOARD8_ADD(_tag, _devices) \
- MCFG_DEVICE_ADD(_tag, MAINBOARD8, 0) \
- MCFG_DEVICE_CONFIG( _devices )
#endif
diff --git a/src/devices/bus/ti99x/datamux.cpp b/src/devices/bus/ti99x/datamux.cpp
index 1b8ec8de02f..034ecfe114d 100644
--- a/src/devices/bus/ti99x/datamux.cpp
+++ b/src/devices/bus/ti99x/datamux.cpp
@@ -75,9 +75,20 @@
Constructor
*/
ti99_datamux_device::ti99_datamux_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: device_t(mconfig, DATAMUX, "Databus multiplexer", tag, owner, clock, "ti99_datamux", __FILE__), m_spacep(nullptr),
- m_ready(*this), m_muxready(), m_sysready(), m_addr_buf(0), m_read_mode(false), m_latch(0), m_waitcount(0), m_ram16b(nullptr), m_use32k(false), m_base32k(0), m_cpu(nullptr)
-{ }
+ : device_t(mconfig, DATAMUX, "Databus multiplexer", tag, owner, clock, "ti99_datamux", __FILE__),
+ m_spacep(nullptr),
+ m_ready(*this),
+ m_addr_buf(0),
+ m_dbin(CLEAR_LINE),
+ m_muxready(CLEAR_LINE),
+ m_sysready(CLEAR_LINE),
+ m_latch(0),
+ m_waitcount(0),
+ m_ram16b(nullptr),
+ m_use32k(false),
+ m_base32k(0),
+ m_console_groms_present(false)
+ { }
#define TRACE_READY 0
#define TRACE_ACCESS 0
@@ -89,140 +100,239 @@ ti99_datamux_device::ti99_datamux_device(const machine_config &mconfig, const ch
DEVICE ACCESSOR FUNCTIONS
***************************************************************************/
-void ti99_datamux_device::read_all(address_space& space, UINT16 addr, UINT8 *target)
+void ti99_datamux_device::read_all(address_space& space, UINT16 addr, UINT8 *value)
{
- attached_device *dev = m_devices.first();
+ // Valid access
+ bool validaccess = ((addr & 0x0400)==0);
- // Reading the odd address first (addr+1)
- while (dev != nullptr)
+ if (validaccess)
{
- if (dev->m_config->write_select != 0xffff) // write-only
+ // GROM access
+ if ((addr & 0xf801)==0x9800)
{
- if ((addr & dev->m_config->address_mask)==dev->m_config->select)
+ if (m_console_groms_present)
{
- // Cast to the bus8z_device (see ti99defs.h)
- bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device);
- devz->readz(space, addr, target);
+ for (int i=0; i < 3; i++)
+ {
+ m_grom[i]->readz(space, addr, value);
+ }
}
- // hope we don't have two devices answering...
- // consider something like a logical OR and maybe some artificial smoke
+ // GROMport (GROMs)
+ m_gromport->readz(space, addr, value);
+ }
+
+ // Video
+ if ((addr & 0xf801)==0x8800)
+ {
+ m_video->readz(space, addr, value);
}
- dev = dev->m_next;
}
+
+ // GROMport (ROMs)
+ if ((addr & 0xe000)==0x6000) m_gromport->readz(space, addr, value);
+
+ // PEB gets all accesses
+ m_peb->readz(space, addr, value);
+ m_peb->memen_in(CLEAR_LINE);
}
void ti99_datamux_device::write_all(address_space& space, UINT16 addr, UINT8 value)
{
- attached_device *dev = m_devices.first();
- while (dev != nullptr)
+ // GROM access
+ if ((addr & 0xf801)==0x9800)
{
- if ((addr & dev->m_config->address_mask)==(dev->m_config->select | dev->m_config->write_select))
+ if (m_console_groms_present)
{
- bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device);
- devz->write(space, addr, value);
+ for (int i=0; i < 3; i++)
+ m_grom[i]->write(space, addr, value);
}
- dev = dev->m_next;
+ // GROMport
+ m_gromport->write(space, addr, value);
+ }
+
+ // Cartridge port and sound
+ if ((addr & 0xe000)==0x6000) m_gromport->write(space, addr, value);
+ if ((addr & 0xfc01)==0x8400) m_sound->write(space, 0, value);
+
+ // Video
+ if ((addr & 0xf801)==0x8800)
+ {
+ m_video->write(space, addr, value);
}
+
+ // PEB gets all accesses
+ m_peb->write(space, addr, value);
+ m_peb->memen_in(CLEAR_LINE);
}
void ti99_datamux_device::setaddress_all(address_space& space, UINT16 addr)
{
- attached_device *dev = m_devices.first();
- while (dev != nullptr)
- {
- if ((addr & dev->m_config->address_mask)==(dev->m_config->select | dev->m_config->write_select))
- {
- bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device);
- devz->setaddress_dbin(space, addr, m_read_mode? ASSERT_LINE : CLEAR_LINE);
- }
- dev = dev->m_next;
- }
+ line_state a14 = ((addr & 2)!=0)? ASSERT_LINE : CLEAR_LINE;
+
+ // Valid access = not(DBIN and A5)
+ bool validaccess = (m_dbin==CLEAR_LINE || (addr & 0x0400)==0);
+
+ // GROM access
+ bool isgrom = ((addr & 0xf801)==0x9800) && validaccess;
+
+ // Cartridge ROM
+ bool iscartrom = ((addr & 0xe000)==0x6000);
+
+ // Always deliver to GROM so that the select line may be cleared
+ int lines = (m_dbin==ASSERT_LINE)? 1 : 0;
+ if (a14==ASSERT_LINE) lines |= 2;
+ line_state select = isgrom? ASSERT_LINE : CLEAR_LINE;
+
+ if (m_console_groms_present)
+ for (int i=0; i < 3; i++)
+ m_grom[i]->set_lines(space, lines, select);
+
+ // GROMport (GROMs)
+ m_gromport->set_gromlines(space, lines, select);
+
+ // Sound chip and video chip do not require the address to be set before access
+
+ // GROMport (ROMs)
+ m_gromport->romgq_line(iscartrom? ASSERT_LINE : CLEAR_LINE);
+
+ // PEB gets all accesses
+ m_peb->memen_in(ASSERT_LINE);
+ m_peb->setaddress_dbin(space, addr, m_dbin);
}
/*
- Special debugger access; these routines have no influence on the wait
- state generation.
+ Special debugger access. The access is similar to the normal access,
+ but it bypasses the wait state circuitry. Also, access ports of memory-
+ mapped devices are excluded because their state would be changed
+ unpredictably by the debugger access.
*/
UINT16 ti99_datamux_device::debugger_read(address_space& space, UINT16 addr)
{
- UINT16 base32k = 0;
- UINT8 lval, hval;
-
UINT16 addrb = addr << 1;
- if (m_use32k)
- {
- if ((addrb & 0xe000)==0x2000) base32k = 0x1000;
- if (((addrb & 0xe000)==0xa000) || ((addrb & 0xc000)==0xc000)) base32k = 0x4000;
- }
- if (base32k != 0)
- {
- return m_ram16b[addr - base32k];
- }
+ UINT16 value = 0;
+
+ if ((addrb & 0xe000)==0x0000) value = m_consolerom[(addrb & 0x1fff)>>1];
else
{
- lval = hval = 0;
- read_all(space, addrb+1, &lval);
- read_all(space, addrb, &hval);
- return ((hval << 8)&0xff00) | (lval & 0xff);
+ if ((addrb & 0xfc00)==0x8000) value = m_padram[(addrb & 0x00ff)>>1];
+ else
+ {
+ int base32k = 0;
+ if (m_use32k)
+ {
+ if ((addrb & 0xe000)==0x2000) base32k = 0x2000;
+ if (((addrb & 0xe000)==0xa000) || ((addrb & 0xc000)==0xc000)) base32k = 0x8000;
+ }
+
+ if (base32k != 0) value = m_ram16b[(addrb-base32k)>>1];
+ else
+ {
+ UINT8 lval = 0;
+ UINT8 hval = 0;
+
+ if ((addr & 0xe000)==0x6000)
+ {
+ m_gromport->readz(space, addrb+1, &lval);
+ m_gromport->readz(space, addrb, &hval);
+ }
+ m_peb->memen_in(ASSERT_LINE);
+ m_peb->readz(space, addrb+1, &lval);
+ m_peb->readz(space, addrb, &hval);
+ m_peb->memen_in(CLEAR_LINE);
+ value = ((hval << 8)&0xff00) | (lval & 0xff);
+ }
+ }
}
+ return value;
}
void ti99_datamux_device::debugger_write(address_space& space, UINT16 addr, UINT16 data)
{
- UINT16 base32k = 0;
-
UINT16 addrb = addr << 1;
- if (m_use32k)
- {
- if ((addrb & 0xe000)==0x2000) base32k = 0x1000;
- if (((addrb & 0xe000)==0xa000) || ((addrb & 0xc000)==0xc000)) base32k = 0x4000;
- }
- if (base32k != 0)
- {
- m_ram16b[addr - base32k] = data;
- }
+
+ if ((addrb & 0xe000)==0x0000) return;
+
+ if ((addrb & 0xfc00)==0x8000) m_padram[(addrb & 0x00ff)>>1] = data;
else
{
- write_all(space, addrb+1, data & 0xff);
- write_all(space, addrb, (data >> 8) & 0xff);
+ int base32k = 0;
+ if (m_use32k)
+ {
+ if ((addrb & 0xe000)==0x2000) base32k = 0x2000;
+ if (((addrb & 0xe000)==0xa000) || ((addrb & 0xc000)==0xc000)) base32k = 0x8000;
+ }
+
+ if (base32k != 0) m_ram16b[(addrb-base32k)>>1] = data;
+ else
+ {
+ if ((addr & 0xe000)==0x6000)
+ {
+ m_gromport->write(space, addr+1, data & 0xff);
+ m_gromport->write(space, addr, (data>>8) & 0xff);
+ }
+
+ m_peb->memen_in(ASSERT_LINE);
+ m_peb->write(space, addr+1, data & 0xff);
+ m_peb->write(space, addr, (data>>8) & 0xff);
+ m_peb->memen_in(CLEAR_LINE);
+ }
}
}
/*
Read access. We are using two loops because the delay between both
accesses must not occur within the loop. So we have one access on the bus,
- a delay, and then the second access (each one with possibly many attached
- devices)
+ a delay, and then the second access.
+
+ mem_mask is always ffff on TMS processors (cannot control bus width)
*/
READ16_MEMBER( ti99_datamux_device::read )
{
+ UINT16 value = 0;
+
// Care for debugger
if (space.debugger_access())
{
return debugger_read(space, offset);
}
- // Looks ugly, but this is close to the real thing. If the 16bit
- // memory expansion is installed in the console, and the access hits its
- // space, just respond to the memory access and don't bother the
- // datamux in any way. In particular, do not make the datamux insert wait
- // states.
-
- if (m_base32k != 0)
+ // Addresses below 0x2000 are ROM (no wait states)
+ if ((m_addr_buf & 0xe000)==0x0000)
{
- UINT16 reply = m_ram16b[offset-m_base32k];
- return reply & mem_mask;
+ value = m_consolerom[(m_addr_buf & 0x1fff)>>1];
}
else
{
- // The byte from the odd address has already been read into the latch
- // Reading the even address now (addr)
- UINT8 hbyte = 0;
- read_all(space, m_addr_buf, &hbyte);
- if (TRACE_ACCESS) logerror("datamux: read even byte from address %04x -> %02x\n", m_addr_buf, hbyte);
+ // Addresses from 8300-83ff (mirrors at 8000, 8100, 8200) are console RAM (no wait states)
+ if ((m_addr_buf & 0xfc00)==0x8000)
+ {
+ value = m_padram[(m_addr_buf & 0x00ff)>>1];
+ }
+ else
+ {
+ // Looks ugly, but this is close to the real thing. If the 16bit
+ // memory expansion is installed in the console, and the access hits its
+ // space, just respond to the memory access and don't bother the
+ // datamux in any way. In particular, do not make the datamux insert wait
+ // states.
+
+ if (m_base32k != 0)
+ {
+ value = m_ram16b[(m_addr_buf-m_base32k)>>1];
+ }
+ else
+ {
+ // The byte from the odd address has already been read into the latch
+ // Reading the even address now (addr)
+ UINT8 hbyte = 0;
+ read_all(space, m_addr_buf, &hbyte);
+ if (TRACE_ACCESS) logerror("Read even byte from address %04x -> %02x\n", m_addr_buf, hbyte);
- return ((hbyte<<8) | m_latch) & mem_mask;
+ value = (hbyte<<8) | m_latch;
+ }
+ }
}
+ return value;
}
/*
@@ -230,21 +340,29 @@ READ16_MEMBER( ti99_datamux_device::read )
*/
WRITE16_MEMBER( ti99_datamux_device::write )
{
- // Addresses below 0x2000 are ROM and should be handled in the address map
- // by the ROM entry, but as the write handler for ROM is not mapped, we end up
- // here when there are invalid accesses, and this will mess up everything.
- if (offset < 0x1000) return;
-
if (space.debugger_access())
{
debugger_write(space, offset, data);
return;
}
+ // Addresses below 0x2000 are ROM
+ if ((m_addr_buf & 0xe000)==0x0000)
+ {
+ return;
+ }
+
+ // Addresses from 8300-83ff (mirrors at 8000, 8100, 8200) are console RAM
+ if ((m_addr_buf & 0xfc00)==0x8000)
+ {
+ m_padram[(m_addr_buf & 0x00ff)>>1] = data;
+ return;
+ }
+
// Handle the internal 32K expansion
if (m_base32k != 0)
{
- m_ram16b[offset-m_base32k] = data;
+ m_ram16b[(m_addr_buf-m_base32k)>>1] = data;
}
else
{
@@ -264,21 +382,34 @@ WRITE16_MEMBER( ti99_datamux_device::write )
*/
SETOFFSET_MEMBER( ti99_datamux_device::setoffset )
{
- if (TRACE_ADDRESS) logerror("datamux: set address %04x\n", offset << 1);
+ m_addr_buf = offset << 1;
+ m_waitcount = 0;
+
+ if (TRACE_ADDRESS) logerror("set address %04x\n", m_addr_buf);
+
+ if ((m_addr_buf & 0xe000) == 0x0000)
+ {
+ return; // console ROM
+ }
+
+ if ((m_addr_buf & 0xfc00) == 0x8000)
+ {
+ return; // console RAM
+ }
+
// Initialize counter
// 1 cycle for loading into the datamux
// 2 subsequent wait states (LSB)
// 2 subsequent wait states (MSB)
// clock cycle 6 is the nominal follower of the last wait state
m_waitcount = 5;
- m_addr_buf = offset << 1;
m_spacep = &space;
m_base32k = 0;
if (m_use32k)
{
- if ((m_addr_buf & 0xe000)==0x2000) m_base32k = 0x1000;
- if (((m_addr_buf & 0xe000)==0xa000) || ((m_addr_buf & 0xc000)==0xc000)) m_base32k = 0x4000;
+ if ((m_addr_buf & 0xe000)==0x2000) m_base32k = 0x2000;
+ if (((m_addr_buf & 0xe000)==0xa000) || ((m_addr_buf & 0xc000)==0xc000)) m_base32k = 0x8000;
}
// Suspend the CPU if not using the 32K
@@ -308,13 +439,13 @@ WRITE_LINE_MEMBER( ti99_datamux_device::clock_in )
if (TRACE_READY) logerror("datamux: stalled due to external READY=0\n");
return;
}
- if (m_read_mode)
+
+ if (m_dbin==ASSERT_LINE)
{
// Reading
if (state==ASSERT_LINE)
{ // raising edge
- m_waitcount--;
- if (m_waitcount==0)
+ if (--m_waitcount==0)
{
m_muxready = ASSERT_LINE;
ready_join();
@@ -333,8 +464,7 @@ WRITE_LINE_MEMBER( ti99_datamux_device::clock_in )
{
if (state==ASSERT_LINE)
{ // raising edge
- m_waitcount--;
- if (m_waitcount==0)
+ if (--m_waitcount==0)
{
m_muxready = ASSERT_LINE;
ready_join();
@@ -365,21 +495,31 @@ void ti99_datamux_device::ready_join()
WRITE_LINE_MEMBER( ti99_datamux_device::dbin_in )
{
- m_read_mode = (state==ASSERT_LINE);
- if (TRACE_ADDRESS) logerror("datamux: data bus in = %d\n", m_read_mode? 1:0 );
+ m_dbin = (line_state)state;
+ if (TRACE_ADDRESS) logerror("data bus in = %d\n", (m_dbin==ASSERT_LINE)? 1:0 );
}
WRITE_LINE_MEMBER( ti99_datamux_device::ready_line )
{
if (TRACE_READY)
{
- if (state != m_sysready) logerror("datamux: READY line from PBox = %d\n", state);
+ if (state != m_sysready) logerror("READY line from PBox = %d\n", state);
}
m_sysready = (line_state)state;
// Also propagate to CPU via driver
ready_join();
}
+WRITE_LINE_MEMBER( ti99_datamux_device::gromclk_in )
+{
+ // Propagate to the GROMs
+ if (m_console_groms_present)
+ {
+ for (int i=0; i < 3; i++) m_grom[i]->gclock_in(state);
+ }
+ m_gromport->gclock_in(state);
+}
+
/***************************************************************************
DEVICE LIFECYCLE FUNCTIONS
***************************************************************************/
@@ -398,15 +538,9 @@ void ti99_datamux_device::device_stop(void)
void ti99_datamux_device::device_reset(void)
{
- const datamux_config *conf = reinterpret_cast<const datamux_config *>(static_config());
-
- const dmux_device_list_entry *list = conf->devlist;
-
- m_cpu = machine().device("maincpu");
- // m_space = &m_cpu->memory().space(AS_PROGRAM);
-
- m_devices.reset(); // clear the list
+ m_consolerom = (UINT16*)owner()->memregion(CONSOLEROM)->base();
m_use32k = (ioport("RAM")->read()==1);
+ m_console_groms_present = (ioport("GROMENA")->read()==1);
// better use a region?
if (m_ram16b==nullptr)
@@ -414,51 +548,6 @@ void ti99_datamux_device::device_reset(void)
m_ram16b = make_unique_clear<UINT16[]>(32768/2);
}
- // Now building the list of active devices at this databus multiplex.
- // We allow for turning off devices according to configuration switch settings.
- // In particular, the HSGPL card cannot function unless the console GROMs are
- // removed.
- if ( list != nullptr )
- {
- bool done = false;
- for (int i=0; !done; i++)
- {
- if (list[i].name == nullptr)
- {
- done = true;
- }
- else
- {
- UINT32 set;
- bool active_device = true;
- if (list[i].setting!=nullptr)
- {
- set = ioport(list[i].setting)->read();
- active_device = ((set & list[i].set)==list[i].set) && ((set & list[i].unset)==0);
- }
- if (active_device)
- {
- device_t *dev = machine().device(list[i].name);
- if (dev != nullptr)
- {
- auto ad = new attached_device(dev, list[i]);
- m_devices.append(*ad);
- if (TRACE_SETUP) logerror("datamux: Device %s mounted at index %d.\n", list[i].name, i);
- }
- else
- {
- if (TRACE_SETUP) logerror("datamux: Device %s not found.\n", list[i].name);
- }
- }
- else
- {
- if (TRACE_SETUP) logerror("datamux: Device %s not mounted due to configuration setting %s.\n", list[i].name, list[i].setting);
- }
- }
- }
- }
- if (TRACE_SETUP) logerror("datamux: Device count = %d\n", m_devices.count());
-
m_sysready = ASSERT_LINE;
m_muxready = ASSERT_LINE;
ready_join();
@@ -466,9 +555,22 @@ void ti99_datamux_device::device_reset(void)
m_waitcount = 0;
m_latch = 0;
- m_read_mode = true;
+ m_dbin = CLEAR_LINE;
}
+void ti99_datamux_device::device_config_complete()
+{
+ m_video = downcast<bus8z_device*>(owner()->subdevice(VIDEO_SYSTEM_TAG));
+ m_sound = downcast<sn76496_base_device*>(owner()->subdevice(TISOUNDCHIP_TAG));
+ m_gromport = downcast<gromport_device*>(owner()->subdevice(GROMPORT_TAG));
+ m_peb = downcast<peribox_device*>(owner()->subdevice(PERIBOX_TAG));
+ m_grom[0] = downcast<tmc0430_device*>(owner()->subdevice(GROM0_TAG));
+ m_grom[1] = downcast<tmc0430_device*>(owner()->subdevice(GROM1_TAG));
+ m_grom[2] = downcast<tmc0430_device*>(owner()->subdevice(GROM2_TAG));
+ m_padram = make_unique_clear<UINT16[]>(256/2);
+}
+
+
INPUT_PORTS_START( datamux )
PORT_START( "RAM" ) /* config */
PORT_CONFNAME( 0x01, 0x00, "Console 32 KiB RAM upgrade (16 bit)" )
diff --git a/src/devices/bus/ti99x/datamux.h b/src/devices/bus/ti99x/datamux.h
index 604dfb2e62f..5b59ea7d134 100644
--- a/src/devices/bus/ti99x/datamux.h
+++ b/src/devices/bus/ti99x/datamux.h
@@ -15,54 +15,16 @@
#define __DMUX__
#include "ti99defs.h"
+#include "machine/tmc0430.h"
+#include "gromport.h"
+#include "bus/ti99_peb/peribox.h"
+#include "sound/sn76496.h"
+#include "video/tms9928a.h"
+#include "bus/ti99x/videowrp.h"
extern const device_type DATAMUX;
/*
- Device that is attached to this datamux.
- The configuration setting is used for certain configurations
- where devices may only be used if others are turned off. In particular,
- if the HGSPL expansion card is used, the GROMs in the console must be
- removed.
-*/
-struct dmux_device_list_entry
-{
- const char *name; // Name of the device (used for looking up the device)
- UINT16 select; // State of the address line bits when addressing this device
- UINT16 address_mask; // Bits of the address bus used to address this device
- UINT16 write_select; // Bits set when doing write accesses to this device (ffff = write-only)
- const char *setting; // configuration switch that may have an effect for the presence of this device
- UINT8 set; // bits that must be set for this switch so that this device is present
- UINT8 unset; // bits that must be reset for this switch so that this device is present
-};
-
-#define DMUX_CONFIG(name) \
- const datamux_config(name) =
-
-struct datamux_config
-{
- const dmux_device_list_entry *devlist;
-};
-
-/*
- Device list of this datamux.
-*/
-class attached_device
-{
- friend class simple_list<attached_device>;
- friend class ti99_datamux_device;
-
-public:
- attached_device(device_t *busdevice, const dmux_device_list_entry &entry)
- : m_next(nullptr), m_device(busdevice), m_config(&entry) { };
-
-private:
- attached_device *m_next;
- device_t *m_device; // the actual device
- const dmux_device_list_entry *m_config;
-};
-
-/*
Main class
*/
class ti99_datamux_device : public device_t
@@ -77,6 +39,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( dbin_in );
DECLARE_WRITE_LINE_MEMBER( ready_line );
+ DECLARE_WRITE_LINE_MEMBER( gromclk_in );
+
template<class _Object> static devcb_base &static_set_ready_callback(device_t &device, _Object object)
{
return downcast<ti99_datamux_device &>(device).m_ready.set_callback(object);
@@ -87,9 +51,22 @@ protected:
void device_start() override;
void device_stop() override;
void device_reset() override;
+ void device_config_complete() override;
ioport_constructor device_input_ports() const override;
private:
+ // Link to the video processor
+ bus8z_device* m_video;
+
+ // Link to the sound processor
+ sn76496_base_device* m_sound;
+
+ // Link to the peripheral expansion box
+ peribox_device* m_peb;
+
+ // Link to the cartridge port (aka GROM port)
+ gromport_device* m_gromport;
+
// Keeps the address space pointer
address_space* m_spacep;
@@ -112,21 +89,18 @@ private:
// Ready line to the CPU
devcb_write_line m_ready;
+ // Address latch (emu). In reality, the address bus remains constant.
+ UINT16 m_addr_buf;
+
+ // DBIN line
+ line_state m_dbin;
+
// Own ready state.
line_state m_muxready;
// Ready state. Needed to control wait state generation via inbound READY
line_state m_sysready;
- /* Address latch (emu). In reality, the address bus remains constant. */
- UINT16 m_addr_buf;
-
- /* Stores the state of the DBIN line. */
- bool m_read_mode;
-
- /* All devices that are attached to the 8-bit bus. */
- simple_list<attached_device> m_devices;
-
/* Latch which stores the first (odd) byte */
UINT8 m_latch;
@@ -136,22 +110,28 @@ private:
/* Memory expansion (internal, 16 bit). */
std::unique_ptr<UINT16[]> m_ram16b;
+ // Console RAM
+ std::unique_ptr<UINT16[]> m_padram;
+
+ // Console ROM
+ UINT16* m_consolerom;
+
+ // Console GROMs
+ tmc0430_device* m_grom[3];
+
/* Use the memory expansion? */
bool m_use32k;
/* Memory base for piggy-back 32K expansion. If 0, expansion is not used. */
UINT16 m_base32k;
- /* Reference to the CPU; avoid lookups. */
- device_t *m_cpu;
+ // Console GROMs are available (the HSGPL expects them to be removed)
+ bool m_console_groms_present;
};
/******************************************************************************/
-#define MCFG_DMUX_ADD(_tag, _devices) \
- MCFG_DEVICE_ADD(_tag, DATAMUX, 0) \
- MCFG_DEVICE_CONFIG( _devices )
-#endif
-
#define MCFG_DMUX_READY_HANDLER( _intcallb ) \
devcb = &ti99_datamux_device::static_set_ready_callback( *device, DEVCB_##_intcallb );
+
+#endif
diff --git a/src/devices/bus/ti99x/genboard.cpp b/src/devices/bus/ti99x/genboard.cpp
index 9d6aeef7e76..10f560ce6bd 100644
--- a/src/devices/bus/ti99x/genboard.cpp
+++ b/src/devices/bus/ti99x/genboard.cpp
@@ -207,7 +207,10 @@
geneve_mapper_device::geneve_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, GENEVE_MAPPER, "Geneve Gate Array", tag, owner, clock, "geneve_mapper", __FILE__), m_gromwaddr_LSB(false), m_gromraddr_LSB(false), m_grom_address(0), m_video_waitstates(false), m_extra_waitstates(false), m_ready_asserted(false), m_read_mode(false), m_debug_no_ws(false), m_geneve_mode(false), m_direct_mode(false), m_cartridge_size(0), m_cartridge_secondpage(false), m_cartridge6_writable(false), m_cartridge7_writable(false), m_turbo(false), m_genmod(false), m_timode(false), m_pfm_mode(0), m_pfm_bank(0), m_pfm_output_enable(false), m_sram_mask(0), m_sram_val(0),
- m_ready(*this), m_waitcount(0), m_ext_waitcount(0), m_clock(nullptr), m_cpu(nullptr), m_pfm512(nullptr), m_pfm512a(nullptr), m_keyboard(nullptr), m_video(nullptr), m_peribox(nullptr), m_sound(nullptr), m_sram(nullptr), m_dram(nullptr)
+ m_ready(*this), m_waitcount(0), m_ext_waitcount(0),
+ m_clock(nullptr), m_cpu(nullptr), m_pfm512(nullptr),
+ m_pfm512a(nullptr), m_sound(nullptr), m_keyboard(nullptr),
+ m_video(nullptr), m_peribox(nullptr), m_sram(nullptr), m_dram(nullptr)
{
m_eprom = nullptr;
}
@@ -466,11 +469,14 @@ READ8_MEMBER( geneve_mapper_device::readm )
switch (dec->function)
{
case MLGVIDEO:
- m_video->readz(space, dec->offset, &value, 0xff);
- if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value);
- // Video wait states are created *after* the access
- // Accordingly, they have no effect when execution is in onchip RAM
- if (m_video_waitstates) set_ext_wait(15);
+ if (!space.debugger_access())
+ {
+ value = m_video->read(space, dec->offset>>1);
+ if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value);
+ // Video wait states are created *after* the access
+ // Accordingly, they have no effect when execution is in onchip RAM
+ if (m_video_waitstates) set_ext_wait(15);
+ }
break;
case MLGMAPPER:
@@ -523,10 +529,13 @@ READ8_MEMBER( geneve_mapper_device::readm )
// video
// ++++ ++-- ---- ---+
// 1000 1000 0000 00x0
- m_video->readz(space, dec->offset, &value, 0xff);
- if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value);
- // See above
- if (m_video_waitstates) set_ext_wait(15);
+ if (!space.debugger_access())
+ {
+ value = m_video->read(space, dec->offset>>1);
+ if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value);
+ // See above
+ if (m_video_waitstates) set_ext_wait(15);
+ }
break;
case MLTSPEECH:
@@ -535,6 +544,7 @@ READ8_MEMBER( geneve_mapper_device::readm )
// 1001 0000 0000 0000
// We need to add the address prefix bits
m_peribox->readz(space, dec->offset, &value, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
if (TRACE_READ) logerror("%s: Read speech -> %02x\n", tag(), value);
break;
@@ -594,6 +604,7 @@ READ8_MEMBER( geneve_mapper_device::readm )
// 0x000000-0x1fffff for the GenMod.(AME,AMD,AMC,AMB,AMA,A0 ...,A15)
m_peribox->readz(space, dec->physaddr, &value, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
if (TRACE_READ) logerror("%s: Read P-Box %04x (%06x) -> %02x\n", tag(), dec->offset, dec->physaddr, value);
break;
@@ -616,6 +627,7 @@ READ8_MEMBER( geneve_mapper_device::readm )
case MPGMBOX:
// Route everything else to the P-Box
m_peribox->readz(space, dec->physaddr, &value, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
break;
}
return value;
@@ -646,10 +658,14 @@ WRITE8_MEMBER( geneve_mapper_device::writem )
// video
// ++++ ++++ ++++ ---+
// 1111 0001 0000 .cc0
- m_video->write(space, dec->offset, data, 0xff);
- if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data);
- // See above
- if (m_video_waitstates) set_ext_wait(15);
+
+ if (!space.debugger_access())
+ {
+ m_video->write(space, dec->offset>>1, data);
+ if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data);
+ // See above
+ if (m_video_waitstates) set_ext_wait(15);
+ }
break;
case MLGMAPPER:
@@ -689,10 +705,13 @@ WRITE8_MEMBER( geneve_mapper_device::writem )
// ++++ ++-- ---- ---+
// 1000 1100 0000 00c0
// Initialize waitstate timer
- m_video->write(space, dec->offset, data, 0xff);
- if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data);
- // See above
- if (m_video_waitstates) set_ext_wait(15);
+ if (!space.debugger_access())
+ {
+ m_video->write(space, dec->offset>>1, data);
+ if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data);
+ // See above
+ if (m_video_waitstates) set_ext_wait(15);
+ }
break;
case MLTSPEECH:
@@ -701,6 +720,7 @@ WRITE8_MEMBER( geneve_mapper_device::writem )
// 1001 0100 0000 0000
// We need to add the address prefix bits
m_peribox->write(space, dec->offset, data, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
if (TRACE_WRITE) logerror("%s: Write speech <- %02x\n", tag(), data);
break;
@@ -756,6 +776,7 @@ WRITE8_MEMBER( geneve_mapper_device::writem )
dec->physaddr = (dec->physaddr & 0x0007ffff); // 19 bit address
if (TRACE_WRITE) logerror("%s: Write P-Box %04x (%06x) <- %02x\n", tag(), offset, dec->physaddr, data);
m_peribox->write(space, dec->physaddr, data, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
break;
case MPGMDRAM:
@@ -775,6 +796,7 @@ WRITE8_MEMBER( geneve_mapper_device::writem )
case MPGMBOX:
// Route everything else to the P-Box
m_peribox->write(space, dec->physaddr, data, 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
break;
}
}
@@ -875,6 +897,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
// We need to add the address prefix bits
dec->function = MLTSPEECH;
dec->offset = offset | ((m_genmod)? 0x170000 : 0x070000);
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->offset, read_mode);
set_wait(1);
return;
@@ -954,6 +977,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
dec->function = MPGBOX;
dec->physaddr = (dec->physaddr & 0x0007ffff); // 19 bit address (with AMA..AMC)
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->physaddr, read_mode);
return;
}
@@ -986,6 +1010,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
// Check: Are waitstates completely turned off for turbo mode, or
// merely the waitstates for DRAM memory access and box access?
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->physaddr, read_mode);
return;
}
@@ -1072,6 +1097,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
{
dec->function = MLTSPEECH;
dec->offset = dec->offset | ((m_genmod)? 0x170000 : 0x070000);
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->offset, read_mode);
set_wait(1);
return;
@@ -1151,6 +1177,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
// only AMA, AMB, AMC are used; AMD and AME are not used
dec->function = MPGBOX;
dec->physaddr = (dec->physaddr & 0x0007ffff); // 19 bit address
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->physaddr, read_mode);
set_wait(1);
}
@@ -1175,6 +1202,7 @@ void geneve_mapper_device::decode(address_space& space, offs_t offset, bool read
// Route everything else to the P-Box
dec->function = MPGMBOX;
dec->physaddr = (dec->physaddr & 0x001fffff); // 21 bit address for Genmod
+ m_peribox->memen_in(ASSERT_LINE);
m_peribox->setaddress_dbin(space, dec->physaddr, read_mode);
if (!m_turbo) set_wait(1);
}
@@ -1346,10 +1374,10 @@ WRITE_LINE_MEMBER( geneve_mapper_device::pfm_output_enable )
void geneve_mapper_device::device_start()
{
// Get pointers
- m_peribox = machine().device<bus8z_device>(PERIBOX_TAG);
+ m_peribox = machine().device<peribox_device>(PERIBOX_TAG);
m_keyboard = machine().device<geneve_keyboard_device>(GKEYBOARD_TAG);
- m_video = machine().device<bus8z_device>(VIDEO_SYSTEM_TAG);
- m_sound = machine().device<bus8z_device>(TISOUND_TAG);
+ m_video = machine().device<v9938_device>(VDP_TAG);
+ m_sound = machine().device<sn76496_base_device>(TISOUNDCHIP_TAG);
m_clock = machine().device<mm58274c_device>(GCLOCK_TAG);
// PFM expansion
diff --git a/src/devices/bus/ti99x/genboard.h b/src/devices/bus/ti99x/genboard.h
index 2248c64f9fe..4f9c5da7f27 100644
--- a/src/devices/bus/ti99x/genboard.h
+++ b/src/devices/bus/ti99x/genboard.h
@@ -19,6 +19,8 @@
#include "video/v9938.h"
#include "cpu/tms9900/tms9995.h"
#include "machine/at29x.h"
+#include "bus/ti99_peb/peribox.h"
+#include "sound/sn76496.h"
extern const device_type GENEVE_MOUSE;
extern const device_type GENEVE_KEYBOARD;
@@ -204,11 +206,11 @@ private:
tms9995_device* m_cpu;
at29c040_device* m_pfm512;
at29c040a_device* m_pfm512a;
+ sn76496_base_device* m_sound;
geneve_keyboard_device* m_keyboard;
- bus8z_device* m_video;
- bus8z_device* m_peribox;
- bus8z_device* m_sound;
+ v9938_device* m_video;
+ peribox_device* m_peribox;
UINT8* m_eprom;
UINT8* m_sram;
UINT8* m_dram;
diff --git a/src/devices/bus/ti99x/grom.cpp b/src/devices/bus/ti99x/grom.cpp
deleted file mode 100644
index 1ecb0168d80..00000000000
--- a/src/devices/bus/ti99x/grom.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// license:LGPL-2.1+
-// copyright-holders:Michael Zapf
-/***************************************************************************
-
- GROM emulation (aka TMC0430)
-
- +----+--+----+
- AD7 |1 G 16| Vss
- AD6 |2 R 15| GR
- AD5 |3 O 14| Vdd
- AD4 |4 M 13| GRC
- AD3 |5 12| M
- AD2 |6 11| MO
- AD1 |7 10| GS*
- AD0 |8 9| Vcc
- +------------+
-
- GR = GROM Ready. Should be connected to processor's READY/HOLD*.
- GRC = GROM clock. Typically in the range of 400-500 kHz.
- M = Direction. 1=read, 0=write
- MO = Mode. 1=address counter access, 0=data access
- GS* = GROM select. 0=select, 1=deselect
-
- GROMs are slow ROM devices, which are
- interfaced via a 8-bit data bus, and include an internal address pointer
- which is incremented after each read. This implies that accesses are
- faster when reading consecutive bytes, although the address pointer can be
- read and written at any time.
-
- GROMs are generally used to store programs written in GPL (Graphic Programming
- Language): a proprietary, interpreted language. The GPL interpreter takes
- most space of the TI-99/4A system ROMs.
-
- Both TI-99/4 and TI-99/4A include three GROMs, with some start-up code,
- system routines and TI-Basic. TI99/4 includes an additional Equation
- Editor. According to the preliminary schematics found on ftp.whtech.com,
- TI-99/8 includes the three standard GROMs and 16 GROMs for the UCSD
- p-system. TI99/2 does not include GROMs at all, and was not designed to
- support any, although it should be relatively easy to create an expansion
- card with the GPL interpreter and a /4a cartridge port.
-
- Communication with GROM is done by writing and reading data over the
- AD0-AD7 lines. Within the TI-99 systems, the address bus is decoded for
- the M, GS*, and MO lines: Writing a byte to address 9c02 asserts the GS* and
- MO line, and clears the M line, which means the transmitted byte is put into
- the internal address register. Two bytes must be written to set up the
- complete address.
-
- It was obviously planned to offer GRAM circuits as well, since the
- programming manuals refer to writing to a special address, clearing the MO
- line. Although the TI-99 systems reserve a port in the memory space, no one
- has ever seen a GRAM circuit in the wild. However, third-party products like
- HSGPL or GRAM Kracker simulate GRAMs using conventional RAM with some
- addressing circuitry, usually in a custom chip.
-
- Each GROM is logically 8 KiB long. Original TI-built GROM are 6 KiB long;
- the extra 2kb can be read, and follow the following formula:
-
- GROM[0x1800+offset] = GROM[0x0800+offset] | GROM[0x1000+offset];
-
- (sounds like address decoding is incomplete - we are lucky we don't burn
- any silicon when doing so... Needless to say, some hackers simulated 8kb
- GRAMs and GROMs with normal RAM/PROM chips and glue logic.)
-
- The address pointer is incremented after each GROM operation, but it will
- always remain within the bounds of the currently selected GROM (e.g. after
- 0x3fff comes 0x2000).
-
- Since address are 16-bit long, you can have up to 8 GROMs. Accordingly,
- a cartridge may include up to 5 GROMs.
-
- Every GROM has an internal ID which represents the high-order three
- address bits. The address counter can be set to any value from 0
- to 0xffff; the GROM will only react when selected and when the current
- address counter's high-order bits match the ID of the chip.
- Example: When the ID is 6, the GROM will react when the address
- counter contains a value from 0xc000 to 0xdfff.
-
- CHECK: Reading the address increases the counter only once. The first access
- returns the MSB, the second (and all following accesses) return the LSB.
-
- Michael Zapf, August 2010
- January 2012: rewritten as class
-
-***************************************************************************/
-
-#include "emu.h"
-#include "grom.h"
-
-#define TRACE_ADDRESS 0
-
-/*
- Constructor.
-*/
-ti99_grom_device::ti99_grom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
-: bus8z_device(mconfig, GROM, "TI-99 GROM device", tag, owner, clock, "ti99_grom", __FILE__), m_writable(false), m_ident(0), m_size(0),
- m_gromready(*this), m_clockrate(0), m_address(0), m_buffer(0), m_raddr_LSB(false), m_waddr_LSB(false), m_memptr(nullptr), m_timer(nullptr)
-{
-}
-
-/*
- Reading from the chip. Represents an access with M=1, GS*=0. The MO bit is
- defined by the offset (0 or 1). This is the enhanced read function with
- Z state.
-*/
-READ8Z_MEMBER( ti99_grom_device::readz )
-{
- // Prevent debugger access
- if (space.debugger_access()) return;
-
- if (offset & 2)
- {
- // GROMs generally answer the address read request
- // (important if GROM simulators do not serve the request but rely on
- // the console GROMs) so we don't check the ident
-
- /* When reading, reset the hi/lo flag byte for writing. */
- /* TODO: Verify this with a real machine. */
- m_waddr_LSB = false;
-
- /* Address reading is done in two steps; first, the high byte */
- /* is transferred, then the low byte. */
- if (m_raddr_LSB)
- {
- /* second pass */
- *value = m_address & 0x00ff;
- m_raddr_LSB = false;
- }
- else
- {
- /* first pass */
- *value = (m_address & 0xff00)>>8;
- m_raddr_LSB = true;
- }
- }
- else
- {
- if (((m_address >> 13)&0x07)==m_ident)
- {
- // GROMs are buffered. Data is retrieved from a buffer,
- // while the buffer is replaced with the next cell content.
- if (TRACE_ADDRESS) if (m_ident==0) logerror("grom0: %04x = %02x\n", m_address-1, m_buffer);
- *value = m_buffer;
- // Get next value, put it in buffer. Note that the GROM
- // wraps at 8K boundaries.
- UINT16 addr = m_address-(m_ident<<13);
-
- if (m_size == 0x1800 && ((m_address&0x1fff)>=0x1800))
- m_buffer = m_memptr[addr-0x1000] | m_memptr[addr-0x0800];
- else
- m_buffer = m_memptr[addr];
- }
- // Note that all GROMs update their address counter.
- // TODO: Check this on a real console
- m_address = (m_address & 0xE000) | ((m_address + 1)&0x1FFF);
-
- // Reset the read and write address flipflops.
- m_raddr_LSB = m_waddr_LSB = false;
-
- // Maybe the timer is also required for address reading/setting, but
- // we don't have such technical details on GROMs.
- clear_ready();
- }
-}
-
-/*
- Writing to the chip. Represents an access with M=0, GS*=0. The MO bit is
- defined by the offset (0 or 1).
-*/
-WRITE8_MEMBER( ti99_grom_device::write )
-{
- // Prevent debugger access
- if (space.debugger_access()) return;
-
- if (offset & 2)
- {
- /* write GROM address */
- /* see comments above */
- m_raddr_LSB = false;
-
- /* Implements the internal flipflop. */
- /* The Editor/Assembler manuals says that the current address */
- /* plus one is returned. This effect is properly emulated */
- /* by using a read-ahead buffer. */
- if (m_waddr_LSB)
- {
- /* Accept low byte (2nd write) */
- m_address = (m_address & 0xFF00) | data;
- /* Setting the address causes a new prefetch */
- if (is_selected())
- {
- m_buffer = m_memptr[m_address-(m_ident<<13)];
- }
- m_waddr_LSB = false;
- if (TRACE_ADDRESS) if (m_ident==0) logerror("grom0: %04x\n", m_address);
- }
- else
- {
- /* Accept high byte (1st write). Do not advance the address conter. */
- m_address = (data << 8) | (m_address & 0xFF);
- m_waddr_LSB = true;
- return;
- }
- }
- else
- {
- /* write GRAM data */
- if ((((m_address >> 13)&0x07)==m_ident) && m_writable)
- {
- UINT16 write_addr;
- // We need to rewind by 1 because the read address has already advanced.
- // However, do not change the address counter!
- write_addr = (m_address & 0xE000) | ((m_address - 1)&0x1FFF);
-
- // UINT16 addr = m_address-(m_ident<<13);
- if (m_size > 0x1800 || ((m_address&0x1fff)<0x1800))
- m_memptr[write_addr-(m_ident<<13)] = data;
- }
- m_raddr_LSB = m_waddr_LSB = false;
- clear_ready();
- }
- m_address = (m_address & 0xE000) | ((m_address + 1)&0x1FFF);
-}
-
-/*
- Timing. We assume that each data read results in READY going down for
- one cycle at the given frequency.
-*/
-void ti99_grom_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- m_gromready(ASSERT_LINE);
-}
-
-void ti99_grom_device::clear_ready()
-{
- m_gromready(CLEAR_LINE);
- m_timer->adjust(attotime::from_hz(m_clockrate));
-}
-
-/***************************************************************************
- DEVICE FUNCTIONS
-***************************************************************************/
-
-void ti99_grom_device::device_start(void)
-{
- const ti99grom_config *conf = reinterpret_cast<const ti99grom_config *>(static_config());
-
- m_memptr = owner()->memregion(conf->regionname)->base();
- assert (m_memptr!=nullptr);
- m_memptr += conf->offset_reg;
-
- m_size = conf->size;
- m_clockrate = conf->clockrate;
- m_writable = conf->writable;
- m_ident = conf->ident;
- m_gromready.resolve_safe();
-
- m_timer = timer_alloc(0);
-}
-
-void ti99_grom_device::device_reset(void)
-{
- m_address = 0;
- m_raddr_LSB = false;
- m_waddr_LSB = false;
- m_buffer = 0;
-}
-
-const device_type GROM = &device_creator<ti99_grom_device>;
diff --git a/src/devices/bus/ti99x/grom.h b/src/devices/bus/ti99x/grom.h
deleted file mode 100644
index a3129b6997f..00000000000
--- a/src/devices/bus/ti99x/grom.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// license:LGPL-2.1+
-// copyright-holders:Michael Zapf
-/***************************************************************************
-
- GROM emulation
- See grom.c for documentation,
-
- Michael Zapf
-
- February 2012: Rewritten as class
-
-***************************************************************************/
-#ifndef __TI99GROM__
-#define __TI99GROM__
-
-#include "ti99defs.h"
-
-struct ti99grom_config
-{
- bool writable;
- int ident;
- const char *regionname;
- offs_t offset_reg;
- int size;
- int clockrate;
-};
-
-#define GROM_CONFIG(name) \
- const ti99grom_config(name) =
-
-#define MCFG_GROM_READY_CALLBACK(_write) \
- devcb = &ti99_grom_device::set_ready_wr_callback(*device, DEVCB_##_write);
-
-extern const device_type GROM;
-
-/*
- ti99_grom. For bus8z_device see ti99defs.h
-*/
-class ti99_grom_device : public bus8z_device, ti99grom_config
-{
-public:
- ti99_grom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
- template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<ti99_grom_device &>(device).m_gromready.set_callback(object); }
-
- DECLARE_READ8Z_MEMBER(readz) override;
- DECLARE_WRITE8_MEMBER(write) override;
-
-private:
- // Is this a GRAM (never seen actually, but obviously planned)
- bool m_writable;
-
- // Identification of this GROM (0-7)
- int m_ident;
-
- // If the GROM has only 6 KiB, the remaining 2 KiB are filled with a
- // specific byte pattern which is created by a logical OR of lower
- // regions
- int m_size;
-
- // Ready callback. This line is usually connected to the READY pin of the CPU.
- devcb_write_line m_gromready;
-
- // Frequency of the incoming GROM clock. In most application cases the
- // GROM gets its clock from the video display processor (TMS9918)
- int m_clockrate;
-
- /* Address pointer. */
- // This value is always expected to be in the range 0x0000 - 0xffff, even
- // when this GROM is not addressed.
- UINT16 m_address;
-
- /* GROM data buffer. */
- UINT8 m_buffer;
-
- /* Internal flip-flop. Used when retrieving the address counter. */
- bool m_raddr_LSB;
-
- /* Internal flip-flops. Used when writing the address counter.*/
- bool m_waddr_LSB;
-
- /* Pointer to the memory region contained in this GROM. */
- UINT8 *m_memptr;
-
- // Timer for READY line operation
- emu_timer *m_timer;
-
- /* Indicates whether this device will react on the next read/write data access. */
- inline int is_selected()
- {
- return (((m_address >> 13)&0x07)==m_ident);
- }
-
- // Calling this method causes the READY line to be cleared, which puts the
- // CPU into wait state mode. A timer is set to raise READY again.
- void clear_ready();
-
- virtual void device_start(void) override;
- virtual void device_reset(void) override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-};
-
-
-#define MCFG_GROM_ADD(_tag, _config) \
- MCFG_DEVICE_ADD(_tag, GROM, 0) \
- MCFG_DEVICE_CONFIG(_config)
-
-#endif
diff --git a/src/devices/bus/ti99x/gromport.cpp b/src/devices/bus/ti99x/gromport.cpp
index 33ef82ae2a7..0109c15708d 100644
--- a/src/devices/bus/ti99x/gromport.cpp
+++ b/src/devices/bus/ti99x/gromport.cpp
@@ -40,7 +40,7 @@
This means that a maximum of 8 KiB of direct memory space can be accessed.
The /GS line is used to enable GROM circuits on the board (serial ROMs with
- own address counter, see grom.h).
+ own address counter, see tmc0430.h).
When a cartridge is inserted the /RESET line is pulled to ground, which
via a R/C component pulls down the /RESET input of the timer circuit for
@@ -111,6 +111,7 @@
***************************************************************************/
#include "gromport.h"
+#include "emuopts.h"
#include "image.h"
#include "softlist.h"
@@ -119,6 +120,7 @@
#define TRACE_ILLWRITE 0
#define TRACE_CONFIG 0
#define TRACE_READ 0
+#define TRACE_WRITE 0
#define TRACE_GROM 0
#define TRACE_GKRACKER 0
#define TRACE_CRU 0
@@ -186,20 +188,33 @@ gromport_device::gromport_device(const machine_config &mconfig, const char *tag,
m_connector(nullptr),
m_reset_on_insert(true),
m_console_ready(*this),
- m_console_reset(*this), m_grombase(0), m_grommask(0)
+ m_console_reset(*this) // , m_grombase(0), m_grommask(0)
{ }
-/* Only called for addresses 6000-7fff and GROM addresses (see datamux config) */
+/*
+ Reading via the GROM port. Only 13 address lines are passed through
+ on the TI-99/4A, and 14 lines on the TI-99/8.
+*/
READ8Z_MEMBER(gromport_device::readz)
{
if (m_connector != nullptr)
- m_connector->readz(space, offset, value);
+ {
+ m_connector->readz(space, offset & m_mask, value);
+ if (TRACE_READ) if (m_romgq) logerror("Read %04x -> %02x\n", offset, *value);
+ }
}
+/*
+ Writing via the GROM port. Only 13 address lines are passed through
+ on the TI-99/4A, and 14 lines on the TI-99/8.
+*/
WRITE8_MEMBER(gromport_device::write)
{
if (m_connector != nullptr)
- m_connector->write(space, offset, data);
+ {
+ if (TRACE_WRITE) if (m_romgq) logerror("Write %04x <- %02x\n", offset, data);
+ m_connector->write(space, offset & m_mask, data);
+ }
}
READ8Z_MEMBER(gromport_device::crureadz)
@@ -219,6 +234,31 @@ WRITE_LINE_MEMBER(gromport_device::ready_line)
m_console_ready(state);
}
+/*
+ Asserted when the console addresses cartridge rom.
+*/
+WRITE_LINE_MEMBER(gromport_device::romgq_line)
+{
+ m_romgq = state;
+ if (m_connector != nullptr)
+ m_connector->romgq_line(state);
+}
+
+WRITE_LINE_MEMBER(gromport_device::gclock_in)
+{
+ if (m_connector != nullptr)
+ m_connector->gclock_in(state);
+}
+
+/*
+ Combined GROM control lines.
+*/
+WRITE8_MEMBER( gromport_device::set_gromlines )
+{
+ if (m_connector != nullptr)
+ m_connector->set_gromlines(space, offset, data);
+}
+
void gromport_device::device_start()
{
m_console_ready.resolve();
@@ -230,11 +270,11 @@ void gromport_device::device_reset()
m_reset_on_insert = (ioport("CARTRESET")->read()==0x01);
}
-void gromport_device::set_grom_base(UINT16 grombase, UINT16 grommask)
-{
- m_grombase = grombase;
- m_grommask = grommask;
-}
+// void gromport_device::set_grom_base(UINT16 grombase, UINT16 grommask)
+// {
+ // m_grombase = grombase;
+ // m_grommask = grommask;
+// }
/*
Shall we reset the console when a cartridge has been inserted?
@@ -255,15 +295,18 @@ void gromport_device::cartridge_inserted()
void gromport_device::device_config_complete()
{
m_connector = static_cast<ti99_cartridge_connector_device*>(subdevices().first());
- set_grom_base(0x9800, 0xf800);
}
-SLOT_INTERFACE_START( gromport )
+SLOT_INTERFACE_START( gromport4 )
SLOT_INTERFACE("single", GROMPORT_SINGLE)
SLOT_INTERFACE("multi", GROMPORT_MULTI)
SLOT_INTERFACE("gkracker", GROMPORT_GK)
SLOT_INTERFACE_END
+SLOT_INTERFACE_START( gromport8 )
+ SLOT_INTERFACE("single", GROMPORT_SINGLE)
+ SLOT_INTERFACE("multi", GROMPORT_MULTI)
+SLOT_INTERFACE_END
INPUT_PORTS_START(gromport)
PORT_START( "CARTRESET" )
@@ -310,16 +353,6 @@ void ti99_cartridge_connector_device::device_config_complete()
m_gromport = static_cast<gromport_device*>(owner());
}
-UINT16 ti99_cartridge_connector_device::grom_base()
-{
- return m_gromport->get_grom_base();
-}
-
-UINT16 ti99_cartridge_connector_device::grom_mask()
-{
- return m_gromport->get_grom_mask();
-}
-
single_conn_device::single_conn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ti99_cartridge_connector_device(mconfig, GROMPORT_SINGLE, "Standard cartridge connector", tag, owner, clock, "single", __FILE__),
m_cartridge(nullptr)
@@ -350,6 +383,28 @@ WRITE8_MEMBER(single_conn_device::cruwrite)
m_cartridge->cruwrite(space, offset, data);
}
+WRITE_LINE_MEMBER(single_conn_device::romgq_line)
+{
+ // Pass through
+ m_cartridge->romgq_line(state);
+}
+
+/*
+ Combined select lines
+*/
+WRITE8_MEMBER(single_conn_device::set_gromlines)
+{
+ // Pass through
+ m_cartridge->set_gromlines(space, offset, data);
+}
+
+
+WRITE_LINE_MEMBER(single_conn_device::gclock_in)
+{
+ // Pass through
+ m_cartridge->gclock_in(state);
+}
+
void single_conn_device::device_start()
{
m_cartridge = static_cast<ti99_cartridge_device*>(subdevices().first());
@@ -475,10 +530,8 @@ int multi_conn_device::get_active_slot(bool changebase, offs_t offset)
int slot;
if (changebase)
{
- if ((offset & grom_mask()) == grom_base())
- {
- set_slot((offset>>2) & 0x00ff);
- }
+ // GROM selected?
+ if (m_gsel != 0) set_slot((offset>>2) & 0x00ff);
}
slot = m_active_slot;
return slot;
@@ -497,6 +550,50 @@ void multi_conn_device::remove(int index)
m_cartridge[index] = nullptr;
}
+WRITE_LINE_MEMBER(multi_conn_device::romgq_line)
+{
+ m_readrom = state;
+
+ // Propagate to all slots
+ for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
+ {
+ if (m_cartridge[i] != nullptr)
+ {
+ m_cartridge[i]->romgq_line(state);
+ }
+ }
+}
+
+/*
+ Combined select lines
+*/
+WRITE8_MEMBER(multi_conn_device::set_gromlines)
+{
+ // GROM selected?
+ m_gsel = data;
+
+ // Propagate to all slots
+ for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
+ {
+ if (m_cartridge[i] != nullptr)
+ {
+ m_cartridge[i]->set_gromlines(space, offset, data);
+ }
+ }
+}
+
+WRITE_LINE_MEMBER(multi_conn_device::gclock_in)
+{
+ // Propagate to all slots
+ for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
+ {
+ if (m_cartridge[i] != nullptr)
+ {
+ m_cartridge[i]->gclock_in(state);
+ }
+ }
+}
+
READ8Z_MEMBER(multi_conn_device::readz)
{
int slot = get_active_slot(true, offset);
@@ -504,14 +601,14 @@ READ8Z_MEMBER(multi_conn_device::readz)
// If we have a GROM access, we need to send the read request to all
// attached cartridges so the slot is irrelevant here. Each GROM
// contains an internal address counter, and we must make sure they all stay in sync.
- if ((offset & grom_mask()) == grom_base())
+ if (m_gsel != 0)
{
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
{
if (m_cartridge[i] != nullptr)
{
UINT8 newval = *value;
- m_cartridge[i]->readz(space, offset, &newval, mem_mask);
+ m_cartridge[i]->readz(space, offset, &newval, 0xff);
if (i==slot)
{
*value = newval;
@@ -523,33 +620,32 @@ READ8Z_MEMBER(multi_conn_device::readz)
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
- m_cartridge[slot]->readz(space, offset, value, mem_mask);
+ m_cartridge[slot]->readz(space, offset, value, 0xff);
}
}
}
WRITE8_MEMBER(multi_conn_device::write)
{
- int slot = get_active_slot(true, offset);
-
// Same issue as above (read)
// We don't have GRAM cartridges, anyway, so it's just used for setting the address.
- if ((offset & grom_mask()) == grom_base())
+ if (m_gsel != 0)
{
for (auto & elem : m_cartridge)
{
if (elem != nullptr)
{
- elem->write(space, offset, data, mem_mask);
+ elem->write(space, offset, data, 0xff);
}
}
}
else
{
+ int slot = get_active_slot(true, offset);
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
- // logerror("%s: try it on slot %d\n", tag(), slot);
- m_cartridge[slot]->write(space, offset, data, mem_mask);
+ // logerror("writing %04x (slot %d) <- %02x\n", offset, slot, data);
+ m_cartridge[slot]->write(space, offset, data, 0xff);
}
}
}
@@ -595,6 +691,7 @@ void multi_conn_device::device_reset(void)
{
m_active_slot = 0;
m_fixed_slot = ioport("CARTSLOT")->read() - 1;
+ m_gsel = 0;
}
static MACHINE_CONFIG_FRAGMENT( multi_slot )
@@ -751,9 +848,40 @@ gkracker_device::gkracker_device(const machine_config &mconfig, const char *tag,
{
}
+WRITE_LINE_MEMBER(gkracker_device::romgq_line)
+{
+ if (m_cartridge != nullptr)
+ {
+ // Propagate to the guest
+ m_cartridge->romgq_line(state);
+ }
+}
+
+/*
+ Combined select lines
+*/
+WRITE8_MEMBER(gkracker_device::set_gromlines)
+{
+ m_gsel = data;
+ if (m_cartridge != nullptr)
+ {
+ // Propagate to the guest
+ m_cartridge->set_gromlines(space, offset, data);
+ }
+}
+
+WRITE_LINE_MEMBER(gkracker_device::gclock_in)
+{
+ if (m_cartridge != nullptr)
+ {
+ // Propagate to the guest
+ m_cartridge->gclock_in(state);
+ }
+}
+
READ8Z_MEMBER(gkracker_device::readz)
{
- if ((offset & grom_mask()) == grom_base())
+ if (m_gsel != 0)
{
// Reads from the GRAM space of the GRAM Kracker.
@@ -863,7 +991,7 @@ WRITE8_MEMBER(gkracker_device::write)
m_cartridge->write(space, offset, data, mem_mask);
}
- if ((offset & grom_mask()) == grom_base())
+ if (m_gsel != 0)
{
// Write to the GRAM space of the GRAM Kracker.
if ((offset & 0x0002)==0x0002)
@@ -1056,6 +1184,7 @@ void gkracker_device::device_reset()
m_grom_address = 0; // for the GROM emulation
m_ram_page = 0;
m_waddr_LSB = false;
+ m_gsel = 0;
}
static MACHINE_CONFIG_FRAGMENT( gkracker_slot )
@@ -1270,15 +1399,15 @@ bool ti99_cartridge_device::has_grom()
return m_pcb->m_grom_size>0;
}
-UINT16 ti99_cartridge_device::grom_base()
-{
- return m_connector->grom_base();
-}
-
-UINT16 ti99_cartridge_device::grom_mask()
-{
- return m_connector->grom_mask();
-}
+// UINT16 ti99_cartridge_device::grom_base()
+// {
+ // return m_connector->grom_base();
+// }
+//
+// UINT16 ti99_cartridge_device::grom_mask()
+// {
+ // return m_connector->grom_mask();
+// }
bool ti99_cartridge_device::call_load()
{
@@ -1401,12 +1530,14 @@ bool ti99_cartridge_device::call_softlist_load(software_list_device &swlist, con
READ8Z_MEMBER(ti99_cartridge_device::readz)
{
- if (m_pcb != nullptr) m_pcb->readz(space, offset, value);
+ if (m_pcb != nullptr)
+ m_pcb->readz(space, offset, value);
}
WRITE8_MEMBER(ti99_cartridge_device::write)
{
- if (m_pcb != nullptr) m_pcb->write(space, offset, data);
+ if (m_pcb != nullptr)
+ m_pcb->write(space, offset, data);
}
READ8Z_MEMBER(ti99_cartridge_device::crureadz)
@@ -1424,48 +1555,44 @@ WRITE_LINE_MEMBER( ti99_cartridge_device::ready_line )
m_connector->ready_line(state);
}
-void ti99_cartridge_device::device_config_complete()
+WRITE_LINE_MEMBER( ti99_cartridge_device::romgq_line )
{
- update_names();
- m_softlist = false;
- m_connector = static_cast<ti99_cartridge_connector_device*>(owner());
+ if (m_pcb != nullptr)
+ {
+ m_pcb->romgq_line(state);
+ m_readrom = state;
+ }
}
-static GROM_CONFIG(grom3_config)
-{
- false, 3, CARTGROM_TAG, 0x0000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(grom4_config)
-{
- false, 4, CARTGROM_TAG, 0x2000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(grom5_config)
+/*
+ Combined select lines
+*/
+WRITE8_MEMBER(ti99_cartridge_device::set_gromlines)
{
- false, 5, CARTGROM_TAG, 0x4000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(grom6_config)
+ if (m_pcb != nullptr) m_pcb->set_gromlines(space, offset, data);
+}
+
+WRITE_LINE_MEMBER(ti99_cartridge_device::gclock_in)
{
- false, 6, CARTGROM_TAG, 0x6000, 0x1800, GROMFREQ
-};
-static GROM_CONFIG(grom7_config)
+ if (m_pcb != nullptr) m_pcb->gclock_in(state);
+}
+
+void ti99_cartridge_device::device_config_complete()
{
- false, 7, CARTGROM_TAG, 0x8000, 0x1800, GROMFREQ
-};
+ update_names();
+ m_softlist = false;
+ m_connector = static_cast<ti99_cartridge_connector_device*>(owner());
+}
/*
5 GROMs that may be contained in a cartridge
*/
static MACHINE_CONFIG_FRAGMENT( ti99_cartridge )
- MCFG_GROM_ADD( GROM3_TAG, grom3_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_cartridge_device, ready_line))
- MCFG_GROM_ADD( GROM4_TAG, grom4_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_cartridge_device, ready_line))
- MCFG_GROM_ADD( GROM5_TAG, grom5_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_cartridge_device, ready_line))
- MCFG_GROM_ADD( GROM6_TAG, grom6_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_cartridge_device, ready_line))
- MCFG_GROM_ADD( GROM7_TAG, grom7_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_cartridge_device, ready_line))
+ MCFG_GROM_ADD( GROM3_TAG, 3, CARTGROM_TAG, 0x0000, WRITELINE(ti99_cartridge_device, ready_line))
+ MCFG_GROM_ADD( GROM4_TAG, 4, CARTGROM_TAG, 0x2000, WRITELINE(ti99_cartridge_device, ready_line))
+ MCFG_GROM_ADD( GROM5_TAG, 5, CARTGROM_TAG, 0x4000, WRITELINE(ti99_cartridge_device, ready_line))
+ MCFG_GROM_ADD( GROM6_TAG, 6, CARTGROM_TAG, 0x6000, WRITELINE(ti99_cartridge_device, ready_line))
+ MCFG_GROM_ADD( GROM7_TAG, 7, CARTGROM_TAG, 0x8000, WRITELINE(ti99_cartridge_device, ready_line))
MACHINE_CONFIG_END
machine_config_constructor ti99_cartridge_device::device_mconfig_additions() const
@@ -1499,19 +1626,31 @@ const device_type TI99CART = &device_creator<ti99_cartridge_device>;
Unlike in the previous implementation we do not model it as a full device.
***************************************************************************/
-ti99_cartridge_pcb::ti99_cartridge_pcb(): m_cart(nullptr), m_grom_size(0), m_rom_size(0), m_ram_size(0), m_rom_ptr(nullptr), m_ram_ptr(nullptr), m_rom_page(0), m_grom_ptr(nullptr), m_grom_address(0), m_ram_page(0), m_tag(nullptr)
-{
-}
-
-UINT16 ti99_cartridge_pcb::grom_base()
+ti99_cartridge_pcb::ti99_cartridge_pcb()
+ : m_cart(nullptr),
+ m_grom_size(0),
+ m_rom_size(0),
+ m_ram_size(0),
+ m_rom_ptr(nullptr),
+ m_ram_ptr(nullptr),
+ m_access_cartspace(false),
+ m_rom_page(0),
+ m_grom_ptr(nullptr),
+ m_grom_address(0),
+ m_ram_page(0),
+ m_tag(nullptr)
{
- return m_cart->grom_base();
}
-UINT16 ti99_cartridge_pcb::grom_mask()
-{
- return m_cart->grom_mask();
-}
+// UINT16 ti99_cartridge_pcb::grom_base()
+// {
+ // return m_cart->grom_base();
+// }
+//
+// UINT16 ti99_cartridge_pcb::grom_mask()
+// {
+ // return m_cart->grom_mask();
+// }
void ti99_cartridge_pcb::set_cartridge(ti99_cartridge_device *cart)
{
@@ -1540,31 +1679,38 @@ WRITE8_MEMBER(ti99_cartridge_pcb::gromwrite)
}
}
+/*
+ TI-99/4A cartridges can only occupy 8 KiB of CPU RAM space. For TI-99/8
+ cartridges with up to 16 KiB we need a new PCB type. Unfortunately, such
+ cartridges were never developed.
+*/
READ8Z_MEMBER(ti99_cartridge_pcb::readz)
{
- if ((offset & grom_mask())==grom_base())
- gromreadz(space, offset, value, mem_mask);
- else
+ if (m_access_cartspace)
{
if (m_rom_ptr!=nullptr)
{
- // For TI-99/8 we should plan for 16K cartridges. However, none was ever produced.
- // Well, forget about that.
*value = m_rom_ptr[offset & 0x1fff];
- // logerror("%s: read cartridge rom space %04x = %02x\n", tag(), offset, *value);
}
}
+ else
+ {
+ // Will not return anything when not selected (preceding gsq=ASSERT)
+ gromreadz(space, offset, value, mem_mask);
+ }
}
WRITE8_MEMBER(ti99_cartridge_pcb::write)
{
- // logerror("%s: write standard\n", tag());
- if ((offset & grom_mask())==grom_base())
- gromwrite(space, offset, data, mem_mask);
- else
+ if (m_access_cartspace)
{
if (TRACE_ILLWRITE) space.device().logerror("%s: Cannot write to ROM space at %04x\n", tag(), offset);
}
+ else
+ {
+ // Will not change anything when not selected (preceding gsq=ASSERT)
+ gromwrite(space, offset, data, mem_mask);
+ }
}
READ8Z_MEMBER(ti99_cartridge_pcb::crureadz)
@@ -1575,11 +1721,35 @@ WRITE8_MEMBER(ti99_cartridge_pcb::cruwrite)
{
}
-inline void ti99_cartridge_pcb::set_grom_pointer(int number, device_t *dev)
+void ti99_cartridge_pcb::set_grom_pointer(int number, device_t *dev)
{
- m_grom[number] = static_cast<ti99_grom_device*>(dev);
+ m_grom[number] = static_cast<tmc0430_device*>(dev);
}
+
+WRITE_LINE_MEMBER( ti99_cartridge_pcb::romgq_line )
+{
+ m_access_cartspace = (state==ASSERT_LINE);
+}
+
+// Propagate to all GROMs
+
+/*
+ Combined select lines
+*/
+WRITE8_MEMBER(ti99_cartridge_pcb::set_gromlines)
+{
+ for (auto& elem : m_grom)
+ if (elem != nullptr) elem->set_lines(space, offset, data);
+}
+
+WRITE_LINE_MEMBER(ti99_cartridge_pcb::gclock_in)
+{
+ for (auto& elem : m_grom)
+ if (elem != nullptr) elem->gclock_in(state);
+}
+
+
/*****************************************************************************
Cartridge type: Paged (Extended Basic)
This cartridge consists of GROM memory and 2 pages of standard ROM.
@@ -1591,23 +1761,28 @@ inline void ti99_cartridge_pcb::set_grom_pointer(int number, device_t *dev)
READ8Z_MEMBER(ti99_paged_cartridge::readz)
{
- if ((offset & grom_mask())==grom_base())
- gromreadz(space, offset, value, mem_mask);
- else
+ if (m_access_cartspace)
{
*value = m_rom_ptr[(offset & 0x1fff) | (m_rom_page << 13)];
}
+ else
+ {
+ // Will not return anything when not selected (preceding gsq=ASSERT)
+ gromreadz(space, offset, value, mem_mask);
+ }
}
WRITE8_MEMBER(ti99_paged_cartridge::write)
{
- // logerror("%s: write standard\n", tag());
- if ((offset & grom_mask())==grom_base())
- gromwrite(space, offset, data, mem_mask);
-
- else {
+ if (m_access_cartspace)
+ {
m_rom_page = (offset >> 1) & 1;
}
+ else
+ {
+ // Will not change anything when not selected (preceding gsq=ASSERT)
+ gromwrite(space, offset, data, mem_mask);
+ }
}
/*****************************************************************************
@@ -1620,10 +1795,7 @@ WRITE8_MEMBER(ti99_paged_cartridge::write)
/* Read function for the minimem cartridge. */
READ8Z_MEMBER(ti99_minimem_cartridge::readz)
{
- if ((offset & grom_mask())==grom_base())
- gromreadz(space, offset, value, mem_mask);
-
- else
+ if (m_access_cartspace)
{
if ((offset & 0x1000)==0x0000)
{
@@ -1637,16 +1809,16 @@ READ8Z_MEMBER(ti99_minimem_cartridge::readz)
*value = m_ram_ptr[offset & 0x0fff];
}
}
+ else
+ {
+ gromreadz(space, offset, value, mem_mask);
+ }
}
/* Write function for the minimem cartridge. */
WRITE8_MEMBER(ti99_minimem_cartridge::write)
{
- // logerror("%s: write standard\n", tag());
- if ((offset & grom_mask())==grom_base())
- gromwrite(space, offset, data, mem_mask);
-
- else
+ if (m_access_cartspace)
{
if ((offset & 0x1000)==0x0000)
{
@@ -1657,6 +1829,10 @@ WRITE8_MEMBER(ti99_minimem_cartridge::write)
m_ram_ptr[offset & 0x0fff] = data;
}
}
+ else
+ {
+ gromwrite(space, offset, data, mem_mask);
+ }
}
/*****************************************************************************
@@ -1678,26 +1854,30 @@ WRITE8_MEMBER(ti99_minimem_cartridge::write)
/* Read function for the super cartridge. */
READ8Z_MEMBER(ti99_super_cartridge::readz)
{
- if ((offset & grom_mask())==grom_base())
- gromreadz(space, offset, value, mem_mask);
- else
+ if (m_access_cartspace)
{
if (m_ram_ptr != nullptr)
{
*value = m_ram_ptr[(m_ram_page << 13) | (offset & 0x1fff)];
}
}
+ else
+ {
+ gromreadz(space, offset, value, mem_mask);
+ }
}
/* Write function for the super cartridge. */
WRITE8_MEMBER(ti99_super_cartridge::write)
{
- if ((offset & grom_mask())==grom_base())
- gromwrite(space, offset, data, mem_mask);
- else
+ if (m_access_cartspace)
{
m_ram_ptr[(m_ram_page << 13) | (offset & 0x1fff)] = data;
}
+ else
+ {
+ gromwrite(space, offset, data, mem_mask);
+ }
}
READ8Z_MEMBER(ti99_super_cartridge::crureadz)
@@ -1763,9 +1943,7 @@ WRITE8_MEMBER(ti99_super_cartridge::cruwrite)
/* Read function for the mbx cartridge. */
READ8Z_MEMBER(ti99_mbx_cartridge::readz)
{
- if ((offset & grom_mask())==grom_base())
- gromreadz(space, offset, value, mem_mask);
- else
+ if (m_access_cartspace)
{
if ((offset & 0x1c00)==0x0c00)
{
@@ -1781,14 +1959,16 @@ READ8Z_MEMBER(ti99_mbx_cartridge::readz)
*value = m_rom_ptr[(offset & 0x1fff) | (m_rom_page<<13)];
}
}
+ else
+ {
+ gromreadz(space, offset, value, mem_mask);
+ }
}
/* Write function for the mbx cartridge. */
WRITE8_MEMBER(ti99_mbx_cartridge::write)
{
- if ((offset & grom_mask())==grom_base())
- gromwrite(space, offset, data, mem_mask);
- else
+ if (m_access_cartspace)
{
if (offset == 0x6ffe)
{
@@ -1802,6 +1982,10 @@ WRITE8_MEMBER(ti99_mbx_cartridge::write)
m_ram_ptr[offset & 0x03ff] = data;
}
}
+ else
+ {
+ gromwrite(space, offset, data, mem_mask);
+ }
}
/*****************************************************************************
@@ -2032,9 +2216,15 @@ WRITE8_MEMBER(ti99_pagedcru_cartridge::cruwrite)
******************************************************************************/
+WRITE_LINE_MEMBER(ti99_gromemu_cartridge::gsq_line)
+{
+ m_grom_space = (state==ASSERT_LINE);
+}
+
+
READ8Z_MEMBER(ti99_gromemu_cartridge::readz)
{
- if ((offset & grom_mask())==grom_base())
+ if (m_grom_space)
gromemureadz(space, offset, value, mem_mask);
else
{
@@ -2055,8 +2245,7 @@ READ8Z_MEMBER(ti99_gromemu_cartridge::readz)
WRITE8_MEMBER(ti99_gromemu_cartridge::write)
{
- // logerror("%s: write standard\n", tag());
- if ((offset & grom_mask())==grom_base())
+ if (m_grom_space)
gromemuwrite(space, offset, data, mem_mask);
else {
@@ -2179,7 +2368,7 @@ rpk::rpk(emu_options& options, const char* sysname)
rpk::~rpk()
{
- //if (TRACE_RPK) logerror("gromport/RPK: Destroy RPK\n");
+ if (TRACE_RPK) printf("gromport/RPK: Destroy RPK\n");
}
/*
@@ -2290,7 +2479,7 @@ rpk_socket* rpk_reader::load_rom_resource(util::archive_file &zip, xml_data_node
file = xml_get_attribute_string(rom_resource_node, "file", nullptr);
if (file == nullptr) throw rpk_exception(RPK_INVALID_LAYOUT, "<rom> must have a 'file' attribute");
- //if (TRACE_RPK) logerror("gromport/RPK: Loading ROM contents for socket '%s' from file %s\n", socketname, file);
+ if (TRACE_RPK) printf("gromport/RPK: Loading ROM contents for socket '%s' from file %s\n", socketname, file);
// check for crc
crcstr = xml_get_attribute_string(rom_resource_node, "crc", nullptr);
@@ -2378,7 +2567,7 @@ rpk_socket* rpk_reader::load_ram_resource(emu_options &options, xml_data_node* r
contents = global_alloc_array_clear<UINT8>(length);
if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY);
- //if (TRACE_RPK) logerror("gromport/RPK: Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname);
+ if (TRACE_RPK) printf("gromport/RPK: Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname);
ram_pname = nullptr;
@@ -2400,7 +2589,7 @@ rpk_socket* rpk_reader::load_ram_resource(emu_options &options, xml_data_node* r
std::string ram_pathname = std::string(system_name).append(PATH_SEPARATOR).append(ram_filename);
ram_pname = core_strdup(ram_pathname.c_str());
// load, and fill rest with 00
- //if (TRACE_RPK) logerror("gromport/RPK: Loading NVRAM contents from '%s'\n", ram_pname);
+ if (TRACE_RPK) printf("gromport/RPK: Loading NVRAM contents from '%s'\n", ram_pname);
image_battery_load_by_name(options, ram_pname, contents, length, 0x00);
}
}
@@ -2488,7 +2677,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy
// We'll try to find the PCB type on the provided type list.
pcb_type = xml_get_attribute_string(pcb_node, "type", nullptr);
if (pcb_type==nullptr) throw rpk_exception(RPK_INVALID_LAYOUT, "<pcb> must have a 'type' attribute");
- //if (TRACE_RPK) logerror("gromport/RPK: Cartridge says it has PCB type '%s'\n", pcb_type);
+ if (TRACE_RPK) printf("gromport/RPK: Cartridge says it has PCB type '%s'\n", pcb_type);
i=0;
do
diff --git a/src/devices/bus/ti99x/gromport.h b/src/devices/bus/ti99x/gromport.h
index 36900c40045..8f49a7f98d4 100644
--- a/src/devices/bus/ti99x/gromport.h
+++ b/src/devices/bus/ti99x/gromport.h
@@ -13,7 +13,7 @@
#include "emu.h"
#include "ti99defs.h"
-#include "grom.h"
+#include "machine/tmc0430.h"
extern const device_type GROMPORT;
@@ -29,13 +29,22 @@ public:
DECLARE_WRITE8_MEMBER(cruwrite);
DECLARE_WRITE_LINE_MEMBER(ready_line);
+ DECLARE_WRITE_LINE_MEMBER(romgq_line);
+
+ // Combined GROM select lines
+ DECLARE_WRITE8_MEMBER(set_gromlines);
+
+ DECLARE_WRITE_LINE_MEMBER(gclock_in);
+
+ static void set_mask(device_t &device, int mask) { downcast<gromport_device &>(device).m_mask = mask; }
+
template<class _Object> static devcb_base &static_set_ready_callback(device_t &device, _Object object) { return downcast<gromport_device &>(device).m_console_ready.set_callback(object); }
template<class _Object> static devcb_base &static_set_reset_callback(device_t &device, _Object object) { return downcast<gromport_device &>(device).m_console_reset.set_callback(object); }
void cartridge_inserted();
- void set_grom_base(UINT16 grombase, UINT16 grommask);
- UINT16 get_grom_base() { return m_grombase; }
- UINT16 get_grom_mask() { return m_grommask; }
+ // void set_grom_base(UINT16 grombase, UINT16 grommask);
+ // UINT16 get_grom_base() { return m_grombase; }
+ // UINT16 get_grom_mask() { return m_grommask; }
protected:
virtual void device_start() override;
@@ -48,15 +57,24 @@ private:
bool m_reset_on_insert;
devcb_write_line m_console_ready;
devcb_write_line m_console_reset;
- UINT16 m_grombase;
- UINT16 m_grommask;
+ int m_mask;
+ int m_romgq;
+ // UINT16 m_grombase;
+ // UINT16 m_grommask;
};
-SLOT_INTERFACE_EXTERN(gromport);
+SLOT_INTERFACE_EXTERN(gromport4);
+SLOT_INTERFACE_EXTERN(gromport8);
-#define MCFG_TI99_GROMPORT_ADD( _tag ) \
+#define MCFG_GROMPORT4_ADD( _tag ) \
MCFG_DEVICE_ADD(_tag, GROMPORT, 0) \
- MCFG_DEVICE_SLOT_INTERFACE(gromport, "single", false)
+ gromport_device::set_mask(*device, 0x1fff); \
+ MCFG_DEVICE_SLOT_INTERFACE(gromport4, "single", false)
+
+#define MCFG_GROMPORT8_ADD( _tag ) \
+ MCFG_DEVICE_ADD(_tag, GROMPORT, 0) \
+ gromport_device::set_mask(*device, 0x3fff); \
+ MCFG_DEVICE_SLOT_INTERFACE(gromport8, "single", false)
#define MCFG_GROMPORT_READY_HANDLER( _ready ) \
devcb = &gromport_device::static_set_ready_callback( *device, DEVCB_##_ready );
@@ -80,11 +98,16 @@ public:
DECLARE_WRITE8_MEMBER(cruwrite);
DECLARE_WRITE_LINE_MEMBER(ready_line);
+ DECLARE_WRITE_LINE_MEMBER(romgq_line);
+ DECLARE_WRITE8_MEMBER(set_gromlines);
+
+ DECLARE_WRITE_LINE_MEMBER(gclock_in);
+
bool is_available() { return m_pcb != nullptr; }
bool has_grom();
void set_slot(int i);
- UINT16 grom_base();
- UINT16 grom_mask();
+ // UINT16 grom_base();
+ // UINT16 grom_mask();
protected:
virtual void device_start() override { };
@@ -111,6 +134,7 @@ protected:
const option_guide *create_option_guide() const override { return nullptr; }
private:
+ bool m_readrom;
bool m_softlist;
int m_pcbtype;
int m_slot;
@@ -136,18 +160,24 @@ public:
virtual DECLARE_READ8Z_MEMBER(crureadz) = 0;
virtual DECLARE_WRITE8_MEMBER(cruwrite) = 0;
+ virtual DECLARE_WRITE_LINE_MEMBER(romgq_line) =0;
+ virtual DECLARE_WRITE8_MEMBER(set_gromlines) =0;
+
+ virtual DECLARE_WRITE_LINE_MEMBER(gclock_in) =0;
+
DECLARE_WRITE_LINE_MEMBER(ready_line);
virtual void insert(int index, ti99_cartridge_device* cart) { m_gromport->cartridge_inserted(); };
virtual void remove(int index) { };
- UINT16 grom_base();
- UINT16 grom_mask();
+ // UINT16 grom_base();
+ // UINT16 grom_mask();
protected:
ti99_cartridge_connector_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual void device_config_complete() override;
gromport_device* m_gromport;
+ int m_gsel;
};
/*
@@ -162,6 +192,9 @@ public:
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
DECLARE_WRITE8_MEMBER(cruwrite) override;
+ DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
+ DECLARE_WRITE8_MEMBER(set_gromlines) override;
+ DECLARE_WRITE_LINE_MEMBER(gclock_in) override;
protected:
virtual void device_start() override;
@@ -190,6 +223,9 @@ public:
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
DECLARE_WRITE8_MEMBER(cruwrite) override;
+ DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
+ DECLARE_WRITE8_MEMBER(set_gromlines) override;
+ DECLARE_WRITE_LINE_MEMBER(gclock_in) override;
void insert(int index, ti99_cartridge_device* cart) override;
void remove(int index) override;
@@ -201,6 +237,7 @@ protected:
virtual ioport_constructor device_input_ports() const override;
private:
+ bool m_readrom;
int m_active_slot;
int m_fixed_slot;
int m_next_free_slot;
@@ -222,6 +259,9 @@ public:
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(crureadz) override;
DECLARE_WRITE8_MEMBER(cruwrite) override;
+ DECLARE_WRITE_LINE_MEMBER(romgq_line) override;
+ DECLARE_WRITE8_MEMBER(set_gromlines) override;
+ DECLARE_WRITE_LINE_MEMBER(gclock_in) override;
void insert(int index, ti99_cartridge_device* cart) override;
void remove(int index) override;
@@ -275,23 +315,28 @@ protected:
virtual DECLARE_READ8Z_MEMBER(crureadz);
virtual DECLARE_WRITE8_MEMBER(cruwrite);
+ DECLARE_WRITE_LINE_MEMBER(romgq_line);
+ DECLARE_WRITE8_MEMBER(set_gromlines);
+ DECLARE_WRITE_LINE_MEMBER(gclock_in);
+
DECLARE_READ8Z_MEMBER(gromreadz);
DECLARE_WRITE8_MEMBER(gromwrite);
inline void set_grom_pointer(int number, device_t *dev);
void set_cartridge(ti99_cartridge_device *cart);
- UINT16 grom_base();
- UINT16 grom_mask();
+ // UINT16 grom_base();
+ // UINT16 grom_mask();
const char* tag() { return m_tag; }
void set_tag(const char* tag) { m_tag = tag; }
ti99_cartridge_device* m_cart;
- ti99_grom_device* m_grom[5];
+ tmc0430_device* m_grom[5];
int m_grom_size;
int m_rom_size;
int m_ram_size;
UINT8* m_rom_ptr;
UINT8* m_ram_ptr;
+ bool m_access_cartspace;
int m_rom_page; // for some cartridge types
UINT8* m_grom_ptr; // for gromemu
int m_grom_address; // for gromemu
@@ -398,15 +443,19 @@ public:
class ti99_gromemu_cartridge : public ti99_cartridge_pcb
{
public:
- ti99_gromemu_cartridge(): m_waddr_LSB(false)
+ ti99_gromemu_cartridge(): m_waddr_LSB(false), m_grom_space(false)
{ m_grom_address = 0; }
~ti99_gromemu_cartridge() { };
DECLARE_READ8Z_MEMBER(readz) override;
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ8Z_MEMBER(gromemureadz);
DECLARE_WRITE8_MEMBER(gromemuwrite);
+
+ DECLARE_WRITE_LINE_MEMBER(gsq_line);
+
private:
bool m_waddr_LSB;
+ bool m_grom_space;
};
diff --git a/src/devices/bus/ti99x/ti99defs.h b/src/devices/bus/ti99x/ti99defs.h
index 130c0cfbc40..8d137e6599f 100644
--- a/src/devices/bus/ti99x/ti99defs.h
+++ b/src/devices/bus/ti99x/ti99defs.h
@@ -32,6 +32,7 @@
#define JOYPORT_TAG "joyport"
#define VDP_TAG "vdp"
#define DSRROM "dsrrom"
+#define CONSOLEROM "consolerom"
#define VDPFREQ XTAL_10_738635MHz
#define GROMFREQ VDPFREQ/24
@@ -41,10 +42,49 @@
#define DRAM_TAG "dram8"
#define MAPPER_TAG "mapper"
#define MAINBOARD8_TAG "mainboard8"
-#define SPEECH_TAG "speech"
-#define ROM0_TAG "rom0"
-#define ROM1_TAG "rom1"
-#define PCODEROM_TAG "pcode"
+#define SPEECHSYN_TAG "speech"
+
+#define ROM0_REG "rom0_region"
+#define ROM1_REG "rom1_region"
+#define PASCAL_REG "pascal_region"
+#define SYSGROM_REG "sysgrom_region"
+#define GROMLIB1_REG "gromlib1_region"
+#define GROMLIB2_REG "gromlib2_region"
+#define GROMLIB3_REG "gromlib3_region"
+#define SPEECHROM_REG "speech_region"
+
+#define GROMLIB_TAG "gromlib"
+#define SYSGROM_TAG GROMLIB_TAG "0"
+#define SYSGROM0_TAG SYSGROM_TAG "_0"
+#define SYSGROM1_TAG SYSGROM_TAG "_1"
+#define SYSGROM2_TAG SYSGROM_TAG "_2"
+
+#define GLIB1_TAG GROMLIB_TAG "1"
+#define GLIB10_TAG GLIB1_TAG "_0"
+#define GLIB11_TAG GLIB1_TAG "_1"
+#define GLIB12_TAG GLIB1_TAG "_2"
+#define GLIB13_TAG GLIB1_TAG "_3"
+#define GLIB14_TAG GLIB1_TAG "_4"
+#define GLIB15_TAG GLIB1_TAG "_5"
+#define GLIB16_TAG GLIB1_TAG "_6"
+#define GLIB17_TAG GLIB1_TAG "_7"
+
+#define GLIB2_TAG GROMLIB_TAG "2"
+#define GLIB20_TAG GLIB2_TAG "_0"
+#define GLIB21_TAG GLIB2_TAG "_1"
+#define GLIB22_TAG GLIB2_TAG "_2"
+#define GLIB23_TAG GLIB2_TAG "_3"
+#define GLIB24_TAG GLIB2_TAG "_4"
+#define GLIB25_TAG GLIB2_TAG "_5"
+#define GLIB26_TAG GLIB2_TAG "_6"
+#define GLIB27_TAG GLIB2_TAG "_7"
+
+#define GLIB3_TAG GROMLIB_TAG "3"
+#define GLIB30_TAG GLIB3_TAG "_0"
+#define GLIB31_TAG GLIB3_TAG "_1"
+#define GLIB32_TAG GLIB3_TAG "_2"
+
+
// Geneve
#define GKEYBOARD_TAG "gkeyboard"
diff --git a/src/devices/bus/ti99x/videowrp.cpp b/src/devices/bus/ti99x/videowrp.cpp
index 6f09da722e7..4aa1935f226 100644
--- a/src/devices/bus/ti99x/videowrp.cpp
+++ b/src/devices/bus/ti99x/videowrp.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Michael Zapf
/****************************************************************************
- TI-99/4(A) and /8 Video subsystem
+ TI-99/4A Video subsystem
This device actually wraps the naked video chip implementation
EVPC (Enhanced Video Processor Card) from SNUG
@@ -11,18 +11,12 @@
The SGCPU ("TI-99/4P") only runs with EVPC
- We also include a class wrapper for the sound chip here.
-
Michael Zapf
- October 2010
- February 2012: Rewritten as class
-
*****************************************************************************/
#include "emu.h"
#include "videowrp.h"
-#include "sound/sn76496.h"
/*
Constructors
@@ -39,23 +33,14 @@ ti_std_video_device::ti_std_video_device(const machine_config &mconfig, const ch
}
ti_exp_video_device::ti_exp_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : ti_video_device(mconfig, V9938VIDEO, "TI99 EXP Video subsystem", tag, owner, clock, "v9938_video", __FILE__), m_v9938(nullptr)
-{
-}
-
-ti_sound_sn94624_device::ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : ti_sound_system_device(mconfig, TISOUND_94624, "Onboard sound (SN94624)", tag, owner, clock, "ti_sound_sn94624", __FILE__)
-{
-}
-
-ti_sound_sn76496_device::ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : ti_sound_system_device(mconfig, TISOUND_76496, "Onboard sound (SN76496)", tag, owner, clock, "ti_sound_sn76496", __FILE__)
+ : ti_video_device(mconfig, V9938VIDEO, "TI99 EXP Video subsystem", tag, owner, clock, "v9938_video", __FILE__),
+ m_v9938(nullptr)
{
}
/*****************************************************************************/
/*
- Memory access (TI-99/4A and TI-99/8)
+ Accessing TMS9928A (TI-99/4A)
*/
READ8Z_MEMBER( ti_std_video_device::readz )
{
@@ -88,104 +73,38 @@ WRITE8_MEMBER( ti_std_video_device::write )
/*****************************************************************************/
/*
- Memory access (EVPC) via 16 bit bus
+ Accessing v9938 via 16 bit bus (SGCPU)
*/
READ16_MEMBER( ti_exp_video_device::read16 )
{
if (space.debugger_access()) return 0;
-
- if (offset & 1)
- { /* read VDP status */
- return ((int) m_v9938->status_r()) << 8;
- }
- else
- { /* read VDP RAM */
- return ((int) m_v9938->vram_r()) << 8;
- }
+ return (int)(m_v9938->read(space, offset)<<8);
}
WRITE16_MEMBER( ti_exp_video_device::write16 )
{
if (space.debugger_access()) return;
-
- switch (offset & 3)
- {
- case 0:
- /* write VDP data */
- m_v9938->vram_w((data >> 8) & 0xff);
- break;
- case 1:
- /* write VDP address */
- m_v9938->command_w((data >> 8) & 0xff);
- break;
- case 2:
- /* write VDP palette */
- m_v9938->palette_w((data >> 8) & 0xff);
- break;
- case 3:
- /* write VDP register pointer (indirect access) */
- m_v9938->register_w((data >> 8) & 0xff);
- break;
- }
+ m_v9938->write(space, offset, (data>>8)&0xff);
}
+
/******************************************************************************/
/*
- Video read (Geneve) via 8 bit bus
+ Accessing v9938 via 8 bit bus (EVPC)
*/
READ8Z_MEMBER( ti_exp_video_device::readz )
{
if (space.debugger_access()) return;
-
- if (offset & 2)
- { /* read VDP status */
- *value = m_v9938->status_r();
- }
- else
- { /* read VDP RAM */
- *value = m_v9938->vram_r();
- }
+ *value = m_v9938->read(space, offset>>1);
}
-/*
- Video write (Geneve)
-*/
WRITE8_MEMBER( ti_exp_video_device::write )
{
if (space.debugger_access()) return;
-
- switch (offset & 6)
- {
- case 0:
- /* write VDP data */
- m_v9938->vram_w(data);
- break;
- case 2:
- /* write VDP address */
- m_v9938->command_w(data);
- break;
- case 4:
- /* write VDP palette */
- m_v9938->palette_w(data);
- break;
- case 6:
- /* write VDP register pointer (indirect access) */
- m_v9938->register_w(data);
- break;
- }
+ m_v9938->write(space, offset>>1, data);
}
-/**************************************************************************/
-// Interfacing to mouse attached to v9938
-
-void ti_exp_video_device::video_update_mouse(int delta_x, int delta_y, int buttons)
-{
- m_v9938->update_mouse_state(delta_x, delta_y, buttons & 3);
-}
-
-/**************************************************************************/
-
void ti_video_device::device_start(void)
{
m_tms9928a = static_cast<tms9928a_device*>(machine().device(VDP_TAG));
@@ -196,64 +115,7 @@ void ti_exp_video_device::device_start(void)
m_v9938 = static_cast<v9938_device*>(machine().device(VDP_TAG));
}
-void ti_video_device::device_reset(void)
-{
-}
-
-/**************************************************************************/
-
-/*
- Sound subsystem.
- TODO: Seriously consider to simplify this by connecting to the datamux
- directly. We don't do anything reasonable here.
-*/
-
-WRITE8_MEMBER( ti_sound_system_device::write )
-{
- if (space.debugger_access()) return;
- m_sound_chip->write(space, 0, data);
-}
-
-void ti_sound_system_device::device_start(void)
-{
- m_console_ready.resolve();
- m_sound_chip = subdevice<sn76496_base_device>(TISOUNDCHIP_TAG);
-}
-
-WRITE_LINE_MEMBER( ti_sound_system_device::sound_ready )
-{
- m_console_ready(state);
-}
-
-MACHINE_CONFIG_FRAGMENT( sn94624 )
- MCFG_SPEAKER_STANDARD_MONO("sound_out")
-
- MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
- MCFG_SN76496_READY_HANDLER(WRITELINE(ti_sound_system_device, sound_ready))
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_FRAGMENT( sn76496 )
- MCFG_SPEAKER_STANDARD_MONO("sound_out")
-
- MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
- MCFG_SN76496_READY_HANDLER(WRITELINE(ti_sound_system_device, sound_ready))
-MACHINE_CONFIG_END
-
-machine_config_constructor ti_sound_sn94624_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( sn94624 );
-}
-
-machine_config_constructor ti_sound_sn76496_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( sn76496 );
-}
-
/**************************************************************************/
const device_type TI99VIDEO = &device_creator<ti_std_video_device>;
const device_type V9938VIDEO = &device_creator<ti_exp_video_device>;
-const device_type TISOUND_94624 = &device_creator<ti_sound_sn94624_device>;
-const device_type TISOUND_76496 = &device_creator<ti_sound_sn76496_device>;
diff --git a/src/devices/bus/ti99x/videowrp.h b/src/devices/bus/ti99x/videowrp.h
index cb339e9dd60..787f0e2d44f 100644
--- a/src/devices/bus/ti99x/videowrp.h
+++ b/src/devices/bus/ti99x/videowrp.h
@@ -2,7 +2,7 @@
// copyright-holders:Michael Zapf
/****************************************************************************
- TI-99/4(A) and /8 Video subsystem
+ TI-99/4A / EVPC Video subsystem
See videowrp.c for documentation
Michael Zapf
@@ -17,7 +17,6 @@
#include "video/tms9928a.h"
#include "video/v9938.h"
#include "ti99defs.h"
-#include "sound/sn76496.h"
class ti_video_device : public bus8z_device
{
@@ -30,7 +29,7 @@ protected:
/* Constructor */
ti_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual void device_start(void) override;
- virtual void device_reset(void) override;
+ virtual void device_reset(void) override { };
virtual DECLARE_READ8Z_MEMBER(readz) override { };
virtual DECLARE_WRITE8_MEMBER(write) override { };
};
@@ -44,18 +43,16 @@ public:
ti_std_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8Z_MEMBER(readz) override;
DECLARE_WRITE8_MEMBER(write) override;
-
void reset_vdp(int state) override { m_tms9928a->reset_line(state); }
};
/*
- Used in the EVPC and Geneve
+ Used in the EVPC
*/
class ti_exp_video_device : public ti_video_device
{
public:
ti_exp_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- void video_update_mouse(int delta_x, int delta_y, int buttons);
DECLARE_READ8Z_MEMBER(readz) override;
DECLARE_WRITE8_MEMBER(write) override;
DECLARE_READ16_MEMBER(read16);
@@ -63,113 +60,34 @@ public:
void reset_vdp(int state) override { m_v9938->reset_line(state); }
protected:
- virtual void device_start(void) override;
- v9938_device *m_v9938;
-};
-
-extern const device_type TI99VIDEO;
-extern const device_type V9938VIDEO;
-
-/****************************************************************************/
-/*
- Sound device
-*/
-
-extern const device_type TISOUND_94624;
-extern const device_type TISOUND_76496;
-
-#define TI_SOUND_CONFIG(name) \
- const ti_sound_config(name) =
-
-class ti_sound_system_device : public bus8z_device
-{
-public:
- ti_sound_system_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : bus8z_device(mconfig, type, name, tag, owner, clock, shortname, source), m_sound_chip(nullptr),
- m_console_ready(*this) { };
-
- // Cannot read from sound; just ignore silently
- DECLARE_READ8Z_MEMBER(readz) override { };
- DECLARE_WRITE8_MEMBER(write) override;
- DECLARE_WRITE_LINE_MEMBER( sound_ready ); // connect to console READY
-
- template<class _Object> static devcb_base &static_set_int_callback(device_t &device, _Object object) { return downcast<ti_sound_system_device &>(device).m_console_ready.set_callback(object); }
-
-protected:
virtual void device_start(void) override;
- virtual machine_config_constructor device_mconfig_additions() const override =0;
private:
- sn76496_base_device* m_sound_chip;
- devcb_write_line m_console_ready;
-};
-
-/*
- The version that sits in the TI-99/4A
-*/
-class ti_sound_sn94624_device : public ti_sound_system_device
-{
-public:
- ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
-protected:
- virtual machine_config_constructor device_mconfig_additions() const override;
+ v9938_device *m_v9938;
};
-/*
- The version that sits in the TI-99/8 and Geneve
-*/
-class ti_sound_sn76496_device : public ti_sound_system_device
-{
-public:
- ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
-protected:
- virtual machine_config_constructor device_mconfig_additions() const override;
-};
+extern const device_type TI99VIDEO;
+extern const device_type V9938VIDEO;
/****************************************************************************/
-#define MCFG_TI_TMS991x_ADD_NTSC(_tag, _chip, _vsize, _class, _int) \
+#define MCFG_TI_TMS991x_ADD_NTSC(_tag, _chip, _vsize, _class, _int, _gclk) \
MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \
MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \
MCFG_TMS9928A_VRAM_SIZE(_vsize) \
MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \
+ MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(_class,_gclk)) \
MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) \
MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
-#define MCFG_TI_TMS991x_ADD_PAL(_tag, _chip, _vsize, _class, _int) \
+#define MCFG_TI_TMS991x_ADD_PAL(_tag, _chip, _vsize, _class, _int, _gclk) \
MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \
MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \
MCFG_TMS9928A_VRAM_SIZE(_vsize) \
MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \
+ MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(_class,_gclk)) \
MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) \
MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
-#define MCFG_TI998_ADD_NTSC(_tag, _chip, _vsize, _class, _int) \
- MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \
- MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \
- MCFG_TMS9928A_VRAM_SIZE(_vsize) \
- MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \
- MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) \
- MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
-
-#define MCFG_TI998_ADD_PAL(_tag, _chip, _vsize, _class, _int) \
- MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \
- MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \
- MCFG_TMS9928A_VRAM_SIZE(_vsize) \
- MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \
- MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) \
- MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
-
-#define MCFG_TI_SOUND_94624_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, TISOUND_94624, 0)
-
-#define MCFG_TI_SOUND_76496_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, TISOUND_76496, 0)
-
-#define MCFG_TI_SOUND_READY_HANDLER( _ready ) \
- devcb = &ti_sound_system_device::static_set_int_callback( *device, DEVCB_##_ready );
-
#endif /* __TIVIDEO__ */
diff --git a/src/devices/bus/tvc/tvc.cpp b/src/devices/bus/tvc/tvc.cpp
index 2ee28a2f3c0..db2ed411ad2 100644
--- a/src/devices/bus/tvc/tvc.cpp
+++ b/src/devices/bus/tvc/tvc.cpp
@@ -8,7 +8,6 @@
#include "emu.h"
#include "tvc.h"
-#include "emuopts.h"
/***************************************************************************
diff --git a/src/devices/bus/vtech/memexp/carts.cpp b/src/devices/bus/vtech/memexp/carts.cpp
index dc40d0e8a57..f46a15e4841 100644
--- a/src/devices/bus/vtech/memexp/carts.cpp
+++ b/src/devices/bus/vtech/memexp/carts.cpp
@@ -15,5 +15,6 @@ SLOT_INTERFACE_START( memexp_slot_carts )
SLOT_INTERFACE("laser310_16k", LASER310_16K)
SLOT_INTERFACE("laser_64k", LASER_64K)
SLOT_INTERFACE("rs232", RS232_INTERFACE)
+ SLOT_INTERFACE("rtty", RTTY_INTERFACE)
SLOT_INTERFACE("wordpro", WORDPRO)
SLOT_INTERFACE_END
diff --git a/src/devices/bus/vtech/memexp/carts.h b/src/devices/bus/vtech/memexp/carts.h
index a1e86987a31..92dd90390ae 100644
--- a/src/devices/bus/vtech/memexp/carts.h
+++ b/src/devices/bus/vtech/memexp/carts.h
@@ -16,6 +16,7 @@
#include "floppy.h"
#include "memory.h"
#include "rs232.h"
+#include "rtty.h"
#include "wordpro.h"
SLOT_INTERFACE_EXTERN( memexp_slot_carts );
diff --git a/src/devices/bus/vtech/memexp/rs232.cpp b/src/devices/bus/vtech/memexp/rs232.cpp
index 42e281151b1..ead9ac0a904 100644
--- a/src/devices/bus/vtech/memexp/rs232.cpp
+++ b/src/devices/bus/vtech/memexp/rs232.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Dirk Best
/***************************************************************************
- Dick Smith VZ-200/300 RS-232 Cartridge
+ Dick Smith VZ-200/300 RS-232 Cartridge (K-6317)
***************************************************************************/
@@ -50,7 +50,7 @@ machine_config_constructor rs232_interface_device::device_mconfig_additions() co
//**************************************************************************
//-------------------------------------------------
-// wordpro_device - constructor
+// rs232_interface_device - constructor
//-------------------------------------------------
rs232_interface_device::rs232_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
diff --git a/src/devices/bus/vtech/memexp/rs232.h b/src/devices/bus/vtech/memexp/rs232.h
index 20508d86469..23c91004533 100644
--- a/src/devices/bus/vtech/memexp/rs232.h
+++ b/src/devices/bus/vtech/memexp/rs232.h
@@ -2,7 +2,7 @@
// copyright-holders:Dirk Best
/***************************************************************************
- Dick Smith VZ-200/300 RS-232 Cartridge
+ Dick Smith VZ-200/300 RS-232 Cartridge (K-6317)
***************************************************************************/
diff --git a/src/devices/bus/vtech/memexp/rtty.cpp b/src/devices/bus/vtech/memexp/rtty.cpp
new file mode 100644
index 00000000000..bf9930c3dcf
--- /dev/null
+++ b/src/devices/bus/vtech/memexp/rtty.cpp
@@ -0,0 +1,88 @@
+// license:GPL-2.0+
+// copyright-holders:Dirk Best
+/***************************************************************************
+
+ Dick Smith VZ-200/300 RTTY Cartridge (K-6318)
+
+***************************************************************************/
+
+#include "rtty.h"
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type RTTY_INTERFACE = &device_creator<rtty_interface_device>;
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+ROM_START( rtty )
+ ROM_REGION(0x1000, "software", 0)
+ ROM_LOAD("vzrtty.ic3", 0x0000, 0x1000, CRC(ccf4289b) SHA1(de737ef0e0b582b3102da473836af1fa159a2e78))
+ROM_END
+
+const rom_entry *rtty_interface_device::device_rom_region() const
+{
+ return ROM_NAME( rtty );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// rtty_interface_device - constructor
+//-------------------------------------------------
+
+rtty_interface_device::rtty_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, RTTY_INTERFACE, "DSE VZ-200/300 RTTY Interface", tag, owner, clock, "vz_rtty", __FILE__),
+ device_memexp_interface(mconfig, *this)
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void rtty_interface_device::device_start()
+{
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void rtty_interface_device::device_reset()
+{
+ // program
+ m_slot->m_program->install_rom(0x4000, 0x4fff, 0, 0x1000, memregion("software")->base());
+
+ // data
+ m_slot->m_program->install_read_handler(0x5000, 0x57ff, read8_delegate(FUNC(rtty_interface_device::receive_data_r), this));
+ m_slot->m_program->install_write_handler(0x5800, 0x5fff, write8_delegate(FUNC(rtty_interface_device::transmit_data_w), this));
+ m_slot->m_program->install_write_handler(0x6000, 0x67ff, write8_delegate(FUNC(rtty_interface_device::relay_w), this));
+}
+
+
+//**************************************************************************
+// IMPLEMENTATION
+//**************************************************************************
+
+READ8_MEMBER( rtty_interface_device::receive_data_r )
+{
+ return 0xff;
+}
+
+WRITE8_MEMBER( rtty_interface_device::transmit_data_w )
+{
+ logerror("transmit_w: %d\n", BIT(data, 7));
+}
+
+WRITE8_MEMBER( rtty_interface_device::relay_w )
+{
+ logerror("relay_w: %d\n", BIT(data, 7));
+}
diff --git a/src/devices/bus/vtech/memexp/rtty.h b/src/devices/bus/vtech/memexp/rtty.h
new file mode 100644
index 00000000000..1bc25eca77a
--- /dev/null
+++ b/src/devices/bus/vtech/memexp/rtty.h
@@ -0,0 +1,45 @@
+// license:GPL-2.0+
+// copyright-holders:Dirk Best
+/***************************************************************************
+
+ Dick Smith VZ-200/300 RTTY Cartridge (K-6318)
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __VTECH_MEMEXP_RTTY_H__
+#define __VTECH_MEMEXP_RTTY_H__
+
+#include "emu.h"
+#include "memexp.h"
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> rtty_interface_device
+
+class rtty_interface_device : public device_t, public device_memexp_interface
+{
+public:
+ // construction/destruction
+ rtty_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ DECLARE_READ8_MEMBER( receive_data_r );
+ DECLARE_WRITE8_MEMBER( transmit_data_w );
+ DECLARE_WRITE8_MEMBER( relay_w );
+
+protected:
+ virtual const rom_entry *device_rom_region() const override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+};
+
+// device type definition
+extern const device_type RTTY_INTERFACE;
+
+#endif // __VTECH_MEMEXP_RTTY_H__
diff --git a/src/devices/bus/x68k/x68kexp.cpp b/src/devices/bus/x68k/x68kexp.cpp
index 39f1f74eec9..7019498fa23 100644
--- a/src/devices/bus/x68k/x68kexp.cpp
+++ b/src/devices/bus/x68k/x68kexp.cpp
@@ -5,7 +5,6 @@
*/
#include "emu.h"
-#include "emuopts.h"
#include "x68kexp.h"
//**************************************************************************
diff --git a/src/devices/bus/z88/z88.cpp b/src/devices/bus/z88/z88.cpp
index 62313b76dd3..062fdeade29 100644
--- a/src/devices/bus/z88/z88.cpp
+++ b/src/devices/bus/z88/z88.cpp
@@ -10,7 +10,6 @@
#include "emu.h"
#include "z88.h"
-#include "emuopts.h"
/***************************************************************************
diff --git a/src/devices/cpu/avr8/avr8.cpp b/src/devices/cpu/avr8/avr8.cpp
index d4a00c1d325..6b2b19a2021 100644
--- a/src/devices/cpu/avr8/avr8.cpp
+++ b/src/devices/cpu/avr8/avr8.cpp
@@ -638,8 +638,7 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *name, const
m_program_config("program", ENDIANNESS_LITTLE, 8, 22),
m_data_config("data", ENDIANNESS_LITTLE, 8, 16, 0, internal_map),
m_io_config("io", ENDIANNESS_LITTLE, 8, 4),
- m_eeprom_tag(nullptr),
- m_eeprom(nullptr),
+ m_eeprom(*this),
m_cpu_type(cpu_type),
m_lfuses(0x62),
m_hfuses(0x99),
@@ -824,8 +823,6 @@ void avr8_device::device_start()
// set our instruction counter
m_icountptr = &m_icount;
-
- m_eeprom = machine().root_device().memregion(m_eeprom_tag)->base();
}
//-------------------------------------------------
diff --git a/src/devices/cpu/avr8/avr8.h b/src/devices/cpu/avr8/avr8.h
index 86207566ffc..ea9cf8c8a19 100644
--- a/src/devices/cpu/avr8/avr8.h
+++ b/src/devices/cpu/avr8/avr8.h
@@ -64,7 +64,7 @@
//**************************************************************************
#define MCFG_CPU_AVR8_EEPROM(_tag) \
- avr8_device::set_eeprom_tag(*device, _tag);
+ avr8_device::set_eeprom_tag(*device, "^" _tag);
//**************************************************************************
@@ -80,7 +80,7 @@ class avr8_device : public cpu_device
{
public:
// inline configuration helpers
- static void set_eeprom_tag(device_t &device, const char *tag) { downcast<avr8_device &>(device).m_eeprom_tag = tag; }
+ static void set_eeprom_tag(device_t &device, const char *tag) { downcast<avr8_device &>(device).m_eeprom.set_tag(tag); }
// fuse configs
void set_low_fuses(UINT8 byte);
@@ -137,8 +137,7 @@ protected:
const address_space_config m_program_config;
const address_space_config m_data_config;
const address_space_config m_io_config;
- const char *m_eeprom_tag;
- UINT8 *m_eeprom;
+ required_region_ptr<UINT8> m_eeprom;
// bootloader
UINT16 m_boot_size;
diff --git a/src/devices/cpu/drcbec.cpp b/src/devices/cpu/drcbec.cpp
index 8736a2b6703..ac6da189688 100644
--- a/src/devices/cpu/drcbec.cpp
+++ b/src/devices/cpu/drcbec.cpp
@@ -1929,6 +1929,14 @@ int drcbe_c::execute(code_handle &entry)
FSPARAM0 = 1.0f / sqrtf(FSPARAM1);
break;
+ case MAKE_OPCODE_SHORT(OP_FCOPYI, 4, 0): // FSCOPYI dst,src
+ FSPARAM0 = u2f(*inst[1].pint32);
+ break;
+
+ case MAKE_OPCODE_SHORT(OP_ICOPYF, 4, 0): // ICOPYFS dst,src
+ *inst[0].pint32 = f2u(FSPARAM1);
+ break;
+
// ----------------------- 64-Bit Floating Point Operations -----------------------
@@ -2068,6 +2076,14 @@ int drcbe_c::execute(code_handle &entry)
FDPARAM0 = 1.0 / sqrt(FDPARAM1);
break;
+ case MAKE_OPCODE_SHORT(OP_FCOPYI, 8, 0): // FDCOPYI dst,src
+ FDPARAM0 = u2d(*inst[1].pint64);
+ break;
+
+ case MAKE_OPCODE_SHORT(OP_ICOPYF, 8, 0): // ICOPYFD dst,src
+ *inst[0].pint64 = d2u(FDPARAM1);
+ break;
+
default:
fatalerror("Unexpected opcode!\n");
}
diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp
index b9583123af0..096dc2cbf5c 100644
--- a/src/devices/cpu/drcbex64.cpp
+++ b/src/devices/cpu/drcbex64.cpp
@@ -169,6 +169,7 @@
#include <stddef.h>
#include "emu.h"
#include "debugger.h"
+#include "emuopts.h"
#include "drcuml.h"
#include "drcbex64.h"
@@ -388,7 +389,9 @@ const drcbe_x64::opcode_table_entry drcbe_x64::s_opcode_table_source[] =
{ uml::OP_FABS, &drcbe_x64::op_fabs }, // FABS dst,src1
{ uml::OP_FSQRT, &drcbe_x64::op_fsqrt }, // FSQRT dst,src1
{ uml::OP_FRECIP, &drcbe_x64::op_frecip }, // FRECIP dst,src1
- { uml::OP_FRSQRT, &drcbe_x64::op_frsqrt } // FRSQRT dst,src1
+ { uml::OP_FRSQRT, &drcbe_x64::op_frsqrt }, // FRSQRT dst,src1
+ { uml::OP_FCOPYI, &drcbe_x64::op_fcopyi }, // FCOPYI dst,src
+ { uml::OP_ICOPYF, &drcbe_x64::op_icopyf } // ICOPYF dst,src
};
@@ -6707,3 +6710,131 @@ void drcbe_x64::op_frsqrt(x86code *&dst, const instruction &inst)
emit_movsd_p64_r128(dst, dstp, dstreg); // movsd dstp,dstreg
}
}
+
+
+//-------------------------------------------------
+// op_fcopyi - process a FCOPYI opcode
+//-------------------------------------------------
+
+void drcbe_x64::op_fcopyi(x86code *&dst, const instruction &inst)
+{
+ // validate instruction
+ assert(inst.size() == 4 || inst.size() == 8);
+ assert_no_condition(inst);
+ assert_no_flags(inst);
+
+ // normalize parameters
+ be_parameter dstp(*this, inst.param(0), PTYPE_MF);
+ be_parameter srcp(*this, inst.param(1), PTYPE_MR);
+
+ // pick a target register for the general case
+ int dstreg = dstp.select_register(REG_XMM0);
+
+ // 32-bit form
+ if (inst.size() == 4)
+ {
+ if (srcp.is_memory())
+ {
+ emit_movd_r128_m32(dst, dstreg, MABS(srcp.memory())); // movd dstreg,[srcp]
+ emit_movss_p32_r128(dst, dstp, dstreg); // movss dstp,dstreg
+ }
+ else
+ {
+ if (dstp.is_memory())
+ {
+ emit_mov_p32_r32(dst, dstp, srcp.ireg()); // mov dstp,srcp
+ }
+ else
+ {
+ emit_movd_r128_r32(dst, dstreg, srcp.ireg()); // movd dstreg,srcp
+ emit_movss_p32_r128(dst, dstp, dstreg); // movss dstp,dstreg
+ }
+ }
+
+ }
+
+ // 64-bit form
+ else if (inst.size() == 8)
+ {
+
+ if (srcp.is_memory())
+ {
+ emit_movq_r128_m64(dst, dstreg, MABS(srcp.memory())); // movq dstreg,[srcp]
+ emit_movsd_p64_r128(dst, dstp, dstreg); // movsd dstp,dstreg
+ }
+ else
+ {
+ if (dstp.is_memory())
+ {
+ emit_mov_p64_r64(dst, dstp, srcp.ireg()); // mov dstp,srcp
+ }
+ else
+ {
+ emit_movq_r128_r64(dst, dstreg, srcp.ireg()); // movq dstreg,srcp
+ emit_movsd_p64_r128(dst, dstp, dstreg); // movsd dstp,dstreg
+ }
+ }
+
+ }
+}
+
+
+//-------------------------------------------------
+// op_icopyf - process a ICOPYF opcode
+//-------------------------------------------------
+
+void drcbe_x64::op_icopyf(x86code *&dst, const instruction &inst)
+{
+ // validate instruction
+ assert(inst.size() == 4 || inst.size() == 8);
+ assert_no_condition(inst);
+ assert_no_flags(inst);
+
+ // normalize parameters
+ be_parameter dstp(*this, inst.param(0), PTYPE_MR);
+ be_parameter srcp(*this, inst.param(1), PTYPE_MF);
+
+ // 32-bit form
+ if (inst.size() == 4)
+ {
+ if (srcp.is_memory())
+ {
+ int dstreg = dstp.select_register(REG_EAX);
+ emit_mov_r32_m32(dst, dstreg, MABS(srcp.memory())); // mov dstreg,[srcp]
+ emit_mov_p32_r32(dst, dstp, dstreg); // mov dstp,dstreg
+ }
+ else
+ {
+ if (dstp.is_memory())
+ {
+ emit_movd_m32_r128(dst, MABS(dstp.memory()), srcp.freg()); // movd dstp,srcp
+ }
+ else
+ {
+ emit_movd_r32_r128(dst, dstp.ireg(), srcp.freg()); // movd dstp,srcp
+ }
+ }
+ }
+
+ // 64-bit form
+ else if (inst.size() == 8)
+ {
+ if (srcp.is_memory())
+ {
+ int dstreg = dstp.select_register(REG_RAX);
+ emit_mov_r64_m64(dst, dstreg, MABS(srcp.memory())); // mov dstreg,[srcp]
+ emit_mov_p64_r64(dst, dstp, dstreg); // mov dstp,dstreg
+ }
+ else
+ {
+ if (dstp.is_memory())
+ {
+ emit_movq_m64_r128(dst, MABS(dstp.memory()), srcp.freg()); // movq dstp,srcp
+ }
+ else
+ {
+ emit_movq_r64_r128(dst, dstp.ireg(), srcp.freg()); // movq dstp,srcp
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/devices/cpu/drcbex64.h b/src/devices/cpu/drcbex64.h
index f60b8970aa9..a538f9bf1e7 100644
--- a/src/devices/cpu/drcbex64.h
+++ b/src/devices/cpu/drcbex64.h
@@ -207,6 +207,8 @@ private:
void op_fsqrt(x86code *&dst, const uml::instruction &inst);
void op_frecip(x86code *&dst, const uml::instruction &inst);
void op_frsqrt(x86code *&dst, const uml::instruction &inst);
+ void op_fcopyi(x86code *&dst, const uml::instruction &inst);
+ void op_icopyf(x86code *&dst, const uml::instruction &inst);
// 32-bit code emission helpers
void emit_mov_r32_p32(x86code *&dst, UINT8 reg, const be_parameter &param);
diff --git a/src/devices/cpu/drcbex86.cpp b/src/devices/cpu/drcbex86.cpp
index be63ac1e869..4ff6a90774b 100644
--- a/src/devices/cpu/drcbex86.cpp
+++ b/src/devices/cpu/drcbex86.cpp
@@ -85,6 +85,7 @@
#include <stddef.h>
#include "emu.h"
#include "debugger.h"
+#include "emuopts.h"
#include "drcuml.h"
#include "drcbex86.h"
@@ -270,7 +271,9 @@ const drcbe_x86::opcode_table_entry drcbe_x86::s_opcode_table_source[] =
{ uml::OP_FABS, &drcbe_x86::op_fabs }, // FABS dst,src1
{ uml::OP_FSQRT, &drcbe_x86::op_fsqrt }, // FSQRT dst,src1
{ uml::OP_FRECIP, &drcbe_x86::op_frecip }, // FRECIP dst,src1
- { uml::OP_FRSQRT, &drcbe_x86::op_frsqrt } // FRSQRT dst,src1
+ { uml::OP_FRSQRT, &drcbe_x86::op_frsqrt }, // FRSQRT dst,src1
+ { uml::OP_FCOPYI, &drcbe_x86::op_fcopyi }, // FCOPYI dst,src
+ { uml::OP_ICOPYF, &drcbe_x86::op_icopyf }, // ICOPYF dst,src
};
@@ -6448,6 +6451,105 @@ void drcbe_x86::op_frsqrt(x86code *&dst, const instruction &inst)
}
+//-------------------------------------------------
+// op_fcopyi - process a FCOPYI opcode
+//-------------------------------------------------
+
+void drcbe_x86::op_fcopyi(x86code *&dst, const instruction &inst)
+{
+ // validate instruction
+ assert(inst.size() == 4 || inst.size() == 8);
+ assert_no_condition(inst);
+ assert_no_flags(inst);
+
+ // normalize parameters
+ be_parameter dstp(*this, inst.param(0), PTYPE_MF);
+ be_parameter srcp(*this, inst.param(1), PTYPE_MR);
+
+ // 32-bit case
+ if (inst.size() == 4)
+ {
+ if (srcp.is_memory())
+ {
+ emit_mov_r32_m32(dst, REG_EAX, MABS(srcp.memory())); // mov eax,[srcp]
+ emit_mov_m32_r32(dst, MABS(dstp.memory()), REG_EAX); // mov [dstp],eax
+ }
+ else if (srcp.is_int_register())
+ {
+ emit_mov_m32_r32(dst, MABS(dstp.memory()), srcp.ireg()); // mov [dstp],srcp
+ }
+ }
+
+ // 64-bit case
+ else if (inst.size() == 8)
+ {
+ if (srcp.is_memory())
+ {
+ emit_mov_r32_m32(dst, REG_EAX, MABS(srcp.memory())); // mov eax,[srcp]
+ emit_mov_r32_m32(dst, REG_EDX, MABS(srcp.memory(4))); // mov edx,[srcp+4]
+ }
+ else if (srcp.is_int_register())
+ {
+ emit_mov_r32_m32(dst, REG_EDX, MABS(m_reghi[srcp.ireg()])); // mov edx,[reghi[srcp]]
+ emit_mov_r32_r32(dst, REG_EAX, srcp.ireg()); // mov eax,srcp
+ }
+
+ emit_mov_m32_r32(dst, MABS(dstp.memory()), REG_EAX); // mov [dstp],eax
+ emit_mov_m32_r32(dst, MABS(dstp.memory(4)), REG_EDX); // mov [dstp+4],edx
+ }
+}
+
+
+//-------------------------------------------------
+// op_icopyf - process a ICOPYF opcode
+//-------------------------------------------------
+
+void drcbe_x86::op_icopyf(x86code *&dst, const instruction &inst)
+{
+ // validate instruction
+ assert(inst.size() == 4 || inst.size() == 8);
+ assert_no_condition(inst);
+ assert_no_flags(inst);
+
+ // normalize parameters
+ be_parameter dstp(*this, inst.param(0), PTYPE_MR);
+ be_parameter srcp(*this, inst.param(1), PTYPE_MF);
+
+ // 32-bit case
+ if (inst.size() == 4)
+ {
+ emit_mov_r32_m32(dst, REG_EAX, MABS(srcp.memory())); // mov eax,[srcp]
+
+ if (dstp.is_memory())
+ {
+ emit_mov_m32_r32(dst, MABS(dstp.memory()), REG_EAX); // mov [dstp],eax
+ }
+ else if (dstp.is_int_register())
+ {
+ emit_mov_r32_r32(dst, dstp.ireg(), REG_EAX); // mov dstp,eax
+ }
+ }
+
+ // 64-bit case
+ else if (inst.size() == 8)
+ {
+ emit_mov_r32_m32(dst, REG_EAX, MABS(srcp.memory())); // mov eax,[srcp]
+ emit_mov_r32_m32(dst, REG_EDX, MABS(srcp.memory(4))); // mov edx,[srcp+4]
+
+ if (dstp.is_memory())
+ {
+ emit_mov_m32_r32(dst, MABS(dstp.memory()), REG_EAX); // mov [dstp],eax
+ emit_mov_m32_r32(dst, MABS(dstp.memory(4)), REG_EDX); // mov [dstp+4],edx
+ }
+ else
+ {
+ emit_mov_m32_r32(dst, MABS(m_reghi[dstp.ireg()]), REG_EDX); // mov [reghi[dstp]],edx
+ emit_mov_r32_r32(dst, dstp.ireg(), REG_EAX); // mov dstp,eax
+ }
+ }
+}
+
+
//**************************************************************************
// MISCELLAENOUS FUNCTIONS
diff --git a/src/devices/cpu/drcbex86.h b/src/devices/cpu/drcbex86.h
index df81ee0c7c7..397cbb53215 100644
--- a/src/devices/cpu/drcbex86.h
+++ b/src/devices/cpu/drcbex86.h
@@ -208,6 +208,8 @@ private:
void op_fsqrt(x86code *&dst, const uml::instruction &inst);
void op_frecip(x86code *&dst, const uml::instruction &inst);
void op_frsqrt(x86code *&dst, const uml::instruction &inst);
+ void op_fcopyi(x86code *&dst, const uml::instruction &inst);
+ void op_icopyf(x86code *&dst, const uml::instruction &inst);
// 32-bit code emission helpers
void emit_mov_r32_p32(x86code *&dst, UINT8 reg, const be_parameter &param);
diff --git a/src/devices/cpu/drcuml.cpp b/src/devices/cpu/drcuml.cpp
index 5c13c76b4c6..736301ff606 100644
--- a/src/devices/cpu/drcuml.cpp
+++ b/src/devices/cpu/drcuml.cpp
@@ -35,6 +35,7 @@
***************************************************************************/
#include "emu.h"
+#include "emuopts.h"
#include "drcuml.h"
#include "drcbec.h"
#include "drcbex86.h"
diff --git a/src/devices/cpu/drcumlsh.h b/src/devices/cpu/drcumlsh.h
index d14c1321d9e..12f5abc20eb 100644
--- a/src/devices/cpu/drcumlsh.h
+++ b/src/devices/cpu/drcumlsh.h
@@ -156,6 +156,8 @@
#define UML_FSSQRT(block, dst, src1) do { block->append().fssqrt(dst, src1); } while (0)
#define UML_FSRECIP(block, dst, src1) do { block->append().fsrecip(dst, src1); } while (0)
#define UML_FSRSQRT(block, dst, src1) do { block->append().fsrsqrt(dst, src1); } while (0)
+#define UML_FSCOPYI(block, dst, src) do { block->append().fscopyi(dst, src); } while (0)
+#define UML_ICOPYFS(block, dst, src) do { block->append().icopyfs(dst, src); } while (0)
/* ----- 64-bit Floating Point Arithmetic Operations ----- */
@@ -179,6 +181,8 @@
#define UML_FDSQRT(block, dst, src1) do { block->append().fdsqrt(dst, src1); } while (0)
#define UML_FDRECIP(block, dst, src1) do { block->append().fdrecip(dst, src1); } while (0)
#define UML_FDRSQRT(block, dst, src1) do { block->append().fdrsqrt(dst, src1); } while (0)
+#define UML_FDCOPYI(block, dst, src) do { block->append().fdcopyi(dst, src); } while (0)
+#define UML_ICOPYFD(block, dst, src) do { block->append().icopyfd(dst, src); } while (0)
#endif /* __DRCUMLSH_H__ */
diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp
index 4f78f3480f4..cd35106a37b 100644
--- a/src/devices/cpu/hmcs40/hmcs40.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40.cpp
@@ -7,7 +7,7 @@
References:
- 1985 #AP1 Hitachi 4-bit Single-Chip Microcomputer Data Book
- 1988 HMCS400 Series Handbook (note: *400 is a newer MCU series, with similarities)
- - opcode decoding by Tatsuyuki Satoh, Olivier Galibert, Kevin Horton, Lord Nightmare
+ - opcode decoding by Tatsuyuki Satoh, Olivier Galibert, Kevin Horton, Lord Nightmare - and verified
*/
@@ -595,7 +595,7 @@ void hmcs40_cpu_device::execute_run()
debugger_instruction_hook(this, m_pc);
m_icount--;
m_op = m_program->read_word(m_pc << 1) & 0x3ff;
- m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR, REDD, SEDD)
+ m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
increment_pc();
// handle opcode
@@ -667,8 +667,7 @@ void hmcs40_cpu_device::execute_run()
case 0x0c0: case 0x0c1: case 0x0c2: case 0x0c3: case 0x0c4: case 0x0c5: case 0x0c6: case 0x0c7:
op_lar(); break;
- case 0x0d0: case 0x0d1: case 0x0d2: case 0x0d3: case 0x0d4: case 0x0d5: case 0x0d6: case 0x0d7:
- case 0x0d8: case 0x0d9: case 0x0da: case 0x0db: case 0x0dc: case 0x0dd: case 0x0de: case 0x0df:
+ case 0x0d0: case 0x0d1: case 0x0d2: case 0x0d3:
op_sedd(); break;
case 0x0e0: case 0x0e1: case 0x0e2: case 0x0e3: case 0x0e4: case 0x0e5: case 0x0e6: case 0x0e7:
op_lbr(); break;
@@ -787,8 +786,7 @@ void hmcs40_cpu_device::execute_run()
case 0x2c0: case 0x2c1: case 0x2c2: case 0x2c3: case 0x2c4: case 0x2c5: case 0x2c6: case 0x2c7:
op_lra(); break;
- case 0x2d0: case 0x2d1: case 0x2d2: case 0x2d3: case 0x2d4: case 0x2d5: case 0x2d6: case 0x2d7:
- case 0x2d8: case 0x2d9: case 0x2da: case 0x2db: case 0x2dc: case 0x2dd: case 0x2de: case 0x2df:
+ case 0x2d0: case 0x2d1: case 0x2d2: case 0x2d3:
op_redd(); break;
case 0x2e0: case 0x2e1: case 0x2e2: case 0x2e3: case 0x2e4: case 0x2e5: case 0x2e6: case 0x2e7:
op_lrb(); break;
diff --git a/src/devices/cpu/hmcs40/hmcs40d.cpp b/src/devices/cpu/hmcs40/hmcs40d.cpp
index b63ba1fde4d..1a40547ebf1 100644
--- a/src/devices/cpu/hmcs40/hmcs40d.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40d.cpp
@@ -111,7 +111,7 @@ static const UINT8 hmcs40_mnemonic[0x400] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0c0 */
mLAR, mLAR, mLAR, mLAR, mLAR, mLAR, mLAR, mLAR, 0, 0, 0, 0, 0, 0, 0, 0,
- mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD, mSEDD,
+ mSEDD, mSEDD, mSEDD, mSEDD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
mLBR, mLBR, mLBR, mLBR, mLBR, mLBR, mLBR, mLBR, 0, 0, 0, 0, 0, 0, 0, 0,
mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR, mXAMR,
@@ -155,7 +155,7 @@ static const UINT8 hmcs40_mnemonic[0x400] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x2c0 */
mLRA, mLRA, mLRA, mLRA, mLRA, mLRA, mLRA, mLRA, 0, 0, 0, 0, 0, 0, 0, 0,
- mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD, mREDD,
+ mREDD, mREDD, mREDD, mREDD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
mLRB, mLRB, mLRB, mLRB, mLRB, mLRB, mLRB, mLRB, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/src/devices/cpu/hmcs40/hmcs40op.cpp b/src/devices/cpu/hmcs40/hmcs40op.cpp
index f6faab90360..ba0a3fb1f77 100644
--- a/src/devices/cpu/hmcs40/hmcs40op.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40op.cpp
@@ -624,13 +624,13 @@ void hmcs40_cpu_device::op_td()
void hmcs40_cpu_device::op_sedd()
{
// SEDD n: Set Discrete I/O Latch Direct
- write_d(m_op & 0xf, 1);
+ write_d(m_op & 3, 1);
}
void hmcs40_cpu_device::op_redd()
{
// REDD n: Reset Discrete I/O Latch Direct
- write_d(m_op & 0xf, 0);
+ write_d(m_op & 3, 0);
}
void hmcs40_cpu_device::op_lar()
diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp
index 44c29698cb1..fd7870d319f 100644
--- a/src/devices/cpu/hphybrid/hphybrid.cpp
+++ b/src/devices/cpu/hphybrid/hphybrid.cpp
@@ -1459,7 +1459,7 @@ UINT32 hp_5061_3001_cpu_device::add_mae(aec_cases_t aec_case , UINT16 addr)
bool top_half = BIT(addr , 15) != 0;
// Detect accesses to top half of base page
- if (aec_case == AEC_CASE_C && (addr & 0xfe00) == 0xfe00) {
+ if ((aec_case == AEC_CASE_C || aec_case == AEC_CASE_I) && (addr & 0xfe00) == 0xfe00) {
aec_case = AEC_CASE_B;
}
diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp
index 8ebba313047..ce226e23739 100644
--- a/src/devices/cpu/m6809/m6809.cpp
+++ b/src/devices/cpu/m6809/m6809.cpp
@@ -210,8 +210,8 @@ void m6809_base_device::device_reset()
m_cc |= CC_I; // IRQ disabled
m_cc |= CC_F; // FIRQ disabled
- m_pc.b.h = m_addrspace[AS_PROGRAM]->read_byte(VECTOR_RESET_FFFE + 0);
- m_pc.b.l = m_addrspace[AS_PROGRAM]->read_byte(VECTOR_RESET_FFFE + 1);
+ m_pc.b.h = space(AS_PROGRAM).read_byte(VECTOR_RESET_FFFE + 0);
+ m_pc.b.l = space(AS_PROGRAM).read_byte(VECTOR_RESET_FFFE + 1);
// reset sub-instruction state
reset_state();
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index 20d82bd3725..c09088fd669 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -31,19 +31,26 @@
#define RTVAL64 (m_core->r[RTREG])
#define RDVAL64 (m_core->r[RDREG])
-#define FRVALS_FR0 (((float *)&m_core->cpr[1][0])[FRREG])
-#define FTVALS_FR0 (((float *)&m_core->cpr[1][0])[FTREG])
-#define FSVALS_FR0 (((float *)&m_core->cpr[1][0])[FSREG])
-#define FDVALS_FR0 (((float *)&m_core->cpr[1][0])[FDREG])
-#define FSVALW_FR0 (((UINT32 *)&m_core->cpr[1][0])[FSREG])
-#define FDVALW_FR0 (((UINT32 *)&m_core->cpr[1][0])[FDREG])
-
-#define FRVALD_FR0 (*(double *)&m_core->cpr[1][FRREG/2])
-#define FTVALD_FR0 (*(double *)&m_core->cpr[1][FTREG/2])
-#define FSVALD_FR0 (*(double *)&m_core->cpr[1][FSREG/2])
-#define FDVALD_FR0 (*(double *)&m_core->cpr[1][FDREG/2])
-#define FSVALL_FR0 (((UINT64 *)&m_core->cpr[1][0])[FSREG/2])
-#define FDVALL_FR0 (((UINT64 *)&m_core->cpr[1][0])[FDREG/2])
+#define FRVALS_FR0 (((float *)&m_core->cpr[1][FRREG])[BYTE_XOR_LE(0)])
+#define FTVALS_FR0 (((float *)&m_core->cpr[1][FTREG])[BYTE_XOR_LE(0)])
+#define FSVALS_FR0 (((float *)&m_core->cpr[1][FSREG])[BYTE_XOR_LE(0)])
+#define FDVALS_FR0 (((float *)&m_core->cpr[1][FDREG])[BYTE_XOR_LE(0)])
+#define FSVALW_FR0 (((UINT32 *)&m_core->cpr[1][FSREG])[BYTE_XOR_LE(0)])
+#define FDVALW_FR0 (((UINT32 *)&m_core->cpr[1][FDREG])[BYTE_XOR_LE(0)])
+
+#define LFRVALD_FR0 (u2d(get_cop1_reg64(FRREG)))
+#define LFTVALD_FR0 (u2d(get_cop1_reg64(FTREG)))
+#define LFSVALD_FR0 (u2d(get_cop1_reg64(FSREG)))
+#define LFDVALD_FR0 (u2d(get_cop1_reg64(FDREG)))
+#define LFSVALL_FR0 (get_cop1_reg64(FSREG))
+#define LFDVALL_FR0 (get_cop1_reg64(FDREG))
+
+#define SFRVALD_FR0(x) (set_cop1_reg64(FRREG,d2u((x))))
+#define SFTVALD_FR0(x) (set_cop1_reg64(FTREG,d2u((x))))
+#define SFSVALD_FR0(x) (set_cop1_reg64(FSREG,d2u((x))))
+#define SFDVALD_FR0(x) (set_cop1_reg64(FDREG,d2u((x))))
+#define SFSVALL_FR0(x) (set_cop1_reg64(FSREG,(x)))
+#define SFDVALL_FR0(x) (set_cop1_reg64(FDREG,(x)))
#define FRVALS_FR1 (((float *)&m_core->cpr[1][FRREG])[BYTE_XOR_LE(0)])
#define FTVALS_FR1 (((float *)&m_core->cpr[1][FTREG])[BYTE_XOR_LE(0)])
@@ -60,7 +67,6 @@
#define FDVALL_FR1 (*(UINT64 *)&m_core->cpr[1][FDREG])
#define ADDPC(x) m_nextpc = m_core->pc + ((x) << 2)
-#define ADDPCL(x,l) { m_nextpc = m_core->pc + ((x) << 2); m_core->r[l] = (INT32)(m_core->pc + 4); }
#define ABSPC(x) m_nextpc = (m_core->pc & 0xf0000000) | ((x) << 2)
#define ABSPCL(x,l) { m_nextpc = (m_core->pc & 0xf0000000) | ((x) << 2); m_core->r[l] = (INT32)(m_core->pc + 4); }
#define SETPC(x) m_nextpc = (x)
@@ -316,7 +322,7 @@ void mips3_device::check_irqs()
void mips3_device::device_start()
{
- m_isdrc = (mconfig().options().drc() && !mconfig().m_force_no_drc) ? true : false;
+ m_isdrc = allow_drc();
/* allocate the implementation-specific state from the full cache */
m_core = (internal_mips3_state *)m_cache.alloc_near(sizeof(internal_mips3_state));
@@ -1513,36 +1519,39 @@ void mips3_device::handle_cop0(UINT32 op)
inline UINT32 mips3_device::get_cop1_reg32(int idx)
{
- if (IS_FR0)
- return ((UINT32 *)&m_core->cpr[1][0])[idx];
- else
+ //if (IS_FR0)
+ // return ((UINT32 *)&m_core->cpr[1][0])[idx];
+ //else
return m_core->cpr[1][idx];
}
inline UINT64 mips3_device::get_cop1_reg64(int idx)
{
if (IS_FR0)
- return ((UINT64 *)&m_core->cpr[1][0])[idx/2];
+ return (UINT64(((UINT32 *)&m_core->cpr[1][(idx&0x1E) + 1])[BYTE_XOR_LE(0)])) << 32
+ | (UINT64(((UINT32 *)&m_core->cpr[1][idx&0x1E])[BYTE_XOR_LE(0)]));
else
return m_core->cpr[1][idx];
}
inline void mips3_device::set_cop1_reg32(int idx, UINT32 val)
{
- if (IS_FR0)
- ((UINT32 *)&m_core->cpr[1][0])[idx] = val;
- else
+ //if (IS_FR0)
+ // ((UINT32 *)&m_core->cpr[1][0])[idx] = val;
+ //else
m_core->cpr[1][idx] = val;
}
inline void mips3_device::set_cop1_reg64(int idx, UINT64 val)
{
if (IS_FR0)
- ((UINT64 *)&m_core->cpr[1][0])[idx/2] = val;
+ {
+ ((UINT32 *)&m_core->cpr[1][idx&0x1E])[BYTE_XOR_LE(0)] = val & 0xFFFFFFFF;
+ ((UINT32 *)&m_core->cpr[1][(idx&0x1E) + 1])[BYTE_XOR_LE(0)] = val >> 32;
+ }
else
m_core->cpr[1][idx] = val;
}
-
inline UINT64 mips3_device::get_cop1_creg(int idx)
{
if (idx == 31)
@@ -1606,56 +1615,56 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* ADD.S */
FDVALS_FR0 = FSVALS_FR0 + FTVALS_FR0;
else /* ADD.D */
- FDVALD_FR0 = FSVALD_FR0 + FTVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 + LFTVALD_FR0);
break;
case 0x01:
if (IS_SINGLE(op)) /* SUB.S */
FDVALS_FR0 = FSVALS_FR0 - FTVALS_FR0;
else /* SUB.D */
- FDVALD_FR0 = FSVALD_FR0 - FTVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 - LFTVALD_FR0);
break;
case 0x02:
if (IS_SINGLE(op)) /* MUL.S */
FDVALS_FR0 = FSVALS_FR0 * FTVALS_FR0;
else /* MUL.D */
- FDVALD_FR0 = FSVALD_FR0 * FTVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 * LFTVALD_FR0);
break;
case 0x03:
if (IS_SINGLE(op)) /* DIV.S */
FDVALS_FR0 = FSVALS_FR0 / FTVALS_FR0;
else /* DIV.D */
- FDVALD_FR0 = FSVALD_FR0 / FTVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 / LFTVALD_FR0);
break;
case 0x04:
if (IS_SINGLE(op)) /* SQRT.S */
FDVALS_FR0 = sqrt(FSVALS_FR0);
else /* SQRT.D */
- FDVALD_FR0 = sqrt(FSVALD_FR0);
+ SFDVALD_FR0(sqrt(LFSVALD_FR0));
break;
case 0x05:
if (IS_SINGLE(op)) /* ABS.S */
FDVALS_FR0 = fabs(FSVALS_FR0);
else /* ABS.D */
- FDVALD_FR0 = fabs(FSVALD_FR0);
+ SFDVALD_FR0(fabs(LFSVALD_FR0));
break;
case 0x06:
if (IS_SINGLE(op)) /* MOV.S */
FDVALS_FR0 = FSVALS_FR0;
else /* MOV.D */
- FDVALD_FR0 = FSVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0);
break;
case 0x07:
if (IS_SINGLE(op)) /* NEG.S */
FDVALS_FR0 = -FSVALS_FR0;
else /* NEG.D */
- FDVALD_FR0 = -FSVALD_FR0;
+ SFDVALD_FR0(-LFSVALD_FR0);
break;
case 0x08:
@@ -1666,16 +1675,16 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
temp = ceil(temp - 0.5);
else
temp = floor(temp + 0.5);
- FDVALL_FR0 = (INT64)temp;
+ SFDVALL_FR0((INT64)temp);
}
else /* ROUND.L.D */
{
- double temp = FSVALD_FR0;
+ double temp = LFSVALD_FR0;
if (temp < 0)
temp = ceil(temp - 0.5);
else
temp = floor(temp + 0.5);
- FDVALL_FR0 = (INT64)temp;
+ SFDVALL_FR0((INT64)temp);
}
break;
@@ -1687,16 +1696,16 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
temp = ceil(temp);
else
temp = floor(temp);
- FDVALL_FR0 = (INT64)temp;
+ SFDVALL_FR0((INT64)temp);
}
else /* TRUNC.L.D */
{
- double temp = FSVALD_FR0;
+ double temp = LFSVALD_FR0;
if (temp < 0)
temp = ceil(temp);
else
temp = floor(temp);
- FDVALL_FR0 = (INT64)temp;
+ SFDVALL_FR0((INT64)temp);
}
break;
@@ -1704,16 +1713,16 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* CEIL.L.S */
dtemp = ceil(FSVALS_FR0);
else /* CEIL.L.D */
- dtemp = ceil(FSVALD_FR0);
- FDVALL_FR0 = (INT64)dtemp;
+ dtemp = ceil(LFSVALD_FR0);
+ SFDVALL_FR0((INT64)dtemp);
break;
case 0x0b:
if (IS_SINGLE(op)) /* FLOOR.L.S */
dtemp = floor(FSVALS_FR0);
else /* FLOOR.L.D */
- dtemp = floor(FSVALD_FR0);
- FDVALL_FR0 = (INT64)dtemp;
+ dtemp = floor(LFSVALD_FR0);
+ SFDVALL_FR0((INT64)dtemp);
break;
case 0x0c:
@@ -1728,7 +1737,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
}
else /* ROUND.W.D */
{
- dtemp = FSVALD_FR0;
+ dtemp = LFSVALD_FR0;
if (dtemp < 0)
dtemp = ceil(dtemp - 0.5);
else
@@ -1749,7 +1758,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
}
else /* TRUNC.W.D */
{
- dtemp = FSVALD_FR0;
+ dtemp = LFSVALD_FR0;
if (dtemp < 0)
dtemp = ceil(dtemp);
else
@@ -1762,7 +1771,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* CEIL.W.S */
dtemp = ceil(FSVALS_FR0);
else /* CEIL.W.D */
- dtemp = ceil(FSVALD_FR0);
+ dtemp = ceil(LFSVALD_FR0);
FDVALW_FR0 = (INT32)dtemp;
break;
@@ -1770,7 +1779,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* FLOOR.W.S */
dtemp = floor(FSVALS_FR0);
else /* FLOOR.W.D */
- dtemp = floor(FSVALD_FR0);
+ dtemp = floor(LFSVALD_FR0);
FDVALW_FR0 = (INT32)dtemp;
break;
@@ -1780,7 +1789,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* MOVT/F.S */
FDVALS_FR0 = FSVALS_FR0;
else /* MOVT/F.D */
- FDVALD_FR0 = FSVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0);
}
break;
@@ -1790,7 +1799,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* MOVZ.S */
FDVALS_FR0 = FSVALS_FR0;
else /* MOVZ.D */
- FDVALD_FR0 = FSVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0);
}
break;
@@ -1800,7 +1809,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* MOVN.S */
FDVALS_FR0 = FSVALS_FR0;
else /* MOVN.D */
- FDVALD_FR0 = FSVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0);
}
break;
@@ -1808,14 +1817,14 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* RECIP.S */
FDVALS_FR0 = 1.0f / FSVALS_FR0;
else /* RECIP.D */
- FDVALD_FR0 = 1.0 / FSVALD_FR0;
+ SFDVALD_FR0(1.0 / LFSVALD_FR0);
break;
case 0x16: /* R5000 */
if (IS_SINGLE(op)) /* RSQRT.S */
FDVALS_FR0 = 1.0f / sqrt(FSVALS_FR0);
else /* RSQRT.D */
- FDVALD_FR0 = 1.0 / sqrt(FSVALD_FR0);
+ SFDVALD_FR0(1.0 / sqrt(LFSVALD_FR0));
break;
case 0x20:
@@ -1824,36 +1833,36 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* CVT.S.W */
FDVALS_FR0 = (INT32)FSVALW_FR0;
else /* CVT.S.L */
- FDVALS_FR0 = (INT64)FSVALL_FR0;
+ FDVALS_FR0 = (INT64)LFSVALL_FR0;
}
else /* CVT.S.D */
- FDVALS_FR0 = FSVALD_FR0;
+ FDVALS_FR0 = LFSVALD_FR0;
break;
case 0x21:
if (IS_INTEGRAL(op))
{
if (IS_SINGLE(op)) /* CVT.D.W */
- FDVALD_FR0 = (INT32)FSVALW_FR0;
+ SFDVALD_FR0((INT32)FSVALW_FR0);
else /* CVT.D.L */
- FDVALD_FR0 = (INT64)FSVALL_FR0;
+ SFDVALD_FR0((INT64)LFSVALL_FR0);
}
else /* CVT.D.S */
- FDVALD_FR0 = FSVALS_FR0;
+ SFDVALD_FR0(FSVALS_FR0);
break;
case 0x24:
if (IS_SINGLE(op)) /* CVT.W.S */
FDVALW_FR0 = (INT32)FSVALS_FR0;
else
- FDVALW_FR0 = (INT32)FSVALD_FR0;
+ FDVALW_FR0 = (INT32)LFSVALD_FR0;
break;
case 0x25:
if (IS_SINGLE(op)) /* CVT.L.S */
- FDVALL_FR0 = (INT64)FSVALS_FR0;
+ SFDVALL_FR0((INT64)FSVALS_FR0);
else /* CVT.L.D */
- FDVALL_FR0 = (INT64)FSVALD_FR0;
+ SFDVALL_FR0((INT64)LFSVALD_FR0);
break;
case 0x30:
@@ -1877,7 +1886,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.EQ.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 == FTVALS_FR0));
else /* C.EQ.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 == FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 == LFTVALD_FR0));
break;
case 0x33:
@@ -1885,7 +1894,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.UEQ.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 == FTVALS_FR0));
else /* C.UEQ.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 == FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 == LFTVALD_FR0));
break;
case 0x34:
@@ -1893,7 +1902,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.OLT.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 < FTVALS_FR0));
else /* C.OLT.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 < FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 < LFTVALD_FR0));
break;
case 0x35:
@@ -1901,7 +1910,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.ULT.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 < FTVALS_FR0));
else /* C.ULT.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 < FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 < LFTVALD_FR0));
break;
case 0x36:
@@ -1909,7 +1918,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.OLE.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 <= FTVALS_FR0));
else /* C.OLE.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 <= FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 <= LFTVALD_FR0));
break;
case 0x37:
@@ -1917,7 +1926,7 @@ void mips3_device::handle_cop1_fr0(UINT32 op)
if (IS_SINGLE(op)) /* C.ULE.S */
SET_FCC((op >> 8) & 7, (FSVALS_FR0 <= FTVALS_FR0));
else /* C.ULE.D */
- SET_FCC((op >> 8) & 7, (FSVALD_FR0 <= FTVALD_FR0));
+ SET_FCC((op >> 8) & 7, (LFSVALD_FR0 <= LFTVALD_FR0));
break;
default:
@@ -2311,7 +2320,7 @@ void mips3_device::handle_cop1x_fr0(UINT32 op)
break;
case 0x01: /* LDXC1 */
- if (RDOUBLE(RSVAL32 + RTVAL32, &temp64)) FDVALL_FR0 = temp64;
+ if (RDOUBLE(RSVAL32 + RTVAL32, &temp64)) SFDVALL_FR0(temp64);
break;
case 0x08: /* SWXC1 */
@@ -2330,7 +2339,7 @@ void mips3_device::handle_cop1x_fr0(UINT32 op)
break;
case 0x21: /* MADD.D */
- FDVALD_FR0 = FSVALD_FR0 * FTVALD_FR0 + FRVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 * LFTVALD_FR0 + LFRVALD_FR0);
break;
case 0x28: /* MSUB.S */
@@ -2338,7 +2347,7 @@ void mips3_device::handle_cop1x_fr0(UINT32 op)
break;
case 0x29: /* MSUB.D */
- FDVALD_FR0 = FSVALD_FR0 * FTVALD_FR0 - FRVALD_FR0;
+ SFDVALD_FR0(LFSVALD_FR0 * LFTVALD_FR0 - LFRVALD_FR0);
break;
case 0x30: /* NMADD.S */
@@ -2346,7 +2355,7 @@ void mips3_device::handle_cop1x_fr0(UINT32 op)
break;
case 0x31: /* NMADD.D */
- FDVALD_FR0 = -(FSVALD_FR0 * FTVALD_FR0 + FRVALD_FR0);
+ SFDVALD_FR0(-(LFSVALD_FR0 * LFTVALD_FR0 + LFRVALD_FR0));
break;
case 0x38: /* NMSUB.S */
@@ -2354,7 +2363,7 @@ void mips3_device::handle_cop1x_fr0(UINT32 op)
break;
case 0x39: /* NMSUB.D */
- FDVALD_FR0 = -(FSVALD_FR0 * FTVALD_FR0 - FRVALD_FR0);
+ SFDVALD_FR0(-(LFSVALD_FR0 * LFTVALD_FR0 - LFRVALD_FR0));
break;
case 0x24: /* MADD.W */
@@ -2541,10 +2550,10 @@ void mips3_device::handle_regimm(UINT32 op)
case 0x0b: /* TLTIU */ if (RSVAL64 >= UIMMVAL) generate_exception(EXCEPTION_TRAP, 1); break;
case 0x0c: /* TEQI */ if (RSVAL64 == UIMMVAL) generate_exception(EXCEPTION_TRAP, 1); break;
case 0x0e: /* TNEI */ if (RSVAL64 != UIMMVAL) generate_exception(EXCEPTION_TRAP, 1); break;
- case 0x10: /* BLTZAL */ if ((INT64)RSVAL64 < 0) ADDPCL(SIMMVAL,31); break;
- case 0x11: /* BGEZAL */ if ((INT64)RSVAL64 >= 0) ADDPCL(SIMMVAL,31); break;
- case 0x12: /* BLTZALL */ if ((INT64)RSVAL64 < 0) ADDPCL(SIMMVAL,31) else m_core->pc += 4; break;
- case 0x13: /* BGEZALL */ if ((INT64)RSVAL64 >= 0) ADDPCL(SIMMVAL,31) else m_core->pc += 4; break;
+ case 0x10: /* BLTZAL */ m_core->r[31] = (INT32)(m_core->pc + 4); if ((INT64)RSVAL64 < 0) ADDPC(SIMMVAL); break;
+ case 0x11: /* BGEZAL */ m_core->r[31] = (INT32)(m_core->pc + 4); if ((INT64)RSVAL64 >= 0) ADDPC(SIMMVAL); break;
+ case 0x12: /* BLTZALL */ m_core->r[31] = (INT32)(m_core->pc + 4); if ((INT64)RSVAL64 < 0) ADDPC(SIMMVAL); else m_core->pc += 4; break;
+ case 0x13: /* BGEZALL */ m_core->r[31] = (INT32)(m_core->pc + 4); if ((INT64)RSVAL64 >= 0) ADDPC(SIMMVAL); else m_core->pc += 4; break;
default: /* ??? */ invalid_instruction(op); break;
}
}
diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp
index 7b6da3a1626..9995cdb105f 100644
--- a/src/devices/cpu/mips/mips3drc.cpp
+++ b/src/devices/cpu/mips/mips3drc.cpp
@@ -150,7 +150,7 @@ inline void mips3_device::save_fast_iregs(drcuml_block *block)
void mips3_device::mips3drc_set_options(UINT32 options)
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
m_drcoptions = options;
}
@@ -196,7 +196,7 @@ void mips3_device::add_fastram(offs_t start, offs_t end, UINT8 readonly, void *b
void mips3_device::mips3drc_add_hotspot(offs_t pc, UINT32 opcode, UINT32 cycles)
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
if (m_hotspot_select < ARRAY_LENGTH(m_hotspot))
{
m_hotspot[m_hotspot_select].pc = pc;
diff --git a/src/devices/cpu/powerpc/ppcdrc.cpp b/src/devices/cpu/powerpc/ppcdrc.cpp
index 7390f9284e9..a974511e504 100644
--- a/src/devices/cpu/powerpc/ppcdrc.cpp
+++ b/src/devices/cpu/powerpc/ppcdrc.cpp
@@ -2224,8 +2224,8 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
UML_ADD(block, I0, R32Z(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op)
UML_CALLH(block, *m_read32[m_core->mode]); // callh read32
- UML_MOV(block, mem(&m_core->tempdata.w.l), I0); // mov [tempdata],i0
- UML_FDFRFLT(block, F64(G_RD(op)), mem(&m_core->tempdata.w.l), SIZE_DWORD); // fdfrflt fd,[tempdata],dword
+ UML_FSCOPYI(block, F0, I0); // fscopyi f0,i0
+ UML_FDFRFLT(block, F64(G_RD(op)), F0, SIZE_DWORD); // fdfrflt fd,f0,dword
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2233,8 +2233,7 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
UML_ADD(block, I0, R32Z(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op)
UML_CALLH(block, *m_read64[m_core->mode]); // callh read64
- UML_DMOV(block, mem(&m_core->tempdata.d), I0); // dmov [tempdata],i0
- UML_FDMOV(block, F64(G_RD(op)), mem(&m_core->tempdata.d)); // fdmov fd,[tempdata]
+ UML_FDCOPYI(block, F64(G_RD(op)), I0); // fdcopyi fd,i0
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2243,8 +2242,8 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op)
UML_CALLH(block, *m_read32[m_core->mode]); // callh read32
- UML_MOV(block, mem(&m_core->tempdata.w.l), I0); // mov [tempdata],i0
- UML_FDFRFLT(block, F64(G_RD(op)), mem(&m_core->tempdata.w.l), SIZE_DWORD); // fdfrflt fd,[tempdata],dword
+ UML_FSCOPYI(block, F0, I0); // fscopyi f0,i0
+ UML_FDFRFLT(block, F64(G_RD(op)), F0, SIZE_DWORD); // fdfrflt fd,f0,dword
UML_MOV(block, R32(G_RA(op)), mem(&m_core->updateaddr)); // mov ra,[updateaddr]
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2254,16 +2253,15 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op)
UML_CALLH(block, *m_read64[m_core->mode]); // callh read64
- UML_DMOV(block, mem(&m_core->tempdata.d), I0); // dmov [tempdata],i0
- UML_FDMOV(block, F64(G_RD(op)), mem(&m_core->tempdata.d)); // fdmov fd,[tempdata]
+ UML_FDCOPYI(block, F64(G_RD(op)), I0); // fdcopyi fd,i0
UML_MOV(block, R32(G_RA(op)), mem(&m_core->updateaddr)); // mov ra,[updateaddr]
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
case 0x34: /* STFS */
UML_ADD(block, I0, R32Z(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
- UML_FSFRFLT(block, mem(&m_core->tempdata.w.l), F64(G_RS(op)), SIZE_QWORD); // fsfrflt [tempdata],rs,qword
- UML_MOV(block, I1, mem(&m_core->tempdata.w.l)); // mov i1,[tempdata]
+ UML_FSFRFLT(block, F0, F64(G_RS(op)), SIZE_QWORD); // fsfrflt f0,fs,qword
+ UML_ICOPYFS(block, I1, F0); // icopyfs i1,f0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op)
UML_CALLH(block, *m_write32[m_core->mode]); // callh write32
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
@@ -2271,8 +2269,7 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
case 0x36: /* STFD */
UML_ADD(block, I0, R32Z(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
- UML_FDMOV(block, mem(&m_core->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs
- UML_DMOV(block, I1, mem(&m_core->tempdata.d)); // dmov i1,[tempdata]
+ UML_ICOPYFD(block, I1, F64(G_RS(op))); // icopyfd i1,fs
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op)); // mapvar dsisr,DSISR_IMM(op)
UML_CALLH(block, *m_write64[m_core->mode]); // callh write64
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
@@ -2280,8 +2277,8 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
case 0x35: /* STFSU */
UML_ADD(block, I0, R32(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
- UML_FSFRFLT(block, mem(&m_core->tempdata.w.l), F64(G_RS(op)), SIZE_QWORD); // fsfrflt [tempdata],rs,qword
- UML_MOV(block, I1, mem(&m_core->tempdata.w.l)); // mov i1,[tempdata]
+ UML_FSFRFLT(block, F0, F64(G_RS(op)), SIZE_QWORD); // fsfrflt f0,fs,qword
+ UML_ICOPYFS(block, I1, F0); // icopyfs i1,f0
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op)
UML_CALLH(block, *m_write32[m_core->mode]); // callh write32
@@ -2291,8 +2288,7 @@ int ppc_device::generate_opcode(drcuml_block *block, compiler_state *compiler, c
case 0x37: /* STFDU */
UML_ADD(block, I0, R32(G_RA(op)), (INT16)G_SIMM(op)); // add i0,ra,simm
- UML_FDMOV(block, mem(&m_core->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs
- UML_DMOV(block, I1, mem(&m_core->tempdata.d)); // dmov i1,[tempdata]
+ UML_ICOPYFD(block, I1, F64(G_RS(op))); // icopyfd i1,fs
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op)); // mapvar dsisr,DSISR_IMMU(op)
UML_CALLH(block, *m_write64[m_core->mode]); // callh write64
@@ -2909,8 +2905,8 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
UML_ADD(block, I0, R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_read32[m_core->mode]); // callh read32
- UML_MOV(block, mem(&m_core->tempdata.w.l), I0); // mov [tempdata],i0
- UML_FDFRFLT(block, F64(G_RD(op)), mem(&m_core->tempdata.w.l), SIZE_DWORD); // fdfrflt fd,[tempdata],dword
+ UML_FSCOPYI(block, F0, I0); // fscopyi f0,i0
+ UML_FDFRFLT(block, F64(G_RD(op)), F0, SIZE_DWORD); // fdfrflt fd,f0,dword
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2918,8 +2914,7 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
UML_ADD(block, I0, R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_read64[m_core->mode]); // callh read64
- UML_DMOV(block, mem(&m_core->tempdata.d), I0); // dmov [tempdata],i0
- UML_FDMOV(block, F64(G_RD(op)), mem(&m_core->tempdata.d)); // fdmov fd,[tempdata]
+ UML_FDCOPYI(block, F64(G_RD(op)), I0); // fdcopyi fd,i0
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2985,8 +2980,8 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_read32[m_core->mode]); // callh read32
- UML_MOV(block, mem(&m_core->tempdata.w.l), I0); // mov [tempdata],i0
- UML_FDFRFLT(block, F64(G_RD(op)), mem(&m_core->tempdata.w.l), SIZE_DWORD); // fdfrflt fd,[tempdata],dword
+ UML_FSCOPYI(block, F0, I0); // fscopyi f0,i0
+ UML_FDFRFLT(block, F64(G_RD(op)), F0, SIZE_DWORD); // fdfrflt fd,f0,dword
UML_MOV(block, R32(G_RA(op)), mem(&m_core->updateaddr)); // mov ra,[updateaddr]
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -2996,8 +2991,7 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_read64[m_core->mode]); // callh read64
- UML_DMOV(block, mem(&m_core->tempdata.d), I0); // dmov [tempdata],i0
- UML_FDMOV(block, F64(G_RD(op)), mem(&m_core->tempdata.d)); // fdmov fd,[tempdata]
+ UML_FDCOPYI(block, F64(G_RD(op)), I0); // fdcopyi fd,i0
UML_MOV(block, R32(G_RA(op)), mem(&m_core->updateaddr)); // mov ra,[updateaddr]
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
return TRUE;
@@ -3055,8 +3049,8 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
case 0x297: /* STFSX */
UML_ADD(block, I0, R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
- UML_FSFRFLT(block, mem(&m_core->tempdata.w.l), F64(G_RS(op)), SIZE_QWORD); // fsfrflt [tempdata],rs,qword
- UML_MOV(block, I1, mem(&m_core->tempdata.w.l)); // mov i1,[tempdata]
+ UML_FSFRFLT(block, F0, F64(G_RS(op)), SIZE_QWORD); // fsfrflt f0,fs,qword
+ UML_ICOPYFS(block, I1, F0); // icopyfs i1,f0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_write32[m_core->mode]); // callh write32
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
@@ -3073,8 +3067,7 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
case 0x2d7: /* STFDX */
UML_ADD(block, I0, R32Z(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
- UML_FDMOV(block, mem(&m_core->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs
- UML_DMOV(block, I1, mem(&m_core->tempdata.d)); // dmov i1,[tempdata]
+ UML_ICOPYFD(block, I1, F64(G_RS(op))); // icopyfd i1,fs
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_write64[m_core->mode]); // callh write64
generate_update_cycles(block, compiler, desc->pc + 4, TRUE); // <update cycles>
@@ -3129,8 +3122,8 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
case 0x2b7: /* STFSUX */
UML_ADD(block, I0, R32(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
- UML_FSFRFLT(block, mem(&m_core->tempdata.w.l), F64(G_RS(op)), SIZE_QWORD); // fsfrflt [tempdata],rs,qword
- UML_MOV(block, I1, mem(&m_core->tempdata.w.l)); // mov i1,[tempdata]
+ UML_FSFRFLT(block, F0, F64(G_RS(op)), SIZE_QWORD); // fsfrflt f0,fs,qword
+ UML_ICOPYFS(block, I1, F0); // icopyfs i1,f0
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_write32[m_core->mode]); // callh write32
@@ -3140,8 +3133,7 @@ int ppc_device::generate_instruction_1f(drcuml_block *block, compiler_state *com
case 0x2f7: /* STFDUX */
UML_ADD(block, I0, R32(G_RA(op)), R32(G_RB(op))); // add i0,ra,rb
- UML_FDMOV(block, mem(&m_core->tempdata.d), F64(G_RS(op))); // fdmov [tempdata],rs
- UML_DMOV(block, I1, mem(&m_core->tempdata.d)); // dmov i1,[tempdata]
+ UML_ICOPYFD(block, I1, F64(G_RS(op))); // icopyfd i1,fs
UML_MOV(block, mem(&m_core->updateaddr), I0); // mov [updateaddr],i0
UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op)); // mapvar dsisr,DSISR_IDX(op)
UML_CALLH(block, *m_write64[m_core->mode]); // callh write64
diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp
index 246843fb6af..9fd2525e193 100644
--- a/src/devices/cpu/rsp/rsp.cpp
+++ b/src/devices/cpu/rsp/rsp.cpp
@@ -361,7 +361,7 @@ void rsp_device::resolve_cb()
void rsp_device::device_start()
{
- m_isdrc = (mconfig().options().drc() && !mconfig().m_force_no_drc) ? true : false;
+ m_isdrc = allow_drc();
m_rsp_state = (internal_rsp_state *)m_cache.alloc_near(sizeof(internal_rsp_state));
if (LOG_INSTRUCTION_EXECUTION)
diff --git a/src/devices/cpu/rsp/rspdrc.cpp b/src/devices/cpu/rsp/rspdrc.cpp
index c581cfb3aba..ce334b91cc8 100644
--- a/src/devices/cpu/rsp/rspdrc.cpp
+++ b/src/devices/cpu/rsp/rspdrc.cpp
@@ -183,7 +183,7 @@ static void cfunc_write32(void *param)
void rsp_device::rspdrc_set_options(UINT32 options)
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
m_drcoptions = options;
}
@@ -307,7 +307,7 @@ void rsp_device::execute_run_drc()
void rsp_device::rspdrc_flush_drc_cache()
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
m_cache_dirty = TRUE;
}
diff --git a/src/devices/cpu/sh2/sh2.cpp b/src/devices/cpu/sh2/sh2.cpp
index 751349dbd0c..0201e8d8a44 100644
--- a/src/devices/cpu/sh2/sh2.cpp
+++ b/src/devices/cpu/sh2/sh2.cpp
@@ -193,7 +193,7 @@ sh2_device::sh2_device(const machine_config &mconfig, const char *tag, device_t
, m_out_of_cycles(nullptr)
, m_debugger_temp(0)
{
- m_isdrc = (mconfig.options().drc() && !mconfig.m_force_no_drc) ? true : false;
+ m_isdrc = allow_drc();
}
@@ -225,7 +225,7 @@ sh2_device::sh2_device(const machine_config &mconfig, device_type type, const ch
, m_nocode(nullptr)
, m_out_of_cycles(nullptr)
{
- m_isdrc = (mconfig.options().drc() && !mconfig.m_force_no_drc) ? true : false;
+ m_isdrc = allow_drc();
}
sh2a_device::sh2a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
diff --git a/src/devices/cpu/sh2/sh2drc.cpp b/src/devices/cpu/sh2/sh2drc.cpp
index db732e57b40..e7b2460198a 100644
--- a/src/devices/cpu/sh2/sh2drc.cpp
+++ b/src/devices/cpu/sh2/sh2drc.cpp
@@ -11,7 +11,6 @@
#include "debugger.h"
#include "sh2.h"
#include "sh2comn.h"
-#include "mconfig.h"
extern unsigned DasmSH2(char *buffer, unsigned pc, UINT16 opcode);
@@ -2946,7 +2945,7 @@ int sh2_device::generate_group_12(drcuml_block *block, compiler_state *compiler,
void sh2_device::sh2drc_set_options(UINT32 options)
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
m_drcoptions = options;
}
@@ -2958,7 +2957,7 @@ void sh2_device::sh2drc_set_options(UINT32 options)
void sh2_device::sh2drc_add_pcflush(offs_t address)
{
- if (!(mconfig().options().drc() && !mconfig().m_force_no_drc)) return;
+ if (!allow_drc()) return;
if (m_pcfsel < ARRAY_LENGTH(m_pcflushes))
m_pcflushes[m_pcfsel++] = address;
diff --git a/src/devices/cpu/sh4/sh4.cpp b/src/devices/cpu/sh4/sh4.cpp
index 74bf64e8f1d..047e7405537 100644
--- a/src/devices/cpu/sh4/sh4.cpp
+++ b/src/devices/cpu/sh4/sh4.cpp
@@ -4115,7 +4115,7 @@ void sh34_base_device::device_start()
m_test_irq = 0;
save_item(NAME(m_pc));
- save_item(NAME(m_r[15]));
+ save_item(NAME(m_r));
save_item(NAME(m_sr));
save_item(NAME(m_pr));
save_item(NAME(m_gbr));
@@ -4126,59 +4126,20 @@ void sh34_base_device::device_start()
save_item(NAME(m_ssr));
save_item(NAME(m_sgr));
save_item(NAME(m_fpscr));
- save_item(NAME(m_r[ 0]));
- save_item(NAME(m_r[ 1]));
- save_item(NAME(m_r[ 2]));
- save_item(NAME(m_r[ 3]));
- save_item(NAME(m_r[ 4]));
- save_item(NAME(m_r[ 5]));
- save_item(NAME(m_r[ 6]));
- save_item(NAME(m_r[ 7]));
- save_item(NAME(m_r[ 8]));
- save_item(NAME(m_r[ 9]));
- save_item(NAME(m_r[10]));
- save_item(NAME(m_r[11]));
- save_item(NAME(m_r[12]));
- save_item(NAME(m_r[13]));
- save_item(NAME(m_r[14]));
- save_item(NAME(m_fr[ 0]));
- save_item(NAME(m_fr[ 1]));
- save_item(NAME(m_fr[ 2]));
- save_item(NAME(m_fr[ 3]));
- save_item(NAME(m_fr[ 4]));
- save_item(NAME(m_fr[ 5]));
- save_item(NAME(m_fr[ 6]));
- save_item(NAME(m_fr[ 7]));
- save_item(NAME(m_fr[ 8]));
- save_item(NAME(m_fr[ 9]));
- save_item(NAME(m_fr[10]));
- save_item(NAME(m_fr[11]));
- save_item(NAME(m_fr[12]));
- save_item(NAME(m_fr[13]));
- save_item(NAME(m_fr[14]));
- save_item(NAME(m_fr[15]));
- save_item(NAME(m_xf[ 0]));
- save_item(NAME(m_xf[ 1]));
- save_item(NAME(m_xf[ 2]));
- save_item(NAME(m_xf[ 3]));
- save_item(NAME(m_xf[ 4]));
- save_item(NAME(m_xf[ 5]));
- save_item(NAME(m_xf[ 6]));
- save_item(NAME(m_xf[ 7]));
- save_item(NAME(m_xf[ 8]));
- save_item(NAME(m_xf[ 9]));
- save_item(NAME(m_xf[10]));
- save_item(NAME(m_xf[11]));
- save_item(NAME(m_xf[12]));
- save_item(NAME(m_xf[13]));
- save_item(NAME(m_xf[14]));
- save_item(NAME(m_xf[15]));
+ save_item(NAME(m_rbnk));
+ save_item(NAME(m_fr));
+ save_item(NAME(m_xf));
save_item(NAME(m_ea));
+ save_item(NAME(m_delay));
+ save_item(NAME(m_cpu_off));
+ save_item(NAME(m_pending_irq));
+ save_item(NAME(m_test_irq));
save_item(NAME(m_fpul));
save_item(NAME(m_dbr));
save_item(NAME(m_exception_priority));
save_item(NAME(m_exception_requesting));
-
+ save_item(NAME(m_irq_line_state));
+ save_item(NAME(m_m));
save_item(NAME(m_SH4_TSTR));
save_item(NAME(m_SH4_TCNT0));
save_item(NAME(m_SH4_TCNT1));
@@ -4191,10 +4152,48 @@ void sh34_base_device::device_start()
save_item(NAME(m_SH4_TCOR2));
save_item(NAME(m_SH4_TOCR));
save_item(NAME(m_SH4_TCPR2));
-
save_item(NAME(m_SH4_IPRA));
-
save_item(NAME(m_SH4_IPRC));
+ save_item(NAME(m_SH4_DAR0));
+ save_item(NAME(m_SH4_DAR1));
+ save_item(NAME(m_SH4_DAR2));
+ save_item(NAME(m_SH4_DAR3));
+ save_item(NAME(m_SH4_CHCR0));
+ save_item(NAME(m_SH4_CHCR1));
+ save_item(NAME(m_SH4_CHCR2));
+ save_item(NAME(m_SH4_CHCR3));
+ save_item(NAME(m_SH4_DMATCR0));
+ save_item(NAME(m_SH4_DMATCR1));
+ save_item(NAME(m_SH4_DMATCR2));
+ save_item(NAME(m_SH4_DMATCR3));
+ save_item(NAME(m_SH4_DMAOR));
+ save_item(NAME(m_nmi_line_state));
+ save_item(NAME(m_sleep_mode));
+ save_item(NAME(m_frt_input));
+ save_item(NAME(m_irln));
+ save_item(NAME(m_internal_irq_level));
+ save_item(NAME(m_internal_irq_vector));
+ save_item(NAME(m_refresh_timer_base));
+ save_item(NAME(m_dma_timer_active));
+ save_item(NAME(m_dma_source));
+ save_item(NAME(m_dma_destination));
+ save_item(NAME(m_dma_count));
+ save_item(NAME(m_dma_wordsize));
+ save_item(NAME(m_dma_source_increment));
+ save_item(NAME(m_dma_destination_increment));
+ save_item(NAME(m_dma_mode));
+ save_item(NAME(m_sh4_icount));
+ save_item(NAME(m_fpu_sz));
+ save_item(NAME(m_fpu_pr));
+ save_item(NAME(m_ioport16_pullup));
+ save_item(NAME( m_ioport16_direction));
+ save_item(NAME(m_ioport4_pullup));
+ save_item(NAME(m_ioport4_direction));
+ save_item(NAME(m_sh4_tlb_address));
+ save_item(NAME(m_sh4_tlb_data));
+ save_item(NAME(m_sh4_mmu_enabled));
+ save_item(NAME(m_sh3internal_upper));
+ save_item(NAME(m_sh3internal_lower));
// Debugger state
diff --git a/src/devices/cpu/sm510/kb1013vk1-2.h b/src/devices/cpu/sm510/kb1013vk1-2.h
new file mode 100644
index 00000000000..7e8c739354d
--- /dev/null
+++ b/src/devices/cpu/sm510/kb1013vk1-2.h
@@ -0,0 +1,41 @@
+// license:BSD-3-Clause
+// copyright-holders:hap, Igor
+/*
+
+ KB1013VK1-2
+
+*/
+
+#ifndef _KB1013VK12_H_
+#define _KB1013VK12_H_
+
+#include "sm500.h"
+
+
+// I/O ports setup
+
+// ..
+
+
+
+
+
+class kb1013vk12_device : public sm500_device
+{
+public:
+ kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override;
+ virtual void execute_one() override;
+
+ // opcode handlers
+ virtual void op_bs0();
+ virtual void op_bs1();
+};
+
+
+extern const device_type KB1013VK12;
+
+
+#endif /* _KB1013VK12_H_ */
diff --git a/src/devices/cpu/sm510/kb1013vk1-2core.cpp b/src/devices/cpu/sm510/kb1013vk1-2core.cpp
new file mode 100644
index 00000000000..1aa40b87cdb
--- /dev/null
+++ b/src/devices/cpu/sm510/kb1013vk1-2core.cpp
@@ -0,0 +1,135 @@
+// license:BSD-3-Clause
+// copyright-holders:hap, Igor
+/*
+
+ KB1013VK1-2 MCU core implementation
+
+*/
+
+#include "kb1013vk1-2.h"
+#include "debugger.h"
+
+// MCU types
+const device_type KB1013VK12 = &device_creator<kb1013vk12_device>;
+
+
+// internal memory maps
+static ADDRESS_MAP_START(program_1_8k, AS_PROGRAM, 8, sm510_base_device)
+ AM_RANGE(0x000, 0x6ff) AM_ROM
+ AM_RANGE(0x700, 0x73f) AM_MIRROR(0x0c0) AM_ROM
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(data_5x13x4, AS_DATA, 8, sm510_base_device)
+ AM_RANGE(0x00, 0x0c) AM_RAM
+ AM_RANGE(0x10, 0x1c) AM_RAM
+ AM_RANGE(0x20, 0x2c) AM_RAM
+ AM_RANGE(0x30, 0x3c) AM_RAM
+ AM_RANGE(0x40, 0x4c) AM_RAM
+ADDRESS_MAP_END
+
+// device definitions
+kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : sm500_device(mconfig, KB1013VK12, "KB1013VK1-2", tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_8k), 7 /* data width */, ADDRESS_MAP_NAME(data_5x13x4), "kb1013vk1-2", __FILE__)
+{ }
+
+
+// disasm
+offs_t kb1013vk12_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
+{
+ extern CPU_DISASSEMBLE(kb1013vk12);
+ return CPU_DISASSEMBLE_NAME(kb1013vk12)(this, buffer, pc, oprom, opram, options);
+}
+
+
+
+//-------------------------------------------------
+// execute
+//-------------------------------------------------
+
+void kb1013vk12_device::execute_one()
+{
+ switch (m_op & 0xf0)
+ {
+ case 0x20: op_lax(); break; // LC
+ case 0x30: op_adx(); break; // AS/A10
+ case 0x40: op_lb(); break; // LAS
+ case 0x70: op_ssr(); break; // LP
+
+ case 0x80: case 0x90: case 0xa0: case 0xb0:
+ op_t(); break; // BR (LP+this=JMP)
+ case 0xc0: case 0xd0: case 0xe0: case 0xf0:
+ op_trs(); break; // CBR/CZP (LP+this=CAL)
+
+ default:
+ switch (m_op & 0xfc)
+ {
+ case 0x04: op_rm(); break; // BM0
+ case 0x0c: op_sm(); break; // BM1
+ case 0x10: op_exc(); break; // XM/XE
+ case 0x14: op_exci(); break; // XI/XEI
+ case 0x18: op_lda(); break; // LE
+ case 0x1c: op_excd(); break; // XD/XED
+ case 0x54: op_tmi(); break; // SM1
+
+ default:
+ switch (m_op)
+ {
+ case 0x00: op_skip(); break; // NOP
+ case 0x01: op_atr(); break; // OAR
+ case 0x02: op_bs1(); break; // *BS1
+ case 0x03: op_atbp(); break;
+ case 0x08: op_add(); break; // AM
+ case 0x09: op_add11(); break; // AC
+ case 0x0a: op_coma(); break; // COM
+ case 0x0b: op_exbla(); break; // XL
+
+ case 0x50: op_tal(); break; // SI1
+ case 0x51: op_tb(); break; // SI0
+ case 0x52: op_tc(); break; // SCO
+ case 0x53: op_tam(); break; // SAM
+ case 0x58: op_tis(); break; // TIM
+ case 0x59: op_ptw(); break;
+ case 0x5a: op_ta0(); break; // SAO
+ case 0x5b: op_tabl(); break; // SAL
+ case 0x5c: op_tw(); break;
+ case 0x5d: op_dtw(); break;
+ case 0x5f: op_lbl(); break; // LAF
+
+ case 0x60: op_comcn(); break;
+ case 0x61: op_pdtw(); break;
+ case 0x62: op_wr(); break;
+ case 0x63: op_ws(); break;
+ case 0x64: op_incb(); break; // INC
+ case 0x65: op_idiv(); break; // SYN
+ case 0x66: op_rc(); break; // CLC
+ case 0x67: op_sc(); break; // STC
+ case 0x68: op_rmf(); break; // CLL
+ case 0x69: op_smf(); break; // LD0
+ case 0x6a: op_kta(); break; // ICD
+ case 0x6b: op_bs0(); break; // *BS0
+ case 0x6c: op_decb(); break; // DEC
+ case 0x6d: op_comcb(); break; // CMS
+ case 0x6e: op_rtn0(); break; // RT
+ case 0x6f: op_rtn1(); break; // RTS
+
+ // extended opcodes
+ case 0x5e:
+ m_op = m_op << 8 | m_param;
+ switch (m_param)
+ {
+ case 0x00: op_cend(); break; // HLT
+ case 0x04: op_dta(); break; // LDF
+
+ default: op_illegal(); break;
+ }
+ break; // 0x5e
+
+ default: op_illegal(); break;
+ }
+ break; // 0xff
+
+ }
+ break; // 0xfc
+
+ } // big switch
+}
diff --git a/src/devices/cpu/sm510/kb1013vk1-2op.cpp b/src/devices/cpu/sm510/kb1013vk1-2op.cpp
new file mode 100644
index 00000000000..3c5fcc548e7
--- /dev/null
+++ b/src/devices/cpu/sm510/kb1013vk1-2op.cpp
@@ -0,0 +1,21 @@
+// license:BSD-3-Clause
+// copyright-holders:hap, Igor
+
+// KB1013VK1-2 opcode handlers
+
+#include "kb1013vk1-2.h"
+
+
+// instruction set
+
+void kb1013vk12_device::op_bs0()
+{
+ // BS0: reset RAM address high bit
+ m_bm &= ~4;
+}
+
+void kb1013vk12_device::op_bs1()
+{
+ // BS1: set RAM address high bit
+ m_bm |= 4;
+}
diff --git a/src/devices/cpu/sm510/sm500.h b/src/devices/cpu/sm510/sm500.h
new file mode 100644
index 00000000000..aaf083c293a
--- /dev/null
+++ b/src/devices/cpu/sm510/sm500.h
@@ -0,0 +1,82 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/*
+
+ Sharp SM500 MCU family cores
+
+*/
+
+#ifndef _SM500_H_
+#define _SM500_H_
+
+#include "sm510.h"
+
+
+// I/O ports setup
+
+// ..
+
+
+// pinout reference
+
+/*
+
+ O33 O43 O12 O22 O32 GND O42 O11 O21 O31 O41 OS1
+ 36 35 34 33 32 31 30 29 28 27 26 25
+ ________________________________________________
+ | |
+O23 37 | | 24 OS2
+O13 38 | | 23 OS3
+O44 39 | | 22 OS4
+O34 40 | | 21 H1
+O24 41 | | 20 H2
+O14 42 | SM500 | 19 VM
+O45 43 | | 18 OSCin
+O35 44 | | 17 OSCout
+O25 45 | | 16 VDD
+O15 46 | | 15 K4
+O46 47 | | 14 K3
+O36 48 | * | 13 K2
+ |________________________________________________/
+
+ 1 2 3 4 5 6 7 8 9 10 11 12
+ O26 O16 R4 R3 R2 R1 GND _T bt al ACL K1 note: bt = beta symbol, al = alpha symbol
+*/
+
+class sm500_device : public sm510_base_device
+{
+public:
+ sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source);
+
+protected:
+ virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override;
+ virtual void execute_one() override;
+ virtual void get_opcode_param() override;
+
+ // opcode handlers
+ virtual void op_lb() override;
+ virtual void op_incb() override;
+
+ virtual void op_comcb();
+ virtual void op_ssr();
+ virtual void op_trs();
+
+ virtual void op_pdtw();
+ virtual void op_tw();
+ virtual void op_dtw();
+
+ virtual void op_ats();
+ virtual void op_exksa();
+ virtual void op_exkfa();
+
+ virtual void op_rmf();
+ virtual void op_smf();
+ virtual void op_comcn();
+};
+
+
+extern const device_type SM500;
+
+
+#endif /* _SM500_H_ */
diff --git a/src/devices/cpu/sm510/sm500core.cpp b/src/devices/cpu/sm510/sm500core.cpp
new file mode 100644
index 00000000000..a5117e7a856
--- /dev/null
+++ b/src/devices/cpu/sm510/sm500core.cpp
@@ -0,0 +1,153 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+/*
+
+ Sharp SM500 MCU core implementation
+
+*/
+
+#include "sm500.h"
+#include "debugger.h"
+
+
+// MCU types
+const device_type SM500 = &device_creator<sm500_device>;
+
+
+// internal memory maps
+static ADDRESS_MAP_START(program_1_2k, AS_PROGRAM, 8, sm510_base_device)
+ AM_RANGE(0x000, 0x4bf) AM_ROM
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(data_4x10x4, AS_DATA, 8, sm510_base_device)
+ AM_RANGE(0x00, 0x09) AM_RAM
+ AM_RANGE(0x10, 0x19) AM_RAM
+ AM_RANGE(0x20, 0x29) AM_RAM
+ AM_RANGE(0x30, 0x39) AM_RAM
+ADDRESS_MAP_END
+
+
+// device definitions
+sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : sm510_base_device(mconfig, SM500, "SM500", tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_2k), 6 /* data width */, ADDRESS_MAP_NAME(data_4x10x4), "sm500", __FILE__)
+{ }
+
+sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
+ : sm510_base_device(mconfig, type, name, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data, shortname, source)
+{ }
+
+
+// disasm
+offs_t sm500_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
+{
+ extern CPU_DISASSEMBLE(sm500);
+ return CPU_DISASSEMBLE_NAME(sm500)(this, buffer, pc, oprom, opram, options);
+}
+
+
+
+//-------------------------------------------------
+// execute
+//-------------------------------------------------
+
+void sm500_device::get_opcode_param()
+{
+ // LBL and prefix opcodes are 2 bytes
+ if (m_op == 0x5e || m_op == 0x5f)
+ {
+ m_icount--;
+ m_param = m_program->read_byte(m_pc);
+ increment_pc();
+ }
+}
+
+void sm500_device::execute_one()
+{
+ switch (m_op & 0xf0)
+ {
+ case 0x20: op_lax(); break;
+ case 0x30:
+ if (m_op == 0x30) op_ats(); // !
+ else op_adx();
+ break;
+ case 0x40: op_lb(); break;
+ case 0x70: op_ssr(); break;
+
+ case 0x80: case 0x90: case 0xa0: case 0xb0:
+ op_t(); break; // aka tr
+ case 0xc0: case 0xd0: case 0xe0: case 0xf0:
+ op_trs(); break;
+
+ default:
+ switch (m_op & 0xfc)
+ {
+ case 0x04: op_rm(); break;
+ case 0x0c: op_sm(); break;
+ case 0x10: op_exc(); break;
+ case 0x14: op_exci(); break;
+ case 0x18: op_lda(); break;
+ case 0x1c: op_excd(); break;
+ case 0x54: op_tmi(); break; // aka tm
+
+ default:
+ switch (m_op)
+ {
+ case 0x00: op_skip(); break;
+ case 0x01: op_atr(); break;
+ case 0x02: op_exksa(); break;
+ case 0x03: op_atbp(); break;
+ case 0x08: op_add(); break;
+ case 0x09: op_add11(); break; // aka addc
+ case 0x0a: op_coma(); break;
+ case 0x0b: op_exbla(); break;
+
+ case 0x50: op_tal(); break; // aka ta: test alpha
+ case 0x51: op_tb(); break;
+ case 0x52: op_tc(); break;
+ case 0x53: op_tam(); break;
+ case 0x58: op_tis(); break; // aka tg: test gamma
+ case 0x59: op_ptw(); break;
+ case 0x5a: op_ta0(); break;
+ case 0x5b: op_tabl(); break;
+ case 0x5c: op_tw(); break;
+ case 0x5d: op_dtw(); break;
+ case 0x5f: op_lbl(); break;
+
+ case 0x60: op_comcn(); break;
+ case 0x61: op_pdtw(); break;
+ case 0x62: op_wr(); break;
+ case 0x63: op_ws(); break;
+ case 0x64: op_incb(); break;
+ case 0x65: op_idiv(); break;
+ case 0x66: op_rc(); break;
+ case 0x67: op_sc(); break;
+ case 0x68: op_rmf(); break;
+ case 0x69: op_smf(); break;
+ case 0x6a: op_kta(); break;
+ case 0x6b: op_exkfa(); break;
+ case 0x6c: op_decb(); break;
+ case 0x6d: op_comcb(); break;
+ case 0x6e: op_rtn0(); break; // aka rtn
+ case 0x6f: op_rtn1(); break; // aka rtns
+
+ // extended opcodes
+ case 0x5e:
+ m_op = m_op << 8 | m_param;
+ switch (m_param)
+ {
+ case 0x00: op_cend(); break;
+ case 0x04: op_dta(); break;
+
+ default: op_illegal(); break;
+ }
+ break; // 0x5e
+
+ default: op_illegal(); break;
+ }
+ break; // 0xff
+
+ }
+ break; // 0xfc
+
+ } // big switch
+}
diff --git a/src/devices/cpu/sm510/sm500op.cpp b/src/devices/cpu/sm510/sm500op.cpp
new file mode 100644
index 00000000000..bb0bc6f043b
--- /dev/null
+++ b/src/devices/cpu/sm510/sm500op.cpp
@@ -0,0 +1,95 @@
+// license:BSD-3-Clause
+// copyright-holders:hap
+
+// SM500 opcode handlers
+
+#include "sm500.h"
+
+
+// instruction set
+
+// RAM address instructions
+
+void sm500_device::op_lb()
+{
+ // LB x: load BM/BL with 4-bit immediate value (partial)
+ // BL bit 2 is clearned, bit 3 is param bit 2|3
+ m_bm = (m_op & 3);
+ m_bl = ((m_op << 1 | m_op) & 8) | (m_op >> 2 & 3);
+}
+
+void sm500_device::op_incb()
+{
+ // INCB: increment BL, skip next on overflow, of 3rd bit!
+ m_bl = (m_bl + 1) & 0xf;
+ m_skip = (m_bl == 8);
+}
+
+
+// ROM address instructions
+
+void sm500_device::op_comcb()
+{
+}
+
+void sm500_device::op_ssr()
+{
+}
+
+void sm500_device::op_trs()
+{
+}
+
+
+// Arithmetic instructions
+
+
+// Data transfer instructions
+
+void sm500_device::op_pdtw()
+{
+}
+
+void sm500_device::op_tw()
+{
+}
+
+void sm500_device::op_dtw()
+{
+}
+
+
+// I/O instructions
+
+void sm500_device::op_ats()
+{
+}
+
+void sm500_device::op_exksa()
+{
+}
+
+void sm500_device::op_exkfa()
+{
+}
+
+
+// Divider manipulation instructions
+
+
+// Bit manipulation instructions
+
+void sm500_device::op_rmf()
+{
+}
+
+void sm500_device::op_smf()
+{
+}
+
+void sm500_device::op_comcn()
+{
+}
+
+// Test instructions
+
diff --git a/src/devices/cpu/sm510/sm510.cpp b/src/devices/cpu/sm510/sm510.cpp
index 9c6b197f06f..a602e611d99 100644
--- a/src/devices/cpu/sm510/sm510.cpp
+++ b/src/devices/cpu/sm510/sm510.cpp
@@ -2,17 +2,25 @@
// copyright-holders:hap
/*
- Sharp SM510 MCU family - known chips:
+ Known chips: (* means not emulated yet)
+
+ Sharp SM510 MCU family:
- SM510: 2.7Kx8 ROM, 128x4 RAM(32x4 for LCD)
- SM511: 4Kx8 ROM, 128x4 RAM(32x4 for LCD), melody controller
- SM512: 4Kx8 ROM, 128x4 RAM(48x4 for LCD), melody controller
-
- Other chips that may be in the same family, investigate more when one of
- them needs to get emulated: SM500, SM530/31, SM4A, SM3903, ..
-
+ - *KB1013VK4-2: Soviet-era clone of SM510, minor differences
+
+ Sharp SM500 MCU family:
+ - *SM500: x
+ - *SM4A: x
+ - *SM530: x
+ - *SM531: x
+ - *KB1013VK1-2: Soviet-era clone of SM500, minor differences
+
References:
- 1990 Sharp Microcomputers Data Book
- 1996 Sharp Microcomputer Databook
+ - KB1013VK1-2/KB1013VK4-2 manual
TODO:
- proper support for LFSR program counter in debugger
@@ -59,35 +67,6 @@ void sm510_base_device::device_start()
m_write_segbs.resolve_safe();
m_write_segc.resolve_safe();
- // zerofill
- memset(m_stack, 0, sizeof(m_stack));
- m_pc = 0;
- m_prev_pc = 0;
- m_op = 0;
- m_prev_op = 0;
- m_param = 0;
- m_acc = 0;
- m_bl = 0;
- m_bm = 0;
- m_c = 0;
- m_skip = false;
- m_w = 0;
- m_r = 0;
- m_div = 0;
- m_1s = false;
- m_k_active = false;
- m_l = 0;
- m_x = 0;
- m_y = 0;
- m_bp = false;
- m_bc = false;
- m_halt = false;
- m_melody_rd = 0;
- m_melody_step_count = 0;
- m_melody_duty_count = 0;
- m_melody_duty_index = 0;
- m_melody_address = 0;
-
// register for savestates
save_item(NAME(m_stack));
save_item(NAME(m_pc));
@@ -147,6 +126,7 @@ void sm510_base_device::device_reset()
// ACL
m_skip = false;
m_halt = false;
+ m_sbm = false;
m_op = m_prev_op = 0;
do_branch(3, 7, 0);
m_prev_pc = m_pc;
diff --git a/src/devices/cpu/sm510/sm510.h b/src/devices/cpu/sm510/sm510.h
index 78a5b13556f..54b71077159 100644
--- a/src/devices/cpu/sm510/sm510.h
+++ b/src/devices/cpu/sm510/sm510.h
@@ -21,7 +21,7 @@
// driver is required to use execute_set_input(SM510_INPUT_LINE_K, state)
#define SM510_INPUT_LINE_K 0
-// 1-bit BA input pin (pull-up)
+// 1-bit BA(aka alpha) input pin (pull-up)
#define MCFG_SM510_READ_BA_CB(_devcb) \
sm510_base_device::set_read_ba_callback(*device, DEVCB_##_devcb);
@@ -162,6 +162,7 @@ protected:
UINT8 m_acc;
UINT8 m_bl;
UINT8 m_bm;
+ bool m_sbm;
UINT8 m_c;
bool m_skip;
UINT8 m_w;
@@ -180,7 +181,7 @@ protected:
UINT16 get_lcd_row(int column, UINT8* ram);
TIMER_CALLBACK_MEMBER(lcd_timer_cb);
- void init_lcd_driver();
+ virtual void init_lcd_driver();
// melody controller
optional_region_ptr<UINT8> m_melody_rom;
@@ -222,70 +223,70 @@ protected:
UINT8 bitmask(UINT16 param);
// opcode handlers
- void op_lb();
- void op_lbl();
- void op_sbm();
- void op_exbla();
- void op_incb();
- void op_decb();
-
- void op_atpl();
- void op_rtn0();
- void op_rtn1();
- void op_tl();
- void op_tml();
- void op_tm();
- void op_t();
-
- void op_exc();
- void op_bdc();
- void op_exci();
- void op_excd();
- void op_lda();
- void op_lax();
- void op_ptw();
- void op_wr();
- void op_ws();
-
- void op_kta();
- void op_atbp();
- void op_atx();
- void op_atl();
- void op_atfc();
- void op_atr();
-
- void op_add();
- void op_add11();
- void op_adx();
- void op_coma();
- void op_rot();
- void op_rc();
- void op_sc();
-
- void op_tb();
- void op_tc();
- void op_tam();
- void op_tmi();
- void op_ta0();
- void op_tabl();
- void op_tis();
- void op_tal();
- void op_tf1();
- void op_tf4();
-
- void op_rm();
- void op_sm();
-
- void op_pre();
- void op_sme();
- void op_rme();
- void op_tmel();
-
- void op_skip();
- void op_cend();
- void op_idiv();
- void op_dr();
- void op_dta();
+ virtual void op_lb();
+ virtual void op_lbl();
+ virtual void op_sbm();
+ virtual void op_exbla();
+ virtual void op_incb();
+ virtual void op_decb();
+
+ virtual void op_atpl();
+ virtual void op_rtn0();
+ virtual void op_rtn1();
+ virtual void op_tl();
+ virtual void op_tml();
+ virtual void op_tm();
+ virtual void op_t();
+
+ virtual void op_exc();
+ virtual void op_bdc();
+ virtual void op_exci();
+ virtual void op_excd();
+ virtual void op_lda();
+ virtual void op_lax();
+ virtual void op_ptw();
+ virtual void op_wr();
+ virtual void op_ws();
+
+ virtual void op_kta();
+ virtual void op_atbp();
+ virtual void op_atx();
+ virtual void op_atl();
+ virtual void op_atfc();
+ virtual void op_atr();
+
+ virtual void op_add();
+ virtual void op_add11();
+ virtual void op_adx();
+ virtual void op_coma();
+ virtual void op_rot();
+ virtual void op_rc();
+ virtual void op_sc();
+
+ virtual void op_tb();
+ virtual void op_tc();
+ virtual void op_tam();
+ virtual void op_tmi();
+ virtual void op_ta0();
+ virtual void op_tabl();
+ virtual void op_tis();
+ virtual void op_tal();
+ virtual void op_tf1();
+ virtual void op_tf4();
+
+ virtual void op_rm();
+ virtual void op_sm();
+
+ virtual void op_pre();
+ virtual void op_sme();
+ virtual void op_rme();
+ virtual void op_tmel();
+
+ virtual void op_skip();
+ virtual void op_cend();
+ virtual void op_idiv();
+ virtual void op_dr();
+ virtual void op_dta();
void op_illegal();
};
diff --git a/src/devices/cpu/sm510/sm510core.cpp b/src/devices/cpu/sm510/sm510core.cpp
index bf1449804c3..a871276c3a1 100644
--- a/src/devices/cpu/sm510/sm510core.cpp
+++ b/src/devices/cpu/sm510/sm510core.cpp
@@ -133,4 +133,7 @@ void sm510_device::execute_one()
break; // 0xfc
} // big switch
+
+ // BM high bit is only valid for 1 step
+ m_sbm = (m_op == 0x02);
}
diff --git a/src/devices/cpu/sm510/sm510d.cpp b/src/devices/cpu/sm510/sm510d.cpp
index 2ab48984ee0..7c78c33b318 100644
--- a/src/devices/cpu/sm510/sm510d.cpp
+++ b/src/devices/cpu/sm510/sm510d.cpp
@@ -2,7 +2,7 @@
// copyright-holders:hap
/*
- Sharp SM510 MCU family disassembler
+ Sharp SM510/SM500 MCU family disassembler
*/
@@ -15,7 +15,8 @@
enum e_mnemonics
{
- mILL, mEXT,
+ // SM510 common
+ mILL /* 0! */, mEXT,
mLB, mLBL, mSBM, mEXBLA, mINCB, mDECB,
mATPL, mRTN0, mRTN1, mTL, mTML, mTM, mT,
mEXC, mBDC, mEXCI, mEXCD, mLDA, mLAX, mPTW, mWR, mWS,
@@ -24,7 +25,20 @@ enum e_mnemonics
mTB, mTC, mTAM, mTMI, mTA0, mTABL, mTIS, mTAL, mTF1, mTF4,
mRM, mSM,
mPRE, mSME, mRME, mTMEL,
- mSKIP, mCEND, mIDIV
+ mSKIP, mCEND, mIDIV, mDR, mDTA,
+
+ // SM500-specific
+ mCOMCB, mRTN, mRTNS, mSSR, mTR, mTRS,
+ mADDC, mPDTW, mTW, mDTW,
+ mATS, mEXKSA, mEXKFA,
+ mRMF, mSMF, mCOMCN,
+ mTA, mTM2, mTG,
+
+ // KB1013VK1-2 aliases
+ mLC, mLM, mLE, mLAF, mLAS, mLDF, mBS0, mBS1, mXL, mXM, mXI, mXEI, mXD, mXED, mXE, mBM0, mBM1, mSM1,
+ mAM, mAC, mA10, mAS, mCLL, mCOM, mCLC, mSTC, mSCO, mSAO, mINC, mDEC, mSAM, mSAL, mNOP,
+ mICD, mOAR, mOA0, mOA1, mDAF, mDAS, mABS, mABF, mCTB, mLD0, mEN,
+ mBR, mLP, mCBR, mCMS, mRT, mRTS, mSI1, mSI0, mSYN, mTIM, mHLT
};
static const char *const s_mnemonics[] =
@@ -38,7 +52,20 @@ static const char *const s_mnemonics[] =
"TB", "TC", "TAM", "TMI", "TA0", "TABL", "TIS", "TAL", "TF1", "TF4",
"RM", "SM",
"PRE", "SME", "RME", "TMEL",
- "SKIP", "CEND", "IDIV"
+ "SKIP", "CEND", "IDIV", "DR", "DTA",
+
+ //
+ "COMCB", "RTN", "RTNS", "SSR", "TR", "TRS",
+ "ADDC", "PDTW", "TW", "DTW",
+ "ATS", "EXKSA", "EXKFA",
+ "RMF", "SMF", "COMCN",
+ "TA", "TM", "TG"
+
+ //
+ "LC", "LM", "LE", "LAF", "LAS", "LDF", "BS0", "BS1", "XL", "XM", "XI", "XEI", "XD", "XED", "XE", "BM0", "BM1", "SM1",
+ "AM", "AC", "A10", "AS", "CLL", "COM", "CLC", "STC", "SCO", "SAO", "INC", "DEC", "SAM", "SAL", "NOP",
+ "ICD", "OAR", "OA0", "OA1", "DAF", "DAS", "ABS", "ABF", "CTB", "LD0", "EN",
+ "BR", "LP", "CBR", "CMS", "RT", "RTS", "SI1", "SI0", "SYN", "TIM", "HLT"
};
// number of bits per opcode parameter, 8 or larger means 2-byte opcode
@@ -53,7 +80,20 @@ static const UINT8 s_bits[] =
0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
2, 2,
8, 0, 0, 0,
- 0, 0, 0
+ 0, 0, 0, 0, 0,
+
+ //
+ 0, 0, 0, 4, 6, 6,
+ 0, 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 2, 0,
+
+ //
+ 4, 0, 2, 8, 4, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 2, 2,
+ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 6, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0
};
#define _OVER DASMFLAG_STEP_OVER
@@ -70,7 +110,20 @@ static const UINT32 s_flags[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
0, 0, 0, 0,
- 0, _OVER, 0
+ 0, _OVER, 0, 0, 0,
+
+ //
+ 0, _OUT, _OUT, 0, 0, _OVER,
+ 0, 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ //
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, _OVER, 0, _OUT, _OUT, 0, 0, 0, 0, _OVER
};
// next program counter in sequence (relative)
@@ -178,14 +231,14 @@ CPU_DISASSEMBLE(sm510)
static const UINT8 sm511_mnemonic[0x100] =
{
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
- mROT, 0, mSBM, mATPL, mRM, mRM, mRM, mRM, mADD, mADD11,mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0
+ mROT, mDTA, mSBM, mATPL, mRM, mRM, mRM, mRM, mADD, mADD11,mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0
mEXC, mEXC, mEXC, mEXC, mEXCI, mEXCI, mEXCI, mEXCI, mLDA, mLDA, mLDA, mLDA, mEXCD, mEXCD, mEXCD, mEXCD, // 1
mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, // 2
mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, // 3
mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, // 4
- mKTA, mTB, mTC, mTAM, mTMI, mTMI, mTMI, mTMI, mTIS, mATL, mTA0, mTABL, mATX, 0, mTAL, mLBL, // 5
- mEXT, mPRE, mWR, mWS, mINCB, 0, mRC, mSC, mTML, mTML, mTML, mTML, mDECB, mPTW, mRTN0, mRTN1, // 6
+ mKTA, mTB, mTC, mTAM, mTMI, mTMI, mTMI, mTMI, mTIS, mATL, mTA0, mTABL, mATX, mCEND, mTAL, mLBL, // 5
+ mEXT, mPRE, mWR, mWS, mINCB, mDR, mRC, mSC, mTML, mTML, mTML, mTML, mDECB, mPTW, mRTN0, mRTN1, // 6
mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, mTL, // 7
mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, mT, // 8
@@ -201,7 +254,7 @@ static const UINT8 sm511_mnemonic[0x100] =
static const UINT8 sm511_extended[0x10] =
{
- mRME, mSME, mTMEL, mATFC, mBDC, mATBP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 3
+ mRME, mSME, mTMEL, mATFC, mBDC, mATBP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 60 3
};
CPU_DISASSEMBLE(sm511)
@@ -213,3 +266,87 @@ CPU_DISASSEMBLE(sm511)
return sm510_common_disasm(sm511_mnemonic, ext, buffer, pc, oprom, opram);
}
+
+
+// SM500 disasm
+
+static const UINT8 sm500_mnemonic[0x100] =
+{
+/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
+ mSKIP, mATR, mEXKSA,mATBP, mRM, mRM, mRM, mRM, mADD, mADDC, mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0
+ mEXC, mEXC, mEXC, mEXC, mEXCI, mEXCI, mEXCI, mEXCI, mLDA, mLDA, mLDA, mLDA, mEXCD, mEXCD, mEXCD, mEXCD, // 1
+ mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, mLAX, // 2
+ mATS, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, mADX, // 3
+
+ mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, mLB, // 4
+ mTA, mTB, mTC, mTAM, mTM2, mTM2, mTM2, mTM2, mTG, mPTW, mTA0, mTABL, mTW, mDTW, mEXT, mLBL, // 5
+ mCOMCN,mPDTW, mWR, mWS, mINCB, mIDIV, mRC, mSC, mRMF, mSMF, mKTA, mEXKFA,mDECB, mCOMCB,mRTN, mRTNS, // 6
+ mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, mSSR, // 7
+
+ mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, // 8
+ mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, // 9
+ mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, // A
+ mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, mTR, // B
+
+ mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, // C
+ mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, // D
+ mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, // E
+ mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS // F
+};
+
+static const UINT8 sm500_extended[0x10] =
+{
+ mCEND, 0, 0, 0, mDTA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 5E 0
+};
+
+CPU_DISASSEMBLE(sm500)
+{
+ // create extended opcode table
+ UINT8 ext[0x100];
+ memset(ext, 0, 0x100);
+ memcpy(ext + 0x00, sm500_extended, 0x10);
+
+ return sm510_common_disasm(sm500_mnemonic, ext, buffer, pc, oprom, opram);
+}
+
+
+// KB1013VK1-2 disasm
+
+static const UINT8 kb1013vk12_mnemonic[0x100] =
+{
+/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
+ mNOP, mOAR, mBS1, mEN, mBM0, mBM0, mBM0, mBM0, mAM, mAC, mCOM, mXL, mBM1, mBM1, mBM1, mBM1, // 0
+ mXM, mXE, mXE, mXE, mXI, mXEI, mXEI, mXEI, mLE, mLE, mLE, mLDA, mXD, mXED, mXED, mXED, // 1
+ mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, mLC, // 2
+ mAS, mAS, mAS, mAS, mAS, mAS, mAS, mAS, mAS, mAS, mA10, mAS, mAS, mAS, mAS, mAS, // 3
+
+ mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, mLAS, // 4
+ mSI1, mSI0, mSCO, mSAM, mSM1, mSM1, mSM1, mSM1, mTIM, mABS, mSAO, mSAL, mABF, mDAF, mEXT, mLAF, // 5
+ mCTB, mDAS, mOA1, mOA0, mINC, mSYN, mCLC, mSTC, mCLL, mLD0, mICD, mBS0, mDEC, mCMS, mRT, mRTS, // 6
+ mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, mLP, // 7
+
+ mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, // 8
+ mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, // 9
+ mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, // A
+ mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, mBR, // B
+
+ mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, // C
+ mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, // D
+ mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, // E
+ mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR // F
+};
+
+static const UINT8 kb1013vk12_extended[0x10] =
+{
+ mHLT, 0, 0, 0, mLDF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 5E 0
+};
+
+CPU_DISASSEMBLE(kb1013vk12)
+{
+ // create extended opcode table
+ UINT8 ext[0x100];
+ memset(ext, 0, 0x100);
+ memcpy(ext + 0x00, kb1013vk12_extended, 0x10);
+
+ return sm510_common_disasm(kb1013vk12_mnemonic, ext, buffer, pc, oprom, opram);
+}
diff --git a/src/devices/cpu/sm510/sm510op.cpp b/src/devices/cpu/sm510/sm510op.cpp
index 05ba90522e4..682aacf7e1b 100644
--- a/src/devices/cpu/sm510/sm510op.cpp
+++ b/src/devices/cpu/sm510/sm510op.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:hap
-// SM510 opcode handlers
+// shared opcode handlers
#include "sm510.h"
@@ -10,14 +10,14 @@
inline UINT8 sm510_base_device::ram_r()
{
- int bmh = (m_prev_op == 0x02) ? (1 << (m_datawidth-1)) : 0; // from SBM
+ int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
UINT8 address = (bmh | m_bm << 4 | m_bl) & m_datamask;
return m_data->read_byte(address) & 0xf;
}
inline void sm510_base_device::ram_w(UINT8 data)
{
- int bmh = (m_prev_op == 0x02) ? (1 << (m_datawidth-1)) : 0; // from SBM
+ int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM
UINT8 address = (bmh | m_bm << 4 | m_bl) & m_datamask;
m_data->write_byte(address, data & 0xf);
}
@@ -68,8 +68,8 @@ void sm510_base_device::op_lb()
switch (m_bl)
{
case 0: hi = 0; break;
- case 1: hi = 0; break;
- case 2: hi = 0; break;
+ case 1: hi = 3; break;
+ case 2: hi = 3; break;
case 3: hi = 3; break;
}
m_bl |= (hi << 2 & 0xc);
@@ -84,8 +84,7 @@ void sm510_base_device::op_lbl()
void sm510_base_device::op_sbm()
{
- // SBM: set BM high bit for next opcode - handled in ram_r/w
- assert(m_op == 0x02);
+ // SBM: set BM high bit for next opcode - handled in execute_one()
}
void sm510_base_device::op_exbla()
@@ -290,9 +289,9 @@ void sm510_base_device::op_add11()
void sm510_base_device::op_adx()
{
- // ADX x: add immediate value to ACC, skip next on carry
+ // ADX x: add immediate value to ACC, skip next on carry except if x = 10
m_acc += (m_op & 0xf);
- m_skip = ((m_acc & 0x10) != 0);
+ m_skip = ((m_op & 0xf) != 10 && (m_acc & 0x10) != 0);
m_acc &= 0xf;
}
@@ -459,7 +458,7 @@ void sm510_base_device::op_dr()
void sm510_base_device::op_dta()
{
// DTA: transfer divider low 4 bits to ACC
- m_acc = BITSWAP16(m_div,0,0,0,0, 0,0,0,0, 0,0,0,0, 14,13,12,11) & 0xf;
+ m_acc = m_div >> 11 & 0xf;
}
void sm510_base_device::op_illegal()
diff --git a/src/devices/cpu/sm510/sm511core.cpp b/src/devices/cpu/sm510/sm511core.cpp
index 956c73936e0..e98374f5905 100644
--- a/src/devices/cpu/sm510/sm511core.cpp
+++ b/src/devices/cpu/sm510/sm511core.cpp
@@ -159,4 +159,7 @@ void sm511_device::execute_one()
break; // 0xfc
} // big switch
+
+ // BM high bit is only valid for 1 step
+ m_sbm = (m_op == 0x02);
}
diff --git a/src/devices/cpu/uml.cpp b/src/devices/cpu/uml.cpp
index 07d5de9b57f..466c47aeda4 100644
--- a/src/devices/cpu/uml.cpp
+++ b/src/devices/cpu/uml.cpp
@@ -22,9 +22,6 @@
* Support for FPU exceptions
* New instructions?
- - FCOPYI, ICOPYF
- copy raw between float and integer registers
-
- VALID opcode_desc,handle,param
checksum/compare code referenced by opcode_desc; if not
matching, generate exception with handle,param
@@ -214,6 +211,8 @@ const opcode_info instruction::s_opcode_info_table[OP_MAX] =
OPINFO2(FSQRT, "f#sqrt", 4|8, false, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY))
OPINFO2(FRECIP, "f#recip", 4|8, false, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY))
OPINFO2(FRSQRT, "f#rsqrt", 4|8, false, NONE, NONE, ALL, PINFO(OUT, OP, FRM), PINFO(IN, OP, FANY))
+ OPINFO2(FCOPYI, "f#copyi", 4|8, false, NONE, NONE, NONE, PINFO(OUT, OP, FRM), PINFO(IN, OP, IRM))
+ OPINFO2(ICOPYF, "icopyf#", 4|8, false, NONE, NONE, NONE, PINFO(OUT, OP, IRM), PINFO(IN, OP, FRM))
};
@@ -870,11 +869,19 @@ std::string uml::instruction::disasm(drcuml_state *drcuml) const
std::ostringstream buffer;
for (const char *opsrc = opinfo.mnemonic; *opsrc != 0; opsrc++)
if (*opsrc == '!')
- util::stream_format(buffer, "%-8s", bang_size[m_size]);
+ util::stream_format(buffer, "%s", bang_size[m_size]);
else if (*opsrc == '#')
- util::stream_format(buffer, "%-8s", pound_size[m_size]);
+ util::stream_format(buffer, "%s", pound_size[m_size]);
else
- util::stream_format(buffer, "%-8c", *opsrc);
+ util::stream_format(buffer, "%c", *opsrc);
+
+ // pad to 8 spaces
+ int pad = 8 - buffer.tellp();
+ while (pad > 0)
+ {
+ buffer.put(' ');
+ pad--;
+ }
// iterate through parameters
for (int pnum = 0; pnum < m_numparams; pnum++)
diff --git a/src/devices/cpu/uml.h b/src/devices/cpu/uml.h
index 2dfd95adbea..5b390700ced 100644
--- a/src/devices/cpu/uml.h
+++ b/src/devices/cpu/uml.h
@@ -218,6 +218,8 @@ namespace uml
OP_FSQRT, // FSQRT dst,src1
OP_FRECIP, // FRECIP dst,src1
OP_FRSQRT, // FRSQRT dst,src1
+ OP_FCOPYI, // FCOPYI dst,src
+ OP_ICOPYF, // ICOPYF dst,src
OP_MAX
};
@@ -544,6 +546,8 @@ namespace uml
void fssqrt(parameter dst, parameter src1) { configure(OP_FSQRT, 4, dst, src1); }
void fsrecip(parameter dst, parameter src1) { configure(OP_FRECIP, 4, dst, src1); }
void fsrsqrt(parameter dst, parameter src1) { configure(OP_FRSQRT, 4, dst, src1); }
+ void fscopyi(parameter dst, parameter src) { configure(OP_FCOPYI, 4, dst, src); }
+ void icopyfs(parameter dst, parameter src) { configure(OP_ICOPYF, 4, dst, src); }
// 64-bit floating point operations
void fdload(parameter dst, const void *base, parameter index) { configure(OP_FLOAD, 8, dst, parameter::make_memory(base), index); }
@@ -566,6 +570,8 @@ namespace uml
void fdsqrt(parameter dst, parameter src1) { configure(OP_FSQRT, 8, dst, src1); }
void fdrecip(parameter dst, parameter src1) { configure(OP_FRECIP, 8, dst, src1); }
void fdrsqrt(parameter dst, parameter src1) { configure(OP_FRSQRT, 8, dst, src1); }
+ void fdcopyi(parameter dst, parameter src) { configure(OP_FCOPYI, 8, dst, src); }
+ void icopyfd(parameter dst, parameter src) { configure(OP_ICOPYF, 8, dst, src); }
// constants
static const int MAX_PARAMS = 4;
diff --git a/src/devices/cpu/x86emit.h b/src/devices/cpu/x86emit.h
index 45e1c456737..d9ac810c905 100644
--- a/src/devices/cpu/x86emit.h
+++ b/src/devices/cpu/x86emit.h
@@ -1273,6 +1273,11 @@ inline void emit_op(x86code *&emitptr, UINT32 op, UINT8 opsize, UINT8 reg, UINT8
if (opsize == OP_16BIT)
emit_byte(emitptr, PREFIX_OPSIZE);
+ bool has_prefix = (op & 0xff0000) == 0x660000 || (op & 0xff0000) == 0xf20000 || (op & 0xff0000) == 0xf30000;
+
+ if (has_prefix)
+ emit_byte(emitptr, op >> 16);
+
#if (X86EMIT_SIZE == 64)
{
UINT8 rex;
@@ -1287,7 +1292,7 @@ inline void emit_op(x86code *&emitptr, UINT32 op, UINT8 opsize, UINT8 reg, UINT8
assert(opsize != OP_64BIT);
#endif
- if ((op & 0xff0000) != 0)
+ if ((op & 0xff0000) != 0 && !has_prefix)
emit_byte(emitptr, op >> 16);
if ((op & 0xff00) != 0)
emit_byte(emitptr, op >> 8);
diff --git a/src/devices/machine/at28c16.cpp b/src/devices/machine/at28c16.cpp
index 9461850043d..f54e28f8bda 100644
--- a/src/devices/machine/at28c16.cpp
+++ b/src/devices/machine/at28c16.cpp
@@ -45,7 +45,8 @@ at28c16_device::at28c16_device( const machine_config &mconfig, const char *tag,
device_nvram_interface(mconfig, *this),
m_a9_12v( 0 ),
m_oe_12v( 0 ),
- m_last_write( -1 )
+ m_last_write( -1 ),
+ m_default_data(*this, DEVICE_SELF, AT28C16_DATA_BYTES)
{
}
@@ -116,26 +117,14 @@ void at28c16_device::nvram_default()
UINT16 default_value = 0xff;
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- m_addrspace[ 0 ]->write_byte( offs, default_value );
+ space(AS_PROGRAM).write_byte( offs, default_value );
}
/* populate from a memory region if present */
- if( m_region != nullptr )
+ if (m_default_data.found())
{
- if( m_region->bytes() != AT28C16_DATA_BYTES )
- {
- fatalerror( "at28c16 region '%s' wrong size (expected size = 0x%X)\n", tag(), AT28C16_DATA_BYTES );
- }
-
- if( m_region->bytewidth() != 1 )
- {
- fatalerror( "at28c16 region '%s' needs to be an 8-bit region\n", tag() );
- }
-
- UINT8 *default_data = m_region->base();
-
for( offs_t offs = 0; offs < AT28C16_DATA_BYTES; offs++ )
- m_addrspace[ 0 ]->write_byte( offs, default_data[offs] );
+ space(AS_PROGRAM).write_byte(offs, m_default_data[offs]);
}
}
@@ -153,7 +142,7 @@ void at28c16_device::nvram_read( emu_file &file )
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
+ space(AS_PROGRAM).write_byte( offs, buffer[ offs ] );
}
}
@@ -168,7 +157,7 @@ void at28c16_device::nvram_write( emu_file &file )
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
+ buffer[ offs ] = space(AS_PROGRAM).read_byte( offs );
}
file.write( &buffer[0], AT28C16_TOTAL_BYTES );
@@ -193,7 +182,7 @@ WRITE8_MEMBER( at28c16_device::write )
{
for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ )
{
- m_addrspace[ 0 ]->write_byte( offs, 0xff );
+ this->space(AS_PROGRAM).write_byte( offs, 0xff );
}
m_last_write = 0xff;
@@ -208,9 +197,9 @@ WRITE8_MEMBER( at28c16_device::write )
}
// logerror( "%s: AT28C16: write( %04x, %02x )\n", machine.describe_context(), offset, data );
- if( m_last_write < 0 && m_addrspace[ 0 ]->read_byte( offset ) != data )
+ if( m_last_write < 0 && this->space(AS_PROGRAM).read_byte( offset ) != data )
{
- m_addrspace[ 0 ]->write_byte( offset, data );
+ this->space(AS_PROGRAM).write_byte( offset, data );
m_last_write = data;
m_write_timer->adjust( attotime::from_usec( 200 ) );
}
@@ -233,7 +222,7 @@ READ8_MEMBER( at28c16_device::read )
offset += AT28C16_ID_BYTES;
}
- UINT8 data = m_addrspace[ 0 ]->read_byte( offset );
+ UINT8 data = this->space(AS_PROGRAM).read_byte( offset );
// logerror( "%s: AT28C16: read( %04x ) data %02x\n", machine.describe_context(), offset, data );
return data;
}
diff --git a/src/devices/machine/at28c16.h b/src/devices/machine/at28c16.h
index 5cc51cf9078..c33f92785e8 100644
--- a/src/devices/machine/at28c16.h
+++ b/src/devices/machine/at28c16.h
@@ -65,6 +65,7 @@ protected:
int m_a9_12v;
int m_oe_12v;
int m_last_write;
+ optional_region_ptr<UINT8> m_default_data;
};
diff --git a/src/devices/machine/at45dbxx.cpp b/src/devices/machine/at45dbxx.cpp
index e61fcca498a..8b127986679 100644
--- a/src/devices/machine/at45dbxx.cpp
+++ b/src/devices/machine/at45dbxx.cpp
@@ -144,13 +144,14 @@ void at45db041_device::nvram_default()
{
memset(&m_data[0], 0xff, m_data.size());
- if (region() != nullptr)
+ memory_region *region = memregion(DEVICE_SELF);
+ if (region != nullptr)
{
- UINT32 bytes = region()->bytes();
+ UINT32 bytes = region->bytes();
if (bytes > m_size)
bytes = m_size;
- memcpy(&m_data[0], region()->base(), bytes);
+ memcpy(&m_data[0], region->base(), bytes);
}
}
diff --git a/src/devices/machine/ds1204.cpp b/src/devices/machine/ds1204.cpp
index 72029b2aecc..56d57267ad3 100644
--- a/src/devices/machine/ds1204.cpp
+++ b/src/devices/machine/ds1204.cpp
@@ -32,6 +32,7 @@ const device_type DS1204 = &device_creator<ds1204_device>;
ds1204_device::ds1204_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t( mconfig, DS1204, "DS1204", tag, owner, clock, "ds1204", __FILE__ ),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_rst( 0 ),
m_clk( 0 ),
m_dqw( 0 ), m_dqr(0), m_state(0), m_bit(0)
@@ -69,7 +70,7 @@ void ds1204_device::nvram_default()
int expected_bytes = sizeof( m_unique_pattern ) + sizeof( m_identification ) + sizeof( m_security_match ) + sizeof( m_secure_memory );
- if( !m_region )
+ if (!m_region.found())
{
logerror( "ds1204(%s) region not found\n", tag() );
}
diff --git a/src/devices/machine/ds1204.h b/src/devices/machine/ds1204.h
index 42b68de7538..35e84c7771f 100644
--- a/src/devices/machine/ds1204.h
+++ b/src/devices/machine/ds1204.h
@@ -72,6 +72,8 @@ private:
static const int DQ_HIGH_IMPEDANCE = -1;
+ optional_memory_region m_region;
+
int m_rst;
int m_clk;
int m_dqw;
diff --git a/src/devices/machine/ds2401.cpp b/src/devices/machine/ds2401.cpp
index 7298fa888ee..7c74924404a 100644
--- a/src/devices/machine/ds2401.cpp
+++ b/src/devices/machine/ds2401.cpp
@@ -65,15 +65,16 @@ void ds2401_device::device_reset()
m_rx = true;
m_tx = true;
- if(m_region)
+ memory_region *region = memregion(DEVICE_SELF);
+ if (region != nullptr)
{
- if(m_region->bytes() == SIZE_DATA)
+ if (region->bytes() == SIZE_DATA)
{
- memcpy(m_data, m_region->base(), SIZE_DATA);
+ memcpy(m_data, region->base(), SIZE_DATA);
return;
}
- logerror("ds2401 %s: Wrong region length for id data, expected 0x%x, got 0x%x\n", tag(), SIZE_DATA, m_region->bytes());
+ logerror("ds2401 %s: Wrong region length for id data, expected 0x%x, got 0x%x\n", tag(), SIZE_DATA, region->bytes());
}
else
{
diff --git a/src/devices/machine/eeprom.cpp b/src/devices/machine/eeprom.cpp
index 042e4535918..43523c18fb1 100644
--- a/src/devices/machine/eeprom.cpp
+++ b/src/devices/machine/eeprom.cpp
@@ -48,6 +48,7 @@ eeprom_base_device::eeprom_base_device(const machine_config &mconfig, device_typ
: device_t(mconfig, devtype, name, tag, owner, 0, shortname, file),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_cells(0),
m_address_bits(0),
m_data_bits(0),
@@ -271,9 +272,9 @@ void eeprom_base_device::nvram_default()
UINT32 default_value = m_default_value_set ? m_default_value : ~0;
for (offs_t offs = 0; offs < eeprom_length; offs++)
if (m_data_bits == 8)
- m_addrspace[0]->write_byte(offs, default_value);
+ space(AS_PROGRAM).write_byte(offs, default_value);
else
- m_addrspace[0]->write_word(offs * 2, default_value);
+ space(AS_PROGRAM).write_word(offs * 2, default_value);
// handle hard-coded data from the driver
if (m_default_data.u8 != nullptr)
@@ -282,14 +283,14 @@ void eeprom_base_device::nvram_default()
for (offs_t offs = 0; offs < m_default_data_size; offs++)
{
if (m_data_bits == 8)
- m_addrspace[0]->write_byte(offs, m_default_data.u8[offs]);
+ space(AS_PROGRAM).write_byte(offs, m_default_data.u8[offs]);
else
- m_addrspace[0]->write_word(offs * 2, m_default_data.u16[offs]);
+ space(AS_PROGRAM).write_word(offs * 2, m_default_data.u16[offs]);
}
}
// populate from a memory region if present
- if (m_region != nullptr)
+ if (m_region.found())
{
if (m_region->bytes() != eeprom_bytes)
fatalerror("eeprom region '%s' wrong size (expected size = 0x%X)\n", tag(), eeprom_bytes);
@@ -303,13 +304,13 @@ void eeprom_base_device::nvram_default()
{
UINT8 *default_data = m_region->base();
for (offs_t offs = 0; offs < eeprom_length; offs++)
- m_addrspace[0]->write_byte(offs, default_data[offs]);
+ space(AS_PROGRAM).write_byte(offs, default_data[offs]);
}
else
{
UINT16 *default_data = (UINT16 *)(m_region->base());
for (offs_t offs = 0; offs < eeprom_length; offs++)
- m_addrspace[0]->write_word(offs * 2, default_data[offs]);
+ space(AS_PROGRAM).write_word(offs * 2, default_data[offs]);
}
}
}
@@ -328,7 +329,7 @@ void eeprom_base_device::nvram_read(emu_file &file)
dynamic_buffer buffer(eeprom_bytes);
file.read(&buffer[0], eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
- m_addrspace[0]->write_byte(offs, buffer[offs]);
+ space(AS_PROGRAM).write_byte(offs, buffer[offs]);
}
@@ -344,7 +345,7 @@ void eeprom_base_device::nvram_write(emu_file &file)
dynamic_buffer buffer(eeprom_bytes);
for (offs_t offs = 0; offs < eeprom_bytes; offs++)
- buffer[offs] = m_addrspace[0]->read_byte(offs);
+ buffer[offs] = space(AS_PROGRAM).read_byte(offs);
file.write(&buffer[0], eeprom_bytes);
}
@@ -356,9 +357,9 @@ void eeprom_base_device::nvram_write(emu_file &file)
UINT32 eeprom_base_device::internal_read(offs_t address)
{
if (m_data_bits == 16)
- return m_addrspace[0]->read_word(address * 2);
+ return space(AS_PROGRAM).read_word(address * 2);
else
- return m_addrspace[0]->read_byte(address);
+ return space(AS_PROGRAM).read_byte(address);
}
@@ -370,7 +371,7 @@ UINT32 eeprom_base_device::internal_read(offs_t address)
void eeprom_base_device::internal_write(offs_t address, UINT32 data)
{
if (m_data_bits == 16)
- m_addrspace[0]->write_word(address * 2, data);
+ space(AS_PROGRAM).write_word(address * 2, data);
else
- m_addrspace[0]->write_byte(address, data);
+ space(AS_PROGRAM).write_byte(address, data);
}
diff --git a/src/devices/machine/eeprom.h b/src/devices/machine/eeprom.h
index 23ba81cf42f..6eb802641e3 100644
--- a/src/devices/machine/eeprom.h
+++ b/src/devices/machine/eeprom.h
@@ -97,6 +97,8 @@ protected:
UINT32 internal_read(offs_t address);
void internal_write(offs_t address, UINT32 data);
+ optional_memory_region m_region;
+
// configuration state
UINT32 m_cells;
UINT8 m_address_bits;
diff --git a/src/devices/machine/er2055.cpp b/src/devices/machine/er2055.cpp
index 7c395a83b62..c0c5966b5a9 100644
--- a/src/devices/machine/er2055.cpp
+++ b/src/devices/machine/er2055.cpp
@@ -37,6 +37,7 @@ er2055_device::er2055_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, ER2055, "ER2055 EAROM", tag, owner, clock, "er2055", __FILE__),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_space_config("EAROM", ENDIANNESS_BIG, 8, 6, 0, *ADDRESS_MAP_NAME(er2055_map)),
m_control_state(0),
m_address(0),
@@ -79,7 +80,7 @@ void er2055_device::nvram_default()
{
// default to all-0xff
for (int byte = 0; byte < SIZE_DATA; byte++)
- m_addrspace[0]->write_byte(byte, 0xff);
+ space(AS_PROGRAM).write_byte(byte, 0xff);
// populate from a memory region if present
if (m_region != nullptr)
@@ -91,7 +92,7 @@ void er2055_device::nvram_default()
UINT8 *default_data = m_region->base();
for (int byte = 0; byte < SIZE_DATA; byte++)
- m_addrspace[0]->write_byte(byte, default_data[byte]);
+ space(AS_PROGRAM).write_byte(byte, default_data[byte]);
}
}
@@ -106,7 +107,7 @@ void er2055_device::nvram_read(emu_file &file)
UINT8 buffer[SIZE_DATA];
file.read(buffer, sizeof(buffer));
for (int byte = 0; byte < SIZE_DATA; byte++)
- m_addrspace[0]->write_byte(byte, buffer[byte]);
+ space(AS_PROGRAM).write_byte(byte, buffer[byte]);
}
@@ -119,7 +120,7 @@ void er2055_device::nvram_write(emu_file &file)
{
UINT8 buffer[SIZE_DATA];
for (int byte = 0; byte < SIZE_DATA; byte++)
- buffer[byte] = m_addrspace[0]->read_byte(byte);
+ buffer[byte] = space(AS_PROGRAM).read_byte(byte);
file.write(buffer, sizeof(buffer));
}
@@ -155,13 +156,13 @@ void er2055_device::set_control(UINT8 cs1, UINT8 cs2, UINT8 c1, UINT8 c2, UINT8
// write mode; erasing is required, so we perform an AND against previous
// data to simulate incorrect behavior if erasing was not done
case 0:
- m_addrspace[0]->write_byte(m_address, m_addrspace[0]->read_byte(m_address) & m_data);
+ space(AS_PROGRAM).write_byte(m_address, space(AS_PROGRAM).read_byte(m_address) & m_data);
//printf("Write %02X = %02X\n", m_address, m_data);
break;
// erase mode
case C2:
- m_addrspace[0]->write_byte(m_address, 0xff);
+ space(AS_PROGRAM).write_byte(m_address, 0xff);
//printf("Erase %02X\n", m_address);
break;
@@ -169,7 +170,7 @@ void er2055_device::set_control(UINT8 cs1, UINT8 cs2, UINT8 c1, UINT8 c2, UINT8
case C1:
if ((oldstate & CK) != 0 && (m_control_state & CK) == 0)
{
- m_data = m_addrspace[0]->read_byte(m_address);
+ m_data = space(AS_PROGRAM).read_byte(m_address);
//printf("Read %02X = %02X\n", m_address, m_data);
}
break;
diff --git a/src/devices/machine/er2055.h b/src/devices/machine/er2055.h
index 900cac15b06..82ad9d2c0e9 100644
--- a/src/devices/machine/er2055.h
+++ b/src/devices/machine/er2055.h
@@ -66,6 +66,8 @@ protected:
static const UINT8 CS1 = 0x08;
static const UINT8 CS2 = 0x10;
+ optional_memory_region m_region;
+
// configuration state
address_space_config m_space_config;
diff --git a/src/devices/machine/gt64xxx.cpp b/src/devices/machine/gt64xxx.cpp
index b11d55160bb..126741f3730 100644
--- a/src/devices/machine/gt64xxx.cpp
+++ b/src/devices/machine/gt64xxx.cpp
@@ -27,7 +27,8 @@ gt64xxx_device::gt64xxx_device(const machine_config &mconfig, const char *tag, d
: pci_host_device(mconfig, GT64XXX, "Galileo GT-64XXX System Controller", tag, owner, clock, "gt64xxx", __FILE__),
m_be(0), m_autoconfig(0), m_irq_num(-1),
m_mem_config("memory_space", ENDIANNESS_LITTLE, 32, 32),
- m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32)
+ m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/machine/gt64xxx.h b/src/devices/machine/gt64xxx.h
index e29637bae00..6653c9ca552 100644
--- a/src/devices/machine/gt64xxx.h
+++ b/src/devices/machine/gt64xxx.h
@@ -231,6 +231,8 @@ private:
address_space_config m_mem_config, m_io_config;
+ required_memory_region m_region;
+
DECLARE_ADDRESS_MAP(cpu_map, 32);
void map_cpu_space();
diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp
index eb94faf3b05..d6a1fa27805 100644
--- a/src/devices/machine/hp_taco.cpp
+++ b/src/devices/machine/hp_taco.cpp
@@ -15,8 +15,9 @@
// In other words, no description of the commands that can be issued to TACO chips.
// So, my main source of information was the careful study of HP software, especially the 9845 system test ROM (09845-66520).
// The second half of this ROM holds a comprehensive set of tape drive tests.
+// Another source was the "SIF" utility tools which use a lot of peculiar command sequences.
// The main shortcomings of my approach are:
-// * I could indentify only those TACO commands that are actually used by the software. I managed
+// * I could identify only those TACO commands that are actually used by the software. I managed
// to identify 17 out of 32 possible commands. The purpose of the rest of commands is anyone's guess.
// * I could only guess the behavior of TACO chips in corner cases (especially behavior in various error/abnormal
// conditions)
@@ -27,6 +28,8 @@
// firmware listing was quite useful in identifying sequences of commands (for example how to find a specific sector etc.).
// [3] http://www.hp9845.net site
// [4] April 1978 issue of HP Journal. There is a one-page summary of TACO chip on page 20.
+// [5] HP, manual 09845-10201, apr 81 rev. - General Utility Routines. This manual describes the SIF format and related
+// utility tools.
// This is an overview of the TACO/CPU interface.
//
@@ -35,23 +38,22 @@
// R4 | R/W | Data register: words read/written to/from tape pass through this register
// R5 | R/W | Command and status register (see below)
// R6 | R/W | Tachometer register. Writing it sets a pulse counter that counts up on either tachometer pulses or IRGs, depending
-// | | on command. When the counter rolls over from 0xffff to 0 it typically ends the command. It's not clear to me
-// | | what value could be read from this register, if it's just the same value that was written last time or the internal
-// | | counter or something else entirely.
-// R7 | R | Checksum register. Reading it clears it.
+// | | on command. When the counter rolls over from 0xffff to 0 it typically ends the command.
+// | | Current counter value is returned when reading from this register.
+// R7 | R | Checksum register. Reading it clears it next time the checksum is updated.
// R7 | W | Timing register. It controls somehow the encoding and decoding of bits. For now I completely ignore it because its
// | | content it's totally unknown to me. It seems safe to do so, anyway. I can see that it's always set to 0x661d before
-// | | writing to tape and to 0x0635 before reading.
+// | | writing to tape and to 0x0635 before reading (0x061d is set by SIF utilities).
//
// Format of TACO command/status register (R5)
// Bit R/W Content
// ===============
// 15 RW Tape direction (1 = forward)
// 14..10 RW Command (see the "enum" below)
-// 9 RW ? Drive ON according to [1], the actual use seems to be selection of gap length
-// 8 RW ? Size of gaps according to [1], N/U in my opinion
+// 9 RW Automatic stopping of tape at command completion (when 1)
+// 8 RW Minimum size of gaps (1 = 1.5", 0 = 0.066")
// 7 RW Speed of tape (1 = 90 ips, 0 = 22 ips)
-// 6 RW Option bit for various commands
+// 6 RW Option bit for various commands. Most of them use it to select read threshold (0 = low, 1 = high).
// 5 R Current track (1 = B)
// 4 R Gap detected (1)
// 3 R Write protection (1)
@@ -79,19 +81,23 @@
// - 6" of final gap
// - Non-recorded tape
// - End of tape holes
-// * Sector #0 is not used
+// * Even though the tape format is not SIF (HP's own Standard Interchange Format), it is
+// clearly based on SIF itself. The whole tape content is stored according to SIF,
+// specifically it is "encapsulated" inside file #1.
+// * Sector #0 is not used. It serves as SIF "file identifier record" (i.e. it identifies
+// that the rest of tape is inside file #1 from SIF point of view).
// * Sectors #1 and #2 hold the first copy of tape directory
// * Sectors #3 and #4 hold the second/backup copy of tape directory
// * User data are stored starting from sector #5
// * There is no "fragmentation" map (like file allocation table in FAT filesystem): a file
// spanning more than 1 sector always occupy a single block of contiguous sectors.
//
-// A sector is structured like this:
+// A sector is structured like this (see description of SIF in [5], pg 655 and following):
// Word 0: Invisible preamble word (always 0). Preamble comes from 9825, don't know if it's
// actually there in TACO encoding. I assumed it is.
-// Word 1: Format/sector in use and other unidentified bits.
-// Word 2: Sector number
-// Word 3: Sector length and other bits
+// Word 1: File word: file identifier bit, empty record indicator and file number
+// Word 2: Record word: sector number and "free field pattern"
+// Word 3: Length word: bytes available and used in sector
// Word 4: Checksum (sum of words 1..3)
// Words 5..132: Payload
// Word 133: Checksum (sum of words 5..132)
@@ -101,7 +107,7 @@
// This is how 9825 encodes words on tape:
// - the unit of encoding are 16-bit words
// - each word is encoded from MSB to LSB
-// - each word has an extra invisible "1" encoded at the end
+// - each word has an extra invisible "1" encoded at the end (a kind of "stop" bit)
// - tape is read/written at slow speed only (21.98 ips)
// - a 0 is encoded with a distance between flux reversals of 1/35200 s
// (giving a maximum density of about 1600 reversals per inch)
@@ -109,9 +115,9 @@
//
// This driver is based on the following model of the actual TACO/tape system:
// * Tape immediately reaches working speed (no spin-up time)
-// * Inversion of tape direction and change of speed are immediate as well
-// * Time & distance to stop the tape are modeled, though. Firmware is upset by
-// a tape with null braking time/distance.
+// * Change of speed is immediate as well
+// * Time & distance to stop and invert direction of tape are modeled, though. Firmware is upset by
+// a tape with null braking/inversion time/distance.
// * Speed of tape is exceptionally accurate. Real tape was controlled by a closed loop
// with something like 1% accuracy on speed.
// * Storage is modeled by one "map" data structure per track. Each map maps the tape position
@@ -125,15 +131,15 @@
// validate my solutions by running the original firmware in MAME, though (no real hw at hand).
//
// TODOs/issues:
-// * Some code cleanup
-// * Handling of tape holes seems to be wrong: test "C" of test ROM only works partially
-// * Find out what is read from register R6
-// * Handle device_image_interface::call_display to show state of tape
+// * It seems like all commands expecting to read data off the tape have a kind of timeout. More
+// investigation is needed.
+// * Emulation of CMD_NOT_INDTA is not entirely ok, SIF utilities fail when using this command.
// * Find more info on TACO chips (does anyone with a working 9845 or access to internal HP docs want to
// help me here, please?)
//
#include "emu.h"
#include "hp_taco.h"
+#include "ui/ui.h"
// Debugging
#define VERBOSE 1
@@ -160,18 +166,21 @@ enum {
#define ONE_INCH_POS (TACH_TICKS_PER_INCH * TAPE_POS_FRACT) // Value in tape_pos_t representing 1 inch of tape
#define TACH_FREQ_SLOW 21276 // Tachometer pulse frequency for slow speed (21.98 ips)
#define TACH_FREQ_FAST 87196 // Tachometer pulse frequency for fast speed (90.08 ips)
+#define TACH_FREQ_BRAKE_SLOW 11606 // Tachometer pulse frequency when stopping from slow speed (11.99 ips)
+#define TACH_FREQ_BRAKE_FAST 44566 // Tachometer pulse frequency when stopping from fast speed (46.04 ips)
#define TAPE_LENGTH ((140 * 12 + 72 * 2) * ONE_INCH_POS) // Tape length: 140 ft of usable tape + 72" of punched tape at either end
#define TAPE_INIT_POS (80 * ONE_INCH_POS) // Initial tape position: 80" from beginning (just past the punched part)
#define ZERO_BIT_LEN 619 // Length of 0 bits at slow tape speed: 1/(35200 Hz)
#define ONE_BIT_LEN 1083 // Length of 1 bits at slow tape speed: 1.75 times ZERO_BIT_LEN
-#define QUICK_CMD_USEC 25 // usec for "quick" command execution
-#define FAST_BRAKE_MSEC 73 // Braking time from fast speed to stop (2 ips) in msec (deceleration is 1200 in/s^2)
-#define SLOW_BRAKE_MSEC 17 // Braking time from slow speed to stop in msec
+#define QUICK_CMD_USEC 25 // usec for "quick" command execution (totally made up)
#define FAST_BRAKE_DIST 3350450 // Braking distance at fast speed (~3.38 in)
#define SLOW_BRAKE_DIST 197883 // Braking distance at slow speed (~0.2 in)
#define PREAMBLE_WORD 0 // Value of preamble word
#define END_GAP_LENGTH (6 * ONE_INCH_POS) // Length of final gap: 6"
-#define MIN_IRG_LENGTH ((tape_pos_t)(0.2 * ONE_INCH_POS)) // Minimum length of IRGs: 0.2" (from 9825, not sure about value in TACO)
+// Minimum gap lengths are probably counted from tacho pulses in real TACO: short gaps could be equal to 64 pulses and long ones
+// to 1472 (23 * 64)
+#define SHORT_GAP_LENGTH ((tape_pos_t)(0.066 * ONE_INCH_POS)) // Minimum length of short gaps: 0.066" ([1], pg 8-10)
+#define LONG_GAP_LENGTH ((tape_pos_t)(1.5 * ONE_INCH_POS)) // Minimum length of long gaps: 1.5" ([1], pg 8-10)
#define NULL_TAPE_POS ((tape_pos_t)-1) // Special value for invalid/unknown tape position
#define NO_DATA_GAP (17 * ONE_BIT_LEN) // Minimum gap size to detect end of data: length of longest word (0xffff)
#define FILE_MAGIC 0x4f434154 // Magic value at start of image file: "TACO"
@@ -180,50 +189,52 @@ enum {
#define CMD_CODE(reg) \
(((reg) >> 10) & 0x1f)
#define DIR_FWD(reg) \
- (BIT(reg , 15))
+ (BIT(reg , 15))
+#define AUTO_STOP(reg) \
+ (BIT(reg , 9))
+#define LONG_GAP(reg) \
+ (BIT(reg , 8))
#define SPEED_FAST(reg) \
(BIT(reg , 7))
#define CMD_OPT(reg) \
- (BIT(reg , 6))
-#define UNKNOWN_B9(reg) \
- (BIT(reg , 9))
+ (BIT(reg , 6))
#define DIR_FWD_MASK BIT_MASK(15) // Direction = forward
#define SPEED_FAST_MASK BIT_MASK(7) // Speed = fast
// Commands
enum {
- CMD_INDTA_INGAP, // 00: scan for data first then for gap
- CMD_UNK_01, // 01: unknown
- CMD_FINAL_GAP, // 02: write final gap
- CMD_INIT_WRITE, // 03: write words for tape formatting
- CMD_STOP, // 04: stop
- CMD_UNK_05, // 05: unknown
- CMD_SET_TRACK, // 06: set A/B track
- CMD_UNK_07, // 07: unknown
- CMD_UNK_08, // 08: unknown
- CMD_UNK_09, // 09: unknown
- CMD_MOVE, // 0a: move tape
- CMD_UNK_0b, // 0b: unknown
- CMD_INGAP_MOVE, // 0c: scan for gap then move a bit further (used to gain some margin when inverting tape movement)
- CMD_UNK_0d, // 0d: unknown
- CMD_CLEAR, // 0e: clear errors/unlatch status bits
- CMD_UNK_0f, // 0f: unknown
- CMD_NOT_INDTA, // 10: scan for end of data
- CMD_UNK_11, // 11: unknown
- CMD_UNK_12, // 12: unknown
- CMD_UNK_13, // 13: unknown
- CMD_UNK_14, // 14: unknown
- CMD_UNK_15, // 15: unknown
- CMD_WRITE_IRG, // 16: write inter-record gap
- CMD_UNK_17, // 17: unknown
- CMD_SCAN_RECORDS, // 18: scan records (count IRGs)
- CMD_RECORD_WRITE, // 19: write record words
- CMD_MOVE_INDTA, // 1a: move then scan for data
- CMD_UNK_1b, // 1b: unknown (for now it seems harmless to handle it as NOP)
- CMD_DELTA_MOVE_HOLE, // 1c: move tape a given distance, intr at end or first hole found (whichever comes first)
- CMD_START_READ, // 1d: start record reading
- CMD_DELTA_MOVE_IRG, // 1e: move tape a given distance, detect gaps in parallel
- CMD_END_READ // 1f: stop reading
+ CMD_INDTA_INGAP, // 00: scan for data first then for gap
+ CMD_UNK_01, // 01: unknown
+ CMD_FINAL_GAP, // 02: write final gap
+ CMD_INIT_WRITE, // 03: write words for tape formatting
+ CMD_STOP, // 04: stop
+ CMD_UNK_05, // 05: unknown
+ CMD_SET_TRACK, // 06: set A/B track
+ CMD_UNK_07, // 07: unknown
+ CMD_UNK_08, // 08: unknown
+ CMD_UNK_09, // 09: unknown
+ CMD_MOVE, // 0a: move tape
+ CMD_UNK_0b, // 0b: unknown
+ CMD_INGAP_MOVE, // 0c: scan for gap then move a bit further (used to gain some margin when inverting tape movement)
+ CMD_UNK_0d, // 0d: unknown
+ CMD_CLEAR, // 0e: clear errors/unlatch status bits
+ CMD_UNK_0f, // 0f: unknown
+ CMD_NOT_INDTA, // 10: scan for end of data
+ CMD_UNK_11, // 11: unknown
+ CMD_UNK_12, // 12: unknown
+ CMD_UNK_13, // 13: unknown
+ CMD_UNK_14, // 14: unknown
+ CMD_UNK_15, // 15: unknown
+ CMD_WRITE_IRG, // 16: write inter-record gap
+ CMD_UNK_17, // 17: unknown
+ CMD_SCAN_RECORDS, // 18: scan records (count IRGs)
+ CMD_RECORD_WRITE, // 19: write record words
+ CMD_MOVE_INDTA, // 1a: move then scan for data
+ CMD_UNK_1b, // 1b: unknown (for now it seems harmless to handle it as NOP)
+ CMD_MOVE_INGAP, // 1c: move tape a given distance then scan for gap (as cmd 0c but in reverse order)
+ CMD_START_READ, // 1d: start record reading
+ CMD_DELTA_MOVE_IRG, // 1e: move tape a given distance, detect gaps in parallel
+ CMD_END_READ // 1f: stop reading
};
// Bits of status register
@@ -293,33 +304,34 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, d
WRITE16_MEMBER(hp_taco_device::reg_w)
{
- LOG_0(("wr R%u = %04x\n", 4 + offset , data));
-
- // Any I/O activity clears IRQ
- irq_w(false);
-
- switch (offset) {
- case 0:
- // Data register
- m_data_reg = data;
- m_data_reg_full = true;
- break;
-
- case 1:
- // Command register
- start_cmd_exec(data & CMD_REG_MASK);
- break;
-
- case 2:
- // Tachometer register
- m_tach_reg = data;
- break;
-
- case 3:
- // Timing register
- m_timing_reg = data;
- break;
- }
+ LOG_0(("wr R%u = %04x\n", 4 + offset , data));
+
+ // Any I/O activity clears IRQ
+ irq_w(false);
+
+ switch (offset) {
+ case 0:
+ // Data register
+ m_data_reg = data;
+ m_data_reg_full = true;
+ break;
+
+ case 1:
+ // Command register
+ start_cmd_exec(data & CMD_REG_MASK);
+ break;
+
+ case 2:
+ // Tachometer register
+ m_tach_reg = data;
+ freeze_tach_reg(true);
+ break;
+
+ case 3:
+ // Timing register
+ m_timing_reg = data;
+ break;
+ }
}
READ16_MEMBER(hp_taco_device::reg_r)
@@ -340,17 +352,18 @@ READ16_MEMBER(hp_taco_device::reg_r)
res = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
break;
- case 2:
- // Tachometer register
- res = m_tach_reg;
- break;
+ case 2:
+ // Tachometer register
+ update_tach_reg();
+ res = m_tach_reg;
+ break;
- case 3:
- // Checksum register: it clears when read
- res = m_checksum_reg;
- m_checksum_reg = 0;
- break;
- }
+ case 3:
+ // Checksum register: it clears when read
+ res = m_checksum_reg;
+ m_clear_checksum_reg = true;
+ break;
+ }
LOG_0(("rd R%u = %04x\n", 4 + offset , res));
@@ -377,35 +390,38 @@ void hp_taco_device::device_config_complete()
// device_start
void hp_taco_device::device_start()
{
- LOG(("device_start"));
- m_irq_handler.resolve_safe();
- m_flg_handler.resolve_safe();
- m_sts_handler.resolve_safe();
-
- save_item(NAME(m_data_reg));
- save_item(NAME(m_data_reg_full));
- save_item(NAME(m_cmd_reg));
- save_item(NAME(m_cmd_state));
- save_item(NAME(m_status_reg));
- save_item(NAME(m_tach_reg));
- save_item(NAME(m_checksum_reg));
- save_item(NAME(m_timing_reg));
- save_item(NAME(m_irq));
- save_item(NAME(m_flg));
- save_item(NAME(m_sts));
- save_item(NAME(m_tape_pos));
- save_item(NAME(m_start_time));
- save_item(NAME(m_tape_fwd));
- save_item(NAME(m_tape_fast));
- save_item(NAME(m_image_dirty));
- save_item(NAME(m_tape_wr));
- save_item(NAME(m_rw_pos));
- save_item(NAME(m_next_word));
- save_item(NAME(m_rd_it_valid));
- save_item(NAME(m_gap_detect_start));
-
- m_tape_timer = timer_alloc(TAPE_TMR_ID);
- m_hole_timer = timer_alloc(HOLE_TMR_ID);
+ LOG(("device_start"));
+ m_irq_handler.resolve_safe();
+ m_flg_handler.resolve_safe();
+ m_sts_handler.resolve_safe();
+
+ save_item(NAME(m_data_reg));
+ save_item(NAME(m_data_reg_full));
+ save_item(NAME(m_cmd_reg));
+ //save_item(NAME(m_cmd_state));
+ save_item(NAME(m_status_reg));
+ save_item(NAME(m_tach_reg));
+ save_item(NAME(m_tach_reg_ref));
+ save_item(NAME(m_tach_reg_frozen));
+ save_item(NAME(m_checksum_reg));
+ save_item(NAME(m_clear_checksum_reg));
+ save_item(NAME(m_timing_reg));
+ save_item(NAME(m_irq));
+ save_item(NAME(m_flg));
+ save_item(NAME(m_sts));
+ save_item(NAME(m_tape_pos));
+ save_item(NAME(m_start_time));
+ save_item(NAME(m_tape_fwd));
+ save_item(NAME(m_tape_fast));
+ save_item(NAME(m_image_dirty));
+ save_item(NAME(m_tape_wr));
+ save_item(NAME(m_rw_pos));
+ save_item(NAME(m_next_word));
+ save_item(NAME(m_rd_it_valid));
+ save_item(NAME(m_gap_detect_start));
+
+ m_tape_timer = timer_alloc(TAPE_TMR_ID);
+ m_hole_timer = timer_alloc(HOLE_TMR_ID);
}
// device_stop
@@ -429,227 +445,92 @@ void hp_taco_device::device_reset()
void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- if (CMD_CODE(m_cmd_reg) != CMD_STOP) {
- update_tape_pos();
- }
-
- switch (id) {
- case TAPE_TMR_ID:
- LOG_0(("Tape tmr @%g\n" , machine().time().as_double()));
-
- tape_pos_t length;
-
- switch (CMD_CODE(m_cmd_reg)) {
- case CMD_INDTA_INGAP:
- if (m_cmd_state == 0) {
- m_cmd_state = 1;
- tape_pos_t target = m_tape_pos;
- if (next_n_gap(target, 1, MIN_IRG_LENGTH)) {
- m_tape_timer->adjust(time_to_target(target));
- }
- return;
- }
- break;
-
- case CMD_RECORD_WRITE:
- if (m_cmd_state == 0) {
- if (m_rd_it->second == PREAMBLE_WORD) {
- LOG_0(("Got preamble\n"));
- m_cmd_state = 1;
- // m_rw_pos already at correct position
- m_tape_timer->adjust(fetch_next_wr_word());
- break;
- } else {
- adv_res_t res = adv_it(m_rd_it);
- if (res != ADV_NO_MORE_DATA) {
- m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos));
- }
- // No IRQ
- return;
- }
- }
- // Intentional fall-through
- case CMD_INIT_WRITE:
- write_word(m_rw_pos , m_next_word , length);
- pos_offset(m_rw_pos , length);
- // Just to be sure..
- m_tape_pos = m_rw_pos;
- m_tape_timer->adjust(fetch_next_wr_word());
- break;
-
- case CMD_STOP:
- move_tape_pos(m_tape_fast ? FAST_BRAKE_DIST : SLOW_BRAKE_DIST);
- stop_tape();
- break;
-
- case CMD_INGAP_MOVE:
- if (m_cmd_state == 0) {
- m_cmd_state = 1;
- m_tape_timer->adjust(time_to_tach_pulses());
- return;
- }
- break;
-
- case CMD_FINAL_GAP:
- case CMD_WRITE_IRG:
- write_gap(m_rw_pos , m_tape_pos);
- m_hole_timer->reset();
- break;
-
- case CMD_SCAN_RECORDS:
- if (m_cmd_state == 0) {
- m_cmd_state = 1;
- tape_pos_t target = m_tape_pos;
- if (next_n_gap(target, 0x10000U - m_tach_reg, MIN_IRG_LENGTH)) {
- LOG_0(("%u gaps @%d\n" , 0x10000U - m_tach_reg, target));
- m_tape_timer->adjust(time_to_target(target));
- }
- return;
- } else {
- m_hole_timer->reset();
- }
- break;
-
- case CMD_MOVE_INDTA:
- if (m_cmd_state == 0) {
- if (next_data(m_rd_it , m_tape_pos , true)) {
- m_cmd_state = 1;
- m_tape_timer->adjust(time_to_target(farthest_end(m_rd_it)));
- }
- // No IRQ
- return;
- }
- // m_cmd_state == 1 -> IRQ & cmd end
- break;
-
- case CMD_DELTA_MOVE_HOLE:
- case CMD_DELTA_MOVE_IRG:
- // Interrupt at end of movement
- m_hole_timer->reset();
- break;
-
- case CMD_START_READ:
- {
- bool set_intr = true;
- // Just to be sure..
- m_tape_pos = m_rw_pos;
- if (m_cmd_state == 0) {
- set_intr = false;
- if (m_rd_it->second == PREAMBLE_WORD) {
- m_cmd_state = 1;
- }
- LOG_0(("Got preamble\n"));
- } else {
- m_data_reg = m_rd_it->second;
- m_checksum_reg += m_data_reg;
- LOG_0(("RD %04x\n" , m_data_reg));
- }
- adv_res_t res = adv_it(m_rd_it);
- LOG_0(("adv_it %d\n" , res));
- if (res == ADV_NO_MORE_DATA) {
- m_rd_it_valid = false;
- } else {
- if (res == ADV_DISCONT_DATA) {
- // Hit a gap, restart preamble search
- m_cmd_state = 0;
- }
- m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos));
- }
- if (!set_intr) {
- return;
- }
- }
- break;
-
- case CMD_END_READ:
- {
- m_tape_pos = m_rw_pos;
- // Note: checksum is not updated
- m_data_reg = m_rd_it->second;
- LOG_0(("Final RD %04x\n" , m_data_reg));
- adv_res_t res = adv_it(m_rd_it);
- if (res == ADV_NO_MORE_DATA) {
- m_rd_it_valid = false;
- }
- m_hole_timer->reset();
- }
- break;
-
- default:
- // Other commands: just raise irq
- break;
- }
- irq_w(true);
- break;
-
- case HOLE_TMR_ID:
- LOG_0(("Hole tmr @%g\n" , machine().time().as_double()));
-
- BIT_SET(m_status_reg , STATUS_HOLE_BIT);
-
- switch (CMD_CODE(m_cmd_reg)) {
- case CMD_FINAL_GAP:
- case CMD_WRITE_IRG:
- write_gap(m_rw_pos , m_tape_pos);
- m_rw_pos = m_tape_pos;
- break;
-
- case CMD_SCAN_RECORDS:
- case CMD_DELTA_MOVE_HOLE:
- // Cmds 18 & 1c are terminated at first hole
- m_tape_timer->reset();
- irq_w(true);
- // No reloading of hole timer
- return;
-
- case CMD_DELTA_MOVE_IRG:
- // TODO: update r6
- m_hole_timer->adjust(time_to_next_hole());
- // No IRQ at holes
- return;
-
- case CMD_START_READ:
- case CMD_END_READ:
- set_error(true);
- break;
-
- default:
- // Other cmds: default processing (update tape pos, set IRQ, schedule timer for next hole)
- break;
- }
-
- irq_w(true);
- m_hole_timer->adjust(time_to_next_hole());
- break;
-
- default:
- break;
- }
+ update_tape_pos();
+
+ switch (id) {
+ case TAPE_TMR_ID:
+ LOG_0(("Tape tmr @%g cmd %02x st %d\n" , machine().time().as_double() , CMD_CODE(m_cmd_reg) , m_cmd_state));
+
+ cmd_fsm();
+ break;
+
+ case HOLE_TMR_ID:
+ LOG_0(("Hole tmr @%g cmd %02x st %d\n" , machine().time().as_double() , CMD_CODE(m_cmd_reg) , m_cmd_state));
+
+ BIT_SET(m_status_reg , STATUS_HOLE_BIT);
+
+ if (m_cmd_state >= CMD_PH0 && m_cmd_state <= CMD_END) {
+ switch (CMD_CODE(m_cmd_reg)) {
+ case CMD_FINAL_GAP:
+ case CMD_WRITE_IRG:
+ write_gap(m_rw_pos , m_tape_pos);
+ m_rw_pos = m_tape_pos;
+ break;
+
+ case CMD_SCAN_RECORDS:
+ // Cmds 18 is terminated at first hole
+ terminate_cmd_now();
+ // No reloading of hole timer
+ return;
+
+ case CMD_MOVE_INGAP:
+ m_hole_timer->adjust(time_to_next_hole());
+ // No IRQ at holes
+ return;
+
+ case CMD_DELTA_MOVE_IRG:
+ // Hit hole before end of programmed pulses
+ terminate_cmd_now();
+ update_tach_reg();
+ freeze_tach_reg(true);
+ return;
+
+ case CMD_START_READ:
+ case CMD_END_READ:
+ set_error(true);
+ break;
+
+ default:
+ // Other cmds: default processing (update tape pos, set IRQ, schedule timer for next hole)
+ break;
+ }
+
+ irq_w(true);
+ }
+ m_hole_timer->adjust(time_to_next_hole());
+ break;
+
+ default:
+ break;
+ }
}
void hp_taco_device::clear_state(void)
{
- m_data_reg = 0;
- m_data_reg_full = false;
- m_cmd_reg = 0;
- m_status_reg = 0;
- m_tach_reg = 0;
- m_checksum_reg = 0;
- m_timing_reg = 0;
- m_cmd_state = 0;
- // m_tape_pos is not reset, tape stays where it is
- m_start_time = attotime::never;
- m_tape_fwd = false;
- m_tape_fast = false;
- // m_image_dirty is not touched
- m_tape_wr = false;
- m_rw_pos = 0;
- m_next_word = 0;
- m_rd_it_valid = false;
- m_gap_detect_start = NULL_TAPE_POS;
-
- set_tape_present(false);
- set_tape_present(is_loaded());
+ m_data_reg = 0;
+ m_data_reg_full = false;
+ m_cmd_reg = 0;
+ m_status_reg = 0;
+ m_tach_reg = 0;
+ m_tach_reg_ref = m_tape_pos;
+ m_tach_reg_frozen = true;
+ m_checksum_reg = 0;
+ m_clear_checksum_reg = false;
+ m_timing_reg = 0;
+ m_cmd_state = CMD_IDLE;
+ // m_tape_pos is not reset, tape stays where it is
+ m_start_time = attotime::never;
+ m_tape_fwd = false;
+ m_tape_fast = false;
+ // m_image_dirty is not touched
+ m_tape_wr = false;
+ m_rw_pos = 0;
+ m_next_word = 0;
+ m_rd_it_valid = false;
+ m_gap_detect_start = NULL_TAPE_POS;
+
+ set_tape_present(false);
+ set_tape_present(is_loaded());
}
void hp_taco_device::irq_w(bool state)
@@ -668,9 +549,16 @@ void hp_taco_device::set_error(bool state)
LOG_0(("error = %d\n" , state));
}
+bool hp_taco_device::is_braking(void) const
+{
+ return m_cmd_state == CMD_INVERTING || m_cmd_state == CMD_STOPPING;
+}
+
unsigned hp_taco_device::speed_to_tick_freq(void) const
{
- return m_tape_fast ? TACH_FREQ_FAST * TAPE_POS_FRACT : TACH_FREQ_SLOW * TAPE_POS_FRACT;
+ return is_braking() ?
+ (m_tape_fast ? TACH_FREQ_BRAKE_FAST * TAPE_POS_FRACT : TACH_FREQ_BRAKE_SLOW * TAPE_POS_FRACT) :
+ (m_tape_fast ? TACH_FREQ_FAST * TAPE_POS_FRACT : TACH_FREQ_SLOW * TAPE_POS_FRACT);
}
bool hp_taco_device::pos_offset(tape_pos_t& pos , tape_pos_t offset) const
@@ -697,47 +585,81 @@ bool hp_taco_device::pos_offset(tape_pos_t& pos , tape_pos_t offset) const
}
}
-void hp_taco_device::move_tape_pos(tape_pos_t delta_pos)
+hp_taco_device::tape_pos_t hp_taco_device::current_tape_pos(void) const
{
- tape_pos_t tape_start_pos = m_tape_pos;
- if (!pos_offset(m_tape_pos , delta_pos)) {
- LOG(("Tape unspooled!\n"));
- }
- m_start_time = machine().time();
- LOG_0(("Tape pos = %u\n" , m_tape_pos));
- if (any_hole(tape_start_pos , m_tape_pos)) {
- // Crossed one or more holes
- BIT_SET(m_status_reg , STATUS_HOLE_BIT);
- }
+ if (m_start_time.is_never()) {
+ // Tape not moving
+ return m_tape_pos;
+ }
+
+ attotime delta_time(machine().time() - m_start_time);
+ LOG_0(("delta_time = %g\n" , delta_time.as_double()));
+ // How many tachometer ticks has the tape moved?
+ tape_pos_t delta_tach = (tape_pos_t)(delta_time.as_ticks(speed_to_tick_freq()));
+ LOG_0(("delta_tach = %u\n" , delta_tach));
+
+ tape_pos_t tape_pos = m_tape_pos;
+ if (!pos_offset(tape_pos , delta_tach)) {
+ LOG(("Tape unspooled!\n"));
+ }
+
+ return tape_pos;
}
void hp_taco_device::update_tape_pos(void)
{
- if (m_start_time.is_never()) {
- // Tape not moving
- return;
- }
+ if (m_start_time.is_never()) {
+ // Tape not moving
+ return;
+ }
+
+ m_tape_pos = current_tape_pos();
+ m_start_time = machine().time();
+ LOG_0(("Tape pos = %u\n" , m_tape_pos));
+
+ // Gap detection
+ bool gap_detected = false;
+ if (m_gap_detect_start != NULL_TAPE_POS && abs(m_gap_detect_start - m_tape_pos) >= min_gap_size()) {
+ tape_pos_t tmp = m_tape_pos;
+ pos_offset(tmp , -min_gap_size());
+ gap_detected = just_gap(tmp , m_tape_pos);
+ }
+ if (gap_detected) {
+ BIT_SET(m_status_reg, STATUS_GAP_BIT);
+ } else {
+ BIT_CLR(m_status_reg, STATUS_GAP_BIT);
+ }
+ // Tach register update
+ update_tach_reg();
+}
- attotime delta_time(machine().time() - m_start_time);
- LOG_0(("delta_time = %g\n" , delta_time.as_double()));
- // How many tachometer ticks has the tape moved?
- tape_pos_t delta_tach = (tape_pos_t)(delta_time.as_ticks(speed_to_tick_freq()));
- LOG_0(("delta_tach = %u\n" , delta_tach));
+void hp_taco_device::update_tach_reg(void)
+{
+ if (m_tach_reg_frozen) {
+ LOG_0(("Tach reg frozen\n"));
+ return;
+ }
- move_tape_pos(delta_tach);
+ tape_pos_t pos = current_tape_pos();
+ tape_pos_t pos_int = pos / TAPE_POS_FRACT;
+ tape_pos_t ref_int = m_tach_reg_ref / TAPE_POS_FRACT;
+ UINT16 reg_value = (UINT16)(abs(pos_int - ref_int) + m_tach_reg);
+
+ LOG_0(("Tach = %04x @ pos = %d, ref_pos = %d\n" , reg_value , pos , m_tach_reg_ref));
+
+ m_tach_reg = reg_value;
+ m_tach_reg_ref = pos;
+}
+
+void hp_taco_device::freeze_tach_reg(bool freeze)
+{
+ if (freeze) {
+ m_tach_reg_frozen = true;
+ } else {
+ m_tach_reg_frozen = false;
+ m_tach_reg_ref = current_tape_pos();
+ }
- // Gap detection
- bool gap_detected = false;
- if (m_gap_detect_start != NULL_TAPE_POS && abs(m_gap_detect_start - m_tape_pos) >= MIN_IRG_LENGTH) {
- tape_pos_t tmp = m_tape_pos;
- pos_offset(tmp , -MIN_IRG_LENGTH);
- gap_detected = just_gap(tmp , m_tape_pos);
- }
- if (gap_detected) {
- BIT_SET(m_status_reg, STATUS_GAP_BIT);
- } else {
- BIT_CLR(m_status_reg, STATUS_GAP_BIT);
- }
}
void hp_taco_device::ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b)
@@ -751,20 +673,6 @@ void hp_taco_device::ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b)
}
}
-// Is there any hole in a given section of tape?
-bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b)
-{
- ensure_a_lt_b(tape_pos_a , tape_pos_b);
-
- for (tape_pos_t hole : tape_holes) {
- if (tape_pos_a < hole && tape_pos_b >= hole) {
- return true;
- }
- }
-
- return false;
-}
-
// Position of next hole tape will reach in a given direction
hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const
{
@@ -800,43 +708,64 @@ attotime hp_taco_device::time_to_target(tape_pos_t target) const
return time_to_distance(abs(target - m_tape_pos));
}
-bool hp_taco_device::start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0)
+attotime hp_taco_device::time_to_stopping_pos(void) const
{
- m_cmd_reg = cmd_reg;
-
- UINT16 to_be_tested = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
- // Bits in STATUS_ERR_MASK must always be 0
- must_be_0 |= STATUS_ERR_MASK;
+ return time_to_distance(m_tape_fast ? FAST_BRAKE_DIST : SLOW_BRAKE_DIST);
+}
- // It's not an error if the error state is already set (sts false)
- if (((to_be_tested & (must_be_1 | must_be_0)) ^ must_be_1) != 0) {
- set_error(true);
- return false;
- } else {
- bool prev_tape_wr = m_tape_wr;
- bool prev_tape_fwd = m_tape_fwd;
- bool prev_tape_fast = m_tape_fast;
- bool not_moving = m_start_time.is_never();
-
- m_start_time = machine().time();
- m_tape_wr = (must_be_0 & STATUS_WPR_MASK) != 0;
- m_tape_fwd = DIR_FWD(m_cmd_reg);
- m_tape_fast = SPEED_FAST(m_cmd_reg);
- // TODO: remove?
- BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
-
- if (m_tape_wr) {
- // Write command: disable gap detector
- m_gap_detect_start = NULL_TAPE_POS;
- BIT_CLR(m_status_reg, STATUS_GAP_BIT);
- m_image_dirty = true;
- } else if (not_moving || prev_tape_wr != m_tape_wr || prev_tape_fwd != m_tape_fwd || prev_tape_fast != m_tape_fast) {
- // Tape started right now, switched from writing to reading, direction changed or speed changed: (re)start gap detector
- m_gap_detect_start = m_tape_pos;
- BIT_CLR(m_status_reg, STATUS_GAP_BIT);
- }
- return true;
- }
+bool hp_taco_device::start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0)
+{
+ m_cmd_reg = cmd_reg;
+
+ UINT16 to_be_tested = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK);
+ // Bits in STATUS_ERR_MASK must always be 0
+ must_be_0 |= STATUS_ERR_MASK;
+
+ // It's not an error if the error state is already set (sts false)
+ if (((to_be_tested & (must_be_1 | must_be_0)) ^ must_be_1) != 0) {
+ return false;
+ } else {
+ bool prev_tape_wr = m_tape_wr;
+ bool prev_tape_fwd = m_tape_fwd;
+ bool prev_tape_fast = m_tape_fast;
+ bool prev_tape_braking = is_braking();
+ bool not_moving = m_start_time.is_never();
+
+ m_start_time = machine().time();
+ m_tape_wr = (must_be_0 & STATUS_WPR_MASK) != 0;
+ m_tape_fwd = DIR_FWD(m_cmd_reg);
+ m_tape_fast = SPEED_FAST(m_cmd_reg);
+ // TODO: remove?
+ BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
+
+ if (m_tape_wr) {
+ // Write command: disable gap detector
+ m_gap_detect_start = NULL_TAPE_POS;
+ BIT_CLR(m_status_reg, STATUS_GAP_BIT);
+ m_image_dirty = true;
+ } else if (not_moving || prev_tape_braking || prev_tape_wr != m_tape_wr || prev_tape_fwd != m_tape_fwd || prev_tape_fast != m_tape_fast) {
+ // Tape started or re-started right now, switched from writing to reading, direction changed or speed changed: (re)start gap detector
+ m_gap_detect_start = m_tape_pos;
+ BIT_CLR(m_status_reg, STATUS_GAP_BIT);
+ }
+
+ if (!not_moving && !prev_tape_braking && prev_tape_fwd != m_tape_fwd) {
+ // Tape direction inverted, stop tape before executing command
+ m_tape_fwd = prev_tape_fwd;
+ m_tape_fast = prev_tape_fast;
+ m_cmd_state = CMD_INVERTING;
+ LOG_0(("Direction reversed! fwd = %d fast = %d\n" , m_tape_fwd , m_tape_fast));
+ m_tape_timer->adjust(time_to_stopping_pos());
+ } else {
+ // No change in direction, immediate execution
+ m_cmd_state = CMD_PH0;
+ m_tape_timer->adjust(attotime::zero);
+ }
+
+ m_hole_timer->reset();
+
+ return true;
+ }
}
void hp_taco_device::stop_tape(void)
@@ -980,19 +909,23 @@ hp_taco_device::adv_res_t hp_taco_device::adv_it(tape_track_t::iterator& it)
attotime hp_taco_device::fetch_next_wr_word(void)
{
- if (m_data_reg_full) {
- m_next_word = m_data_reg;
- m_data_reg_full = false;
- LOG_0(("next %04x (DR)\n" , m_next_word));
- } else {
- // When data register is empty, write checksum word
- m_next_word = m_checksum_reg;
- LOG_0(("next %04x (CS)\n" , m_next_word));
- }
- // Update checksum with new word
- m_checksum_reg += m_next_word;
-
- return time_to_distance(word_length(m_next_word));
+ if (m_data_reg_full) {
+ m_next_word = m_data_reg;
+ m_data_reg_full = false;
+ LOG_0(("next %04x (DR)\n" , m_next_word));
+ } else {
+ // When data register is empty, write checksum word
+ m_next_word = m_checksum_reg;
+ LOG_0(("next %04x (CS)\n" , m_next_word));
+ }
+ if (m_clear_checksum_reg) {
+ m_checksum_reg = 0;
+ m_clear_checksum_reg = false;
+ }
+ // Update checksum with new word
+ m_checksum_reg += m_next_word;
+
+ return time_to_distance(word_length(m_next_word));
}
attotime hp_taco_device::time_to_rd_next_word(tape_pos_t& word_rd_pos)
@@ -1005,6 +938,11 @@ attotime hp_taco_device::time_to_rd_next_word(tape_pos_t& word_rd_pos)
}
}
+hp_taco_device::tape_pos_t hp_taco_device::min_gap_size(void) const
+{
+ return LONG_GAP(m_cmd_reg) ? LONG_GAP_LENGTH : SHORT_GAP_LENGTH;
+}
+
/**
* Scan for next "n_gaps" gaps
*
@@ -1216,213 +1154,500 @@ attotime hp_taco_device::time_to_tach_pulses(void) const
return time_to_distance((tape_pos_t)(0x10000U - m_tach_reg) * TAPE_POS_FRACT);
}
-void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg)
+void hp_taco_device::terminate_cmd_now(void)
{
- LOG(("Cmd = %02x\n" , CMD_CODE(new_cmd_reg)));
-
- update_tape_pos();
-
- attotime cmd_duration = attotime::never;
- attotime time_to_hole = attotime::never;
-
- unsigned new_cmd_code = CMD_CODE(new_cmd_reg);
-
- if (new_cmd_code != CMD_START_READ &&
- new_cmd_code != CMD_END_READ &&
- new_cmd_code != CMD_CLEAR) {
- m_rd_it_valid = false;
- }
-
- switch (new_cmd_code) {
- case CMD_INDTA_INGAP:
- // Errors: CART OUT,FAST SPEED
- if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- m_cmd_state = 0;
- if (next_data(m_rd_it , m_tape_pos , true)) {
- cmd_duration = time_to_target(farthest_end(m_rd_it));
- }
- }
- break;
-
- case CMD_FINAL_GAP:
- // Errors: WP,CART OUT
- if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) {
- m_rw_pos = m_tape_pos;
- cmd_duration = time_to_distance(END_GAP_LENGTH);
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_CLEAR:
- set_error(false);
- BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
- BIT_CLR(m_status_reg, STATUS_CART_OUT_BIT);
- BIT_CLR(m_status_reg, STATUS_WPR_BIT);
- set_tape_present(is_loaded());
- // This is a special command: it doesn't raise IRQ at completion and it
- // doesn't replace current command
- return;
-
- case CMD_NOT_INDTA:
- // Errors: CART OUT,FAST SPEED
- if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- tape_pos_t target = m_tape_pos;
- if (next_n_gap(target, 1, NO_DATA_GAP)) {
- LOG_0(("End of data @%d\n" , target));
- cmd_duration = time_to_target(target);
- }
- // Holes detected?
- }
- break;
-
- case CMD_INIT_WRITE:
- // Errors: WP,CART OUT,fast speed,reverse
- if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) {
- m_next_word = PREAMBLE_WORD;
- m_rw_pos = m_tape_pos;
- cmd_duration = time_to_distance(word_length(m_next_word));
- }
- break;
-
- case CMD_STOP:
- if (CMD_CODE(m_cmd_reg) != CMD_STOP) {
- if (m_start_time.is_never()) {
- // Tape is already stopped
- cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
- } else {
- // Start braking timer
- cmd_duration = attotime::from_msec(m_tape_fast ? FAST_BRAKE_MSEC : SLOW_BRAKE_MSEC);
- }
- m_cmd_reg = new_cmd_reg;
- } else {
- // TODO: check if ok
- return;
- }
- break;
-
- case CMD_SET_TRACK:
- // Don't know if this command really starts the tape or not (probably it doesn't)
- if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
- // When b9 is 0, set track A/B
- // When b9 is 1, ignore command (in TACO chip it has an unknown purpose)
- if (!UNKNOWN_B9(new_cmd_reg)) {
- if (CMD_OPT(new_cmd_reg)) {
- BIT_SET(m_status_reg, STATUS_TRACKB_BIT);
- } else {
- BIT_CLR(m_status_reg, STATUS_TRACKB_BIT);
- }
- }
- cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
- }
- break;
-
- case CMD_MOVE:
- if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_INGAP_MOVE:
- // Errors: CART OUT,FAST SPEED
- if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- m_cmd_state = 0;
- tape_pos_t target = m_tape_pos;
- if (next_n_gap(target, 1, MIN_IRG_LENGTH)) {
- LOG_0(("IRG @%d\n" , target));
- cmd_duration = time_to_target(target);
- }
- // Holes detected?
- }
- break;
-
- case CMD_WRITE_IRG:
- // Errors: WP,CART OUT
- if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) {
- m_rw_pos = m_tape_pos;
- cmd_duration = time_to_tach_pulses();
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_SCAN_RECORDS:
- // Errors: CART OUT
- if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
- m_cmd_state = 0;
- if (next_data(m_rd_it , m_tape_pos , true)) {
- cmd_duration = time_to_target(farthest_end(m_rd_it));
- }
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_RECORD_WRITE:
- // Errors: WP,CART OUT,fast speed,reverse
- if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) {
- // Search for preamble first
- m_cmd_state = 0;
- m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
- cmd_duration = time_to_rd_next_word(m_rw_pos);
- // Holes detected?
- }
- break;
-
- case CMD_MOVE_INDTA:
- // Errors: CART OUT,FAST SPEED
- if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- m_cmd_state = 0;
- cmd_duration = time_to_tach_pulses();
- // Holes detected?
- }
- break;
-
- case CMD_UNK_1b:
- if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
- // Unknown purpose, but make it a NOP (it's used in "T" test of test ROM)
- cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
- }
- break;
-
- case CMD_DELTA_MOVE_HOLE:
- case CMD_DELTA_MOVE_IRG:
- if (start_tape_cmd(new_cmd_reg , 0 , 0)) {
- cmd_duration = time_to_tach_pulses();
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_START_READ:
- // Yes, you can read tape backwards: test "C" does that!
- // Because of this DIR_FWD_MASK is not in the "must be 1" mask.
- if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- // TODO: check anche m_rw_pos sforato
- if (!m_rd_it_valid) {
- // Search for preamble first
- m_cmd_state = 0;
- m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
- }
-
- cmd_duration = time_to_rd_next_word(m_rw_pos);
- time_to_hole = time_to_next_hole();
- }
- break;
-
- case CMD_END_READ:
- // This command only makes sense after CMD_START_READ
- if (CMD_CODE(m_cmd_reg) == CMD_START_READ && m_cmd_state == 1 &&
- start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) {
- LOG_0(("END_READ %d\n" , m_rd_it_valid));
- cmd_duration = time_to_rd_next_word(m_rw_pos);
- time_to_hole = time_to_next_hole();
- }
- break;
+ m_cmd_state = CMD_END;
+ m_tape_timer->adjust(attotime::zero);
+ m_hole_timer->reset();
+}
- default:
- LOG(("Unrecognized command\n"));
- break;
- }
+void hp_taco_device::cmd_fsm(void)
+{
+ if (m_cmd_state == CMD_END) {
+ // Command ended
+ m_cmd_state = CMD_IDLE;
+ m_hole_timer->reset();
+ irq_w(true);
+ if (AUTO_STOP(m_cmd_reg)) {
+ // Automatic stop after command execution
+ LOG_0(("Tape clamped\n"));
+ m_cmd_state = CMD_STOPPING;
+ m_tape_timer->adjust(time_to_stopping_pos());
+ }
+ } else if (m_cmd_state == CMD_STOPPING) {
+ // Braking phase ended
+ m_cmd_state = CMD_IDLE;
+ stop_tape();
+ if (CMD_CODE(m_cmd_reg) == CMD_STOP) {
+ irq_w(true);
+ }
+ } else {
+ attotime cmd_duration = attotime::never;
+
+ if (m_cmd_state == CMD_INVERTING) {
+ m_tape_fwd = DIR_FWD(m_cmd_reg);
+ m_tape_fast = SPEED_FAST(m_cmd_reg);
+ m_cmd_state = CMD_PH0;
+ }
+
+ if (m_cmd_state == CMD_PH0) {
+ m_hole_timer->adjust(time_to_next_hole());
+ }
+
+ switch (CMD_CODE(m_cmd_reg)) {
+ case CMD_INDTA_INGAP:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ if (next_data(m_rd_it , m_tape_pos , true)) {
+ cmd_duration = time_to_target(farthest_end(m_rd_it));
+ }
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ tape_pos_t target = m_tape_pos;
+ if (next_n_gap(target, 1, min_gap_size())) {
+ cmd_duration = time_to_target(target);
+ }
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_FINAL_GAP:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ m_rw_pos = m_tape_pos;
+ cmd_duration = time_to_distance(END_GAP_LENGTH);
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ write_gap(m_rw_pos , m_tape_pos);
+ cmd_duration = attotime::zero;
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_RECORD_WRITE:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ // Search for preamble first
+ m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
+ cmd_duration = time_to_rd_next_word(m_rw_pos);
+ m_cmd_state = CMD_PH1;
+ break;
+ } else if (m_cmd_state == CMD_PH1) {
+ // PH1
+ if (m_rd_it->second == PREAMBLE_WORD) {
+ LOG_0(("Got preamble\n"));
+ m_cmd_state = CMD_PH2;
+ // m_rw_pos already at correct position
+ cmd_duration = fetch_next_wr_word();
+ irq_w(true);
+ } else {
+ adv_res_t res = adv_it(m_rd_it);
+ if (res != ADV_NO_MORE_DATA) {
+ cmd_duration = time_to_rd_next_word(m_rw_pos);
+ }
+ }
+ break;
+ }
+ // Intentional fall-through on PH2
+
+ case CMD_INIT_WRITE:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ m_next_word = PREAMBLE_WORD;
+ m_rw_pos = m_tape_pos;
+ cmd_duration = time_to_distance(word_length(m_next_word));
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1 & PH2 of CMD_RECORD_WRITE
+ tape_pos_t length;
+ write_word(m_rw_pos , m_next_word , length);
+ pos_offset(m_rw_pos , length);
+ // Just to be sure..
+ m_tape_pos = m_rw_pos;
+ cmd_duration = fetch_next_wr_word();
+ irq_w(true);
+ }
+ break;
+
+ case CMD_SET_TRACK:
+ // PH0
+ // When b9 is 0, set track A/B
+ // When b9 is 1, ignore command (in TACO chip it has an unknown purpose)
+ if (!AUTO_STOP(m_cmd_reg)) {
+ if (CMD_OPT(m_cmd_reg)) {
+ BIT_SET(m_status_reg, STATUS_TRACKB_BIT);
+ } else {
+ BIT_CLR(m_status_reg, STATUS_TRACKB_BIT);
+ }
+ }
+ cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
+ m_hole_timer->reset();
+ m_cmd_state = CMD_END;
+ break;
+
+ case CMD_MOVE:
+ // PH0
+ // Endless movement: not setting cmd_duration
+ m_cmd_state = CMD_END;
+ break;
+
+ case CMD_INGAP_MOVE:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ tape_pos_t target = m_tape_pos;
+ if (next_n_gap(target, 1, min_gap_size())) {
+ LOG_0(("IRG @%d\n" , target));
+ cmd_duration = time_to_target(target);
+ }
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ cmd_duration = time_to_tach_pulses();
+ freeze_tach_reg(false);
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_NOT_INDTA:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ if (next_data(m_rd_it , m_tape_pos , true)) {
+ cmd_duration = time_to_target(farthest_end(m_rd_it));
+ }
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ tape_pos_t target = m_tape_pos;
+ if (next_n_gap(target, 1, NO_DATA_GAP)) {
+ LOG_0(("End of data @%d\n" , target));
+ cmd_duration = time_to_target(target);
+ }
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_WRITE_IRG:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ freeze_tach_reg(false);
+ m_rw_pos = m_tape_pos;
+ cmd_duration = time_to_tach_pulses();
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ write_gap(m_rw_pos , m_tape_pos);
+ cmd_duration = attotime::zero;
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_SCAN_RECORDS:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ if (next_data(m_rd_it , m_tape_pos , true)) {
+ cmd_duration = time_to_target(farthest_end(m_rd_it));
+ }
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ tape_pos_t target = m_tape_pos;
+ // b8 seems to select size of gaps
+ // Tach. register is incremented at each gap. Command ends when this register goes positive (b15 = 0).
+ unsigned n_gaps;
+ if (BIT(m_tach_reg , 15)) {
+ n_gaps = 0x10000U - m_tach_reg;
+ m_tach_reg = 0;
+ } else {
+ n_gaps = 1;
+ m_tach_reg++;
+ }
+ if (next_n_gap(target, n_gaps, min_gap_size())) {
+ LOG_0(("%u gaps @%d\n" , n_gaps, target));
+ cmd_duration = time_to_target(target);
+ }
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_MOVE_INDTA:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ freeze_tach_reg(false);
+ cmd_duration = time_to_tach_pulses();
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ if (next_data(m_rd_it , m_tape_pos , true)) {
+ cmd_duration = time_to_target(farthest_end(m_rd_it));
+ }
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_UNK_1b:
+ // PH0
+ // Unknown purpose, but make it a NOP (it's used in "T" test of test ROM)
+ cmd_duration = attotime::from_usec(QUICK_CMD_USEC);
+ m_cmd_state = CMD_END;
+ break;
+
+ case CMD_MOVE_INGAP:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ freeze_tach_reg(false);
+ cmd_duration = time_to_tach_pulses();
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ tape_pos_t target = m_tape_pos;
+ if (next_n_gap(target, 1, min_gap_size())) {
+ LOG_0(("GAP @%d\n" , target));
+ cmd_duration = time_to_target(target);
+ }
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ case CMD_START_READ:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ // Should also check if tape position has gone too far to read word @ m_rd_it
+ if (!m_rd_it_valid) {
+ // Search for preamble first
+ m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false);
+ m_cmd_state = CMD_PH1;
+ } else {
+ // Resume reading from last position, skip preamble search
+ m_cmd_state = CMD_PH2;
+ }
+
+ cmd_duration = time_to_rd_next_word(m_rw_pos);
+ } else {
+ // Just to be sure..
+ m_tape_pos = m_rw_pos;
+
+ if (m_cmd_state == CMD_PH3) {
+ // PH3: delayed setting of error condition
+ set_error(true);
+ m_cmd_state = CMD_PH2;
+ }
+
+ if (m_cmd_state == CMD_PH1) {
+ // PH1
+ // Any word with at least a 0 will do as preamble.
+ // But anything that's not the correct preamble word (0) will cause a wrong alignment
+ // with word boundaries. TACO will read garbage data in this case (this effect is not simulated here).
+ if (m_rd_it->second != 0xffff) {
+ m_cmd_state = CMD_PH2;
+ LOG_0(("Got preamble %04x\n" , m_rd_it->second));
+ }
+ } else {
+ // PH2
+ irq_w(true);
+ m_data_reg = m_rd_it->second;
+ if (m_clear_checksum_reg) {
+ m_checksum_reg = 0;
+ m_clear_checksum_reg = false;
+ }
+ m_checksum_reg += m_data_reg;
+ LOG_0(("RD %04x\n" , m_data_reg));
+ }
+ adv_res_t res = adv_it(m_rd_it);
+ LOG_0(("adv_it %d\n" , res));
+ if (res == ADV_NO_MORE_DATA) {
+ m_rd_it_valid = false;
+ } else {
+ cmd_duration = time_to_rd_next_word(m_rw_pos);
+ if (res == ADV_DISCONT_DATA) {
+ // Wild guess: TACO sets error flag when it stumbles on a gap between words
+ if (m_cmd_state == CMD_PH2 && abs(m_tape_pos - m_rw_pos) > ((tape_pos_t)(0.25 * ONE_INCH_POS))) {
+ m_cmd_state = CMD_PH3;
+ } else {
+ // Hit a gap, restart preamble search
+ // TODO: is this ok?
+ m_cmd_state = CMD_PH1;
+ }
+ }
+ }
+ }
+ break;
+
+ case CMD_DELTA_MOVE_IRG:
+ // PH0
+ freeze_tach_reg(false);
+ cmd_duration = time_to_tach_pulses();
+ m_cmd_state = CMD_END;
+ break;
+
+ case CMD_END_READ:
+ if (m_cmd_state == CMD_PH0) {
+ // PH0
+ cmd_duration = time_to_rd_next_word(m_rw_pos);
+ m_cmd_state = CMD_PH1;
+ } else {
+ // PH1
+ m_tape_pos = m_rw_pos;
+ // Note: checksum is not updated
+ m_data_reg = m_rd_it->second;
+ LOG_0(("Final RD %04x\n" , m_data_reg));
+ adv_res_t res = adv_it(m_rd_it);
+ if (res == ADV_NO_MORE_DATA) {
+ m_rd_it_valid = false;
+ }
+ cmd_duration = attotime::zero;
+ m_cmd_state = CMD_END;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ m_tape_timer->adjust(cmd_duration);
+ }
+}
- m_tape_timer->adjust(cmd_duration);
- m_hole_timer->adjust(time_to_hole);
+void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg)
+{
+ LOG_0(("New cmd %02x @ %g cmd %02x st %d\n" , CMD_CODE(new_cmd_reg) , machine().time().as_double() , CMD_CODE(m_cmd_reg) , m_cmd_state));
+
+ update_tape_pos();
+
+ unsigned new_cmd_code = CMD_CODE(new_cmd_reg);
+
+ if (new_cmd_code != CMD_START_READ &&
+ new_cmd_code != CMD_END_READ &&
+ new_cmd_code != CMD_CLEAR) {
+ m_rd_it_valid = false;
+ }
+
+ bool started = false;
+
+ switch (new_cmd_code) {
+ case CMD_INDTA_INGAP:
+ // Errors: CART OUT,FAST SPEED
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ break;
+
+ case CMD_FINAL_GAP:
+ // Errors: WP,CART OUT
+ started = start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK);
+ break;
+
+ case CMD_INIT_WRITE:
+ // Errors: WP,CART OUT,fast speed,reverse
+ started = start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK);
+ break;
+
+ case CMD_STOP:
+ m_cmd_reg = new_cmd_reg;
+ freeze_tach_reg(false);
+ m_hole_timer->reset();
+ if (m_cmd_state == CMD_INVERTING || m_cmd_state == CMD_STOPPING) {
+ // Already braking
+ // m_tape_timer already set
+ } else if (m_start_time.is_never()) {
+ // Tape is already stopped
+ LOG_0(("Already stopped\n"));
+ m_tape_timer->adjust(attotime::from_usec(QUICK_CMD_USEC));
+ } else {
+ // Start braking timer
+ m_cmd_state = CMD_STOPPING;
+ m_tape_timer->adjust(time_to_stopping_pos());
+ }
+ m_cmd_state = CMD_STOPPING;
+ return;
+
+ case CMD_SET_TRACK:
+ // Don't know if this command really starts the tape or not (probably it doesn't)
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_MOVE:
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_INGAP_MOVE:
+ // Errors: CART OUT,FAST SPEED
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ break;
+
+ case CMD_CLEAR:
+ set_error(false);
+ BIT_CLR(m_status_reg, STATUS_HOLE_BIT);
+ BIT_CLR(m_status_reg, STATUS_CART_OUT_BIT);
+ BIT_CLR(m_status_reg, STATUS_WPR_BIT);
+ set_tape_present(is_loaded());
+ // This is a special command: it doesn't raise IRQ at completion and it
+ // doesn't replace current command
+ return;
+
+ case CMD_NOT_INDTA:
+ // Errors: CART OUT,FAST SPEED
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ break;
+
+ case CMD_WRITE_IRG:
+ // Errors: WP,CART OUT
+ started = start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK);
+ break;
+
+ case CMD_SCAN_RECORDS:
+ // Errors: CART OUT
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_RECORD_WRITE:
+ // Errors: WP,CART OUT,fast speed,reverse
+ started = start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK);
+ break;
+
+ case CMD_MOVE_INDTA:
+ // Errors: CART OUT,FAST SPEED
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ break;
+
+ case CMD_UNK_1b:
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_MOVE_INGAP:
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_START_READ:
+ // Yes, you can read tape backwards: test "C" does that!
+ // Because of this DIR_FWD_MASK is not in the "must be 1" mask.
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ break;
+
+ case CMD_DELTA_MOVE_IRG:
+ started = start_tape_cmd(new_cmd_reg , 0 , 0);
+ break;
+
+ case CMD_END_READ:
+ // This command only makes sense after CMD_START_READ
+ if (CMD_CODE(m_cmd_reg) == CMD_START_READ &&
+ (m_cmd_state == CMD_PH2 || m_cmd_state == CMD_PH3)) {
+ started = start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK);
+ LOG_0(("END_READ %d\n" , m_rd_it_valid));
+ }
+ break;
+
+ default:
+ LOG(("Unrecognized command\n"));
+ started = false;
+ break;
+ }
+
+ if (!started) {
+ set_error(true);
+ m_cmd_state = CMD_IDLE;
+ m_tape_timer->reset();
+ m_hole_timer->reset();
+ }
}
bool hp_taco_device::call_load()
@@ -1461,6 +1686,42 @@ void hp_taco_device::call_unload()
set_tape_present(false);
}
+void hp_taco_device::call_display()
+{
+ // Mostly lifted from cassette_image_device::call_display ;)
+
+ // Do not show anything if image not loaded or tape not moving
+ if (!exists() || m_start_time.is_never()) {
+ return;
+ }
+
+ char buffer[ 64 ];
+
+ char track = BIT(m_status_reg , STATUS_TRACKB_BIT) ? 'B' : 'A';
+ char r_w = m_tape_wr ? 'W' : 'R';
+ char m1;
+ char m2;
+
+ if (m_tape_fwd) {
+ m1 = '>';
+ m2 = m_tape_fast ? '>' : ' ';
+ } else {
+ m1 = '<';
+ m2 = m_tape_fast ? '<' : ' ';
+ }
+
+ int pos_in = current_tape_pos() / ONE_INCH_POS;
+
+ snprintf(buffer , sizeof(buffer) , "%c %c %c%c [%04d/1824]" , track , r_w , m1 , m2 , pos_in);
+
+ float x, y;
+ x = 0.2f;
+ y = 0.5f;
+ y *= device().machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
+
+ device().machine().ui().draw_text_box(&device().machine().render().ui_container(), buffer, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR);
+}
+
const char *hp_taco_device::file_extensions() const
{
return "hti";
diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h
index 1695b7ce706..288b1db3218 100644
--- a/src/devices/machine/hp_taco.h
+++ b/src/devices/machine/hp_taco.h
@@ -47,6 +47,7 @@ public:
virtual bool call_load() override;
virtual bool call_create(int format_type, option_resolution *format_options) override;
virtual void call_unload() override;
+ virtual void call_display() override;
virtual iodevice_t image_type() const override { return IO_MAGTAPE; }
virtual bool is_readable() const override { return true; }
virtual bool is_writeable() const override { return true; }
@@ -71,96 +72,116 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
- // Storage of tracks: mapping from a tape position to word stored there
- typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
-
- devcb_write_line m_irq_handler;
- devcb_write_line m_flg_handler;
- devcb_write_line m_sts_handler;
-
- // Registers
- UINT16 m_data_reg;
- bool m_data_reg_full;
- UINT16 m_cmd_reg;
- UINT16 m_status_reg;
- UINT16 m_tach_reg;
- UINT16 m_checksum_reg;
- UINT16 m_timing_reg;
-
- // State
- bool m_irq;
- bool m_flg;
- bool m_sts;
- UINT8 m_cmd_state;
-
- // Tape position & motion
- tape_pos_t m_tape_pos;
- attotime m_start_time; // Tape moving if != never
- bool m_tape_fwd;
- bool m_tape_fast;
-
- // Timers
- emu_timer *m_tape_timer;
- emu_timer *m_hole_timer;
-
- // Content of tape tracks
- tape_track_t m_tracks[ 2 ];
- bool m_image_dirty;
-
- // Reading & writing
- bool m_tape_wr;
- tape_pos_t m_rw_pos;
- UINT16 m_next_word;
- tape_track_t::iterator m_rd_it;
- bool m_rd_it_valid;
-
- // Gap detection
- tape_pos_t m_gap_detect_start;
-
- typedef enum {
- ADV_NO_MORE_DATA,
- ADV_CONT_DATA,
- ADV_DISCONT_DATA
- } adv_res_t;
-
- void clear_state(void);
- void irq_w(bool state);
- void set_error(bool state);
- unsigned speed_to_tick_freq(void) const;
- bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
- void move_tape_pos(tape_pos_t delta_pos);
- void update_tape_pos(void);
- static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b);
- static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b);
- tape_pos_t next_hole(void) const;
- attotime time_to_distance(tape_pos_t distance) const;
- attotime time_to_target(tape_pos_t target) const;
- bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0);
- void start_tape(UINT16 cmd_reg);
- void stop_tape(void);
- tape_track_t& current_track(void);
- static tape_pos_t word_length(tape_word_t w);
- static tape_pos_t word_end_pos(const tape_track_t::iterator& it);
- static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos);
- void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length);
- void write_gap(tape_pos_t a , tape_pos_t b);
- bool just_gap(tape_pos_t a , tape_pos_t b);
- tape_pos_t farthest_end(const tape_track_t::iterator& it) const;
- bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive);
- adv_res_t adv_it(tape_track_t::iterator& it);
- attotime fetch_next_wr_word(void);
- attotime time_to_rd_next_word(tape_pos_t& word_rd_pos);
- bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap);
- bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap);
- void clear_tape(void);
- void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
- void save_tape(void);
- bool load_track(tape_track_t& track);
- bool load_tape(void);
- void set_tape_present(bool present);
- attotime time_to_next_hole(void) const;
- attotime time_to_tach_pulses(void) const;
- void start_cmd_exec(UINT16 new_cmd_reg);
+ // Storage of tracks: mapping from a tape position to word stored there
+ typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
+
+ devcb_write_line m_irq_handler;
+ devcb_write_line m_flg_handler;
+ devcb_write_line m_sts_handler;
+
+ // Registers
+ UINT16 m_data_reg;
+ bool m_data_reg_full;
+ UINT16 m_cmd_reg;
+ UINT16 m_status_reg;
+ UINT16 m_tach_reg;
+ tape_pos_t m_tach_reg_ref;
+ bool m_tach_reg_frozen;
+ UINT16 m_checksum_reg;
+ bool m_clear_checksum_reg;
+ UINT16 m_timing_reg;
+
+ // State
+ bool m_irq;
+ bool m_flg;
+ bool m_sts;
+
+ // Command FSM state
+ typedef enum {
+ CMD_IDLE,
+ CMD_INVERTING,
+ CMD_PH0,
+ CMD_PH1,
+ CMD_PH2,
+ CMD_PH3,
+ CMD_END,
+ CMD_STOPPING
+ } cmd_state_t;
+ cmd_state_t m_cmd_state;
+
+ // Tape position & motion
+ tape_pos_t m_tape_pos;
+ attotime m_start_time; // Tape moving if != never
+ bool m_tape_fwd;
+ bool m_tape_fast;
+
+ // Timers
+ emu_timer *m_tape_timer;
+ emu_timer *m_hole_timer;
+
+ // Content of tape tracks
+ tape_track_t m_tracks[ 2 ];
+ bool m_image_dirty;
+
+ // Reading & writing
+ bool m_tape_wr;
+ tape_pos_t m_rw_pos;
+ UINT16 m_next_word;
+ tape_track_t::iterator m_rd_it;
+ bool m_rd_it_valid;
+
+ // Gap detection
+ tape_pos_t m_gap_detect_start;
+
+ typedef enum {
+ ADV_NO_MORE_DATA,
+ ADV_CONT_DATA,
+ ADV_DISCONT_DATA
+ } adv_res_t;
+
+ void clear_state(void);
+ void irq_w(bool state);
+ void set_error(bool state);
+ bool is_braking(void) const;
+ unsigned speed_to_tick_freq(void) const;
+ bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
+ tape_pos_t current_tape_pos(void) const;
+ void update_tape_pos(void);
+ void update_tach_reg(void);
+ void freeze_tach_reg(bool freeze);
+ static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b);
+ tape_pos_t next_hole(void) const;
+ attotime time_to_distance(tape_pos_t distance) const;
+ attotime time_to_target(tape_pos_t target) const;
+ attotime time_to_stopping_pos(void) const;
+ bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0);
+ void stop_tape(void);
+ tape_track_t& current_track(void);
+ static tape_pos_t word_length(tape_word_t w);
+ static tape_pos_t word_end_pos(const tape_track_t::iterator& it);
+ static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos);
+ void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length);
+ void write_gap(tape_pos_t a , tape_pos_t b);
+ bool just_gap(tape_pos_t a , tape_pos_t b);
+ tape_pos_t farthest_end(const tape_track_t::iterator& it) const;
+ bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive);
+ adv_res_t adv_it(tape_track_t::iterator& it);
+ attotime fetch_next_wr_word(void);
+ attotime time_to_rd_next_word(tape_pos_t& word_rd_pos);
+ tape_pos_t min_gap_size(void) const;
+ bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap);
+ bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap);
+ void clear_tape(void);
+ void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
+ void save_tape(void);
+ bool load_track(tape_track_t& track);
+ bool load_tape(void);
+ void set_tape_present(bool present);
+ attotime time_to_next_hole(void) const;
+ attotime time_to_tach_pulses(void) const;
+ void terminate_cmd_now(void);
+ void cmd_fsm(void);
+ void start_cmd_exec(UINT16 new_cmd_reg);
};
// device type definition
diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp
index d77e12ef4be..ba320d1f5cd 100644
--- a/src/devices/machine/i2cmem.cpp
+++ b/src/devices/machine/i2cmem.cpp
@@ -78,6 +78,7 @@ i2cmem_device::i2cmem_device( const machine_config &mconfig, const char *tag, de
: device_t(mconfig, I2CMEM, "I2C Memory", tag, owner, clock, "i2cmem", __FILE__),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_slave_address( I2CMEM_SLAVE_ADDRESS ),
m_page_size( 0 ),
m_data_size( 0 ),
@@ -175,11 +176,11 @@ void i2cmem_device::nvram_default()
UINT16 default_value = 0xff;
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- m_addrspace[ 0 ]->write_byte( offs, default_value );
+ space(AS_PROGRAM).write_byte( offs, default_value );
}
/* populate from a memory region if present */
- if( m_region != nullptr )
+ if (m_region.found())
{
if( m_region->bytes() != i2cmem_bytes )
{
@@ -193,7 +194,7 @@ void i2cmem_device::nvram_default()
UINT8 *default_data = m_region->base();
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
- m_addrspace[ 0 ]->write_byte( offs, default_data[offs] );
+ space(AS_PROGRAM).write_byte( offs, default_data[offs] );
}
}
@@ -212,7 +213,7 @@ void i2cmem_device::nvram_read( emu_file &file )
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] );
+ space(AS_PROGRAM).write_byte( offs, buffer[ offs ] );
}
}
@@ -228,7 +229,7 @@ void i2cmem_device::nvram_write( emu_file &file )
for( offs_t offs = 0; offs < i2cmem_bytes; offs++ )
{
- buffer[ offs ] = m_addrspace[ 0 ]->read_byte( offs );
+ buffer[ offs ] = space(AS_PROGRAM).read_byte( offs );
}
file.write( &buffer[0], i2cmem_bytes );
@@ -375,7 +376,7 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
for( int i = 0; i < m_page_size; i++ )
{
- m_addrspace[ 0 ]->write_byte( offset + i, m_page[ i ] );
+ space(AS_PROGRAM).write_byte( offset + i, m_page[ i ] );
}
m_page_offset = 0;
@@ -386,7 +387,7 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
int offset = data_offset();
verboselog( this, 1, "data[ %04x ] <- %02x\n", offset, m_shift );
- m_addrspace[ 0 ]->write_byte( offset, m_shift );
+ space(AS_PROGRAM).write_byte( offset, m_shift );
m_byteaddr++;
}
@@ -419,7 +420,7 @@ WRITE_LINE_MEMBER( i2cmem_device::write_scl )
{
int offset = data_offset();
- m_shift = m_addrspace[ 0 ]->read_byte( offset );
+ m_shift = space(AS_PROGRAM).read_byte( offset );
verboselog( this, 1, "data[ %04x ] -> %02x\n", offset, m_shift );
m_byteaddr++;
}
diff --git a/src/devices/machine/i2cmem.h b/src/devices/machine/i2cmem.h
index d17d6f2f277..a45a51098e3 100644
--- a/src/devices/machine/i2cmem.h
+++ b/src/devices/machine/i2cmem.h
@@ -128,6 +128,8 @@ protected:
int select_device();
int data_offset();
+ optional_memory_region m_region;
+
// device-specific configuration
address_space_config m_space_config;
diff --git a/src/devices/machine/i6300esb.cpp b/src/devices/machine/i6300esb.cpp
index ec7ca934d31..649c437befd 100644
--- a/src/devices/machine/i6300esb.cpp
+++ b/src/devices/machine/i6300esb.cpp
@@ -90,7 +90,8 @@ i6300esb_lpc_device::i6300esb_lpc_device(const machine_config &mconfig, const ch
: pci_device(mconfig, I6300ESB_LPC, "i6300ESB southbridge ISA/LPC bridge", tag, owner, clock, "i6300esb_lpc", __FILE__),
acpi(*this, "acpi"),
rtc (*this, "rtc"),
- pit (*this, "pit")
+ pit (*this, "pit"),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/machine/i6300esb.h b/src/devices/machine/i6300esb.h
index 325e768dbba..e3f216123bc 100644
--- a/src/devices/machine/i6300esb.h
+++ b/src/devices/machine/i6300esb.h
@@ -35,6 +35,7 @@ private:
required_device<lpc_acpi_device> acpi;
required_device<lpc_rtc_device> rtc;
required_device<lpc_pit_device> pit;
+ required_memory_region m_region;
DECLARE_ADDRESS_MAP(internal_io_map, 32);
diff --git a/src/devices/machine/intelfsh.cpp b/src/devices/machine/intelfsh.cpp
index 54f9d4f722f..5f2c0a154ac 100644
--- a/src/devices/machine/intelfsh.cpp
+++ b/src/devices/machine/intelfsh.cpp
@@ -165,6 +165,7 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_type(variant),
m_size(0),
m_bits(8),
@@ -543,7 +544,7 @@ const address_space_config *intelfsh_device::memory_space_config(address_spacenu
void intelfsh_device::nvram_default()
{
// region always wins
- if (m_region != nullptr)
+ if (m_region.found())
{
UINT32 bytes = m_region->bytes();
if (bytes > m_size)
@@ -552,19 +553,19 @@ void intelfsh_device::nvram_default()
if (m_bits == 8)
{
for (offs_t offs = 0; offs < bytes; offs++)
- m_addrspace[0]->write_byte(offs, m_region->u8(offs));
+ space(AS_PROGRAM).write_byte(offs, m_region->u8(offs));
}
else
{
for (offs_t offs = 0; offs < bytes; offs += 2)
- m_addrspace[0]->write_word(offs, m_region->u16(offs / 2));
+ space(AS_PROGRAM).write_word(offs, m_region->u16(offs / 2));
}
return;
}
// otherwise, default to 0xff
for (offs_t offs = 0; offs < m_size; offs++)
- m_addrspace[0]->write_byte(offs, 0xff);
+ space(AS_PROGRAM).write_byte(offs, 0xff);
}
@@ -578,7 +579,7 @@ void intelfsh_device::nvram_read(emu_file &file)
dynamic_buffer buffer(m_size);
file.read(&buffer[0], m_size);
for (int byte = 0; byte < m_size; byte++)
- m_addrspace[0]->write_byte(byte, buffer[byte]);
+ space(AS_PROGRAM).write_byte(byte, buffer[byte]);
}
@@ -591,7 +592,7 @@ void intelfsh_device::nvram_write(emu_file &file)
{
dynamic_buffer buffer(m_size);
for (int byte = 0; byte < m_size; byte++)
- buffer[byte] = m_addrspace[0]->read_byte(byte);
+ buffer[byte] = space(AS_PROGRAM).read_byte(byte);
file.write(&buffer[0], m_size);
}
@@ -613,12 +614,12 @@ UINT32 intelfsh_device::read_full(UINT32 address)
{
case 8:
{
- data = m_addrspace[0]->read_byte(address);
+ data = space(AS_PROGRAM).read_byte(address);
}
break;
case 16:
{
- data = m_addrspace[0]->read_word(address * 2);
+ data = space(AS_PROGRAM).read_word(address * 2);
}
break;
}
@@ -692,12 +693,12 @@ UINT32 intelfsh_device::read_full(UINT32 address)
{
case 8:
{
- data = m_addrspace[0]->read_byte(address);
+ data = space(AS_PROGRAM).read_byte(address);
}
break;
case 16:
{
- data = m_addrspace[0]->read_word(address * 2);
+ data = space(AS_PROGRAM).read_word(address * 2);
}
break;
}
@@ -921,7 +922,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
{
// chip erase
for (offs_t offs = 0; offs < m_size; offs++)
- m_addrspace[0]->write_byte(offs, 0xff);
+ space(AS_PROGRAM).write_byte(offs, 0xff);
m_status = 1 << 3;
m_flash_mode = FM_ERASEAMD4;
@@ -947,14 +948,14 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
if (m_sector_is_4k)
{
for (offs_t offs = 0; offs < 4 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0xfff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0xfff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0x7ff : ~0xfff);
m_timer->adjust( attotime::from_msec( 125 ) );
}
else if(m_sector_is_16k)
{
for (offs_t offs = 0; offs < 16 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0x3fff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0x3fff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0x1fff : ~0x3fff);
m_timer->adjust( attotime::from_msec( 500 ) );
}
@@ -963,21 +964,21 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
if (address >= (m_size - (16*1024)))
{
for (offs_t offs = 0; offs < 16 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0x3fff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0x3fff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0x1fff : ~0x3fff);
m_timer->adjust( attotime::from_msec( 500 ) );
}
else if (address >= (m_size - (32*1024)))
{
for (offs_t offs = 0; offs < 8 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0x1fff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0x1fff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0xfff : ~0x1fff);
m_timer->adjust( attotime::from_msec( 250 ) );
}
else
{
for (offs_t offs = 0; offs < 32 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0x7fff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0x7fff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0x3fff : ~0x7fff);
m_timer->adjust( attotime::from_msec( 500 ) );
}
@@ -985,7 +986,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
else
{
for (offs_t offs = 0; offs < 64 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0xffff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0xffff) + offs, 0xff);
m_erase_sector = address & ((m_bits == 16) ? ~0x7fff : ~0xffff);
m_timer->adjust( attotime::from_seconds( 1 ) );
}
@@ -1003,7 +1004,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
{
case 8:
{
- m_addrspace[0]->write_byte(address, data);
+ space(AS_PROGRAM).write_byte(address, data);
}
break;
default:
@@ -1016,14 +1017,10 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
switch( m_bits )
{
case 8:
- {
- m_addrspace[0]->write_byte(address, data);
- }
+ space(AS_PROGRAM).write_byte(address, data);
break;
case 16:
- {
- m_addrspace[0]->write_word(address * 2, data);
- }
+ space(AS_PROGRAM).write_word(address * 2, data);
break;
default:
logerror( "FM_WRITEPART1 not supported when m_bits == %d\n", m_bits );
@@ -1039,14 +1036,10 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
switch( m_bits )
{
case 8:
- {
- m_addrspace[0]->write_byte(address, data);
- }
+ space(AS_PROGRAM).write_byte(address, data);
break;
case 16:
- {
- m_addrspace[0]->write_word(address * 2, data);
- }
+ space(AS_PROGRAM).write_word(address * 2, data);
break;
default:
logerror( "FM_WRITEPAGEATMEL not supported when m_bits == %d\n", m_bits );
@@ -1068,7 +1061,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
// clear the 256 bytes block containing the current address to all 0xffs
UINT32 base = address * ((m_bits == 16) ? 2 : 1);
for (offs_t offs = 0; offs < 256; offs++)
- m_addrspace[0]->write_byte((base & ~0xff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0xff) + offs, 0xff);
m_timer->adjust( attotime::from_msec( 4 ) );
}
@@ -1111,7 +1104,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
// clear the block containing the current address to all 0xffffs
for (offs_t offs = 0; offs < size / 2; offs += 2)
- m_addrspace[0]->write_word(base | offs, 0xffff);
+ space(AS_PROGRAM).write_word(base | offs, 0xffff);
m_timer->adjust( attotime::from_msec( duration ) );
}
@@ -1120,7 +1113,7 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
// clear the 64k block containing the current address to all 0xffs
UINT32 base = address * ((m_bits == 16) ? 2 : 1);
for (offs_t offs = 0; offs < 64 * 1024; offs++)
- m_addrspace[0]->write_byte((base & ~0xffff) + offs, 0xff);
+ space(AS_PROGRAM).write_byte((base & ~0xffff) + offs, 0xff);
m_timer->adjust( attotime::from_seconds( 1 ) );
}
diff --git a/src/devices/machine/intelfsh.h b/src/devices/machine/intelfsh.h
index 437d8c946c2..611c2a01d49 100644
--- a/src/devices/machine/intelfsh.h
+++ b/src/devices/machine/intelfsh.h
@@ -166,6 +166,8 @@ protected:
UINT32 read_full(UINT32 offset);
void write_full(UINT32 offset, UINT32 data);
+ optional_memory_region m_region;
+
// configuration state
address_space_config m_space_config;
UINT32 m_type;
@@ -205,8 +207,8 @@ public:
DECLARE_READ8_MEMBER(read) { return read_full(offset); }
DECLARE_WRITE8_MEMBER(write) { write_full(offset, data); }
- UINT8 read_raw(offs_t offset) { return m_addrspace[0]->read_byte(offset); }
- void write_raw(offs_t offset, UINT8 data) { m_addrspace[0]->write_byte(offset, data); }
+ UINT8 read_raw(offs_t offset) { return space(AS_PROGRAM).read_byte(offset); }
+ void write_raw(offs_t offset, UINT8 data) { space(AS_PROGRAM).write_byte(offset, data); }
};
@@ -225,8 +227,8 @@ public:
DECLARE_READ16_MEMBER(read) { return read_full(offset); }
DECLARE_WRITE16_MEMBER(write) { write_full(offset, data); }
- UINT16 read_raw(offs_t offset) { return m_addrspace[0]->read_word(offset * 2); }
- void write_raw(offs_t offset, UINT16 data) { m_addrspace[0]->write_word(offset * 2, data); }
+ UINT16 read_raw(offs_t offset) { return space(AS_PROGRAM).read_word(offset * 2); }
+ void write_raw(offs_t offset, UINT16 data) { space(AS_PROGRAM).write_word(offset * 2, data); }
};
diff --git a/src/devices/machine/k033906.cpp b/src/devices/machine/k033906.cpp
index d9953d2864f..b799ad11cd0 100644
--- a/src/devices/machine/k033906.cpp
+++ b/src/devices/machine/k033906.cpp
@@ -8,7 +8,6 @@
#include "emu.h"
#include "k033906.h"
-#include "video/voodoo.h"
//**************************************************************************
@@ -23,7 +22,7 @@ const device_type K033906 = &device_creator<k033906_device>;
//-------------------------------------------------
k033906_device::k033906_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, K033906, "K033906 PCI bridge", tag, owner, clock, "k033906", __FILE__), m_reg_set(0), m_voodoo_tag(nullptr), m_voodoo(nullptr)
+ : device_t(mconfig, K033906, "K033906 PCI bridge", tag, owner, clock, "k033906", __FILE__), m_reg_set(0), m_voodoo(*this)
{
}
@@ -33,8 +32,6 @@ k033906_device::k033906_device(const machine_config &mconfig, const char *tag, d
void k033906_device::device_start()
{
- m_voodoo = (voodoo_device*)machine().device(m_voodoo_tag);
-
m_reg_set = 0;
save_item(NAME(m_reg));
diff --git a/src/devices/machine/k033906.h b/src/devices/machine/k033906.h
index 438cc5796ab..e493244ce81 100644
--- a/src/devices/machine/k033906.h
+++ b/src/devices/machine/k033906.h
@@ -20,7 +20,7 @@
***************************************************************************/
#define MCFG_K033906_VOODOO(_tag) \
- k033906_device::set_voodoo_tag(*device, _tag);
+ k033906_device::set_voodoo_tag(*device, "^" _tag);
/***************************************************************************
TYPE DEFINITIONS
@@ -35,7 +35,7 @@ public:
// construction/destruction
k033906_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void set_voodoo_tag(device_t &device, const char *tag) { downcast<k033906_device &>(device).m_voodoo_tag = tag; }
+ static void set_voodoo_tag(device_t &device, const char *tag) { downcast<k033906_device &>(device).m_voodoo.set_tag(tag); }
DECLARE_READ32_MEMBER( read );
DECLARE_WRITE32_MEMBER( write );
@@ -57,8 +57,7 @@ private:
int m_reg_set; // 1 = access reg / 0 = access ram
- const char *m_voodoo_tag;
- voodoo_device *m_voodoo;
+ required_device<voodoo_device> m_voodoo;
UINT32 m_reg[256];
UINT32 m_ram[32768];
diff --git a/src/devices/machine/k053252.cpp b/src/devices/machine/k053252.cpp
index 45020926ace..2a857d04bf5 100644
--- a/src/devices/machine/k053252.cpp
+++ b/src/devices/machine/k053252.cpp
@@ -76,8 +76,7 @@ k053252_device::k053252_device(const machine_config &mconfig, const char *tag, d
m_offsx(0),
m_offsy(0),
// ugly, needed to work with the rungun etc. video demux board
- m_slave_screen_tag(nullptr),
- m_slave_screen(nullptr)
+ m_slave_screen(*this)
{
}
@@ -103,12 +102,6 @@ void k053252_device::device_start()
save_item(NAME(m_vbp));
save_item(NAME(m_vsw));
save_item(NAME(m_hsw));
-
- if (m_slave_screen_tag != nullptr)
- {
- // find the screen device if explicitly configured
- m_slave_screen = device().siblingdevice<screen_device>(m_slave_screen_tag);
- }
}
//-------------------------------------------------
@@ -181,7 +174,7 @@ void k053252_device::res_change()
m_screen->configure(m_hc, m_vc, visarea, refresh);
- if (m_slave_screen)
+ if (m_slave_screen.found())
m_slave_screen->configure(m_hc, m_vc, visarea, refresh);
#if 0
@@ -262,5 +255,5 @@ WRITE8_MEMBER( k053252_device::write )
void k053252_device::static_set_slave_screen(device_t &device, const char *tag)
{
k053252_device &dev = downcast<k053252_device &>(device);
- dev.m_slave_screen_tag = tag;
+ dev.m_slave_screen.set_tag(tag);
}
diff --git a/src/devices/machine/k053252.h b/src/devices/machine/k053252.h
index a00743789ad..54787a6ee78 100644
--- a/src/devices/machine/k053252.h
+++ b/src/devices/machine/k053252.h
@@ -27,7 +27,7 @@
k053252_device::set_offsets(*device, _offsx, _offsy);
#define MCFG_K053252_SET_SLAVE_SCREEN(_tag) \
- k053252_device::static_set_slave_screen(*device, _tag);
+ k053252_device::static_set_slave_screen(*device, "^" _tag);
class k053252_device : public device_t,
@@ -75,8 +75,7 @@ protected:
int m_offsx;
int m_offsy;
- const char * m_slave_screen_tag;
- screen_device * m_slave_screen;
+ optional_device<screen_device> m_slave_screen;
};
diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp
index 9166e189952..1b659a610a0 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -33,6 +33,7 @@ const device_type MC146818 = &device_creator<mc146818_device>;
mc146818_device::mc146818_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MC146818, "MC146818 RTC", tag, owner, clock, "mc146818", __FILE__),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_index(0),
m_last_refresh(attotime::zero), m_clock_timer(nullptr), m_periodic_timer(nullptr),
m_write_irq(*this),
@@ -48,6 +49,7 @@ mc146818_device::mc146818_device(const machine_config &mconfig, const char *tag,
mc146818_device::mc146818_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_index(0),
m_last_refresh(attotime::zero), m_clock_timer(nullptr), m_periodic_timer(nullptr),
m_write_irq(*this),
@@ -193,14 +195,15 @@ void mc146818_device::device_timer(emu_timer &timer, device_timer_id id, int par
void mc146818_device::nvram_default()
{
// populate from a memory region if present
- if (m_region != nullptr)
+ memory_region *region = memregion(DEVICE_SELF);
+ if (region != nullptr)
{
- UINT32 bytes = m_region->bytes();
+ UINT32 bytes = region->bytes();
if (bytes > data_size())
bytes = data_size();
- memcpy(&m_data[0], m_region->base(), bytes);
+ memcpy(&m_data[0], region->base(), bytes);
}
else
{
diff --git a/src/devices/machine/mc146818.h b/src/devices/machine/mc146818.h
index c1c30eae17e..a7f16300b4b 100644
--- a/src/devices/machine/mc146818.h
+++ b/src/devices/machine/mc146818.h
@@ -167,6 +167,8 @@ private:
int get_year();
void set_year(int year);
+ optional_memory_region m_region;
+
// internal state
UINT8 m_index;
diff --git a/src/devices/machine/mos6530n.cpp b/src/devices/machine/mos6530n.cpp
index 31c15c65e1d..8f43b58405c 100644
--- a/src/devices/machine/mos6530n.cpp
+++ b/src/devices/machine/mos6530n.cpp
@@ -116,6 +116,7 @@ WRITE8_MEMBER(mos6532_t::io_w)
mos6530_base_t::mos6530_base_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
m_ram(*this),
+ m_rom(*this, DEVICE_SELF),
m_irq_cb(*this),
m_in_pa_cb(*this),
m_out_pa_cb(*this),
diff --git a/src/devices/machine/mos6530n.h b/src/devices/machine/mos6530n.h
index 71688040e89..b29fea9af93 100644
--- a/src/devices/machine/mos6530n.h
+++ b/src/devices/machine/mos6530n.h
@@ -268,7 +268,7 @@ protected:
void timer_w(offs_t offset, UINT8 data, bool ie);
UINT8 timer_r(bool ie);
- DECLARE_READ8_MEMBER( rom_r ) { return m_region->base()[offset]; }
+ DECLARE_READ8_MEMBER( rom_r ) { return m_rom[offset]; }
DECLARE_READ8_MEMBER( ram_r ) { return m_ram[offset]; }
DECLARE_WRITE8_MEMBER( ram_w ) { m_ram[offset] = data; }
DECLARE_READ8_MEMBER( pa_data_r );
@@ -287,6 +287,7 @@ protected:
DECLARE_WRITE8_MEMBER( edge_w );
optional_shared_ptr<UINT8> m_ram;
+ optional_region_ptr<UINT8> m_rom;
devcb_write_line m_irq_cb;
devcb_read8 m_in_pa_cb;
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 1ca8d185e47..bae8137edff 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -300,9 +300,8 @@ void netlist_mame_device_t::device_start()
//printf("clock is %d\n", clock());
- m_netlist = global_alloc(netlist_mame_t(*this));
+ m_netlist = global_alloc(netlist_mame_t(*this, "netlist"));
m_setup = global_alloc(netlist::setup_t(m_netlist));
- netlist().init_object(*m_netlist, "netlist");
m_setup->init();
// register additional devices
@@ -325,9 +324,9 @@ void netlist_mame_device_t::device_start()
m_setup->start_devices();
m_setup->resolve_inputs();
- netlist().save(NAME(m_rem));
- netlist().save(NAME(m_div));
- netlist().save(NAME(m_old));
+ netlist().save_item(m_rem, this, "m_rem");
+ netlist().save_item(m_div, this, "m_div");
+ netlist().save_item(m_old, this, "m_old");
save_state();
@@ -348,7 +347,7 @@ void netlist_mame_device_t::device_reset()
LOG_DEV_CALLS(("device_reset\n"));
m_old = netlist::netlist_time::zero;
m_rem = netlist::netlist_time::zero;
- netlist().do_reset();
+ netlist().reset();
}
void netlist_mame_device_t::device_stop()
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index 9550ee57f9d..00b1e3ad352 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -85,8 +85,8 @@ class netlist_mame_t : public netlist::netlist_t
{
public:
- netlist_mame_t(netlist_mame_device_t &parent)
- : netlist::netlist_t(),
+ netlist_mame_t(netlist_mame_device_t &parent, const pstring &aname)
+ : netlist::netlist_t(aname),
m_parent(parent)
{}
virtual ~netlist_mame_t() { };
diff --git a/src/devices/machine/nvram.cpp b/src/devices/machine/nvram.cpp
index 88d1191187a..3a88345eab3 100644
--- a/src/devices/machine/nvram.cpp
+++ b/src/devices/machine/nvram.cpp
@@ -25,6 +25,7 @@ const device_type NVRAM = &device_creator<nvram_device>;
nvram_device::nvram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NVRAM, "NVRAM", tag, owner, clock, "nvram", __FILE__),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_default_value(DEFAULT_ALL_1),
m_base(nullptr),
m_length(0)
@@ -79,7 +80,7 @@ void nvram_device::nvram_default()
determine_final_base();
// region always wins
- if (m_region != nullptr)
+ if (m_region.found())
{
memcpy(m_base, m_region->base(), m_length);
return;
@@ -164,6 +165,6 @@ void nvram_device::determine_final_base()
}
// if we are region-backed for the default, find it now and make sure it's the right size
- if (m_region != nullptr && m_region->bytes() != m_length)
+ if (m_region.found() && m_region->bytes() != m_length)
throw emu_fatalerror("%s",string_format("NVRAM device '%s' has a default region, but it should be 0x%I64uX bytes", tag(), m_length).c_str());
}
diff --git a/src/devices/machine/nvram.h b/src/devices/machine/nvram.h
index ac6b62e7bca..c1a733a3953 100644
--- a/src/devices/machine/nvram.h
+++ b/src/devices/machine/nvram.h
@@ -99,6 +99,7 @@ protected:
void determine_final_base();
// configuration state
+ optional_memory_region m_region;
default_value m_default_value;
nvram_init_delegate m_custom_handler;
diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp
index 5987a423a09..859b44dc939 100644
--- a/src/devices/machine/pci.cpp
+++ b/src/devices/machine/pci.cpp
@@ -59,7 +59,8 @@ DEVICE_ADDRESS_MAP_START(config_map, 32, pci_bridge_device)
ADDRESS_MAP_END
pci_device::pci_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ m_region(*this, DEVICE_SELF)
{
main_id = 0xffffffff;
revision = 0x00;
diff --git a/src/devices/machine/pci.h b/src/devices/machine/pci.h
index a88f0a3b7fb..9650efa8132 100644
--- a/src/devices/machine/pci.h
+++ b/src/devices/machine/pci.h
@@ -82,6 +82,8 @@ public:
virtual DECLARE_READ8_MEMBER(capptr_r);
protected:
+ optional_memory_region m_region;
+
enum {
M_MEM = 0,
M_IO = 1,
diff --git a/src/devices/machine/pla.cpp b/src/devices/machine/pla.cpp
index f96a2bd8f60..f2310201771 100644
--- a/src/devices/machine/pla.cpp
+++ b/src/devices/machine/pla.cpp
@@ -19,6 +19,7 @@ const device_type PLA = &device_creator<pla_device>;
pla_device::pla_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PLA, "PLA", tag, owner, clock, "pla", __FILE__),
+ m_region(*this, DEVICE_SELF),
m_format(PLA_FMT_JEDBIN),
m_inputs(0),
m_outputs(0),
@@ -35,7 +36,6 @@ pla_device::pla_device(const machine_config &mconfig, const char *tag, device_t
void pla_device::device_start()
{
- assert(region() != nullptr);
assert(m_terms < MAX_TERMS);
assert(m_inputs < 32 && m_outputs <= 32);
@@ -74,11 +74,11 @@ void pla_device::parse_fusemap()
switch (m_format)
{
case PLA_FMT_JEDBIN:
- result = jedbin_parse(region()->base(), region()->bytes(), &jed);
+ result = jedbin_parse(m_region->base(), m_region->bytes(), &jed);
break;
case PLA_FMT_BERKELEY:
- result = pla_parse(region()->base(), region()->bytes(), &jed);
+ result = pla_parse(m_region->base(), m_region->bytes(), &jed);
break;
}
diff --git a/src/devices/machine/pla.h b/src/devices/machine/pla.h
index 9f14a155ac5..1fdffd023d9 100644
--- a/src/devices/machine/pla.h
+++ b/src/devices/machine/pla.h
@@ -109,6 +109,8 @@ protected:
private:
void parse_fusemap();
+ required_memory_region m_region;
+
int m_format;
UINT32 m_inputs;
diff --git a/src/devices/machine/rp5h01.cpp b/src/devices/machine/rp5h01.cpp
index 4a3138225a7..009757b6acf 100644
--- a/src/devices/machine/rp5h01.cpp
+++ b/src/devices/machine/rp5h01.cpp
@@ -20,7 +20,7 @@
#include "machine/rp5h01.h"
// this is the contents of an unprogrammed PROM
-static const UINT8 initial_data[0x10] =
+UINT8 rp5h01_device::s_initial_data[0x10] =
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00
@@ -34,7 +34,7 @@ const device_type RP5H01 = &device_creator<rp5h01_device>;
rp5h01_device::rp5h01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, RP5H01, "RP5H01 6/7-bit Counter", tag, owner, clock, "rp5h01", __FILE__)
- , m_rom_ptr(*this, DEVICE_SELF)
+ , m_data(*this, DEVICE_SELF, 0x10)
{
}
@@ -54,15 +54,8 @@ void rp5h01_device::device_config_complete()
void rp5h01_device::device_start()
{
- if (m_rom_ptr == nullptr)
- {
- m_data = initial_data;
- }
- else
- {
- m_data = m_rom_ptr;
- assert(region()->bytes() == 0x10);
- }
+ if (!m_data.found())
+ m_data.set_target(s_initial_data, 0x10);
/* register for state saving */
save_item(NAME(m_counter));
diff --git a/src/devices/machine/rp5h01.h b/src/devices/machine/rp5h01.h
index 0585b5ddf55..c33a80a998b 100644
--- a/src/devices/machine/rp5h01.h
+++ b/src/devices/machine/rp5h01.h
@@ -36,6 +36,8 @@ enum {
class rp5h01_device : public device_t
{
+ static UINT8 s_initial_data[0x10];
+
public:
rp5h01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@@ -60,8 +62,7 @@ private:
int m_enabled; /* chip enable */
int m_old_reset; /* reset pin state (level-triggered) */
int m_old_clock; /* clock pin state (level-triggered) */
- const UINT8 *m_data;
- optional_region_ptr<UINT8> m_rom_ptr;
+ optional_region_ptr<UINT8> m_data;
};
extern const device_type RP5H01;
diff --git a/src/devices/machine/rtc9701.cpp b/src/devices/machine/rtc9701.cpp
index fc72c76c900..86f5378d2b4 100644
--- a/src/devices/machine/rtc9701.cpp
+++ b/src/devices/machine/rtc9701.cpp
@@ -15,6 +15,8 @@
#include "machine/rtc9701.h"
+ALLOW_SAVE_TYPE(rtc9701_state_t);
+
//**************************************************************************
// GLOBAL VARIABLES
@@ -104,6 +106,25 @@ void rtc9701_device::device_start()
rtc_state = RTC9701_CMD_WAIT;
cmd_stream_pos = 0;
current_cmd = 0;
+
+ save_item(NAME(m_latch));
+ save_item(NAME(m_reset_line));
+ save_item(NAME(m_clock_line));
+ save_item(NAME(rtc_state));
+ save_item(NAME(cmd_stream_pos));
+ save_item(NAME(current_cmd));
+ save_item(NAME(rtc9701_address_pos));
+ save_item(NAME(rtc9701_current_address));
+ save_item(NAME(rtc9701_current_data));
+ save_item(NAME(rtc9701_data_pos));
+ save_item(NAME(rtc9701_data));
+ save_item(NAME(m_rtc.sec));
+ save_item(NAME(m_rtc.min));
+ save_item(NAME(m_rtc.hour));
+ save_item(NAME(m_rtc.day));
+ save_item(NAME(m_rtc.wday));
+ save_item(NAME(m_rtc.month));
+ save_item(NAME(m_rtc.year));
}
diff --git a/src/devices/machine/serflash.cpp b/src/devices/machine/serflash.cpp
index f5a002ae929..1746b4583eb 100644
--- a/src/devices/machine/serflash.cpp
+++ b/src/devices/machine/serflash.cpp
@@ -9,6 +9,7 @@
#include "machine/serflash.h"
+ALLOW_SAVE_TYPE(flash_state_t);
//**************************************************************************
// LIVE DEVICE
@@ -42,12 +43,27 @@ void serflash_device::device_start()
m_flashwritemap.resize(m_length / FLASH_PAGE_SIZE);
memset(&m_flashwritemap[0], 0, m_length / FLASH_PAGE_SIZE);
+
+ save_item(NAME(m_flash_state));
+ save_item(NAME(m_flash_enab));
+ save_item(NAME(m_flash_cmd_seq));
+ save_item(NAME(m_flash_cmd_prev));
+ save_item(NAME(m_flash_addr_seq));
+ save_item(NAME(m_flash_read_seq));
+ save_item(NAME(m_flash_row));
+ save_item(NAME(m_flash_col));
+ save_item(NAME(m_flash_page_addr));
+ save_item(NAME(m_flash_page_index));
+ save_item(NAME(m_flashwritemap));
+ save_item(NAME(m_last_flash_cmd));
+ save_item(NAME(m_flash_addr));
+ save_item(NAME(m_flash_page_data));
}
void serflash_device::device_reset()
{
m_flash_enab = 0;
- flash_hard_reset(machine());
+ flash_hard_reset();
m_last_flash_cmd = 0x00;
m_flash_addr_seq = 0;
@@ -115,7 +131,7 @@ void serflash_device::nvram_write(emu_file &file)
file.write(&page, 4);
}
-void serflash_device::flash_hard_reset(running_machine &machine)
+void serflash_device::flash_hard_reset()
{
// logerror("%08x FLASH: RESET\n", cpuexec_describe_context(machine));
@@ -141,7 +157,7 @@ WRITE8_MEMBER( serflash_device::flash_enab_w )
m_flash_enab = data;
}
-void serflash_device::flash_change_state(running_machine &machine, flash_state_t state)
+void serflash_device::flash_change_state(flash_state_t state)
{
m_flash_state = state;
@@ -176,7 +192,7 @@ WRITE8_MEMBER( serflash_device::flash_cmd_w )
break;
case 0x70: // READ STATUS
- flash_change_state( space.machine(), STATE_READ_STATUS );
+ flash_change_state( STATE_READ_STATUS );
break;
case 0x80: // PAGE / CACHE PROGRAM
@@ -186,11 +202,11 @@ WRITE8_MEMBER( serflash_device::flash_cmd_w )
break;
case 0x90: // READ ID
- flash_change_state( space.machine(), STATE_READ_ID );
+ flash_change_state( STATE_READ_ID );
break;
case 0xff: // RESET
- flash_change_state( space.machine(), STATE_IDLE );
+ flash_change_state( STATE_IDLE );
break;
default:
@@ -210,7 +226,7 @@ WRITE8_MEMBER( serflash_device::flash_cmd_w )
m_flash_page_addr = m_flash_col;
m_flash_page_index = m_flash_row;
- flash_change_state( space.machine(), STATE_READ );
+ flash_change_state( STATE_READ );
//logerror("%08x FLASH: caching page = %04X\n", m_maincpu->pc(), m_flash_row);
}
@@ -219,7 +235,7 @@ WRITE8_MEMBER( serflash_device::flash_cmd_w )
case 0x60: // BLOCK ERASE
if (data==0xd0)
{
- flash_change_state( space.machine(), STATE_BLOCK_ERASE );
+ flash_change_state( STATE_BLOCK_ERASE );
m_flashwritemap[m_flash_col] |= 1;
memset(m_region + m_flash_col * FLASH_PAGE_SIZE, 0xff, FLASH_PAGE_SIZE);
//logerror("erased block %04x (%08x - %08x)\n", m_flash_col, m_flash_col * FLASH_PAGE_SIZE, ((m_flash_col+1) * FLASH_PAGE_SIZE)-1);
@@ -232,7 +248,7 @@ WRITE8_MEMBER( serflash_device::flash_cmd_w )
case 0x80:
if (data==0x10)
{
- flash_change_state( space.machine(), STATE_PAGE_PROGRAM );
+ flash_change_state( STATE_PAGE_PROGRAM );
m_flashwritemap[m_flash_row] |= (memcmp(m_region + m_flash_row * FLASH_PAGE_SIZE, m_flash_page_data, FLASH_PAGE_SIZE) != 0);
memcpy(m_region + m_flash_row * FLASH_PAGE_SIZE, m_flash_page_data, FLASH_PAGE_SIZE);
//logerror("re-written block %04x (%08x - %08x)\n", m_flash_row, m_flash_row * FLASH_PAGE_SIZE, ((m_flash_row+1) * FLASH_PAGE_SIZE)-1);
diff --git a/src/devices/machine/serflash.h b/src/devices/machine/serflash.h
index a5cf2c58bfb..9d3654fc9c3 100644
--- a/src/devices/machine/serflash.h
+++ b/src/devices/machine/serflash.h
@@ -50,7 +50,7 @@ public:
DECLARE_WRITE8_MEMBER( flash_data_w );
DECLARE_WRITE8_MEMBER( flash_cmd_w );
DECLARE_WRITE8_MEMBER( flash_enab_w );
- void flash_hard_reset(running_machine &machine);
+ void flash_hard_reset();
DECLARE_READ8_MEMBER(n3d_flash_r);
DECLARE_WRITE8_MEMBER(n3d_flash_cmd_w);
@@ -66,7 +66,7 @@ protected:
virtual void nvram_read(emu_file &file) override;
virtual void nvram_write(emu_file &file) override;
- void flash_change_state(running_machine &machine, flash_state_t state);
+ void flash_change_state(flash_state_t state);
// runtime state
size_t m_length;
diff --git a/src/devices/machine/tc009xlvc.cpp b/src/devices/machine/tc009xlvc.cpp
index 724bd5edf16..3a10002e8f6 100644
--- a/src/devices/machine/tc009xlvc.cpp
+++ b/src/devices/machine/tc009xlvc.cpp
@@ -46,7 +46,7 @@ WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_paletteram_w)
g |= ((i & 2) >> 1);
r |= (i & 1);
- m_palette->set_pen_color(offset / 2, pal5bit(r), pal5bit(g), pal5bit(b));
+ m_gfxdecode->palette().set_pen_color(offset / 2, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
@@ -168,8 +168,7 @@ tc0091lvc_device::tc0091lvc_device(const machine_config &mconfig, const char *ta
: device_t(mconfig, TC0091LVC, "Taito TC0091LVC", tag, owner, clock, "tc0091lvc", __FILE__),
device_memory_interface(mconfig, *this),
m_space_config("tc0091lvc", ENDIANNESS_LITTLE, 8,20, 0, nullptr, *ADDRESS_MAP_NAME(tc0091lvc_map8)),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -184,17 +183,6 @@ void tc0091lvc_device::static_set_gfxdecode_tag(device_t &device, const char *ta
}
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void tc0091lvc_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<tc0091lvc_device &>(device).m_palette.set_tag(tag);
-}
-
-
void tc0091lvc_device::device_config_complete()
{
// int address_bits = 20;
@@ -297,7 +285,8 @@ void tc0091lvc_device::device_start()
//printf("m_gfx_index %d\n", m_gfx_index);
- m_gfxdecode->set_gfx(m_gfx_index, std::make_unique<gfx_element>(m_palette, char_layout, (UINT8 *)m_pcg_ram, 0, m_palette->entries() / 16, 0));
+ palette_device &palette = m_gfxdecode->palette();
+ m_gfxdecode->set_gfx(m_gfx_index, std::make_unique<gfx_element>(palette, char_layout, (UINT8 *)m_pcg_ram, 0, palette.entries() / 16, 0));
}
void tc0091lvc_device::device_reset()
@@ -346,7 +335,7 @@ UINT32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
int x,y;
UINT8 global_flip;
- bitmap.fill(m_palette->black_pen(), cliprect);
+ bitmap.fill(m_gfxdecode->palette().black_pen(), cliprect);
if((m_vregs[4] & 0x20) == 0)
return 0;
@@ -367,7 +356,7 @@ UINT32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
res_y = (global_flip) ? 256-y : y;
if(screen.visible_area().contains(res_x, res_y))
- bitmap.pix16(res_y, res_x) = m_palette->pen(m_bitmap_ram[count]);
+ bitmap.pix16(res_y, res_x) = m_gfxdecode->palette().pen(m_bitmap_ram[count]);
count++;
}
diff --git a/src/devices/machine/tc009xlvc.h b/src/devices/machine/tc009xlvc.h
index 66911acd4e5..3f737cbf044 100644
--- a/src/devices/machine/tc009xlvc.h
+++ b/src/devices/machine/tc009xlvc.h
@@ -21,7 +21,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
DECLARE_READ8_MEMBER( vregs_r );
DECLARE_WRITE8_MEMBER( vregs_w );
@@ -80,7 +79,6 @@ protected:
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
address_space_config m_space_config;
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type TC0091LVC;
@@ -88,8 +86,5 @@ extern const device_type TC0091LVC;
#define MCFG_TC0091LVC_GFXDECODE(_gfxtag) \
tc0091lvc_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_TC0091LVC_PALETTE(_palette_tag) \
- tc0091lvc_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index 7b602c896c6..06aba0b7221 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -119,15 +119,16 @@ static int counter_from_ram( UINT8 *data, int offset )
// timekeeper_device_config - constructor
//-------------------------------------------------
-timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int size)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
, device_nvram_interface(mconfig, *this)
- , m_default_data(*this, DEVICE_SELF)
+ , m_default_data(*this, DEVICE_SELF, size)
+ , m_size(size)
{
}
m48t02_device::m48t02_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : timekeeper_device(mconfig, M48T02, "M48T02 Timekeeper", tag, owner, clock, "m48t02", __FILE__)
+ : timekeeper_device(mconfig, M48T02, "M48T02 Timekeeper", tag, owner, clock, "m48t02", __FILE__, 0x800)
{
m_offset_control = 0x7f8;
m_offset_seconds = 0x7f9;
@@ -139,11 +140,10 @@ m48t02_device::m48t02_device(const machine_config &mconfig, const char *tag, dev
m_offset_year = 0x7ff;
m_offset_century = -1;
m_offset_flags = -1;
- m_size = 0x800;
}
m48t35_device::m48t35_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : timekeeper_device(mconfig, M48T35, "M48T35 Timekeeper", tag, owner, clock, "m48t35", __FILE__)
+ : timekeeper_device(mconfig, M48T35, "M48T35 Timekeeper", tag, owner, clock, "m48t35", __FILE__, 0x8000)
{
m_offset_control = 0x7ff8;
m_offset_seconds = 0x7ff9;
@@ -155,11 +155,10 @@ m48t35_device::m48t35_device(const machine_config &mconfig, const char *tag, dev
m_offset_year = 0x7fff;
m_offset_century = -1;
m_offset_flags = -1;
- m_size = 0x8000;
}
m48t37_device::m48t37_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : timekeeper_device(mconfig, M48T37, "M48T37 Timekeeper", tag, owner, clock, "m48t37", __FILE__)
+ : timekeeper_device(mconfig, M48T37, "M48T37 Timekeeper", tag, owner, clock, "m48t37", __FILE__, 0x8000)
{
m_offset_control = 0x7ff8;
m_offset_seconds = 0x7ff9;
@@ -171,11 +170,10 @@ m48t37_device::m48t37_device(const machine_config &mconfig, const char *tag, dev
m_offset_year = 0x7fff;
m_offset_century = 0x7ff1;
m_offset_flags = 0x7ff0;
- m_size = 0x8000;
}
m48t58_device::m48t58_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : timekeeper_device(mconfig, M48T58, "M48T58 Timekeeper", tag, owner, clock, "m48t58", __FILE__)
+ : timekeeper_device(mconfig, M48T58, "M48T58 Timekeeper", tag, owner, clock, "m48t58", __FILE__, 0x2000)
{
m_offset_control = 0x1ff8;
m_offset_seconds = 0x1ff9;
@@ -187,11 +185,10 @@ m48t58_device::m48t58_device(const machine_config &mconfig, const char *tag, dev
m_offset_year = 0x1fff;
m_offset_century = -1;
m_offset_flags = -1;
- m_size = 0x2000;
}
mk48t08_device::mk48t08_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : timekeeper_device(mconfig, MK48T08, "MK48T08 Timekeeper", tag, owner, clock, "m48t08", __FILE__)
+ : timekeeper_device(mconfig, MK48T08, "MK48T08 Timekeeper", tag, owner, clock, "m48t08", __FILE__, 0x2000)
{
m_offset_control = 0x1ff8;
m_offset_seconds = 0x1ff9;
@@ -203,7 +200,6 @@ mk48t08_device::mk48t08_device(const machine_config &mconfig, const char *tag, d
m_offset_year = 0x1fff;
m_offset_century = 0x1ff1;
m_offset_flags = 0x1ff0;
- m_size = 0x2000;
}
@@ -231,11 +227,6 @@ void timekeeper_device::device_start()
m_century = make_bcd( systime.local_time.year / 100 );
m_data.resize( m_size );
- if (m_default_data)
- {
- assert(m_default_data.bytes() == m_size);
- }
-
save_item( NAME(m_control) );
save_item( NAME(m_seconds) );
save_item( NAME(m_minutes) );
@@ -398,7 +389,7 @@ READ8_MEMBER( timekeeper_device::read )
void timekeeper_device::nvram_default()
{
- if( m_default_data != nullptr )
+ if (m_default_data.found())
{
memcpy( &m_data[0], m_default_data, m_size );
}
diff --git a/src/devices/machine/timekpr.h b/src/devices/machine/timekpr.h
index 84c969b076d..3d96d2f394a 100644
--- a/src/devices/machine/timekpr.h
+++ b/src/devices/machine/timekpr.h
@@ -55,7 +55,7 @@ class timekeeper_device : public device_t,
{
protected:
// construction/destruction
- timekeeper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ timekeeper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int size);
public:
DECLARE_WRITE8_MEMBER( write );
diff --git a/src/devices/machine/vrc4373.cpp b/src/devices/machine/vrc4373.cpp
index c6797193c49..50257a2d076 100644
--- a/src/devices/machine/vrc4373.cpp
+++ b/src/devices/machine/vrc4373.cpp
@@ -31,8 +31,8 @@ ADDRESS_MAP_END
vrc4373_device::vrc4373_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pci_host_device(mconfig, VRC4373, "NEC VRC4373 System Controller", tag, owner, clock, "vrc4373", __FILE__), m_cpu_space(nullptr), m_cpu(nullptr), cpu_tag(nullptr),
m_mem_config("memory_space", ENDIANNESS_LITTLE, 32, 32),
- m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32), m_ram_size(0), m_ram_base(0), m_simm_size(0), m_simm_base(0), m_pci1_laddr(0), m_pci2_laddr(0), m_pci_io_laddr(0), m_target1_laddr(0), m_target2_laddr(0)
-
+ m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32), m_ram_size(0), m_ram_base(0), m_simm_size(0), m_simm_base(0), m_pci1_laddr(0), m_pci2_laddr(0), m_pci_io_laddr(0), m_target1_laddr(0), m_target2_laddr(0),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/machine/vrc4373.h b/src/devices/machine/vrc4373.h
index bbd740b8084..9c9e65588a8 100644
--- a/src/devices/machine/vrc4373.h
+++ b/src/devices/machine/vrc4373.h
@@ -124,6 +124,7 @@ private:
UINT32 m_pci1_laddr, m_pci2_laddr, m_pci_io_laddr;
UINT32 m_target1_laddr, m_target2_laddr;
+ required_memory_region m_region;
};
diff --git a/src/devices/machine/x2212.cpp b/src/devices/machine/x2212.cpp
index cb6fc2b57e9..63d28a322e4 100644
--- a/src/devices/machine/x2212.cpp
+++ b/src/devices/machine/x2212.cpp
@@ -46,11 +46,13 @@ x2212_device::x2212_device(const machine_config &mconfig, const char *tag, devic
m_sram_space_config("SRAM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_sram_map)),
m_e2prom_space_config("E2PROM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_e2prom_map)),
m_store(false),
- m_array_recall(false)
+ m_array_recall(false),
+ m_size_data(0x100),
+ m_default_data(*this, DEVICE_SELF, 0x100)
{
}
-x2212_device::x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+x2212_device::x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int size_data)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_memory_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
@@ -58,7 +60,9 @@ x2212_device::x2212_device(const machine_config &mconfig, device_type type, cons
m_sram_space_config("SRAM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_sram_map)),
m_e2prom_space_config("E2PROM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_e2prom_map)),
m_store(false),
- m_array_recall(false)
+ m_array_recall(false),
+ m_size_data(size_data),
+ m_default_data(*this, DEVICE_SELF, size_data)
{
}
@@ -81,22 +85,8 @@ void x2212_device::device_start()
{
save_item(NAME(m_store));
save_item(NAME(m_array_recall));
-
- m_sram = m_addrspace[0];
- m_e2prom = m_addrspace[1];
-
- SIZE_DATA = 0x100;
-}
-
-void x2210_device::device_start()
-{
- save_item(NAME(m_store));
- save_item(NAME(m_array_recall));
-
- m_sram = m_addrspace[0];
- m_e2prom = m_addrspace[1];
-
- SIZE_DATA = 0x40;
+ m_sram = &space(AS_0);
+ m_e2prom = &space(AS_1);
}
@@ -119,23 +109,17 @@ const address_space_config *x2212_device::memory_space_config(address_spacenum s
void x2212_device::nvram_default()
{
// default to all-0xff
- for (int byte = 0; byte < SIZE_DATA; byte++)
+ for (int byte = 0; byte < m_size_data; byte++)
{
m_sram->write_byte(byte, 0xff);
m_e2prom->write_byte(byte, 0xff);
}
// populate from a memory region if present
- if (m_region != nullptr)
+ if (m_default_data.found())
{
- if (m_region->bytes() != SIZE_DATA)
- fatalerror("x2212 region '%s' wrong size (expected size = 0x100)\n", tag());
- if (m_region->bytewidth() != 1)
- fatalerror("x2212 region '%s' needs to be an 8-bit region\n", tag());
-
- UINT8 *default_data = m_region->base();
- for (int byte = 0; byte < SIZE_DATA; byte++)
- m_e2prom->write_byte(byte, default_data[byte]);
+ for (int byte = 0; byte < m_size_data; byte++)
+ m_e2prom->write_byte(byte, m_default_data[byte]);
}
}
@@ -147,9 +131,9 @@ void x2212_device::nvram_default()
void x2212_device::nvram_read(emu_file &file)
{
- UINT8 *buffer = (UINT8 *) alloca(SIZE_DATA);
- file.read(buffer, SIZE_DATA);
- for (int byte = 0; byte < SIZE_DATA; byte++)
+ UINT8 *buffer = (UINT8 *) alloca(m_size_data);
+ file.read(buffer, m_size_data);
+ for (int byte = 0; byte < m_size_data; byte++)
{
m_sram->write_byte(byte, 0xff);
m_e2prom->write_byte(byte, buffer[byte]);
@@ -168,10 +152,10 @@ void x2212_device::nvram_write(emu_file &file)
if (m_auto_save)
store();
- UINT8 *buffer = (UINT8 *) alloca(SIZE_DATA);
- for (int byte = 0; byte < SIZE_DATA; byte++)
+ UINT8 *buffer = (UINT8 *) alloca(m_size_data);
+ for (int byte = 0; byte < m_size_data; byte++)
buffer[byte] = m_e2prom->read_byte(byte);
- file.write(buffer, SIZE_DATA);
+ file.write(buffer, m_size_data);
}
@@ -187,7 +171,7 @@ void x2212_device::nvram_write(emu_file &file)
void x2212_device::store()
{
- for (int byte = 0; byte < SIZE_DATA; byte++)
+ for (int byte = 0; byte < m_size_data; byte++)
m_e2prom->write_byte(byte, m_sram->read_byte(byte));
}
@@ -199,7 +183,7 @@ void x2212_device::store()
void x2212_device::recall()
{
- for (int byte = 0; byte < SIZE_DATA; byte++)
+ for (int byte = 0; byte < m_size_data; byte++)
m_sram->write_byte(byte, m_e2prom->read_byte(byte));
}
@@ -256,6 +240,6 @@ WRITE_LINE_MEMBER( x2212_device::recall )
x2210_device::x2210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : x2212_device(mconfig, X2210, "X2210", tag, owner, clock, "x2210", __FILE__)
+ : x2212_device(mconfig, X2210, "X2210", tag, owner, clock, "x2210", __FILE__, 0x40)
{
}
diff --git a/src/devices/machine/x2212.h b/src/devices/machine/x2212.h
index 161cf399457..ffcc1dcf84b 100644
--- a/src/devices/machine/x2212.h
+++ b/src/devices/machine/x2212.h
@@ -49,7 +49,7 @@ class x2212_device : public device_t,
public:
// construction/destruction
x2212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int size_data);
// inline configuration helpers
static void static_set_auto_save(device_t &device);
@@ -77,8 +77,6 @@ protected:
virtual void nvram_read(emu_file &file) override;
virtual void nvram_write(emu_file &file) override;
- int SIZE_DATA;
-
// configuration state
bool m_auto_save;
@@ -92,16 +90,15 @@ protected:
bool m_store;
bool m_array_recall;
+
+ int m_size_data;
+ optional_region_ptr<UINT8> m_default_data;
};
class x2210_device : public x2212_device
{
public:
x2210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-
-protected:
- // device-level overrides
- virtual void device_start() override;
};
diff --git a/src/devices/machine/x76f041.cpp b/src/devices/machine/x76f041.cpp
index 21dea0ae141..481434abc77 100644
--- a/src/devices/machine/x76f041.cpp
+++ b/src/devices/machine/x76f041.cpp
@@ -37,6 +37,7 @@ const device_type X76F041 = &device_creator<x76f041_device>;
x76f041_device::x76f041_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t( mconfig, X76F041, "X76F041 Flash", tag, owner, clock, "x76f041", __FILE__ ),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_cs( 0 ),
m_rst( 0 ),
m_scl( 0 ),
@@ -498,7 +499,7 @@ void x76f041_device::nvram_default()
int expected_bytes = sizeof( m_response_to_reset ) + sizeof( m_write_password ) + sizeof( m_read_password ) +
sizeof( m_configuration_password ) + sizeof( m_configuration_registers ) + sizeof( m_data );
- if( !m_region )
+ if (!m_region.found())
{
logerror( "x76f041(%s) region not found\n", tag() );
}
diff --git a/src/devices/machine/x76f041.h b/src/devices/machine/x76f041.h
index 228540969eb..5c453aad6ee 100644
--- a/src/devices/machine/x76f041.h
+++ b/src/devices/machine/x76f041.h
@@ -99,6 +99,8 @@ private:
STATE_WRITE_CONFIGURATION_REGISTERS
};
+ optional_memory_region m_region;
+
// internal state
int m_cs;
int m_rst;
diff --git a/src/devices/machine/x76f100.cpp b/src/devices/machine/x76f100.cpp
index 830a0e51448..f254eed7ffc 100644
--- a/src/devices/machine/x76f100.cpp
+++ b/src/devices/machine/x76f100.cpp
@@ -35,6 +35,7 @@ const device_type X76F100 = &device_creator<x76f100_device>;
x76f100_device::x76f100_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t( mconfig, X76F100, "X76F100 Flash", tag, owner, clock, "x76f100", __FILE__ ),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_cs( 0 ),
m_rst( 0 ),
m_scl( 0 ),
@@ -391,7 +392,7 @@ void x76f100_device::nvram_default()
int expected_size = sizeof( m_response_to_reset ) + sizeof( m_write_password ) + sizeof( m_read_password ) + sizeof( m_data );
- if( !m_region )
+ if (!m_region.found())
{
logerror( "x76f100(%s) region not found\n", tag() );
}
diff --git a/src/devices/machine/x76f100.h b/src/devices/machine/x76f100.h
index 287a4a17a56..5ce4b5241c9 100644
--- a/src/devices/machine/x76f100.h
+++ b/src/devices/machine/x76f100.h
@@ -66,6 +66,8 @@ private:
STATE_WRITE_DATA
};
+ optional_memory_region m_region;
+
// internal state
int m_cs;
int m_rst;
diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp
index ba6baba7bce..7c4a9d0739c 100644
--- a/src/devices/sound/2608intf.cpp
+++ b/src/devices/sound/2608intf.cpp
@@ -144,8 +144,8 @@ void ym2608_device::device_start()
/* stream system initialize */
m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2608_device::stream_generate),this));
/* setup adpcm buffers */
- pcmbufa = region()->base();
- pcmsizea = region()->bytes();
+ pcmbufa = m_region->base();
+ pcmsizea = m_region->bytes();
/* initialize YM2608 */
m_chip = ym2608_init(this,this,clock(),rate,
@@ -187,7 +187,8 @@ const device_type YM2608 = &device_creator<ym2608_device>;
ym2608_device::ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ay8910_device(mconfig, YM2608, "YM2608", tag, owner, clock, PSG_TYPE_YM, 1, 2, "ym2608", __FILE__),
- m_irq_handler(*this)
+ m_irq_handler(*this),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h
index f827f998521..0ec973b69ff 100644
--- a/src/devices/sound/2608intf.h
+++ b/src/devices/sound/2608intf.h
@@ -45,6 +45,7 @@ private:
emu_timer * m_timer[2];
void * m_chip;
devcb_write_line m_irq_handler;
+ required_memory_region m_region;
};
extern const device_type YM2608;
diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp
index 4cc7f303795..776ad96d009 100644
--- a/src/devices/sound/2610intf.cpp
+++ b/src/devices/sound/2610intf.cpp
@@ -157,8 +157,8 @@ void ym2610_device::device_start()
m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2610_device::stream_generate),this));
/* setup adpcm buffers */
- void *pcmbufa = region()->base();
- int pcmsizea = region()->bytes();
+ void *pcmbufa = m_region->base();
+ int pcmsizea = m_region->bytes();
std::string name = tag() + std::string(".deltat");
memory_region *deltat_region = machine().root_device().memregion(name.c_str());
@@ -212,12 +212,14 @@ const device_type YM2610 = &device_creator<ym2610_device>;
ym2610_device::ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__)
, m_irq_handler(*this)
+ , m_region(*this, DEVICE_SELF)
{
}
ym2610_device::ym2610_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source)
, m_irq_handler(*this)
+ , m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h
index dcd0ef01787..b41843053ab 100644
--- a/src/devices/sound/2610intf.h
+++ b/src/devices/sound/2610intf.h
@@ -50,6 +50,7 @@ private:
sound_stream * m_stream;
emu_timer * m_timer[2];
devcb_write_line m_irq_handler;
+ required_memory_region m_region;
};
extern const device_type YM2610;
diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp
index 4454b37f941..adc51009a0c 100644
--- a/src/devices/sound/8950intf.cpp
+++ b/src/devices/sound/8950intf.cpp
@@ -150,7 +150,7 @@ void y8950_device::device_start()
assert_always(m_chip != nullptr, "Error creating Y8950 chip");
/* ADPCM ROM data */
- y8950_set_delta_t_memory(m_chip, region()->base(), region()->bytes());
+ y8950_set_delta_t_memory(m_chip, m_region->base(), m_region->bytes());
m_stream = machine().sound().stream_alloc(*this,0,1,rate);
/* port and keyboard handler */
@@ -212,7 +212,8 @@ y8950_device::y8950_device(const machine_config &mconfig, const char *tag, devic
m_keyboard_read_handler(*this),
m_keyboard_write_handler(*this),
m_io_read_handler(*this),
- m_io_write_handler(*this)
+ m_io_write_handler(*this),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h
index 53a35111f77..e548beffa62 100644
--- a/src/devices/sound/8950intf.h
+++ b/src/devices/sound/8950intf.h
@@ -73,6 +73,7 @@ private:
devcb_write8 m_keyboard_write_handler;
devcb_read8 m_io_read_handler;
devcb_write8 m_io_write_handler;
+ required_memory_region m_region;
};
extern const device_type Y8950;
diff --git a/src/devices/sound/digitalk.cpp b/src/devices/sound/digitalk.cpp
index 262e930bddf..d36bb77e4c3 100644
--- a/src/devices/sound/digitalk.cpp
+++ b/src/devices/sound/digitalk.cpp
@@ -266,7 +266,7 @@ const device_type DIGITALKER = &device_creator<digitalker_device>;
digitalker_device::digitalker_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, DIGITALKER, "Digitalker", tag, owner, clock, "digitalker", __FILE__),
device_sound_interface(mconfig, *this),
- m_rom(nullptr),
+ m_rom(*this, DEVICE_SELF),
m_stream(nullptr),
m_data(0),
m_cs(0),
@@ -655,7 +655,6 @@ void digitalker_device::digitalker_register_for_save()
void digitalker_device::device_start()
{
- m_rom = m_region->base();
m_stream = stream_alloc(0, 1, clock()/4);
m_dac_index = 128;
m_data = 0xff;
diff --git a/src/devices/sound/digitalk.h b/src/devices/sound/digitalk.h
index 7be2a733c56..4142a50e3e2 100644
--- a/src/devices/sound/digitalk.h
+++ b/src/devices/sound/digitalk.h
@@ -59,7 +59,7 @@ private:
void digitalker_register_for_save();
private:
- const UINT8 *m_rom;
+ required_region_ptr<UINT8> m_rom;
sound_stream *m_stream;
// Port/lines state
diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp
index 6fe6b0de784..16d647ba444 100644
--- a/src/devices/sound/gaelco.cpp
+++ b/src/devices/sound/gaelco.cpp
@@ -60,8 +60,7 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char
: device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock, "gaelco_gae1", __FILE__),
device_sound_interface(mconfig, *this),
m_stream(nullptr),
- m_snd_data(nullptr),
- m_data_tag(nullptr)
+ m_snd_data(*this)
{
}
@@ -69,8 +68,7 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_sound_interface(mconfig, *this),
m_stream(nullptr),
- m_snd_data(nullptr),
- m_data_tag(nullptr)
+ m_snd_data(*this)
{
}
@@ -242,8 +240,6 @@ void gaelco_gae1_device::device_start()
{
m_stream = stream_alloc(0, 2, 8000);
- m_snd_data = owner()->memregion(m_data_tag)->base();
-
/* init volume table */
for (int vol = 0; vol < GAELCO_VOLUME_LEVELS; vol++){
for (int j = -128; j <= 127; j++){
diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h
index 8c128ab4bdc..91b90158667 100644
--- a/src/devices/sound/gaelco.h
+++ b/src/devices/sound/gaelco.h
@@ -14,7 +14,7 @@
//**************************************************************************
#define MCFG_GAELCO_SND_DATA(_tag) \
- gaelco_gae1_device::set_snd_data_tag(*device, _tag);
+ gaelco_gae1_device::set_snd_data_tag(*device, "^" _tag);
#define MCFG_GAELCO_BANKS(_offs1, _offs2, _offs3, _offs4) \
gaelco_gae1_device::set_bank_offsets(*device, _offs1, _offs2, _offs3, _offs4);
@@ -44,7 +44,7 @@ public:
gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
~gaelco_gae1_device() { }
- static void set_snd_data_tag(device_t &device, const char *tag) { downcast<gaelco_gae1_device &>(device).m_data_tag = tag; }
+ static void set_snd_data_tag(device_t &device, const char *tag) { downcast<gaelco_gae1_device &>(device).m_snd_data.set_tag(tag); }
static void set_bank_offsets(device_t &device, int offs1, int offs2, int offs3, int offs4)
{
gaelco_gae1_device &dev = downcast<gaelco_gae1_device &>(device);
@@ -68,12 +68,10 @@ public:
private:
sound_stream *m_stream; /* our stream */
- UINT8 *m_snd_data; /* PCM data */
+ required_region_ptr<UINT8> m_snd_data; /* PCM data */
int m_banks[4]; /* start of each ROM bank */
gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */
- const char *m_data_tag;
-
UINT16 m_sndregs[0x38];
// Table for converting from 8 to 16 bits with volume control
diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp
index b913546337e..8f5daf20762 100644
--- a/src/devices/sound/iremga20.cpp
+++ b/src/devices/sound/iremga20.cpp
@@ -49,8 +49,7 @@ const device_type IREMGA20 = &device_creator<iremga20_device>;
iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, IREMGA20, "Irem GA20", tag, owner, clock, "iremga20", __FILE__),
device_sound_interface(mconfig, *this),
- m_rom(nullptr),
- m_rom_size(0),
+ m_rom(*this, DEVICE_SELF),
m_stream(nullptr)
{
}
@@ -64,10 +63,6 @@ void iremga20_device::device_start()
{
int i;
- /* Initialize our chip structure */
- m_rom = m_region->base();
- m_rom_size = m_region->bytes();
-
iremga20_reset();
for ( i = 0; i < 0x40; i++ )
@@ -125,7 +120,7 @@ void iremga20_device::sound_stream_update(sound_stream &stream, stream_sample_t
}
i = samples;
- pSamples = m_rom;
+ pSamples = &m_rom[0];
outL = outputs[0];
outR = outputs[1];
diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h
index 1b6d73674e2..daf1469df74 100644
--- a/src/devices/sound/iremga20.h
+++ b/src/devices/sound/iremga20.h
@@ -65,8 +65,7 @@ private:
void iremga20_reset();
private:
- UINT8 *m_rom;
- INT32 m_rom_size;
+ required_region_ptr<UINT8> m_rom;
sound_stream *m_stream;
UINT16 m_regs[0x40];
IremGA20_channel_def m_channel[4];
diff --git a/src/devices/sound/k005289.cpp b/src/devices/sound/k005289.cpp
index b49d97b1555..aa0fa52c110 100644
--- a/src/devices/sound/k005289.cpp
+++ b/src/devices/sound/k005289.cpp
@@ -56,7 +56,7 @@ const device_type K005289 = &device_creator<k005289_device>;
k005289_device::k005289_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K005289, "K005289 SCC", tag, owner, clock, "k005289", __FILE__),
device_sound_interface(mconfig, *this),
- m_sound_prom(nullptr),
+ m_sound_prom(*this, DEVICE_SELF),
m_stream(nullptr),
m_rate(0),
m_mixer_table(nullptr),
@@ -82,8 +82,6 @@ void k005289_device::device_start()
/* build the mixer table */
make_mixer_table(2);
- m_sound_prom = m_region->base();
-
/* reset all the voices */
for (int i = 0; i < 2; i++)
{
@@ -119,7 +117,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
f=m_frequency[0];
if (v && f)
{
- const unsigned char *w = m_sound_prom + m_waveform[0];
+ const unsigned char *w = &m_sound_prom[m_waveform[0]];
int c = m_counter[0];
mix = m_mixer_buffer.get();
@@ -142,7 +140,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
f=m_frequency[1];
if (v && f)
{
- const unsigned char *w = m_sound_prom + m_waveform[1];
+ const unsigned char *w = &m_sound_prom[m_waveform[1]];
int c = m_counter[1];
mix = m_mixer_buffer.get();
diff --git a/src/devices/sound/k005289.h b/src/devices/sound/k005289.h
index 24f84638263..ad085ba9482 100644
--- a/src/devices/sound/k005289.h
+++ b/src/devices/sound/k005289.h
@@ -43,7 +43,7 @@ public:
private:
void make_mixer_table(int voices);
- const unsigned char *m_sound_prom;
+ required_region_ptr<UINT8> m_sound_prom;
sound_stream *m_stream;
int m_rate;
diff --git a/src/devices/sound/k007232.cpp b/src/devices/sound/k007232.cpp
index cc25519e4b9..1272f7b579b 100644
--- a/src/devices/sound/k007232.cpp
+++ b/src/devices/sound/k007232.cpp
@@ -162,7 +162,7 @@ k007232_device::k007232_device(const machine_config &mconfig, const char *tag, d
void k007232_device::device_start()
{
/* Set up the chips */
- m_pcmlimit = region()->bytes();
+ m_pcmlimit = m_rom.bytes();
m_port_write_handler.resolve();
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index f3ebc4b2445..01d70d0f676 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -76,10 +76,8 @@ const device_type K053260 = &device_creator<k053260_device>;
k053260_device::k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K053260, "K053260 KDSC", tag, owner, clock, "k053260", __FILE__),
device_sound_interface(mconfig, *this),
- m_rgnoverride(nullptr),
m_stream(nullptr),
- m_rom(nullptr),
- m_rom_size(0),
+ m_rom(*this, DEVICE_SELF),
m_keyon(0),
m_mode(0)
{
@@ -93,10 +91,6 @@ k053260_device::k053260_device(const machine_config &mconfig, const char *tag, d
void k053260_device::device_start()
{
- memory_region *ROM = (m_rgnoverride) ? owner()->memregion(m_rgnoverride) : region();
- m_rom = ROM->base();
- m_rom_size = ROM->bytes();
-
m_stream = stream_alloc( 0, 2, clock() / CLOCKS_PER_SAMPLE );
/* register with the save state system */
@@ -381,10 +375,10 @@ void k053260_device::KDSC_Voice::update_pan_volume()
void k053260_device::KDSC_Voice::key_on()
{
- if (m_start >= m_device->m_rom_size)
+ if (m_start >= m_device->m_rom.bytes())
m_device->logerror("K053260: Attempting to start playing past the end of the ROM ( start = %06x, length = %06x )\n", m_start, m_length);
- else if (m_start + m_length >= m_device->m_rom_size)
+ else if (m_start + m_length >= m_device->m_rom.bytes())
m_device->logerror("K053260: Attempting to play past the end of the ROM ( start = %06x, length = %06x )\n",
m_start, m_length);
@@ -462,10 +456,10 @@ UINT8 k053260_device::KDSC_Voice::read_rom()
m_position = (m_position + 1) & 0xffff;
- if (offs >= m_device->m_rom_size)
+ if (offs >= m_device->m_rom.bytes())
{
m_device->logerror("%s: K053260: Attempting to read past the end of the ROM (offs = %06x, size = %06x)\n",
- m_device->machine().describe_context(), offs, m_device->m_rom_size);
+ m_device->machine().describe_context(), offs, m_device->m_rom.bytes());
return 0;
}
diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h
index ace87855740..e80a2da87d7 100644
--- a/src/devices/sound/k053260.h
+++ b/src/devices/sound/k053260.h
@@ -22,7 +22,7 @@
MCFG_DEVICE_REPLACE(_tag, K053260, _clock)
#define MCFG_K053260_REGION(_tag) \
- k053260_device::set_region_tag(*device, _tag);
+ k053260_device::set_region_tag(*device, "^" _tag);
//**************************************************************************
@@ -38,7 +38,7 @@ public:
k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k053260_device() { }
- static void set_region_tag(device_t &device, const char *tag) { downcast<k053260_device &>(device).m_rgnoverride = tag; }
+ static void set_region_tag(device_t &device, const char *tag) { downcast<k053260_device &>(device).m_rom.set_tag(tag); }
DECLARE_READ8_MEMBER( main_read );
DECLARE_WRITE8_MEMBER( main_write );
@@ -55,11 +55,8 @@ protected:
private:
// configuration
- const char * m_rgnoverride;
-
sound_stream * m_stream;
- UINT8 * m_rom;
- UINT32 m_rom_size;
+ required_region_ptr<UINT8> m_rom;
// live state
UINT8 m_portdata[4];
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index 5270f5b80d6..41a2161569b 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -19,10 +19,19 @@ const device_type K054539 = &device_creator<k054539_device>;
k054539_device::k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K054539, "K054539 ADPCM", tag, owner, clock, "k054539", __FILE__),
- device_sound_interface(mconfig, *this), flags(0), ram(nullptr), reverb_pos(0), cur_ptr(0), cur_limit(0),
- cur_zone(nullptr), rom(nullptr), rom_size(0), rom_mask(0), stream(nullptr), m_timer(nullptr), m_timer_state(0),
- m_timer_handler(*this),
- m_rgnoverride(nullptr)
+ device_sound_interface(mconfig, *this),
+ flags(0),
+ ram(nullptr),
+ reverb_pos(0),
+ cur_ptr(0),
+ cur_limit(0),
+ cur_zone(nullptr),
+ m_rom(*this, DEVICE_SELF),
+ rom_mask(0),
+ stream(nullptr),
+ m_timer(nullptr),
+ m_timer_state(0),
+ m_timer_handler(*this)
{
}
@@ -190,10 +199,10 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
cur_pos += pdelta;
cur_pval = cur_val;
- cur_val = (INT16)(rom[cur_pos] << 8);
+ cur_val = (INT16)(m_rom[cur_pos] << 8);
if(cur_val == (INT16)0x8000 && (base2[1] & 1)) {
cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
- cur_val = (INT16)(rom[cur_pos] << 8);
+ cur_val = (INT16)(m_rom[cur_pos] << 8);
}
if(cur_val == (INT16)0x8000) {
keyoff(ch);
@@ -213,10 +222,10 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
cur_pos += pdelta;
cur_pval = cur_val;
- cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
+ cur_val = (INT16)(m_rom[cur_pos] | m_rom[cur_pos+1]<<8);
if(cur_val == (INT16)0x8000 && (base2[1] & 1)) {
cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
- cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
+ cur_val = (INT16)(m_rom[cur_pos] | m_rom[cur_pos+1]<<8);
}
if(cur_val == (INT16)0x8000) {
keyoff(ch);
@@ -241,10 +250,10 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
cur_pos += pdelta;
cur_pval = cur_val;
- cur_val = rom[cur_pos>>1];
+ cur_val = m_rom[cur_pos>>1];
if(cur_val == 0x88 && (base2[1] & 1)) {
cur_pos = ((base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask) << 1;
- cur_val = rom[cur_pos>>1];
+ cur_val = m_rom[cur_pos>>1];
}
if(cur_val == 0x88) {
keyoff(ch);
@@ -311,12 +320,9 @@ void k054539_device::init_chip()
cur_ptr = 0;
memset(ram.get(), 0, 0x4000);
- memory_region *reg = (m_rgnoverride != nullptr) ? owner()->memregion(m_rgnoverride) : region();
- rom = reg->base();
- rom_size = reg->bytes();
rom_mask = 0xffffffffU;
for(int i=0; i<32; i++)
- if((1U<<i) >= rom_size) {
+ if((1U<<i) >= m_rom.bytes()) {
rom_mask = (1U<<i) - 1;
break;
}
@@ -429,7 +435,7 @@ WRITE8_MEMBER(k054539_device::write)
case 0x22e:
cur_zone =
data == 0x80 ? ram.get() :
- rom + 0x20000*data;
+ &m_rom[0x20000*data];
cur_limit = data == 0x80 ? 0x4000 : 0x20000;
cur_ptr = 0;
break;
@@ -466,7 +472,7 @@ WRITE8_MEMBER(k054539_device::write)
void k054539_device::device_post_load()
{
int data = regs[0x22e];
- cur_zone = data == 0x80 ? ram.get() : rom + 0x20000*data;
+ cur_zone = data == 0x80 ? ram.get() : &m_rom[0x20000*data];
cur_limit = data == 0x80 ? 0x4000 : 0x20000;
}
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index fd196d306b8..a035f941f2b 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -18,7 +18,7 @@ typedef device_delegate<void (double left, double right)> k054539_cb_delegate;
k054539_device::set_analog_callback(*device, k054539_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_K054539_REGION_OVERRRIDE(_region) \
- k054539_device::set_override(*device, _region);
+ k054539_device::set_override(*device, "^" _region);
#define MCFG_K054539_TIMER_HANDLER(_devcb) \
devcb = &k054539_device::set_timer_handler(*device, DEVCB_##_devcb);
@@ -46,7 +46,7 @@ public:
// static configuration helpers
static void set_analog_callback(device_t &device, k054539_cb_delegate callback) { downcast<k054539_device &>(device).m_apan_cb = callback; }
- static void set_override(device_t &device, const char *rgnoverride) { downcast<k054539_device &>(device).m_rgnoverride = rgnoverride; }
+ static void set_override(device_t &device, const char *rgnoverride) { downcast<k054539_device &>(device).m_rom.set_tag(rgnoverride); }
template<class _Object> static devcb_base &set_timer_handler(device_t &device, _Object object) { return downcast<k054539_device &>(device).m_timer_handler.set_callback(object); }
@@ -100,8 +100,7 @@ private:
INT32 cur_ptr;
int cur_limit;
unsigned char *cur_zone;
- unsigned char *rom;
- UINT32 rom_size;
+ required_region_ptr<UINT8> m_rom;
UINT32 rom_mask;
channel channels[8];
@@ -110,7 +109,6 @@ private:
emu_timer *m_timer;
UINT32 m_timer_state;
devcb_write_line m_timer_handler;
- const char *m_rgnoverride;
k054539_cb_delegate m_apan_cb;
bool regupdate();
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.cpp b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
index ca30c79e5fc..526cbda9d9e 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.cpp
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.cpp
@@ -105,8 +105,7 @@ l7a1045_sound_device::l7a1045_sound_device(const machine_config &mconfig, const
device_sound_interface(mconfig, *this),
m_stream(nullptr),
m_key(0),
- m_rom(nullptr),
- m_rom_size(0)
+ m_rom(*this, DEVICE_SELF)
{
}
@@ -119,9 +118,6 @@ void l7a1045_sound_device::device_start()
{
/* Allocate the stream */
m_stream = stream_alloc(0, 2, 66150); //clock() / 384);
-
- m_rom = m_region->base();
- m_rom_size = m_region->bytes();
}
@@ -171,7 +167,7 @@ void l7a1045_sound_device::sound_stream_update(sound_stream &stream, stream_samp
}
- data = m_rom[(start + pos) & (m_rom_size-1)];
+ data = m_rom[(start + pos) & m_rom.mask()];
sample = ((INT8)(data & 0xfc)) << (3 - (data & 3));
frac += step;
@@ -252,7 +248,7 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w)
vptr->start |= (m_audiodat[m_audioregister][m_audiochannel].dat[1] & 0xffff) << (4);
vptr->start |= (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xf000) >> (12);
- vptr->start &= m_rom_size - 1;
+ vptr->start &= m_rom.mask();
break;
case 0x01:
@@ -267,7 +263,7 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w)
vptr->end += vptr->start;
vptr->mode = false;
// hopefully it'll never happen? Maybe assert here?
- vptr->end &= m_rom_size - 1;
+ vptr->end &= m_rom.mask();
}
else // absolute
@@ -277,7 +273,7 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w)
vptr->end |= (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xf000) >> (12);
vptr->mode = true;
- vptr->end &= m_rom_size - 1;
+ vptr->end &= m_rom.mask();
}
break;
diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.h b/src/devices/sound/l7a1045_l6028_dsp_a.h
index e97edefc814..49c5670263d 100644
--- a/src/devices/sound/l7a1045_l6028_dsp_a.h
+++ b/src/devices/sound/l7a1045_l6028_dsp_a.h
@@ -48,8 +48,7 @@ private:
sound_stream *m_stream;
l7a1045_voice m_voice[32];
UINT32 m_key;
- UINT8 *m_rom;
- INT32 m_rom_size;
+ required_region_ptr<UINT8> m_rom;
UINT8 m_audiochannel;
UINT8 m_audioregister;
diff --git a/src/devices/sound/nile.cpp b/src/devices/sound/nile.cpp
index 3a21b1c6415..ecb193d005a 100644
--- a/src/devices/sound/nile.cpp
+++ b/src/devices/sound/nile.cpp
@@ -56,7 +56,7 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_
: device_t(mconfig, NILE, "NiLe", tag, owner, clock, "nile", __FILE__),
device_sound_interface(mconfig, *this),
m_stream(nullptr),
- m_sound_ram(nullptr),
+ m_sound_ram(*this, DEVICE_SELF),
m_ctrl(0)
{
}
@@ -68,7 +68,6 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_
void nile_device::device_start()
{
- m_sound_ram = region()->base();
m_stream = stream_alloc(0, 2, 44100);
}
@@ -80,7 +79,7 @@ void nile_device::device_start()
void nile_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
- UINT8 *sound_ram = m_sound_ram;
+ UINT8 *sound_ram = &m_sound_ram[0];
int v, i, snum;
UINT16 *slot;
INT32 mix[48000*2];
diff --git a/src/devices/sound/nile.h b/src/devices/sound/nile.h
index 4265f439813..0a298d6b9b8 100644
--- a/src/devices/sound/nile.h
+++ b/src/devices/sound/nile.h
@@ -46,7 +46,7 @@ public:
private:
sound_stream *m_stream;
- UINT8 *m_sound_ram;
+ required_region_ptr<UINT8> m_sound_ram;
UINT16 m_sound_regs[0x80];
int m_vpos[NILE_VOICES];
int m_frac[NILE_VOICES];
diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp
index 7e97d04e916..d7af7157792 100644
--- a/src/devices/sound/okim6295.cpp
+++ b/src/devices/sound/okim6295.cpp
@@ -91,6 +91,7 @@ okim6295_device::okim6295_device(const machine_config &mconfig, const char *tag,
device_sound_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
m_space_config("samples", ENDIANNESS_LITTLE, 8, 18, 0, nullptr, *ADDRESS_MAP_NAME(okim6295)),
+ m_region(*this, DEVICE_SELF),
m_command(-1),
m_bank_installed(false),
m_bank_offs(0),
diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h
index 36be5b3a084..4fb85839f5c 100644
--- a/src/devices/sound/okim6295.h
+++ b/src/devices/sound/okim6295.h
@@ -103,6 +103,7 @@ protected:
// configuration state
const address_space_config m_space_config;
+ optional_memory_region m_region;
// internal state
static const int OKIM6295_VOICES = 4;
diff --git a/src/devices/sound/tc8830f.cpp b/src/devices/sound/tc8830f.cpp
index 06759146d93..1db6ab5bad4 100644
--- a/src/devices/sound/tc8830f.cpp
+++ b/src/devices/sound/tc8830f.cpp
@@ -37,7 +37,8 @@ tc8830f_device::tc8830f_device(const machine_config &mconfig, const char *tag, d
m_output(0),
m_command(0),
m_cmd_rw(0),
- m_phrase(0), m_mem_base(nullptr), m_mem_mask(0)
+ m_phrase(0),
+ m_mem(*this, DEVICE_SELF)
{
}
@@ -47,9 +48,6 @@ void tc8830f_device::device_start()
// create the stream
m_stream = stream_alloc(0, 1, clock() / 0x10);
- m_mem_base = region()->base();
- m_mem_mask = region()->bytes() - 1;
-
// register for savestates
save_item(NAME(m_playing));
save_item(NAME(m_address));
@@ -90,11 +88,11 @@ void tc8830f_device::sound_stream_update(sound_stream &stream, stream_sample_t *
if (m_playing)
{
// get bit
- int bit = m_mem_base[m_address] >> m_bitcount & 1;
+ int bit = m_mem[m_address] >> m_bitcount & 1;
m_bitcount = (m_bitcount + 1) & 7;
if (m_bitcount == 0)
{
- m_address = (m_address + 1) & m_mem_mask;
+ m_address = (m_address + 1) & m_mem.mask();
if (m_address == m_stop_address)
m_playing = false;
}
@@ -199,7 +197,7 @@ void tc8830f_device::write_p(UINT8 data)
m_address = (m_address & ~(0xf << (m_cmd_rw*4))) | (data << (m_cmd_rw*4));
if (m_cmd_rw == 5)
{
- m_address &= m_mem_mask;
+ m_address &= m_mem.mask();
m_bitcount = 0;
m_cmd_rw = -1;
}
@@ -210,7 +208,7 @@ void tc8830f_device::write_p(UINT8 data)
m_stop_address = (m_stop_address & ~(0xf << (m_cmd_rw*4))) | (data << (m_cmd_rw*4));
if (m_cmd_rw == 5)
{
- m_stop_address &= m_mem_mask;
+ m_stop_address &= m_mem.mask();
m_cmd_rw = -1;
}
break;
@@ -234,9 +232,9 @@ void tc8830f_device::write_p(UINT8 data)
// update addresses and start
UINT8 offs = m_phrase * 4;
- m_address = (m_mem_base[offs] | m_mem_base[offs|1]<<8 | m_mem_base[offs|2]<<16) & m_mem_mask;
+ m_address = (m_mem[offs] | m_mem[offs|1]<<8 | m_mem[offs|2]<<16) & m_mem.mask();
offs += 4;
- m_stop_address = (m_mem_base[offs] | m_mem_base[offs|1]<<8 | m_mem_base[offs|2]<<16) & m_mem_mask;
+ m_stop_address = (m_mem[offs] | m_mem[offs|1]<<8 | m_mem[offs|2]<<16) & m_mem.mask();
m_bitcount = 0;
m_prevbits = 0;
diff --git a/src/devices/sound/tc8830f.h b/src/devices/sound/tc8830f.h
index 655e83167a6..7b7059152ca 100644
--- a/src/devices/sound/tc8830f.h
+++ b/src/devices/sound/tc8830f.h
@@ -60,8 +60,7 @@ private:
int m_cmd_rw;
UINT8 m_phrase;
- UINT8 *m_mem_base;
- UINT32 m_mem_mask;
+ required_region_ptr<UINT8> m_mem;
};
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp
index aa98b69697a..6e7de3e445c 100644
--- a/src/devices/sound/tms5110.cpp
+++ b/src/devices/sound/tms5110.cpp
@@ -1184,7 +1184,7 @@ void tms5110_device::device_reset()
m_RNG = 0x1FFF;
memset(m_u, 0, sizeof(m_u));
memset(m_x, 0, sizeof(m_x));
- if (m_table != nullptr)
+ if (m_table.found())
{
/* legacy interface */
m_schedule_dummy_read = TRUE;
@@ -1454,11 +1454,6 @@ void tmsprom_device::device_start()
m_pdc_cb.resolve_safe();
m_ctl_cb.resolve_safe();
- m_rom = region()->base();
- assert_always(m_rom != nullptr, "Error creating TMSPROM chip: No rom region found");
- m_prom = owner()->memregion(m_prom_region)->base();
- assert_always(m_prom != nullptr, "Error creating TMSPROM chip: No prom region found");
-
m_romclk_timer = timer_alloc(0);
m_romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()));
@@ -1614,7 +1609,8 @@ const device_type TMSPROM = &device_creator<tmsprom_device>;
tmsprom_device::tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, TMSPROM, "TMSPROM", tag, owner, clock, "tmsprom", __FILE__),
- m_prom_region(""),
+ m_rom(*this, DEVICE_SELF),
+ m_prom(*this, 0x20),
m_rom_size(0),
m_pdc_bit(0),
m_ctl1_bit(0),
diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h
index 8eb5306eaf9..8cba11e64f3 100644
--- a/src/devices/sound/tms5110.h
+++ b/src/devices/sound/tms5110.h
@@ -298,7 +298,7 @@ class tmsprom_device : public device_t
public:
tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void set_region(device_t &device, const char *region) { downcast<tmsprom_device &>(device).m_prom_region = region; }
+ static void set_region(device_t &device, const char *region) { downcast<tmsprom_device &>(device).m_prom.set_tag(region); }
static void set_rom_size(device_t &device, UINT32 rom_size) { downcast<tmsprom_device &>(device).m_rom_size = rom_size; }
static void set_pdc_bit(device_t &device, UINT8 pdc_bit) { downcast<tmsprom_device &>(device).m_pdc_bit = pdc_bit; }
static void set_ctl1_bit(device_t &device, UINT8 ctl1_bit) { downcast<tmsprom_device &>(device).m_ctl1_bit = ctl1_bit; }
@@ -339,7 +339,8 @@ private:
int m_prom_cnt;
- const char *m_prom_region; /* prom memory region - sound region is automatically assigned */
+ required_region_ptr<UINT8> m_rom;
+ required_region_ptr<UINT8> m_prom;
UINT32 m_rom_size; /* individual rom_size */
UINT8 m_pdc_bit; /* bit # of pdc line */
/* virtual bit 8: constant 0, virtual bit 9:constant 1 */
@@ -353,14 +354,12 @@ private:
devcb_write8 m_ctl_cb; /* tms ctl func */
emu_timer *m_romclk_timer;
- const UINT8 *m_rom;
- const UINT8 *m_prom;
};
extern const device_type TMSPROM;
#define MCFG_TMSPROM_REGION(_region) \
- tmsprom_device::set_region(*device, _region);
+ tmsprom_device::set_region(*device, "^" _region);
#define MCFG_TMSPROM_ROM_SIZE(_size) \
tmsprom_device::set_rom_size(*device, _size);
diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp
index ca743e73d70..bb050d53182 100644
--- a/src/devices/sound/tms5220.cpp
+++ b/src/devices/sound/tms5220.cpp
@@ -525,7 +525,7 @@ static void printbits(long data, int num)
{
int i;
for (i=(num-1); i>=0; i--)
- fprintf(stderr,"%0ld", (data>>i)&1);
+ logerror("%0ld", (data>>i)&1);
}
#endif
#ifdef DEBUG_PARSE_FRAME_DUMP_HEX
@@ -534,19 +534,19 @@ static void printbits(long data, int num)
switch((num-1)&0xFC)
{
case 0:
- fprintf(stderr,"%0lx", data);
+ logerror("%0lx", data);
break;
case 4:
- fprintf(stderr,"%02lx", data);
+ logerror("%02lx", data);
break;
case 8:
- fprintf(stderr,"%03lx", data);
+ logerror("%03lx", data);
break;
case 12:
- fprintf(stderr,"%04lx", data);
+ logerror("%04lx", data);
break;
default:
- fprintf(stderr,"%04lx", data);
+ logerror("%04lx", data);
break;
}
}
@@ -625,7 +625,7 @@ void tms5220_device::data_write(int data)
m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE;
m_fifo_count++;
#ifdef DEBUG_FIFO
- fprintf(stderr,"data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count);
+ logerror("data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count);
#endif
update_fifo_status_and_ints();
// if we just unset buffer low with that last write, and SPEN *was* zero (see circuit 251, sheet 12)
@@ -633,7 +633,7 @@ void tms5220_device::data_write(int data)
{
int i;
#ifdef DEBUG_FIFO
- fprintf(stderr,"data_write triggered SPEN to go active!\n");
+ logerror("data_write triggered SPEN to go active!\n");
#endif
// ...then we now have enough bytes to start talking; set zpar and clear out the new frame parameters (it will become old frame just before the first call to parse_frame() )
m_zpar = 1;
@@ -662,7 +662,7 @@ void tms5220_device::data_write(int data)
else
{
#ifdef DEBUG_FIFO
- fprintf(stderr,"data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
+ logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
// at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it.
#endif
}
@@ -736,7 +736,7 @@ void tms5220_device::update_fifo_status_and_ints()
if (m_previous_TALK_STATUS == 1 && (TALK_STATUS == 0))
{
#ifdef VERBOSE
- fprintf(stderr,"Talk status WAS 1, is now 0, unsetting DDIS and firing an interrupt!\n");
+ logerror("Talk status WAS 1, is now 0, unsetting DDIS and firing an interrupt!\n");
#endif
set_interrupt_state(1);
m_DDIS = 0;
@@ -825,7 +825,7 @@ int tms5220_device::status_read()
/* clear the interrupt pin on status read */
set_interrupt_state(0);
#ifdef DEBUG_PIN_READS
- fprintf(stderr,"Status read: TS=%d BL=%d BE=%d\n", TALK_STATUS, m_buffer_low, m_buffer_empty);
+ logerror("Status read: TS=%d BL=%d BE=%d\n", TALK_STATUS, m_buffer_low, m_buffer_empty);
#endif
return (TALK_STATUS << 7) | (m_buffer_low << 6) | (m_buffer_empty << 5);
}
@@ -841,7 +841,7 @@ int tms5220_device::status_read()
int tms5220_device::ready_read()
{
#ifdef DEBUG_PIN_READS
- fprintf(stderr,"ready_read: ready pin read, io_ready is %d, fifo count is %d, DDIS(speak external) is %d\n", m_io_ready, m_fifo_count, m_DDIS);
+ logerror("ready_read: ready pin read, io_ready is %d, fifo count is %d, DDIS(speak external) is %d\n", m_io_ready, m_fifo_count, m_DDIS);
#endif
return ((m_fifo_count < FIFO_SIZE)||(!m_DDIS)) && m_io_ready;
}
@@ -899,7 +899,7 @@ int tms5220_device::cycles_to_ready()
int tms5220_device::int_read()
{
#ifdef DEBUG_PIN_READS
- fprintf(stderr,"int_read: irq pin read, state is %d\n", m_irq_pin);
+ logerror("int_read: irq pin read, state is %d\n", m_irq_pin);
#endif
return m_irq_pin;
}
@@ -918,7 +918,7 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
INT32 this_sample;
#ifdef VERBOSE
- fprintf(stderr,"process called with size of %d; IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", size, m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
+ logerror("process called with size of %d; IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", size, m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
#endif
/* loop until the buffer is full or we've stopped speaking */
@@ -975,14 +975,14 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
#ifdef DEBUG_GENERATION
/* Debug info for current parsed frame */
- fprintf(stderr, "OLDE: %d; NEWE: %d; OLDP: %d; NEWP: %d ", OLD_FRAME_SILENCE_FLAG, NEW_FRAME_SILENCE_FLAG, OLD_FRAME_UNVOICED_FLAG, NEW_FRAME_UNVOICED_FLAG);
- fprintf(stderr,"Processing new frame: ");
+ logerror( "OLDE: %d; NEWE: %d; OLDP: %d; NEWP: %d ", OLD_FRAME_SILENCE_FLAG, NEW_FRAME_SILENCE_FLAG, OLD_FRAME_UNVOICED_FLAG, NEW_FRAME_UNVOICED_FLAG);
+ logerror("Processing new frame: ");
if (m_inhibit == 0)
- fprintf(stderr, "Normal Frame\n");
+ logerror( "Normal Frame\n");
else
- fprintf(stderr,"Interpolation Inhibited\n");
- fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
- fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",
+ logerror("Interpolation Inhibited\n");
+ logerror("*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
+ logerror("*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",
(m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)),
m_new_frame_energy_idx,
(m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)),
@@ -1006,7 +1006,7 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
//int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7));
- //fprintf(stderr, "CS: %03d", current_sample);
+ //logerror( "CS: %03d", current_sample);
// reset the current energy, pitch, etc to what it was at frame start
m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_old_zpar));
m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar));
@@ -1089,18 +1089,18 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
}
this_sample = lattice_filter(); /* execute lattice filter */
#ifdef DEBUG_GENERATION_VERBOSE
- //fprintf(stderr,"C:%01d; ",m_subcycle);
- fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
- //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
+ //logerror("C:%01d; ",m_subcycle);
+ logerror("IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
+ //logerror("X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
for (i=0; i<10; i++)
- fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]);
- fprintf(stderr,"Out:%06d ", this_sample);
+ logerror("K%d:%04d ", i+1, m_current_k[i]);
+ logerror("Out:%06d ", this_sample);
//#ifdef PERFECT_INTERPOLATION_HACK
-// fprintf(stderr,"%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar);
+// logerror("%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar);
//#else
-// fprintf(stderr,"x%dx%d",m_zpar,m_uv_zpar);
+// logerror("x%dx%d",m_zpar,m_uv_zpar);
//#endif
- fprintf(stderr,"\n");
+ logerror("\n");
#endif
/* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */
while (this_sample > 16383) this_sample -= 32768;
@@ -1145,17 +1145,17 @@ void tms5220_device::process(INT16 *buffer, unsigned int size)
OLD_FRAME_UNVOICED_FLAG = NEW_FRAME_UNVOICED_FLAG; // m_OLDP
/* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */
#ifdef DEBUG_GENERATION
- fprintf(stderr,"RESETL4, about to update status: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
+ logerror("RESETL4, about to update status: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
#endif
#ifdef DEBUG_GENERATION
if ((!m_TALK) && (!m_SPEN))
- fprintf(stderr,"tms5220_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n");
+ logerror("tms5220_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n");
#endif
m_TALKD = m_TALK; // TALKD is latched from TALK
update_fifo_status_and_ints(); // to trigger an interrupt if TALK_STATUS has changed
if ((!m_TALK) && m_SPEN) m_TALK = 1; // TALK is only activated if it wasn't already active, if m_SPEN is active, and if we're in RESETL4 (which we are).
#ifdef DEBUG_GENERATION
- fprintf(stderr,"RESETL4, status updated: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
+ logerror("RESETL4, status updated: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
#endif
}
m_subcycle = m_subc_reload;
@@ -1217,7 +1217,7 @@ static INT16 clip_analog(INT16 cliptemp)
* 0x xxxx xxxx xxxx -> 0b01111111
*/
#ifdef DEBUG_CLIP
- if ((cliptemp > 2047) || (cliptemp < -2048)) fprintf(stderr,"clipping cliptemp to range; was %d\n", cliptemp);
+ if ((cliptemp > 2047) || (cliptemp < -2048)) logerror("clipping cliptemp to range; was %d\n", cliptemp);
#endif
if (cliptemp > 2047) cliptemp = 2047;
else if (cliptemp < -2048) cliptemp = -2048;
@@ -1257,8 +1257,8 @@ static INT32 matrix_multiply(INT32 a, INT32 b)
while (b<-16384) { b+=32768; }
result = ((a*b)>>9); /** TODO: this isn't technically right to the chip, which truncates the lowest result bit, but it causes glitches otherwise. **/
#ifdef VERBOSE
- if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
- if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);
+ if (result>16383) logerror("matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
+ if (result<-16384) logerror("matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);
#endif
return result;
}
@@ -1321,18 +1321,18 @@ INT32 tms5220_device::lattice_filter()
m_previous_energy = m_current_energy;
#ifdef DEBUG_LATTICE
int i;
- fprintf(stderr,"V:%04d ", m_u[10]);
+ logerror("V:%04d ", m_u[10]);
for (i = 9; i >= 0; i--)
{
- fprintf(stderr,"Y%d:%04d ", i+1, m_u[i]);
+ logerror("Y%d:%04d ", i+1, m_u[i]);
}
- fprintf(stderr,"\n");
- fprintf(stderr,"E:%04d ", err);
+ logerror("\n");
+ logerror("E:%04d ", err);
for (i = 9; i >= 0; i--)
{
- fprintf(stderr,"b%d:%04d ", i+1, m_x[i]);
+ logerror("b%d:%04d ", i+1, m_x[i]);
}
- fprintf(stderr,"\n");
+ logerror("\n");
#endif
return m_u[0];
}
@@ -1348,7 +1348,7 @@ void tms5220_device::process_command(unsigned char cmd)
{
int i;
#ifdef DEBUG_COMMAND_DUMP
- fprintf(stderr,"process_command called with parameter %02X\n",cmd);
+ logerror("process_command called with parameter %02X\n",cmd);
#endif
/* parse the command */
switch (cmd & 0x70)
@@ -1379,7 +1379,7 @@ void tms5220_device::process_command(unsigned char cmd)
if (TALK_STATUS == 0) /* TALKST must be clear for RB */
{
#ifdef VERBOSE
- fprintf(stderr,"read and branch command received\n");
+ logerror("read and branch command received\n");
#endif
m_RDB_flag = FALSE;
if (m_speechrom)
@@ -1495,7 +1495,7 @@ void tms5220_device::parse_frame()
i = extract_bits(2);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(i,2);
- fprintf(stderr," ");
+ logerror(" ");
#endif
m_IP = reload_table[i];
}
@@ -1509,7 +1509,7 @@ void tms5220_device::parse_frame()
m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(m_new_frame_energy_idx,m_coeff->energy_bits);
- fprintf(stderr," ");
+ logerror(" ");
#endif
update_fifo_status_and_ints();
if (m_DDIS && m_buffer_empty) goto ranout;
@@ -1522,14 +1522,14 @@ void tms5220_device::parse_frame()
rep_flag = extract_bits(1);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(rep_flag, 1);
- fprintf(stderr," ");
+ logerror(" ");
#endif
// attempt to extract the pitch
m_new_frame_pitch_idx = extract_bits(m_coeff->pitch_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits);
- fprintf(stderr," ");
+ logerror(" ");
#endif
// if the new frame is unvoiced, be sure to zero out the k5-k10 parameters
m_uv_zpar = NEW_FRAME_UNVOICED_FLAG;
@@ -1545,7 +1545,7 @@ void tms5220_device::parse_frame()
m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
- fprintf(stderr," ");
+ logerror(" ");
#endif
update_fifo_status_and_ints();
if (m_DDIS && m_buffer_empty) goto ranout;
@@ -1564,25 +1564,25 @@ void tms5220_device::parse_frame()
m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
- fprintf(stderr," ");
+ logerror(" ");
#endif
update_fifo_status_and_ints();
if (m_DDIS && m_buffer_empty) goto ranout;
}
#ifdef DEBUG_PARSE_FRAME_DUMP
- fprintf(stderr,"\n");
+ logerror("\n");
#endif
#ifdef VERBOSE
if (m_DDIS)
- fprintf(stderr,"Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken));
+ logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken));
else
- fprintf(stderr,"Parsed a frame successfully in ROM\n");
+ logerror("Parsed a frame successfully in ROM\n");
#endif
return;
ranout:
#ifdef DEBUG_FRAME_ERRORS
- fprintf(stderr,"Ran out of bits on a parse!\n");
+ logerror("Ran out of bits on a parse!\n");
#endif
return;
}
@@ -1597,7 +1597,7 @@ void tms5220_device::set_interrupt_state(int state)
{
if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip, since there's no int pin
#ifdef DEBUG_PIN_READS
- fprintf(stderr,"irq pin set to state %d\n", state);
+ logerror("irq pin set to state %d\n", state);
#endif
if (!m_irq_handler.isnull() && state != m_irq_pin)
m_irq_handler(!state);
@@ -1614,7 +1614,7 @@ void tms5220_device::update_ready_state()
{
int state = ready_read();
#ifdef DEBUG_PIN_READS
- fprintf(stderr,"ready pin set to state %d\n", state);
+ logerror("ready pin set to state %d\n", state);
#endif
if (!m_readyq_handler.isnull() && state != m_ready_pin)
m_readyq_handler(!state);
@@ -1759,7 +1759,7 @@ void tms5220_device::device_reset()
m_speechrom->read(1);
m_schedule_dummy_read = FALSE;
}
-
+
// 5110 specific stuff
m_PDC = 0;
m_CTL_pins = 0;
@@ -1790,8 +1790,8 @@ void tms5220_device::device_timer(emu_timer &timer, device_timer_id id, int para
/* Write */
/* bring up to date first */
#ifdef DEBUG_IO_READY
- fprintf(stderr,"Serviced write: %02x\n", m_write_latch);
- //fprintf(stderr, "Processed write data: %02X\n", m_write_latch);
+ logerror("Serviced write: %02x\n", m_write_latch);
+ //logerror( "Processed write data: %02X\n", m_write_latch);
#endif
m_stream->update();
data_write(m_write_latch);
@@ -1802,7 +1802,7 @@ void tms5220_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_stream->update();
m_read_latch = status_read();
#ifdef DEBUG_IO_READY
- fprintf(stderr,"Serviced read, returning %02x\n", m_read_latch);
+ logerror("Serviced read, returning %02x\n", m_read_latch);
#endif
break;
case 0x03:
@@ -1829,7 +1829,7 @@ WRITE_LINE_MEMBER( tms5220_device::rsq_w )
m_true_timing = 1;
state &= 0x01;
#ifdef DEBUG_RS_WS
- fprintf(stderr,"/RS written with data: %d\n", state);
+ logerror("/RS written with data: %d\n", state);
#endif
new_val = (m_rs_ws & 0x01) | (state<<1);
if (new_val != m_rs_ws)
@@ -1842,7 +1842,7 @@ WRITE_LINE_MEMBER( tms5220_device::rsq_w )
#ifdef DEBUG_RS_WS
else
/* illegal */
- fprintf(stderr,"tms5220_rs_w: illegal\n");
+ logerror("tms5220_rsq_w: illegal\n");
#endif
return;
}
@@ -1860,7 +1860,7 @@ WRITE_LINE_MEMBER( tms5220_device::rsq_w )
{
/* high to low - schedule ready cycle */
#ifdef DEBUG_RS_WS
- fprintf(stderr,"Scheduling ready cycle for /RS...\n");
+ logerror("Scheduling ready cycle for /RS...\n");
#endif
/* upon /RS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
m_io_ready = 0;
@@ -1881,7 +1881,7 @@ WRITE_LINE_MEMBER( tms5220_device::wsq_w )
m_true_timing = 1;
state &= 0x01;
#ifdef DEBUG_RS_WS
- fprintf(stderr,"/WS written with data: %d\n", state);
+ logerror("/WS written with data: %d\n", state);
#endif
new_val = (m_rs_ws & 0x02) | (state<<0);
if (new_val != m_rs_ws)
@@ -1889,12 +1889,12 @@ WRITE_LINE_MEMBER( tms5220_device::wsq_w )
m_rs_ws = new_val;
if (new_val == 0)
{
- if (TMS5220_HAS_RATE_CONTROL) // correct for 5220c, ? for cd2501ecd
+ if (TMS5220_HAS_RATE_CONTROL) // correct for 5220c, probably also correct for cd2501ecd
reset();
#ifdef DEBUG_RS_WS
else
/* illegal */
- fprintf(stderr,"tms5220_ws_w: illegal\n");
+ logerror("tms5220_wsq_w: illegal\n");
#endif
return;
}
@@ -1912,12 +1912,12 @@ WRITE_LINE_MEMBER( tms5220_device::wsq_w )
{
/* high to low - schedule ready cycle */
#ifdef DEBUG_RS_WS
- fprintf(stderr,"Scheduling ready cycle for /WS...\n");
+ logerror("Scheduling ready cycle for /WS...\n");
#endif
/* upon /WS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
m_io_ready = 0;
update_ready_state();
- /* Now comes the complicated part: long does /READY stay inactive, when /WS is pulled low? This depends ENTIRELY on the command written, or whether the chip is in speak external mode or not...
+ /* Now comes the complicated part: how long does /READY stay inactive, when /WS is pulled low? This depends ENTIRELY on the command written, or whether the chip is in speak external mode or not...
Speak external mode: ~16 cycles
Command Mode:
SPK: ? cycles
@@ -1933,6 +1933,80 @@ WRITE_LINE_MEMBER( tms5220_device::wsq_w )
}
}
+/*
+ * combined /RS and /WS line write handler;
+ * /RS is bit 1, /WS is bit 0
+ * Note this is a hack and probably can be removed later, once the 'real' line handlers above defer by at least 4 clock cycles before taking effect
+ */
+WRITE8_MEMBER( tms5220_device::combined_rsq_wsq_w )
+{
+ UINT8 new_val;
+ UINT8 falling_edges;
+ m_true_timing = 1;
+#ifdef DEBUG_RS_WS
+ logerror("/RS and /WS written with %d and %d respectively\n", (data&2)>>1, data&1);
+#endif
+ new_val = data&0x03;
+ if (new_val != m_rs_ws)
+ {
+ falling_edges = ((m_rs_ws^new_val)&(~new_val));
+ m_rs_ws = new_val;
+ switch(new_val)
+ {
+ case 0:
+ if (TMS5220_HAS_RATE_CONTROL) // correct for 5220c, probably also correct for cd2501ecd
+ reset();
+#ifdef DEBUG_RS_WS
+ else
+ /* illegal */
+ logerror("tms5220_combined_rsq_wsq_w: illegal\n");
+#endif
+ return;
+ case 3:
+ /* high impedance */
+ m_read_latch = 0xff;
+ return;
+ case 2: // /WS active, /RS not
+ /* check for falling or rising edge */
+ if (!(falling_edges&0x01)) return; /* low to high, do nothing */
+ /* high to low - schedule ready cycle */
+#ifdef DEBUG_RS_WS
+ logerror("Scheduling ready cycle for /WS...\n");
+#endif
+ /* upon /WS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
+ m_io_ready = 0;
+ update_ready_state();
+ /* Now comes the complicated part: how long does /READY stay inactive, when /WS is pulled low? This depends ENTIRELY on the command written, or whether the chip is in speak external mode or not...
+ Speak external mode: ~16 cycles
+ Command Mode:
+ SPK: ? cycles
+ SPKEXT: ? cycles
+ RDBY: between 60 and 140 cycles
+ RB: ? cycles (80?)
+ RST: between 60 and 140 cycles
+ SET RATE (5220C and CD2501ECD only): ? cycles (probably ~16)
+ */
+ // TODO: actually HANDLE the timing differences! currently just assuming always 16 cycles
+ m_timer_io_ready->adjust(attotime::from_hz(clock()/16), 1); // this should take around 10-16 (closer to ~15) cycles to complete for fifo writes, TODO: but actually depends on what command is written if in command mode
+ return;
+ case 1: // /RS active, /WS not
+ /* check for falling or rising edge */
+ if (!(falling_edges&0x02)) return; /* low to high, do nothing */
+ /* high to low - schedule ready cycle */
+#ifdef DEBUG_RS_WS
+ logerror("Scheduling ready cycle for /RS...\n");
+#endif
+ /* upon /RS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
+ m_io_ready = 0;
+ update_ready_state();
+ /* How long does /READY stay inactive, when /RS is pulled low? I believe its almost always ~16 clocks (25 usec at 800khz as shown on the datasheet) */
+ m_timer_io_ready->adjust(attotime::from_hz(clock()/16), 1); // this should take around 10-16 (closer to ~11?) cycles to complete
+ return;
+ }
+ }
+}
+
+
/**********************************************************************************************
tms5220_data_w -- write data to the sound chip
@@ -1945,7 +2019,7 @@ WRITE8_MEMBER( tms5220_device::data_w )
if (space.debugger_access()) return;
#ifdef DEBUG_RS_WS
- fprintf(stderr,"tms5220_data_w: data %02x\n", data);
+ logerror("tms5220_data_w: data %02x\n", data);
#endif
if (!m_true_timing)
{
@@ -1958,7 +2032,7 @@ WRITE8_MEMBER( tms5220_device::data_w )
/* actually in a write ? */
#ifdef DEBUG_RS_WS
if (!(m_rs_ws == 0x02))
- fprintf(stderr,"tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws);
+ logerror("tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws);
#endif
m_write_latch = data;
}
@@ -1990,7 +2064,7 @@ READ8_MEMBER( tms5220_device::status_r )
return m_read_latch;
#ifdef DEBUG_RS_WS
else
- fprintf(stderr,"tms5220_status_r: data read outside rs!\n");
+ logerror("tms5220_status_r: data read outside rs!\n");
#endif
return 0xff;
}
diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h
index 38a0ea20dc7..4e17dd53574 100644
--- a/src/devices/sound/tms5220.h
+++ b/src/devices/sound/tms5220.h
@@ -8,6 +8,12 @@
#include "emu.h"
#include "machine/spchrom.h"
+enum
+{
+ RS=2,
+ WS=1
+};
+
/* HACK: if defined, uses impossibly perfect 'straight line' interpolation */
#undef PERFECT_INTERPOLATION_HACK
@@ -72,6 +78,8 @@ public:
WRITE_LINE_MEMBER( rsq_w );
WRITE_LINE_MEMBER( wsq_w );
+ DECLARE_WRITE8_MEMBER( combined_rsq_wsq_w ); // this hack is necessary for specific systems such as the TI 99/8 since the 5220c and cd2501ecd do specific things if both lines go active or inactive at slightly different times by separate write_line writes, which causes the chip to incorrectly reset itself on the 99/8, where the writes are supposed to happen simultaneously; /RS is bit 1, /WS is bit 0
+ // Note this is a hack and probably can be removed later, once the 'real' line handlers above defer by at least 4 clock cycles before taking effect
DECLARE_WRITE8_MEMBER( data_w );
DECLARE_READ8_MEMBER( status_r );
diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp
index 836a0de7eac..3bd8928e3e5 100644
--- a/src/devices/sound/vlm5030.cpp
+++ b/src/devices/sound/vlm5030.cpp
@@ -164,6 +164,7 @@ vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, d
device_sound_interface(mconfig, *this),
m_channel(nullptr),
m_coeff(nullptr),
+ m_region(*this, DEVICE_SELF),
m_rom(nullptr),
m_address_mask(0),
m_address(0),
@@ -215,8 +216,8 @@ void vlm5030_device::device_start()
device_reset();
m_phase = PH_IDLE;
- m_rom = region()->base();
- m_address_mask = (region()->bytes() - 1) & 0xffff;
+ m_rom = m_region->base();
+ m_address_mask = (m_region->bytes() - 1) & 0xffff;
m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 440);
@@ -388,6 +389,7 @@ void vlm5030_device::restore_state()
}
/* set speech rom address */
+// TO DO: rewrite using device_memory_interface to get rid of this ridiculous hack
void vlm5030_device::set_rom(void *speech_rom)
{
m_rom = (UINT8 *)speech_rom;
diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h
index cf2c620f13f..00264e4710c 100644
--- a/src/devices/sound/vlm5030.h
+++ b/src/devices/sound/vlm5030.h
@@ -47,6 +47,7 @@ private:
/* need to save state */
+ required_memory_region m_region;
UINT8 *m_rom;
int m_address_mask;
UINT16 m_address;
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index af186ff0100..67db79498e7 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -646,7 +646,7 @@ void ymf278b_device::C_w(UINT8 reg, UINT8 data)
case 0x06:
// memory data
- m_addrspace[0]->write_byte(m_memadr, data);
+ space(AS_0).write_byte(m_memadr, data);
m_memadr = (m_memadr + 1) & 0x3fffff;
break;
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index fad4f1b7558..9809c110c7a 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -583,11 +583,12 @@ void ymz280b_device::device_start()
m_master_clock = (double)clock() / 384.0;
m_irq_handler.resolve();
- if (region() != NULL)
+ memory_region *region = memregion(DEVICE_SELF);
+ if (region != nullptr)
{
/* Some systems (e.g. Konami Firebeat) have a YMZ280B on-board that isn't hooked up to ROM, so be safe. */
- m_mem_base = region()->base();
- m_mem_size = region()->bytes();
+ m_mem_base = region->base();
+ m_mem_size = region->bytes();
}
for (int i = 0; i < 8; i++)
diff --git a/src/devices/sound/ymz770.cpp b/src/devices/sound/ymz770.cpp
index 6456c346ffd..f6a9c17c0b0 100644
--- a/src/devices/sound/ymz770.cpp
+++ b/src/devices/sound/ymz770.cpp
@@ -38,7 +38,8 @@ ymz770_device::ymz770_device(const machine_config &mconfig, const char *tag, dev
m_doen(0),
m_vlma(0),
m_bsl(0),
- m_cpl(0), m_rom_base(nullptr), m_rom_limit(0)
+ m_cpl(0),
+ m_rom(*this, DEVICE_SELF)
{
}
@@ -51,14 +52,12 @@ void ymz770_device::device_start()
{
// create the stream
m_stream = machine().sound().stream_alloc(*this, 0, 2, 16000);
- m_rom_base = region()->base();
- m_rom_limit = region()->bytes() * 8;
for (auto & elem : m_channels)
{
elem.is_playing = false;
elem.is_seq_playing = false;
- elem.decoder = new mpeg_audio(m_rom_base, mpeg_audio::AMM, false, 0);
+ elem.decoder = new mpeg_audio(&m_rom[0], mpeg_audio::AMM, false, 0);
}
// register for save states
@@ -147,8 +146,8 @@ void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
// loop sequence
UINT8 sqn = elem.sequence;
- UINT32 pptr = m_rom_base[(4*sqn)+1+0x400]<<16 | m_rom_base[(4*sqn)+2+0x400]<<8 | m_rom_base[(4*sqn)+3+0x400];
- elem.seqdata = &m_rom_base[pptr];
+ UINT32 pptr = m_rom[(4*sqn)+1+0x400]<<16 | m_rom[(4*sqn)+2+0x400]<<8 | m_rom[(4*sqn)+3+0x400];
+ elem.seqdata = &m_rom[pptr];
}
else
{
@@ -190,8 +189,8 @@ retry:
{
// loop sample
UINT8 phrase = elem.phrase;
- elem.atbl = m_rom_base[(4*phrase)+0] >> 4 & 7;
- elem.pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]);
+ elem.atbl = m_rom[(4*phrase)+0] >> 4 & 7;
+ elem.pptr = 8*(m_rom[(4*phrase)+1]<<16 | m_rom[(4*phrase)+2]<<8 | m_rom[(4*phrase)+3]);
}
else
{
@@ -205,7 +204,7 @@ retry:
{
// next block
int sample_rate, channel_count;
- if (!elem.decoder->decode_buffer(elem.pptr, m_rom_limit, elem.output_data, elem.output_remaining, sample_rate, channel_count) || elem.output_remaining == 0)
+ if (!elem.decoder->decode_buffer(elem.pptr, m_rom.bytes()*8, elem.output_data, elem.output_remaining, sample_rate, channel_count) || elem.output_remaining == 0)
{
elem.is_playing = !elem.last_block; // detect infinite retry loop
elem.last_block = true;
@@ -295,8 +294,8 @@ void ymz770_device::internal_reg_write(UINT8 reg, UINT8 data)
if (data & 6)
{
UINT8 phrase = m_channels[ch].phrase;
- m_channels[ch].atbl = m_rom_base[(4*phrase)+0] >> 4 & 7;
- m_channels[ch].pptr = 8*(m_rom_base[(4*phrase)+1]<<16 | m_rom_base[(4*phrase)+2]<<8 | m_rom_base[(4*phrase)+3]);
+ m_channels[ch].atbl = m_rom[(4*phrase)+0] >> 4 & 7;
+ m_channels[ch].pptr = 8*(m_rom[(4*phrase)+1]<<16 | m_rom[(4*phrase)+2]<<8 | m_rom[(4*phrase)+3]);
m_channels[ch].last_block = false;
m_channels[ch].is_playing = true;
@@ -325,8 +324,8 @@ void ymz770_device::internal_reg_write(UINT8 reg, UINT8 data)
if (data & 6)
{
UINT8 sqn = m_channels[ch].sequence;
- UINT32 pptr = m_rom_base[(4*sqn)+1+0x400]<<16 | m_rom_base[(4*sqn)+2+0x400]<<8 | m_rom_base[(4*sqn)+3+0x400];
- m_channels[ch].seqdata = &m_rom_base[pptr];
+ UINT32 pptr = m_rom[(4*sqn)+1+0x400]<<16 | m_rom[(4*sqn)+2+0x400]<<8 | m_rom[(4*sqn)+3+0x400];
+ m_channels[ch].seqdata = &m_rom[pptr];
m_channels[ch].seqdelay = 0;
m_channels[ch].is_seq_playing = true;
}
diff --git a/src/devices/sound/ymz770.h b/src/devices/sound/ymz770.h
index ddcd72e7bfa..a52dbba8e3a 100644
--- a/src/devices/sound/ymz770.h
+++ b/src/devices/sound/ymz770.h
@@ -86,8 +86,7 @@ protected:
UINT8 m_vlma; // overall AAM volume
UINT8 m_bsl; // boost level
UINT8 m_cpl; // clip limiter
- UINT8 *m_rom_base;
- int m_rom_limit;
+ required_region_ptr<UINT8> m_rom;
ymz_channel m_channels[8];
};
diff --git a/src/devices/video/bufsprite.h b/src/devices/video/bufsprite.h
index 3a75f5a14f6..7e8606f454b 100644
--- a/src/devices/video/bufsprite.h
+++ b/src/devices/video/bufsprite.h
@@ -55,7 +55,7 @@ public:
// construction
buffered_spriteram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, type, "Buffered Sprite RAM", tag, owner, clock, "buffered_spriteram", __FILE__),
- m_spriteram(*owner, tag) { }
+ m_spriteram(*this, DEVICE_SELF) { }
// getters
_Type *live() const { return m_spriteram; }
diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp
index a46e32a34b7..057550d794b 100644
--- a/src/devices/video/ef9345.cpp
+++ b/src/devices/video/ef9345.cpp
@@ -101,6 +101,7 @@ ef9345_device::ef9345_device(const machine_config &mconfig, const char *tag, dev
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(ef9345)),
+ m_charset(*this, DEVICE_SELF),
m_palette(*this)
{
}
@@ -125,7 +126,6 @@ void ef9345_device::device_start()
m_blink_timer = timer_alloc(BLINKING_TIMER);
m_videoram = &space(0);
- m_charset = region();
m_screen_out.allocate(496, m_screen->height());
@@ -266,7 +266,7 @@ void ef9345_device::init_accented_chars(void)
UINT16 i, j;
for(j = 0; j < 0x10; j++)
for(i = 0; i < 0x200; i++)
- m_acc_char[(j << 9) + i] = m_charset->u8(0x0600 + i);
+ m_acc_char[(j << 9) + i] = m_charset[0x0600 + i];
for(j = 0; j < 0x200; j += 0x40)
for(i = 0; i < 4; i++)
@@ -299,7 +299,7 @@ void ef9345_device::init_accented_chars(void)
UINT8 ef9345_device::read_char(UINT8 index, UINT16 addr)
{
if (index < 0x04)
- return m_charset->u8(0x0800*index + addr);
+ return m_charset[0x0800*index + addr];
else if (index < 0x08)
return m_acc_char[0x0800*(index&3) + addr];
else if (index < 0x0c)
@@ -860,7 +860,7 @@ void ef9345_device::ef9345_exec(UINT8 cmd)
set_busy_flag(3.5);
switch(cmd&7)
{
- case 0: m_registers[1] = m_charset->u8(indexrom(7) & 0x1fff); break;
+ case 0: m_registers[1] = m_charset[indexrom(7) & 0x1fff]; break;
case 1: m_registers[1] = m_tgs; break;
case 2: m_registers[1] = m_mat; break;
case 3: m_registers[1] = m_pat; break;
diff --git a/src/devices/video/ef9345.h b/src/devices/video/ef9345.h
index 9179e01ab03..c6790b00a39 100644
--- a/src/devices/video/ef9345.h
+++ b/src/devices/video/ef9345.h
@@ -84,7 +84,7 @@ private:
static const device_timer_id BUSY_TIMER = 0;
static const device_timer_id BLINKING_TIMER = 1;
- memory_region *m_charset;
+ required_region_ptr<UINT8> m_charset;
address_space *m_videoram;
UINT8 m_bf; //busy flag
diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp
index 5b683b15e09..e7266e88b49 100644
--- a/src/devices/video/ef9364.cpp
+++ b/src/devices/video/ef9364.cpp
@@ -61,6 +61,7 @@ ef9364_device::ef9364_device(const machine_config &mconfig, const char *tag, dev
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("textram", ENDIANNESS_LITTLE, 8, 12, 0, nullptr, *ADDRESS_MAP_NAME(ef9364)),
+ m_charset(*this, DEVICE_SELF),
m_palette(*this)
{
clock_freq = clock;
@@ -112,7 +113,6 @@ void ef9364_device::set_color_entry( int index, UINT8 r, UINT8 g, UINT8 b )
void ef9364_device::device_start()
{
m_textram = &space(0);
- m_charset = region();
bitplane_xres = EF9364_NB_OF_COLUMNS*8;
bitplane_yres = EF9364_NB_OF_ROWS*(8+4);
@@ -206,7 +206,7 @@ UINT32 ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
{
c = m_textram->read_byte( ( r * EF9364_NB_OF_COLUMNS ) + ( x>>3 ) );
- if( m_charset->u8(((c&0x7F)<<3) + y ) & (0x80>>(x&7)) )
+ if( m_charset[((c&0x7F)<<3) + y] & (0x80>>(x&7)) )
m_screen_out.pix32((r*12)+y, x) = palette[1];
else
m_screen_out.pix32((r*12)+y, x) = palette[0];
diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h
index 4c5f57bb211..9d18942429d 100644
--- a/src/devices/video/ef9364.h
+++ b/src/devices/video/ef9364.h
@@ -75,7 +75,7 @@ private:
// internal state
- memory_region *m_charset;
+ required_region_ptr<UINT8> m_charset;
address_space *m_textram;
UINT8 x_curs_pos;
diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp
index 5f81d7f45b5..db278ce24bb 100644
--- a/src/devices/video/ef9365.cpp
+++ b/src/devices/video/ef9365.cpp
@@ -160,6 +160,7 @@ ef9365_device::ef9365_device(const machine_config &mconfig, const char *tag, dev
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, nullptr, *ADDRESS_MAP_NAME(ef9365)),
+ m_charset(*this, DEVICE_SELF),
m_palette(*this),
m_irq_handler(*this)
{
@@ -283,7 +284,6 @@ void ef9365_device::device_start()
m_busy_timer = timer_alloc(BUSY_TIMER);
m_videoram = &space(0);
- m_charset = region();
m_current_color = 0x0F;
m_irq_vb = 0;
@@ -729,7 +729,7 @@ int ef9365_device::get_char_pix( unsigned char c, int x, int y )
char_base = c * 5;
char_pix = ( y * 5 ) + x;
- if ( m_charset->u8(char_base + (char_pix>>3) ) & ( 0x80 >> (char_pix&7)) )
+ if ( m_charset[char_base + (char_pix>>3)] & ( 0x80 >> (char_pix&7)) )
return 1;
else
return 0;
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h
index e29b3adca33..957a5047325 100644
--- a/src/devices/video/ef9365.h
+++ b/src/devices/video/ef9365.h
@@ -95,7 +95,7 @@ private:
// internal state
static const device_timer_id BUSY_TIMER = 0;
- memory_region *m_charset;
+ required_region_ptr<UINT8> m_charset;
address_space *m_videoram;
UINT8 m_irq_state;
diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp
index fa168e5ac36..5f399292c49 100644
--- a/src/devices/video/epic12.cpp
+++ b/src/devices/video/epic12.cpp
@@ -49,6 +49,20 @@ void epic12_device::device_start()
m_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::blitter_delay_callback),this));
m_blitter_delay_timer->adjust(attotime::never);
+
+ save_item(NAME(m_gfx_addr));
+ save_item(NAME(m_gfx_scroll_0_x));
+ save_item(NAME(m_gfx_scroll_0_y));
+ save_item(NAME(m_gfx_scroll_1_x));
+ save_item(NAME(m_gfx_scroll_1_y));
+ save_item(NAME(m_delay_scale));
+ save_item(NAME(m_gfx_addr_shadowcopy));
+ save_item(NAME(m_gfx_scroll_0_x_shadowcopy));
+ save_item(NAME(m_gfx_scroll_0_y_shadowcopy));
+ save_item(NAME(m_gfx_scroll_1_x_shadowcopy));
+ save_item(NAME(m_gfx_scroll_1_y_shadowcopy));
+ save_pointer(NAME(m_ram16_copy.get()), m_main_ramsize/2);
+ save_item(NAME(*m_bitmaps));
}
void epic12_device::device_reset()
diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp
index 8b30b0afd9b..c13cf80f818 100644
--- a/src/devices/video/hd44352.cpp
+++ b/src/devices/video/hd44352.cpp
@@ -36,7 +36,8 @@ const device_type HD44352 = &device_creator<hd44352_device>;
hd44352_device::hd44352_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock):
device_t(mconfig, HD44352, "hd44352", tag, owner, clock, "hd44352", __FILE__),
- m_on_cb(*this)
+ m_on_cb(*this),
+ m_char_rom(*this, DEVICE_SELF)
{
}
@@ -216,7 +217,7 @@ UINT8 hd44352_device::get_char(UINT16 pos)
case 0xff:
return m_custom_char[3][pos%8];
default:
- return region()->u8(pos);
+ return m_char_rom[pos];
}
}
diff --git a/src/devices/video/hd44352.h b/src/devices/video/hd44352.h
index dda32fa7111..0974ed90a9d 100644
--- a/src/devices/video/hd44352.h
+++ b/src/devices/video/hd44352.h
@@ -73,6 +73,7 @@ private:
UINT8 m_cursor_lcd;
devcb_write_line m_on_cb; // ON line callback
+ required_region_ptr<UINT8> m_char_rom;
};
// device type definition
diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp
index 00c75e3cd2a..0f8647ced55 100644
--- a/src/devices/video/hd44780.cpp
+++ b/src/devices/video/hd44780.cpp
@@ -47,14 +47,16 @@ ROM_END
hd44780_device::hd44780_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, HD44780, "HD44780 A00", tag, owner, clock, "hd44780_a00", __FILE__),
- m_pixel_update_func(nullptr)
+ m_pixel_update_func(nullptr),
+ m_cgrom(*this, DEVICE_SELF)
{
set_charset_type(CHARSET_HD44780_A00);
}
hd44780_device::hd44780_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_pixel_update_func(nullptr)
+ m_pixel_update_func(nullptr),
+ m_cgrom(*this, DEVICE_SELF)
{
}
@@ -86,10 +88,8 @@ const rom_entry *hd44780_device::device_rom_region() const
void hd44780_device::device_start()
{
- if (region())
- m_cgrom = region()->base();
- else
- m_cgrom = memregion("cgrom")->base();
+ if (!m_cgrom.found())
+ m_cgrom.set_target(memregion("cgrom")->base(), 0x1000);
m_busy_timer = timer_alloc(TIMER_BUSY);
m_blink_timer = timer_alloc(TIMER_BLINKING);
diff --git a/src/devices/video/hd44780.h b/src/devices/video/hd44780.h
index 637056d9505..b1210fbd47d 100644
--- a/src/devices/video/hd44780.h
+++ b/src/devices/video/hd44780.h
@@ -105,7 +105,7 @@ private:
bool m_busy_flag; // busy flag
UINT8 m_ddram[0x80]; // internal display data RAM
UINT8 m_cgram[0x40]; // internal chargen RAM
- UINT8 * m_cgrom; // internal chargen ROM
+ optional_region_ptr<UINT8> m_cgrom; // internal chargen ROM
int m_ac; // address counter
UINT8 m_dr; // data register
UINT8 m_ir; // instruction register
diff --git a/src/devices/video/msm6222b.cpp b/src/devices/video/msm6222b.cpp
index efa82d7c119..17ee6897400 100644
--- a/src/devices/video/msm6222b.cpp
+++ b/src/devices/video/msm6222b.cpp
@@ -22,18 +22,22 @@ ROM_START( msm6222b_01 )
ROM_END
msm6222b_device::msm6222b_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0), cgrom(nullptr)
+ device_t(mconfig, type, name, tag, owner, clock, shortname, source), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0),
+ m_cgrom(*this)
{
}
msm6222b_device::msm6222b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, MSM6222B, "msm6222b-xx", tag, owner, clock, "msm6222b", __FILE__), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0), cgrom(nullptr)
+ device_t(mconfig, MSM6222B, "msm6222b-xx", tag, owner, clock, "msm6222b", __FILE__), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0),
+ m_cgrom(*this, DEVICE_SELF)
{
}
msm6222b_01_device::msm6222b_01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
msm6222b_device(mconfig, MSM6222B_01, "msm6222b-01", tag, owner, clock, "msm6222b", __FILE__)
{
+ // load the fixed cgrom
+ m_cgrom.set_tag("cgrom");
}
const rom_entry *msm6222b_01_device::device_rom_region() const
@@ -43,13 +47,6 @@ const rom_entry *msm6222b_01_device::device_rom_region() const
void msm6222b_device::device_start()
{
- if(memregion("cgrom"))
- cgrom = memregion("cgrom")->base();
- else if(m_region)
- cgrom = m_region->base();
- else
- cgrom = nullptr;
-
memset(cgram, 0, sizeof(cgram));
memset(ddram, 0x20, sizeof(ddram));
@@ -218,8 +215,8 @@ const UINT8 *msm6222b_device::render()
UINT8 c = ddram[(i+shift) % 80];
if(c < 16)
memcpy(render_buf + 16*i, double_height ? cgram + 8*(c & 6) : cgram + 8*(c & 7), char_height);
- else if(cgrom)
- memcpy(render_buf + 16*i, cgrom + 16*c, char_height);
+ else if (m_cgrom.found())
+ memcpy(render_buf + 16*i, &m_cgrom[16*c], char_height);
}
if(cursor_on) {
diff --git a/src/devices/video/msm6222b.h b/src/devices/video/msm6222b.h
index d86bcd63629..3324dda3b06 100644
--- a/src/devices/video/msm6222b.h
+++ b/src/devices/video/msm6222b.h
@@ -41,7 +41,8 @@ private:
UINT8 render_buf[80*16];
bool cursor_direction, cursor_blinking, two_line, shift_on_write, double_height, cursor_on, display_on;
UINT8 adc, shift;
- const UINT8 *cgrom;
+protected:
+ optional_region_ptr<UINT8> m_cgrom;
void cursor_step(bool direction);
void shift_step(bool direction);
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index 9c45dab00ca..e571499a399 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -39,7 +39,7 @@ tms9927_device::tms9927_device(const machine_config &mconfig, const char *tag, d
device_video_interface(mconfig, *this),
m_write_vsyn(*this),
m_hpixels_per_column(0),
- m_selfload_region(nullptr),
+ m_selfload(*this),
m_reset(0)
{
memset(m_reg, 0x00, sizeof(m_reg));
@@ -50,7 +50,7 @@ tms9927_device::tms9927_device(const machine_config &mconfig, device_type type,
device_video_interface(mconfig, *this),
m_write_vsyn(*this),
m_hpixels_per_column(0),
- m_selfload_region(nullptr),
+ m_selfload(*this),
m_reset(0)
{
memset(m_reg, 0x00, sizeof(m_reg));
@@ -84,13 +84,6 @@ void tms9927_device::device_start()
/* copy the initial parameters */
m_clock = clock();
- /* get the self-load PROM */
- if (m_selfload_region != nullptr)
- {
- m_selfload = machine().root_device().memregion(m_selfload_region)->base();
- assert(m_selfload != nullptr);
- }
-
// resolve callbacks
m_write_vsyn.resolve_safe();
@@ -166,7 +159,7 @@ void tms9927_device::generic_access(address_space &space, offs_t offset)
{
case 0x07: /* Processor Self Load */
case 0x0f: /* Non-processor self-load */
- if (m_selfload != nullptr)
+ if (m_selfload.found())
{
for (int cur = 0; cur < 7; cur++)
write(space, cur, m_selfload[cur]);
diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h
index 40181d16cbc..ba8e25f9e79 100644
--- a/src/devices/video/tms9927.h
+++ b/src/devices/video/tms9927.h
@@ -17,7 +17,7 @@
tms9927_device::set_char_width(*device, _pixels);
#define MCFG_TMS9927_REGION(_tag) \
- tms9927_device::set_region_tag(*device, _tag);
+ tms9927_device::set_region_tag(*device, "^" _tag);
class tms9927_device : public device_t,
@@ -31,7 +31,7 @@ public:
template<class _Object> static devcb_base &set_vsyn_wr_callback(device_t &device, _Object object) { return downcast<tms9927_device &>(device).m_write_vsyn.set_callback(object); }
static void set_char_width(device_t &device, int pixels) { downcast<tms9927_device &>(device).m_hpixels_per_column = pixels; }
- static void set_region_tag(device_t &device, const char *tag) { downcast<tms9927_device &>(device).m_selfload_region = tag; }
+ static void set_region_tag(device_t &device, const char *tag) { downcast<tms9927_device &>(device).m_selfload.set_tag(tag); }
DECLARE_WRITE8_MEMBER(write);
DECLARE_READ8_MEMBER(read);
@@ -59,10 +59,9 @@ private:
devcb_write_line m_write_vsyn;
int m_hpixels_per_column; /* number of pixels per video memory address */
- const char *m_selfload_region; /* name of the region with self-load data */
// internal state
- const UINT8 *m_selfload;
+ optional_region_ptr<UINT8> m_selfload;
/* live state */
UINT32 m_clock;
diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h
index 492ad21b03b..56e9fde3e8f 100644
--- a/src/emu/addrmap.h
+++ b/src/emu/addrmap.h
@@ -499,15 +499,4 @@ void _class :: _name(::address_map &map, device_t &device) \
#define AM_RAM_DEVWRITE(_tag, _class, _write) AM_READONLY AM_DEVWRITE(_tag, _class, _write)
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// use this to refer to the owning device when providing a device tag
-static const char DEVICE_SELF[] = "";
-
-// use this to refer to the owning device's owner when providing a device tag
-static const char DEVICE_SELF_OWNER[] = "^";
-
-
#endif /* __ADDRMAP_H__ */
diff --git a/src/emu/audit.cpp b/src/emu/audit.cpp
index 6797d967218..0a0cec543a5 100644
--- a/src/emu/audit.cpp
+++ b/src/emu/audit.cpp
@@ -388,7 +388,6 @@ media_auditor::summary media_auditor::summarize(const char *name, std::string *o
else
output->append(string_format("NOT FOUND (%s)\n", shared_device->shortname()));
}
- best_new_status = NOTFOUND;
break;
case audit_record::SUBSTATUS_NOT_FOUND_NODUMP:
diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp
index 02c27149231..803b8a4db76 100644
--- a/src/emu/clifront.cpp
+++ b/src/emu/clifront.cpp
@@ -715,6 +715,9 @@ void cli_frontend::listmedia(const char *gamename)
bool first = true;
for (const device_image_interface *imagedev = iter.first(); imagedev != nullptr; imagedev = iter.next())
{
+ if (!imagedev->user_loadable())
+ continue;
+
// extract the shortname with parentheses
std::string paren_shortname = string_format("(%s)", imagedev->brief_instance_name());
diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h
index d3c52225550..311f19e5dbd 100644
--- a/src/emu/debug/debugcmd.h
+++ b/src/emu/debug/debugcmd.h
@@ -11,6 +11,7 @@
#ifndef __DEBUGCMD_H__
#define __DEBUGCMD_H__
+#include "emu.h"
/***************************************************************************
FUNCTION PROTOTYPES
diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h
index c15874184af..95aa2e0f8c8 100644
--- a/src/emu/debug/debugcon.h
+++ b/src/emu/debug/debugcon.h
@@ -11,6 +11,7 @@
#ifndef __DEBUGCON_H__
#define __DEBUGCON_H__
+#include "emu.h"
#include "textbuf.h"
diff --git a/src/emu/devcpu.cpp b/src/emu/devcpu.cpp
index 00bac6ed1b0..43460235b19 100644
--- a/src/emu/devcpu.cpp
+++ b/src/emu/devcpu.cpp
@@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
+#include "emuopts.h"
#include <ctype.h>
@@ -25,7 +26,8 @@ cpu_device::cpu_device(const machine_config &mconfig, device_type type, const ch
device_execute_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
device_state_interface(mconfig, *this),
- device_disasm_interface(mconfig, *this)
+ device_disasm_interface(mconfig, *this),
+ m_force_no_drc(false)
{
}
@@ -37,3 +39,24 @@ cpu_device::cpu_device(const machine_config &mconfig, device_type type, const ch
cpu_device::~cpu_device()
{
}
+
+
+//-------------------------------------------------
+// static_set_force_no_drc - configuration helper
+// to disable DRC
+//-------------------------------------------------
+
+void cpu_device::static_set_force_no_drc(device_t &device, bool value)
+{
+ downcast<cpu_device &>(device).m_force_no_drc = value;
+}
+
+
+//-------------------------------------------------
+// allow_drc - return true if DRC is allowed
+//-------------------------------------------------
+
+bool cpu_device::allow_drc() const
+{
+ return mconfig().options().drc() && !m_force_no_drc;
+}
diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h
index 0a298a4ddf8..f34d5645b78 100644
--- a/src/emu/devcpu.h
+++ b/src/emu/devcpu.h
@@ -42,6 +42,11 @@
#define MCFG_CPU_PERIODIC_INT_REMOVE MCFG_DEVICE_PERIODIC_INT_REMOVE
#define MCFG_CPU_IRQ_ACKNOWLEDGE_REMOVE MCFG_DEVICE_IRQ_ACKNOWLEDGE_REMOVE
+// recompilation parameters
+#define MCFG_CPU_FORCE_NO_DRC() \
+ cpu_device::static_set_force_no_drc(*device, true);
+
+
//**************************************************************************
// MACROS
@@ -66,10 +71,19 @@ class cpu_device : public device_t,
{
friend resource_pool_object<cpu_device>::~resource_pool_object();
+public:
+ // configuration helpers
+ static void static_set_force_no_drc(device_t &device, bool value);
+ bool allow_drc() const;
+
protected:
// construction/destruction
cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual ~cpu_device();
+
+private:
+ // configured state
+ bool m_force_no_drc; // whether or not to force DRC off
};
diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp
index d251e56ce0b..7669b331832 100644
--- a/src/emu/devfind.cpp
+++ b/src/emu/devfind.cpp
@@ -45,27 +45,76 @@ void *finder_base::find_memregion(UINT8 width, size_t &length, bool required) co
// look up the region and return NULL if not found
memory_region *region = m_base.memregion(m_tag);
if (region == nullptr)
+ {
+ length = 0;
return nullptr;
+ }
// check the width and warn if not correct
if (region->bytewidth() != width)
{
if (required)
osd_printf_warning("Region '%s' found but is width %d, not %d as requested\n", m_tag, region->bitwidth(), width*8);
+ length = 0;
+ return nullptr;
+ }
+
+ // check the length and warn if other than specified
+ size_t length_found = region->bytes() / width;
+ if (length != 0 && length != length_found)
+ {
+ if (required)
+ osd_printf_warning("Region '%s' found but has %d bytes, not %d as requested\n", m_tag, region->bytes(), (int)length*width);
+ length = 0;
return nullptr;
}
// return results
- length = region->bytes() / width;
+ length = length_found;
return region->base();
}
//-------------------------------------------------
+// validate_memregion - find memory region
+//-------------------------------------------------
+
+bool finder_base::validate_memregion(size_t bytes, bool required) const
+{
+ // make sure we can resolve the full path to the region
+ size_t bytes_found = 0;
+ std::string region_fulltag = m_base.subtag(m_tag);
+
+ // look for the region
+ device_iterator deviter(m_base.mconfig().root_device());
+ for (device_t *dev = deviter.first(); dev != nullptr && bytes_found == 0; dev = deviter.next())
+ for (const rom_entry *romp = rom_first_region(*dev); romp != nullptr; romp = rom_next_region(romp))
+ {
+ if (rom_region_name(*dev, romp) == region_fulltag)
+ {
+ bytes_found = ROMREGION_GETLENGTH(romp);
+ break;
+ }
+ }
+
+ if (bytes_found != 0)
+ {
+ // check the length and warn if other than specified
+ if (bytes != 0 && bytes != bytes_found)
+ {
+ osd_printf_warning("Region '%s' found but has %d bytes, not %d as requested\n", m_tag, (int)bytes_found, (int)bytes);
+ bytes_found = 0;
+ }
+ }
+ return report_missing(bytes_found != 0, "memory region", required);
+}
+
+
+//-------------------------------------------------
// find_memshare - find memory share
//-------------------------------------------------
-void *finder_base::find_memshare(UINT8 width, size_t &bytes, bool required)
+void *finder_base::find_memshare(UINT8 width, size_t &bytes, bool required) const
{
// look up the share and return NULL if not found
memory_share *share = m_base.memshare(m_tag);
@@ -91,7 +140,7 @@ void *finder_base::find_memshare(UINT8 width, size_t &bytes, bool required)
// return true if it's ok
//-------------------------------------------------
-bool finder_base::report_missing(bool found, const char *objname, bool required)
+bool finder_base::report_missing(bool found, const char *objname, bool required) const
{
if (required && strcmp(m_tag, FINDER_DUMMY_TAG)==0)
{
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index 44a5532b6a8..98599e4a6e9 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -47,6 +47,7 @@ public:
// getters
virtual bool findit(bool isvalidation = false) = 0;
+ const char *finder_tag() const { return m_tag; }
// setter for setting the object
void set_tag(const char *tag) { m_tag = tag; }
@@ -54,8 +55,9 @@ public:
protected:
// helpers
void *find_memregion(UINT8 width, size_t &length, bool required) const;
- void *find_memshare(UINT8 width, size_t &bytes, bool required);
- bool report_missing(bool found, const char *objname, bool required);
+ bool validate_memregion(size_t bytes, bool required) const;
+ void *find_memshare(UINT8 width, size_t &bytes, bool required) const;
+ bool report_missing(bool found, const char *objname, bool required) const;
void printf_warning(const char *format, ...) ATTR_PRINTF(2,3);
@@ -104,7 +106,7 @@ class device_finder : public object_finder_base<_DeviceClass>
{
public:
// construction/destruction
- device_finder(device_t &base, const char *tag)
+ device_finder(device_t &base, const char *tag = FINDER_DUMMY_TAG)
: object_finder_base<_DeviceClass>(base, tag) { }
// make reference use transparent as well
@@ -148,7 +150,7 @@ class memory_region_finder : public object_finder_base<memory_region>
{
public:
// construction/destruction
- memory_region_finder(device_t &base, const char *tag)
+ memory_region_finder(device_t &base, const char *tag = FINDER_DUMMY_TAG)
: object_finder_base<memory_region>(base, tag) { }
// make reference use transparent as well
@@ -157,7 +159,7 @@ public:
// finder
virtual bool findit(bool isvalidation = false) override
{
- if (isvalidation) return true;
+ if (isvalidation) return this->validate_memregion(0, _Required);
m_target = m_base.memregion(m_tag);
return this->report_missing(m_target != nullptr, "memory region", _Required);
}
@@ -186,7 +188,7 @@ class memory_bank_finder : public object_finder_base<memory_bank>
{
public:
// construction/destruction
- memory_bank_finder(device_t &base, const char *tag)
+ memory_bank_finder(device_t &base, const char *tag = FINDER_DUMMY_TAG)
: object_finder_base<memory_bank>(base, tag) { }
// make reference use transparent as well
@@ -224,7 +226,7 @@ class ioport_finder : public object_finder_base<ioport_port>
{
public:
// construction/destruction
- ioport_finder(device_t &base, const char *tag)
+ ioport_finder(device_t &base, const char *tag = FINDER_DUMMY_TAG)
: object_finder_base<ioport_port>(base, tag) { }
// make reference use transparent as well
@@ -319,14 +321,20 @@ class region_ptr_finder : public object_finder_base<_PointerType>
{
public:
// construction/destruction
- region_ptr_finder(device_t &base, const char *tag)
+ region_ptr_finder(device_t &base, const char *tag, size_t length = 0)
: object_finder_base<_PointerType>(base, tag),
- m_length(0) { }
+ m_length(length) { }
+ region_ptr_finder(device_t &base, size_t length = 0)
+ : object_finder_base<_PointerType>(base, FINDER_DUMMY_TAG),
+ m_length(length) { }
// operators to make use transparent
_PointerType operator[](int index) const { assert(index < m_length); return this->m_target[index]; }
_PointerType &operator[](int index) { assert(index < m_length); return this->m_target[index]; }
+ // setter for setting the object and its length
+ void set_target(_PointerType *target, size_t length) { this->m_target = target; m_length = length; }
+
// getter for explicit fetching
UINT32 length() const { return m_length; }
UINT32 bytes() const { return m_length * sizeof(_PointerType); }
@@ -335,7 +343,7 @@ public:
// finder
virtual bool findit(bool isvalidation = false) override
{
- if (isvalidation) return true;
+ if (isvalidation) return this->validate_memregion(sizeof(_PointerType) * m_length, _Required);
this->m_target = reinterpret_cast<_PointerType *>(this->find_memregion(sizeof(_PointerType), m_length, _Required));
return this->report_missing(this->m_target != nullptr, "memory region", _Required);
}
@@ -350,7 +358,8 @@ template<class _PointerType>
class optional_region_ptr : public region_ptr_finder<_PointerType, false>
{
public:
- optional_region_ptr(device_t &base, const char *tag = FINDER_DUMMY_TAG) : region_ptr_finder<_PointerType, false>(base, tag) { }
+ optional_region_ptr(device_t &base, const char *tag, size_t length = 0) : region_ptr_finder<_PointerType, false>(base, tag, length) { }
+ optional_region_ptr(device_t &base, size_t length = 0) : region_ptr_finder<_PointerType, false>(base, FINDER_DUMMY_TAG, length) { }
};
// required region pointer finder
@@ -358,10 +367,12 @@ template<class _PointerType>
class required_region_ptr : public region_ptr_finder<_PointerType, true>
{
public:
- required_region_ptr(device_t &base, const char *tag = FINDER_DUMMY_TAG) : region_ptr_finder<_PointerType, true>(base, tag) { }
+ required_region_ptr(device_t &base, const char *tag, size_t length = 0) : region_ptr_finder<_PointerType, true>(base, tag, length) { }
+ required_region_ptr(device_t &base, size_t length = 0) : region_ptr_finder<_PointerType, true>(base, FINDER_DUMMY_TAG, length) { }
};
+
// ======================> shared_ptr_finder
// shared pointer finder template
@@ -370,7 +381,7 @@ class shared_ptr_finder : public object_finder_base<_PointerType>
{
public:
// construction/destruction
- shared_ptr_finder(device_t &base, const char *tag, UINT8 width = sizeof(_PointerType) * 8)
+ shared_ptr_finder(device_t &base, const char *tag = FINDER_DUMMY_TAG, UINT8 width = sizeof(_PointerType) * 8)
: object_finder_base<_PointerType>(base, tag),
m_bytes(0),
m_width(width) { }
diff --git a/src/emu/device.cpp b/src/emu/device.cpp
index 59e4162314c..64fe6fede58 100644
--- a/src/emu/device.cpp
+++ b/src/emu/device.cpp
@@ -39,7 +39,6 @@ device_t::device_t(const machine_config &mconfig, device_type type, const char *
m_clock_scale(1.0),
m_attoseconds_per_clock((clock == 0) ? 0 : HZ_TO_ATTOSECONDS(clock)),
- m_region(nullptr),
m_machine_config(mconfig),
m_static_config(nullptr),
m_input_defaults(nullptr),
@@ -308,7 +307,26 @@ bool device_t::findit(bool isvalidation) const
{
bool allfound = true;
for (finder_base *autodev = m_auto_finder_list; autodev != nullptr; autodev = autodev->m_next)
+ {
+ if (isvalidation)
+ {
+ // sanity checking
+ const char *tag = autodev->finder_tag();
+ if (tag == nullptr)
+ {
+ osd_printf_error("Finder tag is null!\n");
+ allfound = false;
+ continue;
+ }
+ if (tag[0] == '^' && tag[1] == ':')
+ {
+ osd_printf_error("Malformed finder tag: %s\n", tag);
+ allfound = false;
+ continue;
+ }
+ }
allfound &= autodev->findit(isvalidation);
+ }
return allfound;
}
@@ -318,9 +336,6 @@ bool device_t::findit(bool isvalidation) const
void device_t::start()
{
- // populate the machine and the region field
- m_region = machine().root_device().memregion(tag());
-
// find all the registered devices
if (!findit(false))
throw emu_fatalerror("Missing some required objects, unable to proceed");
diff --git a/src/emu/device.h b/src/emu/device.h
index 9681e43943c..c098b2c337b 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -48,6 +48,17 @@
//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// use this to refer to the owning device when providing a device tag
+static const char DEVICE_SELF[] = "";
+
+// use this to refer to the owning device's owner when providing a device tag
+static const char DEVICE_SELF_OWNER[] = "^";
+
+
+//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -199,7 +210,6 @@ public:
UINT8 default_bios() const { return m_default_bios; }
UINT8 system_bios() const { return m_system_bios; }
std::string default_bios_tag() const { return m_default_bios_tag; }
- memory_region *region() const { return m_region; }
// interface helpers
interface_list &interfaces() { return m_interfaces; }
@@ -334,7 +344,6 @@ protected:
attoseconds_t m_attoseconds_per_clock;// period in attoseconds
std::unique_ptr<device_debug> m_debug;
- memory_region * m_region; // our device-local region
const machine_config & m_machine_config; // reference to the machine's configuration
const void * m_static_config; // static device configuration
const input_device_default *m_input_defaults; // devices input ports default overrides
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index f20c9b7733d..3e167614fe9 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -68,6 +68,7 @@ device_image_interface::device_image_interface(const machine_config &mconfig, de
m_from_swlist(false),
m_create_format(0),
m_create_args(nullptr),
+ m_user_loadable(TRUE),
m_is_loading(FALSE)
{
}
@@ -161,16 +162,16 @@ image_error_t device_image_interface::set_image_filename(const char *filename)
util::zippath_parent(m_working_directory, filename);
m_basename.assign(m_image_name);
- size_t loc1 = m_image_name.find_last_of('\\');
- size_t loc2 = m_image_name.find_last_of('/');
- size_t loc3 = m_image_name.find_last_of(':');
- size_t loc = MAX(loc1,MAX(loc2, loc3));
+ int loc1 = m_image_name.find_last_of('\\');
+ int loc2 = m_image_name.find_last_of('/');
+ int loc3 = m_image_name.find_last_of(':');
+ int loc = MAX(loc1, MAX(loc2, loc3));
if (loc != -1) {
if (loc == loc3)
{
// temp workaround for softlists now that m_image_name contains the part name too (e.g. list:gamename:cart)
m_basename = m_basename.substr(0, loc);
- size_t tmploc = m_basename.find_last_of(':');
+ int tmploc = m_basename.find_last_of(':');
m_basename = m_basename.substr(tmploc + 1, loc - tmploc);
}
else
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 248db9cbbd2..5300392d57a 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -129,6 +129,9 @@ typedef void (*device_image_partialhash_func)(hash_collection &, const unsigned
#define DEVICE_IMAGE_UNLOAD_MEMBER(_class,_name) void DEVICE_IMAGE_UNLOAD_NAME(_class,_name)(device_image_interface &image)
#define DEVICE_IMAGE_UNLOAD_DELEGATE(_class,_name) device_image_func_delegate(&DEVICE_IMAGE_UNLOAD_NAME(_class,_name),#_class "::device_image_unload_" #_name, downcast<_class *>(device->owner()))
+#define MCFG_SET_IMAGE_LOADABLE(_usrload) \
+ device_image_interface::static_set_user_loadable(*device, _usrload);
+
// ======================> device_image_interface
@@ -223,8 +226,6 @@ public:
const char *image_type_name() const { return device_typename(image_type()); }
-
-
const char *instance_name() const { return m_instance_name.c_str(); }
const char *brief_instance_name() const { return m_brief_instance_name.c_str(); }
bool uses_file_extension(const char *file_extension) const;
@@ -239,6 +240,15 @@ public:
int reopen_for_write(const char *path);
static void software_name_split(const char *swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart);
+ static void static_set_user_loadable(device_t &device, bool user_loadable) {
+ device_image_interface *img;
+ if (!device.interface(img))
+ throw emu_fatalerror("MCFG_SET_IMAGE_LOADABLE called on device '%s' with no image interface\n", device.tag());
+
+ img->m_user_loadable = user_loadable;
+ }
+
+ bool user_loadable() const { return m_user_loadable; }
protected:
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load);
@@ -311,10 +321,14 @@ protected:
std::string m_brief_instance_name;
std::string m_instance_name;
-
+
/* creation info */
simple_list<image_device_format> m_formatlist;
+ /* in the case of arcade cabinet with fixed carts inserted,
+ we want to disable command line cart loading... */
+ bool m_user_loadable;
+
bool m_is_loading;
};
diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h
index 0998fd4ae9a..941a8c87729 100644
--- a/src/emu/dimemory.h
+++ b/src/emu/dimemory.h
@@ -123,6 +123,9 @@ protected:
// configuration
address_map_constructor m_address_map[ADDRESS_SPACES]; // address maps for each address space
+
+private:
+ // internal state
address_space * m_addrspace[ADDRESS_SPACES]; // reported address spaces
};
diff --git a/src/emu/diserial.cpp b/src/emu/diserial.cpp
index 3e4c0b4c785..4613da0d4ad 100644
--- a/src/emu/diserial.cpp
+++ b/src/emu/diserial.cpp
@@ -425,8 +425,8 @@ void device_serial_interface::transmit_register_setup(UINT8 data_byte)
transmit_register_add_bit(parity);
}
- /* stop bit(s) */
- for (i=0; i<m_df_stop_bit_count; i++)
+ /* stop bit(s) + 1 extra bit as delay between bytes, needed to get 1 stop bit to work. */
+ for (i=0; i<=m_df_stop_bit_count; i++)
{
transmit_register_add_bit(1);
}
diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp
index f012e376813..9b075c10308 100644
--- a/src/emu/drivers/empty.cpp
+++ b/src/emu/drivers/empty.cpp
@@ -9,6 +9,7 @@
**************************************************************************/
#include "emu.h"
+#include "emuopts.h"
#include "render.h"
#include "ui/selgame.h"
#include "ui/simpleselgame.h"
diff --git a/src/emu/emu.h b/src/emu/emu.h
index e978bbe44d5..1411ecda1db 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -41,7 +41,7 @@
#include "devdelegate.h"
// memory and address spaces
-#include "memory.h"
+#include "emumem.h"
#include "addrmap.h"
#include "memarray.h"
@@ -106,9 +106,6 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
#include "sound.h"
#include "speaker.h"
-// user interface
-#include "ui/ui.h"
-
// generic helpers
#include "devcb.h"
#include "dispatch.h"
@@ -118,6 +115,5 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
// member templates that don't like incomplete types
#include "device.ipp"
-#include "machine.ipp"
#endif /* __EMU_H__ */
diff --git a/src/emu/memory.cpp b/src/emu/emumem.cpp
index 331345ea63d..edfd9228492 100644
--- a/src/emu/memory.cpp
+++ b/src/emu/emumem.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Aaron Giles,Olivier Galibert
/***************************************************************************
- memory.c
+ emumem.c
Functions which handle device memory access.
@@ -174,6 +174,7 @@
#include <map>
#include "emu.h"
+#include "emuopts.h"
#include "debug/debugcpu.h"
diff --git a/src/emu/memory.h b/src/emu/emumem.h
index 9fa42b49a93..9348058f650 100644
--- a/src/emu/memory.h
+++ b/src/emu/emumem.h
@@ -2,7 +2,7 @@
// copyright-holders:Aaron Giles,Olivier Galibert
/***************************************************************************
- memory.h
+ emumem.h
Functions which handle device memory accesses.
@@ -14,8 +14,8 @@
#error Dont include this file directly; include emu.h instead.
#endif
-#ifndef __MEMORY_H__
-#define __MEMORY_H__
+#ifndef __EMUMEM_H__
+#define __EMUMEM_H__
@@ -941,4 +941,4 @@ inline UINT64 direct_read_data::read_qword(offs_t byteaddress, offs_t directxor)
return m_space.read_qword(byteaddress);
}
-#endif /* __MEMORY_H__ */
+#endif /* __EMUMEM_H__ */
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index e05a16a5dd5..b3de757e453 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -93,6 +93,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
{ OPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ OPTION_UNEVENSTRETCHX ";uesx", "0", OPTION_BOOLEAN, "allow non-integer stretch factors only on horizontal axis"},
+ { OPTION_INTOVERSCAN ";ios", "0", OPTION_BOOLEAN, "allow overscan on integer scaled targets"},
{ OPTION_INTSCALEX ";sx", "0", OPTION_INTEGER, "set horizontal integer scale factor."},
{ OPTION_INTSCALEY ";sy", "0", OPTION_INTEGER, "set vertical integer scale."},
@@ -150,8 +151,8 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_UI_ACTIVE, "0", OPTION_BOOLEAN, "enable user interface on top of emulated keyboard (if present)" },
{ OPTION_OFFSCREEN_RELOAD ";reload", "0", OPTION_BOOLEAN, "convert lightgun button 2 into offscreen reload" },
{ OPTION_JOYSTICK_MAP ";joymap", "auto", OPTION_STRING, "explicit joystick map, or auto to auto-select" },
- { OPTION_JOYSTICK_DEADZONE ";joy_deadzone;jdz", "0.3", OPTION_FLOAT, "center deadzone range for joystick where change is ignored (0.0 center, 1.0 end)" },
- { OPTION_JOYSTICK_SATURATION ";joy_saturation;jsat", "0.85", OPTION_FLOAT, "end of axis saturation range for joystick where change is ignored (0.0 center, 1.0 end)" },
+ { OPTION_JOYSTICK_DEADZONE ";joy_deadzone;jdz(0.00-1)", "0.3", OPTION_FLOAT, "center deadzone range for joystick where change is ignored (0.0 center, 1.0 end)" },
+ { OPTION_JOYSTICK_SATURATION ";joy_saturation;jsat(0.00-1)", "0.85", OPTION_FLOAT, "end of axis saturation range for joystick where change is ignored (0.0 center, 1.0 end)" },
{ OPTION_NATURAL_KEYBOARD ";nat", "0", OPTION_BOOLEAN, "specifies whether to use a natural keyboard or not" },
{ OPTION_JOYSTICK_CONTRADICTORY ";joy_contradictory","0", OPTION_BOOLEAN, "enable contradictory direction digital joystick input at the same time" },
{ OPTION_COIN_IMPULSE, "0", OPTION_INTEGER, "set coin impulse time (n<0 disable impulse, n==0 obey driver, 0<n set time n)" },
@@ -255,24 +256,16 @@ bool emu_options::add_slot_options(const software_part *swpart)
if (slot->fixed())
continue;
- // first device? add the header as to be pretty
- if (m_slot_options++ == 0)
- add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE);
-
// retrieve info about the device instance
const char *name = slot->device().tag() + 1;
if (!exists(name))
{
+ // first device? add the header as to be pretty
+ if (m_slot_options++ == 0)
+ add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE);
+
// add the option
- UINT32 flags = OPTION_STRING | OPTION_FLAG_DEVICE;
- const char *defvalue = slot->default_option();
- if (defvalue != nullptr)
- {
- const device_slot_option *option = slot->option(defvalue);
- if (option != nullptr && !option->selectable())
- flags |= OPTION_FLAG_INTERNAL;
- }
- add_entry(name, nullptr, flags, defvalue, true);
+ add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot->default_option(), true);
}
// allow software lists to supply their own defaults
@@ -314,12 +307,21 @@ void emu_options::update_slot_options(const software_part *swpart)
if (exists(name) && !slot->option_list().empty())
{
std::string defvalue = slot->get_default_card_software();
- if (defvalue.length() > 0)
+ if (defvalue.empty())
{
- set_default_value(name, defvalue.c_str());
- const device_slot_option *option = slot->option(defvalue.c_str());
- set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0);
+ // keep any non-default setting
+ if (priority(name) > OPTION_PRIORITY_DEFAULT)
+ continue;
+
+ // reinstate the actual default value as configured
+ if (slot->default_option() != nullptr)
+ defvalue.assign(slot->default_option());
}
+
+ // set the value and hide the option if not selectable
+ set_default_value(name, defvalue.c_str());
+ const device_slot_option *option = slot->option(defvalue.c_str());
+ set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0);
}
}
while (add_slot_options(swpart)) { }
@@ -344,11 +346,10 @@ void emu_options::add_device_options()
image_interface_iterator iter(config.root_device());
for (const device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
{
- // first device? add the header as to be pretty
- if (m_device_options++ == 0)
- add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE);
+ if (!image->user_loadable())
+ continue;
- // retrieve info about the device instance
+ // retrieve info about the device instance
std::ostringstream option_name;
util::stream_format(option_name, "%s;%s", image->instance_name(), image->brief_instance_name());
if (strcmp(image->device_typename(image->image_type()), image->instance_name()) == 0)
@@ -356,7 +357,14 @@ void emu_options::add_device_options()
// add the option
if (!exists(image->instance_name()))
+ {
+ // first device? add the header as to be pretty
+ if (m_device_options++ == 0)
+ add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE);
+
+ // add the option
add_entry(option_name.str().c_str(), nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, nullptr, true);
+ }
}
}
@@ -401,12 +409,10 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_
core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
// keep adding slot options until we stop seeing new stuff
- m_slot_options = 0;
while (add_slot_options(swpart))
core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
// add device options and reparse
- m_device_options = 0;
add_device_options();
if (name != nullptr && exists(name))
set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string);
@@ -560,6 +566,11 @@ void emu_options::set_system_name(const char *name)
// remove any existing device options
remove_device_options();
}
+ else
+ {
+ // revert device options set for the old software
+ revert(OPTION_PRIORITY_SUBCMD, OPTION_PRIORITY_SUBCMD);
+ }
// get the new system
const game_driver *cursystem = system();
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index 29e76b08a53..522f128961e 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -27,8 +27,7 @@ enum
OPTION_PRIORITY_CMDLINE,
// INI-based options are NORMAL priority, in increasing order:
- OPTION_PRIORITY_INI = OPTION_PRIORITY_NORMAL,
- OPTION_PRIORITY_MAME_INI,
+ OPTION_PRIORITY_MAME_INI = OPTION_PRIORITY_NORMAL + 1,
OPTION_PRIORITY_DEBUG_INI,
OPTION_PRIORITY_ORIENTATION_INI,
OPTION_PRIORITY_SYSTYPE_INI,
@@ -36,7 +35,8 @@ enum
OPTION_PRIORITY_SOURCE_INI,
OPTION_PRIORITY_GPARENT_INI,
OPTION_PRIORITY_PARENT_INI,
- OPTION_PRIORITY_DRIVER_INI
+ OPTION_PRIORITY_DRIVER_INI,
+ OPTION_PRIORITY_INI,
};
// core options
@@ -102,6 +102,7 @@ enum
#define OPTION_KEEPASPECT "keepaspect"
#define OPTION_UNEVENSTRETCH "unevenstretch"
#define OPTION_UNEVENSTRETCHX "unevenstretchx"
+#define OPTION_INTOVERSCAN "intoverscan"
#define OPTION_INTSCALEX "intscalex"
#define OPTION_INTSCALEY "intscaley"
@@ -296,6 +297,7 @@ public:
bool keep_aspect() const { return bool_value(OPTION_KEEPASPECT); }
bool uneven_stretch() const { return bool_value(OPTION_UNEVENSTRETCH); }
bool uneven_stretch_x() const { return bool_value(OPTION_UNEVENSTRETCHX); }
+ bool int_overscan() const { return bool_value(OPTION_INTOVERSCAN); }
int int_scale_x() const { return int_value(OPTION_INTSCALEX); }
int int_scale_y() const { return int_value(OPTION_INTSCALEY); }
diff --git a/src/emu/image.cpp b/src/emu/image.cpp
index f9f6111a292..4da1e198569 100644
--- a/src/emu/image.cpp
+++ b/src/emu/image.cpp
@@ -36,6 +36,9 @@ image_manager::image_manager(running_machine &machine)
/* is an image specified for this image */
image_name = machine.options().value(image->instance_name());
+ if (!image->user_loadable())
+ continue;
+
if ((image_name != nullptr) && (image_name[0] != '\0'))
{
/* mark init state */
@@ -226,6 +229,7 @@ void image_manager::postdevice_init()
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
{
int result = image->finish_load();
+
/* did the image load fail? */
if (result)
{
diff --git a/src/emu/info.cpp b/src/emu/info.cpp
index d9e76cd72d9..f427d017795 100644
--- a/src/emu/info.cpp
+++ b/src/emu/info.cpp
@@ -100,10 +100,11 @@ const char info_xml_creator::s_dtd_string[] =
"\t\t\t<!ATTLIST input service (yes|no) \"no\">\n"
"\t\t\t<!ATTLIST input tilt (yes|no) \"no\">\n"
"\t\t\t<!ATTLIST input players CDATA #REQUIRED>\n"
-"\t\t\t<!ATTLIST input buttons CDATA #IMPLIED>\n"
"\t\t\t<!ATTLIST input coins CDATA #IMPLIED>\n"
"\t\t\t<!ELEMENT control EMPTY>\n"
"\t\t\t\t<!ATTLIST control type CDATA #REQUIRED>\n"
+"\t\t\t\t<!ATTLIST control player CDATA #IMPLIED>\n"
+"\t\t\t\t<!ATTLIST control buttons CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control minimum CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control maximum CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control sensitivity CDATA #IMPLIED>\n"
@@ -147,6 +148,7 @@ const char info_xml_creator::s_dtd_string[] =
"\t\t<!ELEMENT device (instance*, extension*)>\n"
"\t\t\t<!ATTLIST device type CDATA #REQUIRED>\n"
"\t\t\t<!ATTLIST device tag CDATA #IMPLIED>\n"
+"\t\t\t<!ATTLIST device fixed_image CDATA #IMPLIED>\n"
"\t\t\t<!ATTLIST device mandatory CDATA #IMPLIED>\n"
"\t\t\t<!ATTLIST device interface CDATA #IMPLIED>\n"
"\t\t\t<!ELEMENT instance EMPTY>\n"
@@ -248,6 +250,33 @@ void info_xml_creator::output_one()
device_iterator iter(config.root_device());
for (device_t *device = iter.first(); device != nullptr; device = iter.next())
portlist.append(*device, errors);
+ // renumber player numbers for controller ports
+ int player_offset = 0;
+ // but treat keyboard count separately from players' number
+ int kbd_offset = 0;
+ for (device_t *device = iter.first(); device != nullptr; device = iter.next())
+ {
+ int nplayers = 0;
+ bool new_kbd = FALSE;
+ for (ioport_port &port : portlist)
+ if (&port.device() == device)
+ for (ioport_field &field : port.fields())
+ if (field.type() >= IPT_START && field.type() < IPT_ANALOG_LAST)
+ {
+ if (field.type() == IPT_KEYBOARD)
+ {
+ if (!new_kbd) new_kbd = TRUE;
+ field.set_player(field.player() + kbd_offset);
+ }
+ else
+ {
+ nplayers = MAX(nplayers, field.player() + 1);
+ field.set_player(field.player() + player_offset);
+ }
+ }
+ player_offset += nplayers;
+ if (new_kbd) kbd_offset++;
+ }
// print the header and the game name
fprintf(m_output, "\t<%s",XML_TOP);
@@ -792,295 +821,466 @@ void info_xml_creator::output_sound(device_t &device)
void info_xml_creator::output_input(const ioport_list &portlist)
{
- // enumerated list of control types
- enum
- {
- ANALOG_TYPE_PADDLE,
- ANALOG_TYPE_PEDAL,
- ANALOG_TYPE_JOYSTICK,
- ANALOG_TYPE_POSITIONAL,
- ANALOG_TYPE_LIGHTGUN,
- ANALOG_TYPE_DIAL,
- ANALOG_TYPE_TRACKBALL,
- ANALOG_TYPE_MOUSE,
- ANALOG_TYPE_COUNT
- };
-
- // directions
- const UINT8 DIR_UP = 0x01;
- const UINT8 DIR_DOWN = 0x02;
- const UINT8 DIR_LEFT = 0x04;
- const UINT8 DIR_RIGHT = 0x08;
- const UINT8 DIR_4WAY = 0x10;
-
- // initialize the list of control types
- struct
- {
- const char * type; /* general type of input */
- bool analog;
- bool keyb;
- INT32 min; /* analog minimum value */
- INT32 max; /* analog maximum value */
- INT32 sensitivity; /* default analog sensitivity */
- INT32 keydelta; /* default analog keydelta */
- bool reverse; /* default analog reverse setting */
- } control_info[ANALOG_TYPE_COUNT];
-
- memset(&control_info, 0, sizeof(control_info));
-
- // tracking info as we iterate
- int nplayer = 0;
- int nbutton = 0;
- int ncoin = 0;
- UINT8 joytype[3] = { 0,0,0 };
- bool service = false;
- bool tilt = false;
- bool keypad = false;
- bool keyboard = false;
- bool mahjong = false;
- bool hanafuda = false;
- bool gambling = false;
-
- // iterate over the ports
- for (ioport_port &port : portlist)
- for (ioport_field &field : port.fields())
- {
- int analogtype = -1;
-
- // track the highest player number
- if (nplayer < field.player() + 1)
- nplayer = field.player() + 1;
-
- // switch off of the type
- switch (field.type())
- {
- // map which joystick directions are present
- case IPT_JOYSTICK_UP: joytype[0] |= DIR_UP | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICK_DOWN: joytype[0] |= DIR_DOWN | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICK_LEFT: joytype[0] |= DIR_LEFT | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICK_RIGHT: joytype[0] |= DIR_RIGHT | ((field.way() == 4) ? DIR_4WAY : 0); break;
-
- case IPT_JOYSTICKLEFT_UP: joytype[1] |= DIR_UP | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKLEFT_DOWN: joytype[1] |= DIR_DOWN | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKLEFT_LEFT: joytype[1] |= DIR_LEFT | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKLEFT_RIGHT: joytype[1] |= DIR_RIGHT | ((field.way() == 4) ? DIR_4WAY : 0); break;
-
- case IPT_JOYSTICKRIGHT_UP: joytype[2] |= DIR_UP | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKRIGHT_DOWN: joytype[2] |= DIR_DOWN | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKRIGHT_LEFT: joytype[2] |= DIR_LEFT | ((field.way() == 4) ? DIR_4WAY : 0); break;
- case IPT_JOYSTICKRIGHT_RIGHT: joytype[2] |= DIR_RIGHT | ((field.way() == 4) ? DIR_4WAY : 0); break;
-
- // mark as an analog input, and get analog stats after switch
- case IPT_AD_STICK_X:
- case IPT_AD_STICK_Y:
- case IPT_AD_STICK_Z:
- control_info[analogtype = ANALOG_TYPE_JOYSTICK].type = "stick";
- break;
-
- case IPT_PADDLE:
- case IPT_PADDLE_V:
- control_info[analogtype = ANALOG_TYPE_PADDLE].type = "paddle";
- break;
-
- case IPT_PEDAL:
- case IPT_PEDAL2:
- case IPT_PEDAL3:
- control_info[analogtype = ANALOG_TYPE_PEDAL].type = "pedal";
- break;
-
- case IPT_LIGHTGUN_X:
- case IPT_LIGHTGUN_Y:
- control_info[analogtype = ANALOG_TYPE_LIGHTGUN].type = "lightgun";
- break;
-
- case IPT_POSITIONAL:
- case IPT_POSITIONAL_V:
- control_info[analogtype = ANALOG_TYPE_POSITIONAL].type = "positional";
- break;
-
- case IPT_DIAL:
- case IPT_DIAL_V:
- control_info[analogtype = ANALOG_TYPE_DIAL].type = "dial";
- break;
-
- case IPT_TRACKBALL_X:
- case IPT_TRACKBALL_Y:
- control_info[analogtype = ANALOG_TYPE_TRACKBALL].type = "trackball";
- break;
-
- case IPT_MOUSE_X:
- case IPT_MOUSE_Y:
- control_info[analogtype = ANALOG_TYPE_MOUSE].type = "mouse";
- break;
-
- // track maximum button index
- case IPT_BUTTON1:
- case IPT_BUTTON2:
- case IPT_BUTTON3:
- case IPT_BUTTON4:
- case IPT_BUTTON5:
- case IPT_BUTTON6:
- case IPT_BUTTON7:
- case IPT_BUTTON8:
- case IPT_BUTTON9:
- case IPT_BUTTON10:
- case IPT_BUTTON11:
- case IPT_BUTTON12:
- case IPT_BUTTON13:
- case IPT_BUTTON14:
- case IPT_BUTTON15:
- case IPT_BUTTON16:
- nbutton = MAX(nbutton, field.type() - IPT_BUTTON1 + 1);
- break;
-
- // track maximum coin index
- case IPT_COIN1:
- case IPT_COIN2:
- case IPT_COIN3:
- case IPT_COIN4:
- case IPT_COIN5:
- case IPT_COIN6:
- case IPT_COIN7:
- case IPT_COIN8:
- ncoin = MAX(ncoin, field.type() - IPT_COIN1 + 1);
- break;
-
- // track presence of these guys
- case IPT_KEYPAD:
- keypad = true;
- break;
-
- case IPT_KEYBOARD:
- keyboard = true;
- break;
-
- // additional types
- case IPT_SERVICE:
- service = true;
- break;
-
- case IPT_TILT:
- tilt = true;
- break;
-
- default:
- if (field.type() > IPT_MAHJONG_FIRST && field.type() < IPT_MAHJONG_LAST)
- mahjong = true;
- else if (field.type() > IPT_HANAFUDA_FIRST && field.type() < IPT_HANAFUDA_LAST)
- hanafuda = true;
- else if (field.type() > IPT_GAMBLING_FIRST && field.type() < IPT_GAMBLING_LAST)
- gambling = true;
- break;
- }
-
- // get the analog stats
- if (analogtype != -1)
- {
- if (field.minval() != 0)
- control_info[analogtype].min = field.minval();
- if (field.maxval() != 0)
- control_info[analogtype].max = field.maxval();
- if (field.sensitivity() != 0)
- control_info[analogtype].sensitivity = field.sensitivity();
- if (field.delta() != 0)
- control_info[analogtype].keydelta = field.delta();
- if (field.analog_reverse() != 0)
- control_info[analogtype].reverse = true;
- }
- }
-
- // output the basic info
- fprintf(m_output, "\t\t<input");
- fprintf(m_output, " players=\"%d\"", nplayer);
- if (nbutton != 0)
- fprintf(m_output, " buttons=\"%d\"", nbutton);
- if (ncoin != 0)
- fprintf(m_output, " coins=\"%d\"", ncoin);
- if (service)
- fprintf(m_output, " service=\"yes\"");
- if (tilt)
- fprintf(m_output, " tilt=\"yes\"");
- fprintf(m_output, ">\n");
-
- // output the joystick types
- if (joytype[1]==0 && joytype[2]!=0) { joytype[1] = joytype[2]; joytype[2] = 0; }
- if (joytype[0]==0 && joytype[1]!=0) { joytype[0] = joytype[1]; joytype[1] = 0; }
- if (joytype[1]==0 && joytype[2]!=0) { joytype[1] = joytype[2]; joytype[2] = 0; }
- if (joytype[0] != 0)
- {
- const char *joys = (joytype[2]!=0) ? "triple" : (joytype[1]!=0) ? "double" : "";
- fprintf(m_output, "\t\t\t<control type=\"%sjoy\"", joys);
- for (int lp=0; lp<3 && joytype[lp]!=0; lp++)
- {
- const char *plural = (lp==2) ? "3" : (lp==1) ? "2" : "";
- const char *ways;
- switch (joytype[lp] & (DIR_UP | DIR_DOWN | DIR_LEFT | DIR_RIGHT))
- {
- case DIR_UP | DIR_DOWN | DIR_LEFT | DIR_RIGHT:
- ways = ((joytype[lp] & DIR_4WAY) != 0) ? "4" : "8";
- break;
- case DIR_LEFT | DIR_RIGHT:
- ways = "2";
- break;
- case DIR_UP | DIR_DOWN:
- ways = "vertical2";
- break;
- case DIR_UP:
- case DIR_DOWN:
- case DIR_LEFT:
- case DIR_RIGHT:
- ways = "1";
- break;
- case DIR_UP | DIR_DOWN | DIR_LEFT:
- case DIR_UP | DIR_DOWN | DIR_RIGHT:
- case DIR_UP | DIR_LEFT | DIR_RIGHT:
- case DIR_DOWN | DIR_LEFT | DIR_RIGHT:
- ways = ((joytype[lp] & DIR_4WAY) != 0) ? "3 (half4)" : "5 (half8)";
- break;
- default:
- ways = "strange2";
- break;
- }
- fprintf(m_output, " ways%s=\"%s\"", plural,ways);
- }
- fprintf(m_output, "/>\n");
- }
-
- // output analog types
- for (auto & elem : control_info)
- if (elem.type != nullptr)
- {
- fprintf(m_output, "\t\t\t<control type=\"%s\"", xml_normalize_string(elem.type));
- if (elem.min != 0 || elem.max != 0)
- {
- fprintf(m_output, " minimum=\"%d\"", elem.min);
- fprintf(m_output, " maximum=\"%d\"", elem.max);
- }
- if (elem.sensitivity != 0)
- fprintf(m_output, " sensitivity=\"%d\"", elem.sensitivity);
- if (elem.keydelta != 0)
- fprintf(m_output, " keydelta=\"%d\"", elem.keydelta);
- if (elem.reverse)
- fprintf(m_output, " reverse=\"yes\"");
-
- fprintf(m_output, "/>\n");
- }
-
- // output keypad and keyboard
- if (keypad)
- fprintf(m_output, "\t\t\t<control type=\"keypad\"/>\n");
- if (keyboard)
- fprintf(m_output, "\t\t\t<control type=\"keyboard\"/>\n");
-
- // misc
- if (mahjong)
- fprintf(m_output, "\t\t\t<control type=\"mahjong\"/>\n");
- if (hanafuda)
- fprintf(m_output, "\t\t\t<control type=\"hanafuda\"/>\n");
- if (gambling)
- fprintf(m_output, "\t\t\t<control type=\"gambling\"/>\n");
-
- fprintf(m_output, "\t\t</input>\n");
+ // enumerated list of control types
+ // NOTE: the order is chosen so that 'spare' button inputs are assigned to the
+ // most-likely-correct input device when info is output (you can think of it as
+ // a sort of likelihood order of having buttons)
+ enum
+ {
+ CTRL_DIGITAL_BUTTONS,
+ CTRL_DIGITAL_JOYSTICK,
+ CTRL_ANALOG_JOYSTICK,
+ CTRL_ANALOG_LIGHTGUN,
+ CTRL_ANALOG_DIAL,
+ CTRL_ANALOG_POSITIONAL,
+ CTRL_ANALOG_TRACKBALL,
+ CTRL_ANALOG_MOUSE,
+ CTRL_ANALOG_PADDLE,
+ CTRL_ANALOG_PEDAL,
+ CTRL_DIGITAL_KEYPAD,
+ CTRL_DIGITAL_KEYBOARD,
+ CTRL_DIGITAL_MAHJONG,
+ CTRL_DIGITAL_HANAFUDA,
+ CTRL_DIGITAL_GAMBLING,
+ CTRL_COUNT
+ };
+
+ enum
+ {
+ CTRL_P1,
+ CTRL_P2,
+ CTRL_P3,
+ CTRL_P4,
+ CTRL_P5,
+ CTRL_P6,
+ CTRL_P7,
+ CTRL_P8,
+ CTRL_PCOUNT
+ };
+
+ // directions
+ const UINT8 DIR_UP = 0x01;
+ const UINT8 DIR_DOWN = 0x02;
+ const UINT8 DIR_LEFT = 0x04;
+ const UINT8 DIR_RIGHT = 0x08;
+
+ // initialize the list of control types
+ struct
+ {
+ const char * type; // general type of input
+ int player; // player which the input belongs to
+ int nbuttons; // total number of buttons
+ int maxbuttons; // max index of buttons (using IPT_BUTTONn) [probably to be removed soonish]
+ int ways; // directions for joystick
+ bool analog; // is analog input?
+ UINT8 helper[3]; // for dual joysticks [possibly to be removed soonish]
+ INT32 min; // analog minimum value
+ INT32 max; // analog maximum value
+ INT32 sensitivity; // default analog sensitivity
+ INT32 keydelta; // default analog keydelta
+ bool reverse; // default analog reverse setting
+ } control_info[CTRL_COUNT * CTRL_PCOUNT];
+
+ memset(&control_info, 0, sizeof(control_info));
+
+ // tracking info as we iterate
+ int nplayer = 0;
+ int ncoin = 0;
+ bool service = false;
+ bool tilt = false;
+
+ // iterate over the ports
+ for (ioport_port &port : portlist)
+ {
+ int ctrl_type = CTRL_DIGITAL_BUTTONS;
+ bool ctrl_analog = FALSE;
+ for (ioport_field &field : port.fields())
+ {
+
+ // track the highest player number
+ if (nplayer < field.player() + 1)
+ nplayer = field.player() + 1;
+
+ // switch off of the type
+ switch (field.type())
+ {
+ // map joysticks
+ case IPT_JOYSTICK_UP:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[0] |= DIR_UP;
+ break;
+ case IPT_JOYSTICK_DOWN:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[0] |= DIR_DOWN;
+ break;
+ case IPT_JOYSTICK_LEFT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[0] |= DIR_LEFT;
+ break;
+ case IPT_JOYSTICK_RIGHT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[0] |= DIR_RIGHT;
+ break;
+
+ case IPT_JOYSTICKLEFT_UP:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[1] |= DIR_UP;
+ break;
+ case IPT_JOYSTICKLEFT_DOWN:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[1] |= DIR_DOWN;
+ break;
+ case IPT_JOYSTICKLEFT_LEFT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[1] |= DIR_LEFT;
+ break;
+ case IPT_JOYSTICKLEFT_RIGHT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[1] |= DIR_RIGHT;
+ break;
+
+ case IPT_JOYSTICKRIGHT_UP:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[2] |= DIR_UP;
+ break;
+ case IPT_JOYSTICKRIGHT_DOWN:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[2] |= DIR_DOWN;
+ break;
+ case IPT_JOYSTICKRIGHT_LEFT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[2] |= DIR_LEFT;
+ break;
+ case IPT_JOYSTICKRIGHT_RIGHT:
+ ctrl_type = CTRL_DIGITAL_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "joy";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].ways = field.way();
+ control_info[field.player() * CTRL_COUNT + ctrl_type].helper[2] |= DIR_RIGHT;
+ break;
+
+ // map analog inputs
+ case IPT_AD_STICK_X:
+ case IPT_AD_STICK_Y:
+ case IPT_AD_STICK_Z:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_JOYSTICK;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "stick";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_PADDLE:
+ case IPT_PADDLE_V:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_PADDLE;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "paddle";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_PEDAL:
+ case IPT_PEDAL2:
+ case IPT_PEDAL3:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_PEDAL;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "pedal";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_LIGHTGUN_X:
+ case IPT_LIGHTGUN_Y:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_LIGHTGUN;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "lightgun";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_POSITIONAL:
+ case IPT_POSITIONAL_V:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_POSITIONAL;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "positional";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_DIAL:
+ case IPT_DIAL_V:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_DIAL;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "dial";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_TRACKBALL_X:
+ case IPT_TRACKBALL_Y:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_TRACKBALL;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "trackball";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ case IPT_MOUSE_X:
+ case IPT_MOUSE_Y:
+ ctrl_analog = TRUE;
+ ctrl_type = CTRL_ANALOG_MOUSE;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "mouse";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = TRUE;
+ break;
+
+ // map buttons
+ case IPT_BUTTON1:
+ case IPT_BUTTON2:
+ case IPT_BUTTON3:
+ case IPT_BUTTON4:
+ case IPT_BUTTON5:
+ case IPT_BUTTON6:
+ case IPT_BUTTON7:
+ case IPT_BUTTON8:
+ case IPT_BUTTON9:
+ case IPT_BUTTON10:
+ case IPT_BUTTON11:
+ case IPT_BUTTON12:
+ case IPT_BUTTON13:
+ case IPT_BUTTON14:
+ case IPT_BUTTON15:
+ case IPT_BUTTON16:
+ ctrl_analog = FALSE;
+ if (control_info[field.player() * CTRL_COUNT + ctrl_type].type == nullptr)
+ {
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "only_buttons";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].analog = FALSE;
+ }
+ control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons = MAX(control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons, field.type() - IPT_BUTTON1 + 1);
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ break;
+
+ // track maximum coin index
+ case IPT_COIN1:
+ case IPT_COIN2:
+ case IPT_COIN3:
+ case IPT_COIN4:
+ case IPT_COIN5:
+ case IPT_COIN6:
+ case IPT_COIN7:
+ case IPT_COIN8:
+ ncoin = MAX(ncoin, field.type() - IPT_COIN1 + 1);
+ break;
+
+ // track presence of keypads and keyboards
+ case IPT_KEYPAD:
+ ctrl_type = CTRL_DIGITAL_KEYPAD;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "keypad";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ break;
+
+ case IPT_KEYBOARD:
+ ctrl_type = CTRL_DIGITAL_KEYBOARD;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "keyboard";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ break;
+
+ // additional types
+ case IPT_SERVICE:
+ service = true;
+ break;
+
+ case IPT_TILT:
+ tilt = true;
+ break;
+
+ default:
+ if (field.type() > IPT_MAHJONG_FIRST && field.type() < IPT_MAHJONG_LAST)
+ {
+ ctrl_type = CTRL_DIGITAL_MAHJONG;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "mahjong";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ }
+ else if (field.type() > IPT_HANAFUDA_FIRST && field.type() < IPT_HANAFUDA_LAST)
+ {
+ ctrl_type = CTRL_DIGITAL_HANAFUDA;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "hanafuda";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ }
+ else if (field.type() > IPT_GAMBLING_FIRST && field.type() < IPT_GAMBLING_LAST)
+ {
+ ctrl_type = CTRL_DIGITAL_GAMBLING;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].type = "gambling";
+ control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
+ control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
+ }
+ break;
+ }
+
+ if (ctrl_analog)
+ {
+ // get the analog stats
+ if (field.minval() != 0)
+ control_info[field.player() * CTRL_COUNT + ctrl_type].min = field.minval();
+ if (field.maxval() != 0)
+ control_info[field.player() * CTRL_COUNT + ctrl_type].max = field.maxval();
+ if (field.sensitivity() != 0)
+ control_info[field.player() * CTRL_COUNT + ctrl_type].sensitivity = field.sensitivity();
+ if (field.delta() != 0)
+ control_info[field.player() * CTRL_COUNT + ctrl_type].keydelta = field.delta();
+ if (field.analog_reverse() != 0)
+ control_info[field.player() * CTRL_COUNT + ctrl_type].reverse = TRUE;
+ }
+ }
+ }
+
+ // Clean-up those entries, if any, where buttons were defined in a separate port than the actual controller they belong to.
+ // This is quite often the case, especially for arcades where controls can be easily mapped to separate input ports on PCB.
+ // If such situation would only happen for joystick, it would be possible to work it around by initializing differently
+ // ctrl_type above, but it is quite common among analog inputs as well (for instance, this is the tipical situation
+ // for lightguns) and therefore we really need this separate loop.
+ for (int i = 0; i < CTRL_PCOUNT; i++)
+ {
+ bool fix_done = FALSE;
+ for (int j = 1; j < CTRL_COUNT; j++)
+ if (control_info[i * CTRL_COUNT].type != nullptr && control_info[i * CTRL_COUNT + j].type != nullptr && !fix_done)
+ {
+ control_info[i * CTRL_COUNT + j].nbuttons += control_info[i * CTRL_COUNT].nbuttons;
+ control_info[i * CTRL_COUNT + j].maxbuttons = MAX(control_info[i * CTRL_COUNT + j].maxbuttons, control_info[i * CTRL_COUNT].maxbuttons);
+
+ memset(&control_info[i * CTRL_COUNT], 0, sizeof(control_info[0]));
+ fix_done = TRUE;
+ }
+ }
+
+ // Output the input info
+ // First basic info
+ fprintf(m_output, "\t\t<input");
+ fprintf(m_output, " players=\"%d\"", nplayer);
+ if (ncoin != 0)
+ fprintf(m_output, " coins=\"%d\"", ncoin);
+ if (service)
+ fprintf(m_output, " service=\"yes\"");
+ if (tilt)
+ fprintf(m_output, " tilt=\"yes\"");
+ fprintf(m_output, ">\n");
+
+ // Then controller specific ones
+ for (auto & elem : control_info)
+ if (elem.type != nullptr)
+ {
+ //printf("type %s - player %d - buttons %d\n", elem.type, elem.player, elem.nbuttons);
+ if (elem.analog)
+ {
+ fprintf(m_output, "\t\t\t<control type=\"%s\"", xml_normalize_string(elem.type));
+ if (nplayer > 1)
+ fprintf(m_output, " player=\"%d\"", elem.player);
+ if (elem.nbuttons > 0)
+ fprintf(m_output, " buttons=\"%d\"", strcmp(elem.type, "stick") ? elem.nbuttons : elem.maxbuttons);
+ if (elem.min != 0 || elem.max != 0)
+ {
+ fprintf(m_output, " minimum=\"%d\"", elem.min);
+ fprintf(m_output, " maximum=\"%d\"", elem.max);
+ }
+ if (elem.sensitivity != 0)
+ fprintf(m_output, " sensitivity=\"%d\"", elem.sensitivity);
+ if (elem.keydelta != 0)
+ fprintf(m_output, " keydelta=\"%d\"", elem.keydelta);
+ if (elem.reverse)
+ fprintf(m_output, " reverse=\"yes\"");
+
+ fprintf(m_output, "/>\n");
+ }
+ else
+ {
+ if (elem.helper[1] == 0 && elem.helper[2] != 0) { elem.helper[1] = elem.helper[2]; elem.helper[2] = 0; }
+ if (elem.helper[0] == 0 && elem.helper[1] != 0) { elem.helper[0] = elem.helper[1]; elem.helper[1] = 0; }
+ if (elem.helper[1] == 0 && elem.helper[2] != 0) { elem.helper[1] = elem.helper[2]; elem.helper[2] = 0; }
+ const char *joys = (elem.helper[2] != 0) ? "triple" : (elem.helper[1] != 0) ? "double" : "";
+ fprintf(m_output, "\t\t\t<control type=\"%s%s\"", joys, xml_normalize_string(elem.type));
+ if (nplayer > 1)
+ fprintf(m_output, " player=\"%d\"", elem.player);
+ if (elem.nbuttons > 0)
+ fprintf(m_output, " buttons=\"%d\"", strcmp(elem.type, "joy") ? elem.nbuttons : elem.maxbuttons);
+ for (int lp = 0; lp < 3 && elem.helper[lp] != 0; lp++)
+ {
+ const char *plural = (lp==2) ? "3" : (lp==1) ? "2" : "";
+ const char *ways;
+ std::string helper;
+ switch (elem.helper[lp] & (DIR_UP | DIR_DOWN | DIR_LEFT | DIR_RIGHT))
+ {
+ case DIR_UP | DIR_DOWN | DIR_LEFT | DIR_RIGHT:
+ helper = string_format("%d", (elem.ways == 0) ? 8 : elem.ways);
+ ways = helper.c_str();
+ break;
+ case DIR_LEFT | DIR_RIGHT:
+ ways = "2";
+ break;
+ case DIR_UP | DIR_DOWN:
+ ways = "vertical2";
+ break;
+ case DIR_UP:
+ case DIR_DOWN:
+ case DIR_LEFT:
+ case DIR_RIGHT:
+ ways = "1";
+ break;
+ case DIR_UP | DIR_DOWN | DIR_LEFT:
+ case DIR_UP | DIR_DOWN | DIR_RIGHT:
+ case DIR_UP | DIR_LEFT | DIR_RIGHT:
+ case DIR_DOWN | DIR_LEFT | DIR_RIGHT:
+ ways = (elem.ways == 4) ? "3 (half4)" : "5 (half8)";
+ break;
+ default:
+ ways = "strange2";
+ break;
+ }
+ fprintf(m_output, " ways%s=\"%s\"", plural, ways);
+ }
+ fprintf(m_output, "/>\n");
+ }
+ }
+
+ fprintf(m_output, "\t\t</input>\n");
}
@@ -1229,6 +1429,7 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
{
if (strcmp(imagedev->device().tag(), device.tag()))
{
+ bool loadable = imagedev->user_loadable();
std::string newtag(imagedev->device().tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
@@ -1239,9 +1440,13 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
if (imagedev->device().tag())
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
- // is this device mandatory?
- if (imagedev->must_be_loaded())
- fprintf(m_output, " mandatory=\"1\"");
+ // is this device available as media switch?
+ if (!loadable)
+ fprintf(m_output, " fixed_image=\"1\"");
+
+ // is this device mandatory?
+ if (imagedev->must_be_loaded())
+ fprintf(m_output, " mandatory=\"1\"");
if (imagedev->image_interface() && imagedev->image_interface()[0])
fprintf(m_output, " interface=\"%s\"", xml_normalize_string(imagedev->image_interface()));
@@ -1249,25 +1454,27 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
// close the XML tag
fprintf(m_output, ">\n");
- const char *name = imagedev->instance_name();
- const char *shortname = imagedev->brief_instance_name();
-
- fprintf(m_output, "\t\t\t<instance");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(name));
- fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname));
- fprintf(m_output, "/>\n");
-
- std::string extensions(imagedev->file_extensions());
-
- char *ext = strtok((char *)extensions.c_str(), ",");
- while (ext != nullptr)
- {
- fprintf(m_output, "\t\t\t<extension");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(ext));
- fprintf(m_output, "/>\n");
- ext = strtok(nullptr, ",");
- }
-
+ if (loadable)
+ {
+ const char *name = imagedev->instance_name();
+ const char *shortname = imagedev->brief_instance_name();
+
+ fprintf(m_output, "\t\t\t<instance");
+ fprintf(m_output, " name=\"%s\"", xml_normalize_string(name));
+ fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname));
+ fprintf(m_output, "/>\n");
+
+ std::string extensions(imagedev->file_extensions());
+
+ char *ext = strtok((char *)extensions.c_str(), ",");
+ while (ext != nullptr)
+ {
+ fprintf(m_output, "\t\t\t<extension");
+ fprintf(m_output, " name=\"%s\"", xml_normalize_string(ext));
+ fprintf(m_output, "/>\n");
+ ext = strtok(nullptr, ",");
+ }
+ }
fprintf(m_output, "\t\t</device>\n");
}
}
diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h
index ff2ffbc5749..cd083738ecc 100644
--- a/src/emu/inpttype.h
+++ b/src/emu/inpttype.h
@@ -741,7 +741,7 @@ void construct_core_types_UI(simple_list<input_type_entry> &typelist)
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_END, "UI End", input_seq(KEYCODE_END) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_UP, "UI Page Up", input_seq(KEYCODE_PGUP) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_DOWN, "UI Page Down", input_seq(KEYCODE_PGDN) )
- INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SELECT, "UI Select", input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) )
+ INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SELECT, "UI Select", input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0), input_seq::or_code, KEYCODE_ENTER_PAD) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CANCEL, "UI Cancel", input_seq(KEYCODE_ESC) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DISPLAY_COMMENT, "UI Display Comment", input_seq(KEYCODE_SPACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CLEAR, "UI Clear", input_seq(KEYCODE_DEL) )
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index 3d50bcf9e5e..44b627baf96 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -1583,71 +1583,23 @@ const input_seq &ioport_field::defseq(input_seq_type seqtype) const
ioport_type_class ioport_field::type_class() const
{
- ioport_type_class result;
+ ioport_group group = manager().type_group(m_type, m_player);
+ if (group >= IPG_PLAYER1 && group <= IPG_PLAYER8)
+ return INPUT_CLASS_CONTROLLER;
- switch (m_type)
- {
- case IPT_JOYSTICK_UP:
- case IPT_JOYSTICK_DOWN:
- case IPT_JOYSTICK_LEFT:
- case IPT_JOYSTICK_RIGHT:
- case IPT_JOYSTICKLEFT_UP:
- case IPT_JOYSTICKLEFT_DOWN:
- case IPT_JOYSTICKLEFT_LEFT:
- case IPT_JOYSTICKLEFT_RIGHT:
- case IPT_JOYSTICKRIGHT_UP:
- case IPT_JOYSTICKRIGHT_DOWN:
- case IPT_JOYSTICKRIGHT_LEFT:
- case IPT_JOYSTICKRIGHT_RIGHT:
- case IPT_BUTTON1:
- case IPT_BUTTON2:
- case IPT_BUTTON3:
- case IPT_BUTTON4:
- case IPT_BUTTON5:
- case IPT_BUTTON6:
- case IPT_BUTTON7:
- case IPT_BUTTON8:
- case IPT_BUTTON9:
- case IPT_BUTTON10:
- case IPT_AD_STICK_X:
- case IPT_AD_STICK_Y:
- case IPT_AD_STICK_Z:
- case IPT_TRACKBALL_X:
- case IPT_TRACKBALL_Y:
- case IPT_LIGHTGUN_X:
- case IPT_LIGHTGUN_Y:
- case IPT_MOUSE_X:
- case IPT_MOUSE_Y:
- case IPT_START:
- case IPT_SELECT:
- result = INPUT_CLASS_CONTROLLER;
- break;
+ if (m_type == IPT_KEYPAD || m_type == IPT_KEYBOARD)
+ return INPUT_CLASS_KEYBOARD;
- case IPT_KEYPAD:
- case IPT_KEYBOARD:
- result = INPUT_CLASS_KEYBOARD;
- break;
+ if (m_type == IPT_CONFIG)
+ return INPUT_CLASS_CONFIG;
- case IPT_CONFIG:
- result = INPUT_CLASS_CONFIG;
- break;
+ if (m_type == IPT_DIPSWITCH)
+ return INPUT_CLASS_DIPSWITCH;
- case IPT_DIPSWITCH:
- result = INPUT_CLASS_DIPSWITCH;
- break;
-
- case 0:
- if (m_name != nullptr && m_name != (const char *)-1)
- result = INPUT_CLASS_MISC;
- else
- result = INPUT_CLASS_INTERNAL;
- break;
+ if (group == IPG_OTHER || (group == IPG_INVALID && m_name != nullptr))
+ return INPUT_CLASS_MISC;
- default:
- result = INPUT_CLASS_INTERNAL;
- break;
- }
- return result;
+ return INPUT_CLASS_INTERNAL;
}
diff --git a/src/emu/language.cpp b/src/emu/language.cpp
index 8d4618c7be3..5c9686a646e 100644
--- a/src/emu/language.cpp
+++ b/src/emu/language.cpp
@@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
+#include "emuopts.h"
static std::unordered_map<std::string, std::string> g_translation;
diff --git a/src/emu/layout/svg.lay b/src/emu/layout/svg.lay
new file mode 100644
index 00000000000..96a25360a19
--- /dev/null
+++ b/src/emu/layout/svg.lay
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<mamelayout version="2">
+ <view name="SVG">
+ <screen index="0">
+ <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" />
+ </screen>
+ </view>
+</mamelayout>
diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp
index 62667ee0eef..b1ebf60d88a 100644
--- a/src/emu/luaengine.cpp
+++ b/src/emu/luaengine.cpp
@@ -16,10 +16,14 @@
#include "emu.h"
#include "cheat.h"
#include "drivenum.h"
+#include "emuopts.h"
#include "ui/ui.h"
#include "luaengine.h"
#include <mutex>
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wshift-count-overflow"
+#endif
//**************************************************************************
// LUA ENGINE
//**************************************************************************
@@ -108,6 +112,93 @@ int lua_engine::docall(int narg, int nres)
return status;
}
+namespace luabridge
+{
+template <>
+struct Stack <osd_file::error>
+{
+ static void push(lua_State *L, osd_file::error error)
+ {
+ std::string strerror;
+ switch(error)
+ {
+ case osd_file::error::NONE:
+ lua_pushboolean(L, false);
+ return;
+ case osd_file::error::FAILURE:
+ strerror = "failure";
+ break;
+ case osd_file::error::OUT_OF_MEMORY:
+ strerror = "out_of_memory";
+ break;
+ case osd_file::error::NOT_FOUND:
+ strerror = "not_found";
+ break;
+ case osd_file::error::ACCESS_DENIED:
+ strerror = "access_denied";
+ break;
+ case osd_file::error::ALREADY_OPEN:
+ strerror = "already_open";
+ break;
+ case osd_file::error::TOO_MANY_FILES:
+ strerror = "too_many_files";
+ break;
+ case osd_file::error::INVALID_DATA:
+ strerror = "invalid_data";
+ break;
+ case osd_file::error::INVALID_ACCESS:
+ strerror = "invalid_access";
+ break;
+ default:
+ strerror = "unknown_error";
+ break;
+ }
+ lua_pushstring(L, strerror.c_str());
+ }
+};
+template <>
+struct Stack <map_handler_type>
+{
+ static void push(lua_State *L, map_handler_type error)
+ {
+ std::string type;
+ switch(error)
+ {
+ case AMH_NONE:
+ type = "none";
+ break;
+ case AMH_RAM:
+ type = "ram";
+ break;
+ case AMH_ROM:
+ type = "rom";
+ break;
+ case AMH_NOP:
+ type = "nop";
+ break;
+ case AMH_UNMAP:
+ type = "unmap";
+ break;
+ case AMH_DEVICE_DELEGATE:
+ type = "delegate";
+ break;
+ case AMH_PORT:
+ type = "port";
+ break;
+ case AMH_BANK:
+ type = "bank";
+ break;
+ case AMH_DEVICE_SUBMAP:
+ type = "submap";
+ break;
+ default:
+ type = "unknown";
+ break;
+ }
+ lua_pushstring(L, type.c_str());
+ }
+};
+}
/* mark in error messages for incomplete statements */
#define EOFMARK "<eof>"
#define marklen (sizeof(EOFMARK)/sizeof(char) - 1)
@@ -447,6 +538,61 @@ luabridge::LuaRef lua_engine::l_machine_get_devices(const running_machine *r)
}
//-------------------------------------------------
+// machine_get_images - return table of available image devices userdata
+// -> manager:machine().images["flop1"]
+//-------------------------------------------------
+
+luabridge::LuaRef lua_engine::l_machine_get_images(const running_machine *r)
+{
+ lua_State *L = luaThis->m_lua_state;
+ luabridge::LuaRef image_table = luabridge::LuaRef::newTable(L);
+
+ image_interface_iterator iter(r->root_device());
+ for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) {
+ image_table[image->brief_instance_name()] = image;
+ image_table[image->instance_name()] = image;
+ }
+
+ return image_table;
+}
+
+//-------------------------------------------------
+// memory_banks - return memory_banks
+// -> manager:machine():memory().banks["maincpu"]
+//-------------------------------------------------
+
+luabridge::LuaRef lua_engine::l_memory_get_banks(const memory_manager *m)
+{
+ memory_manager *mm = const_cast<memory_manager *>(m);
+ lua_State *L = luaThis->m_lua_state;
+ luabridge::LuaRef table = luabridge::LuaRef::newTable(L);
+
+ for (memory_bank &bank : mm->banks()) {
+ table[bank.tag()] = &bank;
+ }
+
+ return table;
+}
+
+//-------------------------------------------------
+// memory_regions - return memory_regions
+// -> manager:machine():memory().region[":maincpu"]
+//-------------------------------------------------
+
+luabridge::LuaRef lua_engine::l_memory_get_regions(const memory_manager *m)
+{
+ memory_manager *mm = const_cast<memory_manager *>(m);
+ lua_State *L = luaThis->m_lua_state;
+ luabridge::LuaRef table = luabridge::LuaRef::newTable(L);
+
+ for (memory_region &region: mm->regions()) {
+ table[region.name()] = &region;
+ }
+
+ return table;
+}
+
+//-------------------------------------------------
// machine_cheat_entries - return cheat entries
// -> manager:machine():cheat().entries[0]
//-------------------------------------------------
@@ -566,6 +712,9 @@ luabridge::LuaRef lua_engine::l_dev_get_memspaces(const device_t *d)
lua_State *L = luaThis->m_lua_state;
luabridge::LuaRef sp_table = luabridge::LuaRef::newTable(L);
+ if(!&dev->memory())
+ return sp_table;
+
for (address_spacenum sp = AS_0; sp < ADDRESS_SPACES; ++sp) {
if (dev->memory().has_space(sp)) {
sp_table[dev->memory().space(sp).name()] = &(dev->memory().space(sp));
@@ -585,6 +734,10 @@ luabridge::LuaRef lua_engine::l_dev_get_states(const device_t *d)
device_t *dev = const_cast<device_t *>(d);
lua_State *L = luaThis->m_lua_state;
luabridge::LuaRef st_table = luabridge::LuaRef::newTable(L);
+
+ if(!&dev->state())
+ return st_table;
+
for (device_state_entry &s : dev->state().state_entries())
{
// XXX: refrain from exporting non-visible entries?
@@ -595,6 +748,126 @@ luabridge::LuaRef lua_engine::l_dev_get_states(const device_t *d)
}
//-------------------------------------------------
+// device_get_item - return table of indexed items owned by this device
+// -> manager:machine().devices[":maincpu"].items
+//-------------------------------------------------
+
+luabridge::LuaRef lua_engine::l_dev_get_items(const device_t *d)
+{
+ device_t *dev = const_cast<device_t *>(d);
+ lua_State *L = luaThis->m_lua_state;
+ luabridge::LuaRef table = luabridge::LuaRef::newTable(L);
+ std::string tag = dev->tag();
+
+ // 10000 is enough?
+ for(int i = 0; i < 10000; i++)
+ {
+ std::string name;
+ const char *item;
+ unsigned int size, count;
+ void *base;
+ item = dev->machine().save().indexed_item(i, base, size, count);
+ if(!item)
+ break;
+ name = &(strchr(item, '/')[1]);
+ if(name.substr(0, name.find("/")) == tag)
+ {
+ name = name.substr(name.find("/") + 1, std::string::npos);
+ table[name] = i;
+ }
+ }
+ return table;
+}
+
+lua_engine::lua_item::lua_item(int index)
+{
+ std::string name;
+ const char *item;
+ item = luaThis->machine().save().indexed_item(index, l_item_base, l_item_size, l_item_count);
+ if(!item)
+ {
+ l_item_base = nullptr;
+ l_item_size = 0;
+ l_item_count= 0;
+ }
+}
+
+int lua_engine::lua_item::l_item_read(lua_State *L)
+{
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "offset (integer) expected");
+ int offset = lua_tounsigned(L, 2);
+ int ret = 0;
+ if(!l_item_base || (offset > l_item_count))
+ {
+ lua_pushnil(L);
+ return 1;
+ }
+ switch(l_item_size)
+ {
+ case 1:
+ default:
+ ret = ((UINT8 *)l_item_base)[offset];
+ break;
+ case 2:
+ ret = ((UINT16 *)l_item_base)[offset];
+ break;
+ case 4:
+ ret = ((UINT32 *)l_item_base)[offset];
+ break;
+ case 8:
+ ret = ((UINT64 *)l_item_base)[offset];
+ break;
+ }
+ lua_pushunsigned(L, ret);
+ return 1;
+}
+
+int lua_engine::lua_item::l_item_write(lua_State *L)
+{
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "offset (integer) expected");
+ luaL_argcheck(L, lua_isnumber(L, 3), 3, "value (integer) expected");
+ int offset = lua_tounsigned(L, 2);
+ UINT64 value = lua_tounsigned(L, 3);
+ if(!l_item_base || (offset > l_item_count))
+ return 1;
+ switch(l_item_size)
+ {
+ case 1:
+ default:
+ ((UINT8 *)l_item_base)[offset] = (UINT8)value;
+ break;
+ case 2:
+ ((UINT16 *)l_item_base)[offset] = (UINT16)value;
+ break;
+ case 4:
+ ((UINT32 *)l_item_base)[offset] = (UINT32)value;
+ break;
+ case 8:
+ ((UINT64 *)l_item_base)[offset] = (UINT64)value;
+ break;
+ }
+ return 1;
+}
+
+int lua_engine::lua_item::l_item_read_block(lua_State *L)
+{
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "offset (integer) expected");
+ luaL_argcheck(L, lua_isnumber(L, 3), 3, "length (integer) expected");
+ int offset = lua_tounsigned(L, 2);
+ int len = lua_tonumber(L, 3);
+ if(!l_item_base || ((offset + len) > (l_item_size * l_item_count)))
+ {
+ lua_pushnil(L);
+ return 1;
+ }
+ luaL_Buffer buff;
+ char *ptr = luaL_buffinitsize(L, &buff, len);
+ memcpy(ptr, l_item_base, len);
+ luaL_pushresultsize(&buff, len);
+ return 1;
+}
+
+//-------------------------------------------------
// state_get_value - return value of a device state entry
// -> manager:machine().devices[":maincpu"].state["PC"].value
//-------------------------------------------------
@@ -697,7 +970,7 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L)
if (WORD_ALIGNED(address)) {
sp.write_word(address, val);
} else {
- sp.read_word_unaligned(address, val);
+ sp.write_word_unaligned(address, val);
}
break;
case 32:
@@ -721,6 +994,170 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L)
return 0;
}
+//-------------------------------------------------
+// mem_direct_read - templated direct memory readers for <sign>,<size>
+// -> manager:machine().devices[":maincpu"].spaces["program"]:read_direct_i8(0xC000)
+//-------------------------------------------------
+
+UINT8 lua_engine::read_direct_byte(address_space &space, offs_t addr)
+{
+ UINT8 *base = (UINT8 *)space.get_read_ptr(space.address_to_byte(addr));
+ if(base)
+ return base[addr];
+ else
+ return 0;
+}
+
+template <typename T>
+int lua_engine::lua_addr_space::l_direct_mem_read(lua_State *L)
+{
+ address_space &sp = luabridge::Stack<address_space &>::get(L, 1);
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
+ offs_t address = lua_tounsigned(L, 2);
+ T mem_content = 0;
+ for(int i = 0; i < sizeof(T); i++)
+ {
+ UINT8 byte;
+ mem_content <<= 8;
+ if(sp.endianness() == ENDIANNESS_BIG)
+ byte = read_direct_byte(sp, address + sizeof(T) - i);
+ else
+ byte = read_direct_byte(sp, address + i);
+ mem_content |= byte;
+ }
+
+ if (std::numeric_limits<T>::is_signed) {
+ lua_pushinteger(L, mem_content);
+ } else {
+ lua_pushunsigned(L, mem_content);
+ }
+
+ return 1;
+}
+
+//-------------------------------------------------
+// mem_direct_write - templated memory writer for <sign>,<size>
+// -> manager:machine().devices[":maincpu"].spaces["program"]:write_direct_u16(0xC000, 0xF00D)
+//-------------------------------------------------
+
+void lua_engine::write_direct_byte(address_space &space, offs_t addr, UINT8 byte)
+{
+ UINT8 *base = (UINT8 *)space.get_read_ptr(space.address_to_byte(addr));
+ if(base)
+ base[addr] = byte;
+}
+
+template <typename T>
+int lua_engine::lua_addr_space::l_direct_mem_write(lua_State *L)
+{
+ address_space &sp = luabridge::Stack<address_space &>::get(L, 1);
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
+ luaL_argcheck(L, lua_isnumber(L, 3), 3, "value (integer) expected");
+ offs_t address = lua_tounsigned(L, 2);
+ T val = lua_tounsigned(L, 3);
+ for(int i = 0; i < sizeof(T); i++)
+ {
+ if(sp.endianness() == ENDIANNESS_BIG)
+ write_direct_byte(sp, address + sizeof(T) - i, val & 0xff);
+ else
+ write_direct_byte(sp, address + i, val & 0xff);
+ val >>= 8;
+ }
+
+ return 0;
+}
+
+//-------------------------------------------------
+// region_read - templated region readers for <sign>,<size>
+// -> manager:machine():memory().region[":maincpu"]:read_i8(0xC000)
+//-------------------------------------------------
+
+UINT8 lua_engine::read_region_byte(memory_region &region, offs_t addr)
+{
+ if(addr >= region.bytes())
+ return 0;
+
+ return region.u8(addr);
+}
+
+template <typename T>
+int lua_engine::lua_memory_region::l_region_read(lua_State *L)
+{
+ memory_region &region = luabridge::Stack<memory_region &>::get(L, 1);
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
+ offs_t address = lua_tounsigned(L, 2);
+ T mem_content = 0;
+ for(int i = 0; i < sizeof(T); i++)
+ {
+ UINT8 byte;
+ mem_content <<= 8;
+ if(region.endianness() == ENDIANNESS_BIG)
+ byte = read_region_byte(region, address + sizeof(T) - i);
+ else
+ byte = read_region_byte(region, address + i);
+ mem_content |= byte;
+ }
+
+ if (std::numeric_limits<T>::is_signed) {
+ lua_pushinteger(L, mem_content);
+ } else {
+ lua_pushunsigned(L, mem_content);
+ }
+
+ return 1;
+}
+
+//-------------------------------------------------
+// region_write - templated region writer for <sign>,<size>
+// -> manager:machine():memory().region[":maincpu"]:write_u16(0xC000, 0xF00D)
+//-------------------------------------------------
+
+void lua_engine::write_region_byte(memory_region &region, offs_t addr, UINT8 byte)
+{
+ if(addr >= region.bytes())
+ return;
+
+ region.base()[addr] = byte;
+}
+
+template <typename T>
+int lua_engine::lua_memory_region::l_region_write(lua_State *L)
+{
+ memory_region &region = luabridge::Stack<memory_region &>::get(L, 1);
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
+ luaL_argcheck(L, lua_isnumber(L, 3), 3, "value (integer) expected");
+ offs_t address = lua_tounsigned(L, 2);
+ T val = lua_tounsigned(L, 3);
+ for(int i = 0; i < sizeof(T); i++)
+ {
+ if(region.endianness() == ENDIANNESS_BIG)
+ write_region_byte(region, address + sizeof(T) - i, val & 0xff);
+ else
+ write_region_byte(region, address + i, val & 0xff);
+ val >>= 8;
+ }
+
+ return 0;
+}
+
+luabridge::LuaRef lua_engine::l_addr_space_map(const address_space *space)
+{
+ lua_State *L = luaThis->m_lua_state;
+ luabridge::LuaRef map = luabridge::LuaRef::newTable(L);
+
+ int i = 1;
+ for (address_map_entry &entry : space->map()->m_entrylist)
+ {
+ luabridge::LuaRef mapentry = luabridge::LuaRef::newTable(L);
+ mapentry["offset"] = space->address_to_byte(entry.m_addrstart) & space->bytemask();
+ mapentry["endoff"] = space->address_to_byte(entry.m_addrend) & space->bytemask();
+ mapentry["readtype"] = entry.m_read.m_type;
+ mapentry["writetype"] = entry.m_write.m_type;
+ map[i++] = mapentry;
+ }
+ return map;
+}
+
int lua_engine::lua_options_entry::l_entry_value(lua_State *L)
{
core_options::entry *e = luabridge::Stack<core_options::entry *>::get(L, 1);
@@ -968,6 +1405,7 @@ int lua_engine::lua_screen::l_type(lua_State *L)
case SCREEN_TYPE_RASTER: lua_pushliteral(L, "raster"); break;
case SCREEN_TYPE_VECTOR: lua_pushliteral(L, "vector"); break;
case SCREEN_TYPE_LCD: lua_pushliteral(L, "lcd"); break;
+ case SCREEN_TYPE_SVG: lua_pushliteral(L, "svg"); break;
default: lua_pushliteral(L, "unknown"); break;
}
@@ -1049,6 +1487,7 @@ int lua_engine::lua_screen::l_draw_line(lua_State *L)
//-------------------------------------------------
// draw_text - draw text on a screen container
+// if x is a position, then y is a pixel position, otherwise x and y are screen size relative
// -> manager:machine().screens[":screen"]:draw_text(x, y, message)
//-------------------------------------------------
@@ -1060,7 +1499,7 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
}
// ensure that we got proper parameters
- luaL_argcheck(L, lua_isnumber(L, 2), 2, "x (integer) expected");
+ luaL_argcheck(L, lua_isnumber(L, 2) || lua_isstring(L, 2), 2, "x (integer or string) expected");
luaL_argcheck(L, lua_isnumber(L, 3), 3, "y (integer) expected");
luaL_argcheck(L, lua_isstring(L, 4), 4, "message (string) expected");
luaL_argcheck(L, lua_isinteger(L, 5) || lua_isnone(L, 5), 5, "optional argument: text color, integer expected (default: 0xffffffff)");
@@ -1068,8 +1507,22 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
// retrieve all parameters
int sc_width = sc->visible_area().width();
int sc_height = sc->visible_area().height();
- float x = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
- float y = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
+ int justify = JUSTIFY_LEFT;
+ float y, x = 0;
+ if(lua_isnumber(L, 2))
+ {
+ x = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width);
+ y = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height);
+ }
+ else
+ {
+ std::string just_str = lua_tostring(L, 2);
+ if(just_str == "right")
+ justify = JUSTIFY_RIGHT;
+ else if(just_str == "center")
+ justify = JUSTIFY_CENTER;
+ y = lua_tonumber(L, 3);
+ }
const char *msg = luaL_checkstring(L,4);
rgb_t textcolor = UI_TEXT_COLOR;
if (!lua_isnone(L, 5)) {
@@ -1079,13 +1532,25 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
// draw the text
render_container &rc = sc->container();
ui_manager &ui = sc->machine().ui();
- ui.draw_text_full(&rc, msg, x, y , (1.0f - x),
- JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, textcolor,
+ ui.draw_text_full(&rc, msg, x, y, (1.0f - x),
+ justify, WRAP_WORD, DRAW_NORMAL, textcolor,
UI_TEXT_BG_COLOR, nullptr, nullptr);
return 0;
}
+int lua_engine::lua_emu_file::l_emu_file_read(lua_State *L)
+{
+ emu_file *file = luabridge::Stack<emu_file *>::get(L, 1);
+ luaL_argcheck(L, lua_isnumber(L, 2), 2, "length (integer) expected");
+ int ret, len = lua_tonumber(L, 2);
+ luaL_Buffer buff;
+ char *ptr = luaL_buffinitsize(L, &buff, len);
+ ret = file->read(ptr, len);
+ luaL_pushresultsize(&buff, ret);
+ return 1;
+}
+
void *lua_engine::checkparam(lua_State *L, int idx, const char *tname)
{
const char *name;
@@ -1273,6 +1738,92 @@ lua_engine::~lua_engine()
close();
}
+void lua_engine::menu_populate(std::string &menu, std::vector<menu_item> &menu_list)
+{
+ std::string field = "menu_pop_" + menu;
+ lua_settop(m_lua_state, 0);
+ lua_getfield(m_lua_state, LUA_REGISTRYINDEX, field.c_str());
+
+ if(!lua_isfunction(m_lua_state, -1))
+ {
+ lua_pop(m_lua_state, 1);
+ return;
+ }
+ if(int error = lua_pcall(m_lua_state, 0, 1, 0))
+ {
+ if(error == 2)
+ printf("%s\n", lua_tostring(m_lua_state, -1));
+ lua_pop(m_lua_state, 1);
+ return;
+ }
+ if(!lua_istable(m_lua_state, -1))
+ {
+ lua_pop(m_lua_state, 1);
+ return;
+ }
+
+ lua_pushnil(m_lua_state);
+ while(lua_next(m_lua_state, -2))
+ {
+ if(lua_istable(m_lua_state, -1))
+ {
+ menu_item item;
+ lua_rawgeti(m_lua_state, -1, 1);
+ item.text = lua_tostring(m_lua_state, -1);
+ lua_pop(m_lua_state, 1);
+ lua_rawgeti(m_lua_state, -1, 2);
+ item.subtext = lua_tostring(m_lua_state, -1);
+ lua_pop(m_lua_state, 1);
+ lua_rawgeti(m_lua_state, -1, 3);
+ item.flags = lua_tostring(m_lua_state, -1);
+ lua_pop(m_lua_state, 1);
+ menu_list.push_back(item);
+ }
+ lua_pop(m_lua_state, 1);
+ }
+ lua_pop(m_lua_state, 1);
+}
+
+bool lua_engine::menu_callback(std::string &menu, int index, std::string event)
+{
+ std::string field = "menu_cb_" + menu;
+ bool ret = false;
+ lua_settop(m_lua_state, 0);
+ lua_getfield(m_lua_state, LUA_REGISTRYINDEX, field.c_str());
+
+ if(lua_isfunction(m_lua_state, -1))
+ {
+ lua_pushinteger(m_lua_state, index);
+ lua_pushstring(m_lua_state, event.c_str());
+ if(int error = lua_pcall(m_lua_state, 2, 1, 0))
+ {
+ if(error == 2)
+ printf("%s\n", lua_tostring(m_lua_state, -1));
+ lua_pop(m_lua_state, 1);
+ return false;
+ }
+ ret = lua_toboolean(m_lua_state, -1);
+ lua_pop(m_lua_state, 1);
+ }
+ return ret;
+}
+
+int lua_engine::l_emu_register_menu(lua_State *L)
+{
+ luaL_argcheck(L, lua_isfunction(L, 1), 1, "callback function expected");
+ luaL_argcheck(L, lua_isfunction(L, 2), 2, "callback function expected");
+ luaL_argcheck(L, lua_isstring(L, 3), 3, "message (string) expected");
+ std::string name = luaL_checkstring(L, 3);
+ std::string cbfield = "menu_cb_" + name;
+ std::string popfield = "menu_pop_" + name;
+ luaThis->m_menu.push_back(std::string(name));
+ lua_pushvalue(L, 1);
+ lua_setfield(L, LUA_REGISTRYINDEX, cbfield.c_str());
+ lua_pushvalue(L, 2);
+ lua_setfield(L, LUA_REGISTRYINDEX, popfield.c_str());
+ return 1;
+}
+
void lua_engine::execute_function(const char *id)
{
lua_settop(m_lua_state, 0);
@@ -1285,7 +1836,12 @@ void lua_engine::execute_function(const char *id)
{
if (lua_isfunction(m_lua_state, -1))
{
- lua_pcall(m_lua_state, 0, 0, 0);
+ if(int error = lua_pcall(m_lua_state, 0, 0, 0))
+ {
+ if(error == 2)
+ printf("%s\n", lua_tostring(m_lua_state, -1));
+ lua_pop(m_lua_state, 1);
+ }
}
else
{
@@ -1346,6 +1902,11 @@ int lua_engine::l_emu_register_frame(lua_State *L)
return register_function(L, "LUA_ON_FRAME");
}
+int lua_engine::l_emu_register_frame_done(lua_State *L)
+{
+ return register_function(L, "LUA_ON_FRAME_DONE");
+}
+
void lua_engine::on_machine_prestart()
{
execute_function("LUA_ON_PRESTART");
@@ -1376,6 +1937,11 @@ void lua_engine::on_machine_frame()
execute_function("LUA_ON_FRAME");
}
+void lua_engine::on_frame_done()
+{
+ execute_function("LUA_ON_FRAME_DONE");
+}
+
void lua_engine::update_machine()
{
lua_newtable(m_lua_state);
@@ -1452,6 +2018,8 @@ void lua_engine::initialize()
.addCFunction ("register_pause", l_emu_register_pause )
.addCFunction ("register_resume",l_emu_register_resume )
.addCFunction ("register_frame", l_emu_register_frame )
+ .addCFunction ("register_frame_done", l_emu_register_frame_done )
+ .addCFunction ("register_menu", l_emu_register_menu )
.beginClass <machine_manager> ("manager")
.addFunction ("machine", &machine_manager::machine)
.addFunction ("options", &machine_manager::options)
@@ -1474,9 +2042,11 @@ void lua_engine::initialize()
.addFunction ("ioport", &running_machine::ioport)
.addFunction ("parameters", &running_machine::parameters)
.addFunction ("cheat", &running_machine::cheat)
+ .addFunction ("memory", &running_machine::memory)
.addFunction ("options", &running_machine::options)
.addProperty <luabridge::LuaRef, void> ("devices", &lua_engine::l_machine_get_devices)
.addProperty <luabridge::LuaRef, void> ("screens", &lua_engine::l_machine_get_screens)
+ .addProperty <luabridge::LuaRef, void> ("images", &lua_engine::l_machine_get_images)
.endClass ()
.beginClass <game_driver> ("game_driver")
.addData ("source_file", &game_driver::source_file)
@@ -1492,8 +2062,10 @@ void lua_engine::initialize()
.addFunction ("name", &device_t::name)
.addFunction ("shortname", &device_t::shortname)
.addFunction ("tag", &device_t::tag)
+ .addFunction ("owner", &device_t::owner)
.addProperty <luabridge::LuaRef, void> ("spaces", &lua_engine::l_dev_get_memspaces)
.addProperty <luabridge::LuaRef, void> ("state", &lua_engine::l_dev_get_states)
+ .addProperty <luabridge::LuaRef, void> ("items", &lua_engine::l_dev_get_items)
.endClass()
.beginClass <cheat_manager> ("cheat")
.addProperty <bool, bool> ("enabled", &cheat_manager::enabled, &cheat_manager::set_enable)
@@ -1621,9 +2193,26 @@ void lua_engine::initialize()
.addCFunction ("write_u32", &lua_addr_space::l_mem_write<UINT32>)
.addCFunction ("write_i64", &lua_addr_space::l_mem_write<INT64>)
.addCFunction ("write_u64", &lua_addr_space::l_mem_write<UINT64>)
+ .addCFunction ("read_direct_i8", &lua_addr_space::l_direct_mem_read<INT8>)
+ .addCFunction ("read_direct_u8", &lua_addr_space::l_direct_mem_read<UINT8>)
+ .addCFunction ("read_direct_i16", &lua_addr_space::l_direct_mem_read<INT16>)
+ .addCFunction ("read_direct_u16", &lua_addr_space::l_direct_mem_read<UINT16>)
+ .addCFunction ("read_direct_i32", &lua_addr_space::l_direct_mem_read<INT32>)
+ .addCFunction ("read_direct_u32", &lua_addr_space::l_direct_mem_read<UINT32>)
+ .addCFunction ("read_direct_i64", &lua_addr_space::l_direct_mem_read<INT64>)
+ .addCFunction ("read_direct_u64", &lua_addr_space::l_direct_mem_read<UINT64>)
+ .addCFunction ("write_direct_i8", &lua_addr_space::l_direct_mem_write<INT8>)
+ .addCFunction ("write_direct_u8", &lua_addr_space::l_direct_mem_write<UINT8>)
+ .addCFunction ("write_direct_i16", &lua_addr_space::l_direct_mem_write<INT16>)
+ .addCFunction ("write_direct_u16", &lua_addr_space::l_direct_mem_write<UINT16>)
+ .addCFunction ("write_direct_i32", &lua_addr_space::l_direct_mem_write<INT32>)
+ .addCFunction ("write_direct_u32", &lua_addr_space::l_direct_mem_write<UINT32>)
+ .addCFunction ("write_direct_i64", &lua_addr_space::l_direct_mem_write<INT64>)
+ .addCFunction ("write_direct_u64", &lua_addr_space::l_direct_mem_write<UINT64>)
.endClass()
.deriveClass <address_space, lua_addr_space> ("addr_space")
.addFunction("name", &address_space::name)
+ .addProperty <luabridge::LuaRef, void> ("map", &lua_engine::l_addr_space_map)
.endClass()
.beginClass <render_target> ("target")
.addFunction ("width", &render_target::width)
@@ -1662,6 +2251,7 @@ void lua_engine::initialize()
.addProperty <bool, bool> ("show_fps", &ui_manager::show_fps, &ui_manager::set_show_fps)
.addProperty <bool, bool> ("show_profiler", &ui_manager::show_profiler, &ui_manager::set_show_profiler)
.addProperty <bool, bool> ("single_step", &ui_manager::single_step, &ui_manager::set_single_step)
+ .addFunction ("get_line_height", &ui_manager::get_line_height)
.endClass()
.beginClass <lua_screen> ("lua_screen_dev")
.addCFunction ("draw_box", &lua_screen::l_draw_box)
@@ -1688,6 +2278,65 @@ void lua_engine::initialize()
.addFunction ("is_visible", &device_state_entry::visible)
.addFunction ("is_divider", &device_state_entry::divider)
.endClass()
+ .beginClass <memory_manager> ("memory")
+ .addProperty <luabridge::LuaRef, void> ("banks", &lua_engine::l_memory_get_banks)
+ .addProperty <luabridge::LuaRef, void> ("regions", &lua_engine::l_memory_get_regions)
+ .endClass()
+ .beginClass <lua_memory_region> ("lua_region")
+ .addCFunction ("read_i8", &lua_memory_region::l_region_read<INT8>)
+ .addCFunction ("read_u8", &lua_memory_region::l_region_read<UINT8>)
+ .addCFunction ("read_i16", &lua_memory_region::l_region_read<INT16>)
+ .addCFunction ("read_u16", &lua_memory_region::l_region_read<UINT16>)
+ .addCFunction ("read_i32", &lua_memory_region::l_region_read<INT32>)
+ .addCFunction ("read_u32", &lua_memory_region::l_region_read<UINT32>)
+ .addCFunction ("read_i64", &lua_memory_region::l_region_read<INT64>)
+ .addCFunction ("read_u64", &lua_memory_region::l_region_read<UINT64>)
+ .addCFunction ("write_i8", &lua_memory_region::l_region_write<INT8>)
+ .addCFunction ("write_u8", &lua_memory_region::l_region_write<UINT8>)
+ .addCFunction ("write_i16", &lua_memory_region::l_region_write<INT16>)
+ .addCFunction ("write_u16", &lua_memory_region::l_region_write<UINT16>)
+ .addCFunction ("write_i32", &lua_memory_region::l_region_write<INT32>)
+ .addCFunction ("write_u32", &lua_memory_region::l_region_write<UINT32>)
+ .addCFunction ("write_i64", &lua_memory_region::l_region_write<INT64>)
+ .addCFunction ("write_u64", &lua_memory_region::l_region_write<UINT64>)
+ .endClass()
+ .deriveClass <memory_region, lua_memory_region> ("region")
+ .addProperty <UINT32> ("size", &memory_region::bytes)
+ .endClass()
+ .beginClass <device_image_interface> ("image")
+ .addFunction ("exists", &device_image_interface::exists)
+ .addFunction ("filename", &device_image_interface::filename)
+ .addFunction ("longname", &device_image_interface::longname)
+ .addFunction ("manufacturer", &device_image_interface::manufacturer)
+ .addFunction ("year", &device_image_interface::year)
+ .addFunction ("software_list_name", &device_image_interface::software_list_name)
+ .addFunction ("image_type_name", &device_image_interface::image_type_name)
+ .addFunction ("load", &device_image_interface::load)
+ .addFunction ("unload", &device_image_interface::unload)
+ .addFunction ("crc", &device_image_interface::crc)
+ .addProperty <const device_t &> ("device", static_cast<const device_t &(device_image_interface::*)() const>(&device_image_interface::device))
+ .addProperty <bool> ("is_readable", &device_image_interface::is_readable)
+ .addProperty <bool> ("is_writeable", &device_image_interface::is_writeable)
+ .addProperty <bool> ("is_creatable", &device_image_interface::is_creatable)
+ .addProperty <bool> ("is_reset_on_load", &device_image_interface::is_reset_on_load)
+ .endClass()
+ .beginClass <lua_emu_file> ("lua_file")
+ .addCFunction ("read", &lua_emu_file::l_emu_file_read)
+ .endClass()
+ .deriveClass <emu_file, lua_emu_file> ("file")
+ .addConstructor <void (*)(const char *, UINT32)> ()
+ .addFunction ("open", static_cast<osd_file::error (emu_file::*)(const char *)>(&emu_file::open))
+ .addFunction ("seek", &emu_file::seek)
+ .addFunction ("size", &emu_file::size)
+ .endClass()
+ .beginClass <lua_item> ("item")
+ .addConstructor <void (*)(int)> ()
+ .addData ("size", &lua_item::l_item_size, false)
+ .addData ("count", &lua_item::l_item_count, false)
+ .addCFunction ("read", &lua_item::l_item_read)
+ .addCFunction ("read_block", &lua_item::l_item_read_block)
+ .addCFunction ("write", &lua_item::l_item_write)
+ .endClass()
.endNamespace();
luabridge::push (m_lua_state, machine_manager::instance());
diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h
index b98b9597b56..aaa774d00e6 100644
--- a/src/emu/luaengine.h
+++ b/src/emu/luaengine.h
@@ -49,9 +49,20 @@ public:
bool frame_hook();
void execute_function(const char *id);
+ struct menu_item {
+ std::string text;
+ std::string subtext;
+ std::string flags;
+ };
+ void menu_populate(std::string &menu, std::vector<menu_item> &menu_list);
+ bool menu_callback(std::string &menu, int index, std::string event);
+
void resume(lua_State *L, int nparam = 0, lua_State *root = nullptr);
void set_machine(running_machine *machine) { m_machine = machine; update_machine(); }
+ std::vector<std::string> &get_menu() { return m_menu; }
void attach_notifiers();
+ void on_frame_done();
+
private:
struct hook {
lua_State *L;
@@ -70,6 +81,8 @@ private:
lua_State *m_lua_state;
running_machine * m_machine;
+ std::vector<std::string> m_menu;
+
hook hook_output_cb;
bool output_notifier_set;
@@ -121,10 +134,13 @@ private:
static int l_emu_register_pause(lua_State *L);
static int l_emu_register_resume(lua_State *L);
static int l_emu_register_frame(lua_State *L);
+ static int l_emu_register_frame_done(lua_State *L);
+ static int l_emu_register_menu(lua_State *L);
static int register_function(lua_State *L, const char *id);
// "emu.machine" namespace
static luabridge::LuaRef l_machine_get_devices(const running_machine *r);
+ static luabridge::LuaRef l_machine_get_images(const running_machine *r);
static luabridge::LuaRef l_ioport_get_ports(const ioport_manager *i);
static luabridge::LuaRef l_render_get_targets(const render_manager *r);
static luabridge::LuaRef l_ioports_port_get_fields(const ioport_port *i);
@@ -137,10 +153,16 @@ private:
int l_popmessage(lua_State *L);
int l_logerror(lua_State *L);
};
+ static UINT8 read_direct_byte(address_space &space, offs_t addr);
+ static void write_direct_byte(address_space &space, offs_t addr, UINT8 byte);
struct lua_addr_space {
template<typename T> int l_mem_read(lua_State *L);
template<typename T> int l_mem_write(lua_State *L);
+ template<typename T> int l_direct_mem_read(lua_State *L);
+ template<typename T> int l_direct_mem_write(lua_State *L);
};
+ static luabridge::LuaRef l_addr_space_map(const address_space *as);
+
static luabridge::LuaRef l_machine_get_screens(const running_machine *r);
struct lua_screen {
int l_height(lua_State *L);
@@ -153,6 +175,7 @@ private:
int l_draw_line(lua_State *L);
int l_draw_text(lua_State *L);
};
+ static luabridge::LuaRef l_dev_get_items(const device_t *d);
struct lua_video {
int l_begin_recording(lua_State *L);
@@ -169,6 +192,29 @@ private:
int l_entry_value(lua_State *L);
};
+ static luabridge::LuaRef l_memory_get_banks(const memory_manager *m);
+ static luabridge::LuaRef l_memory_get_regions(const memory_manager *m);
+ static UINT8 read_region_byte(memory_region &region, offs_t addr);
+ static void write_region_byte(memory_region &region, offs_t addr, UINT8 byte);
+ struct lua_memory_region {
+ template<typename T> int l_region_read(lua_State *L);
+ template<typename T> int l_region_write(lua_State *L);
+ };
+
+ struct lua_emu_file {
+ int l_emu_file_read(lua_State *L);
+ };
+
+ struct lua_item {
+ lua_item(int index);
+ void *l_item_base;
+ unsigned int l_item_size;
+ unsigned int l_item_count;
+ int l_item_read(lua_State *L);
+ int l_item_read_block(lua_State *L);
+ int l_item_write(lua_State *L);
+ };
+
void resume(void *L, INT32 param);
void start();
static int luaopen_ioport(lua_State *L);
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 726979cadbc..7940bd6dfb0 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -1202,6 +1202,24 @@ void running_machine::nvram_save()
}
}
}
+
+
+//**************************************************************************
+// OUTPUT
+//**************************************************************************
+
+void running_machine::popup_clear() const
+{
+ ui().popup_time(0, " ");
+}
+
+void running_machine::popup_message(util::format_argument_pack<std::ostream> const &args) const
+{
+ std::string const temp(string_format(args));
+ ui().popup_time(temp.length() / 40 + 2, "%s", temp);
+}
+
+
//**************************************************************************
// CALLBACK ITEMS
//**************************************************************************
diff --git a/src/emu/machine.h b/src/emu/machine.h
index f892e79c3c9..6f18ef60001 100644
--- a/src/emu/machine.h
+++ b/src/emu/machine.h
@@ -17,6 +17,7 @@
#ifndef __MACHINE_H__
#define __MACHINE_H__
+#include "strformat.h"
#include "vecstream.h"
#include <time.h>
@@ -274,6 +275,8 @@ private:
std::string nvram_filename(device_t &device) const;
void nvram_load();
void nvram_save();
+ void popup_clear() const;
+ void popup_message(util::format_argument_pack<std::ostream> const &args) const;
// internal callbacks
static void logfile_callback(const running_machine &machine, const char *buffer);
@@ -382,4 +385,54 @@ private:
mutable util::ovectorstream m_string_buffer;
};
+
+
+//**************************************************************************
+// MEMBER TEMPLATES
+//**************************************************************************
+
+/*-------------------------------------------------
+ popmessage - pop up a user-visible message
+-------------------------------------------------*/
+
+template <typename Format, typename... Params>
+inline void running_machine::popmessage(Format &&fmt, Params &&... args) const
+{
+ // if the format is NULL, it is a signal to clear the popmessage
+ // otherwise, generate the buffer and call the UI to display the message
+ if (is_null<Format>::value(fmt))
+ popup_clear();
+ else
+ popup_message(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
+}
+
+
+/*-------------------------------------------------
+ logerror - log to the debugger and any other
+ OSD-defined output streams
+-------------------------------------------------*/
+
+template <typename Format, typename... Params>
+inline void running_machine::logerror(Format &&fmt, Params &&... args) const
+{
+ // process only if there is a target
+ if (!m_logerror_list.empty())
+ {
+ g_profiler.start(PROFILER_LOGERROR);
+
+ // dump to the buffer
+ m_string_buffer.clear();
+ m_string_buffer.seekp(0);
+ util::stream_format(m_string_buffer, std::forward<Format>(fmt), std::forward<Params>(args)...);
+ m_string_buffer.put('\0');
+
+ // log to all callbacks
+ char const *const str(&m_string_buffer.vec()[0]);
+ for (auto &cb : m_logerror_list)
+ (cb->m_func)(*this, str);
+
+ g_profiler.stop();
+ }
+}
+
#endif /* __MACHINE_H__ */
diff --git a/src/emu/machine.ipp b/src/emu/machine.ipp
deleted file mode 100644
index 44d029fd309..00000000000
--- a/src/emu/machine.ipp
+++ /dev/null
@@ -1,77 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/***************************************************************************
-
- machine.ipp
-
- Controls execution of the core MAME system.
-
-***************************************************************************/
-
-#pragma once
-
-#ifndef __EMU_H__
-#error Dont include this file directly; include emu.h instead.
-#endif
-
-#ifndef __MACHINE_IPP__
-#define __MACHINE_IPP__
-
-#include "strformat.h"
-
-//**************************************************************************
-// MEMBER TEMPLATES
-//**************************************************************************
-
-/*-------------------------------------------------
- popmessage - pop up a user-visible message
--------------------------------------------------*/
-
-template <typename Format, typename... Params>
-inline void running_machine::popmessage(Format &&fmt, Params &&... args) const
-{
- if (is_null<Format>::value(fmt))
- {
- // if the format is NULL, it is a signal to clear the popmessage
- ui().popup_time(0, " ");
- }
- else
- {
- // otherwise, generate the buffer and call the UI to display the message
- std::string const temp(string_format(std::forward<Format>(fmt), std::forward<Params>(args)...));
-
- // pop it in the UI
- ui().popup_time(temp.length() / 40 + 2, "%s", temp.c_str());
- }
-}
-
-
-/*-------------------------------------------------
- logerror - log to the debugger and any other
- OSD-defined output streams
--------------------------------------------------*/
-
-template <typename Format, typename... Params>
-inline void running_machine::logerror(Format &&fmt, Params &&... args) const
-{
- // process only if there is a target
- if (!m_logerror_list.empty())
- {
- g_profiler.start(PROFILER_LOGERROR);
-
- // dump to the buffer
- m_string_buffer.clear();
- m_string_buffer.seekp(0);
- util::stream_format(m_string_buffer, std::forward<Format>(fmt), std::forward<Params>(args)...);
- m_string_buffer.put('\0');
-
- // log to all callbacks
- char const *const str(&m_string_buffer.vec()[0]);
- for (auto &cb : m_logerror_list)
- (cb->m_func)(*this, str);
-
- g_profiler.stop();
- }
-}
-
-#endif // __MACHINE_IPP__
diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp
index 793da15c1a0..2bf2eaab3d6 100644
--- a/src/emu/mconfig.cpp
+++ b/src/emu/mconfig.cpp
@@ -25,7 +25,6 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
: m_minimum_quantum(attotime::zero),
m_watchdog_vblank_count(0),
m_watchdog_time(attotime::zero),
- m_force_no_drc(false),
m_default_layout(nullptr),
m_gamedrv(gamedrv),
m_options(options)
diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h
index 412c2c12e82..582ea14d035 100644
--- a/src/emu/mconfig.h
+++ b/src/emu/mconfig.h
@@ -18,8 +18,6 @@
#ifndef __MCONFIG_H__
#define __MCONFIG_H__
-#include "emuopts.h"
-
//**************************************************************************
// CONSTANTS
//**************************************************************************
@@ -72,7 +70,6 @@ public:
std::string m_perfect_cpu_quantum; // tag of CPU to use for "perfect" scheduling
INT32 m_watchdog_vblank_count; // number of VBLANKs until the watchdog kills us
attotime m_watchdog_time; // length of time until the watchdog kills us
- bool m_force_no_drc; // whether or not to force DRC off
// other parameters
const internal_layout * m_default_layout; // default layout for this machine
@@ -202,10 +199,6 @@ References an external machine config.
#define MCFG_QUANTUM_PERFECT_CPU(_cputag) \
config.m_perfect_cpu_quantum = owner->subtag(_cputag);
-// recompilation parameters
-#define MCFG_FORCE_NO_DRC() \
- config.m_force_no_drc = true;
-
// watchdog configuration
#define MCFG_WATCHDOG_VBLANK_INIT(_count) \
config.m_watchdog_vblank_count = _count;
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index a340e226c50..0af06e665b2 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -934,6 +934,7 @@ render_target::render_target(render_manager &manager, const internal_layout *lay
// aspect and scale options
m_keepaspect = (manager.machine().options().keep_aspect() && !(flags & RENDER_CREATE_HIDDEN));
+ m_int_overscan = manager.machine().options().int_overscan();
m_int_scale_x = manager.machine().options().int_scale_x();
m_int_scale_y = manager.machine().options().int_scale_y();
if (manager.machine().options().uneven_stretch() && !manager.machine().options().uneven_stretch_x())
@@ -1204,22 +1205,24 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
if (target_orientation & ORIENTATION_SWAP_XY)
src_aspect = 1.0 / src_aspect;
- // get destination size and aspect
- float dest_width = (float)target_width;
- float dest_height = (float)target_height;
- float dest_aspect = dest_width / dest_height * target_pixel_aspect;
+ // get target aspect
+ float target_aspect = (float)target_width / (float)target_height * target_pixel_aspect;
- // apply aspect correction to destination rectangle
- if (dest_aspect > src_aspect)
- dest_width *= m_keepaspect? src_aspect / dest_aspect : 1.0f;
- else
- dest_height *= m_keepaspect? dest_aspect / src_aspect : 1.0f;
+ // determine the scale mode for each axis
+ bool x_is_integer = !(target_aspect >= 1.0f && m_scale_mode == SCALE_FRACTIONAL_X);
+ bool y_is_integer = !(target_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_X);
+
+ // first compute scale factors to fit the screen
+ float xscale = (float)target_width / src_width;
+ float yscale = (float)target_height / src_height;
+ float maxxscale = MAX(1, m_int_overscan? render_round_nearest(xscale) : floor(xscale));
+ float maxyscale = MAX(1, m_int_overscan? render_round_nearest(yscale) : floor(yscale));
- // compute scale factors
- float xscale = dest_width / src_width;
- float yscale = dest_height / src_height;
- xscale = dest_aspect >= 1.0f && m_scale_mode == SCALE_FRACTIONAL_X? xscale : MAX(1, render_round_nearest(xscale));
- yscale = dest_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_X? yscale : MAX(1, render_round_nearest(yscale));
+ // now apply desired scale mode and aspect correction
+ if (m_keepaspect && target_aspect > src_aspect) xscale *= src_aspect / target_aspect * (maxyscale / yscale);
+ if (m_keepaspect && target_aspect < src_aspect) yscale *= target_aspect / src_aspect * (maxxscale / xscale);
+ if (x_is_integer) xscale = MIN(maxxscale, MAX(1, render_round_nearest(xscale)));
+ if (y_is_integer) yscale = MIN(maxyscale, MAX(1, render_round_nearest(yscale)));
// check if we have user defined scale factors, if so use them instead
xscale = m_int_scale_x? m_int_scale_x : xscale;
diff --git a/src/emu/render.h b/src/emu/render.h
index 623e65a56f6..6092a37b45a 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -51,6 +51,9 @@
#include <math.h>
#include <mutex>
+#include "emu.h"
+//#include "bitmap.h"
+//#include "screen.h"
//**************************************************************************
// CONSTANTS
@@ -920,6 +923,8 @@ public:
void set_view(int viewindex);
void set_max_texture_size(int maxwidth, int maxheight);
void set_transform_primitives(bool transform_primitives) { m_transform_primitives = transform_primitives; }
+ void set_keepaspect(bool keepaspect) { m_keepaspect = keepaspect; }
+ void set_scale_mode(bool scale_mode) { m_scale_mode = scale_mode; }
// layer config getters
bool backdrops_enabled() const { return m_layerconfig.backdrops_enabled(); }
@@ -1008,6 +1013,7 @@ private:
INT32 m_height; // height in pixels
render_bounds m_bounds; // bounds of the target
bool m_keepaspect; // constrain aspect ratio
+ bool m_int_overscan; // allow overscan on integer scaled targets
float m_pixel_aspect; // aspect ratio of individual pixels
int m_scale_mode; // type of scale to apply
int m_int_scale_x; // horizontal integer scale factor
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index 5995c16eed2..fee6cbdaaa2 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -82,6 +82,8 @@
#include "lcd.lh"
#include "lcd_rot.lh"
+// SVG screen layouts
+#include "svg.lh"
//**************************************************************************
diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h
index ab9390de564..1267be32773 100644
--- a/src/emu/rendlay.h
+++ b/src/emu/rendlay.h
@@ -37,5 +37,8 @@ extern const internal_layout layout_quadhsxs; // quad 4:3 screens side-by-sid
extern const internal_layout layout_lcd; // generic 1:1 lcd screen layout
extern const internal_layout layout_lcd_rot; // same, for use with ROT90 or ROT270
+// SVG screen layouts
+extern const internal_layout layout_svg; // generic 1:1 lcd screen layout
+
#endif // __RENDLAY_H__
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 952c84ca30a..9a22d215a0f 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -13,6 +13,8 @@
#include "png.h"
#include "rendutil.h"
+#include <nanosvg/src/nanosvg.h>
+#include <nanosvg/src/nanosvgrast.h>
//**************************************************************************
@@ -35,6 +37,101 @@ const attotime screen_device::DEFAULT_FRAME_PERIOD(attotime::from_hz(DEFAULT_FRA
UINT32 screen_device::m_id_counter = 0;
+class screen_device_svg_renderer {
+public:
+ screen_device_svg_renderer(memory_region *region);
+ ~screen_device_svg_renderer();
+
+ int width() const;
+ int height() const;
+
+ int render(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
+ static void output_notifier(const char *outname, INT32 value, void *param);
+
+private:
+ NSVGimage *m_image;
+ NSVGrasterizer *m_rasterizer;
+
+ std::unordered_map<std::string, std::list<NSVGshape *>> m_keyed_shapes;
+
+ void output_change(const char *outname, INT32 value);
+};
+
+screen_device_svg_renderer::screen_device_svg_renderer(memory_region *region)
+{
+ char *s = new char[region->bytes()+1];
+ memcpy(s, region->base(), region->bytes());
+ s[region->bytes()] = 0;
+ m_image = nsvgParse(s, "px", 72);
+ delete[] s;
+ m_rasterizer = nsvgCreateRasterizer();
+
+ for (NSVGshape *shape = m_image->shapes; shape != NULL; shape = shape->next)
+ if(shape->title[0]) {
+ shape->flags &= ~NSVG_FLAGS_VISIBLE;
+ m_keyed_shapes[shape->title].push_back(shape);
+ }
+}
+
+screen_device_svg_renderer::~screen_device_svg_renderer()
+{
+ nsvgDeleteRasterizer(m_rasterizer);
+ nsvgDelete(m_image);
+}
+
+int screen_device_svg_renderer::width() const
+{
+ return int(m_image->width + 0.5);
+}
+
+int screen_device_svg_renderer::height() const
+{
+ return int(m_image->height + 0.5);
+}
+
+int screen_device_svg_renderer::render(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ double sx = double(bitmap.width())/m_image->width;
+ double sy = double(bitmap.height())/m_image->height;
+ double sz = sx > sy ? sy : sx;
+ nsvgRasterize(m_rasterizer, m_image, 0, 0, sz, (unsigned char *)bitmap.raw_pixptr(0, 0), bitmap.width(), bitmap.height(), bitmap.rowbytes());
+
+ // Annoyingly, nanosvg doesn't use the same byte order than our bitmaps
+
+ for(unsigned int y=0; y<bitmap.height(); y++) {
+ UINT8 *image = (UINT8 *)bitmap.raw_pixptr(y, 0);
+ for(unsigned int x=0; x<bitmap.width(); x++) {
+ UINT8 r = image[0];
+ UINT8 g = image[1];
+ UINT8 b = image[2];
+ UINT32 color = 0xff000000 | (r << 16) | (g << 8) | (b << 0);
+ *(UINT32 *)image = color;
+ image += 4;
+ }
+ }
+
+ return 0;
+}
+
+void screen_device_svg_renderer::output_notifier(const char *outname, INT32 value, void *param)
+{
+ static_cast<screen_device_svg_renderer *>(param)->output_change(outname, value);
+}
+
+void screen_device_svg_renderer::output_change(const char *outname, INT32 value)
+{
+ auto l = m_keyed_shapes.find(outname);
+ if (l == m_keyed_shapes.end())
+ return;
+ if (value)
+ for(auto s : l->second)
+ s->flags |= NSVG_FLAGS_VISIBLE;
+ else
+ for(auto s : l->second)
+ s->flags &= ~NSVG_FLAGS_VISIBLE;
+}
+
//**************************************************************************
// SCREEN DEVICE
//**************************************************************************
@@ -55,6 +152,7 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev
m_yscale(1.0f),
m_palette(*this),
m_video_attributes(0),
+ m_svg_region(nullptr),
m_container(nullptr),
m_width(100),
m_height(100),
@@ -106,6 +204,12 @@ void screen_device::static_set_type(device_t &device, screen_type_enum type)
}
+void screen_device::static_set_svg_region(device_t &device, const char *region)
+{
+ downcast<screen_device &>(device).m_svg_region = region;
+}
+
+
//-------------------------------------------------
// static_set_raw - configuration helper
// to set the raw screen parameters
@@ -265,7 +369,7 @@ void screen_device::device_validity_check(validity_checker &valid) const
osd_printf_error("Invalid display dimensions\n");
// sanity check display area
- if (m_type != SCREEN_TYPE_VECTOR)
+ if (m_type != SCREEN_TYPE_VECTOR && m_type != SCREEN_TYPE_SVG)
{
if (m_visarea.empty() || m_visarea.max_x >= m_width || m_visarea.max_y >= m_height)
osd_printf_error("Invalid display area\n");
@@ -275,6 +379,10 @@ void screen_device::device_validity_check(validity_checker &valid) const
osd_printf_error("Missing SCREEN_UPDATE function\n");
}
+ // check for svg region
+ if (m_type == SCREEN_TYPE_SVG && !m_svg_region)
+ osd_printf_error("Missing SVG region information\n");
+
// check for zero frame rate
if (m_refresh == 0)
osd_printf_error("Invalid (zero) refresh rate\n");
@@ -293,6 +401,23 @@ void screen_device::device_validity_check(validity_checker &valid) const
void screen_device::device_start()
{
+ if (m_type == SCREEN_TYPE_SVG)
+ {
+ memory_region *reg = owner()->memregion(m_svg_region);
+ if (!reg)
+ fatalerror("SVG region \"%s\" does not exist\n", m_svg_region);
+ m_svg = std::make_unique<screen_device_svg_renderer>(reg);
+ machine().output().set_notifier(nullptr, screen_device_svg_renderer::output_notifier, m_svg.get());
+
+ if (0)
+ {
+ // The osd picks up the size before start is called, so that's useless
+ m_width = m_svg->width();
+ m_height = m_svg->height();
+ m_visarea.set(0, m_width-1, 0, m_height-1);
+ }
+ }
+
// bind our handlers
m_screen_update_ind16.bind_relative_to(*owner());
m_screen_update_rgb32.bind_relative_to(*owner());
@@ -303,6 +428,7 @@ void screen_device::device_start()
throw device_missing_dependencies();
// configure bitmap formats and allocate screen bitmaps
+ // svg is RGB32 too, and doesn't have any update method
texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32;
for (auto & elem : m_bitmap)
@@ -472,8 +598,8 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
assert(visarea.min_y >= 0);
// assert(visarea.max_x < width);
// assert(visarea.max_y < height);
- assert(m_type == SCREEN_TYPE_VECTOR || visarea.min_x < width);
- assert(m_type == SCREEN_TYPE_VECTOR || visarea.min_y < height);
+ assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_x < width);
+ assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_y < height);
assert(frame_period > 0);
// fill in the new parameters
@@ -649,12 +775,19 @@ bool screen_device::update_partial(int scanline)
g_profiler.start(PROFILER_VIDEO);
UINT32 flags;
- screen_bitmap &curbitmap = m_bitmap[m_curbitmap];
- switch (curbitmap.format())
+ if (m_type != SCREEN_TYPE_SVG)
{
- default:
- case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, curbitmap.as_ind16(), clip); break;
- case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, curbitmap.as_rgb32(), clip); break;
+ screen_bitmap &curbitmap = m_bitmap[m_curbitmap];
+ switch (curbitmap.format())
+ {
+ default:
+ case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, curbitmap.as_ind16(), clip); break;
+ case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, curbitmap.as_rgb32(), clip); break;
+ }
+ }
+ else
+ {
+ flags = m_svg->render(*this, m_bitmap[m_curbitmap].as_rgb32(), clip);
}
m_partial_updates_this_frame++;
diff --git a/src/emu/screen.h b/src/emu/screen.h
index 711602b0395..182a1505b16 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -30,7 +30,8 @@ enum screen_type_enum
SCREEN_TYPE_INVALID = 0,
SCREEN_TYPE_RASTER,
SCREEN_TYPE_VECTOR,
- SCREEN_TYPE_LCD
+ SCREEN_TYPE_LCD,
+ SCREEN_TYPE_SVG
};
// texture formats
@@ -155,6 +156,8 @@ typedef device_delegate<void (screen_device &, bool)> screen_vblank_delegate;
// ======================> screen_device
+class screen_device_svg_renderer;
+
class screen_device : public device_t
{
friend class render_manager;
@@ -194,6 +197,7 @@ public:
static void static_set_palette(device_t &device, const char *tag);
static void static_set_video_attributes(device_t &device, UINT32 flags);
static void static_set_color(device_t &device, rgb_t color);
+ static void static_set_svg_region(device_t &device, const char *region);
// information getters
render_container &container() const { assert(m_container != nullptr); return *m_container; }
@@ -279,10 +283,11 @@ private:
screen_vblank_delegate m_screen_vblank; // screen vblank callback
optional_device<palette_device> m_palette; // our palette
UINT32 m_video_attributes; // flags describing the video system
+ const char * m_svg_region; // the region in which the svg data is in
// internal state
render_container * m_container; // pointer to our container
-
+ std::unique_ptr<screen_device_svg_renderer> m_svg; // the svg renderer
// dimensions
int m_width; // current width (HTOTAL)
int m_height; // current height (VTOTAL)
@@ -378,6 +383,11 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
#define MCFG_SCREEN_TYPE(_type) \
screen_device::static_set_type(*device, SCREEN_TYPE_##_type);
+#define MCFG_SCREEN_SVG_ADD(_tag, _region) \
+ MCFG_DEVICE_ADD(_tag, SCREEN, 0) \
+ MCFG_SCREEN_TYPE(SVG) \
+ screen_device::static_set_svg_region(*device, _region);
+
/*!
@brief Configures screen parameters for the given screen.
diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp
deleted file mode 100644
index 0fc7304a550..00000000000
--- a/src/emu/ui/ctrlmenu.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Maurizio Petrarota
-/*********************************************************************
-
- ui/ctrlmenu.cpp
-
- Internal UI user interface.
-
-*********************************************************************/
-
-#include "emu.h"
-#include "ui/ui.h"
-#include "ui/menu.h"
-#include "ui/ctrlmenu.h"
-
-const char *ui_menu_controller_mapping::m_device_status[] = { "none", "keyboard", "mouse", "lightgun", "joystick" };
-
-ui_menu_controller_mapping::ctrl_option ui_menu_controller_mapping::m_options[] = {
- { 0, nullptr, nullptr },
- { 0, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
- { 0, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
- { 0, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
- { 0, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
- { 0, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
- { 0, __("Dial Device Assignment"), OPTION_DIAL_DEVICE },
- { 0, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },
- { 0, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
-};
-
-//-------------------------------------------------
-// ctor
-//-------------------------------------------------
-
-ui_menu_controller_mapping::ui_menu_controller_mapping(running_machine &machine, render_container *container) : ui_menu(machine, container)
-{
- for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
- m_options[d].status = check_status(machine.options().value(m_options[d].option), m_options[d].option);
-}
-
-//-------------------------------------------------
-// dtor
-//-------------------------------------------------
-
-ui_menu_controller_mapping::~ui_menu_controller_mapping()
-{
- std::string error_string;
- for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
- {
- if (strcmp(machine().options().value(m_options[d].option), m_device_status[m_options[d].status])!=0)
- {
- machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string);
- machine().options().mark_changed(m_options[d].option);
- }
- }
-}
-
-//-------------------------------------------------
-// handle
-//-------------------------------------------------
-
-void ui_menu_controller_mapping::handle()
-{
- bool changed = false;
-
- // process the menu
- const ui_menu_event *m_event = process(0);
- if (m_event != nullptr && m_event->itemref != nullptr)
- {
- if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
- {
- changed = true;
- FPTR value = (FPTR)m_event->itemref;
- (m_event->iptkey == IPT_UI_RIGHT) ? m_options[value].status++ : m_options[value].status--;
- }
- }
-
- if (changed)
- reset(UI_MENU_RESET_REMEMBER_REF);
-}
-
-//-------------------------------------------------
-// populate
-//-------------------------------------------------
-
-void ui_menu_controller_mapping::populate()
-{
- // add options
- for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
- {
- UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status);
- item_append(_(m_options[d].description), m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d);
- }
- item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
- customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
-}
-
-//-------------------------------------------------
-// perform our special rendering
-//-------------------------------------------------
-
-void ui_menu_controller_mapping::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
-{
- float width, maxwidth = origx2 - origx1;
- ui_manager &mui = machine().ui();
-
- mui.draw_text_full(container, _("Device Mapping"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
- width += 2 * UI_BOX_LR_BORDER;
- maxwidth = MAX(maxwidth, width);
-
- // compute our bounds
- float x1 = 0.5f - 0.5f * maxwidth;
- float x2 = x1 + maxwidth;
- float y1 = origy1 - top;
- float y2 = origy1 - UI_BOX_TB_BORDER;
-
- // draw a box
- mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
-
- // take off the borders
- x1 += UI_BOX_LR_BORDER;
- x2 -= UI_BOX_LR_BORDER;
- y1 += UI_BOX_TB_BORDER;
-
- // draw the text within it
- mui.draw_text_full(container, _("Device Mapping"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
-
-}
-
-//-------------------------------------------------
-// return current value
-//-------------------------------------------------
-
-int ui_menu_controller_mapping::check_status(const char *status, const char *option)
-{
- for (int d = 0; *m_device_status[d]; d++)
- if (!strcmp(m_device_status[d], status))
- return d;
-
- emu_options def_opt;
- const char *def_val = def_opt.value(option);
-
- for (int d = 0; *m_device_status[d]; d++)
- if (!strcmp(m_device_status[d], def_val))
- return d;
-
- return 1;
-}
diff --git a/src/emu/ui/ctrlmenu.h b/src/emu/ui/ctrlmenu.h
deleted file mode 100644
index 0db85ee878a..00000000000
--- a/src/emu/ui/ctrlmenu.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Maurizio Petrarota
-/***************************************************************************
-
- ui/ctrlmenu.h
-
- Internal UI user interface.
-
-***************************************************************************/
-#pragma once
-
-#ifndef __UI_CTRLMENU_H__
-#define __UI_CTRLMENU_H__
-
-//-------------------------------------------------
-// class controller mapping menu
-//-------------------------------------------------
-
-class ui_menu_controller_mapping : public ui_menu
-{
-public:
- ui_menu_controller_mapping(running_machine &machine, render_container *container);
- virtual ~ui_menu_controller_mapping();
- virtual void populate() override;
- virtual void handle() override;
- virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
-
-private:
- struct ctrl_option
- {
- int status;
- const char *description;
- const char *option;
- };
-
- static const char *m_device_status[];
- static ctrl_option m_options[];
- int check_status(const char *status, const char *option);
-};
-
-#endif /* __UI_CTRLMENU_H__ */
diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp
deleted file mode 100644
index e47164de356..00000000000
--- a/src/emu/ui/dsplmenu.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Maurizio Petrarota
-/*********************************************************************
-
- ui/dsplmenu.cpp
-
- UI video options menu.
-
-*********************************************************************/
-
-#include "emu.h"
-#include "ui/ui.h"
-#include "ui/menu.h"
-#include "ui/dsplmenu.h"
-#include "ui/selector.h"
-#include "ui/utils.h"
-
-#if defined(UI_WINDOWS) && !defined(UI_SDL)
-#include "../osd/windows/winmain.h"
-#else
-#include "../osd/modules/lib/osdobj_common.h"
-#endif
-
-
-ui_menu_display_options::video_modes ui_menu_display_options::m_video = {
- { "auto", "Auto" },
- { "opengl", "OpenGL" },
- { "bgfx", "BGFX" },
- { "d3d", "Direct3D" },
- { "gdi", "GDI" },
- { "ddraw", "DirectDraw" },
- { "soft", "Software" },
- { "accel", "SDL2 Accelerated" }
-};
-
-ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
- { 0, nullptr, nullptr },
- { 0, __("Video Mode"), OSDOPTION_VIDEO },
-#if defined(UI_WINDOWS) && !defined(UI_SDL)
- { 0, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
- { 0, __("HLSL"), WINOPTION_HLSL_ENABLE },
-#endif
- { 0, __("GLSL"), OSDOPTION_GL_GLSL },
- { 0, __("Bilinear Filtering"), OSDOPTION_FILTER },
- { 0, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
- { 0, __("Window Mode"), OSDOPTION_WINDOW },
- { 0, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
- { 0, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
- { 0, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
- { 0, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
-};
-
-
-//-------------------------------------------------
-// ctor
-//-------------------------------------------------
-
-ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
-{
- osd_options &options = downcast<osd_options &>(machine.options());
-
- for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
- m_options[d].status = options.int_value(m_options[d].option);
-
- // create video list
- m_list.push_back("auto");
- m_list.push_back("opengl"); // TODO: check USE_OPENGL
-
- std::string descr = options.description(OSDOPTION_VIDEO);
- descr.erase(0, descr.find(":") + 2);
- std::string delim = ", ";
- size_t p1, p2 = 0;
- for (;;)
- {
- p1 = descr.find_first_not_of(delim, p2);
- if (p1 == std::string::npos)
- break;
- p2 = descr.find_first_of(delim, p1 + 1);
- if (p2 != std::string::npos)
- {
- std::string txt(descr.substr(p1, p2 - p1));
- if (txt != "or" && txt != "none")
- m_list.push_back(descr.substr(p1, p2 - p1));
- }
- else
- {
- m_list.push_back(descr.substr(p1));
- break;
- }
- }
-
- m_options[1].status = 0;
- for (int cur = 0; cur < m_list.size(); ++cur)
- if (options.video() == m_list[cur])
- {
- m_options[1].status = cur;
- break;
- }
-}
-
-//-------------------------------------------------
-// dtor
-//-------------------------------------------------
-
-ui_menu_display_options::~ui_menu_display_options()
-{
- std::string error_string;
- for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
- {
- if (machine().options().int_value(m_options[d].option) != m_options[d].status)
- {
- machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
- machine().options().mark_changed(m_options[d].option);
- }
- }
- if (machine().options().value(m_options[1].option) != m_list[m_options[1].status])
- {
- machine().options().set_value(m_options[1].option, m_list[m_options[1].status].c_str(), OPTION_PRIORITY_CMDLINE, error_string);
- machine().options().mark_changed(m_options[1].option);
-
- }
- ui_globals::reset = true;
-}
-
-
-//-------------------------------------------------
-// handle
-//-------------------------------------------------
-
-void ui_menu_display_options::handle()
-{
- bool changed = false;
-
- // process the menu
- const ui_menu_event *m_event = process(0);
-
- if (m_event != nullptr && m_event->itemref != nullptr)
- {
- int value = (FPTR)m_event->itemref;
- if (!strcmp(m_options[value].option, OSDOPTION_VIDEO) || !strcmp(m_options[value].option, OSDOPTION_PRESCALE))
- {
- if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
- {
- changed = true;
- (m_event->iptkey == IPT_UI_LEFT) ? m_options[value].status-- : m_options[value].status++;
- }
- else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO))
- {
- int total = m_list.size();
- std::vector<std::string> s_sel(total);
- for (int index = 0; index < total; ++index)
- s_sel[index] = m_video[m_list[index]];
-
- ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_options[value].status));
- }
- }
- else if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
- {
- changed = true;
- m_options[value].status = !m_options[value].status;
- }
- }
-
- if (changed)
- reset(UI_MENU_RESET_REMEMBER_REF);
-}
-
-//-------------------------------------------------
-// populate
-//-------------------------------------------------
-
-void ui_menu_display_options::populate()
-{
- // add video mode option
- std::string v_text(m_video[m_list[m_options[1].status]]);
- UINT32 arrow_flags = get_arrow_flags(0, m_list.size() - 1, m_options[1].status);
- item_append(_(m_options[1].description), v_text.c_str(), arrow_flags, (void *)(FPTR)1);
-
- // add options items
- for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt)
- if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0)
- item_append(_(m_options[opt].description), m_options[opt].status ? _("On") : _("Off"),
- m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt);
- else
- {
- arrow_flags = get_arrow_flags(1, 3, m_options[opt].status);
- item_append(_(m_options[opt].description), string_format("%d", m_options[opt].status).c_str(), arrow_flags, (void *)(FPTR)opt);
- }
-
- item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
- customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
-}
-
-//-------------------------------------------------
-// perform our special rendering
-//-------------------------------------------------
-
-void ui_menu_display_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
-{
- float width;
- ui_manager &mui = machine().ui();
- mui.draw_text_full(container, _("Display Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE,
- ARGB_WHITE, ARGB_BLACK, &width, nullptr);
- width += 2 * UI_BOX_LR_BORDER;
- float maxwidth = MAX(origx2 - origx1, width);
-
- // compute our bounds
- float x1 = 0.5f - 0.5f * maxwidth;
- float x2 = x1 + maxwidth;
- float y1 = origy1 - top;
- float y2 = origy1 - UI_BOX_TB_BORDER;
-
- // draw a box
- mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
-
- // take off the borders
- x1 += UI_BOX_LR_BORDER;
- x2 -= UI_BOX_LR_BORDER;
- y1 += UI_BOX_TB_BORDER;
-
- // draw the text within it
- mui.draw_text_full(container, _("Display Options"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL,
- UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
-}
diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h
deleted file mode 100644
index 69b92e3bbe0..00000000000
--- a/src/emu/ui/dsplmenu.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Maurizio Petrarota
-/***************************************************************************
-
- ui/dsplmenu.h
-
- UI video options menu.
-
-***************************************************************************/
-
-#pragma once
-
-#ifndef __UI_DSPLMENU_H__
-#define __UI_DSPLMENU_H__
-
-//-------------------------------------------------
-// class display options menu
-//-------------------------------------------------
-class ui_menu_display_options : public ui_menu
-{
-public:
- ui_menu_display_options(running_machine &machine, render_container *container);
- virtual ~ui_menu_display_options();
- virtual void populate() override;
- virtual void handle() override;
- virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
-
-private:
- struct dspl_option
- {
- UINT16 status;
- const char *description;
- const char *option;
- };
-
- using video_modes = std::unordered_map<std::string, std::string>;
-
- static video_modes m_video;
- static dspl_option m_options[];
-
- std::vector<std::string> m_list;
-};
-
-#endif /* __UI_DSPLMENU_H__ */
diff --git a/src/emu/ui/filemngr.cpp b/src/emu/ui/filemngr.cpp
index fa139e1c696..6c2cd3894bd 100644
--- a/src/emu/ui/filemngr.cpp
+++ b/src/emu/ui/filemngr.cpp
@@ -129,6 +129,9 @@ void ui_menu_file_manager::populate()
image_interface_iterator subiterator(*dev);
for (device_image_interface *scan = subiterator.first(); scan != nullptr; scan = subiterator.next())
{
+ if (!scan->user_loadable())
+ continue;
+
// if it is a children device, and not something further down the device tree, we want it in the menu!
if (strcmp(scan->device().owner()->tag(), dev->tag()) == 0)
if (devtags.insert(scan->device().tag()).second)
diff --git a/src/emu/ui/imgcntrl.cpp b/src/emu/ui/imgcntrl.cpp
index 0b44f1f8e8c..883541786af 100644
--- a/src/emu/ui/imgcntrl.cpp
+++ b/src/emu/ui/imgcntrl.cpp
@@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
+#include "emuopts.h"
#include "ui/ui.h"
#include "ui/menu.h"
#include "ui/imgcntrl.h"
diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp
index 7fe16d771b0..b2935049b9a 100644
--- a/src/emu/ui/mainmenu.cpp
+++ b/src/emu/ui/mainmenu.cpp
@@ -33,6 +33,7 @@
#include "ui/datfile.h"
#include "ui/inifile.h"
#include "ui/datmenu.h"
+#include "ui/pluginopt.h"
/***************************************************************************
@@ -71,47 +72,46 @@ void ui_menu_main::populate()
item_append(_("Machine Information"), nullptr, 0, (void *)GAME_INFO);
image_interface_iterator imgiter(machine().root_device());
- if (imgiter.first() != nullptr)
- {
- /* add image info menu */
- item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
-
- /* add file manager menu */
- item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
-
- /* add tape control menu */
- cassette_device_iterator cassiter(machine().root_device());
- if (cassiter.first() != nullptr)
- item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
- }
-
- pty_interface_iterator ptyiter(machine().root_device());
- if (ptyiter.first() != nullptr) {
- item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
- }
- if (machine().ioport().has_bioses())
+ for (device_image_interface *image = imgiter.first(); image != nullptr; image = imgiter.next())
+ {
+ if (image->user_loadable())
+ {
+ /* add image info menu */
+ item_append(_("Image Information"), nullptr, 0, (void *)IMAGE_MENU_IMAGE_INFO);
+
+ /* add file manager menu */
+ item_append(_("File Manager"), nullptr, 0, (void *)IMAGE_MENU_FILE_MANAGER);
+
+ break;
+ }
+ }
+
+ /* add tape control menu */
+ cassette_device_iterator cassiter(machine().root_device());
+ if (cassiter.first() != nullptr)
+ item_append(_("Tape Control"), nullptr, 0, (void *)TAPE_CONTROL);
+
+ pty_interface_iterator ptyiter(machine().root_device());
+ if (ptyiter.first() != nullptr)
+ item_append(_("Pseudo terminals"), nullptr, 0, (void *)PTY_INFO);
+
+ if (machine().ioport().has_bioses())
item_append(_("Bios Selection"), nullptr, 0, (void *)BIOS_SELECTION);
+ /* add slot info menu */
slot_interface_iterator slotiter(machine().root_device());
if (slotiter.first() != nullptr)
- {
- /* add slot info menu */
item_append(_("Slot Devices"), nullptr, 0, (void *)SLOT_DEVICES);
- }
+ /* add Barcode reader menu */
barcode_reader_device_iterator bcriter(machine().root_device());
if (bcriter.first() != nullptr)
- {
- /* add slot info menu */
item_append(_("Barcode Reader"), nullptr, 0, (void *)BARCODE_READ);
- }
+ /* add network info menu */
network_interface_iterator netiter(machine().root_device());
if (netiter.first() != nullptr)
- {
- /* add image info menu */
item_append(_("Network Devices"), nullptr, 0, (void*)NETWORK_DEVICES);
- }
/* add keyboard mode menu */
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
@@ -131,6 +131,9 @@ void ui_menu_main::populate()
if (machine().options().cheat())
item_append(_("Cheat"), nullptr, 0, (void *)CHEAT);
+ if (machine().options().plugins())
+ item_append(_("Plugin Options"), nullptr, 0, (void *)PLUGINS);
+
// add dats menu
if (machine().ui().options().enabled_dats() && machine().datfile().has_data())
item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS);
@@ -241,6 +244,10 @@ void ui_menu_main::handle()
ui_menu::stack_push(global_alloc_clear<ui_menu_cheat>(machine(), container));
break;
+ case PLUGINS:
+ ui_menu::stack_push(global_alloc_clear<ui_menu_plugin>(machine(), container));
+ break;
+
case SELECT_GAME:
if (strcmp(machine().options().ui(),"simple")==0) {
ui_menu::stack_push(global_alloc_clear<ui_simple_menu_select_game>(machine(), container, nullptr));
diff --git a/src/emu/ui/mainmenu.h b/src/emu/ui/mainmenu.h
index 0684e230ad8..cb12e6e1d1a 100644
--- a/src/emu/ui/mainmenu.h
+++ b/src/emu/ui/mainmenu.h
@@ -42,6 +42,7 @@ private:
VIDEO_OPTIONS,
CROSSHAIR,
CHEAT,
+ PLUGINS,
SELECT_GAME,
BIOS_SELECTION,
BARCODE_READ,
diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp
index 2af806fa586..1d8ae588c0f 100644
--- a/src/emu/ui/menu.cpp
+++ b/src/emu/ui/menu.cpp
@@ -296,7 +296,17 @@ void ui_menu::set_special_main_menu(bool special)
// end of the menu
//-------------------------------------------------
-void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref)
+void ui_menu::item_append(ui_menu_item item)
+{
+ item_append(item.text, item.subtext, item.flags, item.ref, item.type);
+}
+
+//-------------------------------------------------
+// item_append - append a new item to the
+// end of the menu
+//-------------------------------------------------
+
+void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref, ui_menu_item_type type)
{
// only allow multiline as the first item
if ((flags & MENU_FLAG_MULTILINE) != 0)
@@ -312,6 +322,7 @@ void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, v
pitem.subtext = (subtext != nullptr) ? pool_strdup(subtext) : nullptr;
pitem.flags = flags;
pitem.ref = ref;
+ pitem.type = type;
// append to array
int index = item.size();
@@ -380,6 +391,7 @@ const ui_menu_event *ui_menu::process(UINT32 flags)
if (menu_event.iptkey != IPT_INVALID && selected >= 0 && selected < item.size())
{
menu_event.itemref = item[selected].ref;
+ menu_event.type = item[selected].type;
return &menu_event;
}
return nullptr;
@@ -527,6 +539,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height;
visible_lines = floor(visible_main_menu_height / line_height);
+ if (visible_lines > item.size()) visible_lines = item.size();
visible_main_menu_height = (float)visible_lines * line_height;
// compute top/left of inner menu area by centering
@@ -544,14 +557,26 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
if (!customonly)
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
- // determine the first visible line based on the current selection
- if (selected > top_line + visible_lines || selected < top_line - visible_lines)
- top_line = selected - (visible_lines / 2);
if (top_line < 0 || selected == 0)
top_line = 0;
- if (top_line + visible_lines >= item.size())
+ if (top_line > item.size() - visible_lines || selected == (item.size() - 1))
top_line = item.size() - visible_lines;
+ bool show_top_arrow = false;
+ bool show_bottom_arrow = false;
+
+ // if scrolling, show arrows
+ if (item.size() > visible_lines)
+ {
+ if (top_line > 0)
+ show_top_arrow = true;
+ if (top_line != item.size() - visible_lines)
+ show_bottom_arrow = true;
+ }
+
+ // set the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
+ visitems = visible_lines - show_top_arrow - show_bottom_arrow;
+
// determine effective positions taking into account the hilighting arrows
float effective_width = visible_width - 2.0f * gutter_width;
float effective_left = visible_left + gutter_width;
@@ -573,6 +598,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
float line_x0 = x1 + 0.5f * UI_LINE_WIDTH;
float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
if (!customonly)
+ {
for (linenum = 0; linenum < visible_lines; linenum++)
{
float line_y = visible_top + (float)linenum * line_height;
@@ -613,7 +639,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
// if we're on the top line, display the up arrow
- if (linenum == 0 && top_line != 0)
+ if (linenum == 0 && show_top_arrow)
{
draw_arrow(container,
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
@@ -627,7 +653,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
}
// if we're on the bottom line, display the down arrow
- else if (linenum == visible_lines - 1 && itemnum != item.size() - 1)
+ else if (linenum == visible_lines - 1 && show_bottom_arrow)
{
draw_arrow(container,
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
@@ -646,8 +672,16 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
// if we don't have a subitem, just draw the string centered
else if (pitem.subtext == nullptr)
+ {
+ if (pitem.flags & MENU_FLAG_UI_HEADING)
+ {
+ float heading_width = machine().ui().get_string_width(itemtext);
+ container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + ((visible_width - heading_width) / 2) - UI_BOX_LR_BORDER, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container->add_line(visible_left + visible_width - ((visible_width - heading_width) / 2) + UI_BOX_LR_BORDER, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ }
machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width,
JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
+ }
// otherwise, draw the item on the left and the subitem text on the right
else
@@ -708,6 +742,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
}
}
}
+ }
// if the selected subitem is too big, display it in a separate offset box
if (selected_subitem_too_big)
@@ -741,9 +776,6 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
// if there is something special to add, do it by calling the virtual method
custom_render((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2);
-
- // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
- visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size());
}
void ui_menu::custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
@@ -889,9 +921,10 @@ void ui_menu::handle_events(UINT32 flags)
top_line -= local_menu_event.num_lines;
return;
}
- selected -= local_menu_event.num_lines;
+ (selected == 0) ? selected = top_line = item.size() - 1 : selected -= local_menu_event.num_lines;
validate_selection(-1);
- if (selected < top_line + (top_line != 0))
+ top_line -= (selected <= top_line && top_line != 0);
+ if (selected <= top_line && visitems != visible_lines)
top_line -= local_menu_event.num_lines;
}
else
@@ -901,11 +934,10 @@ void ui_menu::handle_events(UINT32 flags)
top_line += local_menu_event.num_lines;
return;
}
- selected += local_menu_event.num_lines;
+ (selected == item.size() - 1) ? selected = top_line = 0 : selected += local_menu_event.num_lines;
validate_selection(1);
- if (selected > item.size() - 1)
- selected = item.size() - 1;
- if (selected >= top_line + visitems + (top_line != 0))
+ top_line += (selected >= top_line + visitems + (top_line != 0));
+ if (selected >= (top_line + visitems + (top_line != 0)))
top_line += local_menu_event.num_lines;
}
}
@@ -989,7 +1021,9 @@ void ui_menu::handle_keys(UINT32 flags)
}
(selected == 0) ? selected = top_line = item.size() - 1 : --selected;
validate_selection(-1);
- top_line -= (selected == top_line && top_line != 0);
+ top_line -= (selected <= top_line && top_line != 0);
+ if (selected <= top_line && visitems != visible_lines)
+ top_line--;
}
// down advances by one item
@@ -1001,7 +1035,10 @@ void ui_menu::handle_keys(UINT32 flags)
return;
}
(selected == item.size() - 1) ? selected = top_line = 0 : ++selected;
- top_line += (selected == top_line + visitems + (top_line != 0));
+ validate_selection(1);
+ top_line += (selected >= top_line + visitems + (top_line != 0));
+ if (selected >= (top_line + visitems + (top_line != 0)))
+ top_line++;
}
// page up backs up by visitems
@@ -1383,7 +1420,7 @@ void ui_menu::draw_select_game(bool noinput)
{
float line_height = machine().ui().get_line_height();
float ud_arrow_width = line_height * machine().render().ui_aspect();
- float gutter_width = 0.52f * line_height * machine().render().ui_aspect();
+ float gutter_width = 0.52f * ud_arrow_width;
mouse_x = -1, mouse_y = -1;
float right_panel_size = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f;
float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER;
@@ -1444,9 +1481,8 @@ void ui_menu::draw_select_game(bool noinput)
x1 = visible_left - UI_BOX_LR_BORDER;
x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
float line = visible_top + (float)(visible_lines * line_height);
-
- //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+
if (visible_items < visible_lines)
visible_lines = visible_items;
if (top_line < 0 || selected == 0)
@@ -1543,7 +1579,7 @@ void ui_menu::draw_select_game(bool noinput)
else
draw_icon(linenum, item[itemnum].ref, effective_left, line_y);
- space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f;
+ space = ud_arrow_width * 1.5f;
}
mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE,
DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
@@ -1701,10 +1737,8 @@ void ui_menu::handle_main_keys(UINT32 flags)
// hitting cancel also pops the stack
if (exclusive_input_pressed(IPT_UI_CANCEL, 0))
{
- if (!menu_has_search_active())
+ if (!ui_error && !menu_has_search_active())
ui_menu::stack_pop(machine());
- // else if (!ui_error)
- // ui_menu::stack_pop(machine()); TODO
return;
}
@@ -2763,7 +2797,6 @@ void ui_menu::draw_dats_menu()
float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height;
float line = visible_top + (float)(visible_lines * line_height);
- //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
if (visible_items < visible_lines)
diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h
index 4a788c612c7..a07bcd1c519 100644
--- a/src/emu/ui/menu.h
+++ b/src/emu/ui/menu.h
@@ -32,6 +32,7 @@
#define MENU_FLAG_UI_SWLIST (1 << 8)
#define MENU_FLAG_UI_FAVORITE (1 << 9)
#define MENU_FLAG_UI_PALETTE (1 << 10)
+#define MENU_FLAG_UI_HEADING (1 << 11)
// special menu item for separators
#define MENU_SEPARATOR_ITEM "---"
@@ -52,6 +53,13 @@ enum ui_menu_reset_options
UI_MENU_RESET_REMEMBER_REF
};
+// types of menu items (TODO: please expand)
+enum class ui_menu_item_type
+{
+ UI_MENU_ITEM_TYPE_UNKNOWN,
+ UI_MENU_ITEM_TYPE_SLIDER,
+ UI_MENU_ITEM_TYPE_SEPARATOR
+};
/***************************************************************************
@@ -61,9 +69,10 @@ enum ui_menu_reset_options
// menu-related events
struct ui_menu_event
{
- void *itemref; // reference for the selected item
- int iptkey; // one of the IPT_* values from inptport.h
- unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL
+ void *itemref; // reference for the selected item
+ ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
+ int iptkey; // one of the IPT_* values from inptport.h
+ unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL
};
struct ui_menu_pool
@@ -77,10 +86,11 @@ struct ui_menu_pool
class ui_menu_item
{
public:
- const char *text;
- const char *subtext;
- UINT32 flags;
- void *ref;
+ const char *text;
+ const char *subtext;
+ UINT32 flags;
+ void *ref;
+ ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
inline bool is_selectable() const;
};
@@ -110,7 +120,8 @@ public:
void reset(ui_menu_reset_options options);
// append a new item to the end of the menu
- void item_append(const char *text, const char *subtext, UINT32 flags, void *ref);
+ void item_append(const char *text, const char *subtext, UINT32 flags, void *ref, ui_menu_item_type type = ui_menu_item_type::UI_MENU_ITEM_TYPE_UNKNOWN);
+ void item_append(ui_menu_item item);
// process a menu, drawing it and returning any interesting events
const ui_menu_event *process(UINT32 flags);
diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp
index edca54ebd20..69f36b6cfda 100644
--- a/src/emu/ui/miscmenu.cpp
+++ b/src/emu/ui/miscmenu.cpp
@@ -552,127 +552,6 @@ void ui_menu_quit_game::handle()
ui_menu::stack_reset(machine());
}
-ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = {
- { 0, nullptr, nullptr },
- { 0, __("Re-select last machine played"), OPTION_REMEMBER_LAST },
- { 0, __("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
- { 0, __("DATs info"), OPTION_DATS_ENABLED },
- { 0, __("Cheats"), OPTION_CHEAT },
- { 0, __("Show mouse pointer"), OPTION_UI_MOUSE },
- { 0, __("Confirm quit from machines"), OPTION_CONFIRM_QUIT },
- { 0, __("Skip displaying information's screen at startup"), OPTION_SKIP_GAMEINFO },
- { 0, __("Force 4:3 appearance for software snapshot"), OPTION_FORCED4X3 },
- { 0, __("Use image as background"), OPTION_USE_BACKGROUND },
- { 0, __("Skip bios selection menu"), OPTION_SKIP_BIOS_MENU },
- { 0, __("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU }
-};
-
-//-------------------------------------------------
-// ctor / dtor
-//-------------------------------------------------
-
-ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
-{
- for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
- if (machine.ui().options().exists(m_options[d].option))
- m_options[d].status = machine.ui().options().bool_value(m_options[d].option);
- else
- m_options[d].status = machine.options().bool_value(m_options[d].option);
-}
-
-ui_menu_misc_options::~ui_menu_misc_options()
-{
- std::string error_string;
- for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) {
- if (machine().ui().options().exists(m_options[d].option))
- {
- machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
- }
- else
- {
- if (machine().options().bool_value(m_options[d].option) != m_options[d].status)
- {
- machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
- machine().options().mark_changed(m_options[d].option);
- }
- }
- }
- ui_globals::reset = true;
-}
-
-//-------------------------------------------------
-// handlethe options menu
-//-------------------------------------------------
-
-void ui_menu_misc_options::handle()
-{
- bool changed = false;
-
- // process the menu
- const ui_menu_event *m_event = process(0);
- if (m_event != nullptr && m_event->itemref != nullptr)
- {
- if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
- {
- changed = true;
- int value = (FPTR)m_event->itemref;
- if (!strcmp(m_options[value].option, OPTION_ENLARGE_SNAPS))
- ui_globals::switch_image = true;
- m_options[value].status = !m_options[value].status;
- }
- }
-
- if (changed)
- reset(UI_MENU_RESET_REMEMBER_REF);
-}
-
-//-------------------------------------------------
-// populate
-//-------------------------------------------------
-
-void ui_menu_misc_options::populate()
-{
- // add options items
- for (int opt = 1; opt < ARRAY_LENGTH(m_options); ++opt)
- item_append(_(m_options[opt].description), m_options[opt].status ? _("On") : _("Off"), m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt);
-
- item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
- customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
-}
-
-//-------------------------------------------------
-// perform our special rendering
-//-------------------------------------------------
-
-void ui_menu_misc_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
-{
- float width;
- ui_manager &mui = machine().ui();
-
- mui.draw_text_full(container, _("Miscellaneous Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
- width += 2 * UI_BOX_LR_BORDER;
- float maxwidth = MAX(origx2 - origx1, width);
-
- // compute our bounds
- float x1 = 0.5f - 0.5f * maxwidth;
- float x2 = x1 + maxwidth;
- float y1 = origy1 - top;
- float y2 = origy1 - UI_BOX_TB_BORDER;
-
- // draw a box
- mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
-
- // take off the borders
- x1 += UI_BOX_LR_BORDER;
- x2 -= UI_BOX_LR_BORDER;
- y1 += UI_BOX_TB_BORDER;
-
- // draw the text within it
- mui.draw_text_full(container, _("Miscellaneous Options"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
-}
-
//-------------------------------------------------
// ctor / dtor
//-------------------------------------------------
diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp
index fef44b8e542..796bd665512 100644
--- a/src/emu/ui/optsmenu.cpp
+++ b/src/emu/ui/optsmenu.cpp
@@ -11,13 +11,12 @@
#include "emu.h"
#include "ui/ui.h"
#include "ui/menu.h"
+#include "ui/submenu.h"
#include "ui/datfile.h"
#include "ui/inifile.h"
#include "ui/selector.h"
#include "ui/custui.h"
#include "ui/sndmenu.h"
-#include "ui/ctrlmenu.h"
-#include "ui/dsplmenu.h"
#include "ui/miscmenu.h"
#include "ui/optsmenu.h"
#include "ui/custmenu.h"
@@ -162,7 +161,7 @@ void ui_menu_game_options::handle()
break;
case MISC_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
- ui_menu::stack_push(global_alloc_clear<ui_menu_misc_options>(machine(), container));
+ ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, misc_submenu_options));
break;
case SOUND_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
@@ -170,7 +169,7 @@ void ui_menu_game_options::handle()
break;
case DISPLAY_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
- ui_menu::stack_push(global_alloc_clear<ui_menu_display_options>(machine(), container));
+ ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, video_submenu_options));
break;
case CUSTOM_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
@@ -178,7 +177,7 @@ void ui_menu_game_options::handle()
break;
case CONTROLLER_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
- ui_menu::stack_push(global_alloc_clear<ui_menu_controller_mapping>(machine(), container));
+ ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, control_submenu_options));
break;
case CGI_MENU:
if (m_event->iptkey == IPT_UI_SELECT)
@@ -188,6 +187,10 @@ void ui_menu_game_options::handle()
if (m_event->iptkey == IPT_UI_SELECT)
ui_menu::stack_push(global_alloc_clear<ui_menu_custom_filter>(machine(), container));
break;
+ case ADVANCED_MENU:
+ if (m_event->iptkey == IPT_UI_SELECT)
+ ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, advanced_submenu_options));
+ break;
case SAVE_CONFIG:
if (m_event->iptkey == IPT_UI_SELECT)
save_main_option(machine());
@@ -258,11 +261,12 @@ void ui_menu_game_options::populate()
item_append(_("Customize UI"), nullptr, 0, (void *)(FPTR)CUSTOM_MENU);
item_append(_("Configure Directories"), nullptr, 0, (void *)(FPTR)CONF_DIR);
}
- item_append(_("Display Options"), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
+ item_append(_(video_submenu_options[0].description), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
item_append(_("Sound Options"), nullptr, 0, (void *)(FPTR)SOUND_MENU);
- item_append(_("Miscellaneous Options"), nullptr, 0, (void *)(FPTR)MISC_MENU);
- item_append(_("Device Mapping"), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
+ item_append(_(misc_submenu_options[0].description), nullptr, 0, (void *)(FPTR)MISC_MENU);
+ item_append(_(control_submenu_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
item_append(_("General Inputs"), nullptr, 0, (void *)(FPTR)CGI_MENU);
+ item_append(_(advanced_submenu_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED_MENU);
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
item_append(_("Save Configuration"), nullptr, 0, (void *)(FPTR)SAVE_CONFIG);
diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h
index 4dd2d0f53be..f6b4243afa0 100644
--- a/src/emu/ui/optsmenu.h
+++ b/src/emu/ui/optsmenu.h
@@ -33,11 +33,12 @@ private:
YEAR_CAT_FILTER,
CATEGORY_FILTER,
CONF_DIR,
- MISC_MENU,
DISPLAY_MENU,
CUSTOM_MENU,
SOUND_MENU,
CONTROLLER_MENU,
+ MISC_MENU,
+ ADVANCED_MENU,
SAVE_OPTIONS,
CGI_MENU,
CUSTOM_FILTER,
diff --git a/src/emu/ui/pluginopt.cpp b/src/emu/ui/pluginopt.cpp
new file mode 100644
index 00000000000..9fd02404a0a
--- /dev/null
+++ b/src/emu/ui/pluginopt.cpp
@@ -0,0 +1,112 @@
+// license:BSD-3-Clause
+// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
+/*********************************************************************
+
+ ui/pluginopt.cpp
+
+ Internal menu for the plugin interface.
+
+*********************************************************************/
+
+#include "emu.h"
+#include "luaengine.h"
+
+#include "ui/pluginopt.h"
+
+void ui_menu_plugin::handle()
+{
+ const ui_menu_event *menu_event = process(0);
+
+ if (menu_event != nullptr && menu_event->itemref != nullptr)
+ {
+ if (menu_event->iptkey == IPT_UI_SELECT)
+ ui_menu::stack_push(global_alloc_clear<ui_menu_plugin_opt>(machine(), container, (char *)menu_event->itemref));
+ }
+}
+
+ui_menu_plugin::ui_menu_plugin(running_machine &machine, render_container *container) :
+ ui_menu(machine, container),
+ m_plugins(machine.manager().lua()->get_menu())
+{
+}
+
+void ui_menu_plugin::populate()
+{
+ for (auto &curplugin : m_plugins)
+ item_append(curplugin.c_str(), 0, 0, (void *)curplugin.c_str());
+ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+}
+
+ui_menu_plugin::~ui_menu_plugin()
+{
+}
+
+ui_menu_plugin_opt::ui_menu_plugin_opt(running_machine &machine, render_container *container, char *menu) :
+ ui_menu(machine, container),
+ m_menu(menu)
+{
+}
+
+void ui_menu_plugin_opt::handle()
+{
+ const ui_menu_event *menu_event = process(0);
+
+ if (menu_event != nullptr && (FPTR)menu_event->itemref)
+ {
+ std::string key;
+ switch(menu_event->iptkey)
+ {
+ case IPT_UI_UP:
+ key = "up";
+ break;
+ case IPT_UI_DOWN:
+ key = "down";
+ break;
+ case IPT_UI_LEFT:
+ key = "left";
+ break;
+ case IPT_UI_RIGHT:
+ key = "right";
+ break;
+ case IPT_UI_SELECT:
+ key = "select";
+ break;
+ case IPT_UI_DISPLAY_COMMENT:
+ key = "comment";
+ break;
+ case IPT_UI_CLEAR:
+ key = "clear";
+ break;
+ default:
+ return;
+ }
+ if(machine().manager().lua()->menu_callback(m_menu, (FPTR)menu_event->itemref, key))
+ reset(UI_MENU_RESET_REMEMBER_REF);
+ }
+}
+
+void ui_menu_plugin_opt::populate()
+{
+ std::vector<lua_engine::menu_item> menu_list;
+ machine().manager().lua()->menu_populate(m_menu, menu_list);
+ FPTR i = 1;
+ for(auto &item : menu_list)
+ {
+ UINT32 flags = 0;
+ if(item.flags == "off")
+ flags = MENU_FLAG_DISABLE;
+ else if(item.flags == "l")
+ flags = MENU_FLAG_LEFT_ARROW;
+ else if(item.flags == "r")
+ flags = MENU_FLAG_RIGHT_ARROW;
+ else if(item.flags == "lr")
+ flags = MENU_FLAG_RIGHT_ARROW | MENU_FLAG_LEFT_ARROW;
+
+ item_append(item.text.c_str(), item.subtext.c_str(), flags, (void *)i++);
+ }
+ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+}
+
+ui_menu_plugin_opt::~ui_menu_plugin_opt()
+{
+}
diff --git a/src/emu/ui/pluginopt.h b/src/emu/ui/pluginopt.h
new file mode 100644
index 00000000000..9d529e93749
--- /dev/null
+++ b/src/emu/ui/pluginopt.h
@@ -0,0 +1,38 @@
+// license:BSD-3-Clause
+// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods, Carl
+/***************************************************************************
+
+ ui/pluginopt.h
+
+ Internal menu for the plugin interface.
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __UI_PLUGINOPT_H__
+#define __UI_PLUGINOPT_H__
+
+#include "ui/ui.h"
+#include "ui/menu.h"
+
+class ui_menu_plugin : public ui_menu {
+public:
+ ui_menu_plugin(running_machine &machine, render_container *container);
+ virtual ~ui_menu_plugin();
+ virtual void populate() override;
+ virtual void handle() override;
+private:
+ std::vector<std::string> &m_plugins;
+};
+
+class ui_menu_plugin_opt : public ui_menu {
+public:
+ ui_menu_plugin_opt(running_machine &machine, render_container *container, char *menu);
+ virtual ~ui_menu_plugin_opt();
+ virtual void populate() override;
+ virtual void handle() override;
+private:
+ std::string m_menu;
+};
+#endif /* __UI_PLUGINOPT_H__ */
diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp
index 1ac26804bb5..daaa072f9ef 100644
--- a/src/emu/ui/selgame.cpp
+++ b/src/emu/ui/selgame.cpp
@@ -205,7 +205,10 @@ void ui_menu_select_game::handle()
{
// reset the error on any future m_event
if (ui_error)
+ {
ui_error = false;
+ machine().ui_input().reset();
+ }
// handle selections
else if (m_event->iptkey == IPT_UI_SELECT)
@@ -444,7 +447,7 @@ void ui_menu_select_game::handle()
// if we're in an error state, overlay an error message
if (ui_error)
machine().ui().draw_text_box(container, _("The selected machine is missing one or more required ROM or CHD images. "
- "Please select a different machine.\n\nPress any key (except ESC) to continue."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
+ "Please select a different machine.\n\nPress any key to continue."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
// handle filters selection from key shortcuts
if (check_filter)
@@ -493,7 +496,6 @@ void ui_menu_select_game::populate()
// reset search string
m_search[0] = '\0';
m_displaylist.clear();
- m_tmp.clear();
// if filter is set on category, build category list
switch (main_filters::actual)
@@ -502,16 +504,16 @@ void ui_menu_select_game::populate()
build_category();
break;
case FILTER_MANUFACTURER:
- build_list(m_tmp, c_mnfct::ui[c_mnfct::actual].c_str());
+ build_list(c_mnfct::ui[c_mnfct::actual].c_str());
break;
case FILTER_YEAR:
- build_list(m_tmp, c_year::ui[c_year::actual].c_str());
+ build_list(c_year::ui[c_year::actual].c_str());
break;
case FILTER_CUSTOM:
build_custom();
break;
default:
- build_list(m_tmp);
+ build_list();
break;
}
@@ -1277,7 +1279,7 @@ void ui_menu_select_game::inkey_configure(const ui_menu_event *m_event)
// build list
//-------------------------------------------------
-void ui_menu_select_game::build_list(std::vector<const game_driver *> &s_drivers, const char *filter_text, int filter, bool bioscheck)
+void ui_menu_select_game::build_list(const char *filter_text, int filter, bool bioscheck, std::vector<const game_driver *> s_drivers)
{
int cx = 0;
bool cloneof = false;
@@ -1441,13 +1443,13 @@ void ui_menu_select_game::build_custom()
switch (filter)
{
case FILTER_YEAR:
- build_list(s_drivers, c_year::ui[custfltr::year[count]].c_str(), filter, bioscheck);
+ build_list(c_year::ui[custfltr::year[count]].c_str(), filter, bioscheck, s_drivers);
break;
case FILTER_MANUFACTURER:
- build_list(s_drivers, c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck);
+ build_list(c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck, s_drivers);
break;
default:
- build_list(s_drivers, nullptr, filter, bioscheck);
+ build_list(nullptr, filter, bioscheck, s_drivers);
break;
}
}
@@ -1459,14 +1461,14 @@ void ui_menu_select_game::build_custom()
void ui_menu_select_game::build_category()
{
+ m_displaylist.clear();
std::vector<int> temp_filter;
machine().inifile().load_ini_category(temp_filter);
for (auto actual : temp_filter)
- m_tmp.push_back(&driver_list::driver(actual));
+ m_displaylist.push_back(&driver_list::driver(actual));
- std::stable_sort(m_tmp.begin(), m_tmp.end(), sorted_game_list);
- m_displaylist = m_tmp;
+ std::stable_sort(m_displaylist.begin(), m_displaylist.end(), sorted_game_list);
}
//-------------------------------------------------
@@ -1777,7 +1779,7 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y
{
float origy1 = y1;
float origy2 = y2;
- float text_size = 0.75f;
+ float text_size = machine().ui().options().infos_size();
float line_height_max = line_height * text_size;
float left_width = 0.0f;
int text_lenght = main_filters::length;
@@ -1793,13 +1795,13 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y
line_height_max = line_height * text_size;
}
- float text_sign = mui.get_string_width_ex("_# ", text_size);
+ float text_sign = mui.get_string_width("_# ", text_size);
for (int x = 0; x < text_lenght; ++x)
{
float total_width;
// compute width of left hand side
- total_width = mui.get_string_width_ex(text[x], text_size);
+ total_width = mui.get_string_width(text[x], text_size);
total_width += text_sign;
// track the maximum
@@ -2073,7 +2075,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
else if (ui_globals::curdats_view == UI_STORY_LOAD)
{
// check size
- float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size);
+ float textlen = mui.get_string_width(tempbuf.c_str(), text_size);
float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size;
size_t last_underscore = tempbuf.find_last_of("_");
@@ -2103,7 +2105,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
else if (ui_globals::curdats_view == UI_COMMAND_LOAD || ui_globals::curdats_view == UI_GENERAL_LOAD)
{
// check size
- float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size);
+ float textlen = mui.get_string_width(tempbuf.c_str(), text_size);
float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size;
int first_dspace = (ui_globals::curdats_view == UI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":");
@@ -2257,7 +2259,6 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
- //machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR);
mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h
index 6db7b23ebeb..11dee880927 100644
--- a/src/emu/ui/selgame.h
+++ b/src/emu/ui/selgame.h
@@ -53,7 +53,6 @@ private:
std::vector<const game_driver *> m_availsortedlist;
std::vector<const game_driver *> m_unavailsortedlist;
std::vector<const game_driver *> m_displaylist;
- std::vector<const game_driver *> m_tmp;
const game_driver *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1];
@@ -61,7 +60,7 @@ private:
void build_custom();
void build_category();
void build_available_list();
- void build_list(std::vector<const game_driver *> &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false);
+ void build_list(const char *filter_text = nullptr, int filter = 0, bool bioscheck = false, std::vector<const game_driver *> vec = {});
bool isfavorite();
void populate_search();
diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp
index 1c85ccf5fde..8f919c9a01e 100644
--- a/src/emu/ui/selsoft.cpp
+++ b/src/emu/ui/selsoft.cpp
@@ -171,7 +171,10 @@ void ui_menu_select_software::handle()
{
// reset the error on any future m_event
if (ui_error)
+ {
ui_error = false;
+ machine().ui_input().reset();
+ }
// handle selections
else if (m_event->iptkey == IPT_UI_SELECT)
@@ -375,7 +378,7 @@ void ui_menu_select_software::handle()
// if we're in an error state, overlay an error message
if (ui_error)
machine().ui().draw_text_box(container, _("The selected software is missing one or more required files. "
- "Please select a different software.\n\nPress any key (except ESC) to continue."),
+ "Please select a different software.\n\nPress any key to continue."),
JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
// handle filters selection from key shortcuts
@@ -428,7 +431,6 @@ void ui_menu_select_software::populate()
machine_config config(*m_driver, machine().options());
image_interface_iterator iter(config.root_device());
-
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
if (image->filename() == nullptr && image->must_be_loaded())
{
@@ -1413,13 +1415,13 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
line_height = l_height * text_size;
}
- float text_sign = mui.get_string_width_ex("_# ", text_size);
+ float text_sign = mui.get_string_width("_# ", text_size);
for (int x = 0; x < text_lenght; ++x)
{
float total_width;
// compute width of left hand side
- total_width = mui.get_string_width_ex(text[x], text_size);
+ total_width = mui.get_string_width(text[x], text_size);
total_width += text_sign;
// track the maximum
@@ -1428,7 +1430,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
}
x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER;
- //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
@@ -1509,7 +1510,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
@@ -1533,7 +1533,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
@@ -1896,7 +1895,6 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1,
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
- //machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR);
mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
diff --git a/src/emu/ui/simpleselgame.cpp b/src/emu/ui/simpleselgame.cpp
index 617c6e651e4..e6c4b197e50 100644
--- a/src/emu/ui/simpleselgame.cpp
+++ b/src/emu/ui/simpleselgame.cpp
@@ -103,7 +103,10 @@ void ui_simple_menu_select_game::handle()
{
// reset the error on any future menu_event
if (m_error)
+ {
m_error = false;
+ machine().ui_input().reset();
+ }
// handle selections
else
diff --git a/src/emu/ui/sliders.cpp b/src/emu/ui/sliders.cpp
index 87508df3dd0..20cb435233a 100644
--- a/src/emu/ui/sliders.cpp
+++ b/src/emu/ui/sliders.cpp
@@ -39,10 +39,10 @@ void ui_menu_sliders::handle()
if (menu_event != nullptr)
{
/* handle keys if there is a valid item selected */
- if (menu_event->itemref != nullptr)
+ if (menu_event->itemref != nullptr && menu_event->type == ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER)
{
const slider_state *slider = (const slider_state *)menu_event->itemref;
- INT32 curvalue = (*slider->update)(machine(), slider->arg, nullptr, SLIDER_NOCHANGE);
+ INT32 curvalue = (*slider->update)(machine(), slider->arg, slider->id, nullptr, SLIDER_NOCHANGE);
INT32 increment = 0;
bool alt_pressed = machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT);
bool ctrl_pressed = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
@@ -104,7 +104,7 @@ void ui_menu_sliders::handle()
newvalue = slider->maxval;
/* update the slider and recompute the menu */
- (*slider->update)(machine(), slider->arg, nullptr, newvalue);
+ (*slider->update)(machine(), slider->arg, slider->id, nullptr, newvalue);
reset(UI_MENU_RESET_REMEMBER_REF);
}
}
@@ -140,27 +140,47 @@ void ui_menu_sliders::populate()
std::string tempstring;
/* add UI sliders */
- for (const slider_state *curslider = machine().ui().get_slider_list(); curslider != nullptr; curslider = curslider->next)
+ std::vector<ui_menu_item> ui_sliders = machine().ui().get_slider_list();
+ for (ui_menu_item item : ui_sliders)
{
- INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
- UINT32 flags = 0;
- if (curval > curslider->minval)
- flags |= MENU_FLAG_LEFT_ARROW;
- if (curval < curslider->maxval)
- flags |= MENU_FLAG_RIGHT_ARROW;
- item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider);
+ if (item.type == ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER)
+ {
+ slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
+ INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
+ UINT32 flags = 0;
+ if (curval > slider->minval)
+ flags |= MENU_FLAG_LEFT_ARROW;
+ if (curval < slider->maxval)
+ flags |= MENU_FLAG_RIGHT_ARROW;
+ item_append(slider->description, tempstring.c_str(), flags, (void *)slider, ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER);
+ }
+ else
+ {
+ item_append(item);
+ }
}
- /* add OSD sliders */
- for (const slider_state *curslider = (slider_state*)machine().osd().get_slider_list(); curslider != nullptr; curslider = curslider->next)
+ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+
+ /* add OSD options */
+ std::vector<ui_menu_item> osd_sliders = machine().osd().get_slider_list();
+ for (ui_menu_item item : osd_sliders)
{
- INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
- UINT32 flags = 0;
- if (curval > curslider->minval)
- flags |= MENU_FLAG_LEFT_ARROW;
- if (curval < curslider->maxval)
- flags |= MENU_FLAG_RIGHT_ARROW;
- item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider);
+ if (item.type == ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER)
+ {
+ slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
+ INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
+ UINT32 flags = 0;
+ if (curval > slider->minval)
+ flags |= MENU_FLAG_LEFT_ARROW;
+ if (curval < slider->maxval)
+ flags |= MENU_FLAG_RIGHT_ARROW;
+ item_append(slider->description, tempstring.c_str(), flags, (void *)slider, ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER);
+ }
+ else
+ {
+ item_append(item);
+ }
}
custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
@@ -184,7 +204,7 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom,
INT32 curval;
/* determine the current value and text */
- curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
+ curval = (*curslider->update)(machine(), curslider->arg, curslider->id, &tempstring, SLIDER_NOCHANGE);
/* compute the current and default percentages */
percentage = (float)(curval - curslider->minval) / (float)(curslider->maxval - curslider->minval);
diff --git a/src/emu/ui/sliders.h b/src/emu/ui/sliders.h
index c21555dc336..f420b094cbe 100644
--- a/src/emu/ui/sliders.h
+++ b/src/emu/ui/sliders.h
@@ -27,6 +27,10 @@ public:
static UINT32 ui_handler(running_machine &machine, render_container *container, UINT32 state);
private:
+ enum {
+ INPUT_GROUPS,
+ INPUT_SPECIFIC,
+ };
bool m_menuless_mode;
bool m_hidden;
};
diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp
index 693c28a9ba8..35c9cab14a7 100644
--- a/src/emu/ui/slotopt.cpp
+++ b/src/emu/ui/slotopt.cpp
@@ -9,7 +9,7 @@
*********************************************************************/
#include "emu.h"
-
+#include "emuopts.h"
#include "ui/ui.h"
#include "ui/menu.h"
#include "ui/slotopt.h"
diff --git a/src/emu/ui/submenu.cpp b/src/emu/ui/submenu.cpp
new file mode 100644
index 00000000000..a06d75adb83
--- /dev/null
+++ b/src/emu/ui/submenu.cpp
@@ -0,0 +1,361 @@
+// license:BSD-3-Clause
+// copyright-holders:Maurizio Petrarota,Jeffrey Clark
+/***************************************************************************
+
+ ui/submenu.cpp
+
+ UI options menu
+
+***************************************************************************/
+
+#include "emu.h"
+#include "ui/ui.h"
+#include "ui/submenu.h"
+#include "ui/utils.h"
+#include <limits>
+#include <iterator>
+
+//-------------------------------------------------
+// ctor / dtor
+//-------------------------------------------------
+
+ui_submenu::ui_submenu(running_machine &machine, render_container *container, std::vector<ui_submenu::option> &suboptions)
+ : ui_menu(machine, container),
+ m_options(suboptions)
+{
+ for (auto & sm_option : m_options)
+ {
+ switch (sm_option.type)
+ {
+ case ui_submenu::EMU:
+ sm_option.entry = machine.options().get_entry(sm_option.name);
+ sm_option.options = dynamic_cast<core_options*>(&machine.options());
+ if (sm_option.entry->type() == OPTION_STRING)
+ {
+ sm_option.value.clear();
+ std::string namestr(sm_option.entry->description());
+ int lparen = namestr.find_first_of('(', 0);
+ int vslash = namestr.find_first_of('|', lparen + 1);
+ int rparen = namestr.find_first_of(')', vslash + 1);
+ if (lparen != -1 && vslash != -1 && rparen != -1)
+ {
+ int semi;
+ namestr.erase(rparen);
+ namestr.erase(0, lparen + 1);
+ while ((semi = namestr.find_first_of('|')) != -1)
+ {
+ sm_option.value.emplace_back(namestr.substr(0, semi));
+ namestr.erase(0, semi + 1);
+ }
+ sm_option.value.emplace_back(namestr);
+ }
+ }
+ break;
+ case ui_submenu::OSD:
+ sm_option.entry = machine.options().get_entry(sm_option.name);
+ sm_option.options = dynamic_cast<core_options*>(&machine.options());
+ if (sm_option.entry->type() == OPTION_STRING)
+ {
+ sm_option.value.clear();
+ std::string descr(sm_option.entry->description()), delim(", ");
+ descr.erase(0, descr.find(":") + 2);
+ size_t p1, p2 = 0;
+ while ((p1 = descr.find_first_not_of(delim, p2)) != std::string::npos)
+ {
+ p2 = descr.find_first_of(delim, p1 + 1);
+ if (p2 != std::string::npos)
+ {
+ std::string txt(descr.substr(p1, p2 - p1));
+ if (txt != "or")
+ sm_option.value.push_back(txt);
+ }
+ else
+ {
+ sm_option.value.push_back(descr.substr(p1));
+ break;
+ }
+ }
+ }
+ break;
+ case ui_submenu::UI:
+ sm_option.entry = machine.ui().options().get_entry(sm_option.name);
+ sm_option.options = dynamic_cast<core_options*>(&machine.ui().options());
+ break;
+ default:
+ continue;
+ break;
+ }
+ }
+}
+
+ui_submenu::~ui_submenu()
+{
+}
+
+//-------------------------------------------------
+// handlethe options menu
+//-------------------------------------------------
+
+void ui_submenu::handle()
+{
+ bool changed = false;
+ std::string error_string, tmptxt;
+ float f_cur, f_step;
+
+ // process the menu
+ const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
+
+ if (m_event != nullptr && m_event->itemref != nullptr &&
+ (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT))
+ {
+ ui_submenu::option *sm_option = (ui_submenu::option *)m_event->itemref;
+
+ switch (sm_option->type)
+ {
+ case ui_submenu::EMU:
+ case ui_submenu::UI:
+ case ui_submenu::OSD:
+ switch (sm_option->entry->type())
+ {
+ case OPTION_BOOLEAN:
+ changed = true;
+ sm_option->options->set_value(sm_option->name, !strcmp(sm_option->entry->value(),"1") ? "0" : "1", OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option->entry->mark_changed();
+ break;
+ case OPTION_INTEGER:
+ if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
+ {
+ changed = true;
+ int i_cur = atoi(sm_option->entry->value());
+ (m_event->iptkey == IPT_UI_LEFT) ? i_cur-- : i_cur++;
+ sm_option->options->set_value(sm_option->name, i_cur, OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option->entry->mark_changed();
+ }
+ break;
+ case OPTION_FLOAT:
+ if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
+ {
+ changed = true;
+ f_cur = atof(sm_option->entry->value());
+ if (sm_option->entry->has_range())
+ {
+ f_step = atof(sm_option->entry->minimum());
+ if (f_step <= 0.0f) {
+ int pmin = getprecisionchr(sm_option->entry->minimum());
+ int pmax = getprecisionchr(sm_option->entry->maximum());
+ tmptxt = '1' + std::string((pmin > pmax) ? pmin : pmax, '0');
+ f_step = 1 / atof(tmptxt.c_str());
+ }
+ }
+ else
+ {
+ int precision = getprecisionchr(sm_option->entry->default_value());
+ tmptxt = '1' + std::string(precision, '0');
+ f_step = 1 / atof(tmptxt.c_str());
+ }
+ if (m_event->iptkey == IPT_UI_LEFT)
+ f_cur -= f_step;
+ else
+ f_cur += f_step;
+ tmptxt = string_format("%g", f_cur);
+ sm_option->options->set_value(sm_option->name, tmptxt.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option->entry->mark_changed();
+ }
+ break;
+ case OPTION_STRING:
+ if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
+ {
+ changed = true;
+ std::string v_cur(sm_option->entry->value());
+ int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
+ if (m_event->iptkey == IPT_UI_LEFT)
+ v_cur = sm_option->value[--cur_value];
+ else
+ v_cur = sm_option->value[++cur_value];
+ sm_option->options->set_value(sm_option->name, v_cur.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
+ sm_option->entry->mark_changed();
+ }
+ break;
+ }
+ break;
+ default:
+ osd_printf_error("Unhandled option: %s", _(sm_option->description));
+ break;
+ }
+ }
+
+ if (changed)
+ reset(UI_MENU_RESET_REMEMBER_REF);
+}
+
+//-------------------------------------------------
+// populate
+//-------------------------------------------------
+
+void ui_submenu::populate()
+{
+ UINT32 arrow_flags;
+
+ // add options
+ for (auto sm_option = m_options.begin(); sm_option < m_options.end(); sm_option++)
+ {
+ // skip first heading (is menu title)
+ if (sm_option == m_options.begin() && sm_option->type == ui_submenu::HEAD) continue;
+
+ switch (sm_option->type)
+ {
+ case ui_submenu::HEAD:
+ item_append(_(sm_option->description), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr);
+ break;
+ case ui_submenu::SEP:
+ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+ break;
+ case ui_submenu::CMD:
+ item_append(_(sm_option->description), nullptr, 0, static_cast<void*>(&(*sm_option)));
+ break;
+ case ui_submenu::EMU:
+ case ui_submenu::UI:
+ case ui_submenu::OSD:
+ switch (sm_option->entry->type())
+ {
+ case OPTION_BOOLEAN:
+ arrow_flags = sm_option->options->bool_value(sm_option->name) ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW;
+ item_append(_(sm_option->description),
+ (arrow_flags == MENU_FLAG_RIGHT_ARROW) ? "On" : "Off",
+ arrow_flags,
+ static_cast<void*>(&(*sm_option)));
+ break;
+ case OPTION_INTEGER:
+ {
+ int i_min, i_max;
+ int i_cur = atoi(sm_option->entry->value());
+ if (sm_option->entry->has_range())
+ {
+ i_min = atoi(sm_option->entry->minimum());
+ i_max = atoi(sm_option->entry->maximum());
+ }
+ else
+ {
+ i_min = std::numeric_limits<int>::min();
+ i_max = std::numeric_limits<int>::max();
+ }
+ arrow_flags = get_arrow_flags(i_min, i_max, i_cur);
+ item_append(_(sm_option->description),
+ sm_option->entry->value(),
+ arrow_flags,
+ static_cast<void*>(&(*sm_option)));
+ break;
+ }
+ case OPTION_FLOAT:
+ {
+ float f_min, f_max;
+ float f_cur = atof(sm_option->entry->value());
+ if (sm_option->entry->has_range())
+ {
+ f_min = atof(sm_option->entry->minimum());
+ f_max = atof(sm_option->entry->maximum());
+ }
+ else
+ {
+ f_min = 0.0f;
+ f_max = std::numeric_limits<float>::max();
+ }
+ arrow_flags = get_arrow_flags(f_min, f_max, f_cur);
+ std::string tmptxt = string_format("%g", f_cur);
+ item_append(_(sm_option->description),
+ tmptxt.c_str(),
+ arrow_flags,
+ static_cast<void*>(&(*sm_option)));
+ break;
+ }
+ case OPTION_STRING:
+ {
+ std::string v_cur(sm_option->entry->value());
+ int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
+ arrow_flags = get_arrow_flags(0, sm_option->value.size() - 1, cur_value);
+ item_append(_(sm_option->description),
+ sm_option->options->value(sm_option->name),
+ arrow_flags, static_cast<void*>(&(*sm_option)));
+ break;
+ }
+ default:
+ arrow_flags = MENU_FLAG_RIGHT_ARROW;
+ item_append(_(sm_option->description),
+ sm_option->options->value(sm_option->name),
+ arrow_flags, static_cast<void*>(&(*sm_option)));
+ break;
+ }
+ break;
+ default:
+ osd_printf_error("Unknown option type: %s", _(sm_option->description));
+ break;
+ }
+ }
+
+ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
+ custombottom = customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
+}
+
+//-------------------------------------------------
+// perform our special rendering
+//-------------------------------------------------
+
+void ui_submenu::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
+{
+ float width;
+ ui_manager &mui = machine().ui();
+
+ mui.draw_text_full(container, _(m_options[0].description), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
+ DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
+ width += 2 * UI_BOX_LR_BORDER;
+ float maxwidth = MAX(origx2 - origx1, width);
+
+ // compute our bounds
+ float x1 = 0.5f - 0.5f * maxwidth;
+ float x2 = x1 + maxwidth;
+ float y1 = origy1 - top;
+ float y2 = origy1 - UI_BOX_TB_BORDER;
+
+ // draw a box
+ mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+
+ // take off the borders
+ x1 += UI_BOX_LR_BORDER;
+ x2 -= UI_BOX_LR_BORDER;
+ y1 += UI_BOX_TB_BORDER;
+
+ // draw the text within it
+ mui.draw_text_full(container, _(m_options[0].description), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
+ DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+
+ if (selectedref != nullptr)
+ {
+ ui_submenu::option *selected_sm_option = (ui_submenu::option *)selectedref;
+ if (selected_sm_option->entry != nullptr)
+ {
+ mui.draw_text_full(container, selected_sm_option->entry->description(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
+ DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
+
+ width += 2 * UI_BOX_LR_BORDER;
+ maxwidth = MAX(origx2 - origx1, width);
+
+ // compute our bounds
+ x1 = 0.5f - 0.5f * maxwidth;
+ x2 = x1 + maxwidth;
+ y1 = origy2 + UI_BOX_TB_BORDER;
+ y2 = origy2 + bottom;
+
+ // draw a box
+ mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+
+ // take off the borders
+ x1 += UI_BOX_LR_BORDER;
+ x2 -= UI_BOX_LR_BORDER;
+ y1 += UI_BOX_TB_BORDER;
+
+ // draw the text within it
+ mui.draw_text_full(container, selected_sm_option->entry->description(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
+ DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ }
+ }
+}
diff --git a/src/emu/ui/submenu.h b/src/emu/ui/submenu.h
new file mode 100644
index 00000000000..3e25ba18c94
--- /dev/null
+++ b/src/emu/ui/submenu.h
@@ -0,0 +1,158 @@
+// license:BSD-3-Clause
+// copyright-holders:Maurizio Petrarota,Jeffrey Clark
+/***************************************************************************
+
+ ui/submenu.h
+
+ UI options menu.
+
+***************************************************************************/
+#pragma once
+
+#ifndef __UI_SUBMENU_H__
+#define __UI_SUBMENU_H__
+
+#include "emuopts.h"
+#include "ui/menu.h"
+
+#if defined(UI_WINDOWS) && !defined(UI_SDL)
+#include "../osd/windows/winmain.h"
+#else
+#include "../osd/modules/lib/osdobj_common.h"
+#endif
+
+//-------------------------------------------------
+// class ui menu
+//-------------------------------------------------
+class ui_submenu : public ui_menu
+{
+public:
+ enum option_type {
+ HEAD,
+ SEP,
+ MENU,
+ CMD,
+ EMU,
+ UI,
+ OSD,
+ };
+
+ struct option {
+ option_type type;
+ const char *description;
+ const char *name;
+ core_options::entry *entry;
+ core_options (*options);
+ std::vector<std::string> value;
+ };
+
+ ui_submenu(running_machine &machine, render_container *container, std::vector<ui_submenu::option> &suboptions);
+ virtual ~ui_submenu();
+ virtual void populate() override;
+ virtual void handle() override;
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+
+private:
+ std::vector<option> &m_options;
+};
+
+static std::vector<ui_submenu::option> misc_submenu_options = {
+ { ui_submenu::HEAD, __("Miscellaneous Options") },
+ { ui_submenu::UI, __("Re-select last machine played"), OPTION_REMEMBER_LAST },
+ { ui_submenu::UI, __("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
+ { ui_submenu::UI, __("DATs info"), OPTION_DATS_ENABLED },
+ { ui_submenu::EMU, __("Cheats"), OPTION_CHEAT },
+ { ui_submenu::EMU, __("Show mouse pointer"), OPTION_UI_MOUSE },
+ { ui_submenu::EMU, __("Confirm quit from machines"), OPTION_CONFIRM_QUIT },
+ { ui_submenu::EMU, __("Skip information screen at startup"), OPTION_SKIP_GAMEINFO },
+ { ui_submenu::UI, __("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 },
+ { ui_submenu::UI, __("Use image as background"), OPTION_USE_BACKGROUND },
+ { ui_submenu::UI, __("Skip bios selection menu"), OPTION_SKIP_BIOS_MENU },
+ { ui_submenu::UI, __("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU },
+ { ui_submenu::UI, __("Info auto audit"), OPTION_INFO_AUTO_AUDIT },
+};
+
+static std::vector<ui_submenu::option> advanced_submenu_options = {
+ { ui_submenu::HEAD, __("Advanced Options") },
+ { ui_submenu::HEAD, __("Performance Options") },
+ { ui_submenu::EMU, __("Auto frame skip"), OPTION_AUTOFRAMESKIP },
+ { ui_submenu::EMU, __("Frame skip"), OPTION_FRAMESKIP },
+ { ui_submenu::EMU, __("Throttle"), OPTION_THROTTLE },
+ { ui_submenu::EMU, __("Sleep"), OPTION_SLEEP },
+ { ui_submenu::EMU, __("Speed"), OPTION_SPEED },
+ { ui_submenu::EMU, __("Refresh speed"), OPTION_REFRESHSPEED },
+
+ { ui_submenu::HEAD, __("Rotation Options") },
+ { ui_submenu::EMU, __("Rotate"), OPTION_ROTATE },
+ { ui_submenu::EMU, __("Rotate right"), OPTION_ROR },
+ { ui_submenu::EMU, __("Rotate left"), OPTION_ROL },
+ { ui_submenu::EMU, __("Auto rotate right"), OPTION_AUTOROR },
+ { ui_submenu::EMU, __("Auto rotate left"), OPTION_AUTOROL },
+ { ui_submenu::EMU, __("Flip X"), OPTION_FLIPX },
+ { ui_submenu::EMU, __("Flip Y"), OPTION_FLIPY },
+
+ { ui_submenu::HEAD, __("Artwork Options") },
+ { ui_submenu::EMU, __("Artwork Crop"), OPTION_ARTWORK_CROP },
+ { ui_submenu::EMU, __("Use Backdrops"), OPTION_USE_BACKDROPS },
+ { ui_submenu::EMU, __("Use Overlays"), OPTION_USE_OVERLAYS },
+ { ui_submenu::EMU, __("Use Bezels"), OPTION_USE_BEZELS },
+ { ui_submenu::EMU, __("Use Control Panels"), OPTION_USE_CPANELS },
+ { ui_submenu::EMU, __("Use Marquees"), OPTION_USE_MARQUEES },
+
+ { ui_submenu::HEAD, __("State/Playback Options") },
+ { ui_submenu::EMU, __("Automatic save/restore"), OPTION_AUTOSAVE },
+ { ui_submenu::EMU, __("Bilinear snapshot"), OPTION_SNAPBILINEAR },
+ { ui_submenu::EMU, __("Burn-in"), OPTION_BURNIN },
+
+ { ui_submenu::HEAD, __("Input Options") },
+ { ui_submenu::EMU, __("Coin lockout"), OPTION_COIN_LOCKOUT },
+ { ui_submenu::EMU, __("Mouse"), OPTION_MOUSE },
+ { ui_submenu::EMU, __("Joystick"), OPTION_JOYSTICK },
+ { ui_submenu::EMU, __("Lightgun"), OPTION_LIGHTGUN },
+ { ui_submenu::EMU, __("Multi-keyboard"), OPTION_MULTIKEYBOARD },
+ { ui_submenu::EMU, __("Multi-mouse"), OPTION_MULTIMOUSE },
+ { ui_submenu::EMU, __("Steadykey"), OPTION_STEADYKEY },
+ { ui_submenu::EMU, __("UI active"), OPTION_UI_ACTIVE },
+ { ui_submenu::EMU, __("Offscreen reload"), OPTION_OFFSCREEN_RELOAD },
+ { ui_submenu::EMU, __("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE },
+ { ui_submenu::EMU, __("Joystick saturation"), OPTION_JOYSTICK_SATURATION },
+ { ui_submenu::EMU, __("Natural keyboard"), OPTION_NATURAL_KEYBOARD },
+ { ui_submenu::EMU, __("Simultaneous contradictory"), OPTION_JOYSTICK_CONTRADICTORY },
+ { ui_submenu::EMU, __("Coin impulse"), OPTION_COIN_IMPULSE },
+};
+
+static std::vector<ui_submenu::option> control_submenu_options = {
+ { ui_submenu::HEAD, __("Device Mapping") },
+ { ui_submenu::EMU, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
+ { ui_submenu::EMU, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
+ { ui_submenu::EMU, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
+ { ui_submenu::EMU, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
+ { ui_submenu::EMU, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
+ { ui_submenu::EMU, __("Dial Device Assignment"), OPTION_DIAL_DEVICE },
+ { ui_submenu::EMU, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },
+ { ui_submenu::EMU, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
+};
+
+static std::vector<ui_submenu::option> video_submenu_options = {
+ { ui_submenu::HEAD, __("Display Options") },
+ { ui_submenu::OSD, __("Video Mode"), OSDOPTION_VIDEO },
+#if defined(UI_WINDOWS) && !defined(UI_SDL)
+ { ui_submenu::OSD, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
+ { ui_submenu::OSD, __("HLSL"), WINOPTION_HLSL_ENABLE },
+#endif
+ { ui_submenu::OSD, __("GLSL"), OSDOPTION_GL_GLSL },
+ { ui_submenu::OSD, __("Bilinear Filtering"), OSDOPTION_FILTER },
+ { ui_submenu::OSD, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
+ { ui_submenu::OSD, __("Window Mode"), OSDOPTION_WINDOW },
+ { ui_submenu::EMU, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
+ { ui_submenu::OSD, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
+ { ui_submenu::OSD, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
+ { ui_submenu::OSD, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
+};
+
+//static std::vector<ui_submenu::option> export_submenu_options = {
+// { ui_submenu::COMMAND, __("Export XML format (like -listxml)"), "exportxml" },
+// { ui_submenu::COMMAND, __("Export TXT format (like -listfull)"), "exporttxt" },
+//};
+
+#endif /* __UI_SUBMENU_H__ */
diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp
index 7b05eb8ae4e..9e6a0579a3e 100644
--- a/src/emu/ui/ui.cpp
+++ b/src/emu/ui/ui.cpp
@@ -13,6 +13,7 @@
#include "video/vector.h"
#include "machine/laserdsc.h"
#include "render.h"
+#include "luaengine.h"
#include "cheat.h"
#include "rendfont.h"
#include "uiinput.h"
@@ -117,7 +118,7 @@ std::string ui_manager::messagebox_poptext;
rgb_t ui_manager::messagebox_backcolor;
// slider info
-slider_state *ui_manager::slider_list;
+std::vector<ui_menu_item> ui_manager::slider_list;
slider_state *ui_manager::slider_current;
@@ -127,31 +128,30 @@ slider_state *ui_manager::slider_current;
// slider controls
static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg);
-static slider_state *slider_init(running_machine &machine);
-static INT32 slider_volume(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_mixervol(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_adjuster(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_overclock(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_refresh(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_brightness(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_contrast(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_gamma(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_xscale(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_yscale(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_xoffset(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_yoffset(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_overxscale(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_overyscale(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_overxoffset(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_overyoffset(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_flicker(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_beam_width_min(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_beam_width_max(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, std::string *str, INT32 newval);
+static INT32 slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static std::string slider_get_screen_desc(screen_device &screen);
#ifdef MAME_DEBUG
-static INT32 slider_crossscale(running_machine &machine, void *arg, std::string *str, INT32 newval);
-static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string *str, INT32 newval);
+static INT32 slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
+static INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
#endif
@@ -337,7 +337,15 @@ void ui_manager::exit()
void ui_manager::initialize(running_machine &machine)
{
// initialize the on-screen display system
- slider_list = slider_current = slider_init(machine);
+ slider_list = slider_init(machine);
+ if (slider_list.size() > 0)
+ {
+ slider_current = reinterpret_cast<slider_state *>(slider_list[0].ref);
+ }
+ else
+ {
+ slider_current = nullptr;
+ }
}
@@ -481,7 +489,10 @@ void ui_manager::update_and_render(render_container *container)
// render any cheat stuff at the bottom
if (machine().phase() >= MACHINE_PHASE_RESET)
+ {
+ machine().manager().lua()->on_frame_done();
machine().cheat().render_text(*container);
+ }
// call the current UI handler
assert(m_handler_callback != nullptr);
@@ -591,9 +602,9 @@ float ui_manager::get_char_width(unicode_char ch)
// character string
//-------------------------------------------------
-float ui_manager::get_string_width(const char *s)
+float ui_manager::get_string_width(const char *s, float text_size)
{
- return get_font()->utf8string_width(get_line_height(), machine().render().ui_aspect(), s);
+ return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s);
}
@@ -1633,17 +1644,9 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co
// toggle pause
if (machine.ui_input().pressed(IPT_UI_PAUSE))
- {
- // with a shift key, it is single step
-// if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT)))
-// {
-// machine.ui().set_single_step(true);
-// machine.resume();
-// }
-// else
- machine.toggle_pause();
- }
+ machine.toggle_pause();
+ // pause single step
if (machine.ui_input().pressed(IPT_UI_PAUSE_SINGLE))
{
machine.ui().set_single_step(true);
@@ -1870,7 +1873,7 @@ UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_contain
// ui_get_slider_list - get the list of sliders
//-------------------------------------------------
-const slider_state *ui_manager::get_slider_list(void)
+std::vector<ui_menu_item>& ui_manager::get_slider_list(void)
{
return slider_list;
}
@@ -1898,43 +1901,40 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
}
-//-------------------------------------------------
-// slider_init - initialize the list of slider
+//----------------------------------------------------------
+// ui_manager::slider_init - initialize the list of slider
// controls
-//-------------------------------------------------
+//----------------------------------------------------------
-static slider_state *slider_init(running_machine &machine)
+std::vector<ui_menu_item> ui_manager::slider_init(running_machine &machine)
{
- slider_state *listhead = nullptr;
- slider_state **tailptr = &listhead;
- std::string str;
- int item;
+ std::vector<slider_state *> sliders;
// add overall volume
- *tailptr = slider_alloc(machine, _("Master Volume"), -32, 0, 0, 1, slider_volume, nullptr);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, _("Master Volume"), -32, 0, 0, 1, slider_volume, nullptr));
// add per-channel volume
mixer_input info;
- for (item = 0; machine.sound().indexed_mixer_input(item, info); item++)
+ for (int item = 0; machine.sound().indexed_mixer_input(item, info); item++)
{
INT32 maxval = 2000;
INT32 defval = 1000;
- str = string_format(_("%1$s Volume"), info.stream->input_name(info.inputnum));
- *tailptr = slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("%1$s Volume"), info.stream->input_name(info.inputnum));
+ sliders.push_back(slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item));
}
// add analog adjusters
for (ioport_port &port : machine.ioport().ports())
+ {
for (ioport_field &field : port.fields())
+ {
if (field.type() == IPT_ADJUSTER)
{
- void *param = (void *)&field;
- *tailptr = slider_alloc(machine, field.name(), field.minval(), field.defvalue(), field.maxval(), 1, slider_adjuster, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, field.name(), field.minval(), field.defvalue(), field.maxval(), 1, slider_adjuster, (void *)&field));
}
+ }
+ }
// add CPU overclocking (cheat only)
if (machine.options().cheat())
@@ -1943,9 +1943,8 @@ static slider_state *slider_init(running_machine &machine)
for (device_execute_interface *exec = iter.first(); exec != nullptr; exec = iter.next())
{
void *param = (void *)&exec->device();
- str = string_format(_("Overclock CPU %1$s"), exec->device().tag());
- *tailptr = slider_alloc(machine, str.c_str(), 10, 1000, 2000, 1, slider_overclock, param);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("Overclock CPU %1$s"), exec->device().tag());
+ sliders.push_back(slider_alloc(machine, str.c_str(), 10, 1000, 2000, 1, slider_overclock, param));
}
}
@@ -1963,39 +1962,32 @@ static slider_state *slider_init(running_machine &machine)
// add refresh rate tweaker
if (machine.options().cheat())
{
- str = string_format(_("%1$s Refresh Rate"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), -10000, 0, 10000, 1000, slider_refresh, param);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("%1$s Refresh Rate"), screen_desc);
+ sliders.push_back(slider_alloc(machine, str.c_str(), -10000, 0, 10000, 1000, slider_refresh, param));
}
// add standard brightness/contrast/gamma controls per-screen
- str = string_format(_("%1$s Brightness"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 2000, 10, slider_brightness, param);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("%1$s Brightness"), screen_desc);
+ sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 2000, 10, slider_brightness, param));
str = string_format(_("%1$s Contrast"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 2000, 50, slider_contrast, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 2000, 50, slider_contrast, param));
str = string_format(_("%1$s Gamma"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 3000, 50, slider_gamma, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 3000, 50, slider_gamma, param));
// add scale and offset controls per-screen
str = string_format(_("%1$s Horiz Stretch"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), 500, defxscale, 1500, 2, slider_xscale, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), 500, defxscale, 1500, 2, slider_xscale, param));
str = string_format(_("%1$s Horiz Position"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_xoffset, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_xoffset, param));
str = string_format(_("%1$s Vert Stretch"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), 500, defyscale, 1500, 2, slider_yscale, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), 500, defyscale, 1500, 2, slider_yscale, param));
str = string_format(_("%1$s Vert Position"), screen_desc);
- *tailptr = slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param));
}
laserdisc_device_iterator lditer(machine.root_device());
for (laserdisc_device *laserdisc = lditer.first(); laserdisc != nullptr; laserdisc = lditer.next())
+ {
if (laserdisc->overlay_configured())
{
laserdisc_overlay_config config;
@@ -2007,52 +1999,60 @@ static slider_state *slider_init(running_machine &machine)
void *param = (void *)laserdisc;
// add scale and offset controls per-overlay
- str = string_format(_("Laserdisc '%1$s' Horiz Stretch"), laserdisc->tag());
- *tailptr = slider_alloc(machine, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("Laserdisc '%1$s' Horiz Stretch"), laserdisc->tag());
+ sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param));
str = string_format(_("Laserdisc '%1$s' Horiz Position"), laserdisc->tag());
- *tailptr = slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param));
str = string_format(_("Laserdisc '%1$s' Vert Stretch"), laserdisc->tag());
- *tailptr = slider_alloc(machine, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param));
str = string_format(_("Laserdisc '%1$s' Vert Position"), laserdisc->tag());
- *tailptr = slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param));
}
+ }
for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next())
+ {
if (screen->screen_type() == SCREEN_TYPE_VECTOR)
{
// add vector control
- *tailptr = slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr);
- tailptr = &(*tailptr)->next;
- *tailptr = slider_alloc(machine, _("Beam Width Minimum"), 1, 100, 1000, 1, slider_beam_width_min, nullptr);
- tailptr = &(*tailptr)->next;
- *tailptr = slider_alloc(machine, _("Beam Width Maximum"), 1, 100, 1000, 1, slider_beam_width_max, nullptr);
- tailptr = &(*tailptr)->next;
- *tailptr = slider_alloc(machine, _("Beam Intensity Weight"), -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr));
+ sliders.push_back(slider_alloc(machine, _("Beam Width Minimum"), 1, 100, 1000, 1, slider_beam_width_min, nullptr));
+ sliders.push_back(slider_alloc(machine, _("Beam Width Maximum"), 1, 100, 1000, 1, slider_beam_width_max, nullptr));
+ sliders.push_back(slider_alloc(machine, _("Beam Intensity Weight"), -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr));
break;
}
+ }
#ifdef MAME_DEBUG
// add crosshair adjusters
for (ioport_port &port : machine.ioport().ports())
+ {
for (ioport_field &field : port.fields())
+ {
if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE && field.player() == 0)
{
- void *param = (void *)&field;
- str = string_format(_("Crosshair Scale %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
- *tailptr = slider_alloc(machine, str.c_str(), -3000, 1000, 3000, 100, slider_crossscale, param);
- tailptr = &(*tailptr)->next;
+ std::string str = string_format(_("Crosshair Scale %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
+ sliders.push_back(slider_alloc(machine, str.c_str(), -3000, 1000, 3000, 100, slider_crossscale, (void *)&field));
str = string_format(_("Crosshair Offset %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
- *tailptr = slider_alloc(machine, str.c_str(), -3000, 0, 3000, 100, slider_crossoffset, param);
- tailptr = &(*tailptr)->next;
+ sliders.push_back(slider_alloc(machine, str.c_str(), -3000, 0, 3000, 100, slider_crossoffset, (void *)&field));
}
+ }
+ }
#endif
- return listhead;
+ std::vector<ui_menu_item> items;
+ for (slider_state *slider : sliders)
+ {
+ ui_menu_item item;
+ item.text = slider->description;
+ item.subtext = "";
+ item.flags = 0;
+ item.ref = slider;
+ item.type = ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER;
+ items.push_back(item);
+ }
+
+ return items;
}
@@ -2060,7 +2060,7 @@ static slider_state *slider_init(running_machine &machine)
// slider_volume - global volume slider callback
//-------------------------------------------------
-static INT32 slider_volume(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
machine.sound().set_attenuation(newval);
@@ -2075,7 +2075,7 @@ static INT32 slider_volume(running_machine &machine, void *arg, std::string *str
// slider callback
//-------------------------------------------------
-static INT32 slider_mixervol(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
mixer_input info;
if (!machine.sound().indexed_mixer_input((FPTR)arg, info))
@@ -2097,7 +2097,7 @@ static INT32 slider_mixervol(running_machine &machine, void *arg, std::string *s
// callback
//-------------------------------------------------
-static INT32 slider_adjuster(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;
ioport_field::user_settings settings;
@@ -2119,7 +2119,7 @@ static INT32 slider_adjuster(running_machine &machine, void *arg, std::string *s
// callback
//-------------------------------------------------
-static INT32 slider_overclock(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
device_t *cpu = (device_t *)arg;
if (newval != SLIDER_NOCHANGE)
@@ -2134,7 +2134,7 @@ static INT32 slider_overclock(running_machine &machine, void *arg, std::string *
// slider_refresh - refresh rate slider callback
//-------------------------------------------------
-static INT32 slider_refresh(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
double defrefresh = ATTOSECONDS_TO_HZ(screen->refresh_attoseconds());
@@ -2159,7 +2159,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, std::string *st
// callback
//-------------------------------------------------
-static INT32 slider_brightness(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2181,7 +2181,7 @@ static INT32 slider_brightness(running_machine &machine, void *arg, std::string
// callback
//-------------------------------------------------
-static INT32 slider_contrast(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2202,7 +2202,7 @@ static INT32 slider_contrast(running_machine &machine, void *arg, std::string *s
// slider_gamma - screen gamma slider callback
//-------------------------------------------------
-static INT32 slider_gamma(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2224,7 +2224,7 @@ static INT32 slider_gamma(running_machine &machine, void *arg, std::string *str,
// callback
//-------------------------------------------------
-static INT32 slider_xscale(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2246,7 +2246,7 @@ static INT32 slider_xscale(running_machine &machine, void *arg, std::string *str
// callback
//-------------------------------------------------
-static INT32 slider_yscale(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2268,7 +2268,7 @@ static INT32 slider_yscale(running_machine &machine, void *arg, std::string *str
// slider callback
//-------------------------------------------------
-static INT32 slider_xoffset(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2290,7 +2290,7 @@ static INT32 slider_xoffset(running_machine &machine, void *arg, std::string *st
// slider callback
//-------------------------------------------------
-static INT32 slider_yoffset(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@@ -2312,7 +2312,7 @@ static INT32 slider_yoffset(running_machine &machine, void *arg, std::string *st
// callback
//-------------------------------------------------
-static INT32 slider_overxscale(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@@ -2334,7 +2334,7 @@ static INT32 slider_overxscale(running_machine &machine, void *arg, std::string
// callback
//-------------------------------------------------
-static INT32 slider_overyscale(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@@ -2356,7 +2356,7 @@ static INT32 slider_overyscale(running_machine &machine, void *arg, std::string
// slider callback
//-------------------------------------------------
-static INT32 slider_overxoffset(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@@ -2378,7 +2378,7 @@ static INT32 slider_overxoffset(running_machine &machine, void *arg, std::string
// slider callback
//-------------------------------------------------
-static INT32 slider_overyoffset(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@@ -2400,7 +2400,7 @@ static INT32 slider_overyoffset(running_machine &machine, void *arg, std::string
// callback
//-------------------------------------------------
-static INT32 slider_flicker(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
vector_device *vector = nullptr;
if (newval != SLIDER_NOCHANGE)
@@ -2416,7 +2416,7 @@ static INT32 slider_flicker(running_machine &machine, void *arg, std::string *st
// callback
//-------------------------------------------------
-static INT32 slider_beam_width_min(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
vector_device *vector = nullptr;
if (newval != SLIDER_NOCHANGE)
@@ -2432,7 +2432,7 @@ static INT32 slider_beam_width_min(running_machine &machine, void *arg, std::str
// callback
//-------------------------------------------------
-static INT32 slider_beam_width_max(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
vector_device *vector = nullptr;
if (newval != SLIDER_NOCHANGE)
@@ -2448,7 +2448,7 @@ static INT32 slider_beam_width_max(running_machine &machine, void *arg, std::str
// callback
//-------------------------------------------------
-static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
vector_device *vector = nullptr;
if (newval != SLIDER_NOCHANGE)
@@ -2481,7 +2481,7 @@ static std::string slider_get_screen_desc(screen_device &screen)
//-------------------------------------------------
#ifdef MAME_DEBUG
-static INT32 slider_crossscale(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;
@@ -2500,7 +2500,7 @@ static INT32 slider_crossscale(running_machine &machine, void *arg, std::string
//-------------------------------------------------
#ifdef MAME_DEBUG
-static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;
@@ -2685,16 +2685,6 @@ void ui_manager::draw_textured_box(render_container *container, float x0, float
}
//-------------------------------------------------
-// get_string_width_ex - return the width of a
-// character string with given text size
-//-------------------------------------------------
-
-float ui_manager::get_string_width_ex(const char *s, float text_size)
-{
- return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s);
-}
-
-//-------------------------------------------------
// decode UI color options
//-------------------------------------------------
diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h
index 8639c1fba27..ad6c3d11ae1 100644
--- a/src/emu/ui/ui.h
+++ b/src/emu/ui/ui.h
@@ -13,9 +13,13 @@
#ifndef __USRINTRF_H__
#define __USRINTRF_H__
+#include <vector>
+
#include "render.h"
#include "moptions.h"
+class ui_menu_item;
+
/***************************************************************************
CONSTANTS
***************************************************************************/
@@ -92,7 +96,7 @@ enum
typedef UINT32 (*ui_callback)(running_machine &, render_container *, UINT32);
-typedef INT32(*slider_update)(running_machine &machine, void *arg, std::string *str, INT32 newval);
+typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
struct slider_state
{
@@ -128,6 +132,7 @@ public:
// methods
void initialize(running_machine &machine);
+ std::vector<ui_menu_item> slider_init(running_machine &machine);
UINT32 set_handler(ui_callback callback, UINT32 param);
void display_startup_screens(bool first_time);
void set_startup_text(const char *text, bool force);
@@ -135,7 +140,7 @@ public:
render_font *get_font();
float get_line_height();
float get_char_width(unicode_char ch);
- float get_string_width(const char *s);
+ float get_string_width(const char *s, float text_size = 1.0f);
void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);
void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor);
void draw_text(render_container *container, const char *buf, float x, float y);
@@ -166,7 +171,7 @@ public:
std::string &game_info_astring(std::string &str);
// slider controls
- const slider_state *get_slider_list(void);
+ std::vector<ui_menu_item>& get_slider_list(void);
// other
void process_natural_keyboard();
@@ -181,9 +186,6 @@ public:
// draw an outlined box with given line color and filled with a texture
void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- // return text string width with given text size
- float get_string_width_ex(const char *s, float text_size);
-
private:
// instance variables
running_machine & m_machine;
@@ -209,7 +211,7 @@ private:
static std::string messagebox_poptext;
static rgb_t messagebox_backcolor;
- static slider_state *slider_list;
+ static std::vector<ui_menu_item> slider_list;
static slider_state *slider_current;
// text generators
diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp
index 1e998d04c9d..6a59208cd30 100644
--- a/src/emu/ui/utils.cpp
+++ b/src/emu/ui/utils.cpp
@@ -84,6 +84,15 @@ const char* strensure(const char* s)
return s == nullptr ? "" : s;
}
+int getprecisionchr(const char* s)
+{
+ int precision = 1;
+ char *dp = const_cast<char *>(strchr(s, '.'));
+ if (dp != nullptr)
+ precision = strlen(s) - (dp - s) - 1;
+ return precision;
+}
+
//-------------------------------------------------
// search a substring with even partial matching
//-------------------------------------------------
diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h
index 81107c0911c..519f74e667b 100644
--- a/src/emu/ui/utils.h
+++ b/src/emu/ui/utils.h
@@ -254,5 +254,6 @@ char* chartrimcarriage(char str[]);
const char* strensure(const char* s);
+int getprecisionchr(const char* s);
#endif /* __UI_UTILS_H__ */
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index 19742fc9b31..684b2687ba1 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -18,10 +18,10 @@ SRC = ..
CDEFS = -DPSTANDALONE=1 -DPTR64=1
#-Werror
-CFLAGS = $(LTO) -g -O3 -std=c++98 -Doverride="" -march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unused-result -Wno-variadic-macros -I..
-LDFLAGS = $(LTO) -g -O3 -std=c++98
-#CFLAGS = $(LTO) -g -O3 -std=c++11 -Wall -Wpedantic -Wsign-compare -Wextra -Isrc
-#LDFLAGS = $(LTO) -g -O3 -std=c++11
+#CFLAGS = $(LTO) -g -O3 -std=c++98 -Doverride="" -march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unused-result -Wno-variadic-macros -I..
+#LDFLAGS = $(LTO) -g -O3 -std=c++98
+CFLAGS = $(LTO) -g -O3 -std=c++11 -march=native -I.. -Wall -Wpedantic -Wsign-compare -Wextra -Wno-unused-parameter
+LDFLAGS = $(LTO) -g -O3 -std=c++11 -lpthread
CC = @g++-5
LD = @g++-5
@@ -66,7 +66,6 @@ NLOBJS := \
$(NLOBJ)/analog/nld_opamps.o \
$(NLOBJ)/devices/nld_4020.o \
$(NLOBJ)/devices/nld_4066.o \
- $(NLOBJ)/devices/nld_7400.o \
$(NLOBJ)/devices/nld_7402.o \
$(NLOBJ)/devices/nld_7404.o \
$(NLOBJ)/devices/nld_7408.o \
diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h
index 8ea3640ec14..7b9cb7298e5 100644
--- a/src/lib/netlist/devices/nld_system.h
+++ b/src/lib/netlist/devices/nld_system.h
@@ -479,10 +479,10 @@ public:
const pstring &def_param)
: base_factory_t(name, classname, def_param), m_setup(setup) { }
- class dummy : public device_t
+ class wrapper : public device_t
{
public:
- dummy(const pstring &dev_name) : device_t(), m_dev_name(dev_name) { }
+ wrapper(const pstring &dev_name) : device_t(), m_dev_name(dev_name) { }
protected:
virtual void init(netlist_t &anetlist, const pstring &aname) override
{
@@ -499,7 +499,7 @@ public:
ATTR_COLD device_t *Create() override
{
- device_t *r = palloc(dummy(this->name()));
+ device_t *r = palloc(wrapper(this->name()));
return r;
}
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp
index ed74a8e305c..96038049473 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.cpp
+++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp
@@ -30,7 +30,7 @@ NETLIST_START(TTL_7416_DIP)
s3.A, /* A3 |5 10| Y5 */ s5.Q,
s3.Q, /* Y3 |6 9| A4 */ s4.A,
GND.I, /* GND |7 8| Y4 */ s4.Q
- /* +--------------+ */
+ /* +--------------+ */
)
NETLIST_END()
@@ -69,7 +69,7 @@ NETLIST_START(TTL_7400_DIP)
s2.B, /* B2 |5 10| B3 */ s3.B,
s2.Q, /* Y2 |6 9| A3 */ s3.A,
GND.I, /* GND |7 8| Y3 */ s3.Q
- /* +--------------+ */
+ /* +--------------+ */
)
NETLIST_END()
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx.h
index cd502aa4782..763ee5620ca 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.h
+++ b/src/lib/netlist/macro/nlm_ttl74xx.h
@@ -14,8 +14,8 @@
#define TTL_7400_GATE(_name) \
NET_REGISTER_DEV(TTL_7400_GATE, _name)
#define TTL_7400_NAND(_name, _A, _B) \
- NET_REGISTER_DEV(TTL_7400_NAND, _name) \
- NET_CONNECT(_name, A, _A) \
+ NET_REGISTER_DEV(TTL_7400_NAND, _name) \
+ NET_CONNECT(_name, A, _A) \
NET_CONNECT(_name, B, _B)
#define TTL_7400_DIP(_name) \
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 7afa0285ef8..eb83749c79b 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -74,13 +74,12 @@ logic_family_desc_t *family_CD4XXX = palloc(logic_family_cd4xxx_t);
queue_t::queue_t(netlist_t &nl)
: timed_queue<net_t *, netlist_time>(512)
- , object_t(QUEUE, GENERIC)
+ , object_t(nl, "QUEUE", QUEUE, GENERIC)
, pstate_callback_t()
, m_qsize(0)
, m_times(512)
, m_names(512)
{
- this->init_object(nl, "QUEUE");
}
void queue_t::register_state(pstate_manager_t &manager, const pstring &module)
@@ -128,13 +127,33 @@ void queue_t::on_post_load()
ATTR_COLD object_t::object_t(const type_t atype, const family_t afamily)
: m_objtype(atype)
, m_family(afamily)
-, m_netlist(NULL)
+, m_netlist(nullptr)
{}
+ATTR_COLD object_t::object_t(netlist_t &nl, const type_t atype, const family_t afamily)
+: m_objtype(atype)
+, m_family(afamily)
+, m_netlist(&nl)
+{}
+
+ATTR_COLD object_t::object_t(netlist_t &nl, const pstring &aname, const type_t atype, const family_t afamily)
+: m_name(aname)
+, m_objtype(atype)
+, m_family(afamily)
+, m_netlist(&nl)
+{
+}
+
ATTR_COLD object_t::~object_t()
{
}
+ATTR_COLD void object_t::init_object(const pstring &aname)
+{
+ m_name = aname;
+ save_register();
+}
+
ATTR_COLD void object_t::init_object(netlist_t &nl, const pstring &aname)
{
m_netlist = &nl;
@@ -171,8 +190,8 @@ ATTR_COLD void device_object_t::init_object(core_device_t &dev,
// netlist_t
// ----------------------------------------------------------------------------------------
-netlist_t::netlist_t()
- : object_t(NETLIST, GENERIC), pstate_manager_t(),
+netlist_t::netlist_t(const pstring &aname)
+ : pstate_manager_t(),
m_stop(netlist_time::zero),
m_time(netlist_time::zero),
m_use_deactivate(0),
@@ -181,9 +200,12 @@ netlist_t::netlist_t()
m_solver(NULL),
m_gnd(NULL),
m_params(NULL),
+ m_name(aname),
m_setup(NULL),
m_log(this)
{
+ save_item(static_cast<pstate_callback_t &>(m_queue), this, "m_queue");
+ save_item(m_time, this, "m_time");
}
netlist_t::~netlist_t()
@@ -202,13 +224,6 @@ netlist_t::~netlist_t()
pstring::resetmem();
}
-ATTR_COLD void netlist_t::save_register()
-{
- save(static_cast<pstate_callback_t &>(m_queue), "m_queue");
- save(NLNAME(m_time));
- object_t::save_register();
-}
-
ATTR_HOT nl_double netlist_t::gmin() const
{
return solver()->gmin();
@@ -925,6 +940,19 @@ ATTR_COLD analog_output_t::analog_output_t()
net().m_cur_Analog = NL_FCONST(0.99);
}
+ATTR_COLD analog_output_t::analog_output_t(core_device_t &dev, const pstring &aname)
+ : analog_t(OUTPUT), m_proxied_net(NULL)
+{
+ this->set_net(m_my_net);
+ set_state(STATE_OUT);
+
+ net().m_cur_Analog = NL_FCONST(0.99);
+
+ analog_t::init_object(dev, aname);
+ net().init_object(dev.netlist(), aname + ".net");
+ net().register_railterminal(*this);
+}
+
ATTR_COLD void analog_output_t::init_object(core_device_t &dev, const pstring &aname)
{
analog_t::init_object(dev, aname);
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 52a91704607..3b6eb7b75e1 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -367,7 +367,7 @@ namespace netlist
// object_t
// -----------------------------------------------------------------------------
- class object_t
+ class object_t : public pstate_interface_t<object_t>
{
P_PREVENT_COPYING(object_t)
public:
@@ -378,8 +378,7 @@ namespace netlist
PARAM = 3,
NET = 4,
DEVICE = 5,
- NETLIST = 6,
- QUEUE = 7
+ QUEUE = 6
};
enum family_t {
// Terminal families
@@ -405,15 +404,18 @@ namespace netlist
};
ATTR_COLD object_t(const type_t atype, const family_t afamily);
+ ATTR_COLD object_t(netlist_t &nl, const type_t atype, const family_t afamily);
+ ATTR_COLD object_t(netlist_t &nl, const pstring &aname, const type_t atype, const family_t afamily);
virtual ~object_t();
+ ATTR_COLD void init_object(const pstring &aname);
ATTR_COLD void init_object(netlist_t &nl, const pstring &aname);
ATTR_COLD bool isInitialized() { return (m_netlist != NULL); }
ATTR_COLD const pstring &name() const;
- PSTATE_INTERFACE_DECL()
+ ATTR_COLD inline pstate_manager_t *state_manager();
ATTR_HOT type_t type() const { return m_objtype; }
ATTR_HOT family_t family() const { return m_family; }
@@ -904,6 +906,7 @@ namespace netlist
P_PREVENT_COPYING(analog_output_t)
public:
+ ATTR_COLD analog_output_t(core_device_t &dev, const pstring &aname);
ATTR_COLD analog_output_t();
ATTR_COLD void init_object(core_device_t &dev, const pstring &aname);
@@ -1183,14 +1186,16 @@ namespace netlist
// -----------------------------------------------------------------------------
- class netlist_t : public object_t, public pstate_manager_t, public plog_dispatch_intf
+ class netlist_t : public pstate_manager_t, public plog_dispatch_intf
{
P_PREVENT_COPYING(netlist_t)
public:
- netlist_t();
+ netlist_t(const pstring &aname);
virtual ~netlist_t();
+ pstring name() const { return m_name; }
+
ATTR_COLD void start();
ATTR_COLD void stop();
@@ -1265,14 +1270,12 @@ namespace netlist
pnamedlist_t<core_device_t *> m_started_devices;
#endif
- ATTR_COLD plog_base<NL_DEBUG> &log() { return m_log; }
- ATTR_COLD const plog_base<NL_DEBUG> &log() const { return m_log; }
+ ATTR_COLD plog_base<NL_DEBUG> &log() { return m_log; }
+ ATTR_COLD const plog_base<NL_DEBUG> &log() const { return m_log; }
- protected:
+ virtual void reset();
- /* from object */
- virtual void reset() override;
- virtual void save_register() override;
+ protected:
#if (NL_KEEP_STATISTICS)
// performance
@@ -1288,13 +1291,13 @@ namespace netlist
bool m_use_deactivate;
queue_t m_queue;
-
devices::NETLIB_NAME(mainclock) * m_mainclock;
devices::NETLIB_NAME(solver) * m_solver;
devices::NETLIB_NAME(gnd) * m_gnd;
-
devices::NETLIB_NAME(netlistparams) *m_params;
+
+ pstring m_name;
setup_t *m_setup;
plog_base<NL_DEBUG> m_log;
};
@@ -1303,7 +1306,10 @@ namespace netlist
// inline implementations
// -----------------------------------------------------------------------------
- PSTATE_INTERFACE(object_t, m_netlist, name())
+ ATTR_COLD inline pstate_manager_t *object_t::state_manager()
+ {
+ return m_netlist;
+ }
template <class C, param_t::param_type_t T>
ATTR_HOT inline void param_template_t<C, T>::setTo(const C &param)
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 399fe86d213..dad17991b87 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -197,8 +197,6 @@ pstring setup_t::objtype_as_astr(object_t &in) const
return "PARAM";
case terminal_t::DEVICE:
return "DEVICE";
- case terminal_t::NETLIST:
- return "NETLIST";
case terminal_t::QUEUE:
return "QUEUE";
}
@@ -283,9 +281,6 @@ void setup_t::register_object(device_t &dev, const pstring &name, object_t &obj)
case terminal_t::DEVICE:
log().fatal("Device registration not yet supported - {1}\n", name);
break;
- case terminal_t::NETLIST:
- log().fatal("Netlist registration not yet supported - {1}\n", name);
- break;
case terminal_t::QUEUE:
log().fatal("QUEUE registration not yet supported - {1}\n", name);
break;
diff --git a/src/lib/netlist/nl_util.h b/src/lib/netlist/nl_util.h
index 87ec2270231..50c545c22e3 100644
--- a/src/lib/netlist/nl_util.h
+++ b/src/lib/netlist/nl_util.h
@@ -11,6 +11,7 @@
#include <cmath>
#include <cstring>
#include <cstdlib>
+#include <algorithm>
#include "plib/pstring.h"
#include "plib/plists.h"
@@ -40,26 +41,35 @@ private:
nl_math() {};
public:
- ATTR_HOT inline static float exp(const float x) { return std::exp(x); }
- ATTR_HOT inline static double abs(const double x) { return std::fabs(x); }
- ATTR_HOT inline static float abs(const float x) { return std::fabs(x); }
- ATTR_HOT inline static double log(const double x) { return std::log(x); }
- ATTR_HOT inline static float log(const float x) { return std::log(x); }
-#if defined(_MSC_VER) && _MSC_VER < 1800
- ATTR_HOT inline static double e_log1p(const double x) { return nl_math::log(1.0 + x); }
- ATTR_HOT inline static float e_log1p(const float x) { return nl_math::log(1.0 + x); }
+ template <typename T>
+ static T abs(const T &x) { return std::abs(x); }
+
+ template <typename T>
+ static T max(const T &x, const T &y) { return std::max(x, y); }
+
+ template <typename T>
+ static T min(const T &x, const T &y) { return std::min(x, y); }
+
+ template <typename T>
+ static T log(const T &x) { return std::log(x); }
+
+ #if defined(_MSC_VER) && _MSC_VER < 1800
+ ATTR_HOT inline static double e_log1p(const double &x) { return nl_math::log(1.0 + x); }
+ ATTR_HOT inline static float e_log1p(const float &x) { return nl_math::log(1.0 + x); }
#else
- ATTR_HOT inline static double e_log1p(const double x) { return log1p(x); }
- ATTR_HOT inline static float e_log1p(const float x) { return log1pf(x); }
+ template <typename T>
+ static T e_log1p(const T &x) { return log1p(x); }
#endif
- ATTR_HOT inline static double sqrt(const double x) { return std::sqrt(x); }
- ATTR_HOT inline static float sqrt(const float x) { return std::sqrt(x); }
+
+ template <typename T>
+ static T sqrt(const T &x) { return std::sqrt(x); }
// this one has an accuracy of better than 5%. That's enough for our purpose
// add c3 and it'll be better than 1%
#if 0
- inline static double fastexp_h(const double x)
+ ATTR_HOT inline static float exp(const float &x) { return std::exp(x); }
+ inline static double fastexp_h(const double &x)
{
/* static */ const double ln2r = 1.442695040888963387;
/* static */ const double ln2 = 0.693147180559945286;
@@ -79,7 +89,7 @@ public:
return pow(2.0, t)*e;
}
- ATTR_HOT inline static double exp(const double x)
+ ATTR_HOT inline static double exp(const double &x)
{
if (x<0)
return 1.0 / fastexp_h(-x);
@@ -87,7 +97,8 @@ public:
return fastexp_h(x);
}
#else
- ATTR_HOT inline static double exp(const double x) { return std::exp(x); }
+ template <typename T>
+ static double exp(const T &x) { return std::exp(x); }
#endif
};
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h
index f5d395f4628..43aa28a229a 100644
--- a/src/lib/netlist/plib/plists.h
+++ b/src/lib/netlist/plib/plists.h
@@ -126,7 +126,7 @@ public:
int indexof(const _ListClass &elem) const
{
- for (int i = 0; i < this->size(); i++)
+ for (unsigned i = 0; i < this->size(); i++)
{
if (this->at(i) == elem)
return i;
diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h
index 91c67ee0e1c..88c0c005927 100644
--- a/src/lib/netlist/plib/pstate.h
+++ b/src/lib/netlist/plib/pstate.h
@@ -15,19 +15,6 @@
// state saving ...
// ----------------------------------------------------------------------------------------
-#define PSTATE_INTERFACE_DECL() \
- template<typename C> ATTR_COLD void save(C &state, const pstring &stname); \
- template<typename C, std::size_t N> ATTR_COLD void save(C (&state)[N], const pstring &stname); \
- template<typename C> ATTR_COLD void save(C *state, const pstring &stname, const int count);
-
-#define PSTATE_INTERFACE(obj, manager, module) \
- template<typename C> ATTR_COLD void obj::save(C &state, const pstring &stname) \
- { manager->save_item(state, this, module + "." + stname); } \
- template<typename C, std::size_t N> ATTR_COLD void obj::save(C (&state)[N], const pstring &stname) \
- { manager->save_state_ptr(module + "." + stname, pstate_datatype<C>::type, this, sizeof(state[0]), N, &(state[0]), false); } \
- template<typename C> ATTR_COLD void obj::save(C *state, const pstring &stname, const int count) \
- { manager->save_state_ptr(module + "." + stname, pstate_datatype<C>::type, this, sizeof(C), count, state, false); }
-
enum pstate_data_type_e {
NOT_SUPPORTED,
DT_CUSTOM,
@@ -148,6 +135,12 @@ public:
save_state_ptr(stname, pstate_datatype<C>::type, owner, sizeof(C), count, state, false);
}
+ template<typename C>
+ void save_item(std::vector<C> &v, const void *owner, const pstring &stname)
+ {
+ save_state(v.data(), owner, stname, v.size());
+ }
+
ATTR_COLD void pre_save();
ATTR_COLD void post_load();
ATTR_COLD void remove_save_items(const void *owner);
@@ -164,5 +157,31 @@ private:
template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname);
+template <typename T>
+class pstate_interface_t
+{
+public:
+ pstate_interface_t() { }
+
+ template<typename C> void save(C &state, const pstring &stname)
+ {
+ pstate_manager_t *manager = static_cast<T*>(this)->state_manager();
+ pstring module = static_cast<T*>(this)->name();
+ manager->save_item(state, this, module + "." + stname);
+ }
+ template<typename C, std::size_t N> ATTR_COLD void save(C (&state)[N], const pstring &stname)
+ {
+ pstate_manager_t *manager = static_cast<T*>(this)->state_manager();
+ pstring module = static_cast<T*>(this)->name();
+ manager->save_state_ptr(module + "." + stname, pstate_datatype<C>::type, this, sizeof(state[0]), N, &(state[0]), false);
+ }
+ template<typename C> ATTR_COLD void save(C *state, const pstring &stname, const int count)
+ {
+ pstate_manager_t *manager = static_cast<T*>(this)->state_manager();
+ pstring module = static_cast<T*>(this)->name();
+ manager->save_state_ptr(module + "." + stname, pstate_datatype<C>::type, this, sizeof(C), count, state, false);
+ }
+};
+
#endif /* PSTATE_H_ */
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index ea5211a3c87..6d34683731e 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -145,8 +145,8 @@ class netlist_tool_t : public netlist::netlist_t
{
public:
- netlist_tool_t()
- : netlist::netlist_t(), m_opts(NULL), m_setup(NULL)
+ netlist_tool_t(const pstring &aname)
+ : netlist::netlist_t(aname), m_opts(NULL), m_setup(NULL)
{
}
@@ -159,7 +159,6 @@ public:
void init()
{
m_setup = palloc(netlist::setup_t(this));
- this->init_object(*this, "netlist");
m_setup->init();
}
@@ -281,7 +280,7 @@ pvector_t<input_t> *read_input(netlist::netlist_t *netlist, pstring fname)
static void run(tool_options_t &opts)
{
- netlist_tool_t nt;
+ netlist_tool_t nt("netlist");
osd_ticks_t t = osd_ticks();
nt.m_opts = &opts;
@@ -326,7 +325,7 @@ static void run(tool_options_t &opts)
static void listdevices()
{
- netlist_tool_t nt;
+ netlist_tool_t nt("netlist");
nt.init();
const netlist::factory_list_t &list = nt.setup().factory();
diff --git a/src/lib/netlist/solver/mat_cr.h b/src/lib/netlist/solver/mat_cr.h
index ea72884c1de..d259fa40df1 100644
--- a/src/lib/netlist/solver/mat_cr.h
+++ b/src/lib/netlist/solver/mat_cr.h
@@ -34,7 +34,7 @@ struct mat_cr_t
while (k < oe)
{
- double tmp = 0.0;
+ T tmp = 0.0;
const unsigned e = ia[i+1];
for (; k < e; k++)
tmp += A[k] * x[ja[k]];
@@ -42,7 +42,8 @@ struct mat_cr_t
}
}
- void incomplete_LU_factorization(const nl_double * RESTRICT A, nl_double * RESTRICT LU)
+ template<typename T>
+ void incomplete_LU_factorization(const T * RESTRICT A, T * RESTRICT LU)
{
/*
* incomplete LU Factorization according to http://de.wikipedia.org/wiki/ILU-Zerlegung
@@ -64,7 +65,7 @@ struct mat_cr_t
// pk == (i, k)
const unsigned k = ja[pk];
const unsigned iak1 = ia[k + 1];
- const double LUpk = LU[pk] = LU[pk] / LU[diag[k]];
+ const T LUpk = LU[pk] = LU[pk] / LU[diag[k]];
unsigned pt = ia[k];
@@ -81,7 +82,8 @@ struct mat_cr_t
}
}
- void solveLUx (const nl_double * RESTRICT LU, nl_double * RESTRICT r)
+ template<typename T>
+ void solveLUx (const T * RESTRICT LU, T * RESTRICT r)
{
/*
* Solve a linear equation Ax = r
@@ -109,7 +111,7 @@ struct mat_cr_t
for (i = 1; ia[i] < nz_num; i++ )
{
- double tmp = 0.0;
+ T tmp = 0.0;
const unsigned j1 = ia[i];
const unsigned j2 = diag[i];
@@ -122,7 +124,7 @@ struct mat_cr_t
for (; 0 < i; i-- )
{
const unsigned im1 = i - 1;
- double tmp = 0.0;
+ T tmp = 0.0;
const unsigned j1 = diag[im1] + 1;
const unsigned j2 = ia[im1+1];
for (unsigned j = j1; j < j2; j++ )
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 715eab6756a..58947144ff5 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -10,14 +10,16 @@
#include "solver/nld_solver.h"
+#include <type_traits>
+
NETLIB_NAMESPACE_DEVICES_START()
class terms_t
{
P_PREVENT_COPYING(terms_t)
- public:
- ATTR_COLD terms_t() : m_railstart(0)
+public:
+ ATTR_COLD terms_t() : m_railstart(0), m_last_V(0)
{}
ATTR_COLD void clear()
@@ -48,6 +50,10 @@ class terms_t
pvector_t<unsigned> m_nz; /* all non zero for multiplication */
pvector_t<unsigned> m_nzrd; /* non zero right of the diagonal for elimination, may include RHS element */
pvector_t<unsigned> m_nzbd; /* non zero below of the diagonal for elimination */
+
+ /* state */
+ nl_double m_last_V;
+
private:
pvector_t<terminal_t *> m_term;
pvector_t<int> m_net_other;
@@ -55,6 +61,7 @@ private:
pvector_t<nl_double> m_gt;
pvector_t<nl_double> m_Idr;
pvector_t<nl_double *> m_other_curanalog;
+
};
class matrix_solver_t : public device_t
@@ -104,14 +111,28 @@ protected:
ATTR_COLD void setup_base(analog_net_t::list_t &nets);
void update_dynamic();
- virtual void add_term(int net_idx, terminal_t *term) = 0;
virtual void vsetup(analog_net_t::list_t &nets) = 0;
virtual int vsolve_non_dynamic(const bool newton_raphson) = 0;
- virtual netlist_time compute_next_timestep() = 0;
+ /* virtual */ netlist_time compute_next_timestep();
+ /* virtual */ void add_term(int net_idx, terminal_t *term);
+
+ template <typename T>
+ void store(const T * RESTRICT V);
+ template <typename T>
+ T delta(const T * RESTRICT V);
+
+ template <typename T>
+ void build_LE_A(T & child);
+ template <typename T>
+ void build_LE_RHS(T & child);
+
+ pvector_t<terms_t *> m_terms;
pvector_t<analog_net_t *> m_nets;
pvector_t<analog_output_t *> m_inps;
+ pvector_t<terms_t *> m_rails_temp;
+
int m_stat_calculations;
int m_stat_newton_raphson;
int m_stat_vsolver_calls;
@@ -138,6 +159,83 @@ private:
const eSolverType m_type;
};
+template <typename T>
+T matrix_solver_t::delta(const T * RESTRICT V)
+{
+ /* FIXME: Ideally we should also include currents (RHS) here. This would
+ * need a revaluation of the right hand side after voltages have been updated
+ * and thus belong into a different calculation. This applies to all solvers.
+ */
+
+ const unsigned iN = this->m_terms.size();
+ T cerr = 0;
+ for (unsigned i = 0; i < iN; i++)
+ cerr = nl_math::max(cerr, nl_math::abs(V[i] - (T) this->m_nets[i]->m_cur_Analog));
+ return cerr;
+}
+
+template <typename T>
+void matrix_solver_t::store(const T * RESTRICT V)
+{
+ for (unsigned i = 0, iN=m_terms.size(); i < iN; i++)
+ this->m_nets[i]->m_cur_Analog = V[i];
+}
+
+template <typename T>
+void matrix_solver_t::build_LE_A(T & child)
+{
+ static_assert(std::is_base_of<matrix_solver_t, T>::value, "T must derive from matrix_solver_t");
+
+ const unsigned iN = child.N();
+ for (unsigned k = 0; k < iN; k++)
+ {
+ for (unsigned i=0; i < iN; i++)
+ child.A(k,i) = 0.0;
+
+ const unsigned terms_count = m_terms[k]->count();
+ const unsigned railstart = m_terms[k]->m_railstart;
+ const nl_double * RESTRICT gt = m_terms[k]->gt();
+
+ {
+ nl_double akk = 0.0;
+ for (unsigned i = 0; i < terms_count; i++)
+ akk += gt[i];
+
+ child.A(k,k) = akk;
+ }
+
+ const nl_double * RESTRICT go = m_terms[k]->go();
+ const int * RESTRICT net_other = m_terms[k]->net_other();
+
+ for (unsigned i = 0; i < railstart; i++)
+ child.A(k,net_other[i]) -= go[i];
+ }
+}
+
+template <typename T>
+void matrix_solver_t::build_LE_RHS(T & child)
+{
+ const unsigned iN = child.N();
+ for (unsigned k = 0; k < iN; k++)
+ {
+ nl_double rhsk_a = 0.0;
+ nl_double rhsk_b = 0.0;
+
+ const unsigned terms_count = m_terms[k]->count();
+ const nl_double * RESTRICT go = m_terms[k]->go();
+ const nl_double * RESTRICT Idr = m_terms[k]->Idr();
+ const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
+
+ for (unsigned i = 0; i < terms_count; i++)
+ rhsk_a = rhsk_a + Idr[i];
+
+ for (unsigned i = m_terms[k]->m_railstart; i < terms_count; i++)
+ //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
+ rhsk_b = rhsk_b + go[i] * *other_cur_analog[i];
+
+ child.RHS(k) = rhsk_a + rhsk_b;
+ }
+}
NETLIB_NAMESPACE_DEVICES_END()
diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h
index 0badcdce863..2b0ae80b855 100644
--- a/src/lib/netlist/solver/nld_ms_direct.h
+++ b/src/lib/netlist/solver/nld_ms_direct.h
@@ -11,6 +11,7 @@
#include <algorithm>
#include "solver/nld_solver.h"
+#include "solver/nld_matrix_solver.h"
#include "solver/vector_base.h"
/* Disabling dynamic allocation gives a ~10% boost in performance
@@ -18,7 +19,12 @@
* going forward in case we implement cuda solvers in the future.
*/
#define NL_USE_DYNAMIC_ALLOCATION (0)
+#define TEST_PARALLEL (0)
+#if TEST_PARALLEL
+#include <thread>
+#include <atomic>
+#endif
NETLIB_NAMESPACE_DEVICES_START()
@@ -26,9 +32,93 @@ NETLIB_NAMESPACE_DEVICES_START()
//#define nl_ext_double long double // slightly slower
#define nl_ext_double nl_double
+#if TEST_PARALLEL
+#define MAXTHR 10
+static const int num_thr = 2;
+
+struct thr_intf
+{
+ virtual void do_work(const int id, void *param) = 0;
+};
+
+struct ti_t
+{
+ volatile std::atomic<int> lo;
+ thr_intf *intf;
+ void *params;
+ int _block[29]; /* make it 256 bytes */
+};
+
+static ti_t ti[MAXTHR];
+static std::thread thr[MAXTHR];
+
+int thr_init = 0;
+
+static void thr_process_proc(int id)
+{
+ while (true)
+ {
+ while (ti[id].lo.load() == 0)
+ ;
+ if (ti[id].lo.load() == 2)
+ return;
+ ti[id].intf->do_work(id, ti[id].params);
+ ti[id].lo.store(0);
+ }
+}
+
+static void thr_process(int id, thr_intf *intf, void *params)
+{
+ ti[id].intf = intf;
+ ti[id].params = params;
+ ti[id].lo.store(1);
+}
+
+static void thr_wait()
+{
+ int c=1;
+ while (c > 0)
+ {
+ c=0;
+ for (int i=0; i<num_thr; i++)
+ c += ti[i].lo.load();
+ }
+}
+
+static void thr_initialize()
+{
+ thr_init++;
+ if (thr_init == 1)
+ {
+ for (int i=0; i<num_thr; i++)
+ {
+ ti[i].lo = 0;
+ thr[i] = std::thread(thr_process_proc, i);
+ }
+ }
+}
+
+static void thr_dispose()
+{
+ thr_init--;
+ if (thr_init == 0)
+ {
+ for (int i=0; i<num_thr; i++)
+ ti[i].lo = 2;
+ for (int i=0; i<num_thr; i++)
+ thr[i].join();
+ }
+}
+#endif
+
template <unsigned m_N, unsigned _storage_N>
+#if TEST_PARALLEL
+class matrix_solver_direct_t: public matrix_solver_t, public thr_intf
+#else
class matrix_solver_direct_t: public matrix_solver_t
+#endif
{
+ friend class matrix_solver_t;
public:
matrix_solver_direct_t(const solver_parameters_t *params, const int size);
@@ -40,26 +130,22 @@ public:
virtual void reset() override { matrix_solver_t::reset(); }
protected:
- virtual void add_term(int net_idx, terminal_t *term) override;
virtual int vsolve_non_dynamic(const bool newton_raphson) override;
int solve_non_dynamic(const bool newton_raphson);
- inline const unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
+ inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
- void build_LE_A();
- void build_LE_RHS();
void LE_solve();
template <typename T>
void LE_back_subst(T * RESTRICT x);
- template <typename T>
- T delta(const T * RESTRICT V);
-
- template <typename T>
- void store(const T * RESTRICT V);
-
- virtual netlist_time compute_next_timestep() override;
+#if TEST_PARALLEL
+ int x_i[10];
+ int x_start[10];
+ int x_stop[10];
+ virtual void do_work(const int id, void *param) override;
+#endif
#if (NL_USE_DYNAMIC_ALLOCATION)
template <typename T1, typename T2>
@@ -73,18 +159,15 @@ protected:
inline nl_ext_double &RHS(const T1 &r) { return m_A[r][N()]; }
#endif
ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
- ATTR_ALIGN nl_double m_last_V[_storage_N];
-
- terms_t * m_terms[_storage_N];
- terms_t *m_rails_temp;
private:
static const std::size_t m_pitch = (((_storage_N + 1) + 7) / 8) * 8;
+ //static const std::size_t m_pitch = (((_storage_N + 1) + 15) / 16) * 16;
+ //static const std::size_t m_pitch = (((_storage_N + 1) + 31) / 32) * 32;
#if (NL_USE_DYNAMIC_ALLOCATION)
ATTR_ALIGN nl_ext_double * RESTRICT m_A;
#else
ATTR_ALIGN nl_ext_double m_A[_storage_N][m_pitch];
- ATTR_ALIGN nl_ext_double m_B[_storage_N][m_pitch];
#endif
//ATTR_ALIGN nl_ext_double m_RHSx[_storage_N];
@@ -99,105 +182,36 @@ private:
template <unsigned m_N, unsigned _storage_N>
matrix_solver_direct_t<m_N, _storage_N>::~matrix_solver_direct_t()
{
- for (unsigned k = 0; k < N(); k++)
- {
- pfree(m_terms[k]);
- }
- pfree_array(m_rails_temp);
#if (NL_USE_DYNAMIC_ALLOCATION)
pfree_array(m_A);
#endif
+#if TEST_PARALLEL
+ thr_dispose();
+#endif
}
template <unsigned m_N, unsigned _storage_N>
-netlist_time matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
-{
- nl_double new_solver_timestep = m_params.m_max_timestep;
-
- if (m_params.m_dynamic)
- {
- /*
- * FIXME: We should extend the logic to use either all nets or
- * only output nets.
- */
- for (unsigned k = 0, iN=N(); k < iN; k++)
- {
- analog_net_t *n = m_nets[k];
-
- const nl_double DD_n = (n->Q_Analog() - m_last_V[k]);
- const nl_double hn = current_timestep();
-
- nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
- nl_double new_net_timestep;
-
- n->m_h_n_m_1 = hn;
- n->m_DD_n_m_1 = DD_n;
- if (nl_math::abs(DD2) > NL_FCONST(1e-30)) // avoid div-by-zero
- new_net_timestep = nl_math::sqrt(m_params.m_lte / nl_math::abs(NL_FCONST(0.5)*DD2));
- else
- new_net_timestep = m_params.m_max_timestep;
-
- if (new_net_timestep < new_solver_timestep)
- new_solver_timestep = new_net_timestep;
-
- m_last_V[k] = n->Q_Analog();
- }
- if (new_solver_timestep < m_params.m_min_timestep)
- new_solver_timestep = m_params.m_min_timestep;
- }
- //if (new_solver_timestep > 10.0 * hn)
- // new_solver_timestep = 10.0 * hn;
- return netlist_time::from_double(new_solver_timestep);
-}
-
-template <unsigned m_N, unsigned _storage_N>
-ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::add_term(int k, terminal_t *term)
-{
- if (term->m_otherterm->net().isRailNet())
- {
- m_rails_temp[k].add(term, -1, false);
- }
- else
- {
- int ot = get_net_idx(&term->m_otherterm->net());
- if (ot>=0)
- {
- m_terms[k]->add(term, ot, true);
- }
- /* Should this be allowed ? */
- else // if (ot<0)
- {
- m_rails_temp[k].add(term, ot, true);
- log().fatal("found term with missing othernet {1}\n", term->name());
- }
- }
-}
-
-
-template <unsigned m_N, unsigned _storage_N>
ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets)
{
if (m_dim < nets.size())
log().fatal("Dimension {1} less than {2}", m_dim, nets.size());
- for (unsigned k = 0; k < N(); k++)
- {
- m_terms[k]->clear();
- m_rails_temp[k].clear();
- }
-
matrix_solver_t::setup_base(nets);
for (unsigned k = 0; k < N(); k++)
{
m_terms[k]->m_railstart = m_terms[k]->count();
- for (unsigned i = 0; i < m_rails_temp[k].count(); i++)
- this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i], false);
+ for (unsigned i = 0; i < m_rails_temp[k]->count(); i++)
+ this->m_terms[k]->add(m_rails_temp[k]->terms()[i], m_rails_temp[k]->net_other()[i], false);
- m_rails_temp[k].clear(); // no longer needed
+ m_rails_temp[k]->clear(); // no longer needed
m_terms[k]->set_pointers();
}
+ for (unsigned k = 0; k < N(); k++)
+ pfree(m_rails_temp[k]); // no longer needed
+
+ m_rails_temp.clear();
#if 1
/* Sort in descending order by number of connected matrix voltages.
@@ -329,13 +343,13 @@ ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::lis
* save states
*/
save(NLNAME(m_last_RHS));
- save(NLNAME(m_last_V));
for (unsigned k = 0; k < N(); k++)
{
pstring num = pfmt("{1}")(k);
save(RHS(k), "RHS" + num);
+ save(m_terms[k]->m_last_V, "lastV" + num);
save(m_terms[k]->go(),"GO" + num, m_terms[k]->count());
save(m_terms[k]->gt(),"GT" + num, m_terms[k]->count());
@@ -345,59 +359,37 @@ ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::lis
}
-template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_direct_t<m_N, _storage_N>::build_LE_A()
-{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
- {
- for (unsigned i=0; i < iN; i++)
- A(k,i) = 0.0;
-
- const unsigned terms_count = m_terms[k]->count();
- const unsigned railstart = m_terms[k]->m_railstart;
- const nl_double * RESTRICT gt = m_terms[k]->gt();
-
- {
- nl_double akk = 0.0;
- for (unsigned i = 0; i < terms_count; i++)
- akk += gt[i];
-
- A(k,k) = akk;
- }
-
- const nl_double * RESTRICT go = m_terms[k]->go();
- const int * RESTRICT net_other = m_terms[k]->net_other();
-
- for (unsigned i = 0; i < railstart; i++)
- A(k,net_other[i]) -= go[i];
- }
-}
+#if TEST_PARALLEL
template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_direct_t<m_N, _storage_N>::build_LE_RHS()
+void matrix_solver_direct_t<m_N, _storage_N>::do_work(const int id, void *param)
{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
+ const int i = x_i[id];
+ /* FIXME: Singular matrix? */
+ const nl_double f = 1.0 / A(i,i);
+ const unsigned * RESTRICT const p = m_terms[i]->m_nzrd.data();
+ const unsigned e = m_terms[i]->m_nzrd.size();
+ //nl_double A_cache[128];
+ //for (unsigned k = 0; k < e; k++)
+ // A_cache[k] = A(i,p[k]);
+
+ /* Eliminate column i from row j */
+
+ const unsigned * RESTRICT const pb = m_terms[i]->m_nzbd.data();
+ //const unsigned eb = m_terms[i]->m_nzbd.size();
+ const unsigned sj = x_start[id];
+ const unsigned se = x_stop[id];
+ for (unsigned jb = sj; jb < se; jb++)
{
- nl_double rhsk_a = 0.0;
- nl_double rhsk_b = 0.0;
-
- const int terms_count = m_terms[k]->count();
- const nl_double * RESTRICT go = m_terms[k]->go();
- const nl_double * RESTRICT Idr = m_terms[k]->Idr();
- const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
-
- for (int i = 0; i < terms_count; i++)
- rhsk_a = rhsk_a + Idr[i];
-
- for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
- //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
- rhsk_b = rhsk_b + go[i] * *other_cur_analog[i];
-
- RHS(k) = rhsk_a + rhsk_b;
+ const unsigned j = pb[jb];
+ const nl_double f1 = - A(j,i) * f;
+ for (unsigned k = 0; k < e; k++)
+ //A(j,p[k]) += A_cache[k] * f1;
+ A(j,p[k]) += A(i,p[k]) * f1;
+ //RHS(j) += RHS(i) * f1;
}
}
+#endif
template <unsigned m_N, unsigned _storage_N>
void matrix_solver_direct_t<m_N, _storage_N>::LE_solve()
@@ -406,7 +398,7 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_solve()
for (unsigned i = 0; i < kN; i++) {
// FIXME: use a parameter to enable pivoting? m_pivot
- if (m_params.m_pivot)
+ if (!TEST_PARALLEL && m_params.m_pivot)
{
/* Find the row with the largest first value */
unsigned maxrow = i;
@@ -442,7 +434,7 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_solve()
#else
vec_add_mult_scalar(kN-i-1,pj,f1,pi);
//for (unsigned k = i+1; k < kN; k++)
- // pj[k] = pj[k] + pi[k] * f1;
+ // pj[k] = pj[k] + pi[k] * f1;
//for (unsigned k = i+1; k < kN; k++)
//A(j,k) += A(i,k) * f1;
RHS(j) += RHS(i) * f1;
@@ -452,23 +444,62 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_solve()
}
else
{
+#if TEST_PARALLEL
+ const unsigned eb = m_terms[i]->m_nzbd.size();
+ if (eb > 0)
+ {
+ //printf("here %d\n", eb);
+ unsigned chunks = (eb) / (num_thr + 1);
+ for (int p=0; p < num_thr + 1; p++)
+ {
+ x_i[p] = i;
+ x_start[p] = chunks * p;
+ x_stop[p] = std::min(chunks*(p+1), eb);
+ if (p<num_thr) thr_process(p, this, NULL);
+ }
+ do_work(num_thr, NULL);
+ thr_wait();
+ }
+ else if (eb > 0)
+ {
+ x_i[0] = i;
+ x_start[0] = 0;
+ x_stop[0] = eb;
+ do_work(0, NULL);
+ }
+#else
+#if 0
/* FIXME: Singular matrix? */
const nl_double f = 1.0 / A(i,i);
- const unsigned * RESTRICT const p = m_terms[i]->m_nzrd.data();
- const unsigned e = m_terms[i]->m_nzrd.size();
+ const auto &nzrd = m_terms[i]->m_nzrd;
+ const auto &nzbd = m_terms[i]->m_nzbd;
/* Eliminate column i from row j */
- const unsigned * RESTRICT const pb = m_terms[i]->m_nzbd.data();
- const unsigned eb = m_terms[i]->m_nzbd.size();
- for (unsigned jb = 0; jb < eb; jb++)
+ for (auto & j : nzbd)
{
- const unsigned j = pb[jb];
const nl_double f1 = - A(j,i) * f;
- for (unsigned k = 0; k < e; k++)
- A(j,p[k]) += A(i,p[k]) * f1;
+ for (auto & k : nzrd)
+ A(j,k) += A(i,k) * f1;
//RHS(j) += RHS(i) * f1;
}
+#else
+ /* FIXME: Singular matrix? */
+ const nl_double f = 1.0 / A(i,i);
+ const auto &nzrd = m_terms[i]->m_nzrd;
+ const auto &nzbd = m_terms[i]->m_nzbd;
+
+ /* Eliminate column i from row j */
+
+ for (auto & j : nzbd)
+ {
+ const nl_double f1 = - A(j,i) * f;
+ for (auto & k : nzrd)
+ A(j,k) += A(i,k) * f1;
+ //RHS(j) += RHS(i) * f1;
+ }
+#endif
+#endif
}
}
}
@@ -512,35 +543,6 @@ void matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst(
template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-T matrix_solver_direct_t<m_N, _storage_N>::delta(
- const T * RESTRICT V)
-{
- /* FIXME: Ideally we should also include currents (RHS) here. This would
- * need a revaluation of the right hand side after voltages have been updated
- * and thus belong into a different calculation. This applies to all solvers.
- */
-
- const unsigned iN = this->N();
- T cerr = 0;
- for (unsigned i = 0; i < iN; i++)
- cerr = std::fmax(cerr, nl_math::abs(V[i] - (T) this->m_nets[i]->m_cur_Analog));
- return cerr;
-}
-
-template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-void matrix_solver_direct_t<m_N, _storage_N>::store(
- const T * RESTRICT V)
-{
- for (unsigned i = 0, iN=N(); i < iN; i++)
- {
- this->m_nets[i]->m_cur_Analog = V[i];
- }
-}
-
-
-template <unsigned m_N, unsigned _storage_N>
int matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
{
nl_double new_V[_storage_N]; // = { 0.0 };
@@ -566,8 +568,8 @@ int matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const
template <unsigned m_N, unsigned _storage_N>
inline int matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
- this->build_LE_A();
- this->build_LE_RHS();
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
for (unsigned i=0, iN=N(); i < iN; i++)
m_last_RHS[i] = RHS(i);
@@ -581,16 +583,16 @@ matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const solver_par
: matrix_solver_t(GAUSSIAN_ELIMINATION, params)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
#if (NL_USE_DYNAMIC_ALLOCATION)
m_A = palloc_array(nl_ext_double, N() * m_pitch);
#endif
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
+#if TEST_PARALLEL
+ thr_initialize();
+#endif
}
template <unsigned m_N, unsigned _storage_N>
@@ -598,16 +600,16 @@ matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const eSolverTyp
: matrix_solver_t(type, params)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
#if (NL_USE_DYNAMIC_ALLOCATION)
m_A = palloc_array(nl_ext_double, N() * m_pitch);
#endif
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
+#if TEST_PARALLEL
+ thr_initialize();
+#endif
}
NETLIB_NAMESPACE_DEVICES_END()
diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h
index ab19c92a4cb..abf9518bfbe 100644
--- a/src/lib/netlist/solver/nld_ms_direct1.h
+++ b/src/lib/netlist/solver/nld_ms_direct1.h
@@ -30,8 +30,8 @@ public:
inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
{
- this->build_LE_A();
- this->build_LE_RHS();
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
//NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]);
nl_double new_val[1] = { RHS(0) / A(0,0) };
diff --git a/src/lib/netlist/solver/nld_ms_direct2.h b/src/lib/netlist/solver/nld_ms_direct2.h
index 2488e573bf2..f71133d95f0 100644
--- a/src/lib/netlist/solver/nld_ms_direct2.h
+++ b/src/lib/netlist/solver/nld_ms_direct2.h
@@ -30,8 +30,8 @@ public:
inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
{
- build_LE_A();
- build_LE_RHS();
+ build_LE_A(*this);
+ build_LE_RHS(*this);
const nl_double a = A(0,0);
const nl_double b = A(0,1);
diff --git a/src/lib/netlist/solver/nld_ms_direct_lu.h b/src/lib/netlist/solver/nld_ms_direct_lu.h
index 2109b0f3e41..e6ccf819653 100644
--- a/src/lib/netlist/solver/nld_ms_direct_lu.h
+++ b/src/lib/netlist/solver/nld_ms_direct_lu.h
@@ -11,6 +11,7 @@
#include <algorithm>
#include "solver/nld_solver.h"
+#include "solver/nld_matrix_solver.h"
//#define A(_r, _c) m_A[_r][_c]
@@ -143,7 +144,6 @@ protected:
ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
ATTR_ALIGN nl_double m_last_V[_storage_N];
- terms_t **m_terms;
terms_t *m_rails_temp;
private:
@@ -160,11 +160,6 @@ private:
template <unsigned m_N, unsigned _storage_N>
matrix_solver_direct_t<m_N, _storage_N>::~matrix_solver_direct_t()
{
- for (unsigned k = 0; k < N(); k++)
- {
- pfree(m_terms[k]);
- }
- pfree_array(m_terms);
pfree_array(m_rails_temp);
}
@@ -607,14 +602,11 @@ matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const solver_par
, m_dim(size)
, m_lp_fact(0)
{
- m_terms = palloc_array(terms_t *, N());
m_rails_temp = palloc_array(terms_t, N());
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
@@ -624,14 +616,12 @@ matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const eSolverTyp
, m_dim(size)
, m_lp_fact(0)
{
- m_terms = palloc_array(terms_t *, N());
m_rails_temp = palloc_array(terms_t, N());
for (unsigned k = 0; k < N(); k++)
{
m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h
index efac84b51da..bff8197127c 100644
--- a/src/lib/netlist/solver/nld_ms_sm.h
+++ b/src/lib/netlist/solver/nld_ms_sm.h
@@ -13,9 +13,9 @@
* In this specific implementation, u is a unit vector specifying the row which
* changed. Thus v contains the changed column.
*
- * Than z = A????? u , w = transpose(A?????) v , lambda = v z
+ * Than z = Aâ»Â¹ u , w = transpose(Aâ»Â¹) v , lambda = v z
*
- * A????? <- 1.0 / (1.0 + lambda) * (z x w)
+ * Aâ»Â¹ <- 1.0 / (1.0 + lambda) * (z x w)
*
* The approach is iterative and applied for each row changed.
*
@@ -36,6 +36,7 @@
#include <algorithm>
#include "solver/nld_solver.h"
+#include "solver/nld_matrix_solver.h"
#include "solver/vector_base.h"
NETLIB_NAMESPACE_DEVICES_START()
@@ -47,6 +48,8 @@ NETLIB_NAMESPACE_DEVICES_START()
template <unsigned m_N, unsigned _storage_N>
class matrix_solver_sm_t: public matrix_solver_t
{
+ friend class matrix_solver_t;
+
public:
matrix_solver_sm_t(const solver_parameters_t *params, const int size);
@@ -58,26 +61,16 @@ public:
virtual void reset() override { matrix_solver_t::reset(); }
protected:
- virtual void add_term(int net_idx, terminal_t *term) override;
virtual int vsolve_non_dynamic(const bool newton_raphson) override;
int solve_non_dynamic(const bool newton_raphson);
- inline const unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
+ inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
- void build_LE_A();
- void build_LE_RHS();
void LE_invert();
template <typename T>
void LE_compute_x(T * RESTRICT x);
- template <typename T>
- T delta(const T * RESTRICT V);
-
- template <typename T>
- void store(const T * RESTRICT V);
-
- virtual netlist_time compute_next_timestep() override;
template <typename T1, typename T2>
inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; }
@@ -95,10 +88,6 @@ protected:
inline nl_ext_double &lAinv(const T1 &r, const T2 &c) { return m_lAinv[r][c]; }
ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
- ATTR_ALIGN nl_double m_last_V[_storage_N];
-
- terms_t * m_terms[_storage_N];
- terms_t *m_rails_temp;
private:
static const std::size_t m_pitch = ((( _storage_N) + 7) / 8) * 8;
@@ -123,102 +112,26 @@ private:
template <unsigned m_N, unsigned _storage_N>
matrix_solver_sm_t<m_N, _storage_N>::~matrix_solver_sm_t()
{
- for (unsigned k = 0; k < N(); k++)
- {
- pfree(m_terms[k]);
- }
- pfree_array(m_rails_temp);
#if (NL_USE_DYNAMIC_ALLOCATION)
pfree_array(m_A);
#endif
}
template <unsigned m_N, unsigned _storage_N>
-netlist_time matrix_solver_sm_t<m_N, _storage_N>::compute_next_timestep()
-{
- nl_double new_solver_timestep = m_params.m_max_timestep;
-
- if (m_params.m_dynamic)
- {
- /*
- * FIXME: We should extend the logic to use either all nets or
- * only output nets.
- */
- for (unsigned k = 0, iN=N(); k < iN; k++)
- {
- analog_net_t *n = m_nets[k];
-
- const nl_double DD_n = (n->Q_Analog() - m_last_V[k]);
- const nl_double hn = current_timestep();
-
- nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
- nl_double new_net_timestep;
-
- n->m_h_n_m_1 = hn;
- n->m_DD_n_m_1 = DD_n;
- if (nl_math::abs(DD2) > NL_FCONST(1e-30)) // avoid div-by-zero
- new_net_timestep = nl_math::sqrt(m_params.m_lte / nl_math::abs(NL_FCONST(0.5)*DD2));
- else
- new_net_timestep = m_params.m_max_timestep;
-
- if (new_net_timestep < new_solver_timestep)
- new_solver_timestep = new_net_timestep;
-
- m_last_V[k] = n->Q_Analog();
- }
- if (new_solver_timestep < m_params.m_min_timestep)
- new_solver_timestep = m_params.m_min_timestep;
- }
- //if (new_solver_timestep > 10.0 * hn)
- // new_solver_timestep = 10.0 * hn;
- return netlist_time::from_double(new_solver_timestep);
-}
-
-template <unsigned m_N, unsigned _storage_N>
-ATTR_COLD void matrix_solver_sm_t<m_N, _storage_N>::add_term(int k, terminal_t *term)
-{
- if (term->m_otherterm->net().isRailNet())
- {
- m_rails_temp[k].add(term, -1, false);
- }
- else
- {
- int ot = get_net_idx(&term->m_otherterm->net());
- if (ot>=0)
- {
- m_terms[k]->add(term, ot, true);
- }
- /* Should this be allowed ? */
- else // if (ot<0)
- {
- m_rails_temp[k].add(term, ot, true);
- log().fatal("found term with missing othernet {1}\n", term->name());
- }
- }
-}
-
-
-template <unsigned m_N, unsigned _storage_N>
ATTR_COLD void matrix_solver_sm_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets)
{
if (m_dim < nets.size())
log().fatal("Dimension {1} less than {2}", m_dim, nets.size());
- for (unsigned k = 0; k < N(); k++)
- {
- m_terms[k]->clear();
- m_rails_temp[k].clear();
- }
-
matrix_solver_t::setup_base(nets);
for (unsigned k = 0; k < N(); k++)
{
m_terms[k]->m_railstart = m_terms[k]->count();
- for (unsigned i = 0; i < m_rails_temp[k].count(); i++)
- this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i], false);
+ for (unsigned i = 0; i < m_rails_temp[k]->count(); i++)
+ this->m_terms[k]->add(m_rails_temp[k]->terms()[i], m_rails_temp[k]->net_other()[i], false);
- m_rails_temp[k].clear(); // no longer needed
+ m_rails_temp[k]->clear(); // no longer needed
m_terms[k]->set_pointers();
}
@@ -314,13 +227,13 @@ ATTR_COLD void matrix_solver_sm_t<m_N, _storage_N>::vsetup(analog_net_t::list_t
* save states
*/
save(NLNAME(m_last_RHS));
- save(NLNAME(m_last_V));
for (unsigned k = 0; k < N(); k++)
{
pstring num = pfmt("{1}")(k);
save(RHS(k), "RHS" + num);
+ save(m_terms[k]->m_last_V, "lastV" + num);
save(m_terms[k]->go(),"GO" + num, m_terms[k]->count());
save(m_terms[k]->gt(),"GT" + num, m_terms[k]->count());
@@ -330,59 +243,6 @@ ATTR_COLD void matrix_solver_sm_t<m_N, _storage_N>::vsetup(analog_net_t::list_t
}
-template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_sm_t<m_N, _storage_N>::build_LE_A()
-{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
- {
- for (unsigned i=0; i < iN; i++)
- A(k,i) = 0.0;
-
- const unsigned terms_count = m_terms[k]->count();
- const unsigned railstart = m_terms[k]->m_railstart;
- const nl_double * RESTRICT gt = m_terms[k]->gt();
-
- {
- nl_double akk = 0.0;
- for (unsigned i = 0; i < terms_count; i++)
- akk += gt[i];
-
- A(k,k) = akk;
- }
-
- const nl_double * RESTRICT go = m_terms[k]->go();
- const int * RESTRICT net_other = m_terms[k]->net_other();
-
- for (unsigned i = 0; i < railstart; i++)
- A(k,net_other[i]) -= go[i];
- }
-}
-
-template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_sm_t<m_N, _storage_N>::build_LE_RHS()
-{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
- {
- nl_double rhsk_a = 0.0;
- nl_double rhsk_b = 0.0;
-
- const int terms_count = m_terms[k]->count();
- const nl_double * RESTRICT go = m_terms[k]->go();
- const nl_double * RESTRICT Idr = m_terms[k]->Idr();
- const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
-
- for (int i = 0; i < terms_count; i++)
- rhsk_a = rhsk_a + Idr[i];
-
- for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
- //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
- rhsk_b = rhsk_b + go[i] * *other_cur_analog[i];
-
- RHS(k) = rhsk_a + rhsk_b;
- }
-}
template <unsigned m_N, unsigned _storage_N>
void matrix_solver_sm_t<m_N, _storage_N>::LE_invert()
@@ -454,49 +314,20 @@ void matrix_solver_sm_t<m_N, _storage_N>::LE_compute_x(
{
const unsigned kN = N();
- for (int i=0; i<kN; i++)
+ for (unsigned i=0; i<kN; i++)
x[i] = 0.0;
- for (int k=0; k<kN; k++)
+ for (unsigned k=0; k<kN; k++)
{
const nl_double f = RHS(k);
- for (int i=0; i<kN; i++)
+ for (unsigned i=0; i<kN; i++)
x[i] += Ainv(i,k) * f;
}
}
template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-T matrix_solver_sm_t<m_N, _storage_N>::delta(
- const T * RESTRICT V)
-{
- /* FIXME: Ideally we should also include currents (RHS) here. This would
- * need a revaluation of the right hand side after voltages have been updated
- * and thus belong into a different calculation. This applies to all solvers.
- */
-
- const unsigned iN = this->N();
- T cerr = 0;
- for (unsigned i = 0; i < iN; i++)
- cerr = std::fmax(cerr, nl_math::abs(V[i] - (T) this->m_nets[i]->m_cur_Analog));
- return cerr;
-}
-
-template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-void matrix_solver_sm_t<m_N, _storage_N>::store(
- const T * RESTRICT V)
-{
- for (unsigned i = 0, iN=N(); i < iN; i++)
- {
- this->m_nets[i]->m_cur_Analog = V[i];
- }
-}
-
-
-template <unsigned m_N, unsigned _storage_N>
int matrix_solver_sm_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
{
static const bool incremental = true;
@@ -514,11 +345,11 @@ int matrix_solver_sm_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const boo
{
if (!incremental)
{
- for (int row = 0; row < iN; row ++)
- for (int k = 0; k < iN; k++)
+ for (unsigned row = 0; row < iN; row ++)
+ for (unsigned k = 0; k < iN; k++)
Ainv(row,k) = lAinv(row, k);
}
- for (int row = 0; row < iN; row ++)
+ for (unsigned row = 0; row < iN; row ++)
{
nl_double v[m_pitch] = {0};
unsigned cols[m_pitch];
@@ -555,11 +386,11 @@ int matrix_solver_sm_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const boo
}
lamba = -1.0 / (1.0 + lamba);
- for (int i=0; i<iN; i++)
+ for (unsigned i=0; i<iN; i++)
{
const nl_double f = lamba * z[i];
if (f != 0.0)
- for (int k = 0; k < iN; k++)
+ for (unsigned k = 0; k < iN; k++)
Ainv(i,k) += f * w[k];
}
}
@@ -589,8 +420,8 @@ int matrix_solver_sm_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const boo
template <unsigned m_N, unsigned _storage_N>
inline int matrix_solver_sm_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
- this->build_LE_A();
- this->build_LE_RHS();
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
for (unsigned i=0, iN=N(); i < iN; i++)
m_last_RHS[i] = RHS(i);
@@ -604,15 +435,12 @@ matrix_solver_sm_t<m_N, _storage_N>::matrix_solver_sm_t(const solver_parameters_
: matrix_solver_t(GAUSSIAN_ELIMINATION, params)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
#if (NL_USE_DYNAMIC_ALLOCATION)
m_A = palloc_array(nl_ext_double, N() * m_pitch);
#endif
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
@@ -621,15 +449,12 @@ matrix_solver_sm_t<m_N, _storage_N>::matrix_solver_sm_t(const eSolverType type,
: matrix_solver_t(type, params)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
#if (NL_USE_DYNAMIC_ALLOCATION)
m_A = palloc_array(nl_ext_double, N() * m_pitch);
#endif
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h
index a4fce8dec2a..10192717a90 100644
--- a/src/lib/netlist/solver/nld_ms_sor_mat.h
+++ b/src/lib/netlist/solver/nld_ms_sor_mat.h
@@ -128,8 +128,8 @@ int matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newt
int resched_cnt = 0;
- this->build_LE_A();
- this->build_LE_RHS();
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
#if 0
static int ws_cnt = 0;
diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h
index b3af357611d..aa6f7104c6c 100644
--- a/src/lib/netlist/solver/nld_ms_w.h
+++ b/src/lib/netlist/solver/nld_ms_w.h
@@ -15,7 +15,7 @@
* Whilst the book proposes to invert the matrix R=(I+transpose(V)*Z) we define
*
* w = transpose(V)*y
- * a = R????? * w
+ * a = Râ»Â¹ * w
*
* and consequently
*
@@ -43,6 +43,7 @@
#include <algorithm>
#include "solver/nld_solver.h"
+#include "solver/nld_matrix_solver.h"
#include "solver/vector_base.h"
NETLIB_NAMESPACE_DEVICES_START()
@@ -54,6 +55,7 @@ NETLIB_NAMESPACE_DEVICES_START()
template <unsigned m_N, unsigned _storage_N>
class matrix_solver_w_t: public matrix_solver_t
{
+ friend class matrix_solver_t;
public:
matrix_solver_w_t(const solver_parameters_t *params, const int size);
@@ -65,26 +67,16 @@ public:
virtual void reset() override { matrix_solver_t::reset(); }
protected:
- virtual void add_term(int net_idx, terminal_t *term) override;
virtual int vsolve_non_dynamic(const bool newton_raphson) override;
int solve_non_dynamic(const bool newton_raphson);
- inline const unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
+ inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
- void build_LE_A();
- void build_LE_RHS();
void LE_invert();
template <typename T>
void LE_compute_x(T * RESTRICT x);
- template <typename T>
- T delta(const T * RESTRICT V);
-
- template <typename T>
- void store(const T * RESTRICT V);
-
- virtual netlist_time compute_next_timestep() override;
template <typename T1, typename T2>
inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; }
@@ -102,10 +94,6 @@ protected:
inline nl_ext_double &lA(const T1 &r, const T2 &c) { return m_lA[r][c]; }
ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
- ATTR_ALIGN nl_double m_last_V[_storage_N];
-
- terms_t * m_terms[_storage_N];
- terms_t *m_rails_temp;
private:
static const std::size_t m_pitch = ((( _storage_N) + 7) / 8) * 8;
@@ -137,102 +125,26 @@ private:
template <unsigned m_N, unsigned _storage_N>
matrix_solver_w_t<m_N, _storage_N>::~matrix_solver_w_t()
{
- for (unsigned k = 0; k < N(); k++)
- {
- pfree(m_terms[k]);
- }
- pfree_array(m_rails_temp);
#if (NL_USE_DYNAMIC_ALLOCATION)
pfree_array(m_A);
#endif
}
template <unsigned m_N, unsigned _storage_N>
-netlist_time matrix_solver_w_t<m_N, _storage_N>::compute_next_timestep()
-{
- nl_double new_solver_timestep = m_params.m_max_timestep;
-
- if (m_params.m_dynamic)
- {
- /*
- * FIXME: We should extend the logic to use either all nets or
- * only output nets.
- */
- for (unsigned k = 0, iN=N(); k < iN; k++)
- {
- analog_net_t *n = m_nets[k];
-
- const nl_double DD_n = (n->Q_Analog() - m_last_V[k]);
- const nl_double hn = current_timestep();
-
- nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
- nl_double new_net_timestep;
-
- n->m_h_n_m_1 = hn;
- n->m_DD_n_m_1 = DD_n;
- if (nl_math::abs(DD2) > NL_FCONST(1e-30)) // avoid div-by-zero
- new_net_timestep = nl_math::sqrt(m_params.m_lte / nl_math::abs(NL_FCONST(0.5)*DD2));
- else
- new_net_timestep = m_params.m_max_timestep;
-
- if (new_net_timestep < new_solver_timestep)
- new_solver_timestep = new_net_timestep;
-
- m_last_V[k] = n->Q_Analog();
- }
- if (new_solver_timestep < m_params.m_min_timestep)
- new_solver_timestep = m_params.m_min_timestep;
- }
- //if (new_solver_timestep > 10.0 * hn)
- // new_solver_timestep = 10.0 * hn;
- return netlist_time::from_double(new_solver_timestep);
-}
-
-template <unsigned m_N, unsigned _storage_N>
-ATTR_COLD void matrix_solver_w_t<m_N, _storage_N>::add_term(int k, terminal_t *term)
-{
- if (term->m_otherterm->net().isRailNet())
- {
- m_rails_temp[k].add(term, -1, false);
- }
- else
- {
- int ot = get_net_idx(&term->m_otherterm->net());
- if (ot>=0)
- {
- m_terms[k]->add(term, ot, true);
- }
- /* Should this be allowed ? */
- else // if (ot<0)
- {
- m_rails_temp[k].add(term, ot, true);
- log().fatal("found term with missing othernet {1}\n", term->name());
- }
- }
-}
-
-
-template <unsigned m_N, unsigned _storage_N>
ATTR_COLD void matrix_solver_w_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets)
{
if (m_dim < nets.size())
log().fatal("Dimension {1} less than {2}", m_dim, nets.size());
- for (unsigned k = 0; k < N(); k++)
- {
- m_terms[k]->clear();
- m_rails_temp[k].clear();
- }
-
matrix_solver_t::setup_base(nets);
for (unsigned k = 0; k < N(); k++)
{
m_terms[k]->m_railstart = m_terms[k]->count();
- for (unsigned i = 0; i < m_rails_temp[k].count(); i++)
- this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i], false);
+ for (unsigned i = 0; i < m_rails_temp[k]->count(); i++)
+ this->m_terms[k]->add(m_rails_temp[k]->terms()[i], m_rails_temp[k]->net_other()[i], false);
- m_rails_temp[k].clear(); // no longer needed
+ m_rails_temp[k]->clear(); // no longer needed
m_terms[k]->set_pointers();
}
@@ -328,13 +240,13 @@ ATTR_COLD void matrix_solver_w_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &
* save states
*/
save(NLNAME(m_last_RHS));
- save(NLNAME(m_last_V));
for (unsigned k = 0; k < N(); k++)
{
pstring num = pfmt("{1}")(k);
save(RHS(k), "RHS" + num);
+ save(m_terms[k]->m_last_V, "lastV" + num);
save(m_terms[k]->go(),"GO" + num, m_terms[k]->count());
save(m_terms[k]->gt(),"GT" + num, m_terms[k]->count());
@@ -344,59 +256,6 @@ ATTR_COLD void matrix_solver_w_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &
}
-template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_w_t<m_N, _storage_N>::build_LE_A()
-{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
- {
- for (unsigned i=0; i < iN; i++)
- A(k,i) = 0.0;
-
- const unsigned terms_count = m_terms[k]->count();
- const unsigned railstart = m_terms[k]->m_railstart;
- const nl_double * RESTRICT gt = m_terms[k]->gt();
-
- {
- nl_double akk = 0.0;
- for (unsigned i = 0; i < terms_count; i++)
- akk += gt[i];
-
- A(k,k) = akk;
- }
-
- const nl_double * RESTRICT go = m_terms[k]->go();
- const int * RESTRICT net_other = m_terms[k]->net_other();
-
- for (unsigned i = 0; i < railstart; i++)
- A(k,net_other[i]) -= go[i];
- }
-}
-
-template <unsigned m_N, unsigned _storage_N>
-void matrix_solver_w_t<m_N, _storage_N>::build_LE_RHS()
-{
- const unsigned iN = N();
- for (unsigned k = 0; k < iN; k++)
- {
- nl_double rhsk_a = 0.0;
- nl_double rhsk_b = 0.0;
-
- const int terms_count = m_terms[k]->count();
- const nl_double * RESTRICT go = m_terms[k]->go();
- const nl_double * RESTRICT Idr = m_terms[k]->Idr();
- const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
-
- for (int i = 0; i < terms_count; i++)
- rhsk_a = rhsk_a + Idr[i];
-
- for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
- //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
- rhsk_b = rhsk_b + go[i] * *other_cur_analog[i];
-
- RHS(k) = rhsk_a + rhsk_b;
- }
-}
template <unsigned m_N, unsigned _storage_N>
void matrix_solver_w_t<m_N, _storage_N>::LE_invert()
@@ -467,48 +326,20 @@ void matrix_solver_w_t<m_N, _storage_N>::LE_compute_x(
{
const unsigned kN = N();
- for (int i=0; i<kN; i++)
+ for (unsigned i=0; i<kN; i++)
x[i] = 0.0;
- for (int k=0; k<kN; k++)
+ for (unsigned k=0; k<kN; k++)
{
const nl_double f = RHS(k);
- for (int i=0; i<kN; i++)
+ for (unsigned i=0; i<kN; i++)
x[i] += Ainv(i,k) * f;
}
}
template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-T matrix_solver_w_t<m_N, _storage_N>::delta(
- const T * RESTRICT V)
-{
- /* FIXME: Ideally we should also include currents (RHS) here. This would
- * need a revaluation of the right hand side after voltages have been updated
- * and thus belong into a different calculation. This applies to all solvers.
- */
-
- const unsigned iN = this->N();
- T cerr = 0;
- for (unsigned i = 0; i < iN; i++)
- cerr = std::fmax(cerr, nl_math::abs(V[i] - (T) this->m_nets[i]->m_cur_Analog));
- return cerr;
-}
-
-template <unsigned m_N, unsigned _storage_N>
-template <typename T>
-void matrix_solver_w_t<m_N, _storage_N>::store(
- const T * RESTRICT V)
-{
- for (unsigned i = 0, iN=N(); i < iN; i++)
- {
- this->m_nets[i]->m_cur_Analog = V[i];
- }
-}
-
-template <unsigned m_N, unsigned _storage_N>
int matrix_solver_w_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
{
const auto iN = N();
@@ -531,7 +362,7 @@ int matrix_solver_w_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool
unsigned rowcount=0;
#define VT(r,c) (A(r,c) - lA(r,c))
- for (int row = 0; row < iN; row ++)
+ for (unsigned row = 0; row < iN; row ++)
{
unsigned cc=0;
auto &nz = m_terms[row]->m_nz;
@@ -596,7 +427,7 @@ int matrix_solver_w_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool
}
/* Back substitution */
//inv(H) w = t w = H t
- nl_double *t = new nl_double[rowcount];
+ nl_double t[_storage_N]; // FIXME: convert to member
for (int j = rowcount - 1; j >= 0; j--)
{
nl_double tmp = 0;
@@ -619,12 +450,20 @@ int matrix_solver_w_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool
}
new_V[i] -= tmp;
}
- delete[] t;
}
}
m_cnt++;
-
+ for (unsigned i=0; i<iN; i++)
+ {
+ nl_double tmp = 0.0;
+ for (unsigned j=0; j<iN; j++)
+ {
+ tmp += A(i,j) * new_V[j];
+ }
+ if (std::fabs(tmp-RHS(i)) > 1e-6)
+ printf("%s failed on row %d: %f RHS: %f\n", this->name().cstr(), i, std::fabs(tmp-RHS(i)), RHS(i));
+ }
if (newton_raphson)
{
nl_double err = delta(new_V);
@@ -643,8 +482,8 @@ int matrix_solver_w_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool
template <unsigned m_N, unsigned _storage_N>
inline int matrix_solver_w_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
- this->build_LE_A();
- this->build_LE_RHS();
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
for (unsigned i=0, iN=N(); i < iN; i++)
m_last_RHS[i] = RHS(i);
@@ -659,15 +498,12 @@ matrix_solver_w_t<m_N, _storage_N>::matrix_solver_w_t(const solver_parameters_t
,m_cnt(0)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
#if (NL_USE_DYNAMIC_ALLOCATION)
m_A = palloc_array(nl_ext_double, N() * m_pitch);
#endif
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
@@ -677,12 +513,9 @@ matrix_solver_w_t<m_N, _storage_N>::matrix_solver_w_t(const eSolverType type, co
,m_cnt(0)
, m_dim(size)
{
- m_rails_temp = palloc_array(terms_t, N());
for (unsigned k = 0; k < N(); k++)
{
- m_terms[k] = palloc(terms_t);
m_last_RHS[k] = 0.0;
- m_last_V[k] = 0.0;
}
}
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index ed011ff254d..5dd0af53313 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -108,6 +108,11 @@ ATTR_COLD matrix_solver_t::matrix_solver_t(const eSolverType type, const solver_
ATTR_COLD matrix_solver_t::~matrix_solver_t()
{
m_inps.clear_and_free();
+ for (unsigned k = 0; k < m_terms.size(); k++)
+ {
+ pfree(m_terms[k]);
+ }
+
}
ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
@@ -115,9 +120,14 @@ ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
log().debug("New solver setup\n");
m_nets.clear();
+ m_terms.clear();
for (auto & net : nets)
+ {
m_nets.push_back(net);
+ m_terms.push_back(palloc(terms_t));
+ m_rails_temp.push_back(palloc(terms_t));
+ }
for (std::size_t k = 0; k < nets.size(); k++)
{
@@ -168,6 +178,9 @@ ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
if (net_proxy_output == NULL)
{
+ //net_proxy_output = palloc(analog_output_t(*this,
+ // this->name() + "." + pfmt("m{1}")(m_inps.size())));
+
net_proxy_output = palloc(analog_output_t);
net_proxy_output->init_object(*this, this->name() + "." + pfmt("m{1}")(m_inps.size()));
m_inps.push_back(net_proxy_output);
@@ -308,6 +321,70 @@ ATTR_COLD int matrix_solver_t::get_net_idx(net_t *net)
return -1;
}
+ATTR_COLD void matrix_solver_t::add_term(int k, terminal_t *term)
+{
+ if (term->m_otherterm->net().isRailNet())
+ {
+ m_rails_temp[k]->add(term, -1, false);
+ }
+ else
+ {
+ int ot = get_net_idx(&term->m_otherterm->net());
+ if (ot>=0)
+ {
+ m_terms[k]->add(term, ot, true);
+ }
+ /* Should this be allowed ? */
+ else // if (ot<0)
+ {
+ m_rails_temp[k]->add(term, ot, true);
+ log().fatal("found term with missing othernet {1}\n", term->name());
+ }
+ }
+}
+
+netlist_time matrix_solver_t::compute_next_timestep()
+{
+ nl_double new_solver_timestep = m_params.m_max_timestep;
+
+ if (m_params.m_dynamic)
+ {
+ /*
+ * FIXME: We should extend the logic to use either all nets or
+ * only output nets.
+ */
+ for (unsigned k = 0, iN=m_terms.size(); k < iN; k++)
+ {
+ analog_net_t *n = m_nets[k];
+
+ const nl_double DD_n = (n->Q_Analog() - m_terms[k]->m_last_V);
+ const nl_double hn = current_timestep();
+
+ nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
+ nl_double new_net_timestep;
+
+ n->m_h_n_m_1 = hn;
+ n->m_DD_n_m_1 = DD_n;
+ if (nl_math::abs(DD2) > NL_FCONST(1e-30)) // avoid div-by-zero
+ new_net_timestep = nl_math::sqrt(m_params.m_lte / nl_math::abs(NL_FCONST(0.5)*DD2));
+ else
+ new_net_timestep = m_params.m_max_timestep;
+
+ if (new_net_timestep < new_solver_timestep)
+ new_solver_timestep = new_net_timestep;
+
+ m_terms[k]->m_last_V = n->Q_Analog();
+ }
+ if (new_solver_timestep < m_params.m_min_timestep)
+ new_solver_timestep = m_params.m_min_timestep;
+ }
+ //if (new_solver_timestep > 10.0 * hn)
+ // new_solver_timestep = 10.0 * hn;
+ return netlist_time::from_double(new_solver_timestep);
+}
+
+
+
void matrix_solver_t::log_stats()
{
if (this->m_stat_calculations != 0 && this->m_stat_vsolver_calls && this->m_params.m_log_stats)
diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp
index be1d2022cd7..ba1840489d6 100644
--- a/src/lib/util/chdcodec.cpp
+++ b/src/lib/util/chdcodec.cpp
@@ -1128,20 +1128,35 @@ chd_lzma_decompressor::chd_lzma_decompressor(chd_file &chd, UINT32 hunkbytes, bo
// construct the decoder
LzmaDec_Construct(&m_decoder);
+ // FIXME: this code is written in a way that makes it impossible to safely upgrade the LZMA SDK
+ // This code assumes that the current version of the encoder imposes the same requirements on the
+ // decoder as the encoder used to produce the file. This is not necessarily true. The format
+ // needs to be changed so the encoder properties are written to the file.
+
// configure the properties like the compressor did
CLzmaEncProps encoder_props;
chd_lzma_compressor::configure_properties(encoder_props, hunkbytes);
// convert to decoder properties
- CLzmaProps decoder_props;
- decoder_props.lc = encoder_props.lc;
- decoder_props.lp = encoder_props.lp;
- decoder_props.pb = encoder_props.pb;
- decoder_props.dicSize = encoder_props.dictSize;
+ CLzmaEncHandle enc = LzmaEnc_Create(&m_allocator);
+ if (!enc)
+ throw CHDERR_DECOMPRESSION_ERROR;
+ if (LzmaEnc_SetProps(enc, &encoder_props) != SZ_OK)
+ {
+ LzmaEnc_Destroy(enc, &m_allocator, &m_allocator);
+ throw CHDERR_DECOMPRESSION_ERROR;
+ }
+ Byte decoder_props[LZMA_PROPS_SIZE];
+ SizeT props_size = sizeof(decoder_props);
+ if (LzmaEnc_WriteProperties(enc, decoder_props, &props_size) != SZ_OK)
+ {
+ LzmaEnc_Destroy(enc, &m_allocator, &m_allocator);
+ throw CHDERR_DECOMPRESSION_ERROR;
+ }
+ LzmaEnc_Destroy(enc, &m_allocator, &m_allocator);
// do memory allocations
- SRes res = LzmaDec_Allocate_MAME(&m_decoder, &decoder_props, &m_allocator);
- if (res != SZ_OK)
+ if (LzmaDec_Allocate(&m_decoder, decoder_props, LZMA_PROPS_SIZE, &m_allocator) != SZ_OK)
throw CHDERR_DECOMPRESSION_ERROR;
}
diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h
index f517cdedeeb..bfde8d2cde7 100644
--- a/src/lib/util/chdcodec.h
+++ b/src/lib/util/chdcodec.h
@@ -14,6 +14,7 @@
#define __CHDCODEC_H__
#include "osdcore.h"
+#include "coretmpl.h"
#define CHDCODEC_VERIFY_COMPRESSION 0
diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h
index 6b4f6a01f58..ae469f86ed7 100644
--- a/src/lib/util/delegate.h
+++ b/src/lib/util/delegate.h
@@ -83,7 +83,7 @@
#include <typeinfo>
#include <utility>
#include <cstring>
-
+#include <cstdint>
//**************************************************************************
// MACROS
diff --git a/src/lib/util/nanosvg.cpp b/src/lib/util/nanosvg.cpp
new file mode 100644
index 00000000000..09973865675
--- /dev/null
+++ b/src/lib/util/nanosvg.cpp
@@ -0,0 +1,6 @@
+#define NANOSVG_IMPLEMENTATION
+#define NANOSVGRAST_IMPLEMENTATION
+#define NANOSVG_ALL_COLOR_KEYWORDS
+
+#include <nanosvg/src/nanosvg.h>
+#include <nanosvg/src/nanosvgrast.h>
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index 7e8b993c0b2..f8ef33b0d39 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -146,13 +146,13 @@ void core_options::entry::set_flag(UINT32 mask, UINT32 flag)
//-------------------------------------------------
// revert - revert back to our default if we are
-// at or below the given priority
+// within the given priority range
//-------------------------------------------------
-void core_options::entry::revert(int priority)
+void core_options::entry::revert(int priority_hi, int priority_lo)
{
- // if our priority is low enough, revert to the default
- if (m_priority <= priority)
+ // if our priority is within the range, revert to the default
+ if (m_priority <= priority_hi && m_priority >= priority_lo)
{
m_data = m_defdata;
m_priority = OPTION_PRIORITY_DEFAULT;
@@ -465,11 +465,11 @@ bool core_options::parse_ini_file(util::core_file &inifile, int priority, int ig
// priority back to their defaults
//-------------------------------------------------
-void core_options::revert(int priority)
+void core_options::revert(int priority_hi, int priority_lo)
{
// iterate over options and revert to defaults if below the given priority
for (entry &curentry : m_entrylist)
- curentry.revert(priority);
+ curentry.revert(priority_hi, priority_lo);
}
@@ -836,3 +836,9 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch
curentry.set_value(data.c_str(), priority);
return true;
}
+
+core_options::entry *core_options::get_entry(const char *name) const
+{
+ auto curentry = m_entrymap.find(name);
+ return (curentry != m_entrymap.end()) ? curentry->second : nullptr;
+} \ No newline at end of file
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 9af9c61233e..ff1cad115de 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -97,7 +97,7 @@ public:
void set_description(const char *description);
void set_flag(UINT32 mask, UINT32 flag);
void mark_changed() { m_changed = true; }
- void revert(int priority);
+ void revert(int priority_hi, int priority_lo);
private:
// internal state
@@ -131,6 +131,7 @@ public:
// getters
entry *first() const { return m_entrylist.first(); }
const char *command() const { return m_command.c_str(); }
+ entry *get_entry(const char *name) const;
// range iterators
using auto_iterator = simple_list<entry>::auto_iterator;
@@ -150,7 +151,7 @@ public:
bool parse_ini_file(util::core_file &inifile, int priority, int ignore_priority, std::string &error_string);
// reverting
- void revert(int priority = OPTION_PRIORITY_MAXIMUM);
+ void revert(int priority_hi = OPTION_PRIORITY_MAXIMUM, int priority_lo = OPTION_PRIORITY_DEFAULT);
// output
std::string output_ini(const core_options *diff = nullptr) const;
diff --git a/src/lib/util/plaparse.h b/src/lib/util/plaparse.h
index db85fac6ffd..e3bfcaf0e2a 100644
--- a/src/lib/util/plaparse.h
+++ b/src/lib/util/plaparse.h
@@ -12,7 +12,7 @@
#define __PLAPARSE_H__
#include "osdcore.h"
-
+#include "jedparse.h"
/***************************************************************************
diff --git a/src/lib/util/un7z.cpp b/src/lib/util/un7z.cpp
index b3d18dcdb8e..95f34179ea0 100644
--- a/src/lib/util/un7z.cpp
+++ b/src/lib/util/un7z.cpp
@@ -16,8 +16,9 @@
#include "unicode.h"
#include "lzma/C/7z.h"
+#include "lzma/C/7zAlloc.h"
#include "lzma/C/7zCrc.h"
-#include "lzma/C/7zVersion.h"
+#include "lzma/C/7zTypes.h"
#include <algorithm>
#include <array>
@@ -40,41 +41,41 @@ struct CSzFile
{
CSzFile() : currfpos(0), length(0), osdfile() {}
- long currfpos;
+ std::uint64_t currfpos;
std::uint64_t length;
osd_file::ptr osdfile;
- WRes read(void *data, std::size_t &size)
+ SRes read(void *data, std::size_t &size)
{
if (!osdfile)
{
- std::printf("un7z.c: called File_Read without file\n");
- return 1;
+ osd_printf_error("un7z: called CSzFile::read without file\n");
+ return SZ_ERROR_READ;
}
- if (!size) return 0;
- size_t originalSize = size;
+ if (!size)
+ return SZ_OK;
- std::uint32_t read_length;
- //osd_file::error err =
- osdfile->read(data, currfpos, originalSize, read_length);
+ // TODO: this casts a size_t to a uint32_t, so it will fail if >=4GB is requested at once (need a loop)
+ std::uint32_t read_length(0);
+ auto const err = osdfile->read(data, currfpos, size, read_length);
size = read_length;
currfpos += read_length;
- if (size == originalSize)
- return 0;
-
- return 0;
+ return (osd_file::error::NONE == err) ? SZ_OK : SZ_ERROR_READ;
}
- WRes seek(Int64 &pos, ESzSeek origin)
+ SRes seek(Int64 &pos, ESzSeek origin)
{
- if (origin == 0) currfpos = pos;
- if (origin == 1) currfpos = currfpos + pos;
- if (origin == 2) currfpos = length -pos;
-
+ switch (origin)
+ {
+ case SZ_SEEK_CUR: currfpos += pos; break;
+ case SZ_SEEK_SET: currfpos = pos; break;
+ case SZ_SEEK_END: currfpos = length + pos; break;
+ default: return SZ_ERROR_READ;
+ }
pos = currfpos;
- return 0;
+ return SZ_OK;
}
};
@@ -109,6 +110,7 @@ public:
{
ptr result;
std::swap(s_cache[cachenum], result);
+ osd_printf_verbose("un7z: found %s in cache\n", filename.c_str());
return result;
}
}
@@ -244,17 +246,6 @@ std::mutex m7z_file_impl::s_cache_mutex;
/* ---------- FileInStream ---------- */
extern "C" {
-static void *SZipAlloc(void *p, std::size_t size)
-{
- return (size == 0) ? nullptr : std::malloc(size);
-}
-
-static void SZipFree(void *p, void *address)
-{
- std::free(address);
-}
-
-
static SRes FileInStream_Read(void *pp, void *buf, size_t *size)
{
return (reinterpret_cast<CFileInStream *>(pp)->read(buf, *size) == 0) ? SZ_OK : SZ_ERROR_READ;
@@ -291,15 +282,19 @@ m7z_file_impl::m7z_file_impl(const std::string &filename)
, m_uchar_buf(128)
, m_utf8_buf(512)
, m_inited(false)
- , m_block_index(0xffffffff) // it can have any value before first call (if outBuffer = 0)
- , m_out_buffer(nullptr) // it must be 0 before first call for each new archive
- , m_out_buffer_size(0) // it can have any value before first call (if outBuffer = 0)
+ , m_block_index(0)
+ , m_out_buffer(nullptr)
+ , m_out_buffer_size(0)
{
- m_alloc_imp.Alloc = SZipAlloc;
- m_alloc_imp.Free = SZipFree;
+ m_alloc_imp.Alloc = &SzAlloc;
+ m_alloc_imp.Free = &SzFree;
+
+ m_alloc_temp_imp.Alloc = &SzAllocTemp;
+ m_alloc_temp_imp.Free = &SzFreeTemp;
- m_alloc_temp_imp.Alloc = SZipAlloc;
- m_alloc_temp_imp.Free = SZipFree;
+ LookToRead_CreateVTable(&m_look_stream, False);
+ m_look_stream.realStream = &m_archive_stream;
+ LookToRead_Init(&m_look_stream);
}
@@ -309,18 +304,24 @@ archive_file::error m7z_file_impl::initialize()
if (err != osd_file::error::NONE)
return archive_file::error::FILE_ERROR;
- LookToRead_CreateVTable(&m_look_stream, False);
- m_look_stream.realStream = &m_archive_stream;
- LookToRead_Init(&m_look_stream);
+ osd_printf_verbose("un7z: opened archive file %s\n", m_filename.c_str());
- CrcGenerateTable();
+ CrcGenerateTable(); // FIXME: doesn't belong here - it should be called once statically
SzArEx_Init(&m_db);
m_inited = true;
-
SRes const res = SzArEx_Open(&m_db, &m_look_stream.s, &m_alloc_imp, &m_alloc_temp_imp);
if (res != SZ_OK)
- return archive_file::error::FILE_ERROR;
+ {
+ osd_printf_error("un7z: error opening %s as 7z archive (%d)\n", m_filename.c_str(), int(res));
+ switch (res)
+ {
+ case SZ_ERROR_UNSUPPORTED: return archive_file::error::UNSUPPORTED;
+ case SZ_ERROR_MEM: return archive_file::error::OUT_OF_MEMORY;
+ case SZ_ERROR_INPUT_EOF: return archive_file::error::FILE_TRUNCATED;
+ default: return archive_file::error::FILE_ERROR;
+ }
+ }
return archive_file::error::NONE;
}
@@ -336,6 +337,7 @@ void m7z_file_impl::close(ptr &&archive)
if (!archive) return;
// close the open files
+ osd_printf_verbose("un7z: closing archive file %s and sending to cache\n", archive->m_filename.c_str());
archive->m_archive_stream.osdfile.reset();
// find the first NULL entry in the cache
@@ -347,7 +349,11 @@ void m7z_file_impl::close(ptr &&archive)
// if no room left in the cache, free the bottommost entry
if (cachenum == s_cache.size())
- s_cache[--cachenum].reset();
+ {
+ cachenum--;
+ osd_printf_verbose("un7z: removing %s from cache to make space\n", s_cache[cachenum]->m_filename.c_str());
+ s_cache[cachenum].reset();
+ }
// move everyone else down and place us at the top
for ( ; cachenum > 0; cachenum--)
@@ -368,30 +374,47 @@ void m7z_file_impl::close(ptr &&archive)
archive_file::error m7z_file_impl::decompress(void *buffer, std::uint32_t length)
{
+ // if we don't have enough buffer, error
+ if (length < m_curr_length)
+ {
+ osd_printf_error("un7z: buffer too small to decompress %s from %s\n", m_curr_name.c_str(), m_filename.c_str());
+ return archive_file::error::BUFFER_TOO_SMALL;
+ }
+
// make sure the file is open..
if (!m_archive_stream.osdfile)
{
m_archive_stream.currfpos = 0;
osd_file::error const err = osd_file::open(m_filename, OPEN_FLAG_READ, m_archive_stream.osdfile, m_archive_stream.length);
if (err != osd_file::error::NONE)
+ {
+ osd_printf_error("un7z: error reopening archive file %s (%d)\n", m_filename.c_str(), int(err));
return archive_file::error::FILE_ERROR;
+ }
+ osd_printf_verbose("un7z: reopened archive file %s\n", m_filename.c_str());
}
- size_t offset = 0;
- size_t out_size_processed = 0;
-
+ std::size_t offset(0);
+ std::size_t out_size_processed(0);
SRes const res = SzArEx_Extract(
- &m_db, &m_look_stream.s, m_curr_file_idx,
- &m_block_index,
- &m_out_buffer, &m_out_buffer_size,
- &offset, &out_size_processed,
- &m_alloc_imp, &m_alloc_temp_imp);
-
+ &m_db, &m_look_stream.s, m_curr_file_idx, // requested file
+ &m_block_index, &m_out_buffer, &m_out_buffer_size, // solid block caching
+ &offset, &out_size_processed, // data size/offset
+ &m_alloc_imp, &m_alloc_temp_imp); // allocator helpers
if (res != SZ_OK)
- return archive_file::error::FILE_ERROR;
-
- std::memcpy(buffer, m_out_buffer + offset, length);
+ {
+ osd_printf_error("un7z: error decompressing %s from %s (%d)\n", m_curr_name.c_str(), m_filename.c_str(), int(res));
+ switch (res)
+ {
+ case SZ_ERROR_UNSUPPORTED: return archive_file::error::UNSUPPORTED;
+ case SZ_ERROR_MEM: return archive_file::error::OUT_OF_MEMORY;
+ case SZ_ERROR_INPUT_EOF: return archive_file::error::FILE_TRUNCATED;
+ default: return archive_file::error::DECOMPRESS_ERROR;
+ }
+ }
+ // copy to destination buffer
+ std::memcpy(buffer, m_out_buffer + offset, (std::min<std::size_t>)(length, out_size_processed));
return archive_file::error::NONE;
}
@@ -404,25 +427,24 @@ int m7z_file_impl::search(
bool matchname,
bool partialpath)
{
- for ( ; i < m_db.db.NumFiles; i++)
+ for ( ; i < m_db.NumFiles; i++)
{
- const CSzFileItem &f(m_db.db.Files[i]);
-
make_utf8_name(i);
- const std::uint64_t size(f.Size);
- const std::uint32_t crc(f.Crc);
- const bool crcmatch(crc == search_crc);
+ bool const is_dir(SzArEx_IsDir(&m_db, i));
+ const std::uint64_t size(SzArEx_GetFileSize(&m_db, i));
+ const std::uint32_t crc(m_db.CRCs.Vals[i]);
+ const bool crcmatch(SzBitArray_Check(m_db.CRCs.Defs, i) && (crc == search_crc));
auto const partialoffset(m_utf8_buf.size() - 1 - search_filename.length());
bool const partialpossible((m_utf8_buf.size() > (search_filename.length() + 1)) && (m_utf8_buf[partialoffset - 1] == '/'));
const bool namematch(
!core_stricmp(search_filename.c_str(), &m_utf8_buf[0]) ||
(partialpath && partialpossible && !core_stricmp(search_filename.c_str(), &m_utf8_buf[partialoffset])));
- const bool found = ((!matchcrc && !matchname) || !f.IsDir) && (!matchcrc || crcmatch) && (!matchname || namematch);
+ const bool found = ((!matchcrc && !matchname) || !is_dir) && (!matchcrc || crcmatch) && (!matchname || namematch);
if (found)
{
m_curr_file_idx = i;
- m_curr_is_dir = bool(f.IsDir);
+ m_curr_is_dir = is_dir;
m_curr_name = &m_utf8_buf[0];
m_curr_length = size;
m_curr_crc = crc;
diff --git a/src/lib/util/unzip.cpp b/src/lib/util/unzip.cpp
index 6a9e407252d..cce6c812a76 100644
--- a/src/lib/util/unzip.cpp
+++ b/src/lib/util/unzip.cpp
@@ -11,9 +11,9 @@
#include "unzip.h"
#include "corestr.h"
+#include "hashing.h"
#include "osdcore.h"
-
#include <algorithm>
#include <array>
#include <cassert>
@@ -25,63 +25,12 @@
#include <zlib.h>
+#include "lzma/C/LzmaDec.h"
+
namespace util {
namespace {
/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-/* offsets in end of central directory structure */
-#define ZIPESIG 0x00
-#define ZIPEDSK 0x04
-#define ZIPECEN 0x06
-#define ZIPENUM 0x08
-#define ZIPECENN 0x0a
-#define ZIPECSZ 0x0c
-#define ZIPEOFST 0x10
-#define ZIPECOML 0x14
-#define ZIPECOM 0x16
-
-/* offsets in central directory entry structure */
-#define ZIPCENSIG 0x00
-#define ZIPCVER 0x04
-#define ZIPCOS 0x05
-#define ZIPCVXT 0x06
-#define ZIPCEXOS 0x07
-#define ZIPCFLG 0x08
-#define ZIPCMTHD 0x0a
-#define ZIPCTIM 0x0c
-#define ZIPCDAT 0x0e
-#define ZIPCCRC 0x10
-#define ZIPCSIZ 0x14
-#define ZIPCUNC 0x18
-#define ZIPCFNL 0x1c
-#define ZIPCXTL 0x1e
-#define ZIPCCML 0x20
-#define ZIPDSK 0x22
-#define ZIPINT 0x24
-#define ZIPEXT 0x26
-#define ZIPOFST 0x2a
-#define ZIPCFN 0x2e
-
-/* offsets in local file header structure */
-#define ZIPLOCSIG 0x00
-#define ZIPVER 0x04
-#define ZIPGENFLG 0x06
-#define ZIPMTHD 0x08
-#define ZIPTIME 0x0a
-#define ZIPDATE 0x0c
-#define ZIPCRC 0x0e
-#define ZIPSIZE 0x12
-#define ZIPUNCMP 0x16
-#define ZIPFNLN 0x1a
-#define ZIPXTRALN 0x1c
-#define ZIPNAME 0x1e
-
-
-
-/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -99,10 +48,8 @@ public:
, m_cd_pos(0)
, m_header()
, m_curr_is_dir(false)
- , m_curr_name()
, m_buffer()
{
- std::memset(&m_header, 0, sizeof(m_header));
std::fill(m_buffer.begin(), m_buffer.end(), 0);
}
@@ -116,6 +63,7 @@ public:
{
ptr result;
std::swap(s_cache[cachenum], result);
+ osd_printf_verbose("unzip: found %s in cache\n", filename.c_str());
return result;
}
}
@@ -137,18 +85,52 @@ public:
return ziperr;
// verify that we can work with this zipfile (no disk spanning allowed)
- if ((m_ecd.disk_number != m_ecd.cd_start_disk_number) || (m_ecd.cd_disk_entries != m_ecd.cd_total_entries))
+ if (m_ecd.disk_number != m_ecd.cd_start_disk_number)
+ {
+ osd_printf_error("unzip: %s central directory starts in another segment\n", m_filename.c_str());
return archive_file::error::UNSUPPORTED;
+ }
+ if (m_ecd.cd_disk_entries != m_ecd.cd_total_entries)
+ {
+ osd_printf_error("unzip: %s not all central directory entries reside in this segment\n", m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+ if (std::size_t(m_ecd.cd_size) != m_ecd.cd_size)
+ {
+ osd_printf_error("unzip: %s central directory too large to load\n", m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
// allocate memory for the central directory
- try { m_cd.resize(m_ecd.cd_size + 1); }
- catch (...) { return archive_file::error::OUT_OF_MEMORY; }
+ try { m_cd.resize(std::size_t(m_ecd.cd_size)); }
+ catch (...)
+ {
+ osd_printf_error("unzip: %s failed to allocate memory for central directory\n", m_filename.c_str());
+ return archive_file::error::OUT_OF_MEMORY;
+ }
// read the central directory
- std::uint32_t read_length;
- auto const filerr = m_file->read(&m_cd[0], m_ecd.cd_start_disk_offset, m_ecd.cd_size, read_length);
- if ((filerr != osd_file::error::NONE) || (read_length != m_ecd.cd_size))
- return (filerr == osd_file::error::NONE) ? archive_file::error::FILE_TRUNCATED : archive_file::error::FILE_ERROR;
+ auto cd_remaining(m_ecd.cd_size);
+ std::size_t cd_offs(0);
+ while (cd_remaining)
+ {
+ std::uint32_t const chunk(std::uint32_t((std::min<std::uint64_t>)(std::numeric_limits<std::uint32_t>::max(), cd_remaining)));
+ std::uint32_t read_length(0);
+ auto const filerr = m_file->read(&m_cd[cd_offs], m_ecd.cd_start_disk_offset + cd_offs, chunk, read_length);
+ if (filerr != osd_file::error::NONE)
+ {
+ osd_printf_error("unzip: %s error reading central directory (%d)\n", m_filename.c_str(), int(filerr));
+ return archive_file::error::FILE_ERROR;
+ }
+ if (!read_length)
+ {
+ osd_printf_error("unzip: %s unexpectedly reached end-of-file while reading central directory\n", m_filename.c_str());
+ return archive_file::error::FILE_TRUNCATED;
+ }
+ cd_remaining -= read_length;
+ cd_offs += read_length;
+ }
+ osd_printf_verbose("unzip: read %s central directory\n", m_filename.c_str());
return archive_file::error::NONE;
}
@@ -180,7 +162,7 @@ public:
}
bool current_is_directory() const { return m_curr_is_dir; }
- const std::string &current_name() const { return m_curr_name; }
+ const std::string &current_name() const { return m_header.file_name; }
std::uint64_t current_uncompressed_length() const { return m_header.uncompressed_length; }
std::uint32_t current_crc() const { return m_header.crc; }
@@ -200,7 +182,15 @@ private:
{
auto const filerr = osd_file::open(m_filename, OPEN_FLAG_READ, m_file, m_length);
if (filerr != osd_file::error::NONE)
+ {
+ // this would spam every time it looks for a non-existent archive, which is a lot
+ //osd_printf_error("unzip: error reopening archive file %s (%d)\n", m_filename.c_str(), int(filerr));
return archive_file::error::FILE_ERROR;
+ }
+ else
+ {
+ osd_printf_verbose("unzip: opened archive file %s\n", m_filename.c_str());
+ }
}
return archive_file::error::NONE;
}
@@ -212,44 +202,31 @@ private:
// decompression interfaces
archive_file::error decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length);
archive_file::error decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length);
+ archive_file::error decompress_data_type_14(std::uint64_t offset, void *buffer, std::uint32_t length);
struct file_header
{
- std::uint32_t signature; // central file header signature
std::uint16_t version_created; // version made by
std::uint16_t version_needed; // version needed to extract
std::uint16_t bit_flag; // general purpose bit flag
std::uint16_t compression; // compression method
- std::uint16_t file_time; // last mod file time
- std::uint16_t file_date; // last mod file date
std::uint32_t crc; // crc-32
- std::uint32_t compressed_length; // compressed size
- std::uint32_t uncompressed_length; // uncompressed size
- std::uint16_t filename_length; // filename length
- std::uint16_t extra_field_length; // extra field length
- std::uint16_t file_comment_length; // file comment length
- std::uint16_t start_disk_number; // disk number start
- std::uint16_t internal_attributes; // internal file attributes
- std::uint32_t external_attributes; // external file attributes
- std::uint32_t local_header_offset; // relative offset of local header
- const char * filename; // filename
+ std::uint64_t compressed_length; // compressed size
+ std::uint64_t uncompressed_length; // uncompressed size
+ std::uint32_t start_disk_number; // disk number start
+ std::uint64_t local_header_offset; // relative offset of local header
+ std::string file_name; // file name
};
// contains extracted end of central directory information
struct ecd
{
- std::uint32_t signature; // end of central dir signature
- std::uint16_t disk_number; // number of this disk
- std::uint16_t cd_start_disk_number; // number of the disk with the start of the central directory
- std::uint16_t cd_disk_entries; // total number of entries in the central directory on this disk
- std::uint16_t cd_total_entries; // total number of entries in the central directory
- std::uint32_t cd_size; // size of the central directory
- std::uint32_t cd_start_disk_offset; // offset of start of central directory with respect to the starting disk number
- std::uint16_t comment_length; // .ZIP file comment length
- const char * comment; // .ZIP file comment
-
- std::unique_ptr<std::uint8_t []> raw; // pointer to the raw data
- std::uint32_t rawlength; // length of the raw data
+ std::uint32_t disk_number; // number of this disk
+ std::uint32_t cd_start_disk_number; // number of the disk with the start of the central directory
+ std::uint64_t cd_disk_entries; // total number of entries in the central directory on this disk
+ std::uint64_t cd_total_entries; // total number of entries in the central directory
+ std::uint64_t cd_size; // size of the central directory
+ std::uint64_t cd_start_disk_offset; // offset of start of central directory with respect to the starting disk number
};
static constexpr std::size_t DECOMPRESS_BUFSIZE = 16384;
@@ -267,7 +244,6 @@ private:
std::uint32_t m_cd_pos; // position in central directory
file_header m_header; // current file header
bool m_curr_is_dir; // current file is directory
- std::string m_curr_name; // current file name
std::array<std::uint8_t, DECOMPRESS_BUFSIZE> m_buffer; // buffer for decompression
};
@@ -307,40 +283,282 @@ private:
};
+class reader_base
+{
+protected:
+ reader_base(void const *buf) : m_buffer(reinterpret_cast<std::uint8_t const *>(buf)) { }
+
+ std::uint8_t read_byte(std::size_t offs) const
+ {
+ return m_buffer[offs];
+ }
+ std::uint16_t read_word(std::size_t offs) const
+ {
+ return
+ (std::uint16_t(m_buffer[offs + 1]) << 8) |
+ (std::uint16_t(m_buffer[offs + 0]) << 0);
+ }
+ std::uint32_t read_dword(std::size_t offs) const
+ {
+ return
+ (std::uint32_t(m_buffer[offs + 3]) << 24) |
+ (std::uint32_t(m_buffer[offs + 2]) << 16) |
+ (std::uint32_t(m_buffer[offs + 1]) << 8) |
+ (std::uint32_t(m_buffer[offs + 0]) << 0);
+ }
+ std::uint64_t read_qword(std::size_t offs) const
+ {
+ return
+ (std::uint64_t(m_buffer[offs + 7]) << 56) |
+ (std::uint64_t(m_buffer[offs + 6]) << 48) |
+ (std::uint64_t(m_buffer[offs + 5]) << 40) |
+ (std::uint64_t(m_buffer[offs + 4]) << 32) |
+ (std::uint64_t(m_buffer[offs + 3]) << 24) |
+ (std::uint64_t(m_buffer[offs + 2]) << 16) |
+ (std::uint64_t(m_buffer[offs + 1]) << 8) |
+ (std::uint64_t(m_buffer[offs + 0]) << 0);
+ }
+ std::string read_string(std::size_t offs, std::string::size_type len) const
+ {
+ return std::string(reinterpret_cast<char const *>(m_buffer + offs), len);
+ }
+ void read_string(std::string &result, std::size_t offs, std::string::size_type len) const
+ {
+ result.assign(reinterpret_cast<char const *>(m_buffer + offs), len);
+ }
+
+ std::uint8_t const *m_buffer;
+};
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-/**
- * @fn static inline UINT16 read_word(UINT8 *buf)
- *
- * @brief Reads a word.
- *
- * @param [in,out] buf If non-null, the buffer.
- *
- * @return The word.
- */
-
-inline std::uint16_t read_word(std::uint8_t const *buf)
+class extra_field_reader : private reader_base
{
- return (buf[1] << 8) | buf[0];
-}
+public:
+ extra_field_reader(void const *buf, std::size_t len) : reader_base(buf), m_length(len) { }
+
+ std::uint16_t header_id() const { return read_word(0x00); }
+ std::uint16_t data_size() const { return read_word(0x02); }
+ void const * data() const { return m_buffer + 0x04; }
+ extra_field_reader next() const { return extra_field_reader(m_buffer + total_length(), m_length - total_length()); }
+
+ bool length_sufficient() const { return (m_length >= minimum_length()) && (m_length >= total_length()); }
+
+ std::size_t total_length() const { return minimum_length() + data_size(); }
+ static std::size_t minimum_length() { return 0x04; }
+
+private:
+ std::size_t m_length;
+};
+
-/**
- * @fn static inline UINT32 read_dword(UINT8 *buf)
- *
- * @brief Reads a double word.
- *
- * @param [in,out] buf If non-null, the buffer.
- *
- * @return The double word.
- */
-
-inline std::uint32_t read_dword(std::uint8_t const *buf)
+class local_file_header_reader : private reader_base
{
- return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
-}
+public:
+ local_file_header_reader(void const *buf) : reader_base(buf) { }
+
+ std::uint32_t signature() const { return read_dword(0x00); }
+ std::uint8_t version_needed() const { return m_buffer[0x04]; }
+ std::uint8_t os_needed() const { return m_buffer[0x05]; }
+ std::uint16_t general_flag() const { return read_word(0x06); }
+ std::uint16_t compression_method() const { return read_word(0x08); }
+ std::uint16_t modified_time() const { return read_word(0x0a); }
+ std::uint16_t modified_date() const { return read_word(0x0c); }
+ std::uint32_t crc32() const { return read_dword(0x0e); }
+ std::uint32_t compressed_size() const { return read_dword(0x12); }
+ std::uint32_t uncompressed_size() const { return read_dword(0x16); }
+ std::uint16_t file_name_length() const { return read_word(0x1a); }
+ std::uint16_t extra_field_length() const { return read_word(0x1c); }
+ std::string file_name() const { return read_string(0x1e, file_name_length()); }
+ void file_name(std::string &result) const { read_string(result, 0x1e, file_name_length()); }
+ extra_field_reader extra_field() const { return extra_field_reader(m_buffer + 0x1e + file_name_length(), extra_field_length()); }
+
+ bool signature_correct() const { return signature() == 0x04034b50; }
+
+ std::size_t total_length() const { return minimum_length() + file_name_length() + extra_field_length(); }
+ static std::size_t minimum_length() { return 0x1e; }
+};
+
+
+class central_dir_entry_reader : private reader_base
+{
+public:
+ central_dir_entry_reader(void const *buf) : reader_base(buf) { }
+
+ std::uint32_t signature() const { return read_dword(0x00); }
+ std::uint8_t version_created() const { return m_buffer[0x04]; }
+ std::uint8_t os_created() const { return m_buffer[0x05]; }
+ std::uint8_t version_needed() const { return m_buffer[0x06]; }
+ std::uint8_t os_needed() const { return m_buffer[0x07]; }
+ std::uint16_t general_flag() const { return read_word(0x08); }
+ std::uint16_t compression_method() const { return read_word(0x0a); }
+ std::uint16_t modified_time() const { return read_word(0x0c); }
+ std::uint16_t modified_date() const { return read_word(0x0e); }
+ std::uint32_t crc32() const { return read_dword(0x10); }
+ std::uint32_t compressed_size() const { return read_dword(0x14); }
+ std::uint32_t uncompressed_size() const { return read_dword(0x18); }
+ std::uint16_t file_name_length() const { return read_word(0x1c); }
+ std::uint16_t extra_field_length() const { return read_word(0x1e); }
+ std::uint16_t file_comment_length() const { return read_word(0x20); }
+ std::uint16_t start_disk() const { return read_word(0x22); }
+ std::uint16_t int_file_attr() const { return read_word(0x24); }
+ std::uint32_t ext_file_attr() const { return read_dword(0x26); }
+ std::uint32_t header_offset() const { return read_dword(0x2a); }
+ std::string file_name() const { return read_string(0x2e, file_name_length()); }
+ void file_name(std::string &result) const { read_string(result, 0x2e, file_name_length()); }
+ extra_field_reader extra_field() const { return extra_field_reader(m_buffer + 0x2e + file_name_length(), extra_field_length()); }
+ std::string file_comment() const { return read_string(0x2e + file_name_length() + extra_field_length(), file_comment_length()); }
+ void file_comment(std::string &result) const { read_string(result, 0x2e + file_name_length() + extra_field_length(), file_comment_length()); }
+
+ bool signature_correct() const { return signature() == 0x02014b50; }
+
+ std::size_t total_length() const { return minimum_length() + file_name_length() + extra_field_length() + file_comment_length(); }
+ static std::size_t minimum_length() { return 0x2e; }
+};
+
+
+class ecd64_reader : private reader_base
+{
+public:
+ ecd64_reader(void const *buf) : reader_base(buf) { }
+
+ std::uint32_t signature() const { return read_dword(0x00); }
+ std::uint64_t ecd64_size() const { return read_qword(0x04); }
+ std::uint8_t version_created() const { return m_buffer[0x0c]; }
+ std::uint8_t os_created() const { return m_buffer[0x0d]; }
+ std::uint8_t version_needed() const { return m_buffer[0x0e]; }
+ std::uint8_t os_needed() const { return m_buffer[0x0f]; }
+ std::uint32_t this_disk_no() const { return read_dword(0x10); }
+ std::uint32_t dir_start_disk() const { return read_dword(0x14); }
+ std::uint64_t dir_disk_entries() const { return read_qword(0x18); }
+ std::uint64_t dir_total_entries() const { return read_qword(0x20); }
+ std::uint64_t dir_size() const { return read_qword(0x28); }
+ std::uint64_t dir_offset() const { return read_qword(0x30); }
+ void const * extensible_data() const { return m_buffer + 0x38; }
+
+ bool signature_correct() const { return signature() == 0x06064b50; }
+
+ std::size_t total_length() const { return 0x0c + ecd64_size(); }
+ static std::size_t minimum_length() { return 0x38; }
+};
+
+
+class ecd64_locator_reader : private reader_base
+{
+public:
+ ecd64_locator_reader(void const *buf) : reader_base(buf) { }
+
+ std::uint32_t signature() const { return read_dword(0x00); }
+ std::uint32_t ecd64_disk() const { return read_dword(0x04); }
+ std::uint64_t ecd64_offset() const { return read_qword(0x08); }
+ std::uint32_t total_disks() const { return read_dword(0x10); }
+
+ bool signature_correct() const { return signature() == 0x07064b50; }
+
+ std::size_t total_length() const { return minimum_length(); }
+ static std::size_t minimum_length() { return 0x14; }
+};
+
+
+class ecd_reader : private reader_base
+{
+public:
+ ecd_reader(void const *buf) : reader_base(buf) { }
+
+ std::uint32_t signature() const { return read_dword(0x00); }
+ std::uint16_t this_disk_no() const { return read_word(0x04); }
+ std::uint16_t dir_start_disk() const { return read_word(0x06); }
+ std::uint16_t dir_disk_entries() const { return read_word(0x08); }
+ std::uint16_t dir_total_entries() const { return read_word(0x0a); }
+ std::uint32_t dir_size() const { return read_dword(0x0c); }
+ std::uint32_t dir_offset() const { return read_dword(0x10); }
+ std::uint16_t comment_length() const { return read_word(0x14); }
+ std::string comment() const { return read_string(0x16, comment_length()); }
+ void comment(std::string &result) const { read_string(result, 0x16, comment_length()); }
+
+ bool signature_correct() const { return signature() == 0x06054b50; }
+
+ std::size_t total_length() const { return minimum_length() + comment_length(); }
+ static std::size_t minimum_length() { return 0x16; }
+};
+
+
+class zip64_ext_info_reader : private reader_base
+{
+public:
+ template <typename T>
+ zip64_ext_info_reader(
+ T const &header,
+ extra_field_reader const &field)
+ : reader_base(field.data())
+ , m_uncompressed_size(header.uncompressed_size())
+ , m_compressed_size(header.compressed_size())
+ , m_header_offset(header.header_offset())
+ , m_start_disk(header.start_disk())
+ , m_offs_compressed_size(~m_uncompressed_size ? 0 : 8)
+ , m_offs_header_offset(m_offs_compressed_size + (~m_compressed_size ? 0 : 8))
+ , m_offs_start_disk(m_offs_header_offset + (~m_header_offset ? 0 : 8))
+ , m_offs_end(m_offs_start_disk + (~m_start_disk ? 0 : 4))
+ {
+ }
+
+ std::uint64_t uncompressed_size() const { return ~m_uncompressed_size ? m_uncompressed_size : read_qword(0x00); }
+ std::uint64_t compressed_size() const { return ~m_compressed_size ? m_compressed_size : read_qword(m_offs_compressed_size); }
+ std::uint64_t header_offset() const { return ~m_header_offset ? m_header_offset : read_qword(m_offs_header_offset); }
+ std::uint32_t start_disk() const { return ~m_start_disk ? m_start_disk : read_dword(m_offs_start_disk); }
+
+ std::size_t total_length() const { return minimum_length() + m_offs_end; }
+ static std::size_t minimum_length() { return 0x00; }
+
+private:
+ std::uint32_t m_uncompressed_size;
+ std::uint32_t m_compressed_size;
+ std::uint32_t m_header_offset;
+ std::uint16_t m_start_disk;
+
+ std::size_t m_offs_compressed_size;
+ std::size_t m_offs_header_offset;
+ std::size_t m_offs_start_disk;
+ std::size_t m_offs_end;
+};
+
+
+class utf8_path_reader : private reader_base
+{
+public:
+ utf8_path_reader(extra_field_reader const &field) : reader_base(field.data()), m_length(field.data_size()) { }
+
+ std::uint8_t version() const { return m_buffer[0]; }
+ std::uint32_t name_crc32() const { return read_dword(0x01); }
+ std::string unicode_name() const { return read_string(0x05, m_length - 0x05); }
+ void unicode_name(std::string &result) const { return read_string(result, 0x05, m_length - 0x05); }
+
+ std::size_t total_length() const { return m_length; }
+ static std::size_t minimum_length() { return 0x05; }
+
+private:
+ std::size_t m_length;
+};
+
+
+class general_flag_reader
+{
+public:
+ general_flag_reader(std::uint16_t val) : m_value(val) { }
+
+ bool encrypted() const { return bool(m_value & 0x0001); }
+ bool implode_8k_dict() const { return bool(m_value & 0x0002); }
+ bool implode_3_trees() const { return bool(m_value & 0x0004); }
+ unsigned deflate_option() const { return unsigned((m_value >> 1) & 0x0003); }
+ bool lzma_eos_mark() const { return bool(m_value & 0x0002); }
+ bool use_descriptor() const { return bool(m_value & 0x0008); }
+ bool patch_data() const { return bool(m_value & 0x0020); }
+ bool strong_encryption() const { return bool(m_value & 0x0040); }
+ bool utf8_encoding() const { return bool(m_value & 0x0800); }
+ bool directory_encryption() const { return bool(m_value & 0x2000); }
+
+private:
+ std::uint16_t m_value;
+};
@@ -359,19 +577,12 @@ std::mutex zip_file_impl::s_cache_mutex;
to the cache
-------------------------------------------------*/
-/**
- * @fn void zip_file_close(zip_file *zip)
- *
- * @brief Zip file close.
- *
- * @param [in,out] zip If non-null, the zip.
- */
-
void zip_file_impl::close(ptr &&zip)
{
if (!zip) return;
// close the open files
+ osd_printf_verbose("unzip: closing archive file %s and sending to cache\n", zip->m_filename.c_str());
zip->m_file.reset();
// find the first NULL entry in the cache
@@ -383,7 +594,11 @@ void zip_file_impl::close(ptr &&zip)
// if no room left in the cache, free the bottommost entry
if (cachenum == s_cache.size())
- s_cache[--cachenum].reset();
+ {
+ cachenum--;
+ osd_printf_verbose("unzip: removing %s from cache to make space\n", s_cache[cachenum]->m_filename.c_str());
+ s_cache[cachenum].reset();
+ }
// move everyone else down and place us at the top
for ( ; cachenum > 0; cachenum--)
@@ -397,67 +612,90 @@ void zip_file_impl::close(ptr &&zip)
***************************************************************************/
/*-------------------------------------------------
- zip_file_first_entry - return the first entry
- in the ZIP
--------------------------------------------------*/
-
-/*-------------------------------------------------
- zip_file_next_entry - return the next entry
- in the ZIP
+ zip_file_search - return the next matching
+ entry in the ZIP
-------------------------------------------------*/
int zip_file_impl::search(std::uint32_t search_crc, const std::string &search_filename, bool matchcrc, bool matchname, bool partialpath)
{
// if we're at or past the end, we're done
- std::string filename;
- while ((m_cd_pos + ZIPCFN) <= m_ecd.cd_size)
+ while ((m_cd_pos + central_dir_entry_reader::minimum_length()) <= m_ecd.cd_size)
{
- // extract file header info
- std::uint8_t const *const raw = &m_cd[0] + m_cd_pos;
- m_header.signature = read_dword(raw + ZIPCENSIG);
- m_header.version_created = read_word (raw + ZIPCVER);
- m_header.version_needed = read_word (raw + ZIPCVXT);
- m_header.bit_flag = read_word (raw + ZIPCFLG);
- m_header.compression = read_word (raw + ZIPCMTHD);
- m_header.file_time = read_word (raw + ZIPCTIM);
- m_header.file_date = read_word (raw + ZIPCDAT);
- m_header.crc = read_dword(raw + ZIPCCRC);
- m_header.compressed_length = read_dword(raw + ZIPCSIZ);
- m_header.uncompressed_length = read_dword(raw + ZIPCUNC);
- m_header.filename_length = read_word (raw + ZIPCFNL);
- m_header.extra_field_length = read_word (raw + ZIPCXTL);
- m_header.file_comment_length = read_word (raw + ZIPCCML);
- m_header.start_disk_number = read_word (raw + ZIPDSK);
- m_header.internal_attributes = read_word (raw + ZIPINT);
- m_header.external_attributes = read_dword(raw + ZIPEXT);
- m_header.local_header_offset = read_dword(raw + ZIPOFST);
- m_header.filename = reinterpret_cast<const char *>(raw + ZIPCFN);
-
// make sure we have enough data
- std::uint32_t const rawlength = ZIPCFN + m_header.filename_length + m_header.extra_field_length + m_header.file_comment_length;
- if ((m_cd_pos + rawlength) > m_ecd.cd_size)
+ central_dir_entry_reader const reader(&m_cd[0] + m_cd_pos);
+ if (!reader.signature_correct() || ((m_cd_pos + reader.total_length()) > m_ecd.cd_size))
break;
+ // extract file header info
+ m_header.version_created = reader.version_created();
+ m_header.version_needed = reader.version_needed();
+ m_header.bit_flag = reader.general_flag();
+ m_header.compression = reader.compression_method();
+ m_header.crc = reader.crc32();
+ m_header.compressed_length = reader.compressed_size();
+ m_header.uncompressed_length = reader.uncompressed_size();
+ m_header.start_disk_number = reader.start_disk();
+ m_header.local_header_offset = reader.header_offset();
+
// advance the position
- m_cd_pos += rawlength;
+ m_cd_pos += reader.total_length();
- // copy the filename filename
- bool const is_dir((m_header.filename_length > 0) && (m_header.filename[m_header.filename_length - 1] == '/'));
- filename.assign(m_header.filename, m_header.filename_length - (is_dir ? 1 : 0));
+ // copy the filename
+ bool is_utf8(general_flag_reader(m_header.bit_flag).utf8_encoding());
+ reader.file_name(m_header.file_name);
+
+ // walk the extra data
+ for (auto extra = reader.extra_field(); extra.length_sufficient(); extra = extra.next())
+ {
+ // look for ZIP64 extended info
+ if ((extra.header_id() == 0x0001) && (extra.data_size() >= zip64_ext_info_reader::minimum_length()))
+ {
+ zip64_ext_info_reader const ext64(reader, extra);
+ if (extra.data_size() >= ext64.total_length())
+ {
+ m_header.compressed_length = ext64.compressed_size();
+ m_header.uncompressed_length = ext64.uncompressed_size();
+ m_header.start_disk_number = ext64.start_disk();
+ m_header.local_header_offset = ext64.header_offset();
+ }
+ }
+
+ // look for Info-ZIP UTF-8 path
+ if (!is_utf8 && (extra.header_id() == 0x7075) && (extra.data_size() >= utf8_path_reader::minimum_length()))
+ {
+ utf8_path_reader const utf8path(extra);
+ if (utf8path.version() == 1)
+ {
+ auto const addr(m_header.file_name.empty() ? nullptr : &m_header.file_name[0]);
+ auto const length(m_header.file_name.empty() ? 0 : m_header.file_name.length() * sizeof(m_header.file_name[0]));
+ auto const crc(crc32_creator::simple(addr, length));
+ if (utf8path.name_crc32() == crc.m_raw)
+ {
+ utf8path.unicode_name(m_header.file_name);
+ is_utf8 = true;
+ }
+ }
+ }
+ }
+
+ // FIXME: if (!is_utf8) convert filename to UTF8 (assume CP437 or something)
+
+ // chop off trailing slash for directory entries
+ bool const is_dir(!m_header.file_name.empty() && (m_header.file_name.back() == '/'));
+ if (is_dir) m_header.file_name.resize(m_header.file_name.length() - 1);
// check to see if it matches query
bool const crcmatch(search_crc == m_header.crc);
- auto const partialoffset(filename.length() - search_filename.length());
- bool const partialpossible((filename.length() > search_filename.length()) && (filename[partialoffset - 1] == '/'));
+ auto const partialoffset(m_header.file_name.length() - search_filename.length());
+ bool const partialpossible((m_header.file_name.length() > search_filename.length()) && (m_header.file_name[partialoffset - 1] == '/'));
const bool namematch(
- !core_stricmp(search_filename.c_str(), filename.c_str()) ||
- (partialpath && partialpossible && !core_stricmp(search_filename.c_str(), filename.c_str() + partialoffset)));
+ !core_stricmp(search_filename.c_str(), m_header.file_name.c_str()) ||
+ (partialpath && partialpossible && !core_stricmp(search_filename.c_str(), m_header.file_name.c_str() + partialoffset)));
bool const found = ((!matchcrc && !matchname) || !is_dir) && (!matchcrc || crcmatch) && (!matchname || namematch);
if (found)
{
m_curr_is_dir = is_dir;
- m_curr_name = std::move(filename);
return 0;
}
}
@@ -470,18 +708,6 @@ int zip_file_impl::search(std::uint32_t search_crc, const std::string &search_fi
from a ZIP into the target buffer
-------------------------------------------------*/
-/**
- * @fn zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length)
- *
- * @brief Zip file decompress.
- *
- * @param [in,out] zip If non-null, the zip.
- * @param [in,out] buffer If non-null, the buffer.
- * @param length The length.
- *
- * @return A zip_error.
- */
-
archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length)
{
archive_file::error ziperr;
@@ -489,11 +715,17 @@ archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length
// if we don't have enough buffer, error
if (length < m_header.uncompressed_length)
+ {
+ osd_printf_error("unzip: buffer too small to decompress %s from %s\n", m_header.file_name.c_str(), m_filename.c_str());
return archive_file::error::BUFFER_TOO_SMALL;
+ }
// make sure the info in the header aligns with what we know
if (m_header.start_disk_number != m_ecd.disk_number)
+ {
+ osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name.c_str(), m_filename.c_str());
return archive_file::error::UNSUPPORTED;
+ }
// get the compressed data offset
ziperr = get_compressed_data_offset(offset);
@@ -511,7 +743,14 @@ archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length
ziperr = decompress_data_type_8(offset, buffer, length);
break;
+ case 14:
+ ziperr = decompress_data_type_14(offset, buffer, length);
+ break;
+
default:
+ osd_printf_error(
+ "unzip: %s in %s uses unsupported compression method %u\n",
+ m_header.file_name.c_str(), m_filename.c_str(), m_header.compression);
ziperr = archive_file::error::UNSUPPORTED;
break;
}
@@ -528,16 +767,6 @@ archive_file::error zip_file_impl::decompress(void *buffer, std::uint32_t length
read_ecd - read the ECD data
-------------------------------------------------*/
-/**
- * @fn static zip_error read_ecd(zip_file *zip)
- *
- * @brief Reads an ecd.
- *
- * @param [in,out] zip If non-null, the zip.
- *
- * @return The ecd.
- */
-
archive_file::error zip_file_impl::read_ecd()
{
// make sure the file handle is open
@@ -546,6 +775,8 @@ archive_file::error zip_file_impl::read_ecd()
return ziperr;
// we may need multiple tries
+ osd_file::error error;
+ std::uint32_t read_length;
std::uint32_t buflen = 1024;
while (buflen < 65536)
{
@@ -556,50 +787,136 @@ archive_file::error zip_file_impl::read_ecd()
// allocate buffer
std::unique_ptr<std::uint8_t []> buffer;
try { buffer.reset(new std::uint8_t[buflen + 1]); }
- catch (...) { return archive_file::error::OUT_OF_MEMORY; }
+ catch (...)
+ {
+ osd_printf_error("unzip: %s failed to allocate memory for ECD search\n", m_filename.c_str());
+ return archive_file::error::OUT_OF_MEMORY;
+ }
// read in one buffers' worth of data
- std::uint32_t read_length;
- auto const error = m_file->read(&buffer[0], m_length - buflen, buflen, read_length);
- if (error != osd_file::error::NONE || read_length != buflen)
+ error = m_file->read(&buffer[0], m_length - buflen, buflen, read_length);
+ if ((error != osd_file::error::NONE) || (read_length != buflen))
+ {
+ osd_printf_error("unzip: %s error reading file to search for ECD (%d)\n", m_filename.c_str(), int(error));
return archive_file::error::FILE_ERROR;
+ }
// find the ECD signature
std::int32_t offset;
- for (offset = buflen - 22; offset >= 0; offset--)
- if (buffer[offset + 0] == 'P' && buffer[offset + 1] == 'K' && buffer[offset + 2] == 0x05 && buffer[offset + 3] == 0x06)
+ for (offset = buflen - ecd_reader::minimum_length(); offset >= 0; offset--)
+ {
+ ecd_reader reader(buffer.get() + offset);
+ if (reader.signature_correct() && ((reader.total_length() + offset) <= buflen))
break;
+ }
// if we found it, fill out the data
if (offset >= 0)
{
- // reuse the buffer as our ECD buffer
- m_ecd.raw = std::move(buffer);
- m_ecd.rawlength = buflen - offset;
-
- /* append a NULL terminator to the comment */
- memmove(&m_ecd.raw[0], &m_ecd.raw[offset], m_ecd.rawlength);
- m_ecd.raw[m_ecd.rawlength] = 0;
-
- /* extract ecd info */
- m_ecd.signature = read_dword(&m_ecd.raw[ZIPESIG]);
- m_ecd.disk_number = read_word (&m_ecd.raw[ZIPEDSK]);
- m_ecd.cd_start_disk_number = read_word (&m_ecd.raw[ZIPECEN]);
- m_ecd.cd_disk_entries = read_word (&m_ecd.raw[ZIPENUM]);
- m_ecd.cd_total_entries = read_word (&m_ecd.raw[ZIPECENN]);
- m_ecd.cd_size = read_dword(&m_ecd.raw[ZIPECSZ]);
- m_ecd.cd_start_disk_offset = read_dword(&m_ecd.raw[ZIPEOFST]);
- m_ecd.comment_length = read_word (&m_ecd.raw[ZIPECOML]);
- m_ecd.comment = reinterpret_cast<const char *>(&m_ecd.raw[ZIPECOM]);
+ osd_printf_verbose("unzip: found %s ECD\n", m_filename.c_str());
+
+ // extract ECD info
+ ecd_reader const ecd_rd(buffer.get() + offset);
+ m_ecd.disk_number = ecd_rd.this_disk_no();
+ m_ecd.cd_start_disk_number = ecd_rd.dir_start_disk();
+ m_ecd.cd_disk_entries = ecd_rd.dir_disk_entries();
+ m_ecd.cd_total_entries = ecd_rd.dir_total_entries();
+ m_ecd.cd_size = ecd_rd.dir_size();
+ m_ecd.cd_start_disk_offset = ecd_rd.dir_offset();
+
+ // is the file too small to contain a ZIP64 ECD locator?
+ if ((m_length - buflen + offset) < ecd64_locator_reader::minimum_length())
+ {
+ osd_printf_verbose("unzip: %s too small to contain ZIP64 ECD locator\n", m_filename.c_str());
+ return archive_file::error::NONE;
+ }
+
+ // try to read the ZIP64 ECD locator
+ error = m_file->read(
+ &buffer[0],
+ m_length - buflen + offset - ecd64_locator_reader::minimum_length(),
+ ecd64_locator_reader::minimum_length(),
+ read_length);
+ if ((error != osd_file::error::NONE) || (read_length != ecd64_locator_reader::minimum_length()))
+ {
+ osd_printf_error("unzip: error reading %s to search for ZIP64 ECD locator (%d)\n", m_filename.c_str(), int(error));
+ return archive_file::error::FILE_ERROR;
+ }
+
+ // if the signature isn't correct, it's not a ZIP64 archive
+ ecd64_locator_reader const ecd64_loc_rd(buffer.get());
+ if (!ecd64_loc_rd.signature_correct())
+ {
+ osd_printf_verbose("unzip: %s has no ZIP64 ECD locator\n", m_filename.c_str());
+ return archive_file::error::NONE;
+ }
+
+ // check that the ZIP64 ECD is in this segment (assuming this segment is the last segment)
+ if ((ecd64_loc_rd.ecd64_disk() + 1) != ecd64_loc_rd.total_disks())
+ {
+ osd_printf_error("unzip: %s ZIP64 ECD resides in a different segment\n", m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+
+ // try to read the ZIP64 ECD
+ error = m_file->read(&buffer[0], ecd64_loc_rd.ecd64_offset(), ecd64_reader::minimum_length(), read_length);
+ if (error != osd_file::error::NONE)
+ {
+ osd_printf_error("unzip: error reading %s ZIP64 ECD (%d)\n", m_filename.c_str(), int(error));
+ return archive_file::error::FILE_ERROR;
+ }
+ if (read_length != ecd64_reader::minimum_length())
+ {
+ osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s ZIP64 ECD\n", m_filename.c_str());
+ return archive_file::error::FILE_TRUNCATED;
+ }
+
+ // check ZIP64 ECD
+ ecd64_reader const ecd64_rd(buffer.get());
+ if (!ecd64_rd.signature_correct())
+ {
+ osd_printf_error(
+ "unzip: %s ZIP64 ECD has incorrect signature 0x%08lx\n",
+ m_filename.c_str(), long(ecd64_rd.signature()));
+ return archive_file::error::BAD_SIGNATURE;
+ }
+ if (ecd64_rd.total_length() < ecd64_reader::minimum_length())
+ {
+ osd_printf_error("unzip: %s ZIP64 ECD appears to be too small\n", m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+ if (ecd64_rd.version_needed() > 63)
+ {
+ osd_printf_error(
+ "unzip: %s ZIP64 ECD requires unsupported version %u.%u\n",
+ m_filename.c_str(), unsigned(ecd64_rd.version_needed() / 10), unsigned(ecd64_rd.version_needed() % 10));
+ return archive_file::error::UNSUPPORTED;
+ }
+ osd_printf_verbose("unzip: found %s ZIP64 ECD\n", m_filename.c_str());
+
+ // extract ZIP64 ECD info
+ m_ecd.disk_number = ecd64_rd.this_disk_no();
+ m_ecd.cd_start_disk_number = ecd64_rd.dir_start_disk();
+ m_ecd.cd_disk_entries = ecd64_rd.dir_disk_entries();
+ m_ecd.cd_total_entries = ecd64_rd.dir_total_entries();
+ m_ecd.cd_size = ecd64_rd.dir_size();
+ m_ecd.cd_start_disk_offset = ecd64_rd.dir_offset();
+
return archive_file::error::NONE;
}
// didn't find it; free this buffer and expand our search
if (buflen < m_length)
+ {
buflen *= 2;
+ }
else
+ {
+ osd_printf_error("unzip: %s couldn't find ECD\n", m_filename.c_str());
return archive_file::error::BAD_SIGNATURE;
+ }
}
+ osd_printf_error("unzip: %s couldn't find ECD in last 64KiB\n", m_filename.c_str());
return archive_file::error::OUT_OF_MEMORY;
}
@@ -609,19 +926,33 @@ archive_file::error zip_file_impl::read_ecd()
offset of the compressed data
-------------------------------------------------*/
-/**
- * @fn static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset)
- *
- * @brief Gets compressed data offset.
- *
- * @param [in,out] zip If non-null, the zip.
- * @param [in,out] offset If non-null, the offset.
- *
- * @return The compressed data offset.
- */
-
archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &offset)
{
+ // don't support a number of features
+ general_flag_reader const flags(m_header.bit_flag);
+ if (m_header.start_disk_number != m_ecd.disk_number)
+ {
+ osd_printf_error("unzip: %s does not reside in segment %s\n", m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+ if (m_header.version_needed > 63)
+ {
+ osd_printf_error(
+ "unzip: %s in %s requires unsupported version %u.%u\n",
+ m_header.file_name.c_str(), m_filename.c_str(), unsigned(m_header.version_needed / 10), unsigned(m_header.version_needed % 10));
+ return archive_file::error::UNSUPPORTED;
+ }
+ if (flags.encrypted() || flags.strong_encryption())
+ {
+ osd_printf_error("unzip: %s in %s is encrypted\n", m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+ if (flags.patch_data())
+ {
+ osd_printf_error("unzip: %s in %s is compressed patch data\n", m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+
// make sure the file handle is open
auto const ziperr = reopen();
if (ziperr != archive_file::error::NONE)
@@ -629,14 +960,32 @@ archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &off
// now go read the fixed-sized part of the local file header
std::uint32_t read_length;
- auto const error = m_file->read(&m_buffer[0], m_header.local_header_offset, ZIPNAME, read_length);
- if (error != osd_file::error::NONE || read_length != ZIPNAME)
- return (error == osd_file::error::NONE) ? archive_file::error::FILE_TRUNCATED : archive_file::error::FILE_ERROR;
+ auto const error = m_file->read(&m_buffer[0], m_header.local_header_offset, local_file_header_reader::minimum_length(), read_length);
+ if (error != osd_file::error::NONE)
+ {
+ osd_printf_error(
+ "unzip: error reading local file header for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(error));
+ return archive_file::error::FILE_ERROR;
+ }
+ if (read_length != local_file_header_reader::minimum_length())
+ {
+ osd_printf_error(
+ "unzip: unexpectedly reached end-of-file while reading local file header for %s in %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::FILE_TRUNCATED;
+ }
- /* compute the final offset */
- offset = m_header.local_header_offset + ZIPNAME;
- offset += read_word(&m_buffer[ZIPFNLN]);
- offset += read_word(&m_buffer[ZIPXTRALN]);
+ // compute the final offset
+ local_file_header_reader reader(&m_buffer[0]);
+ if (!reader.signature_correct())
+ {
+ osd_printf_error(
+ "unzip: local file header for %s in %s has incorrect signature %04lx\n",
+ m_header.file_name.c_str(), m_filename.c_str(), long(reader.signature()));
+ return archive_file::error::BAD_SIGNATURE;
+ }
+ offset = m_header.local_header_offset + reader.total_length();
return archive_file::error::NONE;
}
@@ -652,31 +1001,25 @@ archive_file::error zip_file_impl::get_compressed_data_offset(std::uint64_t &off
type 0 data (which is uncompressed)
-------------------------------------------------*/
-/**
- * @fn static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length)
- *
- * @brief Decompress the data type 0.
- *
- * @param [in,out] zip If non-null, the zip.
- * @param offset The offset.
- * @param [in,out] buffer If non-null, the buffer.
- * @param length The length.
- *
- * @return A zip_error.
- */
-
archive_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset, void *buffer, std::uint32_t length)
{
- std::uint32_t read_length;
-
// the data is uncompressed; just read it
+ std::uint32_t read_length(0);
auto const filerr = m_file->read(buffer, offset, m_header.compressed_length, read_length);
if (filerr != osd_file::error::NONE)
+ {
+ osd_printf_error("unzip: error reading %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
return archive_file::error::FILE_ERROR;
+ }
else if (read_length != m_header.compressed_length)
+ {
+ osd_printf_error("unzip: unexpectedly reached end-of-file while reading %s from %s\n", m_header.file_name.c_str(), m_filename.c_str());
return archive_file::error::FILE_TRUNCATED;
+ }
else
+ {
return archive_file::error::NONE;
+ }
}
@@ -685,55 +1028,56 @@ archive_file::error zip_file_impl::decompress_data_type_0(std::uint64_t offset,
type 8 data (which is deflated)
-------------------------------------------------*/
-/**
- * @fn static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length)
- *
- * @brief Decompress the data type 8.
- *
- * @param [in,out] zip If non-null, the zip.
- * @param offset The offset.
- * @param [in,out] buffer If non-null, the buffer.
- * @param length The length.
- *
- * @return A zip_error.
- */
-
archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset, void *buffer, std::uint32_t length)
{
- std::uint32_t input_remaining = m_header.compressed_length;
+ std::uint64_t input_remaining = m_header.compressed_length;
int zerr;
- // make sure we don't need a newer mechanism
- if (m_header.version_needed > 0x14)
- return archive_file::error::UNSUPPORTED;
-
- /* reset the stream */
+ // reset the stream
z_stream stream;
- memset(&stream, 0, sizeof(stream));
- stream.next_out = (Bytef *)buffer;
+ stream.zalloc = Z_NULL;
+ stream.zfree = Z_NULL;
+ stream.opaque = Z_NULL;
+ stream.avail_in = 0;
+ stream.next_out = reinterpret_cast<Bytef *>(buffer);
stream.avail_out = length;
// initialize the decompressor
zerr = inflateInit2(&stream, -MAX_WBITS);
if (zerr != Z_OK)
+ {
+ osd_printf_error(
+ "unzip: error allocating zlib stream to inflate %s from %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), zerr);
return archive_file::error::DECOMPRESS_ERROR;
+ }
// loop until we're done
while (1)
{
// read in the next chunk of data
- std::uint32_t read_length;
- auto const filerr = m_file->read(&m_buffer[0], offset, (std::min<std::uint32_t>)(input_remaining, m_buffer.size()), read_length);
+ std::uint32_t read_length(0);
+ auto const filerr = m_file->read(
+ &m_buffer[0],
+ offset,
+ std::uint32_t((std::min<std::uint64_t>)(input_remaining, m_buffer.size())),
+ read_length);
if (filerr != osd_file::error::NONE)
{
+ osd_printf_error(
+ "unzip: error reading compressed data for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
inflateEnd(&stream);
return archive_file::error::FILE_ERROR;
}
offset += read_length;
// if we read nothing, but still have data left, the file is truncated
- if (read_length == 0 && input_remaining > 0)
+ if ((read_length == 0) && (input_remaining > 0))
{
+ osd_printf_error(
+ "unzip: unexpectedly reached end-of-file while reading compressed data for %s in %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
inflateEnd(&stream);
return archive_file::error::FILE_TRUNCATED;
}
@@ -750,9 +1094,12 @@ archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset,
// now inflate
zerr = inflate(&stream, Z_NO_FLUSH);
if (zerr == Z_STREAM_END)
+ {
break;
- if (zerr != Z_OK)
+ }
+ else if (zerr != Z_OK)
{
+ osd_printf_error("unzip: error inflating %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), zerr);
inflateEnd(&stream);
return archive_file::error::DECOMPRESS_ERROR;
}
@@ -761,15 +1108,210 @@ archive_file::error zip_file_impl::decompress_data_type_8(std::uint64_t offset,
// finish decompression
zerr = inflateEnd(&stream);
if (zerr != Z_OK)
+ {
+ osd_printf_error("unzip: error finishing inflation of %s from %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), zerr);
return archive_file::error::DECOMPRESS_ERROR;
+ }
- /* if anything looks funny, report an error */
- if (stream.avail_out > 0 || input_remaining > 0)
+ // if anything looks funny, report an error
+ if ((stream.avail_out > 0) || (input_remaining > 0))
+ {
+ osd_printf_error(
+ "unzip: inflation of %s from %s doesn't appear to have completed correctly\n",
+ m_header.file_name.c_str(), m_filename.c_str());
return archive_file::error::DECOMPRESS_ERROR;
+ }
return archive_file::error::NONE;
}
+
+/*-------------------------------------------------
+ decompress_data_type_14 - decompress
+ type 14 data (LZMA)
+-------------------------------------------------*/
+
+archive_file::error zip_file_impl::decompress_data_type_14(std::uint64_t offset, void *buffer, std::uint32_t length)
+{
+ // two-byte version
+ // two-byte properties size (little-endian)
+ // properties
+ // compressed data
+
+ assert(4 <= m_buffer.size());
+ assert(LZMA_PROPS_SIZE <= m_buffer.size());
+
+ bool const eos_mark(general_flag_reader(m_header.bit_flag).lzma_eos_mark());
+ Byte *const output(reinterpret_cast<Byte *>(buffer));
+ SizeT output_remaining(length);
+ std::uint64_t input_remaining(m_header.compressed_length);
+
+ std::uint32_t read_length;
+ osd_file::error filerr;
+ SRes lzerr;
+ ELzmaStatus lzstatus(LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK);
+
+ // reset the stream
+ ISzAlloc alloc_imp;
+ alloc_imp.Alloc = [](void *p, std::size_t size) -> void * { return (size == 0) ? nullptr : std::malloc(size); };
+ alloc_imp.Free = [](void *p, void *address) -> void { std::free(address); };
+ CLzmaDec stream;
+ LzmaDec_Construct(&stream);
+
+ // need to read LZMA properties before we can initialise the decompressor
+ if (4 > input_remaining)
+ {
+ osd_printf_error(
+ "unzip:compressed data for %s in %s is too small to hold LZMA properties header\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ filerr = m_file->read(&m_buffer[0], offset, 4, read_length);
+ if (filerr != osd_file::error::NONE)
+ {
+ osd_printf_error(
+ "unzip: error reading LZMA properties header for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
+ return archive_file::error::FILE_ERROR;
+ }
+ offset += read_length;
+ input_remaining -= read_length;
+ if (4 != read_length)
+ {
+ osd_printf_error(
+ "unzip: unexpectedly reached end-of-file while reading LZMA properties header for %s in %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::FILE_TRUNCATED;
+ }
+ std::uint16_t const props_size((std::uint16_t(m_buffer[3]) << 8) | std::uint16_t(m_buffer[2]));
+ if (props_size > m_buffer.size())
+ {
+ osd_printf_error(
+ "unzip: %s in %s has excessively large LZMA properties\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::UNSUPPORTED;
+ }
+ else if (props_size > input_remaining)
+ {
+ osd_printf_error(
+ "unzip:compressed data for %s in %s is too small to hold LZMA properties\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ filerr = m_file->read(&m_buffer[0], offset, props_size, read_length);
+ if (filerr != osd_file::error::NONE)
+ {
+ osd_printf_error(
+ "unzip: error reading LZMA properties for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
+ return archive_file::error::FILE_ERROR;
+ }
+ offset += read_length;
+ input_remaining -= read_length;
+ if (props_size != read_length)
+ {
+ osd_printf_error(
+ "unzip: unexpectedly reached end-of-file while reading LZMA properties for %s in %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::FILE_TRUNCATED;
+ }
+
+ // initialize the decompressor
+ lzerr = LzmaDec_Allocate(&stream, &m_buffer[0], props_size, &alloc_imp);
+ if (SZ_ERROR_MEM == lzerr)
+ {
+ osd_printf_error(
+ "unzip: memory error allocating LZMA decoder to decompress %s from %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ return archive_file::error::OUT_OF_MEMORY;
+ }
+ else if (SZ_OK != lzerr)
+ {
+ osd_printf_error(
+ "unzip: error allocating LZMA decoder to decompress %s from %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(lzerr));
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ LzmaDec_Init(&stream);
+
+ // loop until we're done
+ while (0 < input_remaining)
+ {
+ // read in the next chunk of data
+ filerr = m_file->read(
+ &m_buffer[0],
+ offset,
+ std::uint32_t((std::min<std::uint64_t>)(input_remaining, m_buffer.size())),
+ read_length);
+ if (filerr != osd_file::error::NONE)
+ {
+ osd_printf_error(
+ "unzip: error reading compressed data for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(filerr));
+ LzmaDec_Free(&stream, &alloc_imp);
+ return archive_file::error::FILE_ERROR;
+ }
+ offset += read_length;
+ input_remaining -= read_length;
+
+ // if we read nothing, but still have data left, the file is truncated
+ if ((0 == read_length) && (0 < input_remaining))
+ {
+ osd_printf_error(
+ "unzip: unexpectedly reached end-of-file while reading compressed data for %s in %s\n",
+ m_header.file_name.c_str(), m_filename.c_str());
+ LzmaDec_Free(&stream, &alloc_imp);
+ return archive_file::error::FILE_TRUNCATED;
+ }
+
+ // now decompress
+ SizeT len(read_length);
+ // FIXME: is the input length really an in/out parameter or not?
+ // At least on reaching the end of the input, the input length doesn't seem to get updated
+ lzerr = LzmaDec_DecodeToBuf(
+ &stream,
+ output + length - output_remaining,
+ &output_remaining,
+ reinterpret_cast<Byte const *>(&m_buffer[0]),
+ &len,
+ ((0 == input_remaining) && eos_mark) ? LZMA_FINISH_END : LZMA_FINISH_ANY,
+ &lzstatus);
+ if (SZ_OK != lzerr)
+ {
+ osd_printf_error("unzip: error decoding LZMA data for %s in %s (%d)\n", m_header.file_name.c_str(), m_filename.c_str(), int(lzerr));
+ LzmaDec_Free(&stream, &alloc_imp);
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ }
+
+ // finish decompression
+ LzmaDec_Free(&stream, &alloc_imp);
+
+ // if anything looks funny, report an error
+ if (LZMA_STATUS_FINISHED_WITH_MARK == lzstatus)
+ {
+ return archive_file::error::NONE;
+ }
+ else if (eos_mark)
+ {
+ osd_printf_error(
+ "unzip: LZMA end mark not found for %s in %s (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(lzstatus));
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ else if (LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK != lzstatus)
+ {
+ osd_printf_error(
+ "unzip: LZMA decompression of %s from %s doesn't appear to have completed correctly (%d)\n",
+ m_header.file_name.c_str(), m_filename.c_str(), int(lzstatus));
+ return archive_file::error::DECOMPRESS_ERROR;
+ }
+ else
+ {
+ return archive_file::error::NONE;
+ }
+}
+
} // anonymous namespace
@@ -790,17 +1332,6 @@ void m7z_file_cache_clear();
zip_file_open - opens a ZIP file for reading
-------------------------------------------------*/
-/**
- * @fn zip_error zip_file_open(const char *filename, zip_file **zip)
- *
- * @brief Queries if a given zip file open.
- *
- * @param filename Filename of the file.
- * @param [in,out] zip If non-null, the zip.
- *
- * @return A zip_error.
- */
-
archive_file::error archive_file::open_zip(const std::string &filename, ptr &result)
{
// ensure we start with a NULL result
diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h
index 486d17c5978..687f984622c 100644
--- a/src/lib/util/vbiparse.h
+++ b/src/lib/util/vbiparse.h
@@ -13,6 +13,7 @@
#ifndef __VBIPARSE_H__
#define __VBIPARSE_H__
+#include "osdcomm.h"
/***************************************************************************
CONSTANTS
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp
index f16dcf824e6..1e4fb6dd293 100644
--- a/src/lib/util/zippath.cpp
+++ b/src/lib/util/zippath.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include <cctype>
+#include <forward_list>
#include <new>
@@ -26,20 +27,6 @@ namespace util {
***************************************************************************/
/**
- * @struct zippath_returned_directory
- *
- * @brief A zippath returned directory.
- */
-
-struct zippath_returned_directory
-{
- /** @brief The next. */
- zippath_returned_directory *next;
- /** @brief The name. */
- std::string name;
-};
-
-/**
* @class zippath_directory
*
* @brief A zippath directory.
@@ -49,11 +36,13 @@ class zippath_directory
{
public:
zippath_directory()
- : returned_parent(false),
- directory(nullptr),
- called_zip_first(false),
- zipfile(nullptr),
- returned_dirlist(nullptr) { }
+ : returned_parent(false)
+ , directory(nullptr)
+ , called_zip_first(false)
+ , zipfile(nullptr)
+ , returned_dirlist()
+ {
+ }
/* common */
/** @brief true to returned parent. */
@@ -73,7 +62,7 @@ public:
/** @brief The zipprefix. */
std::string zipprefix;
/** @brief The returned dirlist. */
- zippath_returned_directory *returned_dirlist;
+ std::forward_list<std::string> returned_dirlist;
};
@@ -856,12 +845,7 @@ void zippath_closedir(zippath_directory *directory)
if (directory->zipfile != nullptr)
directory->zipfile.reset();
- while (directory->returned_dirlist != nullptr)
- {
- zippath_returned_directory *dirlist = directory->returned_dirlist;
- directory->returned_dirlist = directory->returned_dirlist->next;
- delete dirlist;
- }
+ directory->returned_dirlist.clear();
delete directory;
}
@@ -887,24 +871,28 @@ void zippath_closedir(zippath_directory *directory)
static const char *get_relative_path(zippath_directory const &directory)
{
auto len = directory.zipprefix.length();
- const char *prefix = directory.zipprefix.c_str();
+ char const *prefix = directory.zipprefix.c_str();
while (is_zip_file_separator(*prefix))
{
len--;
prefix++;
}
- if ((len <= directory.zipfile->current_name().length()) &&
- !strncmp(prefix, directory.zipfile->current_name().c_str(), len))
+ std::string const &current(directory.zipfile->current_name());
+ char const *result = directory.zipfile->current_name().c_str() + len;
+ if ((current.length() >= len) &&
+ !strncmp(prefix, current.c_str(), len) &&
+ (!*prefix || is_zip_file_separator(*result) || is_zip_file_separator(directory.zipprefix.back())))
{
- const char *result = &directory.zipfile->current_name().c_str()[len];
while (is_zip_file_separator(*result))
result++;
return *result ? result : nullptr;
}
-
- return nullptr;
+ else
+ {
+ return nullptr;
+ }
}
@@ -925,11 +913,6 @@ static const char *get_relative_path(zippath_directory const &directory)
const osd_directory_entry *zippath_readdir(zippath_directory *directory)
{
const osd_directory_entry *result = nullptr;
- int header;
- const char *relpath;
- const char *separator;
- const char *s;
- zippath_returned_directory *rdent;
if (!directory->returned_parent)
{
@@ -947,10 +930,10 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
{
result = osd_readdir(directory->directory);
}
- while((result != nullptr) && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
+ while (result && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
/* special case - is this entry a ZIP file? if so we need to return it as a "directory" */
- if ((result != nullptr) && (is_zip_file(result->name) || is_7z_file(result->name)))
+ if (result && (is_zip_file(result->name) || is_7z_file(result->name)))
{
/* copy; but change the entry type */
directory->returned_entry = *result;
@@ -960,47 +943,46 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
}
else if (directory->zipfile)
{
+ char const *relpath;
do
{
/* a zip file read */
+ int header;
do
{
- if (!directory->called_zip_first)
- header = directory->zipfile->first_file();
- else
- header = directory->zipfile->next_file();
+ header = directory->called_zip_first ? directory->zipfile->next_file() : directory->zipfile->first_file();
directory->called_zip_first = true;
relpath = nullptr;
}
- while((header >= 0) && ((relpath = get_relative_path(*directory)) == nullptr));
+ while ((header >= 0) && ((relpath = get_relative_path(*directory)) == nullptr));
- if (relpath != nullptr)
+ if (relpath)
{
/* we've found a ZIP entry; but this may be an entry deep within the target directory */
- for (s = relpath; *s && !is_zip_file_separator(*s); s++)
- ;
- separator = *s ? s : nullptr;
+ char const *separator = relpath;
+ while (*separator && !is_zip_file_separator(*separator)) separator++;
- if (separator != nullptr)
+ if (*separator || directory->zipfile->current_is_directory())
{
/* a nested entry; loop through returned_dirlist to see if we've returned the parent directory */
- for (rdent = directory->returned_dirlist; rdent != nullptr; rdent = rdent->next)
+ auto const len(separator - relpath);
+ auto rdent = directory->returned_dirlist.begin();
+ while (directory->returned_dirlist.end() != rdent)
{
- if (!core_strnicmp(rdent->name.c_str(), relpath, separator - relpath))
+ if ((rdent->length() == len) && !core_strnicmp(rdent->c_str(), relpath, len))
break;
+ else
+ ++rdent;
}
- if (rdent == nullptr)
+ if (directory->returned_dirlist.end() == rdent)
{
/* we've found a new directory; add this to returned_dirlist */
- rdent = new zippath_returned_directory;
- rdent->next = directory->returned_dirlist;
- rdent->name.assign(relpath, separator - relpath);
- directory->returned_dirlist = rdent;
+ directory->returned_dirlist.emplace_front(relpath, separator - relpath);
/* ...and return it */
memset(&directory->returned_entry, 0, sizeof(directory->returned_entry));
- directory->returned_entry.name = rdent->name.c_str();
+ directory->returned_entry.name = directory->returned_dirlist.front().c_str();
directory->returned_entry.type = ENTTYPE_DIR;
result = &directory->returned_entry;
}
@@ -1016,7 +998,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
}
}
}
- while((relpath != nullptr) && (result == nullptr));
+ while (relpath && !result);
}
return result;
}
diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt
index c8dd56f91ad..c8f63273a51 100644
--- a/src/mame/arcade.flt
+++ b/src/mame/arcade.flt
@@ -558,6 +558,7 @@ jpmsys5sw.cpp
jpmsys7.cpp
jrpacman.cpp
jubilee.cpp
+jungleyo.cpp
junofrst.cpp
jvh.cpp
kaneko16.cpp
@@ -1045,6 +1046,7 @@ sleic.cpp
sliver.cpp
slotcarn.cpp
smsmcorp.cpp
+sms_bootleg.cpp
snesb.cpp
snk.cpp
snk6502.cpp
@@ -1056,6 +1058,7 @@ sonson.cpp
sothello.cpp
spacefb.cpp
spaceg.cpp
+spartanxtec.cpp
spbactn.cpp
spcforce.cpp
spdodgeb.cpp
diff --git a/src/mame/audio/atarijsa.cpp b/src/mame/audio/atarijsa.cpp
index 26581c21550..0ad49a64295 100644
--- a/src/mame/audio/atarijsa.cpp
+++ b/src/mame/audio/atarijsa.cpp
@@ -291,6 +291,7 @@ atari_jsa_base_device::atari_jsa_base_device(const machine_config &mconfig, devi
m_soundcomm(*this, "soundcomm"),
m_jsacpu(*this, "cpu"),
m_ym2151(*this, "ym2151"),
+ m_cpu_region(*this, "cpu"),
m_cpu_bank(*this, "cpubank"),
m_test_read_cb(*this),
m_main_int_cb(*this),
@@ -308,7 +309,7 @@ atari_jsa_base_device::atari_jsa_base_device(const machine_config &mconfig, devi
void atari_jsa_base_device::device_start()
{
// configure CPU bank
- m_cpu_bank->configure_entries(0, 4, m_jsacpu->region()->base(), 0x1000);
+ m_cpu_bank->configure_entries(0, 4, m_cpu_region->base(), 0x1000);
// resolve devices
m_test_read_cb.resolve_safe(0);
@@ -415,6 +416,8 @@ atari_jsa_oki_base_device::atari_jsa_oki_base_device(const machine_config &mconf
: atari_jsa_base_device(mconfig, devtype, name, tag, owner, clock, shortname, channels),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2"),
+ m_oki1_region(*this, "oki1"),
+ m_oki2_region(*this, "oki2"),
m_oki1_banklo(*this, "oki1lo"),
m_oki1_bankhi(*this, "oki1hi"),
m_oki2_banklo(*this, "oki2lo"),
@@ -568,19 +571,19 @@ void atari_jsa_oki_base_device::device_start()
save_item(NAME(m_overall_volume));
// configure JSA III ADPCM banking
- if (m_oki1_banklo != nullptr && m_oki1_bankhi != nullptr && m_oki1->region()->bytes() >= 0x80000)
+ if (m_oki1_banklo.found() && m_oki1_bankhi.found() && m_oki1_region->bytes() >= 0x80000)
{
- m_oki1_banklo->configure_entries(0, 2, m_oki1->region()->base() + 0x00000, 0x00000);
- m_oki1_banklo->configure_entries(2, 2, m_oki1->region()->base() + 0x20000, 0x20000);
- m_oki1_bankhi->set_base(m_oki1->region()->base() + 0x60000);
+ m_oki1_banklo->configure_entries(0, 2, m_oki1_region->base() + 0x00000, 0x00000);
+ m_oki1_banklo->configure_entries(2, 2, m_oki1_region->base() + 0x20000, 0x20000);
+ m_oki1_bankhi->set_base(m_oki1_region->base() + 0x60000);
}
// configure JSA IIIs ADPCM banking
- if (m_oki2_banklo != nullptr && m_oki2_bankhi != nullptr && m_oki2->region()->bytes() >= 0x80000)
+ if (m_oki2_banklo.found() && m_oki2_bankhi.found() && m_oki2_region->bytes() >= 0x80000)
{
- m_oki2_banklo->configure_entries(0, 2, m_oki2->region()->base() + 0x00000, 0x00000);
- m_oki2_banklo->configure_entries(2, 2, m_oki2->region()->base() + 0x20000, 0x20000);
- m_oki2_bankhi->set_base(m_oki2->region()->base() + 0x60000);
+ m_oki2_banklo->configure_entries(0, 2, m_oki2_region->base() + 0x00000, 0x00000);
+ m_oki2_banklo->configure_entries(2, 2, m_oki2_region->base() + 0x20000, 0x20000);
+ m_oki2_bankhi->set_base(m_oki2_region->base() + 0x60000);
}
}
@@ -608,9 +611,9 @@ void atari_jsa_oki_base_device::device_reset()
void atari_jsa_oki_base_device::update_all_volumes()
{
- if (m_oki1 != nullptr)
+ if (m_oki1.found())
m_oki1->set_output_gain(ALL_OUTPUTS, m_overall_volume * m_oki6295_volume * m_ym2151_ct1);
- if (m_oki2 != nullptr)
+ if (m_oki2.found())
m_oki2->set_output_gain(ALL_OUTPUTS, m_overall_volume * m_oki6295_volume * m_ym2151_ct1);
m_ym2151->set_output_gain(ALL_OUTPUTS, m_overall_volume * m_ym2151_volume);
}
diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h
index 38ce437b4d2..dd47ada0c34 100644
--- a/src/mame/audio/atarijsa.h
+++ b/src/mame/audio/atarijsa.h
@@ -117,6 +117,9 @@ protected:
required_device<m6502_device> m_jsacpu;
required_device<ym2151_device> m_ym2151;
+ // memory regions
+ required_memory_region m_cpu_region;
+
// memory banks
required_memory_bank m_cpu_bank;
@@ -159,6 +162,10 @@ protected:
optional_device<okim6295_device> m_oki1;
optional_device<okim6295_device> m_oki2; // JSA IIIs only
+ // memory regions
+ optional_memory_region m_oki1_region;
+ optional_memory_region m_oki2_region;
+
// memory banks
optional_memory_bank m_oki1_banklo; // JSA III(s) only
optional_memory_bank m_oki1_bankhi; // JSA III(s)
diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp
index 9883e9b9a25..d3add75d6fd 100644
--- a/src/mame/audio/seibu.cpp
+++ b/src/mame/audio/seibu.cpp
@@ -78,6 +78,7 @@ const device_type SEIBU_SOUND = &device_creator<seibu_sound_device>;
seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEIBU_SOUND, "Seibu Sound System", tag, owner, clock, "seibu_sound", __FILE__),
+ m_sound_rom(*this, ":audiocpu"),
m_main2sub_pending(0),
m_sub2main_pending(0),
m_rst10_irq(0xff),
@@ -98,16 +99,14 @@ void seibu_sound_device::set_encryption(int mode)
void seibu_sound_device::device_start()
{
- int length = memregion(":audiocpu")->bytes();
- UINT8 *rom = memregion(":audiocpu")->base();
- if (length > 0x10000)
+ if (m_sound_rom.length() > 0x10000)
{
- membank(":seibu_bank1")->configure_entries(0, (length - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
+ membank(":seibu_bank1")->configure_entries(0, (m_sound_rom.length() - 0x10000) / 0x8000, &m_sound_rom[0x10000], 0x8000);
/* Denjin Makai definitely needs this at start-up, it never writes to the bankswitch */
membank(":seibu_bank1")->set_entry(0);
} else
- membank(":seibu_bank1")->set_base(rom + 0x8000);
+ membank(":seibu_bank1")->set_base(&m_sound_rom[0x8000]);
switch(m_encryption_mode) {
case 0: break;
@@ -115,13 +114,13 @@ void seibu_sound_device::device_start()
case 1:
get_custom_decrypt();
- memcpy(m_decrypted_opcodes.get(), rom, length);
- apply_decrypt(rom, m_decrypted_opcodes.get(), 0x2000);
+ memcpy(m_decrypted_opcodes.get(), &m_sound_rom[0], m_sound_rom.length());
+ apply_decrypt(&m_sound_rom[0], m_decrypted_opcodes.get(), 0x2000);
break;
case 2:
get_custom_decrypt();
- apply_decrypt(rom, m_decrypted_opcodes.get(), length);
+ apply_decrypt(&m_sound_rom[0], m_decrypted_opcodes.get(), m_sound_rom.length());
break;
}
@@ -389,7 +388,7 @@ ADDRESS_MAP_START( seibu2_airraid_sound_map, AS_PROGRAM, 8, driver_device )
AM_RANGE(0x4001, 0x4001) AM_DEVWRITE("seibu_sound", seibu_sound_device, irq_clear_w)
AM_RANGE(0x4002, 0x4002) AM_DEVWRITE("seibu_sound", seibu_sound_device, rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_DEVWRITE("seibu_sound", seibu_sound_device, rst18_ack_w)
- AM_RANGE(0x4007, 0x4007) AM_WRITENOP // bank, always 0
+ AM_RANGE(0x4007, 0x4007) AM_DEVWRITE("seibu_sound", seibu_sound_device, bank_w)
AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x4010, 0x4011) AM_DEVREAD("seibu_sound", seibu_sound_device, soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_DEVREAD("seibu_sound", seibu_sound_device, main_data_pending_r)
@@ -514,8 +513,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char
m_end(0),
m_nibble(0),
m_playing(0),
- m_rom_tag(nullptr),
- m_base(nullptr)
+ m_base(*this, DEVICE_SELF)
{
}
@@ -527,7 +525,6 @@ void seibu_adpcm_device::device_start()
{
m_playing = 0;
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
- m_base = machine().root_device().memregion(m_rom_tag)->base();
m_adpcm.reset();
save_item(NAME(m_current));
@@ -540,14 +537,11 @@ void seibu_adpcm_device::device_start()
// simplify PCB layout/routing rather than intentional protection, but it
// still fits, especially since the Z80s for all these games are truly encrypted.
-void seibu_adpcm_device::decrypt(const char *region)
+void seibu_adpcm_device::decrypt()
{
- UINT8 *ROM = machine().root_device().memregion(region)->base();
- int len = machine().root_device().memregion(region)->bytes();
-
- for (int i = 0; i < len; i++)
+ for (int i = 0; i < m_base.length(); i++)
{
- ROM[i] = BITSWAP8(ROM[i], 7, 5, 3, 1, 6, 4, 2, 0);
+ m_base[i] = BITSWAP8(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
}
diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h
index 732ab5af314..450febcf665 100644
--- a/src/mame/audio/seibu.h
+++ b/src/mame/audio/seibu.h
@@ -76,6 +76,7 @@ protected:
// internal state
device_t *m_sound_cpu;
+ required_region_ptr<UINT8> m_sound_rom;
UINT8 m_main2sub[2];
UINT8 m_sub2main[2];
int m_main2sub_pending;
@@ -105,9 +106,7 @@ public:
seibu_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~seibu_adpcm_device() {}
- static void set_adpcm_rom_tag(device_t &device, const char *tag) { downcast<seibu_adpcm_device &>(device).m_rom_tag = tag; }
-
- void decrypt(const char *region);
+ void decrypt();
DECLARE_WRITE8_MEMBER( adr_w );
DECLARE_WRITE8_MEMBER( ctl_w );
@@ -126,17 +125,13 @@ protected:
UINT32 m_end;
UINT8 m_nibble;
UINT8 m_playing;
- const char *m_rom_tag;
- UINT8 *m_base;
+ required_region_ptr<UINT8> m_base;
};
extern const device_type SEIBU_ADPCM;
/**************************************************************************/
-#define MCFG_SEIBU_ADPCM_ROMREGION(_tag) \
- seibu_adpcm_device::set_adpcm_rom_tag(*device, _tag);
-
#define SEIBU_COIN_INPUTS \
PORT_START("COIN") \
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(4) \
@@ -278,11 +273,9 @@ extern const device_type SEIBU_ADPCM;
#define SEIBU_SOUND_SYSTEM_ADPCM_INTERFACE \
MCFG_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) \
- MCFG_SEIBU_ADPCM_ROMREGION("adpcm1") \
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) \
\
MCFG_SOUND_ADD("adpcm2", SEIBU_ADPCM, 8000) \
- MCFG_SEIBU_ADPCM_ROMREGION("adpcm2") \
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
/**************************************************************************/
diff --git a/src/mame/audio/wpcsnd.cpp b/src/mame/audio/wpcsnd.cpp
index 134456fe19b..4aec641b3ac 100644
--- a/src/mame/audio/wpcsnd.cpp
+++ b/src/mame/audio/wpcsnd.cpp
@@ -21,6 +21,7 @@ wpcsnd_device::wpcsnd_device(const machine_config &mconfig, const char *tag, dev
m_dac(*this,"dac"),
m_cpubank(*this,"rombank"),
m_fixedbank(*this,"fixed"),
+ m_rom(*this),
m_reply_cb(*this)
{
}
@@ -92,10 +93,7 @@ void wpcsnd_device::device_start()
void wpcsnd_device::device_reset()
{
- UINT8* ROM;
-
- m_rom = memregion(m_regiontag);
- ROM = m_rom->base();
+ UINT8* ROM = m_rom->base();
m_cpubank->configure_entries(0, 0x80, &ROM[0], 0x8000);
m_cpubank->set_entry(0);
m_fixedbank->configure_entries(0, 1, &ROM[0x17c000], 0x4000);
@@ -110,7 +108,7 @@ void wpcsnd_device::device_reset()
void wpcsnd_device::static_set_gfxregion(device_t &device, const char *tag)
{
wpcsnd_device &cpuboard = downcast<wpcsnd_device &>(device);
- cpuboard.m_regiontag = tag;
+ cpuboard.m_rom.set_tag(tag);
}
WRITE_LINE_MEMBER( wpcsnd_device::ym2151_irq_w)
diff --git a/src/mame/audio/wpcsnd.h b/src/mame/audio/wpcsnd.h
index 36c418bd9bf..0975b2d584a 100644
--- a/src/mame/audio/wpcsnd.h
+++ b/src/mame/audio/wpcsnd.h
@@ -34,7 +34,7 @@ public:
required_device<dac_device> m_dac;
required_memory_bank m_cpubank;
required_memory_bank m_fixedbank;
- memory_region* m_rom;
+ required_memory_region m_rom;
DECLARE_WRITE8_MEMBER(bg_speech_clock_w);
DECLARE_WRITE8_MEMBER(bg_speech_digit_w);
@@ -61,7 +61,6 @@ protected:
virtual machine_config_constructor device_mconfig_additions() const override;
private:
- const char* m_regiontag;
UINT8 m_latch;
UINT8 m_reply;
bool m_reply_available;
diff --git a/src/mame/drivers/actfancr.cpp b/src/mame/drivers/actfancr.cpp
index c9acefba01c..6ce12f09413 100644
--- a/src/mame/drivers/actfancr.cpp
+++ b/src/mame/drivers/actfancr.cpp
@@ -312,16 +312,15 @@ static MACHINE_CONFIG_START( actfancr, actfancr_state )
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,2,2,2);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(2, 2, 2)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 1);
+ MCFG_DECO_MXC06_GFX_REGION(1)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -368,16 +367,15 @@ static MACHINE_CONFIG_START( triothep, actfancr_state )
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,2,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(2, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 1);
+ MCFG_DECO_MXC06_GFX_REGION(1)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp
index 2ad00982f1a..15ae41e4221 100644
--- a/src/mame/drivers/aerofgt.cpp
+++ b/src/mame/drivers/aerofgt.cpp
@@ -1341,7 +1341,6 @@ static MACHINE_CONFIG_START( pspikes, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@@ -1451,7 +1450,6 @@ static MACHINE_CONFIG_START( pspikesc, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@@ -1494,13 +1492,11 @@ static MACHINE_CONFIG_START( karatblz, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz)
@@ -1545,13 +1541,11 @@ static MACHINE_CONFIG_START( karatblzbl, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz)
@@ -1593,14 +1587,12 @@ static MACHINE_CONFIG_START( spinlbrk, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_PRITYPE(1)
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback ) // rom lookup
MCFG_VSYSTEM_SPR2_SET_PRITYPE(1)
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,spinlbrk)
@@ -1647,13 +1639,11 @@ static MACHINE_CONFIG_START( turbofrc, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@@ -1701,13 +1691,11 @@ static MACHINE_CONFIG_START( aerofgtb, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@@ -1755,7 +1743,6 @@ static MACHINE_CONFIG_START( aerofgt, aerofgt_state )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( aerofgt_state, aerofgt_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@@ -1869,7 +1856,6 @@ static MACHINE_CONFIG_START( wbbc97, aerofgt_state )
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,wbbc97)
diff --git a/src/mame/drivers/airbustr.cpp b/src/mame/drivers/airbustr.cpp
index 3a000c60c30..8c6b6473bb3 100644
--- a/src/mame/drivers/airbustr.cpp
+++ b/src/mame/drivers/airbustr.cpp
@@ -619,7 +619,6 @@ static MACHINE_CONFIG_START( airbustr, airbustr_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_GFX_REGION(1)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/aleck64.cpp b/src/mame/drivers/aleck64.cpp
index c86157b6e6a..1463151de96 100644
--- a/src/mame/drivers/aleck64.cpp
+++ b/src/mame/drivers/aleck64.cpp
@@ -845,6 +845,7 @@ static MACHINE_CONFIG_START( aleck64, aleck64_state )
MCFG_MIPS3_DCACHE_SIZE(8192)
MCFG_MIPS3_SYSTEM_CLOCK(62500000)
MCFG_CPU_PROGRAM_MAP(n64_map)
+ MCFG_CPU_FORCE_NO_DRC()
MCFG_CPU_ADD("rsp", RSP, 62500000)
MCFG_RSP_DP_REG_R_CB(DEVREAD32("rcp",n64_periphs, dp_reg_r))
@@ -853,6 +854,7 @@ static MACHINE_CONFIG_START( aleck64, aleck64_state )
MCFG_RSP_SP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, sp_reg_w))
MCFG_RSP_SP_SET_STATUS_CB(DEVWRITE32("rcp",n64_periphs, sp_set_status))
MCFG_CPU_PROGRAM_MAP(rsp_map)
+ MCFG_CPU_FORCE_NO_DRC()
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -872,8 +874,6 @@ static MACHINE_CONFIG_START( aleck64, aleck64_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
MCFG_N64_PERIPHS_ADD("rcp");
-
- MCFG_FORCE_NO_DRC()
MACHINE_CONFIG_END
UINT32 aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/drivers/angelkds.cpp b/src/mame/drivers/angelkds.cpp
index aa6d996010b..53175d2cadd 100644
--- a/src/mame/drivers/angelkds.cpp
+++ b/src/mame/drivers/angelkds.cpp
@@ -125,7 +125,7 @@ Dumped by Chackn
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrp2_device.h"
#include "sound/2203intf.h"
#include "includes/angelkds.h"
#include "machine/i8255.h"
@@ -570,8 +570,13 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( spcpostn, angelkds )
/* encryption */
- MCFG_DEVICE_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_317_0005, XTAL_6MHz)
+ MCFG_CPU_PROGRAM_MAP(main_map)
+ MCFG_CPU_IO_MAP(main_portmap)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", angelkds_state, irq0_line_hold)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+
MACHINE_CONFIG_END
/*** Rom Loading
@@ -678,16 +683,7 @@ DRIVER_INIT_MEMBER(angelkds_state,angelkds)
membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000);
}
-DRIVER_INIT_MEMBER(angelkds_state,spcpostn)
-{
- UINT8 *RAM = memregion("user1")->base();
-
- // 317-0005
- sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 1);
-
- membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000);
-}
GAME( 1988, angelkds, 0, angelkds, angelkds, angelkds_state, angelkds, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , MACHINE_SUPPORTS_SAVE) /* Nasco not displayed but 'Exa Planning' is */
-GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) /* encrypted */
+GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, angelkds, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) /* encrypted */
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index 27b3dd0fc59..d5ef8f11de4 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -107,6 +107,7 @@ Address bus A0-A11 is Y0-Y11
#include "cpu/m6502/m6502.h"
#include "cpu/m6502/m65c02.h"
#include "cpu/z80/z80.h"
+#include "cpu/mcs48/mcs48.h"
#include "formats/ap_dsk35.h"
#include "machine/sonydriv.h"
#include "machine/appldriv.h"
@@ -2437,6 +2438,11 @@ static ADDRESS_MAP_START( lcbank_map, AS_PROGRAM, 8, apple2e_state )
AM_RANGE(0x6000, 0x8fff) AM_ROM AM_REGION("maincpu", 0x5000) AM_WRITE(lc_w)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( spectred_keyb_map, AS_PROGRAM, 8, apple2e_state )
+ AM_RANGE(0x0000, 0x07ff) AM_ROM
+ AM_RANGE(0x0800, 0x0fff) AM_RAM
+ADDRESS_MAP_END
+
/***************************************************************************
KEYBOARD
***************************************************************************/
@@ -3365,6 +3371,14 @@ static MACHINE_CONFIG_DERIVED( apple2ee, apple2e )
MCFG_CPU_PROGRAM_MAP(apple2e_map)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( spectred, apple2e )
+ MCFG_CPU_ADD("keyb_mcu", I8035, XTAL_4MHz) /* guessed frequency */
+ MCFG_CPU_PROGRAM_MAP(spectred_keyb_map)
+
+ //TODO: implement the actual interfacing to this 8035 MCU and
+ // and then remove the keyb CPU inherited from apple2e
+MACHINE_CONFIG_END
+
static MACHINE_CONFIG_DERIVED( tk3000, apple2e )
MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */
MCFG_CPU_PROGRAM_MAP(apple2e_map)
@@ -3632,6 +3646,22 @@ ROM_START(apple2c)
ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak
ROM_END
+
+ROM_START(spectred)
+ ROM_REGION(0x8000,"gfx1",0)
+ ROM_LOAD ( "spm-c_ed_06-08-85.u6", 0x0000, 0x8000, CRC(a1b9ffe4) SHA1(3cb281f19f91372e24685792b7bff778944f99ed) )
+
+ ROM_REGION(0x8000,"maincpu",0)
+ ROM_LOAD ( "spm-c_ed_50-09-86.u50.H", 0x0000, 0x4000, CRC(1fccaf24) SHA1(1de1438ee8789f83cbc97f75c0485d1fd0f58a38))
+ ROM_LOAD ( "spm-c_ed_51-09-86.u51.H", 0x4000, 0x4000, CRC(fae8d36c) SHA1(69bed61513482ccb578b89c2fb8e7ba2258e82a5))
+
+ ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 )
+ ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // copied from apple2e
+
+ ROM_REGION(0x1000, "keyb_mcu", 0)
+ ROM_LOAD( "167_8980.u5", 0x0000, 0x1000, CRC(a501f197) SHA1(136c2b562999a6e340fe0e9a3776cea8c2e3647e) )
+ROM_END
+
// unlike the very unique TK2000, the TK3000 is a mostly stock enhanced IIe clone
ROM_START(tk3000)
ROM_REGION(0x2000,"gfx1",0)
@@ -3755,6 +3785,7 @@ COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, driver_device,
COMP( 1985, apple2eeuk,apple2e, 0, apple2ee, apple2euk, driver_device,0, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE )
COMP( 1987, apple2ep, apple2e, 0, apple2ep, apple2ep, driver_device, 0, "Apple Computer", "Apple //e (Platinum)", MACHINE_SUPPORTS_SAVE )
COMP( 1984, apple2c, 0, apple2, apple2c, apple2c, driver_device, 0, "Apple Computer", "Apple //c" , MACHINE_SUPPORTS_SAVE )
+COMP( 1985?,spectred, apple2e, 0, spectred, apple2e, driver_device, 0, "Scopus/Spectrum", "Spectrum ED" , MACHINE_SUPPORTS_SAVE )
COMP( 1986, tk3000, apple2c, 0, tk3000, apple2e, driver_device, 0, "Microdigital", "TK3000//e" , MACHINE_SUPPORTS_SAVE )
COMP( 1989, prav8c, apple2e, 0, apple2e, apple2e, driver_device, 0, "Pravetz", "Pravetz 8C", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
COMP( 1987, laser128, apple2c, 0, laser128, apple2e, driver_device, 0, "Video Technology", "Laser 128 (version 4.2)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/appoooh.cpp b/src/mame/drivers/appoooh.cpp
index c860ccc7ccc..8ffff3e27fe 100644
--- a/src/mame/drivers/appoooh.cpp
+++ b/src/mame/drivers/appoooh.cpp
@@ -166,7 +166,7 @@ Language
#include "emu.h"
#include "cpu/z80/z80.h"
#include "includes/appoooh.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrp2_device.h"
#include "sound/sn76496.h"
@@ -481,6 +481,16 @@ static MACHINE_CONFIG_DERIVED( robowres, appoooh_common )
MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( robowrese, robowres )
+
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5179,18432000/6) /* ??? the main xtal is 18.432 MHz */
+ MCFG_CPU_PROGRAM_MAP(main_map)
+ MCFG_CPU_IO_MAP(main_portmap)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", appoooh_state, vblank_irq)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
/*************************************
*
* ROM definition(s)
@@ -585,46 +595,6 @@ ROM_END
*
*************************************/
-DRIVER_INIT_MEMBER(appoooh_state,robowres)
-{
- static const UINT8 xor_table[128] =
- {
- 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50,
- 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,
- 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50,
- 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04,
- 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04,
- 0x00,0x45,0x41,0x14,0x50,
- 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,
- 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50,
- 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04,
- 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04,
- 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,
- 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41,
- };
-
- static const int swap_table[128] =
- {
- 8, 9,11,13,15, 0, 2, 4, 6,
- 8, 9,11,13,15, 1, 2, 4, 6,
- 8, 9,11,13,15, 1, 2, 4, 6,
- 8, 9,11,13,15, 1, 2, 4, 6,
- 8,10,11,13,15, 1, 2, 4, 6,
- 8,10,11,13,15, 1, 2, 4, 6,
- 8,10,11,13,15, 1, 3, 4, 6,
- 8,
- 7, 1, 2, 4, 6, 0, 1, 3, 5,
- 7, 1, 2, 4, 6, 0, 1, 3, 5,
- 7, 1, 2, 4, 6, 0, 2, 3, 5,
- 7, 1, 2, 4, 6, 0, 2, 3, 5,
- 7, 1, 2, 4, 6, 0, 2, 3, 5,
- 7, 1, 3, 4, 6, 0, 2, 3, 5,
- 7, 1, 3, 4, 6, 0, 2, 4, 5,
- 7,
- };
-
- sega_decode_2(memregion("maincpu")->base(), m_decrypted_opcodes, xor_table, swap_table);
-}
DRIVER_INIT_MEMBER(appoooh_state,robowresb)
{
@@ -639,5 +609,5 @@ DRIVER_INIT_MEMBER(appoooh_state,robowresb)
*************************************/
GAME( 1984, appoooh, 0, appoooh, appoooh, driver_device, 0, ROT0, "Sanritsu / Sega", "Appoooh", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, robowres, 0, robowres, robowres, appoooh_state, robowres, ROT0, "Sanritsu / Sega", "Robo Wres 2001", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, robowres, 0, robowrese,robowres, driver_device, 0, ROT0, "Sanritsu / Sega", "Robo Wres 2001", MACHINE_SUPPORTS_SAVE )
GAME( 1986, robowresb, robowres, robowres, robowres, appoooh_state, robowresb,ROT0, "bootleg", "Robo Wres 2001 (bootleg)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/artmagic.cpp b/src/mame/drivers/artmagic.cpp
index dba800e1a3d..3c23a78051d 100644
--- a/src/mame/drivers/artmagic.cpp
+++ b/src/mame/drivers/artmagic.cpp
@@ -99,7 +99,7 @@ WRITE16_MEMBER(artmagic_state::control_w)
/* OKI banking here */
if (offset == 0)
{
- m_oki->set_bank_base((((data >> 4) & 1) * 0x40000) % m_oki->region()->bytes());
+ m_oki->set_bank_base((((data >> 4) & 1) * 0x40000) % m_oki_region->bytes());
}
logerror("%06X:control_w(%d) = %04X\n", space.device().safe_pc(), offset, data);
diff --git a/src/mame/drivers/asterix.cpp b/src/mame/drivers/asterix.cpp
index a0dd353246b..e43476e8474 100644
--- a/src/mame/drivers/asterix.cpp
+++ b/src/mame/drivers/asterix.cpp
@@ -270,12 +270,9 @@ static MACHINE_CONFIG_START( asterix, asterix_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(asterix_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 1, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053244", K053244, 0)
diff --git a/src/mame/drivers/attckufo.cpp b/src/mame/drivers/attckufo.cpp
index 3a099bf917f..e0af08c1076 100644
--- a/src/mame/drivers/attckufo.cpp
+++ b/src/mame/drivers/attckufo.cpp
@@ -1,117 +1,52 @@
// license:LGPL-2.1+
// copyright-holders:Tomasz Slanina
-/***************************************
-Attack ufo / Ryoto Electric Co. 1980(?)
- driver by Tomasz Slanina
+/***************************************************************************
-Video and sound emulation based on
- VIC 656x driver by PeT
+ "Attack UFO" © 1980 Ryoto Electric Co.
-TODO:
- - correct I/O chip emulation
- - is game speed ok? a bit slow sometimes
+ TODO:
+ - Verify I/O chip
+ - Is game speed ok? A bit slow sometimes
---
-
-CPU - 6502
- 2,38 +5
- 21 gnd
- 26-33 data bus
-
-I/O - CIA 6526 ?
- 37,38 +5
- 1 gnd
- 2-18 I/O
- 26-33 data bus
-
-Vid - VIC 6560 derivative ???
- 40 +5
- 20 gnd
- 16-32 data bus
-
---
-
-Attack UFO
-???? 1980
-LOIPOIO-B
-
-2 1 2114 2114 2114 2114 2114
-8 7 6 5 4 3 40pin IC "C"
-
-53354 40pin IC "B" 14.318MHz 40pin IC "A"
- SW
-
-****************************************/
+***************************************************************************/
#include "emu.h"
#include "cpu/m6502/m6502.h"
+#include "machine/6821pia.h"
#include "sound/mos6560.h"
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
class attckufo_state : public driver_device
{
public:
attckufo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_mos6560(*this, "mos6560") ,
- m_mainram(*this, "mainram"),
- m_tileram(*this, "tileram"){ }
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<mos6560_device> m_mos6560;
-
- /* memory pointers */
- required_shared_ptr<UINT8> m_mainram;
- required_shared_ptr<UINT8> m_tileram;
-
- DECLARE_READ8_MEMBER(attckufo_io_r);
- DECLARE_WRITE8_MEMBER(attckufo_io_w);
+ m_maincpu(*this, "maincpu")
+ {}
DECLARE_READ8_MEMBER( vic_videoram_r );
DECLARE_READ8_MEMBER( vic_colorram_r );
-};
-READ8_MEMBER(attckufo_state::attckufo_io_r)
-{
- switch(offset)
- {
- case 0: return ioport("DSW")->read();
- case 2: return ioport("INPUT")->read();
- }
- return 0xff;
-}
+private:
+ required_device<cpu_device> m_maincpu;
+};
-WRITE8_MEMBER(attckufo_state::attckufo_io_w)
-{
- /*
- offset, data:
- 0 $00,$30
- 1 $00,$04
- 2 $00
- 3 $00,$04
- */
-}
-
-READ8_MEMBER(attckufo_state::vic_videoram_r)
-{
- return m_maincpu->space(AS_PROGRAM).read_byte(offset);
-}
-
-READ8_MEMBER(attckufo_state::vic_colorram_r)
-{
- return m_maincpu->space(AS_PROGRAM).read_byte(offset + 0x400);
-}
+//**************************************************************************
+// ADDRESS MAPS
+//**************************************************************************
static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, attckufo_state )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
- AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("mainram")
+ AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("mos6560", mos6560_device, read, write)
- AM_RANGE(0x1400, 0x1403) AM_READWRITE(attckufo_io_r, attckufo_io_w)
- AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_SHARE("tileram")
- AM_RANGE(0x2000, 0x3fff) AM_ROM
+ AM_RANGE(0x1400, 0x1403) AM_DEVREADWRITE("pia", pia6821_device, read, write)
+ AM_RANGE(0x1c00, 0x1fff) AM_RAM
+ AM_RANGE(0x2000, 0x3fff) AM_ROM AM_REGION("maincpu", 0)
ADDRESS_MAP_END
static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, attckufo_state )
@@ -122,54 +57,92 @@ static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, attckufo_state )
AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r)
ADDRESS_MAP_END
+
+//**************************************************************************
+// INPUTS
+//**************************************************************************
+
static INPUT_PORTS_START( attckufo )
PORT_START("DSW")
- PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
- PORT_DIPSETTING( 0x00, "3" )
- PORT_DIPSETTING( 0x01, "4" )
- PORT_DIPSETTING( 0x02, "5" )
- PORT_DIPSETTING( 0x03, "6" )
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
- PORT_DIPSETTING( 0x04, "1000" )
- PORT_DIPSETTING( 0x00, "1500" )
- PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
+ PORT_DIPNAME(0x03, 0x00, DEF_STR( Lives ))
+ PORT_DIPSETTING( 0x00, "3")
+ PORT_DIPSETTING( 0x01, "4")
+ PORT_DIPSETTING( 0x02, "5")
+ PORT_DIPSETTING( 0x03, "6")
+ PORT_DIPNAME(0x04, 0x04, DEF_STR( Bonus_Life ))
+ PORT_DIPSETTING( 0x04, "1000")
+ PORT_DIPSETTING( 0x00, "1500")
+ PORT_DIPUNUSED(0x08, IP_ACTIVE_LOW)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_COIN1)
PORT_START("INPUT")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_2WAY
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_2WAY
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_2WAY
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_2WAY
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)
INPUT_PORTS_END
+
+//**************************************************************************
+// VIDEO EMULATION
+//**************************************************************************
+
+READ8_MEMBER(attckufo_state::vic_videoram_r)
+{
+ return m_maincpu->space(AS_PROGRAM).read_byte(offset);
+}
+
+READ8_MEMBER(attckufo_state::vic_colorram_r)
+{
+ return m_maincpu->space(AS_PROGRAM).read_byte(offset + 0x400);
+}
+
+
+//**************************************************************************
+// MACHINE DEFINTIONS
+//**************************************************************************
+
static MACHINE_CONFIG_START( attckufo, attckufo_state )
- /* basic machine hardware */
- MCFG_CPU_ADD("maincpu", M6502, XTAL_14_31818MHz/14)
+ MCFG_CPU_ADD("maincpu", M6502, XTAL_14_31818MHz / 14)
MCFG_CPU_PROGRAM_MAP(cpu_map)
- /* video/sound hardware */
+ MCFG_DEVICE_ADD("pia", PIA6821, 0)
+ MCFG_PIA_READPA_HANDLER(IOPORT("DSW"))
+ MCFG_PIA_READPB_HANDLER(IOPORT("INPUT"))
+
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_MOS656X_ATTACK_UFO_ADD("mos6560", "screen", XTAL_14_31818MHz/14, vic_videoram_map, vic_colorram_map)
+ MCFG_MOS656X_ATTACK_UFO_ADD("mos6560", "screen", XTAL_14_31818MHz / 14, vic_videoram_map, vic_colorram_map)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
+
+//**************************************************************************
+// ROM DEFINITIONS
+//**************************************************************************
+
ROM_START( attckufo )
- ROM_REGION( 0x4000, "maincpu", 0 )
- ROM_LOAD( "1", 0x2000, 0x0400, CRC(b32a36ab) SHA1(4e64686d498f7a79f5213c42b7afbf35aac2b622) )
- ROM_LOAD( "2", 0x2400, 0x0400, CRC(35fc8424) SHA1(d4926768f2e5b21476c7ec33743fe3e1c76662db) )
- ROM_LOAD( "3", 0x2800, 0x0400, CRC(6341c8c4) SHA1(8647a4fabad0399769dd068d784be72e27afca35) )
- ROM_LOAD( "4", 0x2c00, 0x0400, CRC(1ed1d93f) SHA1(2e04c63ea2fc958415f7c7de9d18dadf9e085755) )
- ROM_LOAD( "5", 0x3000, 0x0400, CRC(3380e0f4) SHA1(e1d681f7370ba7fc2bf3561533f4aaf12eefbcb8) )
- ROM_LOAD( "6", 0x3400, 0x0400, CRC(8103e031) SHA1(86bc8dd6c74b84804ede31a8454b5b3d3e4d88b1) )
- ROM_LOAD( "7", 0x3800, 0x0400, CRC(43a41012) SHA1(edd14f49dc9ae7a5a14583b9a92ebbbdd021d7b1) )
- ROM_LOAD( "8", 0x3c00, 0x0400, CRC(9ce93eb0) SHA1(68753e88db4e920446b9582b5cb713b1beec3b27) )
+ ROM_REGION(0x2000, "maincpu", 0)
+ ROM_LOAD("1", 0x0000, 0x0400, CRC(b32a36ab) SHA1(4e64686d498f7a79f5213c42b7afbf35aac2b622))
+ ROM_LOAD("2", 0x0400, 0x0400, CRC(35fc8424) SHA1(d4926768f2e5b21476c7ec33743fe3e1c76662db))
+ ROM_LOAD("3", 0x0800, 0x0400, CRC(6341c8c4) SHA1(8647a4fabad0399769dd068d784be72e27afca35))
+ ROM_LOAD("4", 0x0c00, 0x0400, CRC(1ed1d93f) SHA1(2e04c63ea2fc958415f7c7de9d18dadf9e085755))
+ ROM_LOAD("5", 0x1000, 0x0400, CRC(3380e0f4) SHA1(e1d681f7370ba7fc2bf3561533f4aaf12eefbcb8))
+ ROM_LOAD("6", 0x1400, 0x0400, CRC(8103e031) SHA1(86bc8dd6c74b84804ede31a8454b5b3d3e4d88b1))
+ ROM_LOAD("7", 0x1800, 0x0400, CRC(43a41012) SHA1(edd14f49dc9ae7a5a14583b9a92ebbbdd021d7b1))
+ ROM_LOAD("8", 0x1c00, 0x0400, CRC(9ce93eb0) SHA1(68753e88db4e920446b9582b5cb713b1beec3b27))
ROM_END
-GAME( 1980, attckufo, 0, attckufo, attckufo, driver_device, 0, ROT270, "Ryoto Electric Co.", "Attack Ufo", MACHINE_SUPPORTS_SAVE )
+
+//**************************************************************************
+// SYSTEM DRIVERS
+//**************************************************************************
+
+// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROTATION COMPANY FULLNAME FLAGS
+GAME( 1980, attckufo, 0, attckufo, attckufo, driver_device, 0, ROT270, "Ryoto Electric Co.", "Attack UFO", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/backfire.cpp b/src/mame/drivers/backfire.cpp
index 9ca90c212e8..83f0f64f151 100644
--- a/src/mame/drivers/backfire.cpp
+++ b/src/mame/drivers/backfire.cpp
@@ -513,7 +513,6 @@ static MACHINE_CONFIG_START( backfire, backfire_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SET_SCREEN("lscreen")
@@ -530,21 +529,18 @@ static MACHINE_CONFIG_START( backfire, backfire_state )
MCFG_DECO16IC_PF12_8X8_BANK(2)
MCFG_DECO16IC_PF12_16X16_BANK(3)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_VIDEO_SET_SCREEN("lscreen")
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_PRIORITY_CB(backfire_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_VIDEO_SET_SCREEN("rscreen")
MCFG_DECO_SPRITE_GFX_REGION(5)
MCFG_DECO_SPRITE_PRIORITY_CB(backfire_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/bbusters.cpp b/src/mame/drivers/bbusters.cpp
index e515416b646..2a04e850028 100644
--- a/src/mame/drivers/bbusters.cpp
+++ b/src/mame/drivers/bbusters.cpp
@@ -191,11 +191,6 @@ Beast Busters notes (from Brian Hargrove)
1. Stage 2 for example, has background sprites and enemies that float on the
foreground and not behind the moving elevator layer.
-2. Oddly enough, the emulation completely misses the huge zombie that jumps
-out during the attract demo right before the text story text comes in.
-When you hear the high pitch "zing" sound, there should be a zombie nearly
-the entire size of the screen.
-
***************************************************************************/
@@ -834,6 +829,55 @@ ROM_START( bbustersu )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
+
+ROM_START( bbustersj )
+ ROM_REGION( 0x80000, "maincpu", 0 )
+ ROM_LOAD16_BYTE( "bb3_ver2_j2.k10", 0x000000, 0x20000, CRC(605eb62f) SHA1(b13afd561731ad9115c5b997b8a7a79a57557612) )
+ ROM_LOAD16_BYTE( "bb5_ver2_j2.k12", 0x000001, 0x20000, CRC(9deea26f) SHA1(c5436db0c55da9b0c5e0e053f59a1e17ee4690a6) )
+ ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) )
+ ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) )
+
+ ROM_REGION( 0x10000, "audiocpu", 0 )
+ ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) )
+
+ ROM_REGION( 0x020000, "gfx1", 0 )
+ ROM_LOAD( "bb-10.l9", 0x000000, 0x20000, CRC(490c0d9b) SHA1(567c25a6d96407259c64061d674305e4117d9fa4) )
+
+ ROM_REGION( 0x200000, "gfx2", 0 )
+ ROM_LOAD( "bb-f11.m16", 0x000000, 0x80000, CRC(39fdf9c0) SHA1(80392947e3a1831c3ee80139f6f3bdc3bafa4f0d) )
+ ROM_LOAD( "bb-f12.m13", 0x080000, 0x80000, CRC(69ee046b) SHA1(5c0435f1ce76b584fa8d154d7617d73c7ab5f62f) )
+ ROM_LOAD( "bb-f13.m12", 0x100000, 0x80000, CRC(f5ef840e) SHA1(dd0f630c52076e0d330f47931e68a3ae9a401078) )
+ ROM_LOAD( "bb-f14.m11", 0x180000, 0x80000, CRC(1a7df3bb) SHA1(1f27a528e6f89fe56a7342c4f1ff733da0a09327) )
+
+ ROM_REGION( 0x200000, "gfx3", 0 )
+ ROM_LOAD( "bb-f21.l10", 0x000000, 0x80000, CRC(530f595b) SHA1(820898693b878c4423de9c244f943d39ea69515e) )
+ ROM_LOAD( "bb-f22.l12", 0x080000, 0x80000, CRC(889c562e) SHA1(d19172d6515ab9793c98de75d6e41687e61a408d) )
+ ROM_LOAD( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) )
+ ROM_LOAD( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) )
+
+ ROM_REGION( 0x80000, "gfx4", 0 )
+ ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) )
+
+ ROM_REGION( 0x80000, "gfx5", 0 )
+ ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) )
+
+ ROM_REGION( 0x10000, "user1", 0 ) /* Zoom table */
+ /* same rom exists in 4 different locations on the board */
+ ROM_LOAD( "bb-6.e7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) )
+ ROM_LOAD( "bb-7.h7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) )
+ ROM_LOAD( "bb-8.a14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) )
+ ROM_LOAD( "bb-9.c14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) )
+
+ ROM_REGION( 0x80000, "ymsnd", 0 )
+ ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) )
+
+ ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
+ ROM_LOAD( "bb-pcmb.l3", 0x000000, 0x80000, CRC(c8d5dd53) SHA1(0f7e94532cc14852ca12c1b792e5479667af899e) )
+
+ ROM_REGION( 0x100, "eeprom", 0 )
+ ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
+ROM_END
+
ROM_START( bbustersua )
ROM_REGION( 0x80000, "maincpu", 0 )
ROM_LOAD16_BYTE( "bb-ver2-u3.k10", 0x000000, 0x20000, CRC(6930088b) SHA1(265f0b584d81b6fdcda5c3a2e0bd15d56443bb35) )
@@ -1071,6 +1115,7 @@ ROM_END
GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1989, bbustersu, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1989, bbustersua, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1989, bbustersj, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (Japan, Version 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/bishi.cpp b/src/mame/drivers/bishi.cpp
index f46f2b3e8e6..a9de3729ea9 100644
--- a/src/mame/drivers/bishi.cpp
+++ b/src/mame/drivers/bishi.cpp
@@ -392,12 +392,9 @@ static MACHINE_CONFIG_START( bishi, bishi_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_ENABLE_HILIGHTS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(bishi_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k054338", K054338, 0)
diff --git a/src/mame/drivers/blackt96.cpp b/src/mame/drivers/blackt96.cpp
index 2039e7afe03..4f5801ecb3a 100644
--- a/src/mame/drivers/blackt96.cpp
+++ b/src/mame/drivers/blackt96.cpp
@@ -373,7 +373,6 @@ static MACHINE_CONFIG_START( blackt96, blackt96_state )
MCFG_DEVICE_ADD("sprites", SNK68_SPR, 0)
MCFG_SNK68_SPR_GFXDECODE("gfxdecode")
- MCFG_SNK68_SPR_PALETTE("palette")
MCFG_SNK68_SPR_SET_TILE_INDIRECT( blackt96_state, tile_callback )
MCFG_SNK68_SPR_NO_PARTIAL
diff --git a/src/mame/drivers/boogwing.cpp b/src/mame/drivers/boogwing.cpp
index 098397785c3..ef1fa53fb22 100644
--- a/src/mame/drivers/boogwing.cpp
+++ b/src/mame/drivers/boogwing.cpp
@@ -358,7 +358,6 @@ static MACHINE_CONFIG_START( boogwing, boogwing_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -374,17 +373,14 @@ static MACHINE_CONFIG_START( boogwing, boogwing_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
diff --git a/src/mame/drivers/cabal.cpp b/src/mame/drivers/cabal.cpp
index 9f41c09a89a..b14eeb7e6f8 100644
--- a/src/mame/drivers/cabal.cpp
+++ b/src/mame/drivers/cabal.cpp
@@ -503,11 +503,9 @@ static MACHINE_CONFIG_START( cabal_base, cabal_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80)
MCFG_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) /* it should use the msm5205 */
- MCFG_SEIBU_ADPCM_ROMREGION("adpcm1")
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40)
MCFG_SOUND_ADD("adpcm2", SEIBU_ADPCM, 8000) /* it should use the msm5205 */
- MCFG_SEIBU_ADPCM_ROMREGION("adpcm2")
MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40)
MACHINE_CONFIG_END
@@ -873,8 +871,8 @@ ROM_END
DRIVER_INIT_MEMBER(cabal_state,cabal)
{
- m_adpcm1->decrypt("adpcm1");
- m_adpcm2->decrypt("adpcm2");
+ m_adpcm1->decrypt();
+ m_adpcm2->decrypt();
}
DRIVER_INIT_MEMBER(cabal_state,cabalbl2)
@@ -882,8 +880,8 @@ DRIVER_INIT_MEMBER(cabal_state,cabalbl2)
UINT8 *decrypt = m_seibu_sound->get_custom_decrypt();
memcpy(decrypt, memregion("audiocpu")->base()+0x2000, 0x2000);
memcpy(decrypt+0x8000, memregion("audiocpu")->base()+0x8000, 0x8000);
- m_adpcm1->decrypt("adpcm1");
- m_adpcm2->decrypt("adpcm2");
+ m_adpcm1->decrypt();
+ m_adpcm2->decrypt();
}
diff --git a/src/mame/drivers/calorie.cpp b/src/mame/drivers/calorie.cpp
index a4602d37189..1faa6b62bb8 100644
--- a/src/mame/drivers/calorie.cpp
+++ b/src/mame/drivers/calorie.cpp
@@ -81,7 +81,7 @@ Notes:
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrp2_device.h"
#include "sound/ay8910.h"
@@ -110,7 +110,6 @@ public:
DECLARE_WRITE8_MEMBER(calorie_flipscreen_w);
DECLARE_READ8_MEMBER(calorie_soundlatch_r);
DECLARE_WRITE8_MEMBER(bogus_w);
- DECLARE_DRIVER_INIT(calorie);
DECLARE_DRIVER_INIT(calorieb);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
@@ -488,6 +487,13 @@ static MACHINE_CONFIG_START( calorie, calorie_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.8) /* YM2149 really */
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( caloriee, calorie )
+ MCFG_CPU_REPLACE("maincpu", SEGA_317_0004,4000000) /* 4 MHz */
+ MCFG_CPU_PROGRAM_MAP(calorie_map)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", calorie_state, irq0_line_hold)
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
/*************************************
*
@@ -560,11 +566,7 @@ ROM_END
*
*************************************/
-DRIVER_INIT_MEMBER(calorie_state,calorie)
-{
- // 317-0004
- sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 0);
-}
+
DRIVER_INIT_MEMBER(calorie_state,calorieb)
{
@@ -579,5 +581,5 @@ DRIVER_INIT_MEMBER(calorie_state,calorieb)
*************************************/
/* Note: the bootleg is identical to the original once decrypted */
-GAME( 1986, calorie, 0, calorie, calorie, calorie_state, calorie, ROT0, "Sega", "Calorie Kun vs Moguranian", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, calorie, 0, caloriee,calorie, driver_device, 0, ROT0, "Sega", "Calorie Kun vs Moguranian", MACHINE_SUPPORTS_SAVE )
GAME( 1986, calorieb, calorie, calorie, calorie, calorie_state, calorieb, ROT0, "bootleg", "Calorie Kun vs Moguranian (bootleg)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/cbuster.cpp b/src/mame/drivers/cbuster.cpp
index b68b1ce2c94..16bc2ca7eac 100644
--- a/src/mame/drivers/cbuster.cpp
+++ b/src/mame/drivers/cbuster.cpp
@@ -331,7 +331,6 @@ static MACHINE_CONFIG_START( twocrude, cbuster_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -347,12 +346,10 @@ static MACHINE_CONFIG_START( twocrude, cbuster_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/cchance.cpp b/src/mame/drivers/cchance.cpp
index 0283cf99df9..184ef938fb4 100644
--- a/src/mame/drivers/cchance.cpp
+++ b/src/mame/drivers/cchance.cpp
@@ -218,7 +218,6 @@ static MACHINE_CONFIG_START( cchance, cchance_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp
index f8b89ed07b2..72466a164ae 100644
--- a/src/mame/drivers/cclimber.cpp
+++ b/src/mame/drivers/cclimber.cpp
@@ -239,7 +239,7 @@ Dip location verified from manual for: cclimber, guzzler, swimmer
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "sound/ay8910.h"
#include "sound/samples.h"
#include "audio/cclimber.h"
@@ -1090,10 +1090,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( yamato, root )
/* basic machine hardware */
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5018, MASTER_CLOCK/3/2) /* 3.072 MHz */
MCFG_CPU_PROGRAM_MAP(yamato_map)
MCFG_CPU_IO_MAP(yamato_portmap)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", cclimber_state, vblank_irq)
MCFG_CPU_DECRYPTED_OPCODES_MAP(yamato_decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MCFG_CPU_ADD("audiocpu", Z80, 3072000) /* 3.072 MHz ? */
MCFG_CPU_PROGRAM_MAP(yamato_audio_map)
@@ -1119,10 +1121,15 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( toprollr, cclimber )
- /* basic machine hardware */
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5018, MASTER_CLOCK/3/2) /* 3.072 MHz */
MCFG_CPU_PROGRAM_MAP(toprollr_map)
+ MCFG_CPU_IO_MAP(cclimber_portmap)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", cclimber_state, vblank_irq)
MCFG_CPU_DECRYPTED_OPCODES_MAP(toprollr_decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_SIZE(0)
+ MCFG_SEGACRPT_SET_NUMBANKS(3)
+ MCFG_SEGACRPT_SET_BANKSIZE(0x6000)
+
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", toprollr)
@@ -2461,29 +2468,7 @@ ROM_END
DRIVER_INIT_MEMBER(cclimber_state,yamato)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
+
save_item(NAME(m_yamato_p0));
save_item(NAME(m_yamato_p1));
@@ -2492,30 +2477,20 @@ DRIVER_INIT_MEMBER(cclimber_state,yamato)
DRIVER_INIT_MEMBER(cclimber_state,toprollr)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
- };
-
m_opcodes = std::make_unique<UINT8[]>(0x6000*3);
- sega_decode(memregion("user1")->base(), m_opcodes.get(), 0, convtable, 3, 0x6000);
+
+ segacrpt_z80_device* cpu = (segacrpt_z80_device*)machine().device(":maincpu");
+
+ // this seems to be a messy abuse / use of the encryption, investigate
+ if (!cpu)
+ {
+ fatalerror("can't find cpu!\n");
+ }
+ else
+ {
+ cpu->set_region_p(memregion("user1")->base());
+ cpu->set_decrypted_p(m_opcodes.get());
+ }
membank("bank1")->configure_entries(0, 3, memregion("user1")->base(), 0x6000);
membank("bank1d")->configure_entries(0, 3, m_opcodes.get(), 0x6000);
diff --git a/src/mame/drivers/champbwl.cpp b/src/mame/drivers/champbwl.cpp
index 745870f02bc..8be942af8e2 100644
--- a/src/mame/drivers/champbwl.cpp
+++ b/src/mame/drivers/champbwl.cpp
@@ -503,7 +503,6 @@ static MACHINE_CONFIG_START( champbwl, champbwl_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -565,7 +564,6 @@ static MACHINE_CONFIG_START( doraemon, champbwl_state )
MCFG_NVRAM_ADD_0FILL("nvram")
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
MCFG_MACHINE_START_OVERRIDE(champbwl_state,doraemon)
diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp
index c421161c9d8..dfa70a7dcee 100644
--- a/src/mame/drivers/chihiro.cpp
+++ b/src/mame/drivers/chihiro.cpp
@@ -385,7 +385,7 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
class ohci_hlean2131qc_device : public ohci_function_device
{
public:
- ohci_hlean2131qc_device(running_machine &machine);
+ ohci_hlean2131qc_device(running_machine &machine, xbox_base_state *usb_bus_manager);
int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override;
int handle_bulk_pid(int endpoint, int pid, UINT8 *buffer, int size) override;
void set_region_base(UINT8 *data);
@@ -413,7 +413,7 @@ private:
class ohci_hlean2131sc_device : public ohci_function_device
{
public:
- ohci_hlean2131sc_device(running_machine &machine);
+ ohci_hlean2131sc_device(running_machine &machine, xbox_base_state *usb_bus_manager);
int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override;
private:
static const USBStandardDeviceDescriptor devdesc;
@@ -665,8 +665,8 @@ const UINT8 ohci_hlean2131qc_device::strdesc0[] = { 0x04,0x03,0x00,0x00 };
const UINT8 ohci_hlean2131qc_device::strdesc1[] = { 0x0A,0x03,0x53,0x00,0x45,0x00,0x47,0x00,0x41,0x00 };
const UINT8 ohci_hlean2131qc_device::strdesc2[] = { 0x0E,0x03,0x42,0x00,0x41,0x00,0x53,0x00,0x45,0x00,0x42,0x03,0xFF,0x0B };
-ohci_hlean2131qc_device::ohci_hlean2131qc_device(running_machine &machine) :
- ohci_function_device(machine)
+ohci_hlean2131qc_device::ohci_hlean2131qc_device(running_machine &machine, xbox_base_state *usb_bus_manager) :
+ ohci_function_device(machine, usb_bus_manager)
{
add_device_descriptor(devdesc);
add_configuration_descriptor(condesc);
@@ -712,17 +712,22 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa
}
if ((setup->bRequest == 0x16) && (setup->wValue == 0x1f00))
{
+ // should be for an2131sc
endpoints[1].remain = setup->wIndex;
endpoints[1].position = region + 0x1f00;
}
- if (setup->bRequest == 0x19) // 19 used to receive jvs packet, 20 to send
+ if (setup->bRequest == 0x19) // 19 used to receive packet, 20 to send ?
{
- endpoints[endpoint].buffer[5] = 0;
- endpoints[endpoint].buffer[4] = 20;
+ // amount to transfer
+ endpoints[endpoint].buffer[5] = 20 >> 8;
+ endpoints[endpoint].buffer[4] = (20 & 0xff);
+ endpoints[4].remain = 20;
+ endpoints[4].position = endpoints[4].buffer;
+ memset(endpoints[4].buffer, 0, 20);
}
if (setup->bRequest == 0x20)
{
- printf("\tJvs packet of %d bytes\n\r", setup->wIndex);
+ printf(" Jvs packet of %d bytes\n\r", setup->wIndex-3);
}
endpoints[endpoint].buffer[0] = 0;
@@ -734,7 +739,7 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa
int ohci_hlean2131qc_device::handle_bulk_pid(int endpoint, int pid, UINT8 *buffer, int size)
{
printf("Bulk request: %x %d %x\n\r", endpoint, pid, size);
- if (((endpoint == 1) || (endpoint == 2)) && (pid == InPid))
+ if (((endpoint == 1) || (endpoint == 2) || (endpoint == 4)) && (pid == InPid))
{
if (size > endpoints[endpoint].remain)
size = endpoints[endpoint].remain;
@@ -742,6 +747,12 @@ int ohci_hlean2131qc_device::handle_bulk_pid(int endpoint, int pid, UINT8 *buffe
endpoints[endpoint].position = endpoints[endpoint].position + size;
endpoints[endpoint].remain = endpoints[endpoint].remain - size;
}
+ if ((endpoint == 4) && (pid == OutPid))
+ {
+ for (int n = 0; n < size; n++)
+ printf(" %02x",buffer[n]);
+ printf("\n\r");
+ }
return size;
}
@@ -759,8 +770,8 @@ const UINT8 ohci_hlean2131sc_device::strdesc0[] = { 0x04,0x03,0x00,0x00 };
const UINT8 ohci_hlean2131sc_device::strdesc1[] = { 0x0A,0x03,0x53,0x00,0x45,0x00,0x47,0x00,0x41,0x00 };
const UINT8 ohci_hlean2131sc_device::strdesc2[] = { 0x0E,0x03,0x42,0x00,0x41,0x00,0x53,0x00,0x45,0x00,0x42,0x00,0x44,0x00 };
-ohci_hlean2131sc_device::ohci_hlean2131sc_device(running_machine &machine) :
- ohci_function_device(machine)
+ohci_hlean2131sc_device::ohci_hlean2131sc_device(running_machine &machine, xbox_base_state *usb_bus_manager) :
+ ohci_function_device(machine, usb_bus_manager)
{
add_device_descriptor(devdesc);
add_configuration_descriptor(condesc);
@@ -1058,7 +1069,7 @@ void chihiro_state::machine_start()
break;
}
usbhack_counter = 0;
- usb_device = new ohci_hlean2131qc_device(machine());
+ usb_device = new ohci_hlean2131qc_device(machine(), this);
usb_device->set_region_base(memregion(":others")->base()); // temporary
//usb_device = new ohci_hlean2131sc_device(machine());
usb_ohci_plug(1, usb_device); // connect
@@ -1083,7 +1094,7 @@ static MACHINE_CONFIG_DERIVED_CLASS(chihiro_base, xbox_base, chihiro_state)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED(chihirogd, chihiro_base)
- MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", ":pic", nullptr, NOOP)
+ MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", "gdrom", "pic", nullptr, NOOP)
MACHINE_CONFIG_END
#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
diff --git a/src/mame/drivers/cninja.cpp b/src/mame/drivers/cninja.cpp
index 5e0e6c64183..d027733d85f 100644
--- a/src/mame/drivers/cninja.cpp
+++ b/src/mame/drivers/cninja.cpp
@@ -878,7 +878,6 @@ static MACHINE_CONFIG_START( cninja, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -894,13 +893,11 @@ static MACHINE_CONFIG_START( cninja, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR
@@ -968,7 +965,6 @@ static MACHINE_CONFIG_START( stoneage, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -984,13 +980,11 @@ static MACHINE_CONFIG_START( stoneage, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR
@@ -1053,7 +1047,6 @@ static MACHINE_CONFIG_START( cninjabl, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1069,7 +1062,6 @@ static MACHINE_CONFIG_START( cninjabl, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -1125,7 +1117,6 @@ static MACHINE_CONFIG_START( edrandy, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1141,13 +1132,11 @@ static MACHINE_CONFIG_START( edrandy, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
@@ -1213,7 +1202,6 @@ static MACHINE_CONFIG_START( robocop2, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1229,13 +1217,11 @@ static MACHINE_CONFIG_START( robocop2, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_PRIORITY_CB(cninja_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR
@@ -1307,7 +1293,6 @@ static MACHINE_CONFIG_START( mutantf, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1323,17 +1308,14 @@ static MACHINE_CONFIG_START( mutantf, cninja_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp
index 30fc021028b..113498dd03f 100644
--- a/src/mame/drivers/cobra.cpp
+++ b/src/mame/drivers/cobra.cpp
@@ -3302,15 +3302,11 @@ static MACHINE_CONFIG_START( cobra, cobra_state )
MCFG_M48T58_ADD("m48t58")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_DEVICE_ADD("k001604", K001604, 0) // on the LAN board in Racing Jam DX
- MCFG_K001604_GFX_INDEX1(0)
- MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("cobra_jvs_host", COBRA_JVS_HOST, 4000000)
diff --git a/src/mame/drivers/crospang.cpp b/src/mame/drivers/crospang.cpp
index 1cdd1ff9f83..19a999466f7 100644
--- a/src/mame/drivers/crospang.cpp
+++ b/src/mame/drivers/crospang.cpp
@@ -360,7 +360,6 @@ static MACHINE_CONFIG_START( crospang, crospang_state )
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_OFFSETS(5, 7)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/crshrace.cpp b/src/mame/drivers/crshrace.cpp
index 7cc33cf93a2..49a7ba67639 100644
--- a/src/mame/drivers/crshrace.cpp
+++ b/src/mame/drivers/crshrace.cpp
@@ -455,7 +455,6 @@ static MACHINE_CONFIG_START( crshrace, crshrace_state )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( crshrace_state, crshrace_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram2")
diff --git a/src/mame/drivers/cshooter.cpp b/src/mame/drivers/cshooter.cpp
index d667d57e710..f64d950dc61 100644
--- a/src/mame/drivers/cshooter.cpp
+++ b/src/mame/drivers/cshooter.cpp
@@ -7,17 +7,8 @@
- added sprites, bgmap reading and few fixes here and there
airraid and cshootere are a bit "playable" ;) without gfx
-
-Haze's notes :
-
- - interrupts are probably wrong .. it ends up writing to rom etc.
- - how do the sprites / bg's work .. these big black unknown things on the pcb
- also sound a bit disturbing, what are they?
- - i can't decode the other gfx? rom
- - there don't seem to be any sprites / bg's in ram, interrupts?
- - palette? format isn't understood
- - the other sets ('cshootere' and 'airraid') need decrypting ..
- is the main one protected ? theres a 68705 on it
+Haze's notes
+ - video system is very similar to darkmist.cpp
Stephh's notes (based on the game Z80 code and some tests) :
@@ -85,6 +76,55 @@ Stephh's notes (based on the game Z80 code and some tests) :
*/
+
+
+/*
+
+ Custom SIMM module placement
+
+ The Air Raid PCB has 3 custom modules shown
+ in the rough diagram of the PCB below.
+
+ The modules do not appear to be 100%
+ identical based on external shapes visible.
+
+ The data they contain is as follows
+ MODULE1
+ Background tilemap graphic data
+ Background tilemap layout data
+
+ MODULE2
+ Foreground tilemap graphic data
+ Foreground tilemap layout data
+
+ MODULE3
+ Sprite graphic data
+
+ it's also possible each module contains a
+ 0x100 colour look up table for that layer.
+
+
+ |-------------------------------------------------|
+ | A B C D E F G H I J K |
+ 20| ##MOD1####### |
+ | # Z80 |
+ | M -|
+ | O |
+ | D |=J
+ | 2 |=A
+ | # |=M
+ 11| |=M
+ | |=A
+ | |
+ | -|
+ | Z80 |
+ | |
+ | ##MOD3####### |
+ |-------------------------------------------------|
+
+*/
+
+
#include "emu.h"
#include "cpu/z80/z80.h"
#include "audio/seibu.h"
@@ -98,6 +138,7 @@ public:
m_maincpu(*this, "maincpu"),
m_seibu_sound(*this, "seibu_sound"),
m_txram(*this, "txram"),
+ m_vregs(*this, "vregs"),
m_mainram(*this, "mainram"),
m_spriteram(*this, "spriteram"),
m_gfxdecode(*this, "gfxdecode"),
@@ -109,28 +150,36 @@ public:
required_device<cpu_device> m_maincpu;
optional_device<seibu_sound_device> m_seibu_sound;
required_shared_ptr<UINT8> m_txram;
+ required_shared_ptr<UINT8> m_vregs;
optional_shared_ptr<UINT8> m_mainram;
optional_shared_ptr<UINT8> m_spriteram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_generic_paletteram_8;
required_shared_ptr<UINT8> m_generic_paletteram2_8;
- required_shared_ptr<UINT8> m_decrypted_opcodes;
+ optional_shared_ptr<UINT8> m_decrypted_opcodes;
+
+ TILEMAP_MAPPER_MEMBER(bg_scan);
+ TILEMAP_MAPPER_MEMBER(fg_scan);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ tilemap_t *m_bg_tilemap;
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ tilemap_t *m_fg_tilemap;
+ TILE_GET_INFO_MEMBER(get_cstx_tile_info);
tilemap_t *m_txtilemap;
- int m_coin_stat;
- int m_counter;
+ UINT16 m_hw;
DECLARE_WRITE8_MEMBER(cshooter_txram_w);
DECLARE_READ8_MEMBER(cshooter_coin_r);
DECLARE_WRITE8_MEMBER(cshooter_c500_w);
DECLARE_WRITE8_MEMBER(cshooter_c700_w);
DECLARE_WRITE8_MEMBER(bank_w);
+ DECLARE_WRITE8_MEMBER(vregs_w);
DECLARE_READ8_MEMBER(seibu_sound_comms_r);
DECLARE_WRITE8_MEMBER(seibu_sound_comms_w);
DECLARE_DRIVER_INIT(cshootere);
DECLARE_DRIVER_INIT(cshooter);
- TILE_GET_INFO_MEMBER(get_cstx_tile_info);
virtual void video_start() override;
DECLARE_PALETTE_INIT(cshooter);
DECLARE_MACHINE_RESET(cshooter);
@@ -142,7 +191,7 @@ public:
PALETTE_INIT_MEMBER(cshooter_state, cshooter)
{
- const UINT8 *color_prom = memregion("proms")->base();
+ const UINT8 *color_prom = memregion("tx_clut")->base();
int i;
// text uses colors 0xc0-0xdf
@@ -152,8 +201,55 @@ PALETTE_INIT_MEMBER(cshooter_state, cshooter)
// rest is still unknown..
for (i = 0x40; i < 0x100; i++)
palette.set_pen_indirect(i, color_prom[i]);
+
+ // just make a direct copy of palette at the end for debug
+ for (i = 0x100; i < 0x200; i++)
+ palette.set_pen_indirect(i, i-0x100);
+
+}
+
+
+TILEMAP_MAPPER_MEMBER(cshooter_state::bg_scan)
+{
+ return ((row&0xf) * 0x10) + (col&0xf) + (((col&0x7f0) >> 4)*0x100) + ((row & 0x30)>>4) * 0x8000;
+}
+
+TILEMAP_MAPPER_MEMBER(cshooter_state::fg_scan)
+{
+ return ((row&0xf) * 0x10) + (col&0xf) + (((col&0x0f0) >> 4)*0x100) + ((row & 0x1f0)>>4) * 0x1000;
+}
+
+
+TILE_GET_INFO_MEMBER(cshooter_state::get_bg_tile_info)
+{
+ UINT8 *bgMap = memregion("bg_map")->base();
+ int tile = bgMap[(tile_index*2)+1] & 0xff;
+ int attr = bgMap[(tile_index*2)+0] & 0xff;
+
+ tile |= (attr & 0x70) << 4;
+
+ SET_TILE_INFO_MEMBER(2,
+ tile,
+ 0,
+ 0);
+}
+
+TILE_GET_INFO_MEMBER(cshooter_state::get_fg_tile_info)
+{
+ UINT8 *bgMap = memregion("fg_map")->base();
+ int tile = bgMap[(tile_index*2)+1] & 0xff;
+ int attr = bgMap[(tile_index*2)+0] & 0xff;
+
+ tile |= (attr & 0x70) << 4;
+
+ SET_TILE_INFO_MEMBER(3,
+ tile,
+ 0,
+ 0);
}
+
+
TILE_GET_INFO_MEMBER(cshooter_state::get_cstx_tile_info)
{
int code = (m_txram[tile_index*2]);
@@ -171,6 +267,16 @@ WRITE8_MEMBER(cshooter_state::cshooter_txram_w)
void cshooter_state::video_start()
{
+
+ // there might actually be 4 banks of 2048 x 16 tilemaps in here as the upper scroll bits are with the rom banking.
+ m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(cshooter_state::get_bg_tile_info),this),tilemap_mapper_delegate(FUNC(cshooter_state::bg_scan),this),16,16,2048, 64);
+
+ // which could in turn mean this is actually 256 x 128, not 256 x 512
+// m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(cshooter_state::get_fg_tile_info),this),tilemap_mapper_delegate(FUNC(cshooter_state::fg_scan),this),16,16,256, 512);
+ m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(cshooter_state::get_fg_tile_info),this),tilemap_mapper_delegate(FUNC(cshooter_state::fg_scan),this),16,16,256, 128);
+
+ m_fg_tilemap->set_transparent_pen(0);
+
m_txtilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(cshooter_state::get_cstx_tile_info),this),TILEMAP_SCAN_ROWS, 8,8,32,32);
m_txtilemap->set_transparent_pen(0);
}
@@ -182,22 +288,32 @@ void cshooter_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
if (m_spriteram[i+1]&0x80)
continue;
- /* BCD debug code, to be removed in the end */
- UINT8 tile_low = (m_spriteram[i]&0x0f);
- UINT8 tile_high = ((m_spriteram[i]&0xf0)>>4);
-
- tile_low += (tile_low > 0x9) ? 0x37 : 0x30;
- tile_high += (tile_high > 0x9) ? 0x37 : 0x30;
+ UINT16 tile = (m_spriteram[i]);
+ tile |= (m_spriteram[i + 1] & 0x70) << 4;
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tile_high << 1, m_spriteram[i+1], 0, 0, m_spriteram[i+3],m_spriteram[i+2],0);
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tile_high << 1, m_spriteram[i+1], 0, 0, m_spriteram[i+3]+8,m_spriteram[i+2],0);
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tile_low << 1, m_spriteram[i+1], 0, 0, m_spriteram[i+3]+8,m_spriteram[i+2]+8,0);
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, tile_low << 1, m_spriteram[i+1], 0, 0, m_spriteram[i+3],m_spriteram[i+2]+8,0);
+ m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, tile, 0, 0, 0, m_spriteram[i+3],m_spriteram[i+2],0);
}
}
+
+#define DISPLAY_SPR 1
+#define DISPLAY_FG 2
+#define DISPLAY_BG 4
+#define DISPLAY_TXT 8
+#define DM_GETSCROLL(n) (((m_vregs[(n)]<<1)&0xff) + ((m_vregs[(n)]&0x80)?1:0) +( ((m_vregs[(n)-1]<<4) | (m_vregs[(n)-1]<<12) )&0xff00))
+
UINT32 cshooter_state::screen_update_airraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
+
+ UINT16 bgscrolly = DM_GETSCROLL(0x6);
+ // this is more likely to be 'bank' than scroll, like NMK16
+ bgscrolly += ((m_hw & 0xc0) >> 6) * 256;
+
+ m_bg_tilemap->set_scrollx(0, DM_GETSCROLL(0x2));
+ m_bg_tilemap->set_scrolly(0, bgscrolly);
+ m_fg_tilemap->set_scrollx(0, DM_GETSCROLL(0xa));
+ m_fg_tilemap->set_scrolly(0, DM_GETSCROLL(0xe));
+
// set palette (compared to cshooter, r and g are swapped)
for (int i = 0; i < 0x100; i++)
{
@@ -209,23 +325,34 @@ UINT32 cshooter_state::screen_update_airraid(screen_device &screen, bitmap_ind16
m_palette->set_indirect_color(i, color);
}
+ // draw screen
bitmap.fill(0x80, cliprect); // temp
- draw_sprites(bitmap, cliprect);
+ if ((m_hw & DISPLAY_BG) == 0x00)
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0);
+
+ if ((m_hw & DISPLAY_FG) == 0x00)
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0);
+
+ if(m_hw & DISPLAY_SPR)
+ draw_sprites(bitmap, cliprect);
+
+ if(m_hw & DISPLAY_TXT)
+ m_txtilemap->draw(screen, bitmap, cliprect, 0,0);
- m_txtilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;
}
+
/* main cpu */
TIMER_DEVICE_CALLBACK_MEMBER(cshooter_state::cshooter_scanline)
{
int scanline = param;
-// if(scanline == 240) // presumably a SW trap, not an irq
-// m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xd7); /* RST 10h */
+ if(scanline == 120) // updates scroll resgiters
+ m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xd7); /* RST 10h */
if(scanline == 240) // vblank-out irq
m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xcf); /* RST 08h */
@@ -234,15 +361,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(cshooter_state::cshooter_scanline)
MACHINE_RESET_MEMBER(cshooter_state,cshooter)
{
- m_counter = 0;
-}
-
-READ8_MEMBER(cshooter_state::cshooter_coin_r)
-{
- /* Even reads must return 0xff - Odd reads must return the contents of input port 5.
- Code at 0x5061 is executed once during P.O.S.T. where there is one read.
- Code at 0x50b4 is then executed each frame (not sure) where there are 2 reads. */
- return ( (m_counter++ & 1) ? 0xff : ioport("COIN")->read() );
}
WRITE8_MEMBER(cshooter_state::cshooter_c500_w)
@@ -255,6 +373,19 @@ WRITE8_MEMBER(cshooter_state::cshooter_c700_w)
WRITE8_MEMBER(cshooter_state::bank_w)
{
+ // format of this address is TTBB tbfs
+
+ // TT = bg tilemap upper scroll bits (probably bg tilemap bank select?)
+ // BB = prg ROM bank select
+ // t = text layer enable
+ // b = bg layer disable
+ // f = fg layer disable
+ // s = sprite layer enable
+
+// printf("bankw %02x\n", data & 0xc0);
+
+ m_hw = data;
+
membank("bank1")->set_entry((data>>4)&3);
}
@@ -269,29 +400,15 @@ WRITE8_MEMBER(cshooter_state::seibu_sound_comms_w)
m_seibu_sound->main_word_w(space,offset,data,0x00ff);
}
-#if 0
-static ADDRESS_MAP_START( cshooter_map, AS_PROGRAM, 8, cshooter_state )
- AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank1") AM_WRITEONLY
- AM_RANGE(0xb000, 0xb0ff) AM_READONLY // sound related ?
- AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_SHARE("paletteram")
- AM_RANGE(0xc100, 0xc1ff) AM_RAM AM_SHARE("paletteram2")
- AM_RANGE(0xc200, 0xc200) AM_READ_PORT("IN0")
- AM_RANGE(0xc201, 0xc201) AM_READ_PORT("IN1")
- AM_RANGE(0xc202, 0xc202) AM_READ_PORT("IN2")
- AM_RANGE(0xc203, 0xc203) AM_READ_PORT("DSW2")
- AM_RANGE(0xc204, 0xc204) AM_READ_PORT("DSW1")
- AM_RANGE(0xc205, 0xc205) AM_READ(cshooter_coin_r) // hack until I understand
- AM_RANGE(0xc500, 0xc500) AM_WRITE(cshooter_c500_w)
- AM_RANGE(0xc600, 0xc600) AM_WRITENOP // see notes
- AM_RANGE(0xc700, 0xc700) AM_WRITE(cshooter_c700_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITENOP // see notes
- AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_SHARE("txram")
- AM_RANGE(0xd800, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xffff) AM_RAM
-ADDRESS_MAP_END
-#endif
+WRITE8_MEMBER(cshooter_state::vregs_w)
+{
+ m_vregs[offset] = data;
+
+ if ((offset != 0x2) && (offset != 0x01) && (offset != 0xa) && (offset != 0x09) && (offset != 0xe) && (offset != 0x0d) )
+ printf("vregs_w %02x: %02x\n", offset, data);
+}
+
static ADDRESS_MAP_START( airraid_map, AS_PROGRAM, 8, cshooter_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
@@ -302,14 +419,19 @@ static ADDRESS_MAP_START( airraid_map, AS_PROGRAM, 8, cshooter_state )
AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW2")
AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW1")
AM_RANGE(0xc500, 0xc500) AM_WRITE(cshooter_c500_w)
- AM_RANGE(0xc600, 0xc600) AM_WRITENOP // see notes
+// AM_RANGE(0xc600, 0xc600) AM_WRITE(cshooter_c600_w) // see notes
AM_RANGE(0xc700, 0xc700) AM_WRITE(cshooter_c700_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITENOP // see notes
+// AM_RANGE(0xc801, 0xc801) AM_WRITE(cshooter_c801_w) // see notes
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_SHARE("txram")
AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_SHARE("paletteram")
AM_RANGE(0xda00, 0xdaff) AM_RAM AM_SHARE("paletteram2")
AM_RANGE(0xdc11, 0xdc11) AM_WRITE(bank_w)
- AM_RANGE(0xdc00, 0xdc1f) AM_RAM //video registers
+ AM_RANGE(0xdc00, 0xdc0f) AM_RAM_WRITE(vregs_w) AM_SHARE("vregs")
+// AM_RANGE(0xdc10, 0xdc10) AM_RAM
+// AM_RANGE(0xdc19, 0xdc19) AM_RAM
+// AM_RANGE(0xdc1e, 0xdc1e) AM_RAM
+// AM_RANGE(0xdc1f, 0xdc1f) AM_RAM
+
AM_RANGE(0xde00, 0xde0f) AM_READWRITE(seibu_sound_comms_r,seibu_sound_comms_w)
AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("mainram")
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
@@ -319,16 +441,6 @@ static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cshoot
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes")
ADDRESS_MAP_END
-#if 0
-/* Sound CPU */
-
-static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cshooter_state )
- AM_RANGE(0x0000, 0x1fff) AM_ROM
- AM_RANGE(0xc000, 0xc001) AM_WRITENOP // AM_DEVWRITE("ym1", ym2203_device, write) ?
- AM_RANGE(0xc800, 0xc801) AM_WRITENOP // AM_DEVWRITE("ym2", ym2203_device, write) ?
- AM_RANGE(0xf800, 0xffff) AM_RAM
-ADDRESS_MAP_END
-#endif
static INPUT_PORTS_START( cshooter )
PORT_START("IN0") /* IN0 (0xc200) */
@@ -425,6 +537,7 @@ static INPUT_PORTS_START( airraid )
PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
+
static const gfx_layout cshooter_charlayout =
{
8,8, /* 8*8 characters */
@@ -436,23 +549,39 @@ static const gfx_layout cshooter_charlayout =
128*1
};
+static const gfx_layout cshooter_char16layout =
+{
+ 16,16, /* 8*8 characters */
+ RGN_FRAC(1,1), /* 512 characters */
+ 4, /* 4 bits per pixel */
+ { 0,8,4,12 },
+ { 0,1,2,3, 16,17,18,19, 512+0,512+1,512+2,512+3, 512+16,512+17,512+18,512+19},
+ { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
+ 32*32
+};
+
+
static GFXDECODE_START( cshooter )
- GFXDECODE_ENTRY( "gfx1", 0, cshooter_charlayout, 0, 16 )
+ GFXDECODE_ENTRY( "tx_gfx", 0, cshooter_charlayout, 0, 16 )
+ GFXDECODE_ENTRY( "spr_gfx", 0, cshooter_char16layout, 0x100, 16 )
+ GFXDECODE_ENTRY( "bg_gfx", 0, cshooter_char16layout, 0x100, 16 )
+ GFXDECODE_ENTRY( "fg_gfx", 0, cshooter_char16layout, 0x100, 16 )
GFXDECODE_END
+
+
static MACHINE_CONFIG_START( airraid, cshooter_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(airraid_map)
- MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cshooter_state, cshooter_scanline, "screen", 0, 1)
SEIBU2_AIRRAID_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */
SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW()
- MCFG_QUANTUM_TIME(attotime::from_hz(6000))
+ MCFG_QUANTUM_PERFECT_CPU("maincpu")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -464,8 +593,8 @@ static MACHINE_CONFIG_START( airraid, cshooter_state )
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", cshooter)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x100)
+ MCFG_PALETTE_ADD("palette", 0x200)
+ MCFG_PALETTE_INDIRECT_ENTRIES(0x200)
MCFG_PALETTE_INIT_OWNER(cshooter_state, cshooter)
/* sound hardware */
@@ -473,6 +602,12 @@ static MACHINE_CONFIG_START( airraid, cshooter_state )
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( airraid_crypt, airraid )
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+MACHINE_CONFIG_END
+
+
@@ -513,28 +648,51 @@ ROM_START( cshootere )
ROM_REGION( 0x10000, "maincpu", 0 ) // Main CPU
ROM_LOAD( "1.k19", 0x00000, 0x08000, CRC(71418952) SHA1(9745ca006576381c9e9595d8e42ab276bab80a41) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) // Sub/Sound CPU
+ ROM_REGION( 0x10000, "user1", 0 ) // cpu data
+ ROM_LOAD( "2.k20", 0x00000, 0x10000, CRC(5812fe72) SHA1(3b28bff6b62a411d2195bb228952db62ad32ef3d) )
+
+ ROM_REGION( 0x18000, "audiocpu", 0 ) // Sub/Sound CPU
ROM_LOAD( "5.6f", 0x00000, 0x02000, CRC(30be398c) SHA1(6c61200ee8888d6270c8cec50423b3b5602c2027) ) // 5.g6
- ROM_LOAD( "4.7f", 0x08000, 0x08000, CRC(3cd715b4) SHA1(da735fb5d262908ddf7ed7dacdea68899f1723ff) ) // 4.g8
+ ROM_LOAD( "4.7f", 0x10000, 0x08000, CRC(3cd715b4) SHA1(da735fb5d262908ddf7ed7dacdea68899f1723ff) ) // 4.g8
- ROM_REGION( 0x02000, "gfx1", 0 ) // TX Layer
+ ROM_REGION( 0x02000, "tx_gfx", 0 ) // TX Layer
ROM_LOAD( "3.f11", 0x00000, 0x02000, CRC(67b50a47) SHA1(b1f4aefc9437edbeefba5371149cc08c0b55c741) )
- ROM_REGION( 0x20000, "gfx2", 0 ) // tiles
- ROM_LOAD( "graphics1.bin", 0x00000, 0x10000, NO_DUMP )
- ROM_LOAD( "graphics2.bin", 0x10000, 0x10000, NO_DUMP )
-
- ROM_REGION( 0x10000, "gfx3", 0 ) // sprites
- ROM_LOAD( "graphics3.bin", 0x00000, 0x10000, NO_DUMP )
-
- ROM_REGION( 0x10000, "user1", 0 ) // Tilemaps
- ROM_LOAD( "2.k20", 0x00000, 0x10000, CRC(5812fe72) SHA1(3b28bff6b62a411d2195bb228952db62ad32ef3d) )
- ROM_REGION( 0x320, "proms", 0 ) // taken from parent set
+ ROM_REGION( 0x100, "tx_clut", 0 ) // taken from parent set (need proper IC locations for this PCB type)
ROM_LOAD( "63s281.16a", 0x0000, 0x0100, CRC(0b8b914b) SHA1(8cf4910b846de79661cc187887171ed8ebfd6719) ) // clut
- ROM_LOAD( "82s123.7a", 0x0100, 0x0020, CRC(93e2d292) SHA1(af8edd0cfe85f28ede9604cfaf4516d54e5277c9) ) // sprite color related? (not used)
- ROM_LOAD( "82s129.9s", 0x0120, 0x0100, CRC(cf14ba30) SHA1(3284b6809075756b3c8e07d9705fc7eacb7556f1) ) // timing? (not used)
- ROM_LOAD( "82s129.4e", 0x0220, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // timing? (not used)
+
+ ROM_REGION( 0x220, "proms", 0 ) // taken from parent set (need proper IC locations for this PCB type)
+ ROM_LOAD( "82s123.7a", 0x0000, 0x0020, CRC(93e2d292) SHA1(af8edd0cfe85f28ede9604cfaf4516d54e5277c9) ) // sprite color related? (not used)
+ ROM_LOAD( "82s129.9s", 0x0020, 0x0100, CRC(cf14ba30) SHA1(3284b6809075756b3c8e07d9705fc7eacb7556f1) ) // timing? (not used)
+ ROM_LOAD( "82s129.4e", 0x0120, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // timing? (not used)
+
+ /* ### MODULE 1 ### Background generation / graphics */
+ ROM_REGION( 0x40000, "bg_map", 0 )
+ ROM_LOAD16_BYTE( "bg_layouts_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "bg_layouts_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x40000, "bg_gfx", 0 )
+ ROM_LOAD16_BYTE( "bg_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "bg_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "bg_clut", 0 )
+ ROM_LOAD( "bg_clut", 0x000, 0x100, NO_DUMP )
+
+ /* ### MODULE 2 ### Foreground generation / graphics */
+ ROM_REGION( 0x40000, "fg_map", 0 )
+ ROM_LOAD16_BYTE( "fg_layouts_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "fg_layouts_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x40000, "fg_gfx", 0 )
+ ROM_LOAD16_BYTE( "fg_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "fg_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "fg_clut", 0 )
+ ROM_LOAD( "fg_clut", 0x000, 0x100, NO_DUMP )
+
+ /* ### MODULE 3 ### Sprite graphics */
+ ROM_REGION( 0x40000, "spr_gfx", 0 )
+ ROM_LOAD16_BYTE( "sprite_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "sprite_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "spr_clut", 0 )
+ ROM_LOAD( "spr_clut", 0x000, 0x100, NO_DUMP )
ROM_END
/*
@@ -563,43 +721,59 @@ ROM_START( airraid )
ROM_REGION( 0x10000, "maincpu", 0 ) // Main CPU
ROM_LOAD( "1.16j", 0x00000, 0x08000, CRC(7ac2cedf) SHA1(272831f51a2731e067b5aec6dba6bddd3c5350c9) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) // Sub/Sound CPU
+ ROM_REGION( 0x10000, "user1", 0 ) // cpu data
+ ROM_LOAD( "2.19j", 0x00000, 0x10000, CRC(842ae6c2) SHA1(0468445e4ab6f42bac786f9a258df3972fd1fde9) )
+
+ ROM_REGION( 0x18000, "audiocpu", 0 ) // Sub/Sound CPU
ROM_LOAD( "5.6f", 0x00000, 0x02000, CRC(30be398c) SHA1(6c61200ee8888d6270c8cec50423b3b5602c2027) )
- ROM_LOAD( "4.7f", 0x08000, 0x08000, CRC(3cd715b4) SHA1(da735fb5d262908ddf7ed7dacdea68899f1723ff) )
+ ROM_LOAD( "4.7f", 0x10000, 0x08000, CRC(3cd715b4) SHA1(da735fb5d262908ddf7ed7dacdea68899f1723ff) )
- ROM_REGION( 0x02000, "gfx1", 0 ) // TX Layer
+ ROM_REGION( 0x02000, "tx_gfx", 0 ) // TX Layer
ROM_LOAD( "3.13e", 0x00000, 0x02000, CRC(672ec0e8) SHA1(a11cd90d6494251ceee3bc7c72f4e7b1580b77e2) )
- ROM_REGION( 0x20000, "gfx2", 0 ) // tiles
- ROM_LOAD( "graphics1.bin", 0x00000, 0x10000, NO_DUMP )
- ROM_LOAD( "graphics2.bin", 0x10000, 0x10000, NO_DUMP )
+ ROM_REGION( 0x100, "tx_clut", 0 ) // taken from parent set (need proper IC locations for this PCB type)
+ ROM_LOAD( "63s281.16a", 0x0000, 0x0100, CRC(0b8b914b) SHA1(8cf4910b846de79661cc187887171ed8ebfd6719) ) // clut
- ROM_REGION( 0x10000, "gfx3", 0 ) // sprites
- ROM_LOAD( "graphics3.bin", 0x00000, 0x10000, NO_DUMP )
+ ROM_REGION( 0x220, "proms", 0 ) // taken from parent set (need proper IC locations for this PCB type)
+ ROM_LOAD( "82s123.7a", 0x0000, 0x0020, CRC(93e2d292) SHA1(af8edd0cfe85f28ede9604cfaf4516d54e5277c9) ) // sprite color related? (not used)
+ ROM_LOAD( "82s129.9s", 0x0020, 0x0100, CRC(cf14ba30) SHA1(3284b6809075756b3c8e07d9705fc7eacb7556f1) ) // timing? (not used)
+ ROM_LOAD( "82s129.4e", 0x0120, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // timing? (not used)
+
+ /* ### MODULE 1 ### Background generation / graphics */
+ ROM_REGION( 0x40000, "bg_map", 0 )
+ ROM_LOAD16_BYTE( "bg_layouts_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "bg_layouts_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x40000, "bg_gfx", 0 )
+ ROM_LOAD16_BYTE( "bg_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "bg_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "bg_clut", 0 )
+ ROM_LOAD( "bg_clut", 0x000, 0x100, NO_DUMP )
+
+ /* ### MODULE 2 ### Foreground generation / graphics */
+ ROM_REGION( 0x40000, "fg_map", 0 )
+ ROM_LOAD16_BYTE( "fg_layouts_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "fg_layouts_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x40000, "fg_gfx", 0 )
+ ROM_LOAD16_BYTE( "fg_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "fg_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "fg_clut", 0 )
+ ROM_LOAD( "fg_clut", 0x000, 0x100, NO_DUMP )
+
+ /* ### MODULE 3 ### Sprite graphics */
+ ROM_REGION( 0x40000, "spr_gfx", 0 )
+ ROM_LOAD16_BYTE( "sprite_tiles_even", 0x00000, 0x20000, NO_DUMP )
+ ROM_LOAD16_BYTE( "sprite_tiles_odd", 0x00001, 0x20000, NO_DUMP )
+ ROM_REGION( 0x100, "spr_clut", 0 )
+ ROM_LOAD( "spr_clut", 0x000, 0x100, NO_DUMP )
+ROM_END
- ROM_REGION( 0x10000, "user1", 0 ) // bg maps
- ROM_LOAD( "2.19j", 0x00000, 0x10000, CRC(842ae6c2) SHA1(0468445e4ab6f42bac786f9a258df3972fd1fde9) )
- ROM_REGION( 0x320, "proms", 0 ) // taken from parent set
- ROM_LOAD( "63s281.16a", 0x0000, 0x0100, CRC(0b8b914b) SHA1(8cf4910b846de79661cc187887171ed8ebfd6719) ) // clut
- ROM_LOAD( "82s123.7a", 0x0100, 0x0020, CRC(93e2d292) SHA1(af8edd0cfe85f28ede9604cfaf4516d54e5277c9) ) // sprite color related? (not used)
- ROM_LOAD( "82s129.9s", 0x0120, 0x0100, CRC(cf14ba30) SHA1(3284b6809075756b3c8e07d9705fc7eacb7556f1) ) // timing? (not used)
- ROM_LOAD( "82s129.4e", 0x0220, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) // timing? (not used)
-ROM_END
-#if 0
-DRIVER_INIT_MEMBER(cshooter_state,cshooter)
+DRIVER_INIT_MEMBER(cshooter_state, cshooter)
{
- /* temp so it boots */
- UINT8 *rom = memregion("maincpu")->base();
-
- rom[0xa2] = 0x00;
- rom[0xa3] = 0x00;
- rom[0xa4] = 0x00;
- membank("bank1")->set_base(&memregion("user1")->base()[0]);
+ membank("bank1")->configure_entries(0, 4, memregion("user1")->base(), 0x4000);
}
-#endif
DRIVER_INIT_MEMBER(cshooter_state,cshootere)
{
@@ -630,11 +804,12 @@ DRIVER_INIT_MEMBER(cshooter_state,cshootere)
rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
}
- membank("bank1")->configure_entries(0, 4, memregion("user1")->base(), 0x4000);
+ DRIVER_INIT_CALL(cshooter);
+
}
-GAME( 1987, cshootere, cshooter, airraid, airraid, cshooter_state, cshootere, ROT270, "Seibu Kaihatsu (J.K.H. license)", "Cross Shooter (encrypted)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )
-GAME( 1987, airraid, cshooter, airraid, airraid, cshooter_state, cshootere, ROT270, "Seibu Kaihatsu", "Air Raid (encrypted)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )
+GAME( 1987, cshootere, cshooter, airraid_crypt, airraid, cshooter_state, cshootere, ROT270, "Seibu Kaihatsu (J.K.H. license)", "Cross Shooter (Single PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )
+GAME( 1987, airraid, cshooter, airraid_crypt, airraid, cshooter_state, cshootere, ROT270, "Seibu Kaihatsu", "Air Raid (Single PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )
// There's also an undumped International Games version
diff --git a/src/mame/drivers/cv1k.cpp b/src/mame/drivers/cv1k.cpp
index 02f4cfae416..45c751c4725 100644
--- a/src/mame/drivers/cv1k.cpp
+++ b/src/mame/drivers/cv1k.cpp
@@ -207,18 +207,18 @@ public:
required_shared_ptr<UINT64> m_ram;
required_shared_ptr<UINT64> m_rombase;
- DECLARE_READ8_MEMBER(cv1k_flash_io_r);
- DECLARE_WRITE8_MEMBER(cv1k_flash_io_w);
+ DECLARE_READ8_MEMBER(flash_io_r);
+ DECLARE_WRITE8_MEMBER(flash_io_w);
DECLARE_READ8_MEMBER(serial_rtc_eeprom_r);
DECLARE_WRITE8_MEMBER(serial_rtc_eeprom_w);
- DECLARE_READ64_MEMBER(cv1k_flash_port_e_r);
+ DECLARE_READ64_MEMBER(flash_port_e_r);
- UINT32 screen_update_cv1k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual void machine_reset() override;
/* game specific */
- DECLARE_READ64_MEMBER(cv1k_speedup_r);
+ DECLARE_READ64_MEMBER(speedup_r);
DECLARE_DRIVER_INIT(mushisam);
DECLARE_DRIVER_INIT(ibara);
DECLARE_DRIVER_INIT(espgal2);
@@ -232,13 +232,13 @@ public:
UINT32 m_idleramoffs;
UINT32 m_idlepc;
- void install_cv1k_speedups(UINT32 idleramoff, UINT32 idlepc, bool is_typed);
+ void install_speedups(UINT32 idleramoff, UINT32 idlepc, bool is_typed);
};
/**************************************************************************/
-UINT32 cv1k_state::screen_update_cv1k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+UINT32 cv1k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_blitter->set_delay_scale(m_blitrate->read());
@@ -249,13 +249,13 @@ UINT32 cv1k_state::screen_update_cv1k(screen_device &screen, bitmap_rgb32 &bitma
// FLASH interface
-READ64_MEMBER( cv1k_state::cv1k_flash_port_e_r )
+READ64_MEMBER( cv1k_state::flash_port_e_r )
{
return ((m_serflash->flash_ready_r(space, offset) ? 0x20 : 0x00)) | 0xdf;
}
-READ8_MEMBER( cv1k_state::cv1k_flash_io_r )
+READ8_MEMBER( cv1k_state::flash_io_r )
{
switch (offset)
{
@@ -268,7 +268,7 @@ READ8_MEMBER( cv1k_state::cv1k_flash_io_r )
case 0x06:
case 0x07:
- // logerror("cv1k_flash_io_r offset %04x\n", offset);
+ // logerror("flash_io_r offset %04x\n", offset);
return 0xff;
case 0x00:
@@ -276,13 +276,13 @@ READ8_MEMBER( cv1k_state::cv1k_flash_io_r )
}
}
-WRITE8_MEMBER( cv1k_state::cv1k_flash_io_w )
+WRITE8_MEMBER( cv1k_state::flash_io_w )
{
switch (offset)
{
default:
case 0x03:
- logerror("unknown cv1k_flash_io_w offset %04x data %02x\n", offset, data); // 03 enable/disable fgpa access?
+ logerror("unknown flash_io_w offset %04x data %02x\n", offset, data); // 03 enable/disable fgpa access?
break;
case 0x00:
@@ -336,7 +336,7 @@ WRITE8_MEMBER( cv1k_state::serial_rtc_eeprom_w )
static ADDRESS_MAP_START( cv1k_map, AS_PROGRAM, 64, cv1k_state )
AM_RANGE(0x00000000, 0x003fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITENOP AM_SHARE("rombase") // mmmbanc writes here on startup for some reason..
AM_RANGE(0x0c000000, 0x0c7fffff) AM_RAM AM_SHARE("mainram") AM_MIRROR(0x800000) // work RAM
- AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(cv1k_flash_io_r, cv1k_flash_io_w, U64(0xffffffffffffffff))
+ AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, U64(0xffffffffffffffff))
AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, U64(0xffffffffffffffff))
AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, U64(0xffffffffffffffff))
// AM_RANGE(0x18000000, 0x18000057) // blitter, installed on reset
@@ -346,7 +346,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cv1k_d_map, AS_PROGRAM, 64, cv1k_state )
AM_RANGE(0x00000000, 0x003fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITENOP AM_SHARE("rombase") // mmmbanc writes here on startup for some reason..
AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE("mainram") // work RAM
- AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(cv1k_flash_io_r, cv1k_flash_io_w, U64(0xffffffffffffffff))
+ AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, U64(0xffffffffffffffff))
AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, U64(0xffffffffffffffff))
AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, U64(0xffffffffffffffff))
// AM_RANGE(0x18000000, 0x18000057) // blitter, installed on reset
@@ -356,7 +356,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cv1k_port, AS_IO, 64, cv1k_state )
AM_RANGE(SH3_PORT_C, SH3_PORT_C+7) AM_READ_PORT("PORT_C")
AM_RANGE(SH3_PORT_D, SH3_PORT_D+7) AM_READ_PORT("PORT_D")
- AM_RANGE(SH3_PORT_E, SH3_PORT_E+7) AM_READ( cv1k_flash_port_e_r )
+ AM_RANGE(SH3_PORT_E, SH3_PORT_E+7) AM_READ( flash_port_e_r )
AM_RANGE(SH3_PORT_F, SH3_PORT_F+7) AM_READ_PORT("PORT_F")
AM_RANGE(SH3_PORT_L, SH3_PORT_L+7) AM_READ_PORT("PORT_L")
AM_RANGE(SH3_PORT_J, SH3_PORT_J+7) AM_DEVREADWRITE( "blitter", epic12_device, fpga_r, fpga_w )
@@ -455,7 +455,7 @@ static MACHINE_CONFIG_START( cv1k, cv1k_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(0x200, 0x200)
MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0, 0xf0-1)
- MCFG_SCREEN_UPDATE_DRIVER(cv1k_state, screen_update_cv1k)
+ MCFG_SCREEN_UPDATE_DRIVER(cv1k_state, screen_update)
MCFG_PALETTE_ADD("palette", 0x10000)
@@ -828,18 +828,18 @@ ROM_START( dfkbl )
ROM_LOAD16_WORD_SWAP( "u24", 0x400000, 0x400000, CRC(31f9eb0a) SHA1(322158779e969bb321241065dd49c1167b91ff6c) )
ROM_END
-READ64_MEMBER( cv1k_state::cv1k_speedup_r )
+READ64_MEMBER( cv1k_state::speedup_r )
{
if (m_maincpu->pc()== m_idlepc ) m_maincpu->spin_until_time( attotime::from_usec(10));
return m_ram[m_idleramoffs/8];
}
-void cv1k_state::install_cv1k_speedups(UINT32 idleramoff, UINT32 idlepc, bool is_typed)
+void cv1k_state::install_speedups(UINT32 idleramoff, UINT32 idlepc, bool is_typed)
{
m_idleramoffs = idleramoff;
m_idlepc = idlepc;
- m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000000+m_idleramoffs, 0xc000000+m_idleramoffs+7, read64_delegate(FUNC(cv1k_state::cv1k_speedup_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000000+m_idleramoffs, 0xc000000+m_idleramoffs+7, read64_delegate(FUNC(cv1k_state::speedup_r),this));
m_maincpu->add_fastram(0x00000000, 0x003fffff, TRUE, m_rombase);
@@ -850,37 +850,37 @@ void cv1k_state::install_cv1k_speedups(UINT32 idleramoff, UINT32 idlepc, bool is
DRIVER_INIT_MEMBER(cv1k_state,mushisam)
{
- install_cv1k_speedups(0x024d8, 0xc04a2aa, false);
+ install_speedups(0x024d8, 0xc04a2aa, false);
}
DRIVER_INIT_MEMBER(cv1k_state,ibara)
{
- install_cv1k_speedups(0x022f0, 0xc04a0aa, false);
+ install_speedups(0x022f0, 0xc04a0aa, false);
}
DRIVER_INIT_MEMBER(cv1k_state,espgal2)
{
- install_cv1k_speedups(0x02310, 0xc05177a, false);
+ install_speedups(0x02310, 0xc05177a, false);
}
DRIVER_INIT_MEMBER(cv1k_state,mushitam)
{
- install_cv1k_speedups(0x0022f0, 0xc04a0da, false);
+ install_speedups(0x0022f0, 0xc04a0da, false);
}
DRIVER_INIT_MEMBER(cv1k_state,pinkswts)
{
- install_cv1k_speedups(0x02310, 0xc05176a, false);
+ install_speedups(0x02310, 0xc05176a, false);
}
DRIVER_INIT_MEMBER(cv1k_state,deathsml)
{
- install_cv1k_speedups(0x02310, 0xc0519a2, false);
+ install_speedups(0x02310, 0xc0519a2, false);
}
DRIVER_INIT_MEMBER(cv1k_state,dpddfk)
{
- install_cv1k_speedups(0x02310, 0xc1d1346, true);
+ install_speedups(0x02310, 0xc1d1346, true);
}
diff --git a/src/mame/drivers/darius.cpp b/src/mame/drivers/darius.cpp
index aa8734d4c01..4026a85fde3 100644
--- a/src/mame/drivers/darius.cpp
+++ b/src/mame/drivers/darius.cpp
@@ -801,7 +801,6 @@ static MACHINE_CONFIG_START( darius, darius_state )
MCFG_PC080SN_YINVERT(0)
MCFG_PC080SN_DBLWIDTH(1)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/darkseal.cpp b/src/mame/drivers/darkseal.cpp
index c652fee62a2..7c48821b591 100644
--- a/src/mame/drivers/darkseal.cpp
+++ b/src/mame/drivers/darkseal.cpp
@@ -260,7 +260,6 @@ static MACHINE_CONFIG_START( darkseal, darkseal_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -274,12 +273,10 @@ static MACHINE_CONFIG_START( darkseal, darkseal_state )
MCFG_DECO16IC_PF12_8X8_BANK(2)
MCFG_DECO16IC_PF12_16X16_BANK(3)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/dassault.cpp b/src/mame/drivers/dassault.cpp
index 5df8e0e002c..41d26bed464 100644
--- a/src/mame/drivers/dassault.cpp
+++ b/src/mame/drivers/dassault.cpp
@@ -584,7 +584,6 @@ static MACHINE_CONFIG_START( dassault, dassault_state )
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -601,17 +600,14 @@ static MACHINE_CONFIG_START( dassault, dassault_state )
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp
index 9076254e457..161dcd7d4fe 100644
--- a/src/mame/drivers/dblewing.cpp
+++ b/src/mame/drivers/dblewing.cpp
@@ -403,13 +403,11 @@ static MACHINE_CONFIG_START( dblewing, dblewing_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_PRIORITY_CB(dblewing_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE
diff --git a/src/mame/drivers/dbz.cpp b/src/mame/drivers/dbz.cpp
index 6372c089fb1..c23e895dc27 100644
--- a/src/mame/drivers/dbz.cpp
+++ b/src/mame/drivers/dbz.cpp
@@ -346,14 +346,12 @@ static MACHINE_CONFIG_START( dbz, dbz_state )
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(dbz_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 2, K056832_BPP_4, 1, 1, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(dbz_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 3, NORMAL_PLANE_ORDER, -87, 32) // or -52, 16?
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -87, 32) // or -52, 16?
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
diff --git a/src/mame/drivers/deadang.cpp b/src/mame/drivers/deadang.cpp
index b73bc01e7ed..62f785fdf2d 100644
--- a/src/mame/drivers/deadang.cpp
+++ b/src/mame/drivers/deadang.cpp
@@ -463,14 +463,14 @@ ROM_END
DRIVER_INIT_MEMBER(deadang_state,deadang)
{
- m_adpcm1->decrypt("adpcm1");
- m_adpcm2->decrypt("adpcm2");
+ m_adpcm1->decrypt();
+ m_adpcm2->decrypt();
}
DRIVER_INIT_MEMBER(deadang_state,ghunter)
{
- m_adpcm1->decrypt("adpcm1");
- m_adpcm2->decrypt("adpcm2");
+ m_adpcm1->decrypt();
+ m_adpcm2->decrypt();
m_maincpu->space(AS_PROGRAM).install_read_handler(0x80000, 0x80001, read16_delegate(FUNC(deadang_state::ghunter_trackball_low_r),this));
m_maincpu->space(AS_PROGRAM).install_read_handler(0xb0000, 0xb0001, read16_delegate(FUNC(deadang_state::ghunter_trackball_high_r),this));
diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp
index 0c8bba5ffb1..8f30e7b5b98 100644
--- a/src/mame/drivers/dec0.cpp
+++ b/src/mame/drivers/dec0.cpp
@@ -1291,19 +1291,18 @@ static MACHINE_CONFIG_START( dec0_base, dec0_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,1,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 1, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 3);
+ MCFG_DECO_MXC06_GFX_REGION(3)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( dec0, dec0_base )
@@ -1405,19 +1404,18 @@ static MACHINE_CONFIG_START( automat, dec0_automat_state )
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,1,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 1, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 3);
+ MCFG_DECO_MXC06_GFX_REGION(3)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
@@ -1467,19 +1465,18 @@ static MACHINE_CONFIG_START( secretab, dec0_automat_state )
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,1,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 1, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 3);
+ MCFG_DECO_MXC06_GFX_REGION(3)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp
index f9fe92ef5c9..26abe657ca1 100644
--- a/src/mame/drivers/dec8.cpp
+++ b/src/mame/drivers/dec8.cpp
@@ -2002,9 +2002,8 @@ static MACHINE_CONFIG_START( lastmisn, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2055,9 +2054,8 @@ static MACHINE_CONFIG_START( shackled, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2107,9 +2105,8 @@ static MACHINE_CONFIG_START( gondo, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2160,9 +2157,8 @@ static MACHINE_CONFIG_START( garyoret, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2213,13 +2209,12 @@ static MACHINE_CONFIG_START( ghostb, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,2,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(2, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2277,9 +2272,8 @@ static MACHINE_CONFIG_START( csilver, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("spritegen_krn", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 1);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(1)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2335,13 +2329,12 @@ static MACHINE_CONFIG_START( oscar, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,2,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(2, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen_mxc", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 1);
+ MCFG_DECO_MXC06_GFX_REGION(1)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(58)
@@ -2432,16 +2425,15 @@ static MACHINE_CONFIG_START( cobracom, dec8_state )
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,2,2,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(2, 2, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,3,3,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(3, 3, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen_mxc", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 1);
+ MCFG_DECO_MXC06_GFX_REGION(1)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/deco156.cpp b/src/mame/drivers/deco156.cpp
index b8ab102bee1..410f79504ee 100644
--- a/src/mame/drivers/deco156.cpp
+++ b/src/mame/drivers/deco156.cpp
@@ -369,13 +369,11 @@ static MACHINE_CONFIG_START( hvysmsh, deco156_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_PRIORITY_CB(deco156_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@@ -422,13 +420,11 @@ static MACHINE_CONFIG_START( wcvol95, deco156_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_PRIORITY_CB(deco156_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp
index d8f77543f26..f4788a4b954 100644
--- a/src/mame/drivers/deco32.cpp
+++ b/src/mame/drivers/deco32.cpp
@@ -1840,7 +1840,6 @@ static MACHINE_CONFIG_START( captaven, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0) // pf3 is in 8bpp mode, pf4 is not used
MCFG_DECO16IC_SPLIT(0)
@@ -1856,13 +1855,11 @@ static MACHINE_CONFIG_START( captaven, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_PRIORITY_CB(deco32_state, captaven_pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
@@ -1946,7 +1943,6 @@ static MACHINE_CONFIG_START( fghthist, deco32_state ) /* DE-0380-2 PCB */
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1962,12 +1958,10 @@ static MACHINE_CONFIG_START( fghthist, deco32_state ) /* DE-0380-2 PCB */
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist )
@@ -2032,7 +2026,6 @@ static MACHINE_CONFIG_START( fghthsta, deco32_state ) /* DE-0395-1 PCB */
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -2048,12 +2041,10 @@ static MACHINE_CONFIG_START( fghthsta, deco32_state ) /* DE-0395-1 PCB */
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist )
@@ -2160,7 +2151,6 @@ static MACHINE_CONFIG_START( dragngun, dragngun_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -2176,11 +2166,9 @@ static MACHINE_CONFIG_START( dragngun, dragngun_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen_zoom", DECO_ZOOMSPR, 0)
MCFG_DECO_ZOOMSPR_GFXDECODE("gfxdecode")
- MCFG_DECO_ZOOMSPR_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", dragngun)
MCFG_PALETTE_ADD("palette", 2048)
@@ -2278,7 +2266,6 @@ static MACHINE_CONFIG_START( lockload, dragngun_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -2294,11 +2281,9 @@ static MACHINE_CONFIG_START( lockload, dragngun_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen_zoom", DECO_ZOOMSPR, 0)
MCFG_DECO_ZOOMSPR_GFXDECODE("gfxdecode")
- MCFG_DECO_ZOOMSPR_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
@@ -2367,7 +2352,6 @@ static MACHINE_CONFIG_START( tattass, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -2383,17 +2367,14 @@ static MACHINE_CONFIG_START( tattass, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tattass)
MCFG_PALETTE_ADD("palette", 2048)
@@ -2444,7 +2425,6 @@ static MACHINE_CONFIG_START( nslasher, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -2460,17 +2440,14 @@ static MACHINE_CONFIG_START( nslasher, deco32_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", nslasher)
MCFG_PALETTE_ADD("palette", 2048)
diff --git a/src/mame/drivers/dfruit.cpp b/src/mame/drivers/dfruit.cpp
index 20e459a2b3d..c2097280503 100644
--- a/src/mame/drivers/dfruit.cpp
+++ b/src/mame/drivers/dfruit.cpp
@@ -387,7 +387,6 @@ static MACHINE_CONFIG_START( dfruit, dfruit_state )
MCFG_DEVICE_ADD("tc0091lvc", TC0091LVC, 0)
MCFG_TC0091LVC_GFXDECODE("gfxdecode")
- MCFG_TC0091LVC_PALETTE("palette")
MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp
index e2c8df4e31b..5e8954d705b 100644
--- a/src/mame/drivers/dietgo.cpp
+++ b/src/mame/drivers/dietgo.cpp
@@ -245,12 +245,10 @@ static MACHINE_CONFIG_START( dietgo, dietgo_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE
diff --git a/src/mame/drivers/djboy.cpp b/src/mame/drivers/djboy.cpp
index ae0efeed0ee..bbd3eb25706 100644
--- a/src/mame/drivers/djboy.cpp
+++ b/src/mame/drivers/djboy.cpp
@@ -581,7 +581,6 @@ static MACHINE_CONFIG_START( djboy, djboy_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/djmain.cpp b/src/mame/drivers/djmain.cpp
index 3037b06723c..efa5c7ed4d8 100644
--- a/src/mame/drivers/djmain.cpp
+++ b/src/mame/drivers/djmain.cpp
@@ -1403,8 +1403,7 @@ static MACHINE_CONFIG_START( djmainj, djmain_state )
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(djmain_state, tile_callback)
- MCFG_K056832_CONFIG("gfx2", 1, K056832_BPP_4dj, 1, 1, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx2", K056832_BPP_4dj, 1, 1, "none")
MCFG_K056832_PALETTE("palette")
MCFG_K055555_ADD("k055555")
diff --git a/src/mame/drivers/dreambal.cpp b/src/mame/drivers/dreambal.cpp
index 19516ea4123..727e82ac03c 100644
--- a/src/mame/drivers/dreambal.cpp
+++ b/src/mame/drivers/dreambal.cpp
@@ -340,7 +340,6 @@ static MACHINE_CONFIG_START( dreambal, dreambal_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/esd16.cpp b/src/mame/drivers/esd16.cpp
index 01f12b0de2b..912e811ac4e 100644
--- a/src/mame/drivers/esd16.cpp
+++ b/src/mame/drivers/esd16.cpp
@@ -632,7 +632,6 @@ static MACHINE_CONFIG_START( esd16, esd16_state )
MCFG_DECO_SPRITE_PRIORITY_CB(esd16_state, hedpanic_pri_callback)
MCFG_DECO_SPRITE_FLIPALLX(1)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", esd16)
MCFG_PALETTE_ADD("palette", 0x1000/2)
diff --git a/src/mame/drivers/f1gp.cpp b/src/mame/drivers/f1gp.cpp
index d6bf1eee619..f60b0ca1633 100644
--- a/src/mame/drivers/f1gp.cpp
+++ b/src/mame/drivers/f1gp.cpp
@@ -432,14 +432,12 @@ static MACHINE_CONFIG_START( f1gp, f1gp_state )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_SET_PRITYPE(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( f1gp_state, f1gp_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_SET_PRITYPE(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(f1gp_state,f1gp)
@@ -516,7 +514,6 @@ static MACHINE_CONFIG_DERIVED( f1gp2, f1gp )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( f1gp_state, f1gp2_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_DEVICE_MODIFY("k053936")
MCFG_K053936_OFFSETS(-48, -21)
diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp
index b45fbe6f036..99fc222d7ca 100644
--- a/src/mame/drivers/fb01.cpp
+++ b/src/mame/drivers/fb01.cpp
@@ -219,7 +219,7 @@ MACHINE_CONFIG_END
/* ROM definition */
ROM_START( fb01 )
ROM_REGION( 0x8000, "maincpu", 0 )
- ROM_LOAD("fb01.ic11", 0, 0x8000, CRC(7357e9a4) SHA1(049c482d6c91b7e2846757dd0f5138e0d8b687f0))
+ ROM_LOAD("nec__-011_xb712c0__8709ex700__d27c256c-15.ic11", 0, 0x8000, CRC(7357e9a4) SHA1(049c482d6c91b7e2846757dd0f5138e0d8b687f0)) // OTP 27c256 windowless eprom?
ROM_END
diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp
index 75edef3a3c6..18f152899fd 100644
--- a/src/mame/drivers/fidel6502.cpp
+++ b/src/mame/drivers/fidel6502.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco,hap
+// thanks-to:Berger
/******************************************************************************
Fidelity Electronics 6502 based board driver
@@ -140,7 +141,22 @@ All three of the above are called "segment H".
******************************************************************************
-Sensory Chess Challenger (SC12-B, 6086)
+Sensory Chess Challenger "9" (SC9)
+2 versions were available, the newer version was 2MHz and included the Budapest program.
+---------------------------------
+
+8*(8+1) buttons, 8*8+1 LEDs
+36-pin edge connector, assume same as SC12
+4KB RAM(TMM2016P), 2*8KB ROM(HN48364P)
+R6502-13, 1.4MHz from resonator
+PCB label 510-1045C01 2-1-82
+
+I/O is via TTL, not further documented here
+
+
+******************************************************************************
+
+Sensory 12 Chess Challenger (SC12-B, 6086)
4 versions are known to exist: A,B,C, and X, with increasing CPU speed.
---------------------------------
RE information from netlist by Berger
@@ -156,7 +172,7 @@ NE556 dual-timer IC:
Memory map:
-----------
-6000-0FFF: 4K RAM (2016 * 2)
+0000-0FFF: 4K RAM (2016 * 2)
2000-5FFF: cartridge
6000-7FFF: control(W)
8000-9FFF: 8K ROM SSS SCM23C65E4
@@ -271,6 +287,7 @@ Z80 D6 to W: (model 6092, tied to VCC otherwise)
// internal artwork
#include "fidel_csc.lh" // clickable
#include "fidel_fev.lh" // clickable
+#include "fidel_sc9.lh" // clickable
#include "fidel_sc12.lh" // clickable
@@ -305,6 +322,12 @@ public:
DECLARE_READ_LINE_MEMBER(csc_pia1_ca1_r);
DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r);
+ // SC9
+ void sc9_prepare_display();
+ DECLARE_WRITE8_MEMBER(sc9_control_w);
+ DECLARE_WRITE8_MEMBER(sc9_led_w);
+ DECLARE_READ8_MEMBER(sc9_input_r);
+
// SC12/6086
DECLARE_WRITE8_MEMBER(sc12_control_w);
DECLARE_READ8_MEMBER(sc12_input_r);
@@ -452,10 +475,50 @@ WRITE_LINE_MEMBER(fidel6502_state::csc_pia1_ca2_w)
/******************************************************************************
- SC12/6086
+ SC9
******************************************************************************/
+// TTL/generic
+
+void fidel6502_state::sc9_prepare_display()
+{
+ // 8*8 chessboard leds + 1 corner led
+ display_matrix(8, 9, m_led_data, m_inp_mux);
+}
+
+WRITE8_MEMBER(fidel6502_state::sc9_control_w)
+{
+ // d0-d3: 74245 P0-P3
+ // 74245 Q0-Q8: input mux, led select
+ UINT16 sel = 1 << (data & 0xf) & 0x3ff;
+ m_inp_mux = sel & 0x1ff;
+ sc9_prepare_display();
+
+ // 74245 Q9: speaker out
+ m_speaker->level_w(sel >> 9 & 1);
+
+ // d4,d5: ?
+ // d6,d7: N/C
+}
+WRITE8_MEMBER(fidel6502_state::sc9_led_w)
+{
+ // a0-a2,d0: led data via NE591N
+ m_led_data = (data & 1) << offset;
+ sc9_prepare_display();
+}
+
+READ8_MEMBER(fidel6502_state::sc9_input_r)
+{
+ // multiplexed inputs (active low)
+ return read_inputs(9) ^ 0xff;
+}
+
+
+
+/******************************************************************************
+ SC12/6086
+******************************************************************************/
// TTL/generic
@@ -590,6 +653,19 @@ static ADDRESS_MAP_START( csc_map, AS_PROGRAM, 8, fidel6502_state )
ADDRESS_MAP_END
+// SC9
+
+static ADDRESS_MAP_START( sc9_map, AS_PROGRAM, 8, fidel6502_state )
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM
+ AM_RANGE(0x2000, 0x5fff) AM_READ(sc12_cart_r)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_WRITE(sc9_control_w)
+ AM_RANGE(0x8000, 0x8007) AM_MIRROR(0x1ff8) AM_WRITE(sc9_led_w) AM_READNOP
+ AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_READ(sc9_input_r)
+ AM_RANGE(0xc000, 0xffff) AM_ROM
+ADDRESS_MAP_END
+
+
// SC12/6086
static ADDRESS_MAP_START( sc12_map, AS_PROGRAM, 8, fidel6502_state )
@@ -826,6 +902,28 @@ static MACHINE_CONFIG_START( csc, fidel6502_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_START( sc9, fidel6502_state )
+
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", M6502, 1400000) // from ceramic resonator "681 JSA", measured
+ MCFG_CPU_PROGRAM_MAP(sc9_map)
+ MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, irq0_line_hold, 600) // 555 timer, guessed
+
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1))
+ MCFG_DEFAULT_LAYOUT(layout_fidel_sc9)
+
+ /* sound hardware */
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+
+ /* cartridge */
+ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc")
+ MCFG_GENERIC_EXTENSIONS("bin,dat")
+ MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge)
+ MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc")
+MACHINE_CONFIG_END
+
static MACHINE_CONFIG_START( sc12, fidel6502_state )
/* basic machine hardware */
@@ -932,6 +1030,13 @@ ROM_START( cscfr )
ROM_END
+ROM_START( fscc9 )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD("b30", 0xc000, 0x2000, CRC(b845c458) SHA1(d3fda65dbd9fae44fa4b93f8207839d8fa0c367a) ) // HN48364P
+ ROM_LOAD("b31", 0xe000, 0x2000, CRC(cbaf97d7) SHA1(7ed8e68bb74713d9e2ff1d9c037012320b7bfcbf) ) // "
+ROM_END
+
+
ROM_START( fscc12 )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD("101-1068a01", 0x8000, 0x2000, CRC(63c76cdd) SHA1(e0771c98d4483a6b1620791cb99a7e46b0db95c4) ) // SSS SCM23C65E4
@@ -965,6 +1070,7 @@ CONS( 1981, cscsp, csc, 0, csc, cscg, driver_device, 0, "Fideli
CONS( 1981, cscg, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
CONS( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
+CONS( 1982, fscc9, 0, 0, sc9, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 9", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
CONS( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
CONS( 1987, fexcel, 0, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "Excellence (model 6080/6093)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp
index fcf546c8964..d1239636236 100644
--- a/src/mame/drivers/fidel68k.cpp
+++ b/src/mame/drivers/fidel68k.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:hap
+// thanks-to:Berger
/******************************************************************************
Fidelity Electronics 68000 based board driver
@@ -453,9 +454,9 @@ ROM_END
ROM_START( feagv11 )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD32_BYTE("16", 0x00000, 0x08000, CRC(8375d61f) SHA1(e042f6f01480c59ee09a458cf34f135664479824) ) // 27c256
+ ROM_LOAD32_BYTE("17", 0x00001, 0x08000, CRC(bfd14916) SHA1(115af6dfd29ddd8ad6d2ce390f8ecc4d60de6fce) ) // "
ROM_LOAD32_BYTE("18", 0x00002, 0x08000, CRC(9341dcaf) SHA1(686bd4799e89ffaf11a813d4cf5a2aedd4c2d97a) ) // "
ROM_LOAD32_BYTE("19", 0x00003, 0x08000, CRC(a70c5468) SHA1(7f6b4f46577d5cfdaa84d387c7ce35d941e5bbc7) ) // "
- ROM_LOAD32_BYTE("17", 0x00001, 0x08000, CRC(bfd14916) SHA1(115af6dfd29ddd8ad6d2ce390f8ecc4d60de6fce) ) // "
ROM_END
#define rom_feagv10 rom_feagv11
diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp
index 31568a6f601..34c06fd105e 100644
--- a/src/mame/drivers/fidelz80.cpp
+++ b/src/mame/drivers/fidelz80.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco,hap
+// thanks-to:Berger
/******************************************************************************
Fidelity Electronics Z80 based board driver
diff --git a/src/mame/drivers/funkyjet.cpp b/src/mame/drivers/funkyjet.cpp
index a9cacb720c6..a3c2a47599a 100644
--- a/src/mame/drivers/funkyjet.cpp
+++ b/src/mame/drivers/funkyjet.cpp
@@ -346,12 +346,10 @@ static MACHINE_CONFIG_START( funkyjet, funkyjet_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/galastrm.cpp b/src/mame/drivers/galastrm.cpp
index 796b3130948..4ca8366e984 100644
--- a/src/mame/drivers/galastrm.cpp
+++ b/src/mame/drivers/galastrm.cpp
@@ -311,7 +311,6 @@ static MACHINE_CONFIG_START( galastrm, galastrm_state )
MCFG_TC0480SCP_TX_REGION(3)
MCFG_TC0480SCP_OFFSETS(-40, -3)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
diff --git a/src/mame/drivers/galaxi.cpp b/src/mame/drivers/galaxi.cpp
index 000078b8709..ccbdb96fb47 100644
--- a/src/mame/drivers/galaxi.cpp
+++ b/src/mame/drivers/galaxi.cpp
@@ -521,6 +521,40 @@ ROM_START( magjoker )
ROM_LOAD( "21.u38", 0x00000, 0x40000, CRC(199baf33) SHA1(006708d955481fe1ae44555d27896d18e1ff8440) )
ROM_END
+/*
+ Last Four
+ 2001, BRL.
+
+ CPUs:
+ 1x MC68000P10 (u1) 16/32-bit Microprocessor (main).
+ 1x AD-65 (u9) 4-Channel Mixing ADCPM Voice Synthesis LSI (sound).
+ 1x MC1458 (u10) Dual Operational Amplifier (sound).
+ 1x TDA2003 (u8) Audio Amplifier (sound).
+ 1x 10.000000MHz. oscillator (QZ1).
+ 1x 16.000MHz. oscillator (QZ2).
+
+ ROMs:
+ 1x AF49F010 (14) dumped.
+ 1x Am27C010 (15) dumped.
+ 1x MC27C100 (21) dumped.
+ 2x M27C4001 (12, 13) dumped.
+
+ RAMs:
+ 2x KT76C28K-10 (u16, u17).
+ 2x HT6264-70 (u26, u27).
+ 2x DS1230Y-100 (u4, u5) not dumped.
+
+ PLDs:
+ 1x A40MX04-PL84 (u29) read protected.
+
+ Others:
+ 1x 28x2 JAMMA edge connector.
+ 1x trimmer (volume).
+
+ Notes:
+ PCB is etched: GALAXI - 26 05 2000 BRL S.R.L. BOLOGNA.
+
+*/
ROM_START( lastfour )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "15.u48", 0x00000, 0x20000, CRC(9168e19c) SHA1(4a2f0d100e457bd33691ba084a0f0549e8bf0790) )
@@ -534,6 +568,7 @@ ROM_START( lastfour )
ROM_LOAD( "21.u38", 0x00000, 0x20000, CRC(e48523dd) SHA1(47bc2e5c2164b93d685fa134397845e0ed7aaa5f) )
ROM_END
+
/***************************************************************************
Game Drivers
***************************************************************************/
diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp
index 0ec73f982b8..996b508bd19 100644
--- a/src/mame/drivers/galaxian.cpp
+++ b/src/mame/drivers/galaxian.cpp
@@ -2210,6 +2210,36 @@ static INPUT_PORTS_START( swarm )
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) /* more aliens */
INPUT_PORTS_END
+static INPUT_PORTS_START( kamikazp )
+ PORT_INCLUDE(galaxian)
+
+ PORT_MODIFY("IN1")
+ PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Bonus_Life ) ) // turning both of these on still seems to enable Free Play but actual coinage controlled by later dips?
+ PORT_DIPSETTING( 0x00, DEF_STR( None ) )
+ PORT_DIPSETTING( 0x40, "4000" )
+ PORT_DIPSETTING( 0x80, "5000" )
+ PORT_DIPSETTING( 0xc0, "7000 (buggy FREE PLAY message)" ) // also still causes the game to show 'FREE PLAY' which is the function of the old dips (doesn't operate in FREE PLAY tho)
+
+ PORT_MODIFY("IN2") // actual coinage appers to have been moved here (need to check code, wouldn't surprise me if some of these had other side-effects too) these are also some of the most ridiculous coinage setttings I've seen!
+ PORT_DIPNAME( 0x0f, 0x08, DEF_STR( Coinage ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x07, "6C / 2C" ) // first 4 coins give 1 credit, next 2 coins give 1 credit
+ PORT_DIPSETTING( 0x0c, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x03, "6C / 3C" ) // first 3 coins give 1 credit, 2nd 3 coins give 2 credits
+ PORT_DIPSETTING( 0x0b, "7C / 3C" )
+ PORT_DIPSETTING( 0x0d, DEF_STR( 4C_2C ) ) // first 3 coins give 1 credit, next coin gives 1 credit
+ PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) // 2
+ PORT_DIPSETTING( 0x09, DEF_STR( 3C_2C ) ) // first 2 coins give 1 credit, next coin gives 1 credit
+ PORT_DIPSETTING( 0x05, DEF_STR( 4C_3C ) ) // first 2 coins give 1 credit, 2nd 2 coins give 2 credits
+ PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x06, "1C / 1C (duplicate 1)" )
+ PORT_DIPSETTING( 0x0a, "1C / 1C (duplicate 2)" )
+ PORT_DIPSETTING( 0x0e, "1C / 1C (duplicate 3)" )
+ PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 2C_3C ) ) // .66
+ PORT_DIPSETTING( 0x0f, DEF_STR( Free_Play ) ) // always shows 9 credits
+INPUT_PORTS_END
+
static INPUT_PORTS_START( zerotime )
PORT_INCLUDE(galaxian)
@@ -7316,6 +7346,23 @@ ROM_START( moonaln )
ROM_LOAD( "6l.bpr", 0x0000, 0x0020, CRC(c3ac9467) SHA1(f382ad5a34d282056c78a5ec00c30ec43772bae2) )
ROM_END
+ROM_START( kamikazp )
+ ROM_REGION( 0x4000, "maincpu", 0 )
+ ROM_LOAD( "KK1PMC.bin", 0x0000, 0x0800, CRC(4a29bbe4) SHA1(731e77d76420ab946fb3963681770c81f79c705d) )
+ ROM_LOAD( "KK2PMC.bin", 0x0800, 0x0800, CRC(65c57131) SHA1(6884421b1ee74e6913ceb519b29979cf764ee3f7) )
+ ROM_LOAD( "KK3PMC.bin", 0x1000, 0x0800, CRC(24cf6da0) SHA1(1d6c6d3e8af4f3da449b363eb710c3a42f1dfb64) )
+ ROM_LOAD( "KK4PMC.bin", 0x1800, 0x0800, CRC(5e5ebca8) SHA1(f4f1c4f180a46fed67bb05d9b61c98a556645e7a) )
+ ROM_LOAD( "KK5PMC.bin", 0x2000, 0x0800, CRC(6d325b14) SHA1(2f67db374976cfa1dee3d6136a4b0404db7870f6) )
+ ROM_LOAD( "KK6PMC.bin", 0x2800, 0x0800, CRC(05883c29) SHA1(22a4e6ce5e35d4ddea4d1b583a36b4a64a899159) )
+
+ ROM_REGION( 0x1000, "gfx1", 0 )
+ ROM_LOAD( "KK8PMC.bin", 0x0000, 0x0800, CRC(96b268b1) SHA1(3ad1fa972f8f841e26acd7e3363f42df898d01c6) )
+ ROM_LOAD( "KK7PMC.bin", 0x0800, 0x0800, CRC(58673a07) SHA1(4e51f803718f39436e43d3bceda836215a98cc37) )
+
+ ROM_REGION( 0x0020, "proms", 0 )
+ ROM_LOAD( "prom.6l", 0x0000, 0x0020, CRC(6a0c7d87) SHA1(140335d85c67c75b65689d4e76d29863c209cf32) ) // not dumped, taken from Astrians, colours match screenshots
+ROM_END
+
ROM_START( superg )
ROM_REGION( 0x4000, "maincpu", 0 )
ROM_LOAD( "7f.bin", 0x0000, 0x1000, CRC(4335b1de) SHA1(e41e3d90dac738cf71377f3b476ec67b14dee27a) )
@@ -11331,6 +11378,8 @@ GAME( 1980, galaxrfgg, galaxian, galaxian, galaxrf, galaxian_state, galax
// these have the extra 'linescroll effect' title screens, like Moon Alien 2 but made out of a random tile, they lack an energy bar.
GAME( 1979, moonaln, galaxian, galaxian, superg, galaxian_state, galaxian, ROT90, "Namco / Nichibutsu (Karateco license?)", "Moon Alien", MACHINE_SUPPORTS_SAVE ) // or bootleg?
GAME( 1979, galapx, galaxian, galaxian, superg, galaxian_state, galaxian, ROT90, "hack", "Galaxian Part X (moonaln hack)", MACHINE_SUPPORTS_SAVE )
+// like above but does have the energy bar, also GFX changed to planes.
+GAME( 1979, kamikazp, galaxian, galaxian, kamikazp, galaxian_state, galaxian, ROT90, "bootleg (Potomac Games)", "Kamikaze (Potomac Games)", MACHINE_SUPPORTS_SAVE )
// this has the tiles to display the energy bar, but use the flag gfx for the 'linescroll effect' title screen, also doesn't work due to bad rom.
GAME( 1980, supergx, galaxian, galaxian, superg, galaxian_state, galaxian, ROT90, "Namco / Nichibutsu", "Super GX", MACHINE_NOT_WORKING | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
// these have the energy bar, and the tiles needed to display a less corrupt 'linescroll effect' title, but don't display one
diff --git a/src/mame/drivers/galpanic.cpp b/src/mame/drivers/galpanic.cpp
index 1f9c349de33..9c355309e77 100644
--- a/src/mame/drivers/galpanic.cpp
+++ b/src/mame/drivers/galpanic.cpp
@@ -248,7 +248,6 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_OFFSETS(0, -16)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
MCFG_DEVICE_ADD("calc1_mcu", KANEKO_HIT, 0)
kaneko_hit_device::set_type(*device, 0);
diff --git a/src/mame/drivers/gba.cpp b/src/mame/drivers/gba.cpp
index f2c05930332..9b39f18f1b2 100644
--- a/src/mame/drivers/gba.cpp
+++ b/src/mame/drivers/gba.cpp
@@ -1926,7 +1926,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( gbadv )
PORT_START("INPUTS")
- PORT_BIT( 0xfc00, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_UNUSED
+ PORT_BIT( 0xfc00, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 L") PORT_PLAYER(1) // L
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 R") PORT_PLAYER(1) // R
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
diff --git a/src/mame/drivers/geneve.cpp b/src/mame/drivers/geneve.cpp
index 8d413333bbd..bcf8acee880 100644
--- a/src/mame/drivers/geneve.cpp
+++ b/src/mame/drivers/geneve.cpp
@@ -210,7 +210,6 @@
#include "sound/sn76496.h"
#include "bus/ti99x/genboard.h"
-#include "bus/ti99x/videowrp.h"
#include "bus/ti99x/joyport.h"
#include "bus/ti99_peb/peribox.h"
@@ -690,8 +689,7 @@ static MACHINE_CONFIG_START( geneve_60hz, geneve_state )
MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(geneve_state, clock_out) )
MCFG_TMS9995_DBIN_HANDLER( WRITELINE(geneve_state, dbin_line) )
- // video hardware
- MCFG_DEVICE_ADD(VIDEO_SYSTEM_TAG, V9938VIDEO, 0)
+ // Video hardware
MCFG_V9938_ADD(VDP_TAG, SCREEN_TAG, 0x20000, XTAL_21_4772MHz) /* typical 9938 clock, not verified */
MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(geneve_state, set_tms9901_INT2_from_v9938))
MCFG_V99X8_SCREEN_ADD_NTSC(SCREEN_TAG, VDP_TAG, XTAL_21_4772MHz)
@@ -726,9 +724,11 @@ static MACHINE_CONFIG_START( geneve_60hz, geneve_state )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(geneve_state, intb) )
MCFG_PERIBOX_READY_HANDLER( WRITELINE(geneve_state, ext_ready) )
- // sound hardware
- MCFG_TI_SOUND_76496_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(geneve_state, ext_ready) )
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER( WRITELINE(geneve_state, ext_ready) )
// User interface devices
MCFG_DEVICE_ADD( GKEYBOARD_TAG, GENEVE_KEYBOARD, 0 )
diff --git a/src/mame/drivers/gijoe.cpp b/src/mame/drivers/gijoe.cpp
index 8556742921f..80a0d830c87 100644
--- a/src/mame/drivers/gijoe.cpp
+++ b/src/mame/drivers/gijoe.cpp
@@ -329,18 +329,14 @@ static MACHINE_CONFIG_START( gijoe, gijoe_state )
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(gijoe_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(gijoe_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, -37, 20)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -37, 20)
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
diff --git a/src/mame/drivers/glasgow.cpp b/src/mame/drivers/glasgow.cpp
index e8922472d5b..0f349f068f4 100644
--- a/src/mame/drivers/glasgow.cpp
+++ b/src/mame/drivers/glasgow.cpp
@@ -30,14 +30,15 @@ How to play (quick guide)
3. Computer plays black, it will work out its move and beep.
4. Read the move in the display, or look for the flashing LEDs.
5. Move the computer's piece in the same way you moved yours.
-6. If a piece is being taken, firstly click on the piece then click the board
- edge. This causes the piece to disappear. After that, move the piece that
- took the other piece.
+6. If a piece is being taken, firstly click on the piece then click the blank
+ area at bottom right. This causes the piece to disappear. After that,
+ move the piece that took the other piece.
7. You'll need to read the official user manual for advanced features, or if
you get messages such as "Err1".
-Note about clickable artwork: You need to be running in windowed mode;
- and you need to use newui.
+ToDo:
+- Only glasgow works, the others are incomplete.
+
***************************************************************************/
@@ -46,50 +47,126 @@ Note about clickable artwork: You need to be running in windowed mode;
#include "glasgow.lh"
#include "sound/beep.h"
-
class glasgow_state : public driver_device
{
public:
glasgow_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_beep(*this, "beeper"),
- m_line0(*this, "LINE0"),
- m_line1(*this, "LINE1")
- { }
-
- required_device<cpu_device> m_maincpu;
- required_device<beep_device> m_beep;
- required_ioport m_line0;
- required_ioport m_line1;
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_beep(*this, "beeper")
+ { }
DECLARE_WRITE16_MEMBER(glasgow_lcd_w);
DECLARE_WRITE16_MEMBER(glasgow_lcd_flag_w);
DECLARE_READ16_MEMBER(glasgow_keys_r);
DECLARE_WRITE16_MEMBER(glasgow_keys_w);
+ DECLARE_READ16_MEMBER(glasgow_board_r);
+ DECLARE_WRITE16_MEMBER(glasgow_board_w);
+ DECLARE_WRITE16_MEMBER(glasgow_beeper_w);
+ DECLARE_READ16_MEMBER(read_board);
+ DECLARE_WRITE16_MEMBER(write_board);
+ DECLARE_WRITE16_MEMBER(write_beeper);
DECLARE_WRITE16_MEMBER(write_lcd);
DECLARE_WRITE16_MEMBER(write_lcd_flag);
DECLARE_WRITE16_MEMBER(write_irq_flag);
DECLARE_READ16_MEMBER(read_newkeys16);
+ DECLARE_WRITE32_MEMBER(write_beeper32);
+ DECLARE_READ32_MEMBER(read_board32);
+ DECLARE_WRITE32_MEMBER(write_board32);
+ DECLARE_WRITE32_MEMBER(write_keys32);
DECLARE_WRITE32_MEMBER(write_lcd32);
DECLARE_WRITE32_MEMBER(write_lcd_flag32);
DECLARE_READ32_MEMBER(read_newkeys32);
- DECLARE_WRITE32_MEMBER(write_beeper32);
+ TIMER_DEVICE_CALLBACK_MEMBER(update_nmi);
+ TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32);
+ DECLARE_MACHINE_START(dallas32);
+ DECLARE_MACHINE_START(glasgow);
+ DECLARE_MACHINE_RESET(glasgow);
+private:
UINT8 m_lcd_shift_counter;
UINT8 m_led7;
- UINT8 m_irq_flag;
- UINT16 m_beeper;
+ UINT8 m_key_select;
+ bool m_lcd_invert;
+ bool m_key_selector;
+ UINT8 m_read_board_flag;
+ UINT8 m_mouse_hold;
+ UINT8 m_board_row;
+ UINT8 m_mouse_down;
+ UINT16 m_Line18_LED;
+ UINT16 m_Line18_REED;
+
+ UINT8 pos_to_num( UINT8 );
+ void set_board( );
+ void glasgow_pieces_w( );
- DECLARE_MACHINE_START(dallas32);
- TIMER_DEVICE_CALLBACK_MEMBER(update_nmi);
- TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32);
+ required_device<cpu_device> m_maincpu;
+ required_device<beep_device> m_beep;
+
+};
+
+typedef struct
+ {
+ UINT8 field;
+ UINT8 piece;
+ } BOARD_FIELD;
+
+BOARD_FIELD l_board[8][8];
- virtual void machine_start() override;
- virtual void machine_reset() override;
+ /* starts at bottom left corner */
+const BOARD_FIELD l_start_board[8][8] =
+{
+ { {7,10}, {6,8}, {5,9}, {4,11}, {3,12}, {2,9}, {1,8}, {0,10} },
+ { {15,7}, {14,7}, {13,7}, {12,7}, { 11,7}, {10,7}, {9,7}, {8,7} },
+
+ { {23,0}, {22,0}, {21,0}, {20,0}, {19,0}, {18,0}, {17,0}, {16,0} },
+ { {31,0}, {30,0}, {29,0}, {28,0}, {27,0}, {26,0}, {25,0}, {24,0} },
+ { {39,0}, {38,0}, {37,0}, {36,0}, {35,0}, {34,0}, {33,0}, {32,0} },
+ { {47,0}, {46,0}, {45,0}, {44,0}, {43,0}, {42,0}, {41,0}, {40,0} },
+
+ { {55,1}, {54,1}, {53,1}, {52,1}, {51,1}, {50,1}, {49,1}, {48,1} },
+ { {63,4}, {62,2}, {61,3}, {60,5}, {59,6}, {58,3}, {57,2}, {56,4} }
};
+UINT8 glasgow_state::pos_to_num( UINT8 val )
+{
+ switch (val)
+ {
+ case 0xfe: return 7;
+ case 0xfd: return 6;
+ case 0xfb: return 5;
+ case 0xf7: return 4;
+ case 0xef: return 3;
+ case 0xdf: return 2;
+ case 0xbf: return 1;
+ case 0x7f: return 0;
+ default: return 0xff;
+ }
+}
+
+void glasgow_state::set_board( )
+{
+ UINT8 i_AH, i_18;
+ for (i_AH = 0; i_AH < 8; i_AH++)
+ {
+ for (i_18 = 0; i_18 < 8; i_18++)
+ {
+ // copy start postition to l_board
+ l_board[i_18][i_AH] = l_start_board[i_18][i_AH];
+ }
+ }
+}
+
+void glasgow_state::glasgow_pieces_w( )
+{
+ // This causes the pieces to display on-screen
+ UINT8 i_18, i_AH;
+
+ for (i_18 = 0; i_18 < 8; i_18++)
+ for (i_AH = 0; i_AH < 8; i_AH++)
+ output().set_indexed_value("P", 63 - l_board[i_18][i_AH].field, l_board[i_18][i_AH].piece);
+}
WRITE16_MEMBER( glasgow_state::glasgow_lcd_w )
{
@@ -113,24 +190,158 @@ WRITE16_MEMBER( glasgow_state::glasgow_lcd_flag_w )
else
{
m_led7 = 0;
+ m_key_selector = 1;
}
}
READ16_MEMBER( glasgow_state::glasgow_keys_r )
{
- UINT8 data = 0xff;
+ static const char *const keynames[] = { "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" };
+ UINT8 pos2num_res = 0;
+ m_board_row++;
+ m_board_row &= 7;
+
+ // See if we are moving a piece
+ UINT8 data = ioport(keynames[m_board_row])->read();
+
+ if ((data != 0xff) && (!m_mouse_down))
+ {
+ pos2num_res = pos_to_num(data);
+
+ if (!(pos2num_res < 8))
+ logerror("Position out of bound!");
+ else
+ if ((m_mouse_hold) && (!l_board[m_board_row][pos2num_res].piece))
+ {
+ // Moving a piece onto a blank
+ l_board[m_board_row][pos2num_res].piece = m_mouse_hold;
+ m_mouse_hold = 0;
+ }
+ else
+ if ((!m_mouse_hold) && (l_board[m_board_row][pos2num_res].piece))
+ {
+ // Picking up a piece
+ m_mouse_hold = l_board[m_board_row][pos2num_res].piece;
+ l_board[m_board_row][pos2num_res].piece = 0;
+ }
+
+ m_mouse_down = m_board_row + 1;
+ }
+ else
+ if ((data == 0xff) && (m_mouse_down == (m_board_row + 1))) // Wait for mouse to be released
+ m_mouse_down = 0;
+
+ // See if we are taking a piece off the board
+ if (!ioport("LINE10")->read())
+ m_mouse_hold = 0;
+
+ // See if any keys pressed
+ data = 3;
+
+ if (m_key_select == ioport("LINE0")->read())
+ data &= 1;
+
+ if (m_key_select == ioport("LINE1")->read())
+ data &= 2;
return data << 8;
}
WRITE16_MEMBER( glasgow_state::glasgow_keys_w )
{
+ m_key_select = data >> 8;
+ glasgow_pieces_w();
+}
+
+READ16_MEMBER( glasgow_state::glasgow_board_r )
+{
+ UINT8 i_AH, data = 0;
+
+ if (m_Line18_REED < 8)
+ {
+ // if there is a piece on the field -> set bit in data
+ for (i_AH = 0; i_AH < 8; i_AH++)
+ {
+ if (!l_board[m_Line18_REED][i_AH].piece)
+ data |= (1 << i_AH);
+ }
+ }
+
+ m_read_board_flag = TRUE;
+
+ return data << 8;
+}
+
+WRITE16_MEMBER( glasgow_state::glasgow_board_w )
+{
+ m_Line18_REED = pos_to_num(data >> 8) ^ 7;
+
+ // LED's or REED's ?
+ if (m_read_board_flag)
+ {
+ m_Line18_LED = 0;
+ m_read_board_flag = 0;
+ }
+ else
+ {
+ m_Line18_LED = data >> 8;
+ }
+
+ m_lcd_invert = 1;
+}
+
+WRITE16_MEMBER( glasgow_state::glasgow_beeper_w )
+{
+ UINT8 i_AH, i_18;
+ UINT8 LED;
+ UINT16 LineAH = data >> 8;
+
+ if (LineAH && m_Line18_LED)
+ {
+ for (i_AH = 0; i_AH < 8; i_AH++)
+ {
+ if (LineAH & (1 << i_AH))
+ {
+ for (i_18 = 0; i_18 < 8; i_18++)
+ {
+ if (!(m_Line18_LED & (1 << i_18)))
+ {
+ LED = l_board[i_18][i_AH].field;
+ output().set_led_value(LED, 1); // LED on
+ }
+ else
+ {
+ // LED off
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // No LED -> all LED's off
+ for (i_AH = 0; i_AH < 8; i_AH++)
+ {
+ for (i_18 = 0; i_18 < 8; i_18++)
+ {
+ // LED off
+ LED = l_board[i_18][i_AH].field;
+ output().set_led_value(LED, 0);
+ }
+ }
+ }
+}
+
+WRITE16_MEMBER( glasgow_state::write_beeper )
+{
+ m_lcd_invert = 1;
}
WRITE16_MEMBER( glasgow_state::write_lcd )
{
UINT8 lcd_data = data >> 8;
+ output().set_digit_value(m_lcd_shift_counter, m_lcd_invert ? lcd_data^0xff : lcd_data);
m_lcd_shift_counter--;
m_lcd_shift_counter &= 3;
logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data);
@@ -138,43 +349,60 @@ WRITE16_MEMBER( glasgow_state::write_lcd )
WRITE16_MEMBER( glasgow_state::write_lcd_flag )
{
-// UINT8 lcd_flag;
-// lcd_flag=data >> 8;
- //m_beep->set_state((data >> 8) & 1 ? 1 : 0);
- if ((data >> 8) == 0)
- {
- m_led7 = 0;
- }
- else
- m_led7 = 0xff;
+ m_lcd_invert = 0;
+ UINT8 lcd_flag = data >> 8;
+ //beep_set_state(0, lcd_flag & 1 ? 1 : 0);
+ if (lcd_flag == 0)
+ m_key_selector = 1;
+ // The key function in the rom expects after writing to
+ // the a value from the second key row;
+ m_led7 = (lcd_flag) ? 255 : 0;
-// The key function in the rom expects after writing to
-// the a value from the second key row;
-// if (lcd_flag != 0)
-// m_led7 = 255;
-// else
-// m_led7 = 0;
-//
logerror("LCD Flag 16 = %x \n", data);
}
+READ16_MEMBER( glasgow_state::read_board )
+{
+ return 0xff00; // Mephisto need it for working
+}
+
+WRITE16_MEMBER( glasgow_state::write_board )
+{
+ UINT8 board = data >> 8;
+
+ if (board == 0xff)
+ m_key_selector = 0;
+ // The key function in the rom expects after writing to
+ // the chess board a value from the first key row;
+ logerror("Write Board = %x \n", data >> 8);
+ glasgow_pieces_w();
+}
+
+
WRITE16_MEMBER( glasgow_state::write_irq_flag )
{
- m_beep->set_state(data & 0x100);
+ m_beep->set_state(BIT(data, 8));
logerror("Write 0x800004 = %x \n", data);
- m_irq_flag = 1;
- m_beeper = data;
}
READ16_MEMBER( glasgow_state::read_newkeys16 ) //Amsterdam, Roma
{
- return 0;
+ UINT16 data;
+
+ if (m_key_selector)
+ data = ioport("LINE1")->read();
+ else
+ data = ioport("LINE0")->read();
+
+ logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, m_key_selector);
+ data <<= 8;
+ return data ;
}
#ifdef UNUSED_FUNCTION
-READ16_MEMBER(glasgow_state::read_test)
+READ16_MEMBER(read_test)
{
logerror("read test Offset = %x Data = %x\n ",offset,data);
return 0xffff; // Mephisto need it for working
@@ -189,112 +417,227 @@ READ16_MEMBER(glasgow_state::read_test)
WRITE32_MEMBER( glasgow_state::write_lcd32 )
{
+ UINT8 lcd_data = data >> 8;
+
+ output().set_digit_value(m_lcd_shift_counter, m_lcd_invert ? lcd_data^0xff : lcd_data);
m_lcd_shift_counter--;
m_lcd_shift_counter &= 3;
- //logerror("LCD Offset = %d Data = %x \n ", offset, lcd_data);
+ // logerror("LCD Offset = %d Data = %x \n ", offset, lcd_data);
}
WRITE32_MEMBER( glasgow_state::write_lcd_flag32 )
{
-// UINT8 lcd_flag = data >> 24;
+ UINT8 lcd_flag = data >> 24;
- if ((data >> 24) == 0)
- {
- m_led7 = 0;
- }
- else
- m_led7 = 0xff;
+ m_lcd_invert = 0;
+
+ if (lcd_flag == 0)
+ m_key_selector = 1;
+
+ logerror("LCD Flag 32 = %x \n", lcd_flag);
+ // beep_set_state(0, lcd_flag & 1 ? 1 : 0);
+ m_led7 = (lcd_flag) ? 255 : 0;
+}
- //logerror("LCD Flag 32 = %x \n", data >> 24);
- //m_beep->set_state((data >> 24) & 1 ? 1 : 0);
-// if (lcd_flag != 0)
-// m_led7 = 255;
-// else
-// m_led7 = 0;
+WRITE32_MEMBER( glasgow_state::write_keys32 )
+{
+ m_lcd_invert = 1;
+ m_key_select = data;
+ logerror("Write Key = %x \n", m_key_select);
}
READ32_MEMBER( glasgow_state::read_newkeys32 ) // Dallas 32, Roma 32
{
+ UINT32 data;
+
+ if (m_key_selector)
+ data = ioport("LINE1")->read();
+ else
+ data = ioport("LINE0")->read();
+ //if (key_selector == 1) data = input_port_read(machine, "LINE0"); else data = 0;
+ logerror("read Keyboard Offset = %x Data = %x\n", offset, data);
+ data <<= 24;
+ return data ;
+}
+
+READ32_MEMBER( glasgow_state::read_board32 )
+{
+ logerror("read board 32 Offset = %x \n", offset);
return 0;
}
#ifdef UNUSED_FUNCTION
-READ16_MEMBER(glasgow_state::read_board_amsterd)
+READ16_MEMBER(read_board_amsterd)
{
logerror("read board amsterdam Offset = %x \n ", offset);
return 0xffff;
}
#endif
+WRITE32_MEMBER( glasgow_state::write_board32 )
+{
+ UINT8 board = data >> 24;
+ if (board == 0xff)
+ m_key_selector = 0;
+ logerror("Write Board = %x \n", data);
+ glasgow_pieces_w();
+}
+
+
WRITE32_MEMBER( glasgow_state::write_beeper32 )
{
m_beep->set_state(data & 0x01000000);
logerror("Write 0x8000004 = %x \n", data);
- m_irq_flag = 1;
- m_beeper = data;
}
-TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi)
+
+TIMER_DEVICE_CALLBACK_MEMBER( glasgow_state::update_nmi)
{
m_maincpu->set_input_line(7, HOLD_LINE);
}
-TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi32)
+TIMER_DEVICE_CALLBACK_MEMBER( glasgow_state::update_nmi32 )
{
- m_maincpu->set_input_line(6, HOLD_LINE);
+ m_maincpu->set_input_line(6, HOLD_LINE); // this was 7 in the old code, which is correct?
}
-void glasgow_state::machine_start()
+MACHINE_START_MEMBER( glasgow_state, glasgow )
{
- m_irq_flag = 0;
+ m_key_selector = 0;
m_lcd_shift_counter = 3;
}
-MACHINE_START_MEMBER(glasgow_state,dallas32)
+MACHINE_START_MEMBER( glasgow_state, dallas32 )
{
m_lcd_shift_counter = 3;
}
-void glasgow_state::machine_reset()
+MACHINE_RESET_MEMBER( glasgow_state, glasgow )
{
m_lcd_shift_counter = 3;
+ set_board();
}
+
static ADDRESS_MAP_START(glasgow_mem, AS_PROGRAM, 16, glasgow_state)
ADDRESS_MAP_GLOBAL_MASK(0x1FFFF)
- AM_RANGE(0x00000000, 0x0000ffff) AM_ROM
- AM_RANGE(0x00010000, 0x00010001) AM_WRITE(glasgow_lcd_w)
- AM_RANGE(0x00010002, 0x00010003) AM_READWRITE(glasgow_keys_r,glasgow_keys_w)
- AM_RANGE(0x00010004, 0x00010005) AM_WRITE(glasgow_lcd_flag_w)
- AM_RANGE(0x0001c000, 0x0001ffff) AM_RAM // 16KB
+ AM_RANGE(0x000000, 0x00ffff) AM_ROM
+ AM_RANGE(0x010000, 0x010001) AM_WRITE( glasgow_lcd_w )
+ AM_RANGE(0x010002, 0x010003) AM_READWRITE( glasgow_keys_r, glasgow_keys_w )
+ AM_RANGE(0x010004, 0x010005) AM_WRITE( glasgow_lcd_flag_w )
+ AM_RANGE(0x010006, 0x010007) AM_READWRITE( glasgow_board_r, glasgow_beeper_w )
+ AM_RANGE(0x010008, 0x010009) AM_WRITE( glasgow_board_w )
+ AM_RANGE(0x01c000, 0x01ffff) AM_RAM // 16KB
ADDRESS_MAP_END
-
static ADDRESS_MAP_START(amsterd_mem, AS_PROGRAM, 16, glasgow_state)
// ADDRESS_MAP_GLOBAL_MASK(0x7FFFF)
- AM_RANGE(0x00000000, 0x0000ffff) AM_ROM
- AM_RANGE(0x00800002, 0x00800003) AM_WRITE(write_lcd)
- AM_RANGE(0x00800008, 0x00800009) AM_WRITE(write_lcd_flag)
- AM_RANGE(0x00800004, 0x00800005) AM_WRITE(write_irq_flag)
- AM_RANGE(0x00800040, 0x00800041) AM_READ(read_newkeys16)
- AM_RANGE(0x00ffc000, 0x00ffffff) AM_RAM // 16KB
+ AM_RANGE(0x000000, 0x00ffff) AM_ROM
+ AM_RANGE(0x800002, 0x800003) AM_WRITE( write_lcd )
+ AM_RANGE(0x800008, 0x800009) AM_WRITE( write_lcd_flag )
+ AM_RANGE(0x800004, 0x800005) AM_WRITE( write_irq_flag )
+ AM_RANGE(0x800010, 0x800011) AM_WRITE( write_board )
+ AM_RANGE(0x800020, 0x800021) AM_READ( read_board )
+ AM_RANGE(0x800040, 0x800041) AM_READ( read_newkeys16 )
+ AM_RANGE(0x800088, 0x800089) AM_WRITE( write_beeper )
+ AM_RANGE(0xffc000, 0xffffff) AM_RAM // 16KB
ADDRESS_MAP_END
-
static ADDRESS_MAP_START(dallas32_mem, AS_PROGRAM, 32, glasgow_state)
// ADDRESS_MAP_GLOBAL_MASK(0x1FFFF)
- AM_RANGE(0x00000000, 0x0000ffff) AM_ROM
- AM_RANGE(0x00010000, 0x0001ffff) AM_RAM // 64KB
- AM_RANGE(0x00800000, 0x00800003) AM_WRITE(write_lcd32)
- AM_RANGE(0x00800004, 0x00800007) AM_WRITE(write_beeper32)
- AM_RANGE(0x00800008, 0x0080000B) AM_WRITE(write_lcd_flag32)
- AM_RANGE(0x00800040, 0x00800043) AM_READ(read_newkeys32)
+ AM_RANGE(0x000000, 0x00ffff) AM_ROM
+ AM_RANGE(0x010000, 0x01ffff) AM_RAM // 64KB
+ AM_RANGE(0x800000, 0x800003) AM_WRITE( write_lcd32 )
+ AM_RANGE(0x800004, 0x800007) AM_WRITE( write_beeper32 )
+ AM_RANGE(0x800008, 0x80000B) AM_WRITE( write_lcd_flag32 )
+ AM_RANGE(0x800010, 0x800013) AM_WRITE( write_board32 )
+ AM_RANGE(0x800020, 0x800023) AM_READ( read_board32 )
+ AM_RANGE(0x800040, 0x800043) AM_READ( read_newkeys32 )
+ AM_RANGE(0x800088, 0x80008b) AM_WRITE( write_keys32 )
ADDRESS_MAP_END
+
+static INPUT_PORTS_START( chessboard )
+ PORT_START("LINE2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE5")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE6")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE7")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE8")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE9")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
+ PORT_START("LINE10")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
+INPUT_PORTS_END
+
static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32
PORT_START("LINE0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1)
@@ -315,6 +658,8 @@ static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8)
+
+ PORT_INCLUDE( chessboard )
INPUT_PORTS_END
static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas
@@ -337,23 +682,21 @@ static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4)
-INPUT_PORTS_END
-
-INPUT_PORTS_EXTERN( chessboard);
-
-static INPUT_PORTS_START( oldkeys )
- PORT_INCLUDE( old_keyboard )
+ PORT_INCLUDE( chessboard )
INPUT_PORTS_END
-static INPUT_PORTS_START( newkeys )
- PORT_INCLUDE( new_keyboard )
-INPUT_PORTS_END
static MACHINE_CONFIG_START( glasgow, glasgow_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 12000000)
MCFG_CPU_PROGRAM_MAP(glasgow_mem)
+ MCFG_MACHINE_START_OVERRIDE(glasgow_state, glasgow )
+ MCFG_MACHINE_RESET_OVERRIDE(glasgow_state, glasgow )
+
+ /* video hardware */
+ MCFG_DEFAULT_LAYOUT(layout_glasgow)
+
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("beeper", BEEP, 44)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
@@ -375,9 +718,9 @@ static MACHINE_CONFIG_DERIVED( dallas32, glasgow )
MCFG_DEVICE_REMOVE("nmi_timer")
MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi32, attotime::from_hz(50))
-
MACHINE_CONFIG_END
+
/***************************************************************************
ROM definitions
***************************************************************************/
@@ -413,6 +756,7 @@ ROM_START( dallas16 )
ROM_LOAD16_BYTE("dallas-l.bin",0x00001, 0x06f00,CRC(f0d5bc03) SHA1(4b1b9a71663d5321820b4cf7da205e5fe5d3d001))
ROM_END
+// This set needs checking. It cannot possibly work with this rom and hardware.
ROM_START( roma )
ROM_REGION16_BE( 0x1000000, "maincpu", 0 )
ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd))
@@ -433,11 +777,11 @@ ROM_END
Game drivers
***************************************************************************/
-/* YEAR, NAME, PARENT, COMPAT, MACHINE, INPUT, INIT, COMPANY, FULLNAME, FLAGS */
-CONS( 1984, glasgow, 0, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", MACHINE_NOT_WORKING)
-CONS( 1984, amsterd, 0, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", MACHINE_NOT_WORKING)
-CONS( 1984, dallas, glasgow, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas", MACHINE_NOT_WORKING)
-CONS( 1984, roma, amsterd, 0, glasgow, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma", MACHINE_NOT_WORKING)
-CONS( 1984, dallas32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", MACHINE_NOT_WORKING)
-CONS( 1984, roma32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", MACHINE_NOT_WORKING)
-CONS( 1984, dallas16, amsterd, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", MACHINE_NOT_WORKING)
+/* YEAR, NAME, PARENT, COMPAT, MACHINE, INPUT, CLASS, INIT, COMPANY, FULLNAME, FLAGS */
+CONS( 1984, glasgow, 0, 0, glasgow, old_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", 0)
+CONS( 1984, amsterd, 0, 0, amsterd, new_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", MACHINE_NOT_WORKING)
+CONS( 1984, dallas, glasgow, 0, glasgow, old_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas", MACHINE_NOT_WORKING)
+CONS( 1984, roma, amsterd, 0, glasgow, new_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma", MACHINE_NOT_WORKING)
+CONS( 1984, dallas32, amsterd, 0, dallas32, new_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", MACHINE_NOT_WORKING)
+CONS( 1984, roma32, amsterd, 0, dallas32, new_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", MACHINE_NOT_WORKING)
+CONS( 1984, dallas16, amsterd, 0, amsterd, new_keyboard, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", MACHINE_NOT_WORKING)
diff --git a/src/mame/drivers/gotcha.cpp b/src/mame/drivers/gotcha.cpp
index 11c96bcdb0b..afb5540c576 100644
--- a/src/mame/drivers/gotcha.cpp
+++ b/src/mame/drivers/gotcha.cpp
@@ -287,7 +287,6 @@ static MACHINE_CONFIG_START( gotcha, gotcha_state )
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_OFFSETS(5, -1) // aligned to 2nd instruction screen in attract
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/groundfx.cpp b/src/mame/drivers/groundfx.cpp
index ff6d31a6870..e3e0c652ef7 100644
--- a/src/mame/drivers/groundfx.cpp
+++ b/src/mame/drivers/groundfx.cpp
@@ -344,7 +344,6 @@ static MACHINE_CONFIG_START( groundfx, groundfx_state )
MCFG_TC0480SCP_OFFSETS(0x24, 0)
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
diff --git a/src/mame/drivers/gstriker.cpp b/src/mame/drivers/gstriker.cpp
index 200cac43623..ca2ad772f7f 100644
--- a/src/mame/drivers/gstriker.cpp
+++ b/src/mame/drivers/gstriker.cpp
@@ -546,7 +546,6 @@ static MACHINE_CONFIG_START( gstriker, gstriker_state )
MCFG_VSYSTEM_SPR_SET_PALMASK(0x1f)
MCFG_VSYSTEM_SPR_SET_TRANSPEN(0)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp
index e9cbb5e37a5..91eedfcdf83 100644
--- a/src/mame/drivers/gticlub.cpp
+++ b/src/mame/drivers/gticlub.cpp
@@ -973,15 +973,11 @@ static MACHINE_CONFIG_START( gticlub, gticlub_state )
MCFG_VIDEO_START_OVERRIDE(gticlub_state,gticlub)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
- MCFG_K001604_GFX_INDEX1(1)
- MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(1)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(0)
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
@@ -1031,13 +1027,10 @@ static MACHINE_CONFIG_DERIVED( slrasslt, gticlub )
MCFG_DEVICE_REMOVE("k001604_1")
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
- MCFG_K001604_GFX_INDEX1(1)
- MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(0)
MCFG_K001604_TXT_OFFSET(16384)
MCFG_K001604_ROZ_OFFSET(0)
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MACHINE_CONFIG_END
@@ -1113,26 +1106,18 @@ static MACHINE_CONFIG_START( hangplt, gticlub_state )
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
MCFG_SCREEN_UPDATE_DRIVER(gticlub_state, screen_update_hangplt)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
- MCFG_K001604_GFX_INDEX1(1)
- MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("k001604_2", K001604, 0)
- MCFG_K001604_GFX_INDEX1(3)
- MCFG_K001604_GFX_INDEX2(4)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_K056800_ADD("k056800", XTAL_33_8688MHz/2)
diff --git a/src/mame/drivers/gunbustr.cpp b/src/mame/drivers/gunbustr.cpp
index b4ffdf0ba70..5b1df1707db 100644
--- a/src/mame/drivers/gunbustr.cpp
+++ b/src/mame/drivers/gunbustr.cpp
@@ -303,7 +303,6 @@ static MACHINE_CONFIG_START( gunbustr, gunbustr_state )
MCFG_TC0480SCP_OFFSETS_TX(-1, -1)
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp
index 7b47dc59c7c..4d57c28a3c7 100644
--- a/src/mame/drivers/harddriv.cpp
+++ b/src/mame/drivers/harddriv.cpp
@@ -351,6 +351,8 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d
m_dsp32(*this, "dsp32"),
m_ds3sdsp(*this, "ds3sdsp"),
m_ds3xdsp(*this, "ds3xdsp"),
+ m_ds3sdsp_region(*this, "ds3sdsp"),
+ m_ds3xdsp_region(*this, "ds3xdsp"),
m_ds3dac1(*this, "ds3dac1"),
m_ds3dac2(*this, "ds3dac2"),
m_harddriv_sound(*this, "harddriv_sound"),
@@ -407,8 +409,7 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d
m_adsp_sim_address(0),
m_adsp_som_address(0),
m_adsp_eprom_base(0),
- m_sim_memory(nullptr),
- m_sim_memory_size(0),
+ m_sim_memory(*this, "user1"),
m_adsp_pgm_memory_word(nullptr),
m_ds3_sdata_memory(*this, "ds3sdsp_data"),
m_ds3_sdata_memory_size(0),
@@ -4085,13 +4086,13 @@ ROM_START( racedrivpan )
ROM_LOAD16_BYTE( "088-1016.bin", 0x0e0000, 0x010000, CRC(e83a9c99) SHA1(1d4093902133bb6da981f294e6947544c3564393) ) // == 136077-1016.200y
ROM_LOAD16_BYTE( "088-1015.bin", 0x0e0001, 0x010000, CRC(725806f3) SHA1(0fa4601465dc94f27c71db789ad625bbcd254169) ) // == 136077-4015.210y
- ROM_REGION( 0x60000, "mainpcb:user1", 0 ) /* 384k for object ROM */
- ROM_LOAD16_BYTE( "088-1017.bin", 0x00000, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
- ROM_LOAD16_BYTE( "088-1018.bin", 0x00001, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
- ROM_LOAD16_BYTE( "088-1019.bin", 0x20000, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
- ROM_LOAD16_BYTE( "088-1020.bin", 0x20001, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
- ROM_LOAD16_BYTE( "088-1021.bin", 0x40000, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
- ROM_LOAD16_BYTE( "088-1022.bin", 0x40001, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_REGION16_BE( 0x60000, "mainpcb:user1", 0 ) /* 384k for object ROM */
+ ROM_LOAD16_BYTE( "088-1018.bin", 0x00000, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
+ ROM_LOAD16_BYTE( "088-1017.bin", 0x00001, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
+ ROM_LOAD16_BYTE( "088-1020.bin", 0x20000, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
+ ROM_LOAD16_BYTE( "088-1019.bin", 0x20001, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
+ ROM_LOAD16_BYTE( "088-1022.bin", 0x40000, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_LOAD16_BYTE( "088-1021.bin", 0x40001, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
/* ----------------------- */
@@ -4141,13 +4142,13 @@ ROM_START( racedrivpan )
ROM_LOAD16_BYTE( "088-2016.bin", 0x0e0000, 0x010000, CRC(6a42b7e2) SHA1(2e0ff4b7e391106a976cb872f6311f6d35dca5b0) )
ROM_LOAD16_BYTE( "088-2015.bin", 0x0e0001, 0x010000, CRC(334e2a3b) SHA1(a19bfa7652845b9453c722091c773819ba248569) )
- ROM_REGION( 0x60000, "leftpcb:user1", 0 ) /* 384k for object ROM */
- ROM_LOAD16_BYTE( "088-1017.bin", 0x00000, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
- ROM_LOAD16_BYTE( "088-1018.bin", 0x00001, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
- ROM_LOAD16_BYTE( "088-1019.bin", 0x20000, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
- ROM_LOAD16_BYTE( "088-1020.bin", 0x20001, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
- ROM_LOAD16_BYTE( "088-1021.bin", 0x40000, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
- ROM_LOAD16_BYTE( "088-1022.bin", 0x40001, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_REGION16_BE( 0x60000, "leftpcb:user1", 0 ) /* 384k for object ROM */
+ ROM_LOAD16_BYTE( "088-1018.bin", 0x00000, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
+ ROM_LOAD16_BYTE( "088-1017.bin", 0x00001, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
+ ROM_LOAD16_BYTE( "088-1020.bin", 0x20000, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
+ ROM_LOAD16_BYTE( "088-1019.bin", 0x20001, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
+ ROM_LOAD16_BYTE( "088-1022.bin", 0x40000, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_LOAD16_BYTE( "088-1021.bin", 0x40001, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
ROM_REGION( 0x800, "leftpcb:200e", 0 ) // set to display left monitor, controls not calibrated with valid values (don't think they need to be)
ROM_LOAD( "leftpcb_200e", 0x000000, 0x000800, CRC(a618d02e) SHA1(cc1068fe4f6ec9a26b6e8fdbe05f4364a64559c1) )
@@ -4173,13 +4174,13 @@ ROM_START( racedrivpan )
ROM_LOAD16_BYTE( "088-2016.bin", 0x0e0000, 0x010000, CRC(6a42b7e2) SHA1(2e0ff4b7e391106a976cb872f6311f6d35dca5b0) )
ROM_LOAD16_BYTE( "088-2015.bin", 0x0e0001, 0x010000, CRC(334e2a3b) SHA1(a19bfa7652845b9453c722091c773819ba248569) )
- ROM_REGION( 0x60000, "rightpcb:user1", 0 ) /* 384k for object ROM */
- ROM_LOAD16_BYTE( "088-1017.bin", 0x00000, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
- ROM_LOAD16_BYTE( "088-1018.bin", 0x00001, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
- ROM_LOAD16_BYTE( "088-1019.bin", 0x20000, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
- ROM_LOAD16_BYTE( "088-1020.bin", 0x20001, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
- ROM_LOAD16_BYTE( "088-1021.bin", 0x40000, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
- ROM_LOAD16_BYTE( "088-1022.bin", 0x40001, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_REGION16_BE( 0x60000, "rightpcb:user1", 0 ) /* 384k for object ROM */
+ ROM_LOAD16_BYTE( "088-1018.bin", 0x00000, 0x10000, CRC(11a0a8f5) SHA1(d4ccc83fc99331d741bc9b8027ef20d72e3ad71a) )
+ ROM_LOAD16_BYTE( "088-1017.bin", 0x00001, 0x10000, CRC(d92251e8) SHA1(deeeec54c4a61c3adf62f6b1b910135559090ee5) )
+ ROM_LOAD16_BYTE( "088-1020.bin", 0x20000, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) ) // == 136091-0020.2r (strtdriv)
+ ROM_LOAD16_BYTE( "088-1019.bin", 0x20001, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) ) // == 136091-0019.2k (strtdriv)
+ ROM_LOAD16_BYTE( "088-1022.bin", 0x40000, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) )
+ ROM_LOAD16_BYTE( "088-1021.bin", 0x40001, 0x10000, CRC(ce8e4886) SHA1(d29cd4761deb80ed179d0e503243739eebc0edb4) )
ROM_REGION( 0x800, "rightpcb:200e", 0 ) // set to display right monitor, controls not calibrated with valid values (don't think they need to be)
ROM_LOAD( "rightpcb_200e", 0x000000, 0x000800, CRC(6f1b7094) SHA1(6194a5b99aebe43f02c8d267290207b32c5bdbbd) )
@@ -4462,13 +4463,13 @@ ROM_START( strtdriv )
ROM_REGION( 0x10000 + 0x10000, "mainpcb:asic65:asic65cpu", 0 ) /* dummy region for ADSP 2105 */
ROM_LOAD( "136091-0033.10j", 0x000000, 0x010000, CRC(57504ab6) SHA1(ec8361b7da964c07ca0da48a87537badc3986fe0) )
- ROM_REGION( 0x60000, "mainpcb:user1", 0 ) /* 384k for object ROM */
- ROM_LOAD16_BYTE( "136091-0017.2lm", 0x00000, 0x10000, CRC(b0454074) SHA1(9530ea1ef215116da1f0843776fa7a6b4637049d) )
- ROM_LOAD16_BYTE( "136091-0018.2t", 0x00001, 0x10000, CRC(ef432aa8) SHA1(56bce13c111db7874c9b669d479f6ef47976ee14) )
- ROM_LOAD16_BYTE( "136091-0019.2k", 0x20000, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) )
- ROM_LOAD16_BYTE( "136091-0020.2r", 0x20001, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) )
- ROM_LOAD16_BYTE( "136091-0021.2j", 0x40000, 0x10000, CRC(14f2caae) SHA1(ff40dbced58dc910a2b5825b846a5e52933cb8fc) )
- ROM_LOAD16_BYTE( "136091-0022.2p", 0x40001, 0x10000, CRC(bc4dd071) SHA1(ca182451a0a18d343dce1be56090d51950d43906) )
+ ROM_REGION16_BE( 0x60000, "mainpcb:user1", 0 ) /* 384k for object ROM */
+ ROM_LOAD16_BYTE( "136091-0018.2t", 0x00000, 0x10000, CRC(ef432aa8) SHA1(56bce13c111db7874c9b669d479f6ef47976ee14) )
+ ROM_LOAD16_BYTE( "136091-0017.2lm", 0x00001, 0x10000, CRC(b0454074) SHA1(9530ea1ef215116da1f0843776fa7a6b4637049d) )
+ ROM_LOAD16_BYTE( "136091-0020.2r", 0x20000, 0x10000, CRC(311cef99) SHA1(9c466aabad7e80581e477253ec6f2fd245f9b9fd) )
+ ROM_LOAD16_BYTE( "136091-0019.2k", 0x20001, 0x10000, CRC(5bb00676) SHA1(cad1cea8e43f9590fc71c00fab4eff0d447f9296) )
+ ROM_LOAD16_BYTE( "136091-0022.2p", 0x40000, 0x10000, CRC(bc4dd071) SHA1(ca182451a0a18d343dce1be56090d51950d43906) )
+ ROM_LOAD16_BYTE( "136091-0021.2j", 0x40001, 0x10000, CRC(14f2caae) SHA1(ff40dbced58dc910a2b5825b846a5e52933cb8fc) )
ROM_REGION16_BE( 0x50000, "mainpcb:user3", 0 ) /* 256k for DSK ROMs + 64k for RAM */
ROM_LOAD16_BYTE( "136091-0026.30e", 0x000000, 0x020000, CRC(47705109) SHA1(fa40275b71b74be8591282d2fba4215b98fc29c9) )
@@ -4518,13 +4519,13 @@ ROM_START( hdrivair )
ROM_REGION( 0x10000 + 0x10000, "mainpcb:asic65:asic65cpu", 0 ) /* dummy region for ADSP 2105 */
ROM_LOAD( "sboot.bin", 0x000000, 0x010000, CRC(cde4d010) SHA1(853f4b813ff70fe74cd87e92131c46fca045610d) )
- ROM_REGION( 0xc0000, "mainpcb:user1", 0 ) /* 768k for object ROM */
- ROM_LOAD16_BYTE( "obj0l.bin", 0x00000, 0x20000, CRC(1f835f2e) SHA1(9d3419f2c1aa65ddfe9ace4e70ca1212d634afbf) )
- ROM_LOAD16_BYTE( "obj0h.bin", 0x00001, 0x20000, CRC(c321ab55) SHA1(e095e40bb1ebda7c9ff04a5086c10ab41dec2f16) )
- ROM_LOAD16_BYTE( "obj1l.bin", 0x40000, 0x20000, CRC(3d65f264) SHA1(e9232f5bf439bf4e1cf99cc7e81b7f9550563f15) )
- ROM_LOAD16_BYTE( "obj1h.bin", 0x40001, 0x20000, CRC(2c06b708) SHA1(daa16f727f2f500172f88b69d6931aa0fa13641b) )
- ROM_LOAD16_BYTE( "obj2l.bin", 0x80000, 0x20000, CRC(b206cc7e) SHA1(17f05e906c41b804fe99dd6cd8acbade919a6a10) )
- ROM_LOAD16_BYTE( "obj2h.bin", 0x80001, 0x20000, CRC(a666e98c) SHA1(90e380ff87538c7d557cf005a4a5bcedc250eb72) )
+ ROM_REGION16_BE( 0xc0000, "mainpcb:user1", 0 ) /* 768k for object ROM */
+ ROM_LOAD16_BYTE( "obj0h.bin", 0x00000, 0x20000, CRC(c321ab55) SHA1(e095e40bb1ebda7c9ff04a5086c10ab41dec2f16) )
+ ROM_LOAD16_BYTE( "obj0l.bin", 0x00001, 0x20000, CRC(1f835f2e) SHA1(9d3419f2c1aa65ddfe9ace4e70ca1212d634afbf) )
+ ROM_LOAD16_BYTE( "obj1h.bin", 0x40000, 0x20000, CRC(2c06b708) SHA1(daa16f727f2f500172f88b69d6931aa0fa13641b) )
+ ROM_LOAD16_BYTE( "obj1l.bin", 0x40001, 0x20000, CRC(3d65f264) SHA1(e9232f5bf439bf4e1cf99cc7e81b7f9550563f15) )
+ ROM_LOAD16_BYTE( "obj2h.bin", 0x80000, 0x20000, CRC(a666e98c) SHA1(90e380ff87538c7d557cf005a4a5bcedc250eb72) )
+ ROM_LOAD16_BYTE( "obj2l.bin", 0x80001, 0x20000, CRC(b206cc7e) SHA1(17f05e906c41b804fe99dd6cd8acbade919a6a10) )
ROM_REGION16_BE( 0x140000, "mainpcb:user3", 0 )/* 1MB for DSK ROMs + 256k for RAM */
ROM_LOAD16_BYTE( "dsk2phi.bin", 0x00000, 0x80000, CRC(71c268e0) SHA1(c089248a7dfadf2eba3134fe40ebb777c115a886) )
@@ -4581,13 +4582,13 @@ ROM_START( hdrivairp )
ROM_REGION( 0x10000 + 0x10000, "mainpcb:asic65:asic65cpu", 0 ) /* dummy region for ADSP 2105 */
ROM_LOAD( "xboota.bin", 0x10000 + 0x00000, 0x10000, CRC(d9c49901) SHA1(9f90ae3a47eb1ef00c3ec3661f60402c2eae2108) )
- ROM_REGION( 0xc0000, "mainpcb:user1", 0 ) /* 768k for object ROM */
- ROM_LOAD16_BYTE( "objects.0l", 0x00000, 0x20000, CRC(3c9e9078) SHA1(f1daf32117236401f3cb97f332708632003e55f8) )
- ROM_LOAD16_BYTE( "objects.0h", 0x00001, 0x20000, CRC(4480dbae) SHA1(6a455173c38e80093f58bdc322cffcf25e70b6ae) )
- ROM_LOAD16_BYTE( "objects.1l", 0x40000, 0x20000, CRC(700bd978) SHA1(5cd63d4eee00d90fe29fb9697b6a0ea6b86704ae) )
- ROM_LOAD16_BYTE( "objects.1h", 0x40001, 0x20000, CRC(f613adaf) SHA1(9b9456e144a48fb73c5e084b33345667eed4905e) )
- ROM_LOAD16_BYTE( "objects.2l", 0x80000, 0x20000, CRC(e3b512f0) SHA1(080c5a21cb76edcb55d1c2488e9d91cf29cb0665) )
- ROM_LOAD16_BYTE( "objects.2h", 0x80001, 0x20000, CRC(3f83742b) SHA1(4b6e0134a806bcc9bd56432737047f86d0a16424) )
+ ROM_REGION16_BE( 0xc0000, "mainpcb:user1", 0 ) /* 768k for object ROM */
+ ROM_LOAD16_BYTE( "objects.0h", 0x00000, 0x20000, CRC(4480dbae) SHA1(6a455173c38e80093f58bdc322cffcf25e70b6ae) )
+ ROM_LOAD16_BYTE( "objects.0l", 0x00001, 0x20000, CRC(3c9e9078) SHA1(f1daf32117236401f3cb97f332708632003e55f8) )
+ ROM_LOAD16_BYTE( "objects.1h", 0x40000, 0x20000, CRC(f613adaf) SHA1(9b9456e144a48fb73c5e084b33345667eed4905e) )
+ ROM_LOAD16_BYTE( "objects.1l", 0x40001, 0x20000, CRC(700bd978) SHA1(5cd63d4eee00d90fe29fb9697b6a0ea6b86704ae) )
+ ROM_LOAD16_BYTE( "objects.2h", 0x80000, 0x20000, CRC(3f83742b) SHA1(4b6e0134a806bcc9bd56432737047f86d0a16424) )
+ ROM_LOAD16_BYTE( "objects.2l", 0x80001, 0x20000, CRC(e3b512f0) SHA1(080c5a21cb76edcb55d1c2488e9d91cf29cb0665) )
ROM_REGION16_BE( 0x140000, "mainpcb:user3", 0 )/* 1MB for DSK ROMs + 256k for RAM */
ROM_LOAD16_BYTE( "dskpics.hi", 0x00000, 0x80000, CRC(eaa88101) SHA1(ed0ebf8a9a9514d810242b9b552126f6717f9e25) )
diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp
index 3bc28b5a538..a246450d98e 100644
--- a/src/mame/drivers/hh_hmcs40.cpp
+++ b/src/mame/drivers/hh_hmcs40.cpp
@@ -36,7 +36,7 @@
*29 HD38800B 1984, Tomy Portable 6000 Bombman
*35 HD38800B 1983, Bandai Gundam vs Gelgoog Zaku
@43 HD38800B 1983, Bandai Dokodemo Dorayaki Doraemon (PT-412)
- @52 HD38800B 1983, Bandai Ultra Man (PT-424)
+ @52 HD38800B 1983, Bandai Ultraman Monster Battle (PT-424)
@09 HD38820A 1980, Mattel World Championship Baseball
@13 HD38820A 1981, Entex Galaxian 2
@@ -87,6 +87,7 @@
#include "sound/speaker.h"
// internal artwork
+#include "rendlay.h"
#include "pairmtch.lh"
#include "hh_hmcs40_test.lh" // common test-layout - use external artwork
@@ -1519,7 +1520,7 @@ MACHINE_CONFIG_END
/***************************************************************************
- Bandai Ultra Man (FL LSI Game Push Up) (manufactured in Japan)
+ Bandai Ultraman Monster Battle (FL LSI Game Push Up) (manufactured in Japan)
* PCB label Kaken Corp. PT-424 FL Ultra Man
* Hitachi HD38800B52 MCU
* cyan/red/blue VFD display NEC FIP8BM25T no. 21-8 2
@@ -1549,7 +1550,7 @@ WRITE8_MEMBER(bultrman_state::plate_w)
// update display
UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,15,14,13,12,11,2,10,9,8,7,6,5,4,3,0,1);
+ UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,18,17,16,15,14,13,12,3,11,10,9,8,7,6,5,4,1,2);
display_matrix(18, 8, plate, grid);
}
@@ -1584,7 +1585,7 @@ INPUT_PORTS_END
static MACHINE_CONFIG_START( bultrman, bultrman_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation
+ MCFG_CPU_ADD("maincpu", HD38800, 350000) // approximation
MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bultrman_state, plate_w))
MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bultrman_state, plate_w))
MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bultrman_state, plate_w))
@@ -2070,7 +2071,12 @@ static MACHINE_CONFIG_START( cdkong, cdkong_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("speaker_decay", cdkong_state, speaker_decay_sim, attotime::from_msec(CDKONG_SPEAKER_DECAY))
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
- MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test)
+
+ MCFG_SCREEN_SVG_ADD("screen", "svg")
+ MCFG_SCREEN_REFRESH_RATE(50)
+ MCFG_SCREEN_SIZE(559, 998)
+ MCFG_SCREEN_VISIBLE_AREA(0, 558, 0, 997)
+ MCFG_DEFAULT_LAYOUT(layout_svg)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -3960,6 +3966,9 @@ ROM_START( cdkong )
ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 )
ROM_LOAD( "hd38820a45", 0x0000, 0x1000, CRC(196b8070) SHA1(da85d1eb4b048b77f3168630662ab94ec9baa262) )
ROM_CONTINUE( 0x1e80, 0x0100 )
+
+ ROM_REGION( 359199, "svg", 0)
+ ROM_LOAD( "cdkong.svg", 0, 359199, CRC(ba159fd5) SHA1(3188e2ed3234f39ac9ee93a485a7e73314bc3457) ) // version 8 april 2016. by Rik, kevtris
ROM_END
@@ -4093,12 +4102,12 @@ CONS( 1983, zackman, 0, 0, zackman, zackman, driver_device, 0, "Banda
CONS( 1983, bpengo, 0, 0, bpengo, bpengo, driver_device, 0, "Bandai", "Pengo (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
CONS( 1983, bbtime, 0, 0, bbtime, bbtime, driver_device, 0, "Bandai", "Burger Time (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
CONS( 1983, bdoramon, 0, 0, bdoramon, bdoramon, driver_device, 0, "Bandai", "Dokodemo Dorayaki Doraemon", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
-CONS( 1983, bultrman, 0, 0, bultrman, bultrman, driver_device, 0, "Bandai", "Ultra Man (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
+CONS( 1983, bultrman, 0, 0, bultrman, bultrman, driver_device, 0, "Bandai", "Ultraman Monster Battle", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
CONS( 1984, machiman, 0, 0, machiman, machiman, driver_device, 0, "Bandai", "Machine Man", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
CONS( 1984, pairmtch, 0, 0, pairmtch, pairmtch, driver_device, 0, "Bandai", "Pair Match", MACHINE_SUPPORTS_SAVE )
CONS( 1981, alnattck, 0, 0, alnattck, alnattck, driver_device, 0, "Coleco", "Alien Attack", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
-CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND )
+CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE )
CONS( 1982, cgalaxn, 0, 0, cgalaxn, cgalaxn, driver_device, 0, "Coleco", "Galaxian (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND )
CONS( 1981, cpacman, 0, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 29)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
CONS( 1981, cpacmanr1, cpacman, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 28)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK )
diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp
index 0ae16c2b1ef..7a3e1d622a1 100644
--- a/src/mame/drivers/hh_sm510.cpp
+++ b/src/mame/drivers/hh_sm510.cpp
@@ -11,6 +11,7 @@
#include "emu.h"
#include "cpu/sm510/sm510.h"
+#include "cpu/sm510/kb1013vk1-2.h"
#include "sound/speaker.h"
#include "hh_sm510_test.lh" // common test-layout - use external artwork
@@ -233,6 +234,7 @@ MACHINE_CONFIG_END
/***************************************************************************
Konami Teenage Mutant Ninja Turtles
+ * PCB label BH005
* Sharp SM511 under epoxy (die label KMS 73B, KMS 774)
***************************************************************************/
@@ -257,10 +259,12 @@ static INPUT_PORTS_START( ktmnt )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
PORT_START("IN.1")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("Game Select")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_VOLUME_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("Sound")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_POWER_OFF ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_POWER_ON ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_POWER_ON ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("On/Start")
+ //Wouldn't be better if IPT_START for "On/Start" was used???
+ //Well, this here is a very preliminary driver, nothing final yet. How about some tea???
PORT_START("IN.2")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
@@ -294,6 +298,119 @@ MACHINE_CONFIG_END
/***************************************************************************
+ Konami Gradius
+ * PCB label BH004
+ * Sharp SM511 under epoxy (die label KMS 73B, KMS 774)
+
+***************************************************************************/
+
+class kgradius_state : public hh_sm510_state
+{
+public:
+ kgradius_state(const machine_config &mconfig, device_type type, const char *tag)
+ : hh_sm510_state(mconfig, type, tag)
+ {
+ m_inp_lines = 2;
+ }
+};
+
+// config
+
+static INPUT_PORTS_START( kgradius )
+ PORT_START("IN.0")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POWER_ON ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POWER_OFF ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VOLUME_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("Sound")
+
+ PORT_START("IN.1")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
+INPUT_PORTS_END
+
+static MACHINE_CONFIG_START( kgradius, kgradius_state )
+
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", SM511, XTAL_32_768kHz)
+ MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r))
+ MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w))
+ MCFG_SM510_WRITE_R_CB(WRITE8(hh_sm510_state, sm511_melody_w))
+
+ MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test)
+
+ /* sound hardware */
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+MACHINE_CONFIG_END
+
+
+
+
+
+/***************************************************************************
+
+ Konami Lone Ranger
+ * PCB label BH009
+ * Sharp SM511 under epoxy (die label KMS 73B, KMS 781)
+
+***************************************************************************/
+
+class kloneran_state : public hh_sm510_state
+{
+public:
+ kloneran_state(const machine_config &mconfig, device_type type, const char *tag)
+ : hh_sm510_state(mconfig, type, tag)
+ {
+ m_inp_lines = 2;
+ }
+};
+
+// config
+
+static INPUT_PORTS_START( kloneran )
+ PORT_START("IN.0") // S3?
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+
+ PORT_START("IN.1") // S2?
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POWER_OFF ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_VOLUME_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("Sound")
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) PORT_NAME("Pause")
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_POWER_ON ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL)
+INPUT_PORTS_END
+
+static MACHINE_CONFIG_START( kloneran, kloneran_state )
+
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", SM511, XTAL_32_768kHz)
+ MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w))
+ MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r))
+ MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w))
+ MCFG_SM510_WRITE_R_CB(WRITE8(hh_sm510_state, sm511_melody_w))
+
+ MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test)
+
+ /* sound hardware */
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+MACHINE_CONFIG_END
+
+
+
+
+/***************************************************************************
+
Nintendo Game & Watch: Mickey & Donald (model DM-53)
* PCB label DM-53
* Sharp SM510 label DM-53 (die label CMS54C, CMS565)
@@ -361,6 +478,46 @@ MACHINE_CONFIG_END
/***************************************************************************
+ IM-02 Nu, Pogodi!
+ * KB1013VK1-2, die label V2-2 VK1-2
+
+***************************************************************************/
+
+class nupogodi_state : public hh_sm510_state
+{
+public:
+ nupogodi_state(const machine_config &mconfig, device_type type, const char *tag)
+ : hh_sm510_state(mconfig, type, tag)
+ {
+ m_inp_lines = 2;
+ }
+};
+
+// handlers
+
+
+// config
+
+static INPUT_PORTS_START( nupogodi )
+INPUT_PORTS_END
+
+static MACHINE_CONFIG_START( nupogodi, nupogodi_state )
+
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", KB1013VK12, XTAL_32_768kHz)
+
+ /* sound hardware */
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+MACHINE_CONFIG_END
+
+
+
+
+
+/***************************************************************************
+
Game driver(s)
***************************************************************************/
@@ -373,19 +530,37 @@ ROM_END
ROM_START( ktmnt ) // except for filler/unused bytes, ROM listing in patent US5150899 "BH005 TMNT" prog/music is same
ROM_REGION( 0x1000, "maincpu", 0 )
- ROM_LOAD( "kms73b_774.prog", 0x0000, 0x1000, CRC(a1064f87) SHA1(92156c35fbbb414007ee6804fe635128a741d5f1) )
+ ROM_LOAD( "kms73b_kms774.prog", 0x0000, 0x1000, CRC(a1064f87) SHA1(92156c35fbbb414007ee6804fe635128a741d5f1) )
ROM_REGION( 0x100, "maincpu:music", 0 )
- ROM_LOAD( "kms73b_774.music", 0x000, 0x100, CRC(8270d626) SHA1(bd91ca1d5cd7e2a62eef05c0033b19dcdbe441ca) )
+ ROM_LOAD( "kms73b_kms774.music", 0x000, 0x100, CRC(8270d626) SHA1(bd91ca1d5cd7e2a62eef05c0033b19dcdbe441ca) )
ROM_END
ROM_START( kcontra ) // except for filler/unused bytes, ROM listing in patent US5120057 "BH002 C (Contra)" prog/music is same
ROM_REGION( 0x1000, "maincpu", 0 )
- ROM_LOAD( "kms73b_774.prog", 0x0000, 0x1000, CRC(bf834877) SHA1(055dd56ec16d63afba61ab866481fd9c029fb54d) )
+ ROM_LOAD( "kms73b_kms773.prog", 0x0000, 0x1000, CRC(bf834877) SHA1(055dd56ec16d63afba61ab866481fd9c029fb54d) )
ROM_REGION( 0x100, "maincpu:music", 0 )
- ROM_LOAD( "kms73b_774.music", 0x000, 0x100, CRC(23d02b99) SHA1(703938e496db0eeacd14fe7605d4b5c39e0a5bc8) )
+ ROM_LOAD( "kms73b_kms773.music", 0x000, 0x100, CRC(23d02b99) SHA1(703938e496db0eeacd14fe7605d4b5c39e0a5bc8) )
+ROM_END
+
+
+ROM_START( kgradius )
+ ROM_REGION( 0x1000, "maincpu", 0 )
+ ROM_LOAD( "kms73b_kms771.prog", 0x0000, 0x1000, CRC(830c2afc) SHA1(bb9ebd4e52831cc02cd92dd4b37675f34cf37b8c) )
+
+ ROM_REGION( 0x100, "maincpu:music", 0 )
+ ROM_LOAD( "kms73b_kms771.music", 0x000, 0x100, CRC(4c586b73) SHA1(14c5ab2898013a577f678970a648c374749cc66d) )
+ROM_END
+
+
+ROM_START( kloneran )
+ ROM_REGION( 0x1000, "maincpu", 0 )
+ ROM_LOAD( "kms73b_kms781.prog", 0x0000, 0x1000, CRC(52b9735f) SHA1(06c5ef6e7e781b1176d4c1f2445f765ccf18b3f7) )
+
+ ROM_REGION( 0x100, "maincpu:music", 0 )
+ ROM_LOAD( "kms73b_kms781.music", 0x000, 0x100, CRC(a393de36) SHA1(55089f04833ccb318524ab2b584c4817505f4019) )
ROM_END
@@ -395,10 +570,20 @@ ROM_START( gnwmndon )
ROM_END
+ROM_START( nupogodi )
+ ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 )
+ ROM_LOAD( "nupogodi.bin", 0x0000, 0x0740, CRC(cb820c32) SHA1(7e94fc255f32db725d5aa9e196088e490c1a1443) )
+ROM_END
+
+
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
CONS( 1989, kcontra, 0, 0, ktmnt, ktopgun, driver_device, 0, "Konami", "Contra (handheld)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
CONS( 1989, ktopgun, 0, 0, ktopgun, ktopgun, driver_device, 0, "Konami", "Top Gun (handheld)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
CONS( 1989, ktmnt, 0, 0, ktmnt, ktmnt, driver_device, 0, "Konami", "Teenage Mutant Ninja Turtles (handheld)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
+CONS( 1989, kgradius, 0, 0, kgradius, kgradius, driver_device, 0, "Konami", "Gradius (handheld)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
+CONS( 1989, kloneran, 0, 0, kloneran, kloneran, driver_device, 0, "Konami", "Lone Ranger (handheld)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
CONS( 1982, gnwmndon, 0, 0, gnwmndon, gnwmndon, driver_device, 0, "Nintendo", "Game & Watch: Mickey & Donald", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
+
+CONS( 1984, nupogodi, 0, 0, nupogodi, nupogodi, driver_device, 0, "Elektronika", "Nu, pogodi!", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp
index d3411390e2b..2ea7f8a51ff 100644
--- a/src/mame/drivers/hh_ucom4.cpp
+++ b/src/mame/drivers/hh_ucom4.cpp
@@ -46,6 +46,7 @@
@206 uPD553C 1982, Epoch Dracula
@209 uPD553C 1982, Tomy Caveman (TN-12)
@258 uPD553C 1984, Tomy Alien Chase (TN-16)
+ *296 uPD553C 1984, Epoch Computer Beam Gun Professional
*511 uPD557LC?1980, Gakken Game Robot 9/Mego Fabulous Fred
@512 uPD557LC 1980, Castle Toy Tactix
diff --git a/src/mame/drivers/himesiki.cpp b/src/mame/drivers/himesiki.cpp
index f21891f4500..1ebc2696426 100644
--- a/src/mame/drivers/himesiki.cpp
+++ b/src/mame/drivers/himesiki.cpp
@@ -9,9 +9,10 @@ Android (C) 198? Nasco
*****************************************************************************/
-// Note, another VERY different version of Android also exists, see https://www.youtube.com/watch?v=5rtqZqMBACI (uploaded by Chris Hardy)
-// it is unclear if that version is on the same hardware as this
// Android uses PCBS MK-P102 and MK-P101 ONLY, there is no MK-P103 (extra sprites used on Himeshikibu)
+// Real hardware video of parent set can be seen at https://www.youtube.com/watch?v=5rtqZqMBACI (uploaded by Chris Hardy)
+// for some reason music fails to play the 2nd attract loop in MAME?
+
/*
@@ -235,7 +236,7 @@ static INPUT_PORTS_START( himesiki )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-static INPUT_PORTS_START( androidp )
+static INPUT_PORTS_START( androidpo )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
@@ -320,6 +321,38 @@ static INPUT_PORTS_START( androidp )
INPUT_PORTS_END
+static INPUT_PORTS_START( androidp )
+ PORT_INCLUDE(androidpo)
+
+ PORT_MODIFY("DSW1")
+ PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
+
+ PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
+ PORT_DIPSETTING( 0x08, "1" )
+ PORT_DIPSETTING( 0x0c, "2" )
+ PORT_DIPSETTING( 0x04, "3" )
+ PORT_DIPSETTING( 0x00, "4" )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( No ) )
+ PORT_DIPSETTING( 0x40, DEF_STR( Yes ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x80, DEF_STR( On ) )
+
+ PORT_MODIFY("DSW2")
+ PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x03, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) )
+ PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
+
+INPUT_PORTS_END
/****************************************************************************/
@@ -417,13 +450,13 @@ static MACHINE_CONFIG_START( himesiki, himesiki_state )
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", himesiki)
- MCFG_PALETTE_ADD("palette", 1024)
+ MCFG_PALETTE_ADD_INIT_BLACK("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("ym2203", YM2203, MCLK/4)
+ MCFG_SOUND_ADD("ym2203", YM2203, CLK2/4) // ??
MCFG_YM2203_IRQ_HANDLER(INPUTLINE("sub", 0))
MCFG_SOUND_ROUTE(0, "mono", 0.10)
MCFG_SOUND_ROUTE(1, "mono", 0.10)
@@ -469,7 +502,7 @@ ROM_END
-ROM_START( androidp )
+ROM_START( androidpo )
ROM_REGION( 0x08000, "maincpu", 0 )
ROM_LOAD( "MITSUBISHI_A01.toppcb.m5l27256k.k1.BIN", 0x00000, 0x08000, CRC(25ab85eb) SHA1(e1fab149c83ff880b119258206d5818f3db641c5) )
@@ -496,7 +529,34 @@ ROM_START( androidp )
// + 2 undumped PLDs
ROM_END
+ROM_START( androidp )
+ ROM_REGION( 0x08000, "maincpu", 0 )
+ ROM_LOAD( "ANDR1.BIN", 0x00000, 0x08000, CRC(fff04130) SHA1(9bdafa8b311cc5d0851b04df3c6dd16eb087a5dd) )
+
+ ROM_REGION( 0x10000, "banks", 0 )
+ ROM_LOAD( "ANDR3.BIN", 0x00000, 0x04000, CRC(112d5123) SHA1(653109eae7b58d9dcb8892ea9aca17427f14c145) )
+ ROM_CONTINUE( 0x08000, 0x04000)
+
+ ROM_REGION( 0x18000, "sub", 0 )
+ ROM_LOAD( "ANDR4.BIN", 0x00000, 0x08000, CRC(65f5e98b) SHA1(69f979d653695413a1c503c402d4bf5ffcfb6e5d) )
+
+ ROM_REGION( 0x10000, "bgtiles", 0 )
+ ROM_LOAD( "ANDR5.BIN", 0x00000, 0x10000, CRC(0a0b44c0) SHA1(8d359b802c7dee5faea9464f06b672fd401799cf) )
+
+ ROM_REGION( 0x20000, "sprites", 0 )
+ ROM_LOAD16_BYTE( "ANDR6.BIN", 0x00000, 0x10000, CRC(122b7dd1) SHA1(5dffd2b97c8222afc98552513b84a91d6127f41b) )
+ ROM_LOAD16_BYTE( "ANDR7.BIN", 0x00001, 0x10000, CRC(fc0f9234) SHA1(496a918cc1f4d0e7191a49cc43c51fbd71e0bdf5) )
+
+ ROM_REGION( 0x20000, "spr_p103a", ROMREGION_ERASEFF )
+ // there's no P103A PCB for this on Android
+
+
+ // + 2 undumped PLDs (?)
+ROM_END
+
-GAME( 1989, himesiki, 0, himesiki, himesiki, driver_device, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1989, himesiki, 0, himesiki, himesiki, driver_device, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 198?, androidp, 0, himesiki, androidp, driver_device, 0, ROT90, "Nasco", "Android (early build?)", MACHINE_SUPPORTS_SAVE )
+// the game changed significantly between these 2 versions
+GAME( 198?, androidp, 0, himesiki, androidp, driver_device, 0, ROT90, "Nasco", "Android (prototype, later build)", MACHINE_SUPPORTS_SAVE )
+GAME( 198?, androidpo, androidp, himesiki, androidpo, driver_device, 0, ROT90, "Nasco", "Android (prototype, early build)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp
index b1df15c8419..bd99a6356fe 100644
--- a/src/mame/drivers/hornet.cpp
+++ b/src/mame/drivers/hornet.cpp
@@ -1014,10 +1014,7 @@ static MACHINE_CONFIG_START( hornet, hornet_state )
MCFG_PALETTE_ADD("palette", 65536)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
- MCFG_K037122_ADD("k037122_1", "screen", 0)
- MCFG_K037122_GFXDECODE("gfxdecode")
+ MCFG_K037122_ADD("k037122_1", "screen")
MCFG_K037122_PALETTE("palette")
MCFG_K056800_ADD("k056800", XTAL_16_9344MHz)
@@ -1067,12 +1064,10 @@ static MACHINE_CONFIG_DERIVED( hornet_2board, hornet )
MCFG_DEVICE_REMOVE("k037122_1")
- MCFG_K037122_ADD("k037122_1", "lscreen", 0)
- MCFG_K037122_GFXDECODE("gfxdecode")
+ MCFG_K037122_ADD("k037122_1", "lscreen")
MCFG_K037122_PALETTE("palette")
- MCFG_K037122_ADD("k037122_2", "rscreen", 1)
- MCFG_K037122_GFXDECODE("gfxdecode")
+ MCFG_K037122_ADD("k037122_2", "rscreen")
MCFG_K037122_PALETTE("palette")
MCFG_DEVICE_REMOVE("voodoo0")
diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp
index 1387432ea85..4890b0ad92e 100644
--- a/src/mame/drivers/hp9845.cpp
+++ b/src/mame/drivers/hp9845.cpp
@@ -44,7 +44,10 @@
// Base address of video buffer
#define VIDEO_BUFFER_BASE 0x17000
-#define MAX_WORD_PER_ROW 600
+// For test "B" of alpha video to succeed this must be < 234
+// Basically "B" test is designed to intentionally prevent line buffer to be filled so that display is blanked
+// from 2nd row on. This in turn prevents "BAD" text to be visible on screen.
+#define MAX_WORD_PER_ROW 220
#define VIDEO_CHAR_WIDTH 9
#define VIDEO_CHAR_HEIGHT 15
@@ -412,10 +415,14 @@ void hp9845b_state::video_render_buff(unsigned line_in_row, bool buff_idx)
m_video_blanked = true;
}
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
+
if (m_video_blanked) {
- // TODO: blank scanline
+ // Blank scanline
+ for (unsigned i = 0; i < (80 * 9); i++) {
+ m_bitmap.pix32(m_video_scanline , i) = palette[ 0 ];
+ }
} else {
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
bool cursor_line = line_in_row == 12;
bool ul_line = line_in_row == 14;
bool cursor_blink = BIT(m_video_frame , 3);
diff --git a/src/mame/drivers/hvyunit.cpp b/src/mame/drivers/hvyunit.cpp
index 21ec09dfe4b..a8446a8537c 100644
--- a/src/mame/drivers/hvyunit.cpp
+++ b/src/mame/drivers/hvyunit.cpp
@@ -676,7 +676,6 @@ static MACHINE_CONFIG_START( hvyunit, hvyunit_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/igs009.cpp b/src/mame/drivers/igs009.cpp
index 78e1308068f..638a3260df2 100644
--- a/src/mame/drivers/igs009.cpp
+++ b/src/mame/drivers/igs009.cpp
@@ -18,11 +18,11 @@ NVRAM : Battery for main RAM
---------------------------------------------------------------------------
Year Game Manufacturer Notes
---------------------------------------------------------------------------
-1997 Jingle Bell (US, V157) IGS NMI issues...
-1997 Jingle Bell (EU, V155) IGS NMI issues...
-1997 Jingle Bell (EU, V153) IGS NMI issues...
-1995 Jingle Bell (EU, V141) IGS Working
-1995? Jingle Bell (Italy, V133I) IGS Working
+1997 Jingle Bell (US, V157US) IGS patched protection
+1997 Jingle Bell (EU, V155UE) IGS patched protection
+1997 Jingle Bell (EU, V153UE) IGS patched protection
+1995 Jingle Bell (EU, V141UE) IGS patched protection
+1995? Jingle Bell (Italy, V133I) IGS patched protection
1998 Grand Prix '98 Romtec 1 reel gfx rom is bad
---------------------------------------------------------------------------
@@ -35,7 +35,6 @@ Year Game Manufacturer Notes
#include "sound/okim6295.h"
#include "machine/nvram.h"
-
class igs009_state : public driver_device
{
public:
@@ -106,7 +105,10 @@ public:
TILE_GET_INFO_MEMBER(get_gp98_reel4_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ void decrypt_jingbell();
DECLARE_DRIVER_INIT(jingbell);
+ DECLARE_DRIVER_INIT(jingbelli);
+
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
@@ -314,7 +316,6 @@ UINT32 igs009_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
int startclipmin = 0;
const rectangle &visarea = screen.visible_area();
-
for (i= 0;i < 0x80;i++)
{
m_reel1_tilemap->set_scrolly(i, m_bg_scroll[i]*2);
@@ -323,9 +324,6 @@ UINT32 igs009_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
m_reel4_tilemap->set_scrolly(i, m_bg_scroll[i+0x180]*2);
}
-
-
-
for (zz=0;zz<0x80-8;zz++) // -8 because of visible area (2*8 = 16)
{
rectangle clip;
@@ -395,9 +393,9 @@ WRITE8_MEMBER(igs009_state::nmi_and_coins_w)
machine().bookkeeping().coin_counter_w(0, data & 0x01); // coin_a
machine().bookkeeping().coin_counter_w(1, data & 0x04); // coin_c
machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in
- machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech
+ machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech
- output().set_led_value(6, data & 0x40); // led for coin m_out / m_hopper active
+ output().set_led_value(6, data & 0x40); // led for coin out / m_hopper active
m_nmi_enable = data; // data & 0x80 // nmi enable?
@@ -525,7 +523,7 @@ static ADDRESS_MAP_START( gp98_portmap, AS_IO, 8, igs009_state )
AM_RANGE( 0x5000, 0x5fff ) AM_RAM_WRITE(fg_tile_w ) AM_SHARE("fg_tile_ram")
- // seems to lacks of PPI devices...
+ // seems to lack PPI devices...
AM_RANGE( 0x6480, 0x6480 ) AM_WRITE(nmi_and_coins_w )
AM_RANGE( 0x6481, 0x6481 ) AM_READ_PORT( "SERVICE" )
AM_RANGE( 0x6482, 0x6482 ) AM_READ_PORT( "COINS" )
@@ -727,7 +725,7 @@ static const gfx_layout layout_8x8x6 =
8, 8,
RGN_FRAC(1, 3),
6,
- { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
+ { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
{ STEP8(0,1) },
@@ -740,7 +738,7 @@ static const gfx_layout layout_8x32x6 =
8, 32,
RGN_FRAC(1, 3),
6,
- { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
+ { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
{ STEP8(0,1) },
@@ -796,14 +794,14 @@ void igs009_state::machine_start()
void igs009_state::machine_reset()
{
- m_nmi_enable = 0;
- m_hopper = 0;
- m_video_enable = 1;
+ m_nmi_enable = 0;
+ m_hopper = 0;
+ m_video_enable = 1;
}
INTERRUPT_GEN_MEMBER(igs009_state::interrupt)
{
- if (m_nmi_enable & 0x80)
+ if (m_nmi_enable & 0x80)
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
@@ -1028,6 +1026,7 @@ Notes:
12/02/2008 f205v
***************************************************************************/
+
ROM_START( jingbelli )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "jinglev133i.u44", 0x00000, 0x10000, CRC(df60dc39) SHA1(ff57afd50c045b621395353fdc50ffd1e1b65e9e) )
@@ -1055,14 +1054,12 @@ ROM_START( jingbelli )
ROM_LOAD( "palce22v10h-ch-jin-u27.u27", 0x000, 0x2dd, BAD_DUMP CRC(5c4e9024) SHA1(e9d1e4df3d79c21f4ce053a84bb7b7a43d650f91) )
ROM_END
-
-DRIVER_INIT_MEMBER(igs009_state,jingbell)
+void igs009_state::decrypt_jingbell()
{
- int i;
UINT8 *rom = (UINT8 *)memregion("maincpu")->base();
size_t size = memregion("maincpu")->bytes();
- for (i=0; i<size; i++)
+ for (int i=0; i<size; i++)
{
UINT8 x = rom[i];
if (i & 0x0080)
@@ -1080,11 +1077,26 @@ DRIVER_INIT_MEMBER(igs009_state,jingbell)
rom[i] = x;
}
+}
+
+DRIVER_INIT_MEMBER(igs009_state,jingbelli)
+{
+ decrypt_jingbell();
// protection patch
+ UINT8 *rom = (UINT8 *)memregion("maincpu")->base();
rom[0x01f19] = 0x18;
}
+DRIVER_INIT_MEMBER(igs009_state,jingbell)
+{
+ decrypt_jingbell();
+
+ // protection patch
+ UINT8 *rom = (UINT8 *)memregion("maincpu")->base();
+ rom[0x0e753] = 0x18;
+}
+
/***************************************************************************
Grand Prix '98
@@ -1145,10 +1157,10 @@ ROM_START( gp98 )
ROM_END
-/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */
-GAME( 1997, jingbell, 0, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (US, V157)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
-GAME( 1997, jingbella, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (EU, V155)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
-GAME( 1997, jingbellb, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (EU, V153)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
-GAME( 1995, jingbellc, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (EU, V141)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995?, jingbelli, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (Italy, V133I)", MACHINE_SUPPORTS_SAVE )
-GAME( 1998, gp98, 0, gp98, jingbell, driver_device, 0, ROT0, "Romtec Co. Ltd", "Grand Prix '98 (V100K)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
+/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */
+GAME( 1997, jingbell, 0, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (US, V157US)", MACHINE_SUPPORTS_SAVE )
+GAME( 1997, jingbella, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (EU, V155UE)", MACHINE_SUPPORTS_SAVE ) // Shows V154UE in test mode!
+GAME( 1997, jingbellb, jingbell, jingbell, jingbell, igs009_state, jingbell, ROT0, "IGS", "Jingle Bell (EU, V153UE)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, jingbellc, jingbell, jingbell, jingbell, igs009_state, jingbelli, ROT0, "IGS", "Jingle Bell (EU, V141UE)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995?, jingbelli, jingbell, jingbell, jingbell, igs009_state, jingbelli, ROT0, "IGS", "Jingle Bell (Italy, V133I)", MACHINE_SUPPORTS_SAVE )
+GAME( 1998, gp98, 0, gp98, jingbell, driver_device, 0, ROT0, "Romtec Co. Ltd", "Grand Prix '98 (V100K)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/intv.cpp b/src/mame/drivers/intv.cpp
index d1d6f8eab6b..084d7b492ba 100644
--- a/src/mame/drivers/intv.cpp
+++ b/src/mame/drivers/intv.cpp
@@ -136,103 +136,6 @@ static GFXDECODE_START( intvkbd )
GFXDECODE_ENTRY( "gfx1", 0x0000, intvkbd_charlayout, 0, 256 )
GFXDECODE_END
-static INPUT_PORTS_START( intv )
-
- /* Left Player Controller */
- PORT_START("KEYPAD1")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/1") PORT_CODE(KEYCODE_1_PAD)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/2") PORT_CODE(KEYCODE_2_PAD)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/3") PORT_CODE(KEYCODE_3_PAD)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/4") PORT_CODE(KEYCODE_4_PAD)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/5") PORT_CODE(KEYCODE_5_PAD)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/6") PORT_CODE(KEYCODE_6_PAD)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/7") PORT_CODE(KEYCODE_7_PAD)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/8") PORT_CODE(KEYCODE_8_PAD)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/9") PORT_CODE(KEYCODE_9_PAD)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Clear") PORT_CODE(KEYCODE_DEL_PAD)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/0") PORT_CODE(KEYCODE_0_PAD)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Enter") PORT_CODE(KEYCODE_ENTER_PAD)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left/Upper") PORT_PLAYER(1)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Left/Lower-Left") PORT_PLAYER(1)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Left/Lower-Right") PORT_PLAYER(1)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("DISC1")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Left/Up") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Left/Right") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Left/Down") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left/Left") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00)
-
- PORT_START("DISCX1")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Left/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01)
-
- PORT_START("DISCY1")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Left/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01)
-
- /* Right Player Controller */
- PORT_START("KEYPAD2")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/1")
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/2")
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/3")
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/4")
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/5")
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/6")
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/7")
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/8")
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/9")
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Clear")
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/0")
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Enter")
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Right/Upper") PORT_PLAYER(2)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right/Lower-Left") PORT_PLAYER(2)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Right/Lower-Right") PORT_PLAYER(2)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED )
-
- PORT_START("DISC2")
- PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Right/Up") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right/Right") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Right/Down") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Right/Left") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
- PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00)
-
- PORT_START("DISCX2")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Right/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02)
-
- PORT_START("DISCY2")
- PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Right/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02)
-
- PORT_START("OPTIONS")
- PORT_CONFNAME( 0x01, 0x00, "Left Disc" )
- PORT_CONFSETTING( 0x00, "Digital" )
- PORT_CONFSETTING( 0x01, "Analog" )
- PORT_CONFNAME( 0x02, 0x00, "Right Disc" )
- PORT_CONFSETTING( 0x00, "Digital" )
- PORT_CONFSETTING( 0x02, "Analog" )
-INPUT_PORTS_END
-
/*
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
@@ -370,11 +273,6 @@ static INPUT_PORTS_START( intvkbd )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD)
-
- /* 2008-05 FP: I include here the controller inputs to make happy the read_handler.
- Please remove this (and re-tag accordingly the inputs above) if intv_right_control_r
- is supposed to scan the keyboard inputs when the Keyboard Component is connected */
- PORT_INCLUDE( intv )
INPUT_PORTS_END
static ADDRESS_MAP_START( intv_mem, AS_PROGRAM, 16, intv_state )
@@ -551,7 +449,6 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2)
timer_set(m_keyboard->cycles_to_attotime(100), TIMER_INTV_INTERRUPT2_COMPLETE);
}
-
static MACHINE_CONFIG_START( intv, intv_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", CP1610, XTAL_3_579545MHz/4) /* Colorburst/4 */
@@ -574,11 +471,14 @@ static MACHINE_CONFIG_START( intv, intv_state )
MCFG_PALETTE_INDIRECT_ENTRIES(32)
MCFG_PALETTE_INIT_OWNER(intv_state, intv)
+ MCFG_INTV_CONTROL_PORT_ADD("iopt_right_ctrl", intv_control_port_devices, "handctrl")
+ MCFG_INTV_CONTROL_PORT_ADD("iopt_left_ctrl", intv_control_port_devices, "handctrl")
+
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay8914", AY8914, XTAL_3_579545MHz/2)
- MCFG_AY8910_PORT_A_READ_CB(READ8(intv_state, intv_right_control_r))
- MCFG_AY8910_PORT_B_READ_CB(READ8(intv_state, intv_left_control_r))
+ MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("iopt_right_ctrl", intv_control_port_device, ctrl_r))
+ MCFG_AY8910_PORT_B_READ_CB(DEVREAD8("iopt_left_ctrl", intv_control_port_device, ctrl_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
/* cartridge */
@@ -743,11 +643,11 @@ DRIVER_INIT_MEMBER(intv_state,intvkbd)
***************************************************************************/
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
-CONS( 1979, intv, 0, 0, intv, intv, intv_state, intv, "Mattel", "Intellivision", MACHINE_SUPPORTS_SAVE )
-CONS( 1981, intvsrs, intv, 0, intv, intv, intv_state, intv, "Sears", "Super Video Arcade", MACHINE_SUPPORTS_SAVE )
+CONS( 1979, intv, 0, 0, intv, 0, intv_state, intv, "Mattel", "Intellivision", MACHINE_SUPPORTS_SAVE )
+CONS( 1981, intvsrs, intv, 0, intv, 0, intv_state, intv, "Sears", "Super Video Arcade", MACHINE_SUPPORTS_SAVE )
COMP( 1981, intvkbd, intv, 0, intvkbd, intvkbd, intv_state, intvkbd, "Mattel", "Intellivision Keyboard Component (Unreleased)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
-CONS( 1982, intv2, intv, 0, intv2, intv, intv_state, intv, "Mattel", "Intellivision II", MACHINE_SUPPORTS_SAVE )
+CONS( 1982, intv2, intv, 0, intv2, 0, intv_state, intv, "Mattel", "Intellivision II", MACHINE_SUPPORTS_SAVE )
// made up, user friendlier machines with pre-mounted passthu expansions
-COMP( 1982, intvoice, intv, 0, intvoice, intv, intv_state, intv, "Mattel", "Intellivision w/IntelliVoice expansion", MACHINE_SUPPORTS_SAVE )
-COMP( 1983, intvecs, intv, 0, intvecs, intv, intv_state, intv, "Mattel", "Intellivision w/Entertainment Computer System + Intellivoice expansions", MACHINE_SUPPORTS_SAVE )
+COMP( 1982, intvoice, intv, 0, intvoice, 0, intv_state, intv, "Mattel", "Intellivision w/IntelliVoice expansion", MACHINE_SUPPORTS_SAVE )
+COMP( 1983, intvecs, intv, 0, intvecs, 0, intv_state, intv, "Mattel", "Intellivision w/Entertainment Computer System + Intellivoice expansions", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/inufuku.cpp b/src/mame/drivers/inufuku.cpp
index dcbb74bd400..78621252fae 100644
--- a/src/mame/drivers/inufuku.cpp
+++ b/src/mame/drivers/inufuku.cpp
@@ -395,7 +395,6 @@ static MACHINE_CONFIG_START( inufuku, inufuku_state )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( inufuku_state, inufuku_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", inufuku)
MCFG_PALETTE_ADD("palette", 4096)
diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp
index ee33848dd11..c26edd9b298 100644
--- a/src/mame/drivers/jaguar.cpp
+++ b/src/mame/drivers/jaguar.cpp
@@ -339,7 +339,6 @@ Notes:
#include "machine/vt83c461.h"
#include "sound/dac.h"
#include "includes/jaguar.h"
-#include "emuopts.h"
#include "imagedev/snapquik.h"
#include "sound/dac.h"
#include "machine/eepromser.h"
diff --git a/src/mame/drivers/jclub2.cpp b/src/mame/drivers/jclub2.cpp
index e3135dcbc6e..fe83f2ad7a5 100644
--- a/src/mame/drivers/jclub2.cpp
+++ b/src/mame/drivers/jclub2.cpp
@@ -156,7 +156,7 @@ public:
UINT32 screen_update_jclub2o(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(darkhors_irq);
void draw_sprites_darkhors(bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<gfxdecode_device> m_gfxdecode;
+ optional_device<gfxdecode_device> m_gfxdecode;
WRITE8_MEMBER(st0016_rom_bank_w); // temp?
};
@@ -1021,13 +1021,10 @@ static MACHINE_CONFIG_START( jclub2, darkhors_state )
MCFG_SCREEN_UPDATE_DRIVER(darkhors_state, screen_update_jclub2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
// NOT an ST0020 but instead ST0032, ram format isn't compatible at least
MCFG_DEVICE_ADD("st0020_spr", ST0020_SPRITES, 0)
st0020_device::set_is_st0032(*device, 1);
st0020_device::set_is_jclub2o(*device, 1); // offsets
- MCFG_ST0020_SPRITES_GFXDECODE("gfxdecode")
MCFG_ST0020_SPRITES_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 0x10000)
@@ -1101,11 +1098,8 @@ static MACHINE_CONFIG_START( jclub2o, darkhors_state )
MCFG_PALETTE_ADD("palette", 0x10000)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("st0020_spr", ST0020_SPRITES, 0)
st0020_device::set_is_jclub2o(*device, 1);
- MCFG_ST0020_SPRITES_GFXDECODE("gfxdecode")
MCFG_ST0020_SPRITES_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(darkhors_state,jclub2o)
diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp
index 46e762a799f..ae5ff7faed5 100644
--- a/src/mame/drivers/jongkyo.cpp
+++ b/src/mame/drivers/jongkyo.cpp
@@ -29,7 +29,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#define JONGKYO_CLOCK 18432000
@@ -491,11 +491,15 @@ void jongkyo_state::machine_reset()
static MACHINE_CONFIG_START( jongkyo, jongkyo_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80,JONGKYO_CLOCK/4)
+ MCFG_CPU_ADD("maincpu", SEGA_315_5084,JONGKYO_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(jongkyo_memmap)
MCFG_CPU_IO_MAP(jongkyo_portmap)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", jongkyo_state, irq0_line_hold)
+ MCFG_SEGACRPT_SET_SIZE(0x6c00)
+ MCFG_SEGACRPT_SET_NUMBANKS(8)
+ MCFG_SEGACRPT_SET_BANKSIZE(0x400)
+ // sega_decode(rom, opcodes, 0x6c00, convtable, 8, 0x400);
/* video hardware */
@@ -518,6 +522,7 @@ static MACHINE_CONFIG_START( jongkyo, jongkyo_state )
MACHINE_CONFIG_END
+
/*************************************
*
* ROM definition
@@ -552,27 +557,6 @@ ROM_END
DRIVER_INIT_MEMBER(jongkyo_state,jongkyo)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0x08,0xa8,0x88 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...0...0...1...1 */
- { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
- { 0x20,0xa0,0x00,0x80 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...1...1 */
- { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...1...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 } /* ...1...1...1...1 */
- };
UINT8 *rom = memregion("maincpu")->base();
@@ -584,8 +568,19 @@ DRIVER_INIT_MEMBER(jongkyo_state,jongkyo)
UINT8 *opcodes = auto_alloc_array(machine(), UINT8, 0x6c00+0x400*8);
+ segacrpt_z80_device* cpu = (segacrpt_z80_device*)machine().device(":maincpu");
+
+ if (!cpu)
+ {
+ fatalerror("can't find cpu!\n");
+ }
+ else
+ {
+ cpu->set_region_p(rom);
+ cpu->set_decrypted_p(opcodes);
+ }
+
/* then do the standard Sega decryption */
- sega_decode(rom, opcodes, 0x6c00, convtable, 8, 0x400);
membank("bank1")->configure_entries(0, 8, rom+0x6c00, 0x400);
membank("bank1d")->configure_entries(0, 8, opcodes+0x6c00, 0x400);
@@ -600,3 +595,5 @@ DRIVER_INIT_MEMBER(jongkyo_state,jongkyo)
*************************************/
GAME( 1985, jongkyo, 0, jongkyo, jongkyo, jongkyo_state, jongkyo, ROT0, "Kiwako", "Jongkyo", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
+
+
diff --git a/src/mame/drivers/jungleyo.cpp b/src/mame/drivers/jungleyo.cpp
new file mode 100644
index 00000000000..01c16722e79
--- /dev/null
+++ b/src/mame/drivers/jungleyo.cpp
@@ -0,0 +1,158 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+/*
+
+ CPUs
+QTY Type clock position function
+1x MC68HC000FN10 u3 16/32-bit Microprocessor - main
+1x u6295 u98 4-Channel Mixing ADCPM Voice Synthesis LSI - sound
+1x HA17358 u101 Dual Operational Amplifier - sound
+1x TDA2003 u104 Audio Amplifier - sound
+1x oscillator 12.000MHz osc1
+ROMs
+QTY Type position status
+2x M27C1001 2,3 dumped
+1x M27C2001 1 dumped
+3x M27C4001 4,5,6 dumped
+RAMs
+QTY Type position
+11x LH52B256-10PLL u16a,u17a,u27,u28,u29,u30,u39,u40,u74,u75,u76
+PLDs
+QTY Type position status
+1x ATF20V8B-15PC u37 read protected
+2x A40MX04-F-PL84 u83,u86 read protected
+Others
+
+1x 28x2 JAMMA edge connector
+1x pushbutton (SW1)
+1x trimmer (volume) (VR1)
+4x 8x2 switches DIP (SW1,SW2,SW3,SW4)
+1x battery 3.6V (BT1)
+Notes
+
+PCB silkscreened: "MADE IN TAIWAN YONSHI PCB NO-006F"
+
+*/
+
+
+
+#include "emu.h"
+#include "cpu/m68000/m68000.h"
+#include "sound/okim6295.h"
+
+
+class jungleyo_state : public driver_device
+{
+public:
+ jungleyo_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode") { }
+
+ /* memory pointers */
+
+ /* video-related */
+ virtual void video_start() override;
+ UINT32 screen_update_jungleyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+};
+
+void jungleyo_state::video_start()
+{
+}
+
+UINT32 jungleyo_state::screen_update_jungleyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ return 0;
+}
+
+
+static ADDRESS_MAP_START( jungleyo_map, AS_PROGRAM, 16, jungleyo_state )
+ AM_RANGE(0x000000, 0x03ffff) AM_ROM
+ADDRESS_MAP_END
+
+static INPUT_PORTS_START( jungleyo )
+INPUT_PORTS_END
+
+static const gfx_layout jungleyo_layout =
+{
+ 8,8,
+ RGN_FRAC(1,1),
+ 8,
+ { 0,1,2,3,4,5,6,7 },
+ { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 },
+ { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
+ 8*64
+};
+
+static const gfx_layout jungleyo16_layout =
+{
+ 8,32,
+ RGN_FRAC(1,1),
+ 8,
+ { 0,1,2,3,4,5,6,7 },
+ { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 },
+ { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
+ 8*64, 9*64,10*64,11*64,12*64,13*64,14*64,15*64,
+ 16*64,17*64,18*64,19*64,20*64,21*64,22*64,23*64,
+ 24*64,25*64,26*64,27*64,28*64,29*64,30*64,31*64 },
+ 8*64*4
+};
+
+
+static GFXDECODE_START( jungleyo )
+ GFXDECODE_ENTRY( "reelgfx", 0, jungleyo16_layout, 0x0, 2 )
+ GFXDECODE_ENTRY( "gfx2", 0, jungleyo_layout, 0x0, 2 )
+ GFXDECODE_ENTRY( "gfx3", 0, jungleyo_layout, 0x0, 2 )
+GFXDECODE_END
+
+
+static MACHINE_CONFIG_START( jungleyo, jungleyo_state )
+
+ MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz)
+ MCFG_CPU_PROGRAM_MAP(jungleyo_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", jungleyo_state, irq1_line_hold)
+
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", jungleyo)
+
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
+ MCFG_SCREEN_SIZE(64*8, 32*8)
+ MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
+ MCFG_SCREEN_UPDATE_DRIVER(jungleyo_state, screen_update_jungleyo)
+ MCFG_SCREEN_PALETTE("palette")
+
+ MCFG_PALETTE_ADD("palette", 0x200)
+ MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+
+ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
+
+ MCFG_OKIM6295_ADD("oki", XTAL_12MHz/16, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47)
+MACHINE_CONFIG_END
+
+
+ROM_START( jungleyo )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */ // encrypted?
+ ROM_LOAD16_BYTE( "jungle_(record)_rom3_vi3.02.u15", 0x00001, 0x20000, CRC(7c9f431e) SHA1(fb3f90c4fe59c938f36b30c5fa3af227031e7d7a) )
+ ROM_LOAD16_BYTE( "jungle_(record)_rom2_vi3.02.u14", 0x00000, 0x20000, CRC(f6a71260) SHA1(8e48cbb9d701ad968540244396820359afe97c28) )
+
+ ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
+ ROM_LOAD( "jungle_rom1.u99", 0x00000, 0x40000, CRC(05ef5b85) SHA1(ca7584646271c6adc7880eca5cf43a412340c522) )
+
+ ROM_REGION( 0x80000, "reelgfx", 0 )
+ ROM_LOAD( "jungle_rom4.u58", 0x000000, 0x80000, CRC(2f37da94) SHA1(6479e3bcff665316903964286d72df9822c05485) )
+
+ ROM_REGION( 0x80000, "gfx2", 0 )
+ ROM_LOAD( "jungle_rom5.u59", 0x000000, 0x80000, CRC(0ccd9b94) SHA1(f209c7e15967be2e43be018aca89edd0c311503e) )
+
+ ROM_REGION( 0x80000, "gfx3", 0 )
+ ROM_LOAD( "jungle_rom6.u60", 0x000000, 0x80000, CRC(caab8eb2) SHA1(472ca9f396d7c01a1bd03485581cfae677a3b365) )
+ROM_END
+
+
+GAME( 1999, jungleyo, 0, jungleyo, jungleyo, driver_device, 0, ROT0, "Yonshi", "Jungle (VI3.02)", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp
index b9c25759145..019f95e4492 100644
--- a/src/mame/drivers/kaneko16.cpp
+++ b/src/mame/drivers/kaneko16.cpp
@@ -2229,7 +2229,7 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_START( mgcrystl, kaneko16_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */
+ MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb, TMP68HC000N-12 @U31 and X2 is 12MHz */
MCFG_CPU_PROGRAM_MAP(mgcrystl)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kaneko16_state, kaneko16_interrupt, "screen", 0, 1)
@@ -3832,28 +3832,29 @@ ROM_START( mgcrystlo ) /* Master Up: 91/12/10 01:56:06 */
ROM_LOAD( "mc030.u32", 0x000000, 0x040000, CRC(c165962e) SHA1(f7e130db387ae9dcb7223f7ad6e51270d3033bc9) )
ROM_END
+// Note: there is a known undumped older Japan set from http://gamesdbase.com/Media/SYSTEM/Arcade/PCB/big/Magical_Crystals_-_1991_-_Kaneko.jpg with code roms ending in -00 instead of -02
ROM_START( mgcrystlj ) /* Master Up: 92/01/13 14:44:20 */
ROM_REGION( 0x040000*2, "maincpu", ROMREGION_ERASE ) /* 68000 Code */
- ROM_LOAD16_BYTE( "mc100j02.u18", 0x000000, 0x020000, CRC(afe5882d) SHA1(176e6e12e3df63c08d7aff781f5e5a9bd83ec293) ) /* Labeled as MC100J/U18-02 */
- ROM_LOAD16_BYTE( "mc101j02.u19", 0x000001, 0x040000, CRC(60da5492) SHA1(82b90a617d355825624ce9fb30bddf4714bd0d18) ) /* Labeled as MC101J/U19-02 */
+ ROM_LOAD16_BYTE( "kaneko__mc100-u18j-02.u18", 0x000000, 0x020000, CRC(afe5882d) SHA1(176e6e12e3df63c08d7aff781f5e5a9bd83ec293) ) /* Labeled as MC100J/U18-02 */
+ ROM_LOAD16_BYTE( "kaneko__mc101-u19j-02.u19", 0x000001, 0x040000, CRC(60da5492) SHA1(82b90a617d355825624ce9fb30bddf4714bd0d18) ) /* Labeled as MC101J/U19-02 */
ROM_REGION( 0x280000, "gfx1", 0 ) /* Sprites */
- ROM_LOAD( "mc000.u38", 0x000000, 0x100000, CRC(28acf6f4) SHA1(6647ad90ea580b65ed28772f9d65352b06833d0c) )
- ROM_LOAD( "mc001.u37", 0x100000, 0x080000, CRC(005bc43d) SHA1(6f6cd99e8e60562fa86581008455a6d9d646fa95) )
+ ROM_LOAD( "kaneko__mc-000_0001.u38", 0x000000, 0x100000, CRC(28acf6f4) SHA1(6647ad90ea580b65ed28772f9d65352b06833d0c) ) // Mask rom
+ ROM_LOAD( "kaneko__mc-001_0002_r44.u37", 0x100000, 0x080000, CRC(005bc43d) SHA1(6f6cd99e8e60562fa86581008455a6d9d646fa95) ) // Mask rom
ROM_RELOAD( 0x180000, 0x080000 )
- ROM_LOAD( "mc002e02.u36", 0x200000, 0x020000, CRC(27ac1056) SHA1(34b07c1a0d403ca45c9849d3d8d311012f787df6) ) /* Labeled as MC002J/U36-02, but same as MC002E/U36-02 */
+ ROM_LOAD( "kaneko__mc002j-u36-02.u36", 0x200000, 0x020000, CRC(27ac1056) SHA1(34b07c1a0d403ca45c9849d3d8d311012f787df6) ) /* Labeled as MC002J/U36-02, but same as MC002E/U36-02 */
ROM_RELOAD( 0x220000, 0x020000 )
ROM_RELOAD( 0x240000, 0x020000 )
ROM_RELOAD( 0x260000, 0x020000 )
ROM_REGION( 0x100000, "gfx2", 0 ) /* Tiles (Scrambled) */
- ROM_LOAD( "mc010.u04", 0x000000, 0x100000, CRC(85072772) SHA1(25e903cc2c893d61db791d1fe60a1205a4395667) )
+ ROM_LOAD( "kaneko__mc-010_0003.u04", 0x000000, 0x100000, CRC(85072772) SHA1(25e903cc2c893d61db791d1fe60a1205a4395667) ) // Mask rom
ROM_REGION( 0x100000, "gfx3", 0 ) /* Tiles (Scrambled) */
- ROM_LOAD( "mc020.u34", 0x000000, 0x100000, CRC(1ea92ff1) SHA1(66ec53e664b2a5a751a280a538aaeceafc187ceb) )
+ ROM_LOAD( "kaneko__mc-020_0004.u34", 0x000000, 0x100000, CRC(1ea92ff1) SHA1(66ec53e664b2a5a751a280a538aaeceafc187ceb) ) // Mask rom
ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
- ROM_LOAD( "mc030.u32", 0x000000, 0x040000, CRC(c165962e) SHA1(f7e130db387ae9dcb7223f7ad6e51270d3033bc9) )
+ ROM_LOAD( "kaneko__mc-030_0005_t99.u32", 0x000000, 0x040000, CRC(c165962e) SHA1(f7e130db387ae9dcb7223f7ad6e51270d3033bc9) )
ROM_END
diff --git a/src/mame/drivers/karnov.cpp b/src/mame/drivers/karnov.cpp
index 9737c94c80d..3f602083f66 100644
--- a/src/mame/drivers/karnov.cpp
+++ b/src/mame/drivers/karnov.cpp
@@ -816,9 +816,8 @@ static MACHINE_CONFIG_START( karnov, karnov_state )
MCFG_PALETTE_INIT_OWNER(karnov_state, karnov)
MCFG_DEVICE_ADD("spritegen", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 2);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(2)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(karnov_state,karnov)
@@ -880,9 +879,8 @@ static MACHINE_CONFIG_START( wndrplnt, karnov_state )
MCFG_PALETTE_INIT_OWNER(karnov_state, karnov)
MCFG_DEVICE_ADD("spritegen", DECO_KARNOVSPRITES, 0)
- deco_karnovsprites_device::set_gfx_region(*device, 2);
+ MCFG_DECO_KARNOVSPRITES_GFX_REGION(2)
MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode")
- MCFG_DECO_KARNOVSPRITES_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(karnov_state,wndrplnt)
diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp
index f134febe790..6aeee176b81 100644
--- a/src/mame/drivers/konamigx.cpp
+++ b/src/mame/drivers/konamigx.cpp
@@ -1583,7 +1583,7 @@ static GFXDECODE_START( racinfrc )
GFXDECODE_END
/* type 3 & 4 games use a simple 8bpp decode for the 53936 */
-static GFXDECODE_START( type34 )
+static GFXDECODE_START( type3 )
GFXDECODE_ENTRY( "gfx3", 0, bglayout_8bpp, 0x1000, 8 )
GFXDECODE_END
@@ -1646,12 +1646,9 @@ static MACHINE_CONFIG_START( konamigx, konamigx_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_ENABLE_HILIGHTS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(konamigx_state, type2_tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_K055555_ADD("k055555")
@@ -1663,9 +1660,8 @@ static MACHINE_CONFIG_START( konamigx, konamigx_state )
MCFG_DEVICE_ADD("k055673", K055673, 0)
MCFG_K055673_CB(konamigx_state, type2_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -26, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -26, -23)
MCFG_K055673_SET_SCREEN("screen")
- MCFG_K055673_GFXDECODE("gfxdecode")
MCFG_K055673_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_5bpp)
@@ -1698,12 +1694,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( konamigx_bios, konamigx )
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 0, 0, "k055555")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 0, 0, "k055555")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gokuparo, konamigx )
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -46, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -46, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sexyparo, konamigx )
@@ -1711,12 +1707,12 @@ static MACHINE_CONFIG_DERIVED( sexyparo, konamigx )
MCFG_K056832_CB(konamigx_state, alpha_tile_callback)
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -42, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -42, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( tbyahhoo, konamigx )
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "k055555")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "k055555")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( dragoonj, konamigx )
@@ -1727,11 +1723,11 @@ static MACHINE_CONFIG_DERIVED( dragoonj, konamigx )
MCFG_K053252_OFFSETS(24+16, 16)
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 1, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 1, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(konamigx_state, dragoonj_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_RNG, -53, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_RNG, -53, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( le2, konamigx )
@@ -1739,41 +1735,42 @@ static MACHINE_CONFIG_DERIVED( le2, konamigx )
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", konamigx_state, konamigx_type2_scanline, "screen", 0, 1)
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 1, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(konamigx_state, le2_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_LE2, -46, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_LE2, -46, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( konamigx_6bpp, konamigx )
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_6bpp)
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -46, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -46, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( salmndr2, konamigx )
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 1, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 1, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(konamigx_state, salmndr2_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -48, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -48, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( opengolf, konamigx )
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_RAW_PARAMS(8000000, 384+24+64+40, 0, 383, 224+16+8+16, 0, 223)
MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1)
- MCFG_GFXDECODE_MODIFY("gfxdecode", opengolf)
+
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", opengolf)
MCFG_VIDEO_START_OVERRIDE(konamigx_state, opengolf)
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -53, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -53, -23)
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(gx_type1_map)
@@ -1786,17 +1783,18 @@ static MACHINE_CONFIG_DERIVED( racinfrc, konamigx )
MCFG_SCREEN_MODIFY("screen")
//MCFG_SCREEN_RAW_PARAMS(6000000, 384+24+64+40, 0, 383, 224+16+8+16, 0, 223)
//MCFG_SCREEN_VISIBLE_AREA(32, 32+384-1, 16, 16+224-1)
- MCFG_GFXDECODE_MODIFY("gfxdecode", racinfrc)
+
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", racinfrc)
MCFG_VIDEO_START_OVERRIDE(konamigx_state, racinfrc)
MCFG_DEVICE_MODIFY("k053252")
MCFG_K053252_OFFSETS(24-8+16, 0)
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -53, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -53, -23)
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(gx_type1_map)
@@ -1813,6 +1811,7 @@ static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )
MCFG_DEFAULT_LAYOUT(layout_dualhsxs)
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", type3)
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_type3)
MCFG_DEVICE_MODIFY("k053252")
@@ -1820,10 +1819,10 @@ static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )
MCFG_K053252_SET_SLAVE_SCREEN("screen2")
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 2, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 2, "none")
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -132, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -132, -23)
MCFG_DEVICE_REMOVE("palette")
MCFG_PALETTE_ADD("palette", 16384)
@@ -1842,8 +1841,6 @@ static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )
MCFG_SCREEN_SIZE(1024, 1024)
MCFG_SCREEN_VISIBLE_AREA(0, 576-1, 16, 32*8-1-16)
MCFG_SCREEN_UPDATE_DRIVER(konamigx_state, screen_update_konamigx_right)
-
- MCFG_GFXDECODE_MODIFY("gfxdecode", type34)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gxtype4, konamigx )
@@ -1872,7 +1869,7 @@ static MACHINE_CONFIG_DERIVED( gxtype4, konamigx )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_ENABLE_HILIGHTS()
- MCFG_GFXDECODE_MODIFY("gfxdecode", type4)
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", type4)
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_type4)
MCFG_DEVICE_MODIFY("k053252")
@@ -1881,10 +1878,10 @@ static MACHINE_CONFIG_DERIVED( gxtype4, konamigx )
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 0, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 0, "none")
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -79, -24) // -23 looks better in intro
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -79, -24) // -23 looks better in intro
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gxtype4_vsn, gxtype4 )
@@ -1905,17 +1902,17 @@ static MACHINE_CONFIG_DERIVED( gxtype4_vsn, gxtype4 )
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_type4_vsn)
MCFG_DEVICE_MODIFY("k056832")
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 2, "none") // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2, "none") // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -132, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -132, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gxtype4sd2, gxtype4 )
MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_type4_sd2)
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -81, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -81, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( winspike, konamigx )
@@ -1927,10 +1924,10 @@ static MACHINE_CONFIG_DERIVED( winspike, konamigx )
MCFG_DEVICE_MODIFY("k056832")
MCFG_K056832_CB(konamigx_state, alpha_tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 2, "none")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2, "none")
MCFG_DEVICE_MODIFY("k055673")
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_LE2, -53, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_LE2, -53, -23)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ksys573.cpp b/src/mame/drivers/ksys573.cpp
index 18de66cf40d..28def903b4d 100644
--- a/src/mame/drivers/ksys573.cpp
+++ b/src/mame/drivers/ksys573.cpp
@@ -2750,11 +2750,22 @@ static INPUT_PORTS_START( hyperbbc )
PORT_INCLUDE( konami573 )
PORT_MODIFY( "IN2" )
-
- PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER( 3 ) /* P1 LEFT */
- PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER( 3 ) /* P1 RIGHT */
- PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_START3 ) /* P1 UP */
- PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER( 3 ) /* P1 DOWN */
+ PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER( 3 )
+ PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER( 3 )
+ PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_START3 )
+ PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER( 3 )
+ PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_MODIFY( "IN3" )
+ PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
static INPUT_PORTS_START( hypbbc2p )
diff --git a/src/mame/drivers/lastbank.cpp b/src/mame/drivers/lastbank.cpp
index 75bafbb6d6c..14c2cb772a6 100644
--- a/src/mame/drivers/lastbank.cpp
+++ b/src/mame/drivers/lastbank.cpp
@@ -483,7 +483,6 @@ static MACHINE_CONFIG_START( lastbank, lastbank_state )
MCFG_DEVICE_ADD("tc0091lvc", TC0091LVC, 0)
MCFG_TC0091LVC_GFXDECODE("gfxdecode")
- MCFG_TC0091LVC_PALETTE("palette")
// MCFG_VIDEO_START_OVERRIDE(lastbank_state,lastbank)
diff --git a/src/mame/drivers/leapster.cpp b/src/mame/drivers/leapster.cpp
index 7f53fea59d4..b46d07e385b 100644
--- a/src/mame/drivers/leapster.cpp
+++ b/src/mame/drivers/leapster.cpp
@@ -329,7 +329,7 @@ ROM_END
ROM_START(leapstertv)
ROM_REGION(0x200000, "maincpu", ROMREGION_ERASE00)
- ROM_LOAD( "am29pl160cb-90sf.bin", 0x00000, 0x200000, BAD_DUMP CRC(dc281f1f) SHA1(17588de54ab3bb82801bd5062f3e6aa687412178) )
+ ROM_LOAD( "am29pl160cb-90sf.bin", 0x00000, 0x200000, CRC(194cc724) SHA1(000a79d75c19f2e43532ce0b31f0dca0bed49eab) )
ROM_END
DRIVER_INIT_MEMBER(leapster_state,leapster)
diff --git a/src/mame/drivers/lemmings.cpp b/src/mame/drivers/lemmings.cpp
index 5af69bba418..0c427a4c14f 100644
--- a/src/mame/drivers/lemmings.cpp
+++ b/src/mame/drivers/lemmings.cpp
@@ -260,12 +260,10 @@ static MACHINE_CONFIG_START( lemmings, lemmings_state )
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(1)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(0)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR
diff --git a/src/mame/drivers/lethal.cpp b/src/mame/drivers/lethal.cpp
index fb6ce38d331..bd834f9fd94 100644
--- a/src/mame/drivers/lethal.cpp
+++ b/src/mame/drivers/lethal.cpp
@@ -509,8 +509,6 @@ static MACHINE_CONFIG_START( lethalen, lethal_state )
MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(59.62) /* verified on pcb */
@@ -526,8 +524,7 @@ static MACHINE_CONFIG_START( lethalen, lethal_state )
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(lethal_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8LE, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8LE, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053244", K053244, 0)
diff --git a/src/mame/drivers/m92.cpp b/src/mame/drivers/m92.cpp
index 2ff72f43b87..f4934be8fe6 100644
--- a/src/mame/drivers/m92.cpp
+++ b/src/mame/drivers/m92.cpp
@@ -1180,23 +1180,23 @@ ROM_START( skingame )
ROM_LOAD16_BYTE( "is-l1.5j", 0x80000, 0x40000, CRC(e4e00626) SHA1(e8c6c7ad6a367da4036915a155c8695ad90ae47b) )
ROM_REGION( 0x20000, "soundcpu", 0 )
- ROM_LOAD16_BYTE( "mt2sh0", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
- ROM_LOAD16_BYTE( "mt2sl0", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
+ ROM_LOAD16_BYTE( "mt2-sh0-.ic14", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
+ ROM_LOAD16_BYTE( "mt2-sl0-.ic17", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
- ROM_LOAD( "c0", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
- ROM_LOAD( "c1", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
- ROM_LOAD( "c2", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
- ROM_LOAD( "c3", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
- ROM_LOAD( "k30", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
- ROM_LOAD( "k31", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
- ROM_LOAD( "k32", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
- ROM_LOAD( "k33", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
ROM_REGION( 0x80000, "irem", 0 )
- ROM_LOAD( "da", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
@@ -1217,23 +1217,23 @@ ROM_START( majtitl2 )
ROM_LOAD16_BYTE( "is-l1.5j", 0x80000, 0x40000, CRC(e4e00626) SHA1(e8c6c7ad6a367da4036915a155c8695ad90ae47b) )
ROM_REGION( 0x20000, "soundcpu", 0 )
- ROM_LOAD16_BYTE( "mt2sh0", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
- ROM_LOAD16_BYTE( "mt2sl0", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
+ ROM_LOAD16_BYTE( "mt2-sh0-.ic14", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
+ ROM_LOAD16_BYTE( "mt2-sl0-.ic17", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
- ROM_LOAD( "c0", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
- ROM_LOAD( "c1", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
- ROM_LOAD( "c2", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
- ROM_LOAD( "c3", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
- ROM_LOAD( "k30", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
- ROM_LOAD( "k31", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
- ROM_LOAD( "k32", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
- ROM_LOAD( "k33", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
ROM_REGION( 0x80000, "irem", 0 )
- ROM_LOAD( "da", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
@@ -1246,6 +1246,45 @@ ROM_START( majtitl2 )
ROM_LOAD( "pal16l8-m92-b-7h.ic47", 0x0800, 0x0104, NO_DUMP ) /* PAL is read protected */
ROM_END
+
+ROM_START( majtitl2b )
+ ROM_REGION( 0x100000, "maincpu", 0 )
+ ROM_LOAD16_BYTE( "mt2-h0-e.ic34", 0x00001, 0x40000, CRC(f6c3a28c) SHA1(27ef76c120d27119830e6b17353d2a6412cbcbbe) )
+ ROM_LOAD16_BYTE( "mt2-l0-e.ic31", 0x00000, 0x40000, CRC(0a061384) SHA1(b033215bb99e645a00e7a364cebb895432917fd4) )
+ ROM_LOAD16_BYTE( "mt2-h1-.ic33", 0x80001, 0x40000, CRC(9ba8e1f2) SHA1(ae86697a97223d236e2e6dd33ddb8105b9f926cb) )
+ ROM_LOAD16_BYTE( "mt2-l1-.ic32", 0x80000, 0x40000, CRC(e4e00626) SHA1(e8c6c7ad6a367da4036915a155c8695ad90ae47b) )
+
+ ROM_REGION( 0x20000, "soundcpu", 0 )
+ ROM_LOAD16_BYTE( "mt2-sh0-.ic14", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
+ ROM_LOAD16_BYTE( "mt2-sl0-.ic17", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
+
+ ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+
+ ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+
+ ROM_REGION( 0x80000, "irem", 0 )
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+
+ ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
+ ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
+
+ ROM_REGION( 0x0c00, "plds", 0 )
+ ROM_LOAD( "pal16l8-m92-a-3m.ic11", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
+ ROM_LOAD( "pal16l8-m92-a-7j.ic41", 0x0200, 0x0104, NO_DUMP ) /* PAL is read protected */
+ ROM_LOAD( "pal16l8-m92-a-9j.ic51", 0x0400, 0x0104, NO_DUMP ) /* PAL is read protected */
+ ROM_LOAD( "pal16l8-m92-b-2l.ic7", 0x0600, 0x0104, NO_DUMP ) /* PAL is read protected */
+ ROM_LOAD( "pal16l8-m92-b-7h.ic47", 0x0800, 0x0104, NO_DUMP ) /* PAL is read protected */
+ROM_END
+
+
// this set matches the 'majtitl2' except for the soundcpu roms, which are for a different CPU
ROM_START( majtitl2a )
ROM_REGION( 0x100000, "maincpu", 0 ) // labels differ from 'majtitl2' (maybe the 'B' has faded, or was never there?)
@@ -1259,20 +1298,20 @@ ROM_START( majtitl2a )
ROM_LOAD16_BYTE( "mt2sl0-a", 0x00000, 0x10000, CRC(f4ecd7b5) SHA1(250afed334d37b0309f4733b41ba03319b51360f))
ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
- ROM_LOAD( "c0", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
- ROM_LOAD( "c1", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
- ROM_LOAD( "c2", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
- ROM_LOAD( "c3", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
- ROM_LOAD( "k30", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
- ROM_LOAD( "k31", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
- ROM_LOAD( "k32", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
- ROM_LOAD( "k33", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
ROM_REGION( 0x80000, "irem", 0 )
- ROM_LOAD( "da", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
-
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+
ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
@@ -1292,23 +1331,23 @@ ROM_START( majtitl2j )
ROM_LOAD16_BYTE( "is-l1.5j", 0x80000, 0x40000, CRC(e4e00626) SHA1(e8c6c7ad6a367da4036915a155c8695ad90ae47b) )
ROM_REGION( 0x20000, "soundcpu", 0 )
- ROM_LOAD16_BYTE( "mt2sh0", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
- ROM_LOAD16_BYTE( "mt2sl0", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
+ ROM_LOAD16_BYTE( "mt2-sh0-.ic14", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
+ ROM_LOAD16_BYTE( "mt2-sl0-.ic17", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
- ROM_LOAD( "c0", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
- ROM_LOAD( "c1", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
- ROM_LOAD( "c2", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
- ROM_LOAD( "c3", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
- ROM_LOAD( "k30", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
- ROM_LOAD( "k31", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
- ROM_LOAD( "k32", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
- ROM_LOAD( "k33", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
ROM_REGION( 0x80000, "irem", 0 )
- ROM_LOAD( "da", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
@@ -1329,23 +1368,23 @@ ROM_START( skingame2 )
ROM_LOAD16_BYTE( "is-l1.5j", 0x80000, 0x40000, CRC(e4e00626) SHA1(e8c6c7ad6a367da4036915a155c8695ad90ae47b) )
ROM_REGION( 0x20000, "soundcpu", 0 )
- ROM_LOAD16_BYTE( "mt2sh0", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
- ROM_LOAD16_BYTE( "mt2sl0", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
+ ROM_LOAD16_BYTE( "mt2-sh0-.ic14", 0x00001, 0x10000, CRC(1ecbea43) SHA1(8d66ef419f75569f2c83a89c3985742b8a47914f) )
+ ROM_LOAD16_BYTE( "mt2-sl0-.ic17", 0x00000, 0x10000, CRC(8fd5b531) SHA1(92cae3f6dac7f89b559063de3be2f38587536b65) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* Tiles */
- ROM_LOAD( "c0", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
- ROM_LOAD( "c1", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
- ROM_LOAD( "c2", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
- ROM_LOAD( "c3", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
+ ROM_LOAD( "hr0.ic9", 0x000000, 0x40000, CRC(7e61e4b5) SHA1(d0164862937bd506e701777c51dea1ddb3e2eda4) )
+ ROM_LOAD( "hr1.ic10", 0x040000, 0x40000, CRC(0a667564) SHA1(d122e0619ae5cc0202f30270933784c954eb1e5d) )
+ ROM_LOAD( "hr2.ic11", 0x080000, 0x40000, CRC(5eb44312) SHA1(75b584b63d4f4f2236a679235461f11004aa317f) )
+ ROM_LOAD( "hr3.ic12", 0x0c0000, 0x40000, CRC(f2866294) SHA1(75e0071bf6282c93034dc7e73466af0f51046d01) )
ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */
- ROM_LOAD( "k30", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
- ROM_LOAD( "k31", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
- ROM_LOAD( "k32", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
- ROM_LOAD( "k33", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
+ ROM_LOAD( "k30.ic42", 0x000000, 0x100000, CRC(8c9a2678) SHA1(e8ed119c16ddd59af9e83d243e7be25974f7cbf8) )
+ ROM_LOAD( "k31.ic43", 0x100000, 0x100000, CRC(5455df78) SHA1(9e49bde1d5a310ff611932c3429601fbddf3a7b1) )
+ ROM_LOAD( "k32.ic44", 0x200000, 0x100000, CRC(3a258c41) SHA1(1d93fcd01728929848b782870f80a8cd0af44796) )
+ ROM_LOAD( "k33.ic45", 0x300000, 0x100000, CRC(c1e91a14) SHA1(1f0dbd99d8c5067dc3f8795fc3f1bd4466f64156) )
ROM_REGION( 0x80000, "irem", 0 )
- ROM_LOAD( "da", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
+ ROM_LOAD( "k0d.ic8", 0x000000, 0x80000, CRC(713b9e9f) SHA1(91384d67d4ba9c7d926fbecb077293c661b8ec83) )
ROM_REGION( 0x4000, "eeprom", 0 ) /* D28C64C-20 EEPROM */
ROM_LOAD( "mt2eep", 0x000000, 0x800, CRC(208af971) SHA1(69384cac24b7af35a031f9b60e035131a8b10cb2) )
@@ -2269,8 +2308,9 @@ GAME( 1992, gunhohki, mysticri, mysticri, mysticri, m92_state, m92, RO
// main code is also significantly different to the supported original set, so it might just be a legitimate early revision on a cheap board
GAME( 1992, mysticrib,mysticri, mysticri, mysticri, m92_state, m92, ROT0, "Irem", "Mystic Riders (bootleg?)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
-GAME( 1992, majtitl2, 0, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL) // Nanao 08J27291A7 017 9227NK700 sound CPU
-GAME( 1992, majtitl2a,majtitl2, mysticri, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (World, alt sound CPU)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL) // Nanao 08J27291A6 016 9217NK700 sound CPU
+GAME( 1992, majtitl2, 0, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (World, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL) // Nanao 08J27291A7 017 9227NK700 sound CPU
+GAME( 1992, majtitl2a,majtitl2, mysticri, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (World, set 1, alt sound CPU)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL) // same as set 1 but for the Nanao 08J27291A6 016 9217NK700 sound CPU
+GAME( 1992, majtitl2b,majtitl2, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (World, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL)
GAME( 1992, majtitl2j,majtitl2, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem", "Major Title 2 (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL)
GAME( 1992, skingame, majtitl2, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem America", "The Irem Skins Game (US set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
GAME( 1992, skingame2,majtitl2, majtitl2, majtitl2, m92_state, majtitl2, ROT0, "Irem America", "The Irem Skins Game (US set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
diff --git a/src/mame/drivers/macs.cpp b/src/mame/drivers/macs.cpp
index 0bcdb63d3ce..349646427ad 100644
--- a/src/mame/drivers/macs.cpp
+++ b/src/mame/drivers/macs.cpp
@@ -60,6 +60,8 @@ KISEKAE -- info
#include "emu.h"
#include "machine/st0016.h"
+#include "bus/generic/slot.h"
+#include "bus/generic/carts.h"
class macs_state : public driver_device
{
@@ -67,8 +69,9 @@ public:
macs_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_ram2(*this, "ram2"),
- m_maincpu(*this,"maincpu")
-
+ m_maincpu(*this,"maincpu"),
+ m_cart1(*this, "slot_a"),
+ m_cart2(*this, "slot_b")
{ }
UINT8 m_mux_data;
@@ -84,17 +87,18 @@ public:
DECLARE_DRIVER_INIT(kisekaem);
DECLARE_DRIVER_INIT(macs2);
DECLARE_MACHINE_RESET(macs);
+ DECLARE_MACHINE_START(macs);
UINT32 screen_update_macs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
optional_device<st0016_cpu_device> m_maincpu;
+ optional_device<generic_slot_device> m_cart1;
+ optional_device<generic_slot_device> m_cart2;
};
-
-
static ADDRESS_MAP_START( macs_mem, AS_PROGRAM, 8, macs_state )
AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank4")
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
@@ -111,7 +115,7 @@ ADDRESS_MAP_END
WRITE8_MEMBER(macs_state::rambank_w)
{
- membank("bank3")->set_base(&m_ram1[0x10000+(data&1)*0x800] );
+ membank("bank3")->set_entry(2 + (data & 1));
}
READ8_MEMBER(macs_state::macs_input_r)
@@ -149,16 +153,12 @@ READ8_MEMBER(macs_state::macs_input_r)
WRITE8_MEMBER(macs_state::macs_rom_bank_w)
{
- membank("bank1")->set_base(memregion("maincpu")->base() + (data* 0x4000) + macs_cart_slot*0x400000 );
-
-// m_st0016_rom_bank=data;
+ membank("bank1")->set_entry(macs_cart_slot * 0x100 + data);
}
WRITE8_MEMBER(macs_state::macs_output_w)
{
- UINT8 *ROM = memregion("maincpu")->base();
-
- switch(offset)
+ switch(offset)
{
case 0:
/*
@@ -169,16 +169,16 @@ WRITE8_MEMBER(macs_state::macs_output_w)
if(m_rev == 1)
{
- /* FIXME: dunno if this RAM bank is right, DASM tracking made on the POST screens indicates that there's just one RAM bank,
- but then MACS2 games locks up. */
- membank("bank3")->set_base(&m_ram1[((data&0x20)>>5)*0x1000+0x000] );
+ /* FIXME: dunno if this RAM bank is right, DASM tracking made on the POST
+ screens indicates that there's just one RAM bank, but then MACS2 games
+ locks up. */
+ membank("bank3")->set_entry(BIT(data, 5));
macs_cart_slot = (data & 0xc) >> 2;
-
- membank("bank4")->set_base(&ROM[macs_cart_slot*0x400000] );
+ membank("bank4")->set_entry(macs_cart_slot * 0x100);
}
- membank("bank2")->set_base(&m_ram1[((data&0x20)>>5)*0x1000+0x800] );
+ membank("bank2")->set_entry(BIT(data, 5));
break;
case 2: m_mux_data = data; break;
@@ -492,6 +492,7 @@ static MACHINE_CONFIG_START( macs, macs_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", macs_state, irq0_line_hold)
+ MCFG_MACHINE_START_OVERRIDE(macs_state,macs)
MCFG_MACHINE_RESET_OVERRIDE(macs_state,macs)
/* video hardware */
@@ -502,91 +503,90 @@ static MACHINE_CONFIG_START( macs, macs_state )
MCFG_SCREEN_VISIBLE_AREA(0*8, 128*8-1, 0*8, 128*8-1)
MCFG_SCREEN_UPDATE_DRIVER(macs_state, screen_update_macs)
MCFG_SCREEN_PALETTE("maincpu:palette")
-MACHINE_CONFIG_END
+ MCFG_GENERIC_CARTSLOT_ADD_WITH_DEFAULT("slot_a", generic_plain_slot, "macs_cart", "rom")
+ MCFG_SET_IMAGE_LOADABLE(FALSE)
+ MCFG_GENERIC_CARTSLOT_ADD_WITH_DEFAULT("slot_b", generic_plain_slot, "macs_cart", "rom")
+ MCFG_SET_IMAGE_LOADABLE(FALSE)
+
+MACHINE_CONFIG_END
#define MACS_BIOS \
- ROM_REGION( 0x1000000, "user1", 0 ) \
+ ROM_REGION( 0x1000000, "bios", 0 ) \
ROM_LOAD16_BYTE( "macsos_l.u43", 0x00000, 0x80000, CRC(0b5aed5e) SHA1(042e705017ee34656e2c6af45825bb2dd3447747) ) \
ROM_LOAD16_BYTE( "macsos_h.u44", 0x00001, 0x80000, CRC(538b68e4) SHA1(a0534147791e94e726f49451d0e95671ae0a87d5) )
+
#define MACS2_BIOS \
- ROM_REGION( 0x1000000, "user1", 0 ) \
+ ROM_REGION( 0x1000000, "bios", 0 ) \
ROM_LOAD16_BYTE( "macs2os_l.bin", 0x00000, 0x80000, NO_DUMP ) \
ROM_LOAD16_BYTE( "macs2os_h.bin", 0x00001, 0x80000, NO_DUMP )
+
ROM_START( macsbios )
MACS_BIOS
- ROM_REGION( 0x400000, "user2", ROMREGION_ERASEFF ) // Slot A
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user1", 0x000000, 0x000000, 0x400000 ) // Bios
+ ROM_COPY( "bios", 0x000000, 0x000000, 0x400000 )
+
+ ROM_REGION( 0x400000, "slot_a:rom", ROMREGION_ERASEFF )
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASEFF )
ROM_END
ROM_START( mac2bios )
MACS2_BIOS
- ROM_REGION( 0x400000, "user2", ROMREGION_ERASEFF ) // Slot A
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user1", 0x000000, 0x000000, 0x400000 ) // Bios
+ ROM_COPY( "bios", 0x000000, 0x000000, 0x400000 )
+
+ ROM_REGION( 0x400000, "slot_a:rom", ROMREGION_ERASEFF )
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASEFF )
ROM_END
ROM_START( kisekaem )
MACS_BIOS
- ROM_REGION( 0x400000, "user2", 0 ) // Slot A
- ROM_LOAD16_BYTE( "am-mj.u8", 0x000000, 0x100000, CRC(3cf85151) SHA1(e05400065c384730f04ef565db5ba27eb3973d15) )
- ROM_LOAD16_BYTE( "am-mj.u7", 0x000001, 0x100000, CRC(4b645354) SHA1(1dbf9141c3724e5dff2cd8066117fb1b94671a80) )
- ROM_LOAD16_BYTE( "am-mj.u6", 0x200000, 0x100000, CRC(23b3aa24) SHA1(bfabdb16f9b1b60230bb636a944ab46fdfda49d7) )
- ROM_LOAD16_BYTE( "am-mj.u5", 0x200001, 0x100000, CRC(b4d53e29) SHA1(d7683fdd5531bf1aa0ef1e4e6f517b31e2d5829e) )
-
-
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
-
ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user1", 0x000000, 0x000000, 0x400000 ) // Bios
- ROM_COPY( "user2", 0x000000, 0x400000, 0x400000 ) // Slot A
+ ROM_COPY( "bios", 0x000000, 0x000000, 0x400000 )
+
+ ROM_REGION( 0x400000, "slot_a:rom", 0 )
+ ROM_LOAD16_BYTE( "am-mj.u8", 0x000000, 0x100000, CRC(3cf85151) SHA1(e05400065c384730f04ef565db5ba27eb3973d15) )
+ ROM_LOAD16_BYTE( "am-mj.u7", 0x000001, 0x100000, CRC(4b645354) SHA1(1dbf9141c3724e5dff2cd8066117fb1b94671a80) )
+ ROM_LOAD16_BYTE( "am-mj.u6", 0x200000, 0x100000, CRC(23b3aa24) SHA1(bfabdb16f9b1b60230bb636a944ab46fdfda49d7) )
+ ROM_LOAD16_BYTE( "am-mj.u5", 0x200001, 0x100000, CRC(b4d53e29) SHA1(d7683fdd5531bf1aa0ef1e4e6f517b31e2d5829e) )
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASEFF )
ROM_END
ROM_START( kisekaeh )
MACS_BIOS
- ROM_REGION( 0x400000, "user2", 0 ) // Slot A
- ROM_LOAD16_BYTE( "kh-u8.bin", 0x000000, 0x100000, CRC(601b9e6a) SHA1(54508a6db3928f78897df64ce400791e4789d0f6) )
- ROM_LOAD16_BYTE( "kh-u7.bin", 0x000001, 0x100000, CRC(8f6e4bb3) SHA1(361545189feeda0887f930727d25655309b84629) )
- ROM_LOAD16_BYTE( "kh-u6.bin", 0x200000, 0x100000, CRC(8e700204) SHA1(876e5530d749828de077293cb109a71b67cef140) )
- ROM_LOAD16_BYTE( "kh-u5.bin", 0x200001, 0x100000, CRC(709bf7c8) SHA1(0a93e0c4f9be22a3302a1c5d2a6ec4739b202ea8) )
-
-
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
-
ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user1", 0x000000, 0x000000, 0x400000 ) // Bios
- ROM_COPY( "user2", 0x000000, 0x400000, 0x400000 ) // Slot A
+ ROM_COPY( "bios", 0x000000, 0x000000, 0x400000 )
+
+ ROM_REGION( 0x400000, "slot_a:rom", 0 )
+ ROM_LOAD16_BYTE( "kh-u8.bin", 0x000000, 0x100000, CRC(601b9e6a) SHA1(54508a6db3928f78897df64ce400791e4789d0f6) )
+ ROM_LOAD16_BYTE( "kh-u7.bin", 0x000001, 0x100000, CRC(8f6e4bb3) SHA1(361545189feeda0887f930727d25655309b84629) )
+ ROM_LOAD16_BYTE( "kh-u6.bin", 0x200000, 0x100000, CRC(8e700204) SHA1(876e5530d749828de077293cb109a71b67cef140) )
+ ROM_LOAD16_BYTE( "kh-u5.bin", 0x200001, 0x100000, CRC(709bf7c8) SHA1(0a93e0c4f9be22a3302a1c5d2a6ec4739b202ea8) )
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASEFF )
ROM_END
ROM_START( cultname ) // uses printer - two different games ? (slot a - checks for printer, slot b - not)
MACS_BIOS
- ROM_REGION( 0x400000, "user2", 0 ) // Slot A
+ ROM_REGION( 0x1000000, "maincpu", 0 )
+ ROM_COPY( "bios", 0x000000, 0x000000, 0x400000 )
+
+ ROM_REGION( 0x400000, "slot_a:rom", 0 )
ROM_LOAD16_BYTE( "cult-d0.u8", 0x000000, 0x100000, CRC(394bc1a6) SHA1(98df5406862234815b46c7b0ac0b19e4b597d1b6) )
ROM_LOAD16_BYTE( "cult-d1.u7", 0x000001, 0x100000, CRC(f628133b) SHA1(f06e20212074e5d95cc7d419ac8ce98fb9be3b62) )
ROM_LOAD16_BYTE( "cult-d2.u6", 0x200000, 0x100000, CRC(c5521bc6) SHA1(7554b56b0201b7d81754defa2244fb7ff7452bf6) )
ROM_LOAD16_BYTE( "cult-d3.u5", 0x200001, 0x100000, CRC(4325b09b) SHA1(45699a0444a221f893724754c917d33041cabcb9) )
-
- ROM_REGION( 0x400000, "user3", 0 ) // Slot B
+ ROM_REGION( 0x400000, "slot_b:rom", 0 )
ROM_LOAD16_BYTE( "cult-g0.u8", 0x000000, 0x100000, CRC(f5ab977b) SHA1(e7ee758cc2864500b339e236b944f98df9a1c10e) )
ROM_LOAD16_BYTE( "cult-g1.u7", 0x000001, 0x100000, CRC(32ae15a4) SHA1(061992efec1ed5527f200bf4c111344b156e759d) )
ROM_LOAD16_BYTE( "cult-g2.u6", 0x200000, 0x100000, CRC(30ed056d) SHA1(71735339bb501b94402ef403b5a2a60effa39c36) )
ROM_LOAD16_BYTE( "cult-g3.u5", 0x200001, 0x100000, CRC(fe58b418) SHA1(512f5c544cfafaa98bd2b3791ff1cf67adecec8d) )
-
-
- ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user1", 0x000000, 0x000000, 0x400000 ) // Bios
- ROM_COPY( "user2", 0x000000, 0x400000, 0x400000 ) // Slot A
- ROM_COPY( "user3", 0x000000, 0x800000, 0x400000 ) // Slot B
ROM_END
/* these are listed as MACS2 sub-boards, is it the same? - it's not ;) */
@@ -594,31 +594,31 @@ ROM_END
ROM_START( yuka )
MACS2_BIOS
- ROM_REGION( 0x400000, "user2", 0 ) // Slot A
+ ROM_REGION( 0x400000, "slot_a:rom", 0 )
ROM_LOAD16_BYTE( "yu-ka_2.u6", 0x000001, 0x100000, CRC(c3c5728b) SHA1(e53cdcae556f34bab45d9342fd78ec29b6543c46) )
ROM_LOAD16_BYTE( "yu-ka_4.u5", 0x000000, 0x100000, CRC(7e391ee6) SHA1(3a0c122c9d0e2a91df6d8039fb958b6d00997747) )
ROM_LOAD16_BYTE( "yu-ka_1.u8", 0x200001, 0x100000, CRC(bccd1b15) SHA1(02511f3be60c53b5f5d90f12f0648f6e184ca667) )
ROM_LOAD16_BYTE( "yu-ka_3.u7", 0x200000, 0x100000, CRC(45b8263e) SHA1(59e1846c91dc39a086e8306260506673eb91de0b) )
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASE00 ) // Slot B
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASE00 )
- ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user2", 0x000000, 0x000000, 0x400000 ) // Slot A
+ ROM_REGION( 0x1000000, "maincpu", 0 )
+ ROM_COPY( "slot_a:rom", 0x000000, 0x000000, 0x400000 )
ROM_END
ROM_START( yujan )
MACS2_BIOS
- ROM_REGION( 0x400000, "user2", 0 ) // Slot A
+ ROM_REGION( 0x400000, "slot_a:rom", 0 )
ROM_LOAD16_BYTE( "yu-jan_2.u6", 0x000001, 0x100000, CRC(2f4a8d4b) SHA1(4b328a253b1980a76f46a9a98a7f486813894a33) )
ROM_LOAD16_BYTE( "yu-jan_4.u5", 0x000000, 0x100000, CRC(226df87b) SHA1(a887728f1ea2ef5f6b4dcd6b5b61586f5e8f267d) )
ROM_LOAD16_BYTE( "yu-jan_1.u8", 0x200001, 0x100000, CRC(feeeee6a) SHA1(e9613f50d6d2e62fac6b529f81486250cfe83819) )
ROM_LOAD16_BYTE( "yu-jan_3.u7", 0x200000, 0x100000, CRC(1c1d6997) SHA1(9b07ae6b9ef1c0b57fbaa5fd0bcf1d2d7f17351f) )
- ROM_REGION( 0x400000, "user3", ROMREGION_ERASEFF ) // Slot B
+ ROM_REGION( 0x400000, "slot_b:rom", ROMREGION_ERASEFF )
- ROM_REGION( 0x1000000, "maincpu", 0 )
- ROM_COPY( "user2", 0x000000, 0x000000, 0x400000 ) // Slot A
+ ROM_REGION( 0x1000000, "maincpu", 0 )
+ ROM_COPY( "slot_a:rom", 0x000000, 0x000000, 0x400000 )
ROM_END
#if 0
@@ -637,10 +637,29 @@ static const UINT8 ramdata[160]=
};
#endif
+MACHINE_START_MEMBER(macs_state,macs)
+{
+ membank("bank1")->configure_entries(0 , 256, memregion("maincpu")->base(), 0x4000);
+ membank("bank1")->configure_entries(256, 256, m_cart1->get_rom_base(), 0x4000);
+ membank("bank1")->configure_entries(512, 256, m_cart2->get_rom_base(), 0x4000);
+ membank("bank1")->set_entry(0);
+
+ membank("bank2")->configure_entries(0, 2, m_ram1.get() + 0x2000, 0x800);
+ membank("bank2")->set_entry(0);
+
+ membank("bank3")->configure_entries(0, 4, m_ram1.get(), 0x800);
+ membank("bank3")->set_entry(2);
+
+ membank("bank4")->configure_entries(0 , 256, memregion("maincpu")->base(), 0x4000);
+ membank("bank4")->configure_entries(256, 256, m_cart1->get_rom_base(), 0x4000);
+ membank("bank4")->configure_entries(512, 256, m_cart2->get_rom_base(), 0x4000);
+ membank("bank4")->set_entry(0);
+}
+
MACHINE_RESET_MEMBER(macs_state,macs)
{
- UINT8 *macs_ram1 = m_ram1.get();
#if 0
+ UINT8 *macs_ram1 = m_ram1.get();
UINT8 *macs_ram2 = m_ram2;
/*
BIOS ram init:
@@ -670,11 +689,11 @@ MACHINE_RESET_MEMBER(macs_state,macs)
730E: ED B0 ldir
...
*/
- memcpy(macs_ram1 + 0x0e9f, memregion("user1")->base()+0x7327, 0xc7);
- memcpy(macs_ram1 + 0x1e9f, memregion("user1")->base()+0x7327, 0xc7);
+ memcpy(macs_ram1 + 0x0e9f, memregion("bios")->base()+0x7327, 0xc7);
+ memcpy(macs_ram1 + 0x1e9f, memregion("bios")->base()+0x7327, 0xc7);
- memcpy(macs_ram1 + 0x0800, memregion("user1")->base()+0x73fa, 0x507);
- memcpy(macs_ram1 + 0x1800, memregion("user1")->base()+0x73fa, 0x507);
+ memcpy(macs_ram1 + 0x0800, memregion("bios")->base()+0x73fa, 0x507);
+ memcpy(macs_ram1 + 0x1800, memregion("bios")->base()+0x73fa, 0x507);
#define MAKEJMP(n,m) macs_ram2[(n) - 0xe800 + 0]=0xc3;\
macs_ram2[(n) - 0xe800 + 1]=(m)&0xff;\
@@ -709,11 +728,6 @@ MACHINE_RESET_MEMBER(macs_state,macs)
macs_ram1[0x0ff9]=0x07;
macs_ram1[0x1ff9]=0x07;
#endif
-
- membank("bank1")->set_base(memregion("maincpu")->base() );
- membank("bank2")->set_base(macs_ram1+0x800);
- membank("bank3")->set_base(macs_ram1+0x10000);
- membank("bank4")->set_base(memregion("maincpu")->base() );
}
DRIVER_INIT_MEMBER(macs_state,macs)
diff --git a/src/mame/drivers/madmotor.cpp b/src/mame/drivers/madmotor.cpp
index 34d50a6e22f..dd3e60bafff 100644
--- a/src/mame/drivers/madmotor.cpp
+++ b/src/mame/drivers/madmotor.cpp
@@ -255,19 +255,18 @@ static MACHINE_CONFIG_START( madmotor, madmotor_state )
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,1,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 1, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,2,1);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 2, 1)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 3);
+ MCFG_DECO_MXC06_GFX_REGION(3)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
diff --git a/src/mame/drivers/magic10.cpp b/src/mame/drivers/magic10.cpp
index 6005f807aac..a7dc0d46472 100644
--- a/src/mame/drivers/magic10.cpp
+++ b/src/mame/drivers/magic10.cpp
@@ -2,82 +2,82 @@
// copyright-holders:Pierpaolo Prazzoli, Roberto Fresca
/****************************************************************************
- MAGIC'S 10
- ----------
+ MAGIC'S 10
+ ----------
- Driver by Pierpaolo Prazzoli.
- Additional work by Roberto Fresca.
+ Driver by Pierpaolo Prazzoli.
+ Additional work by Roberto Fresca.
- Supported games:
-
- Magic's 10 (ver. 16.15), 1995, AWP Games.
- Magic's 10 (ver. 16.45), 1995, AWP Games.
- Magic's 10 (ver. 16.54), 1995, AWP Games.
- Magic's 10 (ver. 16.55), 1995, AWP Games.
- Magic's 10 2, 1997, ABM Games.
- Music Sort (ver 2.02, English), 1995, ABM Games.
- Super Pool (9743 rev.01), 1997, ABM Games.
- Hot Slot (ver. 05.01), 1996, ABM Electronics.
- Magic Colors (ver. 1.7a), 1999, Unknown.
- Super Gran Safari (ver 3.11), 1996, New Impeuropex Corp.
+ Supported games:
+ Magic's 10 (ver. 16.15), 1995, AWP Games.
+ Magic's 10 (ver. 16.45), 1995, AWP Games.
+ Magic's 10 (ver. 16.54), 1995, AWP Games.
+ Magic's 10 (ver. 16.55), 1995, AWP Games.
+ Magic's 10 2, 1997, ABM Games.
+ Music Sort (ver 2.02, English), 1995, ABM Games.
+ Super Pool (9743 rev.01), 1997, ABM Games.
+ Hot Slot (ver. 05.01), 1996, ABM Electronics.
+ Magic Colors (ver. 1.7a), 1999, Unknown.
+ Super Gran Safari (ver 3.11), 1996, New Impeuropex Corp.
+ Luna Park (ver. 1.2), 1998, ABM Games.
*****************************************************************************
+ Game Notes
+ ==========
- Game Notes
- ==========
-
-
- * Magic's 10
-
- First time boot instructions:
-
- - Switch "Disable Free Play" to ON
- - Enter a coin
- - Press Collect to get the 1st game over
+ * Magic's 10
+ First time boot instructions:
+ - Switch "Disable Free Play" to ON
+ - Enter a coin
+ - Press Collect to get the 1st game over
- * Super Gran Safari
- There is a input sequence to initialize the game.
+ * Super Gran Safari
- The code expects a mask of 0x4c00 in the DIP switches port to allow
- enter the sequence, so DIP switches must be on default position.
+ There is a input sequence to initialize the game.
- When you see the black screen, enter the following sequence:
- HOLD 4 (key V), HOLD 2 (key X), HOLD 5 (key B), START (key 1).
+ The code expects a mask of 0x4c00 in the DIP switches port to allow
+ enter the sequence, so DIP switches must be on default position.
- The code is checking for a 5th entry. In fact expects HOLD 3 as the first
- entry, then the rest listed above. I don't know why bypass the first one.
- Input port bits are checked in the following order: 2, 3, 1, 4, 5.
+ When you see the black screen, enter the following sequence:
+ HOLD 4 (key V), HOLD 2 (key X), HOLD 5 (key B), START (key 1).
- The player can play the "Super Game" to grab the points.
- In this subgame, you must to hit the lion to get the prize.
- For now, you must miss the shot till hopper & ticket dispenser are properly emulated.
+ The code is checking for a 5th entry. In fact expects HOLD 3 as the first
+ entry, then the rest listed above. I don't know why bypass the first one.
+ Input port bits are checked in the following order: 2, 3, 1, 4, 5.
+ The player can play the "Super Game" to grab the points.
+ In this subgame, you must to hit the lion to get the prize.
+ For now, you must miss the shot till hopper & ticket dispenser are properly emulated.
*****************************************************************************
+ TODO:
- TODO:
+ - Ticket / Hopper support.
+ - Some unknown writes
+ - Finish magic10_2 (association coin - credits handling its inputs
+ and some reads that drive the note displayed?)
+ - Dump/decap/trojan the MCU in the later games (magic102, suprpool, hotslot, mcolors).
+ The MCU shares memory addresses at $500000-$50001f (in magic102)
+ It can't be simulated with a high level of confidence because all the game logic is
+ in there, including rngs for the cards and combinations for the points.
+ - Priorities,likely to be hardwired with the color writes (0=tile has the
+ highest priority).
+ - Define parent/clone relationship between Magic's 10 and Music Sort.
- - Ticket / Hopper support.
- - Some unknown writes
- - Finish magic10_2 (association coin - credits handling its inputs
- and some reads that drive the note displayed?)
- - Dump/decap/trojan the MCU in the later games (magic102, suprpool, hotslot, mcolors).
- The MCU shares memory addresses at $500000-$50001f (in magic102)
- It can't be simulated with a high level of confidence because all the game logic is
- in there, including rngs for the cards and combinations for the points.
- - Priorities,likely to be hardwired with the color writes (0=tile has the
- highest priority).
- - Define parent/clone relationship between Magic's 10 and Music Sort.
+****************************************************************************/
-****************************************************************************/
+#define MAIN_CLOCK XTAL_20MHz
+#define AUX_CLOCK XTAL_30MHz
+
+#define CPU_CLOCK MAIN_CLOCK/2
#include "emu.h"
@@ -249,22 +249,22 @@ WRITE16_MEMBER(magic10_state::magic10_out_w)
0x0400 - Coin counter.
- - Lbits -
- 7654 3210
- =========
- ---- ---x Hold1 lamp.
- ---- --x- Hold2 lamp.
- ---- -x-- Hold3 lamp.
- ---- x--- Hold4 lamp.
- ---x ---- Hold5 lamp.
- --x- ---- Start lamp.
- -x-- ---- Play (Bet/Take/Cancel) lamp.
+ - Lbits -
+ 7654 3210
+ =========
+ ---- ---x Hold1 lamp.
+ ---- --x- Hold2 lamp.
+ ---- -x-- Hold3 lamp.
+ ---- x--- Hold4 lamp.
+ ---x ---- Hold5 lamp.
+ --x- ---- Start lamp.
+ -x-- ---- Play (Bet/Take/Cancel) lamp.
- - Hbits -
- 7654 3210
- =========
- ---- ---x Payout lamp.
- ---- -x-- Coin counter.
+ - Hbits -
+ 7654 3210
+ =========
+ ---- ---x Payout lamp.
+ ---- -x-- Coin counter.
*/
@@ -719,9 +719,9 @@ GFXDECODE_END
static MACHINE_CONFIG_START( magic10, magic10_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", M68000, 10000000) // ?
+ MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK) // 10 MHz.
MCFG_CPU_PROGRAM_MAP(magic10_map)
- MCFG_CPU_VBLANK_INT_DRIVER("screen", magic10_state, irq1_line_hold)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", magic10_state, irq1_line_hold)
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -780,7 +780,7 @@ static MACHINE_CONFIG_DERIVED( sgsafari, magic10 )
/* basic machine hardware */
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(sgsafari_map)
- MCFG_CPU_VBLANK_INT_DRIVER("screen", magic10_state, irq2_line_hold) /* L1 interrupts */
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", magic10_state, irq2_line_hold) /* L1 interrupts */
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
@@ -792,16 +792,36 @@ MACHINE_CONFIG_END
****************************/
/*
+ Magic's 10 (ver. 16.55)
+
+ CPUs:
+ 1x MC68000P12 (u1) 16/32-bit Microprocessor (main).
+ 1x OKI M6295 (u21) 4-Channel Mixing ADCPM Voice Synthesis LSI (sound).
+ 1x KA358 Dual Operational Amplifier (sound).
+ 1x TDA2003 (u24) Audio Amplifier (sound).
-Magic 10 (videopoker)
+ 1x 20.000MHz. oscillator (OSC1, close to main CPU).
+ 1x 30.000MHz. oscillator (OSC2, close to sound).
+ 1x blu resonator 1000J (XTAL1, close to sound).
-1x 68k
-1x 20mhz OSC near 68k
-1x Oki M6295
-1x 30mhz OSC near oki chip
-2x fpga
-1x bank of Dipswitch
-1x Dallas Ds1220y-200 Nonvolatile ram
+ ROMs:
+ 6x M27C1001 (1-6).
+ 1x AM27C020 (1).
+
+ RAMs:
+ 2x KM6865BP-20 (u4, u59).
+ 2x HY6264ALP-70 (u34, u35).
+ 2x HM3-65728BK-5 (u50, u51).
+ 1x Dallas DS1220Y-200 Nonvolatile RAM.
+
+ PLDs:
+ 2x TPC1020BFN-084C1 (u41, u60) (read protected).
+ 1x AMPAL16R4PC (u42) (dumped).
+
+ Others:
+ 1x 28x2 edge connector.
+ 1x trimmer (volume).
+ 1x 8x2 DIP switches (DIP1)
*/
ROM_START( magic10 )
@@ -817,6 +837,9 @@ ROM_START( magic10 )
ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */
ROM_LOAD( "u22.bin", 0x00000, 0x40000, CRC(98885246) SHA1(752d549e6248074f2a7f6c5cc4d0bbc44c7fa4c3) )
+
+ ROM_REGION( 0x0400, "plds", 0 ) /* PLDs */
+ ROM_LOAD( "pal16r4.u42", 0x0000, 0x0104, CRC(6d70f3f2) SHA1(44c2be5945c052e057d4e0b03369acb7b9ff5d37) )
ROM_END
ROM_START( magic10a )
@@ -834,6 +857,42 @@ ROM_START( magic10a )
ROM_LOAD( "u22.bin", 0x00000, 0x40000, CRC(98885246) SHA1(752d549e6248074f2a7f6c5cc4d0bbc44c7fa4c3) )
ROM_END
+/*
+ Magic's 10 (ver. 16.45)
+
+ 1995, A.W.P. Games
+ Version: 16.15
+
+ CPU:
+ 1x MC68000P12 (u1) 16/32-bit Microprocessor (main).
+ 1x OKI M6295 (u21) 4-Channel Mixing ADCPM Voice Synthesis LSI (sound).
+ 1x KA358 Dual Operational Amplifier (sound).
+ 1x TDA2003 (u24) Audio Amplifier (sound).
+
+ 1x 20.000MHz. oscillator (OSC1, close to main CPU).
+ 1x 30.000MHz. oscillator (OSC2, close to sound).
+ 1x blu resonator 1000J (XTAL1, close to sound).
+
+ ROMs:
+ 6x M27C1001 (1-6).
+ 1x AM27C020 (1).
+
+ RAMs:
+ 2x KM6865BP-20 (u4, u59).
+ 2x HY6264ALP-70 (u34, u35).
+ 2x HM3-65728BK-5 (u50, u51).
+ 1x DS1220Y-200
+
+ PLDs:
+ 2x TPC1020BFN-084C1 (u41, u60) (read protected).
+ 1x AMPAL16R4PC (u42) dumped.
+
+ Others:
+ 1x 28x2 edge connector.
+ 1x trimmer (volume).
+ 1x 8x2 DIP switches (DIP1).
+
+*/
ROM_START( magic10b )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_BYTE( "u3_1645.bin", 0x00000, 0x20000, CRC(7f2549e4) SHA1(6578ad29273c357faae7c6be3fa1b49087e088a2) )
@@ -850,36 +909,35 @@ ROM_START( magic10b )
ROM_END
/*
+ Magic's 10 (ver. 16.15)
-Magic's 10 (ver. 16.15)
-
-1995, A.W.P. Games
-Version: 16.15
+ 1995, A.W.P. Games
+ Version: 16.15
-CPU:
-1x TS68000P12 (main)(u1)
-2x TPC1020AFN-084C (PLD)(not dumped)(u41,u60)
+ CPU:
+ 1x TS68000P12 (main)(u1)
+ 2x TPC1020AFN-084C (PLD)(not dumped)(u41,u60)
-Sound:
-1x OKI M6295 (u21)
-1x TDA2003 (u24)
-1x LM358N
+ Sound:
+ 1x OKI M6295 (u21)
+ 1x TDA2003 (u24)
+ 1x LM358N
-1x oscillator 20.000000MHz (close to main)(osc1)
-1x oscillator 30.000MHz (close to sound)(osc2)
-1x orange resonator 1000J (close to sound)(xtal1)
+ 1x oscillator 20.000000MHz (close to main)(osc1)
+ 1x oscillator 30.000MHz (close to sound)(osc2)
+ 1x orange resonator 1000J (close to sound)(xtal1)
-ROMs:
-1x M27C2001 (1)
-6x M27C1001 (2,3,5,6,7)
-1x TMS27C010A (4)
-1x PALCE16V8H (read protected)
+ ROMs:
+ 1x M27C2001 (1)
+ 5x M27C1001 (2,3,5,6,7)
+ 1x TMS27C010A (4)
+ 1x PALCE16V8H (read protected)
-Note:
-1x 28x2 edge connector
-1x trimmer (volume)
-1x 8x2 switches dip
-1x battery
+ Note:
+ 1x 28x2 edge connector
+ 1x trimmer (volume)
+ 1x 8x2 switches dip
+ 1x battery
*/
ROM_START( magic10c )
@@ -898,17 +956,16 @@ ROM_START( magic10c )
ROM_END
/*
+ PCB is marked: Copyright ABM - 9605 Rev.02
-pcb is marked: Copyright ABM - 9605 Rev.02
-
-1x 68000
-1x osc 30mhz
-1x osc 20mhz (near the 68k)
-1x h8/330 HD6473308cp10
-1x dipswitch
-1x battery
-1x fpga by Actel
-1x oki6295
+ 1x 68000
+ 1x osc 30mhz
+ 1x osc 20mhz (near the 68k)
+ 1x h8/330 HD6473308cp10
+ 1x dipswitch
+ 1x battery
+ 1x fpga by Actel
+ 1x oki6295
*/
ROM_START( magic102 )
@@ -930,33 +987,32 @@ ROM_START( magic102 )
ROM_END
/*
-
-Super Pool
-
-ABM (Nazionale Elettronica Giochi S.A.S.), 1998.
-9743 Rev.01
-
-1x MC68HC000P10
-1x ACTEL A1020B-PL84C
-1x HD6473308CP10 (label says: do not remove version 1.2)
-1x U6295 (sound)
-1x LM358N (sound)
-1x TDA2003 (sound)
-1x oscillator 20.000MHz
-1x oscillator 30.0000MHz
-1x blu resonator 1000J (close to sound)
-
-1x M27C2001 (1) (Sound)
-2x TMS27C010A (2,3) (main)
-4x TMS27C010A (4,5,6,7) (gfx)
-1x PALCE22V10H (not dumped)
-1x PALCE16V8H (not dumped)
-
-1x 28x2 JAMMA edge connector
-1x 12 legs connector (J1)
-1x trimmer (volume)
-1x 8x2 switches dip
-1x lithium battery
+ Super Pool
+
+ ABM (Nazionale Elettronica Giochi S.A.S.), 1998.
+ PCB: 9743 Rev.01
+
+ 1x MC68HC000P10
+ 1x ACTEL A1020B-PL84C
+ 1x HD6473308CP10 (label says: do not remove version 1.2)
+ 1x U6295 (sound)
+ 1x LM358N (sound)
+ 1x TDA2003 (sound)
+ 1x oscillator 20.000MHz
+ 1x oscillator 30.0000MHz
+ 1x blu resonator 1000J (close to sound)
+
+ 1x M27C2001 (1) (Sound)
+ 2x TMS27C010A (2,3) (main)
+ 4x TMS27C010A (4,5,6,7) (gfx)
+ 1x PALCE22V10H (not dumped)
+ 1x PALCE16V8H (not dumped)
+
+ 1x 28x2 JAMMA edge connector
+ 1x 12 legs connector (J1)
+ 1x trimmer (volume)
+ 1x 8x2 switches dip
+ 1x lithium battery
STATUS:
@@ -989,47 +1045,63 @@ ROM_START( suprpool )
ROM_END
/*
+ Hot Slot
-Hot Slot
+ CPU:
+ 1x MC68HC000FN12 (u1) 16/32-bit Microprocessor (main).
+ 1x HD6473308CP10 (u24) 16-bit Single-Chip MCU (NOT DUMPED).
+ 1x 6295 (u31) 4-Channel Mixing ADCPM Voice Synthesis LSI (sound).
+ 1x KA358 (u33) Dual Operational Amplifier (sound).
+ 1x TDA2003 (u34) Audio Amplifier (sound).
-CPU:
-1x HD6473308CP10 (u24)(main)
-1x A40MX04-PL84-9828 (u50)(main)
-1x missing PLD (u1)
+ 1x 20.00000 MHz. oscillator (osc1).
+ 1x 30.000 MHz. oscillator (osc2).
+ 1x blu resonator 1000J (xtal1).
-1x 6295 (u31)(sound)
-1x KA358 (u33)(sound)
-1x TDA2003 (u34)(sound)
+ ROMs (1st PCB):
+ 2x 27C010 (2,3).
+ 2x 27C020 (5,7).
+ 3x 27C2001 (1,4,6).
-1x oscillator 20.0000MHz (OSC1)
-1x 1000J blu resonator (XTAL1)
+ ROMs (2nd PCB):
+ 1x AM27C010 (2).
+ 1x M27C1001 (3).
+ 2x 27C020 (1,7).
+ 1x M27C2001 (4).
+ 1x AM27C020 (5,6).
-ROMs:
-3x 27C2001 (1,4,6)
-2x 27C020 (5,7)
-2x 27C010 (2,3)
-1x GAL16V8D (as PAL16R4)(read protected)
-1x missing PAL22V10
+ RAMs
+ 1x HM6116-70 (u6).
+ 4x ZMDU6264ADC-07LLP (u4, u5, u43, u44).
+ 2x HM3-65728H-8 (u61, u62).
-Note:
-1x 28x2 edge connector
-1x trimmer (volume)
-1n trimmer (unknown)
-3x 12 legs connector (J1,J2,J3)
-1x 8x2 switches DIP
+ PLDs
+ 1x A40MX04-PL84 (u50) (not dumped).
+ 1x GAL16V8D-25LP (u54), (read protected).
+ 1x PALC22V10H-25PC/4 (u22), (read protected).
-- Co-processor is unknown, but fits in a QFP68 socket.
-- The system RAM test need the bit 7 of offset 0x500005 activated to be successful.
- This offset seems to be a kind of port.
+ Others:
+ 1x 28x2 JAMMA edge connector.
+ 1x 12 legs connector (J1).
+ 1x 12x2 pins jumper (J2, J3).
+ 1x 2 pins jumper (J4).
+ 1x trimmer (volume)(P1).
+ 1x trimmer (unknown)(P2).
+ 1x 8x2 DIP switches (DIP1).
+ 1x CR2032 3v. lithium battery.
- code:
- 0x00f550 move.b #$b, $500005
- 0x00f558 btst #$7, $500005
- 0x00f560 beq $f558
- ....
+ - The system RAM test need the bit 7 of offset 0x500005 activated to be successful.
+ This offset seems to be a kind of port connected to the MCU.
- seems to copy some bytes (maybe commands) and wait for the status on bit 7
+ code:
+
+ 0x00f550 move.b #$b, $500005
+ 0x00f558 btst #$7, $500005
+ 0x00f560 beq $f558
+ ....
+
+ seems to copy some bytes (maybe commands) and wait for the status on bit 7
STATUS:
@@ -1062,31 +1134,31 @@ ROM_START( hotslot )
ROM_END
/*
+ Magic Colors
+ PCB marking: Rev.03
-Magic Colors
+ CPU:
+ 1x missing CPU (QFP68 socket, u1)
+ 1x HD6473308CP10 (u24)(MCU)
+ 1x A40MX04-PL84-9828 (u50)
-CPU:
-1x HD6473308CP10 (u24)(main)
-1x A40MX04-PL84-9828 (u50)(main)
-1x missing PLD (u1)
+ 1x M6295 (u31)(sound)
+ 1x KA358 (u33)(sound)
+ 1x TDA2003 (u34)(sound)
-1x M6295 (u31)(sound)
-1x KA358 (u33)(sound)
-1x TDA2003 (u34)(sound)
+ 1x oscillator 20.0000MHz (OSC1)
+ 1x 1000J blu resonator (XTAL1)
-1x oscillator 20.0000MHz (OSC1)
-1x 1000J blu resonator (XTAL1)
+ ROMs:
+ 6x 27C010 (2,3,4,5,6,7)
+ 1x 27C020 (1)
+ 1x GAL16V8D (as PAL16R4)(read protected)
+ 1x missing PAL22V10
-ROMs:
-6x 27C010 (2,3,4,5,6,7)
-1x 27C020 (1)
-1x GAL16V8D (as PAL16R4)(read protected)
-1x missing PAL22V10
-
-Note:
-1x 28x2 edge connector
-1x trimmer (volume)
-1x 12 legs connector (J1,J2,J3)
+ Note:
+ 1x 28x2 edge connector
+ 1x trimmer (volume)
+ 1x 12 legs connector (J1,J2,J3)
STATUS:
@@ -1119,32 +1191,31 @@ ROM_START( mcolors )
ROM_END
/*
+ Super Gran Safari
+ 1996 - New Impeuropex Corp.
-Super Gran Safari
-1996 - New Impeuropex Corp.
-
-CPU:
-1x MC68000P12 (main)
-2x A1020B-PL84C (not dumped)
+ CPU:
+ 1x MC68000P12 (main)
+ 2x A1020B-PL84C (not dumped)
-1x M6295 (sound)
-1x TDA2002 (sound)
-1x GL324 (sound)
+ 1x M6295 (sound)
+ 1x TDA2002 (sound)
+ 1x GL324 (sound)
-1x oscillator 30.000MHz
+ 1x oscillator 30.000MHz
-ROMs:
-2x M27C512 (1,2)
-1x M27C2001 (3)
-4x M27C1001 (4,5,6,7)
+ ROMs:
+ 2x M27C512 (1,2)
+ 1x M27C2001 (3)
+ 4x M27C1001 (4,5,6,7)
-Note:
-1x JAMMA edge connector
-1x 12 legs connector (j2)
-1x 8x2 switches dip
-1x 4 legs jumper (j3)
-1x 2 legs jumper (j4)
-1x trimmer (volume)
+ Note:
+ 1x JAMMA edge connector
+ 1x 12 legs connector (j2)
+ 1x 8x2 switches dip
+ 1x 4 legs jumper (j3)
+ 1x 2 legs jumper (j4)
+ 1x trimmer (volume)
STATUS:
@@ -1174,28 +1245,27 @@ ROM_START( sgsafari )
ROM_END
/*
+ Music Sort (Ver. 2.02).
+ Same PCB than Magic's 10 (ver. 16.15)
-Music Sort (Ver. 2.02).
-Same PCB than Magic's 10 (ver. 16.15)
+ CPU:
+ 1x TS68000P12 (main)
+ 2x TPC1020AFN-084C (PLD)(not dumped)
-CPU:
-1x TS68000P12 (main)
-2x TPC1020AFN-084C (PLD)(not dumped)
+ Sound:
+ 1x OKI M6295
+ 1x TDA2003
+ 1x LM358N
-Sound:
-1x OKI M6295
-1x TDA2003
-1x LM358N
+ 1x oscillator 20.000000MHz (close to main)
+ 1x oscillator 30.000MHz (close to sound)
+ 1x orange resonator 1000J (close to sound)
-1x oscillator 20.000000MHz (close to main)
-1x oscillator 30.000MHz (close to sound)
-1x orange resonator 1000J (close to sound)
-
-Note:
-1x 28x2 edge connector
-1x trimmer (volume)
-1x 8x2 switches dip
-1x battery
+ Note:
+ 1x 28x2 edge connector
+ 1x trimmer (volume)
+ 1x 8x2 switches dip
+ 1x battery
*/
ROM_START( musicsrt )
@@ -1216,30 +1286,95 @@ ROM_START( musicsrt )
ROM_LOAD( "musicsrt_nv.bin", 0x0000, 0x0800, CRC(f4e063cf) SHA1(a60bbd960bb7dcf023417e8c7164303b6ce71014) )
ROM_END
+/*
+ Luna Park (ver. 1.2)
+ 1998.25.11
+ ABM games.
+
+ PCB: ABM 9743 Rev.02
+
+ 1x MC68HC000FN10 (u1) 16/32-bit Microprocessor.
+ 1x HD6473308CP10 (u24) label: version 1.2 - 16-bit Single-Chip Microcomputer. NOT DUMPED.
+
+ 1x M6295 (u31) 4-Channel Mixing ADCPM Voice Synthesis LSI.
+ 1x LM358N (u33) Dual Operational Amplifier.
+ 1x TDA2003 (u34) Audio Amplifier.
+
+ 1x 20.000000MHz oscillator (osc1).
+ 1x 30.000MHz oscillator (osc2).
+ 1x blu resonator 1000J (xtal1).
+
+ 6x AM27C010 ROMs(2-7).
+ 1x AM27C020 ROM (1).
+
+ 1x LH5116-10 RAM (u6).
+ 4x HY6264ALP-10 RAM (u4, u5, u43, u44).
+ 2x HM3-65728H-8 RAM (u61, u62).
+
+ 1x TPC1020AFN-084C (u50), read protected.
+ 1x PALCE16V8H-25PC/4 (u54), read protected.
+ 1x PALC22V10H-25PC/4 (u22), read protected.
+
+ 1x 28x2 JAMMA edge connector.
+ 1x 12-pins male connector (JP1).
+ 1x trimmer (volume)(P1).
+ 1x 8x2 DIP switches (DIP1).
+ 1x Renata 3V. CR2032 lithium battery.
+
+
+ STATUS:
+
+ Memory map = done.
+ Inputs = done.
+ Machine = done.
+
+ OKI 6295 = ok.
+ Screen size = ok.
+ Fixed layers = yes.
+
+*/
+ROM_START( lunaprk )
+ ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
+ ROM_LOAD16_BYTE( "2_2.00a.u3", 0x00000, 0x20000, CRC(5ec3d238) SHA1(a9e257275cd81b74309d20bc64b10f788ca1b22a) )
+ ROM_LOAD16_BYTE( "3_2.00a.u2", 0x00001, 0x20000, CRC(6fceb57b) SHA1(f9cf566c60f9c1c604dbfeb9c3ad4831bb3922d4) )
+
+ ROM_REGION( 0x10000, "mcu", 0 ) /* h8/330 HD6473308cp10 with internal ROM */
+ ROM_LOAD( "mcu", 0x00000, 0x10000, NO_DUMP )
+
+ ROM_REGION( 0x80000, "gfx1", 0 ) /* graphics */
+ ROM_LOAD( "7_l.p..u35", 0x00000, 0x20000, CRC(dfd6795d) SHA1(01929c31b5cc9468674830d9f687b2d3607d8052) )
+ ROM_LOAD( "6_l.p..u36", 0x20000, 0x20000, CRC(fe323a28) SHA1(1cfba6c8359efed48506e8ae231926fb77469aaa) )
+ ROM_LOAD( "5_l.p..u37", 0x40000, 0x20000, CRC(445b6564) SHA1(3568bcbcbdafa8503b50de960c370c85f2fbf62a) )
+ ROM_LOAD( "4_l.p..u38", 0x60000, 0x20000, CRC(81567520) SHA1(4a1990ee19b2346824bb5b9f2880db12a414fdf7) )
+
+ ROM_REGION( 0x080000, "oki", 0 ) /* ADPCM samples */
+ ROM_LOAD( "1.u32", 0x00000, 0x40000, CRC(47804af7) SHA1(602dc0361869b52532e2adcb0de3cbdd042761b3) )
+ROM_END
+
/****************************
* Driver Init *
****************************/
-DRIVER_INIT_MEMBER(magic10_state,magic10)
+DRIVER_INIT_MEMBER(magic10_state, magic10)
{
m_layer2_offset[0] = 32;
m_layer2_offset[1] = 2;
}
-DRIVER_INIT_MEMBER(magic10_state,magic102)
+DRIVER_INIT_MEMBER(magic10_state, magic102)
{
m_layer2_offset[0] = 8;
m_layer2_offset[1] = 20;
}
-DRIVER_INIT_MEMBER(magic10_state,suprpool)
+DRIVER_INIT_MEMBER(magic10_state, suprpool)
{
m_layer2_offset[0] = 8;
m_layer2_offset[1] = 16;
}
-DRIVER_INIT_MEMBER(magic10_state,hotslot)
+DRIVER_INIT_MEMBER(magic10_state, hotslot)
{
/* a value of -56 center the playfield, but displace the intro and initial screen.
a value of -64 center the intro and initial screen, but displace the playfield.
@@ -1248,7 +1383,7 @@ DRIVER_INIT_MEMBER(magic10_state,hotslot)
m_layer2_offset[1] = 0; // Y offset.
}
-DRIVER_INIT_MEMBER(magic10_state,sgsafari)
+DRIVER_INIT_MEMBER(magic10_state, sgsafari)
{
m_layer2_offset[0] = 16;
m_layer2_offset[1] = 20;
@@ -1265,8 +1400,9 @@ GAMEL( 1995, magic10a, magic10, magic10, magic10, magic10_state, magic10, RO
GAMEL( 1995, magic10b, magic10, magic10a, magic10, magic10_state, magic10, ROT0, "A.W.P. Games", "Magic's 10 (ver. 16.45)", 0, layout_sgsafari )
GAMEL( 1995, magic10c, magic10, magic10a, magic10, magic10_state, magic10, ROT0, "A.W.P. Games", "Magic's 10 (ver. 16.15)", 0, layout_sgsafari )
GAME( 1997, magic102, 0, magic102, magic102, magic10_state, magic102, ROT0, "ABM Games", "Magic's 10 2 (ver 1.1)", MACHINE_NOT_WORKING )
-GAME( 1997, suprpool, 0, magic102, magic102, magic10_state, suprpool, ROT0, "ABM Games", "Super Pool (9743 rev.01)", MACHINE_NOT_WORKING )
+GAME( 1998, suprpool, 0, magic102, magic102, magic10_state, suprpool, ROT0, "ABM Games", "Super Pool (ver. 1.2)", MACHINE_NOT_WORKING )
GAME( 1996, hotslot, 0, hotslot, hotslot, magic10_state, hotslot, ROT0, "ABM Electronics", "Hot Slot (ver. 05.01)", MACHINE_NOT_WORKING )
GAME( 1999, mcolors, 0, magic102, magic102, magic10_state, magic102, ROT0, "<unknown>", "Magic Colors (ver. 1.7a)", MACHINE_NOT_WORKING )
GAMEL( 1996, sgsafari, 0, sgsafari, sgsafari, magic10_state, sgsafari, ROT0, "New Impeuropex Corp.", "Super Gran Safari (ver 3.11)", 0, layout_sgsafari )
GAMEL( 1995, musicsrt, 0, magic10a, musicsrt, magic10_state, magic10, ROT0, "ABM Games", "Music Sort (ver 2.02, English)", 0, layout_musicsrt )
+GAME( 1998, lunaprk, 0, magic102, magic102, magic10_state, suprpool, ROT0, "ABM Games", "Luna Park (ver. 1.2)", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/mhavoc.cpp b/src/mame/drivers/mhavoc.cpp
index 82ce05f008a..231742afebd 100644
--- a/src/mame/drivers/mhavoc.cpp
+++ b/src/mame/drivers/mhavoc.cpp
@@ -195,13 +195,21 @@
#include "machine/nvram.h"
#include "includes/mhavoc.h"
-
+/* Quad pokey hookup (based on schematics):
+Address: 543210
+ |||||\- pokey A0
+ ||||\-- pokey A1
+ |||\--- pokey A2
+ ||\---- pokey chip number LSB
+ |\----- pokey chip number MSB
+ \------ pokey A3
+*/
READ8_MEMBER(mhavoc_state::quad_pokeyn_r)
{
static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
- int pokey_reg = (offset % 8) | control;
+ int pokey_reg = (offset & 0x7) | control;
pokey_device *pokey = machine().device<pokey_device>(devname[pokey_num]);
return pokey->read(pokey_reg);
@@ -212,7 +220,7 @@ WRITE8_MEMBER(mhavoc_state::quad_pokeyn_w)
static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
- int pokey_reg = (offset % 8) | control;
+ int pokey_reg = (offset & 0x7) | control;
pokey_device *pokey = machine().device<pokey_device>(devname[pokey_num]);
pokey->write(pokey_reg, data);
@@ -224,12 +232,19 @@ WRITE8_MEMBER(mhavoc_state::quad_pokeyn_w)
* Alpha One: dual POKEY?
*
*************************************/
-
+/* dual pokey hookup (presumably, based on the prototype code):
+Address: 43210
+ ||||\- pokey A0
+ |||\-- pokey A1
+ ||\--- pokey A2
+ |\---- pokey chip number
+ \----- pokey A3
+*/
READ8_MEMBER(mhavoc_state::dual_pokey_r)
{
int pokey_num = (offset >> 3) & 0x01;
int control = (offset & 0x10) >> 1;
- int pokey_reg = (offset % 8) | control;
+ int pokey_reg = (offset & 0x7) | control;
if (pokey_num == 0)
return machine().device<pokey_device>("pokey1")->read(pokey_reg);
@@ -242,7 +257,7 @@ WRITE8_MEMBER(mhavoc_state::dual_pokey_w)
{
int pokey_num = (offset >> 3) & 0x01;
int control = (offset & 0x10) >> 1;
- int pokey_reg = (offset % 8) | control;
+ int pokey_reg = (offset & 0x7) | control;
if (pokey_num == 0)
machine().device<pokey_device>("pokey1")->write(pokey_reg, data);
@@ -287,19 +302,41 @@ ADDRESS_MAP_END
* Gamma CPU memory handlers
*
*************************************/
+
+/*
+a15 a14 a13 a12 a11 a10 a09 a08 a07 a06 a05 a04 a03 a02 a01 a00
+0 0 0 x x * * * * * * * * * * * RW ZRAM (6116 SRAM@9PQ)
+0 0 1 0 0 x x x x x * * * * * * RW INPUTS: QCI/O (Quad Pokey)
+0 0 1 0 1 x x x x x x x x x x x R INPUTS: SWITCHES
+0 0 1 1 0 x x x x x x x x x x x R INPUTS: PORTRD_gamma
+0 0 1 1 1 x x x x x x x x x * * R INPUTS: ROLLER (CCI(LETA?), with A2 grounded so only 4 ports are readable)
+0 1 0 x x x x x x x x x x x x x R OUTPUTS: read of dipswitches @8S encompasses the entire OUTPUTS area
+0 1 0 0 0 x x x x x x x x x x x W OUTPUTS: IRQACK
+0 1 0 0 1 x x x x x x x x x x x W OUTPUTS: STROBES
+0 1 0 1 0 x x x x x x x x x x x W OUTPUTS: PORTWR_gamma
+0 1 0 1 1 ? ? ? ? ? ? ? ? ? ? ? W OUTPUTS: TISND, unused tms5220 write
+ ( supposedly, but the /WS hookup is not traced on pcb yet:
+0 1 0 1 1 x? x? 0 x? x? x? x? x? x? x? x? W? OUTPUTS: TISND: Gamma CPU write to octal latch??
+0 1 0 1 1 x? x? 1 x? x? x? x? x? x? x? x? W? OUTPUTS: TISND: octal latch output enable to tms5220 and pulse /WS on 5220??
+ Is there a way to activate /RS on the TMS5220 to read the status register? is the TMS5220 /INT line connected to the 6502 somehow?
+ )
+0 1 1 x x x x * * * * * * * * * RW EEROM: (2804 EEPROM@9QR, pins 22(A9) and 19(A10) are N/C inside the chip)
+1 x * * * * * * * * * * * * * * R ROM 27128 @9S
+*/
static ADDRESS_MAP_START( gamma_map, AS_PROGRAM, 8, mhavoc_state )
- AM_RANGE(0x0000, 0x07ff) AM_RAM /* Program RAM (2K) */
- AM_RANGE(0x0800, 0x0fff) AM_RAM AM_MIRROR (0x1800)
- AM_RANGE(0x2000, 0x203f) AM_READWRITE(quad_pokeyn_r, quad_pokeyn_w) /* Quad Pokey read */
- AM_RANGE(0x2800, 0x2800) AM_READ_PORT("IN1") /* Gamma Input Port */
- AM_RANGE(0x3000, 0x3000) AM_READ(mhavoc_alpha_r) /* Alpha Comm. Read Port*/
- AM_RANGE(0x3800, 0x3803) AM_READ_PORT("DIAL") /* Roller Controller Input*/
- AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW2") AM_WRITE(mhavoc_gamma_irq_ack_w) /* DSW at 8S, IRQ Acknowledge*/
- AM_RANGE(0x4800, 0x4800) AM_WRITE(mhavoc_out_1_w) /* Coin Counters */
- AM_RANGE(0x5000, 0x5000) AM_WRITE(mhavoc_alpha_w) /* Alpha Comm. Write Port */
- AM_RANGE(0x6000, 0x61ff) AM_RAM AM_SHARE("nvram") /* EEROM */
- AM_RANGE(0x8000, 0xffff) AM_ROM /* Program ROM (16K) */
+ AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) /* Program RAM (2K) */
+ AM_RANGE(0x2000, 0x203f) AM_READWRITE(quad_pokeyn_r, quad_pokeyn_w) AM_MIRROR(0x07C0) /* Quad Pokey read/write */
+ AM_RANGE(0x2800, 0x2800) AM_READ_PORT("IN1") AM_MIRROR(0x07ff) /* Gamma Input Port */
+ AM_RANGE(0x3000, 0x3000) AM_READ(mhavoc_alpha_r) AM_MIRROR(0x07ff) /* Alpha Comm. Read Port */
+ AM_RANGE(0x3800, 0x3803) AM_READ_PORT("DIAL") AM_MIRROR(0x07fc) /* Roller Controller Input */
+ AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW2") AM_WRITE(mhavoc_gamma_irq_ack_w) AM_MIRROR(0x07ff) /* DSW at 8S, IRQ Acknowledge */
+ AM_RANGE(0x4800, 0x4800) AM_WRITE(mhavoc_out_1_w) AM_MIRROR(0x07ff) /* Coin Counters */
+ AM_RANGE(0x5000, 0x5000) AM_WRITE(mhavoc_alpha_w) AM_MIRROR(0x07ff) /* Alpha Comm. Write Port */
+ //AM_RANGE(0x5800, 0x5800) AM_WRITE(mhavocrv_speech_data_w) AM_MIRROR(0x06ff) /* TMS5220 data write */
+ //AM_RANGE(0x5900, 0x5900) AM_WRITE(mhavocrv_speech_strobe_w) AM_MIRROR(0x06ff) /* TMS5220 /WS strobe write */
+ AM_RANGE(0x6000, 0x61ff) AM_RAM AM_SHARE("nvram") AM_MIRROR(0x1e00) /* EEROM */
+ AM_RANGE(0x8000, 0xbfff) AM_ROM AM_MIRROR(0x4000) /* Program ROM (16K) */
ADDRESS_MAP_END
@@ -602,8 +639,7 @@ ROM_START( mhavoc )
/* Gamma Processor ROM */
ROM_REGION( 0x10000, "gamma", 0 )
- ROM_LOAD( "136025.108", 0x08000, 0x4000, CRC(93faf210) SHA1(7744368a1d520f986d1c4246113a7e24fcdd6d04) )
- ROM_RELOAD( 0x0c000, 0x4000 ) /* reset+interrupt vectors */
+ ROM_LOAD( "136025.108", 0x08000, 0x4000, CRC(93faf210) SHA1(7744368a1d520f986d1c4246113a7e24fcdd6d04) ) /* mirrored to c000-ffff for reset+interrupt vectors */
/* AVG PROM */
ROM_REGION( 0x100, "user1", 0 )
@@ -633,8 +669,7 @@ ROM_START( mhavoc2 )
/* Gamma Processor ROM */
ROM_REGION( 0x10000, "gamma", 0 )
- ROM_LOAD( "136025.108", 0x08000, 0x4000, CRC(93faf210) SHA1(7744368a1d520f986d1c4246113a7e24fcdd6d04) )
- ROM_RELOAD( 0x0c000, 0x4000 ) /* reset+interrupt vectors */
+ ROM_LOAD( "136025.108", 0x08000, 0x4000, CRC(93faf210) SHA1(7744368a1d520f986d1c4246113a7e24fcdd6d04) ) /* mirrored to c000-ffff for reset+interrupt vectors */
/* AVG PROM */
ROM_REGION( 0x100, "user1", 0 )
@@ -662,8 +697,7 @@ ROM_START( mhavocrv )
/* Gamma Processor ROM */
ROM_REGION( 0x10000, "gamma", 0 )
- ROM_LOAD( "136025.908", 0x08000, 0x4000, CRC(c52ec664) SHA1(08120a385f71b17ec02a3c2ef856ff835a91773e) )
- ROM_RELOAD( 0x0c000, 0x4000 ) /* reset+interrupt vectors */
+ ROM_LOAD( "136025.908", 0x08000, 0x4000, CRC(c52ec664) SHA1(08120a385f71b17ec02a3c2ef856ff835a91773e) ) /* mirrored to c000-ffff for reset+interrupt vectors */
/* AVG PROM */
ROM_REGION( 0x100, "user1", 0 )
@@ -693,8 +727,7 @@ ROM_START( mhavocp )
/* Gamma Processor ROM */
ROM_REGION( 0x10000, "gamma", 0 )
- ROM_LOAD( "136025.008", 0x8000, 0x4000, CRC(22ea7399) SHA1(eeda8cc40089506063835a62c3273e7dd3918fd5) )
- ROM_RELOAD( 0xc000, 0x4000 )/* reset+interrupt vectors */
+ ROM_LOAD( "136025.008", 0x8000, 0x4000, CRC(22ea7399) SHA1(eeda8cc40089506063835a62c3273e7dd3918fd5) ) /* mirrored to c000-ffff for reset+interrupt vectors */
/* AVG PROM */
ROM_REGION( 0x100, "user1", 0 )
diff --git a/src/mame/drivers/mirage.cpp b/src/mame/drivers/mirage.cpp
index 29b275a7965..88a2ae21c37 100644
--- a/src/mame/drivers/mirage.cpp
+++ b/src/mame/drivers/mirage.cpp
@@ -342,12 +342,10 @@ static MACHINE_CONFIG_START( mirage, miragemi_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/model1.cpp b/src/mame/drivers/model1.cpp
index 9fd1950cc0d..4e20dbfeb11 100644
--- a/src/mame/drivers/model1.cpp
+++ b/src/mame/drivers/model1.cpp
@@ -1534,10 +1534,7 @@ static MACHINE_CONFIG_START( model1, model1_state )
MCFG_MACHINE_RESET_OVERRIDE(model1_state,model1)
MCFG_NVRAM_ADD_0FILL("nvram")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1581,10 +1578,7 @@ static MACHINE_CONFIG_START( model1_vr, model1_state )
MCFG_MACHINE_RESET_OVERRIDE(model1_state,model1_vr)
MCFG_NVRAM_ADD_0FILL("nvram")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp
index ac2cdaa2b94..3a92ee24a73 100644
--- a/src/mame/drivers/model2.cpp
+++ b/src/mame/drivers/model2.cpp
@@ -2405,10 +2405,7 @@ static MACHINE_CONFIG_START( model2o, model2_state )
MCFG_TIMER_DRIVER_ADD("timer3", model2_state, model2_timer_cb)
MCFG_TIMER_PTR((FPTR)3)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
@@ -2454,9 +2451,7 @@ static MACHINE_CONFIG_START( model2a, model2_state )
MCFG_TIMER_DRIVER_ADD("timer3", model2_state, model2_timer_cb)
MCFG_TIMER_PTR((FPTR)3)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
@@ -2571,9 +2566,7 @@ static MACHINE_CONFIG_START( model2b, model2_state )
MCFG_TIMER_DRIVER_ADD("timer3", model2_state, model2_timer_cb)
MCFG_TIMER_PTR((FPTR)3)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
@@ -2636,9 +2629,7 @@ static MACHINE_CONFIG_START( model2c, model2_state )
MCFG_TIMER_DRIVER_ADD("timer3", model2_state, model2_timer_cb)
MCFG_TIMER_PTR((FPTR)3)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_SCREEN_ADD("screen", RASTER)
@@ -5196,7 +5187,7 @@ ROM_START( dynabb ) /* Dynamite Baseball, Model 2B. Sega game ID# 833-12803 DYNA
ROM_LOAD32_WORD("epr-19169.14", 0x100002, 0x080000, CRC(91a5acef) SHA1(2520a3e4ff15e4d583861ba656570abca5f7c611) )
ROM_REGION32_LE( 0x2000000, "user1", 0 ) // Data
- // 0x0000000 - 0x07fffff unpopulated? (not checked by ROM checks)
+ // IC11, IC12 not populated
ROM_LOAD32_WORD("mpr-19176.9", 0x0800000, 0x400000, CRC(2c4e90f5) SHA1(8d5ed0b26e79dd6476282bc69cb27b42381635f2) )
ROM_LOAD32_WORD("mpr-19177.10", 0x0800002, 0x400000, CRC(b0f1e512) SHA1(81e4124ac7766c7ea6bac7e7f4db110783394ae3) )
ROM_LOAD32_WORD("mpr-19174.7", 0x1000000, 0x400000, CRC(057e5200) SHA1(dd07eb438d91a8132789154a633fb6ec4e2ef0d1) )
@@ -5205,11 +5196,10 @@ ROM_START( dynabb ) /* Dynamite Baseball, Model 2B. Sega game ID# 833-12803 DYNA
ROM_LOAD32_WORD("mpr-19173.6", 0x1800002, 0x400000, CRC(31adbeed) SHA1(3984be892f0dce21c8d423dda055ef7e57df4d4e) )
ROM_REGION( 0x1000000, "user2", 0 ) // Models
- // these IC positions are weird compared to the other games, but these are the correct pairings.
- ROM_LOAD32_WORD("mpr-19178.11", 0x0000000, 0x400000, CRC(0d621e21) SHA1(31adc229258a5d468ff80d789c59bd8a6777f900) )
- ROM_LOAD32_WORD("mpr-19180.17", 0x0000002, 0x400000, CRC(d2e311a5) SHA1(83fb31c6ad7c32f1a7bcf870edb2719653c3db97) )
- ROM_LOAD32_WORD("mpr-19179.12", 0x0800000, 0x400000, CRC(337a4ec2) SHA1(77d7d186344715237895ac1ed0ab219fcc340a7e) )
- ROM_LOAD32_WORD("mpr-19181.21", 0x0800002, 0x400000, CRC(09a86c33) SHA1(30601c5b00fa3c9db815f60a0de16576e34b8c42) )
+ ROM_LOAD32_WORD("mpr-19178.17", 0x0000000, 0x400000, CRC(0d621e21) SHA1(31adc229258a5d468ff80d789c59bd8a6777f900) )
+ ROM_LOAD32_WORD("mpr-19180.21", 0x0000002, 0x400000, CRC(d2e311a5) SHA1(83fb31c6ad7c32f1a7bcf870edb2719653c3db97) )
+ ROM_LOAD32_WORD("mpr-19179.18", 0x0800000, 0x400000, CRC(337a4ec2) SHA1(77d7d186344715237895ac1ed0ab219fcc340a7e) )
+ ROM_LOAD32_WORD("mpr-19181.22", 0x0800002, 0x400000, CRC(09a86c33) SHA1(30601c5b00fa3c9db815f60a0de16576e34b8c42) )
ROM_REGION( 0x800000, "user3", 0 ) // Textures
diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp
index 04abe3cc7dd..70673ba93ea 100644
--- a/src/mame/drivers/model3.cpp
+++ b/src/mame/drivers/model3.cpp
@@ -737,9 +737,9 @@ JP4/5/6/7 - Jumpers to configure ROMs
#include "machine/eepromser.h"
#include "machine/53c810.h"
#include "machine/nvram.h"
+#include "machine/m3comm.h"
#include "includes/model3.h"
-
void model3_state::update_irq_state()
{
if ((m_irq_enable & m_irq_state) || m_scsi_irq_state)
@@ -1735,20 +1735,6 @@ WRITE8_MEMBER(model3_state::model3_sound_w)
-READ64_MEMBER(model3_state::network_r)
-{
- osd_printf_debug("network_r: %02X at %08X\n", offset, space.device().safe_pc());
- return m_network_ram[offset];
-}
-
-WRITE64_MEMBER(model3_state::network_w)
-{
- COMBINE_DATA(m_network_ram.get() + offset);
- osd_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), space.device().safe_pc());
-}
-
-
-
READ64_MEMBER(model3_state::model3_5881prot_r)
{
UINT64 retvalue = U64(0xffffffffffffffff);
@@ -1823,7 +1809,7 @@ WRITE64_MEMBER(model3_state::daytona2_rombank_w)
}
}
-static ADDRESS_MAP_START( model3_mem, AS_PROGRAM, 64, model3_state )
+static ADDRESS_MAP_START( model3_10_mem, AS_PROGRAM, 64, model3_state )
AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("work_ram") /* work RAM */
AM_RANGE(0x84000000, 0x8400003f) AM_READ(real3d_status_r )
@@ -1845,6 +1831,10 @@ static ADDRESS_MAP_START( model3_mem, AS_PROGRAM, 64, model3_state )
AM_RANGE(0xff800000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( model3_mem, AS_PROGRAM, 64, model3_state )
+ AM_IMPORT_FROM( model3_10_mem )
+ AM_RANGE(0xc0000000, 0xc003ffff) AM_DEVICE32("comm_board", m3comm_device, m3_map, U64(0xffffffffffffffff) )
+ADDRESS_MAP_END
static INPUT_PORTS_START( common )
PORT_START("IN0")
@@ -5475,7 +5465,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(model3_state::model3_interrupt)
static MACHINE_CONFIG_START( model3_10, model3_state )
MCFG_CPU_ADD("maincpu", PPC603E, 66000000)
MCFG_PPC_BUS_FREQUENCY(66000000) /* Multiplier 1, Bus = 66MHz, Core = 66MHz */
- MCFG_CPU_PROGRAM_MAP(model3_mem)
+ MCFG_CPU_PROGRAM_MAP(model3_10_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", model3_state, model3_interrupt, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", M68000, 12000000)
@@ -5562,6 +5552,8 @@ static MACHINE_CONFIG_START( model3_15, model3_state )
MCFG_LSI53C810_DMA_CB(model3_state, real3d_dma_callback)
MCFG_LSI53C810_FETCH_CB(model3_state, scsi_fetch)
MCFG_LEGACY_SCSI_PORT("scsi")
+
+ MCFG_M3COMM_ADD("comm_board")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED(scud, model3_15)
@@ -5605,6 +5597,8 @@ static MACHINE_CONFIG_START(model3_20, model3_state)
MCFG_SOUND_ADD("scsp2", SCSP, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
+
+ MCFG_M3COMM_ADD("comm_board")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED(model3_20_5881, model3_20)
@@ -5647,6 +5641,8 @@ static MACHINE_CONFIG_START(model3_21, model3_state)
MCFG_SOUND_ADD("scsp2", SCSP, 0)
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
+
+ MCFG_M3COMM_ADD("comm_board")
MACHINE_CONFIG_END
@@ -5751,7 +5747,6 @@ DRIVER_INIT_MEMBER(model3_state,lostwsga)
UINT32 *rom = (UINT32*)memregion("user1")->base();
DRIVER_INIT_CALL(model3_15);
- /* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
rom[0x7374f0/4] = 0x38840004; /* This seems to be an actual bug in the original code */
@@ -5770,14 +5765,12 @@ DRIVER_INIT_MEMBER(model3_state,scud)
DRIVER_INIT_MEMBER(model3_state,scudplus)
{
DRIVER_INIT_CALL(model3_15);
- /* TODO: network device at 0xC0000000 - FF */
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
}
DRIVER_INIT_MEMBER(model3_state,scudplusa)
{
DRIVER_INIT_CALL(model3_15);
- /* TODO: network device at 0xC0000000 - FF */
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
}
@@ -5892,17 +5885,11 @@ DRIVER_INIT_MEMBER(model3_state,vs299)
DRIVER_INIT_MEMBER(model3_state,harley)
{
DRIVER_INIT_CALL(model3_20);
-
- m_network_ram = make_unique_clear<UINT64[]>(0x10000);
- m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
}
DRIVER_INIT_MEMBER(model3_state,harleya)
{
DRIVER_INIT_CALL(model3_20);
-
- m_network_ram = make_unique_clear<UINT64[]>(0x10000);
- m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
}
diff --git a/src/mame/drivers/moo.cpp b/src/mame/drivers/moo.cpp
index 73bcdaab223..da3d3960e43 100644
--- a/src/mame/drivers/moo.cpp
+++ b/src/mame/drivers/moo.cpp
@@ -550,18 +550,14 @@ static MACHINE_CONFIG_START( moo, moo_state )
MCFG_VIDEO_START_OVERRIDE(moo_state,moo)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(moo_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, -48+1, 23)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48+1, 23)
MCFG_K053246_PALETTE("palette")
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(moo_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_K053251_ADD("k053251")
@@ -608,18 +604,14 @@ static MACHINE_CONFIG_START( moobl, moo_state )
MCFG_VIDEO_START_OVERRIDE(moo_state,moo)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(moo_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, -48+1, 23)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48+1, 23)
MCFG_K053246_PALETTE("palette")
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(moo_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_K053251_ADD("k053251")
@@ -642,7 +634,7 @@ static MACHINE_CONFIG_DERIVED( bucky, moo )
MCFG_K054000_ADD("k054000")
MCFG_DEVICE_MODIFY("k053246")
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, -48, 23)
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48, 23)
/* video hardware */
MCFG_PALETTE_MODIFY("palette")
diff --git a/src/mame/drivers/mystwarr.cpp b/src/mame/drivers/mystwarr.cpp
index 8e8632c9e1b..04c66269da1 100644
--- a/src/mame/drivers/mystwarr.cpp
+++ b/src/mame/drivers/mystwarr.cpp
@@ -953,20 +953,16 @@ static MACHINE_CONFIG_START( mystwarr, mystwarr_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_ENABLE_HILIGHTS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(mystwarr_state, mystwarr_tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_K055555_ADD("k055555")
MCFG_DEVICE_ADD("k055673", K055673, 0)
MCFG_K055673_CB(mystwarr_state, mystwarr_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -48, -24)
- MCFG_K055673_GFXDECODE("gfxdecode")
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -48, -24)
MCFG_K055673_PALETTE("palette")
MCFG_DEVICE_ADD("k054338", K054338, 0)
@@ -1018,7 +1014,7 @@ static MACHINE_CONFIG_DERIVED( viostorm, mystwarr )
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(mystwarr_state, metamrph_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_RNG, -62, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_RNG, -62, -23)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( metamrph, mystwarr )
@@ -1051,7 +1047,7 @@ static MACHINE_CONFIG_DERIVED( metamrph, mystwarr )
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(mystwarr_state, metamrph_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_RNG, -51, -24)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_RNG, -51, -24)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( dadandrn, mystwarr )
@@ -1067,7 +1063,7 @@ static MACHINE_CONFIG_DERIVED( dadandrn, mystwarr )
MCFG_DEVICE_MODIFY("k053252")
MCFG_K053252_OFFSETS(24, 16+1)
- MCFG_GFXDECODE_MODIFY("gfxdecode", dadandrn)
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", dadandrn)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(mystwarr_state, dadandrn)
@@ -1084,7 +1080,7 @@ static MACHINE_CONFIG_DERIVED( dadandrn, mystwarr )
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(mystwarr_state, gaiapols_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -42, -22)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -42, -22)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gaiapols, mystwarr )
@@ -1102,7 +1098,7 @@ static MACHINE_CONFIG_DERIVED( gaiapols, mystwarr )
MCFG_K054000_ADD("k054000")
- MCFG_GFXDECODE_MODIFY("gfxdecode", gaiapols)
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", gaiapols)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(mystwarr_state, gaiapols)
@@ -1120,7 +1116,7 @@ static MACHINE_CONFIG_DERIVED( gaiapols, mystwarr )
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(mystwarr_state, gaiapols_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_RNG, -61, -22) // stage2 brick walls
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_RNG, -61, -22) // stage2 brick walls
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( martchmp, mystwarr )
@@ -1155,7 +1151,7 @@ static MACHINE_CONFIG_DERIVED( martchmp, mystwarr )
MCFG_DEVICE_MODIFY("k055673")
MCFG_K055673_CB(mystwarr_state, martchmp_sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX, -58, -23)
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -58, -23)
MACHINE_CONFIG_END
/**********************************************************************************/
@@ -1286,6 +1282,46 @@ ROM_END
ROM_START( mystwarra )
/* main program */
ROM_REGION( 0x200000, "maincpu", 0 )
+ ROM_LOAD16_BYTE( "128aab01.20f", 0x000000, 0x40000, CRC(3dc89153) SHA1(dd7b315794b07823d380fe2c59ceff93964d5542) )
+ ROM_LOAD16_BYTE( "128aab02.20g", 0x000001, 0x40000, CRC(8fe92ad2) SHA1(f99e6c4bab026fae6becbcf5463ae67081d3b6dd) )
+ ROM_LOAD16_BYTE( "128a03.19f", 0x100000, 0x80000, CRC(e98094f3) SHA1(a3f9b804ff487f792a00ce85a383868ab0b1b5d8) )
+ ROM_LOAD16_BYTE( "128a04.19g", 0x100001, 0x80000, CRC(88c6a3e4) SHA1(7c2361f716a2320730a3dd6723a271e349ad61c3) )
+
+ /* sound program */
+ ROM_REGION( 0x40000, "soundcpu", 0 )
+ ROM_LOAD("128a05.6b", 0x00000, 0x20000, CRC(0e5194e0) SHA1(83356158d561f1b8e21f6ae5936b61da834a0545) )
+ ROM_RELOAD( 0x20000, 0x20000 )
+
+ /* tiles */
+ ROM_REGION( 0x500000, "gfx1", ROMREGION_ERASE00 )
+ ROM_LOADTILE_WORD( "128a08.1h", 0x000000, 1*1024*1024, CRC(63d6cfa0) SHA1(324bf25cf79aa030d2dcc94a53c1984eb8abec3a) )
+ ROM_LOADTILE_WORD( "128a09.1k", 0x000002, 1*1024*1024, CRC(573a7725) SHA1(f2fef32053ed2a65c6c3ddd3e1657a866aa80b3e) )
+ ROM_LOADTILE_BYTE( "128a10.3h", 0x000004, 512*1024, CRC(558e545a) SHA1(cac53e545f3f8980d431443f2c3b8b95e6077d1c) )
+
+ /* sprites */
+ ROM_REGION( 0x500000, "gfx2", ROMREGION_ERASE00 )
+ ROM_LOAD64_WORD( "128a16.22k", 0x000000, 1*1024*1024, CRC(459b6407) SHA1(e4dace4912f9558bee75a8e95ee2637f5e950b47) )
+ ROM_LOAD64_WORD( "128a15.20k", 0x000002, 1*1024*1024, CRC(6bbfedf4) SHA1(0b3acb2b34c722ddc60c0e64e12baa1f225e4fbb) )
+ ROM_LOAD64_WORD( "128a14.19k", 0x000004, 1*1024*1024, CRC(f7bd89dd) SHA1(c9b2ebd5a49840f8b260d53c25cfcc238d21c75c) )
+ ROM_LOAD64_WORD( "128a13.17k", 0x000006, 1*1024*1024, CRC(e89b66a2) SHA1(fce6e56d1759ffe987766426ecb28e9015a500b7) )
+ ROM_LOAD16_BYTE( "128a12.12k", 0x400000, 512*1024, CRC(63de93e2) SHA1(c9a50e7beff1cbbc5d5820664adbd54d52782c54) )
+ ROM_LOAD16_BYTE( "128a11.10k", 0x400001, 512*1024, CRC(4eac941a) SHA1(c0a33f4b975ebee217fd335001839992f4c0bdc8) )
+
+ /* road generator */
+ ROM_REGION( 0x40000, "gfx3", ROMREGION_ERASE00 )
+
+ /* sound data */
+ ROM_REGION( 0x400000, "shared", 0 )
+ ROM_LOAD( "128a06.2d", 0x000000, 2*1024*1024, CRC(88ed598c) SHA1(3c123e26b3a12541df77b368bc0e0d486f5622b6) )
+ ROM_LOAD( "128a07.1d", 0x200000, 2*1024*1024, CRC(db79a66e) SHA1(b7e118ed26bac557038e8ae6cb77f23f3da5646f) )
+
+ ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error
+ ROM_LOAD( "eeprom", 0x0000, 0x080, CRC(fd6a25b4) SHA1(6a9046b582f82efe85bff4e57d4d3b469213f8ae) )
+ROM_END
+
+ROM_START( mystwarraa )
+ /* main program */
+ ROM_REGION( 0x200000, "maincpu", 0 )
ROM_LOAD16_BYTE( "128aaa01.20f", 0x000000, 0x40000, CRC(633ead86) SHA1(56d8628f6081e860c4c6109eabd1c1392f669996) )
ROM_LOAD16_BYTE( "128aaa02.20g", 0x000001, 0x40000, CRC(69ab81a2) SHA1(545bc298dfc4de05bac15d63a84c10400231a04d) )
ROM_LOAD16_BYTE( "128a03.19f", 0x100000, 0x80000, CRC(e98094f3) SHA1(a3f9b804ff487f792a00ce85a383868ab0b1b5d8) )
@@ -2141,7 +2177,8 @@ ROM_END
GAME( 1993, mystwarr, 0, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver EAA)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1993, mystwarru, mystwarr, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver UAA)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1993, mystwarrj, mystwarr, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver JAA)", MACHINE_IMPERFECT_GRAPHICS )
-GAME( 1993, mystwarra, mystwarr, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver AAA)", MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1993, mystwarra, mystwarr, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver AAB)", MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1993, mystwarraa, mystwarr, mystwarr, mystwarr, driver_device, 0, ROT0, "Konami", "Mystic Warriors (ver AAA)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1993, mmaulers, 0, dadandrn, dadandrn, driver_device, 0, ROT0, "Konami", "Monster Maulers (ver EAA)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1993, dadandrn, mmaulers, dadandrn, dadandrn, driver_device, 0, ROT0, "Konami", "Kyukyoku Sentai Dadandarn (ver JAA)", MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/drivers/n64.cpp b/src/mame/drivers/n64.cpp
index 9c4e7d146ee..e3cefcdf6d6 100644
--- a/src/mame/drivers/n64.cpp
+++ b/src/mame/drivers/n64.cpp
@@ -418,12 +418,13 @@ static MACHINE_CONFIG_START( n64, n64_mess_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", VR4300BE, 93750000)
- MCFG_FORCE_NO_DRC()
+ MCFG_CPU_FORCE_NO_DRC()
MCFG_CPU_CONFIG(config)
MCFG_CPU_PROGRAM_MAP(n64_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", n64_mess_state, n64_reset_poll)
MCFG_CPU_ADD("rsp", RSP, 62500000)
+ MCFG_CPU_FORCE_NO_DRC()
MCFG_RSP_DP_REG_R_CB(DEVREAD32("rcp",n64_periphs, dp_reg_r))
MCFG_RSP_DP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, dp_reg_w))
MCFG_RSP_SP_REG_R_CB(DEVREAD32("rcp",n64_periphs, sp_reg_r))
@@ -464,8 +465,6 @@ static MACHINE_CONFIG_START( n64, n64_mess_state )
/* software lists */
MCFG_SOFTWARE_LIST_ADD("cart_list", "n64")
-
- MCFG_FORCE_NO_DRC()
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( n64dd, n64 )
diff --git a/src/mame/drivers/namcond1.cpp b/src/mame/drivers/namcond1.cpp
index 5e740e11d4a..c2de731e5bb 100644
--- a/src/mame/drivers/namcond1.cpp
+++ b/src/mame/drivers/namcond1.cpp
@@ -124,104 +124,6 @@ static INPUT_PORTS_START( namcond1 )
INPUT_PORTS_END
-/* text-layer characters */
-
-static const UINT32 pts_4bits_layout_xoffset[64] =
-{
- STEP8( 0*256, 4 ), STEP8( 1*256, 4 ), STEP8( 4*256, 4 ), STEP8( 5*256, 4 ),
- STEP8( 16*256, 4 ), STEP8( 17*256, 4 ), STEP8( 20*256, 4 ), STEP8( 21*256, 4 )
-};
-
-static const UINT32 pts_4bits_layout_yoffset[64] =
-{
- STEP8( 0*256, 8*4 ), STEP8( 2*256, 8*4 ), STEP8( 8*256, 8*4 ), STEP8( 10*256, 8*4 ),
- STEP8( 32*256, 8*4 ), STEP8( 34*256, 8*4 ), STEP8( 40*256, 8*4 ), STEP8( 42*256, 8*4 )
-};
-
-static const gfx_layout pts_8x8_4bits_layout =
-{
- 8,8, /* 8*8 pixels */
- RGN_FRAC(1,1), /* 65536 patterns */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 },
- EXTENDED_XOFFS,
- EXTENDED_YOFFS,
- 8*8*4,
- pts_4bits_layout_xoffset,
- pts_4bits_layout_yoffset
-};
-
-static const gfx_layout pts_16x16_4bits_layout =
-{
- 16,16, /* 16*16 pixels */
- RGN_FRAC(1,1), /* 16384 patterns */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 },
- EXTENDED_XOFFS,
- EXTENDED_YOFFS,
- 16*16*4,
- pts_4bits_layout_xoffset,
- pts_4bits_layout_yoffset
-};
-
-static const gfx_layout pts_32x32_4bits_layout =
-{
- 32,32, /* 32*32 pixels */
- RGN_FRAC(1,1), /* 4096 patterns */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 },
- EXTENDED_XOFFS,
- EXTENDED_YOFFS,
- 32*32*4,
- pts_4bits_layout_xoffset,
- pts_4bits_layout_yoffset
-};
-
-static const gfx_layout pts_64x64_4bits_layout =
-{
- 64,64, /* 32*32 pixels */
- RGN_FRAC(1,1), /* 1024 patterns */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 },
- EXTENDED_XOFFS,
- EXTENDED_YOFFS,
- 64*64*4,
- pts_4bits_layout_xoffset,
- pts_4bits_layout_yoffset
-};
-
-
-static const gfx_layout pts_8x8_8bits_layout =
-{
- 8,8, /* 8*8 pixels */
- RGN_FRAC(1,1), /* 32768 patterns */
- 8, /* 8 bits per pixel */
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { STEP8( 0*512, 8 ) },
- { STEP8( 0*512, 8*8 ) },
- 8*8*8
-};
-
-static const gfx_layout pts_16x16_8bits_layout =
-{
- 16,16, /* 16*16 pixels */
- RGN_FRAC(1,1), /* 8192 patterns */
- 8, /* 8 bits per pixel */
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { STEP8( 0*512, 8 ), STEP8( 1*512, 8 ) },
- { STEP8( 0*512, 8*8 ), STEP8( 2*512, 8*8 ) },
- 16*16*8
-};
-
-static GFXDECODE_START( namcond1 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_8x8_4bits_layout, 0, 16 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_16x16_4bits_layout, 0, 16 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_32x32_4bits_layout, 0, 16 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_64x64_4bits_layout, 0, 16 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_8x8_8bits_layout, 0, 256 )
- GFXDECODE_ENTRY( "gfx1", 0x00000000, pts_16x16_8bits_layout, 0, 256 )
-GFXDECODE_END
-
READ16_MEMBER(namcond1_state::mcu_p7_read)
{
return 0xff;
@@ -301,7 +203,6 @@ static MACHINE_CONFIG_START( namcond1, namcond1_state )
MCFG_SCREEN_UPDATE_DEVICE("ygv608", ygv608_device, update_screen)
MCFG_SCREEN_PALETTE("palette")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", namcond1)
MCFG_PALETTE_ADD("palette", 256)
/* sound hardware */
@@ -316,7 +217,6 @@ static MACHINE_CONFIG_START( namcond1, namcond1_state )
MCFG_AT28C16_ADD( "at28c16", NULL )
MCFG_YGV608_ADD("ygv608")
- MCFG_YGV608_GFXDECODE("gfxdecode")
MCFG_YGV608_PALETTE("palette")
MACHINE_CONFIG_END
@@ -328,7 +228,7 @@ ROM_START( ncv1 )
ROM_REGION( 0x80000,"mcu", 0 ) /* sub CPU */
ROM_LOAD( "nc1sub.1c", 0x00000, 0x80000, CRC(48ea0de2) SHA1(33e57c8d084a960ccbda462d18e355de44ec7ad9) )
- ROM_REGION( 0x200000,"gfx1", 0 ) /* 2MB character generator */
+ ROM_REGION( 0x200000,"ygv608", 0 ) /* 2MB character generator */
ROM_LOAD( "nc1cg0.10c", 0x000000, 0x200000, CRC(355e7f29) SHA1(47d92c4e28c3610a620d3c9b3be558199477f6d8) )
ROM_REGION( 0x1000000, "c352", 0 ) // Samples
@@ -343,7 +243,7 @@ ROM_START( ncv1j )
ROM_REGION( 0x80000,"mcu", 0 ) /* sub CPU */
ROM_LOAD( "nc1sub.1c", 0x00000, 0x80000, CRC(48ea0de2) SHA1(33e57c8d084a960ccbda462d18e355de44ec7ad9) )
- ROM_REGION( 0x200000,"gfx1", 0 ) /* 2MB character generator */
+ ROM_REGION( 0x200000,"ygv608", 0 ) /* 2MB character generator */
ROM_LOAD( "nc1cg0.10c", 0x000000, 0x200000, CRC(355e7f29) SHA1(47d92c4e28c3610a620d3c9b3be558199477f6d8) )
ROM_REGION( 0x1000000, "c352", 0 ) // Samples
@@ -358,7 +258,7 @@ ROM_START( ncv1j2 )
ROM_REGION( 0x80000,"mcu", 0 ) /* sub CPU */
ROM_LOAD( "nc1sub.1c", 0x00000, 0x80000, CRC(48ea0de2) SHA1(33e57c8d084a960ccbda462d18e355de44ec7ad9) )
- ROM_REGION( 0x200000,"gfx1", 0 ) /* 2MB character generator */
+ ROM_REGION( 0x200000,"ygv608", 0 ) /* 2MB character generator */
ROM_LOAD( "nc1cg0.10c", 0x000000, 0x200000, CRC(355e7f29) SHA1(47d92c4e28c3610a620d3c9b3be558199477f6d8) )
ROM_REGION( 0x1000000, "c352", 0 ) // Samples
@@ -373,7 +273,7 @@ ROM_START( ncv2 )
ROM_REGION( 0x80000,"mcu", 0 ) /* sub CPU */
ROM_LOAD( "ncs1sub.1d", 0x00000, 0x80000, CRC(365cadbf) SHA1(7263220e1630239e3e88b828c00389d02628bd7d) )
- ROM_REGION( 0x400000,"gfx1", 0 ) /* 4MB character generator */
+ ROM_REGION( 0x400000,"ygv608", 0 ) /* 4MB character generator */
ROM_LOAD( "ncs1cg0.10e", 0x000000, 0x200000, CRC(fdd24dbe) SHA1(4dceaae3d853075f58a7408be879afc91d80292e) )
ROM_LOAD( "ncs1cg1.10e", 0x200000, 0x200000, CRC(007b19de) SHA1(d3c093543511ec1dd2f8be6db45f33820123cabc) )
@@ -389,7 +289,7 @@ ROM_START( ncv2j )
ROM_REGION( 0x80000,"mcu", 0 ) /* sub CPU */
ROM_LOAD("ncs1sub.1d", 0x00000, 0x80000, CRC(365cadbf) SHA1(7263220e1630239e3e88b828c00389d02628bd7d) )
- ROM_REGION( 0x400000,"gfx1", 0 ) /* 4MB character generator */
+ ROM_REGION( 0x400000,"ygv608", 0 ) /* 4MB character generator */
ROM_LOAD( "ncs1cg0.10e", 0x000000, 0x200000, CRC(fdd24dbe) SHA1(4dceaae3d853075f58a7408be879afc91d80292e) )
ROM_LOAD( "ncs1cg1.10e", 0x200000, 0x200000, CRC(007b19de) SHA1(d3c093543511ec1dd2f8be6db45f33820123cabc) )
diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp
index 4bab602d1bc..b727012f2ef 100644
--- a/src/mame/drivers/naomi.cpp
+++ b/src/mame/drivers/naomi.cpp
@@ -1693,6 +1693,7 @@ static ADDRESS_MAP_START( naomi_map, AS_PROGRAM, 64, naomi_state )
AM_RANGE(0x00200000, 0x00207fff) AM_MIRROR(0x02000000) AM_RAM // bios uses it (battery backed ram ?)
AM_RANGE(0x005f6800, 0x005f69ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w )
AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) )
+ AM_RANGE(0x005f7018, 0x005f702f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16( "comm_board", m3comm_device, naomi_r, naomi_w, U64(0x0000ffff0000ffff) )
AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) )
AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) )
AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w )
@@ -2703,6 +2704,7 @@ static MACHINE_CONFIG_DERIVED( naomi_base, naomi_aw_base )
MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("mie_eeprom")
MCFG_X76F100_ADD("naomibd_eeprom")
+ MCFG_M3COMM_ADD("comm_board")
MACHINE_CONFIG_END
/*
@@ -2710,7 +2712,7 @@ MACHINE_CONFIG_END
*/
static MACHINE_CONFIG_DERIVED( naomi, naomi_base )
- MCFG_NAOMI_ROM_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_ROM_BOARD_ADD("rom_board", "naomibd_eeprom", "boardid", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
/*
@@ -2718,7 +2720,7 @@ MACHINE_CONFIG_END
*/
static MACHINE_CONFIG_DERIVED( naomigd, naomi_base )
- MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", ":pic", "naomibd_eeprom", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", "gdrom", "pic", "naomibd_eeprom", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
/*
@@ -2726,7 +2728,7 @@ MACHINE_CONFIG_END
*/
static MACHINE_CONFIG_DERIVED( naomim1, naomi_base )
- MCFG_NAOMI_M1_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_M1_BOARD_ADD("rom_board", "naomibd_eeprom", "boardid", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
/*
@@ -2734,7 +2736,7 @@ MACHINE_CONFIG_END
*/
static MACHINE_CONFIG_DERIVED( naomim2, naomi_base )
- MCFG_NAOMI_M2_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_M2_BOARD_ADD("rom_board", "naomibd_eeprom", "boardid", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
/*
@@ -2742,7 +2744,7 @@ MACHINE_CONFIG_END
*/
static MACHINE_CONFIG_DERIVED( naomim4, naomi_base )
- MCFG_NAOMI_M4_BOARD_ADD("rom_board", ":pic_readout", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_M4_BOARD_ADD("rom_board", "pic_readout", "naomibd_eeprom", "boardid", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
/*
@@ -2789,7 +2791,7 @@ static MACHINE_CONFIG_DERIVED( aw_base, naomi_aw_base )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(aw_map)
MCFG_MACRONIX_29L001MC_ADD("awflash")
- MCFG_AW_ROM_BOARD_ADD("rom_board", ":rom_key", WRITE8(dc_state, g1_irq))
+ MCFG_AW_ROM_BOARD_ADD("rom_board", "rom_key", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( aw1c, aw_base )
@@ -3653,8 +3655,8 @@ ROM_START( derbyoc2 )
ROM_LOAD( "mpr-22304.ic10", 0x9800000, 0x1000000, CRC(46c1fb1f) SHA1(6daca76a75df3501f77e473eb065d48804fcc64a) )
ROM_LOAD( "mpr-22305.ic11", 0xa800000, 0x1000000, CRC(027d0e7b) SHA1(e3c874e60cabb6f9ce686696d9055a0c0d5289ae) )
- // 840-0083-01 2001 317-0327-JPN Naomi (label comes from unclear photo, can be wrong)
- ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // key is unknown, probably not used by game
+ // 840-0083-01 2001 317-0327-JPN Naomi
+ ROM_PARAMETER( ":rom_board:segam2crypt:key", "2a436bb7")
ROM_END
/*
diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp
index 576464351ed..0f76cf72df1 100644
--- a/src/mame/drivers/nc.cpp
+++ b/src/mame/drivers/nc.cpp
@@ -96,7 +96,6 @@
******************************************************************************/
#include "emu.h"
-#include "emuopts.h"
#include "cpu/z80/z80.h"
#include "includes/nc.h"
#include "machine/mc146818.h" /* for NC200 real time clock */
diff --git a/src/mame/drivers/neogeo_noslot.cpp b/src/mame/drivers/neogeo_noslot.cpp
index 761e234a93b..3dc99c2dc2a 100644
--- a/src/mame/drivers/neogeo_noslot.cpp
+++ b/src/mame/drivers/neogeo_noslot.cpp
@@ -7561,6 +7561,30 @@ ROM_START( kf2k3pcb ) /* Encrypted Set, JAMMA PCB */
ROM_END
+
+ROM_START( unkneo )
+ ROM_REGION( 0x100000, "maincpu", 0 )
+ ROM_LOAD16_BYTE( "EP1.bin", 0x000001, 0x080000, CRC(f353448c) SHA1(f0f966ca15d503e01b40e901765ff0888463b65d) )
+ ROM_LOAD16_BYTE( "EP2.bin", 0x000000, 0x080000, CRC(f25c71ad) SHA1(803fb6cd6a7ada59678ad901ff9788b1e54ddd0c) )
+
+ NEO_SFIX_128K( "s1.s1", CRC(706477a7) SHA1(8cbee7f6832e7edd2dc792ca330420a6a984b879) ) // was a dead AXS512PC 512KB sram card, this data is handcrafted to make the set usable (hence BAD_DUMP)
+
+ NEOGEO_BIOS
+ ROM_REGION( 0x20000, "audiobios", 0 )
+ ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) )
+ ROM_REGION( 0x30000, "audiocpu", ROMREGION_ERASE00 )
+ /* not present */
+
+ ROM_REGION( 0x400000, "ymsnd", 0 )
+ ROM_LOAD( "sram.v1", 0x000000, 0x200000, NO_DUMP ) // was a dead AXS2000PC 2MB sram card, battery dead, data lost.
+
+ NO_DELTAT_REGION
+
+ ROM_REGION( 0x2000000, "sprites", 0 )
+ ROM_LOAD16_BYTE( "no3.bin", 0x000000, 0x1000000, CRC(81821826) SHA1(b7c1a53e32633383675206a16c68f6f2ff984865) )
+ ROM_LOAD16_BYTE( "no4.bin", 0x000001, 0x1000000, CRC(3601d568) SHA1(800323e52f5d33b402f84d31850b42c688082d67) )
+ROM_END
+
/*************************************
*
* Bootleg sets
@@ -9902,6 +9926,8 @@ GAME( 1995, marukodq, neogeo, neogeo_noslot, neogeo, neogeo_state, neoge
GAME( 1995, doubledr, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Double Dragon (Neo-Geo)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, gowcaizr, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Voltage Fighter - Gowcaizer / Choujin Gakuen Gowcaizer", MACHINE_SUPPORTS_SAVE )
GAME( 1996, sdodgeb, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan", "Super Dodge Ball / Kunio no Nekketsu Toukyuu Densetsu", MACHINE_SUPPORTS_SAVE )
+GAME( 199?, unkneo, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Technos Japan?", "Unknown Neo-Geo Vs. Fighter (prototype)", MACHINE_SUPPORTS_SAVE ) // same ID code as Voltage Fighter Gowkaizer so probably by Technos
+
/* Tecmo */
GAME( 1996, tws96, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "Tecmo", "Tecmo World Soccer '96", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/ninjakd2.cpp b/src/mame/drivers/ninjakd2.cpp
index a69e8ff2181..af71f1f08dd 100644
--- a/src/mame/drivers/ninjakd2.cpp
+++ b/src/mame/drivers/ninjakd2.cpp
@@ -1352,6 +1352,61 @@ ROM_START( robokid )
ROM_LOAD( "robokid.18a", 0x50000, 0x10000, CRC(fdff7441) SHA1(843b2c92bbc6f7319568677d50cbd9b03475b34a) )
ROM_END
+
+
+ROM_START( robokidj3 )
+ ROM_REGION( 0x50000, "maincpu", 0 )
+ ROM_LOAD( "robokid1.18j", 0x00000, 0x08000, CRC(77a9332a) SHA1(60464ff8bdea5ee2256f24210dc7246fcffb0fca) )
+ ROM_IGNORE( 0x08000 )
+ ROM_RELOAD( 0x10000, 0x10000 ) // banked at 8000-bfff
+ ROM_LOAD( "robokid2.18k", 0x20000, 0x10000, CRC(715ecee4) SHA1(1c00b9233b24ca70b0d097c2f62b85db280a9c9b) )
+ ROM_LOAD( "robokid3.15k", 0x30000, 0x10000, CRC(ce12fa86) SHA1(73beaeea5b50ec90d612813845f8345a465750f7) )
+ ROM_LOAD( "robokid4.12k", 0x40000, 0x10000, CRC(97e86600) SHA1(e140a2e323e9a91ae415fd5539b3e0226dff3a69) )
+
+ ROM_REGION( 0x100, "maincpu_prom", 0 )
+ ROM_LOAD( "prom82s129.cpu", 0x000, 0x100, BAD_DUMP CRC(4dd96f67) SHA1(01b415d9e86ff0c5aad7cfe81e903f2c202bb541))
+
+ ROM_REGION( 0x10000, "soundcpu", 0 )
+ ROM_LOAD( "robokid.k7", 0x00000, 0x10000, CRC(f490a2e9) SHA1(861d1256c090ce3d1f45f95cc894affbbc3f1466) )
+
+ ROM_REGION( 0x08000, "gfx1", 0 ) // fg tiles
+ ROM_LOAD( "robokid.b9", 0x00000, 0x08000, CRC(fac59c3f) SHA1(1b202ad5c12982512129d9e097267dd31b984ae8) )
+
+ ROM_REGION( 0x40000, "gfx2", 0 ) // sprite tiles
+ ROM_LOAD( "robokid.15f", 0x00000, 0x10000, CRC(ba61f5ab) SHA1(8433ddd55f0184cd5e8bb4a94a1c2336b2f8ff05) )
+ ROM_LOAD( "robokid.16f", 0x10000, 0x10000, CRC(d9b399ce) SHA1(70755c9cae27187f183ae6d61bedb95c420756f4) )
+ ROM_LOAD( "robokid.17f", 0x20000, 0x10000, CRC(afe432b9) SHA1(1ec7954ccf112eddf0ffcb8b5aec6cbc5cba7a7a) )
+ ROM_LOAD( "robokid.18f", 0x30000, 0x10000, CRC(a0aa2a84) SHA1(4d46c169429cd285644336c7d47e393b33bd8770) )
+
+ ROM_REGION( 0x80000, "gfx3", 0 ) // bg0 tiles
+ ROM_LOAD( "robokid.19c", 0x00000, 0x10000, CRC(02220421) SHA1(f533e9c6cea1dccbb60e0528c470f3cb5e8fc44e) )
+ ROM_LOAD( "robokid.20c", 0x10000, 0x10000, CRC(02d59bc2) SHA1(031acbb14145f9f4623de8868c6207fb9f8e8207) )
+ ROM_LOAD( "robokid.17d", 0x20000, 0x10000, CRC(2fa29b99) SHA1(13dce7932e2e9c03a139a4293584838aa3d9f1c3) )
+ ROM_LOAD( "robokid.18d", 0x30000, 0x10000, CRC(ae15ce02) SHA1(175e4eebdf12f1f373e01a4b1c933053ddd09abf) )
+ ROM_LOAD( "robokid.19d", 0x40000, 0x10000, CRC(784b089e) SHA1(1ae3346b4afa3da9484ebc59c8a530cb95f7d277) )
+ ROM_LOAD( "robokid.20d", 0x50000, 0x10000, CRC(b0b395ed) SHA1(31ec07634053793a701bbfd601b029f7da66e9d7) )
+ ROM_LOAD( "robokid.19f", 0x60000, 0x10000, CRC(0f9071c6) SHA1(8bf0c35189eda98a9bc150788890e136870cb5b2) )
+
+ ROM_REGION( 0x80000, "gfx4", 0 ) // bg1 tiles
+ ROM_LOAD( "robokid.12c", 0x00000, 0x10000, CRC(0ab45f94) SHA1(d8274263068d998c89a1b247dde7f814037cc15b) )
+ ROM_LOAD( "robokid.14c", 0x10000, 0x10000, CRC(029bbd4a) SHA1(8e078cdafe608fc6cde827be85c5267ade4ecca6) )
+ ROM_LOAD( "robokid.15c", 0x20000, 0x10000, CRC(7de67ebb) SHA1(2fe92e50e2894dd363e69b053db96bdb66a273eb) )
+ ROM_LOAD( "robokid.16c", 0x30000, 0x10000, CRC(53c0e582) SHA1(763e6127532d022a707bf9ddf1a832413745f248) )
+ ROM_LOAD( "robokid.17c", 0x40000, 0x10000, CRC(0cae5a1e) SHA1(a183a33516c81ea2c029b72ee6261c4519e095ab) )
+ ROM_LOAD( "robokid.18c", 0x50000, 0x10000, CRC(56ac7c8a) SHA1(66ed5646a2e8563caeb4ff96fa7d34fde27e9899) )
+ ROM_LOAD( "robokid.15d", 0x60000, 0x10000, CRC(cd632a4d) SHA1(a537d9ced45fdac490097e9162ac4d09a470be79) )
+ ROM_LOAD( "robokid.16d", 0x70000, 0x10000, CRC(18d92b2b) SHA1(e6d20ea8f0fac8bd4824a3b279a0fd8a1d6c26f5) )
+
+ ROM_REGION( 0x80000, "gfx5", 0 ) // bg2 tiles
+ ROM_LOAD( "robokid.12a", 0x00000, 0x10000, CRC(e64d1c10) SHA1(d1073c80c9788aba65410f88691747a37b2a9d4a) )
+ ROM_LOAD( "robokid.14a", 0x10000, 0x10000, CRC(8f9371e4) SHA1(0ea06d62bf4673ebda49a849cead832a24e5b886) )
+ ROM_LOAD( "robokid.15a", 0x20000, 0x10000, CRC(469204e7) SHA1(8c2e94635b2b304e7dfa2e6ad58ba526dcf02453) )
+ ROM_LOAD( "robokid.16a", 0x30000, 0x10000, CRC(4e340815) SHA1(d204b830c5809f25f7dfa451bbcbeda8b81ced54) )
+ ROM_LOAD( "robokid.17a", 0x40000, 0x10000, CRC(f0863106) SHA1(ff7e44d0aa5a07ec9a7eddef1a55181bd2e867b1) )
+ ROM_LOAD( "robokid.18a", 0x50000, 0x10000, CRC(fdff7441) SHA1(843b2c92bbc6f7319568677d50cbd9b03475b34a) )
+ROM_END
+
+
ROM_START( robokidj )
ROM_REGION( 0x50000, "maincpu", 0 )
ROM_LOAD( "1.29", 0x00000, 0x08000, CRC(59a1e2ec) SHA1(71f9d28dd8d2cf77a27fab163ce9562e3e75a540) )
@@ -1620,10 +1675,15 @@ GAME( 1987, ninjakd2b, ninjakd2, ninjakd2, rdaction, ninjakd2_state, bootleg, R
GAME( 1987, ninjakd2c, ninjakd2, ninjakd2, rdaction, ninjakd2_state, ninjakd2, ROT0, "UPL", "Ninja-Kid II / NinjaKun Ashura no Shou (set 4)", MACHINE_SUPPORTS_SAVE ) // close to set 3
GAME( 1987, rdaction, ninjakd2, ninjakd2, rdaction, ninjakd2_state, ninjakd2, ROT0, "UPL (World Games license)", "Rad Action / NinjaKun Ashura no Shou", MACHINE_SUPPORTS_SAVE )
GAME( 1987, jt104, ninjakd2, ninjakd2, rdaction, ninjakd2_state, bootleg, ROT0, "UPL (United Amusements license)", "JT-104 (title screen modification of Rad Action)", MACHINE_SUPPORTS_SAVE )
+
GAME( 1987, mnight, 0, mnight, mnight, ninjakd2_state, mnight, ROT0, "UPL (Kawakus license)", "Mutant Night", MACHINE_SUPPORTS_SAVE )
+
GAME( 1988, arkarea, 0, arkarea, arkarea, ninjakd2_state, mnight, ROT0, "UPL", "Ark Area", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, robokid, 0, robokid, robokid, ninjakd2_state, robokid, ROT0, "UPL", "Atomic Robo-kid", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, robokidj, robokid, robokid, robokidj, ninjakd2_state, robokidj, ROT0, "UPL", "Atomic Robo-kid (Japan, set 1)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, robokidj2, robokid, robokid, robokidj, ninjakd2_state, robokidj, ROT0, "UPL", "Atomic Robo-kid (Japan, set 2)", MACHINE_SUPPORTS_SAVE )
+
+GAME( 1988, robokid, 0, robokid, robokid, ninjakd2_state, robokid, ROT0, "UPL", "Atomic Robo-kid (World, Type-2)", MACHINE_SUPPORTS_SAVE ) // 3-digit highscore names
+GAME( 1988, robokidj, robokid, robokid, robokidj, ninjakd2_state, robokidj, ROT0, "UPL", "Atomic Robo-kid (Japan, Type-2, set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, robokidj2, robokid, robokid, robokidj, ninjakd2_state, robokidj, ROT0, "UPL", "Atomic Robo-kid (Japan, Type-2, set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, robokidj3, robokid, robokid, robokidj, driver_device, 0, ROT0, "UPL", "Atomic Robo-kid (Japan)", MACHINE_SUPPORTS_SAVE )
+
GAME( 1989, omegaf, 0, omegaf, omegaf, driver_device, 0, ROT270, "UPL", "Omega Fighter", MACHINE_SUPPORTS_SAVE )
GAME( 1989, omegafs, omegaf, omegaf, omegaf, driver_device, 0, ROT270, "UPL", "Omega Fighter Special", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/nmg5.cpp b/src/mame/drivers/nmg5.cpp
index 53b65663cf0..6a808ce11d4 100644
--- a/src/mame/drivers/nmg5.cpp
+++ b/src/mame/drivers/nmg5.cpp
@@ -999,7 +999,6 @@ static MACHINE_CONFIG_START( nmg5, nmg5_state )
MCFG_DECO_SPRITE_FLIPALLX(1)
MCFG_DECO_SPRITE_OFFSETS(0, 8)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp
index a64c10fd96a..1b216b62468 100644
--- a/src/mame/drivers/nwk-tr.cpp
+++ b/src/mame/drivers/nwk-tr.cpp
@@ -802,16 +802,11 @@ static MACHINE_CONFIG_START( nwktr, nwktr_state )
MCFG_PALETTE_ADD("palette", 65536)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k001604", K001604, 0)
- MCFG_K001604_GFX_INDEX1(0)
- MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@@ -832,13 +827,10 @@ static MACHINE_CONFIG_DERIVED( thrilld, nwktr )
MCFG_DEVICE_REMOVE("k001604")
MCFG_DEVICE_ADD("k001604", K001604, 0)
- MCFG_K001604_GFX_INDEX1(0)
- MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(1)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/opwolf.cpp b/src/mame/drivers/opwolf.cpp
index 36837da295e..826402fbb1e 100644
--- a/src/mame/drivers/opwolf.cpp
+++ b/src/mame/drivers/opwolf.cpp
@@ -679,9 +679,12 @@ static INPUT_PORTS_START( opwolfp )
PORT_DIPNAME( 0x20, 0x20, "Infinite Health (Cheat)" ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x20, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
+ PORT_DIPNAME( 0x40, 0x40, "Infinite Ammo (Cheat)" ) PORT_DIPLOCATION("SW2:7") // is 'Discount when Continuing' in final release
+ PORT_DIPSETTING( 0x40, DEF_STR( No ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Japanese ) )
- PORT_DIPSETTING( 0x00, "English (invalid)" ) // game hangs on course screen (confirmed on hardware)
+ PORT_DIPSETTING( 0x00, "English (invalid)" ) // game hangs on course screen (confirmed on hardware where it watchdog resets)
INPUT_PORTS_END
@@ -793,7 +796,6 @@ static MACHINE_CONFIG_START( opwolf, opwolf_state )
MCFG_DEVICE_ADD("pc080sn", PC080SN, 0)
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("pc090oj", PC090OJ, 0)
MCFG_PC090OJ_GFXDECODE("gfxdecode")
@@ -868,7 +870,6 @@ static MACHINE_CONFIG_START( opwolfb, opwolf_state ) /* OSC clocks unknown for t
MCFG_DEVICE_ADD("pc080sn", PC080SN, 0)
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("pc090oj", PC090OJ, 0)
MCFG_PC090OJ_GFXDECODE("gfxdecode")
diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp
index 5dd5191318b..c5b1f19898d 100644
--- a/src/mame/drivers/overdriv.cpp
+++ b/src/mame/drivers/overdriv.cpp
@@ -340,17 +340,13 @@ static MACHINE_CONFIG_START( overdriv, overdriv_state )
MCFG_SCREEN_UPDATE_DRIVER(overdriv_state, screen_update_overdriv)
MCFG_SCREEN_PALETTE("palette")
-// MCFG_GFXDECODE_ADD("gfxdecode", "palette", overdriv)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(overdriv_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx1", 0, NORMAL_PLANE_ORDER, 77, 22)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx1", NORMAL_PLANE_ORDER, 77, 22)
MCFG_K053246_PALETTE("palette")
MCFG_DEVICE_ADD("k051316_1", K051316, 0)
diff --git a/src/mame/drivers/pbaction.cpp b/src/mame/drivers/pbaction.cpp
index a62ddc0b6db..626a2e690c4 100644
--- a/src/mame/drivers/pbaction.cpp
+++ b/src/mame/drivers/pbaction.cpp
@@ -68,7 +68,7 @@ Stephh's notes (based on the game Z80 code and some tests) :
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "includes/pbaction.h"
@@ -317,8 +317,11 @@ static MACHINE_CONFIG_START( pbaction, pbaction_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pbactionx, pbaction )
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_CPU_PBACTIO4, 4000000) /* 4 MHz? */
+ MCFG_CPU_PROGRAM_MAP(pbaction_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", pbaction_state, vblank_irq)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MACHINE_CONFIG_END
@@ -487,45 +490,15 @@ DRIVER_INIT_MEMBER(pbaction_state,pbactio3)
rom[i] = BITSWAP8(rom[i], 7,6,5,4,1,2,3,0);
}
- /* then do the standard Sega decryption */
- DRIVER_INIT_CALL(pbactio4);
-
/* install a protection (?) workaround */
m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xc000, read8_delegate(FUNC(pbaction_state::pbactio3_prot_kludge_r),this) );
}
-DRIVER_INIT_MEMBER(pbaction_state,pbactio4)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0xa8,0xa0,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...0...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0x28,0xa0,0x20 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0x28,0xa0,0x20 } /* ...1...1...1...1 */
- };
-
- /* this one only has the Sega decryption */
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
GAME( 1985, pbaction, 0, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, pbaction2, pbaction, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, pbaction3, pbaction, pbactionx, pbaction, pbaction_state, pbactio3, ROT90, "Tehkan", "Pinball Action (set 3, encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, pbaction4, pbaction, pbactionx, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 4, encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, pbaction5, pbaction, pbactionx, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 5, encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, pbaction4, pbaction, pbactionx, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 4, encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, pbaction5, pbaction, pbactionx, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 5, encrypted)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/pc.cpp b/src/mame/drivers/pc.cpp
index 0ab59558865..7452b907f44 100644
--- a/src/mame/drivers/pc.cpp
+++ b/src/mame/drivers/pc.cpp
@@ -340,6 +340,11 @@ ROM_START( sicpc1605 )
ROM_LOAD("multitech pc-700 3.1.bin", 0xe000, 0x2000, CRC(0ac7a2e1) SHA1(b9c8504e21213d81a068dde9f51f9c973d726e7b))
ROM_END
+ROM_START( ncrpc4i )
+ ROM_REGION(0x10000,"bios", 0)
+ ROM_LOAD( "ncr_pc4i_biosrom_1985.bin",0xc000, 0x4000, CRC(b9732648) SHA1(0d5d96fbc36089ca4d893b0db84faffa8043a5e4))
+ROM_END
+
ROM_START( zdsupers )
ROM_REGION(0x10000,"bios", 0)
ROM_SYSTEM_BIOS( 0, "v31d", "v3.1d" )
@@ -434,17 +439,18 @@ ROM_END
ROM_START( compc1 )
ROM_REGION(0x10000, "bios", 0)
- ROM_LOAD("380270-01.bin", 0xc000, 0x4000, BAD_DUMP CRC(75135d37) SHA1(177283642240fee191ba2d87e1d0c2a377c78ccb))
+ ROM_LOAD("pc1_bios.bin", 0xc000, 0x4000, CRC(e37367c8) SHA1(9aac9c38b4ebdb9a740e393199c2eff75a0bde03))
ROM_REGION(0x8000, "gfx1", 0)
- ROM_LOAD("pc1_char.bin", 0x0000, 0x8000, CRC(4773a945) SHA1(bcc38abecc75d3f641d42987cb0d2ed71d71bc4c))
+ ROM_LOAD("pc1_char.bin", 0x0000, 0x4000, CRC(ee6c27f0) SHA1(e769cc3a49a1d708bd74eb4ac85bb6ea67220d38))
ROM_END
+
// Note: Commodore PC20-III, PC10-III and COLT share the same BIOS
ROM_START( pc10iii )
ROM_REGION(0x10000, "bios", 0)
ROM_DEFAULT_BIOS("v441")
ROM_SYSTEM_BIOS(0, "v435", "v4.35")
- ROMX_LOAD("318085-01.u201", 0x8000, 0x8000, NO_DUMP, ROM_BIOS(1))
+ ROMX_LOAD("318085-01.u201", 0x8000, 0x8000, CRC(be752d1e) SHA1(5e5e63cd6d6269816cd691602e4c4d209fe3df67), ROM_BIOS(1))
ROM_SYSTEM_BIOS(1, "v436", "v4.36")
ROMX_LOAD("318085-02.u201", 0x8000, 0x8000, NO_DUMP, ROM_BIOS(2))
ROM_SYSTEM_BIOS(2, "v436c", "v4.36c")
@@ -509,7 +515,8 @@ COMP( 1991, poisk2, ibm5150, 0, poisk2, pccga, driver_device
COMP( 1990, mc1702, ibm5150, 0, pccga, pccga, driver_device, 0, "<unknown>", "Elektronika MC-1702", MACHINE_NOT_WORKING)
COMP( 1987, zdsupers, ibm5150, 0, zenith, pccga, driver_device, 0, "Zenith Data Systems", "SuperSport", 0)
-COMP( 1985, sicpc1605, ibm5150, 0, siemens, pccga, driver_device, 0, "Siemens", "Sicomp PC16-05", 0)
+COMP( 1985, sicpc1605, ibm5150, 0, siemens, pccga, driver_device, 0, "Siemens", "Sicomp PC16-05", MACHINE_NOT_WORKING)
+COMP( 1985, ncrpc4i, ibm5150, 0, pccga, pccga, driver_device, 0, "NCR","PC4i", MACHINE_NOT_WORKING)
COMP( 198?, olivm15, ibm5150, 0, m15, pccga, driver_device, 0, "Olivetti", "M15", 0)
diff --git a/src/mame/drivers/pcktgal.cpp b/src/mame/drivers/pcktgal.cpp
index 3a34210d516..f2745cb74a4 100644
--- a/src/mame/drivers/pcktgal.cpp
+++ b/src/mame/drivers/pcktgal.cpp
@@ -244,7 +244,7 @@ static MACHINE_CONFIG_START( pcktgal, pcktgal_state )
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,0,0,0);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(0, 0, 0)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
/* sound hardware */
diff --git a/src/mame/drivers/pengo.cpp b/src/mame/drivers/pengo.cpp
index c47fb18f97f..0d4f12b4139 100644
--- a/src/mame/drivers/pengo.cpp
+++ b/src/mame/drivers/pengo.cpp
@@ -65,7 +65,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "includes/pacman.h"
@@ -77,7 +77,6 @@ public:
DECLARE_WRITE8_MEMBER(pengo_coin_counter_w);
DECLARE_WRITE8_MEMBER(irq_mask_w);
DECLARE_DRIVER_INIT(penta);
- DECLARE_DRIVER_INIT(pengo);
INTERRUPT_GEN_MEMBER(vblank_irq);
optional_shared_ptr<UINT8> m_decrypted_opcodes;
@@ -405,6 +404,14 @@ static MACHINE_CONFIG_DERIVED( pengou, pengo )
MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( pengoe, pengo )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5010, MASTER_CLOCK/6)
+ MCFG_CPU_PROGRAM_MAP(pengo_map)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", pengo_state, vblank_irq)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
static MACHINE_CONFIG_DERIVED( jrpacmbl, pengo )
/* basic machine hardware */
@@ -643,32 +650,6 @@ ROM_END
*
*************************************/
-DRIVER_INIT_MEMBER(pengo_state,pengo)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...0 */
- { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...1...1...1 */
- { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */
- { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...0...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */
- { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
- { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */
- { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...1...1...0 */
- { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
DRIVER_INIT_MEMBER(pengo_state,penta)
@@ -749,11 +730,11 @@ DRIVER_INIT_MEMBER(pengo_state,penta)
*
*************************************/
-GAME( 1982, pengo, 0, pengo, pengo, pengo_state, pengo, ROT90, "Sega", "Pengo (set 1 rev c)", MACHINE_SUPPORTS_SAVE )
-GAME( 1982, pengo2, pengo, pengo, pengo, pengo_state, pengo, ROT90, "Sega", "Pengo (set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1982, pengo, 0, pengoe, pengo, driver_device, 0, ROT90, "Sega", "Pengo (set 1 rev c)", MACHINE_SUPPORTS_SAVE )
+GAME( 1982, pengo2, pengo, pengoe, pengo, driver_device, 0, ROT90, "Sega", "Pengo (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pengo2u, pengo, pengou, pengo, driver_device, 0, ROT90, "Sega", "Pengo (set 2 not encrypted)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pengo3u, pengo, pengou, pengo, driver_device, 0, ROT90, "Sega", "Pengo (set 3 not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1982, pengo4, pengo, pengo, pengo, pengo_state, pengo, ROT90, "Sega", "Pengo (set 4)", MACHINE_SUPPORTS_SAVE )
+GAME( 1982, pengo4, pengo, pengoe, pengo, driver_device, 0, ROT90, "Sega", "Pengo (set 4)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pengob, pengo, pengo, pengo, pengo_state, penta, ROT90, "bootleg", "Pengo (bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, penta, pengo, pengo, pengo, pengo_state, penta, ROT90, "bootleg (Grinbee Shouji)", "Penta", MACHINE_SUPPORTS_SAVE ) // Grinbee Shouji was a subsidiary of Orca
GAME( 1983, jrpacmbl, jrpacman, jrpacmbl, jrpacmbl, driver_device, 0, ROT90, "bootleg", "Jr. Pac-Man (Pengo hardware)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/pipedrm.cpp b/src/mame/drivers/pipedrm.cpp
index 0151f62c79c..d73d18bd93c 100644
--- a/src/mame/drivers/pipedrm.cpp
+++ b/src/mame/drivers/pipedrm.cpp
@@ -662,7 +662,6 @@ static MACHINE_CONFIG_START( pipedrm, pipedrm_state )
MCFG_VSYSTEM_SPR2_SET_OFFSETS(-13, -6)
MCFG_VSYSTEM_SPR2_SET_PRITYPE(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(pipedrm_state,pipedrm)
diff --git a/src/mame/drivers/pktgaldx.cpp b/src/mame/drivers/pktgaldx.cpp
index f1f55c249af..98355880a4b 100644
--- a/src/mame/drivers/pktgaldx.cpp
+++ b/src/mame/drivers/pktgaldx.cpp
@@ -359,12 +359,10 @@ static MACHINE_CONFIG_START( pktgaldx, pktgaldx_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_INTERFACE_SCRAMBLE(8,9, 4,5,6,7 ,1,0,3,2) // hopefully this is correct, nothing else uses this arrangement!
diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp
index 3de354d2a38..3c43e990d4f 100644
--- a/src/mame/drivers/playch10.cpp
+++ b/src/mame/drivers/playch10.cpp
@@ -1420,6 +1420,27 @@ ROM_START( pc_ngai3 ) /* Ninja Gaiden 3 */
ROM_LOAD( "security.prm", 0x00, 0x10, CRC(13755943) SHA1(b7d809b0f60ef489777ccb35868f5c1e777356e0) )
ROM_END
+// this is identcal to the USA NES release with the generic 'New Game 2' menu rom.
+// TT-CHR.U1 = nes-ni-0 chr nes:ttoonadvu Tiny Toon Adventures (USA)
+// TT-GM2.U3 = u2 pc_virus Virus (Dr. Mario prototype, PlayChoice-10)
+// TT-PRG.U5 = nes-ni-0 prg nes:ttoonadvu Tiny Toon Adventures (USA)
+ROM_START( pc_ttoon ) /* Tiny Toon Adventures */
+ BIOS_CPU
+ ROM_LOAD( "TT-GM2.U3", 0x0c000, 0x2000, CRC(d2764d91) SHA1(393b54148e9250f14d83318aed6686cc04b923e6) ) /* extra bios code for this game */
+ BIOS_GFX
+
+ ROM_REGION( 0x50000, "cart", 0 )
+ ROM_LOAD( "TT-PRG.U5", 0x10000, 0x20000, CRC(9cb55b96) SHA1(437c326a4575895b9d7e567cab4f70b2f44ed8dd) ) /* banked */
+ ROM_RELOAD( 0x30000, 0x20000 )
+
+ ROM_REGION( 0x020000, "gfx2", 0 ) /* cart gfx */
+ ROM_LOAD( "TT-CHR.U1", 0x00000, 0x20000, CRC(a024ae14) SHA1(2e797a173161a61c14ce299e3c5a31c6029f2b50) )
+
+ ROM_REGION( 0x10, "rp5h01", 0 ) /* rp5h01 data */
+ ROM_LOAD( "security.u6", 0x00, 0x10, CRC(5b4f6930) SHA1(bd152d6907fe55f80125b34360fdb44cfc348906) )
+ROM_END
+
+
ROM_START( pc_radr2 ) /* Rad Racer II */
BIOS_CPU
ROM_LOAD( "qr-u3", 0x0c000, 0x2000, CRC(0c8fea63) SHA1(7ac04b151df732bd16708655352b7f13926f004f) ) /* extra bios code for this game */
@@ -1649,6 +1670,20 @@ DRIVER_INIT_MEMBER(playch10_state,virus)
DRIVER_INIT_CALL(pcfboard);
}
+DRIVER_INIT_MEMBER(playch10_state,ttoon)
+{
+ UINT8 *ROM = memregion("rp5h01")->base();
+ UINT32 len = memregion("rp5h01")->bytes();
+ for (int i = 0; i < len; i++)
+ {
+ ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] ^= 0xff;
+ }
+
+ /* common init */
+ DRIVER_INIT_CALL(pcgboard);
+}
+
/* YEAR NAME PARENT BIOS MACHINE INPUT INIT MONITOR */
/* Standard Games */
@@ -1717,6 +1752,8 @@ GAME( 1990, pc_ngai2, playch10, playch10, playch10, playch10_state, pcgboard, RO
GAME( 1991, pc_ngai3, playch10, playch10, playch10, playch10_state, pcgboard, ROT0, "Tecmo (Nintendo of America license)", "Ninja Gaiden Episode III: The Ancient Ship of Doom (PlayChoice-10)", 0 )
GAME( 1991, pc_pwbld, playch10, playch10, playch10, playch10_state, pcgboard, ROT0, "Taito (Nintendo of America license)", "Power Blade (PlayChoice-10)", 0 )
GAME( 1991, pc_rkats, playch10, playch10, playch10, playch10_state, pcgboard, ROT0, "Atlus (Nintendo of America license)", "Rockin' Kats (PlayChoice-10)", 0 )
+GAME( 1991, pc_ttoon, playch10, playch10, playch10, playch10_state, ttoon, ROT0, "Capcom USA (Nintendo of America license)", "Tiny Toon Adventures (prototype) (PlayChoice-10)", 0 ) // Code is final USA NES version of the game, (which is MMC3C according to nes.xml, but this cart has MMC3B)
+
/* variant with 4 screen mirror */
GAME( 1990, pc_radr2, playch10, playch10, playch10, playch10_state, pcgboard_type2, ROT0, "Square (Nintendo of America license)", "Rad Racer II (PlayChoice-10)", 0 )
GAME( 1985, pc_gntlt, playch10, playch10, playch10, playch10_state, pcgboard_type2, ROT0, "Atari / Tengen (Nintendo of America license)", "Gauntlet (PlayChoice-10)", MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/drivers/qdrmfgp.cpp b/src/mame/drivers/qdrmfgp.cpp
index 6e8a59867eb..28e8593117d 100644
--- a/src/mame/drivers/qdrmfgp.cpp
+++ b/src/mame/drivers/qdrmfgp.cpp
@@ -598,12 +598,9 @@ static MACHINE_CONFIG_START( qdrmfgp, qdrmfgp_state )
MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(qdrmfgp_state, qdrmfgp_tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4dj, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053252", K053252, XTAL_32MHz/4)
@@ -645,12 +642,9 @@ static MACHINE_CONFIG_START( qdrmfgp2, qdrmfgp_state )
MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp2)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(qdrmfgp_state, qdrmfgp2_tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4dj, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053252", K053252, XTAL_32MHz/4)
diff --git a/src/mame/drivers/r9751.cpp b/src/mame/drivers/r9751.cpp
index 1e92da690f2..49b2e756a02 100644
--- a/src/mame/drivers/r9751.cpp
+++ b/src/mame/drivers/r9751.cpp
@@ -87,6 +87,8 @@ private:
required_device<generic_terminal_device> m_terminal;
required_shared_ptr<UINT32> m_main_ram;
+ m68000_base_device* ptr_m68000;
+
// Begin registers
UINT32 reg_ff050004;
UINT32 reg_fff80040;
@@ -102,6 +104,9 @@ private:
// functions
UINT32 swap_uint32( UINT32 val );
+ UINT32 debug_a6();
+ UINT32 debug_a5();
+ UINT32 debug_a5_20();
virtual void machine_reset() override;
};
@@ -113,10 +118,25 @@ UINT32 r9751_state::swap_uint32( UINT32 val )
return (val << 16) | (val >> 16);
}
+UINT32 r9751_state::debug_a6()
+{
+ return m_maincpu->space(AS_PROGRAM).read_dword(ptr_m68000->dar[14] + 4);
+}
+
+UINT32 r9751_state::debug_a5()
+{
+ return m_maincpu->space(AS_PROGRAM).read_dword(ptr_m68000->dar[13]);
+}
+
+UINT32 r9751_state::debug_a5_20()
+{
+ return m_maincpu->space(AS_PROGRAM).read_dword(ptr_m68000->dar[13] + 0x20);
+}
+
READ8_MEMBER(r9751_state::pdc_dma_r)
{
/* This callback function takes the value written to 0xFF01000C as the bank offset */
- UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (offset&0xFFFF);
+ UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (offset&0x3FFFF);
if(TRACE_DMA) logerror("DMA READ: %08X DATA: %08X\n", address, m_maincpu->space(AS_PROGRAM).read_byte(address));
return m_maincpu->space(AS_PROGRAM).read_byte(address);
}
@@ -124,7 +144,7 @@ READ8_MEMBER(r9751_state::pdc_dma_r)
WRITE8_MEMBER(r9751_state::pdc_dma_w)
{
/* This callback function takes the value written to 0xFF01000C as the bank offset */
- UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (m_pdc->fdd_68k_dma_address&0xFFFF);
+ UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (m_pdc->fdd_68k_dma_address&0x3FFFF);
m_maincpu->space(AS_PROGRAM).write_byte(address,data);
if(TRACE_DMA) logerror("DMA WRITE: %08X DATA: %08X\n", address,data);
}
@@ -140,6 +160,7 @@ DRIVER_INIT_MEMBER(r9751_state,r9751)
smioc_dma_bank = 0;
m_mem = &m_maincpu->space(AS_PROGRAM);
+ m_maincpu->interface<m68000_base_device>(ptr_m68000);
}
void r9751_state::machine_reset()
@@ -255,7 +276,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w )
case 0xC0B0:
case 0xC1B0: /* fdd_dest_address register */
fdd_dest_address = data << 1;
- if(TRACE_FDC) logerror("--- FDD destination address: %08X PC: %08X Register: %08X\n", (fdd_dma_bank & 0x7FFFF800) + (fdd_dest_address&0xFFFF), space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000);
+ if(TRACE_FDC) logerror("--- FDD destination address: %08X PC: %08X Register: %08X (A6+4): %08X\n", (fdd_dma_bank & 0x7FFFF800) + (fdd_dest_address&0x3FFFF), space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, debug_a6());
data_b0 = data & 0xFF;
data_b1 = (data & 0xFF00) >> 8;
m_pdc->reg_p6 = data_b0;
@@ -274,14 +295,14 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w )
m_pdc->reg_p5 = 0;
/* Send FDD SCSI command location address to PDC 0x2, 0x3 */
- if(TRACE_FDC) logerror("--- FDD command address: %08X PC: %08X Register: %08X\n", (fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0xFFFF), space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000);
+ if(TRACE_FDC) logerror("--- FDD command address: %08X PC: %08X Register: %08X (A6+4): %08X A4: %08X (A5): %08X (A5+20): %08X\n", (fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0x3FFFF), space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, debug_a6(), ptr_m68000->dar[12], debug_a5(), debug_a5_20());
data_b0 = data & 0xFF;
data_b1 = (data & 0xFF00) >> 8;
m_pdc->reg_p2 = data_b0;
m_pdc->reg_p3 = data_b1;
- fdd_scsi_command = swap_uint32(m_mem->read_dword((fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0xFFFF)));
- fdd_scsi_command2 = swap_uint32(m_mem->read_dword(((fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0xFFFF))+4));
+ fdd_scsi_command = swap_uint32(m_mem->read_dword((fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0x3FFFF)));
+ fdd_scsi_command2 = swap_uint32(m_mem->read_dword(((fdd_dma_bank & 0x7FFFF800) + ((data << 1)&0x3FFFF))+4));
memcpy(c_fdd_scsi_command,&fdd_scsi_command,4);
memcpy(c_fdd_scsi_command+4,&fdd_scsi_command2,4);
@@ -300,7 +321,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w )
break;
default:
- if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, data, mem_mask);
+ if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x (A6+4): %08X\n", space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, data, mem_mask, debug_a6());
}
}
diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp
index eb29eea28c9..e5bc0fe0f7c 100644
--- a/src/mame/drivers/raiden2.cpp
+++ b/src/mame/drivers/raiden2.cpp
@@ -2456,6 +2456,40 @@ ROM_START( raidendxj )
ROM_END
+ROM_START( raidendxja )
+ ROM_REGION( 0x200000, "maincpu", 0 ) /* v30 main cpu */
+ ROM_LOAD32_BYTE("1.bin", 0x000000, 0x80000, CRC(247e21c7) SHA1(69e9a084407f57e8433f832a592cfbba2757631f) )
+ ROM_LOAD32_BYTE("2.bin", 0x000001, 0x80000, CRC(f2e9855a) SHA1(e27ac94cdb4ce8e8a98b342fbaf0fde11d9ab9ef) )
+ ROM_LOAD32_BYTE("3.bin", 0x000002, 0x80000, CRC(fbab727f) SHA1(5415ff87dd967e52b5cf7d754c046223cfa1147b) )
+ ROM_LOAD32_BYTE("4.bin", 0x000003, 0x80000, CRC(a08d5838) SHA1(ec07770503eefa5f22d30f40e3df2a02813908e4) )
+
+ ROM_REGION( 0x40000, "user2", 0 ) /* COPX */
+ ROM_LOAD( "copx-d2.u0313", 0x00000, 0x40000, CRC(a6732ff9) SHA1(c4856ec77869d9098da24b1bb3d7d58bb74b4cda) ) /* Shared with original Raiden 2 */
+
+ ROM_REGION( 0x20000, "audiocpu", ROMREGION_ERASEFF ) /* 64k code for sound Z80 */
+ ROM_LOAD( "rdxj_5.u1110", 0x000000, 0x08000, CRC(8c46857a) SHA1(8b269cb20adf960ba4eb594d8add7739dbc9a837) )
+ ROM_CONTINUE(0x10000,0x8000)
+ ROM_COPY( "audiocpu", 0x000000, 0x018000, 0x08000 )
+
+ ROM_REGION( 0x020000, "gfx1", 0 ) /* chars */
+ ROM_LOAD( "rdxj_7.u0724", 0x000000, 0x020000, CRC(ec31fa10) SHA1(e39c9d95699dbeb21e3661d863eee503c9011bbc) )
+
+ ROM_REGION( 0x400000, "gfx2", 0 ) /* background gfx */
+ ROM_LOAD( "dx_back-1.u075", 0x000000, 0x200000, CRC(90970355) SHA1(d71d57cd550a800f583550365102adb7b1b779fc) )
+ ROM_LOAD( "dx_back-2.u0714", 0x200000, 0x200000, CRC(5799af3e) SHA1(85d6532abd769da77bcba70bd2e77915af40f987) )
+
+ ROM_REGION32_LE( 0x800000, "gfx3", 0 ) /* sprite gfx (encrypted) */
+ ROM_LOAD32_WORD( "raiden_2_seibu_obj-1.u0811", 0x000000, 0x200000, CRC(ff08ef0b) SHA1(a1858430e8171ca8bab785457ef60e151b5e5cf1) ) /* Shared with original Raiden 2 */
+ ROM_LOAD32_WORD( "raiden_2_seibu_obj-2.u082", 0x000002, 0x200000, CRC(638eb771) SHA1(9774cc070e71668d7d1d20795502dccd21ca557b) ) /* Shared with original Raiden 2 */
+ ROM_LOAD32_WORD( "dx_obj-3.u0837", 0x400000, 0x200000, CRC(ba381227) SHA1(dfc4d659aca1722a981fa56a31afabe66f444d5d) )
+ ROM_LOAD32_WORD( "dx_obj-4.u0836", 0x400002, 0x200000, CRC(65e50d19) SHA1(c46147b4132abce7314b46bf419ce4773e024b05) )
+
+ ROM_REGION( 0x100000, "oki1", 0 ) /* ADPCM samples */
+ ROM_LOAD( "rdxj_6.u1017", 0x00000, 0x40000, CRC(9a9196da) SHA1(3d1ee67fb0d40a231ce04d10718f07ffb76db455) )
+
+ ROM_REGION( 0x100000, "oki2", 0 ) /* ADPCM samples */
+ ROM_LOAD( "pcm.u1018", 0x00000, 0x40000, CRC(8cf0d17e) SHA1(0fbe0b1e1ca5360c7c8329331408e3d799b4714c) ) /* Shared with original Raiden 2 */
+ROM_END
ROM_START( raidendxch )
ROM_REGION( 0x200000, "maincpu", 0 ) /* v30 main cpu */
@@ -3077,7 +3111,8 @@ GAME( 1994, raidendxk, raidendx, raidendx, raidendx, raiden2_state, raidendx, R
GAME( 1994, raidendxu, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden DX (US)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, raidendxg, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu (Tuning license)", "Raiden DX (Germany)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, raidendxnl, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu", "Raiden DX (Holland)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, raidendxj, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu", "Raiden DX (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, raidendxj, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu", "Raiden DX (Japan, set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, raidendxja, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu", "Raiden DX (Japan, set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, raidendxch, raidendx, raidendx, raidendx, raiden2_state, raidendx, ROT270, "Seibu Kaihatsu (Ideal International Development Corp license) ", "Raiden DX (China)", MACHINE_SUPPORTS_SAVE )
GAME( 1993, zeroteam, 0, zeroteam, zeroteam, raiden2_state, zeroteam, ROT0, "Seibu Kaihatsu (Fabtek license)", "Zero Team USA (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/rastan.cpp b/src/mame/drivers/rastan.cpp
index fe3c3dfa6b1..8ee49dd6992 100644
--- a/src/mame/drivers/rastan.cpp
+++ b/src/mame/drivers/rastan.cpp
@@ -383,7 +383,6 @@ static MACHINE_CONFIG_START( rastan, rastan_state )
MCFG_DEVICE_ADD("pc080sn", PC080SN, 0)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("pc090oj", PC090OJ, 0)
MCFG_PC090OJ_GFX_REGION(1)
diff --git a/src/mame/drivers/rbisland.cpp b/src/mame/drivers/rbisland.cpp
index 922e7f48dad..c71c201750d 100644
--- a/src/mame/drivers/rbisland.cpp
+++ b/src/mame/drivers/rbisland.cpp
@@ -654,7 +654,6 @@ static MACHINE_CONFIG_START( rbisland, rbisland_state )
MCFG_DEVICE_ADD("pc080sn", PC080SN, 0)
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("pc090oj", PC090OJ, 0)
MCFG_PC090OJ_GFXDECODE("gfxdecode")
@@ -708,7 +707,6 @@ static MACHINE_CONFIG_START( jumping, rbisland_state )
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_YINVERT(1)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/rohga.cpp b/src/mame/drivers/rohga.cpp
index 4114bf30579..0379125810b 100644
--- a/src/mame/drivers/rohga.cpp
+++ b/src/mame/drivers/rohga.cpp
@@ -834,7 +834,6 @@ static MACHINE_CONFIG_START( rohga, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -850,14 +849,12 @@ static MACHINE_CONFIG_START( rohga, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_PRIORITY_CB(rohga_state, rohga_pri_callback)
MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, rohga_col_callback)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
@@ -920,7 +917,6 @@ static MACHINE_CONFIG_START( wizdfire, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -936,17 +932,14 @@ static MACHINE_CONFIG_START( wizdfire, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
@@ -1012,7 +1005,6 @@ static MACHINE_CONFIG_START( nitrobal, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1028,17 +1020,14 @@ static MACHINE_CONFIG_START( nitrobal, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(4)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire)
@@ -1106,7 +1095,6 @@ static MACHINE_CONFIG_START( schmeisr, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -1122,14 +1110,12 @@ static MACHINE_CONFIG_START( schmeisr, rohga_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(2)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_PRIORITY_CB(rohga_state, rohga_pri_callback)
MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, schmeisr_col_callback) // wire mods on pcb...
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO104_ADD("ioprot104")
diff --git a/src/mame/drivers/rungun.cpp b/src/mame/drivers/rungun.cpp
index 38d526632e0..662cf5f8237 100644
--- a/src/mame/drivers/rungun.cpp
+++ b/src/mame/drivers/rungun.cpp
@@ -447,8 +447,7 @@ static MACHINE_CONFIG_START( rng, rungun_state )
MCFG_DEVICE_ADD("k055673", K055673, 0)
MCFG_K055673_CB(rungun_state, sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 1, K055673_LAYOUT_RNG, -8, 15)
- MCFG_K055673_GFXDECODE("gfxdecode")
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_RNG, -8, 15)
MCFG_K055673_PALETTE("palette")
MCFG_K055673_SET_SCREEN("screen")
diff --git a/src/mame/drivers/sandscrp.cpp b/src/mame/drivers/sandscrp.cpp
index 50937085c9b..f42ccc583b9 100644
--- a/src/mame/drivers/sandscrp.cpp
+++ b/src/mame/drivers/sandscrp.cpp
@@ -499,7 +499,6 @@ static MACHINE_CONFIG_START( sandscrp, sandscrp_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp
index 77874a36fe5..9e26251263d 100644
--- a/src/mame/drivers/segae.cpp
+++ b/src/mame/drivers/segae.cpp
@@ -296,7 +296,7 @@ GND 8A 8B GND
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "machine/mc8123.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrp2_device.h"
#include "video/315_5124.h"
#include "includes/segaipt.h"
@@ -1018,6 +1018,14 @@ static MACHINE_CONFIG_DERIVED( systemex, systeme )
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( systemex_315_5177, systeme )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, XTAL_10_738635MHz/2) /* Z80B @ 5.3693Mhz */
+ MCFG_CPU_PROGRAM_MAP(systeme_map)
+ MCFG_CPU_IO_MAP(io_map)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
static MACHINE_CONFIG_DERIVED( systemeb, systeme )
MCFG_DEVICE_MODIFY("maincpu")
MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map)
@@ -1030,61 +1038,6 @@ DRIVER_INIT_MEMBER(systeme_state, hangonjr)
}
-DRIVER_INIT_MEMBER(systeme_state, astrofl)
-{
- // 315-5177
- static const UINT8 xor_table[128] =
- {
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
-
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
- };
-
- static const int swap_table[128] =
- {
- 0,0,0,0,
- 1,1,1,1,1,
- 2,2,2,2,2,
- 3,3,3,3,
- 4,4,4,4,4,
- 5,5,5,5,5,
- 6,6,6,6,6,
- 7,7,7,7,7,
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,11,
- 12,12,12,12,12,
- 13,13,
-
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,
- 12,12,12,12,12,
- 13,13,13,13,13,
- 14,14,14,14,14,
- 15,15,15,15,15,
- 16,16,16,16,
- 17,17,17,17,17,
- 18,18,18,18,18,
- 19,19,19,19,19,
- 20,20,20,20,20,
- 21,21,
- };
-
- sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table);
-}
DRIVER_INIT_MEMBER(systeme_state, ridleofp)
@@ -1113,7 +1066,7 @@ DRIVER_INIT_MEMBER(systeme_state, fantzn2)
// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS
GAME( 1985, hangonjr, 0, systeme, hangonjr, systeme_state, hangonjr, ROT0, "Sega", "Hang-On Jr.", MACHINE_SUPPORTS_SAVE )
GAME( 1986, transfrm, 0, systeme, transfrm, driver_device, 0, ROT0, "Sega", "Transformer", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, astrofl, transfrm, systemex, transfrm, systeme_state, astrofl, ROT0, "Sega", "Astro Flash (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, astrofl, transfrm, systemex_315_5177, transfrm, driver_device, 0, ROT0, "Sega", "Astro Flash (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, ridleofp, 0, systeme, ridleofp, systeme_state, ridleofp, ROT90, "Sega / Nasco", "Riddle of Pythagoras (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, opaopa, 0, systemeb, opaopa, systeme_state, opaopa, ROT0, "Sega", "Opa Opa (MC-8123, 317-0042)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, fantzn2, 0, systemex, fantzn2, systeme_state, fantzn2, ROT0, "Sega", "Fantasy Zone II - The Tears of Opa-Opa (MC-8123, 317-0057)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp
index c07976572e7..be9bc6db239 100644
--- a/src/mame/drivers/segag80r.cpp
+++ b/src/mame/drivers/segag80r.cpp
@@ -112,7 +112,7 @@
#include "sound/sn76496.h"
#include "sound/samples.h"
#include "machine/i8255.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "machine/segag80.h"
#include "includes/segag80r.h"
@@ -885,8 +885,12 @@ static MACHINE_CONFIG_DERIVED( monsterb, g80r_base )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( monster2, monsterb )
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_SPAT, VIDEO_CLOCK/4)
+ MCFG_CPU_PROGRAM_MAP(main_map)
+ MCFG_CPU_IO_MAP(main_ppi8255_portmap)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", segag80r_state, segag80r_vblank_start)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pignewt, g80r_base )
@@ -906,10 +910,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sindbadm, g80r_base )
/* basic machine hardware */
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5028, VIDEO_CLOCK/4)
+ MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_IO_MAP(sindbadm_portmap)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", segag80r_state, sindbadm_vblank_start)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
MCFG_I8255_OUT_PORTA_CB(WRITE8(segag80r_state, sindbadm_soundport_w))
@@ -1509,29 +1515,7 @@ DRIVER_INIT_MEMBER(segag80r_state,monsterb)
DRIVER_INIT_MEMBER(segag80r_state,monster2)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
- { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */
- { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */
- { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */
- { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
- { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
+
address_space &iospace = m_maincpu->space(AS_IO);
address_space &pgmspace = m_maincpu->space(AS_PROGRAM);
@@ -1581,29 +1565,7 @@ DRIVER_INIT_MEMBER(segag80r_state,pignewt)
DRIVER_INIT_MEMBER(segag80r_state,sindbadm)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */
- { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
- { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
+
address_space &iospace = m_maincpu->space(AS_IO);
address_space &pgmspace = m_maincpu->space(AS_PROGRAM);
diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp
index b87aee5f734..9240b10d3bf 100644
--- a/src/mame/drivers/segas16a.cpp
+++ b/src/mame/drivers/segas16a.cpp
@@ -148,7 +148,7 @@ Tetris - - - - EPR12169 EPR12170 -
#include "emu.h"
#include "includes/segas16a.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrp2_device.h"
#include "machine/fd1089.h"
#include "machine/nvram.h"
#include "sound/dac.h"
@@ -1982,8 +1982,11 @@ static MACHINE_CONFIG_DERIVED( system16a_no7751, system16a )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( system16a_no7751p, system16a_no7751 )
- MCFG_DEVICE_MODIFY("soundcpu")
+ MCFG_CPU_REPLACE("soundcpu", SEGA_315_5177, 4000000)
+ MCFG_CPU_PROGRAM_MAP(sound_map)
+ MCFG_CPU_IO_MAP(sound_no7751_portmap)
MCFG_CPU_DECRYPTED_OPCODES_MAP(sound_decrypted_opcodes_map)
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":sound_decrypted_opcodes")
MACHINE_CONFIG_END
/*
@@ -3674,63 +3677,6 @@ DRIVER_INIT_MEMBER(segas16a_state,quartet)
m_i8751_vblank_hook = i8751_sim_delegate(FUNC(segas16a_state::quartet_i8751_sim), this);
}
-DRIVER_INIT_MEMBER(segas16a_state,fantzonep)
-{
- DRIVER_INIT_CALL(generic);
-
- // 315-5177
- static const UINT8 xor_table[128] =
- {
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
-
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
- };
-
- static const int swap_table[128] =
- {
- 0,0,0,0,
- 1,1,1,1,1,
- 2,2,2,2,2,
- 3,3,3,3,
- 4,4,4,4,4,
- 5,5,5,5,5,
- 6,6,6,6,6,
- 7,7,7,7,7,
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,11,
- 12,12,12,12,12,
- 13,13,
-
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,
- 12,12,12,12,12,
- 13,13,13,13,13,
- 14,14,14,14,14,
- 15,15,15,15,15,
- 16,16,16,16,
- 17,17,17,17,17,
- 18,18,18,18,18,
- 19,19,19,19,19,
- 20,20,20,20,20,
- 21,21,
- };
-
- sega_decode_2(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, xor_table, swap_table);
-}
DRIVER_INIT_MEMBER(segas16a_state,sdi)
{
@@ -3778,7 +3724,7 @@ GAME( 1986, alexkidd1, alexkidd, system16a_fd1089a, alexkidd, segas16a
GAME( 1986, fantzone, 0, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (Rev A, unprotected)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, fantzone1, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (unprotected)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, fantzonep, fantzone, system16a_no7751p, fantzone, segas16a_state,fantzonep, ROT0, "Sega", "Fantasy Zone (317-5000)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, fantzonep, fantzone, system16a_no7751p, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (317-5000)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, fantzonepr, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // bad / missing gfx roms
GAME( 1988, passsht16a, passsht, system16a_fd1094, passsht16a, segas16a_state,passsht16a, ROT270, "Sega", "Passing Shot (Japan, 4 Players, System 16A) (FD1094 317-0071)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/segas18.cpp b/src/mame/drivers/segas18.cpp
index c78c37f04c7..0dbb04eb3cf 100644
--- a/src/mame/drivers/segas18.cpp
+++ b/src/mame/drivers/segas18.cpp
@@ -45,7 +45,7 @@
void segas18_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 index)
{
- UINT32 romsize = m_maincpu->region()->bytes();
+ UINT32 romsize = m_maincpu_region->bytes();
switch (index)
{
case 7:
diff --git a/src/mame/drivers/segas24.cpp b/src/mame/drivers/segas24.cpp
index 0d97e55ffb3..795df5cfdfd 100644
--- a/src/mame/drivers/segas24.cpp
+++ b/src/mame/drivers/segas24.cpp
@@ -1934,9 +1934,7 @@ static MACHINE_CONFIG_START( system24, segas24_state )
MCFG_TIMER_ADD_NONE("frc_timer")
MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_frc", segas24_state, irq_frc_cb, attotime::from_hz(FRC_CLOCK_MODE1))
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_S24TILE_DEVICE_ADD("tile", 0xfff)
- MCFG_S24TILE_DEVICE_GFXDECODE("gfxdecode")
MCFG_S24TILE_DEVICE_PALETTE("palette")
MCFG_S24SPRITE_DEVICE_ADD("sprite")
MCFG_S24MIXER_DEVICE_ADD("mixer")
diff --git a/src/mame/drivers/segasp.cpp b/src/mame/drivers/segasp.cpp
index ea4482ec04a..51c54c98c3c 100644
--- a/src/mame/drivers/segasp.cpp
+++ b/src/mame/drivers/segasp.cpp
@@ -301,7 +301,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( segasp, naomi_aw_base, segasp_state )
// todo, not exactly NaomiM4 (see notes at top of driver) use custom board type here instead
MCFG_X76F100_ADD("naomibd_eeprom") // actually not present
- MCFG_NAOMI_M4_BOARD_ADD("rom_board", ":pic_readout", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
+ MCFG_NAOMI_M4_BOARD_ADD("rom_board", "pic_readout", "naomibd_eeprom", "boardid", WRITE8(dc_state, g1_irq))
MACHINE_CONFIG_END
#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp
index d6a6604fee1..534d5d5a164 100644
--- a/src/mame/drivers/segaybd.cpp
+++ b/src/mame/drivers/segaybd.cpp
@@ -739,7 +739,7 @@ static ADDRESS_MAP_START( suby_map, AS_PROGRAM, 16, segaybd_state )
AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("divider_suby", sega_315_5249_divider_device, read, write)
AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("shareram")
AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_SHARE("rotateram")
- AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_SHARE("sprites")
+ AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_SHARE("bsprites")
AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0x198000, 0x19ffff) AM_DEVREAD("segaic16vid", segaic16_video_device, rotate_control_r)
AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
@@ -1397,7 +1397,7 @@ static MACHINE_CONFIG_START( yboard, segaybd_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
- MCFG_SEGA_SYS16B_SPRITES_ADD("sprites")
+ MCFG_SEGA_SYS16B_SPRITES_ADD("bsprites")
MCFG_SEGA_YBOARD_SPRITES_ADD("ysprites")
MCFG_SEGAIC16VID_ADD("segaic16vid")
MCFG_SEGAIC16VID_GFXDECODE("gfxdecode")
@@ -1479,7 +1479,7 @@ ROM_START( gforce2 )
ROM_LOAD16_BYTE( "epr-11816b.54", 0x000000, 0x20000, CRC(317dd0c2) SHA1(7f1c7dcfb111385e2a94912975c2f9bfe78445ac) )
ROM_LOAD16_BYTE( "epr-11815b.53", 0x000001, 0x20000, CRC(f1fb22f1) SHA1(da3ce521b0a19b391913c35af34084d29edceca7) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-11467.16", 0x000000, 0x20000, CRC(6e60e736) SHA1(73086744cb2fe1ce162f851cb879755c21819b33) )
ROM_LOAD16_BYTE( "mpr-11468.14", 0x000001, 0x20000, CRC(74ca9ca5) SHA1(c6f27ce43ef270088e6155c8240fd15afa5729fd) )
ROM_LOAD16_BYTE( "epr-11694.17", 0x040000, 0x20000, CRC(7e297b84) SHA1(bbf1aa2b0b6b1f9fdaf9bea77d24b7f4f9320696) )
@@ -1553,7 +1553,7 @@ ROM_START( gforce2sd )
ROM_LOAD16_BYTE( "epr-11816b.54", 0x000000, 0x20000, CRC(317dd0c2) SHA1(7f1c7dcfb111385e2a94912975c2f9bfe78445ac) )
ROM_LOAD16_BYTE( "epr-11815b.53", 0x000001, 0x20000, CRC(f1fb22f1) SHA1(da3ce521b0a19b391913c35af34084d29edceca7) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-11467.16", 0x000000, 0x20000, CRC(6e60e736) SHA1(73086744cb2fe1ce162f851cb879755c21819b33) )
ROM_LOAD16_BYTE( "mpr-11468.14", 0x000001, 0x20000, CRC(74ca9ca5) SHA1(c6f27ce43ef270088e6155c8240fd15afa5729fd) )
ROM_LOAD16_BYTE( "epr-11694.17", 0x040000, 0x20000, CRC(7e297b84) SHA1(bbf1aa2b0b6b1f9fdaf9bea77d24b7f4f9320696) )
@@ -1631,7 +1631,7 @@ ROM_START( gforce2ja )
ROM_LOAD16_BYTE( "epr-11690a.54", 0x000000, 0x20000, CRC(e18bc177) SHA1(3fb179c9074954fc9b64da1463f542d60a99ec84) )
ROM_LOAD16_BYTE( "epr-11689a.53", 0x000001, 0x20000, CRC(6010e63e) SHA1(00aa5e8516f094409a407744b84ef183393b8b19) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-11467.16", 0x000000, 0x20000, CRC(6e60e736) SHA1(73086744cb2fe1ce162f851cb879755c21819b33) )
ROM_LOAD16_BYTE( "mpr-11468.14", 0x000001, 0x20000, CRC(74ca9ca5) SHA1(c6f27ce43ef270088e6155c8240fd15afa5729fd) )
ROM_LOAD16_BYTE( "epr-11694.17", 0x040000, 0x20000, CRC(7e297b84) SHA1(bbf1aa2b0b6b1f9fdaf9bea77d24b7f4f9320696) )
@@ -1706,7 +1706,7 @@ ROM_START( gforce2j )
ROM_LOAD16_BYTE( "epr-11513.54", 0x000000, 0x20000, CRC(e18bc177) SHA1(3fb179c9074954fc9b64da1463f542d60a99ec84) )
ROM_LOAD16_BYTE( "epr-11512.53", 0x000001, 0x20000, CRC(6010e63e) SHA1(00aa5e8516f094409a407744b84ef183393b8b19) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-11467.16", 0x000000, 0x20000, CRC(6e60e736) SHA1(73086744cb2fe1ce162f851cb879755c21819b33) )
ROM_LOAD16_BYTE( "mpr-11468.14", 0x000001, 0x20000, CRC(74ca9ca5) SHA1(c6f27ce43ef270088e6155c8240fd15afa5729fd) )
ROM_LOAD16_BYTE( "epr-11694.17", 0x040000, 0x20000, CRC(7e297b84) SHA1(bbf1aa2b0b6b1f9fdaf9bea77d24b7f4f9320696) )
@@ -1789,7 +1789,7 @@ ROM_START( gloc )
ROM_LOAD16_BYTE( "epr-13030.54", 0x000000, 0x20000, CRC(81abcabf) SHA1(cb4e817d66a7f384aa9757758c51cd1bf7347dd0) )
ROM_LOAD16_BYTE( "epr-13029.53", 0x000001, 0x20000, CRC(f3638efb) SHA1(f82a46fc8616cbe0235746161c587e54adecfe50) )
- ROM_REGION16_BE( 0x200000, "sprites", 0)
+ ROM_REGION16_BE( 0x200000, "bsprites", 0)
ROM_LOAD16_BYTE( "epr-13039.16", 0x000000, 0x80000, CRC(d7e1266d) SHA1(b0fc4cc60a7e876ae2af343bba6da3fb926ea9c5) )
ROM_LOAD16_BYTE( "epr-13037.14", 0x000001, 0x80000, CRC(b801a250) SHA1(7d1f6a1f2022a4f302f22d11fa79057cf8134ad2) )
ROM_LOAD16_BYTE( "epr-13040.17", 0x100000, 0x80000, CRC(4aeb3a85) SHA1(5521fd2d3956839bdbe7b70a9e60cd9fb72a42f1) )
@@ -1864,7 +1864,7 @@ ROM_START( glocu )
ROM_LOAD16_BYTE( "epr-13030.54", 0x000000, 0x20000, CRC(81abcabf) SHA1(cb4e817d66a7f384aa9757758c51cd1bf7347dd0) )
ROM_LOAD16_BYTE( "epr-13029.53", 0x000001, 0x20000, CRC(f3638efb) SHA1(f82a46fc8616cbe0235746161c587e54adecfe50) )
- ROM_REGION16_BE( 0x200000, "sprites", 0)
+ ROM_REGION16_BE( 0x200000, "bsprites", 0)
ROM_LOAD16_BYTE( "epr-13039.16", 0x000000, 0x80000, CRC(d7e1266d) SHA1(b0fc4cc60a7e876ae2af343bba6da3fb926ea9c5) )
ROM_LOAD16_BYTE( "epr-13037.14", 0x000001, 0x80000, CRC(b801a250) SHA1(7d1f6a1f2022a4f302f22d11fa79057cf8134ad2) )
ROM_LOAD16_BYTE( "epr-13040.17", 0x100000, 0x80000, CRC(4aeb3a85) SHA1(5521fd2d3956839bdbe7b70a9e60cd9fb72a42f1) )
@@ -1933,7 +1933,7 @@ ROM_START( glocr360 )
ROM_LOAD16_BYTE( "epr-13325a.54", 0x000000, 0x20000, CRC(aba307e5) SHA1(a27a7d3699a95d7c6265a23157b2fefd362003dd) )
ROM_LOAD16_BYTE( "epr-13324a.53", 0x000001, 0x20000, CRC(eb1b19e5) SHA1(3d1d7299cb3befc22afc0db0376d7f94dec37367) )
- ROM_REGION16_BE( 0x200000, "sprites", 0)
+ ROM_REGION16_BE( 0x200000, "bsprites", 0)
ROM_LOAD16_BYTE( "epr-13039.16", 0x000000, 0x80000, CRC(d7e1266d) SHA1(b0fc4cc60a7e876ae2af343bba6da3fb926ea9c5) )
ROM_LOAD16_BYTE( "epr-13037.14", 0x000001, 0x80000, CRC(b801a250) SHA1(7d1f6a1f2022a4f302f22d11fa79057cf8134ad2) )
ROM_LOAD16_BYTE( "epr-13040.17", 0x100000, 0x80000, CRC(4aeb3a85) SHA1(5521fd2d3956839bdbe7b70a9e60cd9fb72a42f1) )
@@ -2009,7 +2009,7 @@ ROM_START( pdrift )
ROM_LOAD16_BYTE( "epr-12019a.54", 0x000000, 0x20000, CRC(11188a30) SHA1(42dd0344d92529848b53a8cec4c145237ccd5b51) )
ROM_LOAD16_BYTE( "epr-12018a.53", 0x000001, 0x20000, CRC(1c582e1f) SHA1(c32d2f921554bddd7dedcb81e231aa91f50fa27b) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "epr-11789.16", 0x000000, 0x20000, CRC(b86f8d2b) SHA1(a053f2021841fd0ef89fd3f28050a698b36c435e) )
ROM_LOAD16_BYTE( "epr-11791.14", 0x000001, 0x20000, CRC(36b2910a) SHA1(9948b91837f944a7a606542fa685525e74bbe398) )
ROM_LOAD16_BYTE( "epr-11790.17", 0x040000, 0x20000, CRC(2a564e66) SHA1(5f30fc15bfd017d75cfffe1e9e62ed0bcf32a98e) )
@@ -2092,7 +2092,7 @@ ROM_START( pdrifta )
ROM_LOAD16_BYTE( "epr-12019.54", 0x000000, 0x20000, CRC(e514d7b6) SHA1(27ae99f5f3e8d2f248916f7a252e2c0686638df5) )
ROM_LOAD16_BYTE( "epr-12018.53", 0x000001, 0x20000, CRC(0a3f7faf) SHA1(fe20a164a7a2c9e9bf0e7aade75b0488bdc93d79) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "epr-11789.16", 0x000000, 0x20000, CRC(b86f8d2b) SHA1(a053f2021841fd0ef89fd3f28050a698b36c435e) )
ROM_LOAD16_BYTE( "epr-11791.14", 0x000001, 0x20000, CRC(36b2910a) SHA1(9948b91837f944a7a606542fa685525e74bbe398) )
ROM_LOAD16_BYTE( "epr-11790.17", 0x040000, 0x20000, CRC(2a564e66) SHA1(5f30fc15bfd017d75cfffe1e9e62ed0bcf32a98e) )
@@ -2176,7 +2176,7 @@ ROM_START( pdrifte )
ROM_LOAD16_BYTE( "epr-11903.54", 0x000000, 0x20000, CRC(d004f411) SHA1(212a985275647fae24b580ebaffc1230c06318ac) )
ROM_LOAD16_BYTE( "epr-11902.53", 0x000001, 0x20000, CRC(e8028e08) SHA1(de4ee5011e9552e624b6223e0e1ef00bc271a811) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "epr-11789.16", 0x000000, 0x20000, CRC(b86f8d2b) SHA1(a053f2021841fd0ef89fd3f28050a698b36c435e) )
ROM_LOAD16_BYTE( "epr-11791.14", 0x000001, 0x20000, CRC(36b2910a) SHA1(9948b91837f944a7a606542fa685525e74bbe398) )
ROM_LOAD16_BYTE( "epr-11790.17", 0x040000, 0x20000, CRC(2a564e66) SHA1(5f30fc15bfd017d75cfffe1e9e62ed0bcf32a98e) )
@@ -2262,7 +2262,7 @@ ROM_START( pdriftj )
ROM_LOAD16_BYTE( "epr-11750b.54", 0x000000, 0x20000, CRC(bc14ce30) SHA1(9bbadee0946e0abaac4f0d2625ba5550f11fa8a9) )
ROM_LOAD16_BYTE( "epr-11749b.53", 0x000001, 0x20000, CRC(9e385568) SHA1(74e22eaed645cc80b1eb0c52912186066e58b9d2) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "epr-11789.16", 0x000000, 0x20000, CRC(b86f8d2b) SHA1(a053f2021841fd0ef89fd3f28050a698b36c435e) )
ROM_LOAD16_BYTE( "epr-11791.14", 0x000001, 0x20000, CRC(36b2910a) SHA1(9948b91837f944a7a606542fa685525e74bbe398) )
ROM_LOAD16_BYTE( "epr-11790.17", 0x040000, 0x20000, CRC(2a564e66) SHA1(5f30fc15bfd017d75cfffe1e9e62ed0bcf32a98e) )
@@ -2347,7 +2347,7 @@ ROM_START(pdriftl)
ROM_LOAD16_BYTE("epr-12109.54", 0x000000, 0x20000, CRC(256350b8) SHA1(72b05d3583d63766690fed4827ec586e832168d1) )
ROM_LOAD16_BYTE("epr-12108.53", 0x000001, 0x20000, CRC(a3a56771) SHA1(f41d466f31a1b833d21a7011314c48d5056409eb) )
- ROM_REGION16_BE(0x080000, "sprites", 0)
+ ROM_REGION16_BE(0x080000, "bsprites", 0)
ROM_LOAD16_BYTE("epr-12114.16", 0x000000, 0x20000, CRC(8b07e8eb) SHA1(22a4aff968d6de52372b7b2b5322d353f7b835ef) )
ROM_LOAD16_BYTE("epr-12115.14", 0x000001, 0x20000, CRC(045b2912) SHA1(697c8eff69bf1a23745d24171f0b50635cf8513e) )
ROM_LOAD16_BYTE("epr-12112.17", 0x040000, 0x20000, CRC(5dd13e81) SHA1(74ced668a36480a2ce9e3667e4915bfee2391534) )
@@ -2440,7 +2440,7 @@ ROM_START( rchase )
ROM_LOAD16_BYTE( "epr-14092.54", 0x000000, 0x20000, CRC(18eb23c5) SHA1(53e5681c7450a3879ed80c1680168d6295caa887) ) // same as epr-13990.54 below
ROM_LOAD16_BYTE( "epr-14091.53", 0x000001, 0x20000, CRC(72a56f71) SHA1(d45d3072ea92b5dde5c70138e56e7f0ca248880e) ) // 1 byte difference between regions
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-13999.16", 0x000000, 0x40000, CRC(9a1dd53c) SHA1(cb01f2c64554914ea693879dfcb498181a1e7a9a) )
ROM_LOAD16_BYTE( "mpr-13997.14", 0x000001, 0x40000, CRC(1fdf1b87) SHA1(ed46af0f72081d545015b73a8d12240664f29506) )
@@ -2500,7 +2500,7 @@ ROM_START( rchasej )
ROM_LOAD16_BYTE( "epr-13990.54", 0x000000, 0x20000, CRC(18eb23c5) SHA1(53e5681c7450a3879ed80c1680168d6295caa887) )
ROM_LOAD16_BYTE( "epr-13989.53", 0x000001, 0x20000, CRC(8f4f824e) SHA1(d470f23ce2dca4e75b7b714175d47338c41bb721) )
- ROM_REGION16_BE( 0x080000, "sprites", 0 )
+ ROM_REGION16_BE( 0x080000, "bsprites", 0 )
ROM_LOAD16_BYTE( "mpr-13999.16", 0x000000, 0x40000, CRC(9a1dd53c) SHA1(cb01f2c64554914ea693879dfcb498181a1e7a9a) )
ROM_LOAD16_BYTE( "mpr-13997.14", 0x000001, 0x40000, CRC(1fdf1b87) SHA1(ed46af0f72081d545015b73a8d12240664f29506) )
@@ -2565,7 +2565,7 @@ ROM_START( strkfgtr )
ROM_LOAD16_BYTE( "epr-13828.54", 0x000000, 0x20000, CRC(2470cf5f) SHA1(eb1a732228fe7ad9cf0747d2b53e391c5a733667) )
ROM_LOAD16_BYTE( "epr-13827.53", 0x000001, 0x20000, CRC(a9d0cf7d) SHA1(c40c73c9e9105ed6503b77b65a6423a26057d810) )
- ROM_REGION16_BE( 0x200000, "sprites", 0)
+ ROM_REGION16_BE( 0x200000, "bsprites", 0)
ROM_LOAD16_BYTE( "epr-13833.16", 0x000000, 0x80000, CRC(6148e11a) SHA1(5802208cf0415f6af39de162e9f12e7c205915f7) )
ROM_LOAD16_BYTE( "epr-13832.14", 0x000001, 0x80000, CRC(41679754) SHA1(58d46f33a4318bbc9e2a20eb5550a66ee0b2e62f) )
ROM_LOAD16_BYTE( "epr-13040.17", 0x100000, 0x80000, CRC(4aeb3a85) SHA1(5521fd2d3956839bdbe7b70a9e60cd9fb72a42f1) )
@@ -2636,7 +2636,7 @@ ROM_START( strkfgtrj )
ROM_LOAD16_BYTE( "epr-13828.54", 0x000000, 0x20000, CRC(2470cf5f) SHA1(eb1a732228fe7ad9cf0747d2b53e391c5a733667) )
ROM_LOAD16_BYTE( "epr-13827.53", 0x000001, 0x20000, CRC(a9d0cf7d) SHA1(c40c73c9e9105ed6503b77b65a6423a26057d810) )
- ROM_REGION16_BE( 0x200000, "sprites", 0)
+ ROM_REGION16_BE( 0x200000, "bsprites", 0)
ROM_LOAD16_BYTE( "epr-13833.16", 0x000000, 0x80000, CRC(6148e11a) SHA1(5802208cf0415f6af39de162e9f12e7c205915f7) )
ROM_LOAD16_BYTE( "epr-13832.14", 0x000001, 0x80000, CRC(41679754) SHA1(58d46f33a4318bbc9e2a20eb5550a66ee0b2e62f) )
ROM_LOAD16_BYTE( "epr-13040.17", 0x100000, 0x80000, CRC(4aeb3a85) SHA1(5521fd2d3956839bdbe7b70a9e60cd9fb72a42f1) )
diff --git a/src/mame/drivers/senjyo.cpp b/src/mame/drivers/senjyo.cpp
index 4ccb8036ab1..317e04b925a 100644
--- a/src/mame/drivers/senjyo.cpp
+++ b/src/mame/drivers/senjyo.cpp
@@ -80,7 +80,7 @@ I/O read/write
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "includes/senjyo.h"
void senjyo_state::machine_start()
@@ -598,12 +598,26 @@ static MACHINE_CONFIG_START( senjyo, senjyo_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( senjyox, senjyo )
- MCFG_CPU_MODIFY("maincpu")
+
+
+static MACHINE_CONFIG_DERIVED( senjyox_e, senjyo )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5015, 4000000) /* 4 MHz? */
+ MCFG_CPU_PROGRAM_MAP(senjyo_map)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", senjyo_state, irq0_line_assert)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( senjyox_a, senjyo )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5018, 4000000) /* 4 MHz? */
+ MCFG_CPU_PROGRAM_MAP(senjyo_map)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", senjyo_state, irq0_line_assert)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( starforb, senjyox )
+
+static MACHINE_CONFIG_DERIVED( starforb, senjyox_e )
/* basic machine hardware */
MCFG_CPU_MODIFY("maincpu")
@@ -903,29 +917,7 @@ DRIVER_INIT_MEMBER(senjyo_state,starforc)
}
DRIVER_INIT_MEMBER(senjyo_state,starfore)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
+
m_is_senjyo = 0;
m_scrollhack = 0;
@@ -933,29 +925,7 @@ DRIVER_INIT_MEMBER(senjyo_state,starfore)
DRIVER_INIT_MEMBER(senjyo_state,starfora)
{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */
- { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
+
m_is_senjyo = 0;
m_scrollhack = 1;
@@ -968,10 +938,10 @@ DRIVER_INIT_MEMBER(senjyo_state,senjyo)
}
-GAME( 1983, senjyo, 0, senjyo, senjyo, senjyo_state, senjyo, ROT90, "Tehkan", "Senjyo", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, starforc, 0, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan", "Star Force", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, starforce,starforc, senjyox, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, starforcb,starforc, starforb,starforc, senjyo_state, starfore, ROT90, "bootleg", "Star Force (encrypted, bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, starforca,starforc, senjyox, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, megaforc, starforc, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan (Video Ware license)", "Mega Force", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, baluba, 0, senjyo, baluba, senjyo_state, starforc, ROT90, "Able Corp, Ltd.", "Baluba-louk no Densetsu (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, senjyo, 0, senjyo, senjyo, senjyo_state, senjyo, ROT90, "Tehkan", "Senjyo", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, starforc, 0, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan", "Star Force", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, starforce,starforc, senjyox_e, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, starforcb,starforc, starforb, starforc, senjyo_state, starfore, ROT90, "bootleg", "Star Force (encrypted, bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, starforca,starforc, senjyox_a, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, megaforc, starforc, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan (Video Ware license)", "Mega Force", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, baluba, 0, senjyo, baluba, senjyo_state, starforc, ROT90, "Able Corp, Ltd.", "Baluba-louk no Densetsu (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp
index 962c048cc94..5374875f519 100644
--- a/src/mame/drivers/seta.cpp
+++ b/src/mame/drivers/seta.cpp
@@ -7701,7 +7701,6 @@ static MACHINE_CONFIG_START( tndrcade, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7756,7 +7755,6 @@ static MACHINE_CONFIG_START( twineagl, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7800,7 +7798,6 @@ static MACHINE_CONFIG_START( downtown, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7861,7 +7858,6 @@ static MACHINE_CONFIG_START( usclssic, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7915,7 +7911,6 @@ static MACHINE_CONFIG_START( calibr50, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7959,7 +7954,6 @@ static MACHINE_CONFIG_START( metafox, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -7997,7 +7991,6 @@ static MACHINE_CONFIG_START( atehate, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8041,7 +8034,6 @@ static MACHINE_CONFIG_START( blandia, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8079,7 +8071,6 @@ static MACHINE_CONFIG_START( blandiap, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8122,7 +8113,6 @@ static MACHINE_CONFIG_START( blockcar, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8194,7 +8184,6 @@ static MACHINE_CONFIG_START( daioh, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8232,7 +8221,6 @@ static MACHINE_CONFIG_START( daiohp, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8275,7 +8263,6 @@ static MACHINE_CONFIG_START( drgnunit, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8312,7 +8299,6 @@ static MACHINE_CONFIG_START( qzkklgy2, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8363,7 +8349,6 @@ static MACHINE_CONFIG_START( setaroul, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
MCFG_NVRAM_ADD_RANDOM_FILL("nvram")
@@ -8407,7 +8392,6 @@ static MACHINE_CONFIG_START( eightfrc, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8450,7 +8434,6 @@ static MACHINE_CONFIG_START( extdwnhl, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8516,7 +8499,6 @@ static MACHINE_CONFIG_START( gundhara, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8561,7 +8543,6 @@ static MACHINE_CONFIG_START( jjsquawk, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8597,7 +8578,6 @@ static MACHINE_CONFIG_START( jjsquawb, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8642,7 +8622,6 @@ static MACHINE_CONFIG_START( kamenrid, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8681,7 +8660,6 @@ static MACHINE_CONFIG_START( orbs, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8724,7 +8702,6 @@ static MACHINE_CONFIG_START( keroppij, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8766,7 +8743,6 @@ static MACHINE_CONFIG_START( krzybowl, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8809,7 +8785,6 @@ static MACHINE_CONFIG_START( madshark, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8854,7 +8829,6 @@ static MACHINE_CONFIG_START( magspeed, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8902,7 +8876,6 @@ static MACHINE_CONFIG_START( msgundam, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8942,7 +8915,6 @@ static MACHINE_CONFIG_START( oisipuzl, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -8982,7 +8954,6 @@ static MACHINE_CONFIG_START( triplfun, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9021,7 +8992,6 @@ static MACHINE_CONFIG_START( kiwame, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9063,7 +9033,6 @@ static MACHINE_CONFIG_START( rezon, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9104,7 +9073,6 @@ static MACHINE_CONFIG_START( thunderl, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9176,7 +9144,6 @@ static MACHINE_CONFIG_START( wiggie, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9214,7 +9181,6 @@ static MACHINE_CONFIG_START( wits, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9252,7 +9218,6 @@ static MACHINE_CONFIG_START( umanclub, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9294,7 +9259,6 @@ static MACHINE_CONFIG_START( utoukond, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9346,7 +9310,6 @@ static MACHINE_CONFIG_START( wrofaero, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9391,7 +9354,6 @@ static MACHINE_CONFIG_START( zingzip, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9447,7 +9409,6 @@ static MACHINE_CONFIG_START( pairlove, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9496,7 +9457,6 @@ static MACHINE_CONFIG_START( crazyfgt, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
@@ -9562,7 +9522,6 @@ static MACHINE_CONFIG_START( inttoote, seta_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(seta_state, setac_gfxbank_callback)
/* video hardware */
diff --git a/src/mame/drivers/sg1000a.cpp b/src/mame/drivers/sg1000a.cpp
index 509146b18b9..0e43b6c527b 100644
--- a/src/mame/drivers/sg1000a.cpp
+++ b/src/mame/drivers/sg1000a.cpp
@@ -118,7 +118,7 @@ CN4 CN5
#include "sound/sn76496.h"
#include "video/tms9928a.h"
#include "machine/i8255.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
class sg1000a_state : public driver_device
@@ -132,7 +132,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(vdp_interrupt);
DECLARE_WRITE8_MEMBER(sg1000a_coin_counter_w);
DECLARE_DRIVER_INIT(sg1000a);
- DECLARE_DRIVER_INIT(chwrestl);
required_device<cpu_device> m_maincpu;
optional_shared_ptr<UINT8> m_decrypted_opcodes;
};
@@ -292,8 +291,11 @@ static MACHINE_CONFIG_START( sg1000a, sg1000a_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sg1000ax, sg1000a )
- MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5033, XTAL_3_579545MHz)
+ MCFG_CPU_PROGRAM_MAP(program_map)
+ MCFG_CPU_IO_MAP(io_map)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MACHINE_CONFIG_END
/*************************************
@@ -333,33 +335,7 @@ DRIVER_INIT_MEMBER(sg1000a_state,sg1000a)
{
}
-DRIVER_INIT_MEMBER(sg1000a_state,chwrestl)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */
- { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(sg1000a);
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
+
/*************************************
*
@@ -368,5 +344,5 @@ DRIVER_INIT_MEMBER(sg1000a_state,chwrestl)
*************************************/
GAME( 1984, chboxing, 0, sg1000a, chboxing, sg1000a_state, sg1000a, ROT0, "Sega", "Champion Boxing", 0 )
-GAME( 1985, chwrestl, 0, sg1000ax, chwrestl, sg1000a_state, chwrestl, ROT0, "Sega", "Champion Pro Wrestling", 0 )
+GAME( 1985, chwrestl, 0, sg1000ax, chwrestl, sg1000a_state, sg1000a, ROT0, "Sega", "Champion Pro Wrestling", 0 )
GAME( 1985, dokidoki, 0, sg1000a, dokidoki, sg1000a_state, sg1000a, ROT0, "Sega", "Doki Doki Penguin Land", 0 )
diff --git a/src/mame/drivers/silvmil.cpp b/src/mame/drivers/silvmil.cpp
index bff90fc7b16..fed4f7976be 100644
--- a/src/mame/drivers/silvmil.cpp
+++ b/src/mame/drivers/silvmil.cpp
@@ -420,7 +420,6 @@ static MACHINE_CONFIG_START( silvmil, silvmil_state )
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_OFFSETS(5, 7)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/simpl156.cpp b/src/mame/drivers/simpl156.cpp
index 8bda58693b0..9187475a280 100644
--- a/src/mame/drivers/simpl156.cpp
+++ b/src/mame/drivers/simpl156.cpp
@@ -413,13 +413,11 @@ static MACHINE_CONFIG_START( chainrec, simpl156_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_PRIORITY_CB(simpl156_state, pri_callback)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp
index 5641f189a33..20e01f6306c 100644
--- a/src/mame/drivers/simpsons.cpp
+++ b/src/mame/drivers/simpsons.cpp
@@ -356,16 +356,13 @@ static MACHINE_CONFIG_START( simpsons, simpsons_state )
MCFG_PALETTE_ENABLE_HILIGHTS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k052109", K052109, 0)
MCFG_GFX_PALETTE("palette")
MCFG_K052109_CB(simpsons_state, tile_callback)
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(simpsons_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, 53, 23)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, 53, 23)
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
diff --git a/src/mame/drivers/skylncr.cpp b/src/mame/drivers/skylncr.cpp
index cfaba6c0a36..8ba3d10d28b 100644
--- a/src/mame/drivers/skylncr.cpp
+++ b/src/mame/drivers/skylncr.cpp
@@ -1699,8 +1699,9 @@ ROM_START( sstar97 )
ROM_LOAD16_BYTE( "bor_dun_5.u22", 0x40001, 0x20000, CRC(ca17a632) SHA1(d491310ccdbe9b59a1e607f9254646f20700d79d) )
ROM_END
-/* Butterfly Dream 97 / Hudie Meng 97
- Game is encrypted and needs better decoded graphics.
+/*
+ Butterfly Dream 97 / Hudie Meng 97
+ Game is encrypted and needs better decoded graphics.
*/
ROM_START( bdream97 )
ROM_REGION( 0x80000, "maincpu", 0 )
@@ -1719,6 +1720,34 @@ ROM_START( bdream97 )
ROM_LOAD16_BYTE( "27c010.u27", 0x40001, 0x20000, CRC(0a266de4) SHA1(0ff9ad793e77d5419bd446cb73d4968e42305353) )
ROM_END
+/*
+ Sonik Fighter.
+ Greek Version By ZBOUNOS (Z GAMES).
+
+ Multiple Butterfly type with naked girls.
+ + new features and hold a pair.
+ + jackpot.
+ + tetris game?.
+
+ Program ROM is encrypted.
+*/
+ROM_START( sonikfig )
+ ROM_REGION( 0x80000, "maincpu", 0 )
+ ROM_LOAD( "subboard_27c512.bin", 0x00000, 0x10000, CRC(f9b5b03e) SHA1(3832a7d70b41052f9dca46faa6f311ccc5a817b7) )
+
+ ROM_REGION( 0x80000, "gfx1", 0 )
+ ROM_LOAD16_BYTE( "1__am27c100.u29", 0x00000, 0x20000, CRC(69824294) SHA1(a221ab3e5d50435c10e3cd4601cfda1c87038a74) )
+ ROM_LOAD16_BYTE( "2__am27c100.u31", 0x00001, 0x20000, CRC(5224ed08) SHA1(3ba9af7557f13bf31c529bff7b2b8cfd6e71552c) )
+ ROM_LOAD16_BYTE( "3__am27c100.u33", 0x40000, 0x20000, CRC(38fef15c) SHA1(00f7578bac395421fa3289748f85cf3b9d80e04b) )
+ ROM_LOAD16_BYTE( "4__am27c100.u35", 0x40001, 0x20000, CRC(6193d30d) SHA1(390b3f451224eb4236c6c921d34b25b702d366e0) )
+
+ ROM_REGION( 0x80000, "gfx2", 0 )
+ ROM_LOAD16_BYTE( "5__am27c100.u52", 0x00000, 0x20000, CRC(56921033) SHA1(25086b0f5978df04b28b60a30e271f4364112c96) )
+ ROM_LOAD16_BYTE( "6__am27c100.u54", 0x00001, 0x20000, CRC(72802c6c) SHA1(c552d438399fb8c983e995d5e78e591982ef96e5) )
+ ROM_LOAD16_BYTE( "7__am27c100.u56", 0x40000, 0x20000, CRC(90a09327) SHA1(3bb1150ec397627cc04b46d2bf07538c55e7f116) )
+ ROM_LOAD16_BYTE( "8__am27c100.u58", 0x40001, 0x20000, CRC(b02ed0ce) SHA1(ec8ab64210a1b10cdba5ee179e46fc8d6a1a67b6) )
+ROM_END
+
/**********************************
* Driver Init *
@@ -1745,3 +1774,4 @@ GAME( 199?, gallag50, 0, skylncr, gallag50, skylncr_state, skylncr, ROT0
GAME( 199?, neraidou, 0, neraidou, neraidou, skylncr_state, skylncr, ROT0, "bootleg", "Neraidoula (Fairy Butterfly)", 0 )
GAME( 199?, sstar97, 0, sstar97, sstar97, skylncr_state, skylncr, ROT0, "Bordun International", "Super Star 97 / Ming Xing 97 (version V153B)", 0 )
GAME( 199?, bdream97, 0, bdream97, skylncr, skylncr_state, skylncr, ROT0, "bootleg", "Butterfly Dream 97 / Hudie Meng 97", MACHINE_NOT_WORKING )
+GAME( 199?, sonikfig, 0, skylncr, skylncr, skylncr_state, skylncr, ROT0, "Z Games", "Sonik Fighter (encrypted)", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp
index 9348a9dbb9c..417b4d4b335 100644
--- a/src/mame/drivers/slapshot.cpp
+++ b/src/mame/drivers/slapshot.cpp
@@ -498,7 +498,6 @@ static MACHINE_CONFIG_START( slapshot, slapshot_state )
MCFG_TC0480SCP_OFFSETS_FLIP(0, 2)
MCFG_TC0480SCP_COL_BASE(4096)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
@@ -559,7 +558,6 @@ static MACHINE_CONFIG_START( opwolf3, slapshot_state )
MCFG_TC0480SCP_OFFSETS_FLIP(0, 2)
MCFG_TC0480SCP_COL_BASE(4096)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp
index a3839649aac..1f2ddde1437 100644
--- a/src/mame/drivers/sms.cpp
+++ b/src/mame/drivers/sms.cpp
@@ -60,7 +60,7 @@ General compatibility issues on real hardware (not emulation bugs):
Paddle controller;
- Few games of the ones with FM support need to detect the system region as
Japanese to play FM sound;
-- The Light Phaser gun doesn't work with the Japanese SMS;
+- The Light Phaser gun doesn't work with the Japanese SMS and Sega Mark III;
- There are reports about Light Phaser working on the second Korean SMS
version, and a Korean advert shows support on the first version (Gam*Boy I,
although based on Japanese SMS);
@@ -337,10 +337,10 @@ ADDRESS_MAP_END
// The first Korean SMS version also seems to lack I/O port $3F. Games execute
// a region detection procedure that, through that port, sets the mode used by
-// the TH bits of port $DD and tests their behavior. The region of the first SMS
+// the TH bits of port $DD and tests their behaviour. The region of the first SMS
// version is detected as Japanese (opposite to the second version). However,
-// as it supports Light Phaser games, it doesn't have the same behavior of the
-// Japanese SMS. If it had the behavior of other SMS versions, the system
+// as it supports Light Phaser games, it doesn't have the same behaviour of the
+// Japanese SMS. If it had the behaviour of other SMS versions, the system
// region would be detected as Export, so it probably lacks the port.
static ADDRESS_MAP_START( sms1kr_io, AS_IO, 8, sms_state )
AM_IMPORT_FROM(sg1000m3_io)
diff --git a/src/mame/drivers/snk68.cpp b/src/mame/drivers/snk68.cpp
index 72ef817e615..d173946a5ab 100644
--- a/src/mame/drivers/snk68.cpp
+++ b/src/mame/drivers/snk68.cpp
@@ -617,7 +617,6 @@ static MACHINE_CONFIG_START( pow, snk68_state )
MCFG_DEVICE_ADD("sprites", SNK68_SPR, 0)
MCFG_SNK68_SPR_GFXDECODE("gfxdecode")
- MCFG_SNK68_SPR_PALETTE("palette")
MCFG_SNK68_SPR_SET_TILE_INDIRECT( snk68_state, tile_callback_pow )
MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) /* verified on pcb */
diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp
index e038d66471b..095946efcdc 100644
--- a/src/mame/drivers/snowbros.cpp
+++ b/src/mame/drivers/snowbros.cpp
@@ -1678,7 +1678,6 @@ static MACHINE_CONFIG_START( snowbros, snowbros_state )
MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
- MCFG_KANEKO_PANDORA_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/speglsht.cpp b/src/mame/drivers/speglsht.cpp
index 74aee52aee1..6d683980e30 100644
--- a/src/mame/drivers/speglsht.cpp
+++ b/src/mame/drivers/speglsht.cpp
@@ -140,8 +140,8 @@ public:
DECLARE_VIDEO_START(speglsht);
UINT32 screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<palette_device> m_palette;
- optional_device<st0016_cpu_device> m_maincpu;
- optional_device<cpu_device> m_subcpu;
+ required_device<st0016_cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
DECLARE_WRITE8_MEMBER(st0016_rom_bank_w);
};
@@ -387,7 +387,7 @@ UINT32 speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb3
{
if(srcline[x])
{
- rgb_t color=m_maincpu->m_palette->pen_color(srcline[x]);
+ rgb_t color = m_maincpu->palette().pen_color(srcline[x]);
PLOT_PIXEL_RGB(x,y,color.r(),color.g(),color.b());
}
}
diff --git a/src/mame/drivers/spy.cpp b/src/mame/drivers/spy.cpp
index 0806c904736..07bc4ed9c23 100644
--- a/src/mame/drivers/spy.cpp
+++ b/src/mame/drivers/spy.cpp
@@ -511,8 +511,6 @@ static MACHINE_CONFIG_START( spy, spy_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k052109", K052109, 0)
MCFG_GFX_PALETTE("palette")
MCFG_K052109_CB(spy_state, tile_callback)
diff --git a/src/mame/drivers/spyhuntertec.cpp b/src/mame/drivers/spyhuntertec.cpp
index c41dde50fac..d0bfa8f2aa4 100644
--- a/src/mame/drivers/spyhuntertec.cpp
+++ b/src/mame/drivers/spyhuntertec.cpp
@@ -15,16 +15,12 @@ non-interlaced
sound system appears to be the same as 'spartanxtec.cpp'
-analog inputs seem to be read by the sound CPU, with serial communication
-
*/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
-
-
-#define MASTER_CLOCK XTAL_20MHz // ??
+#include "spyhunttec.lh"
class spyhuntertec_state : public driver_device
{
@@ -34,6 +30,7 @@ public:
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_analog_timer(*this, "analog_timer"),
+ m_analog_input(*this, "AN"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"),
@@ -48,6 +45,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<timer_device> m_analog_timer;
+ required_ioport_array<2> m_analog_input;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_spriteram2;
@@ -102,13 +100,11 @@ public:
TILE_GET_INFO_MEMBER(spyhunt_get_alpha_tile_info);
void mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy, int interlaced);
- TIMER_DEVICE_CALLBACK_MEMBER(analog_shift_callback);
+ TIMER_DEVICE_CALLBACK_MEMBER(analog_count_callback);
void reset_analog_timer();
- int m_analog_read_ready;
- UINT8 m_analog_latched_value;
UINT8 m_analog_select;
- int m_analog_read_count;
+ UINT8 m_analog_count;
};
WRITE8_MEMBER(spyhuntertec_state::ay1_porta_w)
@@ -124,31 +120,24 @@ READ8_MEMBER(spyhuntertec_state::ay1_porta_r)
void spyhuntertec_state::reset_analog_timer()
{
- // 555 timer? complete guess
- m_analog_timer->adjust(attotime::from_nsec(7600));
+ // 555 timer, period is guessed
+ m_analog_timer->adjust(attotime::from_nsec(9400));
}
-TIMER_DEVICE_CALLBACK_MEMBER(spyhuntertec_state::analog_shift_callback)
+TIMER_DEVICE_CALLBACK_MEMBER(spyhuntertec_state::analog_count_callback)
{
- m_analog_read_count++;
+ if (m_analog_count != 0)
+ m_analog_count--;
reset_analog_timer();
}
WRITE8_MEMBER(spyhuntertec_state::ay2_porta_w)
{
-// printf("ay2_porta_w %02x\n", data);
- // write 80 / 00
- // or 81 / 01
- // depending on which sound command was used
- // assuming input select
-
- // d7 falling edge
+ // d7: latch analog counter on falling edge, d0 selects which one
if (~data & m_analog_select & 0x80)
{
- m_analog_read_ready = 1;
- m_analog_read_count = 0;
reset_analog_timer();
- m_analog_latched_value = ioport((data & 1) ? "PADDLE" : "PEDAL")->read();
+ m_analog_count = m_analog_input[data & 1]->read();
}
m_analog_select = data;
@@ -420,24 +409,8 @@ READ8_MEMBER(spyhuntertec_state::spyhuntertec_in2_r)
*/
// printf("%04x spyhuntertec_in2_r\n", space.device().safe_pc());
-
- UINT8 ret = ioport("IN2")->read()&~0x40;
-
- if (m_analog_read_ready)
- {
- if (m_analog_read_count >= m_analog_latched_value)
- {
- ret |= 0x40;
- m_analog_read_count = 0;
- m_analog_read_ready = 0;
- }
- }
- else
- {
- ret |= 0x40;
- }
-
- return ret;
+
+ return (ioport("IN2")->read() & ~0x40) | ((m_analog_count == 0) ? 0x40 : 0x00);
}
READ8_MEMBER(spyhuntertec_state::spyhuntertec_in3_r)
@@ -575,19 +548,11 @@ static INPUT_PORTS_START( spyhuntertec )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("IN2")
- PORT_DIPNAME( 0x0001, 0x0001, "2" )
- PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
- PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0010, 0x0010, "handbrake?" )
- PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Right Button / Smoke Screen")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Center Button / Weapons Van")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Left Trigger / Missiles")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left Button / Oil Slick")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Gear Shift") PORT_TOGGLE
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
@@ -616,11 +581,12 @@ static INPUT_PORTS_START( spyhuntertec )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Right Trigger / Machine Guns")
- PORT_START("PEDAL")
+ PORT_START("AN.0")
PORT_BIT( 0xff, 0x02, IPT_PEDAL ) PORT_MINMAX(0x02,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE
- PORT_START("PADDLE")
+
+ PORT_START("AN.1")
PORT_BIT( 0x7f, 0x40, IPT_PADDLE ) PORT_MINMAX(0x30,0x50) PORT_SENSITIVITY(40) PORT_KEYDELTA(3) PORT_REVERSE
INPUT_PORTS_END
@@ -687,9 +653,6 @@ void spyhuntertec_state::machine_start()
void spyhuntertec_state::machine_reset()
{
- m_analog_read_ready = 0;
- m_analog_latched_value = 0;
- m_analog_read_count = 0;
}
@@ -699,13 +662,14 @@ static MACHINE_CONFIG_START( spyhuntertec, spyhuntertec_state )
// note: no ctc, no nvram
// 2*z80, 3*ay8912
+// 2 XTALs: one 20MHz, other one near maincpu ?MHz
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/4)
+ MCFG_CPU_ADD("maincpu", Z80, 4000000 ) // NEC D780C-2 (rated 6MHz)
MCFG_CPU_PROGRAM_MAP(spyhuntertec_map)
MCFG_CPU_IO_MAP(spyhuntertec_portmap)
MCFG_CPU_VBLANK_INT_DRIVER("screen", spyhuntertec_state, irq0_line_hold)
- MCFG_TIMER_DRIVER_ADD("analog_timer", spyhuntertec_state, analog_shift_callback)
+ MCFG_TIMER_DRIVER_ADD("analog_timer", spyhuntertec_state, analog_count_callback)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -723,7 +687,7 @@ static MACHINE_CONFIG_START( spyhuntertec, spyhuntertec_state )
// MCFG_PALETTE_INIT_OWNER(spyhuntertec_state,spyhunt)
- MCFG_CPU_ADD("audiocpu", Z80, 4000000 )
+ MCFG_CPU_ADD("audiocpu", Z80, 4000000 ) // SGS Z8400B1 (rated 2.5MHz?)
MCFG_CPU_PROGRAM_MAP(spyhuntertec_sound_map)
MCFG_CPU_IO_MAP(spyhuntertec_sound_portmap)
MCFG_CPU_PERIODIC_INT_DRIVER(spyhuntertec_state, irq0_line_assert, 1000)
@@ -843,4 +807,4 @@ DRIVER_INIT_MEMBER(spyhuntertec_state,spyhuntertec)
}
-GAME (1983, spyhuntpr,spyhunt, spyhuntertec, spyhuntertec,spyhuntertec_state, spyhuntertec,ROT90, "Bally Midway (Recreativos Franco S.A. license)", "Spy Hunter (Spain, Tecfri / Recreativos Franco S.A. PCB)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+GAMEL(1983, spyhuntpr,spyhunt, spyhuntertec, spyhuntertec,spyhuntertec_state, spyhuntertec,ROT90, "bootleg (Recreativos Franco S.A. license, Tecfri)", "Spy Hunter (Spain, Recreativos Franco S.A., Tecfri PCB)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_spyhunttec )
diff --git a/src/mame/drivers/srmp2.cpp b/src/mame/drivers/srmp2.cpp
index ca80decc53a..9b0c5bf1e62 100644
--- a/src/mame/drivers/srmp2.cpp
+++ b/src/mame/drivers/srmp2.cpp
@@ -1168,7 +1168,6 @@ static MACHINE_CONFIG_START( srmp2, srmp2_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1215,7 +1214,6 @@ static MACHINE_CONFIG_START( srmp3, srmp2_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(srmp2_state, srmp3_gfxbank_callback)
/* video hardware */
@@ -1270,7 +1268,6 @@ static MACHINE_CONFIG_START( mjyuugi, srmp2_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_SETA001_SPRITE_GFXBANK_CB(srmp2_state, srmp3_gfxbank_callback)
/* video hardware */
diff --git a/src/mame/drivers/sshangha.cpp b/src/mame/drivers/sshangha.cpp
index 13df09a5fd8..041b629e7a2 100644
--- a/src/mame/drivers/sshangha.cpp
+++ b/src/mame/drivers/sshangha.cpp
@@ -416,17 +416,14 @@ static MACHINE_CONFIG_START( sshangha, sshangha_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen2", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_DECO146_ADD("ioprot")
diff --git a/src/mame/drivers/ssv.cpp b/src/mame/drivers/ssv.cpp
index a698d6bcc9d..3b2419b8a3d 100644
--- a/src/mame/drivers/ssv.cpp
+++ b/src/mame/drivers/ssv.cpp
@@ -2637,7 +2637,6 @@ static MACHINE_CONFIG_DERIVED( gdfs, ssv )
MCFG_SCREEN_UPDATE_DRIVER(ssv_state, screen_update_gdfs)
MCFG_DEVICE_ADD("st0020_spr", ST0020_SPRITES, 0)
- MCFG_ST0020_SPRITES_GFXDECODE("gfxdecode")
MCFG_ST0020_SPRITES_PALETTE("palette")
MCFG_GFXDECODE_MODIFY("gfxdecode", gdfs)
diff --git a/src/mame/drivers/stadhero.cpp b/src/mame/drivers/stadhero.cpp
index e8fc5e9a4e1..3aea0de91c7 100644
--- a/src/mame/drivers/stadhero.cpp
+++ b/src/mame/drivers/stadhero.cpp
@@ -221,13 +221,12 @@ static MACHINE_CONFIG_START( stadhero, stadhero_state )
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
- deco_bac06_device::set_gfx_region_wide(*device,1,1,2);
+ MCFG_DECO_BAC06_GFX_REGION_WIDE(1, 1, 2)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 2);
+ MCFG_DECO_MXC06_GFX_REGION(2)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
diff --git a/src/mame/drivers/subsino2.cpp b/src/mame/drivers/subsino2.cpp
index 0ced7cfd5d7..8490bcb0d31 100644
--- a/src/mame/drivers/subsino2.cpp
+++ b/src/mame/drivers/subsino2.cpp
@@ -990,21 +990,21 @@ WRITE16_MEMBER(subsino2_state::new2001_outputs_w)
output().set_led_value(0, data & 0x4000); // record?
output().set_led_value(1, data & 0x2000); // shoot now
output().set_led_value(2, data & 0x1000); // double
- output().set_led_value(0, data & 0x0800); // black/red
+ output().set_led_value(3, data & 0x0800); // black/red
}
if (ACCESSING_BITS_0_7)
{
- output().set_led_value(0, data & 0x0080); // start
- output().set_led_value(0, data & 0x0040); // take
- output().set_led_value(0, data & 0x0020); // black/red
+ output().set_led_value(4, data & 0x0080); // start
+ output().set_led_value(5, data & 0x0040); // take
+ output().set_led_value(6, data & 0x0020); // black/red
machine().bookkeeping().coin_counter_w(0, data & 0x0010); // coin in / key in
- output().set_led_value(0, data & 0x0004); // ?
- output().set_led_value(0, data & 0x0002); // ?
+ output().set_led_value(7, data & 0x0004); // ?
+ output().set_led_value(8, data & 0x0002); // ?
}
break;
}
- popmessage("0: %04x", m_outputs16[0]);
+// popmessage("0: %04x", m_outputs16[0]);
}
// Same as bishjan (except for i/o and lo2 usage like xplan)
@@ -2258,7 +2258,7 @@ INPUT_PORTS_END
static MACHINE_CONFIG_START( bishjan, subsino2_state )
MCFG_CPU_ADD("maincpu", H83044, XTAL_44_1MHz / 3)
MCFG_CPU_PROGRAM_MAP( bishjan_map )
- MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state, irq0_line_hold)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state, irq0_line_hold)
MCFG_NVRAM_ADD_0FILL("nvram")
MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
@@ -2364,7 +2364,7 @@ static MACHINE_CONFIG_START( xplan, subsino2_state )
MCFG_CPU_ADD("maincpu", I80188, XTAL_20MHz*2 ) // !! AMD AM188-EM !!
MCFG_CPU_PROGRAM_MAP( xplan_map )
MCFG_CPU_IO_MAP( xplan_io )
- MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state, am188em_int0_irq)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state, am188em_int0_irq)
MCFG_NVRAM_ADD_0FILL("nvram")
diff --git a/src/mame/drivers/supbtime.cpp b/src/mame/drivers/supbtime.cpp
index c2cc30185b2..7b4f6aaa542 100644
--- a/src/mame/drivers/supbtime.cpp
+++ b/src/mame/drivers/supbtime.cpp
@@ -349,12 +349,10 @@ static MACHINE_CONFIG_START( supbtime, supbtime_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -405,12 +403,10 @@ static MACHINE_CONFIG_START( chinatwn, supbtime_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/super80.cpp b/src/mame/drivers/super80.cpp
index 8bbb6c194f7..b3823f3ef28 100644
--- a/src/mame/drivers/super80.cpp
+++ b/src/mame/drivers/super80.cpp
@@ -216,6 +216,7 @@ ToDo:
***********************************************************************************************************/
+#include "emu.h"
#include "super80.lh"
#include "includes/super80.h"
diff --git a/src/mame/drivers/superchs.cpp b/src/mame/drivers/superchs.cpp
index 035b0ccafc5..9aacce21f5e 100644
--- a/src/mame/drivers/superchs.cpp
+++ b/src/mame/drivers/superchs.cpp
@@ -336,7 +336,6 @@ static MACHINE_CONFIG_START( superchs, superchs_state )
MCFG_TC0480SCP_OFFSETS(0x20, 0x08)
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
diff --git a/src/mame/drivers/suprloco.cpp b/src/mame/drivers/suprloco.cpp
index 223db7b3dc9..5144ebc1da2 100644
--- a/src/mame/drivers/suprloco.cpp
+++ b/src/mame/drivers/suprloco.cpp
@@ -23,7 +23,7 @@ Sega PCB 834-5137
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "sound/sn76496.h"
#include "includes/suprloco.h"
@@ -167,10 +167,11 @@ GFXDECODE_END
static MACHINE_CONFIG_START( suprloco, suprloco_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz (?) */
+ MCFG_CPU_ADD("maincpu", SEGA_315_5015, 4000000) /* 4 MHz (?) */
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", suprloco_state, irq0_line_hold)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MCFG_CPU_ADD("audiocpu", Z80, 4000000)
MCFG_CPU_PROGRAM_MAP(sound_map)
@@ -297,30 +298,6 @@ DRIVER_INIT_MEMBER(suprloco_state,suprloco)
}
}
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- /* decrypt program ROMs */
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
}
diff --git a/src/mame/drivers/suprslam.cpp b/src/mame/drivers/suprslam.cpp
index 92d63b4de0d..20fd606a1f9 100644
--- a/src/mame/drivers/suprslam.cpp
+++ b/src/mame/drivers/suprslam.cpp
@@ -326,7 +326,6 @@ static MACHINE_CONFIG_START( suprslam, suprslam_state )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( suprslam_state, suprslam_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_DEVICE_ADD("k053936", K053936, 0)
MCFG_K053936_WRAP(1)
diff --git a/src/mame/drivers/system1.cpp b/src/mame/drivers/system1.cpp
index 43cc5147afb..50395d17607 100644
--- a/src/mame/drivers/system1.cpp
+++ b/src/mame/drivers/system1.cpp
@@ -222,8 +222,7 @@ seem to have access to.
#include "cpu/mcs51/mcs51.h"
#include "machine/z80pio.h"
#include "machine/i8255.h"
-#include "machine/segacrpt.h"
-#include "machine/segacrp2.h"
+#include "machine/segacrpt_device.h"
#include "machine/mc8123.h"
#include "sound/sn76496.h"
#include "includes/system1.h"
@@ -2185,10 +2184,7 @@ static MACHINE_CONFIG_START( sys1ppi, system1_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( sys1ppix, sys1ppi )
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
-MACHINE_CONFIG_END
+
/* reduced visible area for scrolling games */
@@ -2199,10 +2195,9 @@ static MACHINE_CONFIG_DERIVED( sys1ppis, sys1ppi )
MCFG_SCREEN_VISIBLE_AREA(2*(0*8+8), 2*(32*8-1-8), 0*8, 28*8-1)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( sys1ppisx, sys1ppis )
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
-MACHINE_CONFIG_END
+
+
+
/* revised board with 128kbit ROMs and a Z80 PIO for outputs */
@@ -2223,6 +2218,138 @@ static MACHINE_CONFIG_DERIVED( sys1piox, sys1pio )
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MACHINE_CONFIG_END
+#define ENCRYPTED_SYS1PPI_MAPS \
+ MCFG_CPU_PROGRAM_MAP(system1_map) \
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) \
+ MCFG_CPU_IO_MAP(system1_ppi_io_map) \
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) \
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+
+#define ENCRYPTED_SYS1PIO_MAPS \
+ MCFG_CPU_PROGRAM_MAP(system1_map) \
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) \
+ MCFG_CPU_IO_MAP(system1_pio_io_map) \
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) \
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5178, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5178, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5051, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5051, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5048, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5048, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5033, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5033, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5065, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5065, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sys1ppix_315_5098, sys1ppi )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5098, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5177, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5162, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5162, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_317_0006, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_317_0006, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5135, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5135, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5132, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5132, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5155, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5155, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5110, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5110, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5051, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5051, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5098, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5098, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5102, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5102, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5133, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5133, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5093, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5093, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piox_315_5065, sys1pio )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5065, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
/* reduced visible area for scrolling games */
static MACHINE_CONFIG_DERIVED( sys1pios, sys1pio )
@@ -2231,12 +2358,36 @@ static MACHINE_CONFIG_DERIVED( sys1pios, sys1pio )
MCFG_SCREEN_VISIBLE_AREA(2*(0*8+8), 2*(32*8-1-8), 0*8, 28*8-1)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( sys1piosx, sys1pios )
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+static MACHINE_CONFIG_DERIVED( sys1piosx_315_5099, sys1pios )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5065, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1piosx_315_spat, sys1pios )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_SPAT, MASTER_CLOCK)
+ ENCRYPTED_SYS1PIO_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( sys1ppisx_315_5064, sys1ppis )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5064, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys1ppisx_315_5041, sys1ppis )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5041, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+
+
+
+
+
/* this describes the additional 8751 MCU when present */
static MACHINE_CONFIG_FRAGMENT( mcu )
@@ -2286,6 +2437,31 @@ static MACHINE_CONFIG_DERIVED( sys2x, sys2 )
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( sys2_315_5177, sys2 )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5177, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys2_315_5176, sys2 )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5176, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys2_317_0006, sys2 )
+ MCFG_CPU_REPLACE("maincpu", SEGA_317_0006, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sys2_317_0007, sys2 )
+ MCFG_CPU_REPLACE("maincpu", SEGA_317_0007, MASTER_CLOCK)
+ ENCRYPTED_SYS1PPI_MAPS
+ MCFG_SEGAZ80_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
+
static MACHINE_CONFIG_DERIVED( sys2xb, sys2 )
MCFG_DEVICE_MODIFY("maincpu")
MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map)
@@ -3854,6 +4030,36 @@ ROM_START( wboy )
ROM_LOAD( "pr-5317.76", 0x0000, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) )
ROM_END
+ROM_START( wboyub ) // seems to be the same as 'wboy' but a different rom layout and external encryption handling
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "1.bin", 0x0000, 0x8000, CRC(07066b6f) SHA1(1ead373907fd5bd5f4cc003a97218aa582758a00) )
+ ROM_LOAD( "epr-7491.96", 0x8000, 0x4000, CRC(1f7d0efe) SHA1(a1b4f8faf1614f4808df1292209c340f1490adbd) )
+
+ ROM_REGION( 0x10000, "unk", 0 )
+ ROM_LOAD( "0cpu.bin", 0xc000, 0x2000, CRC(a962e6af) SHA1(f46b01db38cdc9c8485d7fe0a344e9f6ed918925) ) /* supposedly the encryption key */
+
+ ROM_REGION( 0x10000, "soundcpu", 0 )
+ ROM_LOAD( "epr7498a.3", 0x0000, 0x2000, CRC(c198205c) SHA1(d2d5cd154ce6a5a3c6a099b4ab2ea7cc045ab0a1) )
+
+ ROM_REGION( 0xc000, "tiles", 0 )
+ ROM_LOAD( "epr-7497.62", 0x0000, 0x2000, CRC(08d609ca) SHA1(11799e9ef7e6942b304f132b404bff3ed44d524b) )
+ ROM_LOAD( "epr-7496.61", 0x2000, 0x2000, CRC(6f61fdf1) SHA1(21826aebf5835b9f3d9c467c8647809c1bc0d01f) )
+ ROM_LOAD( "epr-7495.64", 0x4000, 0x2000, CRC(6a0d2c2d) SHA1(8c21d7f0768e8dda2b7185f3c510cae4229a4a2e) )
+ ROM_LOAD( "epr-7494.63", 0x6000, 0x2000, CRC(a8e281c7) SHA1(a88b80a7b94ab1401bbf28d7707fdf28a5505127) )
+ ROM_LOAD( "epr-7493.66", 0x8000, 0x2000, CRC(89305df4) SHA1(7a5098624769a31e7512f56831e818bce6a18871) )
+ ROM_LOAD( "epr-7492.65", 0xa000, 0x2000, CRC(60f806b1) SHA1(f91e5868a455dff2bce3c2891a7cfd648957cd73) )
+
+ ROM_REGION( 0x10000, "sprites", 0 )
+ ROM_LOAD( "4.bin", 0x0000, 0x4000, CRC(8b3124e6) SHA1(e90deaa687128c1f0b7e9e6b6d767bd484c7fc61) )
+ ROM_CONTINUE(0x8000,0x4000)
+ ROM_LOAD( "5.bin", 0x4000, 0x4000, CRC(b75278e7) SHA1(5b7c519f32eac40dc46ca5bba03cec1e893b6fcd) )
+ ROM_CONTINUE(0xc000,0x4000)
+
+ ROM_REGION( 0x0100, "proms", 0 )
+ ROM_LOAD( "pr-5317.76", 0x0000, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) )
+ROM_END
+
+
/* Wonder Boy (Escape, Sega license)
PCB: 834-3984-09 WONDER BOY
@@ -4064,52 +4270,49 @@ ROM_START( wboyu )
ROM_LOAD( "pr-5317.76", 0x0000, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) )
ROM_END
-ROM_START( wboyub )
- ROM_REGION( 0x10000, "maincpu", 0 )
- /* this has way more code than the parent sets, I have no idea what to do with it */
- ROM_LOAD( "1.bin", 0x0000, 0x8000, CRC(07066b6f) SHA1(1ead373907fd5bd5f4cc003a97218aa582758a00) )
- ROM_LOAD( "4.bin", 0x4000, 0x8000, CRC(8b3124e6) SHA1(e90deaa687128c1f0b7e9e6b6d767bd484c7fc61) )
- ROM_LOAD( "5.bin", 0x8000, 0x8000, CRC(b75278e7) SHA1(5b7c519f32eac40dc46ca5bba03cec1e893b6fcd) )
- ROM_LOAD( "epr-7491.96", 0x8000, 0x4000, CRC(1f7d0efe) SHA1(a1b4f8faf1614f4808df1292209c340f1490adbd) )
- ROM_LOAD( "0cpu.bin", 0xc000, 0x2000, CRC(a962e6af) SHA1(f46b01db38cdc9c8485d7fe0a344e9f6ed918925) ) /* supposedly the encryption key */
+
+ROM_START( wboysys2 )
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "epr7580.90", 0x00000, 0x8000, CRC(d69927a5) SHA1(b633177146a83953131d4e03fa987416f222199a) ) /* encrypted */
+ ROM_LOAD( "epr7579.91", 0x10000, 0x8000, CRC(8a6f4b00) SHA1(2b1c26daa2e9c668292db73e28318257c62b175c) )
ROM_REGION( 0x10000, "soundcpu", 0 )
- ROM_LOAD( "epr7498a.3", 0x0000, 0x2000, CRC(c198205c) SHA1(d2d5cd154ce6a5a3c6a099b4ab2ea7cc045ab0a1) )
+ ROM_LOAD( "epr7583.126", 0x0000, 0x8000, CRC(99334b3c) SHA1(dfc09f63082b7666fa2152e22810c0455a7e5051) )
- ROM_REGION( 0xc000, "tiles", 0 )
- ROM_LOAD( "epr-7497.62", 0x0000, 0x2000, CRC(08d609ca) SHA1(11799e9ef7e6942b304f132b404bff3ed44d524b) )
- ROM_LOAD( "epr-7496.61", 0x2000, 0x2000, CRC(6f61fdf1) SHA1(21826aebf5835b9f3d9c467c8647809c1bc0d01f) )
- ROM_LOAD( "epr-7495.64", 0x4000, 0x2000, CRC(6a0d2c2d) SHA1(8c21d7f0768e8dda2b7185f3c510cae4229a4a2e) )
- ROM_LOAD( "epr-7494.63", 0x6000, 0x2000, CRC(a8e281c7) SHA1(a88b80a7b94ab1401bbf28d7707fdf28a5505127) )
- ROM_LOAD( "epr-7493.66", 0x8000, 0x2000, CRC(89305df4) SHA1(7a5098624769a31e7512f56831e818bce6a18871) )
- ROM_LOAD( "epr-7492.65", 0xa000, 0x2000, CRC(60f806b1) SHA1(f91e5868a455dff2bce3c2891a7cfd648957cd73) )
+ ROM_REGION( 0x18000, "tiles", 0 )
+ ROM_LOAD( "epr7581.4", 0x00000, 0x8000, CRC(d95565fd) SHA1(25f1653cca1d6432171a7b391cbb76bc18ddfb06) )
+ ROM_LOAD( "epr7582.5", 0x08000, 0x8000, CRC(560cbac0) SHA1(851283e6d63e33d250840501dd22750b19772fb0) )
+ ROM_LOAD( "epr7607.6", 0x10000, 0x8000, CRC(bd36df03) SHA1(7f7efac2c71fae48dd1dcb4dcc849f07e8127f7d) )
ROM_REGION( 0x10000, "sprites", 0 )
- ROM_LOAD( "epr-7485.117", 0x0000, 0x4000, CRC(c2891722) SHA1(e4e11c0e9bd0dc121c25349493f2b13d2ff8c807) )
- ROM_LOAD( "epr-7487.04", 0x4000, 0x4000, CRC(2d3a421b) SHA1(d70440a8703ccface3212cd9544c950b36263e8c) )
- ROM_LOAD( "epr-7486.110", 0x8000, 0x4000, CRC(8d622c50) SHA1(9a76a50204c618347d3e8eee6cda841becd906eb) )
- ROM_LOAD( "epr-7488.05", 0xc000, 0x4000, CRC(007c2f1b) SHA1(c2f1376144a49d20cb35384648e06d06978474c1) )
+ ROM_LOAD( "epr7578.87", 0x00000, 0x8000, CRC(6ff1637f) SHA1(9a6ddbd7b8d53273b30c3529b028c1f28bf3c63b) )
+ ROM_LOAD( "epr7577.86", 0x08000, 0x8000, CRC(58b3705e) SHA1(1a8ff3f1765a3b21145bd1a6c85441f806f7b17d) )
+
+ ROM_REGION( 0x0300, "palette", 0 )
+ ROM_LOAD( "pr-7345.20", 0x0000, 0x0100, CRC(8eee0f72) SHA1(b5694c120f604a5f7cc95618a71ab16a1a6151ed) ) /* palette red component */
+ ROM_LOAD( "pr-7344.14", 0x0100, 0x0100, CRC(3e7babd7) SHA1(d4f8790db4dce75e27156a4c6de2dcef2baf6d76) ) /* palette green component */
+ ROM_LOAD( "pr-7343.8", 0x0200, 0x0100, CRC(371c44a6) SHA1(ac37458d1feb6566b09a795b20c21953d4ab109d) ) /* palette blue component */
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "pr-5317.76", 0x0000, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) )
+ ROM_LOAD( "pr-5317.28", 0x0000, 0x0100, CRC(648350b8) SHA1(c7986aa9127ef5b50b845434cb4e81dff9861cd2) )
ROM_END
-ROM_START( wboysys2 )
+ROM_START( wboysys2a )
ROM_REGION( 0x20000, "maincpu", 0 )
- ROM_LOAD( "7580.90", 0x0000, 0x8000, CRC(d69927a5) SHA1(b633177146a83953131d4e03fa987416f222199a) ) /* encrypted */
- ROM_LOAD( "7579.91", 0x10000, 0x8000, CRC(8a6f4b00) SHA1(2b1c26daa2e9c668292db73e28318257c62b175c) ) /* encrypted */
+ ROM_LOAD( "epr7625.90", 0x00000, 0x8000, CRC(43b3d155) SHA1(40cc063bf64327250be7ae078ea85315ad4db794) ) /* encrypted */
+ ROM_LOAD( "epr7626.91", 0x10000, 0x8000, CRC(8a6f4b00) SHA1(2b1c26daa2e9c668292db73e28318257c62b175c) )
ROM_REGION( 0x10000, "soundcpu", 0 )
- ROM_LOAD( "7583.126", 0x0000, 0x8000, CRC(99334b3c) SHA1(dfc09f63082b7666fa2152e22810c0455a7e5051) )
+ ROM_LOAD( "epr7583.126", 0x0000, 0x8000, CRC(99334b3c) SHA1(dfc09f63082b7666fa2152e22810c0455a7e5051) )
ROM_REGION( 0x18000, "tiles", 0 )
- ROM_LOAD( "7581.4", 0x00000, 0x8000, CRC(d95565fd) SHA1(25f1653cca1d6432171a7b391cbb76bc18ddfb06) )
- ROM_LOAD( "7582.5", 0x08000, 0x8000, CRC(560cbac0) SHA1(851283e6d63e33d250840501dd22750b19772fb0) )
- ROM_LOAD( "7607.6", 0x10000, 0x8000, CRC(bd36df03) SHA1(7f7efac2c71fae48dd1dcb4dcc849f07e8127f7d) )
+ ROM_LOAD( "epr7581.4", 0x00000, 0x8000, CRC(d95565fd) SHA1(25f1653cca1d6432171a7b391cbb76bc18ddfb06) )
+ ROM_LOAD( "epr7582.5", 0x08000, 0x8000, CRC(560cbac0) SHA1(851283e6d63e33d250840501dd22750b19772fb0) )
+ ROM_LOAD( "epr7607.6", 0x10000, 0x8000, CRC(bd36df03) SHA1(7f7efac2c71fae48dd1dcb4dcc849f07e8127f7d) )
ROM_REGION( 0x10000, "sprites", 0 )
- ROM_LOAD( "7578.87", 0x00000, 0x8000, CRC(6ff1637f) SHA1(9a6ddbd7b8d53273b30c3529b028c1f28bf3c63b) )
- ROM_LOAD( "7577.86", 0x08000, 0x8000, CRC(58b3705e) SHA1(1a8ff3f1765a3b21145bd1a6c85441f806f7b17d) )
+ ROM_LOAD( "epr7578.87", 0x00000, 0x8000, CRC(6ff1637f) SHA1(9a6ddbd7b8d53273b30c3529b028c1f28bf3c63b) )
+ ROM_LOAD( "epr7577.86", 0x08000, 0x8000, CRC(58b3705e) SHA1(1a8ff3f1765a3b21145bd1a6c85441f806f7b17d) )
ROM_REGION( 0x0300, "palette", 0 )
ROM_LOAD( "pr-7345.20", 0x0000, 0x0100, CRC(8eee0f72) SHA1(b5694c120f604a5f7cc95618a71ab16a1a6151ed) ) /* palette red component */
@@ -4937,447 +5140,26 @@ ROM_END
DRIVER_INIT_MEMBER(system1_state,bank00)
{
- m_videomode_custom = nullptr;
- m_banked_decrypted_opcodes = nullptr;
}
DRIVER_INIT_MEMBER(system1_state,bank44)
{
m_videomode_custom = &system1_state::bank44_custom_w;
- m_banked_decrypted_opcodes = nullptr;
}
DRIVER_INIT_MEMBER(system1_state,bank0c)
{
m_videomode_custom = &system1_state::bank0c_custom_w;
- m_banked_decrypted_opcodes = nullptr;
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5033)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */
- { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5041)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5048)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */
- { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */
- { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */
- { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */
- { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5051)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */
- { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */
- { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
- { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */
- { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */
- { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */
- { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */
- { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */
- { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */
- { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5064)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */
- { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */
- { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */
- { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */
- { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */
- { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */
- { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5065)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */
- { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
- { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */
- { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
- { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_spat)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
- { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */
- { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */
- { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */
- { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */
- { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
- { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
- { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */
- { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5099)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */
- { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
- { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
- { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */
- { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
- { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5093)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
- { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */
- { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */
- { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5098) // also 315-5030 ?
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5102)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */
- { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
- { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-
-// THIS TABLE IS WRONG
-DRIVER_INIT_MEMBER(system1_state,sega315_5133)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */
- { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
- { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5110)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */
- { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */
- { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
- { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */
- { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
- { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */
- { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */
- { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
- { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */
- { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */
- { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
}
-DRIVER_INIT_MEMBER(system1_state,sega315_5155)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */
- { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */
- { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */
- { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
- { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */
- { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-DRIVER_INIT_MEMBER(system1_state,sega315_5132)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */
- { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */
- { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */
- { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */
- { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */
- { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */
- { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
- { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */
- };
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
DRIVER_INIT_MEMBER(system1_state,myherok)
{
+ // extra layer of encryption applied BEFORE the usual CPU decryption
+ // probably bootleg?
+
int A;
UINT8 *rom;
@@ -5417,181 +5199,14 @@ DRIVER_INIT_MEMBER(system1_state,myherok)
}
}
- DRIVER_INIT_CALL(sega315_5132);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5162)
-{
- // 315-5162
- static const UINT8 xor_table[128] =
- {
- 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
- 0x00,
- };
-
- static const int swap_table[128] =
- {
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
- 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
- 12,
- };
-
DRIVER_INIT_CALL(bank00);
- sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table);
}
-DRIVER_INIT_MEMBER(system1_state,sega315_5177)
-{
- // 315-5177
- static const UINT8 xor_table[128] =
- {
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
-
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
- 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
- 0x05,0x55,0x50,0x14,
- };
-
- static const int swap_table[128] =
- {
- 0,0,0,0,
- 1,1,1,1,1,
- 2,2,2,2,2,
- 3,3,3,3,
- 4,4,4,4,4,
- 5,5,5,5,5,
- 6,6,6,6,6,
- 7,7,7,7,7,
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,11,
- 12,12,12,12,12,
- 13,13,
-
- 8,8,8,8,
- 9,9,9,9,9,
- 10,10,10,10,10,
- 11,11,11,11,
- 12,12,12,12,12,
- 13,13,13,13,13,
- 14,14,14,14,14,
- 15,15,15,15,15,
- 16,16,16,16,
- 17,17,17,17,17,
- 18,18,18,18,18,
- 19,19,19,19,19,
- 20,20,20,20,20,
- 21,21,
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table);
-}
-DRIVER_INIT_MEMBER(system1_state,sega315_5177_s2)
-{
- DRIVER_INIT_CALL(sega315_5177);
- DRIVER_INIT_CALL(bank0c);
-}
-DRIVER_INIT_MEMBER(system1_state,sega315_5178)
-{
- // 315-5178
- static const UINT8 xor_table[128] =
- {
- 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,
- 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,
- 0x40,0x55,0x15,0x05,0x51,0x11,
- 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,
- 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,
- 0x41,0x54,0x14,0x04,0x50,0x10,
- 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
-
- 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,
- 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,
- 0x40,0x55,0x15,0x05,0x51,0x11,
- 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,
- 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,
- 0x41,0x54,0x14,0x04,0x50,0x10,
- 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
- };
-
- static const int swap_table[128] =
- {
- 2,
- 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7,
- 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4,
- 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3,
- 4, 6, 0, 2, 4, 6, 0, 2, 4, 6,
- 8,
- 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5,
- 6, 0, 2, 4, 6, 0, 2,
-
- 10,
- 11,13,15, 9,11,13,15, 9,11,13,15,
- 8,10,12,14, 8,10,12,14, 8,10,12,
- 13,15, 9,11,13,15, 9,11,13,15, 9,11,
- 12,14, 8,10,12,14, 8,10,12,14,
- 16,
- 9,11,13,15, 9,11,13,15, 9,11,13,
- 14, 8,10,12,14, 8,10,
- };
- DRIVER_INIT_CALL(bank00);
- sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table);
-}
-
-DRIVER_INIT_MEMBER(system1_state,sega315_5135)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */
- };
-
- DRIVER_INIT_CALL(bank00);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
DRIVER_INIT_MEMBER(system1_state,blockgal)
{
@@ -5599,47 +5214,10 @@ DRIVER_INIT_MEMBER(system1_state,blockgal)
mc8123_decode(m_maincpu_region->base(), m_decrypted_opcodes, memregion("key")->base(), 0x8000);
}
-DRIVER_INIT_MEMBER(system1_state,sega315_3135)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
- { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */
- { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */
- { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */
- { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */
- };
- DRIVER_INIT_CALL(bank44);
- sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-DRIVER_INIT_MEMBER(system1_state,gardia)
-{
- // 317-0006
- DRIVER_INIT_CALL(bank44);
- sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 2);
-}
-DRIVER_INIT_MEMBER(system1_state,gardiab)
-{
- // 317-0007
- DRIVER_INIT_CALL(bank44);
- sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 3);
-}
+
DRIVER_INIT_MEMBER(system1_state,wbml)
{
@@ -5773,90 +5351,91 @@ DRIVER_INIT_MEMBER(system1_state,shtngmst)
*************************************/
/* PPI-based System 1 */
-GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, upndown, 0, sys1ppix, upndown, system1_state, sega315_5098, ROT270, "Sega", "Up'n Down (315-5030)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, regulus, 0, sys1ppix, regulus, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033, Rev A.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, reguluso, regulus, sys1ppix, reguluso, system1_state, sega315_5033, ROT270, "Sega", "Regulus (315-5033)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, mrviking, 0, sys1ppisx, mrviking, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, mrvikingj, mrviking, sys1ppisx, mrvikingj, system1_state, sega315_5041, ROT270, "Sega", "Mister Viking (315-5041, Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, swat, 0, sys1ppix, swat, system1_state, sega315_5048, ROT270, "Coreland / Sega", "SWAT (315-5048)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, flickyo, flicky, sys1ppix, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, flickys1, flicky, sys1ppix, flickys1, system1_state, sega315_5051, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, wmatch, 0, sys1ppisx, wmatch, system1_state, sega315_5064, ROT270, "Sega", "Water Match (315-5064)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, bullfgt, 0, sys1ppix, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "Bullfight (315-5065)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, nprinces, seganinj, sys1ppix, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboy2, wboy, sys1ppix, wboy, system1_state, sega315_5178, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, upndown, 0, sys1ppix_315_5098, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (315-5030)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, regulus, 0, sys1ppix_315_5033, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (315-5033, Rev A.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, reguluso, regulus, sys1ppix_315_5033, reguluso, system1_state, bank00, ROT270, "Sega", "Regulus (315-5033)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, mrviking, 0, sys1ppisx_315_5041,mrviking, system1_state, bank00, ROT270, "Sega", "Mister Viking (315-5041)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, mrvikingj, mrviking, sys1ppisx_315_5041,mrvikingj, system1_state, bank00, ROT270, "Sega", "Mister Viking (315-5041, Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, swat, 0, sys1ppix_315_5048, swat, system1_state, bank00, ROT270, "Coreland / Sega", "SWAT (315-5048)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, flickyo, flicky, sys1ppix_315_5051, flicky, system1_state, bank00, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, flickys1, flicky, sys1ppix_315_5051, flickys1, system1_state, bank00, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, wmatch, 0, sys1ppisx_315_5064,wmatch, system1_state, bank00, ROT270, "Sega", "Water Match (315-5064)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, bullfgt, 0, sys1ppix_315_5065, bullfgt, system1_state, bank00, ROT0, "Coreland / Sega", "Bullfight (315-5065)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, nprinces, seganinj, sys1ppix_315_5051, seganinj, system1_state, bank00, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboy2, wboy, sys1ppix_315_5178, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", MACHINE_SUPPORTS_SAVE )
/* PIO-based System 1 */
-GAME( 1984, flicky, 0, sys1piox, flicky, system1_state, sega315_5051, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, thetogyu, bullfgt, sys1piox, bullfgt, system1_state, sega315_5065, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, spatter, 0, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Spatter (315-xxxx)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, spattera, spatter, sys1piosx, spatter, system1_state, sega315_5099, ROT0, "Sega", "Spatter (315-5099)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, ssanchan, spatter, sys1piosx, spatter, system1_state, sega315_spat, ROT0, "Sega", "Sanrin San Chan (Japan, 315-xxxx)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, pitfall2, 0, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, pitfall2a, pitfall2, sys1piox, pitfall2, system1_state, sega315_5093, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, seganinj, 0, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Sega Ninja (315-5102)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, seganinja, seganinj, sys1piox, seganinj, system1_state, sega315_5133, ROT0, "Sega", "Sega Ninja (315-5113)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // needs decrypting
-GAME( 1985, ninja, seganinj, sys1piox, seganinj, system1_state, sega315_5102, ROT0, "Sega", "Ninja (315-5102)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, nprinceso, seganinj, sys1piox, seganinj, system1_state, sega315_5098, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, nprincesb, seganinj, sys1piox, seganinj, system1_state, sega315_5051, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, imsorry, 0, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, imsorryj, imsorry, sys1piox, imsorry, system1_state, sega315_5110, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, teddybb, 0, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, teddybbo, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, teddybbobl, teddybb, sys1piox, teddybb, system1_state, sega315_5155, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, sscandal, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, myherobl, myhero, sys1piox, myhero, system1_state, sega315_5132, ROT0, "bootleg", "My Hero (bootleg, 315-5132 encryption)", MACHINE_SUPPORTS_SAVE ) // cloned 315-5132 encryption? might be a direct copy of an undumped original set
-GAME( 1985, myherok, myhero, sys1piox, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", MACHINE_SUPPORTS_SAVE ) // possible bootleg, has extra encryption
-GAME( 1985, 4dwarrio, 0, sys1piox, 4dwarrio, system1_state, sega315_5162, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, raflesia, 0, sys1piox, raflesia, system1_state, sega315_5162, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboy, 0, sys1piox, wboy, system1_state, sega315_5177, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboyo, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5135)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboy3, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboy4, wboy, sys1piox, wboy, system1_state, sega315_5162, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", MACHINE_SUPPORTS_SAVE ) // appears to be a very early / unfinished version.
-GAME( 1986, wboy5, wboy, sys1piox, wboy3, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboyub, wboy, sys1piox, wboy, system1_state, sega315_5135, ROT0, "bootleg", "Wonder Boy (US bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
-GAME( 1987, blockgal, 0, sys1piox, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", MACHINE_SUPPORTS_SAVE)
+GAME( 1984, flicky, 0, sys1piox_315_5051, flicky, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, thetogyu, bullfgt, sys1piox_315_5065, bullfgt, system1_state, bank00, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, spatter, 0, sys1piosx_315_spat,spatter, system1_state, bank00, ROT0, "Sega", "Spatter (315-xxxx)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, spattera, spatter, sys1piosx_315_5099,spatter, system1_state, bank00, ROT0, "Sega", "Spatter (315-5099)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, ssanchan, spatter, sys1piosx_315_spat,spatter, system1_state, bank00, ROT0, "Sega", "Sanrin San Chan (Japan, 315-xxxx)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, pitfall2, 0, sys1piox_315_5093, pitfall2, system1_state, bank00, ROT0, "Sega", "Pitfall II (315-5093)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, pitfall2a, pitfall2, sys1piox_315_5093, pitfall2, system1_state, bank00, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, seganinj, 0, sys1piox_315_5102, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (315-5102)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, seganinja, seganinj, sys1piox_315_5133, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (315-5113)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // needs decrypting
+GAME( 1985, ninja, seganinj, sys1piox_315_5102, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja (315-5102)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, nprinceso, seganinj, sys1piox_315_5098, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, nprincesb, seganinj, sys1piox_315_5051, seganinj, system1_state, bank00, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, imsorry, 0, sys1piox_315_5110, imsorry, system1_state, bank00, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, imsorryj, imsorry, sys1piox_315_5110, imsorry, system1_state, bank00, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, teddybb, 0, sys1piox_315_5155, teddybb, system1_state, bank00, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, teddybbo, teddybb, sys1piox_315_5155, teddybb, system1_state, bank00, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, teddybbobl, teddybb, sys1piox_315_5155, teddybb, system1_state, bank00, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, sscandal, myhero, sys1piox_315_5132, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, myherobl, myhero, sys1piox_315_5132, myhero, system1_state, bank00, ROT0, "bootleg", "My Hero (bootleg, 315-5132 encryption)", MACHINE_SUPPORTS_SAVE ) // cloned 315-5132 encryption? might be a direct copy of an undumped original set
+GAME( 1985, myherok, myhero, sys1piox_315_5132, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", MACHINE_SUPPORTS_SAVE ) // possible bootleg, has extra encryption
+GAME( 1985, 4dwarrio, 0, sys1piox_315_5162, 4dwarrio, system1_state, bank00, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, raflesia, 0, sys1piox_315_5162, raflesia, system1_state, bank00, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboy, 0, sys1piox_315_5177, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboyo, wboy, sys1piox_315_5135, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5135)", MACHINE_SUPPORTS_SAVE ) // aka 317-0003
+GAME( 1986, wboy3, wboy, sys1piox_315_5135, wboy3, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboy4, wboy, sys1piox_315_5162, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", MACHINE_SUPPORTS_SAVE ) // appears to be a very early / unfinished version.
+GAME( 1986, wboy5, wboy, sys1piox_315_5135, wboy3, system1_state, bank00, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboyub, wboy, sys1piox_315_5177, wboy, system1_state, bank00, ROT0, "bootleg", "Wonder Boy (US bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, blockgal, 0, sys1piox, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", MACHINE_SUPPORTS_SAVE)
/* PIO-based System 1 with ROM banking */
-GAME( 1985, hvymetal, 0, sys1piox, hvymetal, system1_state, sega315_3135, ROT0, "Sega", "Heavy Metal (315-5135)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, gardia, 0, sys1piox, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (317-0006)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE)
-GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, hvymetal, 0, sys1piox_315_5135, hvymetal, system1_state, bank44, ROT0, "Sega", "Heavy Metal (315-5135)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, gardia, 0, sys1piox_317_0006, gardia, system1_state, bank44, ROT270, "Coreland / Sega", "Gardia (317-0006)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE)
+GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", MACHINE_SUPPORTS_SAVE )
/* System 2 */
-GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
-GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, gardiab, gardia, sys2x, gardia, system1_state, gardiab, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
-GAME( 1986, gardiaj, gardia, sys2x, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (Japan, 317-0006)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
-GAME( 1986, wboysys2, wboy, sys2x, wboysys2, system1_state, sega315_5177_s2, ROT0, "Escape (Sega license)", "Wonder Boy (system 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbml, 0, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbmljo, wbml, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbmljb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbmlb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", MACHINE_SUPPORTS_SAVE)
-GAME( 1987, wbmlbg, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbmlbge, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", MACHINE_SUPPORTS_SAVE )
-GAME( 2009, wbmlvc, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", MACHINE_SUPPORTS_SAVE )
-GAME( 2009, wbmlvcd, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of English, Virtual Console release)", MACHINE_SUPPORTS_SAVE ) // fully decrypted version
-GAME( 1987, wbmld, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, wbmljod, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, dakkochn, 0, sys2xb, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, blockgalb, blockgal, sys2x, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, ufosensi, 0, sys2rowxb, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, ufosensib, ufosensi, sys2rowxb, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
+GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, gardiab, gardia, sys2_317_0007, gardia, system1_state, bank44, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
+GAME( 1986, gardiaj, gardia, sys2_317_0006, gardia, system1_state, bank44, ROT270, "Coreland / Sega", "Gardia (Japan, 317-0006)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboysys2, wboy, sys2_315_5177, wboysys2, system1_state, bank0c, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 1, 315-5177)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, wboysys2a, wboy, sys2_315_5176, wboysys2, system1_state, bank0c, ROT0, "Escape (Sega license)", "Wonder Boy (system 2, set 2, 315-5176)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbml, 0, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbmljo, wbml, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbmljb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbmlb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", MACHINE_SUPPORTS_SAVE)
+GAME( 1987, wbmlbg, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbmlbge, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", MACHINE_SUPPORTS_SAVE )
+GAME( 2009, wbmlvc, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", MACHINE_SUPPORTS_SAVE )
+GAME( 2009, wbmlvcd, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of English, Virtual Console release)", MACHINE_SUPPORTS_SAVE ) // fully decrypted version
+GAME( 1987, wbmld, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan New Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, wbmljod, wbml, sys2xb, wbml, system1_state, bootsys2d, ROT0, "bootleg (mpatou)", "Wonder Boy in Monster Land (decrypted bootleg of Japan Old Ver., MC-8123, 317-0043)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, dakkochn, 0, sys2xb, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, blockgalb, blockgal, sys2x, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, ufosensi, 0, sys2rowxb, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, ufosensib, ufosensi, sys2rowxb, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/taito_f2.cpp b/src/mame/drivers/taito_f2.cpp
index 05a3b11fecc..d323e47ac41 100644
--- a/src/mame/drivers/taito_f2.cpp
+++ b/src/mame/drivers/taito_f2.cpp
@@ -1612,7 +1612,14 @@ static INPUT_PORTS_START( ssi )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-static INPUT_PORTS_START( majest12 )
+static INPUT_PORTS_START( majest12u )
+ PORT_INCLUDE(ssi)
+
+ PORT_MODIFY("DSWA")
+ TAITO_COINAGE_US_LOC(SW1)
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( majest12j )
PORT_INCLUDE(ssi)
PORT_MODIFY("DSWA")
@@ -3232,7 +3239,6 @@ static MACHINE_CONFIG_DERIVED( footchmp, taito_f2 )
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
MACHINE_CONFIG_END
@@ -3266,7 +3272,6 @@ static MACHINE_CONFIG_DERIVED( hthero, taito_f2 )
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MACHINE_CONFIG_END
@@ -3433,7 +3438,6 @@ static MACHINE_CONFIG_DERIVED( metalb, taito_f2_tc0510nio )
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_COL_BASE(4096)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
MACHINE_CONFIG_END
@@ -3501,7 +3505,6 @@ static MACHINE_CONFIG_DERIVED( deadconx, taito_f2 )
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
MACHINE_CONFIG_END
@@ -3526,7 +3529,6 @@ static MACHINE_CONFIG_DERIVED( deadconxj, taito_f2 )
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_OFFSETS_FLIP(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0360PRI_ADD("tc0360pri")
MACHINE_CONFIG_END
@@ -4427,7 +4429,28 @@ ROM_START( ssia )
/* no Delta-T samples */
ROM_END
-ROM_START( majest12 )
+ROM_START( majest12u )
+ ROM_REGION( 0x80000, "maincpu", 0 ) /* 512k for 68000 code */
+ ROM_LOAD16_BYTE( "c64_12.ic9", 0x00000, 0x40000, CRC(d5716d7e) SHA1(3a18d8ef1d16380946714910245b00bbcec39e3d) )
+ ROM_LOAD16_BYTE( "c64_14.ic8", 0x00001, 0x40000, CRC(eee4ed8a) SHA1(ad50dc12ede0d327ef9ded5ffd9dbd6e865ebcfc) )
+
+ ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF )
+ /* empty! */
+
+ ROM_REGION( 0x100000, "gfx2", 0 ) /* OBJ */
+ ROM_LOAD( "c64-01.1", 0x000000, 0x100000, CRC(a1b4f486) SHA1(bdd6bf144e50fe7b1d4cf4504471a689669415a4) )
+
+ ROM_REGION( 0x1c000, "audiocpu", 0 ) /* sound cpu */
+ ROM_LOAD( "c64-09.13", 0x00000, 0x04000, CRC(88d7f65c) SHA1(d6383bf8fd035772fa3c57b26b727eefe1aadd93) )
+ ROM_CONTINUE( 0x10000, 0x0c000 ) /* banked stuff */
+
+ ROM_REGION( 0x20000, "ymsnd", 0 ) /* ADPCM samples */
+ ROM_LOAD( "c64-02.2", 0x00000, 0x20000, CRC(3cb0b907) SHA1(7cbe437fe584575a2f26a582095fd49665c7003e) )
+
+ /* no Delta-T samples */
+ROM_END
+
+ROM_START( majest12j )
ROM_REGION( 0x80000, "maincpu", 0 ) /* 512k for 68000 code */
ROM_LOAD16_BYTE( "c64-07.10", 0x00000, 0x20000, CRC(f29ed5c9) SHA1(62283af1c08457db54057ee59a95fb7a3797b897) )
ROM_LOAD16_BYTE( "c64-06.4", 0x40000, 0x20000, CRC(18dc71ac) SHA1(cb9c0b330ae98e20269f18cdb543feb294647245) )
@@ -5583,7 +5606,8 @@ GAME( 1990, quizhq, 0, quizhq, quizhq, driver_device, 0,
GAME( 1990, ssi, 0, ssi, ssi, driver_device, 0, ROT270, "Taito Corporation Japan", "Super Space Invaders '91 (World, Rev 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, ssia, ssi, ssi, ssi, driver_device, 0, ROT270, "Taito Corporation Japan", "Super Space Invaders '91 (World)", MACHINE_SUPPORTS_SAVE )
-GAME( 1990, majest12, ssi, ssi, majest12, driver_device, 0, ROT270, "Taito Corporation", "Majestic Twelve - The Space Invaders Part IV (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1990, majest12u, ssi, ssi, majest12u, driver_device, 0, ROT270, "Taito America Corporation", "Majestic Twelve - The Space Invaders Part IV (US)", MACHINE_SUPPORTS_SAVE )
+GAME( 1990, majest12j, ssi, ssi, majest12j, driver_device, 0, ROT270, "Taito Corporation", "Majestic Twelve - The Space Invaders Part IV (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gunfront, 0, gunfront, gunfront, driver_device, 0, ROT270, "Taito Corporation Japan", "Gun & Frontier (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gunfrontj, gunfront, gunfront, gunfrontj, driver_device, 0, ROT270, "Taito Corporation", "Gun Frontier (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/taito_h.cpp b/src/mame/drivers/taito_h.cpp
index c2714413025..900940597a2 100644
--- a/src/mame/drivers/taito_h.cpp
+++ b/src/mame/drivers/taito_h.cpp
@@ -676,7 +676,6 @@ static MACHINE_CONFIG_START( syvalion, taitoh_state )
MCFG_TC0080VCO_OFFSETS(1, 1)
MCFG_TC0080VCO_BGFLIP_OFFS(-2)
MCFG_TC0080VCO_GFXDECODE("gfxdecode")
- MCFG_TC0080VCO_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -732,7 +731,6 @@ static MACHINE_CONFIG_START( recordbr, taitoh_state )
MCFG_TC0080VCO_OFFSETS(1, 1)
MCFG_TC0080VCO_BGFLIP_OFFS(-2)
MCFG_TC0080VCO_GFXDECODE("gfxdecode")
- MCFG_TC0080VCO_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -796,7 +794,6 @@ static MACHINE_CONFIG_START( dleague, taitoh_state )
MCFG_TC0080VCO_OFFSETS(1, 1)
MCFG_TC0080VCO_BGFLIP_OFFS(-2)
MCFG_TC0080VCO_GFXDECODE("gfxdecode")
- MCFG_TC0080VCO_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/taito_o.cpp b/src/mame/drivers/taito_o.cpp
index 263ff71afcd..2b9761750a4 100644
--- a/src/mame/drivers/taito_o.cpp
+++ b/src/mame/drivers/taito_o.cpp
@@ -253,7 +253,6 @@ static MACHINE_CONFIG_START( parentj, taitoo_state )
MCFG_TC0080VCO_OFFSETS(1, 1)
MCFG_TC0080VCO_BGFLIP_OFFS(-2)
MCFG_TC0080VCO_GFXDECODE("gfxdecode")
- MCFG_TC0080VCO_PALETTE("palette")
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/taito_x.cpp b/src/mame/drivers/taito_x.cpp
index 9d068780e0b..ed18529079e 100644
--- a/src/mame/drivers/taito_x.cpp
+++ b/src/mame/drivers/taito_x.cpp
@@ -809,7 +809,6 @@ static MACHINE_CONFIG_START( superman, taitox_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -857,7 +856,6 @@ static MACHINE_CONFIG_START( daisenpu, taitox_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -903,7 +901,6 @@ static MACHINE_CONFIG_START( gigandes, taitox_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -951,7 +948,6 @@ static MACHINE_CONFIG_START( ballbros, taitox_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp
index 16fbc1beb8c..45d69582597 100644
--- a/src/mame/drivers/taito_z.cpp
+++ b/src/mame/drivers/taito_z.cpp
@@ -3641,7 +3641,6 @@ static MACHINE_CONFIG_START( dblaxle, taitoz_state )
MCFG_TC0480SCP_TX_REGION(2)
MCFG_TC0480SCP_OFFSETS(0x1f, 0x08)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
@@ -3717,7 +3716,6 @@ static MACHINE_CONFIG_START( racingb, taitoz_state )
MCFG_TC0480SCP_TX_REGION(2)
MCFG_TC0480SCP_OFFSETS(0x1f, 0x08)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
diff --git a/src/mame/drivers/taitoair.cpp b/src/mame/drivers/taitoair.cpp
index 95e1fcdcec9..3315310901b 100644
--- a/src/mame/drivers/taitoair.cpp
+++ b/src/mame/drivers/taitoair.cpp
@@ -767,7 +767,6 @@ static MACHINE_CONFIG_START( airsys, taitoair_state )
MCFG_TC0080VCO_OFFSETS(1, 1)
MCFG_TC0080VCO_BGFLIP_OFFS(-2)
MCFG_TC0080VCO_GFXDECODE("gfxdecode")
- MCFG_TC0080VCO_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/taotaido.cpp b/src/mame/drivers/taotaido.cpp
index 5f4585f3048..f977e8beb69 100644
--- a/src/mame/drivers/taotaido.cpp
+++ b/src/mame/drivers/taotaido.cpp
@@ -387,7 +387,6 @@ static MACHINE_CONFIG_START( taotaido, taotaido_state )
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( taotaido_state, tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(0)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/tasman.cpp b/src/mame/drivers/tasman.cpp
index a9c65694c9b..91159716ee7 100644
--- a/src/mame/drivers/tasman.cpp
+++ b/src/mame/drivers/tasman.cpp
@@ -22,20 +22,44 @@
#include "emu.h"
#include "video/konami_helper.h"
-#include "includes/konamigx.h"
#include "cpu/m68000/m68000.h"
+#include "machine/k053252.h"
+#include "video/k053246_k053247_k055673.h"
+#include "video/k054156_k054157_k056832.h"
+#include "video/k055555.h"
#include "machine/eepromser.h"
#define CUSTOM_DRAW 1
-class kongambl_state : public konamigx_state // with everything devicified there's probably not much point in inheriting the GX state.
+class kongambl_state : public driver_device
{
public:
kongambl_state(const machine_config &mconfig, device_type type, const char *tag)
- : konamigx_state(mconfig, type, tag),
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this,"maincpu"),
+ m_k053252(*this, "k053252"),
+ m_k055673(*this, "k055673"),
+ m_k055555(*this, "k055555"),
+ m_k056832(*this, "k056832"),
+#if CUSTOM_DRAW
+ m_gfxdecode(*this, "gfxdecode"),
+#endif
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
m_vram(*this, "vram")
{ }
+ required_device<cpu_device> m_maincpu;
+ required_device<k053252_device> m_k053252;
+ required_device<k055673_device> m_k055673;
+ required_device<k055555_device> m_k055555;
+ required_device<k056832_device> m_k056832;
+#if CUSTOM_DRAW
+ required_device<gfxdecode_device> m_gfxdecode;
+#endif
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+
optional_shared_ptr<UINT32> m_vram;
DECLARE_READ32_MEMBER(eeprom_r);
DECLARE_WRITE8_MEMBER(eeprom_w);
@@ -48,6 +72,8 @@ public:
virtual void machine_reset() override { m_irq_mask = 0; };
UINT32 screen_update_kongambl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ WRITE_LINE_MEMBER(vblank_irq_ack_w);
+ WRITE_LINE_MEMBER(hblank_irq_ack_w);
TIMER_DEVICE_CALLBACK_MEMBER(kongambl_vblank);
K056832_CB_MEMBER(tile_callback);
K053246_CB_MEMBER(sprite_callback);
@@ -576,6 +602,16 @@ static GFXDECODE_START( tasman )
GFXDECODE_END
+WRITE_LINE_MEMBER(kongambl_state::vblank_irq_ack_w)
+{
+ m_maincpu->set_input_line(1, CLEAR_LINE);
+}
+
+WRITE_LINE_MEMBER(kongambl_state::hblank_irq_ack_w)
+{
+ m_maincpu->set_input_line(2, CLEAR_LINE);
+}
+
TIMER_DEVICE_CALLBACK_MEMBER(kongambl_state::kongambl_vblank)
{
int scanline = param;
@@ -606,8 +642,8 @@ static MACHINE_CONFIG_START( kongambl, kongambl_state )
MCFG_DEVICE_ADD("k053252", K053252, 25000000)
MCFG_K053252_OFFSETS(0, 16) // TBD
- MCFG_K053252_INT1_ACK_CB(WRITELINE(konamigx_state, vblank_irq_ack_w))
- MCFG_K053252_INT2_ACK_CB(WRITELINE(konamigx_state, hblank_irq_ack_w))
+ MCFG_K053252_INT1_ACK_CB(WRITELINE(kongambl_state, vblank_irq_ack_w))
+ MCFG_K053252_INT2_ACK_CB(WRITELINE(kongambl_state, hblank_irq_ack_w))
MCFG_VIDEO_SET_SCREEN("screen")
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
@@ -626,16 +662,16 @@ static MACHINE_CONFIG_START( kongambl, kongambl_state )
MCFG_DEVICE_ADD("k055673", K055673, 0)
MCFG_K055673_CB(kongambl_state, sprite_callback)
- MCFG_K055673_CONFIG("gfx2", 1, K055673_LAYOUT_LE2, -48+1, -23)
- MCFG_K055673_GFXDECODE("gfxdecode")
+ MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_LE2, -48+1, -23)
MCFG_K055673_PALETTE("palette")
+#if CUSTOM_DRAW
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tasman)
+#endif
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(kongambl_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8TASMAN, 0, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_8TASMAN, 0, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp
index d6e9698474a..96a765dfda1 100644
--- a/src/mame/drivers/thedealr.cpp
+++ b/src/mame/drivers/thedealr.cpp
@@ -534,7 +534,6 @@ static MACHINE_CONFIG_START( thedealr, thedealr_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
MCFG_MACHINE_RESET_OVERRIDE(thedealr_state,thedealr)
MCFG_MACHINE_START_OVERRIDE(thedealr_state,thedealr)
diff --git a/src/mame/drivers/thedeep.cpp b/src/mame/drivers/thedeep.cpp
index e999027842b..12e4926c632 100644
--- a/src/mame/drivers/thedeep.cpp
+++ b/src/mame/drivers/thedeep.cpp
@@ -439,9 +439,8 @@ static MACHINE_CONFIG_START( thedeep, thedeep_state )
MCFG_PALETTE_INIT_OWNER(thedeep_state, thedeep)
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 0);
+ MCFG_DECO_MXC06_GFX_REGION(0)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
MCFG_DECO_MXC06_RAMSIZE(0x400)
/* sound hardware */
diff --git a/src/mame/drivers/ti99_4p.cpp b/src/mame/drivers/ti99_4p.cpp
index 0f48e57772b..4650d391c08 100644
--- a/src/mame/drivers/ti99_4p.cpp
+++ b/src/mame/drivers/ti99_4p.cpp
@@ -41,6 +41,7 @@
#include "cpu/tms9900/tms9900.h"
#include "sound/wave.h"
#include "sound/dac.h"
+#include "sound/sn76496.h"
#include "machine/tms9901.h"
#include "imagedev/cassette.h"
@@ -53,8 +54,9 @@
#define TMS9901_TAG "tms9901"
#define SGCPU_TAG "sgcpu"
-#define VERBOSE 1
-#define LOG logerror
+#define TRACE_ILLWRITE 0
+#define TRACE_READY 0
+#define TRACE_INT 0
class ti99_4p_state : public driver_device
{
@@ -63,7 +65,7 @@ public:
: driver_device(mconfig, type, tag),
m_cpu(*this, "maincpu"),
m_tms9901(*this, TMS9901_TAG),
- m_sound(*this, TISOUND_TAG),
+ m_sound(*this, TISOUNDCHIP_TAG),
m_video(*this, VIDEO_SYSTEM_TAG),
m_cassette(*this, "cassette"),
m_peribox(*this, PERIBOX_TAG),
@@ -103,13 +105,13 @@ public:
DECLARE_WRITE_LINE_MEMBER(set_tms9901_INT2_from_v9938);
- required_device<tms9900_device> m_cpu;
- required_device<tms9901_device> m_tms9901;
- required_device<ti_sound_system_device> m_sound;
- required_device<ti_exp_video_device> m_video;
- required_device<cassette_image_device> m_cassette;
- required_device<peribox_device> m_peribox;
- required_device<joyport_device> m_joyport;
+ required_device<tms9900_device> m_cpu;
+ required_device<tms9901_device> m_tms9901;
+ required_device<sn76496_base_device> m_sound;
+ required_device<ti_exp_video_device> m_video;
+ required_device<cassette_image_device> m_cassette;
+ required_device<peribox_device> m_peribox;
+ required_device<joyport_device> m_joyport;
// Pointer to ROM0
UINT16 *m_rom0;
@@ -354,7 +356,7 @@ WRITE16_MEMBER( ti99_4p_state::memwrite )
if (zone==0x0000)
{
// ROM0
- if (VERBOSE>4) LOG("sgcpu: ignoring ROM write access at %04x\n", addroff);
+ if (TRACE_ILLWRITE) logerror("Ignoring ROM write access at %04x\n", addroff);
return;
}
@@ -368,7 +370,7 @@ WRITE16_MEMBER( ti99_4p_state::memwrite )
{
if (m_internal_dsr)
{
- if (VERBOSE>4) LOG("sgcpu: ignoring DSR write access at %04x\n", addroff);
+ if (TRACE_ILLWRITE) logerror("Ignoring DSR write access at %04x\n", addroff);
return;
}
else
@@ -439,12 +441,16 @@ READ16_MEMBER( ti99_4p_state::datamux_read )
UINT8 hbyte = 0;
UINT16 addroff = (offset << 1);
+ m_peribox->memen_in(ASSERT_LINE);
+
m_peribox->readz(space, addroff+1, &m_latch, mem_mask);
m_lowbyte = m_latch;
m_peribox->readz(space, addroff, &hbyte, mem_mask);
m_highbyte = hbyte;
+ m_peribox->memen_in(CLEAR_LINE);
+
// use the latch and the currently read byte and put it on the 16bit bus
// printf("read address = %04x, value = %04x, memmask = %4x\n", addroff, (hbyte<<8) | sgcpu->latch, mem_mask);
@@ -467,11 +473,15 @@ WRITE16_MEMBER( ti99_4p_state::datamux_write )
// read more about the datamux in datamux.c
// Write to the PEB
+ m_peribox->memen_in(ASSERT_LINE);
+
m_peribox->write(space, addroff+1, data & 0xff);
// Write to the PEB
m_peribox->write(space, addroff, (data>>8) & 0xff);
+ m_peribox->memen_in(CLEAR_LINE);
+
// Insert four wait states and let CPU enter wait state
m_waitcount = 6;
console_ready_dmux(CLEAR_LINE);
@@ -684,39 +694,6 @@ WRITE_LINE_MEMBER( ti99_4p_state::cassette_output )
m_cassette->output((state!=0)? +1 : -1);
}
-/*
-// TMS9901 setup. The callback functions pass a reference to the TMS9901 as device.
-const tms9901_interface tms9901_wiring_sgcpu =
-{
- TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC, // only input pins whose state is always known
-
- // read handler
- DEVCB_DRIVER_MEMBER(ti99_4p_state, read_by_9901),
-
- { // write handlers
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC0),
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC1),
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC2),
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, alphaW),
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cs_motor),
- DEVCB_NULL,
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, audio_gate),
- DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cassette_output),
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
- },
-
- // interrupt handler
- DEVCB_DRIVER_MEMBER(ti99_4p_state, tms9901_interrupt)
-};
-
-*/
/***************************************************************************
Control lines
@@ -733,9 +710,9 @@ WRITE_LINE_MEMBER( ti99_4p_state::console_ready )
m_ready_line = state;
int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE;
- if (VERBOSE>6)
+ if (TRACE_READY)
{
- if (m_ready_prev != combined) LOG("ti99_4p: READY level = %d\n", combined);
+ if (m_ready_prev != combined) logerror("READY level = %d\n", combined);
}
m_ready_prev = combined;
m_cpu->set_ready(combined);
@@ -751,9 +728,9 @@ WRITE_LINE_MEMBER( ti99_4p_state::console_ready_dmux )
m_ready_line_dmux = state;
int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE;
- if (VERBOSE>7)
+ if (TRACE_READY)
{
- if (m_ready_prev != combined) LOG("ti99_4p: READY dmux level = %d\n", state);
+ if (m_ready_prev != combined) logerror("READY dmux level = %d\n", state);
}
m_ready_prev = combined;
m_cpu->set_ready(combined);
@@ -769,13 +746,13 @@ void ti99_4p_state::set_9901_int( int line, line_state state)
WRITE_LINE_MEMBER( ti99_4p_state::extint )
{
- if (VERBOSE>6) LOG("ti99_4p: EXTINT level = %02x\n", state);
+ if (TRACE_INT) logerror("EXTINT level = %02x\n", state);
set_9901_int(1, (line_state)state);
}
WRITE_LINE_MEMBER( ti99_4p_state::notconnected )
{
- if (VERBOSE>6) LOG("ti99_4p: Setting a not connected line ... ignored\n");
+ if (TRACE_INT) logerror("Setting a not connected line ... ignored\n");
}
/*
@@ -804,7 +781,7 @@ READ8_MEMBER( ti99_4p_state::interrupt_level )
WRITE8_MEMBER( ti99_4p_state::external_operation )
{
static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" };
- if (VERBOSE>1) LOG("External operation %s not implemented on the SGCPU board\n", extop[offset]);
+ logerror("External operation %s not implemented on the SGCPU board\n", extop[offset]);
}
/*****************************************************************************/
@@ -883,9 +860,11 @@ static MACHINE_CONFIG_START( ti99_4p_60hz, ti99_4p_state )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4p_state, notconnected) )
MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) )
- // sound hardware
- MCFG_TI_SOUND_94624_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) )
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) )
// Cassette drives
MCFG_SPEAKER_STANDARD_MONO("cass_out")
diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp
index b8fcb75b3cb..898327f92a7 100644
--- a/src/mame/drivers/ti99_4x.cpp
+++ b/src/mame/drivers/ti99_4x.cpp
@@ -48,7 +48,6 @@
#include "bus/ti99x/videowrp.h"
#include "bus/ti99x/datamux.h"
-#include "bus/ti99x/grom.h"
#include "bus/ti99x/gromport.h"
#include "bus/ti99x/joyport.h"
@@ -83,8 +82,11 @@ public:
DECLARE_MACHINE_START(ti99_4);
DECLARE_MACHINE_START(ti99_4a);
DECLARE_MACHINE_START(ti99_4qi);
+ DECLARE_MACHINE_START(ti99_4ev);
+
DECLARE_MACHINE_RESET(ti99_4);
DECLARE_MACHINE_RESET(ti99_4a);
+ DECLARE_MACHINE_RESET(ti99_4ev);
// Processor connections with the main board
DECLARE_READ8_MEMBER( cruread );
@@ -103,6 +105,9 @@ public:
DECLARE_WRITE_LINE_MEMBER( console_reset );
DECLARE_WRITE_LINE_MEMBER( notconnected );
+ // GROM clock
+ DECLARE_WRITE_LINE_MEMBER( gromclk_in );
+
// Connections with the system interface chip 9901
DECLARE_WRITE_LINE_MEMBER( extint );
DECLARE_WRITE_LINE_MEMBER( video_interrupt_in );
@@ -124,6 +129,9 @@ public:
// Interrupt triggers
DECLARE_INPUT_CHANGED_MEMBER( load_interrupt );
+ // Used by EVPC
+ void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
void set_keyboard_column(int number, int data);
int m_keyboard_column;
@@ -152,6 +160,9 @@ private:
required_device<ti_video_device> m_video;
required_device<cassette_image_device> m_cassette1;
required_device<cassette_image_device> m_cassette2;
+
+ // Timer for EVPC (provided by the TMS9929A, but EVPC replaces that VDP)
+ emu_timer *m_gromclk_timer;
};
/*
@@ -177,16 +188,10 @@ enum
};
/*
- Memory map.
- Most of the work is done in the datamux (see datamux.c). We only keep ROM
- and the small 256 byte PAD RAM here because they are directly connected
- to the 16bit bus, and the wait state logic is not active during their
- accesses.
+ Memory map. All of the work is done in the datamux (see datamux.c).
*/
static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4x_state)
ADDRESS_MAP_GLOBAL_MASK(0xffff)
- AM_RANGE(0x0000, 0x1fff) AM_ROM
- AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAM
AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(DATAMUX_TAG, ti99_datamux_device, read, write) AM_DEVSETOFFSET(DATAMUX_TAG, ti99_datamux_device, setoffset)
ADDRESS_MAP_END
@@ -365,21 +370,6 @@ INPUT_PORTS_END
Components
******************************************************************************/
-static GROM_CONFIG(grom0_config)
-{
- false, 0, region_grom, 0x0000, 0x1800, GROMFREQ
-};
-
-static GROM_CONFIG(grom1_config)
-{
- false, 1, region_grom, 0x2000, 0x1800, GROMFREQ
-};
-
-static GROM_CONFIG(grom2_config)
-{
- false, 2, region_grom, 0x4000, 0x1800, GROMFREQ
-};
-
READ8_MEMBER( ti99_4x_state::cruread )
{
// if (TRACE_CRU) logerror("read access to CRU address %04x\n", offset << 4);
@@ -631,6 +621,7 @@ READ8_MEMBER( ti99_4x_state::interrupt_level )
WRITE_LINE_MEMBER( ti99_4x_state::clock_out )
{
m_datamux->clock_in(state);
+ m_peribox->clock_in(state);
}
/*
@@ -641,6 +632,27 @@ WRITE_LINE_MEMBER( ti99_4x_state::dbin_line )
m_datamux->dbin_in(state);
}
+/*
+ GROMCLK from VDP, propagating to datamux
+*/
+WRITE_LINE_MEMBER( ti99_4x_state::gromclk_in )
+{
+ m_datamux->gromclk_in(state);
+}
+
+/*
+ Used by the EVPC
+*/
+void ti99_4x_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ // Pulse it
+ if (m_datamux != nullptr)
+ {
+ gromclk_in(ASSERT_LINE);
+ gromclk_in(CLEAR_LINE);
+ }
+}
+
/*****************************************************************************/
/*
@@ -708,6 +720,7 @@ void ti99_4x_state::console_ready_join(int id, int state)
*/
WRITE_LINE_MEMBER( ti99_4x_state::console_ready_grom )
{
+ if (TRACE_READY) logerror("GROM ready = %d\n", state);
console_ready_join(READY_GROM, state);
}
@@ -757,52 +770,6 @@ WRITE_LINE_MEMBER( ti99_4x_state::notconnected )
if (TRACE_INTERRUPTS) logerror("ti99_4x: Setting a not connected line ... ignored\n");
}
-/*****************************************************************************/
-
-/*
- Devices attached to the databus multiplexer. We cannot solve this with
- the common address maps since the multiplexer also inserts wait states
- that we want to emulate properly. Also, devices may reside on the same
- memory locations (like GROMs) and select themselves according to some
- inner state (e.g. GROMs have an own address counter and a given address
- area).
-*/
-static const dmux_device_list_entry dmux_devices[] =
-{
- { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, nullptr, 0, 0 },
- { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, nullptr, 0, 0 },
- { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, nullptr, 0, 0 },
- { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, nullptr, 0, 0 },
- { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, nullptr, 0, 0 }, // Peribox needs all addresses
- { nullptr, 0, 0, 0, nullptr, 0, 0 }
-};
-
-static const dmux_device_list_entry dmux_devices_ev[] =
-{
- { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, nullptr, 0, 0 },
- { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 },
- { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, nullptr, 0, 0 },
- { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, nullptr, 0, 0 },
- { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, nullptr, 0, 0 },
- { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, nullptr, 0, 0 }, // Peribox needs all addresses
- { nullptr, 0, 0, 0, nullptr, 0, 0 }
-};
-
-static DMUX_CONFIG( datamux_conf )
-{
- dmux_devices
-};
-
-static DMUX_CONFIG( datamux_conf_ev )
-{
- dmux_devices_ev
-};
-
/******************************************************************************
Machine definitions
******************************************************************************/
@@ -852,9 +819,10 @@ static MACHINE_CONFIG_START( ti99_4, ti99_4x_state )
MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) )
MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) )
- MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf )
+ MCFG_DEVICE_ADD( DATAMUX_TAG, DATAMUX, 0)
MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) )
- MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG )
+
+ MCFG_GROMPORT4_ADD( GROMPORT_TAG )
MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) )
MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) )
@@ -867,9 +835,11 @@ static MACHINE_CONFIG_START( ti99_4, ti99_4x_state )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) )
MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) )
- /* sound hardware */
- MCFG_TI_SOUND_94624_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
/* Cassette drives */
MCFG_SPEAKER_STANDARD_MONO("cass_out")
@@ -879,13 +849,10 @@ static MACHINE_CONFIG_START( ti99_4, ti99_4x_state )
MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
- /* GROM devices */
- MCFG_GROM_ADD( GROM0_TAG, grom0_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM1_TAG, grom1_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM2_TAG, grom2_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
+ // GROM devices
+ MCFG_GROM_ADD( GROM0_TAG, 0, region_grom, 0x0000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM1_TAG, 1, region_grom, 0x2000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM2_TAG, 2, region_grom, 0x4000, WRITELINE(ti99_4x_state, console_ready_grom))
// Joystick port
MCFG_TI_JOYPORT4_ADD( JOYPORT_TAG )
@@ -896,14 +863,14 @@ MACHINE_CONFIG_END
US version: 60 Hz, NTSC
*/
static MACHINE_CONFIG_DERIVED( ti99_4_60hz, ti99_4 )
- MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/*
European version: 50 Hz, PAL
*/
static MACHINE_CONFIG_DERIVED( ti99_4_50hz, ti99_4 )
- MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/**********************************************************************
@@ -951,9 +918,10 @@ static MACHINE_CONFIG_START( ti99_4a, ti99_4x_state )
MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) )
MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) )
- MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf )
+ MCFG_DEVICE_ADD( DATAMUX_TAG, DATAMUX, 0)
MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) )
- MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG )
+
+ MCFG_GROMPORT4_ADD( GROMPORT_TAG )
MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) )
MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) )
@@ -966,9 +934,11 @@ static MACHINE_CONFIG_START( ti99_4a, ti99_4x_state )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) )
MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) )
- /* sound hardware */
- MCFG_TI_SOUND_94624_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
/* Cassette drives */
MCFG_SPEAKER_STANDARD_MONO("cass_out")
@@ -978,13 +948,10 @@ static MACHINE_CONFIG_START( ti99_4a, ti99_4x_state )
MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
- /* GROM devices */
- MCFG_GROM_ADD( GROM0_TAG, grom0_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM1_TAG, grom1_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM2_TAG, grom2_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
+ // GROM devices
+ MCFG_GROM_ADD( GROM0_TAG, 0, region_grom, 0x0000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM1_TAG, 1, region_grom, 0x2000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM2_TAG, 2, region_grom, 0x4000, WRITELINE(ti99_4x_state, console_ready_grom))
// Joystick port
MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG )
@@ -994,14 +961,14 @@ MACHINE_CONFIG_END
US version: 60 Hz, NTSC
*/
static MACHINE_CONFIG_DERIVED( ti99_4a_60hz, ti99_4a )
- MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/*
European version: 50 Hz, PAL
*/
static MACHINE_CONFIG_DERIVED( ti99_4a_50hz, ti99_4a )
- MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/************************************************************************
@@ -1029,14 +996,14 @@ MACHINE_CONFIG_END
US version: 60 Hz, NTSC
*/
static MACHINE_CONFIG_DERIVED( ti99_4qi_60hz, ti99_4qi )
- MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/*
European version: 50 Hz, PAL
*/
static MACHINE_CONFIG_DERIVED( ti99_4qi_50hz, ti99_4qi )
- MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in)
+ MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in, gromclk_in)
MACHINE_CONFIG_END
/************************************************************************
@@ -1044,6 +1011,27 @@ MACHINE_CONFIG_END
replacing the console video processor.
*************************************************************************/
+MACHINE_START_MEMBER(ti99_4x_state, ti99_4ev)
+{
+ m_peribox->senila(CLEAR_LINE);
+ m_peribox->senilb(CLEAR_LINE);
+ m_nready_combined = 0;
+ m_model = MODEL_4A;
+ // Removing the TMS9928a requires to add a replacement for the GROMCLK.
+ // In the real hardware this is a circuit (REPL99x) that fits into the VDP socket
+ m_gromclk_timer = timer_alloc(0);
+}
+
+MACHINE_RESET_MEMBER(ti99_4x_state, ti99_4ev)
+{
+ m_cpu->set_ready(ASSERT_LINE);
+ m_cpu->set_hold(CLEAR_LINE);
+ m_int1 = CLEAR_LINE;
+ m_int2 = CLEAR_LINE;
+ m_int12 = CLEAR_LINE;
+ m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_10_738635MHz/24));
+}
+
static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state )
/* CPU */
MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map)
@@ -1052,7 +1040,8 @@ static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state )
MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) )
MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) )
- MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a )
+ MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4ev )
+ MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4ev )
/* video hardware */
MCFG_DEVICE_ADD(VIDEO_SYSTEM_TAG, V9938VIDEO, 0)
@@ -1073,9 +1062,9 @@ static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state )
MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) )
MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) )
- MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf_ev )
+ MCFG_DEVICE_ADD( DATAMUX_TAG, DATAMUX, 0)
MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) )
- MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG )
+ MCFG_GROMPORT4_ADD( GROMPORT_TAG )
MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) )
MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) )
@@ -1088,9 +1077,11 @@ static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) )
MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) )
- /* sound hardware */
- MCFG_TI_SOUND_94624_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) )
/* Cassette drives */
MCFG_SPEAKER_STANDARD_MONO("cass_out")
@@ -1100,13 +1091,10 @@ static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state )
MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
- /* GROM devices */
- MCFG_GROM_ADD( GROM0_TAG, grom0_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM1_TAG, grom1_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
- MCFG_GROM_ADD( GROM2_TAG, grom2_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom))
+ // GROM devices
+ MCFG_GROM_ADD( GROM0_TAG, 0, region_grom, 0x0000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM1_TAG, 1, region_grom, 0x2000, WRITELINE(ti99_4x_state, console_ready_grom))
+ MCFG_GROM_ADD( GROM2_TAG, 2, region_grom, 0x4000, WRITELINE(ti99_4x_state, console_ready_grom))
// Joystick port
MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG )
@@ -1124,7 +1112,7 @@ MACHINE_CONFIG_END
ROM_START(ti99_4)
// CPU memory space
- ROM_REGION16_BE(0x2000, "maincpu", 0)
+ ROM_REGION16_BE(0x2000, CONSOLEROM, 0)
ROM_LOAD16_BYTE("u610.bin", 0x0000, 0x1000, CRC(6fcf4b15) SHA1(d085213c64701d429ae535f9a4ac8a50427a8343)) /* CPU ROMs high */
ROM_LOAD16_BYTE("u611.bin", 0x0001, 0x1000, CRC(491c21d1) SHA1(7741ae9294c51a44a78033d1b77c01568a6bbfb9)) /* CPU ROMs low */
@@ -1137,7 +1125,7 @@ ROM_END
ROM_START(ti99_4a)
// CPU memory space
- ROM_REGION16_BE(0x2000, "maincpu", 0)
+ ROM_REGION16_BE(0x2000, CONSOLEROM, 0)
ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */
// GROM memory space
@@ -1147,7 +1135,7 @@ ROM_END
ROM_START(ti99_4qi)
// CPU memory space
- ROM_REGION16_BE(0x2000, "maincpu", 0)
+ ROM_REGION16_BE(0x2000, CONSOLEROM, 0)
ROM_LOAD16_WORD("994qirom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */
// GROM memory space
@@ -1157,10 +1145,9 @@ ROM_START(ti99_4qi)
ROM_LOAD("994qigr2.bin", 0x4000, 0x1800, CRC(e0bb5341) SHA1(e255f0d65d69b927cecb8fcfac7a4c17d585ea96)) /* system GROM 2 */
ROM_END
-
ROM_START(ti99_4ev)
/*CPU memory space*/
- ROM_REGION16_BE(0x2000, "maincpu", 0)
+ ROM_REGION16_BE(0x2000, CONSOLEROM, 0)
ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */
/*GROM memory space*/
@@ -1168,11 +1155,11 @@ ROM_START(ti99_4ev)
ROM_LOAD("994agr38.bin", 0x0000, 0x6000, CRC(bdd9f09b) SHA1(9b058a55d2528d2a6a69d7081aa296911ed7c0de)) /* system GROMs */
ROM_END
-/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
-COMP( 1979, ti99_4, 0, 0, ti99_4_60hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (US)" , 0)
-COMP( 1980, ti99_4e, ti99_4, 0, ti99_4_50hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (Europe)" , 0)
-COMP( 1981, ti99_4a, 0, 0, ti99_4a_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (US)" , 0)
-COMP( 1981, ti99_4ae, ti99_4a, 0, ti99_4a_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (Europe)" , 0)
-COMP( 1983, ti99_4qe, ti99_4qi, 0, ti99_4qi_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer (Europe)" , 0)
-COMP( 1983, ti99_4qi, 0, 0, ti99_4qi_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer" , 0)
-COMP( 1994, ti99_4ev, ti99_4a, 0, ti99_4ev_60hz,ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer with EVPC" , 0)
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
+COMP( 1979, ti99_4, 0, 0, ti99_4_60hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (US)", 0)
+COMP( 1980, ti99_4e, ti99_4, 0, ti99_4_50hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (Europe)", 0)
+COMP( 1981, ti99_4a, 0, 0, ti99_4a_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (US)", 0)
+COMP( 1981, ti99_4ae, ti99_4a, 0, ti99_4a_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (Europe)", 0)
+COMP( 1983, ti99_4qe, ti99_4qi, 0, ti99_4qi_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer (Europe)", 0)
+COMP( 1983, ti99_4qi, 0, 0, ti99_4qi_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer (US)", 0)
+COMP( 1994, ti99_4ev, ti99_4a, 0, ti99_4ev_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer with EVPC", 0)
diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp
index 5e3acc85ff6..9b661f71e82 100644
--- a/src/mame/drivers/ti99_8.cpp
+++ b/src/mame/drivers/ti99_8.cpp
@@ -86,33 +86,6 @@
- Native mode (Armadillo mode): Devices are located at positions above
0xF000 that allow for a contiguous usage of memory.
-
- ROM contents
- ------------
- The ROM0 chip is accessible at addresses 0000-1FFF in the logical address
- space of the compatibility mode. It contains the GPL interpreter. In
- native mode the ROM0 chip is invisible.
-
- ROM0
- offset Logical address Name
- -----------------------------------
- 0000 0000-1FFF ROM0
-
-
- The ROM1 chip contains 32 KiB of various system software. It is located in
- the physical address space, so it must be mapped into the logical address
- space by defining an appropriate map.
-
- ROM1
- offset Physical address Name
- ----------------------------------------------------------
- 0000 FFA000-FFDFFF ROM1
- 4000 FF4000-FF5FFF @CRU>2700 Text-to-speech ROM/DSR
- 6000 FF4000-FF5FFF @CRU>1700 Hexbus DSR
-
- The DSR portions have to be selected via the CRU bits >1700 or >2700.
-
-
Mapper
------
The mapper uses 4K pages (unlike the Geneve mapper with 8K pages) which
@@ -200,22 +173,27 @@ Known Issues (MZ, 2010-11-07)
#include "emu.h"
#include "cpu/tms9900/tms9995.h"
+#include "bus/ti99x/ti99defs.h"
+
#include "sound/sn76496.h"
#include "sound/wave.h"
#include "machine/tms9901.h"
+#include "machine/tmc0430.h"
#include "imagedev/cassette.h"
#include "bus/ti99x/998board.h"
#include "bus/ti99x/videowrp.h"
-#include "bus/ti99x/grom.h"
#include "bus/ti99x/gromport.h"
#include "bus/ti99x/joyport.h"
#include "bus/ti99_peb/peribox.h"
+#include "softlist.h"
+
// Debugging
#define TRACE_READY 0
#define TRACE_INTERRUPTS 0
+#define TRACE_RESET 0
#define TRACE_CRU 0
/*
@@ -228,7 +206,8 @@ enum
READY_PBOX = 4,
READY_SOUND = 8,
READY_CART = 16,
- READY_SPEECH = 32
+ READY_SPEECH = 32,
+ READY_MAINBOARD = 64
};
class ti99_8_state : public driver_device
@@ -242,8 +221,7 @@ public:
m_peribox(*this, PERIBOX_TAG),
m_mainboard(*this, MAINBOARD8_TAG),
m_joyport(*this, JOYPORT_TAG),
- m_video(*this, VIDEO_SYSTEM_TAG),
- m_cassette(*this, "cassette") { }
+ m_cassette(*this, "cassette") { };
// Machine management
DECLARE_MACHINE_START(ti99_8);
@@ -254,17 +232,17 @@ public:
DECLARE_WRITE8_MEMBER( cruwrite );
DECLARE_WRITE8_MEMBER( external_operation );
DECLARE_WRITE_LINE_MEMBER( clock_out );
+ DECLARE_WRITE_LINE_MEMBER( dbin_line );
// Connections from outside towards the CPU (callbacks)
- DECLARE_WRITE_LINE_MEMBER( console_ready_mapper );
- DECLARE_WRITE_LINE_MEMBER( console_ready_sound );
- DECLARE_WRITE_LINE_MEMBER( console_ready_pbox );
- DECLARE_WRITE_LINE_MEMBER( console_ready_cart );
- DECLARE_WRITE_LINE_MEMBER( console_ready_grom );
- DECLARE_WRITE_LINE_MEMBER( console_ready_speech );
+ DECLARE_WRITE_LINE_MEMBER( console_ready );
DECLARE_WRITE_LINE_MEMBER( console_reset );
+ DECLARE_WRITE_LINE_MEMBER( cpu_hold );
DECLARE_WRITE_LINE_MEMBER( notconnected );
+ // GROM clock (coming from Vaquerro)
+ DECLARE_WRITE_LINE_MEMBER( gromclk_in );
+
// Connections with the system interface chip 9901
DECLARE_WRITE_LINE_MEMBER( extint );
DECLARE_WRITE_LINE_MEMBER( video_interrupt );
@@ -275,8 +253,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(keyC1);
DECLARE_WRITE_LINE_MEMBER(keyC2);
DECLARE_WRITE_LINE_MEMBER(keyC3);
- DECLARE_WRITE_LINE_MEMBER(CRUS);
- DECLARE_WRITE_LINE_MEMBER(PTGEN);
DECLARE_WRITE_LINE_MEMBER(audio_gate);
DECLARE_WRITE_LINE_MEMBER(cassette_output);
DECLARE_WRITE_LINE_MEMBER(cassette_motor);
@@ -288,9 +264,7 @@ private:
int m_keyboard_column;
// READY handling
- int m_nready_combined;
- int m_nready_prev;
- void console_ready_join(int id, int state);
+ line_state m_ready_old;
// Latch for 9901 INT2, INT1 lines
line_state m_int1;
@@ -303,7 +277,6 @@ private:
required_device<peribox_device> m_peribox;
required_device<mainboard8_device> m_mainboard;
required_device<joyport_device> m_joyport;
- required_device<ti_video_device> m_video;
required_device<cassette_image_device> m_cassette;
};
@@ -312,7 +285,7 @@ private:
job to the mapper completely.
*/
static ADDRESS_MAP_START(memmap, AS_PROGRAM, 8, ti99_8_state)
- AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(MAINBOARD8_TAG, mainboard8_device, readm, writem )
+ AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(MAINBOARD8_TAG, mainboard8_device, read, write) AM_DEVSETOFFSET(MAINBOARD8_TAG, mainboard8_device, setoffset)
ADDRESS_MAP_END
/*
@@ -432,89 +405,6 @@ static INPUT_PORTS_START(ti99_8)
INPUT_PORTS_END
-/*****************************************************************************
- Components
-******************************************************************************/
-#define region_sysgrom "sysgrom"
-
-static GROM_CONFIG(grom0_config)
-{
- false, 0, region_sysgrom, 0x0000, 0x1800, GROMFREQ
-};
-
-static GROM_CONFIG(grom1_config)
-{
- false, 1, region_sysgrom, 0x2000, 0x1800, GROMFREQ
-};
-
-static GROM_CONFIG(grom2_config)
-{
- false, 2, region_sysgrom, 0x4000, 0x1800, GROMFREQ
-};
-
-/****************************************************
- PASCAL groms, 3 libraries @ 8 GROMs
- Do some macro tricks to keep writing effort low
-*****************************************************/
-
-#define region_gromlib1 "gromlib1"
-#define region_gromlib2 "gromlib2"
-#define region_gromlib3 "gromlib3"
-
-#define MCFG_GROM_LIBRARY_ADD8(_tag, _config) \
- MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##0) \
- MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##1) \
- MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##2) \
- MCFG_DEVICE_ADD(#_tag "3", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##3) \
- MCFG_DEVICE_ADD(#_tag "4", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##4) \
- MCFG_DEVICE_ADD(#_tag "5", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##5) \
- MCFG_DEVICE_ADD(#_tag "6", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##6) \
- MCFG_DEVICE_ADD(#_tag "7", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##7)
-
-#define MCFG_GROM_LIBRARY_ADD3(_tag, _config) \
- MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##0) \
- MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##1) \
- MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \
- MCFG_DEVICE_CONFIG(_config##2)
-
-#define GROM_LIBRARY_CONFIG8(_conf, _region) \
-static GROM_CONFIG(_conf##0) \
-{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##1) \
-{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##2) \
-{ false, 2, _region, 0x4000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##3) \
-{ false, 3, _region, 0x6000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##4) \
-{ false, 4, _region, 0x8000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##5) \
-{ false, 5, _region, 0xa000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##6) \
-{ false, 6, _region, 0xc000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##7) \
-{ false, 7, _region, 0xe000, 0x1800, GROMFREQ };
-
-#define GROM_LIBRARY_CONFIG3(_conf, _region) \
-static GROM_CONFIG(_conf##0) \
-{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##1) \
-{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \
-static GROM_CONFIG(_conf##2) \
-{ false, 2, _region, 0x4000, 0x1800, GROMFREQ };
-GROM_LIBRARY_CONFIG8(pascal1, region_gromlib1)
-GROM_LIBRARY_CONFIG8(pascal2, region_gromlib2)
-GROM_LIBRARY_CONFIG3(pascal3, region_gromlib3)
READ8_MEMBER( ti99_8_state::cruread )
{
@@ -661,33 +551,6 @@ WRITE_LINE_MEMBER( ti99_8_state::keyC3 )
}
/*
- Set 99/4A compatibility mode (CRUS=1)
-*/
-WRITE_LINE_MEMBER( ti99_8_state::CRUS )
-{
- m_mainboard->CRUS_set(state==ASSERT_LINE);
-
- // In Armadillo mode, GROMs are located at f830; accordingly, the
- // gromport must be reconfigured
- if (state==ASSERT_LINE)
- {
- m_gromport->set_grom_base(0x9800, 0xfbf1);
- }
- else
- {
- m_gromport->set_grom_base(0xf830, 0xfff1);
- }
-}
-
-/*
- Set mapper /PTGEN. This is negative logic; we use PTGE as the positive logic signal.
-*/
-WRITE_LINE_MEMBER( ti99_8_state::PTGEN )
-{
- m_mainboard->PTGE_set(state==CLEAR_LINE);
-}
-
-/*
Control cassette tape unit motor (P6)
*/
WRITE_LINE_MEMBER( ti99_8_state::cassette_motor )
@@ -723,11 +586,11 @@ WRITE8_MEMBER( ti99_8_state::tms9901_interrupt )
/*****************************************************************************/
/*
- set the state of TMS9901's INT2 (called by the tms9928 core)
+ set the state of TMS9901's INT2 (called by the VDP)
*/
WRITE_LINE_MEMBER( ti99_8_state::video_interrupt )
{
- if (TRACE_INTERRUPTS) logerror("ti99_8: VDP int 2 on tms9901, level=%02x\n", state);
+ if (TRACE_INTERRUPTS) logerror("VDP int 2 on tms9901, level=%02x\n", state);
m_int2 = (line_state)state;
m_tms9901->set_single_int(2, state);
}
@@ -737,82 +600,59 @@ WRITE_LINE_MEMBER( ti99_8_state::video_interrupt )
***********************************************************/
/*
- We combine the incoming READY signals and propagate them to the CPU.
- An alternative would be to let the CPU get the READY state, but this would
- be a much higher overhead, as this happens in each clock tick.
+ Propagate READY signals to the CPU.
*/
-void ti99_8_state::console_ready_join(int id, int state)
+void ti99_8_state::console_ready(int state)
{
- if (state==CLEAR_LINE)
- m_nready_combined |= id;
- else
- m_nready_combined &= ~id;
-
if (TRACE_READY)
{
- if (m_nready_prev != m_nready_combined) logerror("ti99_8: READY bits = %04x\n", ~m_nready_combined);
+ if (m_ready_old != state) logerror("READY = %d\n", state);
}
- m_nready_prev = m_nready_combined;
- m_cpu->ready_line(m_nready_combined==0);
+ m_ready_old = (line_state)state;
+ m_cpu->ready_line(state);
}
/*
- Connections to the READY line. This might look a bit ugly; we need an
- implementation of a "Wired AND" device.
+ Enqueue a RESET signal.
*/
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_grom )
-{
- console_ready_join(READY_GROM, state);
-}
-
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_mapper )
-{
- console_ready_join(READY_MAPPER, state);
-}
-
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_pbox )
-{
- console_ready_join(READY_PBOX, state);
-}
-
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_sound )
+WRITE_LINE_MEMBER( ti99_8_state::console_reset )
{
- console_ready_join(READY_SOUND, state);
-}
+ if (TRACE_RESET) logerror("Incoming RESET line = %d\n", state);
+ if (machine().phase() != MACHINE_PHASE_INIT)
+ {
+ // RESET the 9901
+ m_tms9901->rst1_line(state);
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_cart )
-{
- console_ready_join(READY_CART, state);
-}
+ // Pull up the CRUS and PTGEN lines (9901 outputs have been deactivated, pull-up resistors on the board show effect)
+ m_mainboard->crus_in(TRUE); // assert
+ m_mainboard->ptgen_in(TRUE); // clear
-WRITE_LINE_MEMBER( ti99_8_state::console_ready_speech )
-{
- console_ready_join(READY_SPEECH, state);
+ // Setting ready to false so that automatic wait states are enabled
+ m_cpu->ready_line(CLEAR_LINE);
+ m_cpu->reset_line(ASSERT_LINE);
+ }
}
/*
- The RESET line leading to a reset of the CPU.
+ The HOLD line leading to the CPU entering the HOLD state.
*/
-WRITE_LINE_MEMBER( ti99_8_state::console_reset )
+WRITE_LINE_MEMBER( ti99_8_state::cpu_hold )
{
- if (machine().phase() != MACHINE_PHASE_INIT)
- {
- m_cpu->set_input_line(INT_9995_RESET, state);
- m_video->reset_vdp(state);
- }
+ if (TRACE_INTERRUPTS) logerror("Incoming HOLD line = %d\n", state);
+ m_cpu->hold_line(state);
}
WRITE_LINE_MEMBER( ti99_8_state::extint )
{
- if (TRACE_READY) logerror("ti99_8: EXTINT level = %02x\n", state);
+ if (TRACE_INTERRUPTS) logerror("EXTINT level = %02x\n", state);
m_int1 = (line_state)state;
m_tms9901->set_single_int(1, state);
}
WRITE_LINE_MEMBER( ti99_8_state::notconnected )
{
- if (TRACE_READY) logerror("ti99_8: Setting a not connected line ... ignored\n");
+ if (TRACE_INTERRUPTS) logerror("Setting a not connected line ... ignored\n");
}
WRITE8_MEMBER( ti99_8_state::external_operation )
@@ -821,7 +661,7 @@ WRITE8_MEMBER( ti99_8_state::external_operation )
if (offset == IDLE_OP) return;
else
{
- logerror("ti99_4x: External operation %s not implemented on TI-99/8 board\n", extop[offset]);
+ logerror("External operation %s not implemented on TI-99/8 board\n", extop[offset]);
}
}
@@ -833,119 +673,23 @@ WRITE_LINE_MEMBER( ti99_8_state::clock_out )
m_mainboard->clock_in(state);
}
-/*****************************************************************************/
-
/*
- Format:
- Name, mode, stop, mask, select, write, read8z function, write8 function
-
- Multiple devices may have the same select pattern; as in the real hardware,
- care must be taken that only one device actually responds. In the case of
- GROMs, each chip has an internal address counter and an ID, and the chip
- only responds when the ID and the most significant 3 bits match.
-
- NATIVE <-> CRUS=0
- TI99EM <-> CRUS=1
-
- PATGEN <-> PTGEN=1
-
- CONT: Mapper continues iterating through devices
- STOP: Mapper stops iterating when found
-
- Access to the mapper registers is done directly in the mapper, not via
- this list.
-
- TODO: This should (must) be improved in terms of performance. Every single
- memory access goes through the mapper. Either we use an ordered search list,
- or we order the entries according to their frequency.
- (I did this right now, putting the Pascal GROMs at the end.)
- We should think about a set entry where devices with the same address
- are collected as one single entry (think about the Pascal lib with 21 GROMs,
- twice eight and once three of them on the same address).
+ Data bus in (DBIN) line from the CPU.
*/
-
-#define PASCAL_GROM_LIB8(_tag, _addr) \
- { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "3", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "4", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "5", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "6", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "7", PATGEN, CONT, _addr, 0xfff1, 0x0000 }
-
-#define PASCAL_GROM_LIB3(_tag, _addr) \
- { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \
- { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 }
-
-
-static const mapper8_list_entry mapper_devices[] =
-{
- // TI-99/4A mode (CRUS=1)
- // Full/partial decoding has been verified on a real machine
- // GROMs: According to the spec, the 99/8 supports up to 4 GROM libraries
- // (99/4A supports 256 libraries)
- // at 9800, 9804, 9808, 980c. Address counter access is at 9802,6,a,e. Write access +0400.
- { ROM0NAME, TI99EM, STOP, 0x0000, 0xe000, 0x0000 }, // 0000-1fff
- { TISOUND_TAG, TI99EM, STOP, 0x8400, 0xfff1, 0x0000 }, // 8400-840f
- { VIDEO_SYSTEM_TAG, TI99EM, STOP, 0x8800, 0xfff1, 0x0400 }, // 8800,8802 / 8c00,8c02
- { SPEECH_TAG, TI99EM, STOP, 0x9000, 0xfff1, 0x0400 }, // 9000-900f / 9400-940f
- { SRAMNAME, TI99EM, STOP, 0x8000, 0xf800, 0x0000 }, // 8000-87ff; must follow the sound generator
- { MAINBOARD8_TAG, TI99EM, STOP, 0x8810, 0xfff0, 0x0000 },
-
- { GROM0_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // 9800,2,4,...e/9c00,2,4,...e
- { GROM1_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto.
- { GROM2_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. (GROMs are connected in parallel,
- { GROMPORT_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. use internal address counter and id)
-
- // TI-99/8 mode
- // Full/partial decoding has been verified on a real machine
- // Sound ports are at f800, f802, f804, ..., f80e
- // VDP ports are (f810,f812), (f814,f816), (f818,f81a), (f81c,f81e)
- // Note that unmapped GROM accesses (odd addresses like F831) return FF,
- // not 00 as in our emulation, so that is not quite consistent, but tolerable ... I guess
-
- { SRAMNAME, NATIVE, STOP, 0xf000, 0xf800, 0x0000 }, // f000-f7ff
- { TISOUND_TAG, NATIVE, STOP, 0xf800, 0xfff1, 0x0000 }, // f800-f80e (even addresses)
- { VIDEO_SYSTEM_TAG, NATIVE, STOP, 0xf810, 0xfff1, 0x0000 }, // f810,2 (unlike 99/4A, no different read/write ports)
- { SPEECH_TAG, NATIVE, STOP, 0xf820, 0xfff1, 0x0000 }, // f820-f82f
- { MAINBOARD8_TAG, NATIVE, STOP, 0xf870, 0xfff0, 0x0000 },
-
- { GROM0_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, // f830-f83e (4 banks), no different read/write ports
- { GROM1_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 },
- { GROM2_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 },
- { GROMPORT_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 },
-
- PASCAL_GROM_LIB8("pascal1_grom", 0xf840),
- PASCAL_GROM_LIB8("pascal2_grom", 0xf850),
- PASCAL_GROM_LIB3("pascal3_grom", 0xf860),
-
- // Physical (need to pack this in here as well to keep config simple)
- // but these lines will be put into a separate list
- { DRAMNAME, PHYSIC, STOP, 0x000000, 0xff0000, 0x000000 }, // 000000-00ffff 64 KiB DRAM
- { PCODENAME, PHYSIC, STOP, 0xf00000, 0xffc000, 0x000000 }, // f00000-f03fff P-Code ROM
- { MAINBOARD8_TAG, PHYSIC, CONT, 0xff4000, 0xffe000, 0x000000 }, // ff4000-ff5fff Internal DSR
- { GROMPORT_TAG, PHYSIC, STOP, 0xff6000, 0xffe000, 0x000000 }, // ff6000-ff7fff Cartridge ROM space
- { GROMPORT_TAG, PHYSIC, STOP, 0xff8000, 0xffe000, 0x000000 }, // ff8000-ff9fff Cartridge ROM space
- { ROM1A0NAME, PHYSIC, STOP, 0xffa000, 0xffe000, 0x000000 }, // ffa000-ffbfff ROM1
- { ROM1C0NAME, PHYSIC, STOP, 0xffc000, 0xffe000, 0x000000 }, // ffc000-ffdfff ROM1
- { INTSNAME, PHYSIC, STOP, 0xffe000, 0xfffff0, 0x000000 }, // ffe000-ffe00f Interrupt level sense
- { PERIBOX_TAG, PHYSIC, STOP, 0x000000, 0x000000, 0x000000 }, // Peripheral Expansion Box
-
- { nullptr, 0, 0, 0, 0, 0 }
-};
-
-static MAPPER8_CONFIG( mapper_conf )
+WRITE_LINE_MEMBER( ti99_8_state::dbin_line )
{
- mapper_devices
-};
+ m_mainboard->dbin_in(state);
+}
MACHINE_START_MEMBER(ti99_8_state,ti99_8)
{
- m_nready_combined = 0;
m_peribox->senila(CLEAR_LINE);
m_peribox->senilb(CLEAR_LINE);
+ // m_mainboard->set_gromport(m_gromport);
+
+ // Need to configure the speech ROM for inverse bit order
+ speechrom_device* mem = subdevice<speechrom_device>(SPEECHROM_REG);
+ mem->set_reverse_bit_order(true);
}
MACHINE_RESET_MEMBER(ti99_8_state, ti99_8)
@@ -956,9 +700,7 @@ MACHINE_RESET_MEMBER(ti99_8_state, ti99_8)
// state on external memory accesses
m_cpu->ready_line(CLEAR_LINE);
- // But we assert the line here so that the system starts running
- m_nready_combined = 0;
- m_gromport->set_grom_base(0x9800, 0xfff1);
+ // m_gromport->set_grom_base(0x9800, 0xfff1);
// Clear INT1 and INT2 latch
m_int1 = CLEAR_LINE;
@@ -972,62 +714,92 @@ static MACHINE_CONFIG_START( ti99_8, ti99_8_state )
MCFG_TMS99xx_ADD("maincpu", TMS9995_MP9537, XTAL_10_738635MHz, memmap, crumap)
MCFG_TMS9995_EXTOP_HANDLER( WRITE8(ti99_8_state, external_operation) )
MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(ti99_8_state, clock_out) )
+ MCFG_TMS9995_DBIN_HANDLER( WRITELINE(ti99_8_state, dbin_line) )
+ MCFG_TMS9995_HOLDA_HANDLER( DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, holda_line) )
MCFG_MACHINE_START_OVERRIDE(ti99_8_state, ti99_8 )
MCFG_MACHINE_RESET_OVERRIDE(ti99_8_state, ti99_8 )
- /* Main board */
+ // 9901 configuration
MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, XTAL_10_738635MHz/4.0)
MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_8_state, read_by_9901) )
MCFG_TMS9901_P0_HANDLER( WRITELINE( ti99_8_state, keyC0) )
MCFG_TMS9901_P1_HANDLER( WRITELINE( ti99_8_state, keyC1) )
MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_8_state, keyC2) )
MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_8_state, keyC3) )
- MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_8_state, CRUS) )
- MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_8_state, PTGEN) )
+ MCFG_TMS9901_P4_HANDLER( DEVWRITELINE( MAINBOARD8_TAG, mainboard8_device, crus_in) )
+ MCFG_TMS9901_P5_HANDLER( DEVWRITELINE( MAINBOARD8_TAG, mainboard8_device, ptgen_in) )
MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_8_state, cassette_motor) )
MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_8_state, audio_gate) )
MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_8_state, cassette_output) )
MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_8_state, tms9901_interrupt) )
- MCFG_MAINBOARD8_ADD( MAINBOARD8_TAG, mapper_conf )
- MCFG_MAINBOARD8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_mapper))
- MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG )
- MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_cart) )
+ // Mainboard with custom chips
+ MCFG_DEVICE_ADD(MAINBOARD8_TAG, MAINBOARD8, 0)
+ MCFG_MAINBOARD8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready))
+ MCFG_MAINBOARD8_RESET_CALLBACK(WRITELINE(ti99_8_state, console_reset))
+ MCFG_MAINBOARD8_HOLD_CALLBACK(WRITELINE(ti99_8_state, cpu_hold))
+
+ MCFG_GROMPORT8_ADD( GROMPORT_TAG )
+ MCFG_GROMPORT_READY_HANDLER( DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, system_grom_ready) )
MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_8_state, console_reset) )
- /* Peripheral expansion box */
+ /* Software list */
+ MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart")
+
+ // Peripheral expansion box
MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_998, 0)
MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_8_state, extint) )
MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_8_state, notconnected) )
- MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_pbox) )
-
- /* Sound hardware */
- MCFG_TI_SOUND_76496_ADD( TISOUND_TAG )
- MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_sound) )
-
- /* Cassette drives */
+ MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, pbox_ready) )
+
+ // Sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("sound_out")
+ MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
+ MCFG_SN76496_READY_HANDLER(DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, sound_ready))
+
+ // Speech hardware
+ // Note: SPEECHROM uses its tag for referencing the region
+ MCFG_DEVICE_ADD(SPEECHROM_REG, SPEECHROM, 0)
+ MCFG_SPEAKER_STANDARD_MONO("speech_out")
+ MCFG_SOUND_ADD(SPEECHSYN_TAG, CD2501ECD, 640000L)
+ MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, speech_ready))
+ MCFG_TMS52XX_SPEECHROM(SPEECHROM_REG)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech_out", 0.50)
+
+ // Cassette drive
MCFG_SPEAKER_STANDARD_MONO("cass_out")
MCFG_CASSETTE_ADD( "cassette" )
MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
- /* Console GROMs */
- MCFG_GROM_ADD( GROM0_TAG, grom0_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom))
- MCFG_GROM_ADD( GROM1_TAG, grom1_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom))
- MCFG_GROM_ADD( GROM2_TAG, grom2_config )
- MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom))
-
- /* Pascal GROM libraries. */
- MCFG_GROM_LIBRARY_ADD8(pascal1_grom, pascal1)
- MCFG_GROM_LIBRARY_ADD8(pascal2_grom, pascal2)
- MCFG_GROM_LIBRARY_ADD3(pascal3_grom, pascal3)
-
- /* Devices */
- MCFG_DEVICE_ADD(SPEECH_TAG, SPEECH8, 0)
- MCFG_SPEECH8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_speech))
+ // GROM library
+ MCFG_GROM_ADD( SYSGROM0_TAG, 0, SYSGROM_REG, 0x0000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, system_grom_ready))
+ MCFG_GROM_ADD( SYSGROM1_TAG, 1, SYSGROM_REG, 0x2000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, system_grom_ready))
+ MCFG_GROM_ADD( SYSGROM2_TAG, 2, SYSGROM_REG, 0x4000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, system_grom_ready))
+
+ MCFG_GROM_ADD( GLIB10_TAG, 0, GROMLIB1_REG, 0x0000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB11_TAG, 1, GROMLIB1_REG, 0x2000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB12_TAG, 2, GROMLIB1_REG, 0x4000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB13_TAG, 3, GROMLIB1_REG, 0x6000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB14_TAG, 4, GROMLIB1_REG, 0x8000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB15_TAG, 5, GROMLIB1_REG, 0xa000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB16_TAG, 6, GROMLIB1_REG, 0xc000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+ MCFG_GROM_ADD( GLIB17_TAG, 7, GROMLIB1_REG, 0xe000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, ptts_grom_ready))
+
+ MCFG_GROM_ADD( GLIB20_TAG, 0, GROMLIB2_REG, 0x0000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB21_TAG, 1, GROMLIB2_REG, 0x2000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB22_TAG, 2, GROMLIB2_REG, 0x4000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB23_TAG, 3, GROMLIB2_REG, 0x6000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB24_TAG, 4, GROMLIB2_REG, 0x8000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB25_TAG, 5, GROMLIB2_REG, 0xa000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB26_TAG, 6, GROMLIB2_REG, 0xc000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+ MCFG_GROM_ADD( GLIB27_TAG, 7, GROMLIB2_REG, 0xe000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p8_grom_ready))
+
+ MCFG_GROM_ADD( GLIB30_TAG, 0, GROMLIB3_REG, 0x0000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p3_grom_ready))
+ MCFG_GROM_ADD( GLIB31_TAG, 1, GROMLIB3_REG, 0x2000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p3_grom_ready))
+ MCFG_GROM_ADD( GLIB32_TAG, 2, GROMLIB3_REG, 0x4000, DEVWRITELINE(MAINBOARD8_TAG, mainboard8_device, p3_grom_ready))
// Joystick port
MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG )
@@ -1037,14 +809,24 @@ MACHINE_CONFIG_END
TI-99/8 US version (NTSC, 60 Hz)
*/
static MACHINE_CONFIG_DERIVED( ti99_8_60hz, ti99_8 )
- MCFG_TI998_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9118, 0x4000, ti99_8_state, video_interrupt)
+ // Video hardware
+ MCFG_DEVICE_ADD( VDP_TAG, TMS9118, XTAL_10_738635MHz / 2 )
+ MCFG_TMS9928A_VRAM_SIZE(0x4000)
+ MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(ti99_8_state, video_interrupt))
+ MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG )
+ MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
MACHINE_CONFIG_END
/*
TI-99/8 European version (PAL, 50 Hz)
*/
static MACHINE_CONFIG_DERIVED( ti99_8_50hz, ti99_8 )
- MCFG_TI998_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9129, 0x4000, ti99_8_state, video_interrupt)
+ // Video hardware
+ MCFG_DEVICE_ADD( VDP_TAG, TMS9129, XTAL_10_738635MHz / 2 )
+ MCFG_TMS9928A_VRAM_SIZE(0x4000)
+ MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(ti99_8_state,video_interrupt))
+ MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG )
+ MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update )
MACHINE_CONFIG_END
/*
@@ -1055,11 +837,11 @@ MACHINE_CONFIG_END
*/
ROM_START(ti99_8)
// Logical (CPU) memory space: ROM0
- ROM_REGION(0x2000, ROM0_TAG, 0)
+ ROM_REGION(0x2000, ROM0_REG, 0)
ROM_LOAD("u4_rom0.bin", 0x0000, 0x2000, CRC(901eb8d6) SHA1(13190c5e834baa9c0a70066b566cfcef438ed88a))
// Physical memory space (mapped): ROM1
- ROM_REGION(0x8000, ROM1_TAG, 0)
+ ROM_REGION(0x8000, ROM1_REG, 0)
ROM_LOAD("u25_rom1.bin", 0x0000, 0x8000, CRC(b574461a) SHA1(42c6aed44802cfabdd26b565d6e5ddfcd689f11e))
// Physical memory space (mapped): P-Code ROM
@@ -1069,20 +851,20 @@ ROM_START(ti99_8)
// the required select line for this ROM on the available schematics, so
// they seem to be from the earlier version. The location in the address
// space was determined by ROM disassembly.
- ROM_REGION(0x8000, PCODEROM_TAG, 0)
+ ROM_REGION(0x8000, PASCAL_REG, 0)
ROM_LOAD("u25a_pas.bin", 0x0000, 0x4000, CRC(d7ed6dd6) SHA1(32212ce6426ceccbff73d342d4a3ef699c0ae1e4))
// System GROMs. 3 chips @ f830
// The schematics do not enumerate the circuits but only talk about
// "circuits on board" (COB) so we name the GROMs as gM_N.bin where M is the
// ID (0-7) and N is the access port in the logical address space.
- ROM_REGION(0x6000, region_sysgrom, 0)
+ ROM_REGION(0x6000, SYSGROM_REG, 0)
ROM_LOAD("g0_f830.bin", 0x0000, 0x1800, CRC(1026db60) SHA1(7327095bf4f390476e69d9fd8424e98ea1f2325a))
ROM_LOAD("g1_f830.bin", 0x2000, 0x1800, CRC(93a43d65) SHA1(19be8a07d674bc7554c2bc9c7a5725d81e888e6e))
ROM_LOAD("g2_f830.bin", 0x4000, 0x1800, CRC(06f2b901) SHA1(f65e0fcb2c63e230b4a9563c72f91259b94ce955))
// TTS & Pascal library. 8 chips @ f840
- ROM_REGION(0x10000, region_gromlib1, 0)
+ ROM_REGION(0x10000, GROMLIB1_REG, 0)
ROM_LOAD("g0_f840.bin", 0x0000, 0x1800, CRC(44501071) SHA1(4b5ef7f1aa43a87e7ae4f02090944be5c39b1f26))
ROM_LOAD("g1_f840.bin", 0x2000, 0x1800, CRC(5a271d9e) SHA1(bb95befa2ffba2cc17ac437386e069e8ff621248))
ROM_LOAD("g2_f840.bin", 0x4000, 0x1800, CRC(d52502df) SHA1(17063e33ee8709d0df8030f38bb92c4322d55e1e))
@@ -1093,7 +875,7 @@ ROM_START(ti99_8)
ROM_LOAD("g7_f840.bin", 0xE000, 0x1800, CRC(3a9d20df) SHA1(1e6f9f8ec7df4b997a7579be742d0a7d54bc8763))
// Pascal library. 8 chips @ f850
- ROM_REGION(0x10000, region_gromlib2, 0)
+ ROM_REGION(0x10000, GROMLIB2_REG, 0)
ROM_LOAD("g0_f850.bin", 0x0000, 0x1800, CRC(2d948672) SHA1(cf15912d6dae5a450e0cfd796aa36ea5e521dc56))
ROM_LOAD("g1_f850.bin", 0x2000, 0x1800, CRC(7d64a842) SHA1(d5884bb2af21c8027311478ee506beac6f46203d))
ROM_LOAD("g2_f850.bin", 0x4000, 0x1800, CRC(e5ed8900) SHA1(03826882ce10fb5a6b3a9ccc85d3d1fe51979d0b))
@@ -1104,17 +886,15 @@ ROM_START(ti99_8)
ROM_LOAD("g7_f850.bin", 0xE000, 0x1800, CRC(71534098) SHA1(75e87123efde885e27dd749e07cb189eb2cc45a8))
// Pascal library. 3 chips @ f860
- ROM_REGION(0x6000, region_gromlib3, 0)
+ ROM_REGION(0x6000, GROMLIB3_REG, 0)
ROM_LOAD("g0_f860.bin", 0x0000, 0x1800, CRC(0ceef210) SHA1(b89957fbff094b758746391a69dea6907c66b950))
ROM_LOAD("g1_f860.bin", 0x2000, 0x1800, CRC(fc87de25) SHA1(4695b7f979f59a01ec16c55e4587c3379482b658))
ROM_LOAD("g2_f860.bin", 0x4000, 0x1800, CRC(e833e350) SHA1(6ffe501981a1112be1af596a489d96e287fc6be5))
- // Built-in RAM
- ROM_REGION(SRAM_SIZE, SRAM_TAG, 0)
- ROM_FILL(0x0000, SRAM_SIZE, 0x00)
-
- ROM_REGION(DRAM_SIZE, DRAM_TAG, 0)
- ROM_FILL(0x0000, DRAM_SIZE, 0x00)
+ // Speech ROM
+ ROM_REGION(0x8000, SPEECHROM_REG, 0)
+ ROM_LOAD("cd2325a.vsm", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe))
+ ROM_LOAD("cd2326a.vsm", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020))
ROM_END
#define rom_ti99_8e rom_ti99_8
diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp
index 828ff045e2a..0a3d72a8e05 100644
--- a/src/mame/drivers/tnzs.cpp
+++ b/src/mame/drivers/tnzs.cpp
@@ -1565,7 +1565,6 @@ static MACHINE_CONFIG_START( arknoid2, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1613,7 +1612,6 @@ static MACHINE_CONFIG_START( drtoppel, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1663,7 +1661,6 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1709,7 +1706,6 @@ static MACHINE_CONFIG_START( insectx, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1755,7 +1751,6 @@ static MACHINE_CONFIG_START( kageki, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1813,7 +1808,6 @@ static MACHINE_CONFIG_START( tnzsb, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1879,7 +1873,6 @@ static MACHINE_CONFIG_START( jpopnics, tnzs_state )
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode")
- MCFG_SETA001_SPRITE_PALETTE("palette")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp
index e265b3130f4..512bb5b6b91 100644
--- a/src/mame/drivers/topspeed.cpp
+++ b/src/mame/drivers/topspeed.cpp
@@ -580,13 +580,11 @@ static MACHINE_CONFIG_START( topspeed, topspeed_state )
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_OFFSETS(0, 8)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("pc080sn_2", PC080SN, 0)
MCFG_PC080SN_GFX_REGION(1)
MCFG_PC080SN_OFFSETS(0, 8)
MCFG_PC080SN_GFXDECODE("gfxdecode")
- MCFG_PC080SN_PALETTE("palette")
MCFG_DEVICE_ADD("tc0140syt", TC0140SYT, 0)
MCFG_TC0140SYT_MASTER_CPU("maincpu")
diff --git a/src/mame/drivers/tourvis.cpp b/src/mame/drivers/tourvis.cpp
index b1a62e95492..9ffd50e0708 100644
--- a/src/mame/drivers/tourvis.cpp
+++ b/src/mame/drivers/tourvis.cpp
@@ -1039,14 +1039,14 @@ ROM_END
GAME( 19??, tourvis, 0, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision)", "Tourvision PCE bootleg", MACHINE_IS_BIOS_ROOT | MACHINE_NOT_WORKING )
GAME( 1988, tvdrgnst, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namcot", "Dragon Spirit (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyo Densetsu - The Legenary Axe (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyou Densetsu - The Legenary Axe (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1989, tvdormon, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Fujiko-Shogakukan-TV Asahi / Hudson Soft", "Doraemon Meikyuu Daisakusen (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1989, tvdormon, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Fujiko-Shogakukan-TV Asahi / Hudson Soft", "Doraemon Meikyuu Dai Sakusen (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1989, tvdunexp, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Atlus Ltd. / Hudson Soft", "Dungeon Explorer (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1989, tvflaptw, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namco Ltd. / Namcot", "Final Lap Twin (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1989, tvgunhed, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson / Toho Sunrise", "Gunhed (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1989, tvdensho, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Big Club / Wolf Team", "Jinmu Densho (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1989, tvmrheli, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / IREM Corp", "Mr Heli (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1989, tvgunhed, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson / Toho Sunrise", "GunHed (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1989, tvdensho, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Big Club / Wolf Team", "Jinmu Denshou (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1989, tvmrheli, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / IREM Corp", "Mr. Heli no Daibouken (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1989, tvpaclnd, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namco / Namcot", "Pac-Land (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1989, tvshnobi, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Sega / Asmik Corporation", "Shinobi (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1989, tvsdarms, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Capcom / Nec Avenue", "Side Arms (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
@@ -1060,7 +1060,7 @@ GAME( 1990, tvaburn, tourvis, tourvision, tourvision, pce_common_state, pce_com
GAME( 1990, tvarmedf, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Nichibutsu / Big Don", "Armed-F (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvbeball, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson Soft", "Be Ball (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvbomber, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson Soft", "Bomberman (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1990, tvbrabho, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namco / Namcot", "Ch??zetsurinjin Beraboh Man (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1990, tvbrabho, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namco / Namcot", "Chouzetsu Rinjin - Bravoman (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvdsenpu, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Toaplan / Nec Avenue", "Daisenpu (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvdevilc, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat / Red", "Devil Crash (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvdodgeb, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Technos Japan Corp / Naxat Soft", "Dodge Ball (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
@@ -1073,22 +1073,22 @@ GAME( 1990, tvovride, tourvis, tourvision, tourvision, pce_common_state, pce_com
GAME( 1990, tvpdrift, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Sega / Asmik Corporation", "Power Drift (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvpchasr, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat Soft", "Psycho Chaser (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvrs2, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito Corporation", "Rastan Saga II (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1990, tvninjas, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / IREM Corp", "Saiga No Nindou - Ninja Spirit (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1990, tvninjas, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / IREM Corp", "Saigo no Nindou - Ninja Spirit (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvsssold, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Inter State / Kaneko / Hudson Soft", "Super Star Soldier (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvsvball, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Video System", "Super Volley ball (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvthbld, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Sega / NEC Avenue", "Thunder Blade (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvtsboys, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Toy Shop Boys (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1990, tveigues, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Veigues (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1990, tvwring, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat Soft", "W-Ring (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1990, tveigues, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Veigues - Tactical Gladiator (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1990, tvwring, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat Soft", "W-Ring - The Double Rings (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1990, tvxvious, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Namco Ltd. / Namcot", "Xevious (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tv1943, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Capcom / Naxat Soft", "1943 Kai (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvbalstx, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Psygnosis / Coconuts Japan", "Ballistix (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvcolumn, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Telenet Japan", "Columns (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1991, tvcoryon, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat Soft", "Coryoon (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1991, tvcoryon, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Naxat Soft", "Coryoon - Child of Dragon (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvdmoon, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / T.S.S", "Dead Moon (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvftenis, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Human", "Final Match Tennis (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
-GAME( 1991, tvhtdaka, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito Corporation", "Hana Taka Daka (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
+GAME( 1991, tvhtdaka, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito Corporation", "Hana Taaka Daka!? (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvjchan, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson Soft", "Jackie Chan (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvtonma, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / IREM Corp", "Legend of Hero Tonma (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
GAME( 1991, tvpcgen2, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson Soft / Red", "PC Genjin 2 - Pithecanthropus Computerurus (Tourvision PCE bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/triforce.cpp b/src/mame/drivers/triforce.cpp
index 3823f27179c..15bc9e48f20 100644
--- a/src/mame/drivers/triforce.cpp
+++ b/src/mame/drivers/triforce.cpp
@@ -583,7 +583,7 @@ static MACHINE_CONFIG_START( triforce_base, triforce_state )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( triforcegd, triforce_base )
- MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", ":pic", nullptr, NOOP)
+ MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", "gdrom", "pic", nullptr, NOOP)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/tumbleb.cpp b/src/mame/drivers/tumbleb.cpp
index 291dcab7e68..9c00b3289e1 100644
--- a/src/mame/drivers/tumbleb.cpp
+++ b/src/mame/drivers/tumbleb.cpp
@@ -2063,7 +2063,6 @@ static MACHINE_CONFIG_START( tumblepb, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tumbleb)
MCFG_PALETTE_ADD("palette", 1024)
@@ -2102,7 +2101,6 @@ static MACHINE_CONFIG_START( tumbleb2, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tumbleb)
MCFG_PALETTE_ADD("palette", 1024)
@@ -2144,7 +2142,6 @@ static MACHINE_CONFIG_START( jumpkids, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tumbleb)
MCFG_PALETTE_ADD("palette", 1024)
@@ -2183,7 +2180,6 @@ static MACHINE_CONFIG_START( fncywld, tumbleb_state )
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_TRANSPEN(15)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", fncywld)
MCFG_PALETTE_ADD("palette", 0x800)
@@ -2246,7 +2242,6 @@ static MACHINE_CONFIG_START( htchctch, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tumbleb)
MCFG_PALETTE_ADD("palette", 1024)
@@ -2357,7 +2352,6 @@ static MACHINE_CONFIG_START( suprtrio, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", suprtrio)
MCFG_PALETTE_ADD("palette", 1024)
@@ -2396,7 +2390,6 @@ static MACHINE_CONFIG_START( pangpang, tumbleb_state )
MCFG_DECO_SPRITE_GFX_REGION(3)
MCFG_DECO_SPRITE_ISBOOTLEG(true)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tumbleb)
MCFG_PALETTE_ADD("palette", 1024)
diff --git a/src/mame/drivers/tumblep.cpp b/src/mame/drivers/tumblep.cpp
index ed7a0bbd561..6e68462322c 100644
--- a/src/mame/drivers/tumblep.cpp
+++ b/src/mame/drivers/tumblep.cpp
@@ -313,12 +313,10 @@ static MACHINE_CONFIG_START( tumblep, tumblep_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
MCFG_DECO_SPRITE_GFX_REGION(2)
MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
- MCFG_DECO_SPRITE_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
diff --git a/src/mame/drivers/turbo.cpp b/src/mame/drivers/turbo.cpp
index 44807c31aca..b6d3a1a3119 100644
--- a/src/mame/drivers/turbo.cpp
+++ b/src/mame/drivers/turbo.cpp
@@ -149,7 +149,7 @@
#include "emu.h"
#include "includes/turbo.h"
#include "machine/i8279.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "sound/samples.h"
#include "turbo.lh"
@@ -968,6 +968,17 @@ static MACHINE_CONFIG_DERIVED( buckrogu, buckrog )
MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES)
MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( buckroge, buckrog )
+
+ /* basic machine hardware */
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5014, MASTER_CLOCK/4)
+ MCFG_CPU_PROGRAM_MAP(buckrog_map)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", turbo_state, irq0_line_hold)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+MACHINE_CONFIG_END
+
/*************************************
*
* ROM definitions
@@ -1751,32 +1762,6 @@ DRIVER_INIT_MEMBER(turbo_state,turbo_enc)
}
-DRIVER_INIT_MEMBER(turbo_state,buckrog_enc)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...0...0 */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...1 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */
- { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */
- { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */
- };
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable);
-}
-
/*************************************
@@ -1794,7 +1779,7 @@ GAMEL( 1981, turbobl, turbo, turbo, turbo, driver_device, 0,
GAMEL( 1982, subroc3d, 0, subroc3d, subroc3d, driver_device, 0, ORIENTATION_FLIP_X, "Sega", "Subroc-3D", MACHINE_IMPERFECT_SOUND , layout_subroc3d )
-GAMEL( 1982, buckrog, 0, buckrog, buckrog, turbo_state, buckrog_enc, ROT0, "Sega", "Buck Rogers: Planet of Zoom", MACHINE_IMPERFECT_SOUND , layout_buckrog )
-GAMEL( 1982, buckrogn, buckrog, buckrogu, buckrog, driver_device, 0, ROT0, "Sega", "Buck Rogers: Planet of Zoom (not encrypted, set 1)", MACHINE_IMPERFECT_SOUND , layout_buckrog )
-GAMEL( 1982, buckrogn2,buckrog, buckrogu, buckrog, driver_device, 0, ROT0, "Sega", "Buck Rogers: Planet of Zoom (not encrypted, set 2)", MACHINE_IMPERFECT_SOUND , layout_buckrog )
-GAMEL( 1982, zoom909, buckrog, buckrog, buckrog, turbo_state, buckrog_enc, ROT0, "Sega", "Zoom 909", MACHINE_IMPERFECT_SOUND, layout_buckrog )
+GAMEL( 1982, buckrog, 0, buckroge, buckrog, driver_device, 0, ROT0, "Sega", "Buck Rogers: Planet of Zoom", MACHINE_IMPERFECT_SOUND , layout_buckrog )
+GAMEL( 1982, buckrogn, buckrog, buckrogu, buckrog, driver_device, 0, ROT0, "Sega", "Buck Rogers: Planet of Zoom (not encrypted, set 1)", MACHINE_IMPERFECT_SOUND , layout_buckrog )
+GAMEL( 1982, buckrogn2,buckrog, buckrogu, buckrog, driver_device, 0, ROT0, "Sega", "Buck Rogers: Planet of Zoom (not encrypted, set 2)", MACHINE_IMPERFECT_SOUND , layout_buckrog )
+GAMEL( 1982, zoom909, buckrog, buckroge, buckrog, driver_device, 0, ROT0, "Sega", "Zoom 909", MACHINE_IMPERFECT_SOUND, layout_buckrog )
diff --git a/src/mame/drivers/twincobr.cpp b/src/mame/drivers/twincobr.cpp
index 98991e2b173..91ea4263f49 100644
--- a/src/mame/drivers/twincobr.cpp
+++ b/src/mame/drivers/twincobr.cpp
@@ -614,6 +614,12 @@ static INPUT_PORTS_START( hishouza )
PORT_MODIFY("DSWA")
TOAPLAN_COINAGE_JAPAN_LOC(SW1) /* table at 0x000316 (COIN1 AND COIN2) */
+
+ PORT_MODIFY("DSWB")
+ PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!8")
+ PORT_DIPSETTING( 0x00, DEF_STR( No ) )
+ PORT_DIPSETTING( 0x80, DEF_STR( Yes ) )
+
INPUT_PORTS_END
diff --git a/src/mame/drivers/undrfire.cpp b/src/mame/drivers/undrfire.cpp
index 65e79c5acee..b820a7a8565 100644
--- a/src/mame/drivers/undrfire.cpp
+++ b/src/mame/drivers/undrfire.cpp
@@ -708,7 +708,6 @@ static MACHINE_CONFIG_START( undrfire, undrfire_state )
MCFG_TC0480SCP_OFFSETS(0x24, 0)
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
@@ -757,7 +756,6 @@ static MACHINE_CONFIG_START( cbombers, undrfire_state )
MCFG_TC0480SCP_OFFSETS_TX(-1, 0)
MCFG_TC0480SCP_COL_BASE(4096)
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
- MCFG_TC0480SCP_PALETTE("palette")
/* sound hardware */
MCFG_DEVICE_ADD("taito_en", TAITO_EN, 0)
diff --git a/src/mame/drivers/vaportra.cpp b/src/mame/drivers/vaportra.cpp
index 4f30b993a32..0eaa9a755b7 100644
--- a/src/mame/drivers/vaportra.cpp
+++ b/src/mame/drivers/vaportra.cpp
@@ -254,7 +254,6 @@ static MACHINE_CONFIG_START( vaportra, vaportra_state )
MCFG_DECO16IC_PF12_8X8_BANK(0)
MCFG_DECO16IC_PF12_16X16_BANK(1)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
MCFG_DECO16IC_SPLIT(0)
@@ -270,12 +269,10 @@ static MACHINE_CONFIG_START( vaportra, vaportra_state )
MCFG_DECO16IC_PF12_8X8_BANK(2)
MCFG_DECO16IC_PF12_16X16_BANK(3)
MCFG_DECO16IC_GFXDECODE("gfxdecode")
- MCFG_DECO16IC_PALETTE("palette")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
- deco_mxc06_device::set_gfx_region(*device, 4);
+ MCFG_DECO_MXC06_GFX_REGION(4)
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
- MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/vendetta.cpp b/src/mame/drivers/vendetta.cpp
index 04795e83708..8bd74706d79 100644
--- a/src/mame/drivers/vendetta.cpp
+++ b/src/mame/drivers/vendetta.cpp
@@ -460,16 +460,13 @@ static MACHINE_CONFIG_START( vendetta, vendetta_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k052109", K052109, 0)
MCFG_GFX_PALETTE("palette")
MCFG_K052109_CB(vendetta_state, vendetta_tile_callback)
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(vendetta_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, 53, 6)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, 53, 6)
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
@@ -507,7 +504,7 @@ static MACHINE_CONFIG_DERIVED( esckids, vendetta )
MCFG_K052109_CB(vendetta_state, esckids_tile_callback)
MCFG_DEVICE_MODIFY("k053246")
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, 101, 6)
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, 101, 6)
MCFG_DEVICE_ADD("k053252", K053252, 6000000)
MCFG_K053252_OFFSETS(12*8, 1*8)
diff --git a/src/mame/drivers/vsnes.cpp b/src/mame/drivers/vsnes.cpp
index 941cb3cb09f..c980ce50981 100644
--- a/src/mame/drivers/vsnes.cpp
+++ b/src/mame/drivers/vsnes.cpp
@@ -2150,21 +2150,22 @@ ROM_START( cluclu )
PALETTE_2C04_0004
ROM_END
-ROM_START( excitebk ) /* EB4-4 A = Excite Bike, Palette 4, rev A */
+
+ROM_START( excitebk ) /* EB4-3 = Excite Bike, Palette 3, revision 'E' */
ROM_REGION( 0x10000,"maincpu", 0 ) /* 6502 memory */
- ROM_LOAD( "mds-eb4-4 a.6d", 0x8000, 0x2000, CRC(6aa87037) SHA1(f3313700955498800a3d59c523ba2a4e0cf443bc) )
- ROM_LOAD( "mds-eb4-4 a.6c", 0xa000, 0x2000, CRC(bdb317db) SHA1(a8b3e8deb1e625d764aaffe86a513bc7ede51a46) )
- ROM_LOAD( "mds-eb4-4 a.6b", 0xc000, 0x2000, CRC(d1afe2dd) SHA1(ef0f44d98464b7dab7c51be4379242f7a4e4fcdd) )
- ROM_LOAD( "mds-eb4-4 a.6a", 0xe000, 0x2000, CRC(46711d0e) SHA1(6ce2f395b3f407671a87c6e1133ab63a637022f2) )
+ ROM_LOAD( "mds-eb4-3e.1d", 0x8000, 0x2000, CRC(f58a392e) SHA1(ca721e47e5dbe72d6f231d9b20b1ca33304c5370) )
+ ROM_LOAD( "mds-eb4-3e.1c", 0xa000, 0x2000, CRC(6ae01102) SHA1(f3f49644f7e2887e14655e8934c7c75d4b92968e) )
+ ROM_LOAD( "mds-eb4-3e.1b", 0xc000, 0x2000, CRC(fbc53465) SHA1(81c9ebac895dfbc5c451b4b32e5990aba3734714) )
+ ROM_LOAD( "mds-eb4-3e.1a", 0xe000, 0x2000, CRC(e2902b4e) SHA1(f559517c735847e2ad622418b8fa525d9c9adac3) )
ROM_REGION( 0x4000,"gfx1", 0 ) /* PPU memory */
- ROM_LOAD( "mds-eb4-4 a.8b", 0x0000, 0x2000, CRC(62a76c52) SHA1(7ebd0dac976abe8636f4f75a3b2a473d7a54934d) )
- ROM_LOAD( "mds-eb4-4 a.8a", 0x2000, 0x2000, CRC(a9b49a05) SHA1(c14706e6a5524f81e79c101e32deef9f3d60de3f) )
+ ROM_LOAD( "mds-eb4-3e.2b", 0x0000, 0x2000, CRC(80be1f50) SHA1(d8544b9a0a9d8719ab601fa9c68c4305385b14c7) )
+ ROM_LOAD( "mds-eb4-3e.2a", 0x2000, 0x2000, CRC(001e8e0b) SHA1(c4c2a11ade7788bac9dd61ea8de319c4111d2592) )
- PALETTE_2C04_0004
+ PALETTE_2C04_0003
ROM_END
-ROM_START( excitebka ) /* EB4-3 = Excite Bike, Palette 3, unknown revision */
+ROM_START( excitebko ) /* EB4-3 = Excite Bike, Palette 3, unknown revision */
ROM_REGION( 0x10000,"maincpu", 0 ) /* 6502 memory */
ROM_LOAD( "mds-eb4-3.1d", 0x8000, 0x2000, CRC(7e54df1d) SHA1(38d878041976386e8608c73133040b18d0e4b9cd) ) /* Need to verify correct label */
ROM_LOAD( "mds-eb4-3.1c", 0xa000, 0x2000, CRC(89baae91) SHA1(6aebf13c415e3246edf7daa847533b7e3ae0425f) ) /* Need to verify correct label */
@@ -2178,6 +2179,20 @@ ROM_START( excitebka ) /* EB4-3 = Excite Bike, Palette 3, unknown revision */
PALETTE_2C04_0003
ROM_END
+ROM_START( excitebkj ) /* EB4-4 A = Excite Bike, Palette 4, rev A */
+ ROM_REGION( 0x10000,"maincpu", 0 ) /* 6502 memory */
+ ROM_LOAD( "mds-eb4-4 a.6d", 0x8000, 0x2000, CRC(6aa87037) SHA1(f3313700955498800a3d59c523ba2a4e0cf443bc) )
+ ROM_LOAD( "mds-eb4-4 a.6c", 0xa000, 0x2000, CRC(bdb317db) SHA1(a8b3e8deb1e625d764aaffe86a513bc7ede51a46) )
+ ROM_LOAD( "mds-eb4-4 a.6b", 0xc000, 0x2000, CRC(d1afe2dd) SHA1(ef0f44d98464b7dab7c51be4379242f7a4e4fcdd) )
+ ROM_LOAD( "mds-eb4-4 a.6a", 0xe000, 0x2000, CRC(46711d0e) SHA1(6ce2f395b3f407671a87c6e1133ab63a637022f2) )
+
+ ROM_REGION( 0x4000,"gfx1", 0 ) /* PPU memory */
+ ROM_LOAD( "mds-eb4-4 a.8b", 0x0000, 0x2000, CRC(62a76c52) SHA1(7ebd0dac976abe8636f4f75a3b2a473d7a54934d) )
+ ROM_LOAD( "mds-eb4-4 a.8a", 0x2000, 0x2000, CRC(a9b49a05) SHA1(c14706e6a5524f81e79c101e32deef9f3d60de3f) )
+
+ PALETTE_2C04_0004
+ROM_END
+
ROM_START( jajamaru )
ROM_REGION( 0x10000,"maincpu", 0 ) /* 6502 memory */
ROM_LOAD( "10.bin", 0x8000, 0x2000, CRC(16af1704) SHA1(ebcf9ad06e302c51ee4432631a6b0fb85a9630ed) )
@@ -2787,8 +2802,9 @@ GAME( 1985, starlstr, 0, vsnes, starlstr, vsnes_state, vsnormal, ROT0,
GAME( 1987, cstlevna, 0, vsnes, cstlevna, vsnes_state, vsvram, ROT0, "Konami", "Vs. Castlevania", 0 )
GAME( 1984, cluclu, 0, vsnes, cluclu, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Clu Clu Land", 0 )
GAME( 1990, drmario, 0, vsnes, drmario, vsnes_state, drmario, ROT0, "Nintendo", "Vs. Dr. Mario", 0 )
-GAME( 1984, excitebk, 0, vsnes, excitebk, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Excitebike (set EB4-4 A)", 0 )
-GAME( 1984, excitebka,excitebk, vsnes, excitebk, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Excitebike (set EB4-3 ?)", 0 )
+GAME( 1984, excitebk, 0, vsnes, excitebk, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Excitebike (set EB4-3 E)", 0 )
+GAME( 1984, excitebko,excitebk, vsnes, excitebk, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Excitebike (set EB4-3 ?)", 0 ) // older
+GAME( 1984, excitebkj,excitebk, vsnes, excitebk, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Excitebike (set EB4-4 A)", 0 ) // likely Japan
GAME( 1986, goonies, 0, vsnes, goonies, vsnes_state, vskonami, ROT0, "Konami", "Vs. The Goonies (set E)", 0 )
GAME( 1984, iceclimb, 0, vsnes, iceclmbj, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Ice Climber (set IC4-4 B-1)", 0 )
GAME( 1984, iceclimba,iceclimb, vsnes, iceclimb, vsnes_state, vsnormal, ROT0, "Nintendo", "Vs. Ice Climber (set IC4-4 ?)", 0 )
diff --git a/src/mame/drivers/welltris.cpp b/src/mame/drivers/welltris.cpp
index 05b29b06cfc..5d547ef911e 100644
--- a/src/mame/drivers/welltris.cpp
+++ b/src/mame/drivers/welltris.cpp
@@ -723,7 +723,6 @@ static MACHINE_CONFIG_START( welltris, welltris_state )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_SET_PRITYPE(-1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
- MCFG_VSYSTEM_SPR2_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/xexex.cpp b/src/mame/drivers/xexex.cpp
index 24098d42aca..c9d3ebf32a8 100644
--- a/src/mame/drivers/xexex.cpp
+++ b/src/mame/drivers/xexex.cpp
@@ -521,18 +521,14 @@ static MACHINE_CONFIG_START( xexex, xexex_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_ENABLE_HILIGHTS()
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(xexex_state, tile_callback)
- MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(xexex_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, -48, 32)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48, 32)
MCFG_K053246_PALETTE("palette")
MCFG_K053250_ADD("k053250", "palette", "screen", -5, -16)
diff --git a/src/mame/drivers/xmen.cpp b/src/mame/drivers/xmen.cpp
index fb5e3a62705..c924ce91528 100644
--- a/src/mame/drivers/xmen.cpp
+++ b/src/mame/drivers/xmen.cpp
@@ -336,16 +336,13 @@ static MACHINE_CONFIG_START( xmen, xmen_state )
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k052109", K052109, 0)
MCFG_GFX_PALETTE("palette")
MCFG_K052109_CB(xmen_state, tile_callback)
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(xmen_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, 53, -2)
- MCFG_K053246_GFXDECODE("gfxdecode")
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, 53, -2)
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
@@ -399,17 +396,14 @@ static MACHINE_CONFIG_START( xmen6p, xmen_state )
MCFG_VIDEO_START_OVERRIDE(xmen_state,xmen6p)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k052109", K052109, 0)
MCFG_GFX_PALETTE("palette")
MCFG_K052109_CB(xmen_state, tile_callback)
MCFG_DEVICE_ADD("k053246", K053246, 0)
MCFG_K053246_CB(xmen_state, sprite_callback)
- MCFG_K053246_CONFIG("gfx2", 1, NORMAL_PLANE_ORDER, 53, -2)
+ MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, 53, -2)
MCFG_K053246_SET_SCREEN("screen")
- MCFG_K053246_GFXDECODE("gfxdecode")
MCFG_K053246_PALETTE("palette")
MCFG_K053251_ADD("k053251")
diff --git a/src/mame/drivers/zaxxon.cpp b/src/mame/drivers/zaxxon.cpp
index e87d8125f91..ace1f3e2fbd 100644
--- a/src/mame/drivers/zaxxon.cpp
+++ b/src/mame/drivers/zaxxon.cpp
@@ -257,7 +257,7 @@
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "sound/samples.h"
-#include "machine/segacrpt.h"
+#include "machine/segacrpt_device.h"
#include "machine/i8255.h"
#include "audio/segasnd.h"
#include "includes/zaxxon.h"
@@ -942,19 +942,33 @@ static MACHINE_CONFIG_DERIVED( zaxxon, root )
MCFG_FRAGMENT_ADD(zaxxon_samples)
MACHINE_CONFIG_END
+
+
static MACHINE_CONFIG_DERIVED( szaxxon, zaxxon )
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+MACHINE_CONFIG_END
- /* encryption */
- MCFG_DEVICE_MODIFY("maincpu")
+
+static MACHINE_CONFIG_DERIVED( szaxxone, zaxxon )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5013, MASTER_CLOCK/16)
+ MCFG_CPU_PROGRAM_MAP(zaxxon_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", zaxxon_state, vblank_int)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+ MCFG_SEGACRPT_SET_SIZE(0x6000)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( futspy, root )
- /* encryption */
- MCFG_DEVICE_MODIFY("maincpu")
+static MACHINE_CONFIG_DERIVED( futspye, root )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5061, MASTER_CLOCK/16)
+ MCFG_CPU_PROGRAM_MAP(zaxxon_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", zaxxon_state, vblank_int)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+ MCFG_SEGACRPT_SET_SIZE(0x6000)
+
/* video hardware */
MCFG_SCREEN_MODIFY("screen")
@@ -963,14 +977,19 @@ static MACHINE_CONFIG_DERIVED( futspy, root )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_FRAGMENT_ADD(zaxxon_samples)
+
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( razmataz, root )
- MCFG_CPU_MODIFY("maincpu")
+
+static MACHINE_CONFIG_DERIVED( razmataze, root )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5098, MASTER_CLOCK/16)
MCFG_CPU_PROGRAM_MAP(ixion_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", zaxxon_state, vblank_int)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+ MCFG_SEGACRPT_SET_SIZE(0x6000)
MCFG_DEVICE_REMOVE("ppi8255")
@@ -984,6 +1003,14 @@ static MACHINE_CONFIG_DERIVED( razmataz, root )
MCFG_SEGAUSBROM_ADD("usbsnd")
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( ixion, razmataze )
+ MCFG_CPU_REPLACE("maincpu", SEGA_315_5013, MASTER_CLOCK/16)
+ MCFG_CPU_PROGRAM_MAP(ixion_map)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", zaxxon_state, vblank_int)
+ MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
+ MCFG_SEGACRPT_SET_DECRYPTED_TAG(":decrypted_opcodes")
+ MCFG_SEGACRPT_SET_SIZE(0x6000)
+MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( congo, root )
@@ -1522,90 +1549,9 @@ DRIVER_INIT_MEMBER(zaxxon_state,zaxxonj)
}
-DRIVER_INIT_MEMBER(zaxxon_state,szaxxon)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */
- { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
- { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
- { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
- { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */
- { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
- { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */
- { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...1 */
- { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...0 */
- { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...1 */
- { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable);
-}
-
-
-DRIVER_INIT_MEMBER(zaxxon_state,futspy)
-{
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...0...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...1...0 */
- { 0xa0,0x80,0x20,0x00 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...1 */
- { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0xa8,0xa0 }, /* ...0...1...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */
- { 0x88,0x80,0xa8,0xa0 }, { 0x28,0x08,0x20,0x00 }, /* ...1...0...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...1 */
- { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...1...0...1...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */
- { 0x88,0x80,0xa8,0xa0 }, { 0x88,0x80,0xa8,0xa0 }, /* ...1...1...0...0 */
- { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */
- { 0x80,0x00,0xa0,0x20 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */
- { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */
- };
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable);
-}
-
DRIVER_INIT_MEMBER(zaxxon_state,razmataz)
{
- // Note: same as nprinces
- static const UINT8 convtable[32][4] =
- {
- /* opcode data address */
- /* A B C D A B C D */
- { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */
- { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
- { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
- { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */
- { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
- { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
- };
-
-
- sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable);
-
address_space &pgmspace = m_maincpu->space(AS_PROGRAM);
/* additional input ports are wired */
@@ -1637,15 +1583,15 @@ GAME( 1982, zaxxonj, zaxxon, szaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90
GAME( 1982, zaxxonb, zaxxon, szaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90, "bootleg", "Jackson", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* standard Zaxxon hardware but extra sound board plugged into 8255 PPI socket and encrypted cpu */
-GAME( 1982, szaxxon, 0, szaxxon, szaxxon, zaxxon_state, szaxxon, ROT90, "Sega", "Super Zaxxon (315-5013)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1982, szaxxon, 0, szaxxone, szaxxon, driver_device, 0, ROT90, "Sega", "Super Zaxxon (315-5013)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* standard Zaxxon hardware? but encrypted cpu */
-GAME( 1984, futspy, 0, futspy, futspy, zaxxon_state, futspy, ROT90, "Sega", "Future Spy (315-5061)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1984, futspy, 0, futspye, futspy, driver_device, 0, ROT90, "Sega", "Future Spy (315-5061)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* these games run on modified Zaxxon hardware with no skewing, extra inputs, and a */
/* G-80 Universal Sound Board */
-GAME( 1983, razmataz, 0, razmataz, razmataz, zaxxon_state, razmataz, ROT90, "Sega", "Razzmatazz", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
-GAME( 1983, ixion, 0, razmataz, ixion, zaxxon_state, szaxxon, ROT270, "Sega", "Ixion (prototype)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE)
+GAME( 1983, razmataz, 0, razmataze, razmataz, zaxxon_state, razmataz, ROT90, "Sega", "Razzmatazz", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1983, ixion, 0, ixion, ixion, driver_device, 0, ROT270, "Sega", "Ixion (prototype)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE)
/* these games run on a slightly newer Zaxxon hardware with more ROM space and a */
/* custom sprite DMA chip */
diff --git a/src/mame/drivers/zr107.cpp b/src/mame/drivers/zr107.cpp
index f838f3e21e2..202c0f102f9 100644
--- a/src/mame/drivers/zr107.cpp
+++ b/src/mame/drivers/zr107.cpp
@@ -784,12 +784,9 @@ static MACHINE_CONFIG_START( zr107, zr107_state )
MCFG_VIDEO_START_OVERRIDE(zr107_state,zr107)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k056832", K056832, 0)
MCFG_K056832_CB(zr107_state, tile_callback)
- MCFG_K056832_CONFIG("gfx2", 1, K056832_BPP_8, 1, 0, "none")
- MCFG_K056832_GFXDECODE("gfxdecode")
+ MCFG_K056832_CONFIG("gfx2", K056832_BPP_8, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
@@ -856,16 +853,11 @@ static MACHINE_CONFIG_START( jetwave, zr107_state )
MCFG_VIDEO_START_OVERRIDE(zr107_state,jetwave)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
-
MCFG_DEVICE_ADD("k001604", K001604, 0)
- MCFG_K001604_GFX_INDEX1(0)
- MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(0)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
- MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
diff --git a/src/mame/includes/angelkds.h b/src/mame/includes/angelkds.h
index 1617fc2579a..22ebca1505e 100644
--- a/src/mame/includes/angelkds.h
+++ b/src/mame/includes/angelkds.h
@@ -55,7 +55,6 @@ public:
DECLARE_WRITE8_MEMBER(angelkds_bgbotscroll_write);
DECLARE_WRITE8_MEMBER(angelkds_layer_ctrl_write);
DECLARE_DRIVER_INIT(angelkds);
- DECLARE_DRIVER_INIT(spcpostn);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
TILE_GET_INFO_MEMBER(get_bgtop_tile_info);
TILE_GET_INFO_MEMBER(get_bgbot_tile_info);
diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h
index 34e49e02c8b..94cbae0b9fb 100644
--- a/src/mame/includes/appoooh.h
+++ b/src/mame/includes/appoooh.h
@@ -52,7 +52,6 @@ public:
DECLARE_WRITE8_MEMBER(bg_videoram_w);
DECLARE_WRITE8_MEMBER(bg_colorram_w);
DECLARE_WRITE8_MEMBER(out_w);
- DECLARE_DRIVER_INIT(robowres);
DECLARE_DRIVER_INIT(robowresb);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
diff --git a/src/mame/includes/artmagic.h b/src/mame/includes/artmagic.h
index 32f56fd2747..575c90b15cf 100644
--- a/src/mame/includes/artmagic.h
+++ b/src/mame/includes/artmagic.h
@@ -20,6 +20,7 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
+ m_oki_region(*this, "oki"),
m_tms(*this, "tms"),
m_tlc34076(*this, "tlc34076"),
m_control(*this, "control"),
@@ -28,6 +29,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<okim6295_device> m_oki;
+ required_memory_region m_oki_region;
required_device<tms34010_device> m_tms;
required_device<tlc34076_device> m_tlc34076;
diff --git a/src/mame/includes/cybiko.h b/src/mame/includes/cybiko.h
index 0c6ad30b5aa..5ccbc687a90 100644
--- a/src/mame/includes/cybiko.h
+++ b/src/mame/includes/cybiko.h
@@ -19,7 +19,6 @@
/* Core includes */
#include "emu.h"
-#include "emuopts.h"
#include "sound/speaker.h"
/* Components */
diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h
index 3f57cc38ec6..56d17e7339f 100644
--- a/src/mame/includes/fidelz80.h
+++ b/src/mame/includes/fidelz80.h
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco,hap
+// thanks-to:Berger
/******************************************************************************
*
* Fidelity Electronics Z80 based board driver
diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h
index 01fad97eb95..669cc95b4ca 100644
--- a/src/mame/includes/harddriv.h
+++ b/src/mame/includes/harddriv.h
@@ -257,6 +257,8 @@ protected:
optional_device<dsp32c_device> m_dsp32;
optional_device<adsp2105_device> m_ds3sdsp;
optional_device<adsp2105_device> m_ds3xdsp;
+ optional_memory_region m_ds3sdsp_region;
+ optional_memory_region m_ds3xdsp_region;
optional_device<dac_device> m_ds3dac1;
optional_device<dac_device> m_ds3dac2;
optional_device<harddriv_sound_board_device> m_harddriv_sound;
@@ -339,8 +341,7 @@ protected:
UINT16 m_adsp_som_address;
UINT32 m_adsp_eprom_base;
- UINT16 * m_sim_memory;
- UINT32 m_sim_memory_size;
+ required_region_ptr<UINT16> m_sim_memory;
UINT16 m_som_memory[0x8000/2];
UINT16 * m_adsp_pgm_memory_word;
diff --git a/src/mame/includes/intv.h b/src/mame/includes/intv.h
index 7f14c7fb55a..4155499db7d 100644
--- a/src/mame/includes/intv.h
+++ b/src/mame/includes/intv.h
@@ -16,6 +16,9 @@
#include "bus/intv/ecs.h"
//#include "bus/intv/keycomp.h"
+#include "bus/intv_ctrl/ctrl.h"
+#include "bus/intv_ctrl/handctrl.h"
+
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
@@ -43,7 +46,6 @@ public:
m_iocart2(*this, "ioslot2"),
m_region_maincpu(*this, "maincpu"),
m_region_keyboard(*this, "keyboard"),
- m_io_options(*this, "OPTIONS"),
m_io_test(*this, "TEST"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
@@ -118,19 +120,13 @@ protected:
optional_device<generic_slot_device> m_iocart2;
required_memory_region m_region_maincpu;
optional_memory_region m_region_keyboard;
- required_ioport m_io_options;
optional_ioport m_io_test;
optional_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- ioport_port *m_keypad[4];
- ioport_port *m_disc[4];
- ioport_port *m_discx[4];
- ioport_port *m_discy[4];
ioport_port *m_intv_keyboard[10];
- UINT8 intv_control_r(int hand);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h
index f5ee6f795d5..fb5f54f28d5 100644
--- a/src/mame/includes/konamigx.h
+++ b/src/mame/includes/konamigx.h
@@ -52,7 +52,7 @@ public:
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
optional_device<tms57002_device> m_dasp;
- required_device<k053252_device> m_k053252; // not hooked up in tasman.cpp yet (does it even have it?)
+ required_device<k053252_device> m_k053252;
required_device<k055673_device> m_k055673;
required_device<k055555_device> m_k055555;
required_device<k056832_device> m_k056832;
@@ -60,7 +60,7 @@ public:
optional_device<k056800_device> m_k056800;
optional_device<k054539_device> m_k054539_1;
optional_device<k054539_device> m_k054539_2;
- required_device<gfxdecode_device> m_gfxdecode;
+ optional_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
diff --git a/src/mame/includes/model1.h b/src/mame/includes/model1.h
index 824766648e5..fac0eec2ed4 100644
--- a/src/mame/includes/model1.h
+++ b/src/mame/includes/model1.h
@@ -89,6 +89,9 @@ public:
float m_tgp_vr_circrad;
float m_tgp_vr_cbox[12];
int m_tgp_vr_select;
+
+ float m_tgp_int_px, m_tgp_int_py, m_tgp_int_pz;
+ UINT32 m_tgp_int_adr;
UINT16 m_ram_adr;
UINT16 m_ram_latch[2];
UINT16 m_ram_scanadr;
@@ -180,12 +183,12 @@ public:
DECLARE_TGP_FUNCTION( clear_stack );
DECLARE_TGP_FUNCTION( matrix_mul );
DECLARE_TGP_FUNCTION( anglev );
- DECLARE_TGP_FUNCTION( f11 );
+ DECLARE_TGP_FUNCTION( triangle_normal );
DECLARE_TGP_FUNCTION( normalize );
DECLARE_TGP_FUNCTION( acc_seti );
DECLARE_TGP_FUNCTION( track_select );
- DECLARE_TGP_FUNCTION( f14 );
- DECLARE_TGP_FUNCTION( f15_swa );
+ DECLARE_TGP_FUNCTION( load_base );
+ DECLARE_TGP_FUNCTION( transpose );
DECLARE_TGP_FUNCTION( anglep );
DECLARE_TGP_FUNCTION( matrix_ident );
DECLARE_TGP_FUNCTION( matrix_read );
@@ -195,7 +198,7 @@ public:
DECLARE_TGP_FUNCTION( matrix_roty );
DECLARE_TGP_FUNCTION( matrix_rotz );
DECLARE_TGP_FUNCTION( track_read_quad );
- DECLARE_TGP_FUNCTION( f24_swa );
+ DECLARE_TGP_FUNCTION( intercept );
DECLARE_TGP_FUNCTION( transform_point );
DECLARE_TGP_FUNCTION( fcos_m1 );
DECLARE_TGP_FUNCTION( fsin_m1 );
@@ -214,9 +217,9 @@ public:
DECLARE_TGP_FUNCTION( xyz2rqf );
DECLARE_TGP_FUNCTION( f43 );
DECLARE_TGP_FUNCTION( f43_swa );
- DECLARE_TGP_FUNCTION( f44 );
+ DECLARE_TGP_FUNCTION( track_read_tri );
DECLARE_TGP_FUNCTION( matrix_sdir );
- DECLARE_TGP_FUNCTION( f45 );
+ DECLARE_TGP_FUNCTION( fsqrt );
DECLARE_TGP_FUNCTION( vlength );
DECLARE_TGP_FUNCTION( f47 );
DECLARE_TGP_FUNCTION( track_read_info );
@@ -228,10 +231,10 @@ public:
DECLARE_TGP_FUNCTION( matrix_rdir );
DECLARE_TGP_FUNCTION( track_lookup );
DECLARE_TGP_FUNCTION( f56 );
- DECLARE_TGP_FUNCTION( f57 );
+ DECLARE_TGP_FUNCTION( int_normal );
DECLARE_TGP_FUNCTION( matrix_readt );
DECLARE_TGP_FUNCTION( acc_geti );
- DECLARE_TGP_FUNCTION( f60 );
+ DECLARE_TGP_FUNCTION( int_point );
DECLARE_TGP_FUNCTION( col_setcirc );
DECLARE_TGP_FUNCTION( col_testpt );
DECLARE_TGP_FUNCTION( push_and_ident );
diff --git a/src/mame/includes/model3.h b/src/mame/includes/model3.h
index 1c66bf531c9..24956b46159 100644
--- a/src/mame/includes/model3.h
+++ b/src/mame/includes/model3.h
@@ -123,7 +123,6 @@ public:
int m_lightgun_reg_sel;
int m_adc_channel;
UINT64 m_real3d_status;
- std::unique_ptr<UINT64[]> m_network_ram;
int m_prot_data_ptr;
std::unique_ptr<UINT32[]> m_vrom;
int m_step;
@@ -215,8 +214,6 @@ public:
DECLARE_READ64_MEMBER(real3d_status_r);
DECLARE_READ8_MEMBER(model3_sound_r);
DECLARE_WRITE8_MEMBER(model3_sound_w);
- DECLARE_READ64_MEMBER(network_r);
- DECLARE_WRITE64_MEMBER(network_w);
DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
DECLARE_WRITE16_MEMBER(model3snd_ctrl);
diff --git a/src/mame/includes/naomi.h b/src/mame/includes/naomi.h
index 3e1e6c80eb0..74b981da5de 100644
--- a/src/mame/includes/naomi.h
+++ b/src/mame/includes/naomi.h
@@ -25,6 +25,7 @@ naomi.h -> NAOMI includes
#include "machine/aicartc.h"
#include "machine/jvsdev.h"
#include "machine/jvs13551.h"
+#include "machine/m3comm.h"
#include "dc.h"
enum {
diff --git a/src/mame/includes/nb1414m4.h b/src/mame/includes/nb1414m4.h
index b00bdf6ae2e..2832d6a38b2 100644
--- a/src/mame/includes/nb1414m4.h
+++ b/src/mame/includes/nb1414m4.h
@@ -24,7 +24,7 @@ private:
void _0600(UINT8 is2p, UINT8 *vram);
void _0e00(UINT16 mcu_cmd, UINT8 *vram);
- optional_region_ptr<UINT8> m_data;
+ required_region_ptr<UINT8> m_data;
};
diff --git a/src/mame/includes/pbaction.h b/src/mame/includes/pbaction.h
index 4fcd6b64574..aa7fa2ddd35 100644
--- a/src/mame/includes/pbaction.h
+++ b/src/mame/includes/pbaction.h
@@ -54,7 +54,6 @@ public:
DECLARE_WRITE8_MEMBER(pbaction_scroll_w);
DECLARE_WRITE8_MEMBER(pbaction_flipscreen_w);
DECLARE_DRIVER_INIT(pbactio3);
- DECLARE_DRIVER_INIT(pbactio4);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void machine_start() override;
diff --git a/src/mame/includes/playch10.h b/src/mame/includes/playch10.h
index a97de718bd3..7878803b073 100644
--- a/src/mame/includes/playch10.h
+++ b/src/mame/includes/playch10.h
@@ -119,6 +119,7 @@ public:
DECLARE_DRIVER_INIT(pcfboard);
DECLARE_DRIVER_INIT(pcfboard_2);
DECLARE_DRIVER_INIT(virus);
+ DECLARE_DRIVER_INIT(ttoon);
DECLARE_DRIVER_INIT(pcgboard);
DECLARE_DRIVER_INIT(pcgboard_type2);
DECLARE_DRIVER_INIT(pchboard);
diff --git a/src/mame/includes/segas18.h b/src/mame/includes/segas18.h
index 5efbcfea648..79726c3c253 100644
--- a/src/mame/includes/segas18.h
+++ b/src/mame/includes/segas18.h
@@ -27,6 +27,7 @@ public:
: sega_16bit_common_base(mconfig, type, tag),
m_mapper(*this, "mapper"),
m_maincpu(*this, "maincpu"),
+ m_maincpu_region(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_mcu(*this, "mcu"),
m_vdp(*this, "gen_vdp"),
@@ -128,6 +129,7 @@ protected:
// devices
required_device<sega_315_5195_mapper_device> m_mapper;
required_device<m68000_device> m_maincpu;
+ required_memory_region m_maincpu_region;
required_device<z80_device> m_soundcpu;
optional_device<i8751_device> m_mcu;
required_device<sega315_5313_device> m_vdp;
diff --git a/src/mame/includes/segaybd.h b/src/mame/includes/segaybd.h
index 2fb72a602ee..baf0b1d7c37 100644
--- a/src/mame/includes/segaybd.h
+++ b/src/mame/includes/segaybd.h
@@ -26,7 +26,7 @@ public:
m_suby(*this, "suby"),
m_soundcpu(*this, "soundcpu"),
m_linkcpu(*this, "linkcpu"),
- m_bsprites(*this, "sprites"),
+ m_bsprites(*this, "bsprites"),
m_ysprites(*this, "ysprites"),
m_segaic16vid(*this, "segaic16vid"),
m_digital_ports(*this, digital_ports),
diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h
index 14a00ebc8da..86f437f732e 100644
--- a/src/mame/includes/system1.h
+++ b/src/mame/includes/system1.h
@@ -2,6 +2,7 @@
// copyright-holders:Jarek Parchanski, Nicola Salmoria, Mirko Buffoni
#include "cpu/z80/z80.h"
#include "machine/i8255.h"
+#include "machine/segacrp2_device.h"
class system1_state : public driver_device
{
@@ -14,6 +15,7 @@ public:
m_nob_mcu_latch(*this, "nob_mcu_latch"),
m_nob_mcu_status(*this, "nob_mcu_status"),
m_paletteram(*this, "palette"),
+ m_videomode_custom(nullptr),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_mcu(*this, "mcu"),
@@ -25,7 +27,9 @@ public:
m_color_prom(*this, "palette"),
m_bank1(*this, "bank1"),
m_bank0d(*this, "bank0d"),
- m_bank1d(*this, "bank1d") { }
+ m_bank1d(*this, "bank1d"),
+ m_banked_decrypted_opcodes(nullptr)
+ { }
optional_device<i8255_device> m_ppi8255;
required_shared_ptr<UINT8> m_ram;
@@ -82,52 +86,30 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(dakkochn_mux_status_r);
DECLARE_WRITE8_MEMBER(sound_control_w);
+ DECLARE_DRIVER_INIT(bank00);
+ DECLARE_DRIVER_INIT(bank0c);
+ DECLARE_DRIVER_INIT(bank44);
+
DECLARE_DRIVER_INIT(nobb);
- DECLARE_DRIVER_INIT(sega315_5178);
- DECLARE_DRIVER_INIT(sega315_5110);
- DECLARE_DRIVER_INIT(sega315_5093);
DECLARE_DRIVER_INIT(dakkochn);
DECLARE_DRIVER_INIT(bootleg);
-
DECLARE_DRIVER_INIT(shtngmst);
- DECLARE_DRIVER_INIT(sega315_5135);
- DECLARE_DRIVER_INIT(sega315_5048);
- DECLARE_DRIVER_INIT(sega315_5033);
- DECLARE_DRIVER_INIT(bank0c);
DECLARE_DRIVER_INIT(blockgal);
DECLARE_DRIVER_INIT(nob);
- DECLARE_DRIVER_INIT(sega315_5041);
- DECLARE_DRIVER_INIT(sega315_5155);
- DECLARE_DRIVER_INIT(sega315_5051);
- DECLARE_DRIVER_INIT(bank44);
DECLARE_DRIVER_INIT(myherok);
- DECLARE_DRIVER_INIT(sega315_5064);
- DECLARE_DRIVER_INIT(bank00);
- DECLARE_DRIVER_INIT(sega315_5132);
DECLARE_DRIVER_INIT(ufosensi);
- DECLARE_DRIVER_INIT(sega315_5098);
DECLARE_DRIVER_INIT(wbml);
DECLARE_DRIVER_INIT(bootsys2);
DECLARE_DRIVER_INIT(bootsys2d);
- DECLARE_DRIVER_INIT(sega315_5065);
- DECLARE_DRIVER_INIT(sega315_5177);
- DECLARE_DRIVER_INIT(sega315_5177_s2);
- DECLARE_DRIVER_INIT(sega315_3135);
- DECLARE_DRIVER_INIT(gardiab);
- DECLARE_DRIVER_INIT(sega315_5162);
DECLARE_DRIVER_INIT(choplift);
- DECLARE_DRIVER_INIT(sega315_5102);
- DECLARE_DRIVER_INIT(sega315_5133);
- DECLARE_DRIVER_INIT(gardia);
- DECLARE_DRIVER_INIT(sega315_spat);
- DECLARE_DRIVER_INIT(sega315_5099);
TILE_GET_INFO_MEMBER(tile_get_info);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
DECLARE_MACHINE_START(system2);
DECLARE_VIDEO_START(system2);
+ DECLARE_MACHINE_START(myherok);
UINT32 screen_update_system1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_system2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_system2_rowscroll(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h
index e2d0ea2ab2d..830fb9a7f6f 100644
--- a/src/mame/includes/turbo.h
+++ b/src/mame/includes/turbo.h
@@ -149,7 +149,6 @@ public:
DECLARE_WRITE8_MEMBER(buckrog_ppi1c_w);
DECLARE_READ8_MEMBER(turbo_analog_r);
DECLARE_WRITE8_MEMBER(buckrog_i8255_0_w);
- DECLARE_DRIVER_INIT(buckrog_enc);
DECLARE_DRIVER_INIT(turbo_enc);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
DECLARE_VIDEO_START(turbo);
diff --git a/src/mame/includes/xbox.h b/src/mame/includes/xbox.h
index 8af8e83635d..5d11a86043d 100644
--- a/src/mame/includes/xbox.h
+++ b/src/mame/includes/xbox.h
@@ -70,6 +70,45 @@ enum OHCIRegisters {
HcRhPortStatus1
};
+enum HcControlBits
+{
+ CBSR = 1 << 0, // ControlBulkServiceRatio
+ PLE = 1 << 2, // PeriodicListEnable
+ IE = 1 << 3, // IsochronousEnable
+ CLE = 1 << 4, // ControlListEnable
+ BLE = 1 << 5, // BulkListEnable
+ HCFS = 1 << 6, // HostControllerFunctionalState
+ IR = 1 << 8, // InterruptRouting
+ RWC = 1 << 9, // RemoteWakeupConnected
+ RWE = 1 << 10 // RemoteWakeupEnable
+};
+
+enum HcRhStatusBits
+{
+ LPS = 1 << 0, // LocalPowerStatus
+ OCI = 1 << 1, // OverCurrentIndicator
+ DRWE = 1 << 15, // DeviceRemoteWakeupEnable
+ LPSC = 1 << 16, // LocalPowerStatusChange
+ OCIC = 1 << 17, // OverCurrentIndicatorChange
+ CRWE = 1 << 31, // ClearRemoteWakeupEnable
+};
+
+enum HcRhPortStatusBits
+{
+ CCS = 1 << 0, // CurrentConnectStatus
+ PES = 1 << 1, // PortEnableStatus
+ PSS = 1 << 2, // PortSuspendStatus
+ POCI = 1 << 3, // PortOverCurrentIndicator
+ PRS = 1 << 4, // PortResetStatus
+ PPS = 1 << 8, // PortPowerStatus
+ LSDA = 1 << 9, // LowSpeedDeviceAttached
+ CSC = 1 << 16, // ConnectStatusChange
+ PESC = 1 << 17, // PortEnableStatusChange
+ PSSC = 1 << 18, // PortSuspendStatusChange
+ POCIC = 1 << 19, // PortOverCurrentIndicatorChange
+ PRSC = 1 << 20 // PortResetStatusChange
+};
+
enum OHCIHostControllerFunctionalState {
UsbReset=0,
UsbResume,
@@ -257,11 +296,15 @@ struct usb_device_configuration
std::forward_list<usb_device_interface *> interfaces;
};
+class xbox_base_state; // forward declaration
+
class ohci_function_device {
public:
- ohci_function_device(running_machine &machine);
- void execute_reset();
- int execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size);
+ ohci_function_device(running_machine &machine, xbox_base_state *usb_bus_manager);
+ virtual void execute_reset();
+ virtual void execute_connect() {};
+ virtual void execute_disconnect() {};
+ int execute_transfer(int endpoint, int pid, UINT8 *buffer, int size);
protected:
virtual int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) { return -1; };
virtual int handle_get_status_request(int endpoint, USBSetupPacket *setup) { return 0; };
@@ -283,6 +326,7 @@ protected:
UINT8 *position_device_descriptor(int &size);
UINT8 *position_configuration_descriptor(int index, int &size);
UINT8 *position_string_descriptor(int index, int &size);
+ xbox_base_state *busmanager;
struct {
int type;
int controldirection;
@@ -311,7 +355,7 @@ protected:
class ohci_game_controller_device : public ohci_function_device
{
public:
- ohci_game_controller_device(running_machine &machine);
+ ohci_game_controller_device(running_machine &machine, xbox_base_state *usb_bus_manager);
int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override;
private:
static const USBStandardDeviceDescriptor devdesc;
@@ -360,8 +404,7 @@ public:
void usb_ohci_writeback_transfer_descriptor(UINT32 address);
void usb_ohci_read_isochronous_transfer_descriptor(UINT32 address);
void usb_ohci_writeback_isochronous_transfer_descriptor(UINT32 address);
- void dword_write_le(UINT8 *addr, UINT32 d);
- void word_write_le(UINT8 *addr, UINT16 d);
+ void usb_ohci_device_address_changed(int old_address, int new_address);
void debug_generate_irq(int irq, bool active);
virtual void hack_eeprom() {};
virtual void hack_usb() {};
@@ -422,8 +465,14 @@ public:
UINT32 hc_regs[255];
struct {
ohci_function_device *function;
+ int address;
int delay;
} ports[4 + 1];
+ struct
+ {
+ ohci_function_device *function;
+ int port;
+ } address[256];
emu_timer *timer;
int state;
UINT32 framenumber;
diff --git a/src/mame/includes/zaxxon.h b/src/mame/includes/zaxxon.h
index e5942968e44..54983f6c2e4 100644
--- a/src/mame/includes/zaxxon.h
+++ b/src/mame/includes/zaxxon.h
@@ -73,9 +73,7 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(service_switch);
DECLARE_INPUT_CHANGED_MEMBER(zaxxon_coin_inserted);
DECLARE_DRIVER_INIT(razmataz);
- DECLARE_DRIVER_INIT(futspy);
DECLARE_DRIVER_INIT(zaxxonj);
- DECLARE_DRIVER_INIT(szaxxon);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(zaxxon_get_fg_tile_info);
TILE_GET_INFO_MEMBER(razmataz_get_fg_tile_info);
diff --git a/src/mame/layout/cc40.lay b/src/mame/layout/cc40.lay
index ea366ddc0c1..2f97e22b6de 100644
--- a/src/mame/layout/cc40.lay
+++ b/src/mame/layout/cc40.lay
@@ -9,20 +9,20 @@
<element name="ind_left" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="&lt;" align="1" state="0">
+ <text string="&#x25c0;" align="1" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="&lt;" align="1" state="1">
+ <text string="&#x25c0;" align="1" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
<element name="ind_right" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="&gt;" align="2" state="0">
+ <text string="&#x25b6;" align="2" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="&gt;" align="2" state="1">
+ <text string="&#x25b6;" align="2" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
@@ -119,10 +119,10 @@
<element name="ind_user" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="v" state="0">
+ <text string="&#x25bc;" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="v" state="1">
+ <text string="&#x25bc;" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
@@ -138,7 +138,7 @@
<view name="Internal Layout">
- <bounds left="0" top="0" right="189" bottom="33" />
+ <bounds left="0" top="1" right="189" bottom="33" />
<screen index="0">
<bounds x="1" y="11" width="187" height="11" />
@@ -162,11 +162,11 @@
<!-- draw top row of lcd indicators -->
<bezel name="lamp10" element="ind_left">
- <bounds x="1.5" y="1" width="20" height="5" />
+ <bounds x="1.5" y="2" width="20" height="7" />
</bezel>
<bezel name="lamp4" element="ind_right">
- <bounds x="167.5" y="1" width="20" height="5" />
+ <bounds x="167.5" y="2" width="20" height="7" />
</bezel>
<bezel name="lamp11" element="ind_shift">
@@ -201,22 +201,22 @@
</bezel>
<bezel name="lamp61" element="ind_user">
- <bounds x="29" y="27" width="20" height="5" />
+ <bounds x="29" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp62" element="ind_user">
- <bounds x="51" y="27" width="20" height="5" />
+ <bounds x="51" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp63" element="ind_user">
- <bounds x="73" y="27" width="20" height="5" />
+ <bounds x="73" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp50" element="ind_user">
- <bounds x="95" y="27" width="20" height="5" />
+ <bounds x="95" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp51" element="ind_user">
- <bounds x="117" y="27" width="20" height="5" />
+ <bounds x="117" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp52" element="ind_user">
- <bounds x="139" y="27" width="20" height="5" />
+ <bounds x="139" y="27" width="20" height="5.5" />
</bezel>
<bezel name="lamp53" element="ind_low">
diff --git a/src/mame/layout/fidel_sc12.lay b/src/mame/layout/fidel_sc12.lay
index 3d087368edf..6d30a74c4af 100644
--- a/src/mame/layout/fidel_sc12.lay
+++ b/src/mame/layout/fidel_sc12.lay
@@ -208,29 +208,54 @@
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
<text string="CL"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
+ <element name="text_pb">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="PB"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_pv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="PV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_lv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="LV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_tb">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="TB"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_dm">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="DM"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_rv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="RV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+
<element name="text_king">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="PB/K"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2654;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
<element name="text_queen">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="PV/Q"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2655;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
<element name="text_rook">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="LV/R"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2656;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
<element name="text_bishop">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="TB/B"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2657;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
<element name="text_knight">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="DM/N"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2658;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
<element name="text_pion">
<disk><color red="0.81" green="0.8" blue="0.79" /></disk>
- <text string="RV/P"><color red="0.17" green="0.15" blue="0.15" /></text>
+ <text string="&#x2659;"><color red="0.17" green="0.15" blue="0.15" /></text>
</element>
@@ -459,42 +484,48 @@
<!-- right side -->
- <bezel element="disk_black"><bounds x="87" y="3.1" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="12.4" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="24.3" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="33.6" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="42.9" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="52.2" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="61.5" width="7.4" height="7.4" /></bezel>
- <bezel element="disk_black"><bounds x="87" y="70.8" width="7.4" height="7.4" /></bezel>
-
- <bezel element="disk_white"><bounds x="87.8" y="3.9" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="13.2" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="25.1" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="34.4" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="43.7" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="53 " width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="62.3" width="5.8" height="5.8" /></bezel>
- <bezel element="disk_white"><bounds x="87.8" y="71.6" width="5.8" height="5.8" /></bezel>
-
- <bezel element="text_re"><bounds x="87.8" y="5.6" width="5.8" height="2.4" /></bezel>
- <bezel element="text_cl"><bounds x="87.8" y="14.9" width="5.8" height="2.4" /></bezel>
- <bezel element="text_king"><bounds x="87.8" y="26.8" width="5.8" height="2.4" /></bezel>
- <bezel element="text_queen"><bounds x="87.8" y="36.1" width="5.8" height="2.4" /></bezel>
- <bezel element="text_rook"><bounds x="87.8" y="45.4" width="5.8" height="2.4" /></bezel>
- <bezel element="text_bishop"><bounds x="87.8" y="54.7" width="5.8" height="2.4" /></bezel>
- <bezel element="text_knight"><bounds x="87.8" y="64 " width="5.8" height="2.4" /></bezel>
- <bezel element="text_pion"><bounds x="87.8" y="73.3" width="5.8" height="2.4" /></bezel>
-
- <bezel element="hlb" inputtag="IN.8" inputmask="0x80"><bounds x="87" y="3.1" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x40"><bounds x="87" y="12.4" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x20"><bounds x="87" y="24.3" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x10"><bounds x="87" y="33.6" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x08"><bounds x="87" y="42.9" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x04"><bounds x="87" y="52.2" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x02"><bounds x="87" y="61.5" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
- <bezel element="hlb" inputtag="IN.8" inputmask="0x01"><bounds x="87" y="70.8" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
-
+ <bezel element="text_king"><bounds x="87.7" y="20.6" width="4.6" height="4" /></bezel>
+ <bezel element="text_queen"><bounds x="87.7" y="29.9" width="4.6" height="4" /></bezel>
+ <bezel element="text_bishop"><bounds x="87.7" y="39.2" width="4.6" height="4" /></bezel>
+ <bezel element="text_knight"><bounds x="87.7" y="48.5" width="4.6" height="4" /></bezel>
+ <bezel element="text_rook"><bounds x="87.7" y="57.8" width="4.6" height="4" /></bezel>
+ <bezel element="text_pion"><bounds x="87.7" y="67.1" width="4.6" height="4" /></bezel>
+
+ <bezel element="disk_black"><bounds x="87" y="3.1" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="12.4" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="24.3" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="33.6" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="42.9" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="52.2" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="61.5" width="6" height="6" /></bezel>
+ <bezel element="disk_black"><bounds x="87" y="70.8" width="6" height="6" /></bezel>
+
+ <bezel element="disk_white"><bounds x="87.7" y="3.8" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="13.1" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="25.0" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="34.3" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="43.6" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="52.9" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="62.2" width="4.6" height="4.6" /></bezel>
+ <bezel element="disk_white"><bounds x="87.7" y="71.5" width="4.6" height="4.6" /></bezel>
+
+ <bezel element="text_re"><bounds x="87.7" y="4.9" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_cl"><bounds x="87.7" y="14.2" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_pb"><bounds x="87.7" y="26.1" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_pv"><bounds x="87.7" y="35.4" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_lv"><bounds x="87.7" y="44.7" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_tb"><bounds x="87.7" y="54.0" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_dm"><bounds x="87.7" y="63.3" width="4.6" height="2.4" /></bezel>
+ <bezel element="text_rv"><bounds x="87.7" y="72.6" width="4.6" height="2.4" /></bezel>
+
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x80"><bounds x="87" y="3.1" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x40"><bounds x="87" y="12.4" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x20"><bounds x="87" y="24.3" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x10"><bounds x="87" y="33.6" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x08"><bounds x="87" y="42.9" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x04"><bounds x="87" y="52.2" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x02"><bounds x="87" y="61.5" width="6" height="6" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x01"><bounds x="87" y="70.8" width="6" height="6" /><color alpha="0.3" /></bezel>
</view>
</mamelayout>
diff --git a/src/mame/layout/fidel_sc9.lay b/src/mame/layout/fidel_sc9.lay
new file mode 100644
index 00000000000..a3ad25dcafd
--- /dev/null
+++ b/src/mame/layout/fidel_sc9.lay
@@ -0,0 +1,437 @@
+<?xml version="1.0"?>
+<mamelayout version="2">
+
+<!-- other than panel button mappings, layout is identical to vsc -->
+
+<!-- define elements -->
+
+ <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
+
+ <element name="led" defstate="0">
+ <disk state="1"><color red="1.0" green="0.1" blue="0.15" /></disk>
+ <disk state="0"><color red="0.1" green="0.01" blue="0.015" /></disk>
+ </element>
+
+ <element name="hl" defstate="0">
+ <text string=" ">
+ <bounds x="0.0" y="0.0" width="1.0" height="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <disk state="1">
+ <bounds x="0.12" y="0.12" width="0.76" height="0.76" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </disk>
+ </element>
+ <element name="hlb" defstate="0">
+ <text string=" ">
+ <bounds x="0.0" y="0.0" width="1.0" height="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <disk state="1">
+ <bounds x="0.0" y="0.0" width="1.0" height="1.0" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </disk>
+ </element>
+
+ <element name="black"><rect><color red="0.17" green="0.15" blue="0.15" /></rect></element>
+ <element name="white"><rect><color red="0.81" green="0.8" blue="0.79" /></rect></element>
+ <element name="disk_black"><disk><color red="0.17" green="0.15" blue="0.15" /></disk></element>
+ <element name="disk_white"><disk><color red="0.81" green="0.8" blue="0.79" /></disk></element>
+
+ <element name="text_1">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="1"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_2">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="2"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_3">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="3"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_4">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="4"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_5">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="5"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_6">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="6"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_7">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="7"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_8">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="8"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+
+ <element name="text_a">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="A"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_b">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="B"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_c">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="C"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_d">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="D"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_e">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="E"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_f">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="F"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_g">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="G"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+ <element name="text_h">
+ <rect><color red="0.81" green="0.8" blue="0.79" /></rect>
+ <text string="H"><color red="0.01" green="0.01" blue="0.01" /></text>
+ </element>
+
+ <element name="text_re">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="RE"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_cl">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="CL"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_pb">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="PB"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_pv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="PV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_lv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="LV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_tb">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="TB"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_dm">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="DM"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_rv">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="RV"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+
+ <element name="text_king">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2654;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_queen">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2655;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_rook">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2656;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_bishop">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2657;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_knight">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2658;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+ <element name="text_pion">
+ <disk><color red="0.81" green="0.8" blue="0.79" /></disk>
+ <text string="&#x2659;"><color red="0.17" green="0.15" blue="0.15" /></text>
+ </element>
+
+
+<!-- build screen -->
+
+ <view name="Internal Layout">
+ <bounds left="-2" right="100" top="-2" bottom="88" />
+ <bezel element="static_black">
+ <bounds left="-2" right="100" top="-2" bottom="88" />
+ </bezel>
+
+ <bezel element="white"><bounds x="-2.5" y="-2.5" width="103" height="90.5" /></bezel>
+
+ <!-- chessboard coords -->
+
+ <bezel element="text_8"><bounds x="-0.8" y="7" width="2" height="2" /></bezel>
+ <bezel element="text_7"><bounds x="-0.8" y="17" width="2" height="2" /></bezel>
+ <bezel element="text_6"><bounds x="-0.8" y="27" width="2" height="2" /></bezel>
+ <bezel element="text_5"><bounds x="-0.8" y="37" width="2" height="2" /></bezel>
+ <bezel element="text_4"><bounds x="-0.8" y="47" width="2" height="2" /></bezel>
+ <bezel element="text_3"><bounds x="-0.8" y="57" width="2" height="2" /></bezel>
+ <bezel element="text_2"><bounds x="-0.8" y="67" width="2" height="2" /></bezel>
+ <bezel element="text_1"><bounds x="-0.8" y="77" width="2" height="2" /></bezel>
+
+ <bezel element="text_a"><bounds x="7" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_b"><bounds x="17" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_c"><bounds x="27" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_d"><bounds x="37" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_e"><bounds x="47" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_f"><bounds x="57" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_g"><bounds x="67" y="85" width="2" height="2" /></bezel>
+ <bezel element="text_h"><bounds x="77" y="85" width="2" height="2" /></bezel>
+
+ <!-- chessboard bezel -->
+
+ <bezel element="black"><bounds x="2" y="2" width="82" height="82" /></bezel>
+ <bezel element="white"><bounds x="3" y="3" width="80" height="80" /></bezel>
+
+ <bezel element="black"><bounds x="13" y="2.5" width="10" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="33" y="2.5" width="10" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="53" y="2.5" width="10" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="73" y="2.5" width="10.5" height="10.5" /></bezel>
+
+ <bezel element="black"><bounds x="2.5" y="13" width="10.5" height="10" /></bezel>
+ <bezel element="black"><bounds x="23" y="13" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="43" y="13" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="63" y="13" width="10" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="13" y="23" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="33" y="23" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="53" y="23" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="73" y="23" width="10.5" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="2.5" y="33" width="10.5" height="10" /></bezel>
+ <bezel element="black"><bounds x="23" y="33" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="43" y="33" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="63" y="33" width="10" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="13" y="43" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="33" y="43" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="53" y="43" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="73" y="43" width="10.5" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="2.5" y="53" width="10.5" height="10" /></bezel>
+ <bezel element="black"><bounds x="23" y="53" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="43" y="53" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="63" y="53" width="10" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="13" y="63" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="33" y="63" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="53" y="63" width="10" height="10" /></bezel>
+ <bezel element="black"><bounds x="73" y="63" width="10.5" height="10" /></bezel>
+
+ <bezel element="black"><bounds x="2.5" y="73" width="10.5" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="23" y="73" width="10" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="43" y="73" width="10" height="10.5" /></bezel>
+ <bezel element="black"><bounds x="63" y="73" width="10" height="10.5" /></bezel>
+
+ <!-- chessboard leds -->
+
+ <bezel name="0.0" element="led"><bounds x="3.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.0" element="led"><bounds x="13.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.0" element="led"><bounds x="23.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.0" element="led"><bounds x="33.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.0" element="led"><bounds x="43.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.0" element="led"><bounds x="53.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.0" element="led"><bounds x="63.2" y="11.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.0" element="led"><bounds x="73.2" y="11.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.1" element="led"><bounds x="3.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.1" element="led"><bounds x="13.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.1" element="led"><bounds x="23.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.1" element="led"><bounds x="33.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.1" element="led"><bounds x="43.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.1" element="led"><bounds x="53.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.1" element="led"><bounds x="63.2" y="21.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.1" element="led"><bounds x="73.2" y="21.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.2" element="led"><bounds x="3.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.2" element="led"><bounds x="13.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.2" element="led"><bounds x="23.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.2" element="led"><bounds x="33.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.2" element="led"><bounds x="43.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.2" element="led"><bounds x="53.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.2" element="led"><bounds x="63.2" y="31.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.2" element="led"><bounds x="73.2" y="31.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.3" element="led"><bounds x="3.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.3" element="led"><bounds x="13.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.3" element="led"><bounds x="23.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.3" element="led"><bounds x="33.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.3" element="led"><bounds x="43.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.3" element="led"><bounds x="53.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.3" element="led"><bounds x="63.2" y="41.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.3" element="led"><bounds x="73.2" y="41.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.4" element="led"><bounds x="3.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.4" element="led"><bounds x="13.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.4" element="led"><bounds x="23.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.4" element="led"><bounds x="33.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.4" element="led"><bounds x="43.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.4" element="led"><bounds x="53.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.4" element="led"><bounds x="63.2" y="51.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.4" element="led"><bounds x="73.2" y="51.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.5" element="led"><bounds x="3.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.5" element="led"><bounds x="13.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.5" element="led"><bounds x="23.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.5" element="led"><bounds x="33.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.5" element="led"><bounds x="43.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.5" element="led"><bounds x="53.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.5" element="led"><bounds x="63.2" y="61.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.5" element="led"><bounds x="73.2" y="61.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.6" element="led"><bounds x="3.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.6" element="led"><bounds x="13.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.6" element="led"><bounds x="23.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.6" element="led"><bounds x="33.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.6" element="led"><bounds x="43.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.6" element="led"><bounds x="53.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.6" element="led"><bounds x="63.2" y="71.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.6" element="led"><bounds x="73.2" y="71.3" width="1.5" height="1.5" /></bezel>
+
+ <bezel name="0.7" element="led"><bounds x="3.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="1.7" element="led"><bounds x="13.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="2.7" element="led"><bounds x="23.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="3.7" element="led"><bounds x="33.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="4.7" element="led"><bounds x="43.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="5.7" element="led"><bounds x="53.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="6.7" element="led"><bounds x="63.2" y="81.3" width="1.5" height="1.5" /></bezel>
+ <bezel name="7.7" element="led"><bounds x="73.2" y="81.3" width="1.5" height="1.5" /></bezel>
+
+ <!-- chessboard sensors -->
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x80"><bounds x="3" y="3" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x80"><bounds x="13" y="3" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x80"><bounds x="23" y="3" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x80"><bounds x="33" y="3" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x80"><bounds x="43" y="3" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x80"><bounds x="53" y="3" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x80"><bounds x="63" y="3" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x80"><bounds x="73" y="3" width="10" height="10" /><color alpha="0.2" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x40"><bounds x="3" y="13" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x40"><bounds x="13" y="13" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x40"><bounds x="23" y="13" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x40"><bounds x="33" y="13" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x40"><bounds x="43" y="13" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x40"><bounds x="53" y="13" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x40"><bounds x="63" y="13" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x40"><bounds x="73" y="13" width="10" height="10" /><color alpha="0.4" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x20"><bounds x="3" y="23" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x20"><bounds x="13" y="23" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x20"><bounds x="23" y="23" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x20"><bounds x="33" y="23" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x20"><bounds x="43" y="23" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x20"><bounds x="53" y="23" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x20"><bounds x="63" y="23" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x20"><bounds x="73" y="23" width="10" height="10" /><color alpha="0.2" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x10"><bounds x="3" y="33" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x10"><bounds x="13" y="33" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x10"><bounds x="23" y="33" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x10"><bounds x="33" y="33" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x10"><bounds x="43" y="33" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x10"><bounds x="53" y="33" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x10"><bounds x="63" y="33" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x10"><bounds x="73" y="33" width="10" height="10" /><color alpha="0.4" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x08"><bounds x="3" y="43" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x08"><bounds x="13" y="43" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x08"><bounds x="23" y="43" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x08"><bounds x="33" y="43" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x08"><bounds x="43" y="43" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x08"><bounds x="53" y="43" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x08"><bounds x="63" y="43" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x08"><bounds x="73" y="43" width="10" height="10" /><color alpha="0.2" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x04"><bounds x="3" y="53" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x04"><bounds x="13" y="53" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x04"><bounds x="23" y="53" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x04"><bounds x="33" y="53" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x04"><bounds x="43" y="53" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x04"><bounds x="53" y="53" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x04"><bounds x="63" y="53" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x04"><bounds x="73" y="53" width="10" height="10" /><color alpha="0.4" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x02"><bounds x="3" y="63" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x02"><bounds x="13" y="63" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x02"><bounds x="23" y="63" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x02"><bounds x="33" y="63" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x02"><bounds x="43" y="63" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x02"><bounds x="53" y="63" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x02"><bounds x="63" y="63" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x02"><bounds x="73" y="63" width="10" height="10" /><color alpha="0.2" /></bezel>
+
+ <bezel element="hl" inputtag="IN.0" inputmask="0x01"><bounds x="3" y="73" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.1" inputmask="0x01"><bounds x="13" y="73" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.2" inputmask="0x01"><bounds x="23" y="73" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.3" inputmask="0x01"><bounds x="33" y="73" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.4" inputmask="0x01"><bounds x="43" y="73" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.5" inputmask="0x01"><bounds x="53" y="73" width="10" height="10" /><color alpha="0.4" /></bezel>
+ <bezel element="hl" inputtag="IN.6" inputmask="0x01"><bounds x="63" y="73" width="10" height="10" /><color alpha="0.2" /></bezel>
+ <bezel element="hl" inputtag="IN.7" inputmask="0x01"><bounds x="73" y="73" width="10" height="10" /><color alpha="0.4" /></bezel>
+
+ <!-- right side -->
+
+ <bezel name="8.7" element="led"><bounds x="91.95" y="7.25" width="1.5" height="1.5" /></bezel>
+
+ <bezel element="text_king"><bounds x="84.01" y="31.1" width="6" height="6" /></bezel>
+ <bezel element="text_queen"><bounds x="84.01" y="39.9" width="6" height="6" /></bezel>
+ <bezel element="text_bishop"><bounds x="84.01" y="48.7" width="6" height="6" /></bezel>
+ <bezel element="text_knight"><bounds x="84.01" y="57.5" width="6" height="6" /></bezel>
+ <bezel element="text_rook"><bounds x="84.01" y="66.3" width="6" height="6" /></bezel>
+ <bezel element="text_pion"><bounds x="84.01" y="75.1" width="6" height="6" /></bezel>
+
+ <bezel element="disk_black"><bounds x="89" y="13" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="21.8" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="30.6" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="39.4" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="48.2" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="57" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="65.8" width="7.4" height="7.4" /></bezel>
+ <bezel element="disk_black"><bounds x="89" y="74.6" width="7.4" height="7.4" /></bezel>
+
+ <bezel element="disk_white"><bounds x="89.7" y="13.7" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="22.5" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="31.3" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="40.1" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="48.9" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="57.7" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="66.5" width="6" height="6" /></bezel>
+ <bezel element="disk_white"><bounds x="89.7" y="75.3" width="6" height="6" /></bezel>
+
+ <bezel element="text_re"><bounds x="90.2" y="15.2" width="5" height="3" /></bezel>
+ <bezel element="text_cl"><bounds x="90.2" y="24" width="5" height="3" /></bezel>
+ <bezel element="text_pb"><bounds x="90.2" y="32.8" width="5" height="3" /></bezel>
+ <bezel element="text_pv"><bounds x="90.2" y="41.6" width="5" height="3" /></bezel>
+ <bezel element="text_lv"><bounds x="90.2" y="50.4" width="5" height="3" /></bezel>
+ <bezel element="text_tb"><bounds x="90.2" y="59.2" width="5" height="3" /></bezel>
+ <bezel element="text_dm"><bounds x="90.2" y="68" width="5" height="3" /></bezel>
+ <bezel element="text_rv"><bounds x="90.2" y="76.8" width="5" height="3" /></bezel>
+
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x80"><bounds x="89" y="13" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x40"><bounds x="89" y="21.8" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x20"><bounds x="89" y="30.6" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x10"><bounds x="89" y="39.4" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x08"><bounds x="89" y="48.2" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x04"><bounds x="89" y="57" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x02"><bounds x="89" y="65.8" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+ <bezel element="hlb" inputtag="IN.8" inputmask="0x01"><bounds x="89" y="74.6" width="7.4" height="7.4" /><color alpha="0.3" /></bezel>
+
+ </view>
+</mamelayout>
diff --git a/src/mame/layout/lantutor.lay b/src/mame/layout/lantutor.lay
index be16b9a8015..f5d0d9c1b03 100644
--- a/src/mame/layout/lantutor.lay
+++ b/src/mame/layout/lantutor.lay
@@ -10,8 +10,8 @@
</element>
<element name="triangle_mark" defstate="0">
- <text state="0" string="v"><color red="0.0235" green="0.1255" blue="0.1059" /></text>
- <text state="1" string="v"><color red="0.2" green="1.0" blue="0.85" /></text>
+ <text state="0" string="&#x25bc;"><color red="0.0235" green="0.1255" blue="0.1059" /></text>
+ <text state="1" string="&#x25bc;"><color red="0.2" green="1.0" blue="0.85" /></text>
</element>
diff --git a/src/mame/layout/spyhunttec.lay b/src/mame/layout/spyhunttec.lay
new file mode 100644
index 00000000000..f77457e680e
--- /dev/null
+++ b/src/mame/layout/spyhunttec.lay
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+<mamelayout version="2">
+
+ <element name="lamp_miss" defstate="0">
+ <text string="MISSILES" state="0">
+ <color red="0.3" green="0.1" blue="0.0" />
+ </text>
+ <text string="MISSILES" state="1">
+ <color red="1.0" green="0.4" blue="0.2" />
+ </text>
+ </element>
+
+ <element name="lamp_oil" defstate="0">
+ <text string="OIL SLICK" state="0">
+ <color red="0.3" green="0.0" blue="0.25" />
+ </text>
+ <text string="OIL SLICK" state="1">
+ <color red="1.0" green="0.2" blue="0.8" />
+ </text>
+ </element>
+
+ <element name="lamp_van" defstate="0">
+ <text string="WEAPONS VAN" state="0">
+ <color red="0.3" green="0.25" blue="0.0" />
+ </text>
+ <text string="WEAPONS VAN" state="1">
+ <color red="1.0" green="0.8" blue="0.2" />
+ </text>
+ </element>
+
+ <element name="lamp_smoke" defstate="0">
+ <text string="SMOKE SCREEN" state="0">
+ <color red="0.3" green="0.0" blue="0.25" />
+ </text>
+ <text string="SMOKE SCREEN" state="1">
+ <color red="1.0" green="0.2" blue="0.8" />
+ </text>
+ </element>
+
+ <element name="lamp_gun" defstate="0">
+ <text string="MACHINE GUNS" state="0">
+ <color red="0.3" green="0.1" blue="0.0" />
+ </text>
+ <text string="MACHINE GUNS" state="1">
+ <color red="1.0" green="0.4" blue="0.2" />
+ </text>
+ </element>
+
+
+ <element name="shifter" defstate="0">
+ <rect>
+ <bounds left="0" right="32" top="0" bottom="64" />
+ <color red="0.85" green="0.4" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="2" right="30" top="2" bottom="62" />
+ <color red="0.14" green="0.17" blue="0.2" />
+ </rect>
+ <rect>
+ <bounds left="14" right="18" top="15" bottom="49" />
+ <color red="0.44" green="0.47" blue="0.5" />
+ </rect>
+ <disk>
+ <bounds left="14" right="18" top="13" bottom="17" />
+ <color red="0.44" green="0.47" blue="0.5" />
+ </disk>
+ <disk>
+ <bounds left="14" right="18" top="47" bottom="51" />
+ <color red="0.44" green="0.47" blue="0.5" />
+ </disk>
+ <text string="LOW" state="0">
+ <bounds left="3" right="29" top="2" bottom="12" />
+ <color red="1.0" green="1.0" blue="0.4" />
+ </text>
+ <text string="LOW" state="1">
+ <bounds left="3" right="29" top="2" bottom="12" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </text>
+
+ <text string="HIGH" state="0">
+ <bounds left="3" right="29" top="52" bottom="62" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </text>
+ <text string="HIGH" state="1">
+ <bounds left="3" right="29" top="52" bottom="62" />
+ <color red="1.0" green="1.0" blue="0.4" />
+ </text>
+ <disk state="0">
+ <bounds left="9" right="23" top="14" bottom="28" />
+ <color red="0.85" green="0.4" blue="0.3" />
+ </disk>
+ <disk state="1">
+ <bounds left="9" right="23" top="36" bottom="50" />
+ <color red="0.85" green="0.4" blue="0.3" />
+ </disk>
+ </element>
+
+
+ <view name="Lamps + Shifter-R">
+ <screen index="0">
+ <bounds x="0" y="0" width="480" height="640" />
+ </screen>
+
+ <bezel name="lamp1" element="lamp_miss">
+ <bounds x="5" y="641" width="60" height="25" />
+ </bezel>
+ <bezel name="lamp0" element="lamp_oil">
+ <bounds x="72" y="641" width="59" height="25" />
+ </bezel>
+ <bezel name="lamp2" element="lamp_van">
+ <bounds x="172" y="641" width="85" height="25" />
+ </bezel>
+ <bezel name="lamp3" element="lamp_smoke">
+ <bounds x="295" y="641" width="93" height="25" />
+ </bezel>
+ <bezel name="lamp4" element="lamp_gun">
+ <bounds x="390" y="641" width="90" height="25" />
+ </bezel>
+
+ <bezel element="shifter" inputtag="IN2" inputmask="0x10">
+ <bounds x="446" y="574" width="32" height="64" />
+ <color alpha="0.6" />
+ </bezel>
+ </view>
+
+ <view name="Lamps + Shifter-L">
+ <screen index="0">
+ <bounds x="0" y="0" width="480" height="640" />
+ </screen>
+
+ <bezel name="lamp1" element="lamp_miss">
+ <bounds x="5" y="641" width="60" height="25" />
+ </bezel>
+ <bezel name="lamp0" element="lamp_oil">
+ <bounds x="72" y="641" width="59" height="25" />
+ </bezel>
+ <bezel name="lamp2" element="lamp_van">
+ <bounds x="172" y="641" width="85" height="25" />
+ </bezel>
+ <bezel name="lamp3" element="lamp_smoke">
+ <bounds x="295" y="641" width="93" height="25" />
+ </bezel>
+ <bezel name="lamp4" element="lamp_gun">
+ <bounds x="390" y="641" width="90" height="25" />
+ </bezel>
+
+ <bezel element="shifter" inputtag="IN2" inputmask="0x10">
+ <bounds x="2" y="574" width="32" height="64" />
+ <color alpha="0.6" />
+ </bezel>
+ </view>
+
+ <view name="Lamps">
+ <screen index="0">
+ <bounds x="0" y="0" width="480" height="640" />
+ </screen>
+
+ <bezel name="lamp1" element="lamp_miss">
+ <bounds x="5" y="641" width="60" height="25" />
+ </bezel>
+ <bezel name="lamp0" element="lamp_oil">
+ <bounds x="72" y="641" width="59" height="25" />
+ </bezel>
+ <bezel name="lamp2" element="lamp_van">
+ <bounds x="172" y="641" width="85" height="25" />
+ </bezel>
+ <bezel name="lamp3" element="lamp_smoke">
+ <bounds x="295" y="641" width="93" height="25" />
+ </bezel>
+ <bezel name="lamp4" element="lamp_gun">
+ <bounds x="390" y="641" width="90" height="25" />
+ </bezel>
+ </view>
+</mamelayout>
diff --git a/src/mame/layout/ti74.lay b/src/mame/layout/ti74.lay
index 16d6c1f55a0..24563b7dc8c 100644
--- a/src/mame/layout/ti74.lay
+++ b/src/mame/layout/ti74.lay
@@ -9,20 +9,20 @@
<element name="ind_left" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="&lt;" align="1" state="0">
+ <text string="&#x25c0;" align="1" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="&lt;" align="1" state="1">
+ <text string="&#x25c0;" align="1" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
<element name="ind_right" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="&gt;" align="2" state="0">
+ <text string="&#x25b6;" align="2" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="&gt;" align="2" state="1">
+ <text string="&#x25b6;" align="2" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
@@ -172,11 +172,11 @@
<!-- draw top row of lcd indicators -->
<bezel name="lamp10" element="ind_left">
- <bounds x="1.5" y="1" width="20" height="5" />
+ <bounds x="1.5" y="0" width="20" height="7" />
</bezel>
<bezel name="lamp4" element="ind_right">
- <bounds x="167.5" y="1" width="20" height="5" />
+ <bounds x="167.5" y="0" width="20" height="7" />
</bezel>
<bezel name="lamp11" element="ind_shift">
diff --git a/src/mame/layout/ti95.lay b/src/mame/layout/ti95.lay
index 6ee4cd6db55..7c70bda1e05 100644
--- a/src/mame/layout/ti95.lay
+++ b/src/mame/layout/ti95.lay
@@ -39,10 +39,10 @@
<element name="ind_left" defstate="0">
<rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect>
- <text string="&lt;" align="1" state="0">
+ <text string="&#x25c0;" align="1" state="0">
<color red="0.515" green="0.537" blue="0.548" />
</text>
- <text string="&lt;" align="1" state="1">
+ <text string="&#x25c0;" align="1" state="1">
<color red="0.361" green="0.326" blue="0.346" />
</text>
</element>
@@ -259,7 +259,7 @@
<bounds x="1" y="9" width="5" height="5" />
</bezel>
<bezel name="lamp71" element="ind_left">
- <bounds x="8" y="9" width="5" height="5" />
+ <bounds x="8" y="8" width="5" height="7" />
</bezel>
<!-- right: run, sys -->
diff --git a/src/mame/machine/awboard.cpp b/src/mame/machine/awboard.cpp
index 7ec0c5b6c3a..1a364d8a1a2 100644
--- a/src/mame/machine/awboard.cpp
+++ b/src/mame/machine/awboard.cpp
@@ -166,15 +166,16 @@ DEVICE_ADDRESS_MAP_START(submap, 16, aw_rom_board)
ADDRESS_MAP_END
aw_rom_board::aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : naomi_g1_device(mconfig, AW_ROM_BOARD, "Sammy Atomiswave ROM Board", tag, owner, clock, "aw_rom_board", __FILE__)
+ : naomi_g1_device(mconfig, AW_ROM_BOARD, "Sammy Atomiswave ROM Board", tag, owner, clock, "aw_rom_board", __FILE__),
+ m_region(*this, DEVICE_SELF),
+ m_keyregion(*this)
{
- keyregion = nullptr;
}
-void aw_rom_board::static_set_keyregion(device_t &device, const char *_keyregion)
+void aw_rom_board::static_set_keyregion(device_t &device, const char *keyregion)
{
aw_rom_board &dev = downcast<aw_rom_board &>(device);
- dev.keyregion = _keyregion;
+ dev.m_keyregion.set_tag(keyregion);
}
@@ -256,20 +257,13 @@ UINT16 aw_rom_board::decrypt(UINT16 cipherText, UINT32 address, const UINT32 key
void aw_rom_board::set_key()
{
- if(!m_region)
- throw emu_fatalerror("AW-ROM-BOARD: region %s is missing\n", tag());
-
- if(!keyregion)
- return;
-
- memory_region *kr = memregion(keyregion);
- if(!kr)
+ if (!m_keyregion.found())
return;
- if(kr->bytes() != 4)
- throw emu_fatalerror("AW-ROM-BOARD: key region %s has incorrect size (%d, expected 4)\n", keyregion, kr->bytes());
+ if (m_keyregion->bytes() != 4)
+ throw emu_fatalerror("AW-ROM-BOARD: key region %s has incorrect size (%d, expected 4)\n", m_keyregion.finder_tag(), m_keyregion->bytes());
- const UINT8 *krp = kr->base();
+ const UINT8 *krp = m_keyregion->base();
rombd_key = (krp[0] << 24) | (krp[1] << 16) | (krp[2] << 8) | krp[3];
}
@@ -307,7 +301,7 @@ READ16_MEMBER(aw_rom_board::pio_r)
UINT32 roffset = epr_offset & 0x3ffffff;
if (roffset >= (mpr_offset / 2))
roffset += mpr_bank * 0x4000000;
- UINT16 retval = (m_region->bytes() > roffset) ? m_region->u16(roffset) : 0;
+ UINT16 retval = (m_region->bytes() > roffset) ? m_region->u16(roffset) : 0; // not endian-safe?
return retval;
}
diff --git a/src/mame/machine/awboard.h b/src/mame/machine/awboard.h
index 4e531523856..5ae885079c1 100644
--- a/src/mame/machine/awboard.h
+++ b/src/mame/machine/awboard.h
@@ -7,14 +7,14 @@
#define MCFG_AW_ROM_BOARD_ADD(_tag, _keyregion, _irq_cb) \
MCFG_NAOMI_G1_ADD(_tag, AW_ROM_BOARD, _irq_cb) \
- aw_rom_board::static_set_keyregion(*device, _keyregion);
+ aw_rom_board::static_set_keyregion(*device, "^" _keyregion);
class aw_rom_board : public naomi_g1_device
{
public:
aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void static_set_keyregion(device_t &device, const char *_keyregion);
+ static void static_set_keyregion(device_t &device, const char *keyregion);
DECLARE_ADDRESS_MAP(submap, 16);
@@ -37,7 +37,8 @@ protected:
private:
enum { EPR, MPR_RECORD, MPR_FILE };
- const char *keyregion;
+ required_memory_region m_region;
+ optional_memory_region m_keyregion;
UINT32 rombd_key;
UINT32 mpr_offset, mpr_bank;
UINT32 epr_offset, mpr_file_offset;
diff --git a/src/mame/machine/dec_lk201.cpp b/src/mame/machine/dec_lk201.cpp
index 0643d46d38d..e8ebfc1bd6e 100644
--- a/src/mame/machine/dec_lk201.cpp
+++ b/src/mame/machine/dec_lk201.cpp
@@ -20,24 +20,24 @@
to => PORT 0 @ KBD controller.
________|D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0
-..KBD17:|[R] |F19 |[R] |F20|PF4|N- | N,| Enter
-........| | | | | | NOTE1)
+..KBD17:|[R] |F19 |[R] |F20|PF4|N- | N,| Enter (numpad)
+........| | | | | | NOTE1)
........| |G22 | |G23|E23|D23|C23| A23
--------|----|----|----|---|---|---|---|---
..KBD16:|F18 |PF3 |[R] |N9 |C:D|N6 |N3 |N.
........|G21 |E22 | |D22|B17|C22|B22|A22
--------|----|----|----|---|---|---|---|---
-..KBD15:|F17 |PF2 |[R] |N8 |N5 |C:R| N2|N0
-........| | | | | | | |NOTE 2)
-........|G20 |E21 | |D21|C21|B18|B21|
+..KBD15:|F17 |PF2 |[R] |N8 |N5 |C:R| N2|N0 (right)
+........| | | | | | | |see NOTE 2)
+........|G20 |E21 | |D21|C21|B18|B21|A21
--------|----|----|----|---|---|---|---|---
- KBD14:|PF1 |Next|Rem-|C:U|N7 |N4 |N1 |N0
-........| |Scrn|move|...| | | |
+ KBD14:|PF1 |Next|Rem-|C:U|N7 |N4 |N1 |N0 (left)
+........| |Scrn|move|...| | | |see NOTE 2)
........|E20 |D18 |E18 |C17|D20|C20|B20|A20
--------|----|----|----|---|---|---|---|---
-..KBD13:|Ins.|--- |'Do'|Prev { |" |[R]|[R]
-........|Here|- | Scrn| [ |' | |
-........|E17 |E11 |G16 |D17|D11|C11| |
+..KBD13:|Ins.|'_' |'Do'|Prev { |" |[R]|[R]
+........|Here|'-' | |Scrn [ |' | |
+........|E17 |E11 |G16 |D17|D11|C11|B13|A17
--------|----|----|----|---|---|---|---|---
..KBD12:|Find|+ |Help|Se-| } |Re-|C:L| |
........| |= | |lect ] |turn...| \
@@ -93,9 +93,10 @@ ________|D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0
[R] = Reserved
NOTE 1) N0-N9, N-, N. and N, refer to numeric keypad
NOTE 2) N0 can be divided into 2 keys.
- Normally only the N0 keyswitch is implemented as a double-sized key.
+ Normally only the N0 keyswitch is implemented as a double-sized key.
+ A21 = N0 (right); A20 = N0 (left)
NOTE 3) Return key occupies 2 positions that are
- decoded as the Return (C13) key.
+ decoded as the Return (C13) key. C13 = RETURN (bot.); D13 = RETURN (top)
C:D - Cursor down (B17)
C:U - Cursor up (C17)
diff --git a/src/mame/machine/decocass_tape.cpp b/src/mame/machine/decocass_tape.cpp
index 8b3f2785032..982cd9018aa 100644
--- a/src/mame/machine/decocass_tape.cpp
+++ b/src/mame/machine/decocass_tape.cpp
@@ -65,7 +65,8 @@ decocass_tape_device::decocass_tape_device(const machine_config &mconfig, const
m_region(REGION_LEADER),
m_bitnum(0),
m_clockpos(0),
- m_numclocks(0)
+ m_numclocks(0),
+ m_tape_data(*this, DEVICE_SELF)
{
for (auto & elem : m_crc16)
elem = 0;
@@ -91,13 +92,12 @@ void decocass_tape_device::device_start()
/* fetch the data pointer */
m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(decocass_tape_device::tape_clock_callback), this));
- if (region() == nullptr)
+ if (!m_tape_data.found())
return;
- UINT8 *regionbase = region()->base();
/* scan for the first non-empty block in the image */
- for (offs = region()->bytes() - 1; offs >= 0; offs--)
- if (regionbase[offs] != 0)
+ for (offs = m_tape_data.bytes() - 1; offs >= 0; offs--)
+ if (m_tape_data[offs] != 0)
break;
numblocks = ((offs | 0xff) + 1) / 256;
assert(numblocks < ARRAY_LENGTH(m_crc16));
@@ -113,7 +113,7 @@ void decocass_tape_device::device_start()
/* first CRC the 256 bytes of data */
for (offs = 256 * curblock; offs < 256 * curblock + 256; offs++)
- crc = tape_crc16_byte(crc, regionbase[offs]);
+ crc = tape_crc16_byte(crc, m_tape_data[offs]);
/* then find a pair of bytes that will bring the CRC to 0 (any better way than brute force?) */
for (testval = 0; testval < 0x10000; testval++)
@@ -292,7 +292,6 @@ TIMER_CALLBACK_MEMBER( decocass_tape_device::tape_clock_callback )
UINT8 decocass_tape_device::get_status_bits()
{
UINT8 tape_bits = 0;
- UINT8 *tape_data = region()->base();
/* bit 0x20 is the BOT/EOT signal, which is also set in the leader/trailer area */
if (m_region == REGION_LEADER || m_region == REGION_BOT || m_region == REGION_EOT || m_region == REGION_TRAILER)
@@ -325,7 +324,7 @@ UINT8 decocass_tape_device::get_status_bits()
/* data block bytes are data */
else if (m_bytenum >= BYTE_DATA_0 && m_bytenum <= BYTE_DATA_255)
- byteval = tape_data[blocknum * 256 + (m_bytenum - BYTE_DATA_0)];
+ byteval = m_tape_data[blocknum * 256 + (m_bytenum - BYTE_DATA_0)];
/* CRC MSB */
else if (m_bytenum == BYTE_CRC16_MSB)
@@ -350,7 +349,7 @@ UINT8 decocass_tape_device::get_status_bits()
UINT8 decocass_tape_device::is_present()
{
- return region() != nullptr;
+ return m_tape_data.found();
}
diff --git a/src/mame/machine/decocass_tape.h b/src/mame/machine/decocass_tape.h
index 0b4909f34bd..4d7f03ada4a 100644
--- a/src/mame/machine/decocass_tape.h
+++ b/src/mame/machine/decocass_tape.h
@@ -64,6 +64,7 @@ private:
UINT32 m_clockpos; /* the current clock position of the tape */
UINT32 m_numclocks; /* total number of clocks on the entire tape */
UINT16 m_crc16[256]; /* CRC16 for each block */
+ optional_region_ptr<UINT8> m_tape_data;
const char *describe_state();
TIMER_CALLBACK_MEMBER( tape_clock_callback );
diff --git a/src/mame/machine/fd1089.cpp b/src/mame/machine/fd1089.cpp
index 5f8df8b0b3d..f786bf29c2d 100644
--- a/src/mame/machine/fd1089.cpp
+++ b/src/mame/machine/fd1089.cpp
@@ -223,6 +223,8 @@ ADDRESS_MAP_END
fd1089_base_device::fd1089_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: m68000_device(mconfig, tag, owner, clock, shortname, source),
+ m_region(*this, DEVICE_SELF),
+ m_key(*this, "key"),
m_decrypted_opcodes(*this, ":fd1089_decrypted_opcodes")
{
// override the name after the m68000 initializes
@@ -251,18 +253,11 @@ void fd1089_base_device::device_start()
// start the base device
m68000_device::device_start();
- // find the key
- m_key = memregion("key")->base();
- if (m_key == nullptr)
- throw emu_fatalerror("FD1089 key region not found!");
-
// get a pointer to the ROM region
- UINT16 *rombase = reinterpret_cast<UINT16 *>(region()->base());
- if (rombase == nullptr)
- throw emu_fatalerror("FD1089 found no ROM data to decrypt!");
+ UINT16 *rombase = reinterpret_cast<UINT16 *>(m_region->base());
// determine length and resize our internal buffers
- UINT32 romsize = region()->bytes();
+ UINT32 romsize = m_region->bytes();
m_plaintext.resize(romsize/2);
// copy the plaintext
@@ -493,7 +488,7 @@ void fd1089_base_device::decrypt(offs_t baseaddr, UINT32 size, const UINT16 *src
for (offs_t offset = 0; offset < size; offset += 2)
{
UINT16 src = srcptr[offset / 2];
- opcodesptr[offset / 2] = decrypt_one(baseaddr + offset, src, m_key, true);
- dataptr[offset / 2] = decrypt_one(baseaddr + offset, src, m_key, false);
+ opcodesptr[offset / 2] = decrypt_one(baseaddr + offset, src, &m_key[0], true);
+ dataptr[offset / 2] = decrypt_one(baseaddr + offset, src, &m_key[0], false);
}
}
diff --git a/src/mame/machine/fd1089.h b/src/mame/machine/fd1089.h
index 71fcc361d7a..0bf37ba75b9 100644
--- a/src/mame/machine/fd1089.h
+++ b/src/mame/machine/fd1089.h
@@ -55,7 +55,8 @@ protected:
void decrypt(offs_t baseaddr, UINT32 size, const UINT16 *srcptr, UINT16 *opcodesptr, UINT16 *dataptr);
// internal state
- const UINT8 * m_key;
+ required_memory_region m_region;
+ required_region_ptr<UINT8> m_key;
std::vector<UINT16> m_plaintext;
required_shared_ptr<UINT16> m_decrypted_opcodes;
diff --git a/src/mame/machine/fd1094.cpp b/src/mame/machine/fd1094.cpp
index 9dc3009cd31..7616adcd0b9 100644
--- a/src/mame/machine/fd1094.cpp
+++ b/src/mame/machine/fd1094.cpp
@@ -558,9 +558,8 @@ fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, dev
m_state(0x00),
m_irqmode(false),
m_cache(*this),
- m_srcbase(nullptr),
- m_srcbytes(0),
- m_key(nullptr)
+ m_srcbase(*this, DEVICE_SELF),
+ m_key(*this, "key")
{
// override the name after the m68000 initializes
m_name.assign("FD1094");
@@ -634,35 +633,18 @@ void fd1094_device::change_state(int newstate)
void fd1094_device::device_start()
{
- // find the key
- m_key = memregion("key")->base();
- if (m_key == nullptr)
- throw emu_fatalerror("FD1094 key region not found!");
-
- // get a pointer to the ROM region
- if (region() != nullptr)
- {
- m_srcbase = reinterpret_cast<UINT16 *>(region()->base());
- m_srcbytes = region()->bytes();
- }
-
// if no ROM region, see if there's a memory share with our name
- else
+ if (!m_srcbase.found())
{
- memory_share *share = owner()->memshare(tag());
+ memory_share *share = memshare(DEVICE_SELF);
if (share != nullptr)
- {
- m_srcbase = reinterpret_cast<UINT16 *>(share->ptr());
- m_srcbytes = share->bytes();
- }
+ m_srcbase.set_target(reinterpret_cast<UINT16 *>(share->ptr()), share->bytes() / 2);
+ else
+ throw emu_fatalerror("FD1094 found no data to decrypt!");
}
- // if we got nothing, error
- if (m_srcbase == nullptr)
- throw emu_fatalerror("FD1094 found no data to decrypt!");
-
// determine length and configure our cache
- m_cache.configure(0x000000, m_srcbytes, 0x000000);
+ m_cache.configure(0x000000, m_srcbase.bytes(), 0x000000);
change_state(STATE_RESET);
// start the base device
@@ -907,7 +889,7 @@ UINT16 fd1094_device::decrypt_one(offs_t address, UINT16 val, const UINT8 *main_
void fd1094_device::decrypt(offs_t baseaddr, UINT32 size, const UINT16 *srcptr, UINT16 *opcodesptr, UINT8 state)
{
for (offs_t offset = 0; offset < size; offset += 2)
- opcodesptr[offset / 2] = decrypt_one((baseaddr + offset) / 2, srcptr[offset / 2], m_key, state, (baseaddr + offset) < 8);
+ opcodesptr[offset / 2] = decrypt_one((baseaddr + offset) / 2, srcptr[offset / 2], &m_key[0], state, (baseaddr + offset) < 8);
}
diff --git a/src/mame/machine/fd1094.h b/src/mame/machine/fd1094.h
index 737f3b81e1c..a72fc6f5df1 100644
--- a/src/mame/machine/fd1094.h
+++ b/src/mame/machine/fd1094.h
@@ -72,7 +72,7 @@ public:
fd1094_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// explicit decryption helpers
- void decrypt(offs_t baseaddr, UINT32 size, offs_t regionoffs, UINT16 *opcodesptr, UINT8 state) { decrypt(baseaddr, size, m_srcbase + regionoffs/2, opcodesptr, state); }
+ void decrypt(offs_t baseaddr, UINT32 size, offs_t regionoffs, UINT16 *opcodesptr, UINT8 state) { decrypt(baseaddr, size, &m_srcbase[regionoffs/2], opcodesptr, state); }
// live state management
UINT8 state() const { return m_irqmode ? m_key[0] : m_state; }
@@ -110,9 +110,8 @@ protected:
bool m_irqmode;
state_change_delegate m_state_change;
fd1094_decryption_cache m_cache;
- UINT16 * m_srcbase;
- UINT32 m_srcbytes;
- const UINT8 * m_key;
+ optional_region_ptr<UINT16> m_srcbase;
+ required_region_ptr<UINT8> m_key;
UINT8 m_masked_opcodes_lookup[2][65536/8/2];
// static tables
diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp
index a9653cf34ea..5d8dc40966b 100644
--- a/src/mame/machine/harddriv.cpp
+++ b/src/mame/machine/harddriv.cpp
@@ -41,8 +41,6 @@ void harddriv_state::device_start()
//atarigen_state::machine_start();
/* predetermine memory regions */
- m_sim_memory = (UINT16 *)memregion("user1")->base();
- m_sim_memory_size = memregion("user1")->bytes() / 2;
m_adsp_pgm_memory_word = (UINT16 *)(reinterpret_cast<UINT8 *>(m_adsp_pgm_memory.target()) + 1);
init_video();
@@ -74,14 +72,14 @@ void harddriv_state::device_reset()
if (m_ds3sdsp.found())
{
- m_ds3sdsp->load_boot_data(m_ds3sdsp->region()->base(), m_ds3sdsp_pgm_memory);
+ m_ds3sdsp->load_boot_data(m_ds3sdsp_region->base(), m_ds3sdsp_pgm_memory);
m_ds3sdsp_timer_en = 0;
m_ds3sdsp_internal_timer->adjust(attotime::never);
}
if (m_ds3xdsp.found())
{
- m_ds3xdsp->load_boot_data(m_ds3xdsp->region()->base(), m_ds3xdsp_pgm_memory);
+ m_ds3xdsp->load_boot_data(m_ds3xdsp_region->base(), m_ds3xdsp_pgm_memory);
m_ds3xdsp_timer_en = 0;
m_ds3xdsp_internal_timer->adjust(attotime::never);
}
@@ -760,7 +758,7 @@ READ16_MEMBER( harddriv_state::hdadsp_special_r )
switch (offset & 7)
{
case 0: /* /SIMBUF */
- if (m_adsp_eprom_base + m_adsp_sim_address < m_sim_memory_size)
+ if (m_adsp_eprom_base + m_adsp_sim_address < m_sim_memory.length())
return m_sim_memory[m_adsp_eprom_base + m_adsp_sim_address++];
else
return 0xff;
@@ -862,7 +860,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_ds3_control_w )
if (m_ds3sdsp.found())
{
m_ds3sdsp->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE);
- m_ds3sdsp->load_boot_data(m_ds3sdsp->region()->base(), m_ds3sdsp_pgm_memory);
+ m_ds3sdsp->load_boot_data(m_ds3sdsp_region->base(), m_ds3sdsp_pgm_memory);
if (val && !m_ds3_sreset)
{
@@ -882,7 +880,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_ds3_control_w )
if (m_ds3xdsp.found())
{
m_ds3xdsp->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE);
- m_ds3xdsp->load_boot_data(m_ds3xdsp->region()->base(), m_ds3xdsp_pgm_memory);
+ m_ds3xdsp->load_boot_data(m_ds3xdsp_region->base(), m_ds3xdsp_pgm_memory);
}
break;
@@ -1190,7 +1188,7 @@ WRITE16_MEMBER( harddriv_state::hdds3_sdsp_control_w )
if (data & 0x200)
{
UINT32 page = (data >> 6) & 7;
- m_ds3sdsp->load_boot_data(m_ds3sdsp->region()->base() + (0x2000 * page), m_ds3sdsp_pgm_memory);
+ m_ds3sdsp->load_boot_data(m_ds3sdsp_region->base() + (0x2000 * page), m_ds3sdsp_pgm_memory);
m_ds3sdsp->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
data &= ~0x200;
}
@@ -1374,7 +1372,7 @@ READ16_MEMBER( harddriv_state::hdds3_special_r )
case 6:
logerror("ADSP r @ %04x\n", m_ds3_sim_address);
- if (m_ds3_sim_address < m_sim_memory_size)
+ if (m_ds3_sim_address < m_sim_memory.length())
return m_sim_memory[m_ds3_sim_address];
else
return 0xff;
diff --git a/src/mame/machine/intv.cpp b/src/mame/machine/intv.cpp
index 391abbd4150..55915b00254 100644
--- a/src/mame/machine/intv.cpp
+++ b/src/mame/machine/intv.cpp
@@ -326,28 +326,6 @@ void intv_state::machine_reset()
void intv_state::machine_start()
{
- // TODO: split these for intvkbd & intvecs??
- for (int i = 0; i < 4; i++)
- {
- char str[8];
- sprintf(str, "KEYPAD%i", i + 1);
- m_keypad[i] = ioport(str);
- }
- for (int i = 0; i < 4; i++)
- {
- char str[6];
- sprintf(str, "DISC%i", i + 1);
- m_disc[i] = ioport(str);
- }
- for (int i = 0; i < 4; i++)
- {
- char str[7];
- sprintf(str, "DISCX%i", i + 1);
- m_discx[i] = ioport(str);
- sprintf(str, "DISCY%i", i + 1);
- m_discy[i] = ioport(str);
- }
-
save_item(NAME(m_bus_copy_mode));
save_item(NAME(m_backtab_row));
save_item(NAME(m_ram16));
@@ -459,74 +437,3 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
m_stic->screenrefresh();
}
-/* hand 0 == left, 1 == right, 2 == ECS hand controller 1, 3 == ECS hand controller 2 */
-UINT8 intv_state::intv_control_r(int hand)
-{
- static const UINT8 keypad_table[] =
- {
- 0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB,
- 0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E
- };
-
- static const UINT8 disc_table[] =
- {
- 0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE,
- 0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB
- };
-
- static const UINT8 discyx_table[5][5] =
- {
- { 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 },
- { 0xE7, 0xE3, 0xFB, 0xE9, 0xF9 },
- { 0xF7, 0xF7, 0xFF, 0xFD, 0xFD },
- { 0xF6, 0xE6, 0xFE, 0xEC, 0xED },
- { 0xE6, 0xEE, 0xFE, 0xFC, 0xEC }
- };
-
- int x, y;
- UINT8 rv = 0xFF;
-
- /* keypad */
- x = m_keypad[hand]->read();
- for (y = 0; y < 16; y++)
- {
- if (x & (1 << y))
- {
- rv &= keypad_table[y];
- }
- }
-
- switch ((m_io_options->read() >> hand) & 1)
- {
- case 0: /* disc == digital */
- default:
-
- x = m_disc[hand]->read();
- for (y = 0; y < 16; y++)
- {
- if (x & (1 << y))
- {
- rv &= disc_table[y];
- }
- }
- break;
-
- case 1: /* disc == _fake_ analog */
-
- x = m_discx[hand]->read();
- y = m_discy[hand]->read();
- rv &= discyx_table[y / 32][x / 32];
- }
-
- return rv;
-}
-
-READ8_MEMBER( intv_state::intv_left_control_r )
-{
- return intv_control_r(0);
-}
-
-READ8_MEMBER( intv_state::intv_right_control_r )
-{
- return intv_control_r(1);
-}
diff --git a/src/mame/machine/m1comm.cpp b/src/mame/machine/m1comm.cpp
index ceec0fc893b..acde86cc451 100644
--- a/src/mame/machine/m1comm.cpp
+++ b/src/mame/machine/m1comm.cpp
@@ -51,6 +51,8 @@ Notes:
JP8 - Jumper, set to 1-2 (selects CLOCK SOURCE)
*/
+#include "emu.h"
+#include "emuopts.h"
#include "machine/m1comm.h"
#define Z80_TAG "m1commcpu"
diff --git a/src/mame/machine/m1comm.h b/src/mame/machine/m1comm.h
index 56106dbe28f..366ad62a455 100644
--- a/src/mame/machine/m1comm.h
+++ b/src/mame/machine/m1comm.h
@@ -7,7 +7,6 @@
#define __M1COMM_SIMULATION__
-#include "emu.h"
#include "cpu/z80/z80.h"
#define MCFG_M1COMM_ADD(_tag ) \
diff --git a/src/mame/machine/m3comm.cpp b/src/mame/machine/m3comm.cpp
new file mode 100644
index 00000000000..34f9460796a
--- /dev/null
+++ b/src/mame/machine/m3comm.cpp
@@ -0,0 +1,437 @@
+// license:BSD-3-Clause
+// copyright-holders:MetalliC
+
+
+// Communication board used by Sega in Model3, NAOMI and Hikaru, uses mostly same design
+// interface to main board LATTICE ICs: Model3 - 315-5958, Hikaru - 315-5958A, NAOMI - 315-6194A
+
+
+// TODO:
+// does IRQ 2 correct ? or it fired at any IO reg write by host
+// IRQ 5 source (data frame exchange cycle start signal on MASTER), can be some timer or 'token acquired' event ?
+// how exactly comm RAM bank flipping works ?
+// Is there any IRQs can be fired to host systems ?
+// Implement NAOMI G1-DMA mode
+// find out and hook actual networking exchange, some sort of token ring ???
+
+/*
+
+MODEL3 COMMUNICATION BOARD
+837-11861 171-7053B
+SEGA 1995
+|---------------------------------------------------------------------------------------------------|
+| |
+| LATTICE NKK N341256SJ-20 NKK N341256SJ-20 NKK N341256SJ-20 40MHz |
+| PLSI 2032 JP3 JP1 |
+| (315-5958) JP4 NKK N341256SJ-20 NKK N341256SJ-20 NKK N341256SJ-20 |
+| JP2 |
+| |
+| PALCE16V8 |
+| 315-6075 68000FN12 315-5804 315-5917 315-5917 |
+| (QFP144) (QFP80) (QFP80) |
+| PALCE16V8 |
+| 315-6074 |
+| LEDx7 |
+|---------------------------------------------------------------------------------------------------|
+JP1: 1-2
+JP2: 2-3
+JP3: not shorted
+JP4: shorted
+
+
+HIKARU COMMUNICATION BOARD
+837-13404 171-7641B
+|-----------------------------------|
+| 40MHz LATTICE 315-5917 |
+| PLSI2032 |
+| (315-5958A) 315-5917|
+| PAL |
+| 62256 |
+| 315-5804 62256 |
+| 62256 |
+| 62256 |
+| 68000 PAL |
+| 62256 |
+| 62256 PAL |
+|-----------------------------------|
+Notes:
+ 62256 - 32k x8 SRAM
+
+
+NAOMI COMMUNICATION BOARD
+840-0001E
+837-13489 171-7704B
+SEGA 1998
+|--------------------------------------------------------------------|
+| CN1 CN3 |
+| 40MHz 256KbSRAM 315-5917 256KbSRAM 315-5917 256KbSRAM |
+| 256KbSRAM (QFP80) 256KbSRAM (QFP80) 256KbSRAM |
+| |
+| |
+| 315-5804 68000FN12 LATTICE |
+| (QFP144) M5-128/104 |
+| 12YC/1-15YI/1 |
+| (315-6194A) |
+| CN2 |
+|--------------------------------------------------------------------|
+
+*/
+
+
+#include "emu.h"
+#include "emuopts.h"
+#include "machine/m3comm.h"
+
+#define M68K_TAG "m3commcpu"
+
+//////// Model 3 (main CPU @ C00xxxxx) and Hikaru (MMctrl bank 0E) interface
+DEVICE_ADDRESS_MAP_START(m3_map, 32, m3comm_device)
+ AM_RANGE(0x0000000, 0x000ffff) AM_READWRITE8(m3_comm_ram_r, m3_comm_ram_w, 0xffffffff)
+ AM_RANGE(0x0010000, 0x00101ff) AM_READWRITE16(m3_ioregs_r, m3_ioregs_w, 0xffff0000)
+ AM_RANGE(0x0020000, 0x003ffff) AM_READWRITE16(m3_m68k_ram_r, m3_m68k_ram_w, 0xffff0000)
+ADDRESS_MAP_END
+
+
+/*************************************
+ * M3COMM Memory Map
+ *************************************/
+static ADDRESS_MAP_START( m3comm_mem, AS_PROGRAM, 16, m3comm_device )
+ AM_RANGE(0x0000000, 0x000ffff) AM_RAM AM_SHARE("m68k_ram")
+ AM_RANGE(0x0040000, 0x00400ff) AM_READWRITE(ctrl_r, ctrl_w)
+ AM_RANGE(0x0080000, 0x008ffff) AM_RAMBANK("comm_ram")
+ AM_RANGE(0x00C0000, 0x00C00ff) AM_READWRITE(ioregs_r, ioregs_w)
+ADDRESS_MAP_END
+
+
+MACHINE_CONFIG_FRAGMENT( m3comm )
+ MCFG_CPU_ADD(M68K_TAG, M68000, 10000000) // random
+ MCFG_CPU_PROGRAM_MAP(m3comm_mem)
+
+ MCFG_RAM_ADD(RAM_TAG)
+ MCFG_RAM_DEFAULT_SIZE("128K")
+MACHINE_CONFIG_END
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type M3COMM = &device_creator<m3comm_device>;
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor m3comm_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( m3comm );
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// m3comm_device - constructor
+//-------------------------------------------------
+
+m3comm_device::m3comm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, M3COMM, "MODEL-3 COMMUNICATION BD", tag, owner, clock, "m3comm", __FILE__),
+ m68k_ram(*this, "m68k_ram"),
+ m_commcpu(*this, M68K_TAG),
+ m_ram(*this, RAM_TAG),
+ m_line_rx(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE ),
+ m_line_tx(OPEN_FLAG_READ)
+{
+ // prepare localhost "filename"
+ m_localhost[0] = 0;
+ strcat(m_localhost, "socket.");
+ strcat(m_localhost, mconfig.options().comm_localhost());
+ strcat(m_localhost, ":");
+ strcat(m_localhost, mconfig.options().comm_localport());
+
+ // prepare remotehost "filename"
+ m_remotehost[0] = 0;
+ strcat(m_remotehost, "socket.");
+ strcat(m_remotehost, mconfig.options().comm_remotehost());
+ strcat(m_remotehost, ":");
+ strcat(m_remotehost, mconfig.options().comm_remoteport());
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void m3comm_device::device_start()
+{
+ timer = timer_alloc(TIMER_IRQ5);
+ timer->adjust(attotime::from_usec(10000));
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void m3comm_device::device_reset()
+{
+ naomi_control = 0xC000;
+ naomi_offset = 0;
+ m_status0 = 0;
+ m_status1 = 0;
+ m_commbank = 0;
+ membank("comm_ram")->set_base(m_ram->pointer());
+}
+
+void m3comm_device::device_reset_after_children()
+{
+ m_commcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+}
+
+/////////////
+
+UINT16 swapb16(UINT16 data)
+{
+ return (data << 8) | (data >> 8);
+}
+
+
+void m3comm_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if(id != TIMER_IRQ5)
+ return;
+
+ m_commcpu->set_input_line(M68K_IRQ_5, ASSERT_LINE);
+ timer.adjust(attotime::from_usec(10000)); // there is it from actually ??????
+}
+
+///////////// Internal MMIO
+
+READ16_MEMBER(m3comm_device::ctrl_r)
+{
+ switch (offset) {
+ case 0x00 / 2:
+ return m_commbank;
+ default:
+ logerror("M3COMM CtrlRead from %04x mask %04x unimplemented!\n", offset * 2, mem_mask);
+ return 0;
+ }
+}
+WRITE16_MEMBER(m3comm_device::ctrl_w)
+{
+ switch (offset) {
+ case 0x00 / 2: // Communication RAM bank switch (flipped in IRQ2 and IRQ5 handlers)
+ m_commbank = data;
+ membank("comm_ram")->set_base(m_ram->pointer() + ((m_commbank & 1) ? 0x10000 : 0));
+ break;
+ case 0x40 / 2: // IRQ 5 ACK
+ m_commcpu->set_input_line(M68K_IRQ_5, CLEAR_LINE);
+ break;
+ case 0xA0 / 2: // IRQ 2 ACK
+ m_commcpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
+ break;
+ case 0x80 / 2: // LEDs
+ case 0xC0 / 2: // possible node unique ID and broadcast flag (7FFF) ????
+ case 0xE0 / 2: // unknown, conditionally cleared in IRQ6 (receive complete) handler
+ break;
+ default:
+ logerror("M3COMM CtrlWrite to %04x %04x mask %04x\n", offset * 2, data, mem_mask);
+ }
+}
+
+READ16_MEMBER(m3comm_device::ioregs_r)
+{
+ switch (offset) {
+ case 0x00 / 2: // UNK, Model3 host wait it to be NZ then write 0
+ // perhaps Model3 IO regs 0-80 mapped not to M68K C0000-80 ?
+ return 1;
+ case 0x10 / 2: // receive result/status
+ return 5; // dbg random
+ case 0x18 / 2: // transmit result/status
+ return 5; // dbg random
+ case 0x88 / 2:
+ return m_status0;
+ case 0x8A / 2:
+ return m_status1;
+ default:
+ logerror("M3COMM IOread from %02x mask %04x\n", offset * 2, mem_mask);
+ return 0;
+ }
+}
+WRITE16_MEMBER(m3comm_device::ioregs_w)
+{
+ switch (offset) {
+ case 0x14 / 2: // written 80 at data receive enable, 0 then 1 at IRQ6 handler
+ if ((data & 0xFF) != 0x80)
+ m_commcpu->set_input_line(M68K_IRQ_6, CLEAR_LINE);
+ break; // it seems one of these ^v is IRQ6 ON/ACK, another is data transfer enable
+ case 0x16 / 2: // written 8C at data receive enable, 0 at IRQ6 handler
+ if ((data & 0xFF) == 0x8C) {
+ logerror("M3COMM Receive offs %04x size %04x\n", recv_offset, recv_size);
+/*
+ if (!m_line_rx.is_open())
+ {
+ logerror("M3COMM: listen on %s\n", m_localhost);
+ m_line_rx.open(m_localhost);
+ }
+ if (m_line_rx.is_open())
+ {
+ UINT8 *commram = (UINT8*)membank("comm_ram")->base();
+ m_line_rx.read(&commram[recv_offset], recv_size);
+ }
+*/
+ m_commcpu->set_input_line(M68K_IRQ_6, ASSERT_LINE); // debug hack
+ }
+ break;
+ case 0x1A / 2: // written 80 at data transmit enable, 0 at IRQ4 handler
+ break; // it seems one of these ^v is IRQ4 ON/ACK, another is data transfer enable
+ case 0x1C / 2: // written 8C at data transmit enable, 0 at IRQ4 handler
+ if ((data & 0xFF) == 0x8C) {
+ logerror("M3COMM Send offs %04x size %04x\n", send_offset, send_size);
+/*
+ if (!m_line_tx.is_open())
+ {
+ logerror("M3COMM: connect to %s\n", m_remotehost);
+ m_line_tx.open(m_remotehost);
+ }
+ if (m_line_tx.is_open())
+ {
+ UINT8 *commram = (UINT8*)membank("comm_ram")->base();
+ m_line_tx.write(&commram[send_offset], send_size);
+ }
+*/
+ }
+ m_commcpu->set_input_line(M68K_IRQ_4, ((data & 0xFF) == 0x8C) ? ASSERT_LINE : CLEAR_LINE); // debug hack
+ break;
+ case 0x40 / 2:
+ recv_offset = (recv_offset >> 8) | (data << 8);
+ break;
+ case 0x42 / 2:
+ recv_size = (recv_size >> 8) | (data << 8);
+ break;
+ case 0x44 / 2:
+ send_offset = (send_offset >> 8) | (data << 8);
+ break;
+ case 0x46 / 2:
+ send_size = (send_size >> 8) | (data << 8);
+ break;
+ case 0x88 / 2:
+ m_status0 = (m_status0 & ~mem_mask) | (data & mem_mask);
+ break;
+ case 0x8A / 2:
+ m_status1 = (m_status1 & ~mem_mask) | (data & mem_mask);
+ break;
+ case 0xC0 / 2:
+ m_commcpu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
+ break;
+ default:
+ logerror("M3COMM IOwrite to %02x %04x mask %04x\n", offset * 2, data, mem_mask);
+ return;
+ }
+}
+
+////////////// Model3 interface
+
+READ16_MEMBER(m3comm_device::m3_m68k_ram_r)
+{
+ UINT16 value = m68k_ram[offset]; // FIXME endian
+ return swapb16(value);
+}
+WRITE16_MEMBER(m3comm_device::m3_m68k_ram_w)
+{
+ m68k_ram[offset] = swapb16(data); // FIXME endian
+}
+READ8_MEMBER(m3comm_device::m3_comm_ram_r)
+{
+ UINT8 *commram = (UINT8*)membank("comm_ram")->base();
+ return commram[offset ^ 3];
+}
+WRITE8_MEMBER(m3comm_device::m3_comm_ram_w)
+{
+ UINT8 *commram = (UINT8*)membank("comm_ram")->base();
+ commram[offset ^ 3] = data;
+}
+READ16_MEMBER(m3comm_device::m3_ioregs_r)
+{
+ UINT16 value = ioregs_r(space, offset, swapb16(mem_mask));
+ return swapb16(value);
+}
+WRITE16_MEMBER(m3comm_device::m3_ioregs_w)
+{
+ UINT16 value = swapb16(data);
+ ioregs_w(space, offset, value, swapb16(mem_mask));
+
+ // guess, can be asserted at any reg write
+ if (offset == (0x88 / 2))
+ m_commcpu->set_input_line(M68K_IRQ_2, ASSERT_LINE);
+}
+
+////////////// NAOMI inerface
+
+READ16_MEMBER(m3comm_device::naomi_r)
+{
+ switch (offset)
+ {
+ case 0: // 5F7018
+ return naomi_control;
+ case 1: // 5F701C
+ return naomi_offset;
+ case 2: // 5F7020
+ {
+// logerror("M3COMM read @ %08x\n", (naomi_control << 16) | naomi_offset);
+ UINT16 value;
+ if (naomi_control & 1)
+ value = m68k_ram[naomi_offset / 2]; // FIXME endian
+ else {
+ UINT16 *commram = (UINT16*)membank("comm_ram")->base();
+
+ value = commram[naomi_offset / 2]; // FIXME endian
+ }
+ naomi_offset += 2;
+ return value;
+ }
+ case 3: // 5F7024
+ return m_status0;
+ case 4: // 5F7028
+ return m_status1;
+ default:
+ return 0;
+ }
+}
+WRITE16_MEMBER(m3comm_device::naomi_w)
+{
+ switch (offset)
+ {
+ case 0: // 5F7018
+ // bit 0: access RAM is 0 - communication RAM / 1 - M68K RAM
+ // bit 1: comm RAM bank ??? (not really used)
+ // bit 5: M68K Reset
+ // bit 6: ???
+ // bit 7: ???
+ // bit 14: G1 DMA bus master 0 - active / 1 - disabled
+ // bit 15: 0 - enable / 1 - disable this device ???
+// logerror("M3COMM control write %04x\n", data);
+ naomi_control = data;
+ m_commcpu->set_input_line(INPUT_LINE_RESET, (naomi_control & 0x20) ? CLEAR_LINE : ASSERT_LINE);
+ break;
+ case 1: // 5F701C
+ naomi_offset = data;
+ break;
+ case 2: // 5F7020
+// logerror("M3COMM write @ %08x %04x\n", (naomi_control << 16) | naomi_offset, data);
+ if (naomi_control & 1)
+ m68k_ram[naomi_offset / 2] = data; // FIXME endian
+ else {
+ UINT16 *commram = (UINT16*)membank("comm_ram")->base();
+ commram[naomi_offset / 2] = data; // FIXME endian
+ }
+ naomi_offset += 2;
+ break;
+ case 3: // 5F7024
+ m_status0 = data;
+ break;
+ case 4: // 5F7028
+ m_status1 = data;
+ break;
+ }
+}
diff --git a/src/mame/machine/m3comm.h b/src/mame/machine/m3comm.h
new file mode 100644
index 00000000000..6a9a77a4cc4
--- /dev/null
+++ b/src/mame/machine/m3comm.h
@@ -0,0 +1,82 @@
+// license:BSD-3-Clause
+// copyright-holders:MetalliC
+#pragma once
+
+#ifndef __M3COMM_H__
+#define __M3COMM_H__
+
+#include "machine/ram.h"
+#include "cpu/m68000/m68000.h"
+
+#define MCFG_M3COMM_ADD(_tag ) \
+ MCFG_DEVICE_ADD(_tag, M3COMM, 0)
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class m3comm_device : public device_t
+{
+public:
+ // construction/destruction
+ m3comm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+ required_shared_ptr<UINT16> m68k_ram;
+ required_device<m68000_device> m_commcpu;
+
+ DECLARE_ADDRESS_MAP(m3_map, 32);
+
+ DECLARE_READ16_MEMBER(ctrl_r);
+ DECLARE_WRITE16_MEMBER(ctrl_w);
+
+ DECLARE_READ16_MEMBER(ioregs_r);
+ DECLARE_WRITE16_MEMBER(ioregs_w);
+
+ DECLARE_READ16_MEMBER(m3_m68k_ram_r);
+ DECLARE_WRITE16_MEMBER(m3_m68k_ram_w);
+ DECLARE_READ8_MEMBER(m3_comm_ram_r);
+ DECLARE_WRITE8_MEMBER(m3_comm_ram_w);
+ DECLARE_READ16_MEMBER(m3_ioregs_r);
+ DECLARE_WRITE16_MEMBER(m3_ioregs_w);
+
+ DECLARE_READ16_MEMBER(naomi_r);
+ DECLARE_WRITE16_MEMBER(naomi_w);
+
+protected:
+ enum { TIMER_IRQ5 = 1 };
+
+ required_device<ram_device> m_ram;
+
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_reset_after_children() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+private:
+ UINT16 naomi_control;
+ UINT16 naomi_offset;
+ UINT16 m_status0;
+ UINT16 m_status1;
+ UINT16 m_commbank;
+
+ UINT16 recv_offset;
+ UINT16 recv_size;
+ UINT16 send_offset;
+ UINT16 send_size;
+
+
+ emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
+ emu_file m_line_tx; // tx line - is differential, simple serial and toslink
+ char m_localhost[256];
+ char m_remotehost[256];
+
+ emu_timer *timer;
+};
+
+// device type definition
+extern const device_type M3COMM;
+
+#endif /* __M3COMM_H__ */
diff --git a/src/mame/machine/mhavoc.cpp b/src/mame/machine/mhavoc.cpp
index 375517022ee..1596717c658 100644
--- a/src/mame/machine/mhavoc.cpp
+++ b/src/mame/machine/mhavoc.cpp
@@ -265,6 +265,9 @@ WRITE8_MEMBER(mhavoc_state::mhavoc_out_0_w)
m_gamma_xmtd = 0;
}
+ /* Bit 2 = Beta reset */
+ /* this is the unpopulated processor in the corner of the pcb farthest from the quad pokey, not used on shipping boards */
+
/* Bit 0 = Roller light (Blinks on fatal errors) */
output().set_led_value(0, data & 0x01);
}
diff --git a/src/mame/machine/model1.cpp b/src/mame/machine/model1.cpp
index 2f974d00a97..49a921dcef0 100644
--- a/src/mame/machine/model1.cpp
+++ b/src/mame/machine/model1.cpp
@@ -247,30 +247,36 @@ TGP_FUNCTION( model1_state::anglev )
next_fn();
}
-TGP_FUNCTION( model1_state::f11 )
-{
- float a = fifoin_pop_f();
- float b = fifoin_pop_f();
- float c = fifoin_pop_f();
- float d = fifoin_pop_f();
- float e = fifoin_pop_f();
- float f = fifoin_pop_f();
- float g = fifoin_pop_f();
- float h = fifoin_pop_f();
- float i = fifoin_pop_f();
- (void)a;
- (void)b;
- (void)c;
- (void)d;
- (void)e;
- (void)f;
- (void)g;
- (void)h;
- (void)i;
- logerror("TGP f11 %f, %f, %f, %f, %f, %f, %f, %f, %f (%x)\n", a, b, c, d, e, f, g, h, i, m_pushpc);
- fifoout_push_f(0);
- fifoout_push_f(0);
- fifoout_push_f(0);
+TGP_FUNCTION( model1_state::triangle_normal )
+{
+ float p1x = fifoin_pop_f();
+ float p1y = fifoin_pop_f();
+ float p1z = fifoin_pop_f();
+ float p2x = fifoin_pop_f();
+ float p2y = fifoin_pop_f();
+ float p2z = fifoin_pop_f();
+ float p3x = fifoin_pop_f();
+ float p3y = fifoin_pop_f();
+ float p3z = fifoin_pop_f();
+
+ float nx = (p1y-p2y)*(p3z-p2z) - (p3y-p2y)*(p1z-p2z);
+ float ny = (p1z-p2z)*(p3x-p2x) - (p3z-p2z)*(p1x-p2x);
+ float nz = (p1x-p2x)*(p3y-p2y) - (p3x-p2x)*(p1y-p2y);
+
+ float nn = sqrtf(nx*nx + ny*ny + nz*nz);
+ if(nn < 1e-3)
+ nn = 0;
+ else
+ nn = 1/nn;
+
+ nx *= nn;
+ ny *= nn;
+ nz *= nn;
+
+ logerror("TGP triangle_normal %f, %f, %f, %f, %f, %f, %f, %f, %f (%x)\n", p1x, p1y, p1z, p2x, p2y,p2z, p3x, p3y, p3z, m_pushpc);
+ fifoout_push_f(nx);
+ fifoout_push_f(ny);
+ fifoout_push_f(nz);
next_fn();
}
@@ -304,19 +310,25 @@ TGP_FUNCTION( model1_state::track_select )
next_fn();
}
-TGP_FUNCTION( model1_state::f14 )
+TGP_FUNCTION( model1_state::load_base )
{
m_tgp_vr_base[0] = fifoin_pop_f();
m_tgp_vr_base[1] = fifoin_pop_f();
m_tgp_vr_base[2] = fifoin_pop_f();
m_tgp_vr_base[3] = fifoin_pop_f();
+ logerror("TGP load_base %f, %f, %f, %f (%x)\n", m_tgp_vr_base[0], m_tgp_vr_base[1], m_tgp_vr_base[2], m_tgp_vr_base[3], m_pushpc);
next_fn();
}
-TGP_FUNCTION( model1_state::f15_swa )
+TGP_FUNCTION( model1_state::transpose )
{
- logerror("TGP f15_swa (%x)\n", m_pushpc);
+ logerror("TGP transpose (%x)\n", m_pushpc);
+
+ float t;
+ t = m_cmat[1]; m_cmat[1] = m_cmat[3]; m_cmat[3] = t;
+ t = m_cmat[2]; m_cmat[2] = m_cmat[6]; m_cmat[6] = t;
+ t = m_cmat[5]; m_cmat[5] = m_cmat[7]; m_cmat[7] = t;
next_fn();
}
@@ -371,6 +383,8 @@ TGP_FUNCTION( model1_state::matrix_trans )
float b = fifoin_pop_f();
float c = fifoin_pop_f();
+ logerror("TCP matrix_trans %f %f %f (%x)\n", a, b, c, m_pushpc);
+
m_cmat[ 9] += m_cmat[0]*a+m_cmat[3]*b+m_cmat[6]*c;
m_cmat[10] += m_cmat[1]*a+m_cmat[4]*b+m_cmat[7]*c;
m_cmat[11] += m_cmat[2]*a+m_cmat[5]*b+m_cmat[8]*c;
@@ -487,24 +501,74 @@ TGP_FUNCTION( model1_state::track_read_quad )
next_fn();
}
-TGP_FUNCTION( model1_state::f24_swa )
+TGP_FUNCTION( model1_state::intercept )
{
- float a = fifoin_pop_f();
- float b = fifoin_pop_f();
- float c = fifoin_pop_f();
- float d = fifoin_pop_f();
- float e = fifoin_pop_f();
- float f = fifoin_pop_f();
- UINT32 g = fifoin_pop();
- (void)a;
- (void)b;
- (void)c;
- (void)d;
- (void)e;
- (void)f;
- (void)g;
- logerror("TGP f24_swa %f, %f, %f, %f, %f, %f, %x (%x)\n", a, b, c, d, e, f, g, m_pushpc);
- fifoout_push_f(0);
+ const UINT32 *tgp_data = (const UINT32 *)memregion("user2")->base();
+
+ float x1 = fifoin_pop_f();
+ float y1 = fifoin_pop_f();
+ float z1 = fifoin_pop_f();
+ float x2 = fifoin_pop_f();
+ float y2 = fifoin_pop_f();
+ float z2 = fifoin_pop_f();
+ UINT32 idx = fifoin_pop();
+
+ logerror("TGP intercept %f, %f, %f, %f, %f, %f, %x (%x)\n", x1, y1, z1, x2, y2, z2, idx, m_pushpc);
+
+ float dx = x2-x1;
+ float dy = y2-y1;
+ float dz = z2-z1;
+
+ idx = tgp_data[0x10] + 2*idx;
+ UINT32 count = tgp_data[idx];
+ UINT32 adr = tgp_data[idx+1];
+ UINT32 ret = 1;
+
+ for(unsigned int j=0; j<count; j++) {
+ float point[4][3];
+ for(int pt=0; pt<4; pt++)
+ for(int dim=0; dim<3; dim++)
+ point[pt][dim] = u2f(tgp_data[adr++]);
+ float plane[4];
+ for(int dim=0; dim<4; dim++)
+ plane[dim] = u2f(tgp_data[adr++]);
+ adr++; // 0, 1 or 2...
+
+ float den = dx * plane[0] + dy * plane[1] + dz * plane[2];
+ if(den > -0.0001 && den < 0.0001)
+ continue;
+ float t = - (x1 * plane[0] + y1 * plane[1] + z1 * plane[2] + plane[3]) / den;
+ if(t < 0 || t > 1)
+ continue;
+
+ float ix = x1 + dx*t;
+ float iy = y1 + dy*t;
+ float iz = z1 + dz*t;
+
+ int cp = 0;
+ for(int pt=0; pt<4; pt++) {
+ int pt1 = (pt+1) & 3;
+ float p01x = point[pt1][0] - point[pt][0];
+ float p01y = point[pt1][1] - point[pt][1];
+ float p01z = point[pt1][2] - point[pt][2];
+ float p0ix = ix - point[pt][0];
+ float p0iy = iy - point[pt][1];
+ float p0iz = iz - point[pt][2];
+ float det = plane[0] * (p01y * p0iz - p01z * p0iy) + plane[1] * (p01z * p0ix - p01x * p0iz) + plane[2] * (p01x * p0iy - p01y * p0ix);
+ cp += det >= 0;
+ }
+ if(cp == 0 || cp == 4) {
+ m_tgp_int_px = ix;
+ m_tgp_int_py = iy;
+ m_tgp_int_pz = iz;
+ ret = 0;
+ adr -= 17;
+ break;
+ }
+ }
+
+ m_tgp_int_adr = adr;
+ fifoout_push(ret);
next_fn();
}
@@ -514,7 +578,6 @@ TGP_FUNCTION( model1_state::transform_point )
float y = fifoin_pop_f();
float z = fifoin_pop_f();
logerror("TGP transform_point %f, %f, %f (%x)\n", x, y, z, m_pushpc);
-
fifoout_push_f(m_cmat[0]*x+m_cmat[3]*y+m_cmat[6]*z+m_cmat[9]);
fifoout_push_f(m_cmat[1]*x+m_cmat[4]*y+m_cmat[7]*z+m_cmat[10]);
fifoout_push_f(m_cmat[2]*x+m_cmat[5]*y+m_cmat[8]*z+m_cmat[11]);
@@ -568,7 +631,7 @@ TGP_FUNCTION( model1_state::distance3 )
a -= d;
b -= e;
c -= f;
- fifoout_push_f((a*a+b*b+c*c)/sqrtf(a*a+b*b+c*c));
+ fifoout_push_f(sqrtf(a*a+b*b+c*c));
next_fn();
}
@@ -663,12 +726,9 @@ TGP_FUNCTION( model1_state::xyz2rqf )
float b = fifoin_pop_f();
float c = fifoin_pop_f();
float norm;
- (void)a;
- (void)b;
- (void)c;
logerror("TGP xyz2rqf %f, %f, %f (%x)\n", a, b, c, m_pushpc);
- fifoout_push_f((a*a+b*b+c*c)/sqrtf(a*a+b*b+c*c));
- norm = sqrt(a*a+c*c);
+ fifoout_push_f(sqrtf(a*a+b*b+c*c));
+ norm = sqrtf(a*a+c*c);
if(!c) {
if(a>=0)
fifoout_push(0);
@@ -732,14 +792,18 @@ TGP_FUNCTION( model1_state::f43_swa )
next_fn();
}
-TGP_FUNCTION( model1_state::f44 )
+TGP_FUNCTION( model1_state::track_read_tri )
{
- float a = fifoin_pop_f();
- (void)a;
- logerror("TGP f44 %f (%x)\n", a, m_pushpc);
- fifoout_push_f(0);
- fifoout_push_f(0);
- fifoout_push_f(0);
+ const UINT32 *tgp_data = (const UINT32 *)memregion("user2")->base();
+ UINT32 a = fifoin_pop();
+ int offd;
+
+ logerror("TGP track_read_tri %d (%x)\n", a, m_pushpc);
+
+ offd = tgp_data[0x20+m_tgp_vr_select] + 16*a;
+ fifoout_push(tgp_data[offd+12]);
+ fifoout_push(tgp_data[offd+13]);
+ fifoout_push(tgp_data[offd+14]);
next_fn();
}
@@ -748,7 +812,7 @@ TGP_FUNCTION( model1_state::matrix_sdir )
float a = fifoin_pop_f();
float b = fifoin_pop_f();
float c = fifoin_pop_f();
- float norm = sqrt(a*a+b*b+c*c);
+ float norm = sqrtf(a*a+b*b+c*c);
float t[9], m[9];
logerror("TGP matrix_sdir %f, %f, %f (%x)\n", a, b, c, m_pushpc);
@@ -764,7 +828,7 @@ TGP_FUNCTION( model1_state::matrix_sdir )
t[1] = b / norm;
t[2] = a / norm;
- norm = sqrt(a*a+c*c);
+ norm = sqrtf(a*a+c*c);
t[6] = a/norm;
t[7] = 0;
t[8] = c/norm;
@@ -772,7 +836,7 @@ TGP_FUNCTION( model1_state::matrix_sdir )
t[3] = -b*c;
t[4] = a*a+c*c;
t[5] = -b*a;
- norm = sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);
+ norm = sqrtf(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);
t[3] /= norm;
t[4] /= norm;
t[5] /= norm;
@@ -793,27 +857,25 @@ TGP_FUNCTION( model1_state::matrix_sdir )
next_fn();
}
-TGP_FUNCTION( model1_state::f45 )
+TGP_FUNCTION( model1_state::fsqrt )
{
float a = fifoin_pop_f();
- (void)a;
- logerror("TGP f45 %f (%x)\n", a, m_pushpc);
- fifoout_push_f(0);
+ logerror("TGP fsqrt %f (%x)\n", a, m_pushpc);
+ fifoout_push_f(sqrtf(a));
next_fn();
}
TGP_FUNCTION( model1_state::vlength )
{
- float a = fifoin_pop_f() - m_tgp_vr_base[0];
- float b = fifoin_pop_f() - m_tgp_vr_base[1];
- float c = fifoin_pop_f() - m_tgp_vr_base[2];
- logerror("TGP vlength %f, %f, %f (%x)\n", a, b, c, m_pushpc);
+ float x = fifoin_pop_f();
+ float y = fifoin_pop_f();
+ float z = fifoin_pop_f();
+ logerror("TGP vlength %f, %f, %f (%x)\n", x, y, z, m_pushpc);
- a = (a*a+b*b+c*c);
- b = 1/sqrt(a);
- c = a * b;
- c -= m_tgp_vr_base[3];
- fifoout_push_f(c);
+ x -= m_tgp_vr_base[0];
+ y -= m_tgp_vr_base[1];
+ z -= m_tgp_vr_base[2];
+ fifoout_push_f(sqrtf(x*x + y*y + z*z) - m_tgp_vr_base[3]);
next_fn();
}
@@ -931,7 +993,7 @@ TGP_FUNCTION( model1_state::matrix_rdir )
float a = fifoin_pop_f();
float b = fifoin_pop_f();
float c = fifoin_pop_f();
- float norm = sqrt(a*a+c*c);
+ float norm = sqrtf(a*a+c*c);
float t1, t2;
(void)b;
@@ -1055,12 +1117,13 @@ TGP_FUNCTION( model1_state::f56 )
next_fn();
}
-TGP_FUNCTION( model1_state::f57 )
+TGP_FUNCTION( model1_state::int_normal )
{
- logerror("TGP f57 (%x)\n", m_pushpc);
- fifoout_push_f(0);
- fifoout_push_f(0);
- fifoout_push_f(0);
+ const UINT32 *tgp_data = (const UINT32 *)memregion("user2")->base();
+ logerror("TGP int_normal (%x)\n", m_pushpc);
+ fifoout_push_f(u2f(tgp_data[m_tgp_int_adr+12]));
+ fifoout_push_f(u2f(tgp_data[m_tgp_int_adr+13]));
+ fifoout_push_f(u2f(tgp_data[m_tgp_int_adr+14]));
next_fn();
}
@@ -1080,12 +1143,12 @@ TGP_FUNCTION( model1_state::acc_geti )
next_fn();
}
-TGP_FUNCTION( model1_state::f60 )
+TGP_FUNCTION( model1_state::int_point )
{
- logerror("TGP f60 (%x)\n", m_pushpc);
- fifoout_push_f(0);
- fifoout_push_f(0);
- fifoout_push_f(0);
+ logerror("TGP int_point (%x)\n", m_pushpc);
+ fifoout_push_f(m_tgp_int_px);
+ fifoout_push_f(m_tgp_int_py);
+ fifoout_push_f(m_tgp_int_pz);
next_fn();
}
@@ -1109,7 +1172,7 @@ TGP_FUNCTION( model1_state::col_testpt )
logerror("TGP col_testpt %f, %f (%x)\n", a, b, m_pushpc);
x = a - m_tgp_vr_circx;
y = b - m_tgp_vr_circy;
- fifoout_push_f(((x*x+y*y)/sqrtf(x*x+y*y)) - m_tgp_vr_circrad);
+ fifoout_push_f(sqrtf(x*x+y*y) - m_tgp_vr_circrad);
next_fn();
}
@@ -1170,7 +1233,7 @@ TGP_FUNCTION( model1_state::distance )
logerror("TGP distance (%f, %f), (%f, %f) (%x)\n", a, b, c, d, m_pushpc);
c -= a;
d -= b;
- fifoout_push_f((c*c+d*d)/sqrtf(c*c+d*d));
+ fifoout_push_f(sqrtf(c*c+d*d));
next_fn();
}
@@ -1233,7 +1296,7 @@ TGP_FUNCTION( model1_state::cpa )
dv_z = (i-k)*(1-dt) + (j-l)*dt;
dv2 = dv_x*dv_x + dv_y*dv_y + dv_z*dv_z;
- fifoout_push_f(sqrt(dv2));
+ fifoout_push_f(sqrtf(dv2));
next_fn();
}
@@ -1581,110 +1644,111 @@ TGP_FUNCTION( model1_state::f103 )
next_fn();
}
+// Addresses in daytona's TGP program
const struct model1_state::function model1_state::ftab_vf[] = {
- { &model1_state::fadd, 2 }, /* 0x00 */
- { &model1_state::fsub, 2 },
- { &model1_state::fmul, 2 },
- { &model1_state::fdiv, 2 },
- { nullptr, 0 },
- { &model1_state::matrix_push, 0 },
- { &model1_state::matrix_pop, 0 },
- { &model1_state::matrix_write, 12 },
- { &model1_state::clear_stack, 0 },
- { nullptr, 0 },
- { &model1_state::anglev, 2 },
- { nullptr, 0 },
- { nullptr, 0 },
- { &model1_state::track_select, 1 },
- { &model1_state::f14, 4 },
- { &model1_state::anglep, 4 },
-
- { &model1_state::matrix_ident, 0 }, /* 0x10 */
- { &model1_state::matrix_read, 0 },
- { &model1_state::matrix_trans, 3 },
- { &model1_state::matrix_scale, 3 },
- { &model1_state::matrix_rotx, 1 },
- { &model1_state::matrix_roty, 1 },
- { &model1_state::matrix_rotz, 1 },
- { nullptr, 0 },
- { &model1_state::track_read_quad, 1 },
- { nullptr, 0 },
- { &model1_state::transform_point, 3 },
- { &model1_state::fsin_m1, 1 },
- { &model1_state::fcos_m1, 1 },
- { &model1_state::fsinm_m1, 2 },
- { &model1_state::fcosm_m1, 2 },
- { &model1_state::distance3, 6 },
-
- { nullptr, 0 }, /* 0x20 */
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { &model1_state::acc_set, 1 },
- { &model1_state::acc_get, 0 },
- { &model1_state::acc_add, 1 },
- { &model1_state::acc_sub, 1 },
- { &model1_state::acc_mul, 1 },
- { &model1_state::acc_div, 1 }, // not used ?
- { &model1_state::f42, 3 },
- { &model1_state::f43, 6 },
- { &model1_state::f44, 1 },
- { &model1_state::f45, 1 },
- { &model1_state::vlength, 3 },
- { nullptr, 0 },
-
- { &model1_state::track_read_info, 1 }, /* 0x30 */
- { &model1_state::colbox_set, 12 },
- { &model1_state::colbox_test, 3 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { &model1_state::track_lookup, 4 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
-
- { &model1_state::col_setcirc, 3 }, /* 0x40 */
- { &model1_state::col_testpt, 2 },
- { nullptr, 0 },
- { &model1_state::distance, 4 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { &model1_state::car_move, 4 },
- { &model1_state::cpa, 12 },
- { nullptr, 0 },
+ { &model1_state::fadd, 2 }, /* 0x00 */ // 0b5
+ { &model1_state::fsub, 2 }, // 0ba
+ { &model1_state::fmul, 2 }, // 0bf
+ { &model1_state::fdiv, 2 }, // 0c4
+ { nullptr, 0 }, // 0d2
+ { &model1_state::matrix_push, 0 }, // 0e3
+ { &model1_state::matrix_pop, 0 }, // 0f7
+ { &model1_state::matrix_write, 12 }, // 106
+ { &model1_state::clear_stack, 0 }, // 10a
+ { &model1_state::matrix_mul, 12 }, // 10e
+ { &model1_state::anglev, 2 }, // 154
+ { nullptr, 0 }, // 15d
+ { nullptr, 0 }, // 19f
+ { &model1_state::track_select, 1 }, // 1b8
+ { &model1_state::load_base, 4 }, // 1bb
+ { &model1_state::anglep, 4 }, // 1c1
+
+ { &model1_state::matrix_ident, 0 }, /* 0x10 */ // 1d2
+ { &model1_state::matrix_read, 0 }, // 1d9
+ { &model1_state::matrix_trans, 3 }, // 1dd
+ { &model1_state::matrix_scale, 3 }, // 1f3
+ { &model1_state::matrix_rotx, 1 }, // 20a
+ { &model1_state::matrix_roty, 1 }, // 223
+ { &model1_state::matrix_rotz, 1 }, // 23b
+ { nullptr, 0 }, // 253
+ { &model1_state::track_read_quad, 1 }, // 2aa
+ { nullptr, 0 }, // 2b0
+ { &model1_state::transform_point, 3 }, // 2b2
+ { &model1_state::fsin_m1, 1 }, // 2cb
+ { &model1_state::fcos_m1, 1 }, // 2ce
+ { &model1_state::fsinm_m1, 2 }, // 2d1
+ { &model1_state::fcosm_m1, 2 }, // 2d7
+ { &model1_state::distance3, 6 }, // 2dd
+
+ { nullptr, 0 }, /* 0x20 */ // 2ff
+ { nullptr, 0 }, // 2ff
+ { nullptr, 0 }, // 300
+ { nullptr, 0 }, // 304
+ { &model1_state::acc_set, 1 }, // 308
+ { &model1_state::acc_get, 0 }, // 30a
+ { &model1_state::acc_add, 1 }, // 30c
+ { &model1_state::acc_sub, 1 }, // 311
+ { &model1_state::acc_mul, 1 }, // 316
+ { &model1_state::acc_div, 1 }, // 31b
+ { &model1_state::f42, 3 }, // 329
+ { &model1_state::f43, 6 }, // 36c
+ { &model1_state::track_read_tri, 1 }, // 3c2
+ { &model1_state::fsqrt, 1 }, // 3c7
+ { &model1_state::vlength, 3 }, // 3cf
+ { nullptr, 0 }, // 3ef
+
+ { &model1_state::track_read_info, 1 }, /* 0x30 */ // 410
+ { &model1_state::colbox_set, 12 }, // 413
+ { &model1_state::colbox_test, 3 }, // 417
+ { nullptr, 0 }, // 43b
+ { nullptr, 0 }, // 44d
+ { nullptr, 0 }, // 452
+ { &model1_state::track_lookup, 4 }, // 457
+ { nullptr, 0 }, // 51a
+ { nullptr, 0 }, // 521
+ { nullptr, 0 }, // 52f
+ { nullptr, 0 }, // 53d
+ { nullptr, 0 }, // 545
+ { nullptr, 0 }, // 558
+ { nullptr, 0 }, // 559
+ { nullptr, 0 }, // 5c6
+ { nullptr, 0 }, // 5e9
+
+ { &model1_state::col_setcirc, 3 }, /* 0x40 */ // 5f3
+ { &model1_state::col_testpt, 2 }, // 5fa
+ { nullptr, 0 }, // 615
+ { &model1_state::distance, 4 }, // 631
+ { nullptr, 0 }, // 63f
+ { nullptr, 0 }, // 643
+ { nullptr, 0 }, // 64b
+ { &model1_state::car_move, 4 }, // 661
+ { &model1_state::cpa, 12 }, // 7d9
+ { nullptr, 0 },
{ &model1_state::vmat_store, 1 },
{ &model1_state::vmat_restore, 1 },
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::vmat_mul, 2 },
{ &model1_state::vmat_read, 1 },
{ &model1_state::matrix_unrot, 0 },
- { &model1_state::f80, 0 }, /* 0x50 */
- { nullptr, 0 },
+ { &model1_state::f80, 0 }, /* 0x50 */
+ { nullptr, 0 },
{ &model1_state::matrix_rtrans, 0 },
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::vmat_save, 1 },
{ &model1_state::vmat_load, 1 },
{ &model1_state::ram_setadr, 1 },
{ &model1_state::groundbox_test, 3 },
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::f89, 4 },
- { nullptr, 0 },
- { nullptr, 0 },
+ { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::f92, 4 },
{ &model1_state::f93, 1 },
{ &model1_state::f94, 1 },
{ &model1_state::vmat_flatten, 0 },
- { &model1_state::vmat_load1, 1 }, /* 0x60 */
+ { &model1_state::vmat_load1, 1 }, /* 0x60 */
{ &model1_state::ram_trans, 0 },
{ &model1_state::f98, 1 },
{ &model1_state::f99, 0 },
@@ -1695,27 +1759,25 @@ const struct model1_state::function model1_state::ftab_vf[] = {
};
// Used in swa scene 1 and unemulated:
-// f14
// f49_swa
-// f15_swa
const struct model1_state::function model1_state::ftab_swa[] = {
{ &model1_state::fadd, 2 }, /* 0x00 */
{ &model1_state::fsub, 2 },
{ &model1_state::fmul, 2 },
{ &model1_state::fdiv, 2 },
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::matrix_push, 0 },
{ &model1_state::matrix_pop, 0 },
{ &model1_state::matrix_write, 12 },
{ &model1_state::clear_stack, 0 },
{ &model1_state::matrix_mul, 12 },
{ &model1_state::anglev, 2 },
- { &model1_state::f11, 9 },
+ { &model1_state::triangle_normal, 9 },
{ &model1_state::normalize, 3 },
{ &model1_state::acc_seti, 1 },
- { &model1_state::f14, 4 },
- { &model1_state::f15_swa, 0 },
+ { &model1_state::load_base, 4 },
+ { &model1_state::transpose, 0 },
{ &model1_state::matrix_ident, 0 }, /* 0x10 */
{ &model1_state::matrix_read, 0 },
@@ -1724,9 +1786,9 @@ const struct model1_state::function model1_state::ftab_swa[] = {
{ &model1_state::matrix_rotx, 1 },
{ &model1_state::matrix_roty, 1 },
{ &model1_state::matrix_rotz, 1 },
- { nullptr, 0 },
- { &model1_state::f24_swa, 7 },
- { nullptr, 0 },
+ { nullptr, 0 },
+ { &model1_state::intercept, 7 },
+ { nullptr, 0 },
{ &model1_state::transform_point, 3 },
{ &model1_state::fsin_m1, 1 },
{ &model1_state::fcos_m1, 1 },
@@ -1734,8 +1796,8 @@ const struct model1_state::function model1_state::ftab_swa[] = {
{ &model1_state::fcosm_m1, 2 },
{ &model1_state::distance3, 6 },
- { nullptr, 0 }, /* 0x20 */
- { nullptr, 0 },
+ { nullptr, 0 }, /* 0x20 */
+ { nullptr, 0 },
{ &model1_state::ftoi, 1 },
{ &model1_state::itof, 1 },
{ &model1_state::acc_set, 1 },
@@ -1747,30 +1809,30 @@ const struct model1_state::function model1_state::ftab_swa[] = {
{ &model1_state::xyz2rqf, 3 },
{ &model1_state::f43_swa, 3 },
{ &model1_state::matrix_sdir, 3 },
- { &model1_state::f45, 1 },
+ { &model1_state::fsqrt, 1 },
{ &model1_state::vlength, 3 },
{ &model1_state::f47, 3 },
- { nullptr, 0 }, /* 0x30 */
+ { nullptr, 0 }, /* 0x30 */
{ &model1_state::f49_swa, 6 },
{ &model1_state::f50_swa, 4 },
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::f52, 0 },
{ &model1_state::matrix_rdir, 3 },
- { nullptr, 0 },
- { nullptr, 0 },
+ { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::f56, 7 },
- { &model1_state::f57, 0 },
+ { &model1_state::int_normal, 0 },
{ &model1_state::matrix_readt, 0 },
{ &model1_state::acc_geti, 0 },
- { &model1_state::f60, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
- { nullptr, 0 },
+ { &model1_state::int_point, 0 },
+ { nullptr, 0 },
+ { nullptr, 0 },
+ { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::push_and_ident, 0 }, /* 0x40 */
- { nullptr, 0 },
+ { nullptr, 0 },
{ &model1_state::catmull_rom, 13 }
};
diff --git a/src/mame/machine/naomibd.cpp b/src/mame/machine/naomibd.cpp
index 704c357d70f..f90c3d35077 100644
--- a/src/mame/machine/naomibd.cpp
+++ b/src/mame/machine/naomibd.cpp
@@ -3,7 +3,6 @@
#include "emu.h"
#include "naomibd.h"
-#include "machine/x76f100.h"
/*
Naomi ROM board info from ElSemi:
@@ -91,8 +90,8 @@ void naomi_board::device_start()
save_item(NAME(pio_ready));
save_item(NAME(dma_ready));
- if(eeprom_tag)
- eeprom = machine().device<x76f100_device>(eeprom_tag);
+ if (eeprom_tag != nullptr)
+ eeprom = owner()->subdevice<x76f100_device>(eeprom_tag);
else
eeprom = nullptr;
}
diff --git a/src/mame/machine/naomibd.h b/src/mame/machine/naomibd.h
index 1b4d2b705c0..8f0c07d3c09 100644
--- a/src/mame/machine/naomibd.h
+++ b/src/mame/machine/naomibd.h
@@ -4,6 +4,7 @@
#define _NAOMIBD_H_
#include "machine/naomig1.h"
+#include "machine/x76f100.h"
#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _actel_tag, _irq_cb) \
MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb) \
@@ -55,7 +56,7 @@ private:
bool pio_ready, dma_ready;
const char *eeprom_tag;
- class x76f100_device *eeprom;
+ x76f100_device *eeprom;
};
#endif
diff --git a/src/mame/machine/naomigd.h b/src/mame/machine/naomigd.h
index 6f9e434ec13..84a3225abb0 100644
--- a/src/mame/machine/naomigd.h
+++ b/src/mame/machine/naomigd.h
@@ -7,7 +7,7 @@
#define MCFG_NAOMI_GDROM_BOARD_ADD(_tag, _image_tag, _pic_tag, _eeprom_tag, _irq_cb) \
MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_GDROM_BOARD, _eeprom_tag, NULL, _irq_cb) \
- naomi_gdrom_board::static_set_tags(*device, _image_tag, _pic_tag);
+ naomi_gdrom_board::static_set_tags(*device, "^" _image_tag, "^" _pic_tag);
class naomi_gdrom_board : public naomi_board
{
diff --git a/src/mame/machine/naomim1.cpp b/src/mame/machine/naomim1.cpp
index 7e205ce1ee7..a456bc8cdb8 100644
--- a/src/mame/machine/naomim1.cpp
+++ b/src/mame/machine/naomim1.cpp
@@ -13,15 +13,16 @@ DEVICE_ADDRESS_MAP_START(submap, 16, naomi_m1_board)
ADDRESS_MAP_END
naomi_m1_board::naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : naomi_board(mconfig, NAOMI_M1_BOARD, "Sega NAOMI M1 Board", tag, owner, clock, "naomi_m1_board", __FILE__)
+ : naomi_board(mconfig, NAOMI_M1_BOARD, "Sega NAOMI M1 Board", tag, owner, clock, "naomi_m1_board", __FILE__),
+ m_region(*this, DEVICE_SELF)
{
}
READ16_MEMBER(naomi_m1_board::actel_id_r)
{
- if (rombdid_tag && memregion(rombdid_tag) != nullptr)
+ if (rombdid_tag && owner()->memregion(rombdid_tag) != nullptr)
{
- const UINT8 *bdid = memregion(rombdid_tag)->base();
+ const UINT8 *bdid = owner()->memregion(rombdid_tag)->base();
return bdid[0] | (bdid[1] << 8);
}
diff --git a/src/mame/machine/naomim1.h b/src/mame/machine/naomim1.h
index 37c5a58739b..0e1730eee80 100644
--- a/src/mame/machine/naomim1.h
+++ b/src/mame/machine/naomim1.h
@@ -35,6 +35,8 @@ private:
UINT32 rom_cur_address, buffer_actual_size, avail_bits;
bool encryption, stream_ended, has_history;
+ required_memory_region m_region;
+
void gb_reset();
UINT32 lookb(int bits);
void skipb(int bits);
diff --git a/src/mame/machine/naomim2.cpp b/src/mame/machine/naomim2.cpp
index 516da16435e..e74da6573fd 100644
--- a/src/mame/machine/naomim2.cpp
+++ b/src/mame/machine/naomim2.cpp
@@ -113,7 +113,8 @@ const device_type NAOMI_M2_BOARD = &device_creator<naomi_m2_board>;
naomi_m2_board::naomi_m2_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: naomi_board(mconfig, NAOMI_M2_BOARD, "Sega NAOMI M2 Board", tag, owner, clock, "naomi_m2_board", __FILE__),
- m_cryptdevice(*this, "segam2crypt")
+ m_cryptdevice(*this, "segam2crypt"),
+ m_region(*this, DEVICE_SELF)
{
}
@@ -194,7 +195,7 @@ UINT16 naomi_m2_board::read_callback(UINT32 addr)
}
else {
- const UINT8 *base = m_region->base() + 2*addr;
+ const UINT8 *base = &m_region->u8(2*addr);
return base[1] | (base[0] << 8);
}
}
diff --git a/src/mame/machine/naomim2.h b/src/mame/machine/naomim2.h
index ae1bdf3fed8..8196e7e4ba7 100644
--- a/src/mame/machine/naomim2.h
+++ b/src/mame/machine/naomim2.h
@@ -32,6 +32,7 @@ protected:
private:
required_device<sega_315_5881_crypt_device> m_cryptdevice;
+ required_memory_region m_region;
};
extern const device_type NAOMI_M2_BOARD;
diff --git a/src/mame/machine/naomim4.cpp b/src/mame/machine/naomim4.cpp
index 40ced99ea5a..89d61ce08c3 100644
--- a/src/mame/machine/naomim4.cpp
+++ b/src/mame/machine/naomim4.cpp
@@ -47,24 +47,24 @@ DEVICE_ADDRESS_MAP_START(submap, 16, naomi_m4_board)
ADDRESS_MAP_END
naomi_m4_board::naomi_m4_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : naomi_board(mconfig, NAOMI_M4_BOARD, "Sega NAOMI M4 Board", tag, owner, clock, "naomi_m4_board", __FILE__)
+ : naomi_board(mconfig, NAOMI_M4_BOARD, "Sega NAOMI M4 Board", tag, owner, clock, "naomi_m4_board", __FILE__),
+ m_region(*this, DEVICE_SELF),
+ m_key_data(*this)
{
- key_tag = nullptr;
}
-void naomi_m4_board::static_set_tags(device_t &device, const char *_key_tag)
+void naomi_m4_board::static_set_tags(device_t &device, const char *key_tag)
{
naomi_m4_board &dev = downcast<naomi_m4_board &>(device);
- dev.key_tag = _key_tag;
+ dev.m_key_data.set_tag(key_tag);
}
void naomi_m4_board::device_start()
{
naomi_board::device_start();
- const UINT8 *key_data = memregion(key_tag)->base();
- subkey1 = (key_data[0x5e2] << 8) | key_data[0x5e0];
- subkey2 = (key_data[0x5e6] << 8) | key_data[0x5e4];
+ subkey1 = (m_key_data[0x5e2] << 8) | m_key_data[0x5e0];
+ subkey2 = (m_key_data[0x5e6] << 8) | m_key_data[0x5e4];
buffer = std::make_unique<UINT8[]>(BUFFER_SIZE);
enc_init();
@@ -134,9 +134,9 @@ void naomi_m4_board::board_get_buffer(UINT8 *&base, UINT32 &limit)
if (cfi_mode) {
int fpr_num = 0;
- if (rombdid_tag && memregion(rombdid_tag) != nullptr)
+ if (rombdid_tag && owner()->memregion(rombdid_tag) != nullptr)
{
- fpr_num = *memregion(rombdid_tag)->base() & 0x7f;
+ fpr_num = *owner()->memregion(rombdid_tag)->base() & 0x7f;
}
@@ -217,9 +217,9 @@ READ16_MEMBER(naomi_m4_board::m4_id_r)
{
UINT16 epr_flag = 0;
- if (rombdid_tag && memregion(rombdid_tag) != nullptr)
+ if (rombdid_tag != nullptr && owner()->memregion(rombdid_tag) != nullptr)
{
- epr_flag = *memregion(rombdid_tag)->base() & 0x80;
+ epr_flag = *owner()->memregion(rombdid_tag)->base() & 0x80;
}
diff --git a/src/mame/machine/naomim4.h b/src/mame/machine/naomim4.h
index 650ed901c24..461fa1779a5 100644
--- a/src/mame/machine/naomim4.h
+++ b/src/mame/machine/naomim4.h
@@ -7,14 +7,14 @@
#define MCFG_NAOMI_M4_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _actel_tag, _irq_cb) \
MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M4_BOARD, _eeprom_tag, _actel_tag, _irq_cb) \
- naomi_m4_board::static_set_tags(*device, _key_tag);
+ naomi_m4_board::static_set_tags(*device, "^" _key_tag);
class naomi_m4_board : public naomi_board
{
public:
naomi_m4_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void static_set_tags(device_t &device, const char *_key_tag);
+ static void static_set_tags(device_t &device, const char *key_tag);
virtual DECLARE_ADDRESS_MAP(submap, 16) override;
@@ -33,7 +33,8 @@ private:
static const UINT8 k_sboxes[4][16];
- const char *key_tag;
+ required_memory_region m_region;
+ required_region_ptr<UINT8> m_key_data;
UINT16 subkey1, subkey2;
std::unique_ptr<UINT16[]> one_round;
diff --git a/src/mame/machine/naomirom.cpp b/src/mame/machine/naomirom.cpp
index 5f074d16ec6..ad356dd46e6 100644
--- a/src/mame/machine/naomirom.cpp
+++ b/src/mame/machine/naomirom.cpp
@@ -6,7 +6,8 @@
const device_type NAOMI_ROM_BOARD = &device_creator<naomi_rom_board>;
naomi_rom_board::naomi_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : naomi_board(mconfig, NAOMI_ROM_BOARD, "Sega NAOMI ROM Board", tag, owner, clock, "naomi_rom_board", __FILE__)
+ : naomi_board(mconfig, NAOMI_ROM_BOARD, "Sega NAOMI ROM Board", tag, owner, clock, "naomi_rom_board", __FILE__),
+ m_region(*this, DEVICE_SELF)
{
}
diff --git a/src/mame/machine/naomirom.h b/src/mame/machine/naomirom.h
index f23268cfa32..11f692200db 100644
--- a/src/mame/machine/naomirom.h
+++ b/src/mame/machine/naomirom.h
@@ -23,6 +23,7 @@ protected:
private:
UINT32 rom_cur_address;
+ required_memory_region m_region;
};
extern const device_type NAOMI_ROM_BOARD;
diff --git a/src/mame/machine/pc9801_118.cpp b/src/mame/machine/pc9801_118.cpp
index ee3a189b338..9b7191c40da 100644
--- a/src/mame/machine/pc9801_118.cpp
+++ b/src/mame/machine/pc9801_118.cpp
@@ -119,7 +119,7 @@ const rom_entry *pc9801_118_device::device_rom_region() const
pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PC9801_118, "pc9801_118", tag, owner, clock, "pc9801_118", __FILE__),
-// m_maincpu(*owner, "maincpu"),
+// m_maincpu(*this, "^maincpu"),
m_opn3(*this, "opn3")
{
}
diff --git a/src/mame/machine/pc9801_26.cpp b/src/mame/machine/pc9801_26.cpp
index 2f0b0351c7c..8eb8e0f7413 100644
--- a/src/mame/machine/pc9801_26.cpp
+++ b/src/mame/machine/pc9801_26.cpp
@@ -111,7 +111,7 @@ ioport_constructor pc9801_26_device::device_input_ports() const
pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PC9801_26, "pc9801_26", tag, owner, clock, "pc9801_26", __FILE__),
-// m_maincpu(*owner, "maincpu"),
+// m_maincpu(*this, "^maincpu"),
m_opn(*this, "opn")
{
}
diff --git a/src/mame/machine/s32comm.cpp b/src/mame/machine/s32comm.cpp
index dad9c291527..8d5abf8e299 100644
--- a/src/mame/machine/s32comm.cpp
+++ b/src/mame/machine/s32comm.cpp
@@ -66,6 +66,8 @@ Sega System Multi32 Comm PCB 837-8792-91
15033.17 OutRunners, Stadium Cross
*/
+#include "emu.h"
+#include "emuopts.h"
#include "machine/s32comm.h"
//#define __S32COMM_VERBOSE__
diff --git a/src/mame/machine/s32comm.h b/src/mame/machine/s32comm.h
index 19b01110361..9c0ef0eae88 100644
--- a/src/mame/machine/s32comm.h
+++ b/src/mame/machine/s32comm.h
@@ -7,8 +7,6 @@
#define __S32COMM_SIMULATION__
-#include "emu.h"
-
#define MCFG_S32COMM_ADD(_tag ) \
MCFG_DEVICE_ADD(_tag, S32COMM, 0)
diff --git a/src/mame/machine/segacrp2.cpp b/src/mame/machine/segacrp2.cpp
deleted file mode 100644
index 8c326441755..00000000000
--- a/src/mame/machine/segacrp2.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/******************************************************************************
-
- Sega encryption emulation by Nicola Salmoria
-
-
- This encryption is an evolution of the one implemented in segacrpt.c.
- It works on more data and address bits but apart from that it's essentially
- the same.
-
- The encryption affects D0, D2, D4, and D6, and depends on M1, A0, A3, A6, A9,
- A12, and A14.
-
- The encryption consists of a permutation of the four data bits, which can also
- be inverted. Therefore there are 4! * 2^4 = 384 different possible encryptions.
-
- An interesting peculiarity is that four games in the list below use an almost
- identical key, just offset by one or more bytes. This leads to believe that
- keys were generated using a PRNG like in other Sega encryptions (MC8123 etc.)
- and the CPU part# used to skip the first N bytes.
-
-
- List of encrypted games currently known:
-
- CPU Part # Game Comments
- 315-5162 4D Warriors & used I'm Sorry for k.p.a.
- Rafflesia &
- Wonder Boy (set 4)
- 315-5177 Astro Flash &
- Wonder Boy (set 1)
- 315-5178 Wonder Boy (set 2) unencrypted version available
- 315-5179 Robo-Wrestle 2001
- 317-5000 Fantasy Zone (Sound CPU) same key as 315-5177
-
- The following games seem to use the same algorithm as the above ones, but
- using a key which almost doesn't change
-
- 317-0004 Calorie Kun unencrypted bootleg available
- 317-0005 Space Position
- 317-0006 Gardia (set 1)
- 317-0007 Gardia (set 2)
-
-******************************************************************************/
-
-#include "emu.h"
-#include "segacrp2.h"
-
-
-void sega_decode_2(UINT8 *rom, UINT8 *decrypted,
- const UINT8 xor_table[128],const int swap_table[128])
-{
- static const UINT8 swaptable[24][4] =
- {
- { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 },
- { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 },
- { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 },
- { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 },
- { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 },
- { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 },
- };
-
-
- for (int A = 0x0000;A < 0x8000;A++)
- {
- int row;
- UINT8 src;
- const UINT8 *tbl;
-
-
- src = rom[A];
-
- /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */
- row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2)
- + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5);
-
- /* decode the opcodes */
- tbl = swaptable[swap_table[2*row]];
- decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row];
-
- /* decode the data */
- tbl = swaptable[swap_table[2*row+1]];
- rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1];
- }
-}
-
-
-/******************************************************************************
-
- These games (all 317-000x CPUs) use the same algorithm, but the key doesn't
- change much - just a shift in the table.
-
-******************************************************************************/
-
-void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift)
-{
- static const UINT8 xor_table[128+3] =
- {
- 0x04,0x54,0x44,0x14,0x15,0x15,0x51,0x41,0x41,0x14,0x10,0x50,0x15,0x55,0x54,0x05,
- 0x04,0x41,0x51,0x01,0x05,0x10,0x55,0x51,0x05,0x05,0x54,0x11,0x45,0x05,0x04,0x14,
- 0x10,0x55,0x01,0x41,0x51,0x05,0x55,0x04,0x45,0x41,0x55,0x14,0x45,0x10,0x04,0x45,
- 0x55,0x50,0x40,0x00,0x11,0x45,0x15,0x00,0x01,0x00,0x40,0x00,0x01,0x45,0x11,0x00,
- 0x45,0x00,0x44,0x54,0x40,0x04,0x05,0x15,0x15,0x10,0x15,0x04,0x01,0x05,0x50,0x11,
- 0x00,0x44,0x44,0x04,0x04,0x01,0x50,0x05,0x51,0x00,0x45,0x44,0x50,0x15,0x54,0x40,
- 0x41,0x45,0x40,0x10,0x14,0x15,0x40,0x51,0x50,0x50,0x45,0x00,0x10,0x15,0x05,0x51,
- 0x50,0x44,0x01,0x15,0x40,0x04,0x01,0x44,0x50,0x44,0x50,0x50,0x50,0x10,0x44,0x04,
- 0x40,0x04,0x10,
- };
-
- static const int swap_table[128+3] =
- {
- 7, 7,12, 1,18,11, 8,23,21,17, 0,23,22, 0,21,15,
- 13,19,21,20,20,12,13,10,20, 0,14,18, 6,18, 3, 5,
- 5,20,20,13, 8, 0,20,18, 4,14, 8, 5,17, 6,22,10,
- 0,21, 0, 1, 6,11,17, 9,17, 3, 9,21, 0, 4,16, 1,
- 13,17,21, 5, 3, 7, 2,16,18,13, 6,19,11,23, 3,20,
- 3, 2,18,10,18,23,19,23, 3,15, 0,10, 5,12, 0, 0,
- 11,22, 8,14, 8, 6, 1,15, 7,11, 2,17,10,15, 8,21,
- 10, 0, 2, 6, 1, 1, 3, 1,12,18,16, 5, 0,15,17,15,
- 10,20, 1,
- };
-
- sega_decode_2(rom, decrypted, xor_table + shift, swap_table + shift);
-}
diff --git a/src/mame/machine/segacrp2.h b/src/mame/machine/segacrp2.h
deleted file mode 100644
index 3c30b8771ae..00000000000
--- a/src/mame/machine/segacrp2.h
+++ /dev/null
@@ -1,7 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-
-void sega_decode_2(UINT8 *rom, UINT8 *decrypted,
- const UINT8 xor_table[128],const int swap_table[128]);
-
-void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift);
diff --git a/src/mame/machine/segacrp2_device.cpp b/src/mame/machine/segacrp2_device.cpp
new file mode 100644
index 00000000000..5c0db860879
--- /dev/null
+++ b/src/mame/machine/segacrp2_device.cpp
@@ -0,0 +1,371 @@
+// license:BSD-3-Clause
+// copyright-holders:Nicola Salmoria, David Haywood
+/******************************************************************************
+
+ Sega encryption emulation by Nicola Salmoria
+
+
+ This encryption is an evolution of the one implemented in segacrpt.c.
+ It works on more data and address bits but apart from that it's essentially
+ the same.
+
+ The encryption affects D0, D2, D4, and D6, and depends on M1, A0, A3, A6, A9,
+ A12, and A14.
+
+ The encryption consists of a permutation of the four data bits, which can also
+ be inverted. Therefore there are 4! * 2^4 = 384 different possible encryptions.
+
+ An interesting peculiarity is that four games in the list below use an almost
+ identical key, just offset by one or more bytes. This leads to believe that
+ keys were generated using a PRNG like in other Sega encryptions (MC8123 etc.)
+ and the CPU part# used to skip the first N bytes.
+
+
+ List of encrypted games currently known:
+
+ CPU Part # Game Comments
+ 315-5162 4D Warriors & used I'm Sorry for k.p.a.
+ Rafflesia &
+ Wonder Boy (set 4)
+ 315-5176 Wonder Boy (system 2 hardware, set 2) NOT DECRYPTED
+ 315-5177 Astro Flash &
+ Wonder Boy (set 1)
+ 315-5178 Wonder Boy (set 2) unencrypted version available
+ 315-5179 Robo-Wrestle 2001
+ 317-5000 Fantasy Zone (Sound CPU) same key as 315-5177
+
+ The following games seem to use the same algorithm as the above ones, but
+ using a key which almost doesn't change
+
+ 317-0004 Calorie Kun unencrypted bootleg available
+ 317-0005 Space Position
+ 317-0006 Gardia (set 1)
+ 317-0007 Gardia (set 2)
+
+******************************************************************************/
+
+#include "emu.h"
+#include "segacrp2_device.h"
+
+static void decode(UINT8 *rom, UINT8 *decrypted,
+ const UINT8 xor_table[128],const int swap_table[128])
+{
+ static const UINT8 swaptable[24][4] =
+ {
+ { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 },
+ { 6,2,4,0 }, { 6,0,2,4 }, { 6,4,0,2 }, { 2,6,4,0 },
+ { 4,2,6,0 }, { 4,6,0,2 }, { 6,0,4,2 }, { 0,6,4,2 },
+ { 4,0,6,2 }, { 0,4,6,2 }, { 6,2,0,4 }, { 2,6,0,4 },
+ { 0,6,2,4 }, { 2,0,6,4 }, { 0,2,6,4 }, { 4,2,0,6 },
+ { 2,4,0,6 }, { 4,0,2,6 }, { 2,0,4,6 }, { 0,2,4,6 },
+ };
+
+
+ for (int A = 0x0000;A < 0x8000;A++)
+ {
+ int row;
+ UINT8 src;
+ const UINT8 *tbl;
+
+
+ src = rom[A];
+
+ /* pick the translation table from bits 0, 3, 6, 9, 12 and 14 of the address */
+ row = (A & 1) + (((A >> 3) & 1) << 1) + (((A >> 6) & 1) << 2)
+ + (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5);
+
+ /* decode the opcodes */
+ tbl = swaptable[swap_table[2*row]];
+ decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row];
+
+ /* decode the data */
+ tbl = swaptable[swap_table[2*row+1]];
+ rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1];
+ }
+}
+
+
+const device_type SEGACRP2_Z80 = &device_creator<segacrp2_z80_device>;
+
+const device_type SEGA_315_5179 = &device_creator<sega_315_5179_device>;
+const device_type SEGA_315_5178 = &device_creator<sega_315_5178_device>;
+const device_type SEGA_315_5177 = &device_creator<sega_315_5177_device>; // also seen as 317-5000
+const device_type SEGA_315_5176 = &device_creator<sega_315_5176_device>; // TODO!
+const device_type SEGA_315_5162 = &device_creator<sega_315_5162_device>;
+
+const device_type SEGA_317_0004 = &device_creator<sega_317_0004_device>;
+const device_type SEGA_317_0005 = &device_creator<sega_317_0005_device>;
+const device_type SEGA_317_0006 = &device_creator<sega_317_0006_device>;
+const device_type SEGA_317_0007 = &device_creator<sega_317_0007_device>;
+
+
+
+segacrp2_z80_device::segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : z80_device(mconfig, SEGACRP2_Z80, "Z80 SegaCrypt2", tag, owner, clock, "z80_sega2", __FILE__) {}
+void segacrp2_z80_device::device_start() { z80_device::device_start(); decrypt(); }
+void segacrp2_z80_device::device_reset() { z80_device::device_reset(); }
+void segacrp2_z80_device::decrypt() { }
+
+void segacrp2_z80_device::set_decrypted_tag(device_t &device, const char* decrypted_tag)
+{
+ segacrp2_z80_device &dev = downcast<segacrp2_z80_device &>(device);
+ dev.m_decrypted_tag = decrypted_tag;
+}
+
+
+sega_315_5177_device::sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5177_device::decrypt()
+{
+ // 315-5177
+ static const UINT8 xor_table[128] =
+ {
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,
+
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,
+ 0x05,0x55,0x50,0x14,
+ };
+
+ static const int swap_table[128] =
+ {
+ 0,0,0,0,
+ 1,1,1,1,1,
+ 2,2,2,2,2,
+ 3,3,3,3,
+ 4,4,4,4,4,
+ 5,5,5,5,5,
+ 6,6,6,6,6,
+ 7,7,7,7,7,
+ 8,8,8,8,
+ 9,9,9,9,9,
+ 10,10,10,10,10,
+ 11,11,11,11,11,
+ 12,12,12,12,12,
+ 13,13,
+
+ 8,8,8,8,
+ 9,9,9,9,9,
+ 10,10,10,10,10,
+ 11,11,11,11,
+ 12,12,12,12,12,
+ 13,13,13,13,13,
+ 14,14,14,14,14,
+ 15,15,15,15,15,
+ 16,16,16,16,
+ 17,17,17,17,17,
+ 18,18,18,18,18,
+ 19,19,19,19,19,
+ 20,20,20,20,20,
+ 21,21,
+ };
+ decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table);
+}
+
+
+sega_315_5176_device::sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5176_device::decrypt()
+{
+ // 315-5176
+ // TODO!
+}
+
+
+sega_315_5162_device::sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5162_device::decrypt()
+{
+ // 315-5162
+ static const UINT8 xor_table[128] =
+ {
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,
+ 0x00,
+ };
+
+ static const int swap_table[128] =
+ {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+ 12,
+ };
+
+ decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table);
+}
+
+
+
+
+sega_315_5178_device::sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5178_device::decrypt()
+{ // 315-5178
+ static const UINT8 xor_table[128] =
+ {
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,
+ 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,
+ 0x40,0x55,0x15,0x05,0x51,0x11,
+ 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,
+ 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,
+ 0x41,0x54,0x14,0x04,0x50,0x10,
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
+
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,
+ 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,
+ 0x40,0x55,0x15,0x05,0x51,0x11,
+ 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,
+ 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,
+ 0x41,0x54,0x14,0x04,0x50,0x10,
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
+ };
+
+ static const int swap_table[128] =
+ {
+ 2,
+ 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7,
+ 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4,
+ 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3,
+ 4, 6, 0, 2, 4, 6, 0, 2, 4, 6,
+ 8,
+ 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5,
+ 6, 0, 2, 4, 6, 0, 2,
+
+ 10,
+ 11,13,15, 9,11,13,15, 9,11,13,15,
+ 8,10,12,14, 8,10,12,14, 8,10,12,
+ 13,15, 9,11,13,15, 9,11,13,15, 9,11,
+ 12,14, 8,10,12,14, 8,10,12,14,
+ 16,
+ 9,11,13,15, 9,11,13,15, 9,11,13,
+ 14, 8,10,12,14, 8,10,
+ };
+
+ decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table);
+}
+
+
+
+sega_315_5179_device::sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5179_device::decrypt()
+{ // 315-5179
+ static const UINT8 xor_table[128] =
+ {
+ 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50,
+ 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,
+ 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50,
+ 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04,
+ 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04,
+ 0x00,0x45,0x41,0x14,0x50,
+ 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,
+ 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50,
+ 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04,
+ 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04,
+ 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,
+ 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41,
+ };
+
+ static const int swap_table[128] =
+ {
+ 8, 9,11,13,15, 0, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 3, 4, 6,
+ 8,
+ 7, 1, 2, 4, 6, 0, 1, 3, 5,
+ 7, 1, 2, 4, 6, 0, 1, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 3, 4, 6, 0, 2, 3, 5,
+ 7, 1, 3, 4, 6, 0, 2, 4, 5,
+ 7,
+ };
+
+ decode(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), xor_table, swap_table);
+}
+
+
+/******************************************************************************
+
+ These games (all 317-000x CPUs) use the same algorithm, but the key doesn't
+ change much - just a shift in the table.
+
+******************************************************************************/
+
+void _sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift)
+{
+ static const UINT8 xor_table[128+3] =
+ {
+ 0x04,0x54,0x44,0x14,0x15,0x15,0x51,0x41,0x41,0x14,0x10,0x50,0x15,0x55,0x54,0x05,
+ 0x04,0x41,0x51,0x01,0x05,0x10,0x55,0x51,0x05,0x05,0x54,0x11,0x45,0x05,0x04,0x14,
+ 0x10,0x55,0x01,0x41,0x51,0x05,0x55,0x04,0x45,0x41,0x55,0x14,0x45,0x10,0x04,0x45,
+ 0x55,0x50,0x40,0x00,0x11,0x45,0x15,0x00,0x01,0x00,0x40,0x00,0x01,0x45,0x11,0x00,
+ 0x45,0x00,0x44,0x54,0x40,0x04,0x05,0x15,0x15,0x10,0x15,0x04,0x01,0x05,0x50,0x11,
+ 0x00,0x44,0x44,0x04,0x04,0x01,0x50,0x05,0x51,0x00,0x45,0x44,0x50,0x15,0x54,0x40,
+ 0x41,0x45,0x40,0x10,0x14,0x15,0x40,0x51,0x50,0x50,0x45,0x00,0x10,0x15,0x05,0x51,
+ 0x50,0x44,0x01,0x15,0x40,0x04,0x01,0x44,0x50,0x44,0x50,0x50,0x50,0x10,0x44,0x04,
+ 0x40,0x04,0x10,
+ };
+
+ static const int swap_table[128+3] =
+ {
+ 7, 7,12, 1,18,11, 8,23,21,17, 0,23,22, 0,21,15,
+ 13,19,21,20,20,12,13,10,20, 0,14,18, 6,18, 3, 5,
+ 5,20,20,13, 8, 0,20,18, 4,14, 8, 5,17, 6,22,10,
+ 0,21, 0, 1, 6,11,17, 9,17, 3, 9,21, 0, 4,16, 1,
+ 13,17,21, 5, 3, 7, 2,16,18,13, 6,19,11,23, 3,20,
+ 3, 2,18,10,18,23,19,23, 3,15, 0,10, 5,12, 0, 0,
+ 11,22, 8,14, 8, 6, 1,15, 7,11, 2,17,10,15, 8,21,
+ 10, 0, 2, 6, 1, 1, 3, 1,12,18,16, 5, 0,15,17,15,
+ 10,20, 1,
+ };
+
+ decode(rom, decrypted, xor_table + shift, swap_table + shift);
+}
+
+
+sega_317_0004_device::sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_317_0004_device::decrypt()
+{ // 317-0004
+ _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 0);
+}
+
+
+
+sega_317_0005_device::sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_317_0005_device::decrypt()
+{ // 317-0005
+ _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 1);
+}
+
+
+sega_317_0006_device::sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_317_0006_device::decrypt()
+{ // 317-0006
+ _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 2);
+}
+
+sega_317_0007_device::sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {}
+void sega_317_0007_device::decrypt()
+{ // 317-0006
+ _sega_decode_317(memregion(tag())->base(), (UINT8*)memshare(m_decrypted_tag)->ptr(), 3);
+} \ No newline at end of file
diff --git a/src/mame/machine/segacrp2_device.h b/src/mame/machine/segacrp2_device.h
new file mode 100644
index 00000000000..f6e90820209
--- /dev/null
+++ b/src/mame/machine/segacrp2_device.h
@@ -0,0 +1,123 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+#pragma once
+
+#ifndef __SEGACRP2_Z80__
+#define __SEGACRP2_Z80__
+
+
+#define MCFG_SEGAZ80_SET_DECRYPTED_TAG(_tag) \
+ segacrp2_z80_device::set_decrypted_tag(*device, _tag);
+
+#include "emu.h"
+#include "cpu/z80/z80.h"
+
+// base class
+class segacrp2_z80_device : public z80_device
+{
+public:
+ segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+
+ static void set_decrypted_tag(device_t &device, const char* decrypted_tag);
+ const char* m_decrypted_tag;
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void decrypt();
+};
+
+
+
+// actual encrypted CPUs
+class sega_315_5179_device : public segacrp2_z80_device
+{
+public:
+ sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_315_5178_device : public segacrp2_z80_device
+{
+public:
+ sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5177_device : public segacrp2_z80_device
+{
+public:
+ sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5176_device : public segacrp2_z80_device
+{
+public:
+ sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5162_device : public segacrp2_z80_device
+{
+public:
+ sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_317_0004_device : public segacrp2_z80_device
+{
+public:
+ sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_317_0005_device : public segacrp2_z80_device
+{
+public:
+ sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_317_0006_device : public segacrp2_z80_device
+{
+public:
+ sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_317_0007_device : public segacrp2_z80_device
+{
+public:
+ sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+extern const device_type SEGACRP2_Z80;
+extern const device_type SEGA_315_5179;
+extern const device_type SEGA_315_5178;
+extern const device_type SEGA_315_5177;
+extern const device_type SEGA_315_5176;
+extern const device_type SEGA_315_5162;
+
+extern const device_type SEGA_317_0004;
+extern const device_type SEGA_317_0005;
+extern const device_type SEGA_317_0006;
+extern const device_type SEGA_317_0007;
+
+
+#endif /// __SEGACRP2_Z80__
+
diff --git a/src/mame/machine/segacrpt.cpp b/src/mame/machine/segacrpt.cpp
deleted file mode 100644
index e577ac786c8..00000000000
--- a/src/mame/machine/segacrpt.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/******************************************************************************
-
- Sega encryption emulation by Nicola Salmoria
-
-
- Several Sega Z80 games have program ROMs encrypted using a common algorithm
- (but with a different key).
- The hardware used to implement this encryption is either a custom CPU, or an
- epoxy block which probably contains a standard Z80 + PALs.
-
- The encryption affects D3, D5, and D7, and depends on M1, A0, A4, A8 and A12.
- D0, D1, D3, D4 and D6 are always unaffected.
-
- The encryption consists of a permutation of the three bits, which can also be
- inverted. Therefore there are 3! * 2^3 = 48 different possible encryptions.
-
- For simplicity, the decryption is implemented using conversion tables.
- We need 32 of these tables, one for every possible combination of M1, A0, A4,
- A8 and A12. However, all the games currently known are full of repetitions
- and only use 6 different tables, the only exceptions being Pengo, Yamato and
- Spatter which have 7 (but one of them is the identity: { 0x00, 0x08, 0x20, 0x28 } ).
- This is most likely a limitation of the hardware.
- Some of the early games are even weaker: of the 6 different tables, they use
- 3 for opcodes and 3 for data, and always coupled in the same way.
-
- In all games currently known, only bytes in the memory range 0x0000-0x7fff
- (A15 = 0) are encrypted. My guess is that this was done to allow games to
- copy code to RAM (in the memory range 0x8000-0xffff) and execute it from
- there without the CPU trying to decrypt it and messing everything up.
- However Zaxxon has RAM at 0x6000, and the CPU doesn't seem to interfere with
- it; but it doesn't execute code from there, so it's possible that the CPU is
- encrypting the data while writing it and decrypting it while reading (that
- would seem kind of strange though). Video and sprite RAM and memory mapped
- ports are all placed above 0x8000.
-
- Given its strict limitations, this encryption is reasonably easy to break,
- and very vulnerable to known plaintext attacks.
-
-
-
- Ninja Princess:
-
- there is a (bootleg?) board which has a standard Z80 + 2 bipolar PROMs
- instead of the custom CPU. The encryption table is different from the
- original Ninja Princess; it is actually the same as Flicky.
-
- The first PROM is 32x8 and contains the number (0..5) of the table to
- use depending on M1, A0, A4, A8, A12:
-
- 00: 11 00 33 22 00 44 44 00 11 33 33 22 44 44 44 22
- 10: 11 55 55 33 44 22 55 22 11 33 55 33 44 44 11 22
-
- The second PROM is 256x4 and contains the 6 different XOR tables:
-
- A D B C C B D A
- 00: 09 09 0A 0A 0A 0A 09 09
- 08: 0E 08 0B 0D 0D 0B 08 0E
- 10: 0A 0C 0A 0C 0C 0A 0C 0A
- 18: 0B 0E 0E 0B 0B 0E 0E 0B
- 20: 0C 0C 0F 0F 0F 0F 0C 0C
- 28: 08 0D 0B 0E 0E 0B 0D 08
- [the remaining bytes are all 0F]
- bit 3 is not used.
- bits 0-2 is the XOR code inverted (0 = 0xa8, 1 = 0xa0 ... 6 = 0x08 7 = 0x00)
-
- Here is a diagram showing how it works:
-
- data to XOR
- decode value
- A ---
- D7 --------------- 0| |
- D3 --------------- 1| |
- D5 --------------- 2| P |D
- A --- D | R |0 ---|>--- D3
- M1 --- 0| P |0 --- 3| O |1 ---|>--- D5
- A0 --- 1| R |1 --- 4| M |2 ---|>--- D7
- A4 --- 2| O |2 --- 5| 2 |3 ---
- A8 --- 3| M |3 --- 6| |
- A12 --- 4| 1 |4 --- 7| |
- --- ---
-
-
- My Hero:
-
- the bootleg does the decryption using a single 256x4 PROM, mapped in the
- obvious way:
-
- data to XOR
- decode value
- A ---
- D3 --- 0| |
- D5 --- 1| |D
- D7 --- 2| P |0 --- D3
- A0 --- 3| R |1 --- D5
- A4 --- 4| O |2 --- D7
- A8 --- 5| M |3 ---
- A12 --- 6| |
- M1 --- 7| |
- ---
-
-
-
- List of encrypted games currently known:
-
- CPU Part # Game Comments
- 315-5010 Pengo unencrypted version available
- 315-5013 Super Zaxxon used Zaxxon for known plaintext attack
- 315-5014 Buck Rogers / Zoom 909 unencrypted version available
- 315-5015 Super Locomotive
- 315-5018 Yamato
- ???-???? Top Roller same key as Yamato
- 315-5028 Sindbad Mystery
- 315-5030 Up'n Down & unencrypted version available
- ???-???? M120 Razzmatazz
- 315-5033 Regulus unencrypted version available
- 315-5041 M140 Mister Viking
- 315-5048 SWAT used Bull Fight for k.p.a.
- 315-5051 Flicky &
- Ninja Princess (bootleg)
- 315-5061 Future Spy
- 315-5064 Water Match used Mister Viking for k.p.a.
- 315-5065 Bull Fight
- 315-5069 Star Force game by Tehkan; same key as Super Locomotive
- ???-???? Pinball Action game by Tehkan; also has a simple bitswap on top
- ???-???? Spatter
- 315-5084 Jongkyo TABLE INCOMPLETE game by Kiwako; also has a simple bitswap on top
- 315-5093 Pitfall II
- 315-5098 Ninja Princess unencrypted version available; same key as Up'n Down
- 315-5102 Sega Ninja unencrypted version available
- 315-5110 I'm Sorry used My Hero for k.p.a.
- 315-5114 ?? pcb 834-5492 same key as Regulus
- 315-5115 TeddyBoy Blues
- 315-5132 My Hero
- 315-5135 Heavy Metal &
- Wonder Boy (set 1a & 3; bootlegs?)
- ???-???? Lovely Cards
-
-
- Some text found in the ROMs:
-
- Buck Rogers SECULITY BY MASATOSHI,MIZUNAGA
- Super Locomotive SEGA FUKUMURA MIZUNAGA
- Yamato SECULITY BY M,MIZUNAGA
- Regulus SECULITY BY SYUICHI,KATAGI
- Up'n Down 19/SEP 1983 MASATOSHI,MIZUNAGA
- Mister Viking SECURITY BY S.KATAGI CONTROL CHIP M140
- SWAT SECURITY BY S.KATAGI
- Flicky SECURITY BY S.KATAGI
- Water Match PROGRAMED BY KAWAHARA&NAKAGAWA
- Star Force STAR FORCE TEHKAN. SECURITY BY SEGA ENTERPRISESE
-
-******************************************************************************/
-
-#include "emu.h"
-#include "segacrpt.h"
-
-
-#if 0
-static void lfkp(int mask)
-{
- int A;
- UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
-
-
- for (A = 0x0000;A < 0x8000-14;A++)
- {
- static const char text[] = "INSERT COIN";
- int i;
-
-
- if ( (RAM[A+0] & mask) == (0x21 & mask) && /* LD HL,$xxxx */
- (RAM[A+3] & mask) == (0x11 & mask) && /* LD DE,$xxxx */
- (RAM[A+6] & mask) == (0x01 & mask)) /* LD BC,$xxxx */
- {
- if ( (RAM[A+ 9] & mask) == (0x36 & mask) && /* LD (HL),$xx */
- (RAM[A+11] & mask) == (0xed & mask) &&
- (RAM[A+12] & mask) == (0xb0 & mask)) /* LDIR */
- logerror("%04x: hl de bc (hl),xx ldir\n",A);
-
- if ( (RAM[A+ 9] & mask) == (0x77 & mask) && /* LD (HL),A */
- (RAM[A+10] & mask) == (0xed & mask) &&
- (RAM[A+11] & mask) == (0xb0 & mask)) /* LDIR */
- logerror("%04x: hl de bc (hl),a ldir\n",A);
-
- if ( (RAM[A+ 9] & mask) == (0xed & mask) &&
- (RAM[A+10] & mask) == (0xb0 & mask)) /* LDIR */
- logerror("%04x: hl de bc ldir\n",A);
- }
-
- /* the following can also be PUSH IX, PUSH IY - need better checking */
- if ( (RAM[A+0] & mask) == (0xf5 & mask) && /* PUSH AF */
- (RAM[A+1] & mask) == (0xc5 & mask) && /* PUSH BC */
- (RAM[A+2] & mask) == (0xd5 & mask) && /* PUSH DE */
- (RAM[A+3] & mask) == (0xe5 & mask)) /* PUSH HL */
- logerror("%04x: push af bc de hl\n",A);
-
- if ( (RAM[A+0] & mask) == (0xe1 & mask) && /* POP HL */
- (RAM[A+1] & mask) == (0xd1 & mask) && /* POP DE */
- (RAM[A+2] & mask) == (0xc1 & mask) && /* POP BC */
- (RAM[A+3] & mask) == (0xf1 & mask)) /* POP AF */
- logerror("%04x: pop hl de bc af\n",A);
-
- for (i = 0;i < strlen(text);i++)
- if ((RAM[A+i] & mask) != (text[i] & mask)) break;
- if (i == strlen(text))
- logerror("%04x: INSERT COIN\n",A);
- }
-}
-
-static void look_for_known_plaintext(void)
-{
- lfkp(0x57);
-}
-#endif
-
-void sega_decode(UINT8 *data, UINT8 *opcodes, int size, const UINT8 convtable[32][4], int bank_count, int bank_size)
-{
- for (int A = 0x0000;A < size + bank_count*bank_size;A++)
- {
- int xorval = 0;
-
- UINT8 src = data[A];
- int adr;
- if(A < size || !bank_count)
- adr = A;
- else
- adr = size + ((A - size) % bank_size);
-
- /* pick the translation table from bits 0, 4, 8 and 12 of the address */
- int row = (adr & 1) + (((adr >> 4) & 1) << 1) + (((adr >> 8) & 1) << 2) + (((adr >> 12) & 1) << 3);
-
- /* pick the offset in the table from bits 3 and 5 of the source data */
- int col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1);
- /* the bottom half of the translation table is the mirror image of the top */
- if (src & 0x80)
- {
- col = 3 - col;
- xorval = 0xa8;
- }
-
- /* decode the opcodes */
- opcodes[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval);
-
- /* decode the data */
- data[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval);
-
- if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */
- opcodes[A] = 0xee;
- if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */
- data[A] = 0xee;
- }
-}
diff --git a/src/mame/machine/segacrpt.h b/src/mame/machine/segacrpt.h
deleted file mode 100644
index ba6fc16ca72..00000000000
--- a/src/mame/machine/segacrpt.h
+++ /dev/null
@@ -1,4 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-
-void sega_decode(UINT8 *data, UINT8 *opcodes, int size, const UINT8 convtable[32][4], int bank_count = 0, int bank_size = 0);
diff --git a/src/mame/machine/segacrpt_device.cpp b/src/mame/machine/segacrpt_device.cpp
new file mode 100644
index 00000000000..c7b8395fb43
--- /dev/null
+++ b/src/mame/machine/segacrpt_device.cpp
@@ -0,0 +1,1091 @@
+// license:BSD-3-Clause
+// copyright-holders:Nicola Salmoria, David Haywood
+/******************************************************************************
+
+ Sega encryption emulation by Nicola Salmoria
+
+
+ Several Sega Z80 games have program ROMs encrypted using a common algorithm
+ (but with a different key).
+ The hardware used to implement this encryption is either a custom CPU, or an
+ epoxy block which probably contains a standard Z80 + PALs.
+
+ The encryption affects D3, D5, and D7, and depends on M1, A0, A4, A8 and A12.
+ D0, D1, D3, D4 and D6 are always unaffected.
+
+ The encryption consists of a permutation of the three bits, which can also be
+ inverted. Therefore there are 3! * 2^3 = 48 different possible encryptions.
+
+ For simplicity, the decryption is implemented using conversion tables.
+ We need 32 of these tables, one for every possible combination of M1, A0, A4,
+ A8 and A12. However, all the games currently known are full of repetitions
+ and only use 6 different tables, the only exceptions being Pengo, Yamato and
+ Spatter which have 7 (but one of them is the identity: { 0x00, 0x08, 0x20, 0x28 } ).
+ This is most likely a limitation of the hardware.
+ Some of the early games are even weaker: of the 6 different tables, they use
+ 3 for opcodes and 3 for data, and always coupled in the same way.
+
+ In all games currently known, only bytes in the memory range 0x0000-0x7fff
+ (A15 = 0) are encrypted. My guess is that this was done to allow games to
+ copy code to RAM (in the memory range 0x8000-0xffff) and execute it from
+ there without the CPU trying to decrypt it and messing everything up.
+ However Zaxxon has RAM at 0x6000, and the CPU doesn't seem to interfere with
+ it; but it doesn't execute code from there, so it's possible that the CPU is
+ encrypting the data while writing it and decrypting it while reading (that
+ would seem kind of strange though). Video and sprite RAM and memory mapped
+ ports are all placed above 0x8000.
+
+ Given its strict limitations, this encryption is reasonably easy to break,
+ and very vulnerable to known plaintext attacks.
+
+
+
+ Ninja Princess:
+
+ there is a (bootleg?) board which has a standard Z80 + 2 bipolar PROMs
+ instead of the custom CPU. The encryption table is different from the
+ original Ninja Princess; it is actually the same as Flicky.
+
+ The first PROM is 32x8 and contains the number (0..5) of the table to
+ use depending on M1, A0, A4, A8, A12:
+
+ 00: 11 00 33 22 00 44 44 00 11 33 33 22 44 44 44 22
+ 10: 11 55 55 33 44 22 55 22 11 33 55 33 44 44 11 22
+
+ The second PROM is 256x4 and contains the 6 different XOR tables:
+
+ A D B C C B D A
+ 00: 09 09 0A 0A 0A 0A 09 09
+ 08: 0E 08 0B 0D 0D 0B 08 0E
+ 10: 0A 0C 0A 0C 0C 0A 0C 0A
+ 18: 0B 0E 0E 0B 0B 0E 0E 0B
+ 20: 0C 0C 0F 0F 0F 0F 0C 0C
+ 28: 08 0D 0B 0E 0E 0B 0D 08
+ [the remaining bytes are all 0F]
+ bit 3 is not used.
+ bits 0-2 is the XOR code inverted (0 = 0xa8, 1 = 0xa0 ... 6 = 0x08 7 = 0x00)
+
+ Here is a diagram showing how it works:
+
+ data to XOR
+ decode value
+ A ---
+ D7 --------------- 0| |
+ D3 --------------- 1| |
+ D5 --------------- 2| P |D
+ A --- D | R |0 ---|>--- D3
+ M1 --- 0| P |0 --- 3| O |1 ---|>--- D5
+ A0 --- 1| R |1 --- 4| M |2 ---|>--- D7
+ A4 --- 2| O |2 --- 5| 2 |3 ---
+ A8 --- 3| M |3 --- 6| |
+ A12 --- 4| 1 |4 --- 7| |
+ --- ---
+
+
+ My Hero:
+
+ the bootleg does the decryption using a single 256x4 PROM, mapped in the
+ obvious way:
+
+ data to XOR
+ decode value
+ A ---
+ D3 --- 0| |
+ D5 --- 1| |D
+ D7 --- 2| P |0 --- D3
+ A0 --- 3| R |1 --- D5
+ A4 --- 4| O |2 --- D7
+ A8 --- 5| M |3 ---
+ A12 --- 6| |
+ M1 --- 7| |
+ ---
+
+
+
+ List of encrypted games currently known:
+
+ CPU Part # Game Comments
+ 315-5010 Pengo unencrypted version available
+ 315-5013 Super Zaxxon used Zaxxon for known plaintext attack
+ 315-5014 Buck Rogers / Zoom 909 unencrypted version available
+ 315-5015 Super Locomotive
+ 315-5018 Yamato
+ ???-???? Top Roller same key as Yamato
+ 315-5028 Sindbad Mystery
+ 315-5030 Up'n Down & unencrypted version available
+ ???-???? M120 Razzmatazz
+ 315-5033 Regulus unencrypted version available
+ 315-5041 M140 Mister Viking
+ 315-5048 SWAT used Bull Fight for k.p.a.
+ 315-5051 Flicky &
+ Ninja Princess (bootleg)
+ 315-5061 Future Spy
+ 315-5064 Water Match used Mister Viking for k.p.a.
+ 315-5065 Bull Fight
+ 315-5069 Star Force game by Tehkan; same key as Super Locomotive
+ ???-???? Pinball Action game by Tehkan; also has a simple bitswap on top
+ ???-???? Spatter
+ 315-5084 Jongkyo TABLE INCOMPLETE game by Kiwako; also has a simple bitswap on top
+ 315-5093 Pitfall II
+ 315-5098 Ninja Princess unencrypted version available; same key as Up'n Down
+ 315-5102 Sega Ninja unencrypted version available
+ 315-5110 I'm Sorry used My Hero for k.p.a.
+ 315-5114 ?? pcb 834-5492 same key as Regulus
+ 315-5115 TeddyBoy Blues
+ 315-5132 My Hero
+ 315-5135 Heavy Metal &
+ Wonder Boy (set 1a & 3; bootlegs?)
+
+
+ Some text found in the ROMs:
+
+ Buck Rogers SECULITY BY MASATOSHI,MIZUNAGA
+ Super Locomotive SEGA FUKUMURA MIZUNAGA
+ Yamato SECULITY BY M,MIZUNAGA
+ Regulus SECULITY BY SYUICHI,KATAGI
+ Up'n Down 19/SEP 1983 MASATOSHI,MIZUNAGA
+ Mister Viking SECURITY BY S.KATAGI CONTROL CHIP M140
+ SWAT SECURITY BY S.KATAGI
+ Flicky SECURITY BY S.KATAGI
+ Water Match PROGRAMED BY KAWAHARA&NAKAGAWA
+ Star Force STAR FORCE TEHKAN. SECURITY BY SEGA ENTERPRISESE
+
+******************************************************************************/
+
+#include "emu.h"
+#include "segacrpt_device.h"
+
+
+#if 0
+static void lfkp(int mask)
+{
+ int A;
+ UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
+
+
+ for (A = 0x0000;A < 0x8000-14;A++)
+ {
+ static const char text[] = "INSERT COIN";
+ int i;
+
+
+ if ( (RAM[A+0] & mask) == (0x21 & mask) && /* LD HL,$xxxx */
+ (RAM[A+3] & mask) == (0x11 & mask) && /* LD DE,$xxxx */
+ (RAM[A+6] & mask) == (0x01 & mask)) /* LD BC,$xxxx */
+ {
+ if ( (RAM[A+ 9] & mask) == (0x36 & mask) && /* LD (HL),$xx */
+ (RAM[A+11] & mask) == (0xed & mask) &&
+ (RAM[A+12] & mask) == (0xb0 & mask)) /* LDIR */
+ logerror("%04x: hl de bc (hl),xx ldir\n",A);
+
+ if ( (RAM[A+ 9] & mask) == (0x77 & mask) && /* LD (HL),A */
+ (RAM[A+10] & mask) == (0xed & mask) &&
+ (RAM[A+11] & mask) == (0xb0 & mask)) /* LDIR */
+ logerror("%04x: hl de bc (hl),a ldir\n",A);
+
+ if ( (RAM[A+ 9] & mask) == (0xed & mask) &&
+ (RAM[A+10] & mask) == (0xb0 & mask)) /* LDIR */
+ logerror("%04x: hl de bc ldir\n",A);
+ }
+
+ /* the following can also be PUSH IX, PUSH IY - need better checking */
+ if ( (RAM[A+0] & mask) == (0xf5 & mask) && /* PUSH AF */
+ (RAM[A+1] & mask) == (0xc5 & mask) && /* PUSH BC */
+ (RAM[A+2] & mask) == (0xd5 & mask) && /* PUSH DE */
+ (RAM[A+3] & mask) == (0xe5 & mask)) /* PUSH HL */
+ logerror("%04x: push af bc de hl\n",A);
+
+ if ( (RAM[A+0] & mask) == (0xe1 & mask) && /* POP HL */
+ (RAM[A+1] & mask) == (0xd1 & mask) && /* POP DE */
+ (RAM[A+2] & mask) == (0xc1 & mask) && /* POP BC */
+ (RAM[A+3] & mask) == (0xf1 & mask)) /* POP AF */
+ logerror("%04x: pop hl de bc af\n",A);
+
+ for (i = 0;i < strlen(text);i++)
+ if ((RAM[A+i] & mask) != (text[i] & mask)) break;
+ if (i == strlen(text))
+ logerror("%04x: INSERT COIN\n",A);
+ }
+}
+
+static void look_for_known_plaintext(void)
+{
+ lfkp(0x57);
+}
+#endif
+
+static void decode(UINT8 *data, UINT8 *opcodes, int size, const UINT8 convtable[32][4], int bank_count, int bank_size)
+{
+ for (int A = 0x0000;A < size + bank_count*bank_size;A++)
+ {
+ int xorval = 0;
+
+ UINT8 src = data[A];
+ int adr;
+ if(A < size || !bank_count)
+ adr = A;
+ else
+ adr = size + ((A - size) % bank_size);
+
+ /* pick the translation table from bits 0, 4, 8 and 12 of the address */
+ int row = (adr & 1) + (((adr >> 4) & 1) << 1) + (((adr >> 8) & 1) << 2) + (((adr >> 12) & 1) << 3);
+
+ /* pick the offset in the table from bits 3 and 5 of the source data */
+ int col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1);
+ /* the bottom half of the translation table is the mirror image of the top */
+ if (src & 0x80)
+ {
+ col = 3 - col;
+ xorval = 0xa8;
+ }
+
+ /* decode the opcodes */
+ opcodes[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval);
+
+ /* decode the data */
+ data[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval);
+
+ if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */
+ opcodes[A] = 0xee;
+ if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */
+ data[A] = 0xee;
+ }
+}
+
+
+
+
+const device_type SEGACRPT_Z80 = &device_creator<segacrpt_z80_device>;
+
+const device_type SEGA_315_5132 = &device_creator<sega_315_5132_device>;
+const device_type SEGA_315_5155 = &device_creator<sega_315_5155_device>;
+const device_type SEGA_315_5110 = &device_creator<sega_315_5110_device>;
+const device_type SEGA_315_5135 = &device_creator<sega_315_5135_device>;
+const device_type SEGA_315_5051 = &device_creator<sega_315_5051_device>;
+const device_type SEGA_315_5098 = &device_creator<sega_315_5098_device>; // also 315-5030 ?
+const device_type SEGA_315_5102 = &device_creator<sega_315_5102_device>;
+const device_type SEGA_315_5065 = &device_creator<sega_315_5065_device>;
+const device_type SEGA_315_5064 = &device_creator<sega_315_5064_device>;
+const device_type SEGA_315_5033 = &device_creator<sega_315_5033_device>;
+const device_type SEGA_315_5041 = &device_creator<sega_315_5041_device>;
+const device_type SEGA_315_5048 = &device_creator<sega_315_5048_device>;
+const device_type SEGA_315_5093 = &device_creator<sega_315_5093_device>;
+const device_type SEGA_315_5099 = &device_creator<sega_315_5099_device>;
+const device_type SEGA_315_5015 = &device_creator<sega_315_5015_device>;
+const device_type SEGA_315_5133 = &device_creator<sega_315_5133_device>; // NOT DECRYPTED YET
+const device_type SEGA_315_5061 = &device_creator<sega_315_5061_device>;
+const device_type SEGA_315_5028 = &device_creator<sega_315_5028_device>;
+const device_type SEGA_315_5084 = &device_creator<sega_315_5084_device>;
+const device_type SEGA_315_5013 = &device_creator<sega_315_5013_device>;
+const device_type SEGA_315_5014 = &device_creator<sega_315_5014_device>;
+const device_type SEGA_315_5018 = &device_creator<sega_315_5018_device>;
+const device_type SEGA_315_5010 = &device_creator<sega_315_5010_device>;
+
+// below are unknown part numbers
+const device_type SEGA_315_SPAT = &device_creator<sega_315_spat_device>; // unknown part number
+const device_type SEGA_CPU_PBACTIO4 = &device_creator<sega_cpu_pbactio4_device>;
+
+
+
+
+segacrpt_z80_device::segacrpt_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ z80_device(mconfig, SEGACRPT_Z80, "Z80 SegaCrypt", tag, owner, clock, "z80_sega", __FILE__),
+ m_decrypted_ptr(nullptr),
+ m_region_ptr(nullptr),
+ m_decode_size(0x8000),
+ m_numbanks(0),
+ m_banksize(0),
+ m_decryption_done(false)
+ {}
+void segacrpt_z80_device::device_start() { z80_device::device_start(); }
+void segacrpt_z80_device::device_reset()
+{
+ // decrypt on reset, makes sure DRIVER_INIT stuff happens first (for myherok)
+ // actual CPU would be decrypting in realtime anyway
+ if (m_decrypted_ptr == nullptr)
+ {
+ m_decrypted_ptr = (UINT8*)memshare(m_decrypted_tag)->ptr();
+ }
+
+ if (m_region_ptr == nullptr)
+ {
+ m_region_ptr = (UINT8*)memregion(tag())->base();
+ }
+
+ if (m_decryption_done == false)
+ {
+ decrypt();
+ m_decryption_done = true;
+ }
+ z80_device::device_reset();
+
+}
+void segacrpt_z80_device::decrypt() { }
+
+void segacrpt_z80_device::set_decrypted_tag(device_t &device, const char* decrypted_tag)
+{
+ segacrpt_z80_device &dev = downcast<segacrpt_z80_device &>(device);
+ dev.m_decrypted_tag = decrypted_tag;
+}
+
+void segacrpt_z80_device::set_decrypted_ptr(device_t &device, UINT8* ptr)
+{
+ segacrpt_z80_device &dev = downcast<segacrpt_z80_device &>(device);
+ dev.m_decrypted_ptr = ptr;
+}
+
+void segacrpt_z80_device::set_region_p(UINT8* ptr)
+{
+ m_region_ptr = ptr;
+}
+
+void segacrpt_z80_device::set_decrypted_p(UINT8* ptr)
+{
+ m_decrypted_ptr = ptr;
+}
+
+void segacrpt_z80_device::set_size(device_t &device, int size)
+{
+ segacrpt_z80_device &dev = downcast<segacrpt_z80_device &>(device);
+ dev.m_decode_size = size;
+}
+
+void segacrpt_z80_device::set_numbanks(device_t &device, int numbanks)
+{
+ segacrpt_z80_device &dev = downcast<segacrpt_z80_device &>(device);
+ dev.m_numbanks = numbanks;
+}
+
+void segacrpt_z80_device::set_banksize(device_t &device, int banksize)
+{
+ segacrpt_z80_device &dev = downcast<segacrpt_z80_device &>(device);
+ dev.m_banksize = banksize;
+}
+
+
+
+
+sega_315_5132_device::sega_315_5132_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5132_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */
+ { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */
+ { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_315_5155_device::sega_315_5155_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5155_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */
+ { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
+ { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_315_5110_device::sega_315_5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5110_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */
+ { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */
+ { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
+ { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */
+ { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */
+ { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */
+ { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */
+ { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */
+ { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5135_device::sega_315_5135_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5135_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */
+ { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_315_5051_device::sega_315_5051_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5051_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */
+ { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
+ { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
+ { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */
+ { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
+ { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */
+ { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */
+ { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */
+ { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */
+ { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */
+ { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */
+ { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5098_device::sega_315_5098_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5098_device::decrypt()
+{
+ // also 315-5030 ?
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
+ { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_315_5102_device::sega_315_5102_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5102_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
+ { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */
+ { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5065_device::sega_315_5065_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5065_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */
+ { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
+ { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */
+ { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
+ { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5064_device::sega_315_5064_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5064_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */
+ { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */
+ { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */
+ { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */
+ { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */
+ { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5033_device::sega_315_5033_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5033_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */
+ { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */
+ { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */
+ { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5041_device::sega_315_5041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5041_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5048_device::sega_315_5048_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5048_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */
+ { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */
+ { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */
+ { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */
+ { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */
+ { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5093_device::sega_315_5093_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5093_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */
+ { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5099_device::sega_315_5099_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5099_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */
+ { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */
+ { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */
+ { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */
+ { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */
+ { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */
+ { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_315_spat_device::sega_315_spat_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_spat_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */
+ { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */
+ { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */
+ { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */
+ { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */
+ { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+sega_315_5015_device::sega_315_5015_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5015_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */
+ { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
+ { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */
+ };
+
+ /* decrypt program ROMs */
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5133_device::sega_315_5133_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5133_device::decrypt()
+{
+ // TODO
+}
+
+
+
+sega_315_5014_device::sega_315_5014_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5014_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...0...0 */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */
+ { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */
+ };
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5013_device::sega_315_5013_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5013_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */
+ { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
+ { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */
+ { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...1 */
+ { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...0 */
+ { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...1 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5061_device::sega_315_5061_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5061_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...0...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...1...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...1 */
+ { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0xa8,0xa0 }, /* ...0...1...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */
+ { 0x88,0x80,0xa8,0xa0 }, { 0x28,0x08,0x20,0x00 }, /* ...1...0...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...1 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...1...0...1...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */
+ { 0x88,0x80,0xa8,0xa0 }, { 0x88,0x80,0xa8,0xa0 }, /* ...1...1...0...0 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */
+ { 0x80,0x00,0xa0,0x20 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */
+ { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+sega_315_5018_device::sega_315_5018_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5018_device::decrypt()
+{
+
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */
+ { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
+ { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */
+ { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */
+ { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */
+ { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+
+}
+
+
+sega_315_5010_device::sega_315_5010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5010_device::decrypt()
+{
+
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...0 */
+ { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */
+ { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...1 */
+ { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */
+ { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...1...1...1 */
+ { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */
+ { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...0...1...0 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */
+ { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
+ { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */
+ { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...1...1...0 */
+ { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+
+
+sega_cpu_pbactio4_device::sega_cpu_pbactio4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_cpu_pbactio4_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...1 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...0...0 */
+ { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0x28,0xa0,0x20 }, /* ...1...1...0...1 */
+ { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0x28,0xa0,0x20 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5028_device::sega_315_5028_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5028_device::decrypt()
+{
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */
+ { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...0...1...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...0 */
+ { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */
+ { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */
+ { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */
+ };
+
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
+
+
+sega_315_5084_device::sega_315_5084_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : segacrpt_z80_device(mconfig, tag, owner, clock) {}
+void sega_315_5084_device::decrypt()
+{
+
+ static const UINT8 convtable[32][4] =
+ {
+ /* opcode data address */
+ /* A B C D A B C D */
+ { 0x28,0x08,0xa8,0x88 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...0...0...1...1 */
+ { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...0 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */
+ { 0x20,0xa0,0x00,0x80 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */
+ { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...0 */
+ { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...1...1 */
+ { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */
+ { 0x08,0x88,0x00,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...1 */
+ { 0x28,0x08,0xa8,0x88 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...1...0 */
+ { 0x80,0x88,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 } /* ...1...1...1...1 */
+ };
+ decode(m_region_ptr, m_decrypted_ptr, m_decode_size, convtable, m_numbanks, m_banksize);
+}
diff --git a/src/mame/machine/segacrpt_device.h b/src/mame/machine/segacrpt_device.h
new file mode 100644
index 00000000000..0c4491f5c3c
--- /dev/null
+++ b/src/mame/machine/segacrpt_device.h
@@ -0,0 +1,296 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+#pragma once
+
+#ifndef __SEGACRPT_Z80__
+#define __SEGACRPT_Z80__
+
+
+#define MCFG_SEGACRPT_SET_DECRYPTED_TAG(_tag) \
+ segacrpt_z80_device::set_decrypted_tag(*device, _tag);
+
+#define MCFG_SEGACRPT_SET_DECRYPTED_PTR(_tag) \
+ segacrpt_z80_device::set_decrypted_ptr(*device, _ptr);
+
+#define MCFG_SEGACRPT_SET_SIZE(_size) \
+ segacrpt_z80_device::set_size(*device, _size);
+
+#define MCFG_SEGACRPT_SET_NUMBANKS(_numbanks) \
+ segacrpt_z80_device::set_numbanks(*device, _numbanks);
+
+#define MCFG_SEGACRPT_SET_BANKSIZE(_banksize) \
+ segacrpt_z80_device::set_banksize(*device, _banksize);
+
+
+#include "emu.h"
+#include "cpu/z80/z80.h"
+
+// base class
+class segacrpt_z80_device : public z80_device
+{
+public:
+ segacrpt_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+
+ static void set_decrypted_tag(device_t &device, const char* decrypted_tag);
+ static void set_decrypted_ptr(device_t &device, UINT8* ptr); // toprollr
+ static void set_size(device_t &device, int size);
+ static void set_numbanks(device_t &device, int _numbanks);
+ static void set_banksize(device_t &device, int _banksize);
+
+ const char* m_decrypted_tag;
+ UINT8* m_decrypted_ptr;
+ UINT8* m_region_ptr;
+ int m_decode_size;
+ int m_numbanks;
+ int m_banksize;
+ bool m_decryption_done;
+
+ void set_decrypted_p(UINT8* ptr);
+ void set_region_p(UINT8* ptr);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void decrypt();
+};
+
+
+// actual encrypted CPUs
+class sega_315_5132_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5132_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5155_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5155_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5110_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5135_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5135_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5051_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5051_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5098_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5098_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5102_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5102_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5065_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5065_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_315_5064_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5064_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_315_5033_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5033_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5041_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5048_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5048_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5093_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5093_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5099_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5099_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_spat_device : public segacrpt_z80_device
+{
+public:
+ sega_315_spat_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5015_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5015_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+class sega_315_5133_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5133_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5014_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5014_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5013_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5013_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5061_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5061_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+
+class sega_315_5018_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5018_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5010_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+
+class sega_cpu_pbactio4_device : public segacrpt_z80_device
+{
+public:
+ sega_cpu_pbactio4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5028_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5028_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+class sega_315_5084_device : public segacrpt_z80_device
+{
+public:
+ sega_315_5084_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
+protected:
+ virtual void decrypt() override;
+};
+
+
+extern const device_type SEGA_315_5132;
+extern const device_type SEGA_315_5155;
+extern const device_type SEGA_315_5110;
+extern const device_type SEGA_315_5135;
+extern const device_type SEGA_315_5051;
+extern const device_type SEGA_315_5098;
+extern const device_type SEGA_315_5102;
+extern const device_type SEGA_315_5065;
+extern const device_type SEGA_315_5064;
+extern const device_type SEGA_315_5033;
+extern const device_type SEGA_315_5041;
+extern const device_type SEGA_315_5048;
+extern const device_type SEGA_315_5093;
+extern const device_type SEGA_315_5099;
+extern const device_type SEGA_315_SPAT;
+extern const device_type SEGA_315_5015;
+extern const device_type SEGA_315_5133;
+extern const device_type SEGA_315_5014;
+extern const device_type SEGA_315_5013;
+extern const device_type SEGA_315_5061;
+extern const device_type SEGA_315_5018;
+extern const device_type SEGA_315_5010;
+extern const device_type SEGA_CPU_PBACTIO4;
+extern const device_type SEGA_315_5028;
+extern const device_type SEGA_315_5084;
+
+
+#endif /// __SEGACRPT_Z80__
+
diff --git a/src/mame/machine/segaic16.cpp b/src/mame/machine/segaic16.cpp
index 3cb068c70e6..611d8568a96 100644
--- a/src/mame/machine/segaic16.cpp
+++ b/src/mame/machine/segaic16.cpp
@@ -200,8 +200,8 @@ WRITE16_MEMBER( sega_16bit_common_base::philko_paletteram_w )
sega_315_5195_mapper_device::sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEGA_315_5195_MEM_MAPPER, "Sega 315-5195 Memory Mapper", tag, owner, clock, "sega_315_5195", __FILE__),
- m_cputag(nullptr),
- m_cpu(nullptr),
+ m_cpu(*this),
+ m_cpuregion(*this),
m_space(nullptr),
m_decrypted_space(nullptr),
m_curregion(0)
@@ -217,7 +217,8 @@ sega_315_5195_mapper_device::sega_315_5195_mapper_device(const machine_config &m
void sega_315_5195_mapper_device::static_set_cputag(device_t &device, const char *cpu)
{
sega_315_5195_mapper_device &mapper = downcast<sega_315_5195_mapper_device &>(device);
- mapper.m_cputag = cpu;
+ mapper.m_cpu.set_tag(cpu);
+ mapper.m_cpuregion.set_tag(cpu);
}
@@ -392,7 +393,7 @@ void sega_315_5195_mapper_device::map_as_rom(UINT32 offset, UINT32 length, offs_
}
// don't map if the start is past the end of the ROM region
- offs_t romsize = m_cpu->region()->bytes();
+ offs_t romsize = m_cpuregion->bytes();
if (rgnoffset < romsize)
{
// clamp the end to the ROM size
@@ -408,7 +409,7 @@ void sega_315_5195_mapper_device::map_as_rom(UINT32 offset, UINT32 length, offs_
// configure the bank
memory_bank *bank = owner()->membank(bank_name);
memory_bank *decrypted_bank = owner()->membank(decrypted_bank_name);
- UINT8 *memptr = m_cpu->region()->base() + rgnoffset;
+ UINT8 *memptr = m_cpuregion->base() + rgnoffset;
bank->set_base(memptr);
// remember this bank, and decrypt if necessary
@@ -527,19 +528,14 @@ void sega_315_5195_mapper_device::device_start()
m_sound_read.bind_relative_to(*owner());
m_sound_write.bind_relative_to(*owner());
- // find our CPU
- m_cpu = siblingdevice<m68000_device>(m_cputag);
- if (m_cpu == nullptr)
- throw emu_fatalerror("Unable to find sibling device '%s'", m_cputag);
-
// if we are mapping an FD1089, tell all the banks
- fd1089_base_device *fd1089 = dynamic_cast<fd1089_base_device *>(m_cpu);
+ fd1089_base_device *fd1089 = dynamic_cast<fd1089_base_device *>(m_cpu.target());
if (fd1089 != nullptr)
for (auto & elem : m_banks)
elem.set_decrypt(fd1089);
// if we are mapping an FD1094, register for state change notifications and tell all the banks
- fd1094_device *fd1094 = dynamic_cast<fd1094_device *>(m_cpu);
+ fd1094_device *fd1094 = dynamic_cast<fd1094_device *>(m_cpu.target());
if (fd1094 != nullptr)
{
fd1094->notify_state_change(fd1094_device::state_change_delegate(FUNC(sega_315_5195_mapper_device::fd1094_state_change), this));
@@ -550,7 +546,7 @@ void sega_315_5195_mapper_device::device_start()
// find the address space that is to be mapped
m_space = &m_cpu->space(AS_PROGRAM);
if (m_space == nullptr)
- throw emu_fatalerror("Unable to find program address space on device '%s'", m_cputag);
+ throw emu_fatalerror("Unable to find program address space on device '%s'", m_cpu.finder_tag());
m_decrypted_space = m_cpu->has_space(AS_DECRYPTED_OPCODES) ? &m_cpu->space(AS_DECRYPTED_OPCODES) : nullptr;
diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h
index 5b4b4812bd4..b647d1012a0 100644
--- a/src/mame/machine/segaic16.h
+++ b/src/mame/machine/segaic16.h
@@ -22,7 +22,7 @@
#define MCFG_SEGA_315_5195_MAPPER_ADD(_tag, _cputag, _class, _mapper, _read, _write) \
MCFG_DEVICE_ADD(_tag, SEGA_315_5195_MEM_MAPPER, 0) \
- sega_315_5195_mapper_device::static_set_cputag(*device, _cputag); \
+ sega_315_5195_mapper_device::static_set_cputag(*device, "^" _cputag); \
sega_315_5195_mapper_device::static_set_mapper(*device, sega_315_5195_mapper_device::mapper_delegate(&_class::_mapper, #_class "::" #_mapper, NULL, (_class *)0)); \
sega_315_5195_mapper_device::static_set_sound_readwrite(*device, sega_315_5195_mapper_device::sound_read_delegate(&_class::_read, #_class "::" #_read, NULL, (_class *)0), sega_315_5195_mapper_device::sound_write_delegate(&_class::_write, #_class "::" #_write, NULL, (_class *)0));
@@ -162,13 +162,13 @@ private:
void fd1094_state_change(UINT8 state);
// configuration
- const char * m_cputag;
+ required_device<m68000_device> m_cpu;
+ required_memory_region m_cpuregion;
mapper_delegate m_mapper;
sound_read_delegate m_sound_read;
sound_write_delegate m_sound_write;
// internal state
- m68000_device * m_cpu;
address_space * m_space;
address_space * m_decrypted_space;
UINT8 m_regs[0x20];
diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp
index 598a94ebddc..c663acae492 100644
--- a/src/mame/machine/st0016.cpp
+++ b/src/mame/machine/st0016.cpp
@@ -31,6 +31,7 @@ ADDRESS_MAP_END
st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: z80_device(mconfig, ST0016_CPU, "ST0016", tag, owner, clock, "st0016_cpu", __FILE__),
+ device_gfx_interface(mconfig, *this, nullptr, "palette"),
st0016_game(-1),
st0016_spr_bank(0),
st0016_spr2_bank(0),
@@ -43,11 +44,7 @@ st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *
m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_io_map)),
m_space_config("regs", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_map)),
-
- m_screen(*this, ":screen"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
-
+ m_screen(*this, ":screen")
{
for (auto & elem : st0016_vregs)
elem = 0;
@@ -109,14 +106,10 @@ READ8_MEMBER(st0016_cpu_device::soundram_read)
return m_charram[offset];
}
-static GFXDECODE_START( st0016 )
-GFXDECODE_END
-
/* CPU interface */
static MACHINE_CONFIG_FRAGMENT( st0016_cpu )
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", st0016)
MCFG_PALETTE_ADD("palette", 16*16*4+1)
MCFG_DEVICE_ADD("stsnd", ST0016, 0)
@@ -218,8 +211,8 @@ WRITE8_MEMBER(st0016_cpu_device::st0016_palette_ram_w)
st0016_paletteram[ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset]=data;
val=st0016_paletteram[color*2]+(st0016_paletteram[color*2+1]<<8);
if(!color)
- m_palette->set_pen_color(UNUSED_PEN,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10)); /* same as color 0 - bg ? */
- m_palette->set_pen_color(color,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10));
+ palette().set_pen_color(UNUSED_PEN,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10)); /* same as color 0 - bg ? */
+ palette().set_pen_color(color,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10));
}
READ8_MEMBER(st0016_cpu_device::st0016_character_ram_r)
@@ -230,7 +223,7 @@ READ8_MEMBER(st0016_cpu_device::st0016_character_ram_r)
WRITE8_MEMBER(st0016_cpu_device::st0016_character_ram_w)
{
m_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset]=data;
- m_gfxdecode->gfx(st0016_ramgfx)->mark_dirty(st0016_char_bank);
+ gfx(st0016_ramgfx)->mark_dirty(st0016_char_bank);
}
READ8_MEMBER(st0016_cpu_device::st0016_vregs_r)
@@ -383,7 +376,7 @@ void st0016_cpu_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip
*/
- gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
+ gfx_element *gfx = this->gfx(st0016_ramgfx);
int i, j, lx, ly, x, y, code, offset, length, sx, sy, color, flipx, flipy, scrollx, scrolly/*,plx,ply*/;
@@ -587,13 +580,13 @@ void st0016_cpu_device::startup()
/* find first empty slot to decode gfx */
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
- if (m_gfxdecode->gfx(gfx_index) == nullptr)
+ if (gfx(gfx_index) == nullptr)
break;
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
- m_gfxdecode->set_gfx(gfx_index, std::make_unique<gfx_element>(m_palette, charlayout, m_charram.get(), 0, 0x40, 0));
+ set_gfx(gfx_index, std::make_unique<gfx_element>(palette(), charlayout, m_charram.get(), 0, 0x40, 0));
st0016_ramgfx = gfx_index;
spr_dx=0;
@@ -607,7 +600,7 @@ void st0016_cpu_device::startup()
void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
{
- gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
+ gfx_element *gfx = this->gfx(st0016_ramgfx);
int j;
//for(j=0x40-8;j>=0;j-=8)
for (j = 0; j < 0x40; j += 8)
diff --git a/src/mame/machine/st0016.h b/src/mame/machine/st0016.h
index 6401ddc5c19..447ce7e4d3c 100644
--- a/src/mame/machine/st0016.h
+++ b/src/mame/machine/st0016.h
@@ -34,7 +34,7 @@ extern UINT8 macs_cart_slot;
-class st0016_cpu_device : public z80_device
+class st0016_cpu_device : public z80_device, public device_gfx_interface
{
public:
st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
@@ -97,13 +97,6 @@ protected:
}
};
required_device<screen_device> m_screen;
- required_device<gfxdecode_device> m_gfxdecode;
-
-public: // speglsht needs to access this for mixing
- required_device<palette_device> m_palette;
-
-private:
-
};
diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp
index 132a46e75bf..96d2a688326 100644
--- a/src/mame/machine/xbox.cpp
+++ b/src/mame/machine/xbox.cpp
@@ -492,7 +492,7 @@ static void geforce_pci_w(device_t *busdevice, device_t *device, int function, i
}
/*
- * ohci usb controller (placeholder for now)
+ * ohci usb controller
*/
#ifdef LOG_OHCI
@@ -552,30 +552,36 @@ WRITE32_MEMBER(xbox_base_state::usbctrl_w)
logerror("usb controller 0 register %s write %08X\n", usbregnames[offset], data);
#endif
if (offset == HcRhStatus) {
- if (data & 0x80000000)
- ohcist.hc_regs[HcRhStatus] &= ~0x8000;
- if (data & 0x00020000)
- ohcist.hc_regs[HcRhStatus] &= ~0x0002;
- if (data & 0x00010000)
- ohcist.hc_regs[HcRhStatus] &= ~0x0001;
+ if (data & CRWE)
+ ohcist.hc_regs[HcRhStatus] &= ~DRWE;
+ if (data & OCIC)
+ ohcist.hc_regs[HcRhStatus] &= ~OCI;
+ if (data & LPSC)
+ ohcist.hc_regs[HcRhStatus] &= ~LPS;
return;
}
if (offset == HcControl) {
int hcfs;
- hcfs = (data >> 6) & 3;
+ hcfs = (data >> 6) & 3; // HostControllerFunctionalState
if (hcfs == UsbOperational) {
ohcist.timer->enable();
ohcist.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1));
ohcist.writebackdonehadcounter = 7;
+ // need to load the FrameRemaining field of HcFmRemaining with the value of the FrameInterval field in HcFmInterval
}
else
ohcist.timer->enable(false);
- ohcist.state = hcfs;
ohcist.interruptbulkratio = (data & 3) + 1;
+ if ((hcfs != UsbReset) && (ohcist.state == UsbReset))
+ {
+ ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange;
+ usb_ohci_interrupts();
+ }
+ ohcist.state = hcfs;
}
if (offset == HcCommandStatus) {
- if (data & 1)
+ if (data & 1) // HostControllerReset
ohcist.hc_regs[HcControl] |= 3 << 6;
ohcist.hc_regs[HcCommandStatus] |= data;
return;
@@ -597,24 +603,69 @@ WRITE32_MEMBER(xbox_base_state::usbctrl_w)
}
if (offset >= HcRhPortStatus1) {
int port = offset - HcRhPortStatus1 + 1; // port 0 not used
- // bit 0 ClearPortEnable: 1 clears PortEnableStatus
- // bit 1 SetPortEnable: 1 sets PortEnableStatus
- // bit 2 SetPortSuspend: 1 sets PortSuspendStatus
- // bit 3 ClearSuspendStatus: 1 clears PortSuspendStatus
- // bit 4 SetPortReset: 1 sets PortResetStatus
- if (data & 0x10) {
- ohcist.hc_regs[offset] |= 0x10;
+ // bit 0 R:CurrentConnectStatus W:ClearPortEnable: 1 clears PortEnableStatus
+ if (data & CCS) {
+ ohcist.hc_regs[offset] &= ~PES;
+ ohcist.address[ohcist.ports[port].address].port = -1;
+ }
+ // bit 1 R:PortEnableStatus W:SetPortEnable: 1 sets PortEnableStatus
+ if (data & PES) {
+ ohcist.hc_regs[offset] |= PES;
+ // the port is enabled, so the device connected to it can communicate on the bus
+ ohcist.address[ohcist.ports[port].address].function = ohcist.ports[port].function;
+ ohcist.address[ohcist.ports[port].address].port = port;
+ }
+ // bit 2 R:PortSuspendStatus W:SetPortSuspend: 1 sets PortSuspendStatus
+ if (data & PSS) {
+ ohcist.hc_regs[offset] |= PSS;
+ }
+ // bit 3 R:PortOverCurrentIndicator W:ClearSuspendStatus: 1 clears PortSuspendStatus
+ if (data & POCI) {
+ ohcist.hc_regs[offset] &= ~PSS;
+ }
+ // bit 4 R: PortResetStatus W:SetPortReset: 1 sets PortResetStatus
+ if (data & PRS) {
+ ohcist.hc_regs[offset] |= PRS;
+ if (ohcist.ports[port].address >= 0)
+ ohcist.address[ohcist.ports[port].address].port = -1;
+ ohcist.ports[port].address = 0;
+ if (ohcist.hc_regs[offset] & PES)
+ {
+ ohcist.address[0].function = ohcist.ports[port].function;
+ ohcist.address[0].port = port;
+ }
ohcist.ports[port].function->execute_reset();
// after 10ms set PortResetStatusChange and clear PortResetStatus and set PortEnableStatus
ohcist.ports[port].delay = 10;
}
- // bit 8 SetPortPower: 1 sets PortPowerStatus
- // bit 9 ClearPortPower: 1 clears PortPowerStatus
- // bit 16 1 clears ConnectStatusChange
- // bit 17 1 clears PortEnableStatusChange
- // bit 18 1 clears PortSuspendStatusChange
- // bit 19 1 clears PortOverCurrentIndicatorChange
- // bit 20 1 clears PortResetStatusChange
+ // bit 8 R:PortPowerStatus W:SetPortPower: 1 sets PortPowerStatus
+ if (data & PPS) {
+ ohcist.hc_regs[offset] |= PPS;
+ }
+ // bit 9 R:LowSpeedDeviceAttached W:ClearPortPower: 1 clears PortPowerStatus
+ if (data & LSDA) {
+ ohcist.hc_regs[offset] &= ~PPS;
+ }
+ // bit 16 R:ConnectStatusChange W: 1 clears ConnectStatusChange
+ if (data & CSC) {
+ ohcist.hc_regs[offset] &= ~CSC;
+ }
+ // bit 17 R:PortEnableStatusChange W: 1 clears PortEnableStatusChange
+ if (data & PESC) {
+ ohcist.hc_regs[offset] &= ~PESC;
+ }
+ // bit 18 R:PortSuspendStatusChange W: 1 clears PortSuspendStatusChange
+ if (data & PSSC) {
+ ohcist.hc_regs[offset] &= ~PSSC;
+ }
+ // bit 19 R:PortOverCurrentIndicatorChange W: 1 clears PortOverCurrentIndicatorChange
+ if (data & POCIC) {
+ ohcist.hc_regs[offset] &= ~POCIC;
+ }
+ // bit 20 R:PortResetStatusChange W: 1 clears PortResetStatusChange
+ if (data & PRSC) {
+ ohcist.hc_regs[offset] &= ~PRSC;
+ }
if (ohcist.hc_regs[offset] != old)
ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange;
usb_ohci_interrupts();
@@ -644,7 +695,9 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
if (ohcist.ports[p].delay > 0) {
ohcist.ports[p].delay--;
if (ohcist.ports[p].delay == 0) {
- ohcist.hc_regs[HcRhPortStatus1 + p - 1] = (ohcist.hc_regs[HcRhPortStatus1 + p - 1] & ~(1 << 4)) | (1 << 20) | (1 << 1); // bit 1 PortEnableStatus
+ ohcist.hc_regs[HcRhPortStatus1 + p - 1] = (ohcist.hc_regs[HcRhPortStatus1 + p - 1] & ~PRS) | PRSC | PES;
+ ohcist.address[ohcist.ports[p].address].function = ohcist.ports[p].function;
+ ohcist.address[ohcist.ports[p].address].port = p;
changed = 1;
}
}
@@ -654,9 +707,9 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
{
// select list, do transfer
if (list == 0) {
- if (ohcist.hc_regs[HcControl] & (1 << 2)) {
+ if (ohcist.hc_regs[HcControl] & PLE) {
// periodic list
- if (ohcist.hc_regs[HcControl] & (1 << 3)) {
+ if (ohcist.hc_regs[HcControl] & IE) {
// isochronous list
}
}
@@ -665,7 +718,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
if (list == 1) {
// control list
// check if control list active
- if (ohcist.hc_regs[HcControl] & (1 << 4)) {
+ if (ohcist.hc_regs[HcControl] & CLE) {
cont = true;
while (cont == true) {
// if current endpoint descriptor is not 0 use it, otherwise ...
@@ -736,8 +789,8 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
}
}
// should check for time available
- // execute transaction
- done=ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps);
+ // execute transaction ohcist.endpoint_descriptor.fa
+ done = ohcist.address[ohcist.endpoint_descriptor.fa].function->execute_transfer(ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps);
// if receiving ...
if (pid == InPid) {
// ... store done bytes
@@ -751,7 +804,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
// status writeback (CompletionCode field, DataToggleControl field, CurrentBufferPointer field, ErrorCount field)
ohcist.transfer_descriptor.cc = NoError;
ohcist.transfer_descriptor.t = (ohcist.transfer_descriptor.t ^ 1) | 2;
- // if all data is transferred (or there was no data to transfer) cbp must be 0 ?
+ // if all data is transferred (or there was no data to transfer) cbp must be 0, otherwise it must be updated
if ((done == remain) || (pid == SetupPid))
b = 0;
ohcist.transfer_descriptor.cbp = b;
@@ -793,7 +846,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
// one bulk every n control transfers
ohcist.interruptbulkratio--;
if (ohcist.interruptbulkratio <= 0) {
- ohcist.interruptbulkratio = (ohcist.hc_regs[HcControl] & 3) + 1;
+ ohcist.interruptbulkratio = (ohcist.hc_regs[HcControl] & 3) + 1; // ControlBulkServiceRatio
cont = false;
}
}
@@ -803,7 +856,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
if (list == 2) {
// bulk list
// check if bulk list active
- if (ohcist.hc_regs[HcControl] & (1 << 5)) {
+ if (ohcist.hc_regs[HcControl] & BLE) {
// if current endpoint descriptor is not 0 use it, otherwise ...
if (ohcist.hc_regs[HcBulkCurrentED] == 0) {
// ... check the filled bit ...
@@ -868,8 +921,8 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
}
}
// should check for time available
- // execute transaction
- done = ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps);
+ // execute transaction ohcist.endpoint_descriptor.fa
+ done = ohcist.address[ohcist.endpoint_descriptor.fa].function->execute_transfer(ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps);
// if receiving ...
if (pid == InPid) {
// ... store done bytes
@@ -883,7 +936,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
// status writeback (CompletionCode field, DataToggleControl field, CurrentBufferPointer field, ErrorCount field)
ohcist.transfer_descriptor.cc = NoError;
ohcist.transfer_descriptor.t = (ohcist.transfer_descriptor.t ^ 1) | 2;
- // if all data is transferred (or there was no data to transfer) cbp must be 0 ?
+ // if all data is transferred (or there was no data to transfer) cbp must be 0, otherwise it must be updated
if (done == remain)
b = 0;
ohcist.transfer_descriptor.cbp = b;
@@ -925,9 +978,9 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer)
}
}
// go to the next list
- if ((ohcist.hc_regs[HcCommandStatus] & (1 << 1)) && (ohcist.hc_regs[HcControl] & (1 << 4)))
+ if ((ohcist.hc_regs[HcCommandStatus] & (1 << 1)) && (ohcist.hc_regs[HcControl] & CLE))
list = 1; // go to control list if enabled and filled
- else if ((ohcist.hc_regs[HcCommandStatus] & (1 << 2)) && (ohcist.hc_regs[HcControl] & (1 << 5)))
+ else if ((ohcist.hc_regs[HcCommandStatus] & (1 << 2)) && (ohcist.hc_regs[HcControl] & BLE))
list = 2; // otherwise stai in bulk list if enabled and filled
else
list = 0; // if no control or bulk lists, go to periodic list
@@ -960,12 +1013,19 @@ void xbox_base_state::usb_ohci_plug(int port, ohci_function_device *function)
{
if ((port > 0) && (port <= 4)) {
ohcist.ports[port].function = function;
- ohcist.hc_regs[HcRhPortStatus1+port-1] = 1;
+ ohcist.ports[port].address = -1;
+ ohcist.hc_regs[HcRhPortStatus1+port-1] = CCS | CSC;
+ if (ohcist.state != UsbReset)
+ {
+ ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange;
+ usb_ohci_interrupts();
+ }
}
}
-ohci_function_device::ohci_function_device(running_machine &machine)
+ohci_function_device::ohci_function_device(running_machine &machine, xbox_base_state *usb_bus_manager)
{
+ busmanager = usb_bus_manager;
state = DefaultState;
descriptors = auto_alloc_array(machine, UINT8, 1024);
descriptors_pos = 0;
@@ -1244,7 +1304,7 @@ void ohci_function_device::execute_reset()
newaddress = 0;
}
-int ohci_function_device::execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size)
+int ohci_function_device::execute_transfer(int endpoint, int pid, UINT8 *buffer, int size)
{
int descriptortype, descriptorindex;
@@ -1355,6 +1415,7 @@ int ohci_function_device::execute_transfer(int address, int endpoint, int pid, U
if ((endpoint == 0) && (settingaddress == true))
{
// set of address is active at end of status stage
+ busmanager->usb_ohci_device_address_changed(address, newaddress);
address = newaddress;
settingaddress = false;
state = AddressState;
@@ -1421,8 +1482,8 @@ const USBStandardInterfaceDescriptor ohci_game_controller_device::intdesc = { 9,
const USBStandardEndpointDescriptor ohci_game_controller_device::enddesc82 = { 7,5,0x82,3,0x20,4 };
const USBStandardEndpointDescriptor ohci_game_controller_device::enddesc02 = { 7,5,0x02,3,0x20,4 };
-ohci_game_controller_device::ohci_game_controller_device(running_machine &machine) :
- ohci_function_device(machine)
+ohci_game_controller_device::ohci_game_controller_device(running_machine &machine, xbox_base_state *usb_bus_manager) :
+ ohci_function_device(machine, usb_bus_manager)
{
add_device_descriptor(devdesc);
add_configuration_descriptor(condesc);
@@ -1434,7 +1495,7 @@ ohci_game_controller_device::ohci_game_controller_device(running_machine &machin
int ohci_game_controller_device::handle_nonstandard_request(int endpoint, USBSetupPacket *setup)
{
// >=8 ==42 !=0 !=0 1,3 2<20 <=20
- const UINT8 mytestdata[16] = { 0x10,0x42 ,0x32,0x43,1 ,0x65,0x18,0x20,0x98,0xa9,0xba,0xcb,0xdc,0xed,0xfe };
+ static const UINT8 mytestdata[16] = { 0x10,0x42 ,0x32,0x43,1 ,0x65,0x18,0x20,0x98,0xa9,0xba,0xcb,0xdc,0xed,0xfe };
if (endpoint != 0)
return -1;
@@ -1572,6 +1633,13 @@ void xbox_base_state::usb_ohci_writeback_isochronous_transfer_descriptor(UINT32
ohcist.space->write_dword(address + 28, w);
}
+void xbox_base_state::usb_ohci_device_address_changed(int old_address, int new_address)
+{
+ ohcist.address[new_address].function = ohcist.address[old_address].function;
+ ohcist.address[new_address].port = ohcist.address[old_address].port;
+ ohcist.address[old_address].port = -1;
+}
+
/*
* Audio
*/
@@ -2105,7 +2173,7 @@ ADDRESS_MAP_END
void xbox_base_state::machine_start()
{
- //ohci_game_controller_device *usb_device;
+ ohci_game_controller_device *usb_device;
nvidia_nv2a = std::make_unique<nv2a_renderer>(machine());
memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer));
@@ -2140,13 +2208,19 @@ void xbox_base_state::machine_start()
ohcist.hc_regs[HcFmInterval] = 0x2edf;
ohcist.hc_regs[HcLSThreshold] = 0x628;
ohcist.hc_regs[HcRhDescriptorA] = 4;
+ ohcist.hc_regs[HcControl] = UsbReset << 6;
+ ohcist.state = UsbReset;
ohcist.interruptbulkratio = 1;
ohcist.writebackdonehadcounter = 7;
+ for (int n = 0; n <= 4; n++)
+ ohcist.ports[n].address = -1;
+ for (int n = 0; n < 256; n++)
+ ohcist.address[n].port = -1;
ohcist.space = &m_maincpu->space();
ohcist.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::usb_ohci_timer), this), (void *)"USB OHCI Timer");
ohcist.timer->enable(false);
- //usb_device = new ohci_game_controller_device(machine());
- //usb_ohci_plug(3, usb_device); // connect top root hub port 3, chihiro needs to use 1 and 2
+ usb_device = new ohci_game_controller_device(machine(), this);
+ usb_ohci_plug(3, usb_device); // connect to root hub port 3, chihiro needs to use 1 and 2
// super-io
memset(&superiost, 0, sizeof(superiost));
superiost.configuration_mode = false;
diff --git a/src/mame/machine/zs01.cpp b/src/mame/machine/zs01.cpp
index 613a3cdcc1a..2816d865ee0 100644
--- a/src/mame/machine/zs01.cpp
+++ b/src/mame/machine/zs01.cpp
@@ -32,6 +32,7 @@ const device_type ZS01 = &device_creator<zs01_device>;
zs01_device::zs01_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t( mconfig, ZS01, "Konami ZS01 PIC", tag, owner, clock, "zs01", __FILE__ ),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_cs( 0 ),
m_rst( 0 ),
m_scl( 0 ),
@@ -581,7 +582,7 @@ void zs01_device::nvram_default()
int expected_bytes = sizeof( m_response_to_reset ) + sizeof( m_command_key ) + sizeof( m_data_key ) + sizeof( m_data );
- if( !m_region )
+ if (!m_region.found())
{
logerror( "zs01(%s) region not found\n", tag() );
}
diff --git a/src/mame/machine/zs01.h b/src/mame/machine/zs01.h
index 2606cb5341e..b7266a20cbd 100644
--- a/src/mame/machine/zs01.h
+++ b/src/mame/machine/zs01.h
@@ -74,6 +74,7 @@ private:
// internal state
const char *m_ds2401_tag;
+ optional_memory_region m_region;
int m_cs;
int m_rst;
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index c520531793c..6fe4aef0f18 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -1209,6 +1209,7 @@ laser128 // ??? 1987 Laser 128
mprof3 // Microprofessor III
prav8c // Pravetz 8C
tk3000 // Microdigital TK3000
+spectred
@source:apple2gs.cpp
apple2gs // Aug 1989 Apple IIgs ROM03
@@ -2265,6 +2266,7 @@ bbcbc // 1985 BBC Bridge Companion
bbusters // A9003 'BB' (c) 1989
bbustersu // A9003 'BB' (c) 1989
bbustersua // A9003 'BB' (c) 1989
+bbustersj //
mechatt // A8002 'MA' (c) 1989
mechattj // A8002 'MA' (c) 1989
mechattu // A8002 'MA' (c) 1989
@@ -11804,6 +11806,7 @@ cscg // * German
cscsp // * Spanish
fexcel //
fexcelv //
+fscc9 //
fscc12 //
@source:fidel68k.cpp
@@ -12290,6 +12293,7 @@ monsterz // (c) 1982 Nihon (Arcade TV Game List - P.102,
moonal2 // [1980] Nichibutsu
moonal2b // [1980] Nichibutsu
moonaln // [Nichibutsu] (Karateco license) or hack
+kamikazp // bootleg (Potomac Games)
mooncmw // bootleg
mooncptc // bootleg (Petaco S.A.)
mooncreg // bootleg
@@ -13688,8 +13692,11 @@ maniac // Ideal
@source:hh_sm510.cpp
gnwmndon // Nintendo
kcontra // Konami
+kgradius // Konami
+kloneran // Konami
ktmnt // Konami
ktopgun // Konami
+nupogodi //
@source:hh_tms1k.cpp
amaztron // Coleco
@@ -13790,6 +13797,7 @@ sgnascar // 2000.09 Nascar Arcade
@source:himesiki.cpp
himesiki // (c) 1989 Hi-Soft
androidp // (c) 198? Nasco
+androidpo // (c) 198? Nasco
@source:hitme.cpp
barricad // (c) 1976 Ramtek
@@ -15944,6 +15952,9 @@ jubileep //
@source:juicebox.cpp
juicebox //
+@source:jungleyo.cpp
+jungleyo
+
@source:junior.cpp
junior //
@@ -16858,6 +16869,7 @@ leaguemn // (c) 1993 Irem (Japan)
lethalth // (c) 1991 Irem (World)
majtitl2 // (c) 1992 Irem (World)
majtitl2a //
+majtitl2b //
majtitl2j // (c) 1992 Irem (Japan)
mysticri // (c) 1992 Irem (World)
mysticrib // bootleg?
@@ -16951,6 +16963,7 @@ mcolors // 1999 unknown
musicsrt // (c) 1995 ABM Games
sgsafari // (c) 1996 New Impeuropex Corp.
suprpool // (c) 1997 ABM Games
+lunaprk // (c) 1998 ABM Games
@source:magicard.cpp
hotslots // (c) 2002 Impera
@@ -27052,6 +27065,7 @@ mtlchampu // GX234 (c) 1993 (US)
mtlchampu1 // GX234 (c) 1993 (US)
mystwarr // GX128 (c) 1993 (World)
mystwarra // GX128 (c) 1993 (Asia)
+mystwarraa // GX128 (c) 1993 (Asia)
mystwarrj // GX128 (c) 1993 (Japan)
mystwarru // GX128 (c) 1993 (US)
viostorm // GX168 (c) 1993 (Europe)
@@ -28016,6 +28030,7 @@ garoup // 0253 (c) 1999 SNK
ghostlop // 0228 GhostLop (prototype) 1996? Data East
goalx3 // 0209 (c) 1995 Visco
gowcaizr // 0094 (c) 1995 Technos
+unkneo // prototype
gpilots // 0020 (c) 1991 SNK
gpilotsh // 0020 (c) 1991 SNK
gururin // 0067 (c) 1994 Face
@@ -28303,6 +28318,7 @@ rdaction // UPL-87003?(c) 1987 + World Games license
robokid // UPL-88013 (c) 1988
robokidj // UPL-88013 (c) 1988
robokidj2 // UPL-88013 (c) 1988
+robokidj3 //
@source:ninjaw.cpp
darius2 // C07 (c) 1989 Taito Corporation (Japan)
@@ -28872,6 +28888,7 @@ sicpc1605 //
ssam88s //
sx16 // Sanyo SX-16
zdsupers //
+ncrpc4i // NCR PC4i
@source:pc100.cpp
pc100 //
@@ -29932,6 +29949,7 @@ pc_moglf // (c) 1991 Nintendo
pc_mtoid // (c) 1986 Nintendo
pc_ngai2 // (c) 1990 Tecmo (Nintendo of America license)
pc_ngai3 // (c) 1991 Tecmo (Nintendo of America license)
+pc_ttoon //
pc_ngaid // (c) 1989 Tecmo (Nintendo of America license)
pc_pinbt // (c) 1988 Rare (Nintendo of America license)
pc_pwbld // (c) 1991 Taito (Nintendo of America license)
@@ -30695,6 +30713,7 @@ raidendxa2 // (c) 1994 Seibu Kaihatsu + Metrotainment licen
raidendxch //
raidendxg // (c) 1994 Seibu Kaihatsu + Tuning license
raidendxj // (c) 1994 Seibu Kaihatsu
+raidendxja // (c) 1994 Seibu Kaihatsu
raidendxk // (c) 1994 Seibu Kaihatsu
raidendxnl // (c) 1994 Seibu Kaihatsu
raidendxu // (c) 1994 Seibu Kaihatsu + Fabtek license
@@ -32779,6 +32798,7 @@ neraidou // Bootleg?
skylncr // (c) 1995 Bordun International
sstar97 // (c) 199? Bordun International
bdream97 // Bootleg?
+sonikfig // Z Games
@source:skyraid.cpp
skyraid // 009709 1978/03 [6502]
@@ -33848,6 +33868,7 @@ wboy4 // 834-5984 (c) 1986 + Escape license (S1)
wboy5 // 834-5984 (c) 1986 + Escape license (S1)
wboyo // 834-5984 (c) 1986 + Escape license (S1)
wboysys2 // 834-5984 (c) 1986 + Escape license (S1)
+wboysys2a //
wboyu // 834-5753 (? maybe a conversion) (c) 1986 + Escape license (S1)
wboyub // bootleg of wboyu
wmatch // (c) 1984 (S1)
@@ -33994,7 +34015,8 @@ hthero // 1991.03 C80 (c) 1990 Taito Corporation (Japan
koshien // 1991.04 C81 (c) 1990 Taito Corporation (Japan)
liquidk // 1990.?? C49 (c) 1990 Taito Corporation Japan (World)
liquidku // 1990.?? C49 (c) 1990 Taito America Corporation (US)
-majest12 // 1990.11 C64 (c) 1990 Taito Corporation (Japan)
+majest12j // 1990.11 C64 (c) 1990 Taito Corporation (Japan)
+majest12u // 1990.11 C64 (c) 1990 Taito America Corporation (US)
megablst // 1989.?? C11 (c) 1989 Taito Corporation Japan (World)
megablstj // 1989.11 C11 (c) 1989 Taito Corporation (Japan)
megablstu // 1989.?? C11 (c) 1989 Taito America Corporation (US)
@@ -35802,7 +35824,8 @@ cstlevna // (c) 1987 Konami licensed to Nintendo
drmario // (c) 1990 Nintendo
duckhunt // (c) 1985 Nintendo
excitebk // (c) 1984 Nintendo
-excitebka // (c) 1984 Nintendo
+excitebko // (c) 1984 Nintendo
+excitebkj // (c) 1984 Nintendo
goonies // (c) 1986 Konami
hogalley // (c) 1985 Nintendo
iceclimb // (c) 1984 Nintendo
diff --git a/src/mame/nl.lst b/src/mame/nl.lst
index 67723374e4b..0b36b3e4e6f 100644
--- a/src/mame/nl.lst
+++ b/src/mame/nl.lst
@@ -29,3 +29,28 @@ pong // (c) 1972 Atari
pongd // (c) 1975 Atari
pongf // (c) 1972 Atari
breakout // (c) 1976 Atari
+
+@source:m62.cpp
+battroad // (c) 1984
+horizon // (c) 1985
+kidniki // (c) 1986 + Data East USA license
+kidnikiu // (c) 1986 + Data East USA license
+kungfub // bootleg
+kungfub2 // bootleg
+kungfum // (c) 1984
+kungfumd // (c) 1984 + Data East license
+ldrun // (c) 1984 licensed from Broderbund
+ldrun2 // (c) 1984 licensed from Broderbund
+ldrun3 // (c) 1985 licensed from Broderbund
+ldrun3j // (c) 1985 licensed from Broderbund
+ldrun4 // (c) 1986 licensed from Broderbund
+ldruna // (c) 1984 licensed from Broderbund
+lithero // bootleg
+lotlot // (c) 1985 licensed from Tokuma Shoten
+spartanx // (c) 1984 (Japan)
+spelunk2 // (c) 1986 licensed from Broderbund
+spelunkr // (c) 1985 licensed from Broderbund
+spelunkrj // (c) 1985 licensed from Broderbund
+yanchamr // (c) 1986 (Japan)
+youjyudn // (c) 1986 (Japan)
+
diff --git a/src/mame/osd/windows/mame/mame.ico b/src/mame/osd/windows/mame/mame.ico
deleted file mode 100644
index 62761447fc2..00000000000
--- a/src/mame/osd/windows/mame/mame.ico
+++ /dev/null
Binary files differ
diff --git a/src/mame/osd/windows/mame/mame.man b/src/mame/osd/windows/mame/mame.man
deleted file mode 100644
index e08eba181cb..00000000000
--- a/src/mame/osd/windows/mame/mame.man
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
- <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MAME" type="win32" />
- <description>Multiple Arcade Machine Emulator</description>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
- </dependentAssembly>
- </dependency>
- <asmv3:application>
- <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
- <dpiAware>true</dpiAware>
- </asmv3:windowsSettings>
- </asmv3:application>
-</assembly>
diff --git a/src/mame/osd/windows/mame/mame.rc b/src/mame/osd/windows/mame/mame.rc
deleted file mode 100644
index 8156b424c64..00000000000
--- a/src/mame/osd/windows/mame/mame.rc
+++ /dev/null
@@ -1,14 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// mame.rc - Minimal resource file for Win32 MAME
-//
-//============================================================
-
-#include <windows.h>
-#include "mamevers.rc"
-
-1 24 MOVEABLE PURE "mame.man"
-
-2 ICON DISCARDABLE "mame.ico"
diff --git a/src/mame/osd/windows/mess/mess.ico b/src/mame/osd/windows/mess/mess.ico
deleted file mode 100644
index bab67dd6195..00000000000
--- a/src/mame/osd/windows/mess/mess.ico
+++ /dev/null
Binary files differ
diff --git a/src/mame/osd/windows/mess/mess.man b/src/mame/osd/windows/mess/mess.man
deleted file mode 100644
index 67ba3aced37..00000000000
--- a/src/mame/osd/windows/mess/mess.man
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
- <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MESS" type="win32" />
- <description>Multi Emulator Super System</description>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
- </dependentAssembly>
- </dependency>
- <asmv3:application>
- <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
- <dpiAware>true</dpiAware>
- </asmv3:windowsSettings>
- </asmv3:application>
-</assembly>
diff --git a/src/mame/osd/windows/mess/mess.rc b/src/mame/osd/windows/mess/mess.rc
deleted file mode 100644
index 1329bcd6fb8..00000000000
--- a/src/mame/osd/windows/mess/mess.rc
+++ /dev/null
@@ -1,14 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// mess.rc - Minimal resource file for Win32 MAME
-//
-//============================================================
-
-#include <windows.h>
-#include "messvers.rc"
-
-1 24 MOVEABLE PURE "mess.man"
-
-2 ICON DISCARDABLE "mess.ico"
diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp
index e9c446301a2..0194a1316fc 100644
--- a/src/mame/video/733_asr.cpp
+++ b/src/mame/video/733_asr.cpp
@@ -82,24 +82,13 @@ const device_type ASR733 = &device_creator<asr733_device>;
asr733_device::asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ASR733, "733 ASR", tag, owner, clock, "asr733", __FILE__),
- m_palette(*this, "palette"),
- m_gfxdecode(*this, "gfxdecode"),
+ device_gfx_interface(mconfig, *this, GFXDECODE_NAME(asr733), "palette"),
m_keyint_line(*this),
m_lineint_line(*this)
{
}
//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void asr733_device::device_config_complete()
-{
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -211,7 +200,7 @@ void asr733_device::set_interrupt_line()
/* write a single char on screen */
void asr733_device::draw_char(int character, int x, int y, int color)
{
- m_gfxdecode->gfx(0)->opaque(*m_bitmap, m_bitmap->cliprect(), character-32, color, 0, 0, x+1, y);
+ gfx(0)->opaque(*m_bitmap, m_bitmap->cliprect(), character-32, color, 0, 0, x+1, y);
}
void asr733_device::linefeed()
@@ -221,7 +210,7 @@ void asr733_device::linefeed()
for (int y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++)
{
extract_scanline8(*m_bitmap, asr_window_offset_x, y+asr_scroll_step, asr_window_width, buf);
- draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, m_palette->pens());
+ draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, palette().pens());
}
const rectangle asr_scroll_clear_window(
@@ -721,8 +710,6 @@ UINT32 asr733_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
}
static MACHINE_CONFIG_FRAGMENT( asr733 )
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", asr733)
-
MCFG_PALETTE_ADD("palette", 2)
MCFG_PALETTE_INIT_OWNER(asr733_device, asr733)
diff --git a/src/mame/video/733_asr.h b/src/mame/video/733_asr.h
index 9c45c69c6ed..d5b48eebc9e 100644
--- a/src/mame/video/733_asr.h
+++ b/src/mame/video/733_asr.h
@@ -10,7 +10,7 @@ enum
asr733_chr_region_len = 128*asr733_single_char_len
};
-class asr733_device : public device_t
+class asr733_device : public device_t, public device_gfx_interface
{
public:
asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@@ -33,7 +33,6 @@ public:
protected:
// device-level overrides
- void device_config_complete() override;
void device_start() override;
void device_reset() override;
machine_config_constructor device_mconfig_additions() const override;
@@ -73,8 +72,6 @@ private:
std::unique_ptr<bitmap_ind16> m_bitmap;
- required_device<palette_device> m_palette;
- required_device<gfxdecode_device> m_gfxdecode;
devcb_write_line m_keyint_line;
devcb_write_line m_lineint_line;
};
diff --git a/src/mame/video/911_vdt.cpp b/src/mame/video/911_vdt.cpp
index ff7b2b6a03c..6b00207b919 100644
--- a/src/mame/video/911_vdt.cpp
+++ b/src/mame/video/911_vdt.cpp
@@ -145,24 +145,13 @@ const device_type VDT911 = &device_creator<vdt911_device>;
vdt911_device::vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VDT911, "911 VDT", tag, owner, clock, "vdt911", __FILE__),
+ device_gfx_interface(mconfig, *this, GFXDECODE_NAME(vdt911), "palette"),
m_beeper(*this, "beeper"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
m_keyint_line(*this),
m_lineint_line(*this)
{
}
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void vdt911_device::device_config_complete()
-{
-}
-
enum
{
BLINK_TIMER,
@@ -467,7 +456,7 @@ WRITE8_MEMBER( vdt911_device::cru_w )
*/
void vdt911_device::refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y)
{
- gfx_element *gfx = m_gfxdecode->gfx(m_model);
+ gfx_element *gfx = this->gfx(m_model);
int height = (m_screen_size == char_960) ? 12 : /*25*/24;
int use_8bit_charcodes = USES_8BIT_CHARCODES();
@@ -822,8 +811,6 @@ static MACHINE_CONFIG_FRAGMENT( vdt911 )
MCFG_PALETTE_ADD("palette", 8)
MCFG_PALETTE_INDIRECT_ENTRIES(3)
MCFG_PALETTE_INIT_OWNER(vdt911_device, vdt911)
-
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", vdt911)
MACHINE_CONFIG_END
//-------------------------------------------------
diff --git a/src/mame/video/911_vdt.h b/src/mame/video/911_vdt.h
index e0ced6bbede..7d90d549d50 100644
--- a/src/mame/video/911_vdt.h
+++ b/src/mame/video/911_vdt.h
@@ -34,7 +34,7 @@ enum vdt911_model_t
vdt911_model_FrenchWP // French word processing
};
-class vdt911_device : public device_t
+class vdt911_device : public device_t, public device_gfx_interface
{
public:
vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@@ -58,7 +58,6 @@ public:
protected:
// device-level overrides
- void device_config_complete() override;
void device_start() override;
void device_reset() override;
@@ -103,8 +102,6 @@ private:
char m_foreign_mode;
required_device<beep_device> m_beeper;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
devcb_write_line m_keyint_line;
devcb_write_line m_lineint_line;
};
diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp
index 05a3fe4737d..897e300533a 100644
--- a/src/mame/video/atarirle.cpp
+++ b/src/mame/video/atarirle.cpp
@@ -68,7 +68,8 @@ inline int atari_rle_objects_device::round_to_powerof2(int value)
atari_rle_objects_device::atari_rle_objects_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ATARI_RLE_OBJECTS, "Atari RLE Motion Objects", tag, owner, clock, "atari_rle", __FILE__),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this),
+ m_rombase(*this, DEVICE_SELF)
{
}
@@ -218,8 +219,6 @@ void atari_rle_objects_device::device_start()
m_bitmapymask = m_bitmapheight - 1;
// set up the graphics ROM
- m_rombase = reinterpret_cast<UINT16 *>(m_region->base());
- m_romlength = m_region->bytes();
m_objectcount = count_objects();
// set up a cliprect
@@ -232,7 +231,7 @@ void atari_rle_objects_device::device_start()
// compute the checksums
memset(m_checksums, 0, sizeof(m_checksums));
- for (int sumchunk = 0; sumchunk < m_romlength / 0x20000; sumchunk++)
+ for (int sumchunk = 0; sumchunk < m_rombase.bytes() / 0x20000; sumchunk++)
{
const UINT16 *csbase = &m_rombase[0x10000 * sumchunk];
int cursum = 0;
@@ -345,7 +344,7 @@ void atari_rle_objects_device::build_rle_tables()
int atari_rle_objects_device::count_objects()
{
// first determine the lowest address of all objects
- int lowest_address = m_romlength;
+ int lowest_address = m_rombase.length();
for (int objoffset = 0; objoffset < lowest_address; objoffset += 4)
{
int offset = ((m_rombase[objoffset + 2] & 0xff) << 16) | m_rombase[objoffset + 3];
@@ -370,7 +369,7 @@ void atari_rle_objects_device::prescan_rle(int which)
// look up the offset
UINT16 *base = (UINT16 *)&m_rombase[which * 4];
- const UINT16 *end = m_rombase + m_romlength / 2;
+ const UINT16 *end = &m_rombase[0] + m_rombase.length();
info.xoffs = (INT16)base[0];
info.yoffs = (INT16)base[1];
@@ -384,7 +383,7 @@ void atari_rle_objects_device::prescan_rle(int which)
info.data = base = (UINT16 *)&m_rombase[offset];
// make sure it's valid
- if (offset < which * 4 || offset >= m_romlength)
+ if (offset < which * 4 || offset >= m_rombase.length())
{
info.data = nullptr;
return;
diff --git a/src/mame/video/atarirle.h b/src/mame/video/atarirle.h
index 5cf65931d04..86b07c598a9 100644
--- a/src/mame/video/atarirle.h
+++ b/src/mame/video/atarirle.h
@@ -159,8 +159,7 @@ private:
sprite_parameter m_vrammask; // mask for the VRAM target
// ROM information
- const UINT16 * m_rombase; // pointer to the base of the GFX ROM
- int m_romlength; // length of the GFX ROM
+ required_region_ptr<UINT16> m_rombase; // pointer to the base of the GFX ROM
int m_objectcount; // number of objects in the ROM
std::vector<object_info> m_info; // list of info records
diff --git a/src/mame/video/battlex.cpp b/src/mame/video/battlex.cpp
index f808d1e536e..d543240f073 100644
--- a/src/mame/video/battlex.cpp
+++ b/src/mame/video/battlex.cpp
@@ -83,7 +83,7 @@ void battlex_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprec
flipy = !flipy;
}
- gfx->transpen(bitmap,cliprect, tile, color, flipx, flipy, sx, sy, 0);
+ gfx->transpen(bitmap,cliprect, tile, color, flipx, flipy, sx, sy, 0);
source += 4;
}
diff --git a/src/mame/video/bbusters.cpp b/src/mame/video/bbusters.cpp
index 1a090935c17..0e7362fd085 100644
--- a/src/mame/video/bbusters.cpp
+++ b/src/mame/video/bbusters.cpp
@@ -200,18 +200,20 @@ void bbusters_state::draw_sprites(bitmap_ind16 &bitmap, const UINT16 *source, in
int offs;
for (offs = 0;offs <0x800 ;offs += 4) {
- int x,y,sprite,colour,fx,fy,scale;
+ int x,sprite,colour,fx,fy,scale;
+ INT16 y;
int block;
sprite=source[offs+1];
colour=source[offs+0];
- if (colour==0xf7 && (sprite==0x3fff || sprite==0xffff))
- continue;
+ if ((colour==0xf7 || colour==0xffff || colour == 0x43f9) && (sprite==0x3fff || sprite==0xffff || sprite==0x0001))
+ continue; // sprite 1, color 0x43f9 is the dead sprite in the top-right of the screen in Mechanized Attack's High Score table.
y=source[offs+3];
x=source[offs+2];
if (x&0x200) x=-(0x100-(x&0xff));
+ if (y > 320 || y < -256) y &= 0x1ff; // fix for bbusters ending & "Zing!" attract-mode fullscreen zombie & Helicopter on the 3rd rotation of the attractmode sequence
/*
Source[0]:
diff --git a/src/mame/video/bfm_adr2.cpp b/src/mame/video/bfm_adr2.cpp
index bca9061ffc2..1bc4615fd69 100644
--- a/src/mame/video/bfm_adr2.cpp
+++ b/src/mame/video/bfm_adr2.cpp
@@ -115,13 +115,32 @@ E000-FFFF | R | D D D D D D D D | 8K ROM
+static const gfx_layout charlayout =
+{
+ 8,8, // 8 * 8 characters
+ 8192, // 8192 characters
+ 4, // 4 bits per pixel
+ { 0,1,2,3 },
+ { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
+ { 0*8*4, 1*8*4, 2*8*4, 3*8*4, 4*8*4, 5*8*4, 6*8*4, 7*8*4 },
+ 8*8*4
+};
+
+// this is a strange beast !!!!
+//
+// characters are grouped by 64 (512 pixels)
+// there are max 128 of these groups
+
+static GFXDECODE_START( adder2 )
+ GFXDECODE_ENTRY( ":gfx1", 0, charlayout, 0, 16 )
+GFXDECODE_END
+
const device_type BFM_ADDER2 = &device_creator<bfm_adder2_device>;
bfm_adder2_device::bfm_adder2_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
: device_t(mconfig, BFM_ADDER2, "BFM ADDER2", tag, owner, clock, "bfm_adder2", __FILE__),
- m_cpu(*this, "adder2"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
+ device_gfx_interface(mconfig, *this, GFXDECODE_NAME(adder2), "palette"),
+ m_cpu(*this, "adder2")
{
}
@@ -194,7 +213,7 @@ void bfm_adder2_device::device_reset()
void bfm_adder2_device::device_start()
{
- if (!m_palette->started())
+ if (!palette().started())
throw device_missing_dependencies();
adder2_decode_char_roms();
@@ -211,26 +230,26 @@ void bfm_adder2_device::device_start()
save_item(NAME(m_adder_ram));
save_item(NAME(m_adder_screen_ram));
- m_tilemap0 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile0_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
-
- m_tilemap1 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile1_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
-
- m_palette->set_pen_color(0,rgb_t(0x00,0x00,0x00));
- m_palette->set_pen_color(1,rgb_t(0x00,0x00,0xFF));
- m_palette->set_pen_color(2,rgb_t(0x00,0xFF,0x00));
- m_palette->set_pen_color(3,rgb_t(0x00,0xFF,0xFF));
- m_palette->set_pen_color(4,rgb_t(0xFF,0x00,0x00));
- m_palette->set_pen_color(5,rgb_t(0xFF,0x00,0xFF));
- m_palette->set_pen_color(6,rgb_t(0xFF,0xFF,0x00));
- m_palette->set_pen_color(7,rgb_t(0xFF,0xFF,0xFF));
- m_palette->set_pen_color(8,rgb_t(0x80,0x80,0x80));
- m_palette->set_pen_color(9,rgb_t(0x00,0x00,0x80));
- m_palette->set_pen_color(10,rgb_t(0x00,0x80,0x00));
- m_palette->set_pen_color(11,rgb_t(0x00,0x80,0x80));
- m_palette->set_pen_color(12,rgb_t(0x80,0x00,0x00));
- m_palette->set_pen_color(13,rgb_t(0x80,0x00,0x80));
- m_palette->set_pen_color(14,rgb_t(0x80,0x80,0x00));
- m_palette->set_pen_color(15,rgb_t(0x80,0x80,0x80));
+ m_tilemap0 = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile0_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
+
+ m_tilemap1 = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(bfm_adder2_device::get_tile1_info),this), TILEMAP_SCAN_ROWS, 8, 8, 50, 35);
+
+ palette().set_pen_color(0,rgb_t(0x00,0x00,0x00));
+ palette().set_pen_color(1,rgb_t(0x00,0x00,0xFF));
+ palette().set_pen_color(2,rgb_t(0x00,0xFF,0x00));
+ palette().set_pen_color(3,rgb_t(0x00,0xFF,0xFF));
+ palette().set_pen_color(4,rgb_t(0xFF,0x00,0x00));
+ palette().set_pen_color(5,rgb_t(0xFF,0x00,0xFF));
+ palette().set_pen_color(6,rgb_t(0xFF,0xFF,0x00));
+ palette().set_pen_color(7,rgb_t(0xFF,0xFF,0xFF));
+ palette().set_pen_color(8,rgb_t(0x80,0x80,0x80));
+ palette().set_pen_color(9,rgb_t(0x00,0x00,0x80));
+ palette().set_pen_color(10,rgb_t(0x00,0x80,0x00));
+ palette().set_pen_color(11,rgb_t(0x00,0x80,0x80));
+ palette().set_pen_color(12,rgb_t(0x80,0x00,0x00));
+ palette().set_pen_color(13,rgb_t(0x80,0x00,0x80));
+ palette().set_pen_color(14,rgb_t(0x80,0x80,0x00));
+ palette().set_pen_color(15,rgb_t(0x80,0x80,0x80));
}
// video update ///////////////////////////////////////////////////////////
@@ -278,7 +297,7 @@ WRITE8_MEMBER( bfm_adder2_device::screen_ram_w )
r = ((data & 0x18)>>3) * 85; // 00011000b = 0x18
g = ((data & 0x06)>>1) * 85; // 00000110b = 0x06
b = ((data & 0x01) ) * 255;
- m_palette->set_pen_color(pal, rgb_t(r,g,b));
+ palette().set_pen_color(pal, rgb_t(r,g,b));
}
if ( m_adder2_screen_page_reg & SL_ACCESS )
@@ -519,26 +538,6 @@ static ADDRESS_MAP_START( adder2_memmap, AS_PROGRAM, 8, bfm_adder2_device )
AM_RANGE(0xE000, 0xFFFF) AM_ROM AM_REGION(":adder2", 0xE000) // 8k ROM
ADDRESS_MAP_END
-static const gfx_layout charlayout =
-{
- 8,8, // 8 * 8 characters
- 8192, // 8192 characters
- 4, // 4 bits per pixel
- { 0,1,2,3 },
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
- { 0*8*4, 1*8*4, 2*8*4, 3*8*4, 4*8*4, 5*8*4, 6*8*4, 7*8*4 },
- 8*8*4
-};
-
-// this is a strange beast !!!!
-//
-// characters are grouped by 64 (512 pixels)
-// there are max 128 of these groups
-
-static GFXDECODE_START( adder2 )
- GFXDECODE_ENTRY( ":gfx1", 0, charlayout, 0, 16 )
-GFXDECODE_END
-
///////////////////////////////////////////////////////////////////////////
static MACHINE_CONFIG_FRAGMENT( adder2 )
@@ -550,7 +549,6 @@ static MACHINE_CONFIG_FRAGMENT( adder2 )
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, bfm_adder2_device, update_screen)
MCFG_PALETTE_ADD("palette", 16)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", adder2)
MCFG_CPU_ADD("adder2", M6809, ADDER_CLOCK/4 ) // adder2 board 6809 CPU at 2 Mhz
MCFG_CPU_PROGRAM_MAP(adder2_memmap) // setup adder2 board memorymap
diff --git a/src/mame/video/bfm_adr2.h b/src/mame/video/bfm_adr2.h
index 301ee7acf0d..8f278dfb65c 100644
--- a/src/mame/video/bfm_adr2.h
+++ b/src/mame/video/bfm_adr2.h
@@ -3,7 +3,7 @@
#ifndef INC_BFMADDER2
#define INC_BFMADDER2
-class bfm_adder2_device : public device_t
+class bfm_adder2_device : public device_t, public device_gfx_interface
{
public:
// construction/destruction
@@ -61,8 +61,6 @@ private:
UINT8 m_adder2_sc2data;
optional_device<cpu_device> m_cpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
// device type definition
@@ -76,7 +74,4 @@ extern const device_type BFM_ADDER2;
#define MCFG_BFM_ADDER2_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, BFM_ADDER2, 0)
-#define MCFG_BFM_ADDER2_PALETTE(_palette_tag) \
- bfm_adder2_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif
diff --git a/src/mame/video/decbac06.h b/src/mame/video/decbac06.h
index 51a991636fa..0f9c24ccdd3 100644
--- a/src/mame/video/decbac06.h
+++ b/src/mame/video/decbac06.h
@@ -152,3 +152,6 @@ extern const device_type DECO_BAC06;
#define MCFG_DECO_BAC06_GFXDECODE(_gfxtag) \
deco_bac06_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
+
+#define MCFG_DECO_BAC06_GFX_REGION_WIDE(_8x8, _16x16, _wide) \
+ deco_bac06_device::set_gfx_region_wide(*device, _8x8, _16x16, _wide);
diff --git a/src/mame/video/deckarn.cpp b/src/mame/video/deckarn.cpp
index 795bf5894d6..bde0dba82ab 100644
--- a/src/mame/video/deckarn.cpp
+++ b/src/mame/video/deckarn.cpp
@@ -17,8 +17,7 @@ const device_type DECO_KARNOVSPRITES = &device_creator<deco_karnovsprites_device
deco_karnovsprites_device::deco_karnovsprites_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, DECO_KARNOVSPRITES, "DECO Karnov Sprites", tag, owner, clock, "deco_karnovsprites", __FILE__),
m_gfxregion(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -112,13 +111,3 @@ void deco_karnovsprites_device::draw_sprites( bitmap_ind16 &bitmap, const rectan
colour,fx,fy,x,y+16,0);
}
}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void deco_karnovsprites_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<deco_karnovsprites_device &>(device).m_palette.set_tag(tag);
-}
diff --git a/src/mame/video/deckarn.h b/src/mame/video/deckarn.h
index 560e0f87ba0..7da58cdc789 100644
--- a/src/mame/video/deckarn.h
+++ b/src/mame/video/deckarn.h
@@ -11,7 +11,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int region);
protected:
@@ -21,7 +20,6 @@ protected:
UINT8 m_gfxregion;
private:
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type DECO_KARNOVSPRITES;
@@ -29,5 +27,5 @@ extern const device_type DECO_KARNOVSPRITES;
#define MCFG_DECO_KARNOVSPRITES_GFXDECODE(_gfxtag) \
deco_karnovsprites_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_DECO_KARNOVSPRITES_PALETTE(_palette_tag) \
- deco_karnovsprites_device::static_set_palette_tag(*device, "^" _palette_tag);
+#define MCFG_DECO_KARNOVSPRITES_GFX_REGION(_region) \
+ deco_karnovsprites_device::set_gfx_region(*device, _region);
diff --git a/src/mame/video/decmxc06.cpp b/src/mame/video/decmxc06.cpp
index 888d5ae6ada..87bb3aa922e 100644
--- a/src/mame/video/decmxc06.cpp
+++ b/src/mame/video/decmxc06.cpp
@@ -54,8 +54,7 @@ deco_mxc06_device::deco_mxc06_device(const machine_config &mconfig, const char *
device_video_interface(mconfig, *this),
m_gfxregion(0),
m_ramsize(0x800),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -223,13 +222,3 @@ void deco_mxc06_device::device_start()
void deco_mxc06_device::device_reset()
{
}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void deco_mxc06_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<deco_mxc06_device &>(device).m_palette.set_tag(tag);
-}
diff --git a/src/mame/video/decmxc06.h b/src/mame/video/decmxc06.h
index a4b58a73195..b00a7d851b5 100644
--- a/src/mame/video/decmxc06.h
+++ b/src/mame/video/decmxc06.h
@@ -11,7 +11,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int region);
static void set_ram_size(device_t &device, int size)
{
@@ -35,7 +34,6 @@ protected:
private:
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type DECO_MXC06;
@@ -43,8 +41,8 @@ extern const device_type DECO_MXC06;
#define MCFG_DECO_MXC06_GFXDECODE(_gfxtag) \
deco_mxc06_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_DECO_MXC06_PALETTE(_palette_tag) \
- deco_mxc06_device::static_set_palette_tag(*device, "^" _palette_tag);
+#define MCFG_DECO_MXC06_GFX_REGION(_region) \
+ deco_mxc06_device::set_gfx_region(*device, _region);
#define MCFG_DECO_MXC06_RAMSIZE(_size) \
deco_mxc06_device::set_ram_size(*device, _size);
diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp
index fa5b1caba0a..df16e96bfc0 100644
--- a/src/mame/video/deco16ic.cpp
+++ b/src/mame/video/deco16ic.cpp
@@ -202,8 +202,7 @@ deco16ic_device::deco16ic_device(const machine_config &mconfig, const char *tag,
m_pf2_colourmask(0xf),
m_pf12_8x8_gfx_bank(0),
m_pf12_16x16_gfx_bank(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -511,7 +510,7 @@ void deco16ic_device::custom_tilemap_draw(
if ((flags & TILEMAP_DRAW_OPAQUE) || (p & trans_mask))
{
- bitmap.pix(y, x) = m_palette->pen(p);
+ bitmap.pix(y, x) = m_gfxdecode->palette().pen(p);
if (screen.priority().valid())
{
UINT8 *pri = &screen.priority().pix8(y);
@@ -943,13 +942,3 @@ void deco16ic_device::tilemap_12_combine_draw(screen_device &screen, bitmap_rgb3
{
custom_tilemap_draw(screen, bitmap, cliprect, nullptr, m_pf1_tilemap_16x16, nullptr, m_pf2_tilemap_16x16, m_pf1_rowscroll_ptr, m_pf12_control[1], m_pf12_control[2], m_pf12_control[5] & 0xff, m_pf12_control[6] & 0xff, 0xf, 4, 0xff, flags, priority, is_tattoo);
}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void deco16ic_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<deco16ic_device &>(device).m_palette.set_tag(tag);
-}
diff --git a/src/mame/video/deco16ic.h b/src/mame/video/deco16ic.h
index 5e45336c093..a15be609dbc 100644
--- a/src/mame/video/deco16ic.h
+++ b/src/mame/video/deco16ic.h
@@ -154,7 +154,6 @@ private:
TILE_GET_INFO_MEMBER(get_pf2_tile_info_b);
TILE_GET_INFO_MEMBER(get_pf1_tile_info_b);
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type DECO16IC;
@@ -206,9 +205,6 @@ extern const device_type DECO16IC;
#define MCFG_DECO16IC_GFXDECODE(_gfxtag) \
deco16ic_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_DECO16IC_PALETTE(_palette_tag) \
- deco16ic_device::static_set_palette_tag(*device, "^" _palette_tag);
-
// function definition for a callback
#define DECO16IC_BANK_CB_MEMBER(_name) int _name(int bank)
diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp
index e1b5cfdb949..aafefabc2a7 100644
--- a/src/mame/video/deco_zoomspr.cpp
+++ b/src/mame/video/deco_zoomspr.cpp
@@ -17,22 +17,11 @@ const device_type DECO_ZOOMSPR = &device_creator<deco_zoomspr_device>;
deco_zoomspr_device::deco_zoomspr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, DECO_ZOOMSPR, "DECO Zooming Sprites", tag, owner, clock, "deco_zoomspr", __FILE__),
- m_palette(*this),
m_gfxdecode(*this)
{
}
//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void deco_zoomspr_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<deco_zoomspr_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// static_set_gfxdecode_tag: Set the tag of the
// gfx decoder
//-------------------------------------------------
@@ -80,7 +69,7 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
{
if( gfx )
{
- const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
+ const pen_t *pal = &m_gfxdecode->palette().pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const UINT8 *code_base = gfx->get_data(code % gfx->elements());
if (sprite_screen_width && sprite_screen_height)
diff --git a/src/mame/video/deco_zoomspr.h b/src/mame/video/deco_zoomspr.h
index 4283f3aa62e..aed9b6b519a 100644
--- a/src/mame/video/deco_zoomspr.h
+++ b/src/mame/video/deco_zoomspr.h
@@ -7,7 +7,6 @@ class deco_zoomspr_device : public device_t
public:
deco_zoomspr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
void dragngun_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata, UINT32* dragngun_sprite_layout_0_ram, UINT32* dragngun_sprite_layout_1_ram, UINT32* dragngun_sprite_lookup_0_ram, UINT32* dragngun_sprite_lookup_1_ram, UINT32 dragngun_sprite_ctrl, bitmap_ind8 &pri_bitmap, bitmap_rgb32 &temp_bitmap);
@@ -18,7 +17,6 @@ protected:
virtual void device_reset() override;
private:
- required_device<palette_device> m_palette;
required_device<gfxdecode_device> m_gfxdecode;
void dragngun_drawgfxzoom(
@@ -33,8 +31,5 @@ private:
extern const device_type DECO_ZOOMSPR;
-#define MCFG_DECO_ZOOMSPR_PALETTE(_palette_tag) \
- deco_zoomspr_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#define MCFG_DECO_ZOOMSPR_GFXDECODE(_gfxtag) \
deco_zoomspr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp
index 304fba4a87b..1ad69cff68a 100644
--- a/src/mame/video/decospr.cpp
+++ b/src/mame/video/decospr.cpp
@@ -157,8 +157,7 @@ decospr_device::decospr_device(const machine_config &mconfig, const char *tag, d
m_y_offset(0),
m_flipallx(0),
m_transpen(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
// default color callback
m_col_cb = decospr_col_cb_delegate(FUNC(decospr_device::default_col_cb), this);
@@ -579,7 +578,7 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const
fatalerror("decospr_device::inefficient_copy_sprite_bitmap with no m_sprite_bitmap\n");
int y, x;
- const pen_t *paldata = m_palette->pens();
+ const pen_t *paldata = m_gfxdecode->palette().pens();
UINT16* srcline;
UINT32* dstline;
@@ -623,13 +622,3 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const
}
}
}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void decospr_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<decospr_device &>(device).m_palette.set_tag(tag);
-}
diff --git a/src/mame/video/decospr.h b/src/mame/video/decospr.h
index 9679a22acc5..c9b2ee68a77 100644
--- a/src/mame/video/decospr.h
+++ b/src/mame/video/decospr.h
@@ -18,7 +18,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int gfxregion);
static void set_pri_callback(device_t &device, decospr_pri_cb_delegate callback) { downcast<decospr_device &>(device).m_pri_cb = callback; }
static void set_col_callback(device_t &device, decospr_col_cb_delegate callback) { downcast<decospr_device &>(device).m_col_cb = callback; }
@@ -67,7 +66,6 @@ private:
template<class _BitmapClass>
void draw_sprites_common(_BitmapClass &bitmap, const rectangle &cliprect, UINT16* spriteram, int sizewords, bool invert_flip);
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type DECO_SPRITE;
@@ -98,6 +96,3 @@ extern const device_type DECO_SPRITE;
#define MCFG_DECO_SPRITE_GFXDECODE(_gfxtag) \
decospr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
-#define MCFG_DECO_SPRITE_PALETTE(_palette_tag) \
- decospr_device::static_set_palette_tag(*device, "^" _palette_tag);
diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp
index 6308e9f2736..efc658e44c4 100644
--- a/src/mame/video/k001604.cpp
+++ b/src/mame/video/k001604.cpp
@@ -19,8 +19,7 @@ const device_type K001604 = &device_creator<k001604_device>;
k001604_device::k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K001604, "K001604 2D tilemaps + 2x ROZ", tag, owner, clock, "k001604", __FILE__),
- m_gfx_index_1(0),
- m_gfx_index_2(0),
+ device_gfx_interface(mconfig, *this, nullptr),
m_layer_size(0),
m_roz_size(0),
m_txt_mem_offset(0),
@@ -28,22 +27,8 @@ k001604_device::k001604_device(const machine_config &mconfig, const char *tag, d
m_layer_roz(nullptr),
m_tile_ram(nullptr),
m_char_ram(nullptr),
- m_reg(nullptr),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_reg(nullptr)
{
- m_gfx_index[0] = 0;
- m_gfx_index[1] = 0;
-}
-
-//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void k001604_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<k001604_device &>(device).m_gfxdecode.set_tag(tag);
}
//-------------------------------------------------
@@ -74,14 +59,8 @@ void k001604_device::device_start()
16*256
};
- if(!m_gfxdecode->started())
- throw device_missing_dependencies();
-
int roz_tile_size;
- m_gfx_index[0] = m_gfx_index_1;
- m_gfx_index[1] = m_gfx_index_2;
-
m_char_ram = make_unique_clear<UINT32[]>(0x200000 / 4);
m_tile_ram = make_unique_clear<UINT32[]>(0x20000 / 4);
m_reg = make_unique_clear<UINT32[]>(0x400 / 4);
@@ -91,24 +70,24 @@ void k001604_device::device_start()
if (m_layer_size)
{
- m_layer_8x8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size1),this), 8, 8, 64, 64);
- m_layer_8x8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size1),this), 8, 8, 64, 64);
+ m_layer_8x8[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size1),this), 8, 8, 64, 64);
+ m_layer_8x8[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size1),this), 8, 8, 64, 64);
- m_layer_roz = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_256),this), roz_tile_size, roz_tile_size, 128, 64);
+ m_layer_roz = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_256),this), roz_tile_size, roz_tile_size, 128, 64);
}
else
{
- m_layer_8x8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size0),this), 8, 8, 64, 64);
- m_layer_8x8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size0),this), 8, 8, 64, 64);
+ m_layer_8x8[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size0),this), 8, 8, 64, 64);
+ m_layer_8x8[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size0),this), 8, 8, 64, 64);
- m_layer_roz = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_128),this), roz_tile_size, roz_tile_size, 128, 64);
+ m_layer_roz = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_128),this), roz_tile_size, roz_tile_size, 128, 64);
}
m_layer_8x8[0]->set_transparent_pen(0);
m_layer_8x8[1]->set_transparent_pen(0);
- m_gfxdecode->set_gfx(m_gfx_index[0], std::make_unique<gfx_element>(m_palette, k001604_char_layout_layer_8x8, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0));
- m_gfxdecode->set_gfx(m_gfx_index[1], std::make_unique<gfx_element>(m_palette, k001604_char_layout_layer_16x16, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0));
+ set_gfx(0, std::make_unique<gfx_element>(palette(), k001604_char_layout_layer_8x8, (UINT8*)&m_char_ram[0], 0, palette().entries() / 16, 0));
+ set_gfx(1, std::make_unique<gfx_element>(palette(), k001604_char_layout_layer_16x16, (UINT8*)&m_char_ram[0], 0, palette().entries() / 16, 0));
save_pointer(NAME(m_reg.get()), 0x400 / 4);
save_pointer(NAME(m_char_ram.get()), 0x200000 / 4);
@@ -182,7 +161,7 @@ TILE_GET_INFO_MEMBER(k001604_device::tile_info_layer_8x8)
if (val & 0x800000)
flags |= TILE_FLIPY;
- SET_TILE_INFO_MEMBER(m_gfx_index[0], tile, color, flags);
+ SET_TILE_INFO_MEMBER(0, tile, color, flags);
}
TILE_GET_INFO_MEMBER(k001604_device::tile_info_layer_roz)
@@ -199,7 +178,7 @@ TILE_GET_INFO_MEMBER(k001604_device::tile_info_layer_roz)
tile += m_roz_size ? 0x800 : 0x2000;
- SET_TILE_INFO_MEMBER(m_gfx_index[m_roz_size], tile, color, flags);
+ SET_TILE_INFO_MEMBER(m_roz_size, tile, color, flags);
}
@@ -237,7 +216,7 @@ void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cli
int ex = cliprect.max_x;
int ey = cliprect.max_y;
- const rgb_t *clut = m_palette->palette()->entry_list_raw();
+ const rgb_t *clut = palette().palette()->entry_list_raw();
int window_x, window_y, window_xmask, window_ymask;
@@ -397,8 +376,8 @@ WRITE32_MEMBER( k001604_device::char_w )
COMBINE_DATA(m_char_ram.get() + addr);
- m_gfxdecode->gfx(m_gfx_index[0])->mark_dirty(addr / 32);
- m_gfxdecode->gfx(m_gfx_index[1])->mark_dirty(addr / 128);
+ gfx(0)->mark_dirty(addr / 32);
+ gfx(1)->mark_dirty(addr / 128);
}
WRITE32_MEMBER( k001604_device::reg_w )
@@ -419,13 +398,3 @@ WRITE32_MEMBER( k001604_device::reg_w )
//printf("K001604_reg_w (%d), %02X, %08X, %08X at %08X\n", chip, offset, data, mem_mask, space.device().safe_pc());
}
}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void k001604_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<k001604_device &>(device).m_palette.set_tag(tag);
-}
diff --git a/src/mame/video/k001604.h b/src/mame/video/k001604.h
index d0719936029..d4264007856 100644
--- a/src/mame/video/k001604.h
+++ b/src/mame/video/k001604.h
@@ -5,17 +5,13 @@
#define __K001604_H__
-class k001604_device : public device_t
+class k001604_device : public device_t, public device_gfx_interface
{
public:
k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k001604_device() {}
// static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
- static void set_gfx_index_1(device_t &device, int idx) { downcast<k001604_device &>(device).m_gfx_index_1 = idx; }
- static void set_gfx_index_2(device_t &device, int idx) { downcast<k001604_device &>(device).m_gfx_index_2 = idx; }
static void set_layer_size(device_t &device, int size) { downcast<k001604_device &>(device).m_layer_size = size; }
static void set_roz_size(device_t &device, int size) { downcast<k001604_device &>(device).m_roz_size = size; }
static void set_txt_mem_offset(device_t &device, int offs) { downcast<k001604_device &>(device).m_txt_mem_offset = offs; }
@@ -36,8 +32,6 @@ protected:
virtual void device_reset() override;
private:
// internal state
- int m_gfx_index_1;
- int m_gfx_index_2;
int m_layer_size; // 0 -> width = 128 tiles, 1 -> width = 256 tiles
int m_roz_size; // 0 -> 8x8, 1 -> 16x16
int m_txt_mem_offset;
@@ -45,13 +39,10 @@ private:
tilemap_t *m_layer_8x8[2];
tilemap_t *m_layer_roz;
- int m_gfx_index[2];
std::unique_ptr<UINT32[]> m_tile_ram;
std::unique_ptr<UINT32[]> m_char_ram;
std::unique_ptr<UINT32[]> m_reg;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
TILEMAP_MAPPER_MEMBER(scan_layer_8x8_0_size0);
TILEMAP_MAPPER_MEMBER(scan_layer_8x8_0_size1);
@@ -66,12 +57,6 @@ private:
extern const device_type K001604;
-#define MCFG_K001604_GFX_INDEX1(_idx) \
- k001604_device::set_gfx_index_1(*device, _idx);
-
-#define MCFG_K001604_GFX_INDEX2(_idx) \
- k001604_device::set_gfx_index_2(*device, _idx);
-
#define MCFG_K001604_LAYER_SIZE(_size) \
k001604_device::set_layer_size(*device, _size);
@@ -84,10 +69,7 @@ extern const device_type K001604;
#define MCFG_K001604_ROZ_OFFSET(_offs) \
k001604_device::set_roz_mem_offset(*device, _offs);
-#define MCFG_K001604_GFXDECODE(_gfxtag) \
- k001604_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
#define MCFG_K001604_PALETTE(_palette_tag) \
- k001604_device::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
#endif
diff --git a/src/mame/video/k037122.cpp b/src/mame/video/k037122.cpp
index e7f57786174..dd572916e9a 100644
--- a/src/mame/video/k037122.cpp
+++ b/src/mame/video/k037122.cpp
@@ -18,36 +18,15 @@ const device_type K037122 = &device_creator<k037122_device>;
k037122_device::k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K037122, "K037122 2D Tilemap", tag, owner, clock, "k037122", __FILE__),
device_video_interface(mconfig, *this),
+ device_gfx_interface(mconfig, *this, nullptr),
m_tile_ram(nullptr),
m_char_ram(nullptr),
m_reg(nullptr),
- m_gfx_index(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfx_index(0)
{
}
//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void k037122_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<k037122_device &>(device).m_gfxdecode.set_tag(tag);
-}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void k037122_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<k037122_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -64,20 +43,17 @@ void k037122_device::device_start()
8*128
};
- if(!m_gfxdecode->started())
- throw device_missing_dependencies();
-
m_char_ram = make_unique_clear<UINT32[]>(0x200000 / 4);
m_tile_ram = make_unique_clear<UINT32[]>(0x20000 / 4);
m_reg = make_unique_clear<UINT32[]>(0x400 / 4);
- m_layer[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64);
- m_layer[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
+ m_layer[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64);
+ m_layer[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
m_layer[0]->set_transparent_pen(0);
m_layer[1]->set_transparent_pen(0);
- m_gfxdecode->set_gfx(m_gfx_index,std::make_unique<gfx_element>(m_palette, k037122_char_layout, (UINT8*)m_char_ram.get(), 0, m_palette->entries() / 16, 0));
+ set_gfx(m_gfx_index,std::make_unique<gfx_element>(palette(), k037122_char_layout, (UINT8*)m_char_ram.get(), 0, palette().entries() / 16, 0));
save_pointer(NAME(m_reg.get()), 0x400 / 4);
save_pointer(NAME(m_char_ram.get()), 0x200000 / 4);
@@ -153,7 +129,7 @@ void k037122_device::update_palette_color( UINT32 palette_base, int color )
{
UINT32 data = m_tile_ram[(palette_base / 4) + color];
- m_palette->set_pen_color(color, pal5bit(data >> 6), pal6bit(data >> 0), pal5bit(data >> 11));
+ palette().set_pen_color(color, pal5bit(data >> 6), pal6bit(data >> 0), pal5bit(data >> 11));
}
READ32_MEMBER( k037122_device::sram_r )
@@ -211,7 +187,7 @@ WRITE32_MEMBER( k037122_device::char_w )
UINT32 addr = offset + (bank * (0x40000/4));
COMBINE_DATA(m_char_ram.get() + addr);
- m_gfxdecode->gfx(m_gfx_index)->mark_dirty(addr / 32);
+ gfx(m_gfx_index)->mark_dirty(addr / 32);
}
READ32_MEMBER( k037122_device::reg_r )
diff --git a/src/mame/video/k037122.h b/src/mame/video/k037122.h
index 181f28e355d..99276695a36 100644
--- a/src/mame/video/k037122.h
+++ b/src/mame/video/k037122.h
@@ -5,15 +5,14 @@
#define __K037122_H__
class k037122_device : public device_t,
- public device_video_interface
+ public device_video_interface,
+ public device_gfx_interface
{
public:
k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k037122_device() {}
// static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void static_set_gfx_index(device_t &device, int index) { downcast<k037122_device &>(device).m_gfx_index = index; }
void tile_draw( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect );
@@ -38,8 +37,6 @@ private:
std::unique_ptr<UINT32[]> m_reg;
int m_gfx_index;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
TILE_GET_INFO_MEMBER(tile_info_layer0);
TILE_GET_INFO_MEMBER(tile_info_layer1);
@@ -48,15 +45,11 @@ private:
extern const device_type K037122;
-#define MCFG_K037122_ADD(_tag, _screen, _gfxindex) \
+#define MCFG_K037122_ADD(_tag, _screen) \
MCFG_DEVICE_ADD(_tag, K037122, 0) \
- MCFG_VIDEO_SET_SCREEN(_screen) \
- k037122_device::static_set_gfx_index(*device, _gfxindex);
-
-#define MCFG_K037122_GFXDECODE(_gfxtag) \
- k037122_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
+ MCFG_VIDEO_SET_SCREEN(_screen)
#define MCFG_K037122_PALETTE(_palette_tag) \
- k037122_device::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
#endif
diff --git a/src/mame/video/k051316.cpp b/src/mame/video/k051316.cpp
index 29493e7e69c..2bad3d043f9 100644
--- a/src/mame/video/k051316.cpp
+++ b/src/mame/video/k051316.cpp
@@ -106,8 +106,7 @@ GFXDECODE_END
k051316_device::k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K051316, "K051316 PSAC", tag, owner, clock, "k051316", __FILE__),
device_gfx_interface(mconfig, *this, gfxinfo),
- m_zoom_rom(nullptr),
- m_zoom_size(0),
+ m_zoom_rom(*this, DEVICE_SELF),
m_dx(0),
m_dy(0),
m_wrap(0),
@@ -151,13 +150,6 @@ void k051316_device::set_bpp(device_t &device, int bpp)
void k051316_device::device_start()
{
- memory_region *ROM = region();
- if (ROM != nullptr)
- {
- m_zoom_rom = ROM->base();
- m_zoom_size = ROM->bytes();
- }
-
decode_gfx();
gfx(0)->set_colors(palette().entries() / gfx(0)->depth());
@@ -209,13 +201,13 @@ WRITE8_MEMBER( k051316_device::write )
READ8_MEMBER( k051316_device::rom_r )
{
- assert (m_zoom_size != 0);
+ assert (m_zoom_rom.found());
if ((m_ctrlram[0x0e] & 0x01) == 0)
{
int addr = offset + (m_ctrlram[0x0c] << 11) + (m_ctrlram[0x0d] << 19);
addr /= m_pixels_per_byte;
- addr &= m_zoom_size - 1;
+ addr &= m_zoom_rom.mask();
// popmessage("%s: offset %04x addr %04x", space.machine().describe_context(), offset, addr);
diff --git a/src/mame/video/k051316.h b/src/mame/video/k051316.h
index fc51fdb95fb..3363cfbdc41 100644
--- a/src/mame/video/k051316.h
+++ b/src/mame/video/k051316.h
@@ -84,8 +84,7 @@ private:
UINT8 m_ctrlram[16];
tilemap_t *m_tmap;
- UINT8 *m_zoom_rom;
- UINT32 m_zoom_size;
+ optional_region_ptr<UINT8> m_zoom_rom;
int m_dx, m_dy;
int m_wrap;
diff --git a/src/mame/video/k051960.cpp b/src/mame/video/k051960.cpp
index ae93ec9cb01..d5c899c3386 100644
--- a/src/mame/video/k051960.cpp
+++ b/src/mame/video/k051960.cpp
@@ -129,10 +129,8 @@ k051960_device::k051960_device(const machine_config &mconfig, const char *tag, d
: device_t(mconfig, K051960, "K051960 Sprite Generator", tag, owner, clock, "k051960", __FILE__),
device_gfx_interface(mconfig, *this, gfxinfo),
m_ram(nullptr),
- m_sprite_rom(nullptr),
- m_sprite_size(0),
- m_screen_tag(nullptr),
- m_screen(nullptr),
+ m_sprite_rom(*this, DEVICE_SELF),
+ m_screen(*this),
m_scanline_timer(nullptr),
m_irq_handler(*this),
m_firq_handler(*this),
@@ -171,10 +169,10 @@ void k051960_device::set_plane_order(device_t &device, int order)
// set_screen_tag - set screen we are attached to
//-------------------------------------------------
-void k051960_device::set_screen_tag(device_t &device, device_t *owner, const char *tag)
+void k051960_device::set_screen_tag(device_t &device, const char *tag)
{
k051960_device &dev = dynamic_cast<k051960_device &>(device);
- dev.m_screen_tag = tag;
+ dev.m_screen.set_tag(tag);
}
//-------------------------------------------------
@@ -184,7 +182,6 @@ void k051960_device::set_screen_tag(device_t &device, device_t *owner, const cha
void k051960_device::device_start()
{
// make sure our screen is started
- m_screen = m_owner->subdevice<screen_device>(m_screen_tag);
if (!m_screen->started())
throw device_missing_dependencies();
@@ -192,9 +189,6 @@ void k051960_device::device_start()
m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k051960_device::scanline_callback), this));
m_scanline_timer->adjust(m_screen->time_until_pos(0));
- m_sprite_rom = region()->base();
- m_sprite_size = region()->bytes();
-
decode_gfx();
gfx(0)->set_colors(palette().entries() / gfx(0)->depth());
@@ -271,7 +265,7 @@ int k051960_device::k051960_fetchromdata( int byte )
m_k051960_cb(&code, &color, &pri, &shadow);
addr = (code << 7) | (off1 << 2) | byte;
- addr &= m_sprite_size - 1;
+ addr &= m_sprite_rom.mask();
// popmessage("%s: addr %06x", machine().describe_context(), addr);
diff --git a/src/mame/video/k051960.h b/src/mame/video/k051960.h
index 069f0f48440..a5b4939153b 100644
--- a/src/mame/video/k051960.h
+++ b/src/mame/video/k051960.h
@@ -22,7 +22,7 @@ typedef device_delegate<void (int *code, int *color, int *priority, int *shadow)
k051960_device::set_plane_order(*device, _order);
#define MCFG_K051960_SCREEN_TAG(_tag) \
- k051960_device::set_screen_tag(*device, owner, _tag);
+ k051960_device::set_screen_tag(*device, "^" _tag);
#define MCFG_K051960_IRQ_HANDLER(_devcb) \
devcb = &k051960_device::set_irq_handler(*device, DEVCB_##_devcb);
@@ -54,7 +54,7 @@ public:
// static configuration
static void set_k051960_callback(device_t &device, k051960_cb_delegate callback) { downcast<k051960_device &>(device).m_k051960_cb = callback; }
static void set_plane_order(device_t &device, int order);
- static void set_screen_tag(device_t &device, device_t *owner, const char *tag);
+ static void set_screen_tag(device_t &device, const char *tag);
/*
The callback is passed:
@@ -89,11 +89,9 @@ private:
// internal state
std::unique_ptr<UINT8[]> m_ram;
- UINT8 *m_sprite_rom;
- UINT32 m_sprite_size;
+ required_region_ptr<UINT8> m_sprite_rom;
- const char *m_screen_tag;
- screen_device *m_screen;
+ required_device<screen_device> m_screen;
emu_timer *m_scanline_timer;
k051960_cb_delegate m_k051960_cb;
diff --git a/src/mame/video/k052109.cpp b/src/mame/video/k052109.cpp
index 08e781da0f8..6530afb113a 100644
--- a/src/mame/video/k052109.cpp
+++ b/src/mame/video/k052109.cpp
@@ -178,9 +178,8 @@ k052109_device::k052109_device(const machine_config &mconfig, const char *tag, d
m_irq_enabled(0),
m_romsubbank(0),
m_scrollctrl(0),
- m_char_rom(nullptr),
- m_char_size(0),
- m_screen_tag(nullptr),
+ m_char_rom(*this, DEVICE_SELF),
+ m_screen(*this),
m_irq_handler(*this),
m_firq_handler(*this),
m_nmi_handler(*this)
@@ -205,21 +204,14 @@ void k052109_device::set_ram(device_t &device, bool ram)
void k052109_device::device_start()
{
- if (m_screen_tag != nullptr)
+ if (m_screen.found())
{
// make sure our screen is started
- screen_device *screen = m_owner->subdevice<screen_device>(m_screen_tag);
- if (!screen->started())
+ if (!m_screen->started())
throw device_missing_dependencies();
// and register a callback for vblank state
- screen->register_vblank_callback(vblank_state_delegate(FUNC(k052109_device::vblank_callback), this));
- }
-
- if (region() != nullptr)
- {
- m_char_rom = region()->base();
- m_char_size = region()->bytes();
+ m_screen->register_vblank_callback(vblank_state_delegate(FUNC(k052109_device::vblank_callback), this));
}
decode_gfx();
@@ -288,10 +280,10 @@ void k052109_device::device_reset()
// set_screen_tag - set screen we are attached to
//-------------------------------------------------
-void k052109_device::set_screen_tag(device_t &device, device_t *owner, const char *tag)
+void k052109_device::set_screen_tag(device_t &device, const char *tag)
{
k052109_device &dev = dynamic_cast<k052109_device &>(device);
- dev.m_screen_tag = tag;
+ dev.m_screen.set_tag(tag);
}
@@ -329,7 +321,7 @@ READ8_MEMBER( k052109_device::read )
}
else /* Punk Shot and TMNT read from 0000-1fff, Aliens from 2000-3fff */
{
- assert (m_char_size != 0);
+ assert (m_char_rom.found());
int code = (offset & 0x1fff) >> 5;
int color = m_romsubbank;
@@ -346,7 +338,7 @@ READ8_MEMBER( k052109_device::read )
m_k052109_cb(0, bank, &code, &color, &flags, &priority);
addr = (code << 5) + (offset & 0x1f);
- addr &= m_char_size - 1;
+ addr &= m_char_rom.mask();
// logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space.device().safe_pc(), offset, m_romsubbank, bank, addr);
diff --git a/src/mame/video/k052109.h b/src/mame/video/k052109.h
index 96f25882fa4..78156365838 100644
--- a/src/mame/video/k052109.h
+++ b/src/mame/video/k052109.h
@@ -14,7 +14,7 @@ typedef device_delegate<void (int layer, int bank, int *code, int *color, int *f
k052109_device::set_ram(*device, _ram);
#define MCFG_K052109_SCREEN_TAG(_tag) \
- k052109_device::set_screen_tag(*device, owner, _tag);
+ k052109_device::set_screen_tag(*device, "^" _tag);
#define MCFG_K052109_IRQ_HANDLER(_devcb) \
devcb = &k052109_device::set_irq_handler(*device, DEVCB_##_devcb);
@@ -36,7 +36,7 @@ public:
static void set_k052109_callback(device_t &device, k052109_cb_delegate callback) { downcast<k052109_device &>(device).m_k052109_cb = callback; }
static void set_ram(device_t &device, bool ram);
- static void set_screen_tag(device_t &device, device_t *owner, const char *tag);
+ static void set_screen_tag(device_t &device, const char *tag);
/*
The callback is passed:
@@ -96,10 +96,9 @@ private:
UINT8 m_irq_enabled;
UINT8 m_romsubbank, m_scrollctrl;
- UINT8 *m_char_rom;
- UINT32 m_char_size;
+ optional_region_ptr<UINT8> m_char_rom;
- const char *m_screen_tag;
+ optional_device<screen_device> m_screen;
k052109_cb_delegate m_k052109_cb;
diff --git a/src/mame/video/k053244_k053245.cpp b/src/mame/video/k053244_k053245.cpp
index 796eff8a3ec..59295af4227 100644
--- a/src/mame/video/k053244_k053245.cpp
+++ b/src/mame/video/k053244_k053245.cpp
@@ -86,7 +86,7 @@ k05324x_device::k05324x_device(const machine_config &mconfig, const char *tag, d
device_gfx_interface(mconfig, *this, gfxinfo),
m_ram(nullptr),
m_buffer(nullptr),
- m_sprite_rom(nullptr),
+ m_sprite_rom(*this, DEVICE_SELF),
m_dx(0),
m_dy(0),
m_rombank(0),
@@ -118,9 +118,6 @@ void k05324x_device::set_bpp(device_t &device, int bpp)
void k05324x_device::device_start()
{
- m_sprite_rom = region()->base();
- m_sprite_size = region()->bytes();
-
/* decode the graphics */
decode_gfx();
gfx(0)->set_colors(palette().entries() / gfx(0)->depth());
@@ -209,7 +206,7 @@ READ8_MEMBER( k05324x_device::k053244_r )
addr = (m_rombank << 19) | ((m_regs[11] & 0x7) << 18)
| (m_regs[8] << 10) | (m_regs[9] << 2)
| ((offset & 3) ^ 1);
- addr &= m_sprite_size - 1;
+ addr &= m_sprite_rom.mask();
// popmessage("%s: offset %02x addr %06x", machine().describe_context(), offset & 3, addr);
diff --git a/src/mame/video/k053244_k053245.h b/src/mame/video/k053244_k053245.h
index 924edc2a37f..47644806bb9 100644
--- a/src/mame/video/k053244_k053245.h
+++ b/src/mame/video/k053244_k053245.h
@@ -66,8 +66,7 @@ private:
// internal state
std::unique_ptr<UINT16[]> m_ram;
std::unique_ptr<UINT16[]> m_buffer;
- UINT8 *m_sprite_rom;
- UINT32 m_sprite_size;
+ required_region_ptr<UINT8> m_sprite_rom;
int m_dx, m_dy;
k05324x_cb_delegate m_k05324x_cb;
diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp
index fc9bc1581eb..1469014fbfc 100644
--- a/src/mame/video/k053246_k053247_k055673.cpp
+++ b/src/mame/video/k053246_k053247_k055673.cpp
@@ -292,9 +292,9 @@ void k053247_device::k053247_sprites_draw_common( _BitmapClass &bitmap, const re
VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS
*/
- if (m_palette->shadows_enabled())
+ if (palette().shadows_enabled())
{
- if (sizeof(typename _BitmapClass::pixel_t) == 4 && (m_palette->hilights_enabled()))
+ if (sizeof(typename _BitmapClass::pixel_t) == 4 && (palette().hilights_enabled()))
shdmask = 3; // enable all shadows and highlights
else
shdmask = 0; // enable default shadows
@@ -505,8 +505,8 @@ void k053247_device::zdrawgfxzoom32GP(
src_fh = 16;
src_base = m_gfx->get_data(code % m_gfx->elements());
- pal_base = m_palette->pens() + m_gfx->colorbase() + (color % m_gfx->colors()) * granularity;
- shd_base = m_palette->shadow_table();
+ pal_base = palette().pens() + m_gfx->colorbase() + (color % m_gfx->colors()) * granularity;
+ shd_base = palette().shadow_table();
dst_ptr = &bitmap.pix32(0);
dst_pitch = bitmap.rowpixels();
@@ -914,7 +914,7 @@ k055673_device::k055673_device(const machine_config &mconfig, const char *tag, d
void k055673_device::device_start()
{
- int gfx_index;
+ int gfx_index = 0;
UINT32 total;
static const gfx_layout spritelayout = /* System GX sprite layout */
@@ -965,12 +965,6 @@ void k055673_device::device_start()
UINT16 *alt_k055673_rom;
int size4;
- /* find first empty slot to decode gfx */
- for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
- if (m_gfxdecode->gfx(gfx_index) == nullptr)
- break;
- assert(gfx_index != MAX_GFX_ELEMENTS);
-
alt_k055673_rom = (UINT16 *)machine().root_device().memregion(m_memory_region)->base();
/* decode the graphics */
@@ -995,33 +989,33 @@ void k055673_device::device_start()
}
total = size4 / 128;
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout, 5);
+ konami_decode_gfx(*this, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout, 5);
break;
case K055673_LAYOUT_RNG:
total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16/2);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout2, 4);
+ konami_decode_gfx(*this, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout2, 4);
break;
case K055673_LAYOUT_LE2:
total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout3, 8);
+ konami_decode_gfx(*this, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout3, 8);
break;
case K055673_LAYOUT_GX6:
total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16*6/8);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout4, 6);
+ konami_decode_gfx(*this, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout4, 6);
break;
default:
fatalerror("Unsupported layout\n");
}
- if (VERBOSE && !(m_palette->shadows_enabled()))
+ if (VERBOSE && !(palette().shadows_enabled()))
popmessage("driver should use VIDEO_HAS_SHADOWS");
m_z_rejection = -1;
- m_gfx = m_gfxdecode->gfx(gfx_index);
+ m_gfx = gfx(gfx_index);
m_objcha_line = CLEAR_LINE;
m_ram = std::make_unique<UINT16[]>(0x1000/2);
@@ -1046,8 +1040,8 @@ const device_type K053246 = &device_creator<k053247_device>;
k053247_device::k053247_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K053246, "K053246 & K053247 Sprite Generator", tag, owner, clock, "k053247", __FILE__),
device_video_interface(mconfig, *this),
- m_gfxdecode(*this),
- m_palette(*this)
+ device_gfx_interface(mconfig, *this),
+ m_gfx_num(0)
{
clear_all();
}
@@ -1055,33 +1049,13 @@ k053247_device::k053247_device(const machine_config &mconfig, const char *tag, d
k053247_device::k053247_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_video_interface(mconfig, *this),
- m_gfxdecode(*this),
- m_palette(*this)
+ device_gfx_interface(mconfig, *this, nullptr),
+ m_gfx_num(0)
{
clear_all();
}
//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void k053247_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<k053247_device &>(device).m_gfxdecode.set_tag(tag);
-}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void k053247_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<k053247_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -1106,7 +1080,7 @@ void k053247_device::device_start()
{
case NORMAL_PLANE_ORDER:
total = machine().root_device().memregion(m_memory_region)->bytes() / 128;
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, m_gfx_num, machine().root_device().memregion(m_memory_region)->base(), total, &spritelayout, 4);
+ konami_decode_gfx(*this, m_gfx_num, machine().root_device().memregion(m_memory_region)->base(), total, &spritelayout, 4);
break;
default:
@@ -1117,17 +1091,17 @@ void k053247_device::device_start()
{
if (m_screen->format() == BITMAP_FORMAT_RGB32)
{
- if (!m_palette->shadows_enabled() || !m_palette->hilights_enabled())
+ if (!palette().shadows_enabled() || !palette().hilights_enabled())
popmessage("driver missing SHADOWS or HIGHLIGHTS flag");
}
else
{
- if (!(m_palette->shadows_enabled()))
+ if (!(palette().shadows_enabled()))
popmessage("driver should use VIDEO_HAS_SHADOWS");
}
}
- m_gfx = m_gfxdecode->gfx(m_gfx_num);
+ m_gfx = gfx(m_gfx_num);
m_ram = make_unique_clear<UINT16[]>(0x1000 / 2);
diff --git a/src/mame/video/k053246_k053247_k055673.h b/src/mame/video/k053246_k053247_k055673.h
index 96e41f00893..7fe1adc37f6 100644
--- a/src/mame/video/k053246_k053247_k055673.h
+++ b/src/mame/video/k053246_k053247_k055673.h
@@ -17,14 +17,14 @@ typedef device_delegate<void (int *code, int *color, int *priority_mask)> k05324
#define MCFG_K053246_CB(_class, _method) \
k053247_device::set_k053247_callback(*device, k053247_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#define MCFG_K053246_CONFIG(_gfx_reg, _gfx_num, _order, _dx, _dy) \
- k053247_device::set_config(*device, _gfx_reg, _gfx_num, _order, _dx, _dy);
+#define MCFG_K053246_CONFIG(_gfx_reg, _order, _dx, _dy) \
+ k053247_device::set_config(*device, _gfx_reg, _order, _dx, _dy);
#define MCFG_K055673_CB(_class, _method) \
k053247_device::set_k053247_callback(*device, k053247_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#define MCFG_K055673_CONFIG(_gfx_reg, _gfx_num, _order, _dx, _dy) \
- k053247_device::set_config(*device, _gfx_reg, _gfx_num, _order, _dx, _dy);
+#define MCFG_K055673_CONFIG(_gfx_reg, _order, _dx, _dy) \
+ k053247_device::set_config(*device, _gfx_reg, _order, _dx, _dy);
/** Konami 053246 / 053247 / 055673 **/
@@ -58,7 +58,8 @@ Callback procedures for non-standard shadows:
class k053247_device : public device_t,
- public device_video_interface
+ public device_video_interface,
+ public device_gfx_interface
{
public:
k053247_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@@ -67,14 +68,11 @@ public:
~k053247_device() { }
// static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_k053247_callback(device_t &device, k053247_cb_delegate callback) { downcast<k053247_device &>(device).m_k053247_cb = callback; }
- static void set_config(device_t &device, const char *gfx_reg, int gfx_num, int bpp, int dx, int dy)
+ static void set_config(device_t &device, const char *gfx_reg, int bpp, int dx, int dy)
{
k053247_device &dev = downcast<k053247_device &>(device);
dev.m_memory_region = gfx_reg;
- dev.m_gfx_num = gfx_num;
dev.m_bpp = bpp;
dev.m_dx = dx;
dev.m_dy = dy;
@@ -122,12 +120,9 @@ public:
k053247_cb_delegate m_k053247_cb;
- //FIXME: device should be updated to use device_gfx_interface to get rid of most of these!
const char *m_memory_region;
int m_gfx_num;
int m_bpp;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
/* alt implementation - to be collapsed */
void zdrawgfxzoom32GP(
@@ -280,14 +275,14 @@ public:
color = 0;
shadow = -1;
whichtable = shadowmode_table;
- m_palette->set_shadow_mode(0);
+ palette().set_shadow_mode(0);
}
else
{
if (shdmask >= 0)
{
shadow = (color & K053247_CUSTOMSHADOW) ? (color >> K053247_SHDSHIFT) : (shadow >> 10);
- if (shadow &= 3) m_palette->set_shadow_mode((shadow - 1) & shdmask);
+ if (shadow &= 3) palette().set_shadow_mode((shadow - 1) & shdmask);
}
else
shadow = 0;
@@ -502,20 +497,12 @@ extern const device_type K055673;
#define MCFG_K053246_SET_SCREEN MCFG_VIDEO_SET_SCREEN
-#define MCFG_K053246_GFXDECODE(_gfxtag) \
- k053247_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
-#define MCFG_K053246_PALETTE(_palette_tag) \
- k053247_device::static_set_palette_tag(*device, "^" _palette_tag);
+#define MCFG_K053246_PALETTE MCFG_GFX_PALETTE
#define MCFG_K055673_SET_SCREEN MCFG_VIDEO_SET_SCREEN
-#define MCFG_K055673_GFXDECODE(_gfxtag) \
- k055673_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
-#define MCFG_K055673_PALETTE(_palette_tag) \
- k055673_device::static_set_palette_tag(*device, "^" _palette_tag);
+#define MCFG_K055673_PALETTE MCFG_GFX_PALETTE
#endif
diff --git a/src/mame/video/k053250.cpp b/src/mame/video/k053250.cpp
index 09b59b99718..55896f2e9b6 100644
--- a/src/mame/video/k053250.cpp
+++ b/src/mame/video/k053250.cpp
@@ -7,7 +7,8 @@ const device_type K053250 = &device_creator<k053250_device>;
k053250_device::k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K053250, "K053250 LVC", tag, owner, clock, "k053250", __FILE__),
device_gfx_interface(mconfig, *this),
- device_video_interface(mconfig, *this)
+ device_video_interface(mconfig, *this),
+ m_rom(*this, DEVICE_SELF)
{
}
@@ -20,18 +21,12 @@ void k053250_device::static_set_offsets(device_t &device, int offx, int offy)
void k053250_device::unpack_nibbles()
{
- if(!m_region)
- throw emu_fatalerror("k053250 %s: no associated region found\n", tag());
+ m_unpacked_rom.resize(m_rom.length()*2);
- const UINT8 *base = m_region->base();
- int size = m_region->bytes();
-
- m_unpacked_rom.resize(size*2);
-
- for(int i=0; i<size; i++)
+ for (int i = 0; i < m_rom.length(); i++)
{
- m_unpacked_rom[2*i] = base[i] >> 4;
- m_unpacked_rom[2*i+1] = base[i] & 0xf;
+ m_unpacked_rom[2*i] = m_rom[i] >> 4;
+ m_unpacked_rom[2*i+1] = m_rom[i] & 0xf;
}
}
@@ -461,5 +456,5 @@ WRITE16_MEMBER(k053250_device::ram_w)
READ16_MEMBER(k053250_device::rom_r)
{
- return m_region->base()[0x80000 * m_regs[6] + 0x800 * m_regs[7] + offset/2];
+ return m_rom[0x80000 * m_regs[6] + 0x800 * m_regs[7] + offset/2];
}
diff --git a/src/mame/video/k053250.h b/src/mame/video/k053250.h
index 610c8577507..2e5e956aa4b 100644
--- a/src/mame/video/k053250.h
+++ b/src/mame/video/k053250.h
@@ -42,6 +42,7 @@ private:
int m_offx, m_offy;
// internal state
+ required_region_ptr<UINT8> m_rom;
dynamic_buffer m_unpacked_rom;
std::vector<UINT16> m_ram;
UINT16 *m_buffer[2];
diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp
index 9167a3e571a..0511b8b8913 100644
--- a/src/mame/video/k054156_k054157_k056832.cpp
+++ b/src/mame/video/k054156_k054157_k056832.cpp
@@ -183,14 +183,14 @@ const device_type K056832 = &device_creator<k056832_device>;
k056832_device::k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K056832, "K056832 Tilemap Generator", tag, owner, clock, "k056832", __FILE__),
+ device_gfx_interface(mconfig, *this),
//m_tilemap[K056832_PAGE_COUNT],
//*m_pixmap[K056832_PAGE_COUNT],
//m_regs[0x20],
//m_regsb[4],
- m_rombase(nullptr),
+ m_rombase(*this),
m_num_gfx_banks(0),
m_cur_gfx_banks(0),
- m_gfx_memory_region(nullptr),
m_gfx_num(0),
m_bpp(-1),
m_big(0),
@@ -219,33 +219,10 @@ k056832_device::k056832_device(const machine_config &mconfig, const char *tag, d
m_use_ext_linescroll(0),
m_uses_tile_banks(0),
m_cur_tile_bank(0),
- m_k055555(nullptr),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_k055555(nullptr)
{
}
-//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void k056832_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<k056832_device &>(device).m_gfxdecode.set_tag(tag);
-}
-
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void k056832_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<k056832_device &>(device).m_palette.set_tag(tag);
-}
-
void k056832_device::create_tilemaps()
{
tilemap_t *tmap;
@@ -284,22 +261,22 @@ void k056832_device::create_tilemaps()
m_videoram.resize(0x2000 * (K056832_PAGE_COUNT + 1) / 2);
memset(&m_videoram[0], 0, 2*m_videoram.size());
- m_tilemap[0x0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info3),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x4] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info4),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x5] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info5),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x6] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info6),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x7] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info7),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x8] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info8),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0x9] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info9),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xa] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoa),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xb] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infob),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xc] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoc),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xd] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infod),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xe] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoe),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_tilemap[0xf] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infof),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x3] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info3),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x4] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info4),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x5] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info5),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x6] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info6),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x7] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info7),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x8] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info8),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0x9] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_info9),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xa] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoa),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xb] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infob),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xc] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoc),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xd] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infod),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xe] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infoe),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_tilemap[0xf] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k056832_device::get_tile_infof),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
for (i = 0; i < K056832_PAGE_COUNT; i++)
{
@@ -362,9 +339,6 @@ void k056832_device::finalize_init()
void k056832_device::device_start()
{
- if(!m_gfxdecode->started())
- throw device_missing_dependencies();
-
memset(m_regs, 0x00, sizeof(m_regs) );
memset(m_regsb, 0x00, sizeof(m_regsb) );
@@ -374,7 +348,7 @@ void k056832_device::device_start()
/* TODO: understand which elements MUST be init here (to keep correct layer
associations) and which ones can can be init at RESET, if any */
- create_gfx(m_gfx_memory_region, m_bpp, m_big);
+ create_gfx();
create_tilemaps();
@@ -635,11 +609,8 @@ void k056832_device::SetExtLinescroll( )
/* generic helper routine for ROM checksumming */
int k056832_device::rom_read_b( int offset, int blksize, int blksize2, int zerosec )
{
- UINT8 *rombase;
int base, ret;
- rombase = (UINT8 *)machine().root_device().memregion(m_gfx_memory_region)->base();
-
if ((m_rom_half) && (zerosec))
{
return 0;
@@ -656,11 +627,11 @@ int k056832_device::rom_read_b( int offset, int blksize, int blksize2, int zeros
if (m_rom_half)
{
- ret = rombase[base + 1];
+ ret = m_rombase[base + 1];
}
else
{
- ret = rombase[base];
+ ret = m_rombase[base];
m_rom_half = 1;
}
@@ -722,9 +693,6 @@ READ16_MEMBER( k056832_device::rom_word_r )
{
int addr = 0x2000 * m_cur_gfx_banks + 2 * offset;
- if (!m_rombase)
- m_rombase = space.machine().root_device().memregion(m_gfx_memory_region)->base();
-
return m_rombase[addr + 1] | (m_rombase[addr] << 8);
}
@@ -735,9 +703,6 @@ READ16_MEMBER( k056832_device::mw_rom_word_r )
int bank = 10240 * m_cur_gfx_banks;
int addr;
- if (!m_rombase)
- m_rombase = space.machine().root_device().memregion(m_gfx_memory_region)->base();
-
if (m_regsb[2] & 0x8)
{
// we want only the 2s
@@ -797,9 +762,6 @@ READ16_MEMBER( k056832_device::bishi_rom_word_r )
{
int addr = 0x4000 * m_cur_gfx_banks + offset;
- if (!m_rombase)
- m_rombase = space.machine().root_device().memregion(m_gfx_memory_region)->base();
-
return m_rombase[addr + 2] | (m_rombase[addr] << 8);
}
@@ -807,9 +769,6 @@ READ16_MEMBER( k056832_device::rom_word_8000_r )
{
int addr = 0x8000 * m_cur_gfx_banks + 2 * offset;
- if (!m_rombase)
- m_rombase = space.machine().root_device().memregion(m_gfx_memory_region)->base();
-
return m_rombase[addr + 2] | (m_rombase[addr] << 8);
}
@@ -817,9 +776,6 @@ READ16_MEMBER( k056832_device::old_rom_word_r )
{
int addr = 0x2000 * m_cur_gfx_banks + 2 * offset;
- if (!m_rombase)
- m_rombase = space.machine().root_device().memregion(m_gfx_memory_region)->base();
-
return m_rombase[addr + 1] | (m_rombase[addr] << 8);
}
@@ -1296,7 +1252,7 @@ int k056832_device::update_linemap( screen_device &screen, _BitmapClass &bitmap,
pixmap = m_pixmap[page];
pal_ptr = machine().pens;
- src_gfx = m_gfxdecode->gfx(m_gfx_num];
+ src_gfx = gfx(m_gfx_num);
src_pitch = src_gfx->rowbytes();
src_modulo = src_gfx->char_modulo;
dst_pitch = pixmap->rowpixels;
@@ -2022,9 +1978,9 @@ READ16_MEMBER( k056832_device::b_word_r )
/***************************************************************************/
-void k056832_device::create_gfx(const char *gfx_memory_region, int bpp, int big)
+void k056832_device::create_gfx()
{
- int gfx_index;
+ int gfx_index = 0;
int i;
UINT32 total;
@@ -2090,68 +2046,57 @@ void k056832_device::create_gfx(const char *gfx_memory_region, int bpp, int big)
8*8*4
};
- m_bpp = bpp;
-
- /* find first empty slot to decode gfx */
- for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
- {
- if (m_gfxdecode->gfx(gfx_index) == nullptr) break;
- }
- assert(gfx_index != MAX_GFX_ELEMENTS);
-
/* handle the various graphics formats */
- i = (big) ? 8 : 16;
+ i = (m_big) ? 8 : 16;
/* decode the graphics */
- switch (bpp)
+ switch (m_bpp)
{
case K056832_BPP_4:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*4);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout4, 4);
+ total = m_rombase.bytes() / (i*4);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout4, 4);
break;
case K056832_BPP_5:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*5);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout5, 5);
+ total = m_rombase.bytes() / (i*5);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout5, 5);
break;
case K056832_BPP_6:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*6);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout6, 6);
+ total = m_rombase.bytes() / (i*6);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout6, 6);
break;
case K056832_BPP_8:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*8);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout8, 8);
+ total = m_rombase.bytes() / (i*8);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout8, 8);
break;
case K056832_BPP_8LE:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*8);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout8le, 8);
+ total = m_rombase.bytes() / (i*8);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout8le, 8);
break;
case K056832_BPP_8TASMAN:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*8);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout8, 8);
+ total = m_rombase.bytes() / (i*8);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout8, 8);
break;
case K056832_BPP_4dj:
- total = machine().root_device().memregion(gfx_memory_region)->bytes() / (i*4);
- konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, machine().root_device().memregion(gfx_memory_region)->base(), total, &charlayout4dj, 4);
+ total = m_rombase.bytes() / (i*4);
+ konami_decode_gfx(*this, gfx_index, &m_rombase[0], total, &charlayout4dj, 4);
break;
default:
fatalerror("Unsupported bpp\n");
}
- m_gfxdecode->gfx(gfx_index)->set_granularity(16); /* override */
- m_gfxdecode->gfx(gfx_index)->set_colors(m_palette->entries() / 16);
+ gfx(gfx_index)->set_granularity(16); /* override */
+ gfx(gfx_index)->set_colors(palette().entries() / 16);
- m_gfx_memory_region = gfx_memory_region;
m_gfx_num = gfx_index;
- m_rombase = machine().root_device().memregion(gfx_memory_region)->base();
- m_num_gfx_banks = machine().root_device().memregion(gfx_memory_region)->bytes() / 0x2000;
+ m_num_gfx_banks = m_rombase.bytes() / 0x2000;
m_cur_gfx_banks = 0;
m_use_ext_linescroll = 0;
m_uses_tile_banks = 0;
@@ -2225,7 +2170,7 @@ int k056832_device::altK056832_update_linemap(screen_device &screen, bitmap_rgb3
pixmap = m_pixmap[page];
pal_ptr = machine().pens;
- src_gfx = m_gfxdecode->gfx(m_gfx_num];
+ src_gfx = gfx(m_gfx_num);
src_pitch = src_gfx->rowbytes();
src_modulo = src_gfx->char_modulo;
dst_pitch = pixmap->rowpixels;
diff --git a/src/mame/video/k054156_k054157_k056832.h b/src/mame/video/k054156_k054157_k056832.h
index d043a4f9525..ce6ed1945d5 100644
--- a/src/mame/video/k054156_k054157_k056832.h
+++ b/src/mame/video/k054156_k054157_k056832.h
@@ -16,8 +16,8 @@ typedef device_delegate<void (int layer, int *code, int *color, int *flags)> k05
#define MCFG_K056832_CB(_class, _method) \
k056832_device::set_k056832_callback(*device, k056832_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#define MCFG_K056832_CONFIG(_gfx_reg, _gfx_num, _bpp, _big, _djmain_hack, _k055555) \
- k056832_device::set_config(*device, _gfx_reg, _gfx_num, _bpp, _big, _djmain_hack, _k055555);
+#define MCFG_K056832_CONFIG(_gfx_reg, _bpp, _big, _djmain_hack, _k055555) \
+ k056832_device::set_config(*device, "^" _gfx_reg, _bpp, _big, _djmain_hack, _k055555);
#define K056832_PAGE_COUNT 16
@@ -35,7 +35,7 @@ typedef device_delegate<void (int layer, int *code, int *color, int *flags)> k05
#define K056382_DRAW_FLAG_FORCE_XYSCROLL 0x00800000
-class k056832_device : public device_t
+class k056832_device : public device_t, public device_gfx_interface
{
public:
k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@@ -45,21 +45,16 @@ public:
}
static void set_k056832_callback(device_t &device, k056832_cb_delegate callback) { downcast<k056832_device &>(device).m_k056832_cb = callback; }
- static void set_config(device_t &device, const char *gfx_reg, int gfx_num, int bpp, int big, int djmain_hack, const char *k055555)
+ static void set_config(device_t &device, const char *gfx_reg, int bpp, int big, int djmain_hack, const char *k055555)
{
k056832_device &dev = downcast<k056832_device &>(device);
- dev.m_gfx_memory_region = gfx_reg;
- dev.m_gfx_num = gfx_num;
+ dev.m_rombase.set_tag(gfx_reg);
dev.m_bpp = bpp;
dev.m_big = big;
dev.m_djmain_hack = djmain_hack;
dev.m_k055555_tag = k055555;
}
- // static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
-
void SetExtLinescroll(); /* Lethal Enforcers */
DECLARE_READ16_MEMBER( ram_word_r );
@@ -132,15 +127,13 @@ private:
UINT16 m_regs[0x20]; // 157/832 regs group 1
UINT16 m_regsb[4]; // 157/832 regs group 2, board dependent
- UINT8 * m_rombase; // pointer to tile gfx data
+ required_region_ptr<UINT8> m_rombase; // pointer to tile gfx data
int m_num_gfx_banks; // depends on size of graphics ROMs
int m_cur_gfx_banks; // cached info for K056832_regs[0x1a]
k056832_cb_delegate m_k056832_cb;
- //FIXME: device should be updated to use device_gfx_interface to get rid of most of these!
- const char *m_gfx_memory_region;
int m_gfx_num;
int m_bpp;
int m_big;
@@ -215,13 +208,10 @@ private:
template<class _BitmapClass>
void tilemap_draw_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int layer, UINT32 flags, UINT32 priority);
- void create_gfx(const char *gfx_memory_region, int bpp, int big);
+ void create_gfx();
void create_tilemaps();
void finalize_init();
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
public:
void m_tilemap_draw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority);
@@ -234,11 +224,8 @@ extern const device_type K056832;
-#define MCFG_K056832_GFXDECODE(_gfxtag) \
- k056832_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
#define MCFG_K056832_PALETTE(_palette_tag) \
- k056832_device::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
#endif
diff --git a/src/mame/video/kan_pand.cpp b/src/mame/video/kan_pand.cpp
index 181de04020d..a1f43a21a7f 100644
--- a/src/mame/video/kan_pand.cpp
+++ b/src/mame/video/kan_pand.cpp
@@ -60,8 +60,7 @@ kaneko_pandora_device::kaneko_pandora_device(const machine_config &mconfig, cons
m_gfx_region(0),
m_xoffset(0),
m_yoffset(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -76,16 +75,6 @@ void kaneko_pandora_device::static_set_gfxdecode_tag(device_t &device, const cha
}
//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void kaneko_pandora_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<kaneko_pandora_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
diff --git a/src/mame/video/kan_pand.h b/src/mame/video/kan_pand.h
index f29c5ef3605..a9cb3d3e7f2 100644
--- a/src/mame/video/kan_pand.h
+++ b/src/mame/video/kan_pand.h
@@ -24,7 +24,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int gfxregion) { downcast<kaneko_pandora_device &>(device).m_gfx_region = gfxregion; }
static void set_offsets(device_t &device, int x_offset, int y_offset)
{
@@ -59,7 +58,6 @@ private:
int m_xoffset;
int m_yoffset;
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type KANEKO_PANDORA;
@@ -78,7 +76,4 @@ extern const device_type KANEKO_PANDORA;
#define MCFG_KANEKO_PANDORA_GFXDECODE(_gfxtag) \
kaneko_pandora_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_KANEKO_PANDORA_PALETTE(_palette_tag) \
- kaneko_pandora_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif /* __KAN_PAND_H__ */
diff --git a/src/mame/video/konami_helper.cpp b/src/mame/video/konami_helper.cpp
index e26864a814b..236371fb4d6 100644
--- a/src/mame/video/konami_helper.cpp
+++ b/src/mame/video/konami_helper.cpp
@@ -5,13 +5,14 @@
#include "emu.h"
#include "konami_helper.h"
-void konami_decode_gfx(running_machine &machine, gfxdecode_device * gfxdecode, palette_device &palette, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp)
+void konami_decode_gfx(device_gfx_interface &gfxdecode, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp)
{
gfx_layout gl;
+ palette_device &palette = gfxdecode.palette();
memcpy(&gl, layout, sizeof(gl));
gl.total = total;
- gfxdecode->set_gfx(gfx_index, std::make_unique<gfx_element>(palette, gl, data, 0, palette.entries() >> bpp, 0));
+ gfxdecode.set_gfx(gfx_index, std::make_unique<gfx_element>(palette, gl, data, 0, palette.entries() >> bpp, 0));
}
diff --git a/src/mame/video/konami_helper.h b/src/mame/video/konami_helper.h
index 0938217e778..e1afd95aada 100644
--- a/src/mame/video/konami_helper.h
+++ b/src/mame/video/konami_helper.h
@@ -6,7 +6,7 @@
#ifndef __KONAMI_HELPER_H__
#define __KONAMI_HELPER_H__
-void konami_decode_gfx(running_machine &machine, gfxdecode_device * gfxdecode, palette_device &palette, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp);
+void konami_decode_gfx(device_gfx_interface &gfxdecode, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp);
/* helper function to sort three tile layers by priority order */
void konami_sortlayers3(int *layer, int *pri);
diff --git a/src/mame/video/mystwarr.cpp b/src/mame/video/mystwarr.cpp
index 537cd1e8157..8fc30620790 100644
--- a/src/mame/video/mystwarr.cpp
+++ b/src/mame/video/mystwarr.cpp
@@ -52,7 +52,7 @@ void mystwarr_state::decode_tiles()
d += 5;
}
- m_gfxdecode->gfx(gfxnum)->set_source(m_decoded.get());
+ m_k056832->gfx(gfxnum)->set_source(m_decoded.get());
}
diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp
index 62736eecae8..54101789fa9 100644
--- a/src/mame/video/pc080sn.cpp
+++ b/src/mame/video/pc080sn.cpp
@@ -58,8 +58,7 @@ pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, d
m_y_offset(0),
m_y_invert(0),
m_dblwidth(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
for (auto & elem : m_ctrl)
elem = 0;
@@ -84,16 +83,6 @@ void pc080sn_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
}
//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void pc080sn_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<pc080sn_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
diff --git a/src/mame/video/pc080sn.h b/src/mame/video/pc080sn.h
index b181fbd134e..a63cdfd6915 100644
--- a/src/mame/video/pc080sn.h
+++ b/src/mame/video/pc080sn.h
@@ -11,7 +11,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int gfxregion) { downcast<pc080sn_device &>(device).m_gfxnum = gfxregion; }
static void set_yinvert(device_t &device, int y_inv) { downcast<pc080sn_device &>(device).m_y_invert = y_inv; }
static void set_dblwidth(device_t &device, int dblwidth) { downcast<pc080sn_device &>(device).m_dblwidth = dblwidth; }
@@ -68,7 +67,6 @@ public:
int m_dblwidth;
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
extern const device_type PC080SN;
@@ -89,7 +87,4 @@ extern const device_type PC080SN;
#define MCFG_PC080SN_GFXDECODE(_gfxtag) \
pc080sn_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_PC080SN_PALETTE(_palette_tag) \
- pc080sn_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif
diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp
index 66d4b288347..cd453cffa14 100644
--- a/src/mame/video/pcd.cpp
+++ b/src/mame/video/pcd.cpp
@@ -10,11 +10,10 @@ const device_type PCX_VIDEO = &device_creator<pcx_video_device>;
pcdx_video_device::pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ device_gfx_interface(mconfig, *this, nullptr, "palette"),
m_maincpu(*this, ":maincpu"),
m_mcu(*this, "graphics"),
m_crtc(*this, "crtc"),
- m_palette(*this, "palette"),
- m_gfxdecode(*this, "gfxdecode"),
m_pic2(*this, ":pic2")
{
}
@@ -76,7 +75,7 @@ static const gfx_layout pcd_charlayout =
};
static GFXDECODE_START( pcx )
- GFXDECODE_ENTRY( "char", 0x0000, pcd_charlayout, 0, 1 )
+ GFXDECODE_DEVICE( "char", 0x0000, pcd_charlayout, 0, 1 )
GFXDECODE_END
static INPUT_PORTS_START( pcd_mouse )
@@ -113,7 +112,6 @@ static MACHINE_CONFIG_FRAGMENT( pcd_video )
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_PALETTE_ADD("palette", 3)
MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx)
@@ -159,7 +157,6 @@ static MACHINE_CONFIG_FRAGMENT( pcx_video )
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update)
- MCFG_GFXDECODE_ADD("gfxdecode", "palette", pcx)
MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_SCN2674_VIDEO_ADD("crtc", 0, INPUTLINE("graphics", MCS51_INT0_LINE));
@@ -184,7 +181,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels)
if(m_p2 & 8)
data = ~data;
for(int i = 0; i < 16; i++)
- bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (15 - i))) ? 1 : 0);
+ bitmap.pix32(y, x + i) = palette().pen((data & (1 << (15 - i))) ? 1 : 0);
}
else
{
@@ -207,7 +204,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels)
else if(attr & 8)
bgnd = 2;
for(int i = 0; i < 8; i++)
- bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? fgnd : bgnd);
+ bitmap.pix32(y, x + i) = palette().pen((data & (1 << (7 - i))) ? fgnd : bgnd);
}
}
@@ -221,7 +218,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels)
if(m_p1 & 0x20)
data = ~data;
for(int i = 0; i < 8; i++)
- bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : 0);
+ bitmap.pix32(y, x + i) = palette().pen((data & (1 << (7 - i))) ? 1 : 0);
}
PALETTE_INIT_MEMBER(pcdx_video_device, pcdx)
@@ -276,7 +273,7 @@ WRITE8_MEMBER(pcd_video_device::vram_w)
{
offset >>= 1;
m_charram[offset & 0x1fff] = data;
- m_gfxdecode->gfx(0)->mark_dirty(offset/16);
+ gfx(0)->mark_dirty(offset/16);
}
}
@@ -410,7 +407,7 @@ void pcd_video_device::device_start()
{
m_maincpu->space(AS_IO).install_readwrite_handler(0xfb00, 0xfb01, 0, 0, read8_delegate(FUNC(pcdx_video_device::detect_r), this), write8_delegate(FUNC(pcdx_video_device::detect_w), this), 0xff00);
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf0000, 0xf7fff, 0, 0, read8_delegate(FUNC(pcd_video_device::vram_r), this), write8_delegate(FUNC(pcd_video_device::vram_w), this), 0xffff);
- m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, pcd_charlayout, &m_charram[0], 0, 1, 0));
+ set_gfx(0, std::make_unique<gfx_element>(palette(), pcd_charlayout, &m_charram[0], 0, 1, 0));
}
void pcd_video_device::device_reset()
@@ -442,6 +439,8 @@ void pcx_video_device::device_start()
mcu->i8051_set_serial_rx_callback(READ8_DELEGATE(pcx_video_device, rx_callback));
set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rate(600*2); // FIXME: fix the keyboard when the mc2661 baud rate calc is fixed
+
+ decode_gfx(GFXDECODE_NAME(pcx));
}
void pcx_video_device::device_reset()
diff --git a/src/mame/video/pcd.h b/src/mame/video/pcd.h
index f22c2707569..32637fac992 100644
--- a/src/mame/video/pcd.h
+++ b/src/mame/video/pcd.h
@@ -11,7 +11,7 @@
#define MCFG_PCX_VIDEO_TXD_HANDLER(_devcb) \
devcb = &pcx_video_device::set_txd_handler(*device, DEVCB_##_devcb);
-class pcdx_video_device : public device_t
+class pcdx_video_device : public device_t, public device_gfx_interface
{
public:
pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
@@ -25,8 +25,6 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_mcu;
required_device<scn2674_device> m_crtc;
- required_device<palette_device> m_palette;
- required_device<gfxdecode_device> m_gfxdecode;
required_device<pic8259_device> m_pic2;
};
diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp
index 1b68402c493..8834730ad20 100644
--- a/src/mame/video/powervr2.cpp
+++ b/src/mame/video/powervr2.cpp
@@ -2016,7 +2016,7 @@ WRITE64_MEMBER( powervr2_device::ta_fifo_poly_w )
}
else
{
- fatalerror("ta_fifo_poly_w: Only 64 bit writes supported!\n");
+ osd_printf_debug("%s",string_format("ta_fifo_poly_w: Unmapped write64 %08x = %I64x mask %I64x\n", 0x10000000+offset*8, data, mem_mask).c_str());
}
tafifo_pos &= tafifo_mask;
diff --git a/src/mame/video/sega16sp.cpp b/src/mame/video/sega16sp.cpp
index 3629072e2e5..8f5e8e6de75 100644
--- a/src/mame/video/sega16sp.cpp
+++ b/src/mame/video/sega16sp.cpp
@@ -96,6 +96,7 @@ WRITE16_MEMBER( sega_16bit_sprite_device::draw_write )
sega_hangon_sprite_device::sega_hangon_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_HANGON_SPRITES, "Sega Custom Sprites (Hang On)", tag, owner, "sega_hangon_sprite", __FILE__)
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(189, -1);
}
@@ -141,8 +142,8 @@ void sega_hangon_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
//
// render the sprites in order
- const UINT16 *spritebase = reinterpret_cast<const UINT16 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x10000;
+ const UINT16 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x10000;
const UINT8 *zoom = memregion("zoom")->base();
UINT16 *ramend = spriteram() + spriteram_elements();
for (UINT16 *data = spriteram(); data < ramend; data += 8)
@@ -272,6 +273,7 @@ void sega_hangon_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
sega_sharrier_sprite_device::sega_sharrier_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SHARRIER_SPRITES, "Sega Custom Sprites (Space Harrier)", tag, owner, "sega_sharrier_sprite", __FILE__)
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(189, -1);
}
@@ -320,8 +322,8 @@ void sega_sharrier_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cl
//
// render the sprites in order
- const UINT32 *spritebase = reinterpret_cast<const UINT32 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x20000;
+ const UINT32 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x20000;
const UINT8 *zoom = memregion("zoom")->base();
UINT16 *ramend = spriteram() + spriteram_elements();
for (UINT16 *data = spriteram(); data < ramend; data += 8)
@@ -459,6 +461,7 @@ void sega_sharrier_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cl
sega_sys16a_sprite_device::sega_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SYS16A_SPRITES, "Sega System 16A Sprites", tag, owner, "sega_sys16a_sprite", __FILE__)
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(189, -1, -189, -1);
}
@@ -503,8 +506,8 @@ void sega_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
//
// render the sprites in order
- const UINT16 *spritebase = reinterpret_cast<const UINT16 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x10000;
+ const UINT16 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x10000;
UINT16 *ramend = spriteram() + spriteram_elements();
for (UINT16 *data = spriteram(); data < ramend; data += 8)
{
@@ -638,6 +641,7 @@ void sega_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
bootleg_sys16a_sprite_device::bootleg_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, BOOTLEG_SYS16A_SPRITES, "Sega System 16A Sprites (Bootleg)", tag, owner, "bootleg_sys16a_sprite", __FILE__)
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
m_addrmap[0] = 0;
m_addrmap[1] = 1;
@@ -689,8 +693,8 @@ void bootleg_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &c
//
// render the sprites in order
- const UINT16 *spritebase = reinterpret_cast<const UINT16 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x10000;
+ const UINT16 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x10000;
UINT16 *ramend = spriteram() + spriteram_elements();
for (UINT16 *data = spriteram(); data < ramend; data += 8)
{
@@ -826,7 +830,7 @@ void bootleg_sys16a_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &c
sega_sys16b_sprite_device::sega_sys16b_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_SYS16B_SPRITES, "Sega System 16B Sprites", tag, owner, "sega_16bit_sprite", __FILE__)
- , m_sprite_region_ptr(*this, ":sprites")
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(184, 0x00, -184, 0);
}
@@ -1022,14 +1026,16 @@ void sega_sys16b_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
sega_outrun_sprite_device::sega_outrun_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_OUTRUN_SPRITES, "Sega Custom Sprites (Out Run)", tag, owner, "sega_outrun_sprite", __FILE__),
- m_is_xboard(false)
+ m_is_xboard(false),
+ m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(189, 0x00);
}
sega_outrun_sprite_device::sega_outrun_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool xboard_variant, const char *shortname, const char *source)
: sega_16bit_sprite_device(mconfig, SEGA_XBOARD_SPRITES, "Sega X-Board Sprites", tag, owner, shortname, source),
- m_is_xboard(true)
+ m_is_xboard(true),
+ m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(190, 0x00);
}
@@ -1090,8 +1096,8 @@ void sega_outrun_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
set_origin(m_xoffs, m_yoffs);
// render the sprites in order
- const UINT32 *spritebase = reinterpret_cast<const UINT32 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x40000;
+ const UINT32 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x40000;
UINT16 *ramend = buffer() + spriteram_elements();
for (UINT16 *data = buffer(); data < ramend; data += 8)
{
@@ -1235,6 +1241,7 @@ void sega_outrun_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
sega_yboard_sprite_device::sega_yboard_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: sega_16bit_sprite_device(mconfig, SEGA_YBOARD_SPRITES, "Sega Y-Board Sprites", tag, owner, "sega_yboard_sprite", __FILE__)
+ , m_sprite_region_ptr(*this, DEVICE_SELF)
{
set_local_origin(0x600, 0x600);
}
@@ -1293,8 +1300,8 @@ void sega_yboard_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
memset(visited, 0, sizeof(visited));
// render the sprites in order
- const UINT64 *spritebase = reinterpret_cast<const UINT64 *>(region()->base());
- UINT8 numbanks = region()->bytes() / 0x80000;
+ const UINT64 *spritebase = &m_sprite_region_ptr[0];
+ UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x80000;
int next = 0;
for (UINT16 *data = spriteram(); !(data[0] & 0x8000) && !visited[next]; data = spriteram() + next * 8)
{
diff --git a/src/mame/video/sega16sp.h b/src/mame/video/sega16sp.h
index ed758b1299f..e5f50143ba1 100644
--- a/src/mame/video/sega16sp.h
+++ b/src/mame/video/sega16sp.h
@@ -130,6 +130,9 @@ public:
protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
+
+ // memory regions
+ required_region_ptr<UINT16> m_sprite_region_ptr;
};
@@ -144,6 +147,9 @@ public:
protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
+
+ // memory regions
+ required_region_ptr<UINT32> m_sprite_region_ptr;
};
@@ -157,11 +163,13 @@ public:
protected:
sega_outrun_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool xboard_variant, const char *shortname, const char *source);
+protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
// configuration
bool m_is_xboard;
+ required_region_ptr<UINT32> m_sprite_region_ptr;
};
class sega_xboard_sprite_device : public sega_outrun_sprite_device
@@ -183,6 +191,9 @@ public:
protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
+
+ // memory regions
+ required_region_ptr<UINT16> m_sprite_region_ptr;
};
@@ -201,6 +212,9 @@ protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
+ // memory regions
+ required_region_ptr<UINT16> m_sprite_region_ptr;
+
// internal state
UINT8 m_addrmap[8];
};
@@ -236,7 +250,8 @@ protected:
// subclass overrides
virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
- rotate_info* m_segaic16_rotate;
+ required_region_ptr<UINT64> m_sprite_region_ptr;
+ rotate_info* m_segaic16_rotate;
};
diff --git a/src/mame/video/segaic24.cpp b/src/mame/video/segaic24.cpp
index 57c848287dc..f1e1f87aae9 100644
--- a/src/mame/video/segaic24.cpp
+++ b/src/mame/video/segaic24.cpp
@@ -25,31 +25,11 @@ const device_type S24MIXER = &device_creator<segas24_mixer>;
segas24_tile::segas24_tile(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, S24TILE, "Sega System 24 Tilemap", tag, owner, clock, "segas24_tile", __FILE__),
- m_gfxdecode(*this),
- m_palette(*this)
+ device_gfx_interface(mconfig, *this),
+ char_gfx_index(0)
{
}
-//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void segas24_tile::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<segas24_tile &>(device).m_gfxdecode.set_tag(tag);
-}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void segas24_tile::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<segas24_tile &>(device).m_palette.set_tag(tag);
-}
-
void segas24_tile::static_set_tile_mask(device_t &device, UINT16 _tile_mask)
{
@@ -96,21 +76,13 @@ TILE_GET_INFO_MEMBER(segas24_tile::tile_info_1w)
void segas24_tile::device_start()
{
- if(!m_gfxdecode->started())
- throw device_missing_dependencies();
-
- for(char_gfx_index = 0; char_gfx_index < MAX_GFX_ELEMENTS; char_gfx_index++)
- if (m_gfxdecode->gfx(char_gfx_index) == nullptr)
- break;
- assert(char_gfx_index != MAX_GFX_ELEMENTS);
-
char_ram = std::make_unique<UINT16[]>(0x80000/2);
tile_ram = std::make_unique<UINT16[]>(0x10000/2);
- tile_layer[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_0s),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
- tile_layer[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_0w),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
- tile_layer[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_1s),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
- tile_layer[3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_1w),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+ tile_layer[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_0s),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+ tile_layer[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_0w),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+ tile_layer[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_1s),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+ tile_layer[3] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(segas24_tile::tile_info_1w),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
tile_layer[0]->set_transparent_pen(0);
tile_layer[1]->set_transparent_pen(0);
@@ -120,7 +92,7 @@ void segas24_tile::device_start()
memset(char_ram.get(), 0, 0x80000);
memset(tile_ram.get(), 0, 0x10000);
- m_gfxdecode->set_gfx(char_gfx_index, std::make_unique<gfx_element>(m_palette, char_layout, (UINT8 *)char_ram.get(), NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0));
+ set_gfx(char_gfx_index, std::make_unique<gfx_element>(palette(), char_layout, (UINT8 *)char_ram.get(), NATIVE_ENDIAN_VALUE_LE_BE(8,0), palette().entries() / 16, 0));
save_pointer(NAME(tile_ram.get()), 0x10000/2);
save_pointer(NAME(char_ram.get()), 0x80000/2);
@@ -267,7 +239,7 @@ void segas24_tile::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind
const UINT16 *source = &bm.pix16(sy, sx);
const UINT8 *trans = &tm.pix8(sy, sx);
UINT32 *dest = &dm.pix32(0);
- const pen_t *pens = m_palette->pens();
+ const pen_t *pens = palette().pens();
tpri |= TILEMAP_PIXEL_LAYER0;
@@ -576,7 +548,7 @@ WRITE16_MEMBER(segas24_tile::char_w)
UINT16 old = char_ram[offset];
COMBINE_DATA(char_ram.get() + offset);
if(old != char_ram[offset])
- m_gfxdecode->gfx(char_gfx_index)->mark_dirty(offset / 16);
+ gfx(char_gfx_index)->mark_dirty(offset / 16);
}
READ32_MEMBER(segas24_tile::tile32_r)
diff --git a/src/mame/video/segaic24.h b/src/mame/video/segaic24.h
index 51165e32ac1..baa9b018afa 100644
--- a/src/mame/video/segaic24.h
+++ b/src/mame/video/segaic24.h
@@ -19,13 +19,10 @@
MCFG_DEVICE_ADD(_tag, S24MIXER, 0)
-#define MCFG_S24TILE_DEVICE_GFXDECODE(_gfxtag) \
- segas24_tile::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
#define MCFG_S24TILE_DEVICE_PALETTE(_palette_tag) \
- segas24_tile::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
-class segas24_tile : public device_t
+class segas24_tile : public device_t, public device_gfx_interface
{
friend class segas24_tile_config;
@@ -33,8 +30,6 @@ public:
segas24_tile(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void static_set_tile_mask(device_t &device, UINT16 tile_mask);
DECLARE_READ16_MEMBER(tile_r);
@@ -65,8 +60,6 @@ private:
UINT16 tile_mask;
static const gfx_layout char_layout;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void tile_info(int offset, tile_data &tileinfo, tilemap_memory_index tile_index);
TILE_GET_INFO_MEMBER(tile_info_0s);
diff --git a/src/mame/video/senjyo.cpp b/src/mame/video/senjyo.cpp
index dfccfbdd7b1..4b5896c3ac0 100644
--- a/src/mame/video/senjyo.cpp
+++ b/src/mame/video/senjyo.cpp
@@ -9,7 +9,6 @@
***************************************************************************/
#include "emu.h"
-#include "machine/segacrpt.h"
#include "includes/senjyo.h"
diff --git a/src/mame/video/seta001.cpp b/src/mame/video/seta001.cpp
index d0ff7874fb3..3c81cd94a0e 100644
--- a/src/mame/video/seta001.cpp
+++ b/src/mame/video/seta001.cpp
@@ -33,8 +33,7 @@ const device_type SETA001_SPRITE = &device_creator<seta001_device>;
seta001_device::seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SETA001_SPRITE, "Seta SETA001 Sprite", tag, owner, clock, "seta001", __FILE__),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -48,16 +47,6 @@ void seta001_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
downcast<seta001_device &>(device).m_gfxdecode.set_tag(tag);
}
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void seta001_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<seta001_device &>(device).m_palette.set_tag(tag);
-}
-
void seta001_device::device_start()
{
// chukatai draws a column on the left from uninitialized RAM which causes garbage in a debug build
diff --git a/src/mame/video/seta001.h b/src/mame/video/seta001.h
index b7fea3ce96e..936a9183859 100644
--- a/src/mame/video/seta001.h
+++ b/src/mame/video/seta001.h
@@ -15,7 +15,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfxbank_callback(device_t &device, gfxbank_cb_delegate callback) { downcast<seta001_device &>(device).m_gfxbank_cb = callback; }
DECLARE_WRITE8_MEMBER( spritebgflag_w8 );
@@ -63,7 +62,6 @@ private:
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size, int setac_type);
void draw_foreground( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size);
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
gfxbank_cb_delegate m_gfxbank_cb;
@@ -88,6 +86,3 @@ extern const device_type SETA001_SPRITE;
#define MCFG_SETA001_SPRITE_GFXDECODE(_gfxtag) \
seta001_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
-#define MCFG_SETA001_SPRITE_PALETTE(_palette_tag) \
- seta001_device::static_set_palette_tag(*device, "^" _palette_tag);
diff --git a/src/mame/video/snk68_spr.cpp b/src/mame/video/snk68_spr.cpp
index fa2382d76ef..0aa9315788a 100644
--- a/src/mame/video/snk68_spr.cpp
+++ b/src/mame/video/snk68_spr.cpp
@@ -10,7 +10,6 @@ const device_type SNK68_SPR = &device_creator<snk68_spr_device>;
snk68_spr_device::snk68_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SNK68_SPR, "SNK68 Sprites", tag, owner, clock, "snk68_spr", __FILE__),
m_gfxdecode(*this),
- m_palette(*this),
m_spriteram(*this, "^spriteram"),
m_screen(*this, "^screen"),
m_flipscreen(0),
@@ -34,16 +33,6 @@ void snk68_spr_device::static_set_gfxdecode_tag(device_t &device, const char *ta
downcast<snk68_spr_device &>(device).m_gfxdecode.set_tag(tag);
}
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void snk68_spr_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<snk68_spr_device &>(device).m_palette.set_tag(tag);
-}
-
// static
void snk68_spr_device::set_tile_indirect_cb(device_t &device,snk68_tile_indirection_delegate newtilecb)
{
diff --git a/src/mame/video/snk68_spr.h b/src/mame/video/snk68_spr.h
index 5604f74714a..1f985727e5a 100644
--- a/src/mame/video/snk68_spr.h
+++ b/src/mame/video/snk68_spr.h
@@ -4,8 +4,6 @@ typedef device_delegate<void (int&, int&, int&, int&)> snk68_tile_indirection_de
#define MCFG_SNK68_SPR_GFXDECODE(_gfxtag) \
snk68_spr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_SNK68_SPR_PALETTE(_palette_tag) \
- snk68_spr_device::static_set_palette_tag(*device, "^" _palette_tag);
#define MCFG_SNK68_SPR_SET_TILE_INDIRECT( _class, _method) \
snk68_spr_device::set_tile_indirect_cb(*device, snk68_tile_indirection_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
#define MCFG_SNK68_SPR_NO_PARTIAL \
@@ -19,7 +17,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_tile_indirect_cb(device_t &device,snk68_tile_indirection_delegate newtilecb);
static void static_set_no_partial(device_t &device);
@@ -38,8 +35,7 @@ protected:
virtual void device_reset() override;
private:
- optional_device<gfxdecode_device> m_gfxdecode;
- optional_device<palette_device> m_palette;
+ required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<UINT16> m_spriteram;
required_device<screen_device> m_screen;
int m_flipscreen;
diff --git a/src/mame/video/st0020.cpp b/src/mame/video/st0020.cpp
index bb0bb01da1b..084d8be208f 100644
--- a/src/mame/video/st0020.cpp
+++ b/src/mame/video/st0020.cpp
@@ -17,33 +17,12 @@ const device_type ST0020_SPRITES = &device_creator<st0020_device>;
st0020_device::st0020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ST0020_SPRITES, "Seta ST0020 Sprites", tag, owner, clock, "st0020", __FILE__)
- , m_gfxdecode(*this)
- , m_palette(*this)
+ , device_gfx_interface(mconfig, *this)
{
m_is_st0032 = 0;
m_is_jclub2 = 0;
}
-//-------------------------------------------------
-// static_set_gfxdecode_tag: Set the tag of the
-// gfx decoder
-//-------------------------------------------------
-
-void st0020_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
-{
- downcast<st0020_device &>(device).m_gfxdecode.set_tag(tag);
-}
-
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void st0020_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<st0020_device &>(device).m_palette.set_tag(tag);
-}
-
void st0020_device::set_is_st0032(device_t &device, int is_st0032)
{
st0020_device &dev = downcast<st0020_device &>(device);
@@ -90,13 +69,9 @@ void st0020_device::device_start()
m_st0020_spriteram = make_unique_clear<UINT16[]>(0x80000 / 2);
m_st0020_blitram = make_unique_clear<UINT16[]>(0x100 / 2);
- for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++)
- if (m_gfxdecode->gfx(m_gfx_index) == nullptr)
- break;
-
- m_gfxdecode->set_gfx(m_gfx_index, std::make_unique<gfx_element>(m_palette, layout_16x8x8_2, (UINT8 *)m_st0020_gfxram.get(), 0, m_palette->entries() / 64, 0));
+ set_gfx(0, std::make_unique<gfx_element>(palette(), layout_16x8x8_2, (UINT8 *)m_st0020_gfxram.get(), 0, palette().entries() / 64, 0));
- m_gfxdecode->gfx(m_gfx_index)->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */
+ gfx(0)->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */
save_pointer(NAME(m_st0020_gfxram.get()), 4 * 0x100000/2);
save_pointer(NAME(m_st0020_spriteram.get()), 0x80000/2);
@@ -128,7 +103,7 @@ WRITE16_MEMBER(st0020_device::st0020_gfxram_w)
offset += m_st0020_gfxram_bank * 0x100000/2;
COMBINE_DATA(&m_st0020_gfxram[offset]);
- m_gfxdecode->gfx(m_gfx_index)->mark_dirty(offset / (16*8/2));
+ gfx(0)->mark_dirty(offset / (16*8/2));
}
READ16_MEMBER(st0020_device::st0020_sprram_r)
@@ -214,7 +189,7 @@ WRITE16_MEMBER(st0020_device::st0020_blit_w)
dst /= 16*8;
while (len--)
{
- m_gfxdecode->gfx(m_gfx_index)->mark_dirty(dst);
+ gfx(0)->mark_dirty(dst);
dst++;
}
}
@@ -407,7 +382,7 @@ void st0020_device::st0020_draw_zooming_sprites(bitmap_ind16 &bitmap, const rect
{
for (y = ystart; y != yend; y += yinc)
{
- m_gfxdecode->gfx(m_gfx_index)->zoom_transpen(bitmap,cliprect,
+ gfx(0)->zoom_transpen(bitmap,cliprect,
code++,
color,
flipx, flipy,
diff --git a/src/mame/video/st0020.h b/src/mame/video/st0020.h
index 33390a8bddc..23049c2b8fb 100644
--- a/src/mame/video/st0020.h
+++ b/src/mame/video/st0020.h
@@ -3,19 +3,15 @@
-class st0020_device : public device_t
+class st0020_device : public device_t, public device_gfx_interface
{
public:
st0020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_is_st0032(device_t &device, int is_st0032);
static void set_is_jclub2o(device_t &device, int is_jclub2o);
- int m_gfx_index;
-
// see if we can handle the difference between this and the st0032 in here, or if we need another
// device
int m_is_st0032;
@@ -45,8 +41,6 @@ private:
void st0020_draw_zooming_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
DECLARE_READ16_MEMBER(st0020_blit_r);
DECLARE_WRITE16_MEMBER(st0020_blit_w);
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
UINT8* m_rom_ptr;
size_t m_rom_size;
};
@@ -57,8 +51,5 @@ private:
if (m_is_st0032) mem_mask = ((mem_mask & 0x00ff)<<8) | ((mem_mask & 0xff00)>>8);
extern const device_type ST0020_SPRITES;
-#define MCFG_ST0020_SPRITES_GFXDECODE(_gfxtag) \
- st0020_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
#define MCFG_ST0020_SPRITES_PALETTE(_palette_tag) \
- st0020_device::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp
index 0bf5aec9b62..4e0604b9514 100644
--- a/src/mame/video/tc0080vco.cpp
+++ b/src/mame/video/tc0080vco.cpp
@@ -103,8 +103,7 @@ tc0080vco_device::tc0080vco_device(const machine_config &mconfig, const char *ta
m_bg_yoffs(0),
m_bg_flip_yoffs(0),
m_has_fg0(1),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
}
@@ -119,16 +118,6 @@ void tc0080vco_device::static_set_gfxdecode_tag(device_t &device, const char *ta
}
//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void tc0080vco_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<tc0080vco_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -193,7 +182,7 @@ void tc0080vco_device::device_start()
m_scroll_ram = m_ram.get() + 0x20800 / 2;
/* create the char set (gfx will then be updated dynamically from RAM) */
- m_gfxdecode->set_gfx(m_txnum, std::make_unique<gfx_element>(m_palette, charlayout, (UINT8 *)m_char_ram, 0, 1, 512));
+ m_gfxdecode->set_gfx(m_txnum, std::make_unique<gfx_element>(m_gfxdecode->palette(), charlayout, (UINT8 *)m_char_ram, 0, 1, 512));
save_pointer(NAME(m_ram.get()), TC0080VCO_RAM_SIZE / 2);
machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_device::postload), this));
diff --git a/src/mame/video/tc0080vco.h b/src/mame/video/tc0080vco.h
index c842e3a57b5..65652b011ec 100644
--- a/src/mame/video/tc0080vco.h
+++ b/src/mame/video/tc0080vco.h
@@ -11,7 +11,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int gfxnum) { downcast<tc0080vco_device &>(device).m_gfxnum = gfxnum; }
static void set_tx_region(device_t &device, int txnum) { downcast<tc0080vco_device &>(device).m_txnum = txnum; }
static void set_offsets(device_t &device, int x_offset, int y_offset)
@@ -75,7 +74,6 @@ private:
int m_has_fg0; // for debug, it can be enabled with set_fg0_debug(true)
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
TILE_GET_INFO_MEMBER(get_bg0_tile_info);
TILE_GET_INFO_MEMBER(get_bg1_tile_info);
@@ -101,7 +99,4 @@ extern const device_type TC0080VCO;
#define MCFG_TC0080VCO_GFXDECODE(_gfxtag) \
tc0080vco_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_TC0080VCO_PALETTE(_palette_tag) \
- tc0080vco_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif
diff --git a/src/mame/video/tc0150rod.cpp b/src/mame/video/tc0150rod.cpp
index 6077df445e3..c6bcd8512af 100644
--- a/src/mame/video/tc0150rod.cpp
+++ b/src/mame/video/tc0150rod.cpp
@@ -16,7 +16,7 @@ const device_type TC0150ROD = &device_creator<tc0150rod_device>;
tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, TC0150ROD, "Taito TC0150ROD", tag, owner, clock, "tc0150rod", __FILE__),
- m_roadgfx(nullptr)
+ m_roadgfx(*this, DEVICE_SELF, 0x40000)
{
}
@@ -29,9 +29,6 @@ void tc0150rod_device::device_start()
m_ram.resize(TC0150ROD_RAM_SIZE / 2);
memset(&m_ram[0], 0, TC0150ROD_RAM_SIZE);
save_item(NAME(m_ram));
-
- m_roadgfx = (UINT16 *)region()->base();
- assert(m_roadgfx);
}
diff --git a/src/mame/video/tc0150rod.h b/src/mame/video/tc0150rod.h
index 723e97dea7c..a6c2b653a64 100644
--- a/src/mame/video/tc0150rod.h
+++ b/src/mame/video/tc0150rod.h
@@ -20,7 +20,7 @@ protected:
private:
// internal state
std::vector<UINT16> m_ram;
- UINT16 *m_roadgfx;
+ required_region_ptr<UINT16> m_roadgfx;
};
extern const device_type TC0150ROD;
diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp
index 83b0ede8c18..bfd14613a53 100644
--- a/src/mame/video/tc0480scp.cpp
+++ b/src/mame/video/tc0480scp.cpp
@@ -166,8 +166,7 @@ tc0480scp_device::tc0480scp_device(const machine_config &mconfig, const char *ta
m_flip_xoffs(0),
m_flip_yoffs(0),
m_col_base(0),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
memset(m_ctrl, 0, sizeof(m_ctrl));
@@ -193,16 +192,6 @@ void tc0480scp_device::static_set_gfxdecode_tag(device_t &device, const char *ta
}
//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void tc0480scp_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<tc0480scp_device &>(device).m_palette.set_tag(tag);
-}
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -297,7 +286,7 @@ void tc0480scp_device::device_start()
set_layer_ptrs();
/* create the char set (gfx will then be updated dynamically from RAM) */
- m_gfxdecode->set_gfx(m_txnum, std::make_unique<gfx_element>(m_palette, tc0480scp_charlayout, (UINT8 *)m_char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), 64, m_col_base));
+ m_gfxdecode->set_gfx(m_txnum, std::make_unique<gfx_element>(m_gfxdecode->palette(), tc0480scp_charlayout, (UINT8 *)m_char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), 64, m_col_base));
m_gfxdecode->gfx(m_gfxnum)->set_colorbase(m_col_base);
save_item(NAME(m_ram));
diff --git a/src/mame/video/tc0480scp.h b/src/mame/video/tc0480scp.h
index 12c83523234..1f77d368b45 100644
--- a/src/mame/video/tc0480scp.h
+++ b/src/mame/video/tc0480scp.h
@@ -11,7 +11,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_region(device_t &device, int gfxregion) { downcast<tc0480scp_device &>(device).m_gfxnum = gfxregion; }
static void set_tx_region(device_t &device, int txregion) { downcast<tc0480scp_device &>(device).m_txnum = txregion; }
static void set_col_base(device_t &device, int col) { downcast<tc0480scp_device &>(device).m_col_base = col; }
@@ -95,7 +94,6 @@ private:
int m_col_base;
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void common_get_tc0480bg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum );
void common_get_tc0480tx_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum );
@@ -136,7 +134,4 @@ extern const device_type TC0480SCP;
#define MCFG_TC0480SCP_GFXDECODE(_gfxtag) \
tc0480scp_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_TC0480SCP_PALETTE(_palette_tag) \
- tc0480scp_device::static_set_palette_tag(*device, "^" _palette_tag);
-
#endif
diff --git a/src/mame/video/vsystem_spr.cpp b/src/mame/video/vsystem_spr.cpp
index 7b74e66851c..981dc32cb40 100644
--- a/src/mame/video/vsystem_spr.cpp
+++ b/src/mame/video/vsystem_spr.cpp
@@ -73,8 +73,7 @@ const device_type VSYSTEM_SPR = &device_creator<vsystem_spr_device>;
vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VSYSTEM_SPR, "Video System Sprites", tag, owner, clock, "vsystem_spr", __FILE__),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
m_transpen = 15;
m_pal_base = 0;
@@ -99,16 +98,6 @@ void vsystem_spr_device::static_set_gfxdecode_tag(device_t &device, const char *
downcast<vsystem_spr_device &>(device).m_gfxdecode.set_tag(tag);
}
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void vsystem_spr_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<vsystem_spr_device &>(device).m_palette.set_tag(tag);
-}
-
UINT32 vsystem_spr_device::tile_callback_noindirect(UINT32 tile)
{
return tile;
diff --git a/src/mame/video/vsystem_spr.h b/src/mame/video/vsystem_spr.h
index 3e8574c9350..1a84e074208 100644
--- a/src/mame/video/vsystem_spr.h
+++ b/src/mame/video/vsystem_spr.h
@@ -17,8 +17,6 @@ typedef device_delegate<UINT32 (UINT32)> vsystem_tile_indirection_delegate;
vsystem_spr_device::CG10103_set_transpen(*device, _transpen);
#define MCFG_VSYSTEM_SPR_GFXDECODE(_gfxtag) \
vsystem_spr_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_VSYSTEM_SPR_PALETTE(_palette_tag) \
- vsystem_spr_device::static_set_palette_tag(*device, "^" _palette_tag);
/*** CG10103 **********************************************/
@@ -29,7 +27,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_offsets(device_t &device, int xoffs, int yoffs);
static void set_pdraw(device_t &device, bool pdraw);
static void set_tile_indirect_cb(device_t &device,vsystem_tile_indirection_delegate newtilecb);
@@ -78,7 +75,6 @@ protected:
private:
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
diff --git a/src/mame/video/vsystem_spr2.cpp b/src/mame/video/vsystem_spr2.cpp
index 68d1b8ff323..b934d27be56 100644
--- a/src/mame/video/vsystem_spr2.cpp
+++ b/src/mame/video/vsystem_spr2.cpp
@@ -31,8 +31,7 @@ const device_type VSYSTEM_SPR2 = &device_creator<vsystem_spr2_device>;
vsystem_spr2_device::vsystem_spr2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VSYSTEM_SPR2, "Video System Sprites Type 2", tag, owner, clock, "vsystem_spr2", __FILE__),
- m_gfxdecode(*this),
- m_palette(*this)
+ m_gfxdecode(*this)
{
m_newtilecb = vsystem_tile2_indirection_delegate(FUNC(vsystem_spr2_device::tile_callback_noindirect), this);
m_pritype = 0; // hack until we have better handling
@@ -51,16 +50,6 @@ void vsystem_spr2_device::static_set_gfxdecode_tag(device_t &device, const char
downcast<vsystem_spr2_device &>(device).m_gfxdecode.set_tag(tag);
}
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
-
-void vsystem_spr2_device::static_set_palette_tag(device_t &device, const char *tag)
-{
- downcast<vsystem_spr2_device &>(device).m_palette.set_tag(tag);
-}
-
void vsystem_spr2_device::set_tile_indirect_cb(device_t &device,vsystem_tile2_indirection_delegate newtilecb)
{
diff --git a/src/mame/video/vsystem_spr2.h b/src/mame/video/vsystem_spr2.h
index 967d6dc69bb..1ffdb41a537 100644
--- a/src/mame/video/vsystem_spr2.h
+++ b/src/mame/video/vsystem_spr2.h
@@ -14,8 +14,6 @@ typedef device_delegate<UINT32 (UINT32)> vsystem_tile2_indirection_delegate;
vsystem_spr2_device::set_offsets(*device, _xoffs,_yoffs);
#define MCFG_VSYSTEM_SPR2_GFXDECODE(_gfxtag) \
vsystem_spr2_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-#define MCFG_VSYSTEM_SPR2_PALETTE(_palette_tag) \
- vsystem_spr2_device::static_set_palette_tag(*device, "^" _palette_tag);
class vsystem_spr2_device : public device_t
{
@@ -24,7 +22,6 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
static void set_tile_indirect_cb(device_t &device,vsystem_tile2_indirection_delegate newtilecb);
static void set_pritype(device_t &device, int pritype);
static void set_gfx_region(device_t &device, int gfx_region);
@@ -68,7 +65,6 @@ protected:
private:
required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp
index 45bcfe5da79..c182bd05bb0 100644
--- a/src/mame/video/vtvideo.cpp
+++ b/src/mame/video/vtvideo.cpp
@@ -78,7 +78,7 @@ vt100_video_device::vt100_video_device(const machine_config &mconfig, device_typ
device_video_interface(mconfig, *this),
m_read_ram(*this),
m_write_clear_video_interrupt(*this),
-m_char_rom_tag(""),
+m_char_rom(*this),
m_palette(*this, "palette")
{
}
@@ -89,7 +89,7 @@ vt100_video_device::vt100_video_device(const machine_config &mconfig, const char
device_video_interface(mconfig, *this),
m_read_ram(*this),
m_write_clear_video_interrupt(*this),
-m_char_rom_tag(""),
+m_char_rom(*this),
m_palette(*this, "palette")
{
}
@@ -111,9 +111,6 @@ void vt100_video_device::device_start()
m_read_ram.resolve_safe(0);
m_write_clear_video_interrupt.resolve_safe();
- m_gfx = machine().root_device().memregion(m_char_rom_tag)->base();
- assert(m_gfx != nullptr);
-
// LBA7 is scan line frequency update
machine().scheduler().timer_pulse(attotime::from_nsec(31778), timer_expired_delegate(FUNC(vt100_video_device::lba7_change), this));
@@ -425,7 +422,7 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, i
// modify line since that is how it is stored in rom
if (j == 0) j = 15; else j = j - 1;
- line = m_gfx[(code & 0x7f) * 16 + j];
+ line = m_char_rom[(code & 0x7f) * 16 + j];
if (m_basic_attribute == 1)
{
@@ -659,7 +656,7 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x,
// modify line since that is how it is stored in rom
if (j == 0) j = 15; else j = j - 1;
- line = m_gfx[(code << 4) + j]; // code * 16
+ line = m_char_rom[(code << 4) + j]; // code * 16
// UNDERLINED CHARACTERS (CASE 5 - different in 1 line):
back_intensity = back_default_intensity; // 0, 1, 2
diff --git a/src/mame/video/vtvideo.h b/src/mame/video/vtvideo.h
index 0c29e0637e8..981e271b103 100644
--- a/src/mame/video/vtvideo.h
+++ b/src/mame/video/vtvideo.h
@@ -25,7 +25,7 @@ public:
template<class _Object> static devcb_base &set_ram_rd_callback(device_t &device, _Object object) { return downcast<vt100_video_device &>(device).m_read_ram.set_callback(object); }
template<class _Object> static devcb_base &set_clear_video_irq_wr_callback(device_t &device, _Object object) { return downcast<vt100_video_device &>(device).m_write_clear_video_interrupt.set_callback(object); }
- static void set_chargen_tag(device_t &device, const char *tag) { downcast<vt100_video_device &>(device).m_char_rom_tag = tag; }
+ static void set_chargen_tag(device_t &device, const char *tag) { downcast<vt100_video_device &>(device).m_char_rom.set_tag(tag); }
DECLARE_READ8_MEMBER(lba7_r);
DECLARE_WRITE8_MEMBER(dc012_w);
@@ -47,8 +47,6 @@ protected:
devcb_read8 m_read_ram;
devcb_write8 m_write_clear_video_interrupt;
- UINT8 *m_gfx; /* content of char rom */
-
int m_lba7;
bool MHFU_FLAG;
@@ -68,7 +66,7 @@ protected:
UINT8 m_frequency;
UINT8 m_interlaced;
- const char *m_char_rom_tag; /* character rom region */
+ required_region_ptr<UINT8> m_char_rom; /* character rom region */
required_device<palette_device> m_palette;
bool m_notify_vblank;
@@ -102,7 +100,7 @@ extern const device_type RAINBOW_VIDEO;
#define MCFG_VT_SET_SCREEN MCFG_VIDEO_SET_SCREEN
#define MCFG_VT_CHARGEN(_tag) \
- vt100_video_device::set_chargen_tag(*device, _tag);
+ vt100_video_device::set_chargen_tag(*device, "^" _tag);
#define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \
devcb = &vt100_video_device::set_ram_rd_callback(*device, DEVCB_##_read);
diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp
index 1b70da162ee..bbdf3212220 100644
--- a/src/mame/video/ygv608.cpp
+++ b/src/mame/video/ygv608.cpp
@@ -49,28 +49,111 @@
#define GFX_16X16_8BIT 5
-const device_type YGV608 = &device_creator<ygv608_device>;
+/* text-layer characters */
-ygv608_device::ygv608_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
- : device_t(mconfig, YGV608, "YGV608 VDP", tag, owner, clock, "ygv608", __FILE__),
- m_gfxdecode(*this),
- m_palette(*this)
+static const UINT32 pts_4bits_layout_xoffset[64] =
{
-}
+ STEP8( 0*256, 4 ), STEP8( 1*256, 4 ), STEP8( 4*256, 4 ), STEP8( 5*256, 4 ),
+ STEP8( 16*256, 4 ), STEP8( 17*256, 4 ), STEP8( 20*256, 4 ), STEP8( 21*256, 4 )
+};
-void ygv608_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
+static const UINT32 pts_4bits_layout_yoffset[64] =
{
- downcast<ygv608_device &>(device).m_gfxdecode.set_tag(tag);
-}
+ STEP8( 0*256, 8*4 ), STEP8( 2*256, 8*4 ), STEP8( 8*256, 8*4 ), STEP8( 10*256, 8*4 ),
+ STEP8( 32*256, 8*4 ), STEP8( 34*256, 8*4 ), STEP8( 40*256, 8*4 ), STEP8( 42*256, 8*4 )
+};
+
+static const gfx_layout pts_8x8_4bits_layout =
+{
+ 8,8, /* 8*8 pixels */
+ RGN_FRAC(1,1), /* 65536 patterns */
+ 4, /* 4 bits per pixel */
+ { 0, 1, 2, 3 },
+ EXTENDED_XOFFS,
+ EXTENDED_YOFFS,
+ 8*8*4,
+ pts_4bits_layout_xoffset,
+ pts_4bits_layout_yoffset
+};
+
+static const gfx_layout pts_16x16_4bits_layout =
+{
+ 16,16, /* 16*16 pixels */
+ RGN_FRAC(1,1), /* 16384 patterns */
+ 4, /* 4 bits per pixel */
+ { 0, 1, 2, 3 },
+ EXTENDED_XOFFS,
+ EXTENDED_YOFFS,
+ 16*16*4,
+ pts_4bits_layout_xoffset,
+ pts_4bits_layout_yoffset
+};
+
+static const gfx_layout pts_32x32_4bits_layout =
+{
+ 32,32, /* 32*32 pixels */
+ RGN_FRAC(1,1), /* 4096 patterns */
+ 4, /* 4 bits per pixel */
+ { 0, 1, 2, 3 },
+ EXTENDED_XOFFS,
+ EXTENDED_YOFFS,
+ 32*32*4,
+ pts_4bits_layout_xoffset,
+ pts_4bits_layout_yoffset
+};
-//-------------------------------------------------
-// static_set_palette_tag: Set the tag of the
-// palette device
-//-------------------------------------------------
+static const gfx_layout pts_64x64_4bits_layout =
+{
+ 64,64, /* 32*32 pixels */
+ RGN_FRAC(1,1), /* 1024 patterns */
+ 4, /* 4 bits per pixel */
+ { 0, 1, 2, 3 },
+ EXTENDED_XOFFS,
+ EXTENDED_YOFFS,
+ 64*64*4,
+ pts_4bits_layout_xoffset,
+ pts_4bits_layout_yoffset
+};
+
+
+static const gfx_layout pts_8x8_8bits_layout =
+{
+ 8,8, /* 8*8 pixels */
+ RGN_FRAC(1,1), /* 32768 patterns */
+ 8, /* 8 bits per pixel */
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { STEP8( 0*512, 8 ) },
+ { STEP8( 0*512, 8*8 ) },
+ 8*8*8
+};
+
+static const gfx_layout pts_16x16_8bits_layout =
+{
+ 16,16, /* 16*16 pixels */
+ RGN_FRAC(1,1), /* 8192 patterns */
+ 8, /* 8 bits per pixel */
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { STEP8( 0*512, 8 ), STEP8( 1*512, 8 ) },
+ { STEP8( 0*512, 8*8 ), STEP8( 2*512, 8*8 ) },
+ 16*16*8
+};
+
+static GFXDECODE_START( ygv608 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_8x8_4bits_layout, 0, 16 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_16x16_4bits_layout, 0, 16 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_32x32_4bits_layout, 0, 16 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_64x64_4bits_layout, 0, 16 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_8x8_8bits_layout, 0, 256 )
+ GFXDECODE_DEVICE( DEVICE_SELF, 0x00000000, pts_16x16_8bits_layout, 0, 256 )
+GFXDECODE_END
+
+
+const device_type YGV608 = &device_creator<ygv608_device>;
-void ygv608_device::static_set_palette_tag(device_t &device, const char *tag)
+ygv608_device::ygv608_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
+ : device_t(mconfig, YGV608, "YGV608 VDP", tag, owner, clock, "ygv608", __FILE__),
+ device_gfx_interface(mconfig, *this, GFXDECODE_NAME(ygv608))
{
- downcast<ygv608_device &>(device).m_palette.set_tag(tag);
}
void ygv608_device::set_gfxbank(UINT8 gfxbank)
@@ -120,7 +203,7 @@ TILEMAP_MAPPER_MEMBER( ygv608_device::get_tile_offset )
}
#define layout_total(x) \
-(m_gfxdecode->gfx(x)->elements())
+(gfx(x)->elements())
TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_A_8 )
{
@@ -516,9 +599,6 @@ void ygv608_device::register_state_save()
void ygv608_device::device_start()
{
- if(!m_gfxdecode->started())
- throw device_missing_dependencies();
-
memset(&m_ports, 0, sizeof(m_ports));
memset(&m_regs, 0, sizeof(m_regs));
memset(&m_pattern_name_table, 0, sizeof(m_pattern_name_table));
@@ -546,21 +626,21 @@ void ygv608_device::device_start()
save_item(NAME(m_namcond1_gfxbank));
/* create tilemaps of all sizes and combinations */
- m_tilemap_A_cache_8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,32);
- m_tilemap_A_cache_8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 64,32);
- m_tilemap_A_cache_8[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,64);
+ m_tilemap_A_cache_8[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,32);
+ m_tilemap_A_cache_8[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 64,32);
+ m_tilemap_A_cache_8[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,64);
- m_tilemap_A_cache_16[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,32);
- m_tilemap_A_cache_16[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 64,32);
- m_tilemap_A_cache_16[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,64);
+ m_tilemap_A_cache_16[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,32);
+ m_tilemap_A_cache_16[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 64,32);
+ m_tilemap_A_cache_16[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_A_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,64);
- m_tilemap_B_cache_8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,32);
- m_tilemap_B_cache_8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 64,32);
- m_tilemap_B_cache_8[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,64);
+ m_tilemap_B_cache_8[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,32);
+ m_tilemap_B_cache_8[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 64,32);
+ m_tilemap_B_cache_8[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_8),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 8,8, 32,64);
- m_tilemap_B_cache_16[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,32);
- m_tilemap_B_cache_16[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 64,32);
- m_tilemap_B_cache_16[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,64);
+ m_tilemap_B_cache_16[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,32);
+ m_tilemap_B_cache_16[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 64,32);
+ m_tilemap_B_cache_16[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(ygv608_device::get_tile_info_B_16),this), tilemap_mapper_delegate(FUNC(ygv608_device::get_tile_offset),this), 16,16, 32,64);
m_tilemap_A = nullptr;
m_tilemap_B = nullptr;
@@ -620,20 +700,20 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
logerror( "SZ_8X8: sprite=%d\n", code );
code = 0;
}
- m_gfxdecode->gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x10000,
color,
flipx,flipy,
sx,sy,0x00);
// redraw with wrap-around
if( sx > 512-8 )
- m_gfxdecode->gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x10000,
color,
flipx,flipy,
sx-512,sy,0x00);
if( sy > 512-8 )
- m_gfxdecode->gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x10000,
color,
flipx,flipy,
@@ -650,20 +730,20 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
logerror( "SZ_8X8: sprite=%d\n", code );
code = 0;
}
- m_gfxdecode->gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x4000,
color,
flipx,flipy,
sx,sy,0x00);
// redraw with wrap-around
if( sx > 512-16 )
- m_gfxdecode->gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x4000,
color,
flipx,flipy,
sx-512,sy,0x00);
if( sy > 512-16 )
- m_gfxdecode->gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x4000,
color,
flipx,flipy,
@@ -680,20 +760,20 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
logerror( "SZ_32X32: sprite=%d\n", code );
code = 0;
}
- m_gfxdecode->gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x1000,
color,
flipx,flipy,
sx,sy,0x00);
// redraw with wrap-around
if( sx > 512-32 )
- m_gfxdecode->gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x1000,
color,
flipx,flipy,
sx-512,sy,0x00);
if( sy > 512-32 )
- m_gfxdecode->gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x1000,
color,
flipx,flipy,
@@ -710,20 +790,20 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
logerror( "SZ_64X64: sprite=%d\n", code );
code = 0;
}
- m_gfxdecode->gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x400,
color,
flipx,flipy,
sx,sy,0x00);
// redraw with wrap-around
if( sx > 512-64 )
- m_gfxdecode->gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x400,
color,
flipx,flipy,
sx-512,sy,0x00);
if( sy > 512-64 )
- m_gfxdecode->gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
+ gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip,
code+m_namcond1_gfxbank*0x400,
color,
flipx,flipy,
@@ -1228,7 +1308,7 @@ WRITE16_MEMBER( ygv608_device::write )
if (++p3_state == 3)
{
p3_state = 0;
- m_palette->set_pen_color(m_regs.s.cc,
+ palette().set_pen_color(m_regs.s.cc,
pal6bit(m_colour_palette[m_regs.s.cc][0]),
pal6bit(m_colour_palette[m_regs.s.cc][1]),
pal6bit(m_colour_palette[m_regs.s.cc][2]) );
diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h
index b4360a4e5e4..3e6f5c54f09 100644
--- a/src/mame/video/ygv608.h
+++ b/src/mame/video/ygv608.h
@@ -282,16 +282,12 @@ struct SPRITE_ATTR {
UINT8 sn; // pattern name (0-255)
};
-class ygv608_device : public device_t
+class ygv608_device : public device_t, public device_gfx_interface
{
public:
// construction/destruction
ygv608_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- // static configuration
- static void static_set_gfxdecode_tag(device_t &device, const char *tag);
- static void static_set_palette_tag(device_t &device, const char *tag);
-
DECLARE_WRITE16_MEMBER( write );
DECLARE_READ16_MEMBER( read );
@@ -376,8 +372,6 @@ private:
UINT8 m_screen_resize; // screen requires resize
UINT8 m_tilemap_resize; // tilemap requires resize
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
// device type definition
@@ -391,10 +385,7 @@ extern const device_type YGV608;
#define MCFG_YGV608_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, YGV608, 0)
-#define MCFG_YGV608_GFXDECODE(_gfxtag) \
- ygv608_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
-
#define MCFG_YGV608_PALETTE(_palette_tag) \
- ygv608_device::static_set_palette_tag(*device, "^" _palette_tag);
+ MCFG_GFX_PALETTE(_palette_tag)
#endif
diff --git a/src/osd/eminline.h b/src/osd/eminline.h
index 519b2b93154..6d3b301b8ad 100644
--- a/src/osd/eminline.h
+++ b/src/osd/eminline.h
@@ -12,6 +12,9 @@
#ifndef __EMINLINE__
#define __EMINLINE__
+#include "osdcomm.h"
+#include "osdcore.h"
+
#if !defined(MAME_NOASM)
/* we come with implementations for GCC x86 and PPC */
#if defined(__GNUC__)
diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp
index ea8e9446e27..e3dfbfdbd85 100644
--- a/src/osd/modules/font/font_dwrite.cpp
+++ b/src/osd/modules/font/font_dwrite.cpp
@@ -31,7 +31,7 @@
DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa);
DEFINE_GUID(GUID_WICPixelFormat8bppAlpha, 0xe6cd0116, 0xeeba, 0x4161, 0xaa, 0x85, 0x27, 0xdd, 0x9f, 0xb3, 0xa8, 0x95);
-#include <wrl\client.h>
+#include <wrl/client.h>
#undef interface
#include "strconv.h"
diff --git a/src/osd/modules/input/input_common.cpp b/src/osd/modules/input/input_common.cpp
index 07fe1ed588f..d9f20e299d6 100644
--- a/src/osd/modules/input/input_common.cpp
+++ b/src/osd/modules/input/input_common.cpp
@@ -87,7 +87,7 @@ key_trans_entry keyboard_trans_table::s_default_table[] =
KEY_TRANS_ENTRY1(TILDE, GRAVE, BACKQUOTE, GRAVE, VK_OEM_3, '`'),
KEY_TRANS_ENTRY1(LSHIFT, LSHIFT, LSHIFT, LSHIFT, VK_LSHIFT, 0),
KEY_TRANS_ENTRY1(BACKSLASH, BACKSLASH, BACKSLASH, BACKSLASH, VK_OEM_5, '\\'),
- KEY_TRANS_ENTRY1(BACKSLASH2, 0, 0, OEM_102, VK_OEM_102, '<'),
+ KEY_TRANS_ENTRY1(BACKSLASH2, NONUSHASH, UNKNOWN, OEM_102, VK_OEM_102, '<'),
KEY_TRANS_ENTRY1(Z, Z, z, Z, 'Z', 'Z'),
KEY_TRANS_ENTRY1(X, X, x, X, 'X', 'X'),
KEY_TRANS_ENTRY1(C, C, c, C, 'C', 'C'),
diff --git a/src/osd/modules/input/input_common.h b/src/osd/modules/input/input_common.h
index 7ea001dad4f..41a9d762838 100644
--- a/src/osd/modules/input/input_common.h
+++ b/src/osd/modules/input/input_common.h
@@ -352,19 +352,35 @@ public:
// allocate the device object
auto devinfo = std::make_unique<TActual>(machine, name, module);
- // Add the device to the machine
- devinfo->m_device = machine.input().device_class(devinfo->deviceclass()).add_device(devinfo->name(), devinfo.get());
+ return add_device_internal(machine, name, module, std::move(devinfo));
+ }
- // append us to the list
- m_list.push_back(std::move(devinfo));
+ template <typename TActual, typename TArg>
+ TActual* create_device1(running_machine &machine, const char *name, input_module &module, TArg arg1)
+ {
+ // allocate the device object
+ auto devinfo = std::make_unique<TActual>(machine, name, module, arg1);
- return (TActual*)m_list.back().get();
+ return add_device_internal(machine, name, module, std::move(devinfo));
}
template <class TActual>
TActual* at(int index)
{
- return (TActual*)m_list.at(index).get();
+ return static_cast<TActual*>(m_list.at(index).get());
+ }
+
+private:
+ template <typename TActual>
+ TActual* add_device_internal(running_machine &machine, const char *name, input_module &module, std::unique_ptr<TActual> allocated)
+ {
+ // Add the device to the machine
+ allocated->m_device = machine.input().device_class(allocated->deviceclass()).add_device(allocated->name(), allocated.get());
+
+ // append us to the list
+ m_list.push_back(std::move(allocated));
+
+ return static_cast<TActual*>(m_list.back().get());
}
};
diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp
index 1e4272e6317..ca3bad08026 100644
--- a/src/osd/modules/input/input_dinput.cpp
+++ b/src/osd/modules/input/input_dinput.cpp
@@ -14,6 +14,7 @@
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <initguid.h>
#include <tchar.h>
#include <wrl/client.h>
@@ -31,17 +32,15 @@
#include "strconv.h"
// MAMEOS headers
-#include "winmain.h"
#include "window.h"
#include "winutil.h"
#include "input_common.h"
#include "input_windows.h"
+#include "input_dinput.h"
using namespace Microsoft::WRL;
-#define STRUCTSIZE(x) (m_dinput_version == 0x0300) ? sizeof(x##_DX3) : sizeof(x)
-
static INT32 dinput_joystick_pov_get_state(void *device_internal, void *item_internal);
//============================================================
@@ -58,255 +57,184 @@ static HRESULT dinput_set_dword_property(ComPtr<IDirectInputDevice> device, REFG
dipdw.diph.dwHow = how;
dipdw.dwData = value;
- return IDirectInputDevice_SetProperty(device.Get(), property_guid, &dipdw.diph);
+ return device->SetProperty(property_guid, &dipdw.diph);
}
//============================================================
// dinput_device - base directinput device
//============================================================
-// DirectInput-specific information about a device
-struct dinput_api_state
+dinput_device::dinput_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module)
+ : device_info(machine, name, deviceclass, module),
+ dinput({nullptr})
{
- ComPtr<IDirectInputDevice> device;
- ComPtr<IDirectInputDevice2> device2;
- DIDEVCAPS caps;
- LPCDIDATAFORMAT format;
-};
+}
-class dinput_device : public device_info
+dinput_device::~dinput_device()
{
-public:
- dinput_api_state dinput;
+ if (dinput.device != nullptr)
+ dinput.device.Reset();
+}
- dinput_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module)
- : device_info(machine, name, deviceclass, module),
- dinput({nullptr})
- {
- }
+HRESULT dinput_device::poll_dinput(LPVOID pState) const
+{
+ HRESULT result;
- virtual ~dinput_device()
- {
- if (dinput.device2 != nullptr)
- dinput.device2.Reset();
+ // first poll the device, then get the state
+ if (dinput.device2 != nullptr)
+ dinput.device2->Poll();
- if (dinput.device != nullptr)
- dinput.device.Reset();
- }
+ // GetDeviceState returns the immediate state
+ result = dinput.device->GetDeviceState(dinput.format->dwDataSize, pState);
-protected:
- HRESULT poll_dinput(LPVOID pState) const
+ // handle lost inputs here
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED)
{
- HRESULT result;
-
- // first poll the device, then get the state
- if (dinput.device2 != nullptr)
- IDirectInputDevice2_Poll(dinput.device2.Get());
-
- // GetDeviceState returns the immediate state
- result = IDirectInputDevice_GetDeviceState(dinput.device.Get(), dinput.format->dwDataSize, pState);
-
- // handle lost inputs here
- if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED)
- {
- result = IDirectInputDevice_Acquire(dinput.device.Get());
- if (result == DI_OK)
- result = IDirectInputDevice_GetDeviceState(dinput.device.Get(), dinput.format->dwDataSize, pState);
- }
-
- return result;
+ result = dinput.device->Acquire();
+ if (result == DI_OK)
+ result = dinput.device->GetDeviceState(dinput.format->dwDataSize, pState);
}
-};
+
+ return result;
+}
//============================================================
// dinput_keyboard_device - directinput keyboard device
//============================================================
-class dinput_keyboard_device : public dinput_device
+dinput_keyboard_device::dinput_keyboard_device(running_machine &machine, const char *name, input_module &module)
+ : dinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module),
+ keyboard({{0}})
{
-private:
- std::mutex m_device_lock;
-
-public:
- keyboard_state keyboard;
-
- dinput_keyboard_device(running_machine &machine, const char *name, input_module &module)
- : dinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module),
- keyboard({{0}})
- {
- }
+}
- // Polls the direct input immediate state
- void poll() override
- {
- std::lock_guard<std::mutex> scope_lock(m_device_lock);
+// Polls the direct input immediate state
+void dinput_keyboard_device::poll()
+{
+ std::lock_guard<std::mutex> scope_lock(m_device_lock);
- // Poll the state
- dinput_device::poll_dinput(&keyboard.state);
- }
+ // Poll the state
+ dinput_device::poll_dinput(&keyboard.state);
+}
- void reset() override
- {
- memset(&keyboard.state, 0, sizeof(keyboard.state));
- }
-};
+void dinput_keyboard_device::reset()
+{
+ memset(&keyboard.state, 0, sizeof(keyboard.state));
+}
//============================================================
-// dinput_module - base directinput module
+// dinput_api_helper - DirectInput API helper
//============================================================
-class dinput_module : public wininput_module
+dinput_api_helper::dinput_api_helper(int version)
+ : m_dinput(nullptr),
+ m_dinput_version(version),
+ m_pfn_DirectInputCreate("DirectInputCreateW", L"dinput.dll")
{
-private:
- ComPtr<IDirectInput> m_dinput;
- int m_dinput_version;
+}
-public:
- dinput_module(const char* type, const char* name)
- : wininput_module(type, name),
- m_dinput(nullptr),
- m_dinput_version(0)
- {
- }
+dinput_api_helper::~dinput_api_helper()
+{
+ m_dinput.Reset();
+}
- int init_internal() override
- {
- HRESULT result;
+int dinput_api_helper::initialize()
+{
+ HRESULT result;
-#if DIRECTINPUT_VERSION >= 0x800
- m_dinput_version = DIRECTINPUT_VERSION;
+ if (m_dinput_version >= 0x0800)
+ {
result = DirectInput8Create(GetModuleHandleUni(), m_dinput_version, IID_IDirectInput8, reinterpret_cast<void **>(m_dinput.GetAddressOf()), nullptr);
if (result != DI_OK)
{
m_dinput_version = 0;
return result;
}
-#else
- // first attempt to initialize DirectInput at the current version
- m_dinput_version = DIRECTINPUT_VERSION;
- result = DirectInputCreate(GetModuleHandleUni(), m_dinput_version, m_dinput.GetAddressOf(), nullptr);
+ }
+ else
+ {
+ result = m_pfn_DirectInputCreate.initialize();
+ if (result != DI_OK)
+ return result;
+
+ // first attempt to initialize DirectInput at v7
+ m_dinput_version = 0x0700;
+ result = m_pfn_DirectInputCreate(GetModuleHandleUni(), m_dinput_version, m_dinput.GetAddressOf(), nullptr);
if (result != DI_OK)
{
// if that fails, try version 5
m_dinput_version = 0x0500;
- result = DirectInputCreate(GetModuleHandleUni(), m_dinput_version, m_dinput.GetAddressOf(), nullptr);
+ result = m_pfn_DirectInputCreate(GetModuleHandleUni(), m_dinput_version, m_dinput.GetAddressOf(), nullptr);
if (result != DI_OK)
{
- // if that fails, try version 3
- m_dinput_version = 0x0300;
- result = DirectInputCreate(GetModuleHandleUni(), m_dinput_version, m_dinput.GetAddressOf(), nullptr);
- if (result != DI_OK)
- {
- m_dinput_version = 0;
- return result;
- }
+ m_dinput_version = 0;
+ return result;
}
}
-#endif
-
- osd_printf_verbose("DirectInput: Using DirectInput %d\n", m_dinput_version >> 8);
- return 0;
}
- void exit() override
- {
- m_dinput.Reset();
- wininput_module::exit();
- }
+ osd_printf_verbose("DirectInput: Using DirectInput %d\n", m_dinput_version >> 8);
+ return 0;
+}
- virtual BOOL device_enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref) = 0;
- struct dinput_callback_context
- {
- dinput_module * self;
- running_machine * machine;
- };
+HRESULT dinput_api_helper::enum_attached_devices(int devclass, device_enum_interface *enumerate_interface, void *state) const
+{
+ device_enum_interface::dinput_callback_context ctx;
+ ctx.self = enumerate_interface;
+ ctx.state = state;
- static BOOL CALLBACK enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref)
- {
- auto context = static_cast<dinput_callback_context*>(ref);
- return context->self->device_enum_callback(instance, context->machine);
- }
+ return m_dinput->EnumDevices(devclass, device_enum_interface::enum_callback, &ctx, DIEDFL_ATTACHEDONLY);
+}
- void input_init(running_machine &machine) override
- {
- dinput_callback_context context = { this, &machine };
- HRESULT result = IDirectInput_EnumDevices(m_dinput.Get(), dinput_devclass(), enum_callback, &context, DIEDFL_ATTACHEDONLY);
- if (result != DI_OK)
- fatalerror("DirectInput: Unable to enumerate keyboards (result=%08X)\n", static_cast<UINT32>(result));
- }
+//============================================================
+// dinput_module - base directinput module
+//============================================================
+class dinput_module : public wininput_module, public device_enum_interface
+{
protected:
- virtual int dinput_devclass() = 0;
+ std::unique_ptr<dinput_api_helper> m_dinput_helper;
- template <class TDevice>
- TDevice* create_dinput_device(
- running_machine &machine,
- LPCDIDEVICEINSTANCE instance,
- LPCDIDATAFORMAT format1,
- LPCDIDATAFORMAT format2,
- DWORD cooperative_level)
+public:
+ dinput_module(const char* type, const char* name)
+ : wininput_module(type, name),
+ m_dinput_helper(nullptr)
{
- HRESULT result;
-
- // convert instance name to utf8
- auto osd_deleter = [](void *ptr) { osd_free(ptr); };
- auto utf8_instance_name = std::unique_ptr<char, decltype(osd_deleter)>(utf8_from_tstring(instance->tszInstanceName), osd_deleter);
-
- // allocate memory for the device object
- TDevice* devinfo = devicelist()->create_device<TDevice>(machine, utf8_instance_name.get(), *this);
-
- // attempt to create a device
- result = IDirectInput_CreateDevice(m_dinput.Get(), WRAP_REFIID(instance->guidInstance), devinfo->dinput.device.GetAddressOf(), NULL);
- if (result != DI_OK)
- goto error;
+ }
- // try to get a version 2 device for it
- result = IDirectInputDevice_QueryInterface(devinfo->dinput.device.Get(), WRAP_REFIID(IID_IDirectInputDevice2), reinterpret_cast<void **>(devinfo->dinput.device2.GetAddressOf()));
- if (result != DI_OK)
- devinfo->dinput.device2 = nullptr;
+ int init_internal() override
+ {
+ m_dinput_helper = std::make_unique<dinput_api_helper>(DIRECTINPUT_VERSION);
+ int result = m_dinput_helper->initialize();
+ if (result != 0)
+ return result;
- // get the caps
- devinfo->dinput.caps.dwSize = STRUCTSIZE(DIDEVCAPS);
- result = IDirectInputDevice_GetCapabilities(devinfo->dinput.device.Get(), &devinfo->dinput.caps);
- if (result != DI_OK)
- goto error;
+ return 0;
+ }
- // attempt to set the data format
- devinfo->dinput.format = format1;
- result = IDirectInputDevice_SetDataFormat(devinfo->dinput.device.Get(), devinfo->dinput.format);
- if (result != DI_OK)
- {
- // use the secondary format if available
- if (format2 != nullptr)
- {
- devinfo->dinput.format = format2;
- result = IDirectInputDevice_SetDataFormat(devinfo->dinput.device.Get(), devinfo->dinput.format);
- }
- if (result != DI_OK)
- goto error;
- }
+ void exit() override
+ {
+ wininput_module::exit();
+ m_dinput_helper.reset();
+ }
- // set the cooperative level
- result = IDirectInputDevice_SetCooperativeLevel(devinfo->dinput.device.Get(), win_window_list->m_hwnd, cooperative_level);
+ void input_init(running_machine &machine) override
+ {
+ HRESULT result = m_dinput_helper->enum_attached_devices(dinput_devclass(), this, &machine);
if (result != DI_OK)
- goto error;
- return devinfo;
-
- error:
- devicelist()->free_device(devinfo);
- return nullptr;
+ fatalerror("DirectInput: Unable to enumerate keyboards (result=%08X)\n", static_cast<UINT32>(result));
}
- std::string device_item_name(dinput_device * devinfo, int offset, const char * defstring, const TCHAR * suffix) const
+ static std::string device_item_name(dinput_device * devinfo, int offset, const char * defstring, const TCHAR * suffix)
{
DIDEVICEOBJECTINSTANCE instance = { 0 };
HRESULT result;
// query the key name
- instance.dwSize = STRUCTSIZE(DIDEVICEOBJECTINSTANCE);
- result = IDirectInputDevice_GetObjectInfo(devinfo->dinput.device.Get(), &instance, offset, DIPH_BYOFFSET);
+ instance.dwSize = sizeof(instance);
+ result = devinfo->dinput.device->GetObjectInfo(&instance, offset, DIPH_BYOFFSET);
// if we got an error and have no default string, just return NULL
if (result != DI_OK)
@@ -342,6 +270,9 @@ protected:
return std::string(combined.get());
}
+
+protected:
+ virtual int dinput_devclass() = 0;
};
class keyboard_input_dinput : public dinput_module
@@ -368,7 +299,7 @@ public:
int keynum;
// allocate and link in a new device
- devinfo = create_dinput_device<dinput_keyboard_device>(machine, instance, &c_dfDIKeyboard, nullptr, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
+ devinfo = m_dinput_helper->create_device<dinput_keyboard_device>(machine, *this, instance, &c_dfDIKeyboard, nullptr, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
if (devinfo == nullptr)
goto exit;
@@ -392,33 +323,28 @@ public:
}
};
-class dinput_mouse_device : public dinput_device
-{
-public:
- mouse_state mouse;
- dinput_mouse_device(running_machine &machine, const char *name, input_module &module)
- : dinput_device(machine, name, DEVICE_CLASS_MOUSE, module),
- mouse({0})
- {
- }
+dinput_mouse_device::dinput_mouse_device(running_machine &machine, const char *name, input_module &module)
+ : dinput_device(machine, name, DEVICE_CLASS_MOUSE, module),
+ mouse({0})
+{
+}
- void poll() override
- {
- // poll
- dinput_device::poll_dinput(&mouse);
+void dinput_mouse_device::poll()
+{
+ // poll
+ dinput_device::poll_dinput(&mouse);
- // scale the axis data
- mouse.lX *= INPUT_RELATIVE_PER_PIXEL;
- mouse.lY *= INPUT_RELATIVE_PER_PIXEL;
- mouse.lZ *= INPUT_RELATIVE_PER_PIXEL;
- }
+ // scale the axis data
+ mouse.lX *= INPUT_RELATIVE_PER_PIXEL;
+ mouse.lY *= INPUT_RELATIVE_PER_PIXEL;
+ mouse.lZ *= INPUT_RELATIVE_PER_PIXEL;
+}
- void reset() override
- {
- memset(&mouse, 0, sizeof(mouse));
- }
-};
+void dinput_mouse_device::reset()
+{
+ memset(&mouse, 0, sizeof(mouse));
+}
class mouse_input_dinput : public dinput_module
{
@@ -445,7 +371,7 @@ public:
HRESULT result;
// allocate and link in a new device
- devinfo = create_dinput_device<dinput_mouse_device>(machine, instance, &c_dfDIMouse2, &c_dfDIMouse, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
+ devinfo = m_dinput_helper->create_device<dinput_mouse_device>(machine, *this, instance, &c_dfDIMouse2, &c_dfDIMouse, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
if (devinfo == nullptr)
goto exit;
@@ -489,46 +415,130 @@ public:
}
};
-// state information for a joystick; DirectInput state must be first element
-struct dinput_joystick_state
+dinput_joystick_device::dinput_joystick_device(running_machine &machine, const char *name, input_module &module)
+ : dinput_device(machine, name, DEVICE_CLASS_JOYSTICK, module),
+ joystick({{0}})
{
- DIJOYSTATE state;
- LONG rangemin[8];
- LONG rangemax[8];
-};
+}
-class dinput_joystick_device : public dinput_device
+void dinput_joystick_device::reset()
{
-public:
- dinput_joystick_state joystick;
+ memset(&joystick.state, 0, sizeof(joystick.state));
+}
+
+void dinput_joystick_device::poll()
+{
+ int axisnum;
+
+ // poll the device first
+ if (dinput_device::poll_dinput(&joystick.state) != ERROR_SUCCESS)
+ return;
+
+ // normalize axis values
+ for (axisnum = 0; axisnum < 8; axisnum++)
+ {
+ LONG *axis = (&joystick.state.lX) + axisnum;
+ *axis = normalize_absolute_axis(*axis, joystick.rangemin[axisnum], joystick.rangemax[axisnum]);
+ }
+}
+
+int dinput_joystick_device::configure()
+{
+ HRESULT result;
+ UINT32 axisnum, axiscount;
+
+ auto devicelist = static_cast<input_module_base&>(module()).devicelist();
+
+ // temporary approximation of index
+ int devindex = devicelist->size();
+
+ // set absolute mode
+ result = dinput_set_dword_property(dinput.device, DIPROP_AXISMODE, 0, DIPH_DEVICE, DIPROPAXISMODE_ABS);
+ if (result != DI_OK && result != DI_PROPNOEFFECT)
+ osd_printf_warning("DirectInput: Unable to set absolute mode for joystick %d (%s)\n", devindex, name());
+
+ // turn off deadzone; we do our own calculations
+ result = dinput_set_dword_property(dinput.device, DIPROP_DEADZONE, 0, DIPH_DEVICE, 0);
+ if (result != DI_OK && result != DI_PROPNOEFFECT)
+ osd_printf_warning("DirectInput: Unable to reset deadzone for joystick %d (%s)\n", devindex, name());
- dinput_joystick_device(running_machine &machine, const char *name, input_module &module)
- : dinput_device(machine, name, DEVICE_CLASS_JOYSTICK, module),
- joystick({{0}})
+ // turn off saturation; we do our own calculations
+ result = dinput_set_dword_property(dinput.device, DIPROP_SATURATION, 0, DIPH_DEVICE, 10000);
+ if (result != DI_OK && result != DI_PROPNOEFFECT)
+ osd_printf_warning("DirectInput: Unable to reset saturation for joystick %d (%s)\n", devindex, name());
+
+ // cap the number of axes, POVs, and buttons based on the format
+ dinput.caps.dwAxes = MIN(dinput.caps.dwAxes, 8);
+ dinput.caps.dwPOVs = MIN(dinput.caps.dwPOVs, 4);
+ dinput.caps.dwButtons = MIN(dinput.caps.dwButtons, 128);
+
+ // populate the axes
+ for (axisnum = axiscount = 0; axiscount < dinput.caps.dwAxes && axisnum < 8; axisnum++)
{
+ DIPROPRANGE dipr;
+ std::string name;
+
+ // fetch the range of this axis
+ dipr.diph.dwSize = sizeof(dipr);
+ dipr.diph.dwHeaderSize = sizeof(dipr.diph);
+ dipr.diph.dwObj = offsetof(DIJOYSTATE2, lX) + axisnum * sizeof(LONG);
+ dipr.diph.dwHow = DIPH_BYOFFSET;
+ result = dinput.device->GetProperty(DIPROP_RANGE, &dipr.diph);
+ if (result != DI_OK)
+ continue;
+
+ joystick.rangemin[axisnum] = dipr.lMin;
+ joystick.rangemax[axisnum] = dipr.lMax;
+
+ // populate the item description as well
+ name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, lX) + axisnum * sizeof(LONG), default_axis_name[axisnum], nullptr);
+ device()->add_item(name.c_str(), static_cast<input_item_id>(ITEM_ID_XAXIS + axisnum), generic_axis_get_state, &joystick.state.lX + axisnum);
+
+ axiscount++;
}
- void reset() override
+ // populate the POVs
+ for (UINT32 povnum = 0; povnum < dinput.caps.dwPOVs; povnum++)
{
- memset(&joystick.state, 0, sizeof(joystick.state));
+ std::string name;
+
+ // left
+ name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("L"));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_LEFT)));
+
+ // right
+ name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("R"));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_RIGHT)));
+
+ // up
+ name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("U"));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_UP)));
+
+ // down
+ name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("D"));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_DOWN)));
}
- void poll() override
+ // populate the buttons
+ for (UINT32 butnum = 0; butnum < dinput.caps.dwButtons; butnum++)
{
- int axisnum;
+ FPTR offset = reinterpret_cast<FPTR>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
+ std::string name = dinput_module::device_item_name(this, offset, default_button_name(butnum), nullptr);
- // poll the device first
- if (dinput_device::poll_dinput(&joystick.state) != ERROR_SUCCESS)
- return;
+ input_item_id itemid;
- // normalize axis values
- for (axisnum = 0; axisnum < 8; axisnum++)
- {
- LONG *axis = (&joystick.state.lX) + axisnum;
- *axis = normalize_absolute_axis(*axis, joystick.rangemin[axisnum], joystick.rangemax[axisnum]);
- }
+ if (butnum < INPUT_MAX_BUTTONS)
+ itemid = static_cast<input_item_id>(ITEM_ID_BUTTON1 + butnum);
+ else if (butnum < INPUT_MAX_BUTTONS + INPUT_MAX_ADD_SWITCH)
+ itemid = static_cast<input_item_id>(ITEM_ID_ADD_SWITCH1 - INPUT_MAX_BUTTONS + butnum);
+ else
+ itemid = ITEM_ID_OTHER_SWITCH;
+
+ device()->add_item(name.c_str(), itemid, generic_button_get_state, &joystick.state.rgbButtons[butnum]);
}
-};
+
+ return 0;
+}
class joystick_input_dinput : public dinput_module
{
@@ -550,102 +560,22 @@ public:
BOOL device_enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref) override
{
DWORD cooperative_level = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE;
- int axisnum, axiscount, povnum, butnum;
running_machine &machine = *static_cast<running_machine *>(ref);
dinput_joystick_device *devinfo;
- HRESULT result;
+ int result = 0;
- if (win_window_list != nullptr && win_window_list->win_has_menu()) {
+ if (win_window_list != nullptr && win_window_list->win_has_menu())
cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
- }
+
// allocate and link in a new device
- devinfo = create_dinput_device<dinput_joystick_device>(machine, instance, &c_dfDIJoystick, nullptr, cooperative_level);
+ devinfo = m_dinput_helper->create_device<dinput_joystick_device>(machine, *this, instance, &c_dfDIJoystick, nullptr, cooperative_level);
if (devinfo == nullptr)
goto exit;
- // set absolute mode
- result = dinput_set_dword_property(devinfo->dinput.device, DIPROP_AXISMODE, 0, DIPH_DEVICE, DIPROPAXISMODE_ABS);
- if (result != DI_OK && result != DI_PROPNOEFFECT)
- osd_printf_warning("DirectInput: Unable to set absolute mode for joystick %d (%s)\n", devicelist()->size(), devinfo->name());
-
- // turn off deadzone; we do our own calculations
- result = dinput_set_dword_property(devinfo->dinput.device, DIPROP_DEADZONE, 0, DIPH_DEVICE, 0);
- if (result != DI_OK && result != DI_PROPNOEFFECT)
- osd_printf_warning("DirectInput: Unable to reset deadzone for joystick %d (%s)\n", devicelist()->size(), devinfo->name());
-
- // turn off saturation; we do our own calculations
- result = dinput_set_dword_property(devinfo->dinput.device, DIPROP_SATURATION, 0, DIPH_DEVICE, 10000);
- if (result != DI_OK && result != DI_PROPNOEFFECT)
- osd_printf_warning("DirectInput: Unable to reset saturation for joystick %d (%s)\n", devicelist()->size(), devinfo->name());
-
- // cap the number of axes, POVs, and buttons based on the format
- devinfo->dinput.caps.dwAxes = MIN(devinfo->dinput.caps.dwAxes, 8);
- devinfo->dinput.caps.dwPOVs = MIN(devinfo->dinput.caps.dwPOVs, 4);
- devinfo->dinput.caps.dwButtons = MIN(devinfo->dinput.caps.dwButtons, 128);
-
- // populate the axes
- for (axisnum = axiscount = 0; axiscount < devinfo->dinput.caps.dwAxes && axisnum < 8; axisnum++)
+ result = devinfo->configure();
+ if (result != 0)
{
- DIPROPRANGE dipr;
- std::string name;
-
- // fetch the range of this axis
- dipr.diph.dwSize = sizeof(dipr);
- dipr.diph.dwHeaderSize = sizeof(dipr.diph);
- dipr.diph.dwObj = offsetof(DIJOYSTATE2, lX) + axisnum * sizeof(LONG);
- dipr.diph.dwHow = DIPH_BYOFFSET;
- result = IDirectInputDevice_GetProperty(devinfo->dinput.device.Get(), DIPROP_RANGE, &dipr.diph);
- if (result != DI_OK)
- continue;
-
- devinfo->joystick.rangemin[axisnum] = dipr.lMin;
- devinfo->joystick.rangemax[axisnum] = dipr.lMax;
-
- // populate the item description as well
- name = device_item_name(devinfo, offsetof(DIJOYSTATE2, lX) + axisnum * sizeof(LONG), default_axis_name[axisnum], nullptr);
- devinfo->device()->add_item(name.c_str(), static_cast<input_item_id>(ITEM_ID_XAXIS + axisnum), generic_axis_get_state, &devinfo->joystick.state.lX + axisnum);
-
- axiscount++;
- }
-
- // populate the POVs
- for (povnum = 0; povnum < devinfo->dinput.caps.dwPOVs; povnum++)
- {
- std::string name;
-
- // left
- name = device_item_name(devinfo, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("L"));
- devinfo->device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_LEFT)));
-
- // right
- name = device_item_name(devinfo, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("R"));
- devinfo->device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_RIGHT)));
-
- // up
- name = device_item_name(devinfo, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("U"));
- devinfo->device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_UP)));
-
- // down
- name = device_item_name(devinfo, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("D"));
- devinfo->device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_DOWN)));
- }
-
- // populate the buttons
- for (butnum = 0; butnum < devinfo->dinput.caps.dwButtons; butnum++)
- {
- FPTR offset = reinterpret_cast<FPTR>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
- std::string name = device_item_name(devinfo, offset, default_button_name(butnum), nullptr);
-
- input_item_id itemid;
-
- if (butnum < INPUT_MAX_BUTTONS)
- itemid = static_cast<input_item_id>(ITEM_ID_BUTTON1 + butnum);
- else if (butnum < INPUT_MAX_BUTTONS + INPUT_MAX_ADD_SWITCH)
- itemid = static_cast<input_item_id>(ITEM_ID_ADD_SWITCH1 - INPUT_MAX_BUTTONS + butnum);
- else
- itemid = ITEM_ID_OTHER_SWITCH;
-
- devinfo->device()->add_item(name.c_str(), itemid, generic_button_get_state, &devinfo->joystick.state.rgbButtons[butnum]);
+ osd_printf_error("Failed to configure DI Joystick device. Error 0x%x\n", static_cast<unsigned int>(result));
}
exit:
diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h
new file mode 100644
index 00000000000..6dacf8ebd77
--- /dev/null
+++ b/src/osd/modules/input/input_dinput.h
@@ -0,0 +1,177 @@
+#ifndef INPUT_DINPUT_H_
+#define INPUT_DINPUT_H_
+
+#include "input_common.h"
+#include "winutil.h"
+
+//============================================================
+// dinput_device - base directinput device
+//============================================================
+
+// DirectInput-specific information about a device
+struct dinput_api_state
+{
+ Microsoft::WRL::ComPtr<IDirectInputDevice> device;
+ Microsoft::WRL::ComPtr<IDirectInputDevice2> device2;
+ DIDEVCAPS caps;
+ LPCDIDATAFORMAT format;
+};
+
+class device_enum_interface
+{
+public:
+ struct dinput_callback_context
+ {
+ device_enum_interface * self;
+ void * state;
+ };
+
+ virtual ~device_enum_interface()
+ {
+ }
+
+ static BOOL CALLBACK enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref)
+ {
+ auto context = static_cast<dinput_callback_context*>(ref);
+ return context->self->device_enum_callback(instance, context->state);
+ }
+
+ virtual BOOL device_enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref) = 0;
+};
+
+typedef lazy_loaded_function_p4<HRESULT, HMODULE, int, IDirectInput **, LPUNKNOWN> pfn_dinput_create;
+
+class dinput_api_helper
+{
+private:
+ Microsoft::WRL::ComPtr<IDirectInput> m_dinput;
+ int m_dinput_version;
+ pfn_dinput_create m_pfn_DirectInputCreate;
+
+public:
+ dinput_api_helper(int version);
+ virtual ~dinput_api_helper();
+ int initialize();
+
+ template<class TDevice>
+ TDevice* create_device(
+ running_machine &machine,
+ input_module_base &module,
+ LPCDIDEVICEINSTANCE instance,
+ LPCDIDATAFORMAT format1,
+ LPCDIDATAFORMAT format2,
+ DWORD cooperative_level)
+ {
+ HRESULT result;
+
+ // convert instance name to utf8
+ auto osd_deleter = [](void *ptr) { osd_free(ptr); };
+ auto utf8_instance_name = std::unique_ptr<char, decltype(osd_deleter)>(utf8_from_tstring(instance->tszInstanceName), osd_deleter);
+
+ // allocate memory for the device object
+ TDevice* devinfo = module.devicelist()->create_device<TDevice>(machine, utf8_instance_name.get(), module);
+
+ // attempt to create a device
+ result = m_dinput->CreateDevice(instance->guidInstance, devinfo->dinput.device.GetAddressOf(), nullptr);
+ if (result != DI_OK)
+ goto error;
+
+ // try to get a version 2 device for it
+ result = devinfo->dinput.device.CopyTo(IID_IDirectInputDevice2, reinterpret_cast<void**>(devinfo->dinput.device2.GetAddressOf()));
+ if (result != DI_OK)
+ devinfo->dinput.device2 = nullptr;
+
+ // get the caps
+ devinfo->dinput.caps.dwSize = sizeof(devinfo->dinput.caps);
+ result = devinfo->dinput.device->GetCapabilities(&devinfo->dinput.caps);
+ if (result != DI_OK)
+ goto error;
+
+ // attempt to set the data format
+ devinfo->dinput.format = format1;
+ result = devinfo->dinput.device->SetDataFormat(devinfo->dinput.format);
+ if (result != DI_OK)
+ {
+ // use the secondary format if available
+ if (format2 != nullptr)
+ {
+ devinfo->dinput.format = format2;
+ result = devinfo->dinput.device->SetDataFormat(devinfo->dinput.format);
+ }
+ if (result != DI_OK)
+ goto error;
+ }
+
+ // set the cooperative level
+ result = devinfo->dinput.device->SetCooperativeLevel(win_window_list->m_hwnd, cooperative_level);
+ if (result != DI_OK)
+ goto error;
+
+ return devinfo;
+
+ error:
+ module.devicelist()->free_device(devinfo);
+ return nullptr;
+ }
+
+ HRESULT enum_attached_devices(int devclass, device_enum_interface *enumerate_interface, void *state) const;
+};
+
+class dinput_device : public device_info
+{
+public:
+ dinput_api_state dinput;
+
+ dinput_device(running_machine &machine, const char *name, input_device_class deviceclass, input_module &module);
+ virtual ~dinput_device();
+
+protected:
+ HRESULT poll_dinput(LPVOID pState) const;
+};
+
+class dinput_keyboard_device : public dinput_device
+{
+private:
+ std::mutex m_device_lock;
+
+public:
+ keyboard_state keyboard;
+
+ dinput_keyboard_device(running_machine &machine, const char *name, input_module &module);
+
+ void poll() override;
+ void reset() override;
+};
+
+class dinput_mouse_device : public dinput_device
+{
+public:
+ mouse_state mouse;
+
+public:
+ dinput_mouse_device(running_machine &machine, const char *name, input_module &module);
+ void poll() override;
+ void reset() override;
+};
+
+// state information for a joystick; DirectInput state must be first element
+struct dinput_joystick_state
+{
+ DIJOYSTATE state;
+ LONG rangemin[8];
+ LONG rangemax[8];
+};
+
+class dinput_joystick_device : public dinput_device
+{
+public:
+ dinput_joystick_state joystick;
+public:
+ dinput_joystick_device(running_machine &machine, const char *name, input_module &module);
+ void reset() override;
+ void poll() override;
+ int configure();
+};
+
+
+#endif
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 2c5b2e45a8c..06096a6961b 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -681,9 +681,24 @@ public:
: sdl_input_module(OSD_JOYSTICKINPUT_PROVIDER)
{
}
-
+
+ virtual void exit() override
+ {
+ sdl_input_module::exit();
+
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+ }
+
virtual void input_init(running_machine &machine) override
{
+ SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
+
+ if (SDL_InitSubSystem(SDL_INIT_JOYSTICK))
+ {
+ osd_printf_error("Could not initialize SDL Joystick: %s.\n", SDL_GetError());
+ return;
+ }
+
sdl_input_module::input_init(machine);
char tempname[512];
@@ -696,20 +711,8 @@ public:
int physical_stick;
for (physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++)
{
- if (SDL_IsGameController(physical_stick)) {
- osd_printf_verbose("Joystick %i is supported by the game controller interface!\n", physical_stick);
- osd_printf_verbose("Compatible controller, named \'%s\'\n", SDL_GameControllerNameForIndex(physical_stick));
- SDL_GameController *joy = SDL_GameControllerOpen(physical_stick);
- osd_printf_verbose("Controller is mapped as \"%s\".\n", SDL_GameControllerMapping(joy));
- std::string joy_name = remove_spaces(SDL_GameControllerName(joy));
- SDL_GameControllerClose(joy);
+ std::string joy_name = remove_spaces(SDL_JoystickNameForIndex(physical_stick));
devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
- } else {
- SDL_Joystick *joy = SDL_JoystickOpen(physical_stick);
- std::string joy_name = remove_spaces(SDL_JoystickName(joy));
- SDL_JoystickClose(joy);
- devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
- }
}
for (int stick = 0; stick < MAX_DEVMAP_ENTRIES; stick++)
@@ -720,13 +723,11 @@ public:
continue;
physical_stick = m_joy_map.map[stick].physical;
-
SDL_Joystick *joy = SDL_JoystickOpen(physical_stick);
-
devinfo->sdl_state.device = joy;
devinfo->sdl_state.joystick_id = SDL_JoystickInstanceID(joy);
- osd_printf_verbose("Joystick: %s\n", devinfo->name());
+ osd_printf_verbose("Joystick: %s\n", SDL_JoystickNameForIndex(physical_stick));
osd_printf_verbose("Joystick: ... %d axes, %d buttons %d hats %d balls\n", SDL_JoystickNumAxes(joy), SDL_JoystickNumButtons(joy), SDL_JoystickNumHats(joy), SDL_JoystickNumBalls(joy));
osd_printf_verbose("Joystick: ... Physical id %d mapped to logical id %d\n", physical_stick, stick + 1);
diff --git a/src/osd/modules/input/input_winhybrid.cpp b/src/osd/modules/input/input_winhybrid.cpp
new file mode 100644
index 00000000000..538abe38da4
--- /dev/null
+++ b/src/osd/modules/input/input_winhybrid.cpp
@@ -0,0 +1,413 @@
+// license:BSD-3-Clause
+// copyright-holders:Brad Hughes
+//============================================================
+//
+// input_winhybrid.cpp - Windows hybrid DirectInput/Xinput
+//
+//============================================================
+
+#include "input_module.h"
+#include "modules/osdmodule.h"
+
+#if defined(OSD_WINDOWS)
+
+#include <wbemcli.h>
+#include <list>
+#include <vector>
+
+// standard windows headers
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <wrl/client.h>
+
+// XInput/DirectInput
+#include <xinput.h>
+#include <dinput.h>
+
+#undef interface
+
+// MAME headers
+#include "emu.h"
+#include "osdepend.h"
+
+// MAMEOS headers
+#include "strconv.h"
+#include "winutil.h"
+#include "winmain.h"
+
+#include "input_common.h"
+#include "input_windows.h"
+#include "input_xinput.h"
+#include "input_dinput.h"
+
+using namespace Microsoft::WRL;
+
+template<class TCom>
+class ComArray
+{
+private:
+ std::vector<TCom*> m_entries;
+
+public:
+ ComArray(size_t capacity)
+ : m_entries(capacity, nullptr)
+ {
+ }
+
+ ~ComArray()
+ {
+ Release();
+ }
+
+ TCom** ReleaseAndGetAddressOf()
+ {
+ Release();
+
+ // This works b/c vector elements are guaranteed to be contiguous.
+ return &m_entries[0];
+ }
+
+ TCom* operator [] (int i)
+ {
+ return m_entries[i];
+ }
+
+ size_t Size()
+ {
+ return m_entries.size();
+ }
+
+ void Release()
+ {
+ for (int i = 0; i < m_entries.size(); i++)
+ {
+ if (m_entries[i] != nullptr)
+ {
+ m_entries[i]->Release();
+ m_entries[i] = nullptr;
+ }
+ }
+ }
+};
+
+struct bstr_deleter
+{
+ void operator () (BSTR bstr) const
+ {
+ if (bstr != nullptr)
+ SysFreeString(bstr);
+ }
+};
+
+typedef std::unique_ptr<OLECHAR, bstr_deleter> bstr_ptr;
+
+//============================================================
+// winhybrid_joystick_module
+//============================================================
+
+class winhybrid_joystick_module : public wininput_module, public device_enum_interface
+{
+private:
+ std::shared_ptr<xinput_api_helper> m_xinput_helper;
+ std::unique_ptr<dinput_api_helper> m_dinput_helper;
+ std::list<DWORD> m_xinput_deviceids;
+ bool m_xinput_detect_failed;
+
+public:
+ winhybrid_joystick_module()
+ : wininput_module(OSD_JOYSTICKINPUT_PROVIDER, "winhybrid"),
+ m_xinput_helper(nullptr),
+ m_dinput_helper(nullptr),
+ m_xinput_detect_failed(false)
+ {
+ }
+
+ bool probe() override
+ {
+ int status = init_helpers();
+ if (status != 0)
+ {
+ osd_printf_verbose("Hybrid joystick module isn't supported, falling back.\n");
+ return false;
+ }
+
+ return true;
+ }
+
+ int init(const osd_options &options) override
+ {
+ // Call the base
+ int status = wininput_module::init(options);
+ if (status != 0)
+ return status;
+
+ // Create and initialize our helpers
+ status = init_helpers();
+ if (status != 0)
+ return status;
+
+ return 0;
+ }
+
+ BOOL device_enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref) override
+ {
+ DWORD cooperative_level = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE;
+ running_machine &machine = *static_cast<running_machine *>(ref);
+ dinput_joystick_device *devinfo;
+ int result = 0;
+
+ // First check if this device is XInput Compatible. If so, don't add it here
+ // as it'll be picked up by Xinput
+ if (!m_xinput_detect_failed && is_xinput_device(&instance->guidProduct))
+ {
+ osd_printf_verbose("Skipping DirectInput for XInput compatible joystick %S.\n", instance->tszInstanceName);
+ goto exit;
+ }
+
+ if (win_window_list != nullptr && win_window_list->win_has_menu())
+ cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
+
+ // allocate and link in a new device
+ devinfo = m_dinput_helper->create_device<dinput_joystick_device>(machine, *this, instance, &c_dfDIJoystick, nullptr, cooperative_level);
+ if (devinfo == nullptr)
+ goto exit;
+
+ result = devinfo->configure();
+ if (result != 0)
+ {
+ osd_printf_error("Failed to configure DI Joystick device. Error 0x%x\n", static_cast<unsigned int>(result));
+ }
+
+ exit:
+ return DIENUM_CONTINUE;
+ }
+
+ void exit() override
+ {
+ m_xinput_helper.reset();
+ m_dinput_helper.reset();
+
+ wininput_module::exit();
+ }
+
+protected:
+ virtual void input_init(running_machine &machine) override
+ {
+ HRESULT result = get_xinput_devices(m_xinput_deviceids);
+ if (result != 0)
+ {
+ m_xinput_detect_failed = true;
+ osd_printf_warning("XInput device detection failed. XInput won't be used. Error: 0x%X\n", static_cast<unsigned int>(result));
+ }
+
+ // Enumerate all the directinput joysticks and add them if they aren't xinput compatible
+ result = m_dinput_helper->enum_attached_devices(DI8DEVCLASS_GAMECTRL, this, &machine);
+ if (result != DI_OK)
+ fatalerror("DirectInput: Unable to enumerate keyboards (result=%08X)\n", static_cast<UINT32>(result));
+
+ xinput_joystick_device *devinfo;
+
+ // now add all xinput devices
+ if (!m_xinput_detect_failed)
+ {
+ // Loop through each gamepad to determine if they are connected
+ for (UINT i = 0; i < XUSER_MAX_COUNT; i++)
+ {
+ XINPUT_STATE state = { 0 };
+
+ if (m_xinput_helper->XInputGetState(i, &state) == ERROR_SUCCESS)
+ {
+ // allocate and link in a new device
+ devinfo = m_xinput_helper->create_xinput_device(machine, i, *this);
+ if (devinfo == nullptr)
+ continue;
+
+ // Configure each gamepad to add buttons and Axes, etc.
+ devinfo->configure();
+ }
+ }
+ }
+ }
+
+private:
+ int init_helpers()
+ {
+ int status = 0;
+
+ if (m_xinput_helper == nullptr)
+ {
+ m_xinput_helper = std::make_shared<xinput_api_helper>();
+ status = m_xinput_helper->initialize();
+ if (status != 0)
+ {
+ osd_printf_error("xinput_api_helper failed to initialize! Error: %u\n", static_cast<unsigned int>(status));
+ return -1;
+ }
+ }
+
+ if (m_dinput_helper == nullptr)
+ {
+ m_dinput_helper = std::make_unique<dinput_api_helper>(DIRECTINPUT_VERSION);
+ status = m_dinput_helper->initialize();
+ if (status != DI_OK)
+ {
+ osd_printf_error("dinput_api_helper failed to initialize! Error: %u\n", static_cast<unsigned int>(status));
+ return -1;
+ }
+ }
+
+ return status;
+ }
+
+ //-----------------------------------------------------------------------------
+ // Returns true if the DirectInput device is also an XInput device.
+ //-----------------------------------------------------------------------------
+ bool is_xinput_device(const GUID* pGuidProductFromDirectInput)
+ {
+ // Check each xinput device to see if this device's vid/pid matches
+ for (auto devid = m_xinput_deviceids.begin(); devid != m_xinput_deviceids.end(); ++devid)
+ {
+ if (*devid == pGuidProductFromDirectInput->Data1)
+ return true;
+ }
+
+ return false;
+ }
+
+ //-----------------------------------------------------------------------------
+ // Enum each PNP device using WMI and check each device ID to see if it contains
+ // "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it’s an XInput device
+ // Unfortunately this information can not be found by just using DirectInput.
+ // Checking against a VID/PID of 0x028E/0x045E won't find 3rd party or future
+ // XInput devices.
+ //-----------------------------------------------------------------------------
+ HRESULT get_xinput_devices(std::list<DWORD> &xinput_id_list) const
+ {
+ ComPtr<IWbemServices> pIWbemServices;
+ ComPtr<IEnumWbemClassObject> pEnumDevices;
+ ComPtr<IWbemLocator> pIWbemLocator;
+ ComArray<IWbemClassObject> pDevices(20);
+ bstr_ptr bstrDeviceID;
+ bstr_ptr bstrClassName;
+ bstr_ptr bstrNamespace;
+ DWORD uReturned = 0;
+ UINT iDevice = 0;
+ VARIANT var;
+ HRESULT hr;
+
+ // CoInit if needed
+ CoInitialize(nullptr);
+
+ // Create WMI
+ hr = CoCreateInstance(
+ __uuidof(WbemLocator),
+ nullptr,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(IWbemLocator),
+ reinterpret_cast<void**>(pIWbemLocator.GetAddressOf()));
+
+ if (FAILED(hr) || pIWbemLocator == nullptr)
+ {
+ osd_printf_error("Creating WbemLocator failed. Error: 0x%X\n", static_cast<unsigned int>(hr));
+ return hr;
+ }
+
+ // Create BSTRs for WMI
+ bstrNamespace = bstr_ptr(SysAllocString(L"\\\\.\\root\\cimv2"));
+ bstrDeviceID = bstr_ptr(SysAllocString(L"DeviceID"));
+ bstrClassName = bstr_ptr(SysAllocString(L"Win32_PNPEntity"));
+
+ // Connect to WMI
+ hr = pIWbemLocator->ConnectServer(
+ bstrNamespace.get(),
+ nullptr,
+ nullptr,
+ nullptr,
+ 0L,
+ nullptr,
+ nullptr,
+ pIWbemServices.GetAddressOf());
+
+ if (FAILED(hr) || pIWbemServices == nullptr)
+ {
+ osd_printf_error("Connecting to WMI Server failed. Error: 0x%X\n", static_cast<unsigned int>(hr));
+ return hr;
+ }
+
+ // Switch security level to IMPERSONATE
+ (void)CoSetProxyBlanket(
+ pIWbemServices.Get(),
+ RPC_C_AUTHN_WINNT,
+ RPC_C_AUTHZ_NONE,
+ nullptr,
+ RPC_C_AUTHN_LEVEL_CALL,
+ RPC_C_IMP_LEVEL_IMPERSONATE,
+ nullptr,
+ 0);
+
+ // Get list of Win32_PNPEntity devices
+ hr = pIWbemServices->CreateInstanceEnum(bstrClassName.get(), 0, nullptr, pEnumDevices.GetAddressOf());
+ if (FAILED(hr) || pEnumDevices == nullptr)
+ {
+ osd_printf_error("Getting list of Win32_PNPEntity devices failed. Error: 0x%X\n", static_cast<unsigned int>(hr));
+ return hr;
+ }
+
+ // Loop over all devices
+ for (; ; )
+ {
+ // Get a few at a time
+ hr = pEnumDevices->Next(10000, pDevices.Size(), pDevices.ReleaseAndGetAddressOf(), &uReturned);
+ if (FAILED(hr))
+ {
+ osd_printf_error("Enumerating WMI classes failed. Error: 0x%X\n", static_cast<unsigned int>(hr));
+ return hr;
+ }
+
+ if (uReturned == 0)
+ break;
+
+ for (iDevice = 0; iDevice < uReturned; iDevice++)
+ {
+ if (!pDevices[iDevice])
+ continue;
+
+ // For each device, get its device ID
+ hr = pDevices[iDevice]->Get(bstrDeviceID.get(), 0L, &var, nullptr, nullptr);
+ if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != nullptr)
+ {
+ // Check if the device ID contains "IG_". If it does, then it’s an XInput device
+ // Unfortunately this information can not be found by just using DirectInput
+ if (wcsstr(var.bstrVal, L"IG_"))
+ {
+ // If it does, then get the VID/PID from var.bstrVal
+ DWORD dwPid = 0, dwVid = 0;
+ WCHAR* strVid = wcsstr(var.bstrVal, L"VID_");
+ if (strVid && swscanf(strVid, L"VID_%4X", &dwVid) != 1)
+ dwVid = 0;
+
+ WCHAR* strPid = wcsstr(var.bstrVal, L"PID_");
+ if (strPid && swscanf(strPid, L"PID_%4X", &dwPid) != 1)
+ dwPid = 0;
+
+ DWORD dwVidPid = MAKELONG(dwVid, dwPid);
+
+ // Add the VID/PID to a linked list
+ xinput_id_list.push_back(dwVidPid);
+ }
+ }
+ }
+ }
+
+ if (SUCCEEDED(hr))
+ hr = S_OK;
+
+ return hr;
+ }
+};
+
+#else
+MODULE_NOT_SUPPORTED(winhybrid_joystick_module, OSD_JOYSTICKINPUT_PROVIDER, "winhybrid")
+#endif
+
+MODULE_DEFINITION(JOYSTICKINPUT_WINHYBRID, winhybrid_joystick_module)
diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp
index 8c7800c8c35..c3725ffbf08 100644
--- a/src/osd/modules/input/input_xinput.cpp
+++ b/src/osd/modules/input/input_xinput.cpp
@@ -23,224 +23,199 @@
// MAME headers
#include "emu.h"
#include "osdepend.h"
-#include "ui/ui.h"
// MAMEOS headers
#include "winutil.h"
#include "winmain.h"
-#include "window.h"
#include "input_common.h"
#include "input_windows.h"
+#include "input_xinput.h"
-#define XINPUT_MAX_POV 4
-#define XINPUT_MAX_BUTTONS 10
-#define XINPUT_MAX_AXIS 4
-#define XINPUT_AXIS_MINVALUE -32767
-#define XINPUT_AXIS_MAXVALUE 32767
-
-// default axis names
-static const char *const xinput_axis_name[] =
+xinput_api_helper::xinput_api_helper()
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ : XInputGetState("XInputGetState", xinput_dll_names, ARRAY_LENGTH(xinput_dll_names))
+ , XInputGetCapabilities("XInputGetCapabilities", xinput_dll_names, ARRAY_LENGTH(xinput_dll_names))
+#endif
{
- "LSX",
- "LSY",
- "RSX",
- "RSY"
-};
+}
-static const input_item_id xinput_axis_ids[] =
+int xinput_api_helper::initialize()
{
- ITEM_ID_XAXIS,
- ITEM_ID_YAXIS,
- ITEM_ID_RXAXIS,
- ITEM_ID_RYAXIS
-};
-
-static const USHORT xinput_pov_dir[] = {
- XINPUT_GAMEPAD_DPAD_UP,
- XINPUT_GAMEPAD_DPAD_DOWN,
- XINPUT_GAMEPAD_DPAD_LEFT,
- XINPUT_GAMEPAD_DPAD_RIGHT
-};
-
-static const char *const xinput_pov_names[] = {
- "DPAD Up",
- "DPAD Down",
- "DPAD Left",
- "DPAD Right"
-};
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ int status;
+ status = XInputGetState.initialize();
+ if (status != 0)
+ {
+ osd_printf_error("Failed to initialize function pointer for %s. Error: %d\n", XInputGetState.name(), status);
+ return -1;
+ }
-static const USHORT xinput_buttons[] = {
- XINPUT_GAMEPAD_A,
- XINPUT_GAMEPAD_B,
- XINPUT_GAMEPAD_X,
- XINPUT_GAMEPAD_Y,
- XINPUT_GAMEPAD_LEFT_SHOULDER,
- XINPUT_GAMEPAD_RIGHT_SHOULDER,
- XINPUT_GAMEPAD_START,
- XINPUT_GAMEPAD_BACK,
- XINPUT_GAMEPAD_LEFT_THUMB,
- XINPUT_GAMEPAD_RIGHT_THUMB,
-};
+ status = XInputGetCapabilities.initialize();
+ if (status != 0)
+ {
+ osd_printf_error("Failed to initialize function pointer for %s. Error: %d\n", XInputGetCapabilities.name(), status);
+ return -1;
+ }
+#endif
-static const char *const xinput_button_names[] = {
- "A",
- "B",
- "X",
- "Y",
- "Left Shoulder",
- "Right Shoulder",
- "Start",
- "Back",
- "Left Thumb",
- "Right Thumb"
-};
+ return 0;
+}
-struct gamepad_state
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+// Pass-through functions for Universal Windows
+inline DWORD xinput_api_helper::XInputGetState(DWORD dwUserindex, XINPUT_STATE *pState)
{
- BYTE rgbButtons[XINPUT_MAX_BUTTONS];
- BYTE rgbPov[XINPUT_MAX_POV];
- BYTE bLeftTrigger;
- BYTE bRightTrigger;
- LONG sThumbLX;
- LONG sThumbLY;
- LONG sThumbRX;
- LONG sThumbRY;
-};
+ return ::XInputGetState(dwUserindex, pState);
+}
-// state information for a gamepad; state must be first element
-struct xinput_api_state
+inline DWORD xinput_api_helper::XInputGetCapabilities(DWORD dwUserindex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities)
{
- UINT32 playerIndex;
- XINPUT_STATE xstate;
- XINPUT_CAPABILITIES caps;
-};
+ return ::XInputGetCapabilities(dwUserindex, dwFlags, pCapabilities);
+}
+#endif
-// Typedef for pointers to XInput Functions
-typedef lazy_loaded_function_p2<DWORD, DWORD, XINPUT_STATE*> xinput_get_state_fn;
-typedef lazy_loaded_function_p3<DWORD, DWORD, DWORD, XINPUT_CAPABILITIES*> xinput_get_caps_fn;
+//============================================================
+// create_xinput_device
+//============================================================
-class xinput_interface
+xinput_joystick_device * xinput_api_helper::create_xinput_device(running_machine &machine, UINT index, wininput_module &module)
{
-private:
- const wchar_t* xinput_dll_names[2] = { L"xinput1_4.dll", L"xinput9_1_0.dll" };
+ xinput_joystick_device *devinfo;
-public:
- xinput_get_state_fn XInputGetState;
- xinput_get_caps_fn XInputGetCapabilities;
-
-private:
- xinput_interface()
- : XInputGetState("XInputGetState", xinput_dll_names, ARRAY_LENGTH(xinput_dll_names)),
- XInputGetCapabilities("XInputGetCapabilities", xinput_dll_names, ARRAY_LENGTH(xinput_dll_names))
+ XINPUT_CAPABILITIES caps = { 0 };
+ if (FAILED(XInputGetCapabilities(index, 0, &caps)))
{
+ // If we can't get the capabilities skip this device
+ return nullptr;
}
- int initialize()
- {
- int status;
- status = XInputGetState.initialize();
- if (status != 0)
- {
- osd_printf_error("Failed to initialize function pointer for %s. Error: %d\n", XInputGetState.name(), status);
- return -1;
- }
+ char device_name[16];
+ snprintf(device_name, sizeof(device_name), "XInput Player %u", index + 1);
- status = XInputGetCapabilities.initialize();
- if (status != 0)
- {
- osd_printf_error("Failed to initialize function pointer for %s. Error: %d\n", XInputGetCapabilities.name(), status);
- return -1;
- }
+ // allocate the device object
+ devinfo = module.devicelist()->create_device1<xinput_joystick_device>(machine, device_name, module, shared_from_this());
- return 0;
- }
+ // Set the player ID
+ devinfo->xinput_state.player_index = index;
-public:
- static DWORD get_interface(xinput_interface **ppinterface)
- {
- static xinput_interface s_instance;
- DWORD error = s_instance.initialize();
- if (error == 0)
- {
- *ppinterface = &s_instance;
- }
+ // Assign the caps we captured earlier
+ devinfo->xinput_state.caps = caps;
- return error;
- }
-};
+ return devinfo;
+}
//============================================================
// xinput_joystick_device
//============================================================
-class xinput_joystick_device : public device_info
+xinput_joystick_device::xinput_joystick_device(running_machine &machine, const char *name, input_module &module, std::shared_ptr<xinput_api_helper> helper)
+ : device_info(machine, name, DEVICE_CLASS_JOYSTICK, module),
+ gamepad({{0}}),
+ xinput_state({0}),
+ m_xinput_helper(helper),
+ m_configured(false)
{
-public:
- gamepad_state gamepad;
- xinput_api_state xinput_state;
+}
-private:
- xinput_interface* xinput_api;
+void xinput_joystick_device::poll()
+{
+ if (!m_configured)
+ return;
-public:
- xinput_joystick_device(running_machine &machine, const char *name, input_module &module)
- : device_info(machine, name, DEVICE_CLASS_JOYSTICK, module),
- gamepad({{0}}),
- xinput_state({0}),
- xinput_api(nullptr)
+ // poll the device first
+ HRESULT result = m_xinput_helper->XInputGetState(xinput_state.player_index, &xinput_state.xstate);
+
+ // If we can't poll the device, skip
+ if (FAILED(result))
+ return;
+
+ // Copy the XState into State
+ // Start with the POV (DPAD)
+ for (int povindex = 0; povindex < XINPUT_MAX_POV; povindex++)
{
- // Attempt to get the xinput interface
- xinput_interface::get_interface(&xinput_api);
+ int currentPov = xinput_pov_dir[povindex];
+ gamepad.povs[povindex] = (xinput_state.xstate.Gamepad.wButtons & currentPov) ? 0xFF : 0;
}
- void poll() override
+ // Now do the buttons
+ for (int buttonindex = 0; buttonindex < XINPUT_MAX_BUTTONS; buttonindex++)
{
- // Nothing we can do if for some reason the API couldn't be loaded
- if (xinput_api == nullptr)
- return;
+ int currentButton = xinput_buttons[buttonindex];
+ gamepad.buttons[buttonindex] = (xinput_state.xstate.Gamepad.wButtons & currentButton) ? 0xFF : 0;
+ }
- // poll the device first
- HRESULT result = xinput_api->XInputGetState(xinput_state.playerIndex, &xinput_state.xstate);
+ // Now grab the axis values
+ // Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick
+ // However, the Y axis values are inverted from what MAME expects, so negate the value
+ gamepad.left_thumb_x = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbLX, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
+ gamepad.left_thumb_y = normalize_absolute_axis(-xinput_state.xstate.Gamepad.sThumbLY, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
+ gamepad.right_thumb_x = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbRX, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
+ gamepad.right_thumb_y = normalize_absolute_axis(-xinput_state.xstate.Gamepad.sThumbRY, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
- // If we can't poll the device, skip
- if (FAILED(result))
- return;
+ // Now the triggers
+ gamepad.left_trigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger, 0, 255);
+ gamepad.right_trigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bRightTrigger, 0, 255);
+}
- // Copy the XState into State
- // Start with the POV (DPAD)
- for (int povindex = 0; povindex < XINPUT_MAX_POV; povindex++)
- {
- int currentPov = xinput_pov_dir[povindex];
- gamepad.rgbPov[currentPov] = (xinput_state.xstate.Gamepad.wButtons & currentPov) ? 0xFF : 0;
- }
+void xinput_joystick_device::reset()
+{
+ memset(&gamepad, 0, sizeof(gamepad));
+}
- // Now do the buttons
- for (int buttonindex = 0; buttonindex < XINPUT_MAX_BUTTONS; buttonindex++)
- {
- int currentButton = xinput_buttons[buttonindex];
- gamepad.rgbButtons[buttonindex] = (xinput_state.xstate.Gamepad.wButtons & currentButton) ? 0xFF : 0;
- }
+void xinput_joystick_device::configure()
+{
+ std::lock_guard<std::mutex> scope_lock(m_device_lock);
+
+ if (m_configured)
+ return;
- // Now grab the axis values
- // Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick
- // However, the Y axis values are inverted from what MAME expects, so multiply by -1 first
- gamepad.sThumbLX = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbLX, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
- gamepad.sThumbLY = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbLY * -1, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
- gamepad.sThumbRX = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbRX, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
- gamepad.sThumbRY = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbRY * -1, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
-
- // Now the triggers
- gamepad.bLeftTrigger = xinput_state.xstate.Gamepad.bLeftTrigger;
- gamepad.bRightTrigger = xinput_state.xstate.Gamepad.bRightTrigger;
+ // Add the axes
+ for (int axisnum = 0; axisnum < XINPUT_MAX_AXIS; axisnum++)
+ {
+ device()->add_item(
+ xinput_axis_name[axisnum],
+ xinput_axis_ids[axisnum],
+ generic_axis_get_state,
+ &gamepad.left_thumb_x + axisnum);
}
- void reset() override
+ // Populate the POVs
+ // For XBOX, we treat the DPAD as a hat switch
+ for (int povnum = 0; povnum < XINPUT_MAX_POV; povnum++)
{
- memset(&gamepad, 0, sizeof(gamepad));
+ device()->add_item(
+ xinput_pov_names[povnum],
+ ITEM_ID_OTHER_SWITCH,
+ generic_button_get_state,
+ &gamepad.povs[povnum]);
}
-};
+
+ // populate the buttons
+ for (int butnum = 0; butnum < XINPUT_MAX_BUTTONS; butnum++)
+ {
+ device()->add_item(
+ xinput_button_names[butnum],
+ static_cast<input_item_id>(ITEM_ID_BUTTON1 + butnum),
+ generic_button_get_state,
+ &gamepad.buttons[butnum]);
+ }
+
+ device()->add_item(
+ "Left Trigger",
+ ITEM_ID_ZAXIS,
+ generic_axis_get_state,
+ &gamepad.left_trigger);
+
+ device()->add_item(
+ "Right Trigger",
+ ITEM_ID_RZAXIS,
+ generic_axis_get_state,
+ &gamepad.right_trigger);
+
+ m_configured = true;
+}
//============================================================
// xinput_joystick_module
@@ -249,12 +224,12 @@ public:
class xinput_joystick_module : public wininput_module
{
private:
- xinput_interface* xinput_api;
+ std::shared_ptr<xinput_api_helper> m_xinput_helper;
public:
xinput_joystick_module()
: wininput_module(OSD_JOYSTICKINPUT_PROVIDER, "xinput"),
- xinput_api(nullptr)
+ m_xinput_helper(nullptr)
{
}
@@ -265,11 +240,12 @@ public:
if (status != 0)
return status;
- // Make sure we can get the xinput API
- status = xinput_interface::get_interface(&xinput_api);
+ // Create and initialize our helper
+ m_xinput_helper = std::make_shared<xinput_api_helper>();
+ status = m_xinput_helper->initialize();
if (status != 0)
{
- osd_printf_error("xinput_joystick_module failed to get XInput interface! Error: %u\n", (unsigned int)status);
+ osd_printf_error("xinput_joystick_module failed to get XInput interface! Error: %u\n", static_cast<unsigned int>(status));
return -1;
}
@@ -279,9 +255,6 @@ public:
protected:
virtual void input_init(running_machine &machine) override
{
- // The Xinput API should have been obtained already
- assert(xinput_api != nullptr);
-
xinput_joystick_device *devinfo;
// Loop through each gamepad to determine if they are connected
@@ -289,93 +262,22 @@ protected:
{
XINPUT_STATE state = {0};
- if (xinput_api->XInputGetState(i, &state) == ERROR_SUCCESS)
+ if (m_xinput_helper->XInputGetState(i, &state) == ERROR_SUCCESS)
{
// allocate and link in a new device
- devinfo = create_xinput_device(machine, i);
+ devinfo = m_xinput_helper->create_xinput_device(machine, i, *this);
if (devinfo == nullptr)
continue;
- // Add the axes
- for (int axisnum = 0; axisnum < XINPUT_MAX_AXIS; axisnum++)
- {
- devinfo->device()->add_item(
- xinput_axis_name[axisnum],
- xinput_axis_ids[axisnum],
- generic_axis_get_state,
- &devinfo->gamepad.sThumbLX + axisnum);
- }
-
- // Populate the POVs
- // For XBOX, we treat the DPAD as a hat switch
- for (int povnum = 0; povnum < XINPUT_MAX_POV; povnum++)
- {
- devinfo->device()->add_item(
- xinput_pov_names[povnum],
- ITEM_ID_OTHER_SWITCH,
- generic_button_get_state,
- &devinfo->gamepad.rgbPov[povnum]);
- }
-
- // populate the buttons
- for (int butnum = 0; butnum < XINPUT_MAX_BUTTONS; butnum++)
- {
- devinfo->device()->add_item(
- xinput_button_names[butnum],
- (input_item_id)(ITEM_ID_BUTTON1 + butnum),
- generic_button_get_state,
- &devinfo->gamepad.rgbButtons[butnum]);
- }
-
- devinfo->device()->add_item(
- "Left Trigger",
- (input_item_id)(ITEM_ID_BUTTON1 + XINPUT_MAX_BUTTONS),
- generic_button_get_state,
- &devinfo->gamepad.bLeftTrigger);
-
- devinfo->device()->add_item(
- "Right Trigger",
- (input_item_id)(ITEM_ID_BUTTON1 + XINPUT_MAX_BUTTONS + 1),
- generic_button_get_state,
- &devinfo->gamepad.bRightTrigger);
+ // Configure each gamepad to add buttons and Axes, etc.
+ devinfo->configure();
}
}
}
-
- private:
- //============================================================
- // create_xinput_device
- //============================================================
-
- xinput_joystick_device * create_xinput_device(running_machine &machine, UINT index)
- {
- xinput_joystick_device *devinfo;
-
- XINPUT_CAPABILITIES caps = {0};
- if (FAILED(xinput_api->XInputGetCapabilities(index, 0, &caps)))
- {
- // If we can't get the capabilities skip this device
- return nullptr;
- }
-
- char device_name[16];
- snprintf(device_name, sizeof(device_name), "XInput Player %u", index + 1);
-
- // allocate the device object
- devinfo = devicelist()->create_device<xinput_joystick_device>(machine, device_name, *this);
-
- // Set the player ID
- devinfo->xinput_state.playerIndex = index;
-
- // Assign the caps we captured earlier
- devinfo->xinput_state.caps = caps;
-
- return devinfo;
- }
};
#else
-MODULE_NOT_SUPPORTED(xinput_joystick_module, OSD_KEYBOARDINPUT_PROVIDER, "xinput")
+MODULE_NOT_SUPPORTED(xinput_joystick_module, OSD_JOYSTICKINPUT_PROVIDER, "xinput")
#endif
MODULE_DEFINITION(JOYSTICKINPUT_XINPUT, xinput_joystick_module)
diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h
new file mode 100644
index 00000000000..4474a3f58f7
--- /dev/null
+++ b/src/osd/modules/input/input_xinput.h
@@ -0,0 +1,140 @@
+#ifndef INPUT_XINPUT_H_
+#define INPUT_XINPUT_H_
+
+#include <mutex>
+
+#define XINPUT_MAX_POV 4
+#define XINPUT_MAX_BUTTONS 10
+#define XINPUT_MAX_AXIS 4
+
+#define XINPUT_AXIS_MINVALUE -32767
+#define XINPUT_AXIS_MAXVALUE 32767
+
+class xinput_joystick_device;
+// default axis names
+static const char *const xinput_axis_name[] =
+{
+ "LSX",
+ "LSY",
+ "RSX",
+ "RSY"
+};
+
+static const input_item_id xinput_axis_ids[] =
+{
+ ITEM_ID_XAXIS,
+ ITEM_ID_YAXIS,
+ ITEM_ID_RXAXIS,
+ ITEM_ID_RYAXIS
+};
+
+static const USHORT xinput_pov_dir[] = {
+ XINPUT_GAMEPAD_DPAD_UP,
+ XINPUT_GAMEPAD_DPAD_DOWN,
+ XINPUT_GAMEPAD_DPAD_LEFT,
+ XINPUT_GAMEPAD_DPAD_RIGHT
+};
+
+static const char *const xinput_pov_names[] = {
+ "DPAD Up",
+ "DPAD Down",
+ "DPAD Left",
+ "DPAD Right"
+};
+
+static const USHORT xinput_buttons[] = {
+ XINPUT_GAMEPAD_A,
+ XINPUT_GAMEPAD_B,
+ XINPUT_GAMEPAD_X,
+ XINPUT_GAMEPAD_Y,
+ XINPUT_GAMEPAD_LEFT_SHOULDER,
+ XINPUT_GAMEPAD_RIGHT_SHOULDER,
+ XINPUT_GAMEPAD_START,
+ XINPUT_GAMEPAD_BACK,
+ XINPUT_GAMEPAD_LEFT_THUMB,
+ XINPUT_GAMEPAD_RIGHT_THUMB,
+};
+
+static const char *const xinput_button_names[] = {
+ "A",
+ "B",
+ "X",
+ "Y",
+ "Left Shoulder",
+ "Right Shoulder",
+ "Start",
+ "Back",
+ "Left Thumb",
+ "Right Thumb"
+};
+
+struct gamepad_state
+{
+ BYTE buttons[XINPUT_MAX_BUTTONS];
+ BYTE povs[XINPUT_MAX_POV];
+ LONG left_trigger;
+ LONG right_trigger;
+ LONG left_thumb_x;
+ LONG left_thumb_y;
+ LONG right_thumb_x;
+ LONG right_thumb_y;
+};
+
+// state information for a gamepad; state must be first element
+struct xinput_api_state
+{
+ UINT32 player_index;
+ XINPUT_STATE xstate;
+ XINPUT_CAPABILITIES caps;
+};
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+// Typedef for pointers to XInput Functions
+typedef lazy_loaded_function_p2<DWORD, DWORD, XINPUT_STATE*> xinput_get_state_fn;
+typedef lazy_loaded_function_p3<DWORD, DWORD, DWORD, XINPUT_CAPABILITIES*> xinput_get_caps_fn;
+#endif
+
+class xinput_api_helper : public std::enable_shared_from_this<xinput_api_helper>
+{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+private:
+ const wchar_t* xinput_dll_names[2] = { L"xinput1_4.dll", L"xinput9_1_0.dll" };
+
+public:
+ xinput_get_state_fn XInputGetState;
+ xinput_get_caps_fn XInputGetCapabilities;
+#endif
+
+public:
+ xinput_api_helper();
+
+ int initialize();
+ xinput_joystick_device * create_xinput_device(running_machine &machine, UINT index, wininput_module &module);
+
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ // Pass-through functions for Universal Windows
+ inline DWORD XInputGetState(DWORD dwUserindex, XINPUT_STATE *pState);
+ inline DWORD XInputGetCapabilities(DWORD dwUserindex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities);
+#endif
+};
+
+class xinput_joystick_device : public device_info
+{
+public:
+ gamepad_state gamepad;
+ xinput_api_state xinput_state;
+
+private:
+ std::shared_ptr<xinput_api_helper> m_xinput_helper;
+ std::mutex m_device_lock;
+ bool m_configured;
+
+public:
+ xinput_joystick_device(running_machine &machine, const char *name, input_module &module, std::shared_ptr<xinput_api_helper> helper);
+
+ void poll() override;
+ void reset() override;
+ void configure();
+};
+
+#endif
diff --git a/src/osd/modules/ipc/raw_tcp_connection.cpp b/src/osd/modules/ipc/raw_tcp_connection.cpp
new file mode 100644
index 00000000000..946aefcafa1
--- /dev/null
+++ b/src/osd/modules/ipc/raw_tcp_connection.cpp
@@ -0,0 +1,29 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#include "raw_tcp_connection.h"
+
+/* Instance methods. */
+
+raw_tcp_connection::raw_tcp_connection(listener* listener, size_t bufferSize) :
+ tcp_connection(bufferSize),
+ m_listener(listener)
+{
+}
+
+raw_tcp_connection::~raw_tcp_connection()
+{
+}
+
+void raw_tcp_connection::user_on_tcp_connection_read()
+{
+ // We may receive multiple packets in the same TCP chunk. If one of them is
+ // a DTLS Close Alert this would be closed (close() called) so we cannot call
+ // our listeners anymore.
+ if (is_closing())
+ return;
+
+ m_listener->on_data_recv(this, m_buffer, m_buffer_data_len);
+
+ m_buffer_data_len = 0;
+}
diff --git a/src/osd/modules/ipc/raw_tcp_connection.h b/src/osd/modules/ipc/raw_tcp_connection.h
new file mode 100644
index 00000000000..7bcfe80bfc6
--- /dev/null
+++ b/src/osd/modules/ipc/raw_tcp_connection.h
@@ -0,0 +1,30 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef RAW_TCP_CONNECTION_H
+#define RAW_TCP_CONNECTION_H
+
+#include "tcp_connection.h"
+
+
+class raw_tcp_connection : public tcp_connection
+{
+public:
+ class listener
+ {
+ public:
+ virtual ~listener(){ }
+ virtual void on_data_recv(raw_tcp_connection *connection, const uint8_t* data, size_t len) = 0;
+ };
+
+ raw_tcp_connection(listener* listener, size_t bufferSize);
+ virtual ~raw_tcp_connection();
+
+ /* Pure virtual methods inherited from tcp_connection. */
+ virtual void user_on_tcp_connection_read() override;
+
+private:
+ // Passed by argument.
+ listener* m_listener;
+};
+#endif
diff --git a/src/osd/modules/ipc/raw_tcp_server.cpp b/src/osd/modules/ipc/raw_tcp_server.cpp
new file mode 100644
index 00000000000..deaee6c5694
--- /dev/null
+++ b/src/osd/modules/ipc/raw_tcp_server.cpp
@@ -0,0 +1,42 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#include "raw_tcp_server.h"
+#include <string>
+
+#define MAX_TCP_CONNECTIONS_PER_SERVER 10
+
+/* Instance methods. */
+
+raw_tcp_server::raw_tcp_server(uv_loop_t* loop, const std::string &ip, uint16_t port, int backlog, listener* listener, raw_tcp_connection::listener* connListener) :
+ tcp_server(loop, ip, port, backlog),
+ m_listener(listener),
+ m_conn_listener(connListener)
+{
+}
+
+void raw_tcp_server::user_on_tcp_connection_alloc(tcp_connection** connection)
+{
+ // Allocate a new raw_tcp_connection for the raw_tcp_server to handle it.
+ *connection = new raw_tcp_connection(m_conn_listener, 65536);
+}
+
+void raw_tcp_server::user_on_new_tcp_connection(tcp_connection* connection)
+{
+ // Allow just MAX_TCP_CONNECTIONS_PER_SERVER.
+ if (get_num_connections() > MAX_TCP_CONNECTIONS_PER_SERVER)
+ connection->close();
+}
+
+void raw_tcp_server::user_on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer)
+{
+ // Notify the listener.
+ // NOTE: Don't do it if closing (since at this point the listener is already freed).
+ // At the end, this is just called if the connection was remotely closed.
+ if (!is_closing())
+ m_listener->on_raw_tcp_connection_closed(this, static_cast<raw_tcp_connection*>(connection), is_closed_by_peer);
+}
+
+void raw_tcp_server::user_on_tcp_server_closed()
+{
+}
diff --git a/src/osd/modules/ipc/raw_tcp_server.h b/src/osd/modules/ipc/raw_tcp_server.h
new file mode 100644
index 00000000000..576490094e3
--- /dev/null
+++ b/src/osd/modules/ipc/raw_tcp_server.h
@@ -0,0 +1,36 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef RAW_TCP_SERVER_H
+#define RAW_TCP_SERVER_H
+
+#include "tcp_server.h"
+#include "tcp_connection.h"
+#include "raw_tcp_connection.h"
+#include <uv.h>
+
+class raw_tcp_server : public tcp_server
+{
+public:
+ class listener
+ {
+ public:
+ virtual ~listener() { }
+ virtual void on_raw_tcp_connection_closed(raw_tcp_server* tcpServer, raw_tcp_connection* connection, bool is_closed_by_peer) = 0;
+ };
+
+ raw_tcp_server(uv_loop_t* loop, const std::string &ip, uint16_t port, int backlog, listener* listener, raw_tcp_connection::listener* connListener);
+
+ /* Pure virtual methods inherited from TCPServer. */
+ virtual void user_on_tcp_connection_alloc(tcp_connection** connection) override;
+ virtual void user_on_new_tcp_connection(tcp_connection* connection) override;
+ virtual void user_on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer) override;
+ virtual void user_on_tcp_server_closed() override;
+
+private:
+ // Passed by argument.
+ listener* m_listener;
+ raw_tcp_connection::listener* m_conn_listener;
+};
+
+#endif
diff --git a/src/osd/modules/ipc/rtc_tcp_connection.cpp b/src/osd/modules/ipc/rtc_tcp_connection.cpp
new file mode 100644
index 00000000000..1cc800b7d77
--- /dev/null
+++ b/src/osd/modules/ipc/rtc_tcp_connection.cpp
@@ -0,0 +1,150 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+#include "emu.h"
+#include "rtc_tcp_connection.h"
+
+/* Instance methods. */
+
+rtc_tcp_connection::rtc_tcp_connection(listener* listener, size_t bufferSize) :
+ tcp_connection(bufferSize),
+ m_listener(listener),
+ m_frame_start(0)
+{
+}
+
+rtc_tcp_connection::~rtc_tcp_connection()
+{
+}
+
+inline uint16_t get2bytes(const uint8_t* data, size_t i)
+{
+ return (uint16_t)(data[i + 1]) | ((uint16_t)(data[i])) << 8;
+}
+
+inline void set2bytes(uint8_t* data, size_t i, uint16_t value)
+{
+ data[i + 1] = (uint8_t)(value);
+ data[i] = (uint8_t)(value >> 8);
+}
+
+
+void rtc_tcp_connection::user_on_tcp_connection_read()
+{
+ /*
+ * Framing RFC 4571
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * ---------------------------------------------------------------
+ * | LENGTH | STUN / DTLS / RTP / RTCP |
+ * ---------------------------------------------------------------
+ *
+ * A 16-bit unsigned integer LENGTH field, coded in network byte order
+ * (big-endian), begins the frame. If LENGTH is non-zero, an RTP or
+ * RTCP packet follows the LENGTH field. The value coded in the LENGTH
+ * field MUST equal the number of octets in the RTP or RTCP packet.
+ * Zero is a valid value for LENGTH, and it codes the null packet.
+ */
+
+ // Be ready to parse more than a single frame in a single TCP chunk.
+ while (true)
+ {
+ // We may receive multiple packets in the same TCP chunk. If one of them is
+ // a DTLS Close Alert this would be closed (Close() called) so we cannot call
+ // our listeners anymore.
+ if (is_closing())
+ return;
+
+ size_t data_len = m_buffer_data_len - m_frame_start;
+ size_t packet_len = 0;
+
+ if (data_len >= 2)
+ packet_len = (size_t)get2bytes(m_buffer + m_frame_start, 0);
+
+ // We have packet_len bytes.
+ if ((data_len >= 2) && data_len >= 2 + packet_len)
+ {
+ const uint8_t* packet = m_buffer + m_frame_start + 2;
+
+ // Notify the listener.
+ if (packet_len != 0)
+ {
+ m_listener->on_packet_recv(this, packet, packet_len);
+ }
+
+ // If there is no more space available in the buffer and that is because
+ // the latest parsed frame filled it, then empty the full buffer.
+ if ((m_frame_start + 2 + packet_len) == m_buffer_size)
+ {
+ osd_printf_error("no more space in the buffer, emptying the buffer data");
+
+ m_frame_start = 0;
+ m_buffer_data_len = 0;
+ }
+ // If there is still space in the buffer, set the beginning of the next
+ // frame to the next position after the parsed frame.
+ else
+ {
+ m_frame_start += 2 + packet_len;
+ }
+
+ // If there is more data in the buffer after the parsed frame then
+ // parse again. Otherwise break here and wait for more data.
+ if (m_buffer_data_len > m_frame_start)
+ {
+ // osd_printf_error("there is more data after the parsed frame, continue parsing");
+
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else // Incomplete packet.
+ {
+ // Check if the buffer is full.
+ if (m_buffer_data_len == m_buffer_size)
+ {
+ // First case: the incomplete frame does not begin at position 0 of
+ // the buffer, so move the frame to the position 0.
+ if (m_frame_start != 0)
+ {
+ // osd_printf_error("no more space in the buffer, moving parsed bytes to the beginning of the buffer and wait for more data");
+
+ std::memmove(m_buffer, m_buffer + m_frame_start, m_buffer_size - m_frame_start);
+ m_buffer_data_len = m_buffer_size - m_frame_start;
+ m_frame_start = 0;
+ }
+ // Second case: the incomplete frame begins at position 0 of the buffer.
+ // The frame is too big, so close the connection.
+ else
+ {
+ osd_printf_error("no more space in the buffer for the unfinished frame being parsed, closing the connection");
+
+ // Close the socket.
+ close();
+ }
+ }
+ // The buffer is not full.
+ else
+ {
+ osd_printf_verbose("frame not finished yet, waiting for more data");
+ }
+
+ // Exit the parsing loop.
+ break;
+ }
+ }
+}
+
+void rtc_tcp_connection::send(const uint8_t* data, size_t len)
+{
+ // Write according to Framing RFC 4571.
+
+ uint8_t frame_len[2];
+
+ set2bytes(frame_len, 0, len);
+
+ write(frame_len, 2, data, len);
+}
diff --git a/src/osd/modules/ipc/rtc_tcp_connection.h b/src/osd/modules/ipc/rtc_tcp_connection.h
new file mode 100644
index 00000000000..9ec74b90537
--- /dev/null
+++ b/src/osd/modules/ipc/rtc_tcp_connection.h
@@ -0,0 +1,33 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef RTC_TCP_CONNECTION_H
+#define RTC_TCP_CONNECTION_H
+
+#include "tcp_connection.h"
+
+
+class rtc_tcp_connection : public tcp_connection
+{
+public:
+ class listener
+ {
+ public:
+ virtual ~listener(){ }
+ virtual void on_packet_recv(rtc_tcp_connection *connection, const uint8_t* data, size_t len) = 0;
+ };
+
+ rtc_tcp_connection(listener* listener, size_t bufferSize);
+ virtual ~rtc_tcp_connection();
+
+ /* Pure virtual methods inherited from tcp_connection. */
+ virtual void user_on_tcp_connection_read() override;
+
+ void send(const uint8_t* data, size_t len);
+
+private:
+ // Passed by argument.
+ listener* m_listener;
+ size_t m_frame_start; // Where the latest frame starts.
+};
+#endif
diff --git a/src/osd/modules/ipc/rtc_tcp_server.cpp b/src/osd/modules/ipc/rtc_tcp_server.cpp
new file mode 100644
index 00000000000..52345454983
--- /dev/null
+++ b/src/osd/modules/ipc/rtc_tcp_server.cpp
@@ -0,0 +1,42 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#include "rtc_tcp_server.h"
+#include <string>
+
+#define MAX_TCP_CONNECTIONS_PER_SERVER 10
+
+/* Instance methods. */
+
+rtc_tcp_server::rtc_tcp_server(uv_loop_t* loop, const std::string &ip, uint16_t port, int backlog, listener* listener, rtc_tcp_connection::listener* connListener) :
+ tcp_server(loop, ip, port, backlog),
+ m_listener(listener),
+ m_conn_listener(connListener)
+{
+}
+
+void rtc_tcp_server::user_on_tcp_connection_alloc(tcp_connection** connection)
+{
+ // Allocate a new rtc_tcp_connection for the rtc_tcp_server to handle it.
+ *connection = new rtc_tcp_connection(m_conn_listener, 65536);
+}
+
+void rtc_tcp_server::user_on_new_tcp_connection(tcp_connection* connection)
+{
+ // Allow just MAX_TCP_CONNECTIONS_PER_SERVER.
+ if (get_num_connections() > MAX_TCP_CONNECTIONS_PER_SERVER)
+ connection->close();
+}
+
+void rtc_tcp_server::user_on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer)
+{
+ // Notify the listener.
+ // NOTE: Don't do it if closing (since at this point the listener is already freed).
+ // At the end, this is just called if the connection was remotely closed.
+ if (!is_closing())
+ m_listener->on_rtc_tcp_connection_closed(this, static_cast<rtc_tcp_connection*>(connection), is_closed_by_peer);
+}
+
+void rtc_tcp_server::user_on_tcp_server_closed()
+{
+}
diff --git a/src/osd/modules/ipc/rtc_tcp_server.h b/src/osd/modules/ipc/rtc_tcp_server.h
new file mode 100644
index 00000000000..f0733c95397
--- /dev/null
+++ b/src/osd/modules/ipc/rtc_tcp_server.h
@@ -0,0 +1,36 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef RTC_TCP_SERVER_H
+#define RTC_TCP_SERVER_H
+
+#include "tcp_server.h"
+#include "tcp_connection.h"
+#include "rtc_tcp_connection.h"
+#include <uv.h>
+
+class rtc_tcp_server : public tcp_server
+{
+public:
+ class listener
+ {
+ public:
+ virtual ~listener() { }
+ virtual void on_rtc_tcp_connection_closed(rtc_tcp_server* tcpServer, rtc_tcp_connection* connection, bool is_closed_by_peer) = 0;
+ };
+
+ rtc_tcp_server(uv_loop_t* loop, const std::string &ip, uint16_t port, int backlog, listener* listener, rtc_tcp_connection::listener* connListener);
+
+ /* Pure virtual methods inherited from TCPServer. */
+ virtual void user_on_tcp_connection_alloc(tcp_connection** connection) override;
+ virtual void user_on_new_tcp_connection(tcp_connection* connection) override;
+ virtual void user_on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer) override;
+ virtual void user_on_tcp_server_closed() override;
+
+private:
+ // Passed by argument.
+ listener* m_listener;
+ rtc_tcp_connection::listener* m_conn_listener;
+};
+
+#endif
diff --git a/src/osd/modules/ipc/tcp_connection.cpp b/src/osd/modules/ipc/tcp_connection.cpp
new file mode 100644
index 00000000000..fb6af2f976a
--- /dev/null
+++ b/src/osd/modules/ipc/tcp_connection.cpp
@@ -0,0 +1,414 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#include "emu.h"
+#include "tcp_connection.h"
+#include <cstdint> // uint8_t, etc
+#include <cstdlib> // std::malloc(), std::free()
+
+/* Static methods for UV callbacks. */
+
+static inline void on_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf)
+{
+ static_cast<tcp_connection*>(handle->data)->on_uv_read_alloc(suggested_size, buf);
+}
+
+static inline void on_read(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf)
+{
+ static_cast<tcp_connection*>(handle->data)->on_uv_read(nread, buf);
+}
+
+static inline void on_write(uv_write_t* req, int status)
+{
+ tcp_connection::tcp_uv_write_data* write_data = static_cast<tcp_connection::tcp_uv_write_data*>(req->data);
+ tcp_connection* connection = write_data->connection;
+
+ // Delete the UvWriteData struct (which includes the uv_req_t and the store char[]).
+ std::free(write_data);
+
+ // Just notify the TCPConnection when error.
+ if (status)
+ connection->on_uv_write_error(status);
+}
+
+static inline void on_shutdown(uv_shutdown_t* req, int status)
+{
+ static_cast<tcp_connection*>(req->data)->on_uv_shutdown(req, status);
+}
+
+static inline void on_close(uv_handle_t* handle)
+{
+ static_cast<tcp_connection*>(handle->data)->on_uv_closed();
+}
+
+/* Instance methods. */
+
+tcp_connection::tcp_connection(size_t bufferSize) :
+ m_listener(nullptr),
+ m_local_addr(nullptr),
+ m_is_closing(false),
+ m_is_closed_by_peer(false),
+ m_has_error(false),
+ m_buffer_size(bufferSize),
+ m_buffer(nullptr),
+ m_buffer_data_len(0),
+ m_local_port(0),
+ m_peer_port(0)
+{
+ m_uv_handle = new uv_tcp_t;
+ m_uv_handle->data = (void*)this;
+
+ // NOTE: Don't allocate the buffer here. Instead wait for the first uv_alloc_cb().
+}
+
+tcp_connection::~tcp_connection()
+{
+ if (m_uv_handle)
+ delete m_uv_handle;
+ if (m_buffer)
+ delete[] m_buffer;
+}
+
+void tcp_connection::setup(uv_loop_t* loop, listener* listener, struct sockaddr_storage* localAddr, const std::string &localIP, uint16_t localPort)
+{
+ int err;
+
+ // Set the UV handle.
+ err = uv_tcp_init(loop, m_uv_handle);
+ if (err)
+ {
+ delete m_uv_handle;
+ m_uv_handle = nullptr;
+ throw emu_fatalerror("uv_tcp_init() failed: %s", uv_strerror(err));
+ }
+
+ // Set the listener.
+ m_listener = listener;
+
+ // Set the local address.
+ m_local_addr = localAddr;
+ m_local_ip = localIP;
+ m_local_port = localPort;
+}
+
+void tcp_connection::close()
+{
+ if (m_is_closing)
+ return;
+
+ int err;
+
+ m_is_closing = true;
+
+ // Don't read more.
+ err = uv_read_stop((uv_stream_t*)m_uv_handle);
+ if (err)
+ throw emu_fatalerror("uv_read_stop() failed: %s", uv_strerror(err));
+
+ // If there is no error and the peer didn't close its connection side then close gracefully.
+ if (!m_has_error && !m_is_closed_by_peer)
+ {
+ // Use uv_shutdown() so pending data to be written will be sent to the peer
+ // before closing.
+ uv_shutdown_t* req = new uv_shutdown_t;
+ req->data = (void*)this;
+ err = uv_shutdown(req, (uv_stream_t*)m_uv_handle, (uv_shutdown_cb)on_shutdown);
+ if (err)
+ throw emu_fatalerror("uv_shutdown() failed: %s", uv_strerror(err));
+ }
+ // Otherwise directly close the socket.
+ else
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+ }
+}
+
+void tcp_connection::terminate()
+{
+ if (m_is_closing)
+ return;
+ m_is_closing = true;
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+}
+
+void tcp_connection::dump()
+{
+ osd_printf_verbose("[TCP, local:%s :%d, remote:%s :%d, status:%s]\r\n",
+ m_local_ip.c_str(), (uint16_t)m_local_port,
+ m_peer_ip.c_str(), (uint16_t)m_peer_port,
+ (!m_is_closing) ? "open" : "closed");
+}
+
+void tcp_connection::start()
+{
+ if (m_is_closing)
+ return;
+
+ int err;
+
+ err = uv_read_start((uv_stream_t*)m_uv_handle, (uv_alloc_cb)on_alloc, (uv_read_cb)on_read);
+ if (err)
+ throw emu_fatalerror("uv_read_start() failed: %s", uv_strerror(err));
+
+ // Get the peer address.
+ if (!set_peer_address())
+ throw emu_fatalerror("error setting peer IP and port");
+}
+
+void tcp_connection::write(const uint8_t* data, size_t len)
+{
+ if (m_is_closing)
+ return;
+
+ if (len == 0)
+ return;
+
+ uv_buf_t buffer;
+ int written;
+ int err;
+
+ // First try uv_try_write(). In case it can not directly write all the given
+ // data then build a uv_req_t and use uv_write().
+
+ buffer = uv_buf_init((char*)data, len);
+ written = uv_try_write((uv_stream_t*)m_uv_handle, &buffer, 1);
+
+ // All the data was written. Done.
+ if (written == (int)len)
+ {
+ return;
+ }
+ // Cannot write any data at first time. Use uv_write().
+ else if (written == UV_EAGAIN || written == UV_ENOSYS)
+ {
+ // Set written to 0 so pending_len can be properly calculated.
+ written = 0;
+ }
+ // Error. Should not happen.
+ else if (written < 0)
+ {
+ osd_printf_warning("uv_try_write() failed, closing the connection: %s", uv_strerror(written));
+
+ close();
+ return;
+ }
+
+ // osd_printf_info("could just write %zu bytes (%zu given) at first time, using uv_write() now", (size_t)written, len);
+
+ size_t pending_len = len - written;
+
+ // Allocate a special UvWriteData struct pointer.
+ tcp_uv_write_data* write_data = (tcp_uv_write_data*)std::malloc(sizeof(tcp_uv_write_data) + pending_len);
+
+ write_data->connection = this;
+ std::memcpy(write_data->store, data + written, pending_len);
+ write_data->req.data = (void*)write_data;
+
+ buffer = uv_buf_init((char*)write_data->store, pending_len);
+
+ err = uv_write(&write_data->req, (uv_stream_t*)m_uv_handle, &buffer, 1, (uv_write_cb)on_write);
+ if (err)
+ throw emu_fatalerror("uv_write() failed: %s", uv_strerror(err));
+}
+
+void tcp_connection::write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2)
+{
+ if (m_is_closing)
+ return;
+
+ if (len1 == 0 && len2 == 0)
+ return;
+
+ size_t total_len = len1 + len2;
+ uv_buf_t buffers[2];
+ int written;
+ int err;
+
+ // First try uv_try_write(). In case it can not directly write all the given
+ // data then build a uv_req_t and use uv_write().
+
+ buffers[0] = uv_buf_init((char*)data1, len1);
+ buffers[1] = uv_buf_init((char*)data2, len2);
+ written = uv_try_write((uv_stream_t*)m_uv_handle, buffers, 2);
+
+ // All the data was written. Done.
+ if (written == (int)total_len)
+ {
+ return;
+ }
+ // Cannot write any data at first time. Use uv_write().
+ else if (written == UV_EAGAIN || written == UV_ENOSYS)
+ {
+ // Set written to 0 so pending_len can be properly calculated.
+ written = 0;
+ }
+ // Error. Should not happen.
+ else if (written < 0)
+ {
+ osd_printf_warning("uv_try_write() failed, closing the connection: %s", uv_strerror(written));
+
+ close();
+ return;
+ }
+
+ // osd_printf_info("could just write %zu bytes (%zu given) at first time, using uv_write() now", (size_t)written, total_len);
+
+ size_t pending_len = total_len - written;
+
+ // Allocate a special UvWriteData struct pointer.
+ tcp_uv_write_data* write_data = (tcp_uv_write_data*)std::malloc(sizeof(tcp_uv_write_data) + pending_len);
+
+ write_data->connection = this;
+ // If the first buffer was not entirely written then splice it.
+ if ((size_t)written < len1)
+ {
+ std::memcpy(write_data->store, data1 + (size_t)written, len1 - (size_t)written);
+ std::memcpy(write_data->store + (len1 - (size_t)written), data2, len2);
+ }
+ // Otherwise just take the pending data in the second buffer.
+ else
+ {
+ std::memcpy(write_data->store, data2 + ((size_t)written - len1), len2 - ((size_t)written - len1));
+ }
+ write_data->req.data = (void*)write_data;
+
+ uv_buf_t buffer = uv_buf_init((char*)write_data->store, pending_len);
+
+ err = uv_write(&write_data->req, (uv_stream_t*)m_uv_handle, &buffer, 1, (uv_write_cb)on_write);
+ if (err)
+ throw emu_fatalerror("uv_write() failed: %s", uv_strerror(err));
+}
+
+void GetAddressInfo(const struct sockaddr* addr, int* family, std::string &ip, uint16_t* port)
+{
+ char _ip[INET6_ADDRSTRLEN + 1];
+ int err;
+
+
+ err = uv_inet_ntop(AF_INET, &((struct sockaddr_in*)addr)->sin_addr, _ip, INET_ADDRSTRLEN);
+ if (err)
+ throw emu_fatalerror("uv_inet_ntop() failed: %s", uv_strerror(err));
+ *port = (uint16_t)ntohs(((struct sockaddr_in*)addr)->sin_port);
+
+ *family = addr->sa_family;
+ ip.assign(_ip);
+}
+bool tcp_connection::set_peer_address()
+{
+ int err;
+ int len = sizeof(m_peer_addr);
+
+ err = uv_tcp_getpeername(m_uv_handle, (struct sockaddr*)&m_peer_addr, &len);
+ if (err)
+ {
+ osd_printf_error("uv_tcp_getpeername() failed: %s", uv_strerror(err));
+
+ return false;
+ }
+
+ int family;
+ GetAddressInfo((const struct sockaddr*)&m_peer_addr, &family, m_peer_ip, &m_peer_port);
+
+ return true;
+}
+
+void tcp_connection::on_uv_read_alloc(size_t suggested_size, uv_buf_t* buf)
+{
+ // If this is the first call to onUvReadAlloc() then allocate the receiving buffer now.
+ if (!m_buffer)
+ m_buffer = new uint8_t[m_buffer_size];
+
+ // Tell UV to write after the last data byte in the buffer.
+ buf->base = (char *)(m_buffer + m_buffer_data_len);
+ // Give UV all the remaining space in the buffer.
+ if (m_buffer_size > m_buffer_data_len)
+ {
+ buf->len = m_buffer_size - m_buffer_data_len;
+ }
+ else
+ {
+ buf->len = 0;
+
+ osd_printf_warning("no available space in the buffer");
+ }
+}
+
+void tcp_connection::on_uv_read(::ssize_t nread, const uv_buf_t* buf)
+{
+ if (m_is_closing)
+ return;
+
+ if (nread == 0)
+ return;
+
+ // Data received.
+ if (nread > 0)
+ {
+ // Update the buffer data length.
+ m_buffer_data_len += (size_t)nread;
+
+ // Notify the subclass.
+ user_on_tcp_connection_read();
+ }
+ // Client disconneted.
+ else if (nread == UV_EOF || nread == UV_ECONNRESET)
+ {
+ osd_printf_info("connection closed by peer, closing server side");
+
+ m_is_closed_by_peer = true;
+
+ // Close server side of the connection.
+ close();
+ }
+ // Some error.
+ else
+ {
+ osd_printf_info("read error, closing the connection: %s", uv_strerror(nread));
+
+ m_has_error = true;
+
+ // Close server side of the connection.
+ close();
+ }
+}
+
+void tcp_connection::on_uv_write_error(int error)
+{
+ if (m_is_closing)
+ return;
+
+ if (error == UV_EPIPE || error == UV_ENOTCONN)
+ {
+ osd_printf_info("write error, closing the connection: %s", uv_strerror(error));
+ }
+ else
+ {
+ osd_printf_info("write error, closing the connection: %s", uv_strerror(error));
+
+ m_has_error = true;
+ }
+
+ close();
+}
+
+void tcp_connection::on_uv_shutdown(uv_shutdown_t* req, int status)
+{
+ delete req;
+
+ if (status == UV_EPIPE || status == UV_ENOTCONN || status == UV_ECANCELED)
+ osd_printf_info("shutdown error: %s", uv_strerror(status));
+ else if (status)
+ osd_printf_info("shutdown error: %s", uv_strerror(status));
+
+ // Now do close the handle.
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+}
+
+void tcp_connection::on_uv_closed()
+{
+ // Notify the listener.
+ m_listener->on_tcp_connection_closed(this, m_is_closed_by_peer);
+
+ // And delete this.
+ delete this;
+}
diff --git a/src/osd/modules/ipc/tcp_connection.h b/src/osd/modules/ipc/tcp_connection.h
new file mode 100644
index 00000000000..55e70d39688
--- /dev/null
+++ b/src/osd/modules/ipc/tcp_connection.h
@@ -0,0 +1,137 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef TCP_CONNECTION_H
+#define TCP_CONNECTION_H
+
+#include <string>
+#include <uv.h>
+
+extern void GetAddressInfo(const sockaddr * addr, int * family, std::string & ip, uint16_t * port);
+
+class tcp_connection
+{
+public:
+ class listener
+ {
+ public:
+ virtual ~listener() { }
+ virtual void on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer) = 0;
+ };
+
+ /* Struct for the data field of uv_req_t when writing into the connection. */
+ struct tcp_uv_write_data
+ {
+ tcp_connection* connection;
+ uv_write_t req;
+ uint8_t store[1];
+ };
+
+ tcp_connection(size_t bufferSize);
+ virtual ~tcp_connection();
+
+ void close();
+ void terminate();
+ virtual void dump();
+ void setup(uv_loop_t* loop, listener* listener, struct sockaddr_storage* localAddr, const std::string &localIP, uint16_t localPort);
+ bool is_closing();
+ uv_tcp_t* get_uv_handle();
+ void start();
+ void write(const uint8_t* data, size_t len);
+ void write(const uint8_t* data1, size_t len1, const uint8_t* data2, size_t len2);
+ void write(const std::string &data);
+ const struct sockaddr* get_local_address();
+ const std::string& get_local_ip();
+ uint16_t get_local_port();
+ const struct sockaddr* get_peer_address();
+ const std::string& get_peer_ip();
+ uint16_t get_peer_port();
+
+private:
+ bool set_peer_address();
+
+ /* Callbacks fired by UV events. */
+public:
+ void on_uv_read_alloc(size_t suggested_size, uv_buf_t* buf);
+ void on_uv_read(ssize_t nread, const uv_buf_t* buf);
+ void on_uv_write_error(int error);
+ void on_uv_shutdown(uv_shutdown_t* req, int status);
+ void on_uv_closed();
+
+ /* Pure virtual methods that must be implemented by the subclass. */
+protected:
+ virtual void user_on_tcp_connection_read() = 0;
+
+private:
+ // Passed by argument.
+ listener* m_listener;
+ // Allocated by this.
+ uv_tcp_t* m_uv_handle;
+ // Others.
+ struct sockaddr_storage* m_local_addr;
+ bool m_is_closing;
+ bool m_is_closed_by_peer;
+ bool m_has_error;
+
+protected:
+ // Passed by argument.
+ size_t m_buffer_size;
+ // Allocated by this.
+ uint8_t* m_buffer;
+ // Others.
+ size_t m_buffer_data_len;
+ std::string m_local_ip;
+ uint16_t m_local_port;
+ struct sockaddr_storage m_peer_addr;
+ std::string m_peer_ip;
+ uint16_t m_peer_port;
+};
+
+/* Inline methods. */
+
+inline bool tcp_connection::is_closing()
+{
+ return m_is_closing;
+}
+
+inline uv_tcp_t* tcp_connection::get_uv_handle()
+{
+ return m_uv_handle;
+}
+
+inline void tcp_connection::write(const std::string &data)
+{
+ write((const uint8_t*)data.c_str(), data.size());
+}
+
+inline const sockaddr* tcp_connection::get_local_address()
+{
+ return (const struct sockaddr*)m_local_addr;
+}
+
+inline const std::string& tcp_connection::get_local_ip()
+{
+ return m_local_ip;
+}
+
+inline uint16_t tcp_connection::get_local_port()
+{
+ return m_local_port;
+}
+
+inline const sockaddr* tcp_connection::get_peer_address()
+{
+ return (const struct sockaddr*)&m_peer_addr;
+}
+
+inline const std::string& tcp_connection::get_peer_ip()
+{
+ return m_peer_ip;
+}
+
+inline uint16_t tcp_connection::get_peer_port()
+{
+ return m_peer_port;
+}
+
+#endif
diff --git a/src/osd/modules/ipc/tcp_server.cpp b/src/osd/modules/ipc/tcp_server.cpp
new file mode 100644
index 00000000000..a4de2df12d9
--- /dev/null
+++ b/src/osd/modules/ipc/tcp_server.cpp
@@ -0,0 +1,279 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#include "emu.h"
+#include "tcp_server.h"
+
+/* Static methods for UV callbacks. */
+
+static inline void on_connection(uv_stream_t* handle, int status)
+{
+ static_cast<tcp_server*>(handle->data)->on_uv_connection(status);
+}
+
+static inline void on_close(uv_handle_t* handle)
+{
+ static_cast<tcp_server*>(handle->data)->on_uv_closed();
+}
+
+static inline void on_error_close(uv_handle_t* handle)
+{
+ delete handle;
+}
+
+/* Instance methods. */
+
+tcp_server::tcp_server(uv_loop_t* loop, const std::string &ip, uint16_t port, int backlog)
+ : m_uv_handle(nullptr),
+ m_loop(nullptr),
+ m_is_closing(false),
+ m_local_port(0)
+{
+ int err;
+ int flags = 0;
+
+ m_uv_handle = new uv_tcp_t;
+ m_uv_handle->data = (void*)this;
+ m_loop = loop;
+
+ err = uv_tcp_init(loop, m_uv_handle);
+ if (err)
+ {
+ delete m_uv_handle;
+ m_uv_handle = nullptr;
+ throw emu_fatalerror("uv_tcp_init() failed: %s", uv_strerror(err));
+ }
+
+ struct sockaddr_storage bind_addr;
+
+
+ err = uv_ip4_addr(ip.c_str(), (int)port, (struct sockaddr_in*)&bind_addr);
+ if (err)
+ throw emu_fatalerror("uv_ipv4_addr() failed: %s", uv_strerror(err));
+
+ err = uv_tcp_bind(m_uv_handle, (const struct sockaddr*)&bind_addr, flags);
+ if (err)
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_error_close);
+ throw emu_fatalerror("uv_tcp_bind() failed: %s", uv_strerror(err));
+ }
+
+ err = uv_listen((uv_stream_t*)m_uv_handle, backlog, (uv_connection_cb)on_connection);
+ if (err)
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_error_close);
+ throw emu_fatalerror("uv_listen() failed: %s", uv_strerror(err));
+ }
+
+ // Set local address.
+ if (!set_local_address())
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_error_close);
+ throw emu_fatalerror("error setting local IP and port");
+ }
+}
+
+tcp_server::~tcp_server()
+{
+ if (m_uv_handle)
+ delete m_uv_handle;
+}
+
+void tcp_server::close()
+{
+ if (m_is_closing)
+ return;
+
+ m_is_closing = true;
+
+ // If there are no connections then close now.
+ if (m_connections.empty())
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+ }
+ // Otherwise close all the connections (but not the TCP server).
+ else
+ {
+ osd_printf_info("closing %d active connections", (int)m_connections.size());
+
+ for (auto it = m_connections.begin(); it != m_connections.end(); ++it)
+ {
+ tcp_connection* connection = *it;
+ connection->close();
+ }
+ }
+}
+
+void tcp_server::terminate()
+{
+ if (m_is_closing)
+ return;
+
+ m_is_closing = true;
+
+ // If there are no connections then close now.
+ if (m_connections.empty())
+ {
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+ }
+ // Otherwise close all the connections (but not the TCP server).
+ else
+ {
+ osd_printf_info("closing %d active connections", (int)m_connections.size());
+
+ for (auto it = m_connections.begin(); it != m_connections.end(); ++it)
+ {
+ tcp_connection* connection = *it;
+ connection->terminate();
+ }
+ }
+}
+
+void tcp_server::send_to_all(const uint8_t* data, size_t len)
+{
+ // If there are no connections then close now.
+ if (!m_connections.empty())
+ {
+ for (auto it = m_connections.begin(); it != m_connections.end(); ++it)
+ {
+ tcp_connection* connection = *it;
+ connection->write(data, len);
+ }
+ }
+}
+
+void tcp_server::dump()
+{
+ osd_printf_info("[TCP, local:%s :%d, status:%s, connections:%d]",
+ m_local_ip.c_str(), (uint16_t)m_local_port,
+ (!m_is_closing) ? "open" : "closed",
+ (int)m_connections.size());
+}
+
+const sockaddr* tcp_server::get_local_address()
+{
+ return (const struct sockaddr*)&m_local_addr;
+}
+
+const std::string& tcp_server::get_local_ip()
+{
+ return m_local_ip;
+}
+
+uint16_t tcp_server::get_local_port()
+{
+ return m_local_port;
+}
+
+bool tcp_server::set_local_address()
+{
+ int err;
+ int len = sizeof(m_local_addr);
+
+ err = uv_tcp_getsockname(m_uv_handle, (struct sockaddr*)&m_local_addr, &len);
+ if (err)
+ {
+ osd_printf_error("uv_tcp_getsockname() failed: %s", uv_strerror(err));
+
+ return false;
+ }
+
+ int family;
+ GetAddressInfo((const struct sockaddr*)&m_local_addr, &family, m_local_ip, &m_local_port);
+
+ return true;
+}
+
+inline void tcp_server::on_uv_connection(int status)
+{
+ if (m_is_closing)
+ return;
+
+ int err;
+
+ if (status)
+ {
+ osd_printf_error("error while receiving a new TCP connection: %s", uv_strerror(status));
+
+ return;
+ }
+
+ // Notify the subclass so it provides an allocated derived class of TCPConnection.
+ tcp_connection* connection = nullptr;
+ user_on_tcp_connection_alloc(&connection);
+ if (connection != nullptr)
+ osd_printf_error("tcp_server pointer was not allocated by the user");
+
+ try
+ {
+ connection->setup(m_loop, this, &(m_local_addr), m_local_ip, m_local_port);
+ }
+ catch (...)
+ {
+ delete connection;
+ return;
+ }
+
+ // Accept the connection.
+ err = uv_accept((uv_stream_t*)m_uv_handle, (uv_stream_t*)connection->get_uv_handle());
+ if (err)
+ throw emu_fatalerror("uv_accept() failed: %s", uv_strerror(err));
+
+ // Insert the TCPConnection in the set.
+ m_connections.insert(connection);
+
+ // Start receiving data.
+ try
+ {
+ connection->start();
+ }
+ catch (emu_exception &error)
+ {
+ osd_printf_error("cannot run the TCP connection, closing the connection: %s", error.what());
+ connection->close();
+ // NOTE: Don't return here so the user won't be notified about a "onclose" for a TCP connection
+ // for which there was not a previous "onnew" event.
+ }
+
+ osd_printf_info("new TCP connection:");
+ connection->dump();
+
+ // Notify the subclass.
+ user_on_new_tcp_connection(connection);
+}
+
+void tcp_server::on_uv_closed()
+{
+ // Motify the subclass.
+ user_on_tcp_server_closed();
+}
+
+void tcp_server::on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer)
+{
+ // NOTE:
+ // Worst scenario is that in which this is the latest connection,
+ // which is remotely closed (no tcp_server.Close() was called) and the user
+ // call tcp_server.Close() on userOnTCPConnectionClosed() callback, so Close()
+ // is called with zero connections and calls uv_close(), but then
+ // onTCPConnectionClosed() continues and finds that isClosing is true and
+ // there are zero connections, so calls uv_close() again and get a crash.
+ //
+ // SOLUTION:
+ // Check isClosing value *before* onTCPConnectionClosed() callback.
+
+ bool wasClosing = m_is_closing;
+
+ osd_printf_info("TCP connection closed:");
+ connection->dump();
+
+ // Remove the TCPConnection from the set.
+ m_connections.erase(connection);
+
+ // Notify the subclass.
+ user_on_tcp_connection_closed(connection, is_closed_by_peer);
+
+ // Check if the server was closing connections, and if this is the last
+ // connection then close the server now.
+ if (wasClosing && m_connections.empty())
+ uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close);
+}
diff --git a/src/osd/modules/ipc/tcp_server.h b/src/osd/modules/ipc/tcp_server.h
new file mode 100644
index 00000000000..3a4c75de2d7
--- /dev/null
+++ b/src/osd/modules/ipc/tcp_server.h
@@ -0,0 +1,72 @@
+// license:BSD-3-Clause
+// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic
+
+#ifndef TCP_SERVER_H
+#define TCP_SERVER_H
+
+#include "tcp_connection.h"
+#include <string>
+#include <unordered_set>
+#include <uv.h>
+
+class tcp_server : public tcp_connection::listener
+{
+public:
+ tcp_server(uv_loop_t* m_loop, const std::string &ip, uint16_t port, int backlog);
+ virtual ~tcp_server();
+
+ void close();
+ void terminate();
+ virtual void dump();
+ void send_to_all(const uint8_t* data, size_t len);
+ bool is_closing();
+ const struct sockaddr* get_local_address();
+ const std::string& get_local_ip();
+ uint16_t get_local_port();
+ size_t get_num_connections();
+
+private:
+ bool set_local_address();
+
+ /* Pure virtual methods that must be implemented by the subclass. */
+protected:
+ virtual void user_on_tcp_connection_alloc(tcp_connection** connection) = 0;
+ virtual void user_on_new_tcp_connection(tcp_connection* connection) = 0;
+ virtual void user_on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer) = 0;
+ virtual void user_on_tcp_server_closed() = 0;
+
+ /* Callbacks fired by UV events. */
+public:
+ void on_uv_connection(int status);
+ void on_uv_closed();
+
+ /* Methods inherited from tcp_connection::listener. */
+ virtual void on_tcp_connection_closed(tcp_connection* connection, bool is_closed_by_peer) override;
+
+private:
+ // Allocated by this (may be passed by argument).
+ uv_tcp_t* m_uv_handle;
+ uv_loop_t* m_loop;
+ // Others.
+ std::unordered_set<tcp_connection*> m_connections;
+ bool m_is_closing;
+
+protected:
+ struct sockaddr_storage m_local_addr;
+ std::string m_local_ip;
+ uint16_t m_local_port;
+};
+
+/* Inline methods. */
+
+inline bool tcp_server::is_closing()
+{
+ return m_is_closing;
+}
+
+inline size_t tcp_server::get_num_connections()
+{
+ return m_connections.size();
+}
+
+#endif
diff --git a/src/osd/modules/lib/osdlib.h b/src/osd/modules/lib/osdlib.h
index 484633f137b..dcba7a6bc81 100644
--- a/src/osd/modules/lib/osdlib.h
+++ b/src/osd/modules/lib/osdlib.h
@@ -61,4 +61,14 @@ void osd_process_kill(void);
int osd_setenv(const char *name, const char *value, int overwrite);
+/*-----------------------------------------------------------------------------
+ osd_get_clipboard_text: retrieves text from the clipboard
+
+ Return value:
+
+ the returned string needs to be osd_free()-ed!
+
+-----------------------------------------------------------------------------*/
+char *osd_get_clipboard_text(void);
+
#endif /* __OSDLIB__ */
diff --git a/src/osd/modules/lib/osdlib_macosx.cpp b/src/osd/modules/lib/osdlib_macosx.cpp
index 34837e8aae4..4d1f839cabd 100644
--- a/src/osd/modules/lib/osdlib_macosx.cpp
+++ b/src/osd/modules/lib/osdlib_macosx.cpp
@@ -14,6 +14,10 @@
#include <sys/types.h>
#include <signal.h>
+#include <mach/mach.h>
+#include <mach/mach_time.h>
+#include <Carbon/Carbon.h>
+
// MAME headers
#include "osdcore.h"
#include "osdlib.h"
@@ -136,3 +140,82 @@ void osd_break_into_debugger(const char *message)
printf("Ignoring MAME exception: %s\n", message);
#endif
}
+
+
+//============================================================
+// osd_get_clipboard_text
+//============================================================
+
+char *osd_get_clipboard_text(void)
+{
+ OSStatus err;
+
+ PasteboardRef pasteboard_ref;
+ err = PasteboardCreate(kPasteboardClipboard, &pasteboard_ref);
+ if (err)
+ return NULL;
+
+ PasteboardSynchronize(pasteboard_ref);
+
+ ItemCount item_count;
+ err = PasteboardGetItemCount(pasteboard_ref, &item_count);
+
+ char *result = NULL; // core expects a malloced C string of uft8 data
+ for (UInt32 item_index = 1; (item_index <= item_count) && !result; item_index++)
+ {
+ PasteboardItemID item_id;
+ err = PasteboardGetItemIdentifier(pasteboard_ref, item_index, &item_id);
+ if (err)
+ continue;
+
+ CFArrayRef flavor_type_array;
+ err = PasteboardCopyItemFlavors(pasteboard_ref, item_id, &flavor_type_array);
+ if (err)
+ continue;
+
+ CFIndex const flavor_count = CFArrayGetCount(flavor_type_array);
+ for (CFIndex flavor_index = 0; (flavor_index < flavor_count) && !result; flavor_index++)
+ {
+ CFStringRef const flavor_type = (CFStringRef)CFArrayGetValueAtIndex(flavor_type_array, flavor_index);
+
+ CFStringEncoding encoding;
+ if (UTTypeConformsTo(flavor_type, kUTTypeUTF16PlainText))
+ encoding = kCFStringEncodingUTF16;
+ else if (UTTypeConformsTo (flavor_type, kUTTypeUTF8PlainText))
+ encoding = kCFStringEncodingUTF8;
+ else if (UTTypeConformsTo (flavor_type, kUTTypePlainText))
+ encoding = kCFStringEncodingMacRoman;
+ else
+ continue;
+
+ CFDataRef flavor_data;
+ err = PasteboardCopyItemFlavorData(pasteboard_ref, item_id, flavor_type, &flavor_data);
+
+ if (!err)
+ {
+ CFStringRef string_ref = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, flavor_data, encoding);
+ CFDataRef data_ref = CFStringCreateExternalRepresentation (kCFAllocatorDefault, string_ref, kCFStringEncodingUTF8, '?');
+ CFRelease(string_ref);
+ CFRelease(flavor_data);
+
+ CFIndex const length = CFDataGetLength(data_ref);
+ CFRange const range = CFRangeMake(0, length);
+
+ result = reinterpret_cast<char *>(osd_malloc_array(length + 1));
+ if (result)
+ {
+ CFDataGetBytes(data_ref, range, reinterpret_cast<unsigned char *>(result));
+ result[length] = 0;
+ }
+
+ CFRelease(data_ref);
+ }
+ }
+
+ CFRelease(flavor_type_array);
+ }
+
+ CFRelease(pasteboard_ref);
+
+ return result;
+}
diff --git a/src/osd/modules/lib/osdlib_unix.cpp b/src/osd/modules/lib/osdlib_unix.cpp
index fd60db54ba9..3b67e4a2f3a 100644
--- a/src/osd/modules/lib/osdlib_unix.cpp
+++ b/src/osd/modules/lib/osdlib_unix.cpp
@@ -18,6 +18,7 @@
#include "osdcore.h"
#include "osdlib.h"
+#include "sdlinc.h"
//============================================================
// osd_getenv
//============================================================
@@ -132,3 +133,29 @@ void osd_break_into_debugger(const char *message)
printf("Ignoring MAME exception: %s\n", message);
#endif
}
+
+#ifdef SDLMAME_ANDROID
+char *osd_get_clipboard_text(void)
+{
+ return nullptr;
+}
+#else
+//============================================================
+// osd_get_clipboard_text
+//============================================================
+
+char *osd_get_clipboard_text(void)
+{
+ char *result = NULL;
+
+ if (SDL_HasClipboardText())
+ {
+ char *temp = SDL_GetClipboardText();
+ result = (char *) osd_malloc_array(strlen(temp) + 1);
+ strcpy(result, temp);
+ SDL_free(temp);
+ }
+ return result;
+}
+
+#endif
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index 572774d6c4c..c5792f0307d 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -21,6 +21,7 @@
#include "osdlib.h"
#include "osdcomm.h"
#include "osdcore.h"
+#include "strconv.h"
#ifdef OSD_WINDOWS
#include "winutf8.h"
@@ -240,3 +241,76 @@ void osd_break_into_debugger(const char *message)
}
#endif
}
+
+//============================================================
+// get_clipboard_text_by_format
+//============================================================
+
+static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID data))
+{
+ char *result = NULL;
+ HANDLE data_handle;
+ LPVOID data;
+
+ // check to see if this format is available
+ if (IsClipboardFormatAvailable(format))
+ {
+ // open the clipboard
+ if (OpenClipboard(NULL))
+ {
+ // try to access clipboard data
+ data_handle = GetClipboardData(format);
+ if (data_handle != NULL)
+ {
+ // lock the data
+ data = GlobalLock(data_handle);
+ if (data != NULL)
+ {
+ // invoke the convert
+ result = (*convert)(data);
+
+ // unlock the data
+ GlobalUnlock(data_handle);
+ }
+ }
+
+ // close out the clipboard
+ CloseClipboard();
+ }
+ }
+ return result;
+}
+
+//============================================================
+// convert_wide
+//============================================================
+
+static char *convert_wide(LPCVOID data)
+{
+ return utf8_from_wstring((LPCWSTR) data);
+}
+
+//============================================================
+// convert_ansi
+//============================================================
+
+static char *convert_ansi(LPCVOID data)
+{
+ return utf8_from_astring((LPCSTR) data);
+}
+
+//============================================================
+// osd_get_clipboard_text
+//============================================================
+
+char *osd_get_clipboard_text(void)
+{
+ // try to access unicode text
+ char *result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
+
+ // try to access ANSI text
+ if (result == nullptr)
+ result = get_clipboard_text_by_format(CF_TEXT, convert_ansi);
+
+ return result;
+}
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index a1ab9ab7677..32f1a6047ac 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -25,6 +25,9 @@ const options_entry osd_options::s_option_entries[] =
{ nullptr, nullptr, OPTION_HEADER, "OSD FONT OPTIONS" },
{ OSD_FONT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for ui font: " },
+ { nullptr, nullptr, OPTION_HEADER, "OSD OUTPUT OPTIONS" },
+ { OSD_OUTPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for output: " },
+
{ nullptr, nullptr, OPTION_HEADER, "OSD INPUT OPTIONS" },
{ OSD_KEYBOARDINPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for keyboard input: " },
{ OSD_MOUSEINPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for mouse input: " },
@@ -171,7 +174,8 @@ osd_common_t::osd_common_t(osd_options &options)
m_keyboard_input(nullptr),
m_mouse_input(nullptr),
m_lightgun_input(nullptr),
- m_joystick_input(nullptr)
+ m_joystick_input(nullptr),
+ m_output(nullptr)
{
osd_output::push(this);
}
@@ -198,11 +202,11 @@ void osd_common_t::register_options()
REGISTER_MODULE(m_mod_man, FONT_SDL);
REGISTER_MODULE(m_mod_man, FONT_NONE);
+ REGISTER_MODULE(m_mod_man, SOUND_XAUDIO2);
REGISTER_MODULE(m_mod_man, SOUND_DSOUND);
REGISTER_MODULE(m_mod_man, SOUND_COREAUDIO);
REGISTER_MODULE(m_mod_man, SOUND_JS);
REGISTER_MODULE(m_mod_man, SOUND_SDL);
- REGISTER_MODULE(m_mod_man, SOUND_XAUDIO2);
REGISTER_MODULE(m_mod_man, SOUND_NONE);
#ifdef SDLMAME_MACOSX
@@ -241,10 +245,16 @@ void osd_common_t::register_options()
REGISTER_MODULE(m_mod_man, LIGHTGUN_NONE);
REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_SDL);
+ REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_WINHYBRID);
REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_DINPUT);
REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_XINPUT);
REGISTER_MODULE(m_mod_man, JOYSTICK_NONE);
+ REGISTER_MODULE(m_mod_man, OUTPUT_NONE);
+ REGISTER_MODULE(m_mod_man, OUTPUT_CONSOLE);
+ REGISTER_MODULE(m_mod_man, OUTPUT_NETWORK);
+
+
// after initialization we know which modules are supported
const char *names[20];
@@ -301,8 +311,17 @@ void osd_common_t::register_options()
dnames.push_back(names[i]);
update_option(OSD_DEBUG_PROVIDER, dnames);
+ m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, &num, names);
+ dnames.clear();
+ for (int i = 0; i < num; i++)
+ dnames.push_back(names[i]);
+ update_option(OSD_OUTPUT_PROVIDER, dnames);
+
// Register video options and update options
video_options_add("none", nullptr);
+#if USE_OPENGL
+ video_options_add("opengl", nullptr);
+#endif
video_register();
update_option(OSDOPTION_VIDEO, m_video_names);
}
@@ -518,9 +537,9 @@ void osd_common_t::customize_input_type_list(simple_list<input_type_entry> &type
// list of OS-dependent slider values.
//-------------------------------------------------
-slider_state* osd_common_t::get_slider_list()
+std::vector<ui_menu_item> osd_common_t::get_slider_list()
{
- return nullptr;
+ return m_sliders;
}
//-------------------------------------------------
@@ -561,6 +580,12 @@ bool osd_common_t::execute_command(const char *command)
}
+static void output_notifier_callback(const char *outname, INT32 value, void *param)
+{
+ osd_common_t *osd = (osd_common_t*)param;
+ osd->notify(outname, value);
+}
+
void osd_common_t::init_subsystems()
{
if (!video_init())
@@ -572,8 +597,6 @@ void osd_common_t::init_subsystems()
exit(-1);
}
- output_init();
-
m_keyboard_input = select_module_options<input_module *>(options(), OSD_KEYBOARDINPUT_PROVIDER);
m_mouse_input = select_module_options<input_module *>(options(), OSD_MOUSEINPUT_PROVIDER);
m_lightgun_input = select_module_options<input_module *>(options(), OSD_LIGHTGUNINPUT_PROVIDER);
@@ -590,6 +613,9 @@ void osd_common_t::init_subsystems()
m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);
+ m_output = select_module_options<output_module *>(options(), OSD_OUTPUT_PROVIDER);
+ machine().output().set_notifier(NULL, output_notifier_callback, this);
+
m_mod_man.init(options());
input_init();
@@ -642,16 +668,10 @@ void osd_common_t::input_resume()
m_joystick_input->resume();
}
-bool osd_common_t::output_init()
-{
- return true;
-}
-
void osd_common_t::exit_subsystems()
{
video_exit();
input_exit();
- output_exit();
}
void osd_common_t::video_exit()
@@ -670,10 +690,6 @@ void osd_common_t::input_exit()
m_joystick_input->exit();
}
-void osd_common_t::output_exit()
-{
-}
-
void osd_common_t::osd_exit()
{
m_mod_man.exit();
diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h
index 0230cfe090d..cd83ba61e7b 100644
--- a/src/osd/modules/lib/osdobj_common.h
+++ b/src/osd/modules/lib/osdobj_common.h
@@ -21,8 +21,11 @@
#include "modules/debugger/debug_module.h"
#include "modules/netdev/netdev_module.h"
#include "modules/midi/midi_module.h"
+#include "modules/output/output_module.h"
#include "cliopts.h"
+class ui_menu_item;
+
//============================================================
// Defines
//============================================================
@@ -188,7 +191,7 @@ public:
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override;
// video overridables
- virtual slider_state *get_slider_list() override;
+ virtual std::vector<ui_menu_item> get_slider_list() override;
// command option overrides
virtual bool execute_command(const char *command) override;
@@ -213,13 +216,11 @@ public:
virtual bool window_init();
virtual void input_resume();
- virtual bool output_init();
virtual void exit_subsystems();
virtual void video_exit();
virtual void window_exit();
virtual void input_exit();
- virtual void output_exit();
virtual void osd_exit();
@@ -232,6 +233,7 @@ public:
bool verbose() const { return m_print_verbose; }
void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; }
+ void notify(const char *outname, INT32 value) { m_output->notify(outname, value); }
protected:
virtual bool input_init();
virtual void input_pause();
@@ -278,6 +280,9 @@ protected:
input_module* m_mouse_input;
input_module* m_lightgun_input;
input_module* m_joystick_input;
+ output_module* m_output;
+ std::vector<ui_menu_item> m_sliders;
+
private:
std::vector<const char *> m_video_names;
};
diff --git a/src/osd/modules/opengl/gl_shader_mgr.h b/src/osd/modules/opengl/gl_shader_mgr.h
index 69400d90dc2..532d40c30fe 100644
--- a/src/osd/modules/opengl/gl_shader_mgr.h
+++ b/src/osd/modules/opengl/gl_shader_mgr.h
@@ -4,6 +4,8 @@
#ifndef GL_SHADER_MGR_H
#define GL_SHADER_MGR_H
+#include "osd_opengl.h"
+
// #define GLSL_SOURCE_ON_DISK 1
enum GLSL_SHADER_FEATURE {
diff --git a/src/osd/modules/osdwindow.cpp b/src/osd/modules/osdwindow.cpp
index 2894092ac30..cde83c3fe7f 100644
--- a/src/osd/modules/osdwindow.cpp
+++ b/src/osd/modules/osdwindow.cpp
@@ -6,14 +6,6 @@
//
//============================================================
-// standard windows headers
-#ifdef OSD_WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <windowsx.h>
-#include <mmsystem.h>
-#endif
-
#include "osdwindow.h"
#include "render/drawnone.h"
diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h
index 47e9d7bd527..60d2cccc700 100644
--- a/src/osd/modules/osdwindow.h
+++ b/src/osd/modules/osdwindow.h
@@ -11,11 +11,20 @@
#include "emu.h"
#include "ui/ui.h"
+#include "ui/menu.h"
#include "osdhelper.h"
+// standard windows headers
+#ifdef OSD_WINDOWS
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <windowsx.h>
+#include <mmsystem.h>
+#endif
+
#ifdef OSD_SDL
-// standard SDL headers
-#include "sdlinc.h"
+// forward declaration
+struct SDL_Window;
#endif
//============================================================
@@ -120,13 +129,23 @@ public:
float pixel_aspect() const { return monitor()->pixel_aspect(); }
+ bool swap_xy()
+ {
+ bool orientation_swap_xy =
+ (machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
+ bool rotation_swap_xy =
+ (target()->orientation() & ROT90) == ROT90 ||
+ (target()->orientation() & ROT270) == ROT270;
+ return orientation_swap_xy ^ rotation_swap_xy;
+ };
+
virtual osd_dim get_size() = 0;
-#ifdef OSD_SDL
virtual osd_monitor_info *monitor() const = 0;
+
+#ifdef OSD_SDL
virtual SDL_Window *sdl_window() = 0;
#else
- virtual osd_monitor_info *monitor() const = 0;
virtual bool win_has_menu() = 0;
// FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ?
virtual osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed) = 0;
@@ -179,21 +198,23 @@ public:
virtual int create() = 0;
virtual render_primitive_list *get_primitives() = 0;
- virtual slider_state* get_slider_list() { return nullptr; }
+ virtual std::vector<ui_menu_item> get_slider_list() { return m_sliders; }
virtual int draw(const int update) = 0;
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) { return 0; };
virtual void save() { };
virtual void record() { };
virtual void toggle_fsfx() { };
virtual bool sliders_dirty() { return m_sliders_dirty; }
- virtual bool multi_window_sliders() { return false; }
static osd_renderer* make_for_type(int mode, osd_window *window, int extra_flags = FLAG_NONE);
protected:
+ virtual void build_slider_list() { }
+
/* Internal flags */
static const int FI_CHANGED = 0x010000;
- bool m_sliders_dirty;
+ bool m_sliders_dirty;
+ std::vector<ui_menu_item> m_sliders;
private:
osd_window *m_window;
@@ -201,4 +222,81 @@ private:
};
+
+//============================================================
+// CONSTANTS
+//============================================================
+
+#define MAX_VIDEO_WINDOWS (4)
+
+#define VIDEO_SCALE_MODE_NONE (0)
+
+#define GLSL_SHADER_MAX 10
+
+
+//============================================================
+// TYPE DEFINITIONS
+//============================================================
+
+struct osd_video_config
+{
+ // global configuration
+ int windowed; // start windowed?
+ int prescale; // prescale factor
+ int keepaspect; // keep aspect ratio
+ int numscreens; // number of screens
+ int fullstretch; // fractional stretch
+
+ // hardware options
+ int mode; // output mode
+ int waitvsync; // spin until vsync
+ int syncrefresh; // sync only to refresh rate
+ int switchres; // switch resolutions
+
+ // d3d, accel, opengl
+ int filter; // enable filtering
+ //int filter; // enable filtering, disabled if glsl_filter>0
+
+ // OpenGL options
+ int glsl;
+ int glsl_filter; // glsl filtering, >0 disables filter
+ char * glsl_shader_mamebm[GLSL_SHADER_MAX]; // custom glsl shader set, mame bitmap
+ int glsl_shader_mamebm_num; // custom glsl shader set number, mame bitmap
+ char * glsl_shader_scrn[GLSL_SHADER_MAX]; // custom glsl shader set, screen bitmap
+ int glsl_shader_scrn_num; // custom glsl shader number, screen bitmap
+ int pbo;
+ int vbo;
+ int allowtexturerect; // allow GL_ARB_texture_rectangle, default: no
+ int forcepow2texture; // force power of two textures, default: no
+
+ // dd, d3d
+ int triplebuf; // triple buffer
+
+ //============================================================
+ // SDL - options
+ //============================================================
+ int novideo; // don't draw, for pure CPU benchmarking
+
+ int centerh;
+ int centerv;
+
+ // vector options
+ float beamwidth; // beam width
+
+ // perftest
+ int perftest; // print out real video fps
+
+ // X11 options
+ int restrictonemonitor; // in fullscreen, confine to Xinerama monitor 0
+
+ // YUV options
+ int scale_mode;
+};
+
+//============================================================
+// GLOBAL VARIABLES
+//============================================================
+
+extern osd_video_config video_config;
+
#endif /* __OSDWINDOW__ */
diff --git a/src/osd/modules/output/console.cpp b/src/osd/modules/output/console.cpp
new file mode 100644
index 00000000000..753164171ee
--- /dev/null
+++ b/src/osd/modules/output/console.cpp
@@ -0,0 +1,32 @@
+// license:BSD-3-Clause
+// copyright-holders:Miodrag Milanovic
+/***************************************************************************
+
+ console.cpp
+
+ Console output interface.
+
+*******************************************************************c********/
+
+#include "output_module.h"
+#include "modules/osdmodule.h"
+
+class output_console : public osd_module, public output_module
+{
+public:
+ output_console()
+ : osd_module(OSD_OUTPUT_PROVIDER, "console"), output_module()
+ {
+ }
+ virtual ~output_console() { }
+
+ virtual int init(const osd_options &options) override { return 0; }
+ virtual void exit() override { }
+
+ // output_module
+
+ virtual void notify(const char *outname, INT32 value) override { osd_printf_info("%s = %d\n", ((outname==nullptr) ? "none" : outname), value); }
+
+};
+
+MODULE_DEFINITION(OUTPUT_CONSOLE, output_console)
diff --git a/src/osd/modules/output/network.cpp b/src/osd/modules/output/network.cpp
new file mode 100644
index 00000000000..3bca29f3dbb
--- /dev/null
+++ b/src/osd/modules/output/network.cpp
@@ -0,0 +1,86 @@
+// license:BSD-3-Clause
+// copyright-holders:Miodrag Milanovic
+/***************************************************************************
+
+ network.cpp
+
+ Network output interface.
+
+*******************************************************************c********/
+
+#include "output_module.h"
+#include "modules/osdmodule.h"
+#include "modules/ipc/raw_tcp_server.h"
+#include "modules/ipc/raw_tcp_connection.h"
+#include <uv.h>
+
+#include <mutex>
+#include <thread>
+
+class output_network_server :
+ public raw_tcp_server::listener,
+ public raw_tcp_connection::listener
+{
+
+public:
+ output_network_server(uv_loop_t* loop) { m_tcp_server = new raw_tcp_server(loop, "0.0.0.0", 8000, 256, this, this); }
+
+ virtual ~output_network_server() { delete m_tcp_server; }
+
+ void terminate_all() { m_tcp_server->terminate(); }
+ void send_to_all(const uint8_t* data, size_t len) { m_tcp_server->send_to_all(data,len); }
+
+ /* Pure virtual methods inherited from raw_tcp_server::listener. */
+ virtual void on_raw_tcp_connection_closed(raw_tcp_server* tcpServer, raw_tcp_connection* connection, bool is_closed_by_peer) override { }
+ /* Pure virtual methods inherited from raw_tcp_connection::listener. */
+ virtual void on_data_recv(raw_tcp_connection *connection, const uint8_t* data, size_t len) override { }
+private:
+ raw_tcp_server* m_tcp_server;
+};
+
+class output_network : public osd_module, public output_module
+{
+public:
+ output_network()
+ : osd_module(OSD_OUTPUT_PROVIDER, "network"), output_module(), m_loop(nullptr), m_server(nullptr)
+{
+ }
+ virtual ~output_network() {
+ }
+
+ virtual int init(const osd_options &options) override {
+ m_loop = new uv_loop_t;
+ int err = uv_loop_init(m_loop);
+ if (err) {
+ return 1;
+ }
+ m_working_thread = std::thread([](output_network* self) { self->process_output(); }, this);
+ return 0;
+ }
+
+ virtual void exit() override {
+ m_server->terminate_all();
+ m_working_thread.join();
+ uv_loop_close(m_loop);
+ delete m_loop;
+ delete m_server;
+ }
+
+ // output_module
+
+ virtual void notify(const char *outname, INT32 value) override { m_server->send_to_all((const uint8_t*)outname, strlen(outname)); }
+
+ // implementation
+ void process_output()
+ {
+ m_server = new output_network_server(m_loop);
+ uv_run(m_loop, UV_RUN_DEFAULT);
+ }
+
+private:
+ std::thread m_working_thread;
+ uv_loop_t* m_loop;
+ output_network_server *m_server;
+};
+
+MODULE_DEFINITION(OUTPUT_NETWORK, output_network)
diff --git a/src/osd/modules/output/none.cpp b/src/osd/modules/output/none.cpp
new file mode 100644
index 00000000000..1adf6279ce0
--- /dev/null
+++ b/src/osd/modules/output/none.cpp
@@ -0,0 +1,32 @@
+// license:BSD-3-Clause
+// copyright-holders:Miodrag Milanovic
+/***************************************************************************
+
+ none.cpp
+
+ Dummy output interface.
+
+*******************************************************************c********/
+
+#include "output_module.h"
+#include "modules/osdmodule.h"
+
+class output_none : public osd_module, public output_module
+{
+public:
+ output_none()
+ : osd_module(OSD_OUTPUT_PROVIDER, "none"), output_module()
+ {
+ }
+ virtual ~output_none() { }
+
+ virtual int init(const osd_options &options) override { return 0; }
+ virtual void exit() override { }
+
+ // output_module
+
+ virtual void notify(const char *outname, INT32 value) override { }
+
+};
+
+MODULE_DEFINITION(OUTPUT_NONE, output_none)
diff --git a/src/osd/modules/output/output_module.h b/src/osd/modules/output/output_module.h
new file mode 100644
index 00000000000..81fcaae2cce
--- /dev/null
+++ b/src/osd/modules/output/output_module.h
@@ -0,0 +1,30 @@
+// license:BSD-3-Clause
+// copyright-holders:Miodrag Milanovic
+/*
+ * outpout_module.h
+ *
+ */
+
+#ifndef OUTPUT_MODULE_H_
+#define OUTPUT_MODULE_H_
+
+#include "osdepend.h"
+#include "modules/osdmodule.h"
+
+//============================================================
+// CONSTANTS
+//============================================================
+
+#define OSD_OUTPUT_PROVIDER "output"
+
+class output_module
+{
+public:
+ output_module() { }
+
+ virtual ~output_module() { }
+
+ virtual void notify(const char *outname, INT32 value) = 0;
+};
+
+#endif /* OUTPUT_MODULE_H_ */
diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp
index 64e5d36f5ca..3cc6e022573 100644
--- a/src/osd/modules/render/bgfx/chain.cpp
+++ b/src/osd/modules/render/bgfx/chain.cpp
@@ -14,18 +14,23 @@
#include "parameter.h"
#include "entryuniform.h"
#include "texturemanager.h"
+#include "targetmanager.h"
+#include "target.h"
#include "vertex.h"
-#include "window.h"
+#include "modules/osdwindow.h"
#include "chain.h"
-bgfx_chain::bgfx_chain(std::string name, std::string author, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries)
+bgfx_chain::bgfx_chain(std::string name, std::string author, target_manager& targets, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries, std::vector<bgfx_target*> target_list, std::uint32_t screen_index)
: m_name(name)
, m_author(author)
+ , m_targets(targets)
, m_sliders(sliders)
, m_params(params)
, m_entries(entries)
+ , m_target_list(target_list)
, m_current_time(0)
+ , m_screen_index(screen_index)
{
for (bgfx_slider* slider : m_sliders)
{
@@ -47,6 +52,10 @@ bgfx_chain::~bgfx_chain()
{
delete entry;
}
+ for (bgfx_target* target : m_target_list)
+ {
+ m_targets.destroy_target(target->name(), m_screen_index);
+ }
}
void bgfx_chain::process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window& window, uint64_t blend)
diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h
index 9cc300d56a6..bc68d4d5af2 100644
--- a/src/osd/modules/render/bgfx/chain.h
+++ b/src/osd/modules/render/bgfx/chain.h
@@ -21,12 +21,14 @@ class render_primitive;
class bgfx_slider;
class bgfx_parameter;
class texture_manager;
+class target_manager;
+class bgfx_target;
class osd_window;
class bgfx_chain
{
public:
- bgfx_chain(std::string name, std::string author, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries);
+ bgfx_chain(std::string name, std::string author, target_manager& targets, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries, std::vector<bgfx_target*> target_list, uint32_t screen_index);
~bgfx_chain();
void process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window &window, uint64_t blend = 0L);
@@ -38,11 +40,14 @@ public:
private:
std::string m_name;
std::string m_author;
+ target_manager& m_targets;
std::vector<bgfx_slider*> m_sliders;
std::vector<bgfx_parameter*> m_params;
std::vector<bgfx_chain_entry*> m_entries;
+ std::vector<bgfx_target*> m_target_list;
std::map<std::string, bgfx_slider*> m_slider_map;
int64_t m_current_time;
+ uint32_t m_screen_index;
};
#endif // __DRAWBGFX_CHAIN__
diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp
index b8e47eea624..a5f091a554b 100644
--- a/src/osd/modules/render/bgfx/chainentry.cpp
+++ b/src/osd/modules/render/bgfx/chainentry.cpp
@@ -24,6 +24,9 @@
#include "vertex.h"
#include "suppressor.h"
+#include "render.h"
+
+
bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output)
: m_name(name)
, m_effect(effect)
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index 25ff6ce3a6e..5eaf6fc1378 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -10,6 +10,11 @@
//============================================================
#include "emu.h"
+#include "ui/ui.h"
+#include "ui/menu.h"
+
+#include "osdcore.h"
+#include "modules/osdwindow.h"
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
@@ -17,27 +22,76 @@
#include <bx/readerwriter.h>
#include <bx/crtimpl.h>
+#include "bgfxutil.h"
+
#include "chainmanager.h"
#include "chainreader.h"
#include "chain.h"
+#include "texture.h"
+#include "target.h"
+#include "slider.h"
+
+#include "sliderdirtynotifier.h"
+
using namespace rapidjson;
+const uint32_t chain_manager::CHAIN_NONE = 0;
+
+chain_manager::chain_manager(running_machine& machine, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t window_index, slider_dirty_notifier& slider_notifier)
+ : m_machine(machine)
+ , m_options(options)
+ , m_textures(textures)
+ , m_targets(targets)
+ , m_effects(effects)
+ , m_window_index(window_index)
+ , m_slider_notifier(slider_notifier)
+ , m_screen_count(0)
+{
+ find_available_chains(options.bgfx_path());
+ parse_chain_selections(options.bgfx_screen_chains());
+}
+
chain_manager::~chain_manager()
{
- for (bgfx_chain* chain : m_chains)
- {
- delete chain;
- }
- m_chains.clear();
+ destroy_chains();
}
-bgfx_chain* chain_manager::chain(std::string name, running_machine& machine, uint32_t window_index, uint32_t screen_index)
+void chain_manager::find_available_chains(std::string path)
{
- return load_chain(name, machine, window_index, screen_index);
+ m_available_chains.clear();
+ m_available_chains.push_back("none");
+
+ osd_directory *directory = osd_opendir((path + "/chains").c_str());
+ if (directory != nullptr)
+ {
+ for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory))
+ {
+ if (entry->type == ENTTYPE_FILE)
+ {
+ std::string name(entry->name);
+ std::string extension(".json");
+
+ // Does the name has at least one character in addition to ".json"?
+ if (name.length() > extension.length())
+ {
+ size_t start = name.length() - extension.length();
+ std::string test_segment = name.substr(start, extension.length());
+
+ // Does it end in .json?
+ if (test_segment == extension)
+ {
+ m_available_chains.push_back(name.substr(0, start));
+ }
+ }
+ }
+ }
+
+ osd_closedir(directory);
+ }
}
-bgfx_chain* chain_manager::load_chain(std::string name, running_machine& machine, uint32_t window_index, uint32_t screen_index)
+bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index)
{
if (name.length() < 5 || (name.compare(name.length() - 5, 5, ".json")!= 0))
{
@@ -72,7 +126,7 @@ bgfx_chain* chain_manager::load_chain(std::string name, running_machine& machine
return nullptr;
}
- bgfx_chain* chain = chain_reader::read_from_value(document, name + ": ", m_options, machine, window_index, screen_index, m_textures, m_targets, m_effects);
+ bgfx_chain* chain = chain_reader::read_from_value(document, name + ": ", m_options, m_machine, m_window_index, screen_index, m_textures, m_targets, m_effects);
if (chain == nullptr)
{
@@ -80,7 +134,345 @@ bgfx_chain* chain_manager::load_chain(std::string name, running_machine& machine
return nullptr;
}
- m_chains.push_back(chain);
-
return chain;
}
+
+void chain_manager::parse_chain_selections(std::string chain_str)
+{
+ std::vector<std::string> chain_names = split_option_string(chain_str);
+
+ while (m_current_chain.size() != chain_names.size())
+ {
+ m_screen_chains.push_back(nullptr);
+ m_current_chain.push_back(CHAIN_NONE);
+ }
+
+ for (size_t index = 0; index < chain_names.size(); index++)
+ {
+ size_t chain_index = 0;
+ for (chain_index = 0; chain_index < m_available_chains.size(); chain_index++)
+ {
+ if (m_available_chains[chain_index] == chain_names[index])
+ {
+ break;
+ }
+ }
+
+ if (chain_index < m_available_chains.size())
+ {
+ m_current_chain[index] = chain_index;
+ }
+ else
+ {
+ m_current_chain[index] = CHAIN_NONE;
+ }
+ }
+}
+
+std::vector<std::string> chain_manager::split_option_string(std::string chain_str) const
+{
+ std::vector<std::string> chain_names;
+
+ uint32_t length = chain_str.length();
+ uint32_t win = 0;
+ uint32_t last_start = 0;
+ for (uint32_t i = 0; i < length + 1; i++)
+ {
+ if (i == length || chain_str[i] == ',' || chain_str[i] == ':')
+ {
+ if (win == m_window_index)
+ {
+ chain_names.push_back(chain_str.substr(last_start, i - last_start));
+ }
+ last_start = i + 1;
+ if (chain_str[i] == ':')
+ {
+ win++;
+ }
+ }
+ }
+
+ return chain_names;
+}
+
+void chain_manager::load_chains()
+{
+ for (size_t chain = 0; chain < m_current_chain.size() && chain < m_screen_chains.size(); chain++)
+ {
+ if (m_current_chain[chain] != CHAIN_NONE)
+ {
+ m_screen_chains[chain] = load_chain(m_available_chains[m_current_chain[chain]], uint32_t(chain));
+ }
+ }
+}
+
+void chain_manager::destroy_chains()
+{
+ for (size_t index = 0; index < m_screen_chains.size(); index++)
+ {
+ if (m_screen_chains[index] != nullptr)
+ {
+ delete m_screen_chains[index];
+ m_screen_chains[index] = nullptr;
+ }
+ }
+}
+
+void chain_manager::reload_chains()
+{
+ destroy_chains();
+ load_chains();
+}
+
+bgfx_chain* chain_manager::screen_chain(uint32_t screen)
+{
+ if (screen >= m_screen_chains.size())
+ {
+ return m_screen_chains[m_screen_chains.size() - 1];
+ }
+ else
+ {
+ return m_screen_chains[screen];
+ }
+}
+
+void chain_manager::process_screen_quad(uint32_t view, uint32_t screen, render_primitive* prim, osd_window &window)
+{
+ uint16_t tex_width(prim->texture.width);
+ uint16_t tex_height(prim->texture.height);
+
+ const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
+ tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
+
+ std::string full_name = "screen" + std::to_string(screen);
+ bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem);
+ m_textures.add_provider(full_name, texture);
+
+ m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST);
+
+ bgfx_chain* chain = screen_chain(screen);
+ chain->process(prim, view, screen, m_textures, window, bgfx_util::get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags)));
+ view += chain->applicable_passes();
+
+ m_textures.add_provider(full_name, nullptr);
+ delete texture;
+}
+
+std::vector<render_primitive*> chain_manager::count_screens(render_primitive* prim)
+{
+ std::vector<render_primitive*> screens;
+
+ int screen_count = 0;
+ std::vector<void*> bases;
+ while (prim != nullptr)
+ {
+ if (PRIMFLAG_GET_SCREENTEX(prim->flags))
+ {
+ bool found = false;
+ for (void* base : bases)
+ {
+ if (base == prim->texture.base)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ screen_count++;
+ screens.push_back(prim);
+ bases.push_back(prim->texture.base);
+ }
+ }
+ prim = prim->next();
+ }
+
+ if (screen_count > 0)
+ {
+ update_screen_count(screen_count);
+ m_targets.update_screen_count(screen_count);
+ }
+
+ return screens;
+}
+
+void chain_manager::update_screen_count(uint32_t screen_count)
+{
+ if (screen_count != m_screen_count)
+ {
+ m_slider_notifier.set_sliders_dirty();
+ m_screen_count = screen_count;
+
+ // Ensure we have one screen chain entry per screen
+ while (m_screen_chains.size() < m_screen_count)
+ {
+ m_screen_chains.push_back(nullptr);
+ m_current_chain.push_back(CHAIN_NONE);
+ }
+
+ // Ensure we have a screen chain selection slider per screen
+ while (m_selection_sliders.size() < m_screen_count)
+ {
+ create_selection_slider(m_selection_sliders.size());
+ }
+
+ load_chains();
+ }
+}
+
+static INT32 update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
+{
+ if (arg != nullptr)
+ {
+ return reinterpret_cast<chain_manager*>(arg)->chain_changed(id, str, newval);
+ }
+ return 0;
+}
+
+int32_t chain_manager::chain_changed(int32_t id, std::string *str, int32_t newval)
+{
+ if (newval != SLIDER_NOCHANGE)
+ {
+ m_current_chain[id] = newval;
+
+ reload_chains();
+
+ m_slider_notifier.set_sliders_dirty();
+ }
+
+ if (str != nullptr)
+ {
+ *str = string_format("%s", m_available_chains[m_current_chain[id]].c_str());
+ }
+
+ return m_current_chain[id];
+}
+
+void chain_manager::create_selection_slider(uint32_t screen_index)
+{
+ if (screen_index < m_selection_sliders.size())
+ {
+ return;
+ }
+
+ std::string description = "Window " + std::to_string(m_window_index) + ", Screen " + std::to_string(screen_index) + " Effect:";
+ size_t size = sizeof(slider_state) + description.length();
+ slider_state *state = reinterpret_cast<slider_state *>(auto_alloc_array_clear(m_machine, UINT8, size));
+
+ state->minval = 0;
+ state->defval = m_current_chain[screen_index];
+ state->maxval = m_available_chains.size() - 1;
+ state->incval = 1;
+ state->update = update_trampoline;
+ state->arg = this;
+ state->id = screen_index;
+ strcpy(state->description, description.c_str());
+
+ ui_menu_item item;
+ item.text = state->description;
+ item.subtext = "";
+ item.flags = 0;
+ item.ref = state;
+ item.type = ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER;
+ m_selection_sliders.push_back(item);
+}
+
+uint32_t chain_manager::handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window)
+{
+ std::vector<render_primitive*> screens = count_screens(starting_prim);
+
+ if (screens.size() == 0)
+ {
+ return 0;
+ }
+
+ // Process each screen as necessary
+ uint32_t used_views = 0;
+ uint32_t screen_index = 0;
+ for (render_primitive* prim : screens)
+ {
+ if (m_current_chain[screen_index] == CHAIN_NONE)
+ {
+ screen_index++;
+ continue;
+ }
+
+ uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f));
+ uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f));
+ if (window.swap_xy())
+ {
+ std::swap(screen_width, screen_height);
+ }
+
+ m_targets.update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE);
+ process_screen_quad(view + used_views, screen_index, prim, window);
+ used_views += screen_chain(screen_index)->applicable_passes();
+
+ screen_index++;
+ }
+
+ bgfx::setViewFrameBuffer(view + used_views, BGFX_INVALID_HANDLE);
+
+ return used_views;
+}
+
+bool chain_manager::has_applicable_chain(uint32_t screen)
+{
+ return screen < m_screen_count && m_current_chain[screen] != CHAIN_NONE && m_screen_chains[screen] != nullptr;
+}
+
+bool chain_manager::needs_sliders()
+{
+ return m_screen_count > 0 && m_available_chains.size() > 1;
+}
+
+std::vector<ui_menu_item> chain_manager::get_slider_list()
+{
+ std::vector<ui_menu_item> sliders;
+
+ if (!needs_sliders())
+ {
+ return sliders;
+ }
+
+ for (size_t index = 0; index < m_screen_chains.size(); index++)
+ {
+ bgfx_chain* chain = m_screen_chains[index];
+ sliders.push_back(m_selection_sliders[index]);
+
+ if (chain == nullptr)
+ {
+ continue;
+ }
+
+ std::vector<bgfx_slider*> chain_sliders = chain->sliders();
+ for (bgfx_slider* slider : chain_sliders)
+ {
+ slider_state* core_slider = slider->core_slider();
+
+ ui_menu_item item;
+ item.text = core_slider->description;
+ item.subtext = "";
+ item.flags = 0;
+ item.ref = core_slider;
+ item.type = ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER;
+ m_selection_sliders.push_back(item);
+
+ sliders.push_back(item);
+ }
+
+ if (chain_sliders.size() > 0)
+ {
+ ui_menu_item item;
+ item.text = MENU_SEPARATOR_ITEM;
+ item.subtext = "";
+ item.flags = 0;
+ item.ref = nullptr;
+ item.type = ui_menu_item_type::UI_MENU_ITEM_TYPE_SEPARATOR;
+
+ sliders.push_back(item);
+ }
+ }
+
+ return sliders;
+}
diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h
index 4cfd53b5f52..7d8d0c16eb3 100644
--- a/src/osd/modules/render/bgfx/chainmanager.h
+++ b/src/osd/modules/render/bgfx/chainmanager.h
@@ -22,31 +22,57 @@
#include "effectmanager.h"
class running_machine;
+class osd_window;
+class slider_dirty_notifier;
class bgfx_chain;
+class bgfx_slider;
-class chain_manager {
+class chain_manager
+{
public:
- chain_manager(osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects)
- : m_options(options)
- , m_textures(textures)
- , m_targets(targets)
- , m_effects(effects)
- {
- }
+ chain_manager(running_machine& machine, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t window_index, slider_dirty_notifier& slider_notifier);
~chain_manager();
- // Getters
- bgfx_chain* chain(std::string name, running_machine& machine, uint32_t window_index, uint32_t screen_index);
+ uint32_t handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window);
+ int32_t chain_changed(int32_t index, std::string *str, int32_t newval);
+
+ // Getters
+ bgfx_chain* screen_chain(uint32_t screen);
+ bgfx_chain* load_chain(std::string name, uint32_t screen_index);
+ bool has_applicable_chain(uint32_t screen);
+ std::vector<ui_menu_item> get_slider_list();
private:
- bgfx_chain* load_chain(std::string name, running_machine& machine, uint32_t window_index, uint32_t screen_index);
+ void load_chains();
+ void destroy_chains();
+ void reload_chains();
+
+ void find_available_chains(std::string path);
+ void parse_chain_selections(std::string chain_str);
+ std::vector<std::string> split_option_string(std::string chain_str) const;
+
+ void update_screen_count(uint32_t screen_count);
+ void create_selection_slider(uint32_t screen_index);
+ bool needs_sliders();
+
+ std::vector<render_primitive*> count_screens(render_primitive* prim);
+ void process_screen_quad(uint32_t view, uint32_t screen, render_primitive* prim, osd_window &window);
+
+ running_machine& m_machine;
+ osd_options& m_options;
+ texture_manager& m_textures;
+ target_manager& m_targets;
+ effect_manager& m_effects;
+ uint32_t m_window_index;
+ slider_dirty_notifier& m_slider_notifier;
+ uint32_t m_screen_count;
+ std::vector<std::string> m_available_chains;
+ std::vector<bgfx_chain*> m_screen_chains;
+ std::vector<ui_menu_item> m_selection_sliders;
+ std::vector<int32_t> m_current_chain;
- osd_options& m_options;
- texture_manager& m_textures;
- target_manager& m_targets;
- effect_manager& m_effects;
- std::vector<bgfx_chain*> m_chains;
+ static const uint32_t CHAIN_NONE;
};
#endif // __DRAWBGFX_CHAIN_MANAGER__
diff --git a/src/osd/modules/render/bgfx/chainreader.cpp b/src/osd/modules/render/bgfx/chainreader.cpp
index 204e7f1b6ce..332ba139fd0 100644
--- a/src/osd/modules/render/bgfx/chainreader.cpp
+++ b/src/osd/modules/render/bgfx/chainreader.cpp
@@ -84,16 +84,19 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, std::string prefix
}
// Create targets
+ std::vector<bgfx_target*> target_list;
if (value.HasMember("targets"))
{
const Value& target_array = value["targets"];
// TODO: Move into its own reader
for (UINT32 i = 0; i < target_array.Size(); i++)
{
- if (!target_reader::read_from_value(target_array[i], prefix + "targets[" + std::to_string(i) + "]: ", targets, options, screen_index))
+ bgfx_target* target = target_reader::read_from_value(target_array[i], prefix + "targets[" + std::to_string(i) + "]: ", targets, options, screen_index);
+ if (target == nullptr)
{
return nullptr;
}
+ target_list.push_back(target);
}
}
@@ -113,7 +116,7 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, std::string prefix
}
}
- return new bgfx_chain(name, author, sliders, parameters, entries);
+ return new bgfx_chain(name, author, targets, sliders, parameters, entries, target_list, screen_index);
}
bool chain_reader::validate_parameters(const Value& value, std::string prefix)
diff --git a/src/osd/modules/render/bgfx/effectmanager.cpp b/src/osd/modules/render/bgfx/effectmanager.cpp
index 082ec10793c..2b6951e18c8 100644
--- a/src/osd/modules/render/bgfx/effectmanager.cpp
+++ b/src/osd/modules/render/bgfx/effectmanager.cpp
@@ -9,11 +9,11 @@
//
//============================================================
-#include "emu.h"
-
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
+#include "emu.h"
+
#include <bgfx/bgfxplatform.h>
#include <bgfx/bgfx.h>
#include <bx/readerwriter.h>
diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp
index 38a55d71939..d8777257187 100644
--- a/src/osd/modules/render/bgfx/inputpair.cpp
+++ b/src/osd/modules/render/bgfx/inputpair.cpp
@@ -9,7 +9,7 @@
//
//============================================================
-#include "emu.h"
+#include "emucore.h"
#include "inputpair.h"
#include "texture.h"
diff --git a/src/osd/modules/render/bgfx/shaders/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/default/fs_blit.sc
index a6835ff890d..9af7bcf0ee6 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_blit.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/default/fs_blit.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Samplers
SAMPLER2D(s_tex, 0);
diff --git a/src/osd/modules/render/bgfx/shaders/chains/default/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/default/varying.def.sc
new file mode 100644
index 00000000000..2aa3cb425c0
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/default/varying.def.sc
@@ -0,0 +1,6 @@
+vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
+vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
+
+vec3 a_position : POSITION;
+vec4 a_color0 : COLOR0;
+vec2 a_texcoord0 : TEXCOORD0;
diff --git a/src/osd/modules/render/bgfx/shaders/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/default/vs_blit.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_blit.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/default/vs_blit.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc
new file mode 100644
index 00000000000..9af7bcf0ee6
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc
@@ -0,0 +1,14 @@
+$input v_color0, v_texcoord0
+
+// license:BSD-3-Clause
+// copyright-holders:Dario Manesku
+
+#include "common.sh"
+
+// Samplers
+SAMPLER2D(s_tex, 0);
+
+void main()
+{
+ gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0;
+}
diff --git a/src/osd/modules/render/bgfx/shaders/fs_color.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_color.sc
index 65c128a6a2a..faa707f5aa1 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_color.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_color.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0
// Color Convolution Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// User-supplied
uniform vec4 u_red_ratios;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_deconverge.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_deconverge.sc
index b23e24951c3..0f7d5c4854f 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_deconverge.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_deconverge.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3
// Deconvergence Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Samplers
SAMPLER2D(s_tex, 0);
diff --git a/src/osd/modules/render/bgfx/shaders/fs_defocus.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc
index c9e76990f3f..77130d98d13 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_defocus.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_defocus.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0
// Defocus Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_tex_size0;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_distortion.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc
index 8f4efa04cd3..0f69c288c5b 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_distortion.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_distortion.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0
// Distortion Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_swap_xy;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_ntsc_decode.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_decode.sc
index 1c6a53fba29..b196674a094 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_ntsc_decode.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_decode.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0
// NTSC Decode Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_source_dims;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_ntsc_encode.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_encode.sc
index 21bbb39240e..61964c10c30 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_ntsc_encode.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_ntsc_encode.sc
@@ -8,7 +8,7 @@ $input v_color0, v_texcoord0
// NB: intentionally wasteful of uniforms in order for easier slider utilization
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_source_dims;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_phosphor.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_phosphor.sc
index 4e752d94137..52b624b644b 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_phosphor.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_phosphor.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// User-supplied
uniform vec4 u_passthrough;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_post.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc
index 27c71a61eba..e4a3a984e6b 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_post.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc
@@ -6,7 +6,7 @@ $input v_color0, v_texcoord0
// Defocus Effect
//-----------------------------------------------------------------------------
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_swap_xy;
diff --git a/src/osd/modules/render/bgfx/shaders/fs_prescale.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_prescale.sc
index 1d8370dacf4..e17d867b621 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_prescale.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_prescale.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Samplers
SAMPLER2D(s_tex, 0);
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/varying.def.sc
new file mode 100644
index 00000000000..53fe40d0b8a
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/varying.def.sc
@@ -0,0 +1,9 @@
+vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
+vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
+vec2 v_texcoord1 : TEXCOORD1 = vec2(0.0, 0.0);
+vec2 v_texcoord2 : TEXCOORD2 = vec2(0.0, 0.0);
+vec2 v_texcoord3 : TEXCOORD3 = vec2(0.0, 0.0);
+
+vec3 a_position : POSITION;
+vec4 a_color0 : COLOR0;
+vec2 a_texcoord0 : TEXCOORD0;
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc
new file mode 100644
index 00000000000..405ef8feb3b
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc
@@ -0,0 +1,14 @@
+$input a_position, a_texcoord0, a_color0
+$output v_texcoord0, v_color0
+
+// license:BSD-3-Clause
+// copyright-holders:Dario Manesku
+
+#include "common.sh"
+
+void main()
+{
+ gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
+ v_texcoord0 = a_texcoord0;
+ v_color0 = a_color0;
+}
diff --git a/src/osd/modules/render/bgfx/shaders/vs_color.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_color.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_color.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_color.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_deconverge.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_deconverge.sc
index b714f84e4a6..b77d85d1ea8 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_deconverge.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_deconverge.sc
@@ -4,7 +4,7 @@ $output v_color0, v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Autos
uniform vec4 u_source_size;
diff --git a/src/osd/modules/render/bgfx/shaders/vs_defocus.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_defocus.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_defocus.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_defocus.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_distortion.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_distortion.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_distortion.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_distortion.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_ntsc_decode.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_decode.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_ntsc_decode.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_decode.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_ntsc_encode.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_encode.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_ntsc_encode.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_ntsc_encode.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_phosphor.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_phosphor.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_phosphor.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_phosphor.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_post.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_post.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_post.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_post.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_prescale.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_prescale.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_prescale.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_prescale.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/chains/unfiltered/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/fs_blit.sc
new file mode 100644
index 00000000000..9af7bcf0ee6
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/fs_blit.sc
@@ -0,0 +1,14 @@
+$input v_color0, v_texcoord0
+
+// license:BSD-3-Clause
+// copyright-holders:Dario Manesku
+
+#include "common.sh"
+
+// Samplers
+SAMPLER2D(s_tex, 0);
+
+void main()
+{
+ gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0;
+}
diff --git a/src/osd/modules/render/bgfx/shaders/chains/unfiltered/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/varying.def.sc
new file mode 100644
index 00000000000..2aa3cb425c0
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/varying.def.sc
@@ -0,0 +1,6 @@
+vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
+vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
+
+vec3 a_position : POSITION;
+vec4 a_color0 : COLOR0;
+vec2 a_texcoord0 : TEXCOORD0;
diff --git a/src/osd/modules/render/bgfx/shaders/chains/unfiltered/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/vs_blit.sc
new file mode 100644
index 00000000000..405ef8feb3b
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/unfiltered/vs_blit.sc
@@ -0,0 +1,14 @@
+$input a_position, a_texcoord0, a_color0
+$output v_texcoord0, v_color0
+
+// license:BSD-3-Clause
+// copyright-holders:Dario Manesku
+
+#include "common.sh"
+
+void main()
+{
+ gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0));
+ v_texcoord0 = a_texcoord0;
+ v_color0 = a_color0;
+}
diff --git a/src/osd/modules/render/bgfx/shaders/fs_gui.sc b/src/osd/modules/render/bgfx/shaders/fs_gui.sc
index a6285212d2f..ab1bff59dee 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_gui.sc
+++ b/src/osd/modules/render/bgfx/shaders/fs_gui.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Samplers
SAMPLER2D(s_tex, 0);
diff --git a/src/osd/modules/render/bgfx/shaders/fs_screen.sc b/src/osd/modules/render/bgfx/shaders/fs_screen.sc
index d0eaa170d49..52dac92785c 100644
--- a/src/osd/modules/render/bgfx/shaders/fs_screen.sc
+++ b/src/osd/modules/render/bgfx/shaders/fs_screen.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
// Samplers
SAMPLER2D(s_tex, 0);
diff --git a/src/osd/modules/render/bgfx/shaders/makefile b/src/osd/modules/render/bgfx/shaders/makefile
index 737ca43554b..e5ee052ab31 100644
--- a/src/osd/modules/render/bgfx/shaders/makefile
+++ b/src/osd/modules/render/bgfx/shaders/makefile
@@ -1,13 +1,29 @@
BGFX_DIR=../../../../../../3rdparty/bgfx
-RUNTIME_DIR=../../../../../..
+RUNTIME_DIR=../../../../../../bgfx
BUILD_DIR=../../../../../../build
-include $(BGFX_DIR)/scripts/shader.mk
+include shader.mk
-rebuild:
+SUBDIRS := $(patsubst .,,$(patsubst ./,,$(shell find . -type d)))
+
+
+rebuild: main $(SUBDIRS)
+
+$(SUBDIRS):
+ @echo $@
+ @make -s --no-print-directory TARGET=0 SHADERS_DIR=$@/ clean all
+ @make -s --no-print-directory TARGET=1 SHADERS_DIR=$@/ clean all
+ @make -s --no-print-directory TARGET=2 SHADERS_DIR=$@/ clean all
+ @make -s --no-print-directory TARGET=3 SHADERS_DIR=$@/ clean all
+ @make -s --no-print-directory TARGET=4 SHADERS_DIR=$@/ clean all
+ @make -s --no-print-directory TARGET=5 SHADERS_DIR=$@/ clean all
+
+main:
@make -s --no-print-directory TARGET=0 clean all
@make -s --no-print-directory TARGET=1 clean all
@make -s --no-print-directory TARGET=2 clean all
@make -s --no-print-directory TARGET=3 clean all
@make -s --no-print-directory TARGET=4 clean all
@make -s --no-print-directory TARGET=5 clean all
+
+.PHONY: main rebuild $(SUBDIRS)
diff --git a/src/osd/modules/render/bgfx/shaders/shader.mk b/src/osd/modules/render/bgfx/shaders/shader.mk
new file mode 100644
index 00000000000..6e6730b5c29
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/shader.mk
@@ -0,0 +1,147 @@
+#
+# Copyright 2011-2016 Branimir Karadzic. All rights reserved.
+# License: http://www.opensource.org/licenses/BSD-2-Clause
+#
+
+THISDIR:=../../../../../../3rdparty/bgfx/scripts
+include $(THISDIR)/tools.mk
+
+# Define SHADERS_DIR if your shader files are in a different dir than the makefile including this.
+# Notice: If defined, SHADERS_DIR should end with dir slash '/'.
+# Example:
+# SHADERS_DIR=shader_files/
+
+ifeq ($(SHADERS_DIR), "./")
+ SHADERS_DIR:=""
+endif
+
+ifndef TARGET
+.PHONY: all
+all:
+ @echo Usage: make TARGET=# [clean, all, rebuild]
+ @echo " TARGET=0 (hlsl - dx9)"
+ @echo " TARGET=1 (hlsl - dx11)"
+ @echo " TARGET=2 (glsl - nacl)"
+ @echo " TARGET=3 (glsl - android)"
+ @echo " TARGET=4 (glsl - linux)"
+ @echo " TARGET=5 (metal - OSX/iOS)"
+ @echo " VERBOSE=1 show build commands."
+else
+
+ifeq ($(TARGET), 0)
+VS_FLAGS=--platform windows -p vs_3_0 -O 3
+FS_FLAGS=--platform windows -p ps_3_0 -O 3
+SHADER_PATH=shaders/dx9/$(SHADERS_DIR)
+else
+ifeq ($(TARGET), 1)
+VS_FLAGS=--platform windows -p vs_4_0 -O 3
+FS_FLAGS=--platform windows -p ps_4_0 -O 3
+CS_FLAGS=--platform windows -p cs_5_0 -O 1
+SHADER_PATH=shaders/dx11/$(SHADERS_DIR)
+else
+ifeq ($(TARGET), 2)
+VS_FLAGS=--platform nacl
+FS_FLAGS=--platform nacl
+SHADER_PATH=shaders/gles/$(SHADERS_DIR)
+else
+ifeq ($(TARGET), 3)
+VS_FLAGS=--platform android
+FS_FLAGS=--platform android
+CS_FLAGS=--platform android
+SHADER_PATH=shaders/gles/$(SHADERS_DIR)
+else
+ifeq ($(TARGET), 4)
+VS_FLAGS=--platform linux -p 120
+FS_FLAGS=--platform linux -p 120
+CS_FLAGS=--platform linux -p 430
+SHADER_PATH=shaders/glsl/$(SHADERS_DIR)
+else
+ifeq ($(TARGET), 5)
+VS_FLAGS=--platform osx -p metal
+FS_FLAGS=--platform osx -p metal
+CS_FLAGS=--platform osx -p metal
+SHADER_PATH=shaders/metal/$(SHADERS_DIR)
+endif
+endif
+endif
+endif
+endif
+endif
+
+THISDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+VS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
+FS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
+CS_FLAGS+=-i $(THISDIR)../src/$(THISDIR)../examples/common/
+
+BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH))
+BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH))
+
+VS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), vs_*.sc)))
+VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(VS_SOURCES)))))
+
+FS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), fs_*.sc)))
+FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(FS_SOURCES)))))
+
+CS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), cs_*.sc)))
+CS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(CS_SOURCES)))))
+
+VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(VS_SOURCES)))))
+FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(FS_SOURCES)))))
+CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(CS_SOURCES)))))
+
+BIN = $(VS_BIN) $(FS_BIN)
+ASM = $(VS_ASM) $(FS_ASM)
+
+ifeq ($(TARGET), 1)
+BIN += $(CS_BIN)
+ASM += $(CS_ASM)
+else
+ifeq ($(TARGET), 3)
+BIN += $(CS_BIN)
+ASM += $(CS_ASM)
+else
+ifeq ($(TARGET), 4)
+BIN += $(CS_BIN)
+ASM += $(CS_ASM)
+endif
+endif
+endif
+
+$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : $(SHADERS_DIR)vs_%.sc
+ @echo [$(<)]
+ $(SILENT) $(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm
+ $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
+
+$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : $(SHADERS_DIR)fs_%.sc
+ @echo [$(<)]
+ $(SILENT) $(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm
+ $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
+
+$(BUILD_INTERMEDIATE_DIR)/cs_%.bin : $(SHADERS_DIR)cs_%.sc
+ @echo [$(<)]
+ $(SILENT) $(SHADERC) $(CS_FLAGS) --type compute --depends -o $(@) -f $(<) --disasm
+ $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
+
+.PHONY: all
+all: dirs $(BIN)
+ @echo Target $(SHADER_PATH)
+
+.PHONY: clean
+clean:
+ @echo Cleaning...
+ @-rm -vf $(BIN)
+ @-$(call CMD_RMDIR,$(BUILD_INTERMEDIATE_DIR))
+
+.PHONY: dirs
+dirs:
+ @-$(call CMD_MKDIR,$(BUILD_INTERMEDIATE_DIR))
+ @-$(call CMD_MKDIR,$(BUILD_OUTPUT_DIR))
+
+.PHONY: rebuild
+rebuild: clean all
+
+endif # TARGET
+
+-include $(VS_DEPS)
+-include $(FS_DEPS)
+-include $(CS_DEPS)
diff --git a/src/osd/modules/render/bgfx/shaders/varying.def.sc b/src/osd/modules/render/bgfx/shaders/varying.def.sc
index 4bbc09efebe..2aa3cb425c0 100644
--- a/src/osd/modules/render/bgfx/shaders/varying.def.sc
+++ b/src/osd/modules/render/bgfx/shaders/varying.def.sc
@@ -1,9 +1,5 @@
vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
-vec2 v_texcoord1 : TEXCOORD1 = vec2(0.0, 0.0);
-vec2 v_texcoord2 : TEXCOORD2 = vec2(0.0, 0.0);
-vec2 v_texcoord3 : TEXCOORD3 = vec2(0.0, 0.0);
-vec3 v_pos : TEXCOORD3 = vec3(0.0, 0.0, 0.0);
vec3 a_position : POSITION;
vec4 a_color0 : COLOR0;
diff --git a/src/osd/modules/render/bgfx/shaders/vs_gui.sc b/src/osd/modules/render/bgfx/shaders/vs_gui.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_gui.sc
+++ b/src/osd/modules/render/bgfx/shaders/vs_gui.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/shaders/vs_screen.sc b/src/osd/modules/render/bgfx/shaders/vs_screen.sc
index fd37320eefb..405ef8feb3b 100644
--- a/src/osd/modules/render/bgfx/shaders/vs_screen.sc
+++ b/src/osd/modules/render/bgfx/shaders/vs_screen.sc
@@ -4,7 +4,7 @@ $output v_texcoord0, v_color0
// license:BSD-3-Clause
// copyright-holders:Dario Manesku
-#include "../../../../../../3rdparty/bgfx/examples/common/common.sh"
+#include "common.sh"
void main()
{
diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp
index cd27c973451..94e9c26ee0c 100644
--- a/src/osd/modules/render/bgfx/slider.cpp
+++ b/src/osd/modules/render/bgfx/slider.cpp
@@ -42,7 +42,7 @@ bgfx_slider::~bgfx_slider()
{
}
-static INT32 update_trampoline(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 update_trampoline(running_machine &machine, void *arg, int /*id*/, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
@@ -62,7 +62,7 @@ slider_state* bgfx_slider::create_core_slider(running_machine& machine)
state->incval = m_step;
state->update = update_trampoline;
state->arg = this;
- state->id = 0; // fixme
+ state->id = 0;
strcpy(state->description, m_description.c_str());
return state;
diff --git a/src/osd/modules/render/bgfx/statereader.cpp b/src/osd/modules/render/bgfx/statereader.cpp
index defb4c65296..91f3bd539bd 100644
--- a/src/osd/modules/render/bgfx/statereader.cpp
+++ b/src/osd/modules/render/bgfx/statereader.cpp
@@ -9,6 +9,8 @@
#include "statereader.h"
+#include <math.h>
+
uint64_t state_reader::get_enum_from_value(const Value& value, std::string name, const uint64_t default_value, const string_to_enum* enums, const int count)
{
if (value.HasMember(name.c_str()))
diff --git a/src/osd/modules/render/bgfx/statereader.h b/src/osd/modules/render/bgfx/statereader.h
index 4881120fb3b..9542116624a 100644
--- a/src/osd/modules/render/bgfx/statereader.h
+++ b/src/osd/modules/render/bgfx/statereader.h
@@ -12,10 +12,11 @@
#ifndef __DRAWBGFX_STATE_READER__
#define __DRAWBGFX_STATE_READER__
-#include "emu.h"
+#include <rapidjson/document.h>
#include <string>
-#include "rapidjson/document.h"
+
+#include "osdcore.h"
using namespace rapidjson;
diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp
index f39a4e3cfdb..4d1d3ea6b2a 100644
--- a/src/osd/modules/render/bgfx/target.cpp
+++ b/src/osd/modules/render/bgfx/target.cpp
@@ -6,7 +6,7 @@
//
//============================================================
-#include "emu.h"
+#include "emucore.h"
#include "target.h"
diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp
index 6350829a4ed..e17b0e6915a 100644
--- a/src/osd/modules/render/bgfx/targetmanager.cpp
+++ b/src/osd/modules/render/bgfx/targetmanager.cpp
@@ -48,14 +48,26 @@ target_manager::~target_manager()
bgfx_target* target_manager::create_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t style, bool double_buffer, bool filter, uint16_t scale, uint32_t screen)
{
bgfx_target* target = new bgfx_target(name, format, width, height, style, double_buffer, filter, scale, screen);
+ std::string full_name = name + std::to_string(screen);
- m_targets[name + std::to_string(screen)] = target;
+ m_targets[full_name] = target;
- m_textures.add_provider(name + std::to_string(screen), target);
+ m_textures.add_provider(full_name, target);
return target;
}
+void target_manager::destroy_target(std::string name, uint32_t screen)
+{
+ std::string full_name = name + std::to_string(screen);
+ if (m_targets[full_name] != nullptr)
+ {
+ delete m_targets[full_name];
+ m_targets[full_name] = nullptr;
+ m_textures.remove_provider(full_name);
+ }
+}
+
bgfx_target* target_manager::create_backbuffer(void *handle, uint16_t width, uint16_t height)
{
bgfx_target* target = new bgfx_target(handle, width, height);
@@ -161,3 +173,15 @@ void target_manager::create_target_if_nonexistent(uint32_t screen, std::string n
create_target(name, bgfx::TextureFormat::RGBA8, width, height, style, double_buffered, filter, 1, screen);
}
+
+uint16_t target_manager::width(uint32_t style, uint32_t screen)
+{
+ std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims;
+ return screen < sizes.size() ? sizes[screen].width() : 0;
+}
+
+uint16_t target_manager::height(uint32_t style, uint32_t screen)
+{
+ std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims;
+ return screen < sizes.size() ? sizes[screen].height() : 0;
+}
diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h
index fe3ff2ef22f..04ac4252f9d 100644
--- a/src/osd/modules/render/bgfx/targetmanager.h
+++ b/src/osd/modules/render/bgfx/targetmanager.h
@@ -31,6 +31,7 @@ public:
~target_manager();
bgfx_target* create_target(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t style, bool double_buffer, bool filter, uint16_t scale, uint32_t screen);
+ void destroy_target(std::string name, uint32_t screen);
bgfx_target* create_backbuffer(void *handle, uint16_t width, uint16_t height);
void update_target_sizes(uint32_t screen, uint16_t width, uint16_t height, uint32_t style);
@@ -38,6 +39,8 @@ public:
// Getters
bgfx_target* target(uint32_t screen, std::string name);
+ uint16_t width(uint32_t style, uint32_t screen);
+ uint16_t height(uint32_t style, uint32_t screen);
private:
void rebuild_targets(uint32_t screen, uint32_t style);
diff --git a/src/osd/modules/render/bgfx/targetreader.cpp b/src/osd/modules/render/bgfx/targetreader.cpp
index 26a2e21bfc3..c63d05ec015 100644
--- a/src/osd/modules/render/bgfx/targetreader.cpp
+++ b/src/osd/modules/render/bgfx/targetreader.cpp
@@ -21,11 +21,11 @@ const target_reader::string_to_enum target_reader::STYLE_NAMES[target_reader::ST
{ "custom", TARGET_STYLE_CUSTOM }
};
-bool target_reader::read_from_value(const Value& value, std::string prefix, target_manager& targets, osd_options& options, uint32_t screen_index)
+bgfx_target* target_reader::read_from_value(const Value& value, std::string prefix, target_manager& targets, osd_options& options, uint32_t screen_index)
{
if (!validate_parameters(value, prefix))
{
- return false;
+ return nullptr;
}
std::string target_name = value["name"].GetString();
@@ -43,21 +43,24 @@ bool target_reader::read_from_value(const Value& value, std::string prefix, targ
switch (mode)
{
case TARGET_STYLE_GUEST:
- break;
+ width = targets.width(TARGET_STYLE_GUEST, screen_index);
+ height = targets.height(TARGET_STYLE_GUEST, screen_index);
+ break;
case TARGET_STYLE_NATIVE:
- break;
+ width = targets.width(TARGET_STYLE_NATIVE, screen_index);
+ height = targets.height(TARGET_STYLE_NATIVE, screen_index);
+ break;
case TARGET_STYLE_CUSTOM:
- if (!READER_CHECK(value.HasMember("width"), (prefix + "Target '" + target_name + "': Must have numeric value 'width'\n").c_str())) return false;
- if (!READER_CHECK(value["width"].IsNumber(), (prefix + "Target '" + target_name + "': Value 'width' must be a number\n").c_str())) return false;
- if (!READER_CHECK(value.HasMember("height"), (prefix + "Target '" + target_name + "': Must have numeric value 'height'\n").c_str())) return false;
- if (!READER_CHECK(value["height"].IsNumber(), (prefix + "Target '" + target_name + "': Value 'height' must be a number\n").c_str())) return false;
+ if (!READER_CHECK(value.HasMember("width"), (prefix + "Target '" + target_name + "': Must have numeric value 'width'\n").c_str())) return nullptr;
+ if (!READER_CHECK(value["width"].IsNumber(), (prefix + "Target '" + target_name + "': Value 'width' must be a number\n").c_str())) return nullptr;
+ if (!READER_CHECK(value.HasMember("height"), (prefix + "Target '" + target_name + "': Must have numeric value 'height'\n").c_str())) return nullptr;
+ if (!READER_CHECK(value["height"].IsNumber(), (prefix + "Target '" + target_name + "': Value 'height' must be a number\n").c_str())) return nullptr;
width = uint16_t(value["width"].GetDouble());
height = uint16_t(value["height"].GetDouble());
break;
}
- targets.create_target(target_name, bgfx::TextureFormat::RGBA8, width, height, mode, double_buffer, bilinear, scale, screen_index);
- return true;
+ return targets.create_target(target_name, bgfx::TextureFormat::RGBA8, width, height, mode, double_buffer, bilinear, scale, screen_index);
}
bool target_reader::validate_parameters(const Value& value, std::string prefix)
diff --git a/src/osd/modules/render/bgfx/targetreader.h b/src/osd/modules/render/bgfx/targetreader.h
index 78e97665f5f..abbc4f9a805 100644
--- a/src/osd/modules/render/bgfx/targetreader.h
+++ b/src/osd/modules/render/bgfx/targetreader.h
@@ -15,13 +15,14 @@
#include "statereader.h"
+class bgfx_target;
class target_manager;
class osd_options;
class target_reader : public state_reader
{
public:
- static bool read_from_value(const Value& value, std::string prefix, target_manager& targets, osd_options& options, uint32_t screen_index);
+ static bgfx_target* read_from_value(const Value& value, std::string prefix, target_manager& targets, osd_options& options, uint32_t screen_index);
private:
static bool validate_parameters(const Value& value, std::string prefix);
diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp
index bd69e18e424..c698f7a9ac5 100644
--- a/src/osd/modules/render/bgfx/texture.cpp
+++ b/src/osd/modules/render/bgfx/texture.cpp
@@ -6,7 +6,7 @@
//
//============================================================
-#include "emu.h"
+#include <string.h>
#include "texture.h"
diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp
index 753585fe3f3..0b2d0bb9969 100644
--- a/src/osd/modules/render/bgfx/texturemanager.cpp
+++ b/src/osd/modules/render/bgfx/texturemanager.cpp
@@ -62,23 +62,25 @@ bgfx_texture* texture_manager::create_png_texture(std::string path, std::string
return nullptr;
}
- uint8_t *texture_data = new uint8_t[bitmap.width() * bitmap.height() * 4];
-
- uint32_t width = bitmap.width();
- uint32_t height = bitmap.height();
- uint32_t rowpixels = bitmap.rowpixels();
- void *base = bitmap.raw_pixptr(0);
- for (int y = 0; y < height; y++) {
- copy_util::copyline_argb32(reinterpret_cast<UINT32 *>(texture_data) + y * width, reinterpret_cast<UINT32 *>(base) + y * rowpixels, width, nullptr);
+ uint8_t *data = new uint8_t[bitmap.width() * bitmap.height() * 4];
+ UINT32 *data32 = reinterpret_cast<UINT32 *>(data);
+
+ const uint32_t width = bitmap.width();
+ const uint32_t height = bitmap.height();
+ const uint32_t rowpixels = bitmap.rowpixels();
+ UINT32* base = reinterpret_cast<UINT32 *>(bitmap.raw_pixptr(0));
+ for (int y = 0; y < height; y++)
+ {
+ copy_util::copyline_argb32(data32 + y * width, base + y * rowpixels, width, nullptr);
}
if (screen >= 0)
{
texture_name += std::to_string(screen);
}
- bgfx_texture* texture = create_texture(texture_name, bgfx::TextureFormat::RGBA8, width, height, texture_data, flags);
+ bgfx_texture* texture = create_texture(texture_name, bgfx::TextureFormat::RGBA8, width, height, data, flags);
- delete[] texture_data;
+ delete [] data;
return texture;
}
@@ -106,3 +108,16 @@ bgfx_texture_handle_provider* texture_manager::provider(std::string name)
return nullptr;
}
+
+void texture_manager::remove_provider(std::string name, bool delete_provider)
+{
+ if (provider(name) != nullptr)
+ {
+ if (delete_provider)
+ {
+ delete m_textures[name];
+ }
+ m_textures[name] = nullptr;
+ }
+}
+
diff --git a/src/osd/modules/render/bgfx/texturemanager.h b/src/osd/modules/render/bgfx/texturemanager.h
index 20da9ff8b3e..117fc36c502 100644
--- a/src/osd/modules/render/bgfx/texturemanager.h
+++ b/src/osd/modules/render/bgfx/texturemanager.h
@@ -30,6 +30,7 @@ public:
bgfx_texture* create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP);
bgfx_texture* create_png_texture(std::string path, std::string file_name, std::string texture_name, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP, uint32_t screen = -1);
void add_provider(std::string name, bgfx_texture_handle_provider* texture);
+ void remove_provider(std::string name, bool delete_provider = false);
// Getters
bgfx::TextureHandle handle(std::string name);
diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp
new file mode 100644
index 00000000000..a5099534220
--- /dev/null
+++ b/src/osd/modules/render/bgfxutil.cpp
@@ -0,0 +1,67 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+//============================================================
+//
+// bgfxutil.cpp - BGFX renderer helper utils
+//
+//============================================================
+
+// MAMEOS headers
+#include "emu.h"
+#include "bgfxutil.h"
+#include "copyutil.h"
+
+#include "render.h"
+
+
+const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base)
+{
+ const bgfx::Memory* mem = bgfx::alloc(width * height * 4);
+ UINT32* data = reinterpret_cast<UINT32*>(mem->data);
+ UINT16* src16 = reinterpret_cast<UINT16*>(base);
+ UINT32* src32 = reinterpret_cast<UINT32*>(base);
+
+ for (int y = 0; y < height; y++)
+ {
+ UINT32* dst_line = data + y * width;
+ UINT16* src_line16 = src16 + y * rowpixels;
+ UINT32* src_line32 = src32 + y * rowpixels;
+ switch (format)
+ {
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16):
+ copy_util::copyline_palette16(dst_line, src_line16, width, palette);
+ break;
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16):
+ copy_util::copyline_palettea16(dst_line, src_line16, width, palette);
+ break;
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16):
+ copy_util::copyline_yuy16_to_argb(dst_line, src_line16, width, palette, 1);
+ break;
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32):
+ copy_util::copyline_argb32(dst_line, src_line32, width, palette);
+ break;
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32):
+ copy_util::copyline_rgb32(dst_line, src_line32, width, palette);
+ break;
+ default:
+ break;
+ }
+ }
+ return mem;
+}
+
+uint64_t bgfx_util::get_blend_state(UINT32 blend)
+{
+ switch (blend)
+ {
+ case BLENDMODE_ALPHA:
+ return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
+ case BLENDMODE_RGB_MULTIPLY:
+ return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO);
+ case BLENDMODE_ADD:
+ return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE);
+ default:
+ return 0L;
+ }
+ return 0L;
+}
diff --git a/src/osd/modules/render/bgfxutil.h b/src/osd/modules/render/bgfxutil.h
new file mode 100644
index 00000000000..0a776755dbf
--- /dev/null
+++ b/src/osd/modules/render/bgfxutil.h
@@ -0,0 +1,18 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+#pragma once
+
+#ifndef __RENDER_BGFX_UTIL__
+#define __RENDER_BGFX_UTIL__
+
+#include <bgfx/bgfx.h>
+
+/* sdl_info is the information about SDL for the current screen */
+class bgfx_util
+{
+public:
+ static const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base);
+ static uint64_t get_blend_state(UINT32 blend);
+};
+
+#endif // __RENDER_BGFX_UTIL__ \ No newline at end of file
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 60bac93db84..4cf8c96a164 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -23,6 +23,7 @@
#include "aviio.h"
#include "png.h"
#include "screen.h"
+#include "ui/ui.h"
// MAMEOS headers
#include "winmain.h"
@@ -37,7 +38,6 @@
// GLOBALS
//============================================================
-static slider_state *g_slider_list;
static osd_file::error open_next(renderer_d3d9 *d3d, emu_file &file, const char *templ, const char *extension, int idx);
//============================================================
@@ -86,7 +86,7 @@ shaders::shaders() :
shaders::~shaders()
{
- for (slider* slider : sliders)
+ for (slider* slider : internal_sliders)
{
delete slider;
}
@@ -400,7 +400,7 @@ void shaders::end_avi_recording()
// shaders::toggle
//============================================================
-void shaders::toggle()
+void shaders::toggle(std::vector<ui_menu_item>& sliders)
{
if (master_enable)
{
@@ -427,7 +427,7 @@ void shaders::toggle()
if (!initialized)
{
// re-create shader resources after renderer resources
- bool failed = create_resources(false);
+ bool failed = create_resources(false, sliders);
if (failed)
{
master_enable = false;
@@ -827,7 +827,7 @@ void shaders::init_fsfx_quad(void *vertbuf)
// shaders::create_resources
//============================================================
-int shaders::create_resources(bool reset)
+int shaders::create_resources(bool reset, std::vector<ui_menu_item>& sliders)
{
if (!master_enable || !d3dintf->post_fx_available)
{
@@ -1003,7 +1003,8 @@ int shaders::create_resources(bool reset)
initialized = true;
- init_slider_list();
+ std::vector<ui_menu_item> my_sliders = init_slider_list();
+ sliders.insert(sliders.end(), my_sliders.begin(), my_sliders.end());
return 0;
}
@@ -1789,7 +1790,7 @@ d3d_render_target* shaders::get_texture_target(render_primitive *prim, texture_i
return nullptr;
}
- bool swap_xy = d3d->swap_xy();
+ bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
@@ -1944,7 +1945,7 @@ bool shaders::register_texture(render_primitive *prim, texture_info *texture)
return false;
}
- bool swap_xy = d3d->swap_xy();
+ bool swap_xy = d3d->window().swap_xy();
int target_width = swap_xy
? static_cast<int>(prim->get_quad_height() + 0.5f)
: static_cast<int>(prim->get_quad_width() + 0.5f);
@@ -2103,8 +2104,6 @@ void shaders::delete_resources(bool reset)
}
shadow_bitmap.reset();
-
- g_slider_list = nullptr;
}
@@ -2226,7 +2225,7 @@ INT32 slider::update(std::string *str, INT32 newval)
return 0;
}
-static INT32 slider_update_trampoline(running_machine &machine, void *arg, std::string *str, INT32 newval)
+static INT32 slider_update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
@@ -2379,10 +2378,6 @@ slider_desc shaders::s_sliders[] =
};
-//============================================================
-// init_slider_list
-//============================================================
-
void *shaders::get_slider_option(int id, int index)
{
switch (id)
@@ -2452,15 +2447,15 @@ void *shaders::get_slider_option(int id, int index)
return nullptr;
}
-void shaders::init_slider_list()
+std::vector<ui_menu_item> shaders::init_slider_list()
{
- if (!master_enable || !d3dintf->post_fx_available)
+ std::vector<ui_menu_item> sliders;
+
+ for (slider* slider : internal_sliders)
{
- g_slider_list = nullptr;
+ delete slider;
}
-
- slider_state *listhead = nullptr;
- slider_state **tailptr = &listhead;
+ internal_sliders.clear();
for (int i = 0; s_sliders[i].name != nullptr; i++)
{
@@ -2488,7 +2483,7 @@ void shaders::init_slider_list()
for (int j = 0; j < count; j++)
{
slider* slider_arg = new slider(desc, get_slider_option(desc->id, j), &options->params_dirty);
- sliders.push_back(slider_arg);
+ internal_sliders.push_back(slider_arg);
std::string name = desc->name;
switch (desc->slider_type)
{
@@ -2507,13 +2502,21 @@ void shaders::init_slider_list()
default:
break;
}
- *tailptr = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg);
- tailptr = &(*tailptr)->next;
+
+ slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg);
+
+ ui_menu_item item;
+ item.text = core_slider->description;
+ item.subtext = "";
+ item.flags = 0;
+ item.ref = core_slider;
+ item.type = ui_menu_item_type::UI_MENU_ITEM_TYPE_SLIDER;
+ sliders.push_back(item);
}
}
}
- g_slider_list = listhead;
+ return sliders;
}
@@ -2617,7 +2620,7 @@ void uniform::update()
case CU_SWAP_XY:
{
- m_shader->set_bool("SwapXY", d3d->swap_xy());
+ m_shader->set_bool("SwapXY", d3d->window().swap_xy());
break;
}
case CU_ORIENTATION_SWAP:
@@ -3052,20 +3055,6 @@ ULONG effect::release()
}
-//============================================================
-// get_slider_list
-//============================================================
-
-slider_state *renderer_d3d9::get_slider_list()
-{
- if (window().m_index > 0)
- {
- return nullptr;
- }
- return g_slider_list;
-}
-
-
// NOTE: The function below is taken directly from src/emu/video.c and should likely be moved into a global helper function.
//-------------------------------------------------
// open_next - open the next non-existing file of
diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h
index 0cf6f0b3de9..e5e6ad600b7 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.h
+++ b/src/osd/modules/render/d3d/d3dhlsl.h
@@ -303,7 +303,7 @@ public:
void init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *renderer);
bool enabled() { return master_enable; }
- void toggle();
+ void toggle(std::vector<ui_menu_item>& sliders);
bool vector_enabled() { return master_enable && vector_enable; }
d3d_render_target* get_vector_target(render_primitive *prim);
@@ -338,11 +338,11 @@ public:
void remove_render_target(int source_width, int source_height, UINT32 screen_index, UINT32 page_index);
void remove_render_target(d3d_render_target *rt);
- int create_resources(bool reset);
+ int create_resources(bool reset, std::vector<ui_menu_item>& sliders);
void delete_resources(bool reset);
// slider-related functions
- void init_slider_list();
+ std::vector<ui_menu_item> init_slider_list();
void *get_slider_option(int id, int index = 0);
private:
@@ -438,7 +438,7 @@ private:
d3d_render_target * targethead;
cache_target * cachehead;
- std::vector<slider*> sliders;
+ std::vector<slider*> internal_sliders;
static slider_desc s_sliders[];
static hlsl_options last_options; // last used options
diff --git a/src/osd/modules/render/d3dtarget.h b/src/osd/modules/render/d3dtarget.h
deleted file mode 100644
index 566b1dbdfcd..00000000000
--- a/src/osd/modules/render/d3dtarget.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
-//============================================================
-//
-// d3dtarget.h - Direct3D HLSL targets
-//
-//============================================================
-
-#pragma once
-
-#ifndef __D3DTARGET__
-#define __D3DTARGET__
-
-#endif // __D3DTARGET__
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 85b76864b23..32f45515a08 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -28,7 +28,7 @@
#include <algorithm>
#include "drawbgfx.h"
-#include "copyutil.h"
+#include "bgfxutil.h"
#include "bgfx/texturemanager.h"
#include "bgfx/targetmanager.h"
#include "bgfx/shadermanager.h"
@@ -43,6 +43,8 @@
#include "bgfx/slider.h"
#include "bgfx/target.h"
+#include "imgui/imgui.h"
+
//============================================================
// DEBUGGING
//============================================================
@@ -188,8 +190,7 @@ int renderer_bgfx::create()
m_screen_effect[2] = m_effects->effect("screen_multiply");
m_screen_effect[3] = m_effects->effect("screen_add");
- m_chains = new chain_manager(options, *m_textures, *m_targets, *m_effects);
- parse_screen_chains(options.bgfx_screen_chains());
+ m_chains = new chain_manager(window().machine(), options, *m_textures, *m_targets, *m_effects, window().m_index, *this);
m_sliders_dirty = true;
uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
@@ -198,51 +199,9 @@ int renderer_bgfx::create()
memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16);
m_texinfo.push_back(rectangle_packer::packable_rectangle(WHITE_HASH, PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32), 16, 16, 16, nullptr, m_white));
- return 0;
-}
+ imguiCreate();
-//============================================================
-// parse_screen_chains
-//============================================================
-
-void renderer_bgfx::parse_screen_chains(std::string chain_str)
-{
- std::vector<std::vector<std::string>> chains;
- uint32_t length = chain_str.length();
- uint32_t last_start = 0;
- uint32_t win = 0;
- chains.push_back(std::vector<std::string>());
- for (uint32_t i = 0; i < length + 1; i++)
- {
- if (i == length || chain_str[i] == ',' || chain_str[i] == ':')
- {
- chains[win].push_back(chain_str.substr(last_start, i - last_start));
- last_start = i + 1;
- if (chain_str[i] == ':')
- {
- win++;
- chains.push_back(std::vector<std::string>());
- }
- }
- }
-
- for (win = 0; win < chains.size(); win++)
- {
- m_screen_chains.push_back(std::vector<bgfx_chain*>());
- if (win != window().m_index)
- {
- continue;
- }
- for (uint32_t screen = 0; screen < chains[win].size(); screen++)
- {
- bgfx_chain* chain = m_chains->chain(chains[win][screen], window().machine(), win, screen);
- if (chain == nullptr) {
- chains.clear();
- return;
- }
- m_screen_chains[win].push_back(chain);
- }
- }
+ return 0;
}
//============================================================
@@ -261,6 +220,8 @@ renderer_bgfx::~renderer_bgfx()
void renderer_bgfx::exit()
{
+ imguiDestroy();
+
bgfx::shutdown();
s_window_set = false;
}
@@ -376,33 +337,6 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, ScreenV
vertex[5].m_v = v[0];
}
-void renderer_bgfx::process_screen_quad(int screen, render_primitive* prim)
-{
- uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP;
- if (video_config.filter == 0)
- {
- texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
- }
-
- uint16_t tex_width(prim->texture.width);
- uint16_t tex_height(prim->texture.height);
-
- const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
- tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
-
- std::string full_name = "screen" + std::to_string(screen);
- bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem);
- m_textures->add_provider(full_name, texture);
-
- m_targets->update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST);
-
- screen_chain(screen)->process(prim, s_current_view, screen, *m_textures, window(), get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags)));
- s_current_view += screen_chain(screen)->applicable_passes();
-
- m_textures->add_provider(full_name, nullptr);
- delete texture;
-}
-
void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer, int32_t screen)
{
ScreenVertex* vertex = reinterpret_cast<ScreenVertex*>(buffer->data);
@@ -454,9 +388,15 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg
vertex[5].m_u = u[0];
vertex[5].m_v = v[0];
+ uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP;
+ if (video_config.filter == 0)
+ {
+ texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
+ }
+
UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags);
bgfx::setVertexBuffer(buffer);
- bgfx::setTexture(0, m_screen_effect[blend]->uniform("s_tex")->handle(), m_targets->target(screen, "output")->texture());
+ bgfx::setTexture(0, m_screen_effect[blend]->uniform("s_tex")->handle(), m_targets->target(screen, "output")->texture(), texture_flags);
m_screen_effect[blend]->submit(view);
}
@@ -517,7 +457,7 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient
uint16_t tex_width(prim->texture.width);
uint16_t tex_height(prim->texture.height);
- const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
+ const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
@@ -721,120 +661,6 @@ uint32_t renderer_bgfx::u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a
return (a << 24) | (b << 16) | (g << 8) | r;
}
-const bgfx::Memory* renderer_bgfx::mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base)
-{
- const bgfx::Memory* mem = bgfx::alloc(width * height * 4);
- for (int y = 0; y < height; y++)
- {
- switch (format)
- {
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16):
- copy_util::copyline_palette16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
- break;
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16):
- copy_util::copyline_palettea16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette);
- break;
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16):
- copy_util::copyline_yuy16_to_argb((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette, 1);
- break;
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32):
- copy_util::copyline_argb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
- break;
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32):
- copy_util::copyline_rgb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette);
- break;
- default:
- break;
- }
- }
- return mem;
-}
-
-int renderer_bgfx::handle_screen_chains()
-{
- if (m_screen_chains.size() <= window().m_index || m_screen_chains[window().m_index].size() == 0)
- {
- return 0;
- }
-
- window().m_primlist->acquire_lock();
-
- render_primitive *prim = window().m_primlist->first();
-
- // Determine how many post-processing passes are needed
- int screens = 0;
- int total_screen_textures = 0;
- std::vector<void*> bases;
- while (prim != nullptr)
- {
- if (PRIMFLAG_GET_SCREENTEX(prim->flags))
- {
- total_screen_textures++;
- bool found = false;
- for (void* base : bases)
- {
- if (base == prim->texture.base)
- {
- found = true;
- break;
- }
- }
- if (!found)
- {
- screens++;
- bases.push_back(prim->texture.base);
- }
- }
- prim = prim->next();
- }
-
- const uint32_t available_chains = m_screen_chains[window().m_index].size();
- screens = screens >= available_chains ? available_chains : screens;
-
- if (screens > 0)
- {
- m_targets->update_screen_count(screens);
- }
-
- // Process each screen as necessary
- prim = window().m_primlist->first();
- int screen_index = 0;
- while (prim != nullptr)
- {
- if (PRIMFLAG_GET_SCREENTEX(prim->flags))
- {
- if (screen_index >= available_chains)
- {
- break;
- }
- uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f));
- uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f));
- m_targets->update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE);
- process_screen_quad(screen_index, prim);
- screen_index++;
- }
- prim = prim->next();
- }
-
- window().m_primlist->release_lock();
-
- bgfx::setViewFrameBuffer(s_current_view, BGFX_INVALID_HANDLE);
-
- return s_current_view;
-}
-
-bgfx_chain* renderer_bgfx::screen_chain(int32_t screen)
-{
- if (screen >= m_screen_chains[window().m_index].size())
- {
- return m_screen_chains[window().m_index][m_screen_chains[window().m_index].size() - 1];
- }
- else
- {
- return m_screen_chains[window().m_index][screen];
- }
-}
-
int renderer_bgfx::draw(int update)
{
int window_index = window().m_index;
@@ -851,7 +677,9 @@ int renderer_bgfx::draw(int update)
m_width[window_index] = wdim.width();
m_height[window_index] = wdim.height();
- handle_screen_chains();
+ window().m_primlist->acquire_lock();
+ s_current_view += m_chains->handle_screen_chains(s_current_view, window().m_primlist->first(), window());
+ window().m_primlist->release_lock();
bool skip_frame = update_dimensions();
if (skip_frame)
@@ -1079,7 +907,7 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(bool atlas_valid,
return BUFFER_PRE_FLUSH;
}
- if (PRIMFLAG_GET_SCREENTEX((*prim)->flags) && m_screen_chains.size() > window().m_index && screen < m_screen_chains[window().m_index].size())
+ if (PRIMFLAG_GET_SCREENTEX((*prim)->flags) && m_chains->has_applicable_chain(screen))
{
#if SCENE_VIEW
setup_view(s_current_view, true);
@@ -1126,26 +954,10 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(bool atlas_valid,
return BUFFER_FLUSH;
}
-uint64_t renderer_bgfx::get_blend_state(UINT32 blend)
-{
- switch (blend)
- {
- case BLENDMODE_ALPHA:
- return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
- case BLENDMODE_RGB_MULTIPLY:
- return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO);
- case BLENDMODE_ADD:
- return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE);
- default:
- return 0L;
- }
- return 0L;
-}
-
void renderer_bgfx::set_bgfx_state(UINT32 blend)
{
uint64_t flags = BGFX_STATE_RGB_WRITE | BGFX_STATE_ALPHA_WRITE | BGFX_STATE_DEPTH_TEST_ALWAYS;
- bgfx::setState(flags | get_blend_state(blend));
+ bgfx::setState(flags | bgfx_util::get_blend_state(blend));
}
bool renderer_bgfx::update_atlas()
@@ -1188,7 +1000,7 @@ void renderer_bgfx::process_atlas_packs(std::vector<std::vector<rectangle_packer
continue;
}
m_hash_to_entry[rect.hash()] = rect;
- const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base());
+ const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base());
bgfx::updateTexture2D(m_texture_cache->texture(), 0, rect.x(), rect.y(), rect.width(), rect.height(), mem);
}
}
@@ -1306,38 +1118,13 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
}
}
-slider_state* renderer_bgfx::get_slider_list()
+std::vector<ui_menu_item> renderer_bgfx::get_slider_list()
{
- if (m_screen_chains.size() <= window().m_index || m_screen_chains[window().m_index].size() == 0)
- {
- return nullptr;
- }
-
- slider_state *listhead = nullptr;
- slider_state **tailptr = &listhead;
- for (std::vector<bgfx_chain*> screen : m_screen_chains)
- {
- for (bgfx_chain* chain : screen)
- {
- std::vector<bgfx_slider*> sliders = chain->sliders();
- for (bgfx_slider* slider : sliders)
- {
- if (*tailptr == nullptr)
- {
- *tailptr = slider->core_slider();
- }
- else
- {
- (*tailptr)->next = slider->core_slider();
- tailptr = &(*tailptr)->next;
- }
- }
- }
- }
- if (*tailptr != nullptr)
- {
- (*tailptr)->next = nullptr;
- }
- m_sliders_dirty = false;
- return listhead;
+ m_sliders_dirty = false;
+ return m_chains->get_slider_list();
}
+
+void renderer_bgfx::set_sliders_dirty()
+{
+ m_sliders_dirty = true;
+} \ No newline at end of file
diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h
index b2fe4abda78..d48bb5914e6 100644
--- a/src/osd/modules/render/drawbgfx.h
+++ b/src/osd/modules/render/drawbgfx.h
@@ -12,6 +12,7 @@
#include "binpacker.h"
#include "bgfx/vertex.h"
+#include "sliderdirtynotifier.h"
class texture_manager;
class target_manager;
@@ -24,7 +25,7 @@ class bgfx_target;
class bgfx_chain;
/* sdl_info is the information about SDL for the current screen */
-class renderer_bgfx : public osd_renderer
+class renderer_bgfx : public osd_renderer, public slider_dirty_notifier
{
public:
renderer_bgfx(osd_window *w)
@@ -39,9 +40,10 @@ public:
static void exit();
virtual int create() override;
- virtual slider_state* get_slider_list() override;
- virtual bool multi_window_sliders() override { return true; }
- virtual int draw(const int update) override;
+ virtual int draw(const int update) override;
+
+ virtual std::vector<ui_menu_item> get_slider_list() override;
+ virtual void set_sliders_dirty() override;
#ifdef OSD_SDL
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override;
@@ -58,11 +60,10 @@ public:
return &window().target()->get_primitives();
}
- static const char* WINDOW_PREFIX;
+ static const char* WINDOW_PREFIX;
private:
- int handle_screen_chains();
- void parse_screen_chains(std::string chain_str);
+ void handle_screen_chains(render_primitive *starting_prim);
bgfx_chain* screen_chain(int32_t screen);
bool update_dimensions();
@@ -81,7 +82,6 @@ private:
};
buffer_status buffer_primitives(bool atlas_valid, render_primitive** prim, bgfx::TransientVertexBuffer* buffer, int32_t screen);
- void process_screen_quad(int view, render_primitive* prim);
void render_textured_quad(render_primitive* prim, bgfx::TransientVertexBuffer* buffer);
void render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer, int32_t screen);
@@ -90,14 +90,12 @@ private:
void put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, ScreenVertex* vertex, float fth = 1.0f);
void set_bgfx_state(UINT32 blend);
- uint64_t get_blend_state(UINT32 blend);
static uint32_t u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a);
bool check_for_dirty_atlas();
bool update_atlas();
void process_atlas_packs(std::vector<std::vector<rectangle_packer::packed_rectangle>>& packed);
- const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base);
UINT32 get_texture_hash(render_primitive *prim);
bgfx_target* m_framebuffer;
@@ -114,7 +112,6 @@ private:
bgfx_effect* m_gui_effect[4];
bgfx_effect* m_screen_effect[4];
- std::vector<std::vector<bgfx_chain*>> m_screen_chains;
std::vector<uint32_t> m_seen_views;
std::map<UINT32, rectangle_packer::packed_rectangle> m_hash_to_entry;
diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp
index 8f18bae8aac..020e4ee3de5 100644
--- a/src/osd/modules/render/drawd3d.cpp
+++ b/src/osd/modules/render/drawd3d.cpp
@@ -27,7 +27,6 @@
#include "window.h"
#include "drawd3d.h"
#include "modules/render/d3d/d3dhlsl.h"
-#include "d3dtarget.h"
//============================================================
@@ -599,7 +598,8 @@ int renderer_d3d9::pre_window_draw_check()
// if we're restarting the renderer, leave things alone
if (m_restarting)
{
- m_shaders->toggle();
+ m_sliders.clear();
+ m_shaders->toggle(m_sliders);
m_restarting = false;
}
@@ -897,14 +897,16 @@ try_again:
m_shaders = (shaders*)global_alloc_clear<shaders>();
m_shaders->init(d3dintf, &window().machine(), this);
- m_sliders_dirty = true;
- int failed = m_shaders->create_resources(false);
+ m_sliders.clear();
+ int failed = m_shaders->create_resources(false, m_sliders);
if (failed)
{
return failed;
}
+ m_sliders_dirty = true;
+
return device_create_resources();
}
@@ -1003,6 +1005,7 @@ void renderer_d3d9::device_delete()
if (m_shaders != nullptr)
{
// free our effects
+ m_sliders.clear();
m_shaders->delete_resources(false);
// delete the HLSL interface
@@ -1131,6 +1134,7 @@ int renderer_d3d9::device_test_cooperative()
osd_printf_verbose("Direct3D: resetting device\n");
// free all existing resources and call reset on the device
+ m_sliders.clear();
m_shaders->delete_resources(true);
device_delete_resources();
result = (*d3dintf->device.reset)(m_device, &m_presentation);
@@ -1150,7 +1154,8 @@ int renderer_d3d9::device_test_cooperative()
return 1;
}
- if (m_shaders->create_resources(true))
+ m_sliders.clear();
+ if (m_shaders->create_resources(true, m_sliders))
{
osd_printf_verbose("Direct3D: failed to recreate HLSL resources for device; failing permanently\n");
device_delete();
diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h
index 2f4b675cba2..672ff6482bb 100644
--- a/src/osd/modules/render/drawd3d.h
+++ b/src/osd/modules/render/drawd3d.h
@@ -47,24 +47,12 @@ public:
static void exit();
virtual int create() override;
- virtual slider_state* get_slider_list() override;
virtual render_primitive_list *get_primitives() override;
virtual int draw(const int update) override;
virtual void save() override;
virtual void record() override;
virtual void toggle_fsfx() override;
- bool swap_xy()
- {
- // todo: move to osd_window
- bool orientation_swap_xy =
- (window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY;
- bool rotation_swap_xy =
- (window().target()->orientation() & ROT90) == ROT90 ||
- (window().target()->orientation() & ROT270) == ROT270;
- return orientation_swap_xy ^ rotation_swap_xy;
- };
-
int initialize();
int device_create(HWND device_HWND);
diff --git a/src/osd/modules/render/sdlglcontext.h b/src/osd/modules/render/sdlglcontext.h
index 5a284ef289d..9a3194582ac 100644
--- a/src/osd/modules/render/sdlglcontext.h
+++ b/src/osd/modules/render/sdlglcontext.h
@@ -13,6 +13,7 @@
#ifndef __SDL_GL_CONTEXT__
#define __SDL_GL_CONTEXT__
+#include "sdlinc.h"
#include "modules/opengl/osd_opengl.h"
class sdl_gl_context : public osd_gl_context
diff --git a/src/osd/modules/render/sliderdirtynotifier.h b/src/osd/modules/render/sliderdirtynotifier.h
new file mode 100644
index 00000000000..bf9f645b894
--- /dev/null
+++ b/src/osd/modules/render/sliderdirtynotifier.h
@@ -0,0 +1,22 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+//====================================================================
+//
+// sliderdirtynotifier.cpp - Interface for a slider-changed callback
+//
+//====================================================================
+
+#pragma once
+
+#ifndef __RENDER_SLIDER_DIRTY_NOTIFIER__
+#define __RENDER_SLIDER_DIRTY_NOTIFIER__
+
+class slider_dirty_notifier
+{
+public:
+ virtual ~slider_dirty_notifier() { }
+
+ virtual void set_sliders_dirty() = 0;
+};
+
+#endif // __RENDER_SLIDER_DIRTY_NOTIFIER__ \ No newline at end of file
diff --git a/src/osd/modules/sync/osdsync.cpp b/src/osd/modules/sync/osdsync.cpp
index 46b321369b0..98690149358 100644
--- a/src/osd/modules/sync/osdsync.cpp
+++ b/src/osd/modules/sync/osdsync.cpp
@@ -11,122 +11,4 @@
#include <stdlib.h>
-// C++ headers
-#include <mutex>
-#include <atomic>
-#include <condition_variable>
-//============================================================
-// TYPE DEFINITIONS
-//============================================================
-
-struct osd_event {
- std::mutex *mutex;
- std::condition_variable *cond;
- std::atomic<INT32> autoreset;
- std::atomic<INT32> signalled;
-};
-
-//============================================================
-// osd_event_alloc
-//============================================================
-
-osd_event *osd_event_alloc(int manualreset, int initialstate)
-{
- osd_event *ev;
-
- ev = (osd_event *)calloc(1, sizeof(osd_event));
- if (ev == nullptr)
- return nullptr;
-
- ev->mutex = new std::mutex();
- ev->cond = new std::condition_variable();
- ev->signalled = initialstate;
- ev->autoreset = !manualreset;
-
- return ev;
-}
-
-//============================================================
-// osd_event_free
-//============================================================
-
-void osd_event_free(osd_event *event)
-{
- delete event->mutex;
- delete event->cond;
- free(event);
-}
-
-//============================================================
-// osd_event_set
-//============================================================
-
-void osd_event_set(osd_event *event)
-{
- event->mutex->lock();
- if (event->signalled == FALSE)
- {
- event->signalled = TRUE;
- if (event->autoreset)
- event->cond->notify_one();
- else
- event->cond->notify_all();
- }
- event->mutex->unlock();
-}
-
-//============================================================
-// osd_event_reset
-//============================================================
-
-void osd_event_reset(osd_event *event)
-{
- event->mutex->lock();
- event->signalled = FALSE;
- event->mutex->unlock();
-}
-
-//============================================================
-// osd_event_wait
-//============================================================
-
-int osd_event_wait(osd_event *event, osd_ticks_t timeout)
-{
- if (timeout == OSD_EVENT_WAIT_INFINITE)
- timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
-
- std::unique_lock<std::mutex> lock(*event->mutex);
- if (!timeout)
- {
- if (!event->signalled)
- {
- return FALSE;
- }
- }
- else
- {
- if (!event->signalled)
- {
- UINT64 msec = timeout * 1000 / osd_ticks_per_second();
-
- do {
- if (event->cond->wait_for(lock, std::chrono::milliseconds(msec)) == std::cv_status::timeout)
- {
- if (!event->signalled)
- {
- return FALSE;
- }
- else
- break;
- } else
- break;
-
- } while (TRUE);
- }
- }
-
- if (event->autoreset)
- event->signalled = 0;
- return TRUE;
-}
diff --git a/src/osd/modules/sync/osdsync.h b/src/osd/modules/sync/osdsync.h
index e88d4a223f2..a0eb8d36682 100644
--- a/src/osd/modules/sync/osdsync.h
+++ b/src/osd/modules/sync/osdsync.h
@@ -9,8 +9,12 @@
#ifndef __OSDSYNC__
#define __OSDSYNC__
+// C++ headers
+#include <mutex>
+#include <atomic>
+#include <condition_variable>
+
#include "osdcomm.h"
-#include "osdcore.h"
/***************************************************************************
SYNCHRONIZATION INTERFACES - Events
@@ -20,87 +24,143 @@
/* osd_event is an opaque type which represents a setable/resetable event */
-struct osd_event;
-
-
-/*-----------------------------------------------------------------------------
- osd_event_alloc: allocate a new event
-
- Parameters:
-
- manualreset - boolean. If true, the event will be automatically set
- to non-signalled after a thread successfully waited for
- it.
- initialstate - boolean. If true, the event is signalled initially.
-
- Return value:
-
- A pointer to the allocated event.
------------------------------------------------------------------------------*/
-osd_event *osd_event_alloc(int manualreset, int initialstate);
-
-
-/*-----------------------------------------------------------------------------
- osd_event_wait: wait for an event to be signalled
-
- Parameters:
-
- event - The event to wait for. If the event is in signalled state, the
- function returns immediately. If not it will wait for the event
- to become signalled.
- timeout - timeout in osd_ticks
-
- Return value:
-
- TRUE: The event was signalled
- FALSE: A timeout occurred
------------------------------------------------------------------------------*/
-int osd_event_wait(osd_event *event, osd_ticks_t timeout);
-
-
-/*-----------------------------------------------------------------------------
- osd_event_reset: reset an event to non-signalled state
-
- Parameters:
-
- event - The event to set to non-signalled state
-
- Return value:
-
- None
------------------------------------------------------------------------------*/
-void osd_event_reset(osd_event *event);
-
-
-/*-----------------------------------------------------------------------------
- osd_event_set: set an event to signalled state
-
- Parameters:
-
- event - The event to set to signalled state
-
- Return value:
-
- None
-
- Notes:
-
- All threads waiting for the event will be signalled.
------------------------------------------------------------------------------*/
-void osd_event_set(osd_event *event);
-
-
-/*-----------------------------------------------------------------------------
- osd_event_free: free the memory and resources associated with an osd_event
-
- Parameters:
-
- event - a pointer to a previously allocated osd_event.
+class osd_event
+{
+public:
+ /*-----------------------------------------------------------------------------
+ constructor: allocate a new event
+
+ Parameters:
+
+ manualreset - boolean. If true, the event will be automatically set
+ to non-signalled after a thread successfully waited for
+ it.
+ initialstate - boolean. If true, the event is signalled initially.
- Return value:
+ Return value:
- None.
------------------------------------------------------------------------------*/
-void osd_event_free(osd_event *event);
+ A pointer to the allocated event.
+ -----------------------------------------------------------------------------*/
+ osd_event(int manualreset, int initialstate)
+ {
+ m_signalled = initialstate;
+ m_autoreset = !manualreset;
+ }
+
+ ~osd_event()
+ {
+ }
+
+ /*-----------------------------------------------------------------------------
+ wait: wait for an event to be signalled
+ If the event is in signalled state, the
+ function returns immediately. If not it will wait for the event
+ to become signalled.
+
+ Parameters:
+
+ timeout - timeout in osd_ticks
+
+ Return value:
+
+ true: The event was signalled
+ false: A timeout occurred
+ -----------------------------------------------------------------------------*/
+
+ bool wait(osd_ticks_t timeout)
+ {
+ if (timeout == OSD_EVENT_WAIT_INFINITE)
+ timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
+
+ std::unique_lock<std::mutex> lock(m_mutex);
+ if (!timeout)
+ {
+ if (!m_signalled)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!m_signalled)
+ {
+ UINT64 msec = timeout * 1000 / osd_ticks_per_second();
+
+ do {
+ if (m_cond.wait_for(lock, std::chrono::milliseconds(msec)) == std::cv_status::timeout)
+ {
+ if (!m_signalled)
+ {
+ return FALSE;
+ }
+ else
+ break;
+ } else
+ break;
+
+ } while (true);
+ }
+ }
+
+ if (m_autoreset)
+ m_signalled = 0;
+
+ return true;
+ }
+
+ /*-----------------------------------------------------------------------------
+ osd_event_reset: reset an event to non-signalled state
+
+ Parameters:
+
+ None
+
+ Return value:
+
+ None
+ -----------------------------------------------------------------------------*/
+ void reset()
+ {
+ m_mutex.lock();
+ m_signalled = FALSE;
+ m_mutex.unlock();
+ }
+
+ /*-----------------------------------------------------------------------------
+ osd_event_set: set an event to signalled state
+
+ Parameters:
+
+ None
+
+ Return value:
+
+ None
+
+ Notes:
+
+ All threads waiting for the event will be signalled.
+ -----------------------------------------------------------------------------*/
+ void set()
+ {
+ m_mutex.lock();
+ if (m_signalled == FALSE)
+ {
+ m_signalled = TRUE;
+ if (m_autoreset)
+ m_cond.notify_one();
+ else
+ m_cond.notify_all();
+ }
+ m_mutex.unlock();
+ }
+
+private:
+ std::mutex m_mutex;
+ std::condition_variable m_cond;
+ std::atomic<INT32> m_autoreset;
+ std::atomic<INT32> m_signalled;
+
+};
#endif /* __OSDSYNC__ */
diff --git a/src/osd/modules/sync/work_osd.cpp b/src/osd/modules/sync/work_osd.cpp
index 9f80c9aec76..3afe4e6c273 100644
--- a/src/osd/modules/sync/work_osd.cpp
+++ b/src/osd/modules/sync/work_osd.cpp
@@ -20,6 +20,7 @@
#include <mutex>
#include <atomic>
#include <thread>
+#include <vector>
// MAME headers
#include "osdcore.h"
@@ -29,15 +30,9 @@
#include "eminline.h"
-#if defined(SDLMAME_MACOSX)
-#include "osxutils.h"
-#endif
#if defined(SDLMAME_LINUX) || defined(SDLMAME_BSD) || defined(SDLMAME_HAIKU) || defined(SDLMAME_EMSCRIPTEN) || defined(SDLMAME_MACOSX)
#include <pthread.h>
#endif
-#if defined(OSD_SDL)
-typedef void *PVOID;
-#endif
//============================================================
// DEBUGGING
@@ -96,10 +91,26 @@ static void spin_while_not(const volatile _AtomType * volatile atom, const _Main
struct work_thread_info
{
- osd_work_queue * queue; // pointer back to the queue
+ work_thread_info(UINT32 aid, osd_work_queue &aqueue)
+ : queue(aqueue)
+ , handle(nullptr)
+ , wakeevent(FALSE, FALSE) // auto-reset, not signalled
+ , active(0)
+ , id(aid)
+#if KEEP_STATISTICS
+ , itemsdone(0)
+ , actruntime(0)
+ , runtime(0)
+ , spintime(0)
+ , waittime(0)
+#endif
+ {
+ }
+ osd_work_queue & queue; // pointer back to the queue
std::thread * handle; // handle to the thread
- osd_event * wakeevent; // wake event for the thread
+ osd_event wakeevent; // wake event for the thread
std::atomic<INT32> active; // are we actively processing work?
+ UINT32 id;
#if KEEP_STATISTICS
INT32 itemsdone;
@@ -113,7 +124,28 @@ struct work_thread_info
struct osd_work_queue
{
- std::mutex *lock; // lock for protecting the queue
+ osd_work_queue()
+ : list(nullptr)
+ , tailptr(nullptr)
+ , free(nullptr)
+ , items(0)
+ , livethreads(0)
+ , waiting(0)
+ , exiting(0)
+ , threads(0)
+ , flags(0)
+ , doneevent(TRUE, TRUE) // manual reset, signalled
+#if KEEP_STATISTICS
+ , itemsqueued(0)
+ , setevents(0)
+ , extraitems(0)
+ , spinloops(0)
+#endif
+ {
+
+ }
+
+ std::mutex lock; // lock for protecting the queue
std::atomic<osd_work_item *> list; // list of items in the queue
osd_work_item ** volatile tailptr; // pointer to the tail pointer of work items in the queue
std::atomic<osd_work_item *> free; // free list of work items
@@ -123,8 +155,8 @@ struct osd_work_queue
std::atomic<INT32> exiting; // should the threads exit on their next opportunity?
UINT32 threads; // number of threads in this queue
UINT32 flags; // creation flags
- work_thread_info * thread; // array of thread information
- osd_event * doneevent; // event signalled when work is complete
+ std::vector<work_thread_info *> thread; // array of thread information
+ osd_event doneevent; // event signalled when work is complete
#if KEEP_STATISTICS
std::atomic<INT32> itemsqueued; // total items queued
@@ -137,8 +169,20 @@ struct osd_work_queue
struct osd_work_item
{
+ osd_work_item(osd_work_queue &aqueue)
+ : next(nullptr)
+ , queue(aqueue)
+ , callback(nullptr)
+ , param(nullptr)
+ , result(nullptr)
+ , event(nullptr) // manual reset, not signalled
+ , flags(0)
+ , done(FALSE)
+ {
+ }
+
osd_work_item * next; // pointer to next item
- osd_work_queue * queue; // pointer back to the owning queue
+ osd_work_queue & queue; // pointer back to the owning queue
osd_work_callback callback; // callback function
void * param; // callback parameter
void * result; // callback result
@@ -204,25 +248,12 @@ osd_work_queue *osd_work_queue_alloc(int flags)
const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
// allocate a new queue
- queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
- if (queue == NULL)
- goto error;
- memset(queue, 0, sizeof(*queue));
+ queue = new osd_work_queue();
// initialize basic queue members
queue->tailptr = (osd_work_item **)&queue->list;
queue->flags = flags;
- // allocate events for the queue
- queue->doneevent = osd_event_alloc(TRUE, TRUE); // manual reset, signalled
- if (queue->doneevent == NULL)
- goto error;
-
- // initialize the critical section
- queue->lock = new std::mutex();
- if (queue->lock == NULL)
- goto error;
-
// determine how many threads to create...
// on a single-CPU system, create 1 thread for I/O queues, and 0 threads for everything else
if (numprocs == 1)
@@ -247,23 +278,13 @@ osd_work_queue *osd_work_queue_alloc(int flags)
printf("osdprocs: %d effecprocs: %d threads: %d allocthreads: %d osdthreads: %d maxthreads: %d queuethreads: %d\n", osd_num_processors, numprocs, threadnum, allocthreadnum, osdthreadnum, WORK_MAX_THREADS, queue->threads);
#endif
- queue->thread = (work_thread_info *)osd_malloc_array(allocthreadnum * sizeof(queue->thread[0]));
- if (queue->thread == NULL)
- goto error;
- memset(queue->thread, 0, allocthreadnum * sizeof(queue->thread[0]));
+ for (threadnum = 0; threadnum < allocthreadnum; threadnum++)
+ queue->thread.push_back(new work_thread_info(threadnum, *queue));
// iterate over threads
for (threadnum = 0; threadnum < queue->threads; threadnum++)
{
- work_thread_info *thread = &queue->thread[threadnum];
-
- // set a pointer back to the queue
- thread->queue = queue;
-
- // create the per-thread wake event
- thread->wakeevent = osd_event_alloc(FALSE, FALSE); // auto-reset, not signalled
- if (thread->wakeevent == NULL)
- goto error;
+ work_thread_info *thread = queue->thread[threadnum];
// create the thread
thread->handle = new std::thread(worker_thread_entry, thread);
@@ -281,7 +302,7 @@ osd_work_queue *osd_work_queue_alloc(int flags)
// start a timer going for "waittime" on the main thread
if (flags & WORK_QUEUE_FLAG_MULTI)
{
- begin_timing(queue->thread[queue->threads].waittime);
+ begin_timing(queue->thread[queue->threads]->waittime);
}
return queue;
@@ -319,7 +340,7 @@ int osd_work_queue_wait(osd_work_queue *queue, osd_ticks_t timeout)
// if this is a multi queue, help out rather than doing nothing
if (queue->flags & WORK_QUEUE_FLAG_MULTI)
{
- work_thread_info *thread = &queue->thread[queue->threads];
+ work_thread_info *thread = queue->thread[queue->threads];
end_timing(thread->waittime);
@@ -341,10 +362,10 @@ int osd_work_queue_wait(osd_work_queue *queue, osd_ticks_t timeout)
}
// reset our done event and double-check the items before waiting
- osd_event_reset(queue->doneevent);
+ queue->doneevent.reset();
queue->waiting = TRUE;
if (queue->items != 0)
- osd_event_wait(queue->doneevent, timeout);
+ queue->doneevent.wait(timeout);
queue->waiting = FALSE;
// return TRUE if we actually hit 0
@@ -358,73 +379,53 @@ int osd_work_queue_wait(osd_work_queue *queue, osd_ticks_t timeout)
void osd_work_queue_free(osd_work_queue *queue)
{
- // if we have threads, clean them up
- if (queue->thread != NULL)
+ // stop the timer for "waittime" on the main thread
+ if (queue->flags & WORK_QUEUE_FLAG_MULTI)
{
- int threadnum;
+ end_timing(queue->thread[queue->threads]->waittime);
+ }
- // stop the timer for "waittime" on the main thread
- if (queue->flags & WORK_QUEUE_FLAG_MULTI)
- {
- end_timing(queue->thread[queue->threads].waittime);
- }
+ // signal all the threads to exit
+ queue->exiting = TRUE;
+ for (int threadnum = 0; threadnum < queue->threads; threadnum++)
+ {
+ work_thread_info *thread = queue->thread[threadnum];
+ thread->wakeevent.set();
+ }
- // signal all the threads to exit
- queue->exiting = TRUE;
- for (threadnum = 0; threadnum < queue->threads; threadnum++)
- {
- work_thread_info *thread = &queue->thread[threadnum];
- if (thread->wakeevent != NULL)
- osd_event_set(thread->wakeevent);
- }
+ // wait for all the threads to go away
+ for (int threadnum = 0; threadnum < queue->threads; threadnum++)
+ {
+ work_thread_info *thread = queue->thread[threadnum];
- // wait for all the threads to go away
- for (threadnum = 0; threadnum < queue->threads; threadnum++)
+ // block on the thread going away, then close the handle
+ if (thread->handle != NULL)
{
- work_thread_info *thread = &queue->thread[threadnum];
-
- // block on the thread going away, then close the handle
- if (thread->handle != NULL)
- {
- thread->handle->join();
- delete thread->handle;
- }
-
- // clean up the wake event
- if (thread->wakeevent != NULL)
- osd_event_free(thread->wakeevent);
+ thread->handle->join();
+ delete thread->handle;
}
-#if KEEP_STATISTICS
- int allocthreadnum;
- if (queue->flags & WORK_QUEUE_FLAG_MULTI)
- allocthreadnum = queue->threads + 1;
- else
- allocthreadnum = queue->threads;
+ }
- // output per-thread statistics
- for (threadnum = 0; threadnum < allocthreadnum; threadnum++)
- {
- work_thread_info *thread = &queue->thread[threadnum];
- osd_ticks_t total = thread->runtime + thread->waittime + thread->spintime;
- printf("Thread %d: items=%9d run=%5.2f%% (%5.2f%%) spin=%5.2f%% wait/other=%5.2f%% total=%9d\n",
- threadnum, thread->itemsdone,
- (double)thread->runtime * 100.0 / (double)total,
- (double)thread->actruntime * 100.0 / (double)total,
- (double)thread->spintime * 100.0 / (double)total,
- (double)thread->waittime * 100.0 / (double)total,
- (UINT32) total);
- }
-#endif
+#if KEEP_STATISTICS
+ // output per-thread statistics
+ for (work_thread_info *thread : queue->thread)
+ {
+ osd_ticks_t total = thread->runtime + thread->waittime + thread->spintime;
+ printf("Thread %d: items=%9d run=%5.2f%% (%5.2f%%) spin=%5.2f%% wait/other=%5.2f%% total=%9d\n",
+ thread->id, thread->itemsdone,
+ (double)thread->runtime * 100.0 / (double)total,
+ (double)thread->actruntime * 100.0 / (double)total,
+ (double)thread->spintime * 100.0 / (double)total,
+ (double)thread->waittime * 100.0 / (double)total,
+ (UINT32) total);
}
+#endif
// free the list
- if (queue->thread != NULL)
- osd_free(queue->thread);
-
- // free all the events
- if (queue->doneevent != NULL)
- osd_event_free(queue->doneevent);
+ for (auto & th : queue->thread)
+ delete th;
+ queue->thread.clear();
// free all items in the free list
while (queue->free.load() != nullptr)
@@ -432,8 +433,8 @@ void osd_work_queue_free(osd_work_queue *queue)
osd_work_item *item = (osd_work_item *)queue->free;
queue->free = item->next;
if (item->event != NULL)
- osd_event_free(item->event);
- osd_free(item);
+ delete item->event;
+ delete item;
}
// free all items in the active list
@@ -442,20 +443,19 @@ void osd_work_queue_free(osd_work_queue *queue)
osd_work_item *item = (osd_work_item *)queue->list;
queue->list = item->next;
if (item->event != NULL)
- osd_event_free(item->event);
- osd_free(item);
+ delete item->event;
+ delete item;
}
#if KEEP_STATISTICS
- printf("Items queued = %9d\n", queue->itemsqueued);
- printf("SetEvent calls = %9d\n", queue->setevents);
- printf("Extra items = %9d\n", queue->extraitems);
- printf("Spin loops = %9d\n", queue->spinloops);
+ printf("Items queued = %9d\n", queue->itemsqueued.load());
+ printf("SetEvent calls = %9d\n", queue->setevents.load());
+ printf("Extra items = %9d\n", queue->extraitems.load());
+ printf("Spin loops = %9d\n", queue->spinloops.load());
#endif
- delete queue->lock;
// free the queue itself
- osd_free(queue);
+ delete queue;
}
@@ -476,7 +476,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
// first allocate a new work item; try the free list first
{
- std::lock_guard<std::mutex> lock(*queue->lock);
+ std::lock_guard<std::mutex> lock(queue->lock);
do
{
item = (osd_work_item *)queue->free;
@@ -487,12 +487,9 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
if (item == NULL)
{
// allocate the item
- item = (osd_work_item *)osd_malloc(sizeof(*item));
+ item = new osd_work_item(*queue);
if (item == NULL)
return NULL;
- item->event = NULL;
- item->queue = queue;
- item->done = FALSE;
}
else
{
@@ -515,7 +512,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
// enqueue the whole thing within the critical section
{
- std::lock_guard<std::mutex> lock(*queue->lock);
+ std::lock_guard<std::mutex> lock(queue->lock);
*queue->tailptr = itemlist;
queue->tailptr = item_tailptr;
}
@@ -532,12 +529,12 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
// iterate over all the threads
for (threadnum = 0; threadnum < queue->threads; threadnum++)
{
- work_thread_info *thread = &queue->thread[threadnum];
+ work_thread_info *thread = queue->thread[threadnum];
// if this thread is not active, wake him up
if (!thread->active)
{
- osd_event_set(thread->wakeevent);
+ thread->wakeevent.set();
add_to_stat(queue->setevents, 1);
// for non-shared, the first one we find is good enough
@@ -550,9 +547,9 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call
// if no threads, run the queue now on this thread
if (queue->threads == 0)
{
- end_timing(queue->thread[0].waittime);
- worker_thread_process(queue, &queue->thread[0]);
- begin_timing(queue->thread[0].waittime);
+ end_timing(queue->thread[0]->waittime);
+ worker_thread_process(queue, queue->thread[0]);
+ begin_timing(queue->thread[0]->waittime);
}
// only return the item if it won't get released automatically
return (flags & WORK_ITEM_FLAG_AUTO_RELEASE) ? NULL : lastitem;
@@ -572,11 +569,11 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout)
// if we don't have an event, create one
if (item->event == NULL)
{
- std::lock_guard<std::mutex> lock(*item->queue->lock);
- item->event = osd_event_alloc(TRUE, FALSE); // manual reset, not signalled
+ std::lock_guard<std::mutex> lock(item->queue.lock);
+ item->event = new osd_event(TRUE, FALSE); // manual reset, not signalled
}
else
- osd_event_reset(item->event);
+ item->event->reset();
// if we don't have an event, we need to spin (shouldn't ever really happen)
if (item->event == NULL)
@@ -587,7 +584,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout)
// otherwise, block on the event until done
else if (!item->done)
- osd_event_wait(item->event, timeout);
+ item->event->wait(timeout);
// return TRUE if the refcount actually hit 0
return item->done;
@@ -616,12 +613,12 @@ void osd_work_item_release(osd_work_item *item)
osd_work_item_wait(item, 100 * osd_ticks_per_second());
// add us to the free list on our queue
- std::lock_guard<std::mutex> lock(*item->queue->lock);
+ std::lock_guard<std::mutex> lock(item->queue.lock);
do
{
- next = (osd_work_item *)item->queue->free;
+ next = (osd_work_item *) item->queue.free;
item->next = next;
- } while (!item->queue->free.compare_exchange_weak(next, item, std::memory_order_release, std::memory_order_relaxed));
+ } while (!item->queue.free.compare_exchange_weak(next, item, std::memory_order_release, std::memory_order_relaxed));
}
@@ -661,64 +658,56 @@ static int effective_num_processors(void)
static void *worker_thread_entry(void *param)
{
work_thread_info *thread = (work_thread_info *)param;
- osd_work_queue *queue = thread->queue;
-
-#if defined(SDLMAME_MACOSX)
- void *arp = NewAutoreleasePool();
-#endif
+ osd_work_queue &queue = thread->queue;
// loop until we exit
for ( ;; )
{
// block waiting for work or exit
// bail on exit, and only wait if there are no pending items in queue
- if (queue->exiting)
+ if (queue.exiting)
break;
- if (!queue_has_list_items(queue))
+ if (!queue_has_list_items(&queue))
{
begin_timing(thread->waittime);
- osd_event_wait(thread->wakeevent, OSD_EVENT_WAIT_INFINITE);
+ thread->wakeevent.wait( OSD_EVENT_WAIT_INFINITE);
end_timing(thread->waittime);
}
- if (queue->exiting)
+ if (queue.exiting)
break;
// indicate that we are live
thread->active = TRUE;
- ++queue->livethreads;
+ ++queue.livethreads;
// process work items
for ( ;; )
{
// process as much as we can
- worker_thread_process(queue, thread);
+ worker_thread_process(&queue, thread);
// if we're a high frequency queue, spin for a while before giving up
- if (queue->flags & WORK_QUEUE_FLAG_HIGH_FREQ && queue->list.load() == nullptr)
+ if (queue.flags & WORK_QUEUE_FLAG_HIGH_FREQ && queue.list.load() == nullptr)
{
// spin for a while looking for more work
begin_timing(thread->spintime);
- spin_while<std::atomic<osd_work_item *>, osd_work_item *>(&queue->list, (osd_work_item *)nullptr, SPIN_LOOP_TIME);
+ spin_while<std::atomic<osd_work_item *>, osd_work_item *>(&queue.list, (osd_work_item *)nullptr, SPIN_LOOP_TIME);
end_timing(thread->spintime);
}
// if nothing more, release the processor
- if (!queue_has_list_items(queue))
+ if (!queue_has_list_items(&queue))
break;
- add_to_stat(queue->spinloops, 1);
+ add_to_stat(queue.spinloops, 1);
}
// decrement the live thread count
thread->active = FALSE;
- --queue->livethreads;
+ --queue.livethreads;
}
-#if defined(SDLMAME_MACOSX)
- ReleaseAutoreleasePool(arp);
-#endif
-
return NULL;
}
@@ -729,7 +718,7 @@ static void *worker_thread_entry(void *param)
static void worker_thread_process(osd_work_queue *queue, work_thread_info *thread)
{
- int threadid = thread - queue->thread;
+ int threadid = thread->id;
begin_timing(thread->runtime);
@@ -742,7 +731,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
// use a critical section to synchronize the removal of items
{
- std::lock_guard<std::mutex> lock(*queue->lock);
+ std::lock_guard<std::mutex> lock(queue->lock);
if (queue->list.load() == nullptr)
{
@@ -784,12 +773,12 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
// set the result and signal the event
else
{
- std::lock_guard<std::mutex> lock(*queue->lock);
+ std::lock_guard<std::mutex> lock(queue->lock);
if (item->event != NULL)
{
- osd_event_set(item->event);
- add_to_stat(item->queue->setevents, 1);
+ item->event->set();
+ add_to_stat(item->queue.setevents, 1);
}
}
@@ -802,7 +791,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
// we don't need to set the doneevent for multi queues because they spin
if (queue->waiting)
{
- osd_event_set(queue->doneevent);
+ queue->doneevent.set();
add_to_stat(queue->setevents, 1);
}
@@ -811,7 +800,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
bool queue_has_list_items(osd_work_queue *queue)
{
- std::lock_guard<std::mutex> lock(*queue->lock);
+ std::lock_guard<std::mutex> lock(queue->lock);
bool has_list_items = (queue->list.load() != nullptr);
return has_list_items;
}
diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp
index fef7d0d0f7a..3e783159a9b 100644
--- a/src/osd/osdcore.cpp
+++ b/src/osd/osdcore.cpp
@@ -5,6 +5,9 @@
#include <thread>
#include <chrono>
+#if defined(SDLMAME_ANDROID)
+#include <SDL2/SDL.h>
+#endif
static const int MAXSTACK = 10;
static osd_output *m_stack[MAXSTACK];
static int m_ptr = -1;
@@ -58,7 +61,11 @@ void CLIB_DECL osd_printf_error(const char *format, ...)
/* do the output */
va_start(argptr, format);
+#if defined(SDLMAME_ANDROID)
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr);
+#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_ERROR, format, argptr);
+#endif
va_end(argptr);
}
@@ -74,7 +81,11 @@ void CLIB_DECL osd_printf_warning(const char *format, ...)
/* do the output */
va_start(argptr, format);
+#if defined(SDLMAME_ANDROID)
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr);
+#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_WARNING, format, argptr);
+#endif
va_end(argptr);
}
@@ -90,7 +101,11 @@ void CLIB_DECL osd_printf_info(const char *format, ...)
/* do the output */
va_start(argptr, format);
+#if defined(SDLMAME_ANDROID)
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, format, argptr);
+#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_INFO, format, argptr);
+#endif
va_end(argptr);
}
@@ -106,7 +121,11 @@ void CLIB_DECL osd_printf_verbose(const char *format, ...)
/* do the output */
va_start(argptr, format);
+#if defined(SDLMAME_ANDROID)
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, format, argptr);
+#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_VERBOSE, format, argptr);
+#endif
va_end(argptr);
}
@@ -122,7 +141,11 @@ void CLIB_DECL osd_printf_debug(const char *format, ...)
/* do the output */
va_start(argptr, format);
+#if defined(SDLMAME_ANDROID)
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, format, argptr);
+#else
if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_DEBUG, format, argptr);
+#endif
va_end(argptr);
}
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index 899f024d9f4..623c3ee3f11 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -774,11 +774,6 @@ void osd_free_executable(void *ptr, size_t size);
-----------------------------------------------------------------------------*/
void osd_break_into_debugger(const char *message);
-
-/*-----------------------------------------------------------------------------
- MESS specific code below
------------------------------------------------------------------------------*/
-
/*-----------------------------------------------------------------------------
osd_get_clipboard_text: retrieves text from the clipboard
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h
index b6ab45003e1..661160cb271 100644
--- a/src/osd/osdepend.h
+++ b/src/osd/osdepend.h
@@ -17,6 +17,7 @@
#include "osdcore.h"
#include "unicode.h"
#include "cliopts.h"
+#include "ui/menu.h"
#include <memory>
#include <string>
@@ -56,8 +57,6 @@ public:
// ======================> osd_interface
-struct slider_state;
-
// description of the currently-running machine
class osd_interface
{
@@ -80,7 +79,7 @@ public:
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
// video overridables
- virtual slider_state *get_slider_list() = 0;
+ virtual std::vector<ui_menu_item> get_slider_list() = 0;
// font interface
virtual osd_font::ptr font_alloc() = 0;
diff --git a/src/osd/sdl/README_SDL20.txt b/src/osd/sdl/README_SDL20.txt
deleted file mode 100644
index 7787bdc5e39..00000000000
--- a/src/osd/sdl/README_SDL20.txt
+++ /dev/null
@@ -1,130 +0,0 @@
-======================================================================================
-SDLMAME now supports SDL from version 2.0 on upwards.
-=======================================================================================
-
-
-Warning
-=======
-
-- SDL2.0 still is still under development, the following may or may not
- work.
-- if you are using wine on unix be sure to disable wintab32.dll
-
-Known bugs:
-===========
-
-* SDL1.3/X11: Some compound keys, e.g. "'" are not supported by SDL driver
-* SDL2.0: sdlvideofps does not take -numscreens>1 into account.
-* SDL1.3/WIN32: crashes with -rd d3d
-* SDL1.3/WIN32: resizing does not work
-
-Build SDL 2.0 from HG
-======================
-
-Pull 2.0 from hg. Then
-
-sh autogen.sh
-./configure --prefix=/usr/local/sdl13/ --disable-video-svga --enable-video-directfb --enable-fusionsound
-make
-[sudo] make install
-
-You may leave away the last two enables, if you do not want to play around with directfb - although it is lightning fast now :-)
-
-To build the files in test, do
-
-cd test
-./configure --prefix=/usr/local/sdl13/ --with-sdl-pfx=/usr/local/sdl13
-make
-
-Replace /usr/local/sdl13 above with a safe location, this may as well be a directory in $HOME.
-
-Edit sdl.mak to have
-
-SDL_LIBVER = sdl2
-SDL_INSTALL_ROOT = /usr/local/sdl13
-
-That's it.
-
-make
-./mame -video sdl13 -rd opengl dkong
-
-
-All drivers
-===========
-
-should support:
-
--waitvsync
--prescale
--resolution[X]
--switchres
--numscreens
--screen[X]
-
-The following modes are working:
-
-SDL13
-=====
-
-This is driver using SDL texture and line drawing support. It supports
--prescale, -filter and -waitvsync. The driver determines which pixel
-formats perform best and converts textures to these pixel formats and at
-the same time performs any necessary rotation.
-
-Basic usage examples:
-
-X11/opengl: ./mamed -video sdl13 -rd opengl mario
-DFB/DFB: ./mamed -video sdl13 -vd directfb -rd directfb mario
-
-The performance of the directfb driver depends on the combined
-support of the kernel framebuffer driver and the directfb driver.
-Having loaded radeonfb I get the same performance as with the open source
-radeon X11 driver.
-
-Using the SDL software renderer (preferred is -video soft, thought)
-
-X11,DFB,WIN32 ./mamed -video sdl13 -rd software
-
-Soft:
-=====
-
-./mamed -mt -video soft -sm none -numscreens 2 mario
-
-OpenGL:
-=======
-
-Plain opengl does work. Anything more advanced like pbo, fbo or glsl will
-most probably not work with more than one screen.
-
- ./mamed -mt -video opengl mario -nogl_pbo -nogl_vbo -nogl_glsl -numscreens 2
-
-YUV - modes:
-============
-
- ./mamed -mt -video soft -sm yuy2 mario
-
-Using DirectFB, the following should get you going
-
- ./mamed -mt -video soft -sm yuy2 -vd directfb -rd directfb mario
-
-for accelerated blitting on the framebuffer - provided directfb supports it.
-At least my Radeon R480 is supported.
-
--video soft and -scale_mode (-sm)
-=================================
-
-sdlmame supports 7 scale modes using textures in -video soft:
-
-none: All rendering/scaling in software.
-
-hwblit: Rendering in software/scaling with hardware (if supported)
-
-hwbest: Rendering in software/antialiased scaling with hardware (if supported)
-
-yv12, yv12x2, yuy2, yuy2x2:
-Rendering in software / scaling with hardware (if supported)
-
-Whether these are actually hardware accelerated depends on the SDL driver
-and the hardware. The SDL directfb driver supports all above if the hardware
-supports it. However, only one YUV-texture per display is supported.
-The second window consequently will get "software" YUV blitting.
diff --git a/src/osd/sdl/emscripten_post.js b/src/osd/sdl/emscripten_post.js
deleted file mode 100644
index 6bfad8790cb..00000000000
--- a/src/osd/sdl/emscripten_post.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// MAME-JavaScript function mappings
-var JSMAME = JSMAME || {};
-JSMAME.get_machine = Module.cwrap('_Z14js_get_machinev', 'number');
-JSMAME.get_ui = Module.cwrap('_Z9js_get_uiv', 'number');
-JSMAME.get_sound = Module.cwrap('_Z12js_get_soundv', 'number');
-JSMAME.ui_set_show_fps = Module.cwrap('_ZN10ui_manager12set_show_fpsEb', '', ['number', 'number']);
-JSMAME.ui_get_show_fps = Module.cwrap('_ZNK10ui_manager8show_fpsEv', 'number', ['number']);
-JSMAME.sound_manager_mute = Module.cwrap('_ZN13sound_manager4muteEbh', '', ['number', 'number', 'number']);
-JSMAME.sdl_pauseaudio = Module.cwrap('SDL_PauseAudio', '', ['number']);
-var JSMESS = JSMAME;
diff --git a/src/osd/sdl/ledutil.sh b/src/osd/sdl/ledutil.sh
deleted file mode 100644
index e91e44200de..00000000000
--- a/src/osd/sdl/ledutil.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-# license:BSD-3-Clause
-# copyright-holders:Olivier Galibert, R. Belmont
-# ============================================================
-#
-# ledutil.sh - Example script for output notifiers
-#
-# This is a very basic implementation which
-#
-# a) Sets kbd leds if led0, led1, led2 is received
-# b) Beeps if led0 is set to on (state=1)
-# c) Writes a message when pause is received
-#
-# use "sh ledutil.sh -h" to get more information
-#
-# ============================================================
-
-SDLMAME_OUTPUT=/tmp/sdlmame_out
-
-verbose=0
-autoclose=0
-myname=`basename $0`
-paused=0
-
-while [ $# -gt 0 ]; do
- case $1 in
- -v)
- verbose=1
- ;;
- -a)
- autoclose=1
- ;;
- -h)
- echo "Usage: $myname [-a] [-v]"
- echo ""
- echo " -a Automatically close when sdlmame ends game"
- echo " -v LOG all messages received"
- echo " -h Get help"
- echo ""
- exit
- ;;
- *)
- echo "$myname: invalid option $1"
- echo "Try \`$myname -h' for more information."
- exit
- ;;
- esac
- shift
-done
-
-if [ ! -e ${SDLMAME_OUTPUT} ]; then
- mkfifo ${SDLMAME_OUTPUT}
-fi
-
-while true; do
- cat ${SDLMAME_OUTPUT} | while read class pidnum what state; do
- [ $verbose = 1 ] && echo LOG: $class $pidnum $what $state
- if [ "$class" = "MAME" ]; then
- case "$what" in
- START)
- echo Process $pidnum starting game $state
- paused=0
- ;;
- STOP)
- echo Process $pidnum stopping game $state
- ;;
- esac
- fi
- if [ "$class" = "OUT" ]; then
- case "$what" in
- led0)
- [ "$state" = 1 ] && beep
- [ "$state" = 1 ] && xset led 1
- [ "$state" = 0 ] && xset -led 1
- ;;
- led1)
- [ "$state" = 1 ] && xset led 2
- [ "$state" = 0 ] && xset -led 2
- ;;
- led2)
- [ "$state" = 1 ] && xset led 3
- [ "$state" = 0 ] && xset -led 3
- ;;
- pause)
- paused=$state
- echo Pause $paused!
- ;;
- esac
- fi
- done
- [ $autoclose = 1 ] && break;
-done
-
-rm -f ${SDLMAME_OUTPUT}
-
diff --git a/src/osd/sdl/main.cpp b/src/osd/sdl/main.cpp
deleted file mode 100644
index 7a73e6a82a9..00000000000
--- a/src/osd/sdl/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// main.c - Win32 main program
-//
-//============================================================
-
-// standard windows headers
-#ifdef OSD_SDL
-#define _WIN32_WINNT 0x0400
-#endif
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <tchar.h>
-#include <stdlib.h>
-
-// MAMEOS headers
-#include "strconv.h"
-
-extern int utf8_main(int argc, char *argv[]);
-
-
-
-//============================================================
-// main
-//============================================================
-
-// undo the command-line #define that maps main to utf8_main in all other cases
-#ifndef WINUI
-#undef main
-#undef wmain
-#endif
-#ifdef UNICODE
-extern "C" int _tmain(int argc, TCHAR **argv)
-{
- int i, rc;
- char **utf8_argv;
-
- /* convert arguments to UTF-8 */
- utf8_argv = (char **) malloc(argc * sizeof(*argv));
- if (utf8_argv == NULL)
- return 999;
- for (i = 0; i < argc; i++)
- {
- utf8_argv[i] = utf8_from_tstring(argv[i]);
- if (utf8_argv[i] == NULL)
- return 999;
- }
-
- /* run utf8_main */
- rc = utf8_main(argc, utf8_argv);
-
- /* free arguments */
- for (i = 0; i < argc; i++)
- osd_free(utf8_argv[i]);
- free(utf8_argv);
-
- return rc;
-}
-#endif
diff --git a/src/osd/sdl/man/LICENSE b/src/osd/sdl/man/LICENSE
deleted file mode 100644
index 670154e3538..00000000000
--- a/src/osd/sdl/man/LICENSE
+++ /dev/null
@@ -1,116 +0,0 @@
-CC0 1.0 Universal
-
-Statement of Purpose
-
-The laws of most jurisdictions throughout the world automatically confer
-exclusive Copyright and Related Rights (defined below) upon the creator and
-subsequent owner(s) (each and all, an "owner") of an original work of
-authorship and/or a database (each, a "Work").
-
-Certain owners wish to permanently relinquish those rights to a Work for the
-purpose of contributing to a commons of creative, cultural and scientific
-works ("Commons") that the public can reliably and without fear of later
-claims of infringement build upon, modify, incorporate in other works, reuse
-and redistribute as freely as possible in any form whatsoever and for any
-purposes, including without limitation commercial purposes. These owners may
-contribute to the Commons to promote the ideal of a free culture and the
-further production of creative, cultural and scientific works, or to gain
-reputation or greater distribution for their Work in part through the use and
-efforts of others.
-
-For these and/or other purposes and motivations, and without any expectation
-of additional consideration or compensation, the person associating CC0 with a
-Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
-and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
-and publicly distribute the Work under its terms, with knowledge of his or her
-Copyright and Related Rights in the Work and the meaning and intended legal
-effect of CC0 on those rights.
-
-1. Copyright and Related Rights. A Work made available under CC0 may be
-protected by copyright and related or neighboring rights ("Copyright and
-Related Rights"). Copyright and Related Rights include, but are not limited
-to, the following:
-
- i. the right to reproduce, adapt, distribute, perform, display, communicate,
- and translate a Work;
-
- ii. moral rights retained by the original author(s) and/or performer(s);
-
- iii. publicity and privacy rights pertaining to a person's image or likeness
- depicted in a Work;
-
- iv. rights protecting against unfair competition in regards to a Work,
- subject to the limitations in paragraph 4(a), below;
-
- v. rights protecting the extraction, dissemination, use and reuse of data in
- a Work;
-
- vi. database rights (such as those arising under Directive 96/9/EC of the
- European Parliament and of the Council of 11 March 1996 on the legal
- protection of databases, and under any national implementation thereof,
- including any amended or successor version of such directive); and
-
- vii. other similar, equivalent or corresponding rights throughout the world
- based on applicable law or treaty, and any national implementations thereof.
-
-2. Waiver. To the greatest extent permitted by, but not in contravention of,
-applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
-unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
-and Related Rights and associated claims and causes of action, whether now
-known or unknown (including existing as well as future claims and causes of
-action), in the Work (i) in all territories worldwide, (ii) for the maximum
-duration provided by applicable law or treaty (including future time
-extensions), (iii) in any current or future medium and for any number of
-copies, and (iv) for any purpose whatsoever, including without limitation
-commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
-the Waiver for the benefit of each member of the public at large and to the
-detriment of Affirmer's heirs and successors, fully intending that such Waiver
-shall not be subject to revocation, rescission, cancellation, termination, or
-any other legal or equitable action to disrupt the quiet enjoyment of the Work
-by the public as contemplated by Affirmer's express Statement of Purpose.
-
-3. Public License Fallback. Should any part of the Waiver for any reason be
-judged legally invalid or ineffective under applicable law, then the Waiver
-shall be preserved to the maximum extent permitted taking into account
-Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
-is so judged Affirmer hereby grants to each affected person a royalty-free,
-non transferable, non sublicensable, non exclusive, irrevocable and
-unconditional license to exercise Affirmer's Copyright and Related Rights in
-the Work (i) in all territories worldwide, (ii) for the maximum duration
-provided by applicable law or treaty (including future time extensions), (iii)
-in any current or future medium and for any number of copies, and (iv) for any
-purpose whatsoever, including without limitation commercial, advertising or
-promotional purposes (the "License"). The License shall be deemed effective as
-of the date CC0 was applied by Affirmer to the Work. Should any part of the
-License for any reason be judged legally invalid or ineffective under
-applicable law, such partial invalidity or ineffectiveness shall not
-invalidate the remainder of the License, and in such case Affirmer hereby
-affirms that he or she will not (i) exercise any of his or her remaining
-Copyright and Related Rights in the Work or (ii) assert any associated claims
-and causes of action with respect to the Work, in either case contrary to
-Affirmer's express Statement of Purpose.
-
-4. Limitations and Disclaimers.
-
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
- surrendered, licensed or otherwise affected by this document.
-
- b. Affirmer offers the Work as-is and makes no representations or warranties
- of any kind concerning the Work, express, implied, statutory or otherwise,
- including without limitation warranties of title, merchantability, fitness
- for a particular purpose, non infringement, or the absence of latent or
- other defects, accuracy, or the present or absence of errors, whether or not
- discoverable, all to the greatest extent permissible under applicable law.
-
- c. Affirmer disclaims responsibility for clearing rights of other persons
- that may apply to the Work or any use thereof, including without limitation
- any person's Copyright and Related Rights in the Work. Further, Affirmer
- disclaims responsibility for obtaining any necessary consents, permissions
- or other rights required for any use of the Work.
-
- d. Affirmer understands and acknowledges that Creative Commons is not a
- party to this document and has no duty or obligation with respect to this
- CC0 or use of the Work.
-
-For more information, please see
-<http://creativecommons.org/publicdomain/zero/1.0/>
diff --git a/src/osd/sdl/man/README.md b/src/osd/sdl/man/README.md
deleted file mode 100644
index 61036986e6a..00000000000
--- a/src/osd/sdl/man/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# **man pages** #
-
-man pages for MAME and its tools is work of many different contributors, and contain information about usage of MAME and utilities that are comming in package.
-
-Licensed under [CC0 1.0 Universal (CC0 1.0)](https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file
diff --git a/src/osd/sdl/man/castool.1 b/src/osd/sdl/man/castool.1
deleted file mode 100644
index 1dd96b6eb3f..00000000000
--- a/src/osd/sdl/man/castool.1
+++ /dev/null
@@ -1,46 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" castool.1
-.\"
-.\" Man page created from usage info
-.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
-.\"
-.\"
-.TH CASTOOL 1 2015-07-22 0.164 "MESS Generic cassette manipulation tool"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-castool \- MESS Generic cassette manipulation tool
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B castool convert
-.IB "format infile outfile" .wav
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B castool
-is a tool for the maintenance and manipulation of cassette
-dumps that MESS users need to deal with.
-.\"
-.\"
-.\" COMMANDS chapter
-.SH COMMANDS
-.TP
-.B convert
-Convert a cassette dump to a .wav audio file. See
-.B castool
-(without arguments) for a full list of supported cassette formats.
-.\"
-.\"
-.\" EXAMPLES chapter
-.SH EXAMPLES
-.B castool convert tzx pyjamarama.tzx pyjamarama.wav
-.\"
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-mess(6)
diff --git a/src/osd/sdl/man/chdman.1 b/src/osd/sdl/man/chdman.1
deleted file mode 100644
index f81b48abdea..00000000000
--- a/src/osd/sdl/man/chdman.1
+++ /dev/null
@@ -1,255 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" chdman.1
-.\"
-.\" Man page created from source and usage information by
-.\" Ashley T. Howes <debiandev@ashleyhowes.com>, February 2005
-.\" updated by Cesare Falco <c.falco@ubuntu.com>, February 2007
-.\"
-.TH CHDMAN 1 2015-07-22 0.164 "MAME Compressed Hunks of Data (CHD) manager"
-.\"
-.\" NAME chapter
-.SH NAME
-chdman \- MAME Compressed Hunks of Data (CHD) manager
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B chdman
-.I option
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B chdman
-is the (C)ompressed (H)unks of (D)ata (CHD) manager for MAME.
-It is a tool to manage CHD images.
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-Please note that each option allows a set of switches, the meaning of each
-is explained in the \fBSWITCHES\fR section below. Whenever the short form
-for the switch is listed, the long one may be used instead.
-.TP
-.B help \fR[\fIoption\fR]
-Print a summary of the available options or, if \fIoption\fR is given, a
-detailed list of the valid switches for the option.
-.TP
-.B info \
-\-i \fIfilename\fR \
-[\fB\-v\fR]
-Dump the header information from a drive image.
-.TP
-.B verify \
-\-i \fIfileiname\fR \
-[\fB\-ip \fIfilename\fR]
-Validate the MD5/SHA1 on a drive image.
-.TP
-.B createraw \
-\-o \fIfilename\fR \
-[\fB\-op \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-isb \fIoffset\fR] \
-[\fB\-ish \fIoffset\fR] \
-[\fB\-ib \fIlength\fR] \
-[\fB\-ih \fIlength\fR] \
-\fB\-hs \fIbytes\fR \
-\fB\-us \fIbytes\fR \
-[\fB\-c none\fR|type1[,[...]]] \
-[\fB\-np \fIprocessors\fR]
-Create a new compressed raw image from a raw file.
-.TP
-.B createhd \
-\-o \fIfilename\fR \
-[\fB\-op \fIfilename\fR] \
-[\fB\-f\fR] \
-[\fB\-i \fIfilename\fR] \
-[\fB\-isb \fIoffset\fR] \
-[\fB\-ish \fIoffset\fR] \
-[\fB\-ib \fIlength\fR] \
-[\fB\-ih \fIlength\fR] \
-[\fB\-hs \fIbytes\fR] \
-[\fB\-c none\fR|type1[,[...]]] \
-[\fB\-chs \fIcylinders\fB,\fIheads\fB,\fIsectors\fR] \
-[\fB\-ss \fIbytes\fR] \
-[\fB\-np \fIprocessors\fR]
-Create a new compressed hard disk image from a raw file.
-.TP
-.B createcd \
-\-o \fIfilename\fR \
-[\fB\-op \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-hs \fIbytes\fR] \
-[\fB\-c none\fR|type1[,[...]]] \
-[\fB\-np \fIprocessors\fR]
-Create a new compressed CD image from a raw file.
-.TP
-.B createld \
-\-o \fIfilename\fR \
-[\fB\-op \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-isf \fIoffset\fR] \
-[\fB\-if \fIlength\fR] \
-[\fB\-hs \fIbytes\fR] \
-[\fB\-c none\fR|type1[,[...]]] \
-[\fB\-np \fIprocessors\fR]
-Create a new compressed laserdisc image from a raw file.
-.TP
-.B extractraw \
-\-o \fIfilename\fR \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-ip \fIfilename\fR] \
-[\fB\-isb \fIoffset\fR] \
-[\fB\-ish \fIoffset\fR] \
-[\fB\-ib \fIlength\fR] \
-[\fB\-ih \fIlength\fR]
-Extract a raw file from a CHD image.
-.TP
-.B extracthd \
-\-o \fIfilename\fR \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-ip \fIfilename\fR] \
-[\fB\-isb \fIoffset\fR] \
-[\fB\-ish \fIoffset\fR] \
-[\fB\-ib \fIlength\fR] \
-[\fB\-ih \fIlength\fR]
-Extract a hard disk block image from a CHD image.
-.TP
-.B extractcd \
-\-o \fIfilename\fR \
-[\fB\-ob \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-ip \fIfilename\fR]
-Extract a CDRDAO .toc/.bin, CDRWIN .bin/.cue, or Sega Dreamcast .GDI file from a CHD\-CD image.
-.TP
-.B extractld \
-\-o \fIfilename\fR \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-ip \fIfilename\fR] \
-[\fB\-isf \fIoffset\fR] \
-[\fB\-if \fIlength\fR]
-Extract a laserdisc image from a CHD\-LD image.
-.TP
-.B copy \
-\-o \fIfilename\fR \
-[\fB\-op \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-i \fIfilename\fR \
-[\fB\-ip \fIfilename\fR] \
-[\fB\-isb \fIoffset\fR] \
-[\fB\-ish \fIoffset\fR] \
-[\fB\-ib \fIlength\fR] \
-[\fB\-ih \fIlength\fR] \
-\fB\-hs \fIbytes\fR \
-[\fB\-c none\fR|type1[,[...]]] \
-[\fB\-np \fIprocessors\fR]
-Copy all hunks of data from one CHD file to another. The hunk sizes do not need to match.
-If the source is shorter than the destination, the source data will be padded with 0s.
-.TP
-.B addmeta \
-\fB\-i \fIfilename\fR \
-\fB\-t \fItag\fR \
-[\fB\-ix \fIindex\fR] \
-[\fB\-vt \fItext\fR] \
-[\fB\-vf \fIfilename\fR] \
-[\fB\-nocs\fR]
-Add metadata to the chd.
-.TP
-.B delmeta \
-\fB\-i \fIfilename\fR \
-\fB\-t \fItag\fR \
-[\fB\-ix \fIindex\fR]
-Remove metadata from the chd.
-.TP
-.B dumpmeta \
-\fB\-i \fIfilename\fR \
-[\fB\-o \fIfilename\fR] \
-[\fB\-f\fR] \
-\fB\-t \fItag\fR \
-[\fB\-ix \fIindex\fR]
-Dump metadata from the chd to standard output or to a file.
-.\"
-.\" SWITCHES chapter
-.SH SWITCHES
-.TP
-.B \-\-chs, \-chs \fIcylinders,heads,sectors
-Specifies CHS geometry values for CHD harddisks.
-.TP
-.B \-\-compression, \-c \fInone\fR|\fItype1\fR[,[...]]
-Which compression codecs to use (up to 4).
-.TP
-.B \-\-force, \-f
-Force overwriting an existing file.
-.TP
-.B \-\-hunksize, \-hs \fIbytes
-Size of each unit, in hunks.
-.TP
-.B \-\-ident, \-id \fIfilename
-Name of ident file to provide CHS information.
-.TP
-.B \-\-index, \-ix \fIindex
-Indexed instance of the metadata tag.
-.TP
-.B \-\-input, \-i \fIfilename
-Input file name.
-.TP
-.B \-\-inputbytes, \-ib \fIlength
-Effective length of the input in bytes.
-.TP
-.B \-\-inputframes, \-if \fIlength
-Effective length of the input in frames.
-.TP
-.B \-\-inputhunks, \-ih \fIlength
-Effective length of the input in hunks.
-.TP
-.B \-\-inputparent, \-ip \fIfilename
-Parent CHD's input file name.
-.TP
-.B \-\-inputstartbyte, \-isb \fIoffset
-Starting byte offset within the input.
-.TP
-.B \-\-inputstartframe, \-isf \fIoffset
-Starting frame offset within the input.
-.TP
-.B \-\-inputstarthunk, \-ish \fIoffset
-Starting hunk offset within the input.
-.TP
-.B \-\-nochecksum, \-nocs
-Do not include this metadata information in the overall SHA-1.
-.TP
-.B \-\-numprocessors, \-np \fIcount
-Limits the number of processors to use during compression.
-.TP
-.B \-\-output, \-o \fIfilename
-Output file name.
-.TP
-.B \-\-outputbin, \-ob \fIfilename
-Output binary file name for extractcd.
-.TP
-.B \-\-outputparent, \-op \fIfilename
-Parent CHD's output file name.
-.TP
-.B \-\-sectorsize, \-ss \fIbytes
-Size of each hard disk sector.
-.TP
-.B \-\-tag, \-t \fItag
-4-character tag for metadata.
-.TP
-.B \-\-valuefile, \-vf \fIfilename
-Text file containing data to add.
-.TP
-.B \-\-valuetext, \-vt \fItext
-Text for the metadata.
-.TP
-.B \-\-unitsize, \-us \fIbytes
-Size of each unit, in bytes.
-.TP
-.B \-\-verbose, \-v
-Output additional information about the operation.
-.SH SEE ALSO
-mame(6), mess(6)
diff --git a/src/osd/sdl/man/floptool.1 b/src/osd/sdl/man/floptool.1
deleted file mode 100644
index 24d8e97c46a..00000000000
--- a/src/osd/sdl/man/floptool.1
+++ /dev/null
@@ -1,47 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" floptool.1
-.\"
-.\" Man page created from usage info
-.\" Cesare Falco <c.falco@ubuntu.com>, April 2014
-.\"
-.\"
-.TH FLOPTOOL 1 2015-07-22 0.164 "MESS Generic floppy manipulation tool"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-floptool \- MESS Generic floppy image manipulation tool
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B floptool
-.I option
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B floptool
-is a tool for the maintenance and manipulation of floppy disk
-images that MESS users need to deal with.
-.\"
-.\"
-.\" COMMANDS chapter
-.SH COMMANDS
-.TP
-.B identify \fIinputfile\fR [\fIinputfile \fR... ]
-Determine the format of a floppy disk image.
-.TP
-.B convert [\fIinputformat\fR|\fIauto\fR] \fIoutputformat inputfile outputfile
-Convert a floppy disk image to a different format.
-.\"
-.\"
-.\" EXAMPLES chapter
-.SH EXAMPLES
-.B floptool identify image.dsk
-.\"
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-mess(6)
diff --git a/src/osd/sdl/man/imgtool.1 b/src/osd/sdl/man/imgtool.1
deleted file mode 100644
index 819da84de06..00000000000
--- a/src/osd/sdl/man/imgtool.1
+++ /dev/null
@@ -1,157 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" imgtool.1
-.\"
-.\" Man page created from usage info and imgtool.txt
-.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
-.\"
-.\"
-.TH IMGTOOL 1 2015-07-22 0.164 "MESS media image manipulation tool"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-imgtool \- MESS media image manipulation tool
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B imgtool create
-.I format image
-.RI [ option " ...]"
-.br
-.B imgtool dir
-.I format image
-.RI [ path ]
-.br
-.B imgtool get
-.I format image file
-.RI [ newname ]
-.RB [ \-\-filter=\c
-.IR filter ]
-.RB [ \-\-fork=\c
-.IR fork ]
-.br
-.B imgtool put
-.IR "format image file " ...
-.RI [ newname ]
-.RI [ option " ...]"
-.RB [ \-\-filter=\c
-.IR filter ]
-.RB [ \-\-fork=\c
-.IR fork ]
-.br
-.B imgtool getall
-.I format image
-.RI [ path ]
-.RB [ \-\-filter=\c
-.IR filter ]
-.br
-.B imgtool del
-.IR "format image file " ...
-.br
-.B imgtool mkdir
-.I format image directory
-.br
-.B imgtool rmdir
-.IR "format image directory " ...
-.br
-.BR "imgtool readsector" | writesector
-.I format image track head sector file
-.br
-.B imgtool identify
-.I image
-.br
-.BR "imgtool listformats" | listfilters
-.br
-.B imgtool
-.B listdriveroptions
-.I format
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B imgtool
-is a tool for the maintenance and manipulation of disk and
-other types of images that MESS users need to deal with. Functions
-include retrieving and storing files and CRC checking and validation.
-Image files can also be within .zip files.
-.\"
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-.TP
-.B create
-Creates and image. Optional, image\-specific parameters can be
-specified, see
-.B imgtool listdriveroptions
-command for a full list.
-.TP
-.B dir
-Lists the contents of an image.
-.TP
-.B get
-Gets a single file from an image. A filter can be specified to convert
-custom file formats to ASCII, see
-.B imgtool listfilters
-command for a full list. File can optionally be renamed.
-.TP
-.B put
-Puts file(s) on an image (wildcards and rename supported).
-Filters are supplied to convert ASCII files to custom file formats,
-see
-.B imgtool listfilters
-command for a full list.
-.TP
-.B getall
-Gets all files off an image. Filters can be specified to convert
-custom file formats to ASCII, see
-.B imgtool listfilters
-command for a full list.
-.TP
-.B del
-Deletes a file on an image.
-.TP
-.B mkdir
-Create a directory on an image.
-.TP
-.B rmdir
-Delete directories on an image.
-.TP
-.B readsector
-Extract content of a single sector from an image to a file.
-.TP
-.B writesector
-Write file content to a specific sector on an image.
-.TP
-.B identify
-Try to recognize the format of an image file.
-.TP
-.B listformats
-Lists all image file formats supported by imgtool.
-.TP
-.B listfilters
-Lists all filters supported by imgtool.
-Filters are a mean to process data being written into or read out
-of an image in a certain way.
-.TP
-.B listdriveroptions
-Lists all format\-specific options for
-.B imgtool put
-and
-.B imgtool create
-commands.
-.\"
-.\"
-.\" EXAMPLES chapter
-.SH EXAMPLES
-.B imgtool dir coco_jvc_rsdos myimageinazip.zip
-.P
-.B imgtool get coco_jvc_rsdos myimage.dsk myfile.bin mynewfile.txt
-.P
-.B imgtool getall coco_jvc_rsdos myimage.dsk
-.\"
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-mess (6)
diff --git a/src/osd/sdl/man/jedutil.1 b/src/osd/sdl/man/jedutil.1
deleted file mode 100644
index e93d07a8e22..00000000000
--- a/src/osd/sdl/man/jedutil.1
+++ /dev/null
@@ -1,49 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" jedutil.1
-.\"
-.\" Man page created from source and usage information
-.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
-.\"
-.\" References
-.\" http://aarongiles.com/?p=159
-.\"
-.TH JEDUTIL 1 2015-07-22 0.164 "MAME JEDEC file utilities"
-.\"
-.\" NAME chapter
-.SH NAME
-jedutil \- MAME JEDEC file utilities
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B jedutil
-.RI [ option ]
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-Data for Programmable Logic Devices (PLDs) are usually stored in a format known
-as JEDEC, basically a text file allowing insertion of further information by
-programmers.
-.PP
-MAME uses a raw binary representation of the same data, in order to
-achieve correct identification of PLD data through CRC and SHA1 algorithms
-(i.e. with the \-romident option).
-.PP
-.B jedutil
-provides an easy way to convert PLDs data between these two formats.
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-.TP
-.B \-convert \fIinputfile outputfile \fR[\fIfuses\fR]
-Converts JEDEC data between file formats. Both .jed (JEDEC) and .pla
-(Berkeley standard PLA) files can be converted to a .bin (binary) file,
-while a binary file can be converted to a .jed file only.
-.TP
-.B \-view \fIinputfile device
-Dump logic equations. \fIinputfile\fR can be either a JED or binary file.
-.TP
-.B \-viewlist
-View list of supported devices.
-.SH SEE ALSO
-mame(6), mess(6)
diff --git a/src/osd/sdl/man/ldplayer.1 b/src/osd/sdl/man/ldplayer.1
deleted file mode 100644
index 40c0cb34794..00000000000
--- a/src/osd/sdl/man/ldplayer.1
+++ /dev/null
@@ -1,52 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" ldplayer.1
-.\"
-.\" Man page created from source and usage information by
-.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
-.\"
-.TH LDPLAYER 1 2012-03-25 0.145u5 "ldplayer"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-ldplayer \- MAME laserdisc image player
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B ldplayer pr8210
-\-rompath \fI/path/to/pr8210.zip\fP\fB\\;\fP\fI/path/to/image.chd\fP
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B ldplayer
-is an optional utility that simply plays the audio and video from laserdisc
-CHD files. It actually emulates and therefore behaves just like a real
-laserdisc player \- you can pause, fast-forward, rewind, and all the rest.
-.\"
-.\"
-.\" NOTES chapter
-.SH NOTES
-First of all, you need to go to your MAME ROMs folder and make a copy of
-\fBcubeqst.zip\fP (the ROMs for Cube Quest). Rename it as \fBpr8210.zip\fP.
-.P
-Next, run ldplayer.
-Note that the first path in the \fB\-rompath\fP option is the full path
-to the \fBpr8210.zip\fP file and the second is the full path to the laserdisc
-CHD file you wish to play. \fINote\fP the backslash and the semicolon
-\- \fB\\;\fP \- between them.
-.P
-Once ldplayer is running, you can hit \fBTAB\fP like usual and check out
-Inputs (this game) to see the controls. Space is the Play/Pause button, for
-instance. Note that some laserdiscs (notably Cube Quest) have 30 seconds or
-more of nothing at the start, so you either need to be patient or use
-fast-forward to start seeing video.
-.\"
-.\"
-.\" FILES chapter
-.SH FILES
-.TP
-.B /etc/mame/ldplayer.ini
-Main configuration file.
diff --git a/src/osd/sdl/man/ldresample.1 b/src/osd/sdl/man/ldresample.1
deleted file mode 100644
index c56b8af2c06..00000000000
--- a/src/osd/sdl/man/ldresample.1
+++ /dev/null
@@ -1,46 +0,0 @@
-.\" Hey, EMACS: -*- nroff -*-
-.\" First parameter, NAME, should be all caps
-.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
-.\" other parameters are allowed: see man(7), man(1)
-.\"
-.TH LDRESAMPLE 1 2015-07-22 0.164 "MAME laserdisc audio manipulation tool"
-.\"
-.\" Please adjust this date whenever revising the manpage.
-.\"
-.\" Some roff macros, for reference:
-.\" .nh disable hyphenation
-.\" .hy enable hyphenation
-.\" .ad l left justify
-.\" .ad b justify to both left and right margins
-.\" .nf disable filling
-.\" .fi enable filling
-.\" .br insert line break
-.\" .sp <n> insert n+1 empty lines
-.\" for manpage-specific macros, see man(7)
-.SH "NAME"
-ldresample \- MAME laserdisc audio manipulation tool
-.SH "SYNOPSIS"
-.B ldresample
-.I source.chd
-.br
-.B ldresample
-.I source.chd
-.I output.chd
-.B offset
-.B [slope]
-.SH "DESCRIPTION"
-Assists in resynchronizing audio tracks in a CHD (Compressed Hunks of Data)
-file with frames.
-.PP
-.B Offset
-parameter and \fBslope\fR option make a linear equation f(x) which
-describes the sample offset from the source as a function of field number.
-.SH "COPYRIGHT"
-Copyright \(co 2008 Aaron Giles. BSD License.
-.SH "SEE ALSO"
-ldverify(1), mame(6), mess(6)
-.SH "AUTHORS"
-Written by Aaron Giles.
-.PP
-This manual page was written by Ludovic Lechapt <ludomatic@gmail.com>,
-for the Debian project but may be used by others.
diff --git a/src/osd/sdl/man/ldverify.1 b/src/osd/sdl/man/ldverify.1
deleted file mode 100644
index aae404164cb..00000000000
--- a/src/osd/sdl/man/ldverify.1
+++ /dev/null
@@ -1,25 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" ldverify.1
-.\"
-.\" Man page created from source and usage information by
-.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
-.\"
-.TH LDVERIFY 1 2015-07-22 0.164 "MAME laserdisc data checker"
-.\"
-.\" NAME chapter
-.SH NAME
-ldverify \- MAME laserdisc data checker
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B ldverify \fR[\fIavifile.avi\fR|\fIchdfile.chd\fR]
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-.B ldverify
-is a tool which walks through either an AVI or CHD capture from a
-laserdisc and ensures that there are no anomalies lurking in
-the VBI data.
-.SH SEE ALSO
-ldresample(1), mame(6), mess(6)
diff --git a/src/osd/sdl/man/mame.6 b/src/osd/sdl/man/mame.6
deleted file mode 100644
index 87e260ced5b..00000000000
--- a/src/osd/sdl/man/mame.6
+++ /dev/null
@@ -1,1176 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" mame.6
-.\"
-.\" Man page created from usage and source information:
-.\" * commands: see src/emu/clifront.c clifront.h
-.\" * options: core entries, see src/emu/emuopts.c emuopts.h
-.\" SDL-specific entries, see src/osd/sdl/sdlmain.c osdsdl.h
-.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
-.\"
-.\" Also, some text borrowed from the xmame 0.106 man page,
-.\" done by Rene Herrmann <rene.herrmann@berlin.de>, September 2000
-.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
-.\"
-.\"
-.TH MAME 6 2015-07-22 0.164 "MAME \- The Multiple Arcade Machine Emulator"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-MAME \- The Multiple Arcade Machine Emulator
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B mame
-.RI [ options ]
-.I gamename
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-Started in 1997 by Nicola Salmoria, MAME was originally intended as a series
-of emulators for individual games, which were later combined into a single
-multi\-game emulator. In the following years, MAME grew over and over up to
-the actual size, with more than 100 contributors to the project.
-.\"
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-.\"
-.\" *******************************************************
-.SS Core commands
-.\" *******************************************************
-.TP
-.B \-help, \-?
-Displays current MAME version and copyright notice.
-.TP
-.B \-validate, \-valid
-Performs internal validation on every driver in the system. Run this
-before submitting changes to ensure that you haven't violated any of
-the core system rules.
-.\"
-.\" *******************************************************
-.SS Configuration commands
-.\" *******************************************************
-.TP
-.B \-createconfig, \-cc
-Creates the default \fBmame.ini\fR file in the current directory. All the
-configuration options (not commands) described below can be permanently
-changed by editing this configuration file.
-.TP
-.B \-showconfig, \-sc
-Displays the current configuration settings.
-.TP
-.B \-showusage, \-su
-Displays a summary of all the command line options. For options that
-are not mentioned here, the short summary given by \fB\-showusage\fR
-is usually sufficient.
-.\"
-.\" *******************************************************
-.SS Frontend commands
-.\" *******************************************************
-All the list commands below write info to the screen.
-If you wish to write the info to a textfile instead, use redirection.
-For example,
-.B mame \-listxml > ~/mamelist.xml
-writes the full list of supported game to file \fImamelist.xml\fR in your home
-directory.
-.TP
-.B \-listxml, \-lx \fR[\fIgamename\fR|\fIwildcard\fR]
-List comprehensive details for all of the supported games. The output
-is quite long, so it is usually better to redirect this into a file.
-The output is in XML format. By default all games are listed; however,
-you can limit this list by specifying a driver name or wildcard after
-the \-listxml command.
-.TP
-.B \-listfull, \-ll \fR[\fIgamename\fR|\fIwildcard\fR]
-Displays a list of game driver names and descriptions. By default all
-games are listed; however, you can limit this list by specifying a
-driver name or wildcard after the \-listfull command.
-.TP
-.B \-listsource, \-ls \fR[\fIgamename\fR|\fIwildcard\fR]
-Displays a list of drivers and the names of the source files their game
-drivers live in. Useful for finding which driver a game runs on in
-order to fix bugs. By default all games are listed; however, you can
-limit this list by specifying a driver name or wildcard after the
-\-listsource command.
-.TP
-.B \-listclones, \-lc \fR[\fIgamename\fR|\fIwildcard\fR]
-Displays a list of clones. By default all clones are listed; however,
-you can limit this list by specifying a driver name or wildcard after
-the \-listclones command.
-.TP
-.B \-listbrothers, \-lb \fR[\fIgamename\fR|\fIwildcard\fR]
-Displays a list of "brothers" or other drivers from same sourcefile.
-By default all games are listed; however, you can limit this list by
-specifying a driver name or wildcard after the \-listbrothers command.
-.TP
-.B \-listcrc
-Displays a full list of CRCs of all ROM images referenced by all
-drivers within MAME code.
-.TP
-.B \-listroms, \-lr \fIgamename
-Displays a list of ROM images referenced by the specified game.
-.TP
-.B \-listsamples \fIgamename
-Displays a list of samples referenced by the specified game.
-.TP
-.B \-verifyroms \fR[\fIgamename\fR|\fIwildcard\fR]
-Checks for invalid or missing ROM images. By default all drivers that
-have valid ZIP files or directories in the rompath are verified;
-however, you can limit this list by specifying a driver name or
-wildcard after the \-verifyroms command.
-.TP
-.B \-verifysamples \fR[\fIgamename\fR|\fIwildcard\fR]
-Checks for invalid or missing samples. By default all drivers that
-have valid ZIP files or directories in the samplepath are verified;
-however, you can limit this list by specifying a driver name or
-wildcard after the \-verifyroms command.
-.TP
-.B \-romident
-Attempts to identify ROM files, if they are known to MAME, in the
-specified .zip file or directory. This command can be used to try and
-identify ROM sets taken from unknown boards. On exit, the errorlevel
-is returned as one of the following:
-.br
-\fB0\fR all files were identified
-.br
-\fB7\fR all files were identified except for some "non\-ROM" files
-.br
-\fB8\fR some files were identified
-.br
-\fB9\fR no files were identified
-.TP
-.B \-listdevices, \-ld
-Output the list of devices referenced by a given game or set of games.
-.TP
-.B \-listslots, \-lslot
-Output the list of available slots and slot devices for the system.
-.TP
-.B \-listmedia, \-lm
-Output the list of available media for the system.
-.TP
-.B \-listsoftware, \-lsoft
-Output the list of known software for the system.
-.TP
-.B \-verifysoftware, \-vsoft \fR[\fIgamename\fR|\fIwildcard\fR]
-Checks for invalid or missing ROM images in your software lists.
-By default all drivers that have valid ZIP files or directories
-in the rompath are verified; however, you can limit this list by
-specifying a specific driver name or wildcard.
-.TP
-.B \-getsoftlist, \-glist
-Retrieve software list by name.
-.TP
-.B \-verifysoftlist, \-vlist \fR[\fIsoftwarelistname\fR]
-Checks a specified software list for missing ROM images if files exist
-for issued softwarelistname. By default, all drivers that have valid
-ZIP files or directories in the rompath are verified; however, you can
-limit this list by specifying a specific softwarelistname (without .XML).
-.TP
-.B \-listmidi, \-mlist
-Create a list of list available MIDI I/O devices for use with emulation.
-.TP
-.B \-listnetwork, \-nlist
-List available network adapters.
-.\"
-.\" *******************************************************
-.SS Configuration options
-.\" *******************************************************
-.TP
-.B \-[no]readconfig, \-[no]rc
-Enables or disables the reading of the config files. When enabled
-(which is the default), MAME reads the following config files in order:
-.br
-1. \fBmame.ini\fR
-.br
-the main configuration file
-.br
-2. \fIname\fB.ini\fR
-.br
-where \fIname\fR is your executable name, i.e. mame unless you changed it
-(e.g. if you renamed mame to mame0137, the parsed file will be
-\fImame0137.ini\fR)
-.br
-3. \fBdebug.ini\fR, if the debugger is enabled
-.br
-4. \fBvector.ini\fR, for vector games only
-.br
-5. \fI[driver]\fB.ini\fR
-.br
-based on the source filename of the game driver
-.br
-6. \fI[parent]\fB.ini\fR
-.br
-for clones only, may be called recursively
-.br
-7. \fI[gamename]\fB.ini\fR
-.br
-note this sometimes resolves to the same of the source driver
-.br
-The settings in the later ini's override those in the earlier ini's.
-So, for example, if you wanted to disable overlay effects in the
-vector games, you can create a vector.ini with the "effect none" line
-in it, and it will override whatever effect value you have in your
-mame.ini. The default is ON (\-readconfig).
-.TP
-.B \-[no]writeconfig, \-[no]wc
-Write configuration to \fI[driver]\fR.ini on exit.
-Default is OFF (\-nowriteconfig).
-.\"
-.\" *******************************************************
-.SS Search path options
-.\" *******************************************************
-Be careful to use the path, directory and file options in
-mame.ini \fBONLY\fR. Otherwise, the outcome may be unpredictable and not
-consistent across releases.
-.TP
-.B \-rompath, \-rp, \-biospath, \-bp \fIpathname
-Specifies a list of paths within which to find ROM or hard disk images.
-Multiple paths can be specified by separating them with semicolons.
-The default is 'roms' (that is, a directory "roms" in the same directory
-as the MAME executable).
-.TP
-.B \-hashpath \fIpathname
-Specifies a list of paths within which to search for software hash files.
-Multiple paths can be specified by separating them with semicolons.
-The default is 'hash' (that is, a directory 'hash' in the same directory
-as the MAME executable).
-.TP
-.B \-samplepath, \-sp \fIpathname
-Specifies a list of paths within which to find sample files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'samples' (that is, a directory "samples" in the same directory as
-the MAME executable).
-.TP
-.B \-artpath, \-artwork_directory \fIpathname
-Specifies a list of paths within which to find artwork files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'artwork' (that is, a directory "artwork" in the same directory as
-the MAME executable).
-.TP
-.B \-ctrlrpath, \-ctrlr_directory \fIpathname
-Specifies a list of paths within which to find controller\-specific
-configuration files. Multiple paths can be specified by separating
-them with semicolons. The default is 'ctrlr' (that is, a directory
-"ctrlr" in the same directory as the MAME executable).
-.TP
-.B \-inipath \fIpathname
-Specifies a list of paths within which to find .INI files. Multiple
-paths can be specified by separating them with semicolons. The default
-is '/etc/mame/'.
-.TP
-.B \-fontpath \fIpathname
-Specifies a list of paths within which to find .BDF font files. Multiple
-paths can be specified by separating them with semicolons. The default
-is '.' (that is, search in the same directory as the MAME executable).
-.TP
-.B \-cheatpath \fIpathname
-Specifies a list of paths within which to find cheat files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'cheat' (that is, a directory 'cheat' in the same directory as
-the MAME executable).
-.TP
-.B \-crosshairpath \fIpathname
-Specifies a list of paths within which to find crosshair files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'crosshair' (that is, a directory "crosshair" in the same directory as
-the MAME executable). If the Crosshair is set to default in the menu,
-MAME will look for gamename\cross#.png and then cross#.png in the
-specified crosshairpath, where # is the player number. Failing that,
-MAME will use built\-in default crosshairs.
-.\"
-.\" *******************************************************
-.SS Output Directory Options
-.\" *******************************************************
-.TP
-.B \-cfg_directory \fIpathname
-Specifies a single directory where configuration files are stored.
-Configuration files store user configurable settings that are read at
-startup and written when MAME exits. The default is 'cfg' (that is,
-a directory "cfg" in the same directory as the MAME executable). If this
-directory does not exist, it will be automatically created.
-.TP
-.B \-nvram_directory \fIpathname
-Specifies a single directory where NVRAM files are stored. NVRAM files
-store the contents of EEPROM and non\-volatile RAM (NVRAM) for games
-which used this type of hardware. This data is read at startup and
-written when MAME exits. The default is 'nvram' (that is, a directory
-"nvram" in the same directory as the MAME executable). If this directory
-does not exist, it will be automatically created.
-.TP
-.B \-input_directory \fIpathname
-Specifies a single directory where input recording files are stored.
-Input recordings are created via the \-record option and played back via
-the \-playback option. The default is 'inp' (that is, a directory
-"inp" in the same directory as the MAME executable). If this directory
-does not exist, it will be automatically created.
-.TP
-.B \-state_directory \fIpathname
-Specifies a single directory where save state files are stored. Save
-state files are read and written either upon user request, or when using
-the \-autosave option. The default is 'sta' (that is, a directory "sta"
-in the same directory as the MAME executable). If this directory does
-not exist, it will be automatically created.
-.TP
-.B \-snapshot_directory \fIpathname
-Specifies a single directory where screen snapshots are stored, when
-requested by the user. The default is 'snap' (that is, a directory
-"snap" in the same directory as the MAME executable). If this directory
-does not exist, it will be automatically created.
-.TP
-.B \-diff_directory \fIpathname
-Specifies a single directory where hard drive differencing files are
-stored. Hard drive differencing files store any data that is written
-back to a hard disk image, in order to preserve the original image. The
-differencing files are created at startup when a game with a hard disk
-image. The default is 'diff' (that is, a directory "diff" in the same
-directory as the MAME executable). If this directory does not exist,
-it will be automatically created.
-.TP
-.B \-comment_directory \fIpathname
-Specifies a single directory where debugger comment files are stored.
-Debugger comment files are written by the debugger when comments are
-added to the disassembly for a game. The default is 'comments' (that is,
-a directory "comments" in the same directory as the MAME executable).
-If this directory does not exist, it will be automatically created.
-.\"
-.\" *******************************************************
-.SS State/playback options
-.\" *******************************************************
-.TP
-.B \-state \fIslot
-Immediately after starting the specified game, will cause the save
-state in the specified \fIslot\fP to be loaded.
-.TP
-.B \-[no]autosave
-When enabled, automatically creates a save state file when exiting MAME
-and automatically attempts to reload it when later starting MAME with
-the same game. This only works for games that have explicitly enabled
-save state support in their driver. The default is OFF (\-noautosave).
-.TP
-.B \-playback, \-pb \fIfilename
-Specifies a file from which to play back a series of game inputs. This
-feature does not work reliably for all games, but can be used to watch
-a previously recorded game session from start to finish. In order to
-make things consistent, you should only record and playback with all
-configuration (.cfg), NVRAM (.nv), and memory card files deleted. The
-default is NULL (no playback).
-.TP
-.B \-[no]exit_after_playback
-If play back is enabled (see \-playback option) the program exits when
-end of file is reached. Otherwise the machine will continue to run.
-Default is OFF (\-noexit_after_playback).
-.TP
-.B \-record, \-rec \fIfilename
-Specifies a file to record all input from a game session. This can be
-used to record a game session for later playback. This feature does not
-work reliably for all games, but can be used to watch a previously
-recorded game session from start to finish. In order to make things
-consistent, you should only record and playback with all configuration
-(.cfg), NVRAM (.nv), and memory card files deleted. The default is NULL
-(no recording).
-.TP
-.B \-[no]record_timecode
-Specify whether to create a timecode file. It contains a line with elapsed
-times on each press of timecode shortcut key (default is F12).
-This option works only when recording mode is enabled (\-record option).
-The file is saved on inp folder.
-Default is OFF (\-norecord_timecode).
-.TP
-.B \-mngwrite \fIfilename
-Writes each video frame to the given \fIfilename\fP in MNG format, producing
-an animation of the game session. Note that \-mngwrite only writes video
-frames; it does not save any audio data. Use \-wavwrite for that, and
-reassemble the audio/video using offline tools. The default is NULL (no
-recording).
-.TP
-.B \-aviwrite \fIfilename
-Stream video and sound data to the given \fIfilename\fP in AVI format,
-producing an animation of the game session complete with sound. The
-default is NULL (no recording).
-.TP
-.B \-wavwrite \fIfilename
-Writes the final mixer output to the given \fIfilename\fP in WAV format,
-producing an audio recording of the game session. The default is NULL
-(no recording).
-.TP
-.B \-snapname \fIstring
-Describes how MAME should name files for snapshots. \fIstring\fP
-provides a template that is used to generate a filename. Three
-simple substitutions are provided: the / character represents the
-path separator on any target platform (even Windows); the literal \fB%g\fP
-represents the driver name of the current game; and the literal \fB%i\fP
-represents an incrementing index. If \fB%i\fP is omitted, then each
-snapshot taken will overwrite the previous one; otherwise, MAME will
-find the next empty value for \fB%i\fP and use that for a filename. The
-default is \fB%g/%i\fP, which creates a separate folder for each game,
-and names the snapshots under it starting with 0000 and increasing
-from there. Example: if you use
-.B mame robby \-snapname foo/%g%i
-snapshots will be saved as \fBsnaps/foo/robby0000.png\fP,
-\fBsnaps/foo/robby0001.png\fP and so on.
-.TP
-.B \-snapsize \fIwidth\fPx\fIheight
-Hard\-codes the size for snapshots and movie recording. By default,
-MAME will create snapshots at the game's current resolution in raw
-pixels, and will create movies at the game's starting resolution in
-raw pixels. If you specify this option, then MAME will create both
-snapshots and movies at the size specified, and will bilinear filter
-the result. Note that this size does not automatically rotate if the
-game is vertically oriented. The default is 'auto'.
-.TP
-.B \-snapview internal\fR|\fBauto\fR|\fIviewname
-Specifies the view to use when rendering snapshots and movies. By
-default, both use a special 'internal' view, which renders a separate
-snapshot per screen or renders movies only of the first screen. By
-specifying this option, you can override this default behavior and
-select a single view that will apply to all snapshots and movies.
-Note that \fIviewname\fP does not need to be a perfect match; rather, it
-will select the first view whose name matches all the characters
-specified by \fIviewname\fP. For example, \-snapview native will match the
-"Native (15:14)" view even though it is not a perfect match.
-\fIviewname\fP can also be 'auto', which selects the first view with all
-screens present. The default value is 'internal'.
-.TP
-.B \-[no]snapbilinear
-Specify whether snapshot/movie should have bilinear filtering applied.
-Default is ON (\-snapbilinear).
-.TP
-.B \-statename \fIstring
-Describes how MAME should store save state files, relative to the
-state_directory path. \fIstring\fP provides a template that
-is used to generate a relative path. Two simple substitutions are
-provided: the / character represents the path separator on any target
-platform (even Windows); the literal \fB%g\fP represents the driver name of
-the current game. The default is '%g', which creates a separate folder
-for each game. Example: if you use
-.B mame robby \-statename foo/%g
-save states will be stored inside \fBsta/foo/robby/\fP.
-.TP
-.B \-[no]burnin
-Tracks brightness of the screen during play and at the end of
-emulation generates a PNG that can be used to simulate burn\-in
-effects on other games. The resulting PNG is created such that the
-least used\-areas of the screen are fully white (since burned\-in areas
-are darker, all other areas of the screen must be lightened a touch).
-The intention is that this PNG can be loaded via an artwork file with
-a low alpha (e.g, 0.1\-0.2 seems to work well) and blended over the
-entire screen. The PNG files are saved in the snap directory under
-the gamename\\burnin\-<screen.name>.png. The default is OFF (\-noburnin).
-.\"
-.\" *******************************************************
-.SS Performance options
-.\" *******************************************************
-.TP
-.B \-[no]autoframeskip, \-[no]afs
-Automatically determines the frameskip level while you're playing the
-game, adjusting it constantly in a frantic attempt to keep the game
-running at full speed. Turning this on overrides the value you have set
-for \-frameskip below. The default is OFF (\-noautoframeskip).
-.TP
-.B \-frameskip, \-fs \fIvalue
-Specifies the frameskip value (autoframeskip must be disabled). This is the
-number of frames out of every 12 to drop when running. For example, if you
-say \-frameskip 2, then MAME will display 10 out of every 12 frames. By
-skipping those frames, you may be able to get full speed in a game that
-requires more horsepower than your computer has. The default value is 0,
-which skips no frames.
-.TP
-.B \-seconds_to_run, \-str \fIvalue
-This option can be used for benchmarking and automated testing. It tells
-MAME to stop execution after a fixed number of seconds. By combining
-this with a fixed set of other command line options, you can set up a
-consistent environment for benchmarking MAME performance. In addition,
-upon exit, the \-str option will write a screenshot called final.png
-to the game's snapshot directory.
-.TP
-.B \-[no]throttle
-Configures the default thottling setting. When throttling is on, MAME
-attempts to keep the game running at the game's intended speed. When
-throttling is off, MAME runs the game as fast as it can. Note that the
-fastest speed is more often than not limited by your graphics card,
-especially for older games. The default is ON (\-throttle).
-.TP
-.B \-[no]sleep
-Allows MAME to give time back to the system when running with \-throttle.
-This allows other programs to have some CPU time, assuming that the
-game isn't taxing 100% of your CPU resources. This option can potentially
-cause hiccups in performance if other demanding programs are running.
-The default is ON (\-sleep).
-.TP
-.B \-speed \fIvalue
-Controls the speed of gameplay, relative to realtime; smaller numbers are
-slower. Default is 1.00.
-.TP
-.B \-[no]refreshspeed, \-[no]rs
-Automatically adjusts the \fB\-speed\fR parameter to keep the effective refresh
-rate below that of the lowest screen refresh rate.
-Default is OFF (\-norefreshspeed).
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" OS specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]multithreading, \-[no]mt
-Enable multithreading; this enables rendering and blitting on a separate
-thread. The default is OFF (\-nomultithreading).
-.TP
-.B \-numprocessors, \-np \fIvalue
-Set number of processors; this overrides the number the system reports.
-.TP
-.B \-bench \fIvalue
-Benchmark for the given number of emulated seconds;
-implies \-video none \-sound none \-nothrottle.
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]sdlvideofps
-Show SDL video performance. Default is OFF (\-nosdlvideofps).
-.\"
-.\" *******************************************************
-.SS Rotation options
-.\" *******************************************************
-.TP
-.B \-[no]rotate
-Rotate the game to match its normal state (horizontal/vertical). This
-ensures that both vertically and horizontally oriented games show up
-correctly without the need to rotate your monitor. If you want to keep
-the game displaying 'raw' on the screen the way it would have in the
-arcade, turn this option OFF. The default is ON (\-rotate).
-.TP
-.B \-[no]ror | \-[no]rol
-Rotate the game screen to the right (clockwise) or left (counter\-
-clockwise) relative to either its normal state (if \-rotate is specified)
-or its native state (if \-norotate is specified).
-Default for both is OFF (\-noror \-norol).
-.TP
-.B \-[no]autoror | \-[no]autorol
-These options are designed for use with pivoting screens that only
-pivot in a single direction. If your screen only pivots clockwise,
-use \-autorol to ensure that the game will fill the screen either
-horizontally or vertically in one of the directions you can handle.
-If your screen only pivots counter\-clockwise, use \-autoror.
-Default for both is OFF (\-noautoror \-noautorol).
-.TP
-.B \-[no]flipx \-[no]flipy
-Flip (mirror) the game screen either horizontally (\-flipx) or
-vertically (\-flipy). The flips are applied after the \-rotate and
-\-ror/\-rol options are applied.
-Default for both is OFF (\-noflipx \-noflipy).
-.\"
-.\" *******************************************************
-.SS Artwork options
-.\" *******************************************************
-.TP
-.B \-[no]artwork_crop, \-[no]artcrop
-Enable cropping of artwork to the game screen area only. This
-option can also be controlled via the Video Options menu in the user
-interface. The default is OFF (\-noartwork_crop).
-.TP
-.B \-[no]use_backdrops, \-[no]backdrop
-Enables/disables the display of backdrops. The default is ON
-(\-use_backdrops).
-.TP
-.B \-[no]use_overlays, \-[no]overlay
-Enables/disables the display of overlays. The default is ON
-(\-use_overlays).
-.TP
-.B \-[no]use_bezels, \-[no]bezel
-Enables/disables the display of bezels. The default is ON
-(\-use_bezels).
-.TP
-.B \-[no]use_cpanels, \-[no]cpanel
-Enables/disables the display of cpanels. The default is ON
-(\-use_bezels).
-.TP
-.B \-[no]use_marquees, \-[no]marquee
-Enables/disables the display of marquees. The default is ON
-(\-use_bezels).
-.\"
-.\" *******************************************************
-.SS Screen options
-.\" *******************************************************
-.TP
-.B \-brightness \fIvalue
-Controls the default brightness, or black level, of the game screens.
-This option does not affect the artwork or other parts of the display.
-Using the MAME UI, you can individually set the brightness for each game
-screen; this option controls the initial value for all visible game
-screens. The standard value is 1.0. Selecting lower values (down to 0.1)
-will produce a darkened display, while selecting higher values (up to
-2.0) will give a brighter display. The default is 1.0.
-.TP
-.B \-contrast \fIvalue
-Controls the contrast, or white level, of the game screens. This option
-does not affect the artwork or other parts of the display. Using the
-MAME UI, you can individually set the contrast for each game screen;
-this option controls the initial value for all visible game screens. The
-standard value is 1.0. Selecting lower values (down to 0.1) will produce
-a dimmer display, while selecting higher values (up to 2.0) will
-give a more saturated display. The default is 1.0.
-.TP
-.B \-gamma \fIvalue
-Controls the gamma, which produces a potentially nonlinear black to
-white ramp, for the game screens. This option does not affect the
-artwork or other parts of the display. Using the MAME UI, you can
-individually set the gamma for each game screen; this option controls
-the initial value for all visible game screens. The standard value is
-1.0, which gives a linear ramp from black to white. Selecting lower
-values (down to 0.1) will increase the nonlinearity toward black,
-while selecting higher values (up to 3.0) will push the nonlinearity
-toward white. The default is 1.0.
-.TP
-.B \-pause_brightness \fIvalue
-This controls the brightness level when MAME is paused. The default
-value is 0.65.
-.TP
-.B \-effect\fR [\fInone\fR|\fIfilename[.png]\fR]
-Name of a PNG file to use for visual effects, or 'none'. Default is 'none'.
-.\"
-.\" *******************************************************
-.SS Vector rendering options
-.\" *******************************************************
-.TP
-.B \-[no]antialias, \-[no]aa
-Enables antialiased line rendering for vector games. The default is ON
-(\-antialias).
-.TP
-.B \-beam \fIvalue
-Sets the width of the vectors. This is a scaling factor against the
-standard vector width. A value of 1.0 will keep the default vector line
-width. Smaller values will reduce the width, and larger values will
-increase the width. The default is 1.0.
-.TP
-.B \-flicker \fIvalue
-Simulates a vector "flicker" effect, similar to a vector monitor that
-needs adjustment. This option requires a float argument in the range of
-0.00\-100.00 (0=none, 100=maximum). The default is 0.
-.\"
-.\" *******************************************************
-.SS Video options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-video\fR [\fIsoft\fR|\fIopengl\fR|\fInone\fR]
-Specifies which video subsystem to use for drawing:
-.br
-\fBsoft\fR uses software rendering, which is slower but more compatible.
-.br
-\fBopengl\fR uses OpenGL and your graphics accelerator to speed up many
-aspects of drawing MAME including compositing artwork, overlays, and
-bezels, as well as stretching the image to fit your screen.
-output on some cards.
-.br
-\fBnone\fR does no drawing and is intended for CPU benchmarking.
-.br
-Default is SOFT.
-.TP
-.B \-[no]window, \-[no]w
-Run MAME in either full screen or a window. This is a fully\-featured window
-mode where the window resizes as necessary to track what the game does.
-And you can resize it yourself with your OS's standard window controls.
-The default is OFF (\-nowindow).
-.TP
-.B \-[no]maximize, \-[no]max
-Controls initial window size in windowed mode. If it is set on, the
-window will initially be set to the maximum supported size when you
-start MAME. If it is turned off, the window will start out at the
-smallest supported size. This option only has an effect when the
-\-window option is used. The default is ON (\-maximize).
-.TP
-.B \-[no]keepaspect, \-[no]ka
-Forces the correct aspect ratio. This means when you're resizing the window
-in windowed mode the actual game image will resize in discrete steps to
-maintain the proper shape of the game graphics. If you turn this off you can
-resize the window to anything you like and get funny squishing and stretching.
-The same applies for full\-screen. Default is ON (\-keepaspect).
-.TP
-.B \-[no]unevenstretch, \-[no]ues
-Allow non\-integer stretch factors. Video purists should stay far, far away
-from this option, while everyone else will be happy to know that it lets you
-fill the screen properly in full\-screen mode. Default is ON (\-unevenstretch).
-.TP
-.B \-[no]centerh
-Center horizontally within the view area. Default is ON (\-centerh).
-.TP
-.B \-[no]centerv
-Center vertically within the view area. Default is ON (\-centerv).
-.TP
-.B \-[no]waitvsync, \-[no]vs
-Enable waiting for the start of VBLANK before flipping screens;
-reduces tearing effects. Default is OFF (\-nowaitvsync).
-.TP
-.B \-[no]syncrefresh, \-[no]srf
-Enable using the start of VBLANK for throttling instead of the game time.
-Default is OFF (\-nosyncrefresh).
-.\"
-.\" *******************************************************
-.SS Software video rendering subsystem options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.B NOTE:
-All the options in this group are available only with softare video
-rendering subsystem, i.e \fB\-video soft\fR.
-.TP
-.B \-prescale\fR [\fIvalue\fR]
-Scale screen rendering by this amount in software. Default is 1.
-.TP
-.B \-scalemode, \-sm \fR[\fInone\fR|\fIasync\fR|\fIyv12\fR|\fIyuy2\fR|\fIyv12x2\fR|\fIyuy2x2\fR]
-Hardware scaling mode.
-.br
-\fBnone\fR use software rendering.
-.br
-\fBasync\fR async overlay.
-.br
-\fByv12\fR yv12 overlay.
-.br
-\fByuy2\fR yuy2 overlay.
-.br
-\fByv12x2\fR yv12 overlay using x2 prescaling.
-.br
-\fByuy2x2\fR yuy2 overlay using x2 prescaling.
-.br
-Default is NONE.
-.\"
-.\" *******************************************************
-.SS OpenGL video rendering subsystem options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.B NOTE:
-All the options in this group are available only with OpenGL video
-rendering subsystem, i.e \fB\-video opengl\fR or \fB\-video opengl16\fR.
-.TP
-.B \-[no]filter, \-[no]glfilter, \-[no]flt
-Enable bilinear filtering on screen output. Default is ON (\-filter).
-.TP
-.B \-prescale\fR [\fIvalue\fR]
-Scale screen rendering by this amount in software. Default is 1.
-.TP
-.B \-[no]gl_forcepow2texture
-Force power of two textures. Default is OFF (\-nogl_forcepow2texture).
-.TP
-.B \-[no]gl_notexturerect
-Don't use OpenGL GL_ARB_texture_rectangle. Turn off if
-corruption occurs in OpenGL mode, at cost of some performance
-loss. Default is ON (\-gl_notexturerect).
-.TP
-.B \-[no]gl_vbo
-Enable OpenGL VBO, if available, for a performance increase.
-Turn off if corruption occurs. Default is ON (\-gl_vbo).
-.TP
-.B \-[no]gl_pbo
-Enable OpenGL PBO, if available, for a performance increase.
-Turn off if corruption occurs. Default is ON (\-gl_pbo).
-.TP
-.B \-[no]gl_glsl
-Enable OpenGL GLSL, if available, for a performance increase.
-Default is OFF (\-nogl_glsl).
-.TP
-.B \-gl_glsl_filter \fIvalue
-Enable OpenGL GLSL filtering instead of FF filtering 0=plain, 1=bilinear.
-Default is 1: bilinear.
-.TP
-.B \-glsl_shader_mame[0\-9]
-Preferred custom OpenGL GLSL shader set mame bitmap (from 0 to 9).
-.TP
-.B \-glsl_shader_screen[0\-9]
-Preferred custom OpenGL GLSL shader screen bitmap (from 0 to 9).
-.TP
-.B \-gl_glsl_vid_attr
-Enable OpenGL GLSL handling of brightness and contrast. Better RGB game
-performance for free. Default is ON.
-.TP
-.B \-screen
-Explicit name for all screens; 'auto' here will try to make a best guess.
-.TP
-.B \-aspect, \-screen_aspect
-Aspect ratio for all screens; 'auto' here will try to make a best guess.
-.TP
-.B \-resolution, \-r
-Preferred resolution for all screens;
-format is \fIwidth\fRx\fIheight\fR[@\fIrefreshrate\fR] or 'auto'.
-.TP
-.B \-view
-Preferred view for all screens
-.TP
-.B \-screen[0\-3]
-Explicit name of the first|second|third|fourth screen; 'auto' here will try
-to make a best guess.
-.TP
-.B \-aspect[0\-3]
-Aspect ratio of the first|second|third|fourth screen; 'auto' here will try
-to make a best guess.
-.TP
-.B \-resolution[0\-3], \-r[0\-3]
-Preferred resolution for the first|second|third|fourth screen;
-format is \fIwidth\fRx\fIheight\fR[@\fIrefreshrate\fR] or 'auto'.
-.TP
-.B \-view[0\-3]
-Preferred view for the first|second|third|fourth screen.
-.\"
-.\" *******************************************************
-.SS Full screen options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]switchres
-Affects full screen mode only. Chooses if MAME can try to change the screen
-resolution (color depth is normally left alone) when in full\-screen mode. If
-it's off, you always get your desktop resolution in full\-screen mode (which can
-be useful for LCDs). Default is OFF (\-noswitchres).
-.TP
-.B \-[no]useallheads
-Split full screen image across monitors. Default is OFF (\-nouseallheads).
-.\"
-.\" *******************************************************
-.SS Sound options
-.\" *******************************************************
-.TP
-.B \-[no]sound
-Enable or disable sound altogether. The default is ON (\-sound).
-.TP
-.B \-samplerate, \-srf \fIvalue
-Sets the audio sample rate. Smaller values (e.g. 11025) cause lower
-audio quality but faster emulation speed. Higher values (e.g. 48000)
-cause higher audio quality but slower emulation speed. The default is
-48000.
-.TP
-.B \-[no]samples
-Use samples if available. The default is ON (\-samples).
-.TP
-.B \-volume, \-vol \fIvalue
-Sets the startup volume. It can later be changed with the user interface
-(see Keys section). The volume is an attenuation in dB: e.g.,
-"\-volume \-12" will start with \-12dB attenuation. The default is 0.
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-audio_latency \fIvalue
-This controls the amount of latency built into the audio streaming.
-The latency parameter controls the lower threshold. The default is 1
-(meaning lower=1/5 and upper=2/5). Set it to 2 (\-audio_latency 2) to keep
-the sound buffer between 2/5 and 3/5 full. If you crank it up to 4,
-you can definitely notice the lag.
-.\"
-.\" *******************************************************
-.SS Input options
-.\" *******************************************************
-.TP
-.B \-[no]coin_lockout, \-[no]coinlock
-Enables simulation of the "coin lockout" feature that is implmeneted
-on a number of game PCBs. It was up to the operator whether or not
-the coin lockout outputs were actually connected to the coin
-mechanisms. If this feature is enabled, then attempts to enter a coin
-while the lockout is active will fail and will display a popup message
-in the user interface. If this feature is disabled, the coin lockout
-signal will be ignored. The default is ON (\-coin_lockout).
-.TP
-.B \-ctrlr \fIcontroller
-Enables support for special controllers. Configuration files are
-loaded from the ctrlrpath. They are in the same format as the .cfg
-files that are saved, but only control configuration data is read
-from the file. The default is NULL (no controller file).
-.TP
-.B \-[no]mouse
-Controls whether or not MAME looks for a mouse controller to use. Note
-that in many cases, lightguns are treated as mice by the operating
-system, so you may need to enable this to enable lightgun support. When
-this is enabled, you will not be able to use your mouse while playing
-a game. If you want to get control of your computer back, you will need
-to either pause the game or quit. The default is OFF (\-nomouse).
-.TP
-.B \-[no]joystick, \-[no]joy
-Controls whether or not MAME looks for joystick/gamepad controllers.
-The default is ON (\-joystick).
-.TP
-.B \-[no]lightgun, \-[no]gun
-Controls whether or not MAME makes use of lightgun controllers.
-Note that most lightguns map to the mouse, so using \-lightgun and
-\-mouse together may produce strange results. The default is OFF
-(\-nolightgun).
-.TP
-.B \-[no]multikeyboard, \-[no]multikey
-Determines whether MAME differentiates between multiple keyboards.
-Some systems may report more than one keyboard; by default, the data
-from all of these keyboards is combined so that it looks like a single
-keyboard. Turning this option on will enable MAME to report keypresses
-on different keyboards independently. The default is OFF
-(\-nomultikeyboard).
-.TP
-.B \-[no]multimouse
-Determines whether MAME differentiates between multiple mice. Some
-systems may report more than one mouse device; by default, the data
-from all of these mice is combined so that it looks like a single
-mouse. Turning this option on will enable MAME to report mouse
-movement and button presses on different mice independently. The
-default is OFF (\-nomultimouse).
-.TP
-.B \-[no]steadykey, \-[no]steady
-Some games require two or more buttons to be pressed at exactly the
-same time to make special moves. Due to limitations in the PC keyboard
-hardware, it can be difficult or even impossible to accomplish that
-using the standard keyboard handling. This option selects a different
-handling that makes it easier to register simultaneous button presses,
-but has the disadvantage of making controls less responsive. The
-default is OFF (\-nosteadykey).
-.TP
-.B \-[no]ui_active
-Enable MAME user interface on top of emulated keyboard (if present).
-Default is OFF (\-noui_active).
-.TP
-.B \-[no]offscreen_reload, \-[no]reload
-Controls whether or not MAME treats a second button input from a
-lightgun as a reload signal. In this case, MAME will report the gun's
-position as (0,MAX) with the trigger held, which is equivalent to an
-offscreen reload. This is only needed for games that required you to
-shoot offscreen to reload, and then only if your gun does not support
-off screen reloads. The default is OFF (\-nooffscreen_reload).
-.TP
-.B \-joystick_map, \-joymap \fImap
-Controls how joystick values map to digital joystick controls.
-See /usr/share/doc/mame/config.txt for full details on \fImap\fR format.
-.TP
-.B \-joystick_deadzone, \-joy_deadzone, \-jdz \fIvalue
-If you play with an analog joystick, the center can drift a little.
-joystick_deadzone tells how far along an axis you must move before the
-axis starts to change. This option expects a float in the range of
-0.0 to 1.0. Where 0 is the center of the joystick and 1 is the outer
-limit. The default is 0.3.
-.TP
-.B \-joystick_saturation, \-joy_saturation, \-jsat \fIvalue
-If you play with an analog joystick, the ends can drift a little,
-and may not match in the +/\- directions. joystick_saturation tells how
-far along an axis movement change will be accepted before it reaches
-the maximum range. This option expects a float in the range of 0.0 to
-1.0, where 0 is the center of the joystick and 1 is the outer limit.
-The default is 0.85.
-.TP
-.B \-[no]natural, \-[no]nat
-Allows user to specify whether or not to use a natural keyboard.
-This allows you to start your game or system in a 'native' mode, depending
-on your region, allowing compatibility for non\-"QWERTY" style keyboards.
-The default is OFF (\-nonatural).
-.TP
-.B \-[no]joystick_contradictory, \-[no]joy_contradictory
-Enable contradictory direction digital joystick input at the same time.
-Default is OFF (\-nojoystick_contradictory).
-.TP
-.B \-coin_impulse \fItime
-Set coin impulse time. A negative value for \fItime\fR disables the impulse;
-set \fItime\fR to 0 to obey driver or give a positive value to set impulse time.
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-uimodekey, \-umk
-Specifies the key used to toggle between full and partial UI mode.
-.TP
-.B \-[no]keymap
-Enable keymap for non\-QWERTY keyboards. Used in conjunction with
-\fB\-keymap_file\fR. Default is OFF (\-nokeymap).
-.TP
-.B \-keymap_file \fIkeymap_file\fR
-Specifies the full path to the keymap file to be used. A few
-keymap files are available in \fB/usr/share/games/mess/keymaps\fR.
-.TP
-.B \-joy_idx[0\-8] \fIjoystick
-With these options you can assign a joystick to a
-specific index in MAME. Even if the kernel will list the joysticks
-in a different order on the next boot, MAME will still see the joystick
-as e.g. "Joystick 2". Use mame \-v to see which joysticks are recognized.
-Default is 'auto'.
-.TP
-.B \-[no]sixaxis
-Use special handling for PS3 Sixaxis controllers.
-Default is OFF (\-nosixaxis).
-.TP
-.B \-lightgun_index[1\-8]
-Map lightgun to specific index in MAME.
-.TP
-.B \-videodriver, \-vd \fIx11\fR|\fIdirectfb\fR|\fIauto\fR
-SDL video driver to use; auto selects SDL default.
-.TP
-.B \-audiodriver, \-ad \fIalsa\fR|\fIarts\fR|\fIauto\fR
-SDL audio driver to use; auto selects SDL default.
-.TP
-.B \-gl_lib \fIalsa\fR|\fIarts\fR|\fIauto\fR
-Alternative libGL.so to use; auto selects SDL default.
-.\"
-.\" *******************************************************
-.SS Input automatic enable options
-.\" *******************************************************
-.TP
-.B \-paddle_device, \-paddle \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-adstick_device, \-adstick \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-pedal_device, \-pedal \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-dial_device, \-dial \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-trackball_device, \-trackball \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-lightgun_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-positional_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-mouse_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-Each of these options controls autoenabling the mouse, or joystick
-depending on the presence of a particular class of analog
-control for a particular game. For example, if you specify the option
-\-paddle mouse, then any game that has a paddle control will automatically
-enable mouse controls just as if you had explicitly specified \-mouse.
-Note that these controls override the values of \-[no]mouse, \-[no]joystick, etc.
-.\"
-.\" *******************************************************
-.SS Debugging options
-.\" *******************************************************
-.TP
-.B \-[no]log
-Creates a file called error.log which contains all of the internal
-log messages generated by the MAME core and game drivers. The default
-is OFF (\-nolog).
-.TP
-.B \-[no]verbose, \-[no]v
-Displays internal diagnostic information. This information is very
-useful for debugging problems with your configuration. \fBIMPORTANT\fP: when
-reporting bugs, please run with mame \-verbose and include the resulting
-information. The default is OFF (\-noverbose).
-.TP
-.B \-[no]update_in_pause
-Enables updating the screen bitmap while the game is paused. This is
-useful for debuggin in some scenarios (and gets in the way in others).
-Default is OFF (\-noupdate_in_pause).
-.TP
-.B \-[no]debug, \-[no]d
-Activates the integrated debugger. By default, the debugger is entered
-by pressing the tilde (~) key during emulation. It is also entered
-immediately at startup. The default is OFF (\-nodebug).
-.TP
-.B \-debugscript \fIfilename
-Specifies a file that contains a list of debugger commands to execute
-immediately upon startup. The default is NULL (no commands).
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-debugger \fIdebugger_name
-Name of the debugger to use. Default is AUTO.
-.TP
-.B \-debugger_font, \-dfont \fIfont_name
-Specifies the font to use for debugging. Default is AUTO.
-.TP
-.B \-debugger_font_size, \-dfontsize \fIsize
-Specifies the font size to use for debugging.
-.TP
-.B \-[no]oslog
-Outputs the error.log data to the system debugger. This can be used at
-the same time as \-log to output the log data to both targets as well.
-Default is OFF (\-nooslog).
-.\"
-.\" *******************************************************
-.SS Misc options
-.\" *******************************************************
-.TP
-.B \-[no]drc
-Enable DRC cpu core if available. Default is ON (\-drc).
-.TP
-.B \-[no]drc_use_c
-Force DRC use C backend. Default is OFF (\-nodrc_use_c).
-.TP
-.B \-[no]drc_log_uml
-Write DRC UML disassembly log. Default is OFF (\-nodrc_log_uml).
-.TP
-.B \-[no]drc_log_native
-Write DRC native disassembly log. Default is OFF (\-no_drc_log_native).
-.TP
-.B \-bios \fIbiosname
-Specifies the specific BIOS to use with the current game, for game
-systems that make use of a BIOS. The \-listxml output will list all of
-the possible BIOS names for a game. The default is 'default'.
-.TP
-.B \-[no]cheat, \-[no]c
-Activates the cheat menu with autofire options and other tricks from
-the cheat database, if present.
-The default is OFF (\-nocheat).
-.TP
-.B \-[no]skip_gameinfo
-Forces MAME to skip displaying the game info screen. The default is OFF
-(\-noskip_gameinfo).
-.TP
-.B \-uifont \fIfontname
-Specifies the name of a BDF font file to use for the UI font. If this
-font cannot be found or cannot be loaded, the system will fall back
-to its built\-in UI font. On some platforms \fIfontname\fP can be a system
-font name instead of a BDF font file. The default is 'default' (use
-the OSD\-determined default font).
-.TP
-.B \-ramsize, \-ram \fIvalue
-Size of RAM (if supported by driver).
-.TP
-.B \-[no]confirm_quit
-Display confirm quit screen on exit. Default is ON (\-confirm_quit).
-.TP
-.B \-[no]ui_mouse
-Display UI mouse cursor. Default is OFF (\-noui_mouse).
-.TP
-.B \-autoboot_command, \-ab \fIcommand
-Command string to execute after machine boot (in quotes ""). To issue
-a quote to the emulation, use \fB"""\fP in the string.
-Using \fB\\n\fP will issue a create a new line, issuing what was
-typed prior as a command. Example:
-\fB\-autoboot_command "load """$""",8,1\\n"\fP.
-.TP
-.B \-autoboot_delay \fR[\fIvalue\fP]
-Timer delay (in seconds) to trigger command execution on autoboot.
-Default is 2.
-.TP
-.B \-autoboot_script, \-script \fR[\fIfilename.lua\fP]
-File containing scripting to execute after machine boot.
-.TP
-.B \-[no]http
-Enable local http server. Default is OFF (\-nohttp).
-.TP
-.B \-http_port \fIport
-Internal webserver listener port.
-.TP
-.B \-http_path \fIpath
-Path to web files. Default is /usr/share/games/mess/web.
-.TP
-.B \-[no]console
-Enable emulator LUA console. Default is OFF (\-noconsole).
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-watchdog \fIvalue
-Specifies a number of seconds after which MAME should automatically exit
-if it detects that the emulation has locked up.
-.\"
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-chdman(1), jedutil(1), ldresample(1), ldverify(1), romcmp(1), testkeys(1)
-.\"
-.\"
-.\" LEGAL NOTICE chapter
-.SH LEGAL NOTICE
-Please visit the MAME website for some important legal information:
-.PP
-http://mamedev.org/legal.html
diff --git a/src/osd/sdl/man/mess.6 b/src/osd/sdl/man/mess.6
deleted file mode 100644
index 3062b2a613b..00000000000
--- a/src/osd/sdl/man/mess.6
+++ /dev/null
@@ -1,1183 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" mess.6
-.\"
-.\" Man page created from usage and source information:
-.\" * commands: see src/emu/clifront.c clifront.h
-.\" * options: core entries, see src/emu/emuopts.c emuopts.h
-.\" SDL-specific entries, see src/osd/sdl/sdlmain.c osdsdl.h
-.\" Cesare Falco <c.falco@ubuntu.com>, March 2011
-.\"
-.\" Some text borrowed from the xmame 0.106 man page,
-.\" done by Rene Herrmann <rene.herrmann@berlin.de>, September 2000
-.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
-.\"
-.\" Other info's taken from MESS Wiki as well:
-.\" http://www.mess.org/
-.\"
-.\"
-.TH MESS 6 2015-05-20 0.162 "The Multiple Emulator Super System (MESS)"
-.\"
-.\"
-.\" NAME chapter
-.SH NAME
-MESS \- The Multiple Emulator Super System
-.\"
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B mess
-.I system
-.RI [ "media software" ]
-.RI [ options ]
-.\"
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-MESS documents the hardware for a wide variety of (mostly vintage) computers,
-video game consoles, and calculators through software emulation. As a nice
-side effect, MESS allows software and games for these hardware platforms
-to run on modern PCs.
-.\"
-.\"
-.\" SOFTWARE chapter
-.SH SOFTWARE
-A \fIsoftware\fR entry may be specified to attach an image file to the
-emulated system. In such a case, the appropriate \fImedia\fR switch
-is also required:
-.TP
-.B \-cart, \-cart1
-Cartrigde, used mainly by game consoles
-.TP
-.B \-cass
-Cassette (tape), widely used by old home computers
-.TP
-.B \-flop, -flop1
-Floppy disk
-.TP
-.B \-cdrom
-CD-Rom
-.\"
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-.\"
-.\" *******************************************************
-.SS Core commands
-.\" *******************************************************
-.TP
-.B \-help, \-?
-Displays current MESS version and copyright notice.
-.TP
-.B \-validate, \-valid
-Performs internal validation on every driver in MESS. Run this
-before submitting changes to ensure that you haven't violated any of
-the core system rules.
-.\"
-.\" *******************************************************
-.SS Configuration commands
-.\" *******************************************************
-.TP
-.B \-createconfig, \-cc
-Creates the default \fBmess.ini\fR file in the current directory. All the
-configuration options (not commands) described below can be permanently
-changed by editing this configuration file.
-.TP
-.B \-showconfig, \-sc
-Displays the current configuration settings.
-.TP
-.B \-showusage, \-su
-Displays a summary of all the command line options. For options that
-are not mentioned here, the short summary given by \fB\-showusage\fR
-is usually sufficient.
-.\"
-.\" *******************************************************
-.SS Frontend commands
-.\" *******************************************************
-All the list commands below write info to the screen.
-If you wish to write the info to a textfile instead, use redirection.
-For example,
-.B mess \-listxml > ~/messlist.xml
-writes the full list of supported systems to \fBmesslist.xml\fR in your
-home directory.
-.TP
-.B \-listxml, \-lx \fR[\fIsystem\fR|\fIwildcard\fR]
-List comprehensive details for all of the supported systems. The output
-is quite long, so it is usually better to redirect this into a file.
-The output is in XML format. By default all systems are listed; however,
-you can limit this list by specifying a driver name or wildcard.
-.TP
-.B \-listfull, \-ll \fR[\fIsystem\fR|\fIwildcard\fR]
-Displays a list of system driver names and descriptions. By default all
-systems are listed; however, you can limit this list by specifying a
-driver name or wildcard.
-.TP
-.B \-listsource, \-ls \fR[\fIsystem\fR|\fIwildcard\fR]
-Displays a list of drivers and the names of the source files their system
-drivers live in. Useful for finding which driver a system runs on in
-order to fix bugs. By default all systems are listed; however, you can
-limit this list by specifying a driver name or wildcard.
-.TP
-.B \-listclones, \-lc \fR[\fIsystem\fR|\fIwildcard\fR]
-Displays a list of clones. By default all clones are listed; however,
-you can limit this list by specifying a driver name or wildcard.
-.TP
-.B \-listbrothers, \-lb \fR[\fIsystem\fR|\fIwildcard\fR]
-Displays a list of "brothers" or other drivers from same sourcefile.
-By default all systems are listed; however, you can limit this list by
-specifying a driver name or wildcard.
-.TP
-.B \-listcrc
-Displays a full list of CRCs of all ROM images referenced by all
-drivers within MESS code.
-.TP
-.B \-listroms, \-lr \fIsystem
-Displays a list of ROM images referenced by the specified system.
-.TP
-.B \-listsamples \fIsystem
-Displays a list of samples referenced by the specified system.
-.TP
-.B \-verifyroms \fR[\fIsystem\fR|\fIwildcard\fR]
-Checks for invalid or missing ROM images. By default all drivers that
-have valid ZIP files or directories in the rom path are verified;
-however, you can limit this list by specifying a driver name or
-wildcard.
-.TP
-.B \-verifysamples \fR[\fIsystem\fR|\fIwildcard\fR]
-Checks for invalid or missing samples. By default all drivers that
-have valid ZIP files or directories in the samplepath are verified;
-however, you can limit this list by specifying a driver name or wildcard.
-.TP
-.B \-romident
-Attempts to identify ROM files, if they are known to MESS, in the
-specified .zip file or directory. This command can be used to try and
-identify ROM sets taken from unknown boards. On exit, the errorlevel
-is returned as one of the following:
-.br
-\fB0\fR all files were identified
-.br
-\fB7\fR all files were identified except for some "non\-ROM" files
-.br
-\fB8\fR some files were identified
-.br
-\fB9\fR no files were identified
-.TP
-.B \-listdevices, \-ld
-Output the list of devices referenced by a given system or set of systems.
-.TP
-.B \-listslots, \-lslot
-Output the list of available slots and slot devices for the system.
-.TP
-.B \-listmedia, \-lm
-Output the list of available media for the system.
-.TP
-.B \-listsoftware, \-lsoft
-Output the list of known software for the system.
-.TP
-.B \-verifysoftware, \-vsoft \fR[\fIgamename\fR|\fIwildcard\fR]
-Checks for invalid or missing ROM images in your software lists.
-By default all drivers that have valid ZIP files or directories
-in the rompath are verified; however, you can limit this list by
-specifying a specific driver name or wildcard.
-.TP
-.B \-getsoftlist, \-glist
-Retrieve software list by name.
-.TP
-.B \-verifysoftlist, \-vlist \fR[\fIsoftwarelistname\fR]
-Checks a specified software list for missing ROM images if files exist
-for issued softwarelistname. By default, all drivers that have valid
-ZIP files or directories in the rompath are verified; however, you can
-limit this list by specifying a specific softwarelistname (without .XML).
-.TP
-.B \-listmidi, \-mlist
-List available MIDI I/O devices.
-.TP
-.B \-listnetwork, \-nlist
-List available network adapters.
-.\"
-.\" *******************************************************
-.SS Configuration options
-.\" *******************************************************
-.TP
-.B \-[no]readconfig, \-[no]rc
-Enables or disables the reading of the config files. When enabled
-(which is the default), MESS reads the following config files in order:
-.br
-1. \fBmess.ini\fR
-.br
-the main configuration file
-.br
-2. \fI[driver]\fB.ini\fR
-.br
-based on the source file name of the system driver
-.br
-3. \fI[parent]\fB.ini\fR
-.br
-for clones only, may be called recursively
-.br
-4. \fI[system]\fB.ini\fR
-.br
-note this sometimes resolves to the same of the source driver
-.P
-The settings in the later ini's override those in the earlier ini's.
-The default is ON (\-readconfig).
-.TP
-.B \-[no]writeconfig, \-[no]wc
-Write configuration to \fI[driver]\fR.ini on exit.
-Default is OFF (\-nowriteconfig).
-.\"
-.\" *******************************************************
-.SS Search path options
-.\" *******************************************************
-Be careful to use the path, directory and file options in
-mess.ini ONLY. Otherwise, the outcome may be unpredictable and not
-consistent across releases.
-.TP
-.B \-rompath, \-rp, \-biospath, \-bp \fIpathname
-Specifies a list of paths within which to find ROM or hard disk images.
-Multiple paths can be specified by separating them with semicolons.
-The default is 'roms' (that is, a directory 'roms' in the same directory
-as the MESS executable).
-.TP
-.B \-hashpath \fIpathname
-Specifies a list of paths within which to search for software hash files.
-Multiple paths can be specified by separating them with semicolons.
-The default is 'hash' (that is, a directory 'hash' in the same directory
-as the MESS executable).
-.TP
-.B \-samplepath, \-sp \fIpathname
-Specifies a list of paths within which to find sample files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'samples' (that is, a directory 'samples' in the same directory as
-the MESS executable).
-.TP
-.B \-artpath, \-artwork_directory \fIpathname
-Specifies a list of paths within which to find artwork files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'artwork' (that is, a directory 'artwork' in the same directory as
-the MESS executable).
-.TP
-.B \-ctrlrpath, \-ctrlr_directory \fIpathname
-Specifies a list of paths within which to find controller\-specific
-configuration files. Multiple paths can be specified by separating
-them with semicolons. The default is 'ctrlr' (that is, a
-directory 'ctrlr' in the same directory as the MESS executable).
-.TP
-.B \-inipath \fIpathname
-Specifies a list of paths within which to find .ini files. Multiple
-paths can be specified by separating them with semicolons. The default
-is '/etc/mess'.
-.TP
-.B \-fontpath \fIpathname
-Specifies a list of paths within which to find .bdf font files. Multiple
-paths can be specified by separating them with semicolons. The default
-is '.' (that is, search in the same directory as the MESS executable).
-.TP
-.B \-cheatpath \fIpathname
-Specifies a list of paths within which to find cheat files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'cheat' (that is, a directory 'cheat' in the same directory as
-the MESS executable).
-.TP
-.B \-crosshairpath \fIpathname
-Specifies a list of paths within which to find crosshair files. Multiple
-paths can be specified by separating them with semicolons. The default
-is 'crosshair' (that is, a directory 'crosshair' in the same directory as
-the MESS executable). If the Crosshair is set to default in the menu,
-MESS will look for system/cross#.png and then cross#.png in the
-specified path, where # is the player number. Failing that,
-MESS will use built\-in default crosshairs.
-.\"
-.\" *******************************************************
-.SS Output Directory Options
-.\" *******************************************************
-.TP
-.B \-cfg_directory \fIpathname
-Specifies a single directory where configuration files are stored.
-Configuration files store user configurable settings that are read at
-startup and written when MESS exits. The default is 'cfg' (that is,
-a directory 'cfg' in the same directory as the MESS executable). If this
-directory does not exist, it will be automatically created.
-.TP
-.B \-nvram_directory \fIpathname
-Specifies a single directory where NVRAM files are stored. NVRAM files
-store the contents of EEPROM and non\-volatile RAM (NVRAM) for systems
-which used this type of hardware. This data is read at startup and
-written when MESS exits. The default is 'nvram' (that is, a
-directory 'nvram' in the same directory as the MESS executable). If this
-directory does not exist, it will be automatically created.
-.TP
-.B \-input_directory \fIpathname
-Specifies a single directory where input recording files are stored.
-Input recordings are created via the \-record option and played back via
-the \-playback option. The default is 'inp' (that is, a directory 'inp'
-in the same directory as the MESS executable). If this directory
-does not exist, it will be automatically created.
-.TP
-.B \-state_directory \fIpathname
-Specifies a single directory where save state files are stored. Save
-state files are read and written either upon user request, or when using
-the \-autosave option. The default is 'sta' (that is, a directory 'sta'
-in the same directory as the MESS executable). If this directory does
-not exist, it will be automatically created.
-.TP
-.B \-snapshot_directory \fIpathname
-Specifies a single directory where screen snapshots are stored, when
-requested by the user. The default is 'snap' (that is, a directory 'snap'
-in the same directory as the MESS executable). If this directory
-does not exist, it will be automatically created.
-.TP
-.B \-diff_directory \fIpathname
-Specifies a single directory where hard drive differencing files are
-stored. Hard drive differencing files store any data that is written
-back to a hard disk image, in order to preserve the original image. The
-differencing files are created at startup when a system with a hard disk
-image. The default is 'diff' (that is, a directory 'diff' in the same
-directory as the MESS executable). If this directory does not exist,
-it will be automatically created.
-.TP
-.B \-comment_directory \fIpathname
-Specifies a single directory where debugger comment files are stored.
-Debugger comment files are written by the debugger when comments are
-added to the disassembly for a system. The default is 'comments' (that is,
-a directory 'comments' in the same directory as the MESS executable).
-If this directory does not exist, it will be automatically created.
-.\"
-.\" *******************************************************
-.SS State/playback options
-.\" *******************************************************
-.TP
-.B \-state \fIslot
-Immediately after starting the specified system, will cause the save
-state in the specified slot to be loaded.
-.TP
-.B \-[no]autosave
-When enabled, automatically creates a save state file when exiting MESS
-and automatically attempts to reload it when later starting MESS with
-the same system. This only works for systems that have explicitly enabled
-save state support in their driver. The default is OFF (\-noautosave).
-.TP
-.B \-playback, \-pb \fIfilename
-Specifies a file from which to play back a series of system inputs. This
-feature does not work reliably for all systems, but can be used to watch
-a previously recorded system session from start to finish. In order to
-make things consistent, you should only record and playback with all
-configuration (.cfg), NVRAM (.nv), and memory card files deleted. The
-default is NULL (no playback).
-.TP
-.B \-[no]exit_after_playback
-If play back is enabled (see \-playback option) the program exits when
-end of file is reached. Otherwise the machine will continue to run.
-Default is OFF (\-noexit_after_playback).
-.TP
-.B \-record, \-rec \fIfilename
-Specifies a file to record all input from a system session. This can be
-used to record a system session for later playback. This feature does not
-work reliably for all systems, but can be used to watch a previously
-recorded system session from start to finish. In order to make things
-consistent, you should only record and playback with all configuration
-(.cfg), NVRAM (.nv), and memory card files deleted. The default is NULL
-(no recording).
-.TP
-.B \-[no]record_timecode
-Specify whether to create a timecode file. It contains a line with elapsed
-times on each press of timecode shortcut key (default is F12).
-This option works only when recording mode is enabled (\-record option).
-The file is saved on inp folder.
-Default is OFF (\-norecord_timecode).
-.TP
-.B \-mngwrite \fIfilename
-Writes each video frame to the given file in MNG format, producing
-an animation of the system session.
-Note that \-mngwrite only writes video frames; it does not save any audio
-data. Use \-wavwrite for that, and reassemble the audio/video using
-offline tools. The default is NULL (no recording).
-.TP
-.B \-aviwrite \fIfilename
-Stream video and sound data to the given file
-in AVI format, producing an animation of the system session complete
-with sound. The default is NULL (no recording).
-.TP
-.B \-wavwrite \fIfilename
-Writes the final mixer output to the given file
-in WAV format, producing an audio recording of the system session.
-The default is NULL (no recording).
-.TP
-.B \-snapname \fIstring
-Describes how MESS should name files for snapshots. \fIstring\fP
-provides a template that is used to generate a filename. Three
-simple substitutions are provided: the / character represents the
-path separator on any target platform (even Windows); the literal \fB%g\fP
-represents the driver name of the current system; and the literal \fB%i\fP
-represents an incrementing index. If \fB%i\fP is omitted, then each
-snapshot taken will overwrite the previous one; otherwise, MESS will
-find the next empty value for \fB%i\fP and use that for a filename. The
-default is '%g/%i', which creates a separate folder for each game,
-and names the snapshots under it starting with 0000 and increasing
-from there. In addition to the above, for drivers using different
-media, like carts or floppy disks, you can also use the
-\fB%d\fP\fI_[media]\fP indicator. Replace \fI[media]\fP with the media
-switch you want to use. A few examples: if you use
-.B mess nes \-cart robby \-snapname %g/%d_cart
-snapshots will be saved as \fBsnaps/nes/robby.png\fP; if you use
-.B mess c64 \-flop1 robby \-snapname %g/%d_flop1/%i
-snapshots will be saved as \fBsnaps/c64/robby/0000.png\fP.
-.TP
-.B \-snapsize \fIwidth\fRx\fIheight
-Hard\-codes the size for snapshots and movie recording. By default,
-MESS will create snapshots at the system's current resolution in raw
-pixels, and will create movies at the system's starting resolution in
-raw pixels. If you specify this option, then MESS will create both
-snapshots and movies at the size specified, and will bilinear filter
-the result. Note that this size does not automatically rotate if the
-system is vertically oriented. The default is 'auto'.
-.TP
-.B \-snapview internal\fR|\fBauto\fR|\fIviewname
-Specifies the view to use when rendering snapshots and movies. By
-default, both use a special 'internal' view, which renders a separate
-snapshot per screen or renders movies only of the first screen. By
-specifying this option, you can override this default behavior and
-select a single view that will apply to all snapshots and movies.
-Note that \fIviewname\fP does not need to be a perfect match; rather, it
-will select the first view whose name matches all the characters
-specified by \fIviewname\fP. For example, \-snapview native will match the
-"Native (15:14)" view even though it is not a perfect match.
-\fIviewname\fP can also be 'auto', which selects the first view with all
-screens present. The default value is 'internal'.
-.TP
-.B \-[no]snapbilinear
-Specify whether snapshot/movie should have bilinear filtering applied.
-Default is ON (\-snapbilinear).
-.TP
-.B \-statename \fIstring
-Describes how MESS should store save state files, relative to the
-state_directory path. \fIstring\fP provides a template that
-is used to generate a relative path. Two simple substitutions are
-provided: the / character represents the path separator on any target
-platform (even Windows); the literal \fB%g\fP represents the driver name of
-the current game. The default is '%g', which creates a separate folder
-for each game. In addition to the above, for drivers using different
-media, like carts or floppy disks, you can also use the
-\fB%d_\fP\fI[media]\fP indicator. Replace \fI[media]\fP with the media
-switch you want to use. A few examples: if you use
-.B mess nes \-cart robby \-statename %g/%d_cart
-save states will be stored inside \fBsta/nes/robby/\fP; if you use
-.B mess c64 \-flop1 robby \-statename %g/%d_flop1
-save states will be stored inside \fBsta/c64/robby/\fP.
-.TP
-.B \-[no]burnin
-Tracks brightness of the screen during play and at the end of
-emulation generates a PNG that can be used to simulate burn\-in
-effects on other systems. The resulting PNG is created such that the
-least\-used areas of the screen are fully white (since burned\-in areas
-are darker, all other areas of the screen must be lightened a touch).
-The intention is that this PNG can be loaded via an artwork file with
-a low alpha (e.g, 0.1\-0.2 seems to work well) and blended over the
-entire screen. The PNG files are saved in the snap directory under
-the system/burnin\-<screen.name>.png. The default is OFF (\-noburnin).
-.\"
-.\" *******************************************************
-.SS Performance options
-.\" *******************************************************
-.TP
-.B \-[no]autoframeskip, \-[no]afs
-Automatically determines the frameskip level while you're playing the
-system, adjusting it constantly in a frantic attempt to keep the system
-running at full speed. Turning this on overrides the value you have set
-for \-frameskip below. The default is OFF (\-noautoframeskip).
-.TP
-.B \-frameskip, \-fs \fIvalue
-Specifies the frameskip value (autoframeskip must be disabled). This is the
-number of frames out of every 12 to drop when running. For example, if you
-say \-frameskip 2, then MESS will display 10 out of every 12 frames. By
-skipping those frames, you may be able to get full speed in a system that
-requires more horsepower than your computer has. The default value is 0,
-which skips no frames.
-.TP
-.B \-seconds_to_run, \-str \fIvalue
-This option can be used for benchmarking and automated testing. It tells
-MESS to stop execution after a fixed number of seconds. By combining
-this with a fixed set of other command line options, you can set up a
-consistent environment for benchmarking MESS performance. In addition,
-upon exit, the \-str option will write a screenshot called final.png
-to the system's snapshot directory.
-.TP
-.B \-[no]throttle
-Configures the default thottling setting. When throttling is on, MESS
-attempts to keep the system running at the system's intended speed. When
-throttling is off, MESS runs the system as fast as it can. Note that the
-fastest speed is more often than not limited by your graphics card,
-especially for older systems. The default is ON (\-throttle).
-.TP
-.B \-[no]sleep
-Allows MESS to give time back to the system when running with \-throttle.
-This allows other programs to have some CPU time, assuming that the
-system isn't taxing 100% of your CPU resources. This option can potentially
-cause hiccups in performance if other demanding programs are running.
-The default is ON (\-sleep).
-.TP
-.B \-speed \fIvalue
-Controls the speed of gameplay, relative to realtime; smaller numbers are
-slower. Default is 1.00.
-.TP
-.B \-[no]refreshspeed, \-[no]rs
-Automatically adjusts the \-speed parameter to keep the effective refresh
-rate below that of the lowest screen refresh rate.
-Default is OFF (\-norefreshspeed).
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" OS specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]multithreading, \-[no]mt
-Enable multithreading; this enables rendering and blitting on a separate
-thread. The default is OFF (\-nomultithreading).
-.TP
-.B \-numprocessors, \-np \fIvalue
-Set number of processors; this overrides the number the system reports.
-.TP
-.B \-bench \fIvalue
-Benchmark for the given number of emulated seconds;
-implies \-video none \-sound none \-nothrottle.
-.\"
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]sdlvideofps
-Show SDL video performance. Default is OFF (\-nosdlvideofps).
-.\"
-.\" *******************************************************
-.SS Rotation options
-.\" *******************************************************
-.TP
-.B \-[no]rotate
-Rotate the system to match its normal state (horizontal/vertical). This
-ensures that both vertically and horizontally oriented systems show up
-correctly without the need to rotate your monitor. If you want to keep
-the system displaying 'raw' on the screen the way the actual machine would
-have, turn this option off. The default is ON (\-rotate).
-.TP
-.B \-[no]ror \-[no]rol
-Rotate the system screen to the right (clockwise) or left
-(counter\-clockwise) relative to either its normal state (if \-rotate
-is specified) or its native state (if \-norotate is specified).
-Default for both is OFF (\-noror \-norol).
-.TP
-.B \-[no]autoror \-[no]autorol
-These options are designed for use with pivoting screens that only
-pivot in a single direction. If your screen only pivots clockwise,
-use \-autorol to ensure that the system will fill the screen either
-horizontally or vertically in one of the directions you can handle.
-If your screen only pivots counter\-clockwise, use \-autoror.
-Default for both is OFF (\-noautoror \-noautorol).
-.TP
-.B \-[no]flipx \-[no]flipy
-Flip (mirror) the system screen either horizontally (\-flipx) or
-vertically (\-flipy). The flips are applied after the \-rotate and
-\-ror/\-rol options are applied.
-Default for both is OFF (\-noflipx \-noflipy).
-.\"
-.\" *******************************************************
-.SS Artwork options
-.\" *******************************************************
-.TP
-.B \-[no]artwork_crop, \-[no]artcrop
-Enable cropping of artwork to the system screen area only. This
-option can also be controlled via the Video Options menu in the user
-interface. The default is OFF (\-noartwork_crop).
-.TP
-.B \-[no]use_backdrops, \-[no]backdrop
-Enables/disables the display of backdrops. The default is ON
-(\-use_backdrops).
-.TP
-.B \-[no]use_overlays, \-[no]overlay
-Enables/disables the display of overlays. The default is ON
-(\-use_overlays).
-.TP
-.B \-[no]use_bezels, \-[no]bezel
-Enables/disables the display of bezels. The default is ON
-(\-use_bezels).
-.TP
-.B \-[no]use_cpanels, \-[no]cpanel
-Enables/disables the display of cpanels. The default is ON
-(\-use_bezels).
-.TP
-.B \-[no]use_marquees, \-[no]marquee
-Enables/disables the display of marquees. The default is ON
-(\-use_bezels).
-.\"
-.\" *******************************************************
-.SS Screen options
-.\" *******************************************************
-.TP
-.B \-brightness \fIvalue
-Controls the default brightness, or black level, of the system screens.
-This option does not affect the artwork or other parts of the display.
-Using the MESS UI, you can individually set the brightness for each system
-screen; this option controls the initial value for all visible system
-screens. The standard value is 1.0. Selecting lower values (down to 0.1)
-will produce a darkened display, while selecting higher values (up to
-2.0) will give a brighter display. The default is 1.0.
-.TP
-.B \-contrast \fIvalue
-Controls the contrast, or white level, of the system screens. This option
-does not affect the artwork or other parts of the display. Using the
-MESS UI, you can individually set the contrast for each system screen;
-this option controls the initial value for all visible system screens. The
-standard value is 1.0. Selecting lower values (down to 0.1) will produce
-a dimmer display, while selecting higher values (up to 2.0) will
-give a more saturated display. The default is 1.0.
-.TP
-.B \-gamma \fIvalue
-Controls the gamma, which produces a potentially nonlinear black to
-white ramp, for the system screens. This option does not affect the
-artwork or other parts of the display. Using the MESS UI, you can
-individually set the gamma for each system screen; this option controls
-the initial value for all visible system screens. The standard value is
-1.0, which gives a linear ramp from black to white. Selecting lower
-values (down to 0.1) will increase the nonlinearity toward black,
-while selecting higher values (up to 3.0) will push the nonlinearity
-toward white. The default is 1.0.
-.TP
-.B \-pause_brightness \fIvalue
-This controls the brightness level when MESS is paused. The default
-value is 0.65.
-.TP
-.B \-effect\fR [\fInone\fR|\fIfilename[.png]\fR]
-Name of a PNG file to use for visual effects, or 'none'. Default is 'none'.
-.\"
-.\" *******************************************************
-.SS Vector rendering options
-.\" *******************************************************
-.TP
-.B \-[no]antialias, \-[no]aa
-Enables antialiased line rendering for vector systems. The default is ON
-(\-antialias).
-.TP
-.B \-beam \fIvalue
-Sets the width of the vectors. This is a scaling factor against the
-standard vector width. A value of 1.0 will keep the default vector line
-width. Smaller values will reduce the width, and larger values will
-increase the width. The default is 1.0.
-.TP
-.B \-flicker \fIvalue
-Simulates a vector "flicker" effect, similar to a vector monitor that
-needs adjustment. This option requires a float argument in the range of
-0.00\-100.00 (0=none, 100=maximum). The default is 0.
-.\"
-.\" *******************************************************
-.SS Video options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-video\fR [\fIsoft\fR|\fIopengl\fR|\fInone\fR]
-Specifies which video subsystem to use for drawing:
-.br
-\fBsoft\fR uses software rendering, which is slower but more compatible.
-.br
-\fBopengl\fR uses OpenGL and your graphics accelerator to speed up many
-aspects of drawing MESS including compositing artwork, overlays, and
-bezels, as well as stretching the image to fit your screen.
-.br
-\fBnone\fR does no drawing and is intended for CPU benchmarking.
-.br
-Default is SOFT.
-.TP
-.B \-[no]window, \-[no]w
-Run MESS in either full screen or a window. This is a fully\-featured window
-mode where the window resizes as necessary to track what the system does.
-And you can resize it yourself with your OS's standard window controls.
-The default is OFF (\-nowindow).
-.TP
-.B \-[no]maximize, \-[no]max
-Controls initial window size in windowed mode. If it is set on, the
-window will initially be set to the maximum supported size when you
-start MESS. If it is turned off, the window will start out at the
-smallest supported size. This option only has an effect when the
-\-window option is used. The default is ON (\-maximize).
-.TP
-.B \-[no]keepaspect, \-[no]ka
-Forces the correct aspect ratio. This means when you're resizing the window
-in windowed mode the actual system image will resize in discrete steps to
-maintain the proper shape of the system graphics. If you turn this off you can
-resize the window to anything you like and get funny squishing and stretching.
-The same applies for full\-screen. Default is ON (\-keepaspect).
-.TP
-.B \-[no]unevenstretch, \-[no]ues
-Allow non\-integer stretch factors. Video purists should stay far, far away
-from this option, while everyone else will be happy to know that it lets you
-fill the screen properly in full\-screen mode. Default is ON (\-unevenstretch).
-.TP
-.B \-[no]centerh
-Center horizontally within the view area. Default is ON (\-centerh).
-.TP
-.B \-[no]centerv
-Center vertically within the view area. Default is ON (\-centerv).
-.TP
-.B \-[no]waitvsync, \-[no]vs
-Enable waiting for the start of VBLANK before flipping screens;
-reduces tearing effects. Default is OFF (\-nowaitvsync).
-.TP
-.B \-[no]syncrefresh, \-[no]srf
-Enable using the start of VBLANK for throttling instead of the game time.
-Default is OFF (\-nosyncrefresh).
-.\"
-.\" *******************************************************
-.SS Software video rendering subsystem options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-All the options in this group are available only with softare video
-rendering subsystem (\-video soft).
-.TP
-.B \-prescale\fR [\fIvalue\fR]
-Scale screen rendering by this amount in software. Default is 1.
-.TP
-.B \-scalemode, \-sm \fR[\fInone\fR|\fIasync\fR|\fIyv12\fR|\fIyuy2\fR|\fIyv12x2\fR|\fIyuy2x2\fR]
-Hardware scaling mode.
-.br
-\fBnone\fR use software rendering.
-.br
-\fBasync\fR async overlay.
-.br
-\fByv12\fR yv12 overlay.
-.br
-\fByuy2\fR yuy2 overlay.
-.br
-\fByv12x2\fR yv12 overlay using x2 prescaling.
-.br
-\fByuy2x2\fR yuy2 overlay using x2 prescaling.
-.br
-Default is NONE.
-.\"
-.\" *******************************************************
-.SS OpenGL video rendering subsystem options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-All the options in this group are available only with OpenGL video
-rendering subsystem (\-video opengl or \-video opengl16).
-.TP
-.B \-[no]filter, \-[no]glfilter, \-[no]flt
-Enable bilinear filtering on screen output. Default is ON (\-filter).
-.TP
-.B \-[no]gl_forcepow2texture
-Force power of two textures. Default is OFF (\-nogl_forcepow2texture).
-.TP
-.B \-[no]gl_notexturerect
-Don't use OpenGL GL_ARB_texture_rectangle. Turn off if
-corruption occurs in OpenGL mode, at cost of some performance
-loss. Default is ON (\-gl_notexturerect).
-.TP
-.B \-[no]gl_vbo
-Enable OpenGL VBO, if available, for a performance increase.
-Turn off if corruption occurs. Default is ON (\-gl_vbo).
-.TP
-.B \-[no]gl_pbo
-Enable OpenGL PBO, if available, for a performance increase.
-Turn off if corruption occurs. Default is ON (\-gl_pbo).
-.TP
-.B \-[no]gl_glsl
-Enable OpenGL GLSL, if available, for a performance increase.
-Default is OFF (\-nogl_glsl).
-.TP
-.B \-gl_glsl_filter \fIvalue
-Enable OpenGL GLSL filtering instead of FF filtering 0=plain, 1=bilinear.
-Default is 1: bilinear.
-.TP
-.BR \-glsl_shader_mame[0\-9]
-Preferred custom OpenGL GLSL shader set mame bitmap (from 0 to 9).
-.TP
-.BR \-glsl_shader_screen[0\-9]
-Preferred custom OpenGL GLSL shader screen bitmap (from 0 to 9).
-.TP
-.B \-gl_glsl_vid_attr
-Enable OpenGL GLSL handling of brightness and contrast. Better RGB system
-performance for free. Default is ON.
-.TP
-.B \-screen
-Explicit name for all screens; 'auto' here will try to make a best guess.
-.TP
-.B \-aspect, \-screen_aspect
-Aspect ratio for all screens; 'auto' here will try to make a best guess.
-.TP
-.B \-resolution, \-r
-Preferred resolution for all screens;
-format is \fIwidth\fRx\fIheight\fR[@\fIrefreshrate\fR] or 'auto'.
-.TP
-.B \-view
-Preferred view for all screens
-.TP
-.B \-screen[0\-3]
-Explicit name of the first|second|third|fourth screen; 'auto' here will try
-to make a best guess.
-.TP
-.B \-aspect[0\-3]
-Aspect ratio of the first|second|third|fourth screen; 'auto' here will try
-to make a best guess.
-.TP
-.B \-resolution[0\-3], \-r[0\-3]
-Preferred resolution for the first|second|third|fourth screen;
-format is \fIwidth\fRx\fIheight\fR[@\fIrefreshrate\fR] or 'auto'.
-.TP
-.B \-view[0\-3]
-Preferred view for the first|second|third|fourth screen.
-.\"
-.\" *******************************************************
-.SS Full screen options
-.\" *******************************************************
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]switchres
-Affects full screen mode only. Chooses if MESS can try to change the
-screen resolution (color depth is normally left alone) when in
-full\-screen mode. If it's off, you always get your desktop resolution
-in full\-screen mode (which can be useful for LCDs).
-Default is OFF (\-noswitchres).
-.TP
-.B \-[no]useallheads
-Split full screen image across monitors. Default is OFF (\-nouseallhead).
-.\"
-.\" *******************************************************
-.SS Sound options
-.\" *******************************************************
-.TP
-.B \-[no]sound
-Enable or disable sound altogether. The default is ON (\-sound).
-.TP
-.B \-samplerate, \-sr \fIvalue
-Sets the audio sample rate. Smaller values (e.g. 11025) cause lower
-audio quality but faster emulation speed. Higher values (e.g. 48000)
-cause higher audio quality but slower emulation speed. The default is
-48000.
-.TP
-.B \-[no]samples
-Use samples if available. The default is ON (\-samples).
-.TP
-.B \-volume, \-vol \fIvalue
-Sets the startup volume. It can later be changed with the user interface
-(see Keys section). The volume is an attenuation in dB:
-for example, '\-volume \-12' will start with \-12dB attenuation.
-The default is 0.
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-audio_latency \fIvalue
-This controls the amount of latency built into the audio streaming.
-The latency parameter controls the lower threshold. The default is 3;
-increase to reduce glitches, decrease for responsiveness.
-.\"
-.\" *******************************************************
-.SS Input options
-.\" *******************************************************
-.TP
-.B \-[no]coin_lockout, \-[no]coinlock
-Enables simulation of the "coin lockout" feature that is implemented
-on a number of arcade game PCBs. It was up to the operator whether or not
-the coin lockout outputs were actually connected to the coin
-mechanisms. If this feature is enabled, then attempts to enter a coin
-while the lockout is active will fail and will display a popup message
-in the user interface. If this feature is disabled, the coin lockout
-signal will be ignored. The default is ON (\-coin_lockout).
-.TP
-.B \-ctrlr \fIcontroller
-Enables support for special controllers. Configuration files are
-loaded from the ctrlrpath. They are in the same format as the .cfg
-files that are saved, but only control configuration data is read
-from the file. The default is NULL (no controller file).
-.TP
-.B \-[no]mouse
-Controls whether or not MESS looks for a mouse controller to use. Note
-that in many cases, lightguns are treated as mice by the operating
-system, so you may need to enable this to enable lightgun support. When
-this is enabled, you will not be able to use your mouse while running
-MESS. If you want to get control of your computer back, you will need
-to either pause MESS or quit. The default is OFF (\-nomouse).
-.TP
-.B \-[no]joystick, \-[no]joy
-Controls whether or not MESS looks for joystick/gamepad controllers.
-The default is ON (\-joystick).
-.TP
-.B \-[no]lightgun, \-[no]gun
-Controls whether or not MESS makes use of lightgun controllers.
-Note that most lightguns map to the mouse, so using \-lightgun and
-\-mouse together may produce strange results. The default is OFF
-(\-nolightgun).
-.TP
-.B \-[no]multikeyboard, \-[no]multikey
-Determines whether MESS differentiates between multiple keyboards.
-Some systems may report more than one keyboard; by default, the data
-from all of these keyboards is combined so that it looks like a single
-keyboard. Turning this option on will enable MESS to report keypresses
-on different keyboards independently. The default is OFF
-(\-nomultikeyboard).
-.TP
-.B \-[no]multimouse
-Determines whether MESS differentiates between multiple mice. Some
-systems may report more than one mouse device; by default, the data
-from all of these mice is combined so that it looks like a single
-mouse. Turning this option on will enable MESS to report mouse
-movement and button presses on different mice independently. The
-default is OFF (\-nomultimouse).
-.TP
-.B \-[no]steadykey, \-[no]steady
-Some systems require two or more buttons to be pressed at exactly the
-same time to make special moves. Due to limitations in the PC keyboard
-hardware, it can be difficult or even impossible to accomplish that
-using the standard keyboard handling. This option selects a different
-handling that makes it easier to register simultaneous button presses,
-but has the disadvantage of making controls less responsive. The
-default is OFF (\-nosteadykey).
-.TP
-.B \-[no]ui_active
-Enable MESS user interface on top of emulated keyboard (if present).
-User interface may be toggled during execution by pressing the key
-defined with \-ui_modekey.
-Default is OFF (\-noui_active).
-.TP
-.B \-[no]offscreen_reload, \-[no]reload
-Controls whether or not MESS treats a second button input from a
-lightgun as a reload signal. In this case, MESS will report the gun's
-position as (0,MAX) with the trigger held, which is equivalent to an
-offscreen reload. This is only needed for systems that required you to
-shoot offscreen to reload, and then only if your gun does not support
-off screen reloads. The default is OFF (\-nooffscreen_reload).
-.TP
-.B \-joystick_map, \-joymap \fImap
-Controls how joystick values map to digital joystick controls.
-See /usr/share/doc/mame\-common/config.txt for full details on
-joymap format.
-.TP
-.B \-joystick_deadzone, \-joy_deadzone, \-jdz \fIvalue
-If you play with an analog joystick, the center can drift a little.
-joystick_deadzone tells how far along an axis you must move before the
-axis starts to change. This option expects a float in the range of
-0.0 to 1.0. Where 0 is the center of the joystick and 1 is the outer
-limit. The default is 0.3.
-.TP
-.B \-joystick_saturation, \-joy_saturation, \-jsat \fIvalue
-If you play with an analog joystick, the ends can drift a little,
-and may not match in the +/\- directions. joystick_saturation tells how
-far along an axis movement change will be accepted before it reaches
-the maximum range. This option expects a float in the range of 0.0 to
-1.0, where 0 is the center of the joystick and 1 is the outer limit.
-The default is 0.85.
-.TP
-.B \-[no]natural, \-[no]nat
-Allows user to specify whether or not to use a natural keyboard.
-This allows you to start your game or system in a 'native' mode, depending
-on your region, allowing compatibility for non\-"QWERTY" style keyboards.
-The default is OFF (\-nonatural).
-.TP
-.B \-[no]joystick_contradictory, \-[no]joy_contradictory
-Enable contradictory direction digital joystick input at the same time.
-Default is OFF (\-nojoystick_contradictory).
-.TP
-.B \-uimodekey, \-umk
-Specifies the key used to toggle between full and partial UI mode.
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-[no]keymap
-Enable keymap for non\-QWERTY keyboards. Used in conjunction
-with \fB\-keymap_file\fR. Default is OFF (\-nokeymap).
-.TP
-.B \-keymap_file \fIkeymap_file
-Specifies the full path to the keymap file to be used. A few
-keymap files are available in /usr/share/games/mess/keymaps.
-.TP
-.B \-joy_idx[0\-8] \fIjoystick
-With these options you can assign a joystick to a
-specific index in MESS. Even if the kernel will list the joysticks
-in a different order on the next boot, MESS will still see the joystick
-as e.g. "Joystick 2". Use mame \-v to see which joysticks are recognized.
-Default is 'auto'.
-.TP
-.B \-[no]sixaxis
-Use special handling for PS3 Sixaxis controllers.
-Default is OFF (\-nosixaxis).
-.TP
-.B \-lightgun_index[1\-8]
-Map lightgun to specific index in MESS.
-.TP
-.B \-videodriver, \-vd x11\fR|\fBdirectfb\fR|\fBauto
-SDL video driver to use; auto selects SDL default.
-.TP
-.B \-audiodriver, \-ad alsa\fR|\fBarts\fR|\fBauto
-SDL audio driver to use; auto selects SDL default.
-.TP
-.B \-gl_lib alsa\fR|\fBarts\fR|\fBauto
-Alternative libGL.so to use; auto selects SDL default.
-.\"
-.\" *******************************************************
-.SS Input automatic enable options
-.\" *******************************************************
-.TP
-.B \-paddle_device, \-paddle \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-adstick_device, \-adstick \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-pedal_device, \-pedal \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-dial_device, \-dial \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-trackball_device, \-trackball \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-lightgun_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-positional_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-.TP
-.B \-mouse_device \fR[\fInone\fR|\fIkeyboard\fR|\fImouse\fR|\fIlightgun\fR|\fIjoystick\fR]
-Each of these options controls auto\-enabling the mouse, or joystick
-depending on the presence of a particular class of analog
-control for a particular system. For example, if you specify the option
-\-paddle mouse, then any system that has a paddle control will automatically
-enable mouse controls just as if you had explicitly specified \-mouse.
-Note that these controls override the values of \-[no]mouse,
-\-[no]joystick, etc.
-.\"
-.\" *******************************************************
-.SS Debugging options
-.\" *******************************************************
-.TP
-.B \-[no]log
-Creates a file called error.log which contains all of the internal
-log messages generated by the MESS core and system drivers. The default
-is OFF (\-nolog).
-.TP
-.B \-[no]verbose, \-[no]v
-Displays internal diagnostic information. This information is very
-useful for debugging problems with your configuration.
-Please use the \-verbose option and include the resulting information
-when reporting bugs. The default is OFF (\-noverbose).
-.TP
-.B \-[no]update_in_pause
-Enables updating the screen bitmap while the system is paused. This is
-useful for debuggin in some scenarios (and gets in the way in others).
-Default is OFF (\-noupdate_in_pause).
-.TP
-.B \-[no]debug, \-[no]d
-Activates the integrated debugger. By default, the debugger is entered
-by pressing the tilde (~) key during emulation. It is also entered
-immediately at startup. The default is OFF (\-nodebug).
-.TP
-.B \-debugscript \fIfilename
-Specifies a file that contains a list of debugger commands to execute
-immediately upon startup. The default is NULL (no commands).
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.\" SDL specific
-.\" +++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.TP
-.B \-debugger \fIdebugger_name
-Name of the debugger to use. Default is AUTO.
-.TP
-.B \-debugger_font, \-dfont \fIfont_name
-Specifies the font to use for debugging. Default is AUTO.
-.TP
-.B \-debugger_font_size, \-dfontsize \fIsize
-Specifies the font size to use for debugging.
-.TP
-.B \-[no]oslog
-Outputs the error.log data to the system debugger. This can be used at
-the same time as \-log to output the log data to both targets as well.
-Default is OFF (\-nooslog).
-.\"
-.\" *******************************************************
-.SS Misc options
-.\" *******************************************************
-.TP
-.B \-[no]drc
-Enable DRC cpu core if available. Default is ON (\-drc).
-.TP
-.B \-[no]drc_use_c
-Force DRC use C backend. Default is OFF (\-nodrc_use_c).
-.TP
-.B \-[no]drc_log_uml
-Write DRC UML disassembly log. Default is OFF (\-nodrc_log_uml).
-.TP
-.B \-[no]drc_log_native
-Write DRC native disassembly log. Default is OFF (\-no_drc_log_native).
-.TP
-.B \-bios \fIbiosname
-Specifies the specific BIOS to use with the current system, for
-systems that make use of a BIOS. The \-listxml output will list all of
-the possible BIOS names for a system. The default is 'default'.
-.TP
-.B \-[no]cheat, \-[no]c
-Activates the cheat menu with autofire options and other tricks from
-the cheat database, if present.
-The default is OFF (\-nocheat).
-.TP
-.B \-[no]skip_gameinfo
-Forces MESS to skip displaying the system info screen. The default is OFF
-(\-noskip_gameinfo).
-.TP
-.B \-uifont \fIfontname
-Specifies the name of a BDF font file to use for the UI font. If this
-font cannot be found or cannot be loaded, the system will fall back
-to its built\-in UI font. On some platforms \fIfontname\fP can be a system
-font name instead of a BDF font file. The default is 'default' (use
-the OSD\-determined default font).
-.TP
-.B \-ramsize, \-ram \fIvalue
-Size of RAM (if supported by driver).
-.TP
-.B \-[no]confirm_quit
-Display confirm quit screen on exit. Default is ON (\-confirm_quit).
-.TP
-.B \-[no]ui_mouse
-Display UI mouse cursor. Default is OFF (\-noui_mouse).
-.TP
-.B \-autoboot_command, \-ab \fIcommand
-Command string to execute after machine boot (in quotes ""). To issue
-a quote to the emulation, use \fB"""\fP in the string.
-Using \fB\\n\fP will issue a create a new line, issuing what was
-typed prior as a command. Example:
-\fB\-autoboot_command "load """$""",8,1\\n"\fP.
-.TP
-.B \-autoboot_delay \fR[\fIvalue\fP]
-Timer delay (in seconds) to trigger command execution on autoboot.
-Default is 2.
-.TP
-.B \-autoboot_script, \-script \fR[\fIfilename.lua\fP]
-File containing scripting to execute after machine boot.
-.TP
-.B \-[no]http
-Enable local http server. Default is OFF (\-nohttp).
-.TP
-.B \-http_port \fIport
-Internal webserver listener port.
-.TP
-.B \-http_path \fIpath
-Path to web files. Default is /usr/share/games/mess/web.
-.TP
-.B \-[no]console
-Enable emulator LUA console. Default is OFF (\-noconsole).
-.TP
-.B \-newui, \-nu
-Use the new MESS UI.
-.TP
-.B \-watchdog \fIvalue
-Specifies a number of seconds after which MESS should automatically exit
-if it detects that the emulation has locked up.
-.\"
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-castool(1), chdman(1), floptool(1), imgtool(1), testkeys(1)
-.\"
-.\"
-.\" LEGAL NOTICE chapter
-.SH LEGAL NOTICE
-Please visit the MAME website for some important legal information:
-.PP
-http://mamedev.org/legal.html
diff --git a/src/osd/sdl/man/romcmp.1 b/src/osd/sdl/man/romcmp.1
deleted file mode 100644
index d7a89f92e80..00000000000
--- a/src/osd/sdl/man/romcmp.1
+++ /dev/null
@@ -1,56 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" romcmp.1
-.\"
-.\" Man page created from FAQs, source and usage information by
-.\" Ashley T. Howes <debiandev@ashleyhowes.com>, February 2005
-.\" updated by Cesare Falco <c.falco@ubuntu.com>, February 2007
-.\"
-.\" References
-.\" http://www.mame.net/mamefaq.html
-.\"
-.TH ROMCMP 1 2015-07-22 0.164 "MAME romset checking tool"
-.\"
-.\" NAME chapter
-.SH NAME
-romcmp \- MAME rom and romsets check and comparison tool
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B romcmp
-.RI [ \-option ]
-.RI [ dir1 | zip1 ]
-.RI [ dir2 | zip2 ]
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-\fBromcmp\fP is a tool developed to detect the most common errors that
-can occur when dumping ROMS, for example stuck bits and address line errors.
-.PP
-It can check the ROMs in ZIP files or subdirectories; it can also be used
-to compare two ROM sets, by giving it two files or subdirectories
-as parameters. It will determine which ROMS are identical and which are
-the closest matches. This is useful when figuring out if a newly dumped
-ROM set is a clone of another ROM set.
-.\"
-.\" OPTIONS chapter
-.SH OPTIONS
-.TP
-.B \-d
-Enables a slower, more comprehensive comparison.
-.\"
-.\" EXAMPLES chapter
-.SH EXAMPLES
-.B romcmp jumpkids.zip
-will output the following:
-
- 11 files
- 23.3c FIXED BITS (xxxxxx1x)
- 23.3c FIRST AND SECOND HALF IDENTICAL
-
-This tells us that the 23.3C ROM in Jump Kids is bad, and incidentally,
-it causes the missing sound in that game.
-.\"
-.\" SEE ALSO chapter
-.SH SEE ALSO
-mame(6)
diff --git a/src/osd/sdl/man/testkeys.1 b/src/osd/sdl/man/testkeys.1
deleted file mode 100644
index 91ddd1eb93d..00000000000
--- a/src/osd/sdl/man/testkeys.1
+++ /dev/null
@@ -1,27 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" testkeys.1
-.\"
-.\" Man page created from source and usage information
-.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
-.\"
-.TH TESTKEYS 1 2015-07-22 0.164 "MAME SDL keycode scanner"
-.\"
-.\" NAME chapter
-.SH NAME
-testkeys \- MAME SDL keycode scanner
-.\"
-.\" SYNOPSIS chapter
-.SH SYNOPSIS
-.B testkeys
-.\"
-.\" DESCRIPTION chapter
-.SH DESCRIPTION
-Since 0.113 (SDL)MAME introduced keymap files to handle keyboards
-with non\-us layouts.
-.PP
-This simple utility helps determining which SDL keycode is bound
-to each key, thus making the process of compiling keymap files a
-bit easier.
-.SH SEE ALSO
-mame(6), mess(6)
diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
index ddeabebc386..d3ce734b4d2 100644
--- a/src/osd/sdl/osdsdl.h
+++ b/src/osd/sdl/osdsdl.h
@@ -3,8 +3,6 @@
#ifndef _osdsdl_h_
#define _osdsdl_h_
-#include "sdlinc.h"
-
#include "watchdog.h"
#include "clifront.h"
#include "modules/lib/osdobj_common.h"
@@ -142,9 +140,6 @@ public:
virtual void init(running_machine &machine) override;
virtual void update(bool skip_redraw) override;
- // video overridables
- virtual slider_state *get_slider_list() override;
-
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override;
@@ -152,13 +147,9 @@ public:
virtual bool video_init() override;
virtual bool window_init() override;
- virtual bool output_init() override;
- //virtual bool midi_init();
virtual void video_exit() override;
virtual void window_exit() override;
- virtual void output_exit() override;
- //virtual void midi_exit();
// sdl specific
void poll_inputs(running_machine &machine);
@@ -180,7 +171,6 @@ private:
sdl_options &m_options;
watchdog *m_watchdog;
- slider_state * m_sliders;
};
//============================================================
diff --git a/src/osd/sdl/osxutils.h b/src/osd/sdl/osxutils.h
deleted file mode 100644
index 61ec4527cf1..00000000000
--- a/src/osd/sdl/osxutils.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Vas Crabb
-//============================================================
-//
-// osxutils.h - Mac OS X utilities for SDLMAME
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-//
-//============================================================
-
-#ifndef __SDLOSXUTILS__
-#define __SDLOSXUTILS__
-
-//============================================================
-// PROTOTYPES
-//============================================================
-
-void * NewAutoreleasePool(void);
-void ReleaseAutoreleasePool(void *pool);
-
-#endif
diff --git a/src/osd/sdl/osxutils.mm b/src/osd/sdl/osxutils.mm
deleted file mode 100644
index c71af922b59..00000000000
--- a/src/osd/sdl/osxutils.mm
+++ /dev/null
@@ -1,34 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Vas Crabb
-//============================================================
-//
-// osxutils.m - Mac OS X utilities for SDLMAME
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-//
-//============================================================
-
-#import <Foundation/Foundation.h>
-
-// MAMEOS headers
-#import "osxutils.h"
-
-
-//============================================================
-// NewAutoreleasePool
-//============================================================
-
-void * NewAutoreleasePool(void)
-{
- return [[NSAutoreleasePool alloc] init];
-}
-
-
-//============================================================
-// ReleaseAutoreleasePool
-//============================================================
-
-void ReleaseAutoreleasePool(void *pool)
-{
- [(NSAutoreleasePool *)pool release];
-}
diff --git a/src/osd/sdl/output.cpp b/src/osd/sdl/output.cpp
deleted file mode 100644
index f2348f592e2..00000000000
--- a/src/osd/sdl/output.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert, R. Belmont
-//============================================================
-//
-// output.c - Generic implementation of MAME output routines
-//
-//============================================================
-
-#if !defined(SDLMAME_WIN32)
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-// MAME headers
-#include "emu.h"
-
-// MAMEOS headers
-#include "osdsdl.h"
-
-
-
-//============================================================
-// CONSTANTS
-//============================================================
-
-#define SDLMAME_OUTPUT "/tmp/sdlmame_out"
-
-/*
- * Using long/int should be sufficient on all
- * architectures.
- */
-
-
-#ifdef PTR64
-#define PID_FMT "%ld"
-#else
-#define PID_FMT "%d"
-#endif
-
-//============================================================
-// TYPEDEFS
-//============================================================
-
-//============================================================
-// PRIVATE VARIABLES
-//============================================================
-
-static FILE *output;
-
-//============================================================
-// FUNCTION PROTOTYPES
-//============================================================
-
-static void notifier_callback(const char *outname, INT32 value, void *param);
-
-//============================================================
-// osd_get_pid
-//============================================================
-
-intptr_t osd_getpid(void)
-{
- return intptr_t(getpid());
-}
-
-//============================================================
-// output_init
-//============================================================
-
-bool sdl_osd_interface::output_init()
-{
- int fildes;
-
- fildes = open(SDLMAME_OUTPUT, O_RDWR | O_NONBLOCK);
-
- if (fildes < 0)
- {
- output = NULL;
- osd_printf_verbose("output: unable to open output notifier file %s\n", SDLMAME_OUTPUT);
- }
- else
- {
- output = fdopen(fildes, "w");
-
- osd_printf_verbose("output: opened output notifier file %s\n", SDLMAME_OUTPUT);
- fprintf(output, "MAME " PID_FMT " START %s\n", osd_getpid(), this->machine().system().name);
- fflush(output);
- }
-
- machine().output().set_notifier(NULL, notifier_callback, NULL);
- return true;
-}
-
-
-//============================================================
-// winoutput_exit
-//============================================================
-
-void sdl_osd_interface::output_exit()
-{
- if (output != NULL)
- {
- fprintf(output, "MAME " PID_FMT " STOP %s\n", osd_getpid(), machine().system().name);
- fflush(output);
- fclose(output);
- output = NULL;
- osd_printf_verbose("output: closed output notifier file\n");
- }
-}
-
-//============================================================
-// notifier_callback
-//============================================================
-
-static void notifier_callback(const char *outname, INT32 value, void *param)
-{
- if (output != NULL)
- {
- fprintf(output, "OUT " PID_FMT " %s %d\n", osd_getpid(), outname, value);
- fflush(output);
- }
-}
-
-#else /* SDLMAME_WIN32 */
-
-#include "emu.h"
-#include "osdsdl.h"
-#include "emucore.h"
-
-//============================================================
-// Stub for win32
-//============================================================
-
-bool sdl_osd_interface::output_init()
-{
- return true;
-}
-
-void sdl_osd_interface::output_exit()
-{
-}
-
-#endif /* SDLMAME_WIN32 */
diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp
index c2e1479ddd2..270bc714320 100644
--- a/src/osd/sdl/sdlmain.cpp
+++ b/src/osd/sdl/sdlmain.cpp
@@ -198,6 +198,11 @@ int main(int argc, char *argv[])
setvbuf(stdout, (char *) NULL, _IONBF, 0);
setvbuf(stderr, (char *) NULL, _IONBF, 0);
+#if defined(SDLMAME_ANDROID)
+ /* Enable standard application logging */
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE);
+#endif
+
// FIXME: this should be done differently
#ifdef SDLMAME_UNIX
@@ -245,7 +250,7 @@ static void output_oslog(const running_machine &machine, const char *buffer)
//============================================================
sdl_osd_interface::sdl_osd_interface(sdl_options &options)
-: osd_common_t(options), m_options(options), m_watchdog(nullptr), m_sliders(nullptr)
+: osd_common_t(options), m_options(options), m_watchdog(nullptr)
{
}
@@ -269,7 +274,7 @@ void sdl_osd_interface::osd_exit()
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
- SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER );
+ SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER );
}
}
@@ -486,12 +491,7 @@ void sdl_osd_interface::init(running_machine &machine)
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
-#ifdef SDLMAME_EMSCRIPTEN
- // timer brings in threads which are not supported in Emscripten
- if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
-#else
- if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
-#endif
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);
}
diff --git a/src/osd/sdl/sdlos_macosx.cpp b/src/osd/sdl/sdlos_macosx.cpp
deleted file mode 100644
index 5afcfdc54eb..00000000000
--- a/src/osd/sdl/sdlos_macosx.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert, R. Belmont
-//============================================================
-//
-// sdlos_*.c - OS specific low level code
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-//
-//============================================================
-
-// standard sdl header
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <mach/mach.h>
-#include <mach/mach_time.h>
-#include <Carbon/Carbon.h>
-
-#include "sdlinc.h"
-
-// MAME headers
-#include "osdcore.h"
-
-
-//============================================================
-// osd_get_clipboard_text
-//============================================================
-
-char *osd_get_clipboard_text(void)
-{
- OSStatus err;
-
- PasteboardRef pasteboard_ref;
- err = PasteboardCreate(kPasteboardClipboard, &pasteboard_ref);
- if (err)
- return NULL;
-
- PasteboardSynchronize(pasteboard_ref);
-
- ItemCount item_count;
- err = PasteboardGetItemCount(pasteboard_ref, &item_count);
-
- char *result = NULL; // core expects a malloced C string of uft8 data
- for (UInt32 item_index = 1; (item_index <= item_count) && !result; item_index++)
- {
- PasteboardItemID item_id;
- err = PasteboardGetItemIdentifier(pasteboard_ref, item_index, &item_id);
- if (err)
- continue;
-
- CFArrayRef flavor_type_array;
- err = PasteboardCopyItemFlavors(pasteboard_ref, item_id, &flavor_type_array);
- if (err)
- continue;
-
- CFIndex const flavor_count = CFArrayGetCount(flavor_type_array);
- for (CFIndex flavor_index = 0; (flavor_index < flavor_count) && !result; flavor_index++)
- {
- CFStringRef const flavor_type = (CFStringRef)CFArrayGetValueAtIndex(flavor_type_array, flavor_index);
-
- CFStringEncoding encoding;
- if (UTTypeConformsTo(flavor_type, kUTTypeUTF16PlainText))
- encoding = kCFStringEncodingUTF16;
- else if (UTTypeConformsTo (flavor_type, kUTTypeUTF8PlainText))
- encoding = kCFStringEncodingUTF8;
- else if (UTTypeConformsTo (flavor_type, kUTTypePlainText))
- encoding = kCFStringEncodingMacRoman;
- else
- continue;
-
- CFDataRef flavor_data;
- err = PasteboardCopyItemFlavorData(pasteboard_ref, item_id, flavor_type, &flavor_data);
-
- if (!err)
- {
- CFStringRef string_ref = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, flavor_data, encoding);
- CFDataRef data_ref = CFStringCreateExternalRepresentation (kCFAllocatorDefault, string_ref, kCFStringEncodingUTF8, '?');
- CFRelease(string_ref);
- CFRelease(flavor_data);
-
- CFIndex const length = CFDataGetLength(data_ref);
- CFRange const range = CFRangeMake(0, length);
-
- result = reinterpret_cast<char *>(osd_malloc_array(length + 1));
- if (result)
- {
- CFDataGetBytes(data_ref, range, reinterpret_cast<unsigned char *>(result));
- result[length] = 0;
- }
-
- CFRelease(data_ref);
- }
- }
-
- CFRelease(flavor_type_array);
- }
-
- CFRelease(pasteboard_ref);
-
- return result;
-}
diff --git a/src/osd/sdl/sdlos_unix.cpp b/src/osd/sdl/sdlos_unix.cpp
deleted file mode 100644
index 29bb10c6bdd..00000000000
--- a/src/osd/sdl/sdlos_unix.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert, R. Belmont
-//============================================================
-//
-// sdlos_*.c - OS specific low level code
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-//
-//============================================================
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#ifdef SDLMAME_EMSCRIPTEN
-#include <emscripten.h>
-#endif
-
-#include "sdlinc.h"
-
-// MAME headers
-#include "osdcore.h"
-
-#ifdef SDLMAME_ANDROID
-char *osd_get_clipboard_text(void)
-{
- return nullptr;
-}
-#else
-//============================================================
-// osd_get_clipboard_text
-//============================================================
-
-char *osd_get_clipboard_text(void)
-{
- char *result = NULL;
-
- if (SDL_HasClipboardText())
- {
- char *temp = SDL_GetClipboardText();
- result = (char *) osd_malloc_array(strlen(temp) + 1);
- strcpy(result, temp);
- SDL_free(temp);
- }
- return result;
-}
-
-#endif
diff --git a/src/osd/sdl/sdlos_win32.cpp b/src/osd/sdl/sdlos_win32.cpp
deleted file mode 100644
index 0de8a374817..00000000000
--- a/src/osd/sdl/sdlos_win32.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert, R. Belmont
-//============================================================
-//
-// sdlos_*.c - OS specific low level code
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-//
-//============================================================
-
-// standard sdl header
-#include "sdlinc.h"
-
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-// MAME headers
-#include "osdcore.h"
-#include "strconv.h"
-
-
-//============================================================
-// get_clipboard_text_by_format
-//============================================================
-
-static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID data))
-{
- char *result = NULL;
- HANDLE data_handle;
- LPVOID data;
-
- // check to see if this format is available
- if (IsClipboardFormatAvailable(format))
- {
- // open the clipboard
- if (OpenClipboard(NULL))
- {
- // try to access clipboard data
- data_handle = GetClipboardData(format);
- if (data_handle != NULL)
- {
- // lock the data
- data = GlobalLock(data_handle);
- if (data != NULL)
- {
- // invoke the convert
- result = (*convert)(data);
-
- // unlock the data
- GlobalUnlock(data_handle);
- }
- }
-
- // close out the clipboard
- CloseClipboard();
- }
- }
- return result;
-}
-
-
-//============================================================
-// convert_wide
-//============================================================
-
-static char *convert_wide(LPCVOID data)
-{
- return utf8_from_wstring((LPCWSTR) data);
-}
-
-
-
-//============================================================
-// convert_ansi
-//============================================================
-
-static char *convert_ansi(LPCVOID data)
-{
- return utf8_from_astring((LPCSTR) data);
-}
-
-
-
-//============================================================
-// osd_get_clipboard_text
-//============================================================
-
-char *osd_get_clipboard_text(void)
-{
- char *result = NULL;
-
- // try to access unicode text
- if (result == NULL)
- result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
-
- // try to access ANSI text
- if (result == NULL)
- result = get_clipboard_text_by_format(CF_TEXT, convert_ansi);
-
- return result;
-}
diff --git a/src/osd/sdl/testkeys.cpp b/src/osd/sdl/testkeys.cpp
deleted file mode 100644
index 0f8157aa524..00000000000
--- a/src/osd/sdl/testkeys.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert, R. Belmont
-//============================================================
-//
-// testkey.c - A small utility to analyze SDL keycodes
-//
-// SDLMAME by Olivier Galibert and R. Belmont
-// testkeys by couriersud
-//
-//============================================================
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <wchar.h>
-
-#include "sdlinc.h"
-
-#include "unicode.h"
-
-struct key_lookup_table
-{
- int code;
- const char *name;
-};
-
-#define KE(x) { SDL_SCANCODE_ ## x, "SDL_SCANCODE_" #x },
-#define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H)
-#define KE7(A, B, C, D, E, F, G) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G)
-#define KE5(A, B, C, D, E) KE(A) KE(B) KE(C) KE(D) KE(E)
-#define KE3(A, B, C) KE(A) KE(B) KE(C)
-
-
-static key_lookup_table sdl_lookup[] =
-{
- KE7(UNKNOWN, BACKSPACE, TAB, CLEAR, RETURN, PAUSE, ESCAPE )
- KE(SPACE)
- KE5(COMMA, MINUS, PERIOD, SLASH, 0 )
- KE8(1, 2, 3, 4, 5, 6, 7, 8 )
- KE5(9, SEMICOLON, EQUALS, PRINTSCREEN, AC_REFRESH)
- KE5(LEFTBRACKET,BACKSLASH, RIGHTBRACKET, A, B )
- KE8(C, D, E, F, G, H, I, J )
- KE8(K, L, M, N, O, P, Q, R )
- KE8(S, T, U, V, W, X, Y, Z )
- KE8(DELETE, KP_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6 )
- KE8(KP_7, KP_8, KP_9, KP_PERIOD, KP_DIVIDE, KP_MULTIPLY,KP_MINUS, KP_PLUS )
- KE8(KP_ENTER, KP_EQUALS, UP, DOWN, RIGHT, LEFT, INSERT, HOME )
- KE8(END, PAGEUP, PAGEDOWN, F1, F2, F3, F4, F5 )
- KE8(F6, F7, F8, F9, F10, F11, F12, F13 )
- KE8(F14, F15, NUMLOCKCLEAR, CAPSLOCK, SCROLLLOCK, RSHIFT, LSHIFT, RCTRL )
- KE7(LCTRL, RALT, LALT, LGUI, RGUI, KP_DECIMAL, APPLICATION)
- KE5(MENU, NONUSBACKSLASH, UNDO, APOSTROPHE, GRAVE )
- {-1, ""}
-};
-
-static const char * lookup_key_name(const key_lookup_table *kt, int kc)
-{
- int i=0;
- while (kt[i].code>=0)
- {
- if (kc==kt[i].code)
- return kt[i].name;
- i++;
- }
- return NULL;
-}
-
-#ifdef SDLMAME_WIN32
-int utf8_main(int argc, char *argv[])
-#else
-int main(int argc, char *argv[])
-#endif
-{
- SDL_Event event;
- int quit = 0;
- char lasttext[20] = "";
-
- if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
- fprintf(stderr, "Couldn't initialize SDL: %s\n",
- SDL_GetError());
- exit(1);
- }
- SDL_CreateWindow("Input Test", 0, 0, 100, 100,0 );
- while(SDL_PollEvent(&event) || !quit) {
- switch(event.type) {
- case SDL_QUIT:
- quit = 1;
- break;
- case SDL_KEYDOWN:
- if (event.key.keysym.sym == SDLK_ESCAPE)
- quit=1;
- else
- {
- printf("ITEM_ID_XY %s 0x%x 0x%x %s\n",
- lookup_key_name(sdl_lookup, event.key.keysym.scancode),
- (int) event.key.keysym.scancode,
- (int) event.key.keysym.sym,
- "");
- lasttext[0] = 0;
- }
- break;
- case SDL_KEYUP:
- printf("ITEM_ID_XY %s 0x%x 0x%x %s\n",
- lookup_key_name(sdl_lookup, event.key.keysym.scancode),
- (int) event.key.keysym.scancode,
- (int) event.key.keysym.sym,
- lasttext);
- break;
- case SDL_TEXTINPUT:
- strcpy(lasttext, event.text.text);
- break;
- }
- event.type = 0;
- }
- SDL_Quit();
- return(0);
-}
diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp
index 08938b99511..582836f0c8e 100644
--- a/src/osd/sdl/video.cpp
+++ b/src/osd/sdl/video.cpp
@@ -91,16 +91,6 @@ bool sdl_osd_interface::video_init()
return true;
}
-
-//============================================================
-// get_slider_list
-//============================================================
-
-slider_state *sdl_osd_interface::get_slider_list()
-{
- return m_sliders;
-}
-
//============================================================
// video_exit
//============================================================
@@ -116,6 +106,11 @@ void sdl_osd_interface::video_exit()
// sdlvideo_monitor_refresh
//============================================================
+inline osd_rect SDL_Rect_to_osd_rect(const SDL_Rect &r)
+{
+ return osd_rect(r.x, r.y, r.w, r.h);
+}
+
void sdl_monitor_info::refresh()
{
SDL_DisplayMode dmode;
@@ -294,10 +289,19 @@ static void check_osd_inputs(running_machine &machine)
}
}
+ if (machine.ui_input().pressed(IPT_OSD_2))
+ {
+ //FIXME: on a per window basis
+ video_config.fullstretch = !video_config.fullstretch;
+ window->target()->set_scale_mode(video_config.fullstretch? SCALE_FRACTIONAL : SCALE_INTEGER);
+ machine.ui().popup_time(1, "Uneven stretch %s", video_config.fullstretch? "enabled":"disabled");
+ }
+
if (machine.ui_input().pressed(IPT_OSD_4))
{
//FIXME: on a per window basis
video_config.keepaspect = !video_config.keepaspect;
+ window->target()->set_keepaspect(video_config.keepaspect);
machine.ui().popup_time(1, "Keepaspect %s", video_config.keepaspect? "enabled":"disabled");
}
@@ -333,6 +337,7 @@ void sdl_osd_interface::extract_video_config()
video_config.filter = options().filter();
video_config.keepaspect = options().keep_aspect();
video_config.numscreens = options().numscreens();
+ video_config.fullstretch = options().uneven_stretch();
#ifdef SDLMAME_X11
video_config.restrictonemonitor = !options().use_all_heads();
#endif
diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h
index 307f3a898c9..1c6993c0c0b 100644
--- a/src/osd/sdl/video.h
+++ b/src/osd/sdl/video.h
@@ -15,32 +15,12 @@
#include "modules/osdwindow.h"
//============================================================
-// CONSTANTS
-//============================================================
-
-#define MAX_VIDEO_WINDOWS (4)
-
-#define VIDEO_SCALE_MODE_NONE (0)
-
-#define GLSL_SHADER_MAX 10
-
-//============================================================
// TYPE DEFINITIONS
//============================================================
-inline osd_rect SDL_Rect_to_osd_rect(const SDL_Rect &r)
-{
- return osd_rect(r.x, r.y, r.w, r.h);
-}
-
class sdl_monitor_info : public osd_monitor_info
{
public:
-#if 0
- sdl_monitor_info()
- : m_next(NULL), m_handle(0), m_aspect(0.0f)
- {}
-#endif
sdl_monitor_info(const UINT64 handle, const char *monitor_device, float aspect)
: osd_monitor_info(&m_handle, monitor_device, aspect), m_handle(handle)
{
@@ -56,66 +36,4 @@ private:
UINT64 m_handle; // handle to the monitor
};
-struct osd_video_config
-{
- // global configuration
- int windowed; // start windowed?
- int prescale; // prescale factor
- int keepaspect; // keep aspect ratio
- int numscreens; // number of screens
-
- // hardware options
- int mode; // output mode
- int waitvsync; // spin until vsync
- int syncrefresh; // sync only to refresh rate
- int switchres; // switch resolutions
-
- int fullstretch; // FXIME: implement in windows!
-
- // d3d, accel, opengl
- int filter; // enable filtering
- //int filter; // enable filtering, disabled if glsl_filter>0
-
- // OpenGL options
- int glsl;
- int glsl_filter; // glsl filtering, >0 disables filter
- char * glsl_shader_mamebm[GLSL_SHADER_MAX]; // custom glsl shader set, mame bitmap
- int glsl_shader_mamebm_num; // custom glsl shader set number, mame bitmap
- char * glsl_shader_scrn[GLSL_SHADER_MAX]; // custom glsl shader set, screen bitmap
- int glsl_shader_scrn_num; // custom glsl shader number, screen bitmap
- int pbo;
- int vbo;
- int allowtexturerect; // allow GL_ARB_texture_rectangle, default: no
- int forcepow2texture; // force power of two textures, default: no
-
- // dd, d3d
- int triplebuf; // triple buffer
-
- //============================================================
- // SDL - options
- //============================================================
- int novideo; // don't draw, for pure CPU benchmarking
-
- int centerh;
- int centerv;
-
- // vector options
- float beamwidth; // beam width
-
- // perftest
- int perftest; // print out real video fps
-
- // X11 options
- int restrictonemonitor; // in fullscreen, confine to Xinerama monitor 0
-
- // YUV options
- int scale_mode;
-};
-
-//============================================================
-// GLOBAL VARIABLES
-//============================================================
-
-extern osd_video_config video_config;
-
#endif
diff --git a/src/osd/sdl/watchdog.cpp b/src/osd/sdl/watchdog.cpp
index eaa216dd0f8..8a86464cb56 100644
--- a/src/osd/sdl/watchdog.cpp
+++ b/src/osd/sdl/watchdog.cpp
@@ -21,13 +21,13 @@ static void *watchdog_thread(void *param)
while (TRUE)
{
- if (osd_event_wait(thiz->event(), thiz->getTimeout()))
+ if (thiz->event().wait(thiz->getTimeout()))
{
if (thiz->do_exit())
break;
else
{
- osd_event_reset(thiz->event());
+ thiz->event().reset();
continue;
}
}
@@ -42,9 +42,9 @@ static void *watchdog_thread(void *param)
}
watchdog::watchdog(void)
+: m_event(1,0)
{
m_do_exit = 0;
- m_event = osd_event_alloc(1, 0);
m_thread = new std::thread(watchdog_thread, this);
m_timeout = 60 * osd_ticks_per_second();
}
@@ -52,10 +52,9 @@ watchdog::watchdog(void)
watchdog::~watchdog(void)
{
m_do_exit = 1;
- osd_event_set(m_event);
+ m_event.set();
m_thread->join();
delete m_thread;
- osd_event_free(m_event);
}
void watchdog::setTimeout(int timeout)
diff --git a/src/osd/sdl/watchdog.h b/src/osd/sdl/watchdog.h
index cddba0100ef..9cc2ee03322 100644
--- a/src/osd/sdl/watchdog.h
+++ b/src/osd/sdl/watchdog.h
@@ -20,15 +20,15 @@ public:
watchdog(void);
~watchdog(void);
- void reset() { osd_event_set(m_event); }
+ void reset() { m_event.set(); }
- osd_event * event(void) { return m_event; }
+ osd_event & event(void) { return m_event; }
INT32 do_exit(void) { return m_do_exit; }
osd_ticks_t getTimeout(void) { return m_timeout; }
void setTimeout(int timeout);
private:
- osd_event * m_event;
- std::thread* m_thread;
+ osd_event m_event;
+ std::thread* m_thread;
std::atomic<INT32> m_do_exit;
osd_ticks_t m_timeout;
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp
index 8abf89ce5fc..7cec35d400a 100644
--- a/src/osd/sdl/window.cpp
+++ b/src/osd/sdl/window.cpp
@@ -89,6 +89,14 @@ sdl_window_info *sdl_window_list;
static sdl_window_info **last_window_ptr;
+class SDL_DM_Wrapper
+{
+public:
+ SDL_DisplayMode mode;
+};
+
+
+
// event handling
static SDL_threadID main_threadid;
static SDL_threadID window_threadid;
@@ -176,7 +184,7 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id)
if (SDLMAME_INIT_IN_WORKER_THREAD)
{
- if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE))
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO))
{
osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
@@ -300,33 +308,13 @@ void sdl_osd_interface::update_slider_list()
void sdl_osd_interface::build_slider_list()
{
- m_sliders = nullptr;
- slider_state* full_list = nullptr;
- slider_state* curr = nullptr;
+ m_sliders.clear();
+
for (sdl_window_info *window = sdl_window_list; window != nullptr; window = window->m_next)
{
- // take the sliders of the first window
- slider_state* window_sliders = window->renderer().get_slider_list();
- if (window_sliders == nullptr)
- {
- continue;
- }
-
- if (full_list == nullptr)
- {
- full_list = curr = window_sliders;
- }
- else
- {
- curr->next = window_sliders;
- }
-
- while (curr->next != nullptr) {
- curr = curr->next;
- }
+ std::vector<ui_menu_item> window_sliders = window->renderer().get_slider_list();
+ m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
}
-
- m_sliders = full_list;
}
//============================================================
@@ -488,7 +476,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
if (window->fullscreen() && (video_config.switchres || is_osx))
{
SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode
- SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode); // Try to set mode
+ SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode->mode); // Try to set mode
SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode
}
SDL_DestroyWindow(window->sdl_window());
@@ -623,9 +611,6 @@ int sdl_window_info::window_init()
set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this)));
- // create an event that we can use to skip blitting
- m_rendered_event = osd_event_alloc(FALSE, TRUE);
-
// load the layout
m_target = m_machine.render().target_alloc();
@@ -673,7 +658,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt )
if (window->fullscreen() && video_config.switchres)
{
SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode
- SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode); // Try to set mode
+ SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode->mode); // Try to set mode
SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode
}
SDL_DestroyWindow(window->sdl_window());
@@ -706,9 +691,6 @@ void sdl_window_info::destroy()
// free the render target, after the textures!
this->machine().render().target_free(m_target);
- // free the event
- osd_event_free(m_rendered_event);
-
}
@@ -828,7 +810,7 @@ void sdl_window_info::update()
else
event_wait_ticks = 0;
- if (osd_event_wait(m_rendered_event, event_wait_ticks))
+ if (m_rendered_event.wait(event_wait_ticks))
{
// ensure the target bounds are up-to-date, and then get the primitives
@@ -967,7 +949,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
SDL_DisplayMode mode;
//SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
SDL_GetWindowDisplayMode(window->sdl_window(), &mode);
- window->m_original_mode = mode;
+ window->m_original_mode->mode = mode;
mode.w = temp.width();
mode.h = temp.height();
if (window->m_win_config.refresh)
@@ -1130,7 +1112,7 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt )
}
/* all done, ready for next */
- osd_event_set(window->m_rendered_event);
+ window->m_rendered_event.set();
osd_free(wp);
return nullptr;
@@ -1319,6 +1301,16 @@ osd_dim sdl_window_info::get_min_bounds(int constrain)
return osd_dim(minwidth, minheight);
}
+//============================================================
+// get_size
+//============================================================
+
+osd_dim sdl_window_info::get_size()
+{
+ int w=0; int h=0;
+ SDL_GetWindowSize(m_sdl_window, &w, &h);
+ return osd_dim(w,h);
+}
//============================================================
@@ -1361,3 +1353,37 @@ osd_dim sdl_window_info::get_max_bounds(int constrain)
return maximum.dim();
}
+
+//============================================================
+// construction and destruction
+//============================================================
+
+sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_monitor_info *a_monitor,
+ const osd_window_config *config)
+: osd_window(), m_next(NULL),
+ // Following three are used by input code to defer resizes
+ m_resize_width(0),
+ m_resize_height(0),
+ m_last_resize(0),
+ m_minimum_dim(0,0),
+ m_windowed_dim(0,0),
+ m_rendered_event(0, 1), m_target(0),
+ m_sdl_window(NULL),
+ m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0)
+{
+ m_win_config = *config;
+ m_index = index;
+
+ //FIXME: these should be per_window in config-> or even better a bit set
+ m_fullscreen = !video_config.windowed;
+ m_prescale = video_config.prescale;
+
+ m_windowed_dim = osd_dim(config->width, config->height);
+ m_original_mode = global_alloc(SDL_DM_Wrapper);
+}
+
+sdl_window_info::~sdl_window_info()
+{
+ global_free(m_renderer);
+ global_free(m_original_mode);
+}
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 5e3e58f92ed..7a62d3a5925 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -11,7 +11,6 @@
#ifndef __SDLWINDOW__
#define __SDLWINDOW__
-#include "sdlinc.h"
#include "osdsdl.h"
#include "video.h"
@@ -24,6 +23,10 @@
// TYPE DEFINITIONS
//============================================================
+// forward of SDL_DisplayMode not possible (typedef struct) - define wrapper
+
+class SDL_DM_Wrapper;
+
typedef uintptr_t HashT;
#define OSDWORK_CALLBACK(name) void *name(void *param, ATTR_UNUSED int threadid)
@@ -32,32 +35,9 @@ class sdl_window_info : public osd_window
{
public:
sdl_window_info(running_machine &a_machine, int index, osd_monitor_info *a_monitor,
- const osd_window_config *config)
- : osd_window(), m_next(NULL),
- // Following three are used by input code to defer resizes
- m_resize_width(0),
- m_resize_height(0),
- m_last_resize(0),
- m_minimum_dim(0,0),
- m_windowed_dim(0,0),
- m_rendered_event(0), m_target(0),
- m_sdl_window(NULL),
- m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0)
- {
- m_win_config = *config;
- m_index = index;
-
- //FIXME: these should be per_window in config-> or even better a bit set
- m_fullscreen = !video_config.windowed;
- m_prescale = video_config.prescale;
-
- m_windowed_dim = osd_dim(config->width, config->height);
- }
+ const osd_window_config *config);
- ~sdl_window_info()
- {
- global_free(m_renderer);
- }
+ ~sdl_window_info();
int window_init();
@@ -69,12 +49,7 @@ public:
void notify_changed();
- osd_dim get_size() override
- {
- int w=0; int h=0;
- SDL_GetWindowSize(m_sdl_window, &w, &h);
- return osd_dim(w,h);
- }
+ osd_dim get_size() override;
int xy_to_render_target(int x, int y, int *xt, int *yt);
@@ -106,13 +81,13 @@ private:
osd_dim m_windowed_dim;
// rendering info
- osd_event * m_rendered_event;
+ osd_event m_rendered_event;
render_target * m_target;
// Needs to be here as well so we can identify window
SDL_Window *m_sdl_window;
// Original display_mode
- SDL_DisplayMode m_original_mode;
+ SDL_DM_Wrapper *m_original_mode;
int m_extra_flags;
diff --git a/src/osd/strconv.h b/src/osd/strconv.h
index 6d23d78fbb1..aaab2527d25 100644
--- a/src/osd/strconv.h
+++ b/src/osd/strconv.h
@@ -33,6 +33,17 @@ char *utf8_from_astring(const CHAR *s);
WCHAR *wstring_from_utf8(const char *s);
char *utf8_from_wstring(const WCHAR *s);
+struct osd_wstr_deleter
+{
+ void operator () (wchar_t* wstr)
+ {
+ if (wstr != nullptr)
+ osd_free(wstr);
+ }
+};
+
+typedef std::unique_ptr<wchar_t, osd_wstr_deleter> osd_unique_wstr;
+
#ifdef UNICODE
#define tstring_from_utf8 wstring_from_utf8
#define utf8_from_tstring utf8_from_wstring
diff --git a/src/osd/windows/ledutil.cpp b/src/osd/windows/ledutil.cpp
deleted file mode 100644
index 85c7cca1fe1..00000000000
--- a/src/osd/windows/ledutil.cpp
+++ /dev/null
@@ -1,710 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles,Paul Priest
-//============================================================
-//
-// ledutil.c - Win32 example code that tracks changing
-// outputs and updates the keyboard LEDs in response
-//
-//============================================================
-//
-// This is sample code. To use it as a starting point, you
-// should do the following:
-//
-// 1. Change the CLIENT_ID define to something unique.
-//
-// 2. Change the WINDOW_CLASS and WINDOW_NAME defines to
-// something unique.
-//
-// 3. Delete all the code from the >8 snip 8< comment and
-// downward.
-//
-// 4. Implement the following functions:
-//
-// output_startup - called at app init time
-// output_shutdown - called before the app exits
-// output_mame_start - called when MAME starts
-// output_mame_stop - called when MAME exits
-// output_set_state - called whenever state changes
-//
-//============================================================
-
-// standard windows headers
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winioctl.h>
-
-// standard C headers
-#include <conio.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-// MAME output header file
-typedef int running_machine;
-#include "osdcomm.h"
-#include "output.h"
-
-
-
-//============================================================
-// DEBUGGING
-//============================================================
-
-// note you need to compile as a console app to have any of
-// these printfs show up
-#define DEBUG_VERSION 0
-
-#if DEBUG_VERSION
-#define DEBUG_PRINTF(x) printf x
-#else
-#define DEBUG_PRINTF(x)
-#endif
-
-
-//============================================================
-// CONSTANTS
-//============================================================
-
-// unique client ID
-#define CLIENT_ID (('M' << 24) | ('L' << 16) | ('E' << 8) | ('D' << 0))
-
-// LED methods
-#define LED_METHOD_PS2 0
-#define LED_METHOD_USB 1
-
-// window parameters
-#define WINDOW_CLASS TEXT("LEDSample")
-#define WINDOW_NAME TEXT("LEDSample")
-
-// window styles
-#define WINDOW_STYLE WS_OVERLAPPEDWINDOW
-#define WINDOW_STYLE_EX 0
-
-// Define the keyboard indicators.
-// (Definitions borrowed from ntddkbd.h)
-
-#define IOCTL_KEYBOARD_SET_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define IOCTL_KEYBOARD_QUERY_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define IOCTL_KEYBOARD_QUERY_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define KEYBOARD_SCROLL_LOCK_ON 1
-#define KEYBOARD_NUM_LOCK_ON 2
-#define KEYBOARD_CAPS_LOCK_ON 4
-
-
-
-//============================================================
-// TYPE DEFINITIONS
-//============================================================
-
-struct KEYBOARD_INDICATOR_PARAMETERS
-{
- USHORT UnitId; // Unit identifier.
- USHORT LedFlags; // LED indicator state.
-};
-
-
-struct id_map_entry
-{
- id_map_entry * next;
- const char * name;
- WPARAM id;
-};
-
-
-
-//============================================================
-// GLOBAL VARIABLES
-//============================================================
-
-static int ledmethod;
-static int original_state;
-static int current_state;
-static int pause_state;
-static HANDLE hKbdDev;
-
-static HWND mame_target;
-static HWND listener_hwnd;
-
-static id_map_entry * idmaplist;
-
-// message IDs
-static UINT om_mame_start;
-static UINT om_mame_stop;
-static UINT om_mame_update_state;
-static UINT om_mame_register_client;
-static UINT om_mame_unregister_client;
-static UINT om_mame_get_id_string;
-
-
-
-//============================================================
-// FUNCTION PROTOTYPES
-//============================================================
-
-static int create_window_class(void);
-static LRESULT CALLBACK listener_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
-static LRESULT handle_mame_start(WPARAM wparam, LPARAM lparam);
-static LRESULT handle_mame_stop(WPARAM wparam, LPARAM lparam);
-static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam);
-static void reset_id_to_outname_cache(void);
-static const char *map_id_to_outname(WPARAM id);
-static LRESULT handle_update_state(WPARAM wparam, LPARAM lparam);
-
-// these functions provide the meat
-static void output_startup(const char *commandline);
-static void output_mame_start(void);
-static void output_set_state(const char *name, INT32 state);
-static void output_mame_stop(void);
-static void output_shutdown(void);
-
-static int led_get_state(void);
-static void led_set_state(int state);
-
-
-//============================================================
-// main
-//============================================================
-
-int main(int argc, char *argv[])
-{
- const char *arg = (argc > 1) ? argv[1] : "";
- int exitcode = 1;
- HWND otherwnd;
- MSG message;
- int result;
-
- // see if there is another instance of us running
- otherwnd = FindWindow(WINDOW_CLASS, WINDOW_NAME);
-
- // if the argument is "-kill", post a close message
- if (strcmp(arg, "-kill") == 0)
- {
- if (otherwnd != nullptr)
- PostMessage(otherwnd, WM_QUIT, 0, 0);
- return (otherwnd != nullptr) ? 1 : 0;
- }
-
- // if we had another instance, defer to it
- if (otherwnd != nullptr)
- return 0;
-
- // call the startup code
- output_startup(arg);
-
- // create our window class
- result = create_window_class();
- if (result != 0)
- goto error;
-
- // create a window
- listener_hwnd = CreateWindowEx(
- WINDOW_STYLE_EX,
- WINDOW_CLASS,
- WINDOW_NAME,
- WINDOW_STYLE,
- 0, 0,
- 1, 1,
- nullptr,
- nullptr,
- GetModuleHandle(nullptr),
- nullptr);
- if (listener_hwnd == nullptr)
- goto error;
-
- // allocate message ids
- om_mame_start = RegisterWindowMessage(OM_MAME_START);
- if (om_mame_start == 0)
- goto error;
- om_mame_stop = RegisterWindowMessage(OM_MAME_STOP);
- if (om_mame_stop == 0)
- goto error;
- om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE);
- if (om_mame_update_state == 0)
- goto error;
-
- om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT);
- if (om_mame_register_client == 0)
- goto error;
- om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT);
- if (om_mame_unregister_client == 0)
- goto error;
- om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING);
- if (om_mame_get_id_string == 0)
- goto error;
-
- // see if MAME is already running
- otherwnd = FindWindow(OUTPUT_WINDOW_CLASS, OUTPUT_WINDOW_NAME);
- if (otherwnd != nullptr)
- handle_mame_start((WPARAM)otherwnd, 0);
-
- // process messages
- while (GetMessage(&message, nullptr, 0, 0))
- {
- TranslateMessage(&message);
- DispatchMessage(&message);
- }
-
- // reset on the way out if still live
- if (mame_target != nullptr)
- handle_mame_stop((WPARAM)mame_target, 0);
- exitcode = 0;
-
-error:
- // call the shutdown code
- output_shutdown();
-
- return exitcode;
-}
-
-
-//============================================================
-// create_window_class
-//============================================================
-
-static int create_window_class(void)
-{
- static int classes_created = FALSE;
-
- /* only do this once */
- if (!classes_created)
- {
- WNDCLASS wc = { 0 };
-
- // initialize the description of the window class
- wc.lpszClassName = WINDOW_CLASS;
- wc.hInstance = GetModuleHandle(nullptr);
- wc.lpfnWndProc = listener_window_proc;
-
- // register the class; fail if we can't
- if (!RegisterClass(&wc))
- return 1;
- classes_created = TRUE;
- }
-
- return 0;
-}
-
-
-//============================================================
-// window_proc
-//============================================================
-
-static LRESULT CALLBACK listener_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- // OM_MAME_START: register ourselves with the new MAME (first instance only)
- if (message == om_mame_start)
- return handle_mame_start(wparam, lparam);
-
- // OM_MAME_STOP: no need to unregister, just note that we've stopped caring and reset the LEDs
- else if (message == om_mame_stop)
- return handle_mame_stop(wparam, lparam);
-
- // OM_MAME_UPDATE_STATE: update the state of this item if we care
- else if (message == om_mame_update_state)
- return handle_update_state(wparam, lparam);
-
- // WM_COPYDATA: extract the string and create an ID map entry
- else if (message == WM_COPYDATA)
- return handle_copydata(wparam, lparam);
-
- // everything else is default
- else
- return DefWindowProc(wnd, message, wparam, lparam);
-}
-
-
-//============================================================
-// handle_mame_start
-//============================================================
-
-static LRESULT handle_mame_start(WPARAM wparam, LPARAM lparam)
-{
- DEBUG_PRINTF(("mame_start (%08X)\n", (UINT32)wparam));
-
- // make this the targeted version of MAME
- mame_target = (HWND)wparam;
-
- // initialize the LED states
- output_mame_start();
- reset_id_to_outname_cache();
-
- // register ourselves as a client
- PostMessage(mame_target, om_mame_register_client, (WPARAM)listener_hwnd, CLIENT_ID);
-
- // get the game name
- map_id_to_outname(0);
- return 0;
-}
-
-
-//============================================================
-// handle_mame_stop
-//============================================================
-
-static LRESULT handle_mame_stop(WPARAM wparam, LPARAM lparam)
-{
- DEBUG_PRINTF(("mame_stop (%08X)\n", (UINT32)wparam));
-
- // ignore if this is not the instance we care about
- if (mame_target != (HWND)wparam)
- return 1;
-
- // clear our target out
- mame_target = nullptr;
- reset_id_to_outname_cache();
-
- // reset the LED states
- output_mame_stop();
- return 0;
-}
-
-
-//============================================================
-// handle_copydata
-//============================================================
-
-static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam)
-{
- COPYDATASTRUCT *copydata = (COPYDATASTRUCT *)lparam;
- copydata_id_string *data = (copydata_id_string *)copydata->lpData;
- id_map_entry *entry;
- char *string;
-
- DEBUG_PRINTF(("copydata (%08X)\n", (UINT32)wparam));
-
- // ignore requests we don't care about
- if (mame_target != (HWND)wparam)
- return 1;
-
- // allocate memory
- entry = (id_map_entry *)malloc(sizeof(*entry));
- if (entry == nullptr)
- return 0;
-
- string = (char *)malloc(strlen(data->string) + 1);
- if (string == nullptr)
- {
- free(entry);
- return 0;
- }
-
- // if all allocations worked, make a new entry
- entry->next = idmaplist;
- entry->name = string;
- entry->id = data->id;
-
- // copy the string and hook us into the list
- strcpy(string, data->string);
- idmaplist = entry;
-
- DEBUG_PRINTF((" id %d = '%s'\n", (int)entry->id, entry->name));
-
- return 0;
-}
-
-
-//============================================================
-// reset_id_to_outname_cache
-//============================================================
-
-static void reset_id_to_outname_cache(void)
-{
- // free our ID list
- while (idmaplist != nullptr)
- {
- id_map_entry *temp = idmaplist;
- idmaplist = temp->next;
- free((void*)temp->name);
- free(temp);
- }
-}
-
-
-//============================================================
-// map_id_to_outname
-//============================================================
-
-static const char *map_id_to_outname(WPARAM id)
-{
- id_map_entry *entry;
-
- // see if we have an entry in our map
- for (entry = idmaplist; entry != nullptr; entry = entry->next)
- if (entry->id == id)
- return entry->name;
-
- // no entry yet; we have to ask
- SendMessage(mame_target, om_mame_get_id_string, (WPARAM)listener_hwnd, id);
-
- // now see if we have the entry in our map
- for (entry = idmaplist; entry != nullptr; entry = entry->next)
- if (entry->id == id)
- return entry->name;
-
- // if not, use an empty string
- return "";
-}
-
-
-//============================================================
-// handle_update_state
-//============================================================
-
-static LRESULT handle_update_state(WPARAM wparam, LPARAM lparam)
-{
- DEBUG_PRINTF(("update_state: id=%d state=%d\n", (UINT32)wparam, (UINT32)lparam));
- output_set_state(map_id_to_outname(wparam), lparam);
- return 0;
-}
-
-
-//
-// END BOILERPLATE CODE
-//
-// ------------------------>8 snip 8<-------------------------
-//
-// BEGIN LED-SPECIFIC CODE
-//
-
-
-//============================================================
-// output_startup
-//============================================================
-
-static void output_startup(const char *commandline)
-{
- // default to PS/2, override if USB is specified as a parameter
- ledmethod = LED_METHOD_PS2;
- if (commandline != nullptr && strcmp(commandline, "-usb") == 0)
- ledmethod = LED_METHOD_USB;
-
- // output the method
- switch (ledmethod)
- {
- case LED_METHOD_PS2:
- DEBUG_PRINTF(("Using PS/2 method\n"));
- break;
-
- case LED_METHOD_USB:
- DEBUG_PRINTF(("Using USB method\n"));
- break;
- }
-}
-
-
-//============================================================
-// output_shutdown
-//============================================================
-
-static void output_shutdown(void)
-{
- // nothing to do here
-}
-
-
-//============================================================
-// output_mame_start
-//============================================================
-
-static void output_mame_start(void)
-{
- HRESULT error_number;
-
- // initialize the system based on the method
- switch (ledmethod)
- {
- case LED_METHOD_PS2:
- if (!DefineDosDevice(DDD_RAW_TARGET_PATH, TEXT("Kbd"), TEXT("\\Device\\KeyboardClass0")))
- {
- error_number = GetLastError();
- fprintf(stderr, "Unable to open the keyboard device. (error %d)\n", (UINT32)error_number);
- return;
- }
-
- hKbdDev = CreateFile(TEXT("\\\\.\\Kbd"), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
- if (hKbdDev == INVALID_HANDLE_VALUE)
- {
- error_number = GetLastError();
- fprintf(stderr, "Unable to open the keyboard device. (error %d)\n", (UINT32)error_number);
- return;
- }
- break;
- }
-
- // remember the initial LED states
- original_state = current_state = led_get_state();
-}
-
-
-//============================================================
-// output_mame_stop
-//============================================================
-
-static void output_mame_stop(void)
-{
- int error_number = 0;
-
- // restore the initial LED states
- led_set_state(original_state);
-
- switch (ledmethod)
- {
- case LED_METHOD_PS2:
- if (!DefineDosDevice(DDD_REMOVE_DEFINITION, TEXT("Kbd"), nullptr))
- {
- error_number = GetLastError();
- fprintf(stderr, "Unable to close the keyboard device. (error %d)\n", error_number);
- return;
- }
- if (!CloseHandle(hKbdDev))
- {
- error_number = GetLastError();
- fprintf(stderr, "Unable to close the keyboard device. (error %d)\n", error_number);
- return;
- }
- break;
- }
-}
-
-
-//============================================================
-// output_set_state
-//============================================================
-
-static void output_set_state(const char *outname, INT32 state)
-{
- // look for pause state
- if (strcmp(outname, "pause") == 0)
- {
- if (state)
- {
- pause_state = led_get_state();
- led_set_state(original_state);
- }
- else
- {
- original_state = led_get_state();
- led_set_state(pause_state);
- }
- }
- // look for LED0/LED1/LED2 states and update accordingly
- else if (strcmp(outname, "led0") == 0)
- led_set_state((current_state & ~1) | (state & 1));
- else if (strcmp(outname, "led1") == 0)
- led_set_state((current_state & ~2) | ((state & 1) << 1));
- else if (strcmp(outname, "led2") == 0)
- led_set_state((current_state & ~4) | ((state & 1) << 2));
-}
-
-
-//============================================================
-// led_get_state
-//============================================================
-
-static int led_get_state(void)
-{
- int result = 0;
-
- switch (ledmethod)
- {
- case LED_METHOD_USB:
- {
- BYTE key_states[256];
-
- // get the current state
- GetKeyboardState(&key_states[0]);
-
- // set the numlock bit
- result |= (key_states[VK_NUMLOCK] & 1);
- result |= (key_states[VK_CAPITAL] & 1) << 1;
- result |= (key_states[VK_SCROLL] & 1) << 2;
- break;
- }
-
- case LED_METHOD_PS2:
- {
- KEYBOARD_INDICATOR_PARAMETERS OutputBuffer; // Output buffer for DeviceIoControl
- ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
- ULONG ReturnedLength; // Number of bytes returned in output buffer
-
- // Address first keyboard
- OutputBuffer.UnitId = 0;
-
- DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_QUERY_INDICATORS,
- nullptr, 0,
- &OutputBuffer, DataLength,
- &ReturnedLength, nullptr);
-
- // Demangle lights to match 95/98
- if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) result |= 0x1;
- if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON) result |= 0x2;
- if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) result |= 0x4;
- break;
- }
- }
-
- return result;
-}
-
-
-//============================================================
-// led_set_state
-//============================================================
-
-static void led_set_state(int state)
-{
- current_state = state;
-
- switch (ledmethod)
- {
- case LED_METHOD_USB:
- {
- static const BYTE vk[3] = { VK_NUMLOCK, VK_CAPITAL, VK_SCROLL };
- BYTE keyState[256];
- int k;
-
- GetKeyboardState((LPBYTE)&keyState);
- for (k = 0; k < 3; k++)
- {
- if ((((state >> k) & 1) && !(keyState[vk[k]] & 1)) ||
- (!((state >> k) & 1) && (keyState[vk[k]] & 1)))
- {
- // Simulate a key press
- keybd_event(vk[k], 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
-
- // Simulate a key release
- keybd_event(vk[k], 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
- }
- }
-
- keyState[VK_NUMLOCK] = (keyState[VK_NUMLOCK] & ~1) | ((state >> 0) & 1);
- keyState[VK_CAPITAL] = (keyState[VK_CAPITAL] & ~1) | ((state >> 1) & 1);
- keyState[VK_SCROLL] = (keyState[VK_SCROLL] & ~1) | ((state >> 2) & 1);
- SetKeyboardState(&keyState[0]);
- break;
- }
-
- case LED_METHOD_PS2:
- {
- KEYBOARD_INDICATOR_PARAMETERS InputBuffer; // Input buffer for DeviceIoControl
- ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
- ULONG ReturnedLength; // Number of bytes returned in output buffer
- UINT LedFlags=0;
-
- // Demangle lights to match 95/98
- if (state & 0x1) LedFlags |= KEYBOARD_NUM_LOCK_ON;
- if (state & 0x2) LedFlags |= KEYBOARD_CAPS_LOCK_ON;
- if (state & 0x4) LedFlags |= KEYBOARD_SCROLL_LOCK_ON;
-
- // Address first keyboard
- InputBuffer.UnitId = 0;
- InputBuffer.LedFlags = LedFlags;
- DeviceIoControl(hKbdDev, IOCTL_KEYBOARD_SET_INDICATORS,
- &InputBuffer, DataLength,
- nullptr, 0,
- &ReturnedLength, nullptr);
- break;
- }
- }
-}
diff --git a/src/osd/windows/main.cpp b/src/osd/windows/main.cpp
index ccfddb27a0d..6e7717349bb 100644
--- a/src/osd/windows/main.cpp
+++ b/src/osd/windows/main.cpp
@@ -7,28 +7,24 @@
//============================================================
// standard windows headers
+#ifdef OSD_SDL
+#define _WIN32_WINNT 0x0501
+#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
-// MAMEOS headers
#include "strconv.h"
-extern int utf8_main(int argc, char *argv[]);
-
-
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+extern int utf8_main(int argc, char *argv[]);
//============================================================
// main
//============================================================
-// undo the command-line #define that maps main to utf8_main in all other cases
-#ifndef WINUI
-#undef main
-#undef wmain
-#endif
-
+#ifdef UNICODE
extern "C" int _tmain(int argc, TCHAR **argv)
{
int i, rc;
@@ -55,3 +51,19 @@ extern "C" int _tmain(int argc, TCHAR **argv)
return rc;
}
+#endif
+
+#else
+
+#include "winmain.h"
+
+// The main function is only used to initialize our IFrameworkView class.
+[Platform::MTAThread]
+int main(Platform::Array<Platform::String^>^)
+{
+ auto app_source = ref new MameViewSource();
+ Windows::ApplicationModel::Core::CoreApplication::Run(app_source);
+ return 0;
+}
+
+#endif
diff --git a/src/osd/windows/output.cpp b/src/osd/windows/output.cpp
deleted file mode 100644
index ef3c563e3ac..00000000000
--- a/src/osd/windows/output.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// output.c - Win32 implementation of MAME output routines
-//
-//============================================================
-
-// standard windows headers
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-// MAME headers
-#include "emu.h"
-#include "winmain.h"
-// MAMEOS headers
-#include "output.h"
-
-#include "winutil.h"
-
-
-
-//============================================================
-// CONSTANTS
-//============================================================
-
-// window styles
-#define WINDOW_STYLE WS_OVERLAPPEDWINDOW
-#define WINDOW_STYLE_EX 0
-
-
-
-//============================================================
-// TYPEDEFS
-//============================================================
-
-struct registered_client
-{
- registered_client * next; // next client in the list
- LPARAM id; // client-specified ID
- HWND hwnd; // client HWND
- running_machine * machine;
-};
-
-
-
-//============================================================
-// GLOBAL VARIABLES
-//============================================================
-
-// our HWND
-static HWND output_hwnd;
-
-// client list
-static registered_client * clientlist;
-
-// message IDs
-static UINT om_mame_start;
-static UINT om_mame_stop;
-static UINT om_mame_update_state;
-static UINT om_mame_register_client;
-static UINT om_mame_unregister_client;
-static UINT om_mame_get_id_string;
-
-
-
-//============================================================
-// FUNCTION PROTOTYPES
-//============================================================
-
-static int create_window_class(void);
-static LRESULT CALLBACK output_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
-static LRESULT register_client(running_machine &machine, HWND hwnd, LPARAM id);
-static LRESULT unregister_client(running_machine &machine, HWND hwnd, LPARAM id);
-static LRESULT send_id_string(running_machine &machine, HWND hwnd, LPARAM id);
-static void notifier_callback(const char *outname, INT32 value, void *param);
-
-
-
-//============================================================
-// output_init
-//============================================================
-
-bool windows_osd_interface::output_init()
-{
- int result;
-
- // reset globals
- clientlist = nullptr;
-
- // create our window class
- result = create_window_class();
- assert(result == 0);
- (void)result; // to silence gcc 4.6
-
- // create a window
- output_hwnd = CreateWindowEx(
- WINDOW_STYLE_EX,
- OUTPUT_WINDOW_CLASS,
- OUTPUT_WINDOW_NAME,
- WINDOW_STYLE,
- 0, 0,
- 1, 1,
- nullptr,
- nullptr,
- GetModuleHandleUni(),
- nullptr);
- assert(output_hwnd != nullptr);
-
- // set a pointer to the running machine
- SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine());
-
- // allocate message ids
- om_mame_start = RegisterWindowMessage(OM_MAME_START);
- assert(om_mame_start != 0);
- om_mame_stop = RegisterWindowMessage(OM_MAME_STOP);
- assert(om_mame_stop != 0);
- om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE);
- assert(om_mame_update_state != 0);
-
- om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT);
- assert(om_mame_register_client != 0);
- om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT);
- assert(om_mame_unregister_client != 0);
- om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING);
- assert(om_mame_get_id_string != 0);
-
- // broadcast a startup message
- PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0);
-
- // register a notifier for output changes
- machine().output().set_notifier(nullptr, notifier_callback, &machine());
-
- return true;
-}
-
-
-//============================================================
-// output_exit
-//============================================================
-
-void windows_osd_interface::output_exit()
-{
- // free all the clients
- while (clientlist != nullptr)
- {
- registered_client *temp = clientlist;
- clientlist = temp->next;
- global_free(temp);
- }
-
- // broadcast a shutdown message
- PostMessage(HWND_BROADCAST, om_mame_stop, (WPARAM)output_hwnd, 0);
-}
-
-
-//============================================================
-// create_window_class
-//============================================================
-
-static int create_window_class(void)
-{
- static UINT8 classes_created = FALSE;
-
- /* only do this once */
- if (!classes_created)
- {
- WNDCLASS wc = { 0 };
-
- // initialize the description of the window class
- wc.lpszClassName = OUTPUT_WINDOW_CLASS;
- wc.hInstance = GetModuleHandleUni();
- wc.lpfnWndProc = output_window_proc;
-
- UnregisterClass(wc.lpszClassName, wc.hInstance);
-
- // register the class; fail if we can't
- if (!RegisterClass(&wc))
- return 1;
- classes_created = TRUE;
- }
-
- return 0;
-}
-
-
-//============================================================
-// output_window_proc
-//============================================================
-
-static LRESULT CALLBACK output_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- LONG_PTR ptr = GetWindowLongPtr(wnd, GWLP_USERDATA);
- running_machine &machine = *(running_machine *)ptr;
-
- // register a new client
- if (message == om_mame_register_client)
- return register_client(machine,(HWND)wparam, lparam);
-
- // unregister a client
- else if (message == om_mame_unregister_client)
- return unregister_client(machine,(HWND)wparam, lparam);
-
- // get a string for an ID
- else if (message == om_mame_get_id_string)
- return send_id_string(machine, (HWND)wparam, lparam);
-
- else
- return DefWindowProc(wnd, message, wparam, lparam);
-}
-
-
-//============================================================
-// register_client
-//============================================================
-
-static LRESULT register_client(running_machine &machine, HWND hwnd, LPARAM id)
-{
- registered_client **client;
-
- // find the end of the list; if we find ourself already registered,
- // return 1
- for (client = &clientlist; *client != nullptr; client = &(*client)->next)
- if ((*client)->id == id)
- {
- (*client)->hwnd = hwnd;
- machine.output().notify_all(notifier_callback, *client);
- return 1;
- }
-
- // add us to the end
- *client = global_alloc(registered_client);
- (*client)->next = nullptr;
- (*client)->id = id;
- (*client)->hwnd = hwnd;
- (*client)->machine = &machine;
-
- // request a notification for all outputs
- machine.output().notify_all(notifier_callback, *client);
- return 0;
-}
-
-
-//============================================================
-// unregister_client
-//============================================================
-
-static LRESULT unregister_client(running_machine &machine, HWND hwnd, LPARAM id)
-{
- registered_client **client;
- int found = FALSE;
-
- // find any matching IDs in the list and remove them
- for (client = &clientlist; *client != nullptr; client = &(*client)->next)
- if ((*client)->id == id)
- {
- registered_client *temp = *client;
- *client = (*client)->next;
- global_free(temp);
- found = TRUE;
- break;
- }
-
- // return an error if not found
- return found ? 0 : 1;
-}
-
-
-//============================================================
-// send_id_string
-//============================================================
-
-static LRESULT send_id_string(running_machine &machine, HWND hwnd, LPARAM id)
-{
- COPYDATASTRUCT copydata;
- const char *name;
- int datalen;
-
- // id 0 is the name of the game
- if (id == 0)
- name = machine.system().name;
- else
- name = machine.output().id_to_name(id);
-
- // a NULL name is an empty string
- if (name == nullptr)
- name = "";
-
- // allocate memory for the message
- datalen = sizeof(copydata_id_string) + strlen(name) + 1;
- dynamic_buffer buffer(datalen);
- copydata_id_string *temp = (copydata_id_string *)&buffer[0];
- temp->id = id;
- strcpy(temp->string, name);
-
- // reply by using SendMessage with WM_COPYDATA
- copydata.dwData = COPYDATA_MESSAGE_ID_STRING;
- copydata.cbData = datalen;
- copydata.lpData = temp;
- SendMessage(hwnd, WM_COPYDATA, (WPARAM)output_hwnd, (LPARAM)&copydata);
-
- return 0;
-}
-
-
-//============================================================
-// notifier_callback
-//============================================================
-
-static void notifier_callback(const char *outname, INT32 value, void *param)
-{
- registered_client *client;
- // loop over clients and notify them
- for (client = clientlist; client != nullptr; client = client->next)
- {
- if (param == nullptr || param == client->machine) {
- PostMessage(client->hwnd, om_mame_update_state, client->machine->output().name_to_id(outname), value);
- }
- }
-}
diff --git a/src/osd/windows/output.h b/src/osd/windows/output.h
deleted file mode 100644
index 9d71332b44b..00000000000
--- a/src/osd/windows/output.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// output.h - Win32 implementation of MAME output routines
-//
-//============================================================
-
-#ifndef __WINDOWS_OUTPUT_H__
-#define __WINDOWS_OUTPUT_H__
-
-
-//============================================================
-// CONSTANTS
-//============================================================
-
-// window parameters
-#define OUTPUT_WINDOW_CLASS TEXT("MAMEOutput")
-#define OUTPUT_WINDOW_NAME TEXT("MAMEOutput")
-
-//
-// These messages are sent by MAME:
-//
-
-// OM_MAME_START: broadcast when MAME initializes
-// WPARAM = HWND of MAME's output window
-// LPARAM = unused
-#define OM_MAME_START TEXT("MAMEOutputStart")
-
-// OM_MAME_STOP: broadcast when MAME shuts down
-// WPARAM = HWND of MAME's output window
-// LPARAM = unused
-#define OM_MAME_STOP TEXT("MAMEOutputStop")
-
-// OM_MAME_UPDATE_STATE: sent to registered clients when the state
-// of an output changes
-// WPARAM = ID of the output
-// LPARAM = new value for the output
-#define OM_MAME_UPDATE_STATE TEXT("MAMEOutputUpdateState")
-
-
-//
-// These messages are sent by external clients to MAME:
-//
-
-// OM_MAME_REGISTER_CLIENT: sent to MAME to register a client
-// WPARAM = HWND of client's listener window
-// LPARAM = client-specified ID (must be unique)
-#define OM_MAME_REGISTER_CLIENT TEXT("MAMEOutputRegister")
-
-// OM_MAME_UNREGISTER_CLIENT: sent to MAME to unregister a client
-// WPARAM = HWND of client's listener window
-// LPARAM = client-specified ID (must match registration)
-#define OM_MAME_UNREGISTER_CLIENT TEXT("MAMEOutputUnregister")
-
-// OM_MAME_GET_ID_STRING: requests the string associated with a
-// given ID. ID=0 is always the name of the game. Other IDs are
-// only discoverable from a OM_MAME_UPDATE_STATE message. The
-// result will be sent back as a WM_COPYDATA message with MAME's
-// output window as the sender, dwData = the ID of the string,
-// and lpData pointing to a NULL-terminated string.
-// WPARAM = HWND of client's listener window
-// LPARAM = ID you wish to know about
-#define OM_MAME_GET_ID_STRING TEXT("MAMEOutputGetIDString")
-
-
-//
-// These constants are used to identify WM_COPYDATA messages
-// coming from MAME:
-//
-
-#define COPYDATA_MESSAGE_ID_STRING 1
-
-
-
-//============================================================
-// TYPE DEFINITIONS
-//============================================================
-
-struct copydata_id_string
-{
- UINT32 id; // ID that was requested
- char string[1]; // string array containing the data
-};
-
-#endif /* __WINDOWS_OUTPUT_H__ */
diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp
index 559213657da..f6de9222c50 100644
--- a/src/osd/windows/video.cpp
+++ b/src/osd/windows/video.cpp
@@ -62,7 +62,7 @@ static void get_resolution(const char *defdata, const char *data, osd_window_con
//============================================================
// FIXME: Temporary workaround
-static osd_window_config windows[MAX_WINDOWS]; // configuration data per-window
+static osd_window_config windows[MAX_VIDEO_WINDOWS]; // configuration data per-window
bool windows_osd_interface::video_init()
{
@@ -89,15 +89,6 @@ bool windows_osd_interface::video_init()
}
//============================================================
-// get_slider_list
-//============================================================
-
-slider_state *windows_osd_interface::get_slider_list()
-{
- return m_sliders;
-}
-
-//============================================================
// video_exit
//============================================================
diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h
index 9e040d90b78..f47a5260b8e 100644
--- a/src/osd/windows/video.h
+++ b/src/osd/windows/video.h
@@ -14,14 +14,6 @@
#include "modules/osdwindow.h"
//============================================================
-// CONSTANTS
-//============================================================
-
-#define MAX_WINDOWS 4
-
-#define GLSL_SHADER_MAX 10
-
-//============================================================
// TYPE DEFINITIONS
//============================================================
@@ -47,67 +39,9 @@ public:
private:
HMONITOR m_handle; // handle to the monitor
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
MONITORINFOEX m_info; // most recently retrieved info
+#endif
};
-struct osd_video_config
-{
- // global configuration
- int windowed; // start windowed?
- int prescale; // prescale factor
- int keepaspect; // keep aspect ratio
- int numscreens; // number of screens
-
- // hardware options
- int mode; // output mode
- int waitvsync; // spin until vsync
- int syncrefresh; // sync only to refresh rate
- int switchres; // switch resolutions
-
- // d3d, accel, opengl
- int filter; // enable filtering
- //int filter; // enable filtering, disabled if glsl_filter>0
-
- // OpenGL options
- int glsl;
- int glsl_filter; // glsl filtering, >0 disables filter
- char * glsl_shader_mamebm[GLSL_SHADER_MAX]; // custom glsl shader set, mame bitmap
- int glsl_shader_mamebm_num; // custom glsl shader set number, mame bitmap
- char * glsl_shader_scrn[GLSL_SHADER_MAX]; // custom glsl shader set, screen bitmap
- int glsl_shader_scrn_num; // custom glsl shader number, screen bitmap
- int pbo;
- int vbo;
- int allowtexturerect; // allow GL_ARB_texture_rectangle, default: no
- int forcepow2texture; // force power of two textures, default: no
-
- // dd, d3d
- int triplebuf; // triple buffer
-
- //============================================================
- // SDL - options
- //============================================================
- int novideo; // don't draw, for pure CPU benchmarking
-
- int centerh;
- int centerv;
-
- // vector options
- float beamwidth; // beam width
-
- // perftest
- int perftest; // print out real video fps
-
- // X11 options
- int restrictonemonitor; // in fullscreen, confine to Xinerama monitor 0
-
- // YUV options
- int scale_mode;
-};
-
-//============================================================
-// GLOBAL VARIABLES
-//============================================================
-
-extern osd_video_config video_config;
-
#endif
diff --git a/src/osd/windows/winclip.cpp b/src/osd/windows/winclip.cpp
deleted file mode 100644
index 7717f4e6188..00000000000
--- a/src/osd/windows/winclip.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// winclip.c - Win32 OSD core clipboard access functions
-//
-//============================================================
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "strconv.h"
-
-//============================================================
-// get_clipboard_text_by_format
-//============================================================
-
-static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID data))
-{
- char *result = NULL;
- HANDLE data_handle;
- LPVOID data;
-
- // check to see if this format is available
- if (IsClipboardFormatAvailable(format))
- {
- // open the clipboard
- if (OpenClipboard(NULL))
- {
- // try to access clipboard data
- data_handle = GetClipboardData(format);
- if (data_handle != NULL)
- {
- // lock the data
- data = GlobalLock(data_handle);
- if (data != NULL)
- {
- // invoke the convert
- result = (*convert)(data);
-
- // unlock the data
- GlobalUnlock(data_handle);
- }
- }
-
- // close out the clipboard
- CloseClipboard();
- }
- }
- return result;
-}
-
-//============================================================
-// convert_wide
-//============================================================
-
-static char *convert_wide(LPCVOID data)
-{
- return utf8_from_wstring((LPCWSTR) data);
-}
-
-//============================================================
-// convert_ansi
-//============================================================
-
-static char *convert_ansi(LPCVOID data)
-{
- return utf8_from_astring((LPCSTR) data);
-}
-
-
-
-//============================================================
-// osd_get_clipboard_text
-//============================================================
-
-char *osd_get_clipboard_text(void)
-{
- char *result;
-
- // try to access unicode text
- result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
-
- // try to access ANSI text
- if (result == NULL)
- result = get_clipboard_text_by_format(CF_TEXT, convert_ansi);
-
- return result;
-}
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index ad8de3d2890..0e30da1b93d 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -272,33 +272,14 @@ int windows_osd_interface::window_count()
void windows_osd_interface::build_slider_list()
{
- m_sliders = nullptr;
- slider_state* full_list = nullptr;
- slider_state* curr = nullptr;
+ m_sliders.clear();
+
for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next)
{
// take the sliders of the first window
- slider_state* window_sliders = window->m_renderer->get_slider_list();
- if (window_sliders == nullptr)
- {
- continue;
- }
-
- if (full_list == nullptr)
- {
- full_list = curr = window_sliders;
- }
- else
- {
- curr->next = window_sliders;
- }
-
- while (curr->next != nullptr) {
- curr = curr->next;
- }
+ std::vector<ui_menu_item> window_sliders = window->m_renderer->get_slider_list();
+ m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
}
-
- m_sliders = full_list;
}
//============================================================
diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h
index bc3544ba637..b42903b9dff 100644
--- a/src/osd/windows/window.h
+++ b/src/osd/windows/window.h
@@ -57,14 +57,22 @@ public:
virtual bool win_has_menu() override
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
return GetMenu(m_hwnd) ? true : false;
+#else
+ return false;
+#endif
}
virtual osd_dim get_size() override
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
RECT client;
GetClientRect(m_hwnd, &client);
return osd_dim(client.right - client.left, client.bottom - client.top);
+#else
+ throw ref new Platform::NotImplementedException();
+#endif
}
virtual osd_monitor_info *monitor() const override { return m_monitor; }
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 55cbde387e6..7249c9ee747 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -33,6 +33,13 @@
#include "winutil.h"
#include "debugger.h"
#include "winfile.h"
+#include "strconv.h"
+
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+using namespace Windows::ApplicationModel;
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::UI::Popups;
+#endif
#define DEBUG_SLOW_LOCKS 0
@@ -52,6 +59,8 @@
// TYPE DEFINITIONS
//**************************************************************************
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
template<typename _FunctionPtr>
class dynamic_bind
{
@@ -217,6 +226,34 @@ public:
}
};
+#else
+
+//============================================================
+// winuniversal_output_error
+//============================================================
+
+class winuniversal_output_error : public osd_output
+{
+public:
+ virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override
+ {
+ if (channel == OSD_OUTPUT_CHANNEL_ERROR)
+ {
+ char buffer[1024];
+ vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args);
+
+ osd_unique_wstr wcbuffer(wstring_from_utf8(buffer));
+ osd_unique_wstr wcappname(wstring_from_utf8(emulator_info::get_appname()));
+
+ auto dlg = ref new MessageDialog(ref new Platform::String(wcbuffer.get()), ref new Platform::String(wcappname.get()));
+ dlg->ShowAsync();
+ }
+ else
+ chain_output(channel, msg, args);
+ }
+};
+
+#endif
@@ -231,21 +268,23 @@ int _CRT_glob = 0;
// LOCAL VARIABLES
//**************************************************************************
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
static LPTOP_LEVEL_EXCEPTION_FILTER pass_thru_filter;
-static HANDLE watchdog_reset_event;
-static HANDLE watchdog_exit_event;
-static HANDLE watchdog_thread;
+static sampling_profiler *profiler = nullptr;
+static symbol_manager *symbols = nullptr;
-static running_machine *g_current_machine;
+bool stack_walker::s_initialized = false;
static int timeresult = !TIMERR_NOERROR;
static TIMECAPS timecaps;
+#endif
-static sampling_profiler *profiler = nullptr;
-static symbol_manager *symbols = nullptr;
+static HANDLE watchdog_reset_event;
+static HANDLE watchdog_exit_event;
+static HANDLE watchdog_thread;
-bool stack_walker::s_initialized = false;
+static running_machine *g_current_machine;
//**************************************************************************
@@ -374,6 +413,7 @@ const options_entry windows_options::s_option_entries[] =
// MAIN ENTRY POINT
//**************************************************************************
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//============================================================
// utf8_main
@@ -432,18 +472,6 @@ int main(int argc, char *argv[])
return result;
}
-
-//============================================================
-// windows_options
-//============================================================
-
-windows_options::windows_options()
-: osd_options()
-{
- add_entries(s_option_entries);
-}
-
-
//============================================================
// control_handler
//============================================================
@@ -453,12 +481,12 @@ static BOOL WINAPI control_handler(DWORD type)
// indicate to the user that we detected something
switch (type)
{
- case CTRL_C_EVENT: fprintf(stderr, "Caught Ctrl+C"); break;
- case CTRL_BREAK_EVENT: fprintf(stderr, "Caught Ctrl+break"); break;
- case CTRL_CLOSE_EVENT: fprintf(stderr, "Caught console close"); break;
- case CTRL_LOGOFF_EVENT: fprintf(stderr, "Caught logoff"); break;
- case CTRL_SHUTDOWN_EVENT: fprintf(stderr, "Caught shutdown"); break;
- default: fprintf(stderr, "Caught unexpected console event"); break;
+ case CTRL_C_EVENT: fprintf(stderr, "Caught Ctrl+C"); break;
+ case CTRL_BREAK_EVENT: fprintf(stderr, "Caught Ctrl+break"); break;
+ case CTRL_CLOSE_EVENT: fprintf(stderr, "Caught console close"); break;
+ case CTRL_LOGOFF_EVENT: fprintf(stderr, "Caught logoff"); break;
+ case CTRL_SHUTDOWN_EVENT: fprintf(stderr, "Caught shutdown"); break;
+ default: fprintf(stderr, "Caught unexpected console event"); break;
}
// if we don't have a machine yet, or if we are handling ctrl+c/ctrl+break,
@@ -480,7 +508,82 @@ static BOOL WINAPI control_handler(DWORD type)
return TRUE;
}
+#else
+
+MameMainApp::MameMainApp()
+{
+}
+
+void MameMainApp::Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView)
+{
+ // Register event handlers for app lifecycle.
+}
+
+// Called when the CoreWindow object is created (or re-created).
+void MameMainApp::SetWindow(Windows::UI::Core::CoreWindow^ window)
+{
+ // Attach event handlers on the window for input, etc.
+}
+
+// Initializes scene resources, or loads a previously saved app state.
+void MameMainApp::Load(Platform::String^ entryPoint)
+{
+}
+
+void MameMainApp::Run()
+{
+ // use small output buffers on non-TTYs (i.e. pipes)
+ if (!isatty(fileno(stdout)))
+ setvbuf(stdout, (char *) nullptr, _IOFBF, 64);
+ if (!isatty(fileno(stderr)))
+ setvbuf(stderr, (char *) nullptr, _IOFBF, 64);
+
+ // parse config and cmdline options
+ m_options = std::make_unique<windows_options>();
+ m_osd = std::make_unique<windows_osd_interface>(m_options);
+
+ // Since we're a GUI app, out errors to message boxes
+ // Initialize this after the osd interface so that we are first in the
+ // output order
+ winuniversal_output_error winerror;
+ osd_output::push(&winerror);
+
+ m_osd->register_options();
+ m_frontend = std::make_unique<cli_frontend>(*m_options.get(), *m_osd.get());
+
+ // To satisfy the latter things, pass in the module path name
+ char exe_path[MAX_PATH];
+ GetModuleFileNameA(NULL, exe_path, MAX_PATH);
+ char* args[2] = { exe_path, (char*)"-verbose" };
+
+ DWORD result = m_frontend->execute(ARRAY_LENGTH(args), args);
+ osd_output::pop(&winerror);
+}
+
+// Required for IFrameworkView.
+void MameMainApp::Uninitialize()
+{
+ // Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
+ // class is torn down while the app is in the foreground.
+}
+
+IFrameworkView^ MameViewSource::CreateView()
+{
+ return ref new MameMainApp();
+}
+#endif
+
+
+//============================================================
+// windows_options
+//============================================================
+
+windows_options::windows_options()
+: osd_options()
+{
+ add_entries(s_option_entries);
+}
//============================================================
@@ -501,7 +604,6 @@ static void output_oslog(const running_machine &machine, const char *buffer)
windows_osd_interface::windows_osd_interface(windows_options &options)
: osd_common_t(options)
, m_options(options)
- , m_sliders(nullptr)
{
}
@@ -592,11 +694,13 @@ void windows_osd_interface::init(running_machine &machine)
if (options.oslog())
machine.add_logerror_callback(output_oslog);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// crank up the multimedia timer resolution to its max
// this gives the system much finer timeslices
timeresult = timeGetDevCaps(&timecaps, sizeof(timecaps));
if (timeresult == TIMERR_NOERROR)
timeBeginPeriod(timecaps.wPeriodMin);
+#endif
// if a watchdog thread is requested, create one
int watchdog = options.watchdog();
@@ -611,11 +715,13 @@ void windows_osd_interface::init(running_machine &machine)
}
// create and start the profiler
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
if (profile > 0)
{
profiler = global_alloc(sampling_profiler(1000, profile - 1));
profiler->start();
}
+#endif
// initialize sockets
win_init_sockets();
@@ -652,6 +758,7 @@ void windows_osd_interface::osd_exit()
watchdog_thread = nullptr;
}
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// stop the profiler
if (profiler != nullptr)
{
@@ -663,43 +770,12 @@ void windows_osd_interface::osd_exit()
// restore the timer resolution
if (timeresult == TIMERR_NOERROR)
timeEndPeriod(timecaps.wPeriodMin);
+#endif
// one last pass at events
winwindow_process_events(machine(), 0, 0);
}
-//============================================================
-// winmain_dump_stack
-//============================================================
-
-void winmain_dump_stack()
-{
- // set up the stack walker
- stack_walker walker;
- if (!walker.reset())
- return;
-
- // walk the stack
- while (walker.unwind())
- fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip()));
-}
-
-
-//============================================================
-// check_for_double_click_start
-//============================================================
-
-static int is_double_click_start(int argc)
-{
- STARTUPINFO startup_info = { sizeof(STARTUPINFO) };
-
- // determine our startup information
- GetStartupInfo(&startup_info);
-
- // try to determine if MAME was simply double-clicked
- return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES));
-}
-
//============================================================
// watchdog_thread_entry
@@ -751,6 +827,40 @@ void winmain_watchdog_ping(void)
}
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
+//============================================================
+// winmain_dump_stack
+//============================================================
+
+void winmain_dump_stack()
+{
+ // set up the stack walker
+ stack_walker walker;
+ if (!walker.reset())
+ return;
+
+ // walk the stack
+ while (walker.unwind())
+ fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip()));
+}
+
+
+//============================================================
+// check_for_double_click_start
+//============================================================
+
+static int is_double_click_start(int argc)
+{
+ STARTUPINFO startup_info = { sizeof(STARTUPINFO) };
+
+ // determine our startup information
+ GetStartupInfo(&startup_info);
+
+ // try to determine if MAME was simply double-clicked
+ return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES));
+}
+
//============================================================
// exception_filter
//============================================================
@@ -1559,3 +1669,5 @@ void sampling_profiler::thread_run()
Sleep(1);
}
}
+
+#endif \ No newline at end of file
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index 162c2ada1dd..f4d1a611191 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -9,6 +9,7 @@
#ifndef __WINDOWS_WINMAIN_H__
#define __WINDOWS_WINMAIN_H__
+#include <winapifamily.h>
#include "clifront.h"
#include "osdepend.h"
#include "modules/lib/osdobj_common.h"
@@ -210,8 +211,6 @@ private:
static const options_entry s_option_entries[];
};
-
-
//============================================================
// MACROS
//============================================================
@@ -263,19 +262,15 @@ public:
virtual void update(bool skip_redraw) override;
// video overridables
- virtual slider_state *get_slider_list() override;
-
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override;
virtual void video_register() override;
virtual bool video_init() override;
virtual bool window_init() override;
- virtual bool output_init() override;
virtual void video_exit() override;
virtual void window_exit() override;
- virtual void output_exit() override;
void extract_video_config();
@@ -296,12 +291,37 @@ private:
virtual void osd_exit() override;
windows_options & m_options;
- slider_state * m_sliders;
static const int DEFAULT_FONT_HEIGHT = 200;
};
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
+ref class MameMainApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
+{
+private:
+ std::unique_ptr<windows_options> m_options;
+ std::unique_ptr<windows_osd_interface> m_osd;
+ std::unique_ptr<cli_frontend> m_frontend;
+
+public:
+ MameMainApp();
+
+ // IFrameworkView Methods.
+ virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
+ virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
+ virtual void Load(Platform::String^ entryPoint);
+ virtual void Run();
+ virtual void Uninitialize();
+};
+
+ref class MameViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
+{
+public:
+ virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
+};
+#endif
//============================================================
// GLOBAL VARIABLES
diff --git a/src/osd/sdl/aueffectutil-Info.plist b/src/tools/aueffectutil-Info.plist
index e5094157c33..e5094157c33 100644
--- a/src/osd/sdl/aueffectutil-Info.plist
+++ b/src/tools/aueffectutil-Info.plist
diff --git a/src/osd/sdl/aueffectutil.mm b/src/tools/aueffectutil.mm
index 531d814e987..531d814e987 100644
--- a/src/osd/sdl/aueffectutil.mm
+++ b/src/tools/aueffectutil.mm
diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp
index 59cce01ad29..e70f1fc13ac 100644
--- a/src/tools/unidasm.cpp
+++ b/src/tools/unidasm.cpp
@@ -110,6 +110,7 @@ CPU_DISASSEMBLE( i960 );
CPU_DISASSEMBLE( ie15 );
CPU_DISASSEMBLE( jaguardsp );
CPU_DISASSEMBLE( jaguargpu );
+CPU_DISASSEMBLE( kb1013vk12 );
CPU_DISASSEMBLE( konami );
CPU_DISASSEMBLE( lh5801 );
CPU_DISASSEMBLE( lr35902 );
@@ -158,7 +159,9 @@ CPU_DISASSEMBLE( sh2 );
CPU_DISASSEMBLE( sh4 );
CPU_DISASSEMBLE( sh4be );
CPU_DISASSEMBLE( sharc );
+CPU_DISASSEMBLE( sm500 );
CPU_DISASSEMBLE( sm510 );
+CPU_DISASSEMBLE( sm511 );
CPU_DISASSEMBLE( sm8500 );
CPU_DISASSEMBLE( spc700 );
CPU_DISASSEMBLE( ssem );
@@ -264,6 +267,7 @@ static const dasm_table_entry dasm_table[] =
{ "ie15", _8bit, 0, CPU_DISASSEMBLE_NAME(ie15) },
{ "jaguardsp", _16be, 0, CPU_DISASSEMBLE_NAME(jaguardsp) },
{ "jaguargpu", _16be, 0, CPU_DISASSEMBLE_NAME(jaguargpu) },
+ { "kb1013vk12", _8bit, 0, CPU_DISASSEMBLE_NAME(kb1013vk12) },
{ "konami", _8bit, 0, CPU_DISASSEMBLE_NAME(konami) },
{ "lh5801", _8bit, 0, CPU_DISASSEMBLE_NAME(lh5801) },
{ "lr35902", _8bit, 0, CPU_DISASSEMBLE_NAME(lr35902) },
@@ -311,7 +315,9 @@ static const dasm_table_entry dasm_table[] =
{ "sh4", _16le, 0, CPU_DISASSEMBLE_NAME(sh4) },
{ "sh4be", _16be, 0, CPU_DISASSEMBLE_NAME(sh4be) },
{ "sharc", _48le, -2, CPU_DISASSEMBLE_NAME(sharc) },
+ { "sm500", _8bit, 0, CPU_DISASSEMBLE_NAME(sm500) },
{ "sm510", _8bit, 0, CPU_DISASSEMBLE_NAME(sm510) },
+ { "sm511", _8bit, 0, CPU_DISASSEMBLE_NAME(sm511) },
{ "sm8500", _8bit, 0, CPU_DISASSEMBLE_NAME(sm8500) },
{ "spc700", _8bit, 0, CPU_DISASSEMBLE_NAME(spc700) },
{ "ssem", _32le, 0, CPU_DISASSEMBLE_NAME(ssem) },