Previous 199869 Revisions Next

r34681 Thursday 22nd January, 2015 at 22:45:53 UTC by Angelo Salese
New personal branch, for WIP rewrites and other goodies.
[/trunk]makefile
[hash]gamegear.xml lantutor.xml pasogo.xml
[src]version.c
[src/build]file2str.py flags_clang.mak png.py png2bdc.py
[src/emu]clifront.c cliopts.c devfind.c devfind.h device.c device.h distate.c distate.h emu.h emu.mak emucore.c emuopts.c emuopts.h image.c image.h luaengine.c luaengine.h machine.c machine.h mame.c memory.c parameters.c parameters.h render.c render.h rendfont.c romload.c romload.h save.c save.h
[src/emu/bus]bus.mak
[src/emu/bus/a8sio]a8sio.c cassette.c
[src/emu/bus/gamegear]gear2gear.c* gear2gear.h* ggext.c ggext.h smsctrladp.c smsctrladp.h
[src/emu/bus/nes_ctrl]4score.c 4score.h arkpaddle.c arkpaddle.h bcbattle.c bcbattle.h ctrl.c ctrl.h fckeybrd.c fckeybrd.h ftrainer.c ftrainer.h hori.c hori.h joypad.c joypad.h konamihs.c konamihs.h miracle.c miracle.h mjpanel.c mjpanel.h pachinko.c pachinko.h partytap.c partytap.h powerpad.c powerpad.h suborkey.c suborkey.h zapper.c zapper.h
[src/emu/bus/sms_ctrl]graphic.c joypad.c lphaser.c multitap.c paddle.c rfu.c sports.c sportsjp.c
[src/emu/bus/vcs]dpc.c
[src/emu/bus/vcs_ctrl]joybooster.c joystick.c keypad.c lightpen.c paddles.c wheel.c
[src/emu/cpu/arcompact]arcompact.c arcompact.h arcompact_execute.c arcompact_make.py
[src/emu/cpu/h8]h8make.py
[src/emu/cpu/i386]i386dasm.c i386op16.inc pentops.inc
[src/emu/cpu/m68000]m68k_in.c m68kcpu.c m68kcpu.h m68kfpu.inc
[src/emu/cpu/m6809]m6809make.py
[src/emu/cpu/mcs96]mcs96make.py
[src/emu/cpu/mips]mips3drc.c
[src/emu/cpu/powerpc]ppccom.c ppcdrc.c
[src/emu/cpu/rsp]rspdrc.c
[src/emu/cpu/sh2]sh2drc.c
[src/emu/cpu/tms0980]tms0980.c tms0980.h
[src/emu/cpu/tms57002]tmsmake.py
[src/emu/machine]6522via.c bcreader.c bcreader.h intelfsh.c intelfsh.h jvshost.c netlist.c
[src/emu/netlist]netlist.mak nl_base.c nl_base.h nl_config.h nl_dice_compat.h nl_factory.c nl_factory.h nl_parser.c nl_parser.h nl_setup.c nl_setup.h plists.h pstate.c pstate.h pstring.c pstring.h
[src/emu/netlist/analog]nld_bjt.c nld_bjt.h nld_fourterm.c nld_fourterm.h nld_ms_direct.h nld_ms_direct1.h nld_ms_direct2.h nld_ms_gauss_seidel.h nld_opamps.c nld_solver.c nld_solver.h nld_twoterm.c nld_twoterm.h
[src/emu/netlist/devices]net_lib.c net_lib.h nld_4020.c nld_4066.c nld_74123.c nld_74ls629.c nld_cmos.h nld_ne555.c nld_ne555.h nld_r2r_dac.c nld_system.c nld_system.h
[src/emu/sound]qs1000.c rf5c400.c rf5c400.h tiasound.c
[src/emu/ui]barcode.c cheatopt.c cheatopt.h devctrl.h devopt.c devopt.h filemngr.c filemngr.h imgcntrl.c imgcntrl.h imginfo.c* imginfo.h* info.c info.h inputmap.c mainmenu.c mainmenu.h menu.c miscmenu.c miscmenu.h selgame.c sliders.c sliders.h slotopt.h tapectrl.c ui.c videoopt.c videoopt.h
[src/emu/video]315_5124.c h63484.c h63484.h
[src/lib/util]astring.h coretmpl.h palette.h
[src/mame]mame.lst mame.mak
[src/mame/audio]mario.c
[src/mame/drivers]20pacgal.c actfancr.c aerofgt.c aleck64.c aliens.c alpha68k.c bogeyman.c btime.c calomega.c circus.c cps1.c crospang.c ddenlovr.c dec0.c dec8.c deniam.c dgpix.c dkong.c dynax.c eolith.c eolith16.c eolithsp.c exidy.c exidyttl.c funkball.c fuukifg2.c fuukifg3.c galaxian.c galspnbl.c gticlub.c gts80a.c gumbo.c hcastle.c hikaru.c itech32.c itech8.c lordgun.c m58.c mappy.c metro.c midtunit.c model2.c model3.c namcos21.c naomi.c nemesis.c nl_pongd.c nmg5.c oneshot.c onetwo.c overdriv.c pacman.c paradise.c peplus.c prehisle.c psikyo.c psikyo4.c psikyosh.c psychic5.c punchout.c segae.c segajw.c seta2.c silvmil.c snk68.c snowbros.c spbactn.c spdodgeb.c spy.c st_mp200.c stadhero.c stv.c suna8.c taitottl.c tbowl.c tecmo.c toaplan1.c toaplan2.c tourtabl.c twincobr.c twinkle.c tx1.c vegaeo.c vicdual.c wardner.c yunsun16.c zn.c
[src/mame/includes]actfancr.h aerofgt.h alpha68k.h bogeyman.h calomega.h crospang.h dec0.h dec8.h deniam.h dynax.h eolith.h exidy.h fuukifg2.h fuukifg3.h galspnbl.h hcastle.h hyhoo.h itech8.h lordgun.h m58.h mario.h metro.h midtunit.h model2.h model3.h namcos21.h naomi.h nb1413m3.h nemesis.h oneshot.h pacman.h paradise.h pastelg.h prehisle.h psikyo.h psikyo4.h psikyosh.h senjyo.h snk68.h snowbros.h spbactn.h spdodgeb.h spy.h stadhero.h stfight.h stlforce.h strnskil.h stv.h suna8.h tbowl.h tecmo.h toaplan1.h toaplan2.h twincobr.h tx1.h vaportra.h xyonix.h yunsun16.h
[src/mame/layout]gts80a_caveman.lay
[src/mame/machine]315-5838_317-0229_comp.c 315-5838_317-0229_comp.h 315-5881_crypt.c 315-5881_crypt.h dec0.c decathlt.c* jvs13551.c midtunit.c mie.c naomi.c naomibd.h naomicrypt.c* naomicrypt.h* naomim1.c naomim1.h naomim2.c naomim2.h ng_memcard.h stfight.c stvprot.c
[src/mame/video]actfancr.c bogeyman.c cps1.c eolith.c gp9001.c m58.c paradise.c pastelg.c pc080sn.c taitoair.c tc0080vco.c tc0480scp.c tia.c tia.h tx1.c wgp.c
[src/mess]mess.lst mess.mak
[src/mess/drivers]a2600.c amaztron.c applix.c apricotp.c banctec.c bw12.c c65.c cat.c cnsector.c comp4.c elecdet.c excali64.c gamate.c hp16500.c hp9k_3xx.c mathmagi.c merlin.c nes.c ngen.c pasogo.c pc9801.c slicer.c sms.c splitsec.c starwbc.c stopthie.c tandy12.c tispeak.c vt100.c
[src/mess/includes]apricotp.h banctec.h mac.h nes.h sms.h
[src/mess/layout]splitsec.lay
[src/mess/machine]amstrad.c macadb.c nes.c sms.c
[src/osd]osdcore.c osdcore.h osdepend.h
[src/osd/modules]osdmodule.c osdmodule.h
[src/osd/modules/debugger]debug_module.h debugint.c debugint.h* debugosx.h debugosx.m debugqt.c debugqt.h* debugwin.c debugwin.h* none.c none.h*
[src/osd/modules/font]font_module.h font_none.c font_osx.c font_sdl.c font_windows.c
[src/osd/modules/lib]osdlib.h osdlib_macosx.c osdlib_os2.c osdlib_unix.c osdlib_win32.c osdobj_common.c osdobj_common.h
[src/osd/modules/midi]none.c portmidi.c
[src/osd/modules/sound]direct_sound.c direct_sound.h* js_sound.c js_sound.h* none.c none.h* sdl_sound.c sdl_sound.h* sound_module.h
[src/osd/modules/sync]sync_mini.c sync_ntc.c sync_os2.c sync_sdl.c sync_tc.c sync_windows.c work_osd.c
[src/osd/osdmini]minimisc.c
[src/osd/sdl]blit13.h draw13.c drawogl.c input.c main.c netdev_pcap.c netdev_pcap_osx.c osdsdl.h sdl.mak sdldir.c sdlfile.c sdlmain.c sdlmisc_os2.c* sdlmisc_unix.c* sdlmisc_win32.c* sdlos_macosx.c sdlos_os2.c sdlos_unix.c sdlos_win32.c sdlprefix.h sdlptty_unix.c strconv.c strconv.h video.c window.c window.h
[src/osd/sdl/man]castool.1 chdman.1 floptool.1 imgtool.1 jedutil.1 ldresample.1 ldverify.1 mame.6 mess.6 romcmp.1 testkeys.1
[src/osd/windows]main.c netdev_pcap.h strconv.c strconv.h vconv.c windows.mak winfile.c winmain.c winmain.h winmisc.c*
[src/tools]chdman.c nltool.c

trunk/hash/gamegear.xml
r243192r243193
650650
651651   <software name="barbie">
652652      <description>Barbie Super Model (Prototype)</description>
653      <year>1993</year>
654      <publisher>Hi Tech Expressions</publisher>
653      <year>199?</year>
654      <publisher>&lt;unknown&gt;</publisher>
655655      <part name="cart" interface="gamegear_cart">
656656         <dataarea name="rom" size="262144">
657657            <rom name="barbie super model (unknown) (proto).bin" size="262144" crc="03a0ce9e" sha1="4fabaf794081074ac1a76eb0efc4262efb627610" offset="000000" />
r243192r243193
12961296
12971297   <software name="carlicen">
12981298      <description>Car Licence (Jpn)</description>
1299      <year>1995</year>
1300      <publisher>Mitsubishi Chemical</publisher>
1299      <year>199?</year>
1300      <publisher>&lt;unknown&gt;</publisher>
13011301      <part name="cart" interface="gamegear_cart">
13021302         <dataarea name="rom" size="524288">
13031303            <rom name="car licence (japan).bin" size="524288" crc="f6a697f8" sha1="0cf691dba7080a1f8d4a181563948b188115ec89" offset="000000" />
r243192r243193
23582358      </part>
23592359   </software>
23602360
2361   <software name="ecco">
2361   <software name="ecco" supported="no">
23622362      <description>Ecco the Dolphin (Euro, USA)</description>
23632363      <year>1994</year>
23642364      <publisher>Sega</publisher>
r243192r243193
27052705
27062706   <software name="frogger">
27072707      <description>Frogger (USA, Prototype)</description>
2708      <year>1991</year>
2709      <publisher>Sega</publisher>
2708      <year>199?</year>
2709      <publisher>&lt;unknown&gt;</publisher>
27102710      <part name="cart" interface="gamegear_cart">
27112711         <dataarea name="rom" size="131072">
27122712            <rom name="frogger (usa) (proto).bin" size="131072" crc="02bbf994" sha1="b917ac6fbd3e5d18c07246f1309d81943ee1dd47" offset="000000" />
r243192r243193
34493449   <software name="jangpun2">
34503450      <description>Jang Pung II (Kor, SMS Mode)</description>
34513451      <year>1993</year>
3452      <publisher>Sieco</publisher>
3452      <publisher>&lt;unknown&gt;</publisher>
34533453      <part name="cart" interface="gamegear_cart">
34543454         <feature name="slot" value="codemasters" />
34553455         <feature name="pin_42" value="sms_mode" />
r243192r243193
46714671
46724672   <software name="mspacman">
46734673      <description>Ms. Pac-Man (USA)</description>
4674      <year>1993</year> <!-- re-released in 2000 my Majesco -->
4675      <publisher>Namco</publisher>
4674      <year>199?</year>
4675      <publisher>&lt;unknown&gt;</publisher>
46764676      <info name="serial" value="T-14048"/>
46774677      <part name="cart" interface="gamegear_cart">
46784678         <dataarea name="rom" size="131072">
r243192r243193
57775777
57785778   <software name="pacintim">
57795779      <description>Pac-In-Time (Prototype)</description>
5780      <year>1994</year>
5781      <publisher>Namco</publisher>
5780      <year>199?</year>
5781      <publisher>&lt;unknown&gt;</publisher>
57825782      <part name="cart" interface="gamegear_cart">
57835783         <dataarea name="rom" size="262144">
57845784            <rom name="pac-in-time (unknown) (proto).bin" size="262144" crc="64c28e20" sha1="bc956615da23f13bddc491377b29631f9c0a4d5a" offset="000000" />
r243192r243193
77227722
77237723   <software name="spirou">
77247724      <description>Spirou (Euro, Prototype)</description>
7725      <year>1996</year>
7726      <publisher>Infogrames</publisher>
7725      <year>199?</year>
7726      <publisher>&lt;unknown&gt;</publisher>
77277727      <part name="cart" interface="gamegear_cart">
77287728         <dataarea name="rom" size="524288">
77297729            <rom name="spirou (europe) (proto).bin" size="524288" crc="ab622adc" sha1="40359adbe9950b8e5e46158f519ad782757f0884" offset="000000" />
r243192r243193
98559855
98569856   <software name="yogibear">
98579857      <description>Yogi Bear in Yogi Bear's Goldrush (Prototype)</description>
9858      <year>1994</year>
9859      <publisher>GameTek</publisher>
9858      <year>199?</year>
9859      <publisher>&lt;unknown&gt;</publisher>
98609860      <part name="cart" interface="gamegear_cart">
98619861         <dataarea name="rom" size="262144">
98629862            <rom name="yogi bear in yogi bear's goldrush (unknown) (proto).bin" size="262144" crc="e678f264" sha1="ea5f9ce4b3618565ea24a858f7efe3988b82eb8a" offset="000000" />
r243192r243193
99729972
99739973   <software name="mgear">
99749974      <description>Master Gear Adapter</description>
9975      <year>1991</year>
9976      <publisher>Sega</publisher>
9975      <year>198?</year>
9976      <publisher>&lt;unknown&gt;</publisher>
99779977      <part name="cart" interface="gamegear_cart">
99789978         <feature name="slot" value="mgear" />
99799979         <feature name="pin_42" value="sms_mode" />
trunk/hash/lantutor.xml
r243192r243193
3838      <publisher>Texas Instruments</publisher>
3939      <part name="cart" interface="lantutor">
4040         <dataarea name="rom" size="0x10000">
41<!--            <rom name="cd2315.vsm" size="0x4000" crc="" sha1="" offset="0x0000" /> -->
42<!--            <rom name="cd2316.vsm" size="0x4000" crc="" sha1="" offset="0x4000" /> -->
41<!--         <rom name="cd2315.vsm" size="0x4000" crc="" sha1="" offset="0x0000" /> -->
42<!--         <rom name="cd2316.vsm" size="0x4000" crc="" sha1="" offset="0x4000" /> -->
4343            <rom name="cd2317.vsm" size="0x4000" crc="53231c0b" sha1="472117c3d0e28437fa8faa054f98088e06efc2a1" offset="0x8000" />
4444            <rom name="cd2318.vsm" size="0x4000" crc="6c0727bc" sha1="132e39755b122f2cbec6f3e767f5d256a9c1e7ae" offset="0xc000" />
4545         </dataarea>
trunk/hash/pasogo.xml
r243192r243193
11<?xml version="1.0"?>
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33<softwarelist name="pasogo" description="Koei PasoGo cartridges">
4
5<!--
6  Koei PasoGo (パソ碁) undumped games
7
8  Taikyoku-kun I ~ 対局くん I [KS-1001]
9  Tanoshii Tsumego Dai-1-kan ~ 楽しい詰碁・第1巻 [KS-1002]
10  Tanoshii Tsumego Dai-2-kan ~ 楽しい詰碁・第2巻 [KS-1003]
11
12-->
13
14   <!-- Contians 8M SOP44 ROM, 62256 SOP32 RAM, Microchip 1081N (reset IC?watchdog?battery-power-switcher?) and 3V battery. -->
4   <!-- KS-1010. Contians 8M SOP44 ROM, 62256 SOP32 RAM, Microchip 1081N (reset IC?watchdog?battery-power-switcher?) and 3V battery. -->
155   <software name="dgoban">
166      <description>Denshi Goban</description>
177      <year>1996</year>
188      <publisher>Koei</publisher>
19      <info name="serial" value="KS-1009"/>
20      <info name="alt_title" value="電子碁盤"/>
219      <part name="cart" interface="pasogo_cart">
2210         <dataarea name="rom" width="16" endianness="little" size="1048576">
2311            <rom name="ks-1010.ic4" size="1048576" crc="b6a3f97c" sha1="2de63b05ec93a4ba3ea55ba131c0706927a5bf39" offset="00000000" />
r243192r243193
2513      </part>
2614   </software>
2715
28
29   <!-- Contains 4M SOP40 ROM only. -->
16   <!-- KS-1004. Contains 4M SOP40 ROM only. -->
3017   <software name="igmks1">
31      <description>Igo Meikyokushuu - Dai-1-kan</description>
18      <description>Igo Meikyokushuu - Dai Ikkan</description>
3219      <year>1996</year>
3320      <publisher>Koei</publisher>
34      <info name="serial" value="KS-1004"/>
35      <info name="alt_title" value="囲碁名局集 第1巻"/>
3621      <part name="cart" interface="pasogo_cart">
3722         <dataarea name="rom" width="16" endianness="little" size="524288">
3823            <rom name="yrm0442m-184s" size="524288" crc="32f9c38a" sha1="1be82afcdf5e2d1a0e873fda4161e663d7a53a85" offset="00000000" />
r243192r243193
4025      </part>
4126   </software>
4227
43   <!-- Contains 4M SOP40 ROM only. -->
28   <!-- KS-1009. Contains 4M SOP40 ROM only. -->
4429   <software name="tnt1">
45      <description>Tsuyoku Naru Tesuji - Dai-1-kan</description>
30      <description>Tsuyoku Naru Tesuji - Dai Ikkan</description>
4631      <year>1996</year>
4732      <publisher>Koei</publisher>
48      <info name="serial" value="KS-1010"/>
49      <info name="alt_title" value="強くなる手筋・第1巻"/>
5033      <part name="cart" interface="pasogo_cart">
5134         <dataarea name="rom" width="16" endianness="little" size="524288">
5235            <rom name="ks-1009.ic4" size="524288" crc="3e70fca6" sha1="c46cdc9e01f2f5c66b2523e1d30355e51c839f27" offset="00000000" />
trunk/makefile
r243192r243193
9898ifeq ($(firstword $(filter Haiku,$(UNAME))),Haiku)
9999TARGETOS = haiku
100100endif
101ifeq ($(firstword $(filter SunOS,$(UNAME))),SunOS)
102TARGETOS = solaris
103SDL_LIBVER = sdl
104endif
105101
106102ifndef TARGETOS
107103$(error Unable to detect TARGETOS from uname -a: $(UNAME))
r243192r243193
118114ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
119115PTR64 = 1
120116endif
121ifeq ($(TARGETOS), solaris)
122ifeq ($(firstword $(filter amd64,$(shell /usr/bin/isainfo -k))),amd64)
123PTR64 = 1
124117endif
125endif
126endif
127118
128119# Autodetect BIGENDIAN
129120# MacOSX
r243192r243193
607598# warnings only applicable to C++ compiles
608599CPPONLYFLAGS += \
609600   -Woverloaded-virtual
601   
602include $(SRC)/build/cc_detection.mak
610603
611604ifdef SANITIZE
612605CCOMFLAGS += -fsanitize=$(SANITIZE)
613
614606ifneq (,$(findstring thread,$(SANITIZE)))
615607CCOMFLAGS += -fPIE
616608endif
609ifneq (,$(findstring memory,$(SANITIZE)))
610ifneq (,$(findstring clang,$(CC)))
611CCOMFLAGS += -fsanitize-memory-track-origins -fPIE
617612endif
613endif
614ifneq (,$(findstring undefined,$(SANITIZE)))
615ifneq (,$(findstring clang,$(CC)))
616# TODO: check if linker is clang++
617# produces a lot of messages - disable it for now
618CCOMFLAGS += -fno-sanitize=alignment
619# these are false positives because of the way our delegates work
620CCOMFLAGS += -fno-sanitize=function
621# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c when this isn't disabled
622CCOMFLAGS += -fno-sanitize=shift
623# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c, src/emu/cpu/m6809/hd6309.c when this isn't disabled
624CCOMFLAGS += -fno-sanitize=object-size
625# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c, src/emu/cpu/m6809/konami.c, src/emu/cpu/m6809/hd6309.c, src/emu/video/psx.c when this isn't disabled
626CCOMFLAGS += -fno-sanitize=vptr
627# clang takes forever to compile src/emu/video/psx.c when this isn't disabled
628CCOMFLAGS += -fno-sanitize=null
629# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c when this isn't disabled
630CCOMFLAGS += -fno-sanitize=signed-integer-overflow
631endif
632endif
633endif
618634
619include $(SRC)/build/cc_detection.mak
620
621635#-------------------------------------------------
622636# include paths
623637#-------------------------------------------------
trunk/src/build/file2str.py
r243192r243193
22
33from __future__ import with_statement
44
5import string
56import sys
67import os
78
trunk/src/build/flags_clang.mak
r243192r243193
99# caused by src/mame/video/jagblit.inc on older clang versions
1010CCOMFLAGS += -Wno-constant-logical-operand
1111
12ifneq (,$(findstring undefined,$(SANITIZE)))
13# TODO: check if linker is clang++
14# produces a lot of messages - disable it for now
15CCOMFLAGS += -fno-sanitize=alignment
16# these are false positives because of the way our delegates work
17CCOMFLAGS += -fno-sanitize=function
18endif
19
20ifneq (,$(findstring memory,$(SANITIZE)))
21CCOMFLAGS += -fsanitize-memory-track-origins -fPIE
22endif
23
2412# TODO: needs to use $(CC)
2513TEST_CLANG := $(shell clang --version)
2614
r243192r243193
4129CCOMFLAGS += -Wno-unknown-warning-option
4230# XCode 6.0.1 gives this when using SDL2 in /Library/Frameworks/SDL2.framework/Headers/SDL_syswm.h:150 included from src/osd/sdl/sdlinc.h
4331CCOMFLAGS += -Wno-extern-c-compat
44
45ifneq (,$(findstring undefined,$(SANITIZE)))
46# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c when this isn't disabled
47CCOMFLAGS += -fno-sanitize=shift
48# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c, src/emu/cpu/m6809/hd6309.c when this isn't disabled
49CCOMFLAGS += -fno-sanitize=object-size
50# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c, src/emu/cpu/m6809/konami.c, src/emu/cpu/m6809/hd6309.c, src/emu/video/psx.c when this isn't disabled
51CCOMFLAGS += -fno-sanitize=vptr
52# clang takes forever to compile src/emu/video/psx.c when this isn't disabled
53CCOMFLAGS += -fno-sanitize=null
54# clang takes forever to compile src/emu/cpu/tms57002/tms57002.c when this isn't disabled
55CCOMFLAGS += -fno-sanitize=signed-integer-overflow
5632endif
57endif
5833
5934ifeq ($(TARGETOS),emscripten)
6035CCOMFLAGS += -Qunused-arguments
trunk/src/build/png.py
r243192r243193
26602660
26612661    # Parse command line arguments
26622662    from optparse import OptionParser
2663    import re
26632664    version = '%prog ' + __version__
26642665    parser = OptionParser(version=version)
26652666    parser.set_usage("%prog [options] [imagefile]")
trunk/src/build/png2bdc.py
r243192r243193
121121        fp.write('o')
122122        fp.write('n')
123123        fp.write('t')
124        fp.write(chr(hash32 >> 24 & 0xff))
125        fp.write(chr(hash32 >> 16 & 0xff))
126        fp.write(chr(hash32 >> 8 & 0xff))
127        fp.write(chr(hash32 >> 0 & 0xff))
128        fp.write(chr(font.height >> 8 & 0xff))
129        fp.write(chr(font.height >> 0 & 0xff))
130        fp.write(chr(font.yOffs >> 8 & 0xff))
131        fp.write(chr(font.yOffs >> 0 & 0xff))
132        fp.write(chr(numChars >> 24 & 0xff))
133        fp.write(chr(numChars >> 16 & 0xff))
134        fp.write(chr(numChars >> 8 & 0xff))
135        fp.write(chr(numChars >> 0 & 0xff))
124        fp.write(bytearray([hash32 >> 24 & 0xff]))
125        fp.write(bytearray([hash32 >> 16 & 0xff]))
126        fp.write(bytearray([hash32 >> 8 & 0xff]))
127        fp.write(bytearray([hash32 >> 0 & 0xff]))
128        fp.write(bytearray([font.height >> 8 & 0xff]))
129        fp.write(bytearray([font.height >> 0 & 0xff]))
130        fp.write(bytearray([font.yOffs >> 8 & 0xff]))
131        fp.write(bytearray([font.yOffs >> 0 & 0xff]))
132        fp.write(bytearray([numChars >> 24 & 0xff]))
133        fp.write(bytearray([numChars >> 16 & 0xff]))
134        fp.write(bytearray([numChars >> 8 & 0xff]))
135        fp.write(bytearray([numChars >> 0 & 0xff]))
136136       
137137        # Write a blank table at first (?)
138138        charTable = [0]*(numChars * CACHED_CHAR_SIZE)
139        for i in range(numChars * CACHED_CHAR_SIZE):
140            fp.write(chr(charTable[i]))
139        fp.write(bytearray(charTable))
141140       
142141        # Loop over all characters
143142        tableIndex = 0
r243192r243193
172171                    dBuffer.append(accum)
173172               
174173                # Write the data
175                for j in range(len(dBuffer)):
176                    fp.write(chr(dBuffer[j]))
174                fp.write(bytearray(dBuffer))
177175           
178176            destIndex = tableIndex * CACHED_CHAR_SIZE
179177            charTable[destIndex +  0] = i >> 8 & 0xff
r243192r243193
192190   
193191        # Seek back to the beginning and rewrite the table
194192        fp.seek(CACHED_HEADER_SIZE, 0)
195        for i in range(numChars * CACHED_CHAR_SIZE):
196            fp.write(chr(charTable[i]))
193        fp.write(bytearray(charTable))
197194   
198195        fp.close()
199196        return 0
trunk/src/emu/bus/a8sio/a8sio.c
r243192r243193
217217SLOT_INTERFACE_START(a8sio_cards)
218218   SLOT_INTERFACE("cassette", A8SIO_CASSETTE)
219219SLOT_INTERFACE_END
220
trunk/src/emu/bus/a8sio/cassette.c
r243192r243193
115115         break;
116116   }
117117}
118
trunk/src/emu/bus/bus.mak
r243192r243193
10871087
10881088#-------------------------------------------------
10891089#
1090#@src/emu/bus/nes_ctrl/ctrl.h,BUSES += NES_CTRL
1091#-------------------------------------------------
1092
1093ifneq ($(filter NES_CTRL,$(BUSES)),)
1094OBJDIRS += $(BUSOBJ)/nes_ctrl
1095BUSOBJS += $(BUSOBJ)/nes_ctrl/ctrl.o
1096BUSOBJS += $(BUSOBJ)/nes_ctrl/joypad.o
1097BUSOBJS += $(BUSOBJ)/nes_ctrl/4score.o
1098BUSOBJS += $(BUSOBJ)/nes_ctrl/arkpaddle.o
1099BUSOBJS += $(BUSOBJ)/nes_ctrl/bcbattle.o
1100BUSOBJS += $(BUSOBJ)/nes_ctrl/ftrainer.o
1101BUSOBJS += $(BUSOBJ)/nes_ctrl/fckeybrd.o
1102BUSOBJS += $(BUSOBJ)/nes_ctrl/hori.o
1103BUSOBJS += $(BUSOBJ)/nes_ctrl/konamihs.o
1104BUSOBJS += $(BUSOBJ)/nes_ctrl/miracle.o
1105BUSOBJS += $(BUSOBJ)/nes_ctrl/mjpanel.o
1106BUSOBJS += $(BUSOBJ)/nes_ctrl/pachinko.o
1107BUSOBJS += $(BUSOBJ)/nes_ctrl/partytap.o
1108BUSOBJS += $(BUSOBJ)/nes_ctrl/powerpad.o
1109BUSOBJS += $(BUSOBJ)/nes_ctrl/suborkey.o
1110BUSOBJS += $(BUSOBJ)/nes_ctrl/zapper.o
1111endif
1112
1113#-------------------------------------------------
1114#
11151090#@src/emu/bus/snes/snes_slot.h,BUSES += SNES
11161091#-------------------------------------------------
11171092
r243192r243193
12911266
12921267#-------------------------------------------------
12931268#
1294#@src/emu/bus/gamegear/ggext.h,BUSES += GAMEGEAR
1269#@src/emu/bus/gamegear/gear2gear.h,BUSES += GAMEGEAR
12951270#-------------------------------------------------
12961271
12971272ifneq ($(filter GAMEGEAR,$(BUSES)),)
12981273OBJDIRS += $(BUSOBJ)/gamegear
1299BUSOBJS += $(BUSOBJ)/gamegear/ggext.o
1274BUSOBJS += $(BUSOBJ)/gamegear/gear2gear.o
13001275BUSOBJS += $(BUSOBJ)/gamegear/smsctrladp.o
13011276endif
13021277
trunk/src/emu/bus/gamegear/gear2gear.c
r0r243193
1/**********************************************************************
2
3    Sega Game Gear "Gear to Gear Port" emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "gear2gear.h"
11// slot devices
12#include "smsctrladp.h"
13
14
15
16//**************************************************************************
17//  GLOBAL VARIABLES
18//**************************************************************************
19
20const device_type GG_GEAR2GEAR_PORT = &device_creator<gg_gear2gear_port_device>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_gg_gear2gear_port_interface - constructor
30//-------------------------------------------------
31
32device_gg_gear2gear_port_interface::device_gg_gear2gear_port_interface(const machine_config &mconfig, device_t &device)
33   : device_slot_card_interface(mconfig,device)
34{
35   m_port = dynamic_cast<gg_gear2gear_port_device *>(device.owner());
36}
37
38
39//-------------------------------------------------
40//  ~device_gg_gear2gear_port_interface - destructor
41//-------------------------------------------------
42
43device_gg_gear2gear_port_interface::~device_gg_gear2gear_port_interface()
44{
45}
46
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  gg_gear2gear_port_device - constructor
55//-------------------------------------------------
56
57gg_gear2gear_port_device::gg_gear2gear_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58                  device_t(mconfig, GG_GEAR2GEAR_PORT, "Gear to Gear Port", tag, owner, clock, "gg_gear2gear_port", __FILE__),
59                  device_slot_interface(mconfig, *this),
60                  m_th_pin_handler(*this),
61                  m_pixel_handler(*this)
62{
63}
64
65
66//-------------------------------------------------
67//  gg_gear2gear_port_device - destructor
68//-------------------------------------------------
69
70gg_gear2gear_port_device::~gg_gear2gear_port_device()
71{
72}
73
74
75//-------------------------------------------------
76//  device_start - device-specific startup
77//-------------------------------------------------
78
79void gg_gear2gear_port_device::device_start()
80{
81   m_device = dynamic_cast<device_gg_gear2gear_port_interface *>(get_card_device());
82
83   m_th_pin_handler.resolve_safe();
84   m_pixel_handler.resolve_safe(0);
85}
86
87
88UINT8 gg_gear2gear_port_device::port_r()
89{
90   UINT8 data = 0xff;
91   if (m_device)
92      data = m_device->peripheral_r();
93   return data;
94}
95
96void gg_gear2gear_port_device::port_w( UINT8 data )
97{
98   if (m_device)
99      m_device->peripheral_w(data);
100}
101
102
103void gg_gear2gear_port_device::th_pin_w(int state)
104{
105   m_th_pin_handler(state);
106}
107
108UINT32 gg_gear2gear_port_device::pixel_r()
109{
110   return m_pixel_handler();
111}
112
113
114//-------------------------------------------------
115//  SLOT_INTERFACE( gg_gear2gear_port_devices )
116//-------------------------------------------------
117
118SLOT_INTERFACE_START( gg_gear2gear_port_devices )
119   SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR)
120SLOT_INTERFACE_END
trunk/src/emu/bus/gamegear/gear2gear.h
r0r243193
1/**********************************************************************
2
3    Sega Game Gear "Gear to Gear Port" emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9
10
11**********************************************************************/
12
13#pragma once
14
15#ifndef __GG_GEAR2GEAR_PORT__
16#define __GG_GEAR2GEAR_PORT__
17
18#include "emu.h"
19
20
21
22//**************************************************************************
23//  INTERFACE CONFIGURATION MACROS
24//**************************************************************************
25
26#define MCFG_GG_GEAR2GEAR_PORT_ADD(_tag, _slot_intf, _def_slot) \
27   MCFG_DEVICE_ADD(_tag, GG_GEAR2GEAR_PORT, 0) \
28   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
29#define MCFG_GG_GEAR2GEAR_PORT_MODIFY(_tag) \
30   MCFG_DEVICE_MODIFY(_tag)
31
32
33#define MCFG_GG_GEAR2GEAR_PORT_TH_INPUT_HANDLER(_devcb) \
34   devcb = &gg_gear2gear_port_device::set_th_input_handler(*device, DEVCB_##_devcb);
35
36
37#define MCFG_GG_GEAR2GEAR_PORT_PIXEL_HANDLER(_devcb) \
38   devcb = &gg_gear2gear_port_device::set_pixel_handler(*device, DEVCB_##_devcb);
39
40
41
42//**************************************************************************
43//  TYPE DEFINITIONS
44//**************************************************************************
45
46// ======================> gg_gear2gear_port_device
47
48class device_gg_gear2gear_port_interface;
49
50class gg_gear2gear_port_device : public device_t,
51                        public device_slot_interface
52{
53public:
54   // construction/destruction
55   gg_gear2gear_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56   virtual ~gg_gear2gear_port_device();
57
58   // static configuration helpers
59   template<class _Object> static devcb_base &set_th_input_handler(device_t &device, _Object object) { return downcast<gg_gear2gear_port_device &>(device).m_th_pin_handler.set_callback(object); }
60
61   template<class _Object> static devcb_base &set_pixel_handler(device_t &device, _Object object) { return downcast<gg_gear2gear_port_device &>(device).m_pixel_handler.set_callback(object); }
62
63   // Currently, only the support for SMS Controller Adaptor is emulated,
64   // for when SMS Compatibility mode is enabled. In that mode, the 10
65   // pins of the Gear to Gear Port follows the same numbering of a SMS
66   // Control port.
67
68   // Data returned by the port_r methods:
69   // bit 0 - pin 1 - Up
70   // bit 1 - pin 2 - Down
71   // bit 2 - pin 3 - Left
72   // bit 3 - pin 4 - Right
73   // bit 4 - pin 5 - Vcc (no data)
74   // bit 5 - pin 6 - TL (Button 1/Light Phaser Trigger)
75   // bit 6 - pin 7 - TH (Light Phaser sensor)
76   //         pin 8 - GND
77   // bit 7 - pin 9 - TR (Button 2)
78   //         pin 10 - Not connected
79   //
80   UINT8 port_r();
81   void port_w( UINT8 data );
82
83   void th_pin_w(int state);
84   UINT32 pixel_r();
85
86//protected:
87   // device-level overrides
88   virtual void device_start();
89
90   device_gg_gear2gear_port_interface *m_device;
91
92private:
93   devcb_write_line m_th_pin_handler;
94   devcb_read32 m_pixel_handler;
95};
96
97
98// ======================> device_gg_gear2gear_port_interface
99
100// class representing interface-specific live sms_expansion card
101class device_gg_gear2gear_port_interface : public device_slot_card_interface
102{
103public:
104   // construction/destruction
105   device_gg_gear2gear_port_interface(const machine_config &mconfig, device_t &device);
106   virtual ~device_gg_gear2gear_port_interface();
107
108   virtual UINT8 peripheral_r() { return 0xff; };
109   virtual void peripheral_w(UINT8 data) { };
110
111protected:
112   gg_gear2gear_port_device *m_port;
113};
114
115
116// device type definition
117extern const device_type GG_GEAR2GEAR_PORT;
118
119
120SLOT_INTERFACE_EXTERN( gg_gear2gear_port_devices );
121
122
123#endif
trunk/src/emu/bus/gamegear/ggext.c
r243192r243193
1/**********************************************************************
2
3    Sega Game Gear EXT port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "ggext.h"
11// slot devices
12#include "smsctrladp.h"
13
14
15
16//**************************************************************************
17//  GLOBAL VARIABLES
18//**************************************************************************
19
20const device_type GG_EXT_PORT = &device_creator<gg_ext_port_device>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_gg_ext_port_interface - constructor
30//-------------------------------------------------
31
32device_gg_ext_port_interface::device_gg_ext_port_interface(const machine_config &mconfig, device_t &device)
33   : device_slot_card_interface(mconfig,device)
34{
35   m_port = dynamic_cast<gg_ext_port_device *>(device.owner());
36}
37
38
39//-------------------------------------------------
40//  ~device_gg_ext_port_interface - destructor
41//-------------------------------------------------
42
43device_gg_ext_port_interface::~device_gg_ext_port_interface()
44{
45}
46
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  gg_ext_port_device - constructor
55//-------------------------------------------------
56
57gg_ext_port_device::gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58                  device_t(mconfig, GG_EXT_PORT, "EXT Port", tag, owner, clock, "gg_ext_port", __FILE__),
59                  device_slot_interface(mconfig, *this),
60                  m_th_pin_handler(*this),
61                  m_pixel_handler(*this)
62{
63}
64
65
66//-------------------------------------------------
67//  gg_ext_port_device - destructor
68//-------------------------------------------------
69
70gg_ext_port_device::~gg_ext_port_device()
71{
72}
73
74
75//-------------------------------------------------
76//  device_start - device-specific startup
77//-------------------------------------------------
78
79void gg_ext_port_device::device_start()
80{
81   m_device = dynamic_cast<device_gg_ext_port_interface *>(get_card_device());
82
83   m_th_pin_handler.resolve_safe();
84   m_pixel_handler.resolve_safe(0);
85}
86
87
88UINT8 gg_ext_port_device::port_r()
89{
90   UINT8 data = 0xff;
91   if (m_device)
92      data = m_device->peripheral_r();
93   return data;
94}
95
96void gg_ext_port_device::port_w( UINT8 data )
97{
98   if (m_device)
99      m_device->peripheral_w(data);
100}
101
102
103void gg_ext_port_device::th_pin_w(int state)
104{
105   m_th_pin_handler(state);
106}
107
108UINT32 gg_ext_port_device::pixel_r()
109{
110   return m_pixel_handler();
111}
112
113
114//-------------------------------------------------
115//  SLOT_INTERFACE( gg_ext_port_devices )
116//-------------------------------------------------
117
118SLOT_INTERFACE_START( gg_ext_port_devices )
119   SLOT_INTERFACE("smsctrladp", SMS_CTRL_ADAPTOR)
120SLOT_INTERFACE_END
trunk/src/emu/bus/gamegear/ggext.h
r243192r243193
1/**********************************************************************
2
3    Sega Game Gear EXT port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9
10
11**********************************************************************/
12
13#pragma once
14
15#ifndef __GG_EXT_PORT__
16#define __GG_EXT_PORT__
17
18#include "emu.h"
19
20
21
22//**************************************************************************
23//  INTERFACE CONFIGURATION MACROS
24//**************************************************************************
25
26#define MCFG_GG_EXT_PORT_ADD(_tag, _slot_intf, _def_slot) \
27   MCFG_DEVICE_ADD(_tag, GG_EXT_PORT, 0) \
28   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
29#define MCFG_GG_EXT_PORT_MODIFY(_tag) \
30   MCFG_DEVICE_MODIFY(_tag)
31
32
33#define MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(_devcb) \
34   devcb = &gg_ext_port_device::set_th_input_handler(*device, DEVCB_##_devcb);
35
36
37#define MCFG_GG_EXT_PORT_PIXEL_HANDLER(_devcb) \
38   devcb = &gg_ext_port_device::set_pixel_handler(*device, DEVCB_##_devcb);
39
40
41
42//**************************************************************************
43//  TYPE DEFINITIONS
44//**************************************************************************
45
46// ======================> gg_ext_port_device
47
48class device_gg_ext_port_interface;
49
50class gg_ext_port_device : public device_t,
51                        public device_slot_interface
52{
53public:
54   // construction/destruction
55   gg_ext_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56   virtual ~gg_ext_port_device();
57
58   // static configuration helpers
59   template<class _Object> static devcb_base &set_th_input_handler(device_t &device, _Object object) { return downcast<gg_ext_port_device &>(device).m_th_pin_handler.set_callback(object); }
60
61   template<class _Object> static devcb_base &set_pixel_handler(device_t &device, _Object object) { return downcast<gg_ext_port_device &>(device).m_pixel_handler.set_callback(object); }
62
63   // Currently, only the support for SMS Controller Adaptor is emulated,
64   // for when SMS Compatibility mode is enabled. In that mode, the 10 pins
65   // of the EXT port follows the same numbering of a SMS Control port.
66
67   // Data returned by the port_r methods:
68   // bit 0 - pin 1 - Up
69   // bit 1 - pin 2 - Down
70   // bit 2 - pin 3 - Left
71   // bit 3 - pin 4 - Right
72   // bit 4 - pin 5 - Vcc (no data)
73   // bit 5 - pin 6 - TL (Button 1/Light Phaser Trigger)
74   // bit 6 - pin 7 - TH (Light Phaser sensor)
75   //         pin 8 - GND
76   // bit 7 - pin 9 - TR (Button 2)
77   //         pin 10 - Not connected
78   //
79   UINT8 port_r();
80   void port_w( UINT8 data );
81
82   void th_pin_w(int state);
83   UINT32 pixel_r();
84
85//protected:
86   // device-level overrides
87   virtual void device_start();
88
89   device_gg_ext_port_interface *m_device;
90
91private:
92   devcb_write_line m_th_pin_handler;
93   devcb_read32 m_pixel_handler;
94};
95
96
97// ======================> device_gg_ext_port_interface
98
99// class representing interface-specific live sms_expansion card
100class device_gg_ext_port_interface : public device_slot_card_interface
101{
102public:
103   // construction/destruction
104   device_gg_ext_port_interface(const machine_config &mconfig, device_t &device);
105   virtual ~device_gg_ext_port_interface();
106
107   virtual UINT8 peripheral_r() { return 0xff; };
108   virtual void peripheral_w(UINT8 data) { };
109
110protected:
111   gg_ext_port_device *m_port;
112};
113
114
115// device type definition
116extern const device_type GG_EXT_PORT;
117
118
119SLOT_INTERFACE_EXTERN( gg_ext_port_devices );
120
121
122#endif
trunk/src/emu/bus/gamegear/smsctrladp.c
r243192r243193
11/**********************************************************************
22
3    Sega Game Gear "SMS Controller Adaptor" emulation
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243192r243193
2929
3030sms_ctrl_adaptor_device::sms_ctrl_adaptor_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
3131   device_t(mconfig, SMS_CTRL_ADAPTOR, "SMS Controller Adaptor", tag, owner, clock, "sms_ctrl_adaptor", __FILE__),
32   device_gg_ext_port_interface(mconfig, *this),
32   device_gg_gear2gear_port_interface(mconfig, *this),
3333   m_subctrl_port(*this, "ctrl")
3434{
3535}
trunk/src/emu/bus/gamegear/smsctrladp.h
r243192r243193
11/**********************************************************************
22
3    Sega Game Gear "SMS Controller Adaptor" emulation
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243192r243193
1515
1616
1717#include "emu.h"
18#include "ggext.h"
18#include "gear2gear.h"
1919#include "../sms_ctrl/smsctrl.h"
2020
2121
r243192r243193
2727// ======================> sms_ctrl_adaptor_device
2828
2929class sms_ctrl_adaptor_device : public device_t,
30                     public device_gg_ext_port_interface
30                     public device_gg_gear2gear_port_interface
3131{
3232public:
3333   // construction/destruction
r243192r243193
4141   virtual void device_start();
4242   virtual machine_config_constructor device_mconfig_additions() const;
4343
44   // device_gg_ext_port_interface overrides
44   // device_gg_gear2gear_port_interface overrides
4545   virtual UINT8 peripheral_r();
4646   virtual void peripheral_w(UINT8 data);
4747
trunk/src/emu/bus/sms_ctrl/graphic.c
r243192r243193
7777//-------------------------------------------------
7878
7979sms_graphic_device::sms_graphic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
80   : device_t(mconfig, SMS_GRAPHIC, "Sega SMS Graphic Board", tag, owner, clock, "sms_graphic", __FILE__)
80   : device_t(mconfig, SMS_GRAPHIC, "Graphic Board", tag, owner, clock, "sms_graphic", __FILE__)
8181   , device_sms_control_port_interface(mconfig, *this)
8282   , m_buttons(*this, "BUTTONS")
8383   , m_x(*this, "X")
trunk/src/emu/bus/sms_ctrl/joypad.c
r243192r243193
2020
2121static INPUT_PORTS_START( sms_joypad )
2222   PORT_START("JOYPAD")
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
2727   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )   // Vcc
2828   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )  // TL
2929   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   // TH
r243192r243193
5151//-------------------------------------------------
5252
5353sms_joypad_device::sms_joypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54   device_t(mconfig, SMS_JOYPAD, "Sega SMS Control Pad", tag, owner, clock, "sms_joypad", __FILE__),
54   device_t(mconfig, SMS_JOYPAD, "Control Pad", tag, owner, clock, "sms_joypad", __FILE__),
5555   device_sms_control_port_interface(mconfig, *this),
5656   m_joypad(*this, "JOYPAD")
5757{
trunk/src/emu/bus/sms_ctrl/lphaser.c
r243192r243193
7070//-------------------------------------------------
7171
7272sms_light_phaser_device::sms_light_phaser_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
73   device_t(mconfig, SMS_LIGHT_PHASER, "Sega SMS Light Phaser", tag, owner, clock, "sms_light_phaser", __FILE__),
73   device_t(mconfig, SMS_LIGHT_PHASER, "Light Phaser", tag, owner, clock, "sms_light_phaser", __FILE__),
7474   device_video_interface(mconfig, *this),
7575   device_sms_control_port_interface(mconfig, *this),
7676   m_lphaser_pins(*this, "CTRL_PORT"),
trunk/src/emu/bus/sms_ctrl/multitap.c
r243192r243193
2929//-------------------------------------------------
3030
3131sms_multitap_device::sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
32   device_t(mconfig, SMS_MULTITAP, "Sega SMS Multitap", tag, owner, clock, "sms_multitap", __FILE__),
32   device_t(mconfig, SMS_MULTITAP, "Multitap", tag, owner, clock, "sms_multitap", __FILE__),
3333   device_sms_control_port_interface(mconfig, *this),
3434   m_subctrl1_port(*this, "ctrl1"),
3535   m_subctrl2_port(*this, "ctrl2"),
trunk/src/emu/bus/sms_ctrl/paddle.c
r243192r243193
7373//-------------------------------------------------
7474
7575sms_paddle_device::sms_paddle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
76   device_t(mconfig, SMS_PADDLE, "Sega SMS Paddle", tag, owner, clock, "sms_paddle", __FILE__),
76   device_t(mconfig, SMS_PADDLE, "Paddle", tag, owner, clock, "sms_paddle", __FILE__),
7777   device_sms_control_port_interface(mconfig, *this),
7878   m_paddle_pins(*this, "CTRL_PORT"),
7979   m_paddle_x(*this, "PADDLE_X"),
trunk/src/emu/bus/sms_ctrl/rfu.c
r243192r243193
5151//-------------------------------------------------
5252
5353sms_rapid_fire_device::sms_rapid_fire_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54   device_t(mconfig, SMS_RAPID_FIRE, "Sega SMS Rapid Fire", tag, owner, clock, "sms_rapid_fire", __FILE__),
54   device_t(mconfig, SMS_RAPID_FIRE, "Rapid Fire", tag, owner, clock, "sms_rapid_fire", __FILE__),
5555   device_sms_control_port_interface(mconfig, *this),
5656   m_rfire_sw(*this, "rfu_sw"),
5757   m_subctrl_port(*this, "ctrl"),
trunk/src/emu/bus/sms_ctrl/sports.c
r243192r243193
112112//-------------------------------------------------
113113
114114sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
115   device_t(mconfig, SMS_SPORTS_PAD, "Sega SMS Sports Pad US", tag, owner, clock, "sms_sports_pad", __FILE__),
115   device_t(mconfig, SMS_SPORTS_PAD, "Sports Pad US", tag, owner, clock, "sms_sports_pad", __FILE__),
116116   device_sms_control_port_interface(mconfig, *this),
117117   m_sports_in(*this, "SPORTS_IN"),
118118   m_sports_out(*this, "SPORTS_OUT"),
trunk/src/emu/bus/sms_ctrl/sportsjp.c
r243192r243193
8787//-------------------------------------------------
8888
8989sms_sports_pad_jp_device::sms_sports_pad_jp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
90   device_t(mconfig, SMS_SPORTS_PAD_JP, "Sega SMS Sports Pad JP", tag, owner, clock, "sms_sports_pad_jp", __FILE__),
90   device_t(mconfig, SMS_SPORTS_PAD_JP, "Sports Pad JP", tag, owner, clock, "sms_sports_pad_jp", __FILE__),
9191   device_sms_control_port_interface(mconfig, *this),
9292   m_sports_jp_in(*this, "SPORTS_JP_IN"),
9393   m_sports_jp_x(*this, "SPORTS_JP_X"),
trunk/src/emu/bus/vcs/dpc.c
r243192r243193
3737      save_item(NAME(m_df[i].music_mode), i);
3838      save_item(NAME(m_df[i].osc_clk), i);
3939   }
40
40   
4141   save_item(NAME(m_movamt));
4242   save_item(NAME(m_latch_62));
4343   save_item(NAME(m_latch_64));
trunk/src/emu/bus/vcs_ctrl/joybooster.c
r243192r243193
5858//-------------------------------------------------
5959
6060vcs_joystick_booster_device::vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
61   device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Atari / CBM Digital joystick with Boostergrip", tag, owner, clock, "vcs_joystick_booster", __FILE__),
61   device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Digital joystick with Boostergrip", tag, owner, clock, "vcs_joystick_booster", __FILE__),
6262   device_vcs_control_port_interface(mconfig, *this),
6363   m_joy(*this, "JOY"),
6464   m_potx(*this, "POTX"),
trunk/src/emu/bus/vcs_ctrl/joystick.c
r243192r243193
5151//-------------------------------------------------
5252
5353vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54   device_t(mconfig, VCS_JOYSTICK, "Atari / CBM Digital joystick", tag, owner, clock, "vcs_joystick", __FILE__),
54   device_t(mconfig, VCS_JOYSTICK, "Digital joystick", tag, owner, clock, "vcs_joystick", __FILE__),
5555   device_vcs_control_port_interface(mconfig, *this),
5656   m_joy(*this, "JOY")
5757{
trunk/src/emu/bus/vcs_ctrl/keypad.c
r243192r243193
5555//-------------------------------------------------
5656
5757vcs_keypad_device::vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58   device_t(mconfig, VCS_KEYPAD, "Atari / CBM Keypad", tag, owner, clock, "vcs_keypad", __FILE__),
58   device_t(mconfig, VCS_KEYPAD, "Keypad", tag, owner, clock, "vcs_keypad", __FILE__),
5959   device_vcs_control_port_interface(mconfig, *this),
6060   m_keypad(*this, "KEYPAD")
6161{
trunk/src/emu/bus/vcs_ctrl/lightpen.c
r243192r243193
6060//-------------------------------------------------
6161
6262vcs_lightpen_device::vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
63   device_t(mconfig, VCS_LIGHTPEN, "Atari / CBM Light Pen", tag, owner, clock, "vcs_lightpen", __FILE__),
63   device_t(mconfig, VCS_LIGHTPEN, "Light Pen", tag, owner, clock, "vcs_lightpen", __FILE__),
6464   device_vcs_control_port_interface(mconfig, *this),
6565   m_joy(*this, "JOY"),
6666   m_lightx(*this, "LIGHTX"),
trunk/src/emu/bus/vcs_ctrl/paddles.c
r243192r243193
5454//-------------------------------------------------
5555
5656vcs_paddles_device::vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
57   device_t(mconfig, VCS_PADDLES, "Atari / CBM Digital paddles", tag, owner, clock, "vcs_paddles", __FILE__),
57   device_t(mconfig, VCS_PADDLES, "Digital paddles", tag, owner, clock, "vcs_paddles", __FILE__),
5858   device_vcs_control_port_interface(mconfig, *this),
5959   m_joy(*this, "JOY"),
6060   m_potx(*this, "POTX"),
trunk/src/emu/bus/vcs_ctrl/wheel.c
r243192r243193
4848//-------------------------------------------------
4949
5050vcs_wheel_device::vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
51   device_t(mconfig, VCS_WHEEL, "Atari / CBM Driving Wheel", tag, owner, clock, "vcs_wheel", __FILE__),
51   device_t(mconfig, VCS_WHEEL, "Driving Wheel", tag, owner, clock, "vcs_wheel", __FILE__),
5252   device_vcs_control_port_interface(mconfig, *this),
5353   m_joy(*this, "JOY"),
5454   m_wheel(*this, "WHEEL")
trunk/src/emu/clifront.c
r243192r243193
3636class media_identifier
3737{
3838public:
39   // construction/destruction
40   media_identifier(cli_options &options);
39    // construction/destruction
40    media_identifier(cli_options &options);
4141
42   // getters
43   int total() const { return m_total; }
44   int matches() const { return m_matches; }
45   int nonroms() const { return m_nonroms; }
42    // getters
43    int total() const { return m_total; }
44    int matches() const { return m_matches; }
45    int nonroms() const { return m_nonroms; }
4646
47   // operations
48   void reset() { m_total = m_matches = m_nonroms = 0; }
49   void identify(const char *name);
50   void identify_file(const char *name);
51   void identify_data(const char *name, const UINT8 *data, int length);
52   int find_by_hash(const hash_collection &hashes, int length);
47    // operations
48    void reset() { m_total = m_matches = m_nonroms = 0; }
49    void identify(const char *name);
50    void identify_file(const char *name);
51    void identify_data(const char *name, const UINT8 *data, int length);
52    int find_by_hash(const hash_collection &hashes, int length);
5353
5454private:
55   // internal state
56   driver_enumerator   m_drivlist;
57   int                 m_total;
58   int                 m_matches;
59   int                 m_nonroms;
55    // internal state
56    driver_enumerator   m_drivlist;
57    int                 m_total;
58    int                 m_matches;
59    int                 m_nonroms;
6060};
6161
6262
r243192r243193
16191619      }
16201620
16211621   if (!m_osd.execute_command(m_options.command()))
1622      // if we get here, we don't know what has been requested
1623      throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command());
1622        // if we get here, we don't know what has been requested
1623        throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command());
16241624}
16251625
16261626
trunk/src/emu/cliopts.c
r243192r243193
6060cli_options::cli_options()
6161: emu_options()
6262{
63   add_entries(cli_options::s_option_entries);
63    add_entries(cli_options::s_option_entries);
6464}
65
trunk/src/emu/cpu/arcompact/arcompact.c
r243192r243193
5151arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5252   : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__)
5353   , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) // some docs describe these as 'middle endian'?!
54   , m_io_config( "io", ENDIANNESS_LITTLE, 32, AUX_SPACE_ADDRESS_WIDTH, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) )
54   , m_io_config( "io", ENDIANNESS_LITTLE, 32, AUX_SPACE_ADDRESS_WIDTH, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) )
5555{
5656}
5757
trunk/src/emu/cpu/arcompact/arcompact.h
r243192r243193
6060public:
6161   // construction/destruction
6262   arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
63
63   
6464   DECLARE_READ32_MEMBER( arcompact_auxreg002_LPSTART_r);
6565   DECLARE_WRITE32_MEMBER(arcompact_auxreg002_LPSTART_w);
6666   DECLARE_READ32_MEMBER( arcompact_auxreg003_LPEND_r);
6767   DECLARE_WRITE32_MEMBER(arcompact_auxreg003_LPEND_w);
68
68   
6969   DECLARE_READ32_MEMBER( arcompact_auxreg00a_STATUS32_r);
7070   DECLARE_READ32_MEMBER( arcompact_auxreg025_INTVECTORBASE_r);
7171   DECLARE_WRITE32_MEMBER( arcompact_auxreg025_INTVECTORBASE_w);
7272
73
73   
7474protected:
7575   // device-level overrides
7676   virtual void device_start();
r243192r243193
184184   ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32);
185185   ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32);
186186//  ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32);
187//  ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
187//   ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
188188   ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32);
189189   ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32);
190190   ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32);
191191   ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32);
192//  ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
192//   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
193193//  ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
194194   ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32);
195195   ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32);
196196//  ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32);
197//  ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32);
197//   ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32);
198198   ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32);
199199   ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32);
200200   ARCOMPACT_RETTYPE arcompact_handle04_2f_06(OPS_32);
r243192r243193
770770   ARCOMPACT_RETTYPE arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format);
771771   ARCOMPACT_RETTYPE arcompact_handle1e_0x_helper(OPS_16, const char* optext);
772772   ARCOMPACT_RETTYPE arcompact_handle1e_03_0x_helper(OPS_16, const char* optext);
773   
773774
774
775775   UINT32 handle_jump_to_addr(int delay, int link, UINT32 address, UINT32 next_addr);
776776   UINT32 handle_jump_to_register(int delay, int link, UINT32 reg, UINT32 next_addr, int flag);
777777
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r243192r243193
21422142         size = 8;
21432143      }
21442144
2145   //  c = limm;
2145   //   c = limm;
21462146
21472147   }
21482148   else
r243192r243193
21512151      // Jcc [c]         0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ
21522152      // no conditional links to ILINK1, ILINK2?
21532153
2154   //  c = m_regs[creg];
2154   //   c = m_regs[creg];
21552155   }
21562156
21572157   if (!check_condition(condition))
trunk/src/emu/cpu/arcompact/arcompact_make.py
r243192r243193
11#!/usr/bin/python
22
33import sys
4import re
45
56def EmitGroup04_Handle_NZ_Flags(f, funcname, opname):
67        print >>f, "      if (result & 0x80000000) { STATUS32_SET_N; }"
r243192r243193
352353try:
353354    f = open(sys.argv[1], "w")
354355except Exception, err:
355    sys.stderr.write("cannot write file %s [%s]\n" % (sys.argv[1], err))
356    logging.error("cannot write file %s [%s]", fname, err)
356357    sys.exit(1)
357358
358359
trunk/src/emu/cpu/h8/h8make.py
r243192r243193
139139        for i in range(0, extra_words):
140140            self.source.append("\tfetch(%d);\n" % (i+base_offset));
141141
142    def description(self):
142    def description():
143143        return "%s %s %s" % (self.name, self.am1, self.am2)
144144   
145145    def add_source_line(self, line):
r243192r243193
451451    try:
452452        f = open(argv[3], "w")
453453    except Exception, err:
454        sys.stderr.write("cannot write file %s [%s]\n" % (argv[3], err))
454        logging.error("cannot write file %s [%s]", fname, err)
455455        sys.exit(1)
456456
457457    opcodes.build_dispatch()
trunk/src/emu/cpu/i386/i386dasm.c
r243192r243193
9898#define ALWAYS64            0x400
9999#define SPECIAL64           0x800
100100#define SPECIAL64_ENT(x)    (SPECIAL64 | ((x) << 24))
101#define GROUP_MOD           0x1000
102101
103102struct I386_OPCODE {
104103   const char *mnemonic;
r243192r243193
426425      "movupd\0"
427426      "movsd\0"
428427      "movss",            MODRM|VAR_NAME4,PARAM_XMMM,         PARAM_XMM,          0               },
429   {"group0F12",      GROUP|GROUP_MOD, 0,                  0,                  0                   },
430428   {"movlps\0"
431429      "movlpd\0"
430      "movddup\0"
431      "movsldup",     MODRM|VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
432   {"movlps\0"
433      "movlpd\0"
432434      "???\0"
433435      "???",              MODRM|VAR_NAME4,PARAM_XMMM,         PARAM_XMM,          0               },
434436   {"unpcklps\0"
r243192r243193
439441      "unpckhpd\0"
440442      "???\0"
441443      "???",              MODRM|VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
442   { "group0F16",     GROUP|GROUP_MOD, 0,                  0,                  0                   },
443444   {"movhps\0"
444445      "movhpd\0"
445446      "???\0"
446      "???",              MODRM|VAR_NAME4,PARAM_XMMM,          PARAM_XMM,         0               },
447      "movshdup",     MODRM|VAR_NAME4,PARAM_XMMM,         PARAM_XMM,          0               },
448   {"movhps\0"
449      "movhpd\0"
450      "???\0"
451      "???",              MODRM|VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
447452   {"group0F18",       GROUP,          0,                  0,                  0               },
448453   {"nop_hint",        0,              PARAM_RMPTR8,               0,                  0               },
449454   {"nop_hint",        0,              PARAM_RMPTR8,               0,                  0               },
r243192r243193
18051810   {"???",             0,              0,                  0,                  0               }
18061811};
18071812
1808static const I386_OPCODE group0F12_table[4] =
1809{
1810   { "movlps\0"
1811      "movlpd\0"
1812      "movddup\0"
1813      "movsldup",     VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
1814   { "movlps\0"
1815      "movlpd\0"
1816      "movddup\0"
1817      "movsldup",     VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
1818   { "movlps\0"
1819      "movlpd\0"
1820      "movddup\0"
1821      "movsldup",     VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
1822   { "movhlps\0"
1823      "???\0"
1824      "movddup\0"
1825      "movsldup",     VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               }
1826};
1827
1828static const I386_OPCODE group0F16_table[4] =
1829{
1830   { "movhps\0"
1831      "movhpd\0"
1832      "???\0"
1833      "movshdup",     VAR_NAME4,PARAM_XMM,         PARAM_XMMM,          0               },
1834   { "movhps\0"
1835      "movhpd\0"
1836      "???\0"
1837      "movshdup",     VAR_NAME4,PARAM_XMM,         PARAM_XMMM,          0               },
1838   { "movhps\0"
1839      "movhpd\0"
1840      "???\0"
1841      "movshdup",     VAR_NAME4,PARAM_XMM,         PARAM_XMMM,          0               },
1842   { "movlhps\0"
1843      "movhpd\0"
1844      "???\0"
1845      "movshdup",     VAR_NAME4,PARAM_XMM,         PARAM_XMMM,          0               }
1846};
1847
18481813static const I386_OPCODE group0F18_table[8] =
18491814{
18501815   {"prefetchnta",     0,              PARAM_RM8,          0,                  0               },
r243192r243193
19511916   { "group0F00",          group0F00_table         },
19521917   { "group0F01",          group0F01_table         },
19531918   { "group0F0D",          group0F0D_table         },
1954   { "group0F12",          group0F12_table         },
1955   { "group0F16",          group0F16_table         },
19561919   { "group0F18",          group0F18_table         },
19571920   { "group0F71",          group0F71_table         },
19581921   { "group0F72",          group0F72_table         },
r243192r243193
19911954
19921955#define MODRM_REG1  ((modrm >> 3) & 0x7)
19931956#define MODRM_REG2  (modrm & 0x7)
1994#define MODRM_MOD   ((modrm >> 6) & 0x3)
19951957
19961958INLINE UINT8 FETCH(void)
19971959{
r243192r243193
29972959         handle_modrm( modrm_string );
29982960         for( i=0; i < ARRAY_LENGTH(group_op_table); i++ ) {
29992961            if( strcmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) {
3000               if (op->flags & GROUP_MOD)
3001                  decode_opcode( s, &group_op_table[i].opcode[MODRM_MOD], op1 );
3002               else
3003                  decode_opcode( s, &group_op_table[i].opcode[MODRM_REG1], op1 );
2962               decode_opcode( s, &group_op_table[i].opcode[MODRM_REG1], op1 );
30042963               return;
30052964            }
30062965         }
trunk/src/emu/cpu/i386/i386op16.inc
r243192r243193
33303330               ea = GetEA(modrm,1);
33313331            }
33323332            WRITE16(ea, m_gdtr.limit);
3333            WRITE32(ea + 2, m_gdtr.base);
3333            WRITE32(ea + 2, m_gdtr.base & 0xffffff);
33343334            CYCLES(CYCLES_SGDT);
33353335            break;
33363336         }
r243192r243193
33463346               ea = GetEA(modrm,1);
33473347            }
33483348            WRITE16(ea, m_idtr.limit);
3349            WRITE32(ea + 2, m_idtr.base);
3349            WRITE32(ea + 2, m_idtr.base & 0xffffff);
33503350            CYCLES(CYCLES_SIDT);
33513351            break;
33523352         }
trunk/src/emu/cpu/i386/pentops.inc
r243192r243193
22492249   MMXPROLOG();
22502250   UINT8 modrm = FETCH();
22512251   if( modrm >= 0xc0 ) {
2252      MMX_REG ds, sd;
22532252      int s,d;
22542253      s=modrm & 0x7;
22552254      d=(modrm >> 3) & 0x7;
2256      ds.q = MMX(d).q;
2257      sd.q = MMX(s).q;
2258      MMX(d).b[0]=SaturatedSignedWordToUnsignedByte(ds.s[0]);
2259      MMX(d).b[1]=SaturatedSignedWordToUnsignedByte(ds.s[1]);
2260      MMX(d).b[2]=SaturatedSignedWordToUnsignedByte(ds.s[2]);
2261      MMX(d).b[3]=SaturatedSignedWordToUnsignedByte(ds.s[3]);
2262      MMX(d).b[4]=SaturatedSignedWordToUnsignedByte(sd.s[0]);
2263      MMX(d).b[5]=SaturatedSignedWordToUnsignedByte(sd.s[1]);
2264      MMX(d).b[6]=SaturatedSignedWordToUnsignedByte(sd.s[2]);
2265      MMX(d).b[7]=SaturatedSignedWordToUnsignedByte(sd.s[3]);
2255      MMX(d).b[0]=SaturatedSignedWordToUnsignedByte(MMX(d).s[0]);
2256      MMX(d).b[1]=SaturatedSignedWordToUnsignedByte(MMX(d).s[1]);
2257      MMX(d).b[2]=SaturatedSignedWordToUnsignedByte(MMX(d).s[2]);
2258      MMX(d).b[3]=SaturatedSignedWordToUnsignedByte(MMX(d).s[3]);
2259      MMX(d).b[4]=SaturatedSignedWordToUnsignedByte(MMX(s).s[0]);
2260      MMX(d).b[5]=SaturatedSignedWordToUnsignedByte(MMX(s).s[1]);
2261      MMX(d).b[6]=SaturatedSignedWordToUnsignedByte(MMX(s).s[2]);
2262      MMX(d).b[7]=SaturatedSignedWordToUnsignedByte(MMX(s).s[3]);
22662263   } else {
2267      MMX_REG s,t;
2264      MMX_REG s;
22682265      int d=(modrm >> 3) & 0x7;
22692266      UINT32 ea = GetEA(modrm, 0);
22702267      READMMX(ea, s);
2271      t.q = MMX(d).q;
2272      MMX(d).b[0]=SaturatedSignedWordToUnsignedByte(t.s[0]);
2273      MMX(d).b[1]=SaturatedSignedWordToUnsignedByte(t.s[1]);
2274      MMX(d).b[2]=SaturatedSignedWordToUnsignedByte(t.s[2]);
2275      MMX(d).b[3]=SaturatedSignedWordToUnsignedByte(t.s[3]);
2268      MMX(d).b[0]=SaturatedSignedWordToUnsignedByte(MMX(d).s[0]);
2269      MMX(d).b[1]=SaturatedSignedWordToUnsignedByte(MMX(d).s[1]);
2270      MMX(d).b[2]=SaturatedSignedWordToUnsignedByte(MMX(d).s[2]);
2271      MMX(d).b[3]=SaturatedSignedWordToUnsignedByte(MMX(d).s[3]);
22762272      MMX(d).b[4]=SaturatedSignedWordToUnsignedByte(s.s[0]);
22772273      MMX(d).b[5]=SaturatedSignedWordToUnsignedByte(s.s[1]);
22782274      MMX(d).b[6]=SaturatedSignedWordToUnsignedByte(s.s[2]);
r243192r243193
23662362   UINT8 modrm = FETCH();
23672363   if( modrm >= 0xc0 ) {
23682364      int s,d;
2369      INT32 t1, t2, t3, t4;
23702365      s=modrm & 0x7;
23712366      d=(modrm >> 3) & 0x7;
2372      t1 = MMX(d).i[0];
2373      t2 = MMX(d).i[1];
2374      t3 = MMX(s).i[0];
2375      t4 = MMX(s).i[1];
2376      MMX(d).s[0] = SaturatedSignedDwordToSignedWord(t1);
2377      MMX(d).s[1] = SaturatedSignedDwordToSignedWord(t2);
2378      MMX(d).s[2] = SaturatedSignedDwordToSignedWord(t3);
2379      MMX(d).s[3] = SaturatedSignedDwordToSignedWord(t4);
2380   }
2381   else {
2367      MMX(d).s[0]=SaturatedSignedDwordToSignedWord(MMX(d).i[0]);
2368      MMX(d).s[1]=SaturatedSignedDwordToSignedWord(MMX(d).i[1]);
2369      MMX(d).s[2]=SaturatedSignedDwordToSignedWord(MMX(s).i[0]);
2370      MMX(d).s[3]=SaturatedSignedDwordToSignedWord(MMX(s).i[1]);
2371   } else {
23822372      MMX_REG s;
2383      INT32 t1, t2;
23842373      int d=(modrm >> 3) & 0x7;
23852374      UINT32 ea = GetEA(modrm, 0);
23862375      READMMX(ea, s);
2387      t1 = MMX(d).i[0];
2388      t2 = MMX(d).i[1];
2389      MMX(d).s[0] = SaturatedSignedDwordToSignedWord(t1);
2390      MMX(d).s[1] = SaturatedSignedDwordToSignedWord(t2);
2391      MMX(d).s[2] = SaturatedSignedDwordToSignedWord(s.i[0]);
2392      MMX(d).s[3] = SaturatedSignedDwordToSignedWord(s.i[1]);
2376      MMX(d).s[0]=SaturatedSignedDwordToSignedWord(MMX(d).i[0]);
2377      MMX(d).s[1]=SaturatedSignedDwordToSignedWord(MMX(d).i[1]);
2378      MMX(d).s[2]=SaturatedSignedDwordToSignedWord(s.i[0]);
2379      MMX(d).s[3]=SaturatedSignedDwordToSignedWord(s.i[1]);
23932380   }
23942381   CYCLES(1);     // TODO: correct cycle count
23952382}
r243192r243193
27242711{
27252712   UINT8 modrm = FETCH();
27262713   if( modrm >= 0xc0 ) {
2727      // MOVHLPS opcode
2728      XMM((modrm >> 3) & 0x7).q[0] = XMM(modrm & 0x7).q[1];
2714      // unsupported by cpu
27292715      CYCLES(1);     // TODO: correct cycle count
27302716   } else {
2731      // MOVLPS opcode
27322717      UINT32 ea = GetEA(modrm, 0);
27332718      READXMM_LO64(ea, XMM((modrm >> 3) & 0x7));
27342719      CYCLES(1);     // TODO: correct cycle count
r243192r243193
27522737{
27532738   UINT8 modrm = FETCH();
27542739   if( modrm >= 0xc0 ) {
2755      // MOVLHPS opcode
2756      XMM((modrm >> 3) & 0x7).q[1] = XMM(modrm & 0x7).q[0];
2740      // unsupported by cpu
27572741      CYCLES(1);     // TODO: correct cycle count
27582742   } else {
2759      // MOVHPS opcode
27602743      UINT32 ea = GetEA(modrm, 0);
27612744      READXMM_HI64(ea, XMM((modrm >> 3) & 0x7));
27622745      CYCLES(1);     // TODO: correct cycle count
r243192r243193
33843367   CYCLES(1);     // TODO: correct cycle count
33853368}
33863369
3387void i386_device::sse_shufps() // Opcode 0f c6
3370void i386_device::sse_shufps() // Opcode 0f 67
33883371{
33893372   UINT8 modrm = FETCH();
33903373   UINT8 sel = FETCH();
r243192r243193
33973380   s=modrm & 0x7;
33983381   d=(modrm >> 3) & 0x7;
33993382   if( modrm >= 0xc0 ) {
3400      UINT32 t1,t2,t3,t4;
3401      t1=XMM(d).d[m1];
3402      t2=XMM(d).d[m2];
3403      t3=XMM(s).d[m3];
3404      t4=XMM(s).d[m4];
3405      XMM(d).d[0]=t1;
3406      XMM(d).d[1]=t2;
3407      XMM(d).d[2]=t3;
3408      XMM(d).d[3]=t4;
3383      UINT32 t;
3384      t=XMM(d).d[m1];
3385      XMM(d).d[1]=XMM(d).d[m2];
3386      XMM(d).d[0]=t;
3387      XMM(d).d[2]=XMM(s).d[m3];
3388      XMM(d).d[3]=XMM(s).d[m4];
34093389   } else {
3410      UINT32 t1,t2;
3390      UINT32 t;
34113391      XMM_REG src;
34123392      UINT32 ea = GetEA(modrm, 0);
34133393      READXMM(ea, src);
3414      t1=XMM(d).d[m1];
3415      t2=XMM(d).d[m2];
3416      XMM(d).d[0]=t1;
3417      XMM(d).d[1]=t2;
3394      t=XMM(d).d[m1];
3395      XMM(d).d[1]=XMM(d).d[m2];
3396      XMM(d).d[0]=t;
34183397      XMM(d).d[2]=src.d[m3];
34193398      XMM(d).d[3]=src.d[m4];
34203399   }
r243192r243193
34253404{
34263405   UINT8 modrm = FETCH();
34273406   int s,d;
3428   UINT32 t1, t2, t3, t4;
34293407   s=modrm & 0x7;
34303408   d=(modrm >> 3) & 0x7;
34313409   if( modrm >= 0xc0 ) {
3432      t1 = XMM(s).d[1];
3433      t2 = XMM(d).d[1];
3434      t3 = XMM(s).d[0];
3435      t4 = XMM(d).d[0];
3436      XMM(d).d[3]=t1;
3437      XMM(d).d[2]=t2;
3438      XMM(d).d[1]=t3;
3439      XMM(d).d[0]=t4;
3410      XMM(d).d[3]=XMM(s).d[1];
3411      XMM(d).d[2]=XMM(d).d[1];
3412      XMM(d).d[1]=XMM(s).d[0];
3413      //XMM(d).d[0]=XMM(d).d[0];
34403414   } else {
34413415      XMM_REG src;
34423416      UINT32 ea = GetEA(modrm, 0);
34433417      READXMM(ea, src);
3444      t2 = XMM(d).d[1];
34453418      XMM(d).d[3]=src.d[1];
3446      XMM(d).d[2]=t2;
3419      XMM(d).d[2]=XMM(d).d[1];
34473420      XMM(d).d[1]=src.d[0];
34483421   }
34493422   CYCLES(1);     // TODO: correct cycle count
r243192r243193
34533426{
34543427   UINT8 modrm = FETCH();
34553428   int s,d;
3456   UINT32 t1, t2, t3, t4;
34573429   s=modrm & 0x7;
34583430   d=(modrm >> 3) & 0x7;
34593431   if( modrm >= 0xc0 ) {
3460      t1 = XMM(d).d[2];
3461      t2 = XMM(s).d[2];
3462      t3 = XMM(d).d[3];
3463      t4 = XMM(s).d[3];
3464      XMM(d).d[0]=t1;
3465      XMM(d).d[1]=t2;
3466      XMM(d).d[2]=t3;
3467      XMM(d).d[3]=t4;
3432      XMM(d).d[0]=XMM(d).d[2];
3433      XMM(d).d[1]=XMM(s).d[2];
3434      XMM(d).d[2]=XMM(d).d[3];
3435      XMM(d).d[3]=XMM(s).d[3];
34683436   } else {
34693437      XMM_REG src;
34703438      UINT32 ea = GetEA(modrm, 0);
34713439      READXMM(ea, src);
3472      t1 = XMM(d).d[2];
3473      t3 = XMM(d).d[3];
3474      XMM(d).d[0]=t1;
3440      XMM(d).d[0]=XMM(d).d[2];
34753441      XMM(d).d[1]=src.d[2];
3476      XMM(d).d[2]=t3;
3442      XMM(d).d[2]=XMM(d).d[3];
34773443      XMM(d).d[3]=src.d[3];
34783444   }
34793445   CYCLES(1);     // TODO: correct cycle count
trunk/src/emu/cpu/m68000/m68k_in.c
r243192r243193
272272extern void m68040_fpu_op0(m68000_base_device *m68k);
273273extern void m68040_fpu_op1(m68000_base_device *m68k);
274274extern void m68881_mmu_ops(m68000_base_device *m68k);
275extern void m68881_ftrap(m68000_base_device *m68k);
275extern void m68881_ftrap(m68000_base_device *m68k);
276276
277277/* ======================================================================== */
278278/* ========================= INSTRUCTION HANDLERS ========================= */
trunk/src/emu/cpu/m68000/m68kcpu.c
r243192r243193
699699   {
700700      /* only the 68010 throws this unique type-1000 frame */
701701      m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR);
702   }
702   }
703703   else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k))
704704   {
705705      m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address);
trunk/src/emu/cpu/m68000/m68kcpu.h
r243192r243193
3232
3333#include <limits.h>
3434
35#ifdef SDLMAME_SOLARIS
36#undef REG_SP
37#undef REG_PC
38#undef REG_FP
39#endif
4035
4136/* ======================================================================== */
4237/* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */
trunk/src/emu/cpu/m68000/m68kfpu.inc
r243192r243193
21772177      // trap here
21782178      m68ki_exception_trap(m68k, EXCEPTION_TRAPV);
21792179   }
2180   else    // fall through, requires eating the operand
2180   else   // fall through, requires eating the operand
21812181   {
21822182      switch (m68k->ir & 0x7)
21832183      {
2184         case 2: // word operand
2184         case 2:   // word operand
21852185            OPER_I_16(m68k);
21862186            break;
21872187
r243192r243193
21892189            OPER_I_32(m68k);
21902190            break;
21912191
2192         case 4: // no operand
2192         case 4:   // no operand
21932193            break;
21942194      }
21952195   }
21962196}
2197
trunk/src/emu/cpu/m6809/m6809make.py
r243192r243193
11#!/usr/bin/python
22
33import sys
4import logging
5import fileinput
46import re
57
68# Initial state
trunk/src/emu/cpu/mcs96/mcs96make.py
r243192r243193
175175    try:
176176        f = open(argv[3], "w")
177177    except Exception, err:
178        sys.stderr.write("cannot write file %s [%s]\n" % (argv[3], err))
178        logging.error("cannot write file %s [%s]", fname, err)
179179        sys.exit(1)
180180   
181181    if t != "mcs96":
trunk/src/emu/cpu/mips/mips3drc.c
r243192r243193
10131013    an exception if out
10141014-------------------------------------------------*/
10151015
1016void mips3_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
1016void mips3_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
10171017{
10181018   /* check software interrupts if pending */
10191019   if (compiler->checksoftints)
trunk/src/emu/cpu/powerpc/ppccom.c
r243192r243193
693693   m_hotspot_select = 0;
694694   memset(m_hotspot, 0, sizeof(m_hotspot));
695695
696   m_debugger_temp = 0;
697
698696   m_cache_line_size = 32;
699697   m_cpu_clock = clock();
700698   m_program = &space(AS_PROGRAM);
trunk/src/emu/cpu/powerpc/ppcdrc.c
r243192r243193
5757***************************************************************************/
5858
5959#define R32(reg)                m_regmap[reg]
60#define R32Z(reg)               (((reg) == 0) ? uml::parameter(0) : m_regmap[reg])
60#define R32Z(reg)               (((reg) == 0) ? parameter(0) : m_regmap[reg])
6161#define F64(reg)                m_fdregmap[reg]
6262#define CR32(reg)               mem(&m_core->cr[reg])
6363#define FPSCR32                 mem(&m_core->fpscr)
r243192r243193
15491549    an exception if out
15501550-------------------------------------------------*/
15511551
1552void ppc_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
1552void ppc_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
15531553{
15541554   /* check full interrupts if pending */
15551555   if (compiler->checkints)
trunk/src/emu/cpu/rsp/rspdrc.c
r243192r243193
641641    subtract cycles from the icount and generate
642642    an exception if out
643643-------------------------------------------------*/
644void rsp_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
644void rsp_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
645645{
646646   /* account for cycles */
647647   if (compiler->cycles > 0)
trunk/src/emu/cpu/sh2/sh2drc.c
r243192r243193
9191   {
9292      if (m_regmap[regnum].is_int_register())
9393      {
94         UML_MOV(block, uml::parameter::make_ireg(m_regmap[regnum].ireg()), mem(&m_sh2_state->r[regnum]));
94         UML_MOV(block, parameter::make_ireg(m_regmap[regnum].ireg()), mem(&m_sh2_state->r[regnum]));
9595      }
9696   }
9797}
r243192r243193
110110   {
111111      if (m_regmap[regnum].is_int_register())
112112      {
113         UML_MOV(block, mem(&m_sh2_state->r[regnum]), uml::parameter::make_ireg(m_regmap[regnum].ireg()));
113         UML_MOV(block, mem(&m_sh2_state->r[regnum]), parameter::make_ireg(m_regmap[regnum].ireg()));
114114      }
115115   }
116116}
r243192r243193
12201220    subtract cycles from the icount and generate
12211221    an exception if out
12221222-------------------------------------------------*/
1223void sh2_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
1223void sh2_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
12241224{
12251225   /* check full interrupts if pending */
12261226   if (compiler->checkints)
trunk/src/emu/cpu/tms0980/tms0980.c
r243192r243193
429429   m_sr = 0;
430430   m_pa = 0;
431431   m_pb = 0;
432   m_ps = 0;
433432   m_a = 0;
434433   m_x = 0;
435434   m_y = 0;
r243192r243193
467466   save_item(NAME(m_sr));
468467   save_item(NAME(m_pa));
469468   save_item(NAME(m_pb));
470   save_item(NAME(m_ps));
471469   save_item(NAME(m_a));
472470   save_item(NAME(m_x));
473471   save_item(NAME(m_y));
r243192r243193
638636   tms1100_cpu_device::device_reset();
639637
640638   // small differences in 00-3f area
639   m_fixed_decode[0x09] = F_COMX; // !
641640   m_fixed_decode[0x0b] = F_TPC;
642641}
643642
r243192r243193
959958//-------------------------------------------------
960959
961960// handle branches:
962
963// TMS1000/common
964961// note: add(latch) and bl(branch latch) are specific to 0980 series,
965962// c(chapter) bits are specific to 1100(and 1400) series
966963
964// TMS1000/common:
965
967966void tms1xxx_cpu_device::op_br()
968967{
969968   // BR/BL: conditional branch
970   if (m_status)
971   {
972      if (m_clatch == 0)
973         m_pa = m_pb;
974      m_ca = m_cb;
975      m_pc = m_opcode & m_pc_mask;
976   }
969   if (!m_status)
970      return;
971
972   if (!m_clatch)
973      m_pa = m_pb;
974   m_ca = m_cb;
975   m_pc = m_opcode & m_pc_mask;
977976}
978977
979978void tms1xxx_cpu_device::op_call()
980979{
981980   // CALL/CALLL: conditional call
982   if (m_status)
983   {
984      UINT8 prev_pa = m_pa;
981   if (!m_status)
982      return;
985983
986      if (m_clatch == 0)
987      {
988         m_clatch = 1;
989         m_sr = m_pc;
990         m_pa = m_pb;
991         m_cs = m_ca;
992      }
993      m_ca = m_cb;
994      m_pb = prev_pa;
995      m_pc = m_opcode & m_pc_mask;
984   UINT8 prev_pa = m_pa;
985   if (!m_clatch)
986   {
987      m_sr = m_pc;
988      m_clatch = 1;
989      m_pa = m_pb;
990      m_cs = m_ca;
996991   }
992   m_ca = m_cb;
993   m_pb = prev_pa;
994   m_pc = m_opcode & m_pc_mask;
997995}
998996
999997void tms1xxx_cpu_device::op_retn()
1000998{
1001999   // RETN: return from subroutine
1002   if (m_clatch == 1)
1000   if (m_clatch)
10031001   {
1004      m_clatch = 0;
10051002      m_pc = m_sr;
1003      m_clatch = 0;
10061004      m_ca = m_cs;
10071005   }
10081006   m_add = 0;
r243192r243193
10161014void tms1400_cpu_device::op_br()
10171015{
10181016   // BR/BL: conditional branch
1019   if (m_status)
1020   {
1021      m_pa = m_pb; // don't care about clatch
1022      m_ca = m_cb;
1023      m_pc = m_opcode & m_pc_mask;
1024   }
1017   if (!m_status)
1018      return;
1019   
1020   //..
10251021}
10261022
10271023void tms1400_cpu_device::op_call()
10281024{
10291025   // CALL/CALLL: conditional call
1030   if (m_status)
1031   {
1032      // 3-level stack, mask clatch 3 bits (no need to mask others)
1033      m_clatch = (m_clatch << 1 | 1) & 7;
1026   if (!m_status)
1027      return;
10341028
1035      m_sr = m_sr << m_pc_bits | m_pc;
1036      m_pc = m_opcode & m_pc_mask;
1037
1038      m_ps = m_ps << 4 | m_pa;
1039      m_pa = m_pb;
1040
1041      m_cs = m_cs << 2 | m_ca;
1042      m_ca = m_cb;
1043   }
1044   else
1045   {
1046      m_pb = m_pa;
1047      m_cb = m_ca;
1048   }
1029   //..
10491030}
10501031
10511032void tms1400_cpu_device::op_retn()
10521033{
10531034   // RETN: return from subroutine
1054   if (m_clatch & 1)
1055   {
1056      m_clatch >>= 1;
1057
1058      m_pc = m_sr & m_pc_mask;
1059      m_sr >>= m_pc_bits;
1060
1061      m_pa = m_pb = m_ps & 0xf;
1062      m_ps >>= 4;
1063
1064      m_ca = m_cb = m_cs & 3;
1065      m_cs >>= 2;
1066   }
1035   //..
10671036}
10681037
10691038
10701039// handle other:
10711040
1072// TMS1000/common
1041// TMS1000/common:
10731042
10741043void tms1xxx_cpu_device::op_sbit()
10751044{
r243192r243193
11891158
11901159
11911160// TMS0980-specific (and possibly child classes)
1192
11931161void tms0980_cpu_device::op_comx()
11941162{
11951163   // COMX: complement X register, but not the MSB
r243192r243193
12351203
12361204
12371205// TMS0270-specific
1238
12391206void tms0270_cpu_device::op_setr()
12401207{
12411208   // same as default, but handle write to output in dynamic_output
trunk/src/emu/cpu/tms0980/tms0980.h
r243192r243193
139139   optional_device<pla_device> m_spla;
140140
141141   UINT8   m_pc;        // 6 or 7-bit program counter
142   UINT32  m_sr;        // 6 or 7-bit subroutine return register(s)
142   UINT8  m_sr;        // 6 or 7-bit subroutine return register
143143   UINT8   m_pa;        // 4-bit page address register
144144   UINT8   m_pb;        // 4-bit page buffer register
145   UINT16  m_ps;        // 4-bit page subroutine register(s)
146145   UINT8   m_a;         // 4-bit accumulator
147146   UINT8   m_x;         // 2,3,or 4-bit RAM X register
148147   UINT8   m_y;         // 4-bit RAM Y register
149   UINT8   m_ca;        // chapter address register
150   UINT8   m_cb;        // chapter buffer register
151   UINT16  m_cs;        // chapter subroutine register(s)
148   UINT8   m_ca;        // chapter address bit
149   UINT8   m_cb;        // chapter buffer bit
150   UINT8   m_cs;        // chapter subroutine bit
152151   UINT16  m_r;
153152   UINT16  m_o;
154153   UINT8   m_cki_bus;
r243192r243193
161160   UINT8   m_status;
162161   UINT8   m_status_latch;
163162   UINT8   m_eac;       // end around carry bit
164   UINT8   m_clatch;    // call latch bit(s)
163   UINT8   m_clatch;    // call latch bit
165164   UINT8   m_add;       // add latch bit
166165   UINT8   m_bl;        // branch latch bit
167166
trunk/src/emu/cpu/tms57002/tmsmake.py
r243192r243193
417417try:
418418    f = open(sys.argv[2], "w")
419419except Exception, err:
420    sys.stderr.write("cannot write file %s [%s]\n" % (sys.argv[2], err))
420    logging.error("cannot write file %s [%s]", fname, err)
421421    sys.exit(1)
422422
423423EmitDasm(f, ins_list)
trunk/src/emu/devfind.c
r243192r243193
114114
115115void finder_base::printf_warning(const char *format, ...)
116116{
117   va_list argptr;
118   char buffer[1024];
117    va_list argptr;
118    char buffer[1024];
119119
120   /* do the output */
121   va_start(argptr, format);
122   vsnprintf(buffer, 1024, format, argptr);
123   osd_printf_warning("%s", buffer);
124   va_end(argptr);
120    /* do the output */
121    va_start(argptr, format);
122    vsnprintf(buffer, 1024, format, argptr);
123    osd_printf_warning("%s", buffer);
124    va_end(argptr);
125125}
trunk/src/emu/devfind.h
r243192r243193
5757   void *find_memshare(UINT8 width, size_t &bytes, bool required);
5858   bool report_missing(bool found, const char *objname, bool required);
5959
60   void printf_warning(const char *format, ...) ATTR_PRINTF(2,3);
60    void printf_warning(const char *format, ...) ATTR_PRINTF(2,3);
6161
6262   // internal state
6363   finder_base *m_next;
trunk/src/emu/device.c
r243192r243193
186186
187187
188188//-------------------------------------------------
189//  ioport - return a pointer to the I/O port
190//  object for a given port name
191//-------------------------------------------------
192
193astring device_t::parameter(const char *tag) const
194{
195   // safety first
196   if (this == NULL)
197      return NULL;
198
199   // build a fully-qualified name and look it up
200   astring fullpath;
201   return machine().parameters().lookup(subtag(fullpath, tag));
202}
203
204
205//-------------------------------------------------
206189//  static_set_clock - set/change the clock on
207190//  a device
208191//-------------------------------------------------
trunk/src/emu/device.h
r243192r243193
130130   UINT8 default_bios() const { return m_default_bios; }
131131   UINT8 system_bios() const { return m_system_bios; }
132132   astring default_bios_tag() const { return m_default_bios_tag; }
133   astring parameter(const char *tag) const;
134133
135134   // interface helpers
136135   device_interface *first_interface() const { return m_interface_list; }
trunk/src/emu/distate.c
r243192r243193
4949//  device_state_entry - constructor
5050//-------------------------------------------------
5151
52device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev)
53   : m_device_state(dev),
54      m_next(NULL),
52device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size)
53   : m_next(NULL),
5554      m_index(index),
5655      m_dataptr(dataptr),
5756      m_datamask(0),
r243192r243193
8786      m_symbol.cpy("CURFLAGS");
8887}
8988
90device_state_entry::device_state_entry(int index, device_state_interface *dev)
91   : m_device_state(dev),
92      m_next(NULL),
89device_state_entry::device_state_entry(int index)
90   : m_next(NULL),
9391      m_index(index),
9492      m_dataptr(NULL),
9593      m_datamask(0),
r243192r243193
525523   assert(symbol != NULL);
526524
527525   // allocate new entry
528   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size, this));
526   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size));
529527
530528   // append to the end of the list
531529   m_state_list.append(*entry);
r243192r243193
545543device_state_entry &device_state_interface::state_add_divider(int index)
546544{
547545   // allocate new entry
548   device_state_entry *entry = global_alloc(device_state_entry(index, this));
546   device_state_entry *entry = global_alloc(device_state_entry(index));
549547
550548   // append to the end of the list
551549   m_state_list.append(*entry);
trunk/src/emu/distate.h
r243192r243193
4545{
4646   friend class device_state_interface;
4747   friend class simple_list<device_state_entry>;
48   friend class lua_engine;
4849
4950private:
5051   // construction/destruction
51   device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev);
52   device_state_entry(int index, device_state_interface *dev);
52   device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size);
53   device_state_entry(int index);
5354
5455public:
5556   // post-construction modifiers
r243192r243193
6970   const char *symbol() const { return m_symbol; }
7071   bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
7172   bool divider() const { return m_flags & DSF_DIVIDER; }
72   device_state_interface *parent_state() const {return m_device_state;}
7373
7474protected:
7575   // device state flags
r243192r243193
9898   static const UINT64 k_decimal_divisor[20];      // divisors for outputting decimal values
9999
100100   // public state description
101   device_state_interface *m_device_state;         // link to parent device state
102101   device_state_entry *    m_next;                 // link to next item
103102   UINT32                  m_index;                // index by which this item is referred
104103   generic_ptr             m_dataptr;              // pointer to where the data lives
trunk/src/emu/emu.h
r243192r243193
8282// machine and driver configuration
8383#include "mconfig.h"
8484#include "gamedrv.h"
85#include "parameters.h"
8685
8786// timers, CPU and scheduling
8887#include "devcpu.h"
trunk/src/emu/emu.mak
r243192r243193
9999   $(EMUOBJ)/memarray.o \
100100   $(EMUOBJ)/memory.o \
101101   $(EMUOBJ)/network.o \
102   $(EMUOBJ)/parameters.o \
103102   $(EMUOBJ)/output.o \
104103   $(EMUOBJ)/render.o \
105104   $(EMUOBJ)/rendfont.o \
r243192r243193
121120   $(EMUOBJ)/ui/mainmenu.o \
122121   $(EMUOBJ)/ui/miscmenu.o \
123122   $(EMUOBJ)/ui/barcode.o \
124   $(EMUOBJ)/ui/cheatopt.o \
125123   $(EMUOBJ)/ui/devopt.o \
126124   $(EMUOBJ)/ui/filemngr.o \
127125   $(EMUOBJ)/ui/filesel.o \
128126   $(EMUOBJ)/ui/imgcntrl.o \
129   $(EMUOBJ)/ui/info.o \
127   $(EMUOBJ)/ui/imginfo.o \
130128   $(EMUOBJ)/ui/inputmap.o \
131129   $(EMUOBJ)/ui/selgame.o \
132   $(EMUOBJ)/ui/sliders.o \
133130   $(EMUOBJ)/ui/slotopt.o \
134131   $(EMUOBJ)/ui/swlist.o \
135132   $(EMUOBJ)/ui/tapectrl.o \
136   $(EMUOBJ)/ui/videoopt.o \
137133   $(EMUOBJ)/ui/viewgfx.o \
138134   $(EMUOBJ)/validity.o \
139135   $(EMUOBJ)/video.o \
r243192r243193
153149   $(EMUOBJ)/profiler.o \
154150   $(EMUOBJ)/webengine.o \
155151   $(OSDOBJ)/osdnet.o \
152   $(OSDOBJ)/modules/sound/none.o \
153   $(OSDOBJ)/modules/debugger/none.o \
154   $(OSDOBJ)/modules/debugger/debugint.o \
156155
157156EMUSOUNDOBJS = \
158157   $(EMUOBJ)/sound/filter.o \
trunk/src/emu/emucore.c
r243192r243193
1717emu_fatalerror::emu_fatalerror(const char *format, ...)
1818: code(0)
1919{
20   if (format == NULL)
21   {
22      text[0] = '\0';
23   }
24   else
25   {
26      va_list ap;
27      va_start(ap, format);
28      vsprintf(text, format, ap);
29      va_end(ap);
30   }
31   osd_break_into_debugger(text);
20    if (format == NULL)
21    {
22        text[0] = '\0';
23    }
24    else
25    {
26        va_list ap;
27        va_start(ap, format);
28        vsprintf(text, format, ap);
29        va_end(ap);
30    }
31    osd_break_into_debugger(text);
3232}
3333
3434emu_fatalerror::emu_fatalerror(const char *format, va_list ap)
3535: code(0)
3636{
37   if (format == NULL)
38   {
39      text[0] = '\0';
40   }
41   else
42   {
43      vsprintf(text, format, ap);
44   }
45   osd_break_into_debugger(text);
37    if (format == NULL)
38    {
39        text[0] = '\0';
40    }
41    else
42    {
43        vsprintf(text, format, ap);
44    }
45    osd_break_into_debugger(text);
4646}
4747
4848emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, ...)
4949: code(_exitcode)
5050{
51   if (format == NULL)
52   {
53      text[0] = '\0';
54   }
55   else
56   {
57      va_list ap;
58      va_start(ap, format);
59      vsprintf(text, format, ap);
60      va_end(ap);
61   }
51    if (format == NULL)
52    {
53        text[0] = '\0';
54    }
55    else
56    {
57        va_list ap;
58        va_start(ap, format);
59        vsprintf(text, format, ap);
60        va_end(ap);
61    }
6262}
6363
6464emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, va_list ap)
6565: code(_exitcode)
6666{
67   if (format == NULL)
68   {
69      text[0] = '\0';
70   }
71   else
72   {
73      vsprintf(text, format, ap);
74   }
67    if (format == NULL)
68    {
69        text[0] = '\0';
70    }
71    else
72    {
73        vsprintf(text, format, ap);
74    }
7575}
7676
7777
r243192r243193
8989
9090void fatalerror(const char *format, ...)
9191{
92   va_list ap;
93   va_start(ap, format);
94   emu_fatalerror error(format, ap);
95   va_end(ap);
96   throw error;
92    va_list ap;
93    va_start(ap, format);
94    emu_fatalerror error(format, ap);
95    va_end(ap);
96    throw error;
9797}
9898
9999void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...)
100100{
101   va_list ap;
102   va_start(ap, format);
103   emu_fatalerror error(exitcode, format, ap);
104   va_end(ap);
105   throw error;
101    va_list ap;
102    va_start(ap, format);
103    emu_fatalerror error(exitcode, format, ap);
104    va_end(ap);
105    throw error;
106106}
trunk/src/emu/emuopts.c
r243192r243193
150150
151151   // debugging options
152152   { NULL,                                              NULL,        OPTION_HEADER,     "CORE DEBUGGING OPTIONS" },
153   { OPTION_VERBOSE ";v",                               "0",         OPTION_BOOLEAN,    "display additional diagnostic information" },
154   { OPTION_LOG,                                        "0",         OPTION_BOOLEAN,    "generate an error.log file" },
155   { OPTION_OSLOG,                                      "0",         OPTION_BOOLEAN,    "output error.log data to the system debugger" },
156   { OPTION_DEBUG ";d",                                 "0",         OPTION_BOOLEAN,    "enable/disable debugger" },
153    { OPTION_VERBOSE ";v",                               "0",         OPTION_BOOLEAN,    "display additional diagnostic information" },
154    { OPTION_LOG,                                        "0",         OPTION_BOOLEAN,    "generate an error.log file" },
155    { OPTION_OSLOG,                                      "0",         OPTION_BOOLEAN,    "output error.log data to the system debugger" },
156    { OPTION_DEBUG ";d",                                 "0",         OPTION_BOOLEAN,    "enable/disable debugger" },
157157   { OPTION_UPDATEINPAUSE,                              "0",         OPTION_BOOLEAN,    "keep calling video updates while in pause" },
158158   { OPTION_DEBUGSCRIPT,                                NULL,        OPTION_STRING,     "script for debugger" },
159159
r243192r243193
278278         }
279279      }
280280   }
281   while (add_slot_options(false));
282   add_device_options(false);
283281}
284282
285283
r243192r243193
367365   do {
368366      num = options_count();
369367      update_slot_options();
368      while (add_slot_options(false));
369      add_device_options(false);
370370      result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
371371   } while (num != options_count());
372372
r243192r243193
502502      do {
503503         num = options_count();
504504         update_slot_options();
505         while (add_slot_options(false));
506         add_device_options(false);
505507      } while(num != options_count());
506508   }
507509}
trunk/src/emu/emuopts.h
r243192r243193
318318   bool joystick_contradictory() const { return bool_value(OPTION_JOYSTICK_CONTRADICTORY); }
319319   int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); }
320320
321   // core debugging options
322   bool log() const { return bool_value(OPTION_LOG); }
323   bool debug() const { return bool_value(OPTION_DEBUG); }
324   bool verbose() const { return bool_value(OPTION_VERBOSE); }
325   bool oslog() const { return bool_value(OPTION_OSLOG); }
321    // core debugging options
322    bool log() const { return bool_value(OPTION_LOG); }
323    bool debug() const { return bool_value(OPTION_DEBUG); }
324    bool verbose() const { return bool_value(OPTION_VERBOSE); }
325    bool oslog() const { return bool_value(OPTION_OSLOG); }
326326   const char *debug_script() const { return value(OPTION_DEBUGSCRIPT); }
327327   bool update_in_pause() const { return bool_value(OPTION_UPDATEINPAUSE); }
328328
trunk/src/emu/image.c
r243192r243193
237237         }
238238      }
239239   }
240}
241240
242/*-------------------------------------------------
243 image_mandatory_scan - search for devices which
244 need an image to be loaded
245 -------------------------------------------------*/
246
247astring &image_mandatory_scan(running_machine &machine, astring &mandatory)
248{
249   mandatory.reset();
250   // make sure that any required image has a mounted file
251   image_interface_iterator iter(machine.root_device());
252241   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
253242   {
254      if (image->filename() == NULL && image->must_be_loaded())
255         mandatory.cat("\"").cat(image->instance_name()).cat("\", ");
243      /* is an image specified for this image */
244      image_name = image->filename();
245
246      if (!((image_name != NULL) && (image_name[0] != '\0')))
247      {
248         /* no image... must this device be loaded? */
249         if (image->must_be_loaded())
250         {
251            fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->instance_name());
252         }
253      }
256254   }
257   return mandatory;
258255}
259256
260257/*-------------------------------------------------
trunk/src/emu/image.h
r243192r243193
2020
2121void image_init(running_machine &machine);
2222void image_postdevice_init(running_machine &machine);
23astring &image_mandatory_scan(running_machine &machine, astring &mandatory);
2423
2524extern struct io_procs image_ioprocs;
2625
trunk/src/emu/luaengine.c
r243192r243193
11// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic,Luca Bruno
2// copyright-holders:Miodrag Milanovic
33/***************************************************************************
44
55    luaengine.c
r243192r243193
130130   cb = -1;
131131}
132132
133#ifdef SDLMAME_SOLARIS
134#undef _L
135#endif
136
137133void lua_engine::hook::set(lua_State *_L, int idx)
138134{
139135   if (L)
r243192r243193
460456}
461457
462458//-------------------------------------------------
463//  state_get_value - return value of a device state entry
459//  state_get_value - return value of a devices state
464460//  -> manager:machine().devices[":maincpu"].state["PC"].value
465461//-------------------------------------------------
466462
467463UINT64 lua_engine::l_state_get_value(const device_state_entry *d)
468464{
469   device_state_interface *state = d->parent_state();
470   if(state) {
471      luaThis->machine().save().dispatch_presave();
472      return state->state_int(d->index());
473   } else {
474      return 0;
475   }
465   return d->value();
476466}
477467
478468//-------------------------------------------------
479//  state_set_value - set value of a device state entry
469//  state_set_value - set value of a devices state
480470//  -> manager:machine().devices[":maincpu"].state["D0"].value = 0x0c00
481471//-------------------------------------------------
482472
483473void lua_engine::l_state_set_value(device_state_entry *d, UINT64 val)
484474{
485   device_state_interface *state = d->parent_state();
486   if(state) {
487      state->set_state_int(d->index(), val);
488      luaThis->machine().save().dispatch_presave();
489   }
475   d->set_value(val);
490476}
491477
492478//-------------------------------------------------
r243192r243193
541527}
542528
543529//-------------------------------------------------
544//  mem_write - templated memory writer for <sign>,<size>
545//  -> manager:machine().devices[":maincpu"].spaces["program"]:write_u16(0xC000, 0xF00D)
546//-------------------------------------------------
547
548template <typename T>
549int lua_engine::lua_addr_space::l_mem_write(lua_State *L)
550{
551   address_space &sp = luabridge::Stack<address_space &>::get(L, 1);
552   luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
553   luaL_argcheck(L, lua_isnumber(L, 3), 3, "value (integer) expected");
554   offs_t address = lua_tounsigned(L, 2);
555   T val = lua_tounsigned(L, 3);
556
557   switch(sizeof(val) * 8) {
558      case 8:
559         sp.write_byte(address, val);
560         break;
561      case 16:
562         if ((address & 1) == 0) {
563            sp.write_word(address, val);
564         } else {
565            sp.read_word_unaligned(address, val);
566         }
567         break;
568      case 32:
569         if ((address & 3) == 0) {
570            sp.write_dword(address, val);
571         } else {
572            sp.write_dword_unaligned(address, val);
573         }
574         break;
575      case 64:
576         if ((address & 7) == 0) {
577            sp.write_qword(address, val);
578         } else {
579            sp.write_qword_unaligned(address, val);
580         }
581         break;
582      default:
583         break;
584   }
585
586   return 0;
587}
588
589//-------------------------------------------------
590//  screen_height - return screen visible height
591//  -> manager:machine().screens[":screen"]:height()
592//-------------------------------------------------
593
594int lua_engine::lua_screen::l_height(lua_State *L)
595{
596   screen_device *sc = luabridge::Stack<screen_device *>::get(L, 1);
597   if(!sc) {
598      return 0;
599   }
600
601   lua_pushunsigned(L, sc->visible_area().height());
602   return 1;
603}
604
605//-------------------------------------------------
606//  screen_width - return screen visible width
607//  -> manager:machine().screens[":screen"]:width()
608//-------------------------------------------------
609
610int lua_engine::lua_screen::l_width(lua_State *L)
611{
612   screen_device *sc = luabridge::Stack<screen_device *>::get(L, 1);
613   if(!sc) {
614      return 0;
615   }
616
617   lua_pushunsigned(L, sc->visible_area().width());
618   return 1;
619}
620
621//-------------------------------------------------
622530//  draw_box - draw a box on a screen container
623531//  -> manager:machine().screens[":screen"]:draw_box(x1, y1, x2, y2, bgcolor, linecolor)
624532//-------------------------------------------------
r243192r243193
640548
641549   // retrieve all parameters
642550   float x1, y1, x2, y2;
643   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
644   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
645   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->visible_area().width()) , 1.0f);
646   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->visible_area().height()), 1.0f);
551   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
552   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
553   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->width()) , 1.0f);
554   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->height()), 1.0f);
647555   UINT32 bgcolor = lua_tounsigned(L, 6);
648556   UINT32 fgcolor = lua_tounsigned(L, 7);
649557
r243192r243193
676584
677585   // retrieve all parameters
678586   float x1, y1, x2, y2;
679   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
680   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
681   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->visible_area().width()) , 1.0f);
682   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->visible_area().height()), 1.0f);
587   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
588   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
589   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->width()) , 1.0f);
590   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->height()), 1.0f);
683591   UINT32 color = lua_tounsigned(L, 6);
684592
685593   // draw the line
r243192r243193
705613   luaL_argcheck(L, lua_isstring(L, 4), 4, "message (string) expected");
706614
707615   // retrieve all parameters
708   float x = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
709   float y = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
616   float x = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
617   float y = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
710618   const char *msg = luaL_checkstring(L,4);
711619   // TODO: add optional parameters (colors, etc.)
712620
r243192r243193
714622   render_container &rc = sc->container();
715623   ui_manager &ui = sc->machine().ui();
716624   ui.draw_text_full(&rc, msg, x, y , (1.0f - x),
717                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
718                  UI_TEXT_BG_COLOR, NULL, NULL);
625                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
626                  UI_TEXT_BG_COLOR, NULL, NULL);
719627
720628   return 0;
721629}
r243192r243193
974882            .addCFunction ("read_u32", &lua_addr_space::l_mem_read<UINT32>)
975883            .addCFunction ("read_i64", &lua_addr_space::l_mem_read<INT64>)
976884            .addCFunction ("read_u64", &lua_addr_space::l_mem_read<UINT64>)
977            .addCFunction ("write_i8", &lua_addr_space::l_mem_write<INT8>)
978            .addCFunction ("write_u8", &lua_addr_space::l_mem_write<UINT8>)
979            .addCFunction ("write_i16", &lua_addr_space::l_mem_write<INT16>)
980            .addCFunction ("write_u16", &lua_addr_space::l_mem_write<UINT16>)
981            .addCFunction ("write_i32", &lua_addr_space::l_mem_write<INT32>)
982            .addCFunction ("write_u32", &lua_addr_space::l_mem_write<UINT32>)
983            .addCFunction ("write_i64", &lua_addr_space::l_mem_write<INT64>)
984            .addCFunction ("write_u64", &lua_addr_space::l_mem_write<UINT64>)
985885         .endClass()
986886         .deriveClass <address_space, lua_addr_space> ("addr_space")
987887            .addFunction("name", &address_space::name)
r243192r243193
990890            .addCFunction ("draw_box",  &lua_screen::l_draw_box)
991891            .addCFunction ("draw_line", &lua_screen::l_draw_line)
992892            .addCFunction ("draw_text", &lua_screen::l_draw_text)
993            .addCFunction ("height", &lua_screen::l_height)
994            .addCFunction ("width", &lua_screen::l_width)
995893         .endClass()
996894         .deriveClass <screen_device, lua_screen> ("screen_dev")
997            .addFunction ("frame_number", &screen_device::frame_number)
998895            .addFunction ("name", &screen_device::name)
999896            .addFunction ("shortname", &screen_device::shortname)
1000897            .addFunction ("tag", &screen_device::tag)
898            .addFunction ("height", &screen_device::height)
899            .addFunction ("width", &screen_device::width)
1001900         .endClass()
1002901         .beginClass <device_state_entry> ("dev_space")
1003902            .addFunction ("name", &device_state_entry::symbol)
trunk/src/emu/luaengine.h
r243192r243193
112112   static luabridge::LuaRef l_dev_get_memspaces(const device_t *d);
113113   struct lua_addr_space {
114114      template<typename T> int l_mem_read(lua_State *L);
115      template<typename T> int l_mem_write(lua_State *L);
116115   };
117116   static luabridge::LuaRef l_machine_get_screens(const running_machine *r);
118117   struct lua_screen {
119      int l_height(lua_State *L);
120      int l_width(lua_State *L);
121118      int l_draw_box(lua_State *L);
122119      int l_draw_line(lua_State *L);
123120      int l_draw_text(lua_State *L);
trunk/src/emu/machine.c
r243192r243193
108108
109109osd_interface &running_machine::osd() const
110110{
111   return m_manager.osd();
111    return m_manager.osd();
112112}
113113
114114//-------------------------------------------------
r243192r243193
142142      m_save(*this),
143143      m_memory(*this),
144144      m_ioport(*this),
145      m_parameters(*this),
146145      m_scheduler(*this)
147146{
148147   memset(&m_base_time, 0, sizeof(m_base_time));
trunk/src/emu/machine.h
r243192r243193
165165   save_manager &save() { return m_save; }
166166   memory_manager &memory() { return m_memory; }
167167   ioport_manager &ioport() { return m_ioport; }
168   parameters_manager &parameters() { return m_parameters; }
169168   cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; }
170169   render_manager &render() const { assert(m_render != NULL); return *m_render; }
171170   input_manager &input() const { assert(m_input != NULL); return *m_input; }
r243192r243193
358357   save_manager            m_save;                 // save manager
359358   memory_manager          m_memory;               // memory manager
360359   ioport_manager          m_ioport;               // I/O port manager
361   parameters_manager      m_parameters;           // parameters manager
362360   device_scheduler        m_scheduler;            // scheduler object
363361   emu_timer               *m_autoboot_timer;      // autoboot timer
364362};
trunk/src/emu/machine/6522via.c
r243192r243193
223223   save_item(NAME(m_acr));
224224   save_item(NAME(m_ier));
225225   save_item(NAME(m_ifr));
226   save_item(NAME(m_time1));
227226   save_item(NAME(m_t1_active));
228227   save_item(NAME(m_t1_pb7));
229   save_item(NAME(m_time2));
230228   save_item(NAME(m_t2_active));
231229   save_item(NAME(m_shift_counter));
232230}
trunk/src/emu/machine/bcreader.c
r243192r243193
269269   {
270270      if (m_byte_count < m_byte_length)
271271      {
272         UINT8 val = m_byte_data[m_byte_count];
272         UINT8 val = m_pixel_data[m_byte_count];
273273         m_byte_count++;
274274         return val;
275275      }
trunk/src/emu/machine/bcreader.h
r243192r243193
2525   barcode_reader_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2626
2727   void write_code(const char *barcode, int len);
28   int get_pending_code() { return m_new_code; }
29   int get_byte_length() { return m_byte_length; }
3028   UINT8 read_code();
3129   int read_pixel();
3230
trunk/src/emu/machine/intelfsh.c
r243192r243193
102102const device_type INTEL_TE28F160 = &device_creator<intel_te28f160_device>;
103103const device_type SHARP_UNK128MBIT = &device_creator<sharp_unk128mbit_device>;
104104const device_type INTEL_28F320J3D = &device_creator<intel_28f320j3d_device>;
105const device_type INTEL_28F320J5 = &device_creator<intel_28f320j5_device>;
106
107105const device_type SST_39VF400A = &device_creator<sst_39vf400a_device>;
108106
109107static ADDRESS_MAP_START( memory_map8_512Kb, AS_PROGRAM, 8, intelfsh_device )
r243192r243193
248246      m_sector_is_4k = true;
249247      map = ADDRESS_MAP_NAME( memory_map16_32Mb );
250248      break;
251   case FLASH_INTEL_28F320J5: // funkball
252      m_bits = 16;
253      m_size = 0x400000;
254      m_maker_id = MFG_INTEL;
255      m_device_id = 0x14;
256//      m_sector_is_4k = true; 128kb?
257      map = ADDRESS_MAP_NAME( memory_map16_32Mb );
258      break;
259249   case FLASH_SST_39VF020:
260250      m_bits = 8;
261251      m_size = 0x40000;
r243192r243193
456446intel_28f320j3d_device::intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
457447   : intelfsh16_device(mconfig, INTEL_28F320J3D, "Intel 28F320J3D Flash", tag, owner, clock, FLASH_INTEL_28F320J3D, "intel_28f320j3d", __FILE__) { }
458448
459intel_28f320j5_device::intel_28f320j5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
460   : intelfsh16_device(mconfig, INTEL_28F320J5, "Intel 28F320J3D_a Flash", tag, owner, clock, FLASH_INTEL_28F320J5, "intel_28f320j5", __FILE__) { }
461
462
463449sst_39vf400a_device::sst_39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
464450   : intelfsh16_device(mconfig, SST_39VF400A, "SST 39VF400A Flash", tag, owner, clock, FLASH_SST_39VF400A, "sst_39vf400a", __FILE__) { }
465451
trunk/src/emu/machine/intelfsh.h
r243192r243193
8282#define MCFG_INTEL_28F320J3D_ADD(_tag) \
8383   MCFG_DEVICE_ADD(_tag, INTEL_28F320J3D, 0)
8484
85#define MCFG_INTEL_28F320J5_ADD(_tag) \
86   MCFG_DEVICE_ADD(_tag, INTEL_28F320J5, 0)
87
8885#define MCFG_SST_39VF400A_ADD(_tag) \
8986   MCFG_DEVICE_ADD(_tag, SST_39VF400A, 0)
9087
r243192r243193
131128      FLASH_INTEL_TE28F160,
132129      FLASH_SHARP_UNK128MBIT,
133130      FLASH_INTEL_28F320J3D,
134      FLASH_INTEL_28F320J5,
135131      FLASH_SST_39VF400A
136132   };
137133
r243192r243193
367363   intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
368364};
369365
370class intel_28f320j5_device : public intelfsh16_device
371{
372public:
373   intel_28f320j5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
374};
375
376366class sst_39vf400a_device : public intelfsh16_device
377367{
378368public:
r243192r243193
407397extern const device_type INTEL_TE28F160;
408398extern const device_type SHARP_UNK128MBIT;
409399extern const device_type INTEL_28F320J3D;
410extern const device_type INTEL_28F320J5;
411400extern const device_type SST_39VF400A;
412401
413402#endif
trunk/src/emu/machine/jvshost.c
r243192r243193
4949   // - have at least one command byte
5050   if(send_size < 3 || send_buffer[0] == 0x00 || send_buffer[1] != send_size-1) {
5151      logerror("JVS checksum error\n");
52   } /*
53        Naomi suchie3 have bad working controls with this
52      // "This message is crap" doesn't exist so call it checksum error
53      recv_buffer[0] = 0x00;
54      recv_buffer[1] = 0x02;
55      recv_buffer[2] = 0x03;
56      recv_size = 3;
5457
55        // "This message is crap" doesn't exist so call it checksum error
56        recv_buffer[0] = 0x00;
57        recv_buffer[1] = 0x02;
58        recv_buffer[2] = 0x03;
59        recv_size = 3;
60
61    } else */ {
58   } else {
6259      if(first_device) {
6360         first_device->message(send_buffer[0], send_buffer+2, send_size-2, recv_buffer+2, recv_size);
6461         recv_is_encoded = false;
trunk/src/emu/machine/netlist.c
r243192r243193
4848#include "netlist.h"
4949#include "netlist/nl_base.h"
5050#include "netlist/nl_setup.h"
51#include "netlist/nl_factory.h"
5251#include "netlist/devices/net_lib.h"
5352#include "debugger.h"
5453
r243192r243193
135134   pstring dname = "OUT_" + m_in;
136135   m_delegate.bind_relative_to(owner()->machine().root_device());
137136   NETLIB_NAME(analog_callback) *dev = downcast<NETLIB_NAME(analog_callback) *>(
138         setup.register_dev("nld_analog_callback", dname));
137         setup.factory().new_device_by_classname("nld_analog_callback", setup));
139138
139   setup.register_dev(dev, dname);
140140   dev->register_callback(m_delegate);
141141   setup.register_link(dname + ".IN", m_in);
142142}
r243192r243193
208208{
209209   NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device<NETLIB_NAME(sound_in)>();
210210   if (snd_in == NULL)
211      snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.register_dev("nld_sound_in", "STREAM_INPUT"));
211   {
212      snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.factory().new_device_by_classname("nld_sound_in", setup));
213      setup.register_dev(snd_in, "STREAM_INPUT");
214   }
212215
213216   pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel);
214217   setup.register_param(sparam, m_param_name);
r243192r243193
244247
245248void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &setup)
246249{
247   //NETLIB_NAME(sound_out) *snd_out;
250   NETLIB_NAME(sound_out) *snd_out;
248251   pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel);
249252
250   //snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname));
251   setup.register_dev("nld_sound_out", sname);
253   snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.factory().new_device_by_classname("nld_sound_out", setup));
254   setup.register_dev(snd_out, sname);
252255
253256   setup.register_param(sname + ".CHAN" , m_channel);
254257   setup.register_param(sname + ".MULT",  m_mult);
r243192r243193
440443               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
441444            }
442445            break;
443         case DT_FLOAT:
444            {
445               float *td = s->resolved<float>();
446               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
447            }
448            break;
449446         case DT_INT64:
450447            save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
451448            break;
trunk/src/emu/mame.c
r243192r243193
9494
9595osd_interface &machine_manager::osd() const
9696{
97   return m_osd;
97    return m_osd;
9898}
9999
100100
trunk/src/emu/memory.c
r243192r243193
18111811   m_map.reset(global_alloc(address_map(m_device, m_spacenum)));
18121812
18131813   // merge in the submaps
1814   m_map->uplift_submaps(machine(), m_device, m_device.owner() ? *m_device.owner() : m_device, endianness());
1814   m_map->uplift_submaps(machine(), m_device, *m_device.owner(), endianness());
18151815
18161816   // extract global parameters specified by the map
18171817   m_unmap = (m_map->m_unmapval == 0) ? 0 : ~0;
trunk/src/emu/netlist/analog/nld_bjt.c
r243192r243193
1111{
1212public:
1313   diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
14   diode(const nl_double Is, const nl_double n)
14   diode(const double Is, const double n)
1515   {
1616      m_Is = Is;
1717      m_VT = 0.0258 * n;
1818      m_VT_inv = 1.0 / m_VT;
1919   }
20   void set(const nl_double Is, const nl_double n)
20   void set(const double Is, const double n)
2121   {
2222      m_Is = Is;
2323      m_VT = 0.0258 * n;
2424      m_VT_inv = 1.0 / m_VT;
2525   }
26   nl_double I(const nl_double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
27   nl_double g(const nl_double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
28   nl_double V(const nl_double I) const { return log(1.0 + I / m_Is) * m_VT; }
29   nl_double gI(const nl_double I) const { return m_VT_inv * (I + m_Is); }
26   double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
27   double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
28   double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
29   double gI(const double I) const { return m_VT_inv * (I + m_Is); }
3030
3131private:
32   nl_double m_Is;
33   nl_double m_VT;
34   nl_double m_VT_inv;
32   double m_Is;
33   double m_VT;
34   double m_VT_inv;
3535};
3636
3737
r243192r243193
8585   m_state_on = 0;
8686
8787   {
88      nl_double IS = m_model.model_value("IS", 1e-15);
89      nl_double BF = m_model.model_value("BF", 100);
90      nl_double NF = m_model.model_value("NF", 1);
91      //nl_double VJE = m_model.dValue("VJE", 0.75);
88      double IS = m_model.model_value("IS", 1e-15);
89      double BF = m_model.model_value("BF", 100);
90      double NF = m_model.model_value("NF", 1);
91      //double VJE = m_model.dValue("VJE", 0.75);
9292
9393      set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP);
9494
95      nl_double alpha = BF / (1.0 + BF);
95      double alpha = BF / (1.0 + BF);
9696
9797      diode d(IS, NF);
9898
r243192r243193
155155   m_gD_BC.save("m_D_BC", *this);
156156
157157   {
158      nl_double IS = m_model.model_value("IS", 1e-15);
159      nl_double BF = m_model.model_value("BF", 100);
160      nl_double NF = m_model.model_value("NF", 1);
161      nl_double BR = m_model.model_value("BR", 1);
162      nl_double NR = m_model.model_value("NR", 1);
163      //nl_double VJE = m_model.dValue("VJE", 0.75);
158      double IS = m_model.model_value("IS", 1e-15);
159      double BF = m_model.model_value("BF", 100);
160      double NF = m_model.model_value("NF", 1);
161      double BR = m_model.model_value("BR", 1);
162      double NR = m_model.model_value("NR", 1);
163      //double VJE = m_model.dValue("VJE", 0.75);
164164
165165      set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP);
166166      //printf("type %s\n", m_model.model_type().cstr());
trunk/src/emu/netlist/analog/nld_bjt.h
r243192r243193
9898
9999   NETLIB_UPDATE_TERMINALS()
100100   {
101      const nl_double m = (is_qtype( BJT_NPN) ? 1 : -1);
101      const double m = (is_qtype( BJT_NPN) ? 1 : -1);
102102
103103      const int new_state = (m_RB.deltaV() * m > m_V ) ? 1 : 0;
104104      if (m_state_on ^ new_state)
105105      {
106106#if 0
107         nl_double gb = m_gB;
108         nl_double gc = m_gC;
109         nl_double v  = m_V * m;
107         double gb = m_gB;
108         double gc = m_gC;
109         double v  = m_V * m;
110110         if (!new_state )
111111         {
112112            // not conducting
r243192r243193
115115            gc = netlist().gmin();
116116         }
117117#else
118         const nl_double gb = new_state ? m_gB : netlist().gmin();
119         const nl_double gc = new_state ? m_gC : netlist().gmin();
120         const nl_double v  = new_state ? m_V * m : 0;
118         const double gb = new_state ? m_gB : netlist().gmin();
119         const double gc = new_state ? m_gC : netlist().gmin();
120         const double v  = new_state ? m_V * m : 0;
121121#endif
122122         m_RB.set(gb, v,   0.0);
123123         m_RC.set(gc, 0.0, 0.0);
r243192r243193
142142   ATTR_COLD virtual void start();
143143   ATTR_HOT void update_param();
144144
145   nl_double m_gB; // base conductance / switch on
146   nl_double m_gC; // collector conductance / switch on
147   nl_double m_V; // internal voltage source
145   double m_gB; // base conductance / switch on
146   double m_gC; // collector conductance / switch on
147   double m_V; // internal voltage source
148148   UINT8 m_state_on;
149149
150150private:
r243192r243193
169169
170170   NETLIB_UPDATE_TERMINALS()
171171   {
172      const nl_double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0);
172      const double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0);
173173
174174      m_gD_BE.update_diode(-m_D_EB.deltaV() * polarity);
175175      m_gD_BC.update_diode(-m_D_CB.deltaV() * polarity);
176176
177      const nl_double gee = m_gD_BE.G();
178      const nl_double gcc = m_gD_BC.G();
179      const nl_double gec =  m_alpha_r * gcc;
180      const nl_double gce =  m_alpha_f * gee;
181      const nl_double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I();
182      const nl_double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I();
183      const nl_double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity;
184      const nl_double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity;
177      const double gee = m_gD_BE.G();
178      const double gcc = m_gD_BC.G();
179      const double gec =  m_alpha_r * gcc;
180      const double gce =  m_alpha_f * gee;
181      const double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I();
182      const double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I();
183      const double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity;
184      const double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity;
185185
186186      m_D_EB.set_mat(gee, gec - gee, gce - gee, gee - gec, Ie, -Ie);
187187      m_D_CB.set_mat(gcc, gce - gcc, gec - gcc, gcc - gce, Ic, -Ic);
r243192r243193
202202   nld_twoterm m_D_EB;  // gee, gec - gee, gce - gee, gee - gec | Ie
203203   nld_twoterm m_D_EC;  // 0, -gec, -gcc, 0 | 0
204204
205   nl_double m_alpha_f;
206   nl_double m_alpha_r;
205   double m_alpha_f;
206   double m_alpha_r;
207207
208208private:
209209};
trunk/src/emu/netlist/analog/nld_fourterm.c
r243192r243193
1717   m_gfac = 1.0;
1818}
1919
20void NETLIB_NAME(VCCS)::start_internal(const nl_double def_RI)
20void NETLIB_NAME(VCCS)::start_internal(const double def_RI)
2121{
2222   register_param("G", m_G, 1.0);
2323   register_param("RI", m_RI, def_RI);
r243192r243193
4545
4646NETLIB_RESET(VCCS)
4747{
48   const nl_double m_mult = m_G.Value() * m_gfac; // 1.0 ==> 1V ==> 1A
49   const nl_double GI = 1.0 / m_RI.Value();
48   const double m_mult = m_G.Value() * m_gfac; // 1.0 ==> 1V ==> 1A
49   const double GI = 1.0 / m_RI.Value();
5050
5151   m_IP.set(GI);
5252   m_IN.set(GI);
trunk/src/emu/netlist/analog/nld_fourterm.h
r243192r243193
5959   ATTR_COLD virtual void update_param();
6060   ATTR_HOT ATTR_ALIGN void update();
6161
62   ATTR_COLD void start_internal(const nl_double def_RI);
62   ATTR_COLD void start_internal(const double def_RI);
6363
6464   netlist_terminal_t m_OP;
6565   netlist_terminal_t m_ON;
r243192r243193
7373   netlist_param_double_t m_G;
7474   netlist_param_double_t m_RI;
7575
76   nl_double m_gfac;
76   double m_gfac;
7777};
7878
7979// ----------------------------------------------------------------------------------------
r243192r243193
115115   ATTR_COLD virtual void update_param();
116116   ATTR_HOT ATTR_ALIGN void update();
117117
118   nl_double m_gfac;
118   double m_gfac;
119119};
120120
121121
trunk/src/emu/netlist/analog/nld_ms_direct.h
r243192r243193
1414public:
1515
1616   netlist_matrix_solver_direct_t(const netlist_solver_parameters_t &params, int size);
17   netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size);
17    netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size);
1818
1919   virtual ~netlist_matrix_solver_direct_t();
2020
r243192r243193
2828protected:
2929   ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term);
3030
31   ATTR_HOT virtual nl_double vsolve();
31   ATTR_HOT virtual double vsolve();
3232
3333   ATTR_HOT int solve_non_dynamic();
3434   ATTR_HOT void build_LE();
35   ATTR_HOT void gauss_LE(nl_double (* RESTRICT x));
36   ATTR_HOT nl_double delta(const nl_double (* RESTRICT V));
37   ATTR_HOT void store(const nl_double (* RESTRICT V), const bool store_RHS);
35   ATTR_HOT void gauss_LE(double (* RESTRICT x));
36   ATTR_HOT double delta(const double (* RESTRICT V));
37   ATTR_HOT void store(const double (* RESTRICT V), const bool store_RHS);
3838
3939   /* bring the whole system to the current time
4040    * Don't schedule a new calculation time. The recalculation has to be
4141    * triggered by the caller after the netlist element was changed.
4242    */
43   ATTR_HOT nl_double compute_next_timestep();
43   ATTR_HOT double compute_next_timestep();
4444
45   nl_double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
46   nl_double m_RHS[_storage_N];
47   nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
48   nl_double m_Vdelta[_storage_N];
49   nl_double m_last_V[_storage_N];
45   double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
46   double m_RHS[_storage_N];
47   double m_last_RHS[_storage_N]; // right hand side - contains currents
48   double m_Vdelta[_storage_N];
49   double m_last_V[_storage_N];
5050
5151   terms_t **m_terms;
5252   terms_t *m_rails_temp;
r243192r243193
5555   vector_ops_t *m_row_ops[_storage_N + 1];
5656
5757   int m_dim;
58   nl_double m_lp_fact;
58   double m_lp_fact;
5959};
6060
6161// ----------------------------------------------------------------------------------------
r243192r243193
6969   {
7070      //delete[] m_A[k];
7171   }
72   for (int k = 0; k < N(); k++)
73   {
74      nl_free(m_terms[k]);
75      nl_free(m_row_ops[k]);
76   }
77   nl_free(m_row_ops[N()]);
7872   //delete[] m_last_RHS;
7973   //delete[] m_RHS;
80   nl_free_array(m_terms);
81   nl_free_array(m_rails_temp);
74   delete[] m_terms;
75   delete[] m_rails_temp;
8276   //delete[] m_row_ops;
8377
8478}
8579
8680template <int m_N, int _storage_N>
87ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
81ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
8882{
89   nl_double new_solver_timestep = m_params.m_max_timestep;
83   double new_solver_timestep = m_params.m_max_timestep;
9084
9185   if (m_params.m_dynamic)
9286   {
r243192r243193
10397      {
10498         netlist_analog_net_t *n = m_nets[k];
10599#endif
106         const nl_double DD_n = (n->m_cur_Analog - m_last_V[k]);
107         const nl_double hn = current_timestep();
100         const double DD_n = (n->m_cur_Analog - m_last_V[k]);
101         const double hn = current_timestep();
108102
109         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);
110         nl_double new_net_timestep;
103         double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
104         double new_net_timestep;
111105
112106         n->m_h_n_m_1 = hn;
113107         n->m_DD_n_m_1 = DD_n;
r243192r243193
193187    * Sorting as a general matrix pre-conditioning is mentioned in
194188    * literature but I have found no articles about Gauss Seidel.
195189    *
196    * For Gaussian Elimination however increasing order is better suited.
197    * FIXME: Even better would be to sort on elements right of the matrix diagonal.
198    *
190     * For Gaussian Elimination however increasing order is better suited.
191     * FIXME: Even better would be to sort on elements right of the matrix diagonal.
192     *
199193    */
200194
201   int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
195    int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
202196
203197   for (int k = 0; k < N() / 2; k++)
204198      for (int i = 0; i < N() - 1; i++)
205199      {
206         if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
200            if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
207201         {
208202            std::swap(m_terms[i],m_terms[i+1]);
209203            m_nets.swap(i, i+1);
r243192r243193
236230      for (int i=0; i < N(); i++)
237231         m_A[k][i] = 0.0;
238232
239      nl_double rhsk = 0.0;
240      nl_double akk  = 0.0;
233      double rhsk = 0.0;
234      double akk  = 0.0;
241235      {
242236         const int terms_count = m_terms[k]->count();
243         const nl_double * RESTRICT gt = m_terms[k]->gt();
244         const nl_double * RESTRICT go = m_terms[k]->go();
245         const nl_double * RESTRICT Idr = m_terms[k]->Idr();
237         const double * RESTRICT gt = m_terms[k]->gt();
238         const double * RESTRICT go = m_terms[k]->go();
239         const double * RESTRICT Idr = m_terms[k]->Idr();
246240#if VECTALT
247241
248242         for (int i = 0; i < terms_count; i++)
r243192r243193
253247#else
254248         m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk);
255249#endif
256         nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
250         double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
257251         for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
258252         {
259253            //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
r243192r243193
272266      m_A[k][k] += 1.0;
273267      {
274268         const int *net_other = m_terms[k]->net_other();
275         const nl_double *go = m_terms[k]->go();
269         const double *go = m_terms[k]->go();
276270         const int railstart =  m_terms[k]->m_railstart;
277271
278272         for (int i = 0; i < railstart; i++)
r243192r243193
285279      m_A[k][k] += akk;
286280      {
287281         const int * RESTRICT net_other = m_terms[k]->net_other();
288         const nl_double * RESTRICT go = m_terms[k]->go();
282         const double * RESTRICT go = m_terms[k]->go();
289283         const int railstart =  m_terms[k]->m_railstart;
290284
291285         for (int i = 0; i < railstart; i++)
r243192r243193
299293
300294template <int m_N, int _storage_N>
301295ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE(
302      nl_double (* RESTRICT x))
296      double (* RESTRICT x))
303297{
304298#if 0
305299   for (int i = 0; i < N(); i++)
r243192r243193
336330      }
337331
338332      /* FIXME: Singular matrix? */
339      const nl_double f = 1.0 / m_A[i][i];
333      const double f = 1.0 / m_A[i][i];
340334
341335      /* Eliminate column i from row j */
342336
343337      for (int j = i + 1; j < kN; j++)
344338      {
345         const nl_double f1 = - m_A[j][i] * f;
339         const double f1 = - m_A[j][i] * f;
346340         if (f1 != 0.0)
347341         {
348342#if 0 && VECTALT
r243192r243193
359353   /* back substitution */
360354   for (int j = kN - 1; j >= 0; j--)
361355   {
362      nl_double tmp = 0;
356      double tmp = 0;
363357
364358      for (int k = j + 1; k < kN; k++)
365359         tmp += m_A[j][k] * x[k];
r243192r243193
380374}
381375
382376template <int m_N, int _storage_N>
383ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
384      const nl_double (* RESTRICT V))
377ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
378      const double (* RESTRICT V))
385379{
386   nl_double cerr = 0;
387   nl_double cerr2 = 0;
380   double cerr = 0;
381   double cerr2 = 0;
388382   for (int i = 0; i < this->N(); i++)
389383   {
390      const nl_double e = (V[i] - this->m_nets[i]->m_cur_Analog);
391      const nl_double e2 = (m_RHS[i] - this->m_last_RHS[i]);
384      const double e = (V[i] - this->m_nets[i]->m_cur_Analog);
385      const double e2 = (m_RHS[i] - this->m_last_RHS[i]);
392386      cerr = (fabs(e) > cerr ? fabs(e) : cerr);
393387      cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2);
394388   }
r243192r243193
398392
399393template <int m_N, int _storage_N>
400394ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store(
401      const nl_double (* RESTRICT V), const bool store_RHS)
395      const double (* RESTRICT V), const bool store_RHS)
402396{
403397   for (int i = 0; i < this->N(); i++)
404398   {
r243192r243193
414408}
415409
416410template <int m_N, int _storage_N>
417ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
411ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
418412{
419413   solve_base<netlist_matrix_solver_direct_t>(this);
420414   return this->compute_next_timestep();
r243192r243193
424418template <int m_N, int _storage_N>
425419ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic()
426420{
427   nl_double new_v[_storage_N] = { 0.0 };
421   double new_v[_storage_N] = { 0.0 };
428422
429423   this->gauss_LE(new_v);
430424
431425   if (this->is_dynamic())
432426   {
433      nl_double err = delta(new_v);
427      double err = delta(new_v);
434428
435429      store(new_v, true);
436430
r243192r243193
458452, m_dim(size)
459453, m_lp_fact(0)
460454{
461   m_terms = nl_alloc_array(terms_t *, N());
462   m_rails_temp = nl_alloc_array(terms_t, N());
455   m_terms = new terms_t *[N()];
456   m_rails_temp = new terms_t[N()];
463457
464458   for (int k = 0; k < N(); k++)
465459   {
466      m_terms[k] = nl_alloc(terms_t);
460      m_terms[k] = new terms_t;
467461      m_row_ops[k] = vector_ops_t::create_ops(k);
468462   }
469463   m_row_ops[N()] = vector_ops_t::create_ops(N());
r243192r243193
475469, m_dim(size)
476470, m_lp_fact(0)
477471{
478   m_terms = nl_alloc_array(terms_t *, N());
479   m_rails_temp = nl_alloc_array(terms_t, N());
472    m_terms = new terms_t *[N()];
473    m_rails_temp = new terms_t[N()];
480474
481   for (int k = 0; k < N(); k++)
482   {
483      m_terms[k] = nl_alloc(terms_t);
484      m_row_ops[k] = vector_ops_t::create_ops(k);
485   }
486   m_row_ops[N()] = vector_ops_t::create_ops(N());
475    for (int k = 0; k < N(); k++)
476    {
477        m_terms[k] = new terms_t;
478        m_row_ops[k] = vector_ops_t::create_ops(k);
479    }
480    m_row_ops[N()] = vector_ops_t::create_ops(N());
487481}
488482
489483
trunk/src/emu/netlist/analog/nld_ms_direct1.h
r243192r243193
1818      {}
1919   ATTR_HOT inline int vsolve_non_dynamic();
2020protected:
21   ATTR_HOT virtual nl_double vsolve();
21   ATTR_HOT virtual double vsolve();
2222private:
2323};
2424
r243192r243193
2626// netlist_matrix_solver - Direct1
2727// ----------------------------------------------------------------------------------------
2828
29ATTR_HOT nl_double netlist_matrix_solver_direct1_t::vsolve()
29ATTR_HOT double netlist_matrix_solver_direct1_t::vsolve()
3030{
3131   solve_base<netlist_matrix_solver_direct1_t>(this);
3232   return this->compute_next_timestep();
r243192r243193
3838   this->build_LE();
3939   //NL_VERBOSE_OUT(("%f %f\n", new_val, m_RHS[0] / m_A[0][0]);
4040
41   nl_double new_val =  m_RHS[0] / m_A[0][0];
41   double new_val =  m_RHS[0] / m_A[0][0];
4242
43   nl_double e = (new_val - net->m_cur_Analog);
44   nl_double cerr = fabs(e);
43   double e = (new_val - net->m_cur_Analog);
44   double cerr = fabs(e);
4545
4646   net->m_cur_Analog = new_val;
4747
trunk/src/emu/netlist/analog/nld_ms_direct2.h
r243192r243193
2020      {}
2121   ATTR_HOT inline int vsolve_non_dynamic();
2222protected:
23   ATTR_HOT virtual nl_double vsolve();
23   ATTR_HOT virtual double vsolve();
2424private:
2525};
2626
r243192r243193
2828// netlist_matrix_solver - Direct2
2929// ----------------------------------------------------------------------------------------
3030
31ATTR_HOT nl_double netlist_matrix_solver_direct2_t::vsolve()
31ATTR_HOT double netlist_matrix_solver_direct2_t::vsolve()
3232{
3333   solve_base<netlist_matrix_solver_direct2_t>(this);
3434   return this->compute_next_timestep();
r243192r243193
3838{
3939   build_LE();
4040
41   const nl_double a = m_A[0][0];
42   const nl_double b = m_A[0][1];
43   const nl_double c = m_A[1][0];
44   const nl_double d = m_A[1][1];
41   const double a = m_A[0][0];
42   const double b = m_A[0][1];
43   const double c = m_A[1][0];
44   const double d = m_A[1][1];
4545
46   nl_double new_val[2];
46   double new_val[2];
4747   new_val[1] = (a * m_RHS[1] - c * m_RHS[0]) / (a * d - b * c);
4848   new_val[0] = (m_RHS[0] - b * new_val[1]) / a;
4949
5050   if (is_dynamic())
5151   {
52      nl_double err = this->delta(new_val);
52      double err = this->delta(new_val);
5353      store(new_val, true);
5454      if (err > m_params.m_accuracy )
5555         return 2;
trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
r243192r243193
1717public:
1818
1919   netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t &params, int size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size)
2121      , m_lp_fact(0)
2222      , m_gs_fail(0)
2323      , m_gs_total(0)
24      {
25         const char *p = osd_getenv("NETLIST_STATS");
26         if (p != NULL)
27            m_log_stats = (bool) atoi(p);
28         else
29            m_log_stats = false;
30      }
24      {}
3125
3226   virtual ~netlist_matrix_solver_gauss_seidel_t() {}
3327
r243192r243193
3529
3630   ATTR_HOT inline int vsolve_non_dynamic();
3731protected:
38   ATTR_HOT virtual nl_double vsolve();
32   ATTR_HOT virtual double vsolve();
3933
4034private:
41   nl_double m_lp_fact;
35   double m_lp_fact;
4236   int m_gs_fail;
4337   int m_gs_total;
44   bool m_log_stats;
4538
4639};
4740
r243192r243193
5245template <int m_N, int _storage_N>
5346void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
5447{
55   if (this->m_stat_calculations != 0 && m_log_stats)
56   {
57      printf("==============================================\n");
58      printf("Solver %s\n", this->name().cstr());
59      printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
60      printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
61      printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
62      printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
63      printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
64            this->m_stat_calculations,
65            this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
66            this->m_gs_fail,
67            100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
68            (double) this->m_gs_total / (double) this->m_stat_calculations);
69   }
48#if 1
49    if (this->m_stat_calculations == 0)
50      return;
51   printf("==============================================\n");
52   printf("Solver %s\n", this->name().cstr());
53   printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
54   printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
55   printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
56    printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
57   printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
58            this->m_stat_calculations,
59            this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
60         this->m_gs_fail,
61            100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
62            (double) this->m_gs_total / (double) this->m_stat_calculations);
63#endif
7064}
7165
7266template <int m_N, int _storage_N>
73ATTR_HOT nl_double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
67ATTR_HOT double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
7468{
7569   /*
7670    * enable linear prediction on first newton pass
r243192r243193
9286
9387   if (USE_LINEAR_PREDICTION)
9488   {
95      nl_double sq = 0;
96      nl_double sqo = 0;
97      const nl_double rez_cts = 1.0 / this->current_timestep();
89      double sq = 0;
90      double sqo = 0;
91      const double rez_cts = 1.0 / this->current_timestep();
9892      for (int k = 0; k < this->N(); k++)
9993      {
10094         const netlist_analog_net_t *n = this->m_nets[k];
101         const nl_double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
95         const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
10296         sq += nv * nv;
10397         sqo += this->m_Vdelta[k] * this->m_Vdelta[k];
10498         this->m_Vdelta[k] = nv;
r243192r243193
122116    */
123117
124118#if 0 || USE_MATRIX_GS
125   static nl_double ws = 1.0;
126   ATTR_ALIGN nl_double new_v[_storage_N] = { 0.0 };
119   static double ws = 1.0;
120   ATTR_ALIGN double new_v[_storage_N] = { 0.0 };
127121   const int iN = this->N();
128122
129123   bool resched = false;
r243192r243193
133127   this->build_LE();
134128
135129   {
136      nl_double frob;
130      double frob;
137131      frob = 0;
138      nl_double rmin = 1e99, rmax = -1e99;
132      double rmin = 1e99, rmax = -1e99;
139133      for (int k = 0; k < iN; k++)
140134      {
141135         new_v[k] = this->m_nets[k]->m_cur_Analog;
142         nl_double s=0.0;
136         double s=0.0;
143137         for (int i = 0; i < iN; i++)
144138         {
145139            frob += this->m_A[k][i] * this->m_A[k][i];
r243192r243193
152146            rmax = s;
153147      }
154148#if 0
155      nl_double frobA = sqrt(frob /(iN));
149      double frobA = sqrt(frob /(iN));
156150      if (1 &&frobA < 1.0)
157151         //ws = 2.0 / (1.0 + sqrt(1.0-frobA));
158152         ws = 2.0 / (2.0 - frobA);
r243192r243193
167161      // overhead is bigger than the gain. Consequently the fast GS below
168162      // uses a fixed GS. One can however use this here to determine a
169163      // suitable parameter.
170      nl_double rm = (rmax + rmin) * 0.5;
164      double rm = (rmax + rmin) * 0.5;
171165      if (rm < 1.0)
172166         ws = 2.0 / (1.0 + sqrt(1.0-rm));
173167      else
r243192r243193
178172   }
179173
180174   // Frobenius norm for (D-L)^(-1)U
181   //nl_double frobU;
182   //nl_double frobL;
183   //nl_double norm;
175   //double frobU;
176   //double frobL;
177   //double norm;
184178   do {
185179      resched = false;
186      nl_double cerr = 0.0;
180      double cerr = 0.0;
187181      //frobU = 0;
188182      //frobL = 0;
189183      //norm = 0;
190184
191185      for (int k = 0; k < iN; k++)
192186      {
193         nl_double Idrive = 0;
194         //nl_double norm_t = 0;
187         double Idrive = 0;
188         //double norm_t = 0;
195189         // Reduction loops need -ffast-math
196190         for (int i = 0; i < iN; i++)
197191            Idrive += this->m_A[k][i] * new_v[i];
r243192r243193
204198         }
205199
206200         //if (norm_t > norm) norm = norm_t;
207         const nl_double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k];
201         const double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k];
208202
209         const nl_double e = fabs(new_val - new_v[k]);
203         const double e = fabs(new_val - new_v[k]);
210204         cerr = (e > cerr ? e : cerr);
211205         new_v[k] = new_val;
212206      }
r243192r243193
216210         resched = true;
217211      }
218212      resched_cnt++;
219      //ATTR_UNUSED nl_double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
213      //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
220214   } while (resched && (resched_cnt < this->m_params.m_gs_loops));
221215   //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm);
222216   //printf("Omega Estimate1 %f %f\n", 2.0 / (1.0 + sqrt(1-frobUL)), 2.0 / (1.0 + sqrt(1-frobA)) ); //        printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) ));
r243192r243193
253247    * omega = 2.0 / (1.0 + sqrt(1-rho))
254248    */
255249
256   const nl_double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1)));
257   //const nl_double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N())));
250   const double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1)));
251   //const double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N())));
258252
259   ATTR_ALIGN nl_double w[_storage_N];
260   ATTR_ALIGN nl_double one_m_w[_storage_N];
261   ATTR_ALIGN nl_double RHS[_storage_N];
262   ATTR_ALIGN nl_double new_V[_storage_N];
253   ATTR_ALIGN double w[_storage_N];
254   ATTR_ALIGN double one_m_w[_storage_N];
255   ATTR_ALIGN double RHS[_storage_N];
256   ATTR_ALIGN double new_V[_storage_N];
263257
264258   for (int k = 0; k < iN; k++)
265259   {
266      nl_double gtot_t = 0.0;
267      nl_double gabs_t = 0.0;
268      nl_double RHS_t = 0.0;
260      double gtot_t = 0.0;
261      double gabs_t = 0.0;
262      double RHS_t = 0.0;
269263
270264      new_V[k] = this->m_nets[k]->m_cur_Analog;
271265
272266      {
273267         const int term_count = this->m_terms[k]->count();
274         const nl_double * const RESTRICT gt = this->m_terms[k]->gt();
275         const nl_double * const RESTRICT go = this->m_terms[k]->go();
276         const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr();
277         const nl_double * const *other_cur_analog = this->m_terms[k]->other_curanalog();
268         const double * const RESTRICT gt = this->m_terms[k]->gt();
269         const double * const RESTRICT go = this->m_terms[k]->go();
270         const double * const RESTRICT Idr = this->m_terms[k]->Idr();
271         const double * const *other_cur_analog = this->m_terms[k]->other_curanalog();
278272#if VECTALT
279273         for (int i = 0; i < term_count; i++)
280274         {
r243192r243193
299293      //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20)
300294      //    printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t);
301295
302      gabs_t *= 0.95; // avoid rounding issues
296        gabs_t *= 0.95; // avoid rounding issues
303297      if (!USE_GABS || gabs_t <= gtot_t)
304298      {
305299         w[k] = ws / gtot_t;
r243192r243193
314308
315309   }
316310
317   const nl_double accuracy = this->m_params.m_accuracy;
311   const double accuracy = this->m_params.m_accuracy;
318312
319313   do {
320314      resched = false;
r243192r243193
323317      {
324318         const int * RESTRICT net_other = this->m_terms[k]->net_other();
325319         const int railstart = this->m_terms[k]->m_railstart;
326         const nl_double * RESTRICT go = this->m_terms[k]->go();
320         const double * RESTRICT go = this->m_terms[k]->go();
327321
328         nl_double Idrive = 0.0;
322         double Idrive = 0.0;
329323         for (int i = 0; i < railstart; i++)
330324            Idrive = Idrive + go[i] * new_V[net_other[i]];
331325
332         //nl_double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]);
333         const nl_double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k];
326         //double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]);
327         const double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k];
334328
335329         resched = resched || (std::abs(new_val - new_V[k]) > accuracy);
336330         new_V[k] = new_val;
r243192r243193
343337      this->m_nets[k]->m_cur_Analog = new_V[k];
344338
345339   this->m_gs_total += resched_cnt;
346   this->m_stat_calculations++;
340    this->m_stat_calculations++;
347341
348342   if (resched)
349343   {
trunk/src/emu/netlist/analog/nld_opamps.c
r243192r243193
3131   NET_C(R1.2, R2.2, G1.ON)
3232   VCVS(G1)
3333   PARAM(G1.G, 10000000)
34   //PARAM(G1.RI, 1)
34    //PARAM(G1.RI, 1)
3535   PARAM(G1.RO, RES_K(8))
3636
3737NETLIST_END()
trunk/src/emu/netlist/analog/nld_solver.c
r243192r243193
4444   switch (size)
4545   {
4646      case 1:
47         return nl_alloc(vector_ops_impl_t<1>);
47         return new vector_ops_impl_t<1>();
4848      case 2:
49         return nl_alloc(vector_ops_impl_t<2>);
49         return new vector_ops_impl_t<2>();
5050      case 3:
51         return nl_alloc(vector_ops_impl_t<3>);
51         return new vector_ops_impl_t<3>();
5252      case 4:
53         return nl_alloc(vector_ops_impl_t<4>);
53         return new vector_ops_impl_t<4>();
5454      case 5:
55         return nl_alloc(vector_ops_impl_t<5>);
55         return new vector_ops_impl_t<5>();
5656      case 6:
57         return nl_alloc(vector_ops_impl_t<6>);
57         return new vector_ops_impl_t<6>();
5858      case 7:
59         return nl_alloc(vector_ops_impl_t<7>);
59         return new vector_ops_impl_t<7>();
6060      case 8:
61         return nl_alloc(vector_ops_impl_t<8>);
61         return new vector_ops_impl_t<8>();
6262      case 9:
63         return nl_alloc(vector_ops_impl_t<9>);
63         return new vector_ops_impl_t<9>();
6464      case 10:
65         return nl_alloc(vector_ops_impl_t<10>);
65         return new vector_ops_impl_t<10>();
6666      case 11:
67         return nl_alloc(vector_ops_impl_t<11>);
67         return new vector_ops_impl_t<11>();
6868      case 12:
69         return nl_alloc(vector_ops_impl_t<12>);
69         return new vector_ops_impl_t<12>();
7070      default:
71         return nl_alloc(vector_ops_impl_t<0>, size);
71         return new vector_ops_impl_t<0>(size);
7272   }
7373}
7474
r243192r243193
9191      m_term[i]->m_Idr1 = &m_Idr[i];
9292      m_other_curanalog[i] = &m_term[i]->m_otherterm->net().as_analog().m_cur_Analog;
9393   }
94
95   m_ops = vector_ops_t::create_ops(m_gt.count());
9496}
9597
9698// ----------------------------------------------------------------------------------------
r243192r243193
99101
100102ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params)
101103: m_stat_calculations(0),
102   m_stat_newton_raphson(0),
103   m_stat_vsolver_calls(0),
104   m_params(params),
105   m_cur_ts(0),
106   m_type(type)
104  m_stat_newton_raphson(0),
105  m_stat_vsolver_calls(0),
106 m_params(params),
107 m_cur_ts(0),
108 m_type(type)
107109{
108110}
109111
110112ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t()
111113{
112114   for (int i = 0; i < m_inps.count(); i++)
113      global_free(m_inps[i]);
115      delete m_inps[i];
114116}
115117
116118ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets)
r243192r243193
174176
175177                  if (net_proxy_output == NULL)
176178                  {
177                     net_proxy_output = nl_alloc(netlist_analog_output_t);
179                     net_proxy_output = new netlist_analog_output_t();
178180                     net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
179181                     m_inps.add(net_proxy_output);
180182                     net_proxy_output->m_proxied_net = &p->net().as_analog();
r243192r243193
233235
234236ATTR_COLD void netlist_matrix_solver_t::update()
235237{
236   const nl_double new_timestep = solve();
238   const double new_timestep = solve();
237239
238240   if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
239241      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
r243192r243193
241243
242244ATTR_COLD void netlist_matrix_solver_t::update_forced()
243245{
244   ATTR_UNUSED const nl_double new_timestep = solve();
246   ATTR_UNUSED const double new_timestep = solve();
245247
246248   if (m_params.m_dynamic && is_timestep())
247249      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
r243192r243193
249251
250252ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
251253{
252   const nl_double dd = delta.as_double();
254   const double dd = delta.as_double();
253255   for (int k=0; k < m_step_devices.count(); k++)
254256      m_step_devices[k]->step_time(dd);
255257}
r243192r243193
257259template<class C >
258260void netlist_matrix_solver_t::solve_base(C *p)
259261{
260   m_stat_vsolver_calls++;
262    m_stat_vsolver_calls++;
261263   if (is_dynamic())
262264   {
263265      int this_resched;
r243192r243193
270272         newton_loops++;
271273      } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
272274
273      m_stat_newton_raphson += newton_loops;
275        m_stat_newton_raphson += newton_loops;
274276      // reschedule ....
275277      if (this_resched > 1 && !m_Q_sync.net().is_queued())
276278      {
r243192r243193
284286   }
285287}
286288
287ATTR_HOT nl_double netlist_matrix_solver_t::solve()
289ATTR_HOT double netlist_matrix_solver_t::solve()
288290{
289291   netlist_time now = netlist().time();
290292   netlist_time delta = now - m_last_step;
r243192r243193
300302
301303   step(delta);
302304
303   const nl_double next_time_step = vsolve();
305   const double next_time_step = vsolve();
304306
305307   update_inputs();
306308   return next_time_step;
r243192r243193
348350   register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
349351   register_param("DYNAMIC_TS", m_dynamic, 0);
350352   register_param("LTE", m_lte, 5e-5);                     // diff/timestep
351   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // nl_double timestep resolution
353   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // double timestep resolution
352354
353355   // internal staff
354356
r243192r243193
378380   while (e != NULL)
379381   {
380382      netlist_matrix_solver_t * const *en = m_mat_solvers.next(e);
381      global_free(*e);
383      delete *e;
382384      e = en;
383385   }
384386
r243192r243193
417419      if (m_mat_solvers[i]->is_timestep())
418420         {
419421            // Ignore return value
420            ATTR_UNUSED const nl_double ts = m_mat_solvers[i]->solve();
422            ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
421423         }
422424   }
423425#endif
r243192r243193
433435netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific)
434436{
435437   if (use_specific && m_N == 1)
436      return nl_alloc(netlist_matrix_solver_direct1_t, m_params);
438      return new netlist_matrix_solver_direct1_t(m_params);
437439   else if (use_specific && m_N == 2)
438      return nl_alloc(netlist_matrix_solver_direct2_t, m_params);
440      return new netlist_matrix_solver_direct2_t(m_params);
439441   else
440442   {
441      typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N;
442443      if (size >= gs_threshold)
443         return nl_alloc(solver_N, m_params, size);
444         return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size);
444445      else
445         return nl_alloc(solver_N, m_params, size);
446         return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size);
446447   }
447448}
448449
trunk/src/emu/netlist/analog/nld_solver.h
r243192r243193
3737
3838struct netlist_solver_parameters_t
3939{
40   nl_double m_accuracy;
41   nl_double m_lte;
42   nl_double m_min_timestep;
43   nl_double m_max_timestep;
44   nl_double m_sor;
40   double m_accuracy;
41   double m_lte;
42   double m_min_timestep;
43   double m_max_timestep;
44   double m_sor;
4545   bool m_dynamic;
4646   int m_gs_loops;
4747   int m_nr_loops;
r243192r243193
5959
6060   virtual ~vector_ops_t() {}
6161
62   virtual const nl_double sum(const nl_double * v) = 0;
63   virtual void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT  s1, nl_double & RESTRICT s2) = 0;
64   virtual void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) = 0;
65   virtual void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) = 0;
62   virtual const double sum(const double * v) = 0;
63   virtual void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT  s1, double & RESTRICT s2) = 0;
64   virtual void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) = 0;
65   virtual void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) = 0;
6666
67   virtual const nl_double sumabs(const nl_double * v) = 0;
67   virtual const double sumabs(const double * v) = 0;
6868
6969   static vector_ops_t *create_ops(const int size);
7070
r243192r243193
9595
9696   ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; }
9797
98   const nl_double sum(const nl_double * v)
98   const double sum(const double * v)
9999   {
100      const nl_double *  RESTRICT vl = v;
101      nl_double tmp = 0.0;
100      const double *  RESTRICT vl = v;
101      double tmp = 0.0;
102102      for (int i=0; i < N(); i++)
103103         tmp += vl[i];
104104      return tmp;
105105   }
106106
107   void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2)
107   void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2)
108108   {
109      const nl_double * RESTRICT v1l = v1;
110      const nl_double * RESTRICT v2l = v2;
109      const double * RESTRICT v1l = v1;
110      const double * RESTRICT v2l = v2;
111111      for (int i=0; i < N(); i++)
112112      {
113113         s1 += v1l[i];
r243192r243193
115115      }
116116   }
117117
118   void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult)
118   void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult)
119119   {
120      nl_double * RESTRICT v1l = v1;
121      const nl_double * RESTRICT v2l = v2;
120      double * RESTRICT v1l = v1;
121      const double * RESTRICT v2l = v2;
122122      for (int i=0; i < N(); i++)
123123      {
124124         v1l[i] += v2l[i] * mult;
125125      }
126126   }
127127
128   void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs)
128   void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs)
129129   {
130      const nl_double * RESTRICT v1l = v1;
131      const nl_double * RESTRICT v2l = v2;
132      const nl_double * RESTRICT v3l = v3abs;
130      const double * RESTRICT v1l = v1;
131      const double * RESTRICT v2l = v2;
132      const double * RESTRICT v3l = v3abs;
133133      for (int i=0; i < N(); i++)
134134      {
135135         s1 += v1l[i];
r243192r243193
138138      }
139139   }
140140
141   const nl_double sumabs(const nl_double * v)
141   const double sumabs(const double * v)
142142   {
143      const nl_double * RESTRICT vl = v;
144      nl_double tmp = 0.0;
143      const double * RESTRICT vl = v;
144      double tmp = 0.0;
145145      for (int i=0; i < N(); i++)
146146         tmp += fabs(vl[i]);
147147      return tmp;
r243192r243193
155155   NETLIST_PREVENT_COPYING(terms_t)
156156
157157   public:
158   ATTR_COLD terms_t() : m_railstart(0)
158   ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL)
159159   {}
160160
161161   ATTR_COLD void clear()
r243192r243193
171171
172172   ATTR_HOT inline netlist_terminal_t **terms() { return m_term; }
173173   ATTR_HOT inline int *net_other() { return m_net_other; }
174   ATTR_HOT inline nl_double *gt() { return m_gt; }
175   ATTR_HOT inline nl_double *go() { return m_go; }
176   ATTR_HOT inline nl_double *Idr() { return m_Idr; }
177   ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog; }
174   ATTR_HOT inline double *gt() { return m_gt; }
175   ATTR_HOT inline double *go() { return m_go; }
176   ATTR_HOT inline double *Idr() { return m_Idr; }
177   ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; }
178   ATTR_HOT vector_ops_t *ops() { return m_ops; }
178179
179180   ATTR_COLD void set_pointers();
180181
r243192r243193
183184private:
184185   plinearlist_t<netlist_terminal_t *> m_term;
185186   plinearlist_t<int> m_net_other;
186   plinearlist_t<nl_double> m_go;
187   plinearlist_t<nl_double> m_gt;
188   plinearlist_t<nl_double> m_Idr;
189   plinearlist_t<nl_double *> m_other_curanalog;
187   plinearlist_t<double> m_go;
188   plinearlist_t<double> m_gt;
189   plinearlist_t<double> m_Idr;
190   plinearlist_t<double *> m_other_curanalog;
191   vector_ops_t * m_ops;
190192};
191193
192194class netlist_matrix_solver_t : public netlist_device_t
r243192r243193
197199
198200   enum eSolverType
199201   {
200      GAUSSIAN_ELIMINATION,
201      GAUSS_SEIDEL
202       GAUSSIAN_ELIMINATION,
203       GAUSS_SEIDEL
202204   };
203205
204206   ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params);
r243192r243193
209211   template<class C>
210212   void solve_base(C *p);
211213
212   ATTR_HOT nl_double solve();
214   ATTR_HOT double solve();
213215
214216   ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; }
215217   ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; }
r243192r243193
236238   ATTR_HOT void update_dynamic();
237239
238240   // should return next time step
239   ATTR_HOT virtual nl_double vsolve() = 0;
241   ATTR_HOT virtual double vsolve() = 0;
240242
241243   ATTR_COLD virtual void  add_term(int net_idx, netlist_terminal_t *term) = 0;
242244
243245   plinearlist_t<netlist_analog_net_t *> m_nets;
244246   plinearlist_t<netlist_analog_output_t *> m_inps;
245247
246   int m_stat_calculations;
247   int m_stat_newton_raphson;
248   int m_stat_vsolver_calls;
248    int m_stat_calculations;
249    int m_stat_newton_raphson;
250    int m_stat_vsolver_calls;
249251
250252   const netlist_solver_parameters_t &m_params;
251253
252   ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; }
254   ATTR_HOT inline const double current_timestep() { return m_cur_ts; }
253255private:
254256
255257   netlist_time m_last_step;
256   nl_double m_cur_ts;
258   double m_cur_ts;
257259   dev_list_t m_step_devices;
258260   dev_list_t m_dynamic_devices;
259261
r243192r243193
264266
265267   ATTR_HOT void update_inputs();
266268
267   const eSolverType m_type;
269    const eSolverType m_type;
268270};
269271
270272
r243192r243193
279281
280282   ATTR_COLD void post_start();
281283
282   ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); }
284   ATTR_HOT inline double gmin() { return m_gmin.Value(); }
283285
284286protected:
285287   ATTR_HOT void update();
trunk/src/emu/netlist/analog/nld_twoterm.c
r243192r243193
1616   set_param(1e-15, 1, 1e-15);
1717}
1818
19ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin)
19ATTR_COLD void netlist_generic_diode::set_param(const double Is, const double n, double gmin)
2020{
2121   m_Is = Is;
2222   m_n = n;
r243192r243193
157157
158158NETLIB_UPDATE_PARAM(POT)
159159{
160   nl_double v = m_Dial.Value();
160   double v = m_Dial.Value();
161161   if (m_DialIsLog.Value())
162162      v = (exp(v) - 1.0) / (exp(1.0) - 1.0);
163163
r243192r243193
221221
222222NETLIB_UPDATE_PARAM(D)
223223{
224   nl_double Is = m_model.model_value("Is", 1e-15);
225   nl_double n = m_model.model_value("N", 1);
224   double Is = m_model.model_value("Is", 1e-15);
225   double n = m_model.model_value("N", 1);
226226
227227   m_D.set_param(Is, n, netlist().gmin());
228228}
trunk/src/emu/netlist/analog/nld_twoterm.h
r243192r243193
9797   {
9898   }
9999
100   ATTR_HOT inline void set(const nl_double G, const nl_double V, const nl_double I)
100   ATTR_HOT inline void set(const double G, const double V, const double I)
101101   {
102102      /*      GO, GT, I                */
103103      m_P.set( G,  G, (  V) * G - I);
104104      m_N.set( G,  G, ( -V) * G + I);
105105   }
106106
107   ATTR_HOT inline nl_double deltaV() const
107   ATTR_HOT inline double deltaV() const
108108   {
109109      return m_P.net().as_analog().Q_Analog() - m_N.net().as_analog().Q_Analog();
110110   }
111111
112   ATTR_HOT void set_mat(nl_double a11, nl_double a12, nl_double a21, nl_double a22, nl_double r1, nl_double r2)
112   ATTR_HOT void set_mat(double a11, double a12, double a21, double a22, double r1, double r2)
113113   {
114114      /*      GO, GT, I                */
115115      m_P.set(-a12, a11, -r1);
r243192r243193
133133public:
134134   ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
135135
136   inline void set_R(const nl_double R)
136   inline void set_R(const double R)
137137   {
138138      set(1.0 / R, 0.0, 0.0);
139139   }
r243192r243193
171171public:
172172   ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
173173
174   ATTR_HOT void step_time(const nl_double st)
174   ATTR_HOT void step_time(const double st)
175175   {
176      const nl_double G = m_C.Value() / st;
177      const nl_double I = -G * deltaV();
176      const double G = m_C.Value() / st;
177      const double I = -G * deltaV();
178178      set(G, 0.0, I);
179179   }
180180
r243192r243193
198198public:
199199   ATTR_COLD netlist_generic_diode();
200200
201   ATTR_HOT inline void update_diode(const nl_double nVd)
201   ATTR_HOT inline void update_diode(const double nVd)
202202   {
203203      //FIXME: Optimize cutoff case
204204
r243192r243193
212212      {
213213         m_Vd = nVd;
214214
215         const nl_double eVDVt = exp(m_Vd * m_VtInv);
215         const double eVDVt = exp(m_Vd * m_VtInv);
216216         m_Id = m_Is * (eVDVt - 1.0);
217217         m_G = m_Is * m_VtInv * eVDVt + m_gmin;
218218      }
r243192r243193
221221#if defined(_MSC_VER) && _MSC_VER < 1800
222222         m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
223223#else
224         nl_double a = (nVd - m_Vd) * m_VtInv;
224         double a = (nVd - m_Vd) * m_VtInv;
225225         if (a<1e-12 - 1.0) a = 1e-12 - 1.0;
226226         m_Vd = m_Vd + log1p(a) * m_Vt;
227227#endif
228         const nl_double eVDVt = exp(m_Vd * m_VtInv);
228         const double eVDVt = exp(m_Vd * m_VtInv);
229229         m_Id = m_Is * (eVDVt - 1.0);
230230
231231         m_G = m_Is * m_VtInv * eVDVt + m_gmin;
r243192r243193
234234      //printf("nVd %f m_Vd %f Vcrit %f\n", nVd, m_Vd, m_Vcrit);
235235   }
236236
237   ATTR_COLD void set_param(const nl_double Is, const nl_double n, nl_double gmin);
237   ATTR_COLD void set_param(const double Is, const double n, double gmin);
238238
239   ATTR_HOT inline nl_double I() const { return m_Id; }
240   ATTR_HOT inline nl_double G() const { return m_G; }
241   ATTR_HOT inline nl_double Ieq() const { return (m_Id - m_Vd * m_G); }
242   ATTR_HOT inline nl_double Vd() const { return m_Vd; }
239   ATTR_HOT inline double I() const { return m_Id; }
240   ATTR_HOT inline double G() const { return m_G; }
241   ATTR_HOT inline double Ieq() const { return (m_Id - m_Vd * m_G); }
242   ATTR_HOT inline double Vd() const { return m_Vd; }
243243
244244   /* owning object must save those ... */
245245
246246   ATTR_COLD void save(pstring name, netlist_object_t &parent);
247247
248248private:
249   nl_double m_Vd;
250   nl_double m_Id;
251   nl_double m_G;
249   double m_Vd;
250   double m_Id;
251   double m_G;
252252
253   nl_double m_Vt;
254   nl_double m_Is;
255   nl_double m_n;
256   nl_double m_gmin;
253   double m_Vt;
254   double m_Is;
255   double m_n;
256   double m_gmin;
257257
258   nl_double m_VtInv;
259   nl_double m_Vcrit;
258   double m_VtInv;
259   double m_Vcrit;
260260};
261261
262262// ----------------------------------------------------------------------------------------
r243192r243193
268268// add c3 and it'll be better than 1%
269269
270270#if 0
271inline nl_double fastexp_h(const nl_double x)
271inline double fastexp_h(const double x)
272272{
273   static const nl_double ln2r = 1.442695040888963387;
274   static const nl_double ln2  = 0.693147180559945286;
275   //static const nl_double c3   = 0.166666666666666667;
273   static const double ln2r = 1.442695040888963387;
274   static const double ln2  = 0.693147180559945286;
275   //static const double c3   = 0.166666666666666667;
276276
277   const nl_double y = x * ln2r;
277   const double y = x * ln2r;
278278   const unsigned int t = y;
279   const nl_double z = (x - ln2 * (double) t);
280   const nl_double zz = z * z;
281   //const nl_double zzz = zz * z;
279   const double z = (x - ln2 * (double) t);
280   const double zz = z * z;
281   //const double zzz = zz * z;
282282
283283   return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
284284}
285285
286inline nl_double fastexp(const nl_double x)
286inline double fastexp(const double x)
287287{
288288   if (x<0)
289289      return 1.0 / fastexp_h(-x);
trunk/src/emu/netlist/devices/net_lib.c
r243192r243193
4949
5050#include "net_lib.h"
5151#include "nld_system.h"
52#include "../nl_factory.h"
5352
5453NETLIST_START(diode_models)
5554   NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
r243192r243193
6564
6665
6766#define xstr(s) # s
68#define ENTRY1(_nic, _name, _defparam) factory.register_device<_nic>( # _name, xstr(_nic), _defparam );
67#define ENTRY1(_nic, _name, _defparam) register_device<_nic>( # _name, xstr(_nic), _defparam );
6968#define ENTRY(_nic, _name, _defparam) ENTRY1(NETLIB_NAME(_nic), _name, _defparam)
7069
71void nl_initialize_factory(netlist_factory_t &factory)
70netlist_factory_t::netlist_factory_t()
7271{
72}
73
74netlist_factory_t::~netlist_factory_t()
75{
76   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
77   {
78      net_device_t_base_factory *p = *e;
79      delete p;
80   }
81   m_list.clear();
82}
83
84void netlist_factory_t::initialize()
85{
7386   ENTRY(R,                    RES,                    "R")
7487   ENTRY(POT,                  POT,                    "R")
7588   ENTRY(C,                    CAP,                    "C")
r243192r243193
7891   ENTRY(VCCS,                 VCCS,                   "-")
7992   ENTRY(CCCS,                 CCCS,                   "-")
8093   ENTRY(dummy_input,          DUMMY_INPUT,            "-")
81   ENTRY(frontier,             FRONTIER,               "+I,Q")
94    ENTRY(frontier,             FRONTIER,               "+I,Q")
8295   ENTRY(QBJT_EB,              QBJT_EB,                "model")
8396   ENTRY(QBJT_switch,          QBJT_SW,                "model")
8497   ENTRY(ttl_input,            TTL_INPUT,              "IN")
r243192r243193
148161   ENTRY(SN74LS629_dip,        SN74LS629_DIP,          "1.CAP1,2.CAP2")
149162   ENTRY(NE555_dip,            NE555_DIP,              "-")
150163}
164
165netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const
166{
167   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
168   {
169      net_device_t_base_factory *p = *e;
170      if (strcmp(p->classname(), classname) == 0)
171      {
172         netlist_device_t *ret = p->Create();
173         return ret;
174      }
175      p++;
176   }
177   setup.netlist().error("Class %s not found!\n", classname.cstr());
178   return NULL; // appease code analysis
179}
180
181netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
182{
183   net_device_t_base_factory *f = factory_by_name(name, setup);
184   return f->Create();
185}
186
187net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const
188{
189   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
190   {
191      net_device_t_base_factory *p = *e;
192      if (strcmp(p->name(), name) == 0)
193      {
194         return p;
195      }
196      p++;
197   }
198   setup.netlist().error("Class %s not found!\n", name.cstr());
199   return NULL; // appease code analysis
200}
trunk/src/emu/netlist/devices/net_lib.h
r243192r243193
9999NETLIST_EXTERNAL(diode_models);
100100NETLIST_EXTERNAL(bjt_models);
101101
102void nl_initialize_factory(netlist_factory_t &factory);
103
104102#endif
trunk/src/emu/netlist/devices/nld_4020.c
r243192r243193
4343   register_output("Q5", m_Q[4]);
4444   register_output("Q6", m_Q[5]);
4545   register_output("Q7", m_Q[6]);
46   register_output("Q8", m_Q[7]);
46    register_output("Q8", m_Q[7]);
4747   register_output("Q9", m_Q[8]);
4848   register_output("Q10", m_Q[9]);
4949   register_output("Q11", m_Q[10]);
r243192r243193
125125   register_subalias("7", sub.m_Q[3]);
126126   register_subalias("8", m_supply.m_vss);
127127
128   register_subalias("9", sub.m_Q[0]);
128   register_subalias("9", sub.m_Q[1]);
129129   register_subalias("10", sub.m_IP);
130130   register_subalias("11", m_RESET);
131131   register_subalias("12", sub.m_Q[8]);
trunk/src/emu/netlist/devices/nld_4066.c
r243192r243193
1919
2020NETLIB_UPDATE(4066)
2121{
22   nl_double sup = (m_supply.get()->vdd() - m_supply.get()->vss());
23   nl_double low = 0.45 * sup;
24   nl_double high = 0.55 * sup;
25   nl_double in = INPANALOG(m_control) - m_supply.get()->vss();
26   nl_double rON = 270.0 * 5.0 / sup;
22   double sup = (m_supply.get()->vdd() - m_supply.get()->vss());
23   double low = 0.45 * sup;
24   double high = 0.55 * sup;
25   double in = INPANALOG(m_control) - m_supply.get()->vss();
26   double rON = 270.0 * 5.0 / sup;
2727
2828   if (in < low)
2929   {
r243192r243193
5353   register_subalias("4", m_B.m_R.m_N);
5454   register_subalias("5", m_B.m_control);
5555   register_subalias("6", m_C.m_control);
56   register_subalias("7", m_supply.m_vss);
56   register_input("7", m_supply.m_vss);
5757
5858   register_subalias("8", m_C.m_R.m_P);
5959   register_subalias("9", m_C.m_R.m_N);
r243192r243193
6161   register_subalias("11", m_D.m_R.m_N);
6262   register_subalias("12", m_D.m_control);
6363   register_subalias("13", m_A.m_control);
64   register_subalias("14", m_supply.m_vdd);
64   register_input("14", m_supply.m_vdd);
6565
6666}
6767
trunk/src/emu/netlist/devices/nld_74123.c
r243192r243193
6969
7070   if (m_state == 1)
7171   {
72      const nl_double vLow = m_KP * TERMANALOG(m_RP.m_P);
72      const double vLow = m_KP * TERMANALOG(m_RP.m_P);
7373      if (INPANALOG(m_CV) < vLow)
7474      {
7575         m_RN.set_R(R_OFF);
r243192r243193
7878   }
7979   else if (m_state == 2)
8080   {
81      const nl_double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
81      const double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
8282      if (INPANALOG(m_CV) > vHigh)
8383      {
8484         m_RP.set_R(R_OFF);
trunk/src/emu/netlist/devices/nld_74ls629.c
r243192r243193
104104{
105105   {
106106      // recompute
107      nl_double  freq;
108      nl_double  v_freq_2, v_freq_3, v_freq_4;
109      nl_double  v_freq = INPANALOG(m_FC);
110      nl_double  v_rng = INPANALOG(m_RNG);
107      double  freq;
108      double  v_freq_2, v_freq_3, v_freq_4;
109      double  v_freq = INPANALOG(m_FC);
110      double  v_rng = INPANALOG(m_RNG);
111111
112112      /* coefficients */
113      const nl_double k1 = 1.9904769024796283E+03;
114      const nl_double k2 = 1.2070059213983407E+03;
115      const nl_double k3 = 1.3266985579561108E+03;
116      const nl_double k4 = -1.5500979825922698E+02;
117      const nl_double k5 = 2.8184536266938172E+00;
118      const nl_double k6 = -2.3503421582744556E+02;
119      const nl_double k7 = -3.3836786704527788E+02;
120      const nl_double k8 = -1.3569136703258670E+02;
121      const nl_double k9 = 2.9914575453819188E+00;
122      const nl_double k10 = 1.6855569086173170E+00;
113      const double k1 = 1.9904769024796283E+03;
114      const double k2 = 1.2070059213983407E+03;
115      const double k3 = 1.3266985579561108E+03;
116      const double k4 = -1.5500979825922698E+02;
117      const double k5 = 2.8184536266938172E+00;
118      const double k6 = -2.3503421582744556E+02;
119      const double k7 = -3.3836786704527788E+02;
120      const double k8 = -1.3569136703258670E+02;
121      const double k9 = 2.9914575453819188E+00;
122      const double k10 = 1.6855569086173170E+00;
123123
124124      /* scale due to input resistance */
125125
trunk/src/emu/netlist/devices/nld_cmos.h
r243192r243193
2121
2222   protected:
2323      ATTR_HOT void update() {};
24      ATTR_HOT void start()
25      {
26         register_input("VDD,", m_vdd);
27         register_input("VSS,", m_vss);
28      };
24        ATTR_HOT void start()
25        {
26            register_input("VDD,", m_vdd);
27            register_input("VSS,", m_vss);
28        };
2929      ATTR_HOT void reset()  {};
3030
3131public:
32   ATTR_HOT inline nl_double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline nl_double vss() { return INPANALOG(m_vss); }
32   ATTR_HOT inline double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline double vss() { return INPANALOG(m_vss); }
3434};
3535
3636#endif /* NLD_CMOS_H_ */
trunk/src/emu/netlist/devices/nld_ne555.c
r243192r243193
1010#define R_OFF (1E20)
1111#define R_ON (25)   // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2
1212
13inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b)
13inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
1414{
15   nl_double ret = v;
16   nl_double vcc = TERMANALOG(m_R1.m_P);
15   double ret = v;
16   double vcc = TERMANALOG(m_R1.m_P);
1717
1818   if (ret >  vcc - a)
1919      ret = vcc - a;
r243192r243193
6464{
6565   // FIXME: assumes GND is connected to 0V.
6666
67   nl_double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
67   double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
6868   bool bthresh = (INPANALOG(m_THRES) > vt);
6969   bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
7070   bool out = m_last_out;
trunk/src/emu/netlist/devices/nld_ne555.h
r243192r243193
3939
4040   netlist_state_t<bool> m_last_out;
4141
42   inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b);
42   inline double clamp(const double v, const double a, const double b);
4343
4444);
4545
trunk/src/emu/netlist/devices/nld_r2r_dac.c
r243192r243193
3232
3333   update_dev();
3434
35   nl_double V = m_VIN.Value() / (double) (1 << m_num.Value()) * (double) m_val.Value();
35   double V = m_VIN.Value() / (double) (1 << m_num.Value()) * (double) m_val.Value();
3636
3737   this->set(1.0 / m_R.Value(), V, 0.0);
3838}
trunk/src/emu/netlist/devices/nld_system.c
r243192r243193
118118   if (state != m_last_state)
119119   {
120120      m_last_state = state;
121      const nl_double R = state ? m_logic_family->m_R_high : m_logic_family->m_R_low;
122      const nl_double V = state ? m_logic_family->m_high_V : m_logic_family->m_low_V;
121      const double R = state ? m_logic_family->m_R_high : m_logic_family->m_R_low;
122      const double V = state ? m_logic_family->m_high_V : m_logic_family->m_low_V;
123123
124124      // We only need to update the net first if this is a time stepping net
125125      if (m_RV.m_P.net().as_analog().solver()->is_timestep())
trunk/src/emu/netlist/devices/nld_system.h
r243192r243193
4040      NET_REGISTER_DEV(dummy_input, _name)
4141
4242#define FRONTIER(_name, _IN, _OUT)                                             \
43      NET_REGISTER_DEV(frontier, _name)                                      \
44      NET_C(_IN, _name.I)                                                    \
45      NET_C(_OUT, _name.Q)
43        NET_REGISTER_DEV(frontier, _name)                                      \
44        NET_C(_IN, _name.I)                                                    \
45        NET_C(_OUT, _name.Q)                                                   \
46
4647// -----------------------------------------------------------------------------
4748// mainclock
4849// -----------------------------------------------------------------------------
r243192r243193
158159class NETLIB_NAME(frontier) : public netlist_device_t
159160{
160161public:
161   ATTR_COLD NETLIB_NAME(frontier)()
162         : netlist_device_t(DUMMY) { }
162    ATTR_COLD NETLIB_NAME(frontier)()
163            : netlist_device_t(DUMMY) { }
163164
164   ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
165    ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
165166
166167protected:
167168
168   ATTR_COLD void start()
169   {
170      register_input("I", m_I);
171      register_output("Q", m_Q);
172   }
169    ATTR_COLD void start()
170    {
171        register_input("I", m_I);
172        register_output("Q", m_Q);
173    }
173174
174   ATTR_COLD void reset()
175   {
176   }
175    ATTR_COLD void reset()
176    {
177    }
177178
178   ATTR_HOT ATTR_ALIGN void update()
179   {
180      OUTANALOG(m_Q, INPANALOG(m_I));
181   }
179    ATTR_HOT ATTR_ALIGN void update()
180    {
181        OUTANALOG(m_Q, INPANALOG(m_I));
182    }
182183
183184private:
184   netlist_analog_input_t m_I;
185   netlist_analog_output_t m_Q;
185    netlist_analog_input_t m_I;
186    netlist_analog_output_t m_Q;
186187
187188};
188189
trunk/src/emu/netlist/netlist.mak
r243192r243193
2626   $(NETLISTOBJ)/nl_base.o \
2727   $(NETLISTOBJ)/nl_parser.o \
2828   $(NETLISTOBJ)/nl_setup.o \
29   $(NETLISTOBJ)/nl_factory.o \
3029   $(NETLISTOBJ)/pstring.o \
3130   $(NETLISTOBJ)/pstate.o \
3231   $(NETLISTOBJ)/analog/nld_bjt.o \
trunk/src/emu/netlist/nl_base.c
r243192r243193
152152   {
153153      if (!m_nets[i]->isRailNet())
154154      {
155         global_free(m_nets[i]);
155         delete m_nets[i];
156156      }
157157   }
158158
r243192r243193
170170   netlist_object_t::save_register();
171171}
172172
173ATTR_HOT const nl_double netlist_base_t::gmin() const
173ATTR_HOT const double netlist_base_t::gmin() const
174174{
175175   return solver()->gmin();
176176}
r243192r243193
452452}
453453
454454template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_double_t &param, const double initialVal);
455template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_double_t &param, const float initialVal);
456455template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_int_t &param, const int initialVal);
457456template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_logic_t &param, const int initialVal);
458457template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_str_t &param, const char * const initialVal);
r243192r243193
875874   net().as_analog().m_cur_Analog = 0.98;
876875}
877876
878ATTR_COLD void netlist_analog_output_t::initial(const nl_double val)
877ATTR_COLD void netlist_analog_output_t::initial(const double val)
879878{
880879   net().as_analog().m_cur_Analog = val * 0.99;
881880}
r243192r243193
932931}
933932
934933
935ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const
934ATTR_COLD double netlist_param_model_t::model_value(const pstring &entity, const double defval) const
936935{
937936   pstring tmp = this->Value();
938937   // .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
r243192r243193
946945      if (pequal < 0)
947946         netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
948947      tmp = tmp.substr(pequal+1);
949      nl_double factor = 1.0;
948      double factor = 1.0;
950949      switch (*(tmp.right(1).cstr()))
951950      {
952951         case 'm': factor = 1e-3; break;
r243192r243193
10011000   net.toggle_new_Q();
10021001   net.set_time(netlist().time() + m_inc);
10031002}
1003
1004// ----------------------------------------------------------------------------------------
1005// net_device_t_base_factory
1006// ----------------------------------------------------------------------------------------
1007
1008ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
1009{
1010   if (m_def_param.startsWith("+"))
1011      return nl_util::split(m_def_param.substr(1), ",");
1012   else
1013      return nl_util::pstring_list();
1014}
1015
1016ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
1017{
1018   if (m_def_param.startsWith("+") || m_def_param.equals("-"))
1019      return nl_util::pstring_list();
1020   else
1021      return nl_util::split(m_def_param, ",");
1022}
trunk/src/emu/netlist/nl_base.h
r243192r243193
272272
273273struct netlist_logic_family_desc_t
274274{
275   nl_double m_low_thresh_V;
276   nl_double m_high_thresh_V;
277   nl_double m_low_V;
278   nl_double m_high_V;
279   nl_double m_R_low;
280   nl_double m_R_high;
275   double m_low_thresh_V;
276   double m_high_thresh_V;
277   double m_low_V;
278   double m_high_V;
279   double m_R_low;
280   double m_R_high;
281281};
282282
283283/* Terminals inherit the family description from the netlist_device
r243192r243193
337337      CAPACITOR,  // Capacitor
338338      DIODE,      // Diode
339339      DUMMY,      // DUMMY device without function
340      FRONTIER,   // Net frontier
340        FRONTIER,   // Net frontier
341341      BJT_EB,     // BJT(Ebers-Moll)
342342      BJT_SWITCH, // BJT(Switch)
343343      VCVS,       // Voltage controlled voltage source
r243192r243193
474474
475475   ATTR_COLD netlist_terminal_t();
476476
477   nl_double *m_Idr1; // drive current
478   nl_double *m_go1;  // conductance for Voltage from other term
479   nl_double *m_gt1;  // conductance for total conductance
477   double *m_Idr1; // drive current
478   double *m_go1;  // conductance for Voltage from other term
479   double *m_gt1;  // conductance for total conductance
480480
481   ATTR_HOT inline void set(const nl_double G)
481   ATTR_HOT inline void set(const double G)
482482   {
483483      set_ptr(m_Idr1, 0);
484484      set_ptr(m_go1, G);
485485      set_ptr(m_gt1, G);
486486   }
487487
488   ATTR_HOT inline void set(const nl_double GO, const nl_double GT)
488   ATTR_HOT inline void set(const double GO, const double GT)
489489   {
490490      set_ptr(m_Idr1, 0);
491491      set_ptr(m_go1, GO);
492492      set_ptr(m_gt1, GT);
493493   }
494494
495   ATTR_HOT inline void set(const nl_double GO, const nl_double GT, const nl_double I)
495   ATTR_HOT inline void set(const double GO, const double GT, const double I)
496496   {
497497      set_ptr(m_Idr1, I);
498498      set_ptr(m_go1, GO);
r243192r243193
509509
510510   ATTR_COLD virtual void reset();
511511private:
512   inline void set_ptr(nl_double *ptr, const nl_double val)
512   inline void set_ptr(double *ptr, const double val)
513513   {
514514      if (ptr != NULL)
515515         *ptr = val;
r243192r243193
586586   ATTR_COLD netlist_analog_input_t()
587587      : netlist_input_t(INPUT, ANALOG) { }
588588
589   ATTR_HOT inline const nl_double Q_Analog() const;
589   ATTR_HOT inline const double Q_Analog() const;
590590};
591591
592592//#define INPVAL(_x) (_x).Q()
r243192r243193
661661   // We have to have those on one object. Dividing those does lead
662662   // to a significant performance hit
663663   // FIXME: Have to fix the public at some time
664   nl_double m_cur_Analog;
664   double m_cur_Analog;
665665
666666};
667667
r243192r243193
736736   ATTR_COLD netlist_analog_net_t();
737737   ATTR_COLD virtual ~netlist_analog_net_t() { };
738738
739   ATTR_HOT inline const nl_double Q_Analog() const
739   ATTR_HOT inline const double Q_Analog() const
740740   {
741741      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
742742      nl_assert(family() == ANALOG);
743743      return m_cur_Analog;
744744   }
745745
746   ATTR_COLD inline nl_double &Q_Analog_state_ptr()
746   ATTR_COLD inline double &Q_Analog_state_ptr()
747747   {
748748      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
749749      nl_assert(family() == ANALOG);
r243192r243193
764764private:
765765
766766public:
767   nl_double m_DD_n_m_1;
768   nl_double m_h_n_m_1;
767   double m_DD_n_m_1;
768   double m_h_n_m_1;
769769
770770   //FIXME: needed by current solver code
771771   netlist_matrix_solver_t *m_solver;
r243192r243193
831831
832832   ATTR_COLD netlist_analog_output_t();
833833
834   ATTR_COLD void initial(const nl_double val);
834   ATTR_COLD void initial(const double val);
835835
836   ATTR_HOT inline void set_Q(const nl_double newQ);
836   ATTR_HOT inline void set_Q(const double newQ);
837837
838838   netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic
839839
r243192r243193
876876public:
877877   ATTR_COLD netlist_param_double_t();
878878
879   ATTR_HOT inline void setTo(const nl_double param);
880   ATTR_COLD inline void initial(const nl_double val) { m_param = val; }
881   ATTR_HOT inline const nl_double Value() const        { return m_param;   }
879   ATTR_HOT inline void setTo(const double param);
880   ATTR_COLD inline void initial(const double val) { m_param = val; }
881   ATTR_HOT inline const double Value() const        { return m_param;   }
882882
883883protected:
884884   ATTR_COLD virtual void save_register()
r243192r243193
888888   }
889889
890890private:
891   nl_double m_param;
891   double m_param;
892892};
893893
894894class netlist_param_int_t : public netlist_param_t
r243192r243193
946946   ATTR_HOT inline const pstring &Value() const     { return m_param;     }
947947
948948   /* these should be cached! */
949   ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const;
949   ATTR_COLD double model_value(const pstring &entity, const double defval = 0.0) const;
950950   ATTR_COLD const pstring model_type() const;
951951
952952private:
r243192r243193
997997      out.set_Q(val, delay);
998998   }
999999
1000   ATTR_HOT inline const nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
1000   ATTR_HOT inline const double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
10011001
1002   ATTR_HOT inline const nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
1002   ATTR_HOT inline const double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
10031003
1004   ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
1004   ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const double val)
10051005   {
10061006      out.set_Q(val);
10071007   }
r243192r243193
10101010
10111011   ATTR_HOT virtual void dec_active() {  }
10121012
1013   ATTR_HOT virtual void step_time(const nl_double st) { }
1013   ATTR_HOT virtual void step_time(const double st) { }
10141014   ATTR_HOT virtual void update_terminals() { }
10151015
10161016
r243192r243193
11201120   ATTR_HOT inline const netlist_time time() const { return m_time; }
11211121   ATTR_HOT inline NETLIB_NAME(solver) *solver() const { return m_solver; }
11221122   ATTR_HOT inline NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
1123   ATTR_HOT const nl_double gmin() const;
1123   ATTR_HOT const double gmin() const;
11241124
11251125   ATTR_HOT inline void push_to_queue(netlist_net_t *out, const netlist_time attime)
11261126   {
r243192r243193
12511251   }
12521252}
12531253
1254ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param)
1254ATTR_HOT inline void netlist_param_double_t::setTo(const double param)
12551255{
12561256   if (m_param != param)
12571257   {
r243192r243193
12681268
12691269ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const
12701270{
1271   nl_assert(family() == LOGIC);
1271    nl_assert(family() == LOGIC);
12721272   return static_cast<const netlist_logic_net_t &>(*this);
12731273}
12741274
12751275ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog()
12761276{
1277   nl_assert(family() == ANALOG);
1277    nl_assert(family() == ANALOG);
12781278   return static_cast<netlist_analog_net_t &>(*this);
12791279}
12801280
r243192r243193
13561356   return net().as_logic().Q();
13571357}
13581358
1359ATTR_HOT inline const nl_double netlist_analog_input_t::Q_Analog() const
1359ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const
13601360{
13611361   return net().as_analog().Q_Analog();
13621362}
13631363
1364ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ)
1364ATTR_HOT inline void netlist_analog_output_t::set_Q(const double newQ)
13651365{
13661366   if (newQ != net().as_analog().m_cur_Analog)
13671367   {
r243192r243193
13701370   }
13711371}
13721372
1373
1374// -----------------------------------------------------------------------------
1375// net_dev class factory
1376// -----------------------------------------------------------------------------
1377
1378class net_device_t_base_factory
1379{
1380   NETLIST_PREVENT_COPYING(net_device_t_base_factory)
1381public:
1382   ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname,
1383         const pstring &def_param)
1384   : m_name(name), m_classname(classname), m_def_param(def_param)
1385   {}
1386
1387   ATTR_COLD virtual ~net_device_t_base_factory() {}
1388
1389   ATTR_COLD virtual netlist_device_t *Create() const = 0;
1390
1391   ATTR_COLD const pstring &name() const { return m_name; }
1392   ATTR_COLD const pstring &classname() const { return m_classname; }
1393   ATTR_COLD const pstring &param_desc() const { return m_def_param; }
1394   ATTR_COLD const nl_util::pstring_list term_param_list();
1395   ATTR_COLD const nl_util::pstring_list def_params();
1396
1397protected:
1398   pstring m_name;                             /* device name */
1399   pstring m_classname;                        /* device class name */
1400   pstring m_def_param;                        /* default parameter */
1401};
1402
1403template <class C>
1404class net_device_t_factory : public net_device_t_base_factory
1405{
1406   NETLIST_PREVENT_COPYING(net_device_t_factory)
1407public:
1408   ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname,
1409         const pstring &def_param)
1410   : net_device_t_base_factory(name, classname, def_param) { }
1411
1412   ATTR_COLD netlist_device_t *Create() const
1413   {
1414      netlist_device_t *r = new C();
1415      //r->init(setup, name);
1416      return r;
1417   }
1418};
1419
1420class netlist_factory_t
1421{
1422public:
1423   typedef plinearlist_t<net_device_t_base_factory *> list_t;
1424
1425   ATTR_COLD netlist_factory_t();
1426   ATTR_COLD ~netlist_factory_t();
1427
1428   ATTR_COLD void initialize();
1429
1430   template<class _C>
1431   ATTR_COLD void register_device(const pstring &name, const pstring &classname,
1432         const pstring &def_param)
1433   {
1434      m_list.add(new net_device_t_factory< _C >(name, classname, def_param) );
1435   }
1436
1437   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;
1438   ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
1439   ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const;
1440
1441   const list_t &list() { return m_list; }
1442
1443private:
1444   list_t m_list;
1445
1446};
1447
1448
13731449#endif /* NLBASE_H_ */
trunk/src/emu/netlist/nl_config.h
r243192r243193
4949
5050#define NETLIST_GMIN_DEFAULT    (1e-9)
5151
52//typedef double   nl_double;
53
54#define nl_double double
55
5652//============================================================
5753//  DEBUGGING
5854//============================================================
r243192r243193
113109// this macro passes an item followed by a string version of itself as two consecutive parameters
114110#define NLNAME(x) x, #x
115111
116//============================================================
117//  Exceptions
118//============================================================
119
120112// emu_fatalerror is a generic fatal exception that provides an error string
121113class nl_fatalerror : public std::exception
122114{
123115public:
124   nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3)
125   {
126      char text[1024];
127      va_list ap;
128      va_start(ap, format);
129      vsprintf(text, format, ap);
130      va_end(ap);
131      osd_printf_error("%s\n", text);
132   }
133   nl_fatalerror(const char *format, va_list ap)
134   {
135      char text[1024];
136      vsprintf(text, format, ap);
137      osd_printf_error("%s\n", text);
138   }
116    nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3)
117    {
118        char text[1024];
119        va_list ap;
120        va_start(ap, format);
121        vsprintf(text, format, ap);
122        va_end(ap);
123        osd_printf_error("%s\n", text);
124    }
125    nl_fatalerror(const char *format, va_list ap)
126    {
127        char text[1024];
128        vsprintf(text, format, ap);
129        osd_printf_error("%s\n", text);
130    }
139131};
140132
141//============================================================
142//  Memory allocation
143//============================================================
144
145#define nl_alloc(T, ...)        global_alloc(T(__VA_ARGS__))
146#define nl_alloc_array(T, N)    global_alloc_array(T, N)
147
148#define nl_free(_ptr)           global_free(_ptr)
149#define nl_free_array(_ptr)     global_free_array(_ptr)
150
151
152//============================================================
153//  Asserts
154//============================================================
155
156133#ifdef MAME_DEBUG
157134#define nl_assert(x)               do { if (!(x)) throw nl_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0)
158135#define nl_assert_always(x, msg)   do { if (!(x)) throw nl_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0)
159136#else
160137#define nl_assert(x)               do { } while (0)
161138//#define assert_always(x, msg)   do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0)
162#define nl_assert_always(x, msg)    do { if (!(x)) throw nl_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0)
139#define nl_assert_always(x, msg)   do { } while (0)
163140#endif
164141
165142//============================================================
trunk/src/emu/netlist/nl_dice_compat.h
r243192r243193
88#ifndef NL_DICE_COMPAT_H_
99#define NL_DICE_COMPAT_H_
1010
11#include "netlist/devices/net_lib.h"
12
1311/* --------------------------------------------------------------------
1412 * Compatibility macros for DICE netlists ...
1513 * -------------------------------------------------------------------- */
1614
17/*
18 * define NETLIST_DEVELOPMENT in IDEs before including this header file
19 * to get compile time errors on unknown devices. This should only be
20 * a temporary support and not be used in commits.
21 */
15//#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n);
16#define CHIP(_n, _t) setup.register_dev( new nld_ ## _t ## _dip(), _n);
2217
23#ifdef NETLIST_DEVELOPMENT
24#define CHIP(_n, _t) setup.register_dev( nl_alloc(nld_ ## _t ## _dip), _n);
25#else
26#define CHIP(_n, _t) setup.register_dev(NETLIB_NAME_STR(_t ## _dip), _n);
27#endif
28
2918#define CONNECTION( ... ) CONNECTIONY( CONNECTIONX( __VA_ARGS__ ) )
3019#define CONNECTIONY(_a) _a
3120#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
r243192r243193
4130struct Mono555Desc
4231{
4332public:
44      nl_double r, c;
33      double r, c;
4534
46      Mono555Desc(nl_double res, nl_double cap) : r(res), c(cap) { }
35      Mono555Desc(double res, double cap) : r(res), c(cap) { }
4736};
4837
4938struct SeriesRCDesc
5039{
5140public:
52      nl_double r, c;
41      double r, c;
5342
54      SeriesRCDesc(nl_double res, nl_double cap) : r(res), c(cap) { }
43      SeriesRCDesc(double res, double cap) : r(res), c(cap) { }
5544};
5645
5746#define CHIP_555_Mono(_name,  _pdesc)   \
trunk/src/emu/netlist/nl_factory.c
r243192r243193
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/***************************************************************************
4
5    nl_factory.c
6
7    Discrete netlist implementation.
8
9****************************************************************************
10
11    Couriersud reserves the right to license the code under a less restrictive
12    license going forward.
13
14    Copyright Nicola Salmoria and the MAME team
15    All rights reserved.
16
17    Redistribution and use of this code or any derivative works are permitted
18    provided that the following conditions are met:
19
20    * Redistributions may not be sold, nor may they be used in a commercial
21    product or activity.
22
23    * Redistributions that are modified from the original source must include the
24    complete source code, including the source code for all components used by a
25    binary built from the modified sources. However, as a special exception, the
26    source code distributed need not include anything that is normally distributed
27    (in either source or binary form) with the major components (compiler, kernel,
28    and so on) of the operating system on which the executable runs, unless that
29    component itself accompanies the executable.
30
31    * Redistributions must reproduce the above copyright notice, this list of
32    conditions and the following disclaimer in the documentation and/or other
33    materials provided with the distribution.
34
35    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
39    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
40    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
43    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45    POSSIBILITY OF SUCH DAMAGE.
46
47
48****************************************************************************/
49
50#include "nl_factory.h"
51#include "nl_setup.h"
52
53// ----------------------------------------------------------------------------------------
54// net_device_t_base_factory
55// ----------------------------------------------------------------------------------------
56
57ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
58{
59   if (m_def_param.startsWith("+"))
60      return nl_util::split(m_def_param.substr(1), ",");
61   else
62      return nl_util::pstring_list();
63}
64
65ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
66{
67   if (m_def_param.startsWith("+") || m_def_param.equals("-"))
68      return nl_util::pstring_list();
69   else
70      return nl_util::split(m_def_param, ",");
71}
72
73
74netlist_factory_t::netlist_factory_t()
75{
76}
77
78netlist_factory_t::~netlist_factory_t()
79{
80   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
81   {
82      net_device_t_base_factory *p = *e;
83      global_free(p);
84   }
85   m_list.clear();
86}
87
88netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname) const
89{
90   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
91   {
92      net_device_t_base_factory *p = *e;
93      if (strcmp(p->classname(), classname) == 0)
94      {
95         netlist_device_t *ret = p->Create();
96         return ret;
97      }
98      p++;
99   }
100   return NULL; // appease code analysis
101}
102
103netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
104{
105   net_device_t_base_factory *f = factory_by_name(name, setup);
106   return f->Create();
107}
108
109net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const
110{
111   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
112   {
113      net_device_t_base_factory *p = *e;
114      if (strcmp(p->name(), name) == 0)
115      {
116         return p;
117      }
118      p++;
119   }
120   setup.netlist().error("Class %s not found!\n", name.cstr());
121   return NULL; // appease code analysis
122}
trunk/src/emu/netlist/nl_factory.h
r243192r243193
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/*
4 * nl_factory.h
5 *
6 *
7 */
8
9#ifndef NLFACTORY_H_
10#define NLFACTORY_H_
11
12#include "nl_config.h"
13#include "plists.h"
14#include "nl_base.h"
15#if 0
16#include "nl_time.h"
17#include "nl_util.h"
18#include "pstate.h"
19#endif
20#include "pstring.h"
21
22// -----------------------------------------------------------------------------
23// net_dev class factory
24// -----------------------------------------------------------------------------
25
26class net_device_t_base_factory
27{
28   NETLIST_PREVENT_COPYING(net_device_t_base_factory)
29public:
30   ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname,
31         const pstring &def_param)
32   : m_name(name), m_classname(classname), m_def_param(def_param)
33   {}
34
35   ATTR_COLD virtual ~net_device_t_base_factory() {}
36
37   ATTR_COLD virtual netlist_device_t *Create() const = 0;
38
39   ATTR_COLD const pstring &name() const { return m_name; }
40   ATTR_COLD const pstring &classname() const { return m_classname; }
41   ATTR_COLD const pstring &param_desc() const { return m_def_param; }
42   ATTR_COLD const nl_util::pstring_list term_param_list();
43   ATTR_COLD const nl_util::pstring_list def_params();
44
45protected:
46   pstring m_name;                             /* device name */
47   pstring m_classname;                        /* device class name */
48   pstring m_def_param;                        /* default parameter */
49};
50
51template <class C>
52class net_device_t_factory : public net_device_t_base_factory
53{
54   NETLIST_PREVENT_COPYING(net_device_t_factory)
55public:
56   ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname,
57         const pstring &def_param)
58   : net_device_t_base_factory(name, classname, def_param) { }
59
60   ATTR_COLD netlist_device_t *Create() const
61   {
62      netlist_device_t *r = nl_alloc(C);
63      //r->init(setup, name);
64      return r;
65   }
66};
67
68class netlist_factory_t
69{
70public:
71   typedef plinearlist_t<net_device_t_base_factory *> list_t;
72
73   ATTR_COLD netlist_factory_t();
74   ATTR_COLD ~netlist_factory_t();
75
76   template<class _C>
77   ATTR_COLD void register_device(const pstring &name, const pstring &classname,
78         const pstring &def_param)
79   {
80      m_list.add(nl_alloc(net_device_t_factory< _C >, name, classname, def_param));
81   }
82
83   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname) const;
84   ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
85   ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const;
86
87   const list_t &list() { return m_list; }
88
89private:
90   list_t m_list;
91
92};
93
94
95#endif /* NLFACTORY_H_ */
trunk/src/emu/netlist/nl_parser.c
r243192r243193
66 */
77
88#include "nl_parser.h"
9#include "nl_factory.h"
109
1110//#undef NL_VERBOSE_OUT
1211//#define NL_VERBOSE_OUT(x) printf x
r243192r243193
400399void netlist_parser::netdev_param()
401400{
402401   pstring param;
403   nl_double val;
402   double val;
404403   param = get_identifier();
405404   require_token(m_tok_comma);
406405   val = eval_param(get_token());
r243192r243193
440439      }
441440      else
442441      {
443         nl_double val = eval_param(tok);
442         double val = eval_param(tok);
444443         m_setup.register_param(paramfq, val);
445444      }
446445      cnt++;
r243192r243193
468467// ----------------------------------------------------------------------------------------
469468
470469
471nl_double netlist_parser::eval_param(const token_t tok)
470double netlist_parser::eval_param(const token_t tok)
472471{
473472   static const char *macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
474   static nl_double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
473   static double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
475474   int i;
476475   int f=0;
477476   bool e;
478   nl_double ret;
477   double ret;
479478   pstring val;
480479
481480   //printf("param %s\n", tok.m_token.cstr());
trunk/src/emu/netlist/nl_parser.h
r243192r243193
160160   virtual void verror(pstring msg, int line_num, pstring line);
161161private:
162162
163   nl_double eval_param(const token_t tok);
163   double eval_param(const token_t tok);
164164
165165   token_id_t m_tok_param_left;
166166   token_id_t m_tok_param_right;
trunk/src/emu/netlist/nl_setup.c
r243192r243193
99#include "nl_setup.h"
1010#include "nl_parser.h"
1111#include "nl_util.h"
12#include "nl_factory.h"
1312#include "devices/net_lib.h"
1413#include "devices/nld_system.h"
1514#include "analog/nld_solver.h"
r243192r243193
3837   , m_proxy_cnt(0)
3938{
4039   netlist.set_setup(this);
41   m_factory = nl_alloc(netlist_factory_t);
4240}
4341
4442void netlist_setup_t::init()
4543{
46   nl_initialize_factory(factory());
44   m_factory.initialize();
4745   NETLIST_NAME(base)(*this);
4846}
4947
r243192r243193
5755   m_params_temp.clear();
5856
5957   netlist().set_setup(NULL);
60   nl_free(m_factory);
6158
6259   pstring::resetmem();
6360}
r243192r243193
9592   return dev;
9693}
9794
98netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring &name)
99{
100   netlist_device_t *dev = factory().new_device_by_classname(classname);
101   if (dev == NULL)
102      netlist().error("Class %s not found!\n", classname.cstr());
103   return register_dev(dev, name);
104}
105
10695template <class T>
10796static void remove_start_with(T &hm, pstring &sw)
10897{
r243192r243193
401390   if (proxy == NULL)
402391   {
403392      // create a new one ...
404      proxy = nl_alloc(nld_d_to_a_proxy ,out);
393      proxy = new nld_d_to_a_proxy(out);
405394      pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt);
406395      m_proxy_cnt++;
407396
r243192r243193
430419{
431420   if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
432421   {
433      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, in);
422      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
434423      pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt);
435424      m_proxy_cnt++;
436425
r243192r243193
466455   else if (inp.isFamily(netlist_terminal_t::LOGIC))
467456   {
468457      NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
469      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, inp);
458      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
470459      pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt);
471460      m_proxy_cnt++;
472461
r243192r243193
534523   else
535524   {
536525      NL_VERBOSE_OUT(("adding net ...\n"));
537      netlist_analog_net_t *anet =  nl_alloc(netlist_analog_net_t);
526      netlist_analog_net_t *anet =  new netlist_analog_net_t();
538527      t1.set_net(*anet);
539528      //m_netlist.solver()->m_nets.add(anet);
540529      // FIXME: Nets should have a unique name
r243192r243193
697686
698687void netlist_setup_t::start_devices()
699688{
700   //FIXME: we need a nl_getenv
689    //FIXME: we need a nl_getenv
701690   if (getenv("NL_LOGS"))
702691   {
703692      NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
r243192r243193
706695      {
707696         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
708697         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
709         netlist_device_t *nc = factory().new_device_by_classname("nld_log");
698         netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
710699         pstring name = "log_" + ll[i];
711700         register_dev(nc, name);
712701         register_link(name + ".I", ll[i]);
trunk/src/emu/netlist/nl_setup.h
r243192r243193
33/*
44 * nlsetup.h
55 *
6 *  Created on: 3 Nov 2013
7 *      Author: andre
68 */
79
810#ifndef NLSETUP_H_
911#define NLSETUP_H_
1012
1113#include "nl_base.h"
12//#include "nl_factory.h"
1314
1415//============================================================
1516//  MACROS / inline netlist definitions
r243192r243193
2324#define ALIAS(_alias, _name)                                                        \
2425   setup.register_alias(# _alias, # _name);
2526
26//#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
27#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
2728
2829#define NET_REGISTER_DEV(_type, _name)                                              \
29      setup.register_dev(NETLIB_NAME_STR(_type), # _name);
30      setup.register_dev(NET_NEW(_type), # _name);
3031
3132#define NET_REMOVE_DEV(_name)                                                       \
3233      setup.remove_dev(# _name);
r243192r243193
6566      setup.namespace_pop();
6667
6768// ----------------------------------------------------------------------------------------
69// FIXME: Clean this up
70// ----------------------------------------------------------------------------------------
71
72//class NETLIB_NAME(analog_callback);
73
74// ----------------------------------------------------------------------------------------
6875// netlist_setup_t
6976// ----------------------------------------------------------------------------------------
7077
71// Forward definition so we keep nl_factory.h out of the public
72class netlist_factory_t;
73
7478class netlist_setup_t
7579{
7680   NETLIST_PREVENT_COPYING(netlist_setup_t)
r243192r243193
113117
114118   netlist_base_t &netlist() { return m_netlist; }
115119   const netlist_base_t &netlist() const { return m_netlist; }
120   netlist_factory_t &factory() { return m_factory; }
121   const netlist_factory_t &factory() const { return m_factory; }
116122
117123   pstring build_fqn(const pstring &obj_name) const;
118124
119125   netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
120   netlist_device_t *register_dev(const pstring &classname, const pstring &name);
121126   void remove_dev(const pstring &name);
122127
123128   void register_model(const pstring &model);
r243192r243193
146151   void namespace_push(const pstring &aname);
147152   void namespace_pop();
148153
149   netlist_factory_t &factory() { return *m_factory; }
150   const netlist_factory_t &factory() const { return *m_factory; }
151
152154   /* not ideal, but needed for save_state */
153155   tagmap_terminal_t  m_terminals;
154156
r243192r243193
165167   tagmap_link_t   m_links;
166168   tagmap_nstring_t m_params_temp;
167169
168   netlist_factory_t *m_factory;
170   netlist_factory_t m_factory;
169171
170172   plinearlist_t<pstring> m_models;
171173
trunk/src/emu/netlist/plists.h
r243192r243193
2828      if (m_num_elements == 0)
2929         m_list = NULL;
3030      else
31         m_list = nl_alloc_array(_ListClass, m_num_elements);
31         m_list = new _ListClass[m_num_elements];
3232      m_count = 0;
3333   }
3434
r243192r243193
3838      if (m_num_elements == 0)
3939         m_list = NULL;
4040      else
41         m_list = nl_alloc_array(_ListClass, m_num_elements);
41         m_list = new _ListClass[m_num_elements];
4242      m_count = 0;
4343      for (int i=0; i<rhs.count(); i++)
4444      {
r243192r243193
6060   ATTR_COLD ~plinearlist_t()
6161   {
6262      if (m_list != NULL)
63         nl_free_array(m_list);
63         delete[] m_list;
6464      m_list = NULL;
6565   }
6666
r243192r243193
157157   {
158158      for (_ListClass *i = m_list; i < m_list + m_count; i++)
159159      {
160         nl_free(*i);
160         delete *i;
161161      }
162162      clear();
163163   }
164164
165165private:
166   ATTR_COLD void resize(const int new_size)
166   ATTR_HOT inline void resize(const int new_size)
167167   {
168168      int cnt = count();
169169      if (new_size > 0)
170170      {
171         _ListClass *m_new = nl_alloc_array(_ListClass, new_size);
171         _ListClass *m_new = new _ListClass[new_size];
172172         _ListClass *pd = m_new;
173173
174174         if (cnt > new_size)
r243192r243193
176176         for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++)
177177            *pd = *ps;
178178         if (m_list != NULL)
179            nl_free_array(m_list);
179            delete[] m_list;
180180         m_list = m_new;
181181         m_count = cnt;
182182      }
183183      else
184184      {
185185         if (m_list != NULL)
186            nl_free_array(m_list);
186            delete[] m_list;
187187         m_list = NULL;
188188         m_count = 0;
189189      }
r243192r243193
199199// pnamedlist_t: a simple list
200200// ----------------------------------------------------------------------------------------
201201
202#ifdef SDLMAME_SOLARIS
203#undef _C
204#endif
205
206202template <class _C>
207203class pnamedlist_t : public plinearlist_t<_C>
208204{
trunk/src/emu/netlist/pstate.c
r243192r243193
2323         "DT_INT16",
2424         "DT_INT8",
2525         "DT_INT",
26         "DT_BOOLEAN",
27         "DT_FLOAT"
26         "DT_BOOLEAN"
2827   };
2928
3029   NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
31   pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, dt, owner, size, count, ptr, is_ptr);
30   pstate_entry_t *p = new pstate_entry_t(stname, dt, owner, size, count, ptr, is_ptr);
3231   m_save.add(p);
3332}
3433
r243192r243193
6160      if (m_save[i]->m_dt == DT_CUSTOM)
6261         m_save[i]->m_callback->on_post_load();
6362}
64
65template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname)
66{
67   //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
68   pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, owner, &state);
69   m_save.add(p);
70   state.register_state(*this, stname);
71}
trunk/src/emu/netlist/pstate.h
r243192r243193
3232   DT_INT16,
3333   DT_INT8,
3434   DT_INT,
35   DT_BOOLEAN,
36   DT_FLOAT
35   DT_BOOLEAN
3736};
3837
3938template<typename _ItemType> struct nl_datatype
r243192r243193
5655
5756NETLIST_SAVE_TYPE(char, DT_INT8);
5857NETLIST_SAVE_TYPE(double, DT_DOUBLE);
59NETLIST_SAVE_TYPE(float, DT_FLOAT);
6058NETLIST_SAVE_TYPE(INT8, DT_INT8);
6159NETLIST_SAVE_TYPE(UINT8, DT_INT8);
6260NETLIST_SAVE_TYPE(INT64, DT_INT64);
r243192r243193
147145   pstate_entry_t::list_t m_save;
148146};
149147
150template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname);
148template<> ATTR_COLD inline void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname)
149{
150   //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
151   pstate_entry_t *p = new pstate_entry_t(stname, owner, &state);
152   m_save.add(p);
153   state.register_state(*this, stname);
154}
151155
152156template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname)
153157{
trunk/src/emu/netlist/pstring.c
r243192r243193
1414//pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
1515
1616pblockpool pstring::m_pool;
17
1718pstring::str_t pstring::m_zero;
1819
1920/*
r243192r243193
108109   return 1;
109110}
110111
111nl_double pstring::as_double(bool *error) const
112double pstring::as_double(bool *error) const
112113{
113   nl_double ret;
114   double ret;
114115   char *e = NULL;
115116
116117   if (error != NULL)
r243192r243193
124125
125126long pstring::as_long(bool *error) const
126127{
127   nl_double ret;
128   double ret;
128129   char *e = NULL;
129130
130131   if (error != NULL)
trunk/src/emu/netlist/pstring.h
r243192r243193
159159
160160   // conversions
161161
162   nl_double as_double(bool *error = NULL) const;
162   double as_double(bool *error = NULL) const;
163163
164164   long as_long(bool *error = NULL) const;
165165
trunk/src/emu/parameters.c
r243192r243193
1// license:BSD-3-Clause
2// copyright-holders:Olivier Galibert, Aaron Giles
3/***************************************************************************
4
5    parameters.c
6
7    Per-game parameters handling.
8
9***************************************************************************/
10
11#include "emu.h"
12
13parameters_manager::parameters_manager(running_machine &machine)
14   : m_machine(machine)
15{
16}
17
18astring parameters_manager::lookup(astring tag) const
19{
20   return m_parameters.find(tag);
21}
22
23void parameters_manager::add(astring tag, astring value)
24{
25   m_parameters.add(tag, value);
26}
trunk/src/emu/parameters.h
r243192r243193
1// license:BSD-3-Clause
2// copyright-holders:Olivier Galibert,Aaron Giles
3/***************************************************************************
4
5    parameters.h
6
7    Per-game parameters handling.
8
9***************************************************************************/
10
11#pragma once
12
13#ifndef __EMU_H__
14#error Dont include this file directly; include emu.h instead.
15#endif
16
17#ifndef __PARAMETERS_H__
18#define __PARAMETERS_H__
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> parameters_manager
26
27class parameters_manager
28{
29   DISABLE_COPYING(parameters_manager);
30
31public:
32   // construction/destruction
33   parameters_manager(running_machine &machine);
34
35   // getters
36   running_machine &machine() const { return m_machine; }
37   astring lookup(astring tag) const;
38
39   // setters
40   void add(astring tag, astring value);
41
42private:
43   // internal state
44   running_machine &       m_machine;              // reference to owning machine
45   tagmap_t<astring>       m_parameters;
46};
47
48#endif  // __INPTPORT_H__ */
trunk/src/emu/render.c
r243192r243193
207207
208208render_texinfo &render_texinfo::operator=(const render_texinfo &src)
209209{
210   free_palette();
211   base = src.base;
212   rowpixels = src.rowpixels;
213   width = src.width;
214   height = src.height;
215   seqid = src.seqid;
216   osddata = src.osddata;
217   m_palette = src.m_palette;
218   if (m_palette != NULL)
219   {
220      m_palette->ref_count++;
221   }
222   return *this;
210    free_palette();
211    base = src.base;
212    rowpixels = src.rowpixels;
213    width = src.width;
214    height = src.height;
215    seqid = src.seqid;
216    osddata = src.osddata;
217    m_palette = src.m_palette;
218    if (m_palette != NULL)
219    {
220        m_palette->ref_count++;
221    }
222    return *this;
223223}
224224
225225render_texinfo::render_texinfo(const render_texinfo &src)
226226{
227   base = src.base;
228   rowpixels = src.rowpixels;
229   width = src.width;
230   height = src.height;
231   seqid = src.seqid;
232   osddata = src.osddata;
233   m_palette = src.m_palette;
234   if (m_palette != NULL)
235   {
236      m_palette->ref_count++;
237   }
227    base = src.base;
228    rowpixels = src.rowpixels;
229    width = src.width;
230    height = src.height;
231    seqid = src.seqid;
232    osddata = src.osddata;
233    m_palette = src.m_palette;
234    if (m_palette != NULL)
235    {
236        m_palette->ref_count++;
237    }
238238}
239239
240240void render_texinfo::set_palette(const dynamic_array<rgb_t> *source)
241241{
242   free_palette();
243   if (source != NULL)
244   {
245      m_palette = global_alloc(render_palette_copy);
246      m_palette->palette.copyfrom(*source);
247      m_palette->ref_count = 1;
248   }
249   else
250   {
251      m_palette = NULL;
252   }
242    free_palette();
243    if (source != NULL)
244    {
245        m_palette = global_alloc(render_palette_copy);
246        m_palette->palette.copyfrom(*source);
247        m_palette->ref_count = 1;
248    }
249    else
250    {
251        m_palette = NULL;
252    }
253253}
254254
255255void render_texinfo::free_palette()
256256{
257   if (m_palette != NULL)
258   {
259      m_palette->ref_count--;
260      if (m_palette->ref_count == 0)
261      {
262         global_free(m_palette);
263      }
264   }
265   m_palette = NULL;
257    if (m_palette != NULL)
258    {
259        m_palette->ref_count--;
260        if (m_palette->ref_count == 0)
261        {
262            global_free(m_palette);
263        }
264    }
265    m_palette = NULL;
266266}
267267
268268
r243192r243193
277277
278278void render_primitive::reset()
279279{
280   // public state
281   type = INVALID;
282   bounds.x0 = 0;
283   bounds.y0 = 0;
284   bounds.x1 = 0;
285   bounds.y1 = 0;
286   color.a = 0;
287   color.r = 0;
288   color.g = 0;
289   color.b = 0;
290   flags = 0;
291   width = 0.0f;
292   texture.set_palette(NULL);
293   texture = render_texinfo();
294   texcoords.bl.u = 0.0f;
295   texcoords.bl.v = 0.0f;
296   texcoords.br.u = 0.0f;
297   texcoords.br.v = 0.0f;
298   texcoords.tl.u = 0.0f;
299   texcoords.tl.v = 0.0f;
300   texcoords.tr.u = 0.0f;
301   texcoords.tr.v = 0.0f;
280    // public state
281    type = INVALID;
282    bounds.x0 = 0;
283    bounds.y0 = 0;
284    bounds.x1 = 0;
285    bounds.y1 = 0;
286    color.a = 0;
287    color.r = 0;
288    color.g = 0;
289    color.b = 0;
290    flags = 0;
291    width = 0.0f;
292    texture.set_palette(NULL);
293    texture = render_texinfo();
294    texcoords.bl.u = 0.0f;
295    texcoords.bl.v = 0.0f;
296    texcoords.br.u = 0.0f;
297    texcoords.br.v = 0.0f;
298    texcoords.tl.u = 0.0f;
299    texcoords.tl.v = 0.0f;
300    texcoords.tr.u = 0.0f;
301    texcoords.tr.v = 0.0f;
302302
303   // do not clear m_next!
304   // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
303    // do not clear m_next!
304    // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
305305}
306306
307307
r243192r243193
556556      texinfo.width = swidth;
557557      texinfo.height = sheight;
558558      // will be set later
559      texinfo.set_palette(NULL);
559        texinfo.set_palette(NULL);
560560      texinfo.seqid = ++m_curseq;
561561   }
562562   else
563563   {
564      // make sure we can recover the original argb32 bitmap
565      bitmap_argb32 dummy;
566      bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
564        // make sure we can recover the original argb32 bitmap
565        bitmap_argb32 dummy;
566        bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
567567
568      // is it a size we already have?
569      scaled_texture *scaled = NULL;
570      int scalenum;
571      for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
572      {
573         scaled = &m_scaled[scalenum];
568        // is it a size we already have?
569        scaled_texture *scaled = NULL;
570        int scalenum;
571        for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
572        {
573            scaled = &m_scaled[scalenum];
574574
575         // we need a non-NULL bitmap with matching dest size
576         if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
577            break;
578      }
575            // we need a non-NULL bitmap with matching dest size
576            if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
577                break;
578        }
579579
580      // did we get one?
581      if (scalenum == ARRAY_LENGTH(m_scaled))
582      {
583         int lowest = -1;
580        // did we get one?
581        if (scalenum == ARRAY_LENGTH(m_scaled))
582        {
583            int lowest = -1;
584584
585         // didn't find one -- take the entry with the lowest seqnum
586         for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
587            if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
588               lowest = scalenum;
589         assert_always(lowest != -1, "Too many live texture instances!");
585            // didn't find one -- take the entry with the lowest seqnum
586            for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
587                if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
588                    lowest = scalenum;
589            assert_always(lowest != -1, "Too many live texture instances!");
590590
591         // throw out any existing entries
592         scaled = &m_scaled[lowest];
593         if (scaled->bitmap != NULL)
594         {
595            m_manager->invalidate_all(scaled->bitmap);
596            global_free(scaled->bitmap);
597         }
591            // throw out any existing entries
592            scaled = &m_scaled[lowest];
593            if (scaled->bitmap != NULL)
594            {
595                m_manager->invalidate_all(scaled->bitmap);
596                global_free(scaled->bitmap);
597            }
598598
599         // allocate a new bitmap
600         scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
601         scaled->seqid = ++m_curseq;
599            // allocate a new bitmap
600            scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
601            scaled->seqid = ++m_curseq;
602602
603         // let the scaler do the work
604         (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
605      }
603            // let the scaler do the work
604            (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
605        }
606606
607      // finally fill out the new info
608      primlist.add_reference(scaled->bitmap);
609      texinfo.base = &scaled->bitmap->pix32(0);
610      texinfo.rowpixels = scaled->bitmap->rowpixels();
611      texinfo.width = dwidth;
612      texinfo.height = dheight;
613      // will be set later
614      texinfo.set_palette(NULL);
615      texinfo.seqid = scaled->seqid;
607        // finally fill out the new info
608        primlist.add_reference(scaled->bitmap);
609        texinfo.base = &scaled->bitmap->pix32(0);
610        texinfo.rowpixels = scaled->bitmap->rowpixels();
611        texinfo.width = dwidth;
612        texinfo.height = dheight;
613        // will be set later
614        texinfo.set_palette(NULL);
615        texinfo.seqid = scaled->seqid;
616616   }
617617}
618618
r243192r243193
18171817               height = MIN(height, m_maxtexheight);
18181818
18191819               curitem->texture()->get_scaled(width, height, prim->texture, list);
1820               // set the palette
1820                    // set the palette
18211821#if 1
18221822               const dynamic_array<rgb_t> *adjusted_pal = curitem->texture()->get_adjusted_palette(container);
1823               prim->texture.set_palette(adjusted_pal);
1823                    prim->texture.set_palette(adjusted_pal);
18241824#else
1825               prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
1825                    prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
18261826#endif
18271827
1828               // determine UV coordinates and apply clipping
1829               prim->texcoords = oriented_texcoords[finalorient];
1830               clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1828                    // determine UV coordinates and apply clipping
1829                    prim->texcoords = oriented_texcoords[finalorient];
1830                    clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
18311831
1832               // apply the final orientation from the quad flags and then build up the final flags
1833               prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1834                           PRIMFLAG_TEXORIENT(finalorient) |
1835                           PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1836               if (blendmode != -1)
1837                  prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1838               else
1839                  prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
1832                    // apply the final orientation from the quad flags and then build up the final flags
1833                    prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1834                                    PRIMFLAG_TEXORIENT(finalorient) |
1835                                    PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1836                    if (blendmode != -1)
1837                        prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1838                    else
1839                        prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
18401840            }
18411841            else
18421842            {
r243192r243193
18761876            (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
18771877
18781878      // determine UV coordinates
1879      prim->texcoords = oriented_texcoords[container_xform.orientation];
1879        prim->texcoords = oriented_texcoords[container_xform.orientation];
18801880
1881      // set the flags and add it to the list
1882      prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1883                  PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1884                  PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1885                  PRIMFLAG_TEXSHADE(1);
1881        // set the flags and add it to the list
1882        prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1883                        PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1884                        PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1885                        PRIMFLAG_TEXSHADE(1);
18861886
1887      list.append_or_return(*prim, false);
1887        list.append_or_return(*prim, false);
18881888   }
18891889}
18901890
r243192r243193
19251925
19261926      texture->get_scaled(width, height, prim->texture, list);
19271927
1928      // compute the clip rect
1929      render_bounds cliprect;
1930      cliprect.x0 = render_round_nearest(xform.xoffs);
1931      cliprect.y0 = render_round_nearest(xform.yoffs);
1932      cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1933      cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1934      sect_render_bounds(&cliprect, &m_bounds);
1928        // compute the clip rect
1929        render_bounds cliprect;
1930        cliprect.x0 = render_round_nearest(xform.xoffs);
1931        cliprect.y0 = render_round_nearest(xform.yoffs);
1932        cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1933        cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1934        sect_render_bounds(&cliprect, &m_bounds);
19351935
1936      // determine UV coordinates and apply clipping
1937      prim->texcoords = oriented_texcoords[xform.orientation];
1938      bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1936        // determine UV coordinates and apply clipping
1937        prim->texcoords = oriented_texcoords[xform.orientation];
1938        bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
19391939
19401940      // add to the list or free if we're clipped out
19411941      list.append_or_return(*prim, clipped);
trunk/src/emu/render.h
r243192r243193
213213
214214struct render_palette_copy
215215{
216   int ref_count;
217   dynamic_array<rgb_t> palette;
216    int ref_count;
217    dynamic_array<rgb_t> palette;
218218};
219219
220220class render_texinfo
221221{
222222public:
223   render_texinfo()
224   : base(NULL), rowpixels(0), width(0), height(0),
225      seqid(0), osddata(0), m_palette(NULL)
226   {}
223    render_texinfo()
224    : base(NULL), rowpixels(0), width(0), height(0),
225      seqid(0), osddata(0), m_palette(NULL)
226    {}
227227
228   render_texinfo(const render_texinfo &src);
228    render_texinfo(const render_texinfo &src);
229229
230   ~render_texinfo()
231   {
232      free_palette();
233   }
230    ~render_texinfo()
231    {
232        free_palette();
233    }
234234
235   render_texinfo &operator=(const render_texinfo &src);
235    render_texinfo &operator=(const render_texinfo &src);
236236
237237   void *              base;               // base of the data
238238   UINT32              rowpixels;          // pixels per row
r243192r243193
241241   UINT32              seqid;              // sequence ID
242242   UINT64              osddata;            // aux data to pass to osd
243243
244   const rgb_t *       palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); }
244    const rgb_t *       palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); }
245245
246   void set_palette(const dynamic_array<rgb_t> *source);
246    void set_palette(const dynamic_array<rgb_t> *source);
247247
248248private:
249   void free_palette();
249    void free_palette();
250250
251   render_palette_copy *m_palette;     // palette for PALETTE16 textures, LUTs for RGB15/RGB32
251    render_palette_copy *m_palette;     // palette for PALETTE16 textures, LUTs for RGB15/RGB32
252252};
253253
254254
trunk/src/emu/rendfont.c
r243192r243193
8989   // if this is an OSD font, we're done
9090   if (filename != NULL)
9191   {
92      m_osdfont = manager.machine().osd().font_alloc();
92      m_osdfont = manager.machine().osd().font_open(filename, m_height);
9393      if (m_osdfont != NULL)
9494      {
95         if (m_osdfont->open(manager.machine().options().font_path(), filename, m_height))
96         {
97            m_scale = 1.0f / (float)m_height;
98            m_format = FF_OSD;
99            return;
100         }
101         global_free(m_osdfont);
102         m_osdfont = NULL;
95         m_scale = 1.0f / (float)m_height;
96         m_format = FF_OSD;
97         return;
10398      }
10499   }
105100
r243192r243193
135130
136131   // release the OSD font
137132   if (m_osdfont != NULL)
138   {
139      m_osdfont->close();
140      global_free(m_osdfont);
141   }
133      m_manager.machine().osd().font_close(m_osdfont);
142134}
143135
144136
r243192r243193
157149         return;
158150
159151      // attempt to get the font bitmap; if we fail, set bmwidth to -1
160      if (!m_osdfont->get_bitmap(chnum, gl.bitmap, gl.width, gl.xoffs, gl.yoffs))
152      if (!m_manager.machine().osd().font_get_bitmap(m_osdfont, chnum, gl.bitmap, gl.width, gl.xoffs, gl.yoffs))
161153      {
162154         gl.bitmap.reset();
163155         gl.bmwidth = -1;
trunk/src/emu/romload.c
r243192r243193
171171const rom_entry *rom_first_region(const device_t &device)
172172{
173173   const rom_entry *romp = device.rom_region();
174   while (romp && ROMENTRY_ISPARAMETER(romp))
175      romp++;
176174   return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL;
177175}
178176
r243192r243193
187185   romp++;
188186   while (!ROMENTRY_ISREGIONEND(romp))
189187      romp++;
190   while (ROMENTRY_ISPARAMETER(romp))
191      romp++;
192188   return ROMENTRY_ISEND(romp) ? NULL : romp;
193189}
194190
r243192r243193
222218
223219
224220/*-------------------------------------------------
225    rom_first_parameter - return pointer to the first
226    per-game parameter
227-------------------------------------------------*/
228
229const rom_entry *rom_first_parameter(const device_t &device)
230{
231   const rom_entry *romp = device.rom_region();
232   while (romp && !ROMENTRY_ISEND(romp) && !ROMENTRY_ISPARAMETER(romp))
233      romp++;
234   return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL;
235}
236
237
238/*-------------------------------------------------
239    rom_next_parameter - return pointer to the next
240    per-game parameter
241-------------------------------------------------*/
242
243const rom_entry *rom_next_parameter(const rom_entry *romp)
244{
245   romp++;
246   while (!ROMENTRY_ISREGIONEND(romp) && !ROMENTRY_ISPARAMETER(romp))
247      romp++;
248   return ROMENTRY_ISEND(romp) ? NULL : romp;
249}
250
251
252/*-------------------------------------------------
253221    rom_region_name - return the appropriate name
254222    for a rom region
255223-------------------------------------------------*/
r243192r243193
261229
262230
263231/*-------------------------------------------------
264    rom_parameter_name - return the appropriate name
265    for a per-game parameter
266-------------------------------------------------*/
267
268astring &rom_parameter_name(astring &result, const device_t &device, const rom_entry *romp)
269{
270   return device.subtag(result, romp->_name);
271}
272
273
274/*-------------------------------------------------
275    rom_parameter_name - return the value for a
276    per-game parameter
277-------------------------------------------------*/
278
279astring rom_parameter_value(const rom_entry *romp)
280{
281   return romp->_hashdata;
282}
283
284
285/*-------------------------------------------------
286232    rom_file_size - return the expected size of a
287233    file given the ROM description
288234-------------------------------------------------*/
r243192r243193
15081454         rom_region_name(regiontag, *device, region);
15091455         region_post_process(romdata, regiontag, ROMREGION_ISINVERTED(region));
15101456      }
1511
1512   /* and finally register all per-game parameters */
1513   for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
1514      for (const rom_entry *param = rom_first_parameter(*device); param != NULL; param = rom_next_parameter(param))
1515      {
1516         rom_parameter_name(regiontag, *device, param);
1517         romdata->machine().parameters().add(regiontag, rom_parameter_value(param));
1518      }
15191457}
15201458
15211459
trunk/src/emu/romload.h
r243192r243193
3939   ROMENTRYTYPE_IGNORE,        /* this entry continues loading the previous ROM but throws the data away */
4040   ROMENTRYTYPE_SYSTEM_BIOS,   /* this entry specifies a bios */
4141   ROMENTRYTYPE_DEFAULT_BIOS,  /* this entry specifies a default bios */
42   ROMENTRYTYPE_PARAMETER,     /* this entry specifies a per-game parameter */
4342   ROMENTRYTYPE_COUNT
4443};
4544
r243192r243193
153152#define ROMENTRY_ISIGNORE(r)        (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_IGNORE)
154153#define ROMENTRY_ISSYSTEM_BIOS(r)   (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_SYSTEM_BIOS)
155154#define ROMENTRY_ISDEFAULT_BIOS(r)  (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_DEFAULT_BIOS)
156#define ROMENTRY_ISPARAMETER(r)     (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_PARAMETER)
157#define ROMENTRY_ISREGIONEND(r)     (ROMENTRY_ISREGION(r) || ROMENTRY_ISPARAMETER(r) || ROMENTRY_ISEND(r))
155#define ROMENTRY_ISREGIONEND(r)     (ROMENTRY_ISREGION(r) || ROMENTRY_ISEND(r))
158156
159157/* ----- per-region macros ----- */
160158#define ROMREGION_GETTAG(r)         ((r)->_name)
r243192r243193
245243#define ROM_DEFAULT_BIOS(name)                      { name, NULL, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS },
246244
247245
248/* ----- game parameter macro ----- */
249#define ROM_PARAMETER(tag, value)                   { tag, value, 0, 0, ROMENTRYTYPE_PARAMETER },
250
251246/* ----- disk loading macros ----- */
252247#define DISK_REGION(tag)                            ROM_REGION(1, tag, ROMREGION_DATATYPEDISK)
253248#define DISK_IMAGE(name,idx,hash)                   ROMX_LOAD(name, idx, 0, hash, DISK_READWRITE)
r243192r243193
282277/* ----- ROM iteration ----- */
283278
284279/* return pointer to the first ROM region within a source */
285const rom_entry *rom_first_region(const device_t &device);
280const rom_entry *rom_first_region(const device_t &romp);
286281
287282/* return pointer to the next ROM region within a source */
288283const rom_entry *rom_next_region(const rom_entry *romp);
r243192r243193
299294/* return the appropriate name for a rom region */
300295astring &rom_region_name(astring &result, const device_t &device, const rom_entry *romp);
301296
302/* return pointer to the first per-game parameter */
303const rom_entry *rom_first_parameter(const device_t &device);
304297
305/* return pointer to the next per-game parameter */
306const rom_entry *rom_next_parameter(const rom_entry *romp);
307298
308/* return the appropriate name for a per-game parameter */
309astring &rom_parameter_name(astring &result, const device_t &device, const rom_entry *romp);
310
311/* return the value for a per-game parameter */
312astring rom_parameter_value(const rom_entry *romp);
313
314
315299/* ----- disk handling ----- */
316300
317301/* open a disk image, searching up the parent and loading by checksum */
trunk/src/emu/save.c
r243192r243193
213213   return validate_header(header, gamename, sig, errormsg, "");
214214}
215215
216//-------------------------------------------------
217//  dispatch_postload - invoke all registered
218//  postload callbacks for updates
219//-------------------------------------------------
220216
221
222void save_manager::dispatch_postload()
223{
224   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
225      func->m_func();
226}
227
228217//-------------------------------------------------
229218//  read_file - read the data from a file
230219//-------------------------------------------------
r243192r243193
264253   }
265254
266255   // call the post-load functions
267   dispatch_postload();
256   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
257      func->m_func();
268258
269259   return STATERR_NONE;
270260}
271261
272//-------------------------------------------------
273//  dispatch_presave - invoke all registered
274//  presave callbacks for updates
275//-------------------------------------------------
276262
277
278void save_manager::dispatch_presave()
279{
280   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
281      func->m_func();
282}
283
284263//-------------------------------------------------
285264//  write_file - writes the data to a file
286265//-------------------------------------------------
r243192r243193
308287   file.compress(FCOMPRESS_MEDIUM);
309288
310289   // call the pre-save functions
311   dispatch_presave();
290   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
291      func->m_func();
312292
313293   // then write all the data
314294   for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
trunk/src/emu/save.h
r243192r243193
9999   void register_presave(save_prepost_delegate func);
100100   void register_postload(save_prepost_delegate func);
101101
102   // callback dispatching
103   void dispatch_presave();
104   void dispatch_postload();
105
106102   // generic memory registration
107103   void save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
108104
trunk/src/emu/sound/qs1000.c
r243192r243193
246246
247247   save_item(NAME(m_serial_data_in));
248248   save_item(NAME(m_wave_regs));
249
249   
250250   for (int i = 0; i < QS1000_CHANNELS; i++)
251251   {
252252      save_item(NAME(m_channels[i].m_acc), i);
trunk/src/emu/sound/rf5c400.c
r243192r243193
129129
130130         if (env_phase == PHASE_NONE) break;
131131
132         tmp = rom[(pos>>16) & m_rommask];
132         tmp = rom[pos>>16];
133133         switch ( type )
134134         {
135135            case TYPE_16:
r243192r243193
331331   }
332332
333333   m_stream = stream_alloc(0, 2, clock()/384);
334
335   m_rommask = m_rom.length() - 1;
336334}
337335
338336
trunk/src/emu/sound/rf5c400.h
r243192r243193
9898private:
9999   required_region_ptr<INT16> m_rom;
100100
101   UINT32 m_rommask;
102
103101   sound_stream *m_stream;
104102
105103   double m_env_ar_table[0x9f];
trunk/src/emu/sound/tiasound.c
r243192r243193
597597      chip->P5[chan] = 0;
598598      chip->P9[chan] = 0;
599599   }
600
600   
601601   tia_save_state(device, chip);
602602
603603   return chip;
trunk/src/emu/ui/barcode.c
r243192r243193
2020
2121
2222/**************************************************
23
23
2424 BARCODE READER MENU
25
25
2626 **************************************************/
2727
2828
r243192r243193
5151void ui_menu_barcode_reader::populate()
5252{
5353   if (current_device())
54   {
54   {     
5555      astring buffer;
5656      const char *new_barcode;
5757
r243192r243193
6868      {
6969         new_barcode = m_barcode_buffer;
7070      }
71
71     
7272      item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE);
73
73     
7474      // finish up the menu
7575      item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
7676      item_append("Enter Code", NULL, 0, ITEMREF_ENTER_BARCODE);
77
77     
7878      customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
7979   }
8080}
r243192r243193
103103            if (event->itemref == ITEMREF_SELECT_READER)
104104               previous();
105105            break;
106
106           
107107         case IPT_UI_RIGHT:
108108            if (event->itemref == ITEMREF_SELECT_READER)
109109               next();
trunk/src/emu/ui/cheatopt.c
r243192r243193
1/*********************************************************************
2
3    ui/cheatopt.c
4
5    Internal menu for the cheat interface.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12#include "emu.h"
13#include "cheat.h"
14
15#include "uiinput.h"
16#include "ui/ui.h"
17#include "ui/cheatopt.h"
18
19/*-------------------------------------------------
20    menu_cheat - handle the cheat menu
21-------------------------------------------------*/
22
23void ui_menu_cheat::handle()
24{
25   /* process the menu */
26   const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT);
27
28   /* handle events */
29   if (menu_event != NULL && menu_event->itemref != NULL)
30   {
31      bool changed = false;
32
33      /* clear cheat comment on any movement or keypress */
34      popmessage(NULL);
35
36      /* handle reset all + reset all cheats for reload all option */
37      if ((FPTR)menu_event->itemref < 3 && menu_event->iptkey == IPT_UI_SELECT)
38      {
39         for (cheat_entry *curcheat = machine().cheat().first(); curcheat != NULL; curcheat = curcheat->next())
40            if (curcheat->select_default_state())
41               changed = true;
42      }
43
44
45      /* handle individual cheats */
46      else if ((FPTR)menu_event->itemref > 2)
47      {
48         cheat_entry *curcheat = reinterpret_cast<cheat_entry *>(menu_event->itemref);
49         const char *string;
50         switch (menu_event->iptkey)
51         {
52            /* if selected, activate a oneshot */
53            case IPT_UI_SELECT:
54               changed = curcheat->activate();
55               break;
56
57            /* if cleared, reset to default value */
58            case IPT_UI_CLEAR:
59               changed = curcheat->select_default_state();
60               break;
61
62            /* left decrements */
63            case IPT_UI_LEFT:
64               changed = curcheat->select_previous_state();
65               break;
66
67            /* right increments */
68            case IPT_UI_RIGHT:
69               changed = curcheat->select_next_state();
70               break;
71
72            /* bring up display comment if one exists */
73            case IPT_UI_DISPLAY_COMMENT:
74            case IPT_UI_UP:
75            case IPT_UI_DOWN:
76               string = curcheat->comment();
77               if (string != NULL && string[0] != 0)
78                  popmessage("Cheat Comment:\n%s", string);
79               break;
80         }
81      }
82
83      /* handle reload all  */
84      if ((FPTR)menu_event->itemref == 2 && menu_event->iptkey == IPT_UI_SELECT)
85      {
86         /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */
87         machine().cheat().reload();
88
89         /* display the reloaded cheats */
90         reset(UI_MENU_RESET_REMEMBER_REF);
91         popmessage("All cheats reloaded");
92      }
93
94      /* if things changed, update */
95      if (changed)
96         reset(UI_MENU_RESET_REMEMBER_REF);
97   }
98}
99
100
101/*-------------------------------------------------
102    menu_cheat_populate - populate the cheat menu
103-------------------------------------------------*/
104
105ui_menu_cheat::ui_menu_cheat(running_machine &machine, render_container *container) : ui_menu(machine, container)
106{
107}
108
109void ui_menu_cheat::populate()
110{
111   /* iterate over cheats */
112   astring text;
113   astring subtext;
114   for (cheat_entry *curcheat = machine().cheat().first(); curcheat != NULL; curcheat = curcheat->next())
115   {
116      UINT32 flags;
117      curcheat->menu_text(text, subtext, flags);
118      item_append(text, subtext, flags, curcheat);
119   }
120
121   /* add a separator */
122   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
123
124   /* add a reset all option */
125   item_append("Reset All", NULL, 0, (void *)1);
126
127   /* add a reload all cheats option */
128   item_append("Reload All", NULL, 0, (void *)2);
129}
130
131ui_menu_cheat::~ui_menu_cheat()
132{
133}
trunk/src/emu/ui/cheatopt.h
r243192r243193
1/***************************************************************************
2
3    ui/cheatopt.h
4
5    Internal menu for the cheat interface.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_CHEATOPT_H__
15#define __UI_CHEATOPT_H__
16
17class ui_menu_cheat : public ui_menu {
18public:
19   ui_menu_cheat(running_machine &machine, render_container *container);
20   virtual ~ui_menu_cheat();
21   virtual void populate();
22   virtual void handle();
23};
24
25#endif  /* __UI_CHEATOPT_H__ */
trunk/src/emu/ui/devctrl.h
r243192r243193
99    printers)
1010    The base class contains calls to get the total number of devices of
1111    the same kind connected to the driver, and shortcuts to switch current
12    device to next one or previous one attached. This allows, for instance,
13    users to pass from a device to another one by simply pressing left/right
14    and the menu is rebuilt accordingly, without the need of a preliminary
12    device to next one or previous one attached. This allows, for instance,
13    users to pass from a device to another one by simply pressing left/right
14    and the menu is rebuilt accordingly, without the need of a preliminary
1515    submenu listing available devices of the same kind.
1616
1717    Copyright Nicola Salmoria and the MAME Team.
trunk/src/emu/ui/devopt.c
r243192r243193
4646   string.catprintf("Option: %s\n", m_option->name());
4747
4848   dev = const_cast<machine_config &>(machine().config()).device_add(&machine().config().root_device(), m_option->name(), m_option->devtype(), 0);
49
49     
5050   string.catprintf("Device: %s\n", dev->name());
5151   if (!m_mounted)
5252      string.cat("\nIf you select this option, the following items will be enabled:\n");
r243192r243193
6666
6767         // get cpu specific clock that takes internal multiplier/dividers into account
6868         int clock = exec->device().clock();
69
69         
7070         // count how many identical CPUs we have
7171         int count = 1;
7272         const char *name = exec->device().name();
r243192r243193
7777               if (exectags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE)
7878                  count++;
7979         }
80
80         
8181         // if more than one, prepend a #x in front of the CPU name
8282         if (count > 1)
8383            string.catprintf("  %d" UTF8_MULTIPLY, count);
8484         else
8585            string.cat("  ");
8686         string.cat(name);
87
87         
8888         // display clock in kHz or MHz
8989         if (clock >= 1000000)
9090            string.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
r243192r243193
9292            string.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
9393      }
9494   }
95
95   
9696   // display screen information
9797   screen_device_iterator scriter(*dev);
9898   if (scriter.count() > 0)
r243192r243193
101101      for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next())
102102      {
103103         string.catprintf("  Screen '%s': ", screen->tag());
104
104         
105105         if (screen->screen_type() == SCREEN_TYPE_VECTOR)
106106            string.cat("Vector\n");
107107         else
108108         {
109109            const rectangle &visarea = screen->visible_area();
110
110           
111111            string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
112                           visarea.width(), visarea.height(),
113                           (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
114                           ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
112                         visarea.width(), visarea.height(),
113                         (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
114                         ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
115115         }
116116      }
117117   }
118
118   
119119   // loop over all sound chips
120120   sound_interface_iterator snditer(*dev);
121121   if (snditer.count() > 0)
r243192r243193
126126      {
127127         if (soundtags.add(sound->device().tag(), 1, FALSE) == TMERR_DUPLICATE)
128128            continue;
129
129         
130130         // count how many identical sound chips we have
131131         int count = 1;
132132         sound_interface_iterator sndinneriter(*dev);
r243192r243193
142142         else
143143            string.cat("  ");
144144         string.cat(sound->device().name());
145
145         
146146         // display clock in kHz or MHz
147147         int clock = sound->device().clock();
148148         if (clock >= 1000000)
r243192r243193
153153            string.cat("\n");
154154      }
155155   }
156
157   // scan for BIOS settings
158   int bios = 0;
159   if (dev->rom_region())
160   {
161      astring bios_str;
162      // first loop through roms in search of default bios (shortname)
163      for (const rom_entry *rom = dev->rom_region(); !ROMENTRY_ISEND(rom); rom++)
164         if (ROMENTRY_ISDEFAULT_BIOS(rom))
165            bios_str.cpy(ROM_GETNAME(rom));
166
167      // then loop again to count bios options and to get the default bios complete name
168      for (const rom_entry *rom = dev->rom_region(); !ROMENTRY_ISEND(rom); rom++)
169      {
170         if (ROMENTRY_ISSYSTEM_BIOS(rom))
171         {
172            bios++;
173            if (bios_str == ROM_GETNAME(rom))
174               bios_str.cpy(ROM_GETHASHDATA(rom));
175         }
176      }
177
178      if (bios)
179         string.catprintf("* BIOS settings:\n  %d options    [default: %s]\n", bios, bios_str.cstr());
180   }
181
156   
182157   int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0;
183   int input_keypad = 0, input_keyboard = 0, dips = 0, confs = 0;
158   int dips = 0, confs = 0;
184159   astring errors, dips_opt, confs_opt;
185160   ioport_list portlist;
186161   device_iterator iptiter(*dev);
r243192r243193
201176            input_analog++;
202177         else if (field->type() == IPT_ADJUSTER)
203178            input_adjust++;
204         else if (field->type() == IPT_KEYPAD)
205            input_keypad++;
206         else if (field->type() == IPT_KEYBOARD)
207            input_keyboard++;
208179         else if (field->type() >= IPT_START1 && field->type() < IPT_UI_FIRST)
209180            input++;
210181         else if (field->type() == IPT_DIPSWITCH)
r243192r243193
239210      string.cat("* Dispwitch settings:\n").cat(dips_opt);
240211   if (confs)
241212      string.cat("* Configuration settings:\n").cat(confs_opt);
242   if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard)
213   if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust)
243214      string.cat("* Input device(s):\n");
244215   if (input)
245      string.catprintf("  User inputs    [%d inputs]\n", input);
216      string.catprintf("  Player inputs    [%d inputs]\n", input);
246217   if (input_mj)
247218      string.catprintf("  Mahjong inputs    [%d inputs]\n", input_mj);
248219   if (input_hana)
r243192r243193
253224      string.catprintf("  Analog inputs    [%d inputs]\n", input_analog);
254225   if (input_adjust)
255226      string.catprintf("  Adjuster inputs    [%d inputs]\n", input_adjust);
256   if (input_keypad)
257      string.catprintf("  Keypad inputs    [%d inputs]\n", input_keypad);
258   if (input_keyboard)
259      string.catprintf("  Keyboard inputs    [%d inputs]\n", input_keyboard);
260227
261228   image_interface_iterator imgiter(*dev);
262229   if (imgiter.count() > 0)
r243192r243193
265232      for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next())
266233         string.catprintf("  %s    [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag());
267234   }
268
235   
269236   slot_interface_iterator slotiter(*dev);
270237   if (slotiter.count() > 0)
271238   {
r243192r243193
274241         string.catprintf("  %s    [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----");
275242   }
276243
277   if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + bios + dips + confs
278         + input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) == 0)
244   if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + input + input_mj + input_hana + input_gamble + input_analog + input_adjust) == 0)
279245      string.cat("[None]\n");
280246
281247   const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name());
trunk/src/emu/ui/devopt.h
r243192r243193
11/***************************************************************************
22
33    ui/devopt.h
4
4
55    Internal menu for the device configuration.
6
6
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
trunk/src/emu/ui/filemngr.c
r243192r243193
66
77    TODO
88        - Restrict directory listing by file extension
9        - Support file manager invocation from the main menu for
10          required images
911
1012*********************************************************************/
1113
14#include <stdio.h>
15#include <ctype.h>
16#include <stdlib.h>
17
1218#include "emu.h"
1319#include "ui/ui.h"
1420#include "ui/swlist.h"
1521#include "ui/filemngr.h"
1622#include "ui/filesel.h"
17#include "ui/miscmenu.h"
1823
1924
2025/***************************************************************************
r243192r243193
2530//  ctor
2631//-------------------------------------------------
2732
28ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings) : ui_menu(machine, container)
33ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container)
2934{
30   // This warning string is used when accessing from the force_file_manager call, i.e.
31   // when the file manager is loaded top front in the case of mandatory image devices
32   if (warnings)
33      m_warnings.cpy(warnings);
34   else
35      m_warnings.reset();
3635}
3736
3837
r243192r243193
6463{
6564   // get the image type/id
6665   instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name());
67
66   
6867   // get the base name
6968   if (img->basename() != NULL)
7069   {
7170      filename.cpy(img->basename());
72
71     
7372      // if the image has been loaded through softlist, also show the loaded part
7473      if (img->part_entry() != NULL)
7574      {
r243192r243193
102101   bool first_entry = true;
103102   astring prev_owner;
104103
105   if (m_warnings)
106   {
107      item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL);
108      item_append("", NULL, MENU_FLAG_DISABLE, NULL);
109   }
110
111104   // cycle through all devices for this system
112105   device_iterator iter(machine().root_device());
113106   tagmap_t<UINT8> devtags;
r243192r243193
120113      // check whether it owns an image interface
121114      image_interface_iterator subiter(*dev);
122115      if (subiter.count() > 0)
123      {
116      {         
124117         // if so, cycle through all its image interfaces
125118         image_interface_iterator subiter(*dev);
126119         for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next())
r243192r243193
172165         if (selected_device != NULL)
173166         {
174167            ui_menu::stack_push(selected_device->get_selection_menu(machine(), container));
175
168           
176169            // reset the existing menu
177170            reset(UI_MENU_RESET_REMEMBER_POSITION);
178171         }
179172      }
180173   }
181174}
182
183// force file manager menu
184void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings)
185{
186   // reset the menu stack
187   ui_menu::stack_reset(machine);
188
189   // add the quit entry followed by the game select entry
190   ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container));
191   quit->set_special_main_menu(true);
192   ui_menu::stack_push(quit);
193   ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings)));
194
195   // force the menus on
196   machine.ui().show_menu();
197
198   // make sure MAME is paused
199   machine.pause();
200}
trunk/src/emu/ui/filemngr.h
r243192r243193
2020   astring current_file;
2121   device_image_interface *selected_device;
2222
23   static void force_file_manager(running_machine &machine, render_container *container, const char *warnings);
24
25   ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings);
23   ui_menu_file_manager(running_machine &machine, render_container *container);
2624   virtual ~ui_menu_file_manager();
2725   virtual void populate();
2826   virtual void handle();
2927   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
3028
3129   void fill_image_line(device_image_interface *img, astring &instance, astring &filename);
32
33private:
34   astring m_warnings;
3530};
3631
3732#endif  /* __UI_FILEMNGR_H__ */
trunk/src/emu/ui/imgcntrl.c
r243192r243193
1616#include "ui/filesel.h"
1717#include "ui/swlist.h"
1818#include "zippath.h"
19#include "audit.h"
2019
2120
2221/***************************************************************************
r243192r243193
133132void ui_menu_control_device_image::load_software_part()
134133{
135134   astring temp_name(sld->list_name(), ":", swi->shortname(), ":", swp->name());
136
137   driver_enumerator drivlist(machine().options(), machine().options().system_name());
138   media_auditor auditor(drivlist);
139   media_auditor::summary summary = auditor.audit_software(sld->list_name(), (software_info *)swi, AUDIT_VALIDATE_FAST);
140   // if everything looks good, load software
141   if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
142      hook_load(temp_name, true);
143   else
144   {
145      popmessage("The selected game is missing one or more required ROM or CHD images. Please select a different game.");
146      state = SELECT_SOFTLIST;
147   }
135   hook_load(temp_name, true);
148136}
149137
150138
r243192r243193
229217      {
230218         swp = swi->first_part();
231219         load_software_part();
220         ui_menu::stack_pop(machine());
232221      }
233222      break;
234223
r243192r243193
236225      switch(submenu_result) {
237226      case ui_menu_software_parts::T_ENTRY: {
238227         load_software_part();
228         ui_menu::stack_pop(machine());
239229         break;
240230      }
241231
r243192r243193
328318      state = create_ok ? CREATE_FILE : START_FILE;
329319      handle();
330320      break;
331
321         
332322   case DO_CREATE: {
333323      astring path;
334324      zippath_combine(path, current_directory, current_file);
trunk/src/emu/ui/imgcntrl.h
r243192r243193
1414#ifndef __UI_IMGCNTRL_H__
1515#define __UI_IMGCNTRL_H__
1616
17#include "drivenum.h"
18
1917// ======================> ui_menu_control_device_image
2018
2119class ui_menu_control_device_image : public ui_menu {
r243192r243193
2725
2826protected:
2927   enum {
30      START_FILE, START_OTHER_PART, START_SOFTLIST,
31      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
28      START_FILE, START_OTHER_PART, START_SOFTLIST,
29      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
3230      SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, CHECK_CREATE, DO_CREATE, SELECT_SOFTLIST,
3331      LAST_ID
3432   };
trunk/src/emu/ui/imginfo.c
r0r243193
1/***************************************************************************
2
3    ui/imginfo.c
4
5    Image info screen
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "emu.h"
13#include "ui/menu.h"
14#include "ui/imginfo.h"
15
16
17/***************************************************************************
18    IMPLEMENTATION
19***************************************************************************/
20
21//-------------------------------------------------
22//  ctor
23//-------------------------------------------------
24
25ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
26{
27}
28
29
30//-------------------------------------------------
31//  dtor
32//-------------------------------------------------
33
34ui_menu_image_info::~ui_menu_image_info()
35{
36}
37
38
39//-------------------------------------------------
40//  populate
41//-------------------------------------------------
42
43void ui_menu_image_info::populate()
44{
45   item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL);
46   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
47
48   image_interface_iterator iter(machine().root_device());
49   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
50         image_info(image);
51}
52
53
54//-------------------------------------------------
55//  handle
56//-------------------------------------------------
57
58void ui_menu_image_info::handle()
59{
60   // process the menu
61   process(0);
62}
63
64
65//-------------------------------------------------
66//  image_info - display image info for a specific
67//  image interface device
68//-------------------------------------------------
69
70void ui_menu_image_info::image_info(device_image_interface *image)
71{
72   if (image->exists())
73   {
74      // display device type and filename
75      item_append(image->brief_instance_name(), image->basename(), 0, NULL);
76
77      // if image has been loaded through softlist, let's add some more info
78      if (image->software_entry())
79      {
80         astring string;
81
82         // display long filename
83         item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
84         
85         // display manufacturer and year
86         string.catprintf("%s, %s", image->manufacturer(), image->year());
87         item_append(string, "", MENU_FLAG_DISABLE, NULL);
88
89         // display supported information, if available
90         switch (image->supported())
91         {
92            case SOFTWARE_SUPPORTED_NO:
93               item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
94               break;
95            case SOFTWARE_SUPPORTED_PARTIAL:
96               item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
97               break;
98            default:
99               break;
100         }
101      }
102   }
103   else
104      item_append(image->brief_instance_name(), "[empty]", 0, NULL);
105   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
106}
trunk/src/emu/ui/imginfo.h
r0r243193
1/***************************************************************************
2
3    ui/imginfo.h
4
5    Image info screen
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_IMGINFO_H__
15#define __UI_IMGINFO_H__
16
17class ui_menu_image_info : public ui_menu
18{
19public:
20   ui_menu_image_info(running_machine &machine, render_container *container);
21   virtual ~ui_menu_image_info();
22   virtual void populate();
23   virtual void handle();
24
25private:
26   void image_info(device_image_interface *image);
27};
28
29#endif // __UI_IMGINFO_H__
trunk/src/emu/ui/info.c
r243192r243193
1/***************************************************************************
2
3    ui/info.c
4
5    System and image info screens
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "emu.h"
13#include "ui/menu.h"
14#include "ui/info.h"
15#include "ui/ui.h"
16
17/*-------------------------------------------------
18  menu_game_info - handle the game information
19  menu
20 -------------------------------------------------*/
21
22ui_menu_game_info::ui_menu_game_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
23{
24}
25
26ui_menu_game_info::~ui_menu_game_info()
27{
28}
29
30void ui_menu_game_info::populate()
31{
32   astring tempstring;
33   item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
34}
35
36void ui_menu_game_info::handle()
37{
38   // process the menu
39   process(0);
40}
41
42
43/*-------------------------------------------------
44  ui_menu_image_info - handle the image information
45  menu
46 -------------------------------------------------*/
47
48ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
49{
50}
51
52ui_menu_image_info::~ui_menu_image_info()
53{
54}
55
56void ui_menu_image_info::populate()
57{
58   item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL);
59   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
60
61   image_interface_iterator iter(machine().root_device());
62   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
63         image_info(image);
64}
65
66void ui_menu_image_info::handle()
67{
68   // process the menu
69   process(0);
70}
71
72
73/*-------------------------------------------------
74  image_info - display image info for a specific
75  image interface device
76-------------------------------------------------*/
77
78void ui_menu_image_info::image_info(device_image_interface *image)
79{
80   if (image->exists())
81   {
82      // display device type and filename
83      item_append(image->brief_instance_name(), image->basename(), 0, NULL);
84
85      // if image has been loaded through softlist, let's add some more info
86      if (image->software_entry())
87      {
88         astring string;
89
90         // display long filename
91         item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
92
93         // display manufacturer and year
94         string.catprintf("%s, %s", image->manufacturer(), image->year());
95         item_append(string, "", MENU_FLAG_DISABLE, NULL);
96
97         // display supported information, if available
98         switch (image->supported())
99         {
100            case SOFTWARE_SUPPORTED_NO:
101               item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
102               break;
103            case SOFTWARE_SUPPORTED_PARTIAL:
104               item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
105               break;
106            default:
107               break;
108         }
109      }
110   }
111   else
112      item_append(image->brief_instance_name(), "[empty]", 0, NULL);
113   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
114}
trunk/src/emu/ui/info.h
r243192r243193
1/***************************************************************************
2
3    ui/info.h
4
5    System and image info screens
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_INFO_H__
15#define __UI_INFO_H__
16
17class ui_menu_game_info : public ui_menu {
18public:
19   ui_menu_game_info(running_machine &machine, render_container *container);
20   virtual ~ui_menu_game_info();
21   virtual void populate();
22   virtual void handle();
23};
24
25
26class ui_menu_image_info : public ui_menu
27{
28public:
29   ui_menu_image_info(running_machine &machine, render_container *container);
30   virtual ~ui_menu_image_info();
31   virtual void populate();
32   virtual void handle();
33
34private:
35   void image_info(device_image_interface *image);
36};
37
38#endif // __UI_INFO_H__
trunk/src/emu/ui/inputmap.c
r243192r243193
154154void ui_menu_input_specific::populate()
155155{
156156   input_item_data *itemlist = NULL;
157   ioport_field *field;
158   ioport_port *port;
157159   int suborder[SEQ_TYPE_TOTAL];
158160   astring tempstring;
159   int port_count = 0;
160161
161162   /* create a mini lookup table for sort order based on sequence type */
162163   suborder[SEQ_TYPE_STANDARD] = 0;
r243192r243193
164165   suborder[SEQ_TYPE_INCREMENT] = 2;
165166
166167   /* iterate over the input ports and add menu items */
167   for (ioport_port *port = machine().ioport().first_port(); port != NULL; port = port->next())
168   {
169      port_count++;
170      for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
168   for (port = machine().ioport().first_port(); port != NULL; port = port->next())
169      for (field = port->first_field(); field != NULL; field = field->next())
171170      {
172171         const char *name = field->name();
173172
r243192r243193
183182            {
184183               sortorder = (field->type() << 2) | (field->player() << 12);
185184               if (strcmp(field->device().tag(), ":"))
186                  sortorder |= (port_count & 0xfff) * 0x10000;
185                  sortorder |= 0x10000;
187186            }
188187            else
189188               sortorder = field->type() | 0xf000;
r243192r243193
213212            }
214213         }
215214      }
216   }
217215
218216   /* sort and populate the menu in a standard fashion */
219217   populate_and_sort(itemlist);
r243192r243193
487485   if (menu_event != NULL && menu_event->itemref != NULL)
488486   {
489487      // reset
490      if ((FPTR)menu_event->itemref == 1)
488      if ((FPTR)menu_event->itemref == 1)
491489      {
492490         if (menu_event->iptkey == IPT_UI_SELECT)
493491            machine().schedule_hard_reset();
r243192r243193
498496         ioport_field *field = (ioport_field *)menu_event->itemref;
499497         ioport_field::user_settings settings;
500498         int changed = false;
501
499         
502500         switch (menu_event->iptkey)
503501         {
504502            /* if selected, reset to default value */
r243192r243193
508506               field->set_user_settings(settings);
509507               changed = true;
510508               break;
511
509               
512510            /* left goes to previous setting */
513511            case IPT_UI_LEFT:
514512               field->select_previous_setting();
515513               changed = true;
516514               break;
517
515               
518516            /* right goes to next setting */
519517            case IPT_UI_RIGHT:
520518               field->select_next_setting();
521519               changed = true;
522520               break;
523521         }
524
522         
525523         /* if anything changed, rebuild the menu, trying to stay on the same field */
526524         if (changed)
527525            reset(UI_MENU_RESET_REMEMBER_REF);
r243192r243193
628626         }
629627   if (type == IPT_DIPSWITCH)
630628      custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0;
631
629   
632630   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
633631   item_append("Reset",  NULL, 0, (void *)1);
634632}
r243192r243193
661659   {
662660      const ioport_diplocation *diploc;
663661      UINT32 selectedmask = 0;
664
662     
665663      // determine the mask of selected bits
666664      if ((FPTR)selectedref != 1)
667665      {
668666         ioport_field *field = (ioport_field *)selectedref;
669
667         
670668         if (field != NULL && field->first_diplocation() != NULL)
671669            for (diploc = field->first_diplocation(); diploc != NULL; diploc = diploc->next())
672670               if (strcmp(dip->name, diploc->name()) == 0)
673671                  selectedmask |= 1 << (diploc->number() - 1);
674672      }
675
673     
676674      // draw one switch
677675      custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask);
678676      y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT);
r243192r243193
884882                  }
885883
886884                  name.cpy(field->name());
887
885                 
888886                  /* allocate a data item for tracking what this menu item refers to */
889887                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
890888                  data->field = field;
trunk/src/emu/ui/mainmenu.c
r243192r243193
1010*********************************************************************/
1111
1212#include "emu.h"
13#include "audit.h"
14#include "crsshair.h"
1513#include "osdnet.h"
1614#include "emuopts.h"
15#include "ui/ui.h"
1716#include "rendutil.h"
1817#include "cheat.h"
1918#include "uiinput.h"
20#include "ui/ui.h"
2119#include "ui/filemngr.h"
2220#include "ui/filesel.h"
2321#include "ui/barcode.h"
24#include "ui/cheatopt.h"
25#include "ui/info.h"
22#include "ui/imginfo.h"
2623#include "ui/inputmap.h"
2724#include "ui/mainmenu.h"
2825#include "ui/miscmenu.h"
2926#include "ui/selgame.h"
30#include "ui/sliders.h"
3127#include "ui/slotopt.h"
3228#include "ui/tapectrl.h"
33#include "ui/videoopt.h"
29#include "audit.h"
30#include "crsshair.h"
31#include <ctype.h>
3432#include "imagedev/cassette.h"
3533#include "imagedev/bitbngr.h"
3634#include "machine/bcreader.h"
r243192r243193
185183         break;
186184
187185      case IMAGE_MENU_FILE_MANAGER:
188         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container, NULL)));
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
189187         break;
190188
191189      case TAPE_CONTROL:
trunk/src/emu/ui/mainmenu.h
r243192r243193
1414#ifndef __UI_MAINMENU_H__
1515#define __UI_MAINMENU_H__
1616
17#include "crsshair.h"
1718#include "drivenum.h"
1819
1920class ui_menu_main : public ui_menu {
trunk/src/emu/ui/menu.c
r243192r243193
1111
1212#include "emu.h"
1313#include "emuopts.h"
14#include "ui/ui.h"
1415#include "rendutil.h"
16#include "uiinput.h"
1517#include "cheat.h"
16#include "uiinput.h"
17#include "ui/ui.h"
1818#include "ui/mainmenu.h"
19#include "ui/cheatopt.h"
19#include "ui/miscmenu.h"
20#include <ctype.h>
2021
2122
2223
trunk/src/emu/ui/miscmenu.c
r243192r243193
99
1010*********************************************************************/
1111
12#include <ctype.h>
13
1214#include "emu.h"
15#include "emuopts.h"
16
17#include "cheat.h"
1318#include "osdnet.h"
19#include "rendutil.h"
1420
1521#include "uiinput.h"
1622#include "ui/ui.h"
1723#include "ui/miscmenu.h"
1824#include "ui/filemngr.h"
1925
26#include "osdepend.h"
2027
28/*-------------------------------------------------
29    ui_slider_ui_handler - pushes the slider
30    menu on the stack and hands off to the
31    standard menu handler
32-------------------------------------------------*/
33
34UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *container, UINT32 state)
35{
36   UINT32 result;
37
38   /* if this is the first call, push the sliders menu */
39   if (state)
40      ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_sliders(machine, container, true)));
41
42   /* handle standard menus */
43   result = ui_menu::ui_handler(machine, container, state);
44
45   /* if we are cancelled, pop the sliders menu */
46   if (result == UI_HANDLER_CANCEL)
47      ui_menu::stack_pop(machine);
48
49   ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack);
50   return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL;
51}
52
53
2154/***************************************************************************
2255    MENU HANDLERS
2356***************************************************************************/
r243192r243193
270303   item_append(tempstring, NULL, MENU_FLAG_MULTILINE, NULL);
271304}
272305
306
273307/*-------------------------------------------------
308    menu_game_info - handle the game information
309    menu
310-------------------------------------------------*/
311
312ui_menu_game_info::ui_menu_game_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
313{
314}
315
316void ui_menu_game_info::populate()
317{
318   astring tempstring;
319   item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
320}
321
322void ui_menu_game_info::handle()
323{
324   /* process the menu */
325   process(0);
326}
327
328ui_menu_game_info::~ui_menu_game_info()
329{
330}
331
332/*-------------------------------------------------
333    menu_cheat - handle the cheat menu
334-------------------------------------------------*/
335
336void ui_menu_cheat::handle()
337{
338   /* process the menu */
339   const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT);
340
341   /* handle events */
342   if (menu_event != NULL && menu_event->itemref != NULL)
343   {
344      bool changed = false;
345
346      /* clear cheat comment on any movement or keypress */
347      popmessage(NULL);
348
349      /* handle reset all + reset all cheats for reload all option */
350      if ((FPTR)menu_event->itemref < 3 && menu_event->iptkey == IPT_UI_SELECT)
351      {
352         for (cheat_entry *curcheat = machine().cheat().first(); curcheat != NULL; curcheat = curcheat->next())
353            if (curcheat->select_default_state())
354               changed = true;
355      }
356
357
358      /* handle individual cheats */
359      else if ((FPTR)menu_event->itemref > 2)
360      {
361         cheat_entry *curcheat = reinterpret_cast<cheat_entry *>(menu_event->itemref);
362         const char *string;
363         switch (menu_event->iptkey)
364         {
365            /* if selected, activate a oneshot */
366            case IPT_UI_SELECT:
367               changed = curcheat->activate();
368               break;
369
370            /* if cleared, reset to default value */
371            case IPT_UI_CLEAR:
372               changed = curcheat->select_default_state();
373               break;
374
375            /* left decrements */
376            case IPT_UI_LEFT:
377               changed = curcheat->select_previous_state();
378               break;
379
380            /* right increments */
381            case IPT_UI_RIGHT:
382               changed = curcheat->select_next_state();
383               break;
384
385            /* bring up display comment if one exists */
386            case IPT_UI_DISPLAY_COMMENT:
387            case IPT_UI_UP:
388            case IPT_UI_DOWN:
389               string = curcheat->comment();
390               if (string != NULL && string[0] != 0)
391                  popmessage("Cheat Comment:\n%s", string);
392               break;
393         }
394      }
395
396      /* handle reload all  */
397      if ((FPTR)menu_event->itemref == 2 && menu_event->iptkey == IPT_UI_SELECT)
398      {
399         /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */
400         machine().cheat().reload();
401
402         /* display the reloaded cheats */
403         reset(UI_MENU_RESET_REMEMBER_REF);
404         popmessage("All cheats reloaded");
405      }
406
407      /* if things changed, update */
408      if (changed)
409         reset(UI_MENU_RESET_REMEMBER_REF);
410   }
411}
412
413
414/*-------------------------------------------------
415    menu_cheat_populate - populate the cheat menu
416-------------------------------------------------*/
417
418ui_menu_cheat::ui_menu_cheat(running_machine &machine, render_container *container) : ui_menu(machine, container)
419{
420}
421
422void ui_menu_cheat::populate()
423{
424   /* iterate over cheats */
425   astring text;
426   astring subtext;
427   for (cheat_entry *curcheat = machine().cheat().first(); curcheat != NULL; curcheat = curcheat->next())
428   {
429      UINT32 flags;
430      curcheat->menu_text(text, subtext, flags);
431      item_append(text, subtext, flags, curcheat);
432   }
433
434   /* add a separator */
435   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
436
437   /* add a reset all option */
438   item_append("Reset All", NULL, 0, (void *)1);
439
440   /* add a reload all cheats option */
441   item_append("Reload All", NULL, 0, (void *)2);
442}
443
444ui_menu_cheat::~ui_menu_cheat()
445{
446}
447
448/*-------------------------------------------------
449    menu_sliders - handle the sliders menu
450-------------------------------------------------*/
451
452void ui_menu_sliders::handle()
453{
454   const ui_menu_event *menu_event;
455
456   /* process the menu */
457   menu_event = process(UI_MENU_PROCESS_LR_REPEAT | (hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0));
458   if (menu_event != NULL)
459   {
460      /* handle keys if there is a valid item selected */
461      if (menu_event->itemref != NULL)
462      {
463         const slider_state *slider = (const slider_state *)menu_event->itemref;
464         INT32 curvalue = (*slider->update)(machine(), slider->arg, NULL, SLIDER_NOCHANGE);
465         INT32 increment = 0;
466
467         switch (menu_event->iptkey)
468         {
469            /* toggle visibility */
470            case IPT_UI_ON_SCREEN_DISPLAY:
471               if (menuless_mode)
472                  ui_menu::stack_pop(machine());
473               else
474                  hidden = !hidden;
475               break;
476
477            /* decrease value */
478            case IPT_UI_LEFT:
479               if (machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT))
480                  increment = -1;
481               else if (machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT))
482                  increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
483               else if (machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL))
484                  increment = -slider->incval * 10;
485               else
486                  increment = -slider->incval;
487               break;
488
489            /* increase value */
490            case IPT_UI_RIGHT:
491               if (machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT))
492                  increment = 1;
493               else if (machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT))
494                  increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
495               else if (machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL))
496                  increment = slider->incval * 10;
497               else
498                  increment = slider->incval;
499               break;
500
501            /* restore default */
502            case IPT_UI_SELECT:
503               increment = slider->defval - curvalue;
504               break;
505         }
506
507         /* handle any changes */
508         if (increment != 0)
509         {
510            INT32 newvalue = curvalue + increment;
511
512            /* clamp within bounds */
513            if (newvalue < slider->minval)
514               newvalue = slider->minval;
515            if (newvalue > slider->maxval)
516               newvalue = slider->maxval;
517
518            /* update the slider and recompute the menu */
519            (*slider->update)(machine(), slider->arg, NULL, newvalue);
520            reset(UI_MENU_RESET_REMEMBER_REF);
521         }
522      }
523
524      /* if we are selecting an invalid item and we are hidden, skip to the next one */
525      else if (hidden)
526      {
527         /* if we got here via up or page up, select the previous item */
528         if (menu_event->iptkey == IPT_UI_UP || menu_event->iptkey == IPT_UI_PAGE_UP)
529         {
530            selected = (selected + numitems - 1) % numitems;
531            validate_selection(-1);
532         }
533
534         /* otherwise select the next item */
535         else if (menu_event->iptkey == IPT_UI_DOWN || menu_event->iptkey == IPT_UI_PAGE_DOWN)
536         {
537            selected = (selected + 1) % numitems;
538            validate_selection(1);
539         }
540      }
541   }
542}
543
544
545/*-------------------------------------------------
546    menu_sliders_populate - populate the sliders
547    menu
548-------------------------------------------------*/
549
550ui_menu_sliders::ui_menu_sliders(running_machine &machine, render_container *container, bool _menuless_mode) : ui_menu(machine, container)
551{
552   menuless_mode = hidden = _menuless_mode;
553}
554
555void ui_menu_sliders::populate()
556{
557   const slider_state *curslider;
558   astring tempstring;
559
560   /* add all sliders */
561   for (curslider = machine().ui().get_slider_list(); curslider != NULL; curslider = curslider->next)
562   {
563      INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
564      UINT32 flags = 0;
565      if (curval > curslider->minval)
566         flags |= MENU_FLAG_LEFT_ARROW;
567      if (curval < curslider->maxval)
568         flags |= MENU_FLAG_RIGHT_ARROW;
569      item_append(curslider->description, tempstring, flags, (void *)curslider);
570
571      if (menuless_mode)
572         break;
573   }
574
575   /* add all sliders */
576   for (curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next)
577   {
578      INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
579      UINT32 flags = 0;
580      if (curval > curslider->minval)
581         flags |= MENU_FLAG_LEFT_ARROW;
582      if (curval < curslider->maxval)
583         flags |= MENU_FLAG_RIGHT_ARROW;
584      item_append(curslider->description, tempstring, flags, (void *)curslider);
585   }
586
587   custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
588}
589
590ui_menu_sliders::~ui_menu_sliders()
591{
592}
593
594/*-------------------------------------------------
595    menu_sliders_custom_render - perform our special
596    rendering
597-------------------------------------------------*/
598
599void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
600{
601   const slider_state *curslider = (const slider_state *)selectedref;
602   if (curslider != NULL)
603   {
604      float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x;
605      float line_height = machine().ui().get_line_height();
606      float percentage, default_percentage;
607      astring tempstring;
608      float text_height;
609      INT32 curval;
610
611      /* determine the current value and text */
612      curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
613
614      /* compute the current and default percentages */
615      percentage = (float)(curval - curslider->minval) / (float)(curslider->maxval - curslider->minval);
616      default_percentage = (float)(curslider->defval - curslider->minval) / (float)(curslider->maxval - curslider->minval);
617
618      /* assemble the text */
619      tempstring.ins(0, " ").ins(0, curslider->description);
620
621      /* move us to the bottom of the screen, and expand to full width */
622      y2 = 1.0f - UI_BOX_TB_BORDER;
623      y1 = y2 - bottom;
624      x1 = UI_BOX_LR_BORDER;
625      x2 = 1.0f - UI_BOX_LR_BORDER;
626
627      /* draw extra menu area */
628      machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
629      y1 += UI_BOX_TB_BORDER;
630
631      /* determine the text height */
632      machine().ui().draw_text_full(container, tempstring, 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
633               JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, NULL, &text_height);
634
635      /* draw the thermometer */
636      bar_left = x1 + UI_BOX_LR_BORDER;
637      bar_area_top = y1;
638      bar_width = x2 - x1 - 2.0f * UI_BOX_LR_BORDER;
639      bar_area_height = line_height;
640
641      /* compute positions */
642      bar_top = bar_area_top + 0.125f * bar_area_height;
643      bar_bottom = bar_area_top + 0.875f * bar_area_height;
644      default_x = bar_left + bar_width * default_percentage;
645      current_x = bar_left + bar_width * percentage;
646
647      /* fill in the percentage */
648      container->add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
649
650      /* draw the top and bottom lines */
651      container->add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
652      container->add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
653
654      /* draw default marker */
655      container->add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
656      container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
657
658      /* draw the actual text */
659      machine().ui().draw_text_full(container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
660               JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, &text_height);
661   }
662}
663
664
665/*-------------------------------------------------
666    menu_video_targets - handle the video targets
667    menu
668-------------------------------------------------*/
669
670void ui_menu_video_targets::handle()
671{
672   /* process the menu */
673   const ui_menu_event *menu_event = process(0);
674   if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT)
675      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, static_cast<render_target *>(menu_event->itemref))));
676}
677
678
679/*-------------------------------------------------
680    menu_video_targets_populate - populate the
681    video targets menu
682-------------------------------------------------*/
683
684ui_menu_video_targets::ui_menu_video_targets(running_machine &machine, render_container *container) : ui_menu(machine, container)
685{
686}
687
688void ui_menu_video_targets::populate()
689{
690   int targetnum;
691
692   /* find the targets */
693   for (targetnum = 0; ; targetnum++)
694   {
695      render_target *target = machine().render().target_by_index(targetnum);
696      char buffer[40];
697
698      /* stop when we run out */
699      if (target == NULL)
700         break;
701
702      /* add a menu item */
703      sprintf(buffer, "Screen #%d", targetnum);
704      item_append(buffer, NULL, 0, target);
705   }
706}
707
708ui_menu_video_targets::~ui_menu_video_targets()
709{
710}
711
712/*-------------------------------------------------
713    menu_video_options - handle the video options
714    menu
715-------------------------------------------------*/
716
717void ui_menu_video_options::handle()
718{
719   bool changed = false;
720
721   /* process the menu */
722   const ui_menu_event *menu_event = process(0);
723   if (menu_event != NULL && menu_event->itemref != NULL)
724   {
725      switch ((FPTR)menu_event->itemref)
726      {
727         /* rotate adds rotation depending on the direction */
728         case VIDEO_ITEM_ROTATE:
729            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
730            {
731               int delta = (menu_event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90;
732               target->set_orientation(orientation_add(delta, target->orientation()));
733               if (target->is_ui_target())
734               {
735                  render_container::user_settings settings;
736                  container->get_user_settings(settings);
737                  settings.m_orientation = orientation_add(delta ^ ROT180, settings.m_orientation);
738                  container->set_user_settings(settings);
739               }
740               changed = true;
741            }
742            break;
743
744         /* layer config bitmasks handle left/right keys the same (toggle) */
745         case VIDEO_ITEM_BACKDROPS:
746            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
747            {
748               target->set_backdrops_enabled(!target->backdrops_enabled());
749               changed = true;
750            }
751            break;
752
753         case VIDEO_ITEM_OVERLAYS:
754            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
755            {
756               target->set_overlays_enabled(!target->overlays_enabled());
757               changed = true;
758            }
759            break;
760
761         case VIDEO_ITEM_BEZELS:
762            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
763            {
764               target->set_bezels_enabled(!target->bezels_enabled());
765               changed = true;
766            }
767            break;
768
769         case VIDEO_ITEM_CPANELS:
770            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
771            {
772               target->set_cpanels_enabled(!target->cpanels_enabled());
773               changed = true;
774            }
775            break;
776
777         case VIDEO_ITEM_MARQUEES:
778            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
779            {
780               target->set_marquees_enabled(!target->marquees_enabled());
781               changed = true;
782            }
783            break;
784
785         case VIDEO_ITEM_ZOOM:
786            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
787            {
788               target->set_zoom_to_screen(!target->zoom_to_screen());
789               changed = true;
790            }
791            break;
792
793         /* anything else is a view item */
794         default:
795            if (menu_event->iptkey == IPT_UI_SELECT && (int)(FPTR)menu_event->itemref >= VIDEO_ITEM_VIEW)
796            {
797               target->set_view((FPTR)menu_event->itemref - VIDEO_ITEM_VIEW);
798               changed = true;
799            }
800            break;
801      }
802   }
803
804   /* if something changed, rebuild the menu */
805   if (changed)
806      reset(UI_MENU_RESET_REMEMBER_REF);
807}
808
809
810/*-------------------------------------------------
811    menu_video_options_populate - populate the
812    video options menu
813-------------------------------------------------*/
814
815ui_menu_video_options::ui_menu_video_options(running_machine &machine, render_container *container, render_target *_target) : ui_menu(machine, container)
816{
817   target = _target;
818}
819
820void ui_menu_video_options::populate()
821{
822   const char *subtext = "";
823   astring tempstring;
824   int viewnum;
825   int enabled;
826
827   /* add items for each view */
828   for (viewnum = 0; ; viewnum++)
829   {
830      const char *name = target->view_name(viewnum);
831      if (name == NULL)
832         break;
833
834      /* create a string for the item, replacing underscores with spaces */
835      tempstring.cpy(name).replace(0, "_", " ");
836      item_append(tempstring, NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum));
837   }
838
839   /* add a separator */
840   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
841
842   /* add a rotate item */
843   switch (target->orientation())
844   {
845      case ROT0:      subtext = "None";                   break;
846      case ROT90:     subtext = "CW 90" UTF8_DEGREES;     break;
847      case ROT180:    subtext = "180" UTF8_DEGREES;       break;
848      case ROT270:    subtext = "CCW 90" UTF8_DEGREES;    break;
849   }
850   item_append("Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
851
852   /* backdrop item */
853   enabled = target->backdrops_enabled();
854   item_append("Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
855
856   /* overlay item */
857   enabled = target->overlays_enabled();
858   item_append("Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
859
860   /* bezel item */
861   enabled = target->bezels_enabled();
862   item_append("Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
863
864   /* cpanel item */
865   enabled = target->cpanels_enabled();
866   item_append("CPanels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS);
867
868   /* marquee item */
869   enabled = target->marquees_enabled();
870   item_append("Marquees", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES);
871
872   /* cropping */
873   enabled = target->zoom_to_screen();
874   item_append("View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
875}
876
877ui_menu_video_options::~ui_menu_video_options()
878{
879}
880
881/*-------------------------------------------------
274882    menu_crosshair - handle the crosshair settings
275883    menu
276884-------------------------------------------------*/
trunk/src/emu/ui/miscmenu.h
r243192r243193
1414#ifndef __UI_MISCMENU_H__
1515#define __UI_MISCMENU_H__
1616
17#include "crsshair.h"
1718#include "drivenum.h"
18#include "crsshair.h"
1919
2020class ui_menu_keyboard_mode : public ui_menu {
2121public:
r243192r243193
4444   attotime prevtime;
4545};
4646
47class ui_menu_game_info : public ui_menu {
48public:
49   ui_menu_game_info(running_machine &machine, render_container *container);
50   virtual ~ui_menu_game_info();
51   virtual void populate();
52   virtual void handle();
53};
54
55class ui_menu_cheat : public ui_menu {
56public:
57   ui_menu_cheat(running_machine &machine, render_container *container);
58   virtual ~ui_menu_cheat();
59   virtual void populate();
60   virtual void handle();
61};
62
63class ui_menu_sliders : public ui_menu {
64public:
65   ui_menu_sliders(running_machine &machine, render_container *container, bool menuless_mode = false);
66   virtual ~ui_menu_sliders();
67   virtual void populate();
68   virtual void handle();
69
70   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
71
72   static UINT32 ui_handler(running_machine &machine, render_container *container, UINT32 state);
73
74private:
75   bool menuless_mode, hidden;
76};
77
78class ui_menu_video_targets : public ui_menu {
79public:
80   ui_menu_video_targets(running_machine &machine, render_container *container);
81   virtual ~ui_menu_video_targets();
82   virtual void populate();
83   virtual void handle();
84};
85
86class ui_menu_video_options : public ui_menu {
87public:
88   ui_menu_video_options(running_machine &machine, render_container *container, render_target *target);
89   virtual ~ui_menu_video_options();
90   virtual void populate();
91   virtual void handle();
92
93private:
94   enum {
95      VIDEO_ITEM_ROTATE = 0x80000000,
96      VIDEO_ITEM_BACKDROPS,
97      VIDEO_ITEM_OVERLAYS,
98      VIDEO_ITEM_BEZELS,
99      VIDEO_ITEM_CPANELS,
100      VIDEO_ITEM_MARQUEES,
101      VIDEO_ITEM_ZOOM,
102      VIDEO_ITEM_VIEW
103   };
104
105   render_target *target;
106};
107
47108class ui_menu_crosshair : public ui_menu {
48109public:
49110   ui_menu_crosshair(running_machine &machine, render_container *container);
trunk/src/emu/ui/selgame.c
r243192r243193
157157      media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
158158
159159      // if everything looks good, schedule the new driver
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE)
161161      {
162162         machine().manager().schedule_new_driver(*driver);
163163         machine().schedule_hard_reset();
trunk/src/emu/ui/sliders.c
r243192r243193
1/*********************************************************************
2
3    miscmenu.c
4
5    Internal MAME menus for the user interface.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12#include "emu.h"
13
14#include "osdepend.h"
15#include "uiinput.h"
16#include "ui/ui.h"
17#include "ui/sliders.h"
18
19
20ui_menu_sliders::ui_menu_sliders(running_machine &machine, render_container *container, bool _menuless_mode) : ui_menu(machine, container)
21{
22   menuless_mode = hidden = _menuless_mode;
23}
24
25ui_menu_sliders::~ui_menu_sliders()
26{
27}
28
29/*-------------------------------------------------
30    menu_sliders - handle the sliders menu
31-------------------------------------------------*/
32
33void ui_menu_sliders::handle()
34{
35   const ui_menu_event *menu_event;
36
37   /* process the menu */
38   menu_event = process(UI_MENU_PROCESS_LR_REPEAT | (hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0));
39   if (menu_event != NULL)
40   {
41      /* handle keys if there is a valid item selected */
42      if (menu_event->itemref != NULL)
43      {
44         const slider_state *slider = (const slider_state *)menu_event->itemref;
45         INT32 curvalue = (*slider->update)(machine(), slider->arg, NULL, SLIDER_NOCHANGE);
46         INT32 increment = 0;
47
48         switch (menu_event->iptkey)
49         {
50            /* toggle visibility */
51            case IPT_UI_ON_SCREEN_DISPLAY:
52               if (menuless_mode)
53                  ui_menu::stack_pop(machine());
54               else
55                  hidden = !hidden;
56               break;
57
58            /* decrease value */
59            case IPT_UI_LEFT:
60               if (machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT))
61                  increment = -1;
62               else if (machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT))
63                  increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
64               else if (machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL))
65                  increment = -slider->incval * 10;
66               else
67                  increment = -slider->incval;
68               break;
69
70            /* increase value */
71            case IPT_UI_RIGHT:
72               if (machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT))
73                  increment = 1;
74               else if (machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT))
75                  increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
76               else if (machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL))
77                  increment = slider->incval * 10;
78               else
79                  increment = slider->incval;
80               break;
81
82            /* restore default */
83            case IPT_UI_SELECT:
84               increment = slider->defval - curvalue;
85               break;
86         }
87
88         /* handle any changes */
89         if (increment != 0)
90         {
91            INT32 newvalue = curvalue + increment;
92
93            /* clamp within bounds */
94            if (newvalue < slider->minval)
95               newvalue = slider->minval;
96            if (newvalue > slider->maxval)
97               newvalue = slider->maxval;
98
99            /* update the slider and recompute the menu */
100            (*slider->update)(machine(), slider->arg, NULL, newvalue);
101            reset(UI_MENU_RESET_REMEMBER_REF);
102         }
103      }
104
105      /* if we are selecting an invalid item and we are hidden, skip to the next one */
106      else if (hidden)
107      {
108         /* if we got here via up or page up, select the previous item */
109         if (menu_event->iptkey == IPT_UI_UP || menu_event->iptkey == IPT_UI_PAGE_UP)
110         {
111            selected = (selected + numitems - 1) % numitems;
112            validate_selection(-1);
113         }
114
115         /* otherwise select the next item */
116         else if (menu_event->iptkey == IPT_UI_DOWN || menu_event->iptkey == IPT_UI_PAGE_DOWN)
117         {
118            selected = (selected + 1) % numitems;
119            validate_selection(1);
120         }
121      }
122   }
123}
124
125
126/*-------------------------------------------------
127    menu_sliders_populate - populate the sliders
128    menu
129-------------------------------------------------*/
130
131void ui_menu_sliders::populate()
132{
133   astring tempstring;
134
135   /* add UI sliders */
136   for (const slider_state *curslider = machine().ui().get_slider_list(); curslider != NULL; curslider = curslider->next)
137   {
138      INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
139      UINT32 flags = 0;
140      if (curval > curslider->minval)
141         flags |= MENU_FLAG_LEFT_ARROW;
142      if (curval < curslider->maxval)
143         flags |= MENU_FLAG_RIGHT_ARROW;
144      item_append(curslider->description, tempstring, flags, (void *)curslider);
145
146      if (menuless_mode)
147         break;
148   }
149
150   /* add OSD sliders */
151   for (const slider_state *curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next)
152   {
153      INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
154      UINT32 flags = 0;
155      if (curval > curslider->minval)
156         flags |= MENU_FLAG_LEFT_ARROW;
157      if (curval < curslider->maxval)
158         flags |= MENU_FLAG_RIGHT_ARROW;
159      item_append(curslider->description, tempstring, flags, (void *)curslider);
160   }
161
162   custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
163}
164
165/*-------------------------------------------------
166    menu_sliders_custom_render - perform our special
167    rendering
168-------------------------------------------------*/
169
170void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
171{
172   const slider_state *curslider = (const slider_state *)selectedref;
173   if (curslider != NULL)
174   {
175      float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x;
176      float line_height = machine().ui().get_line_height();
177      float percentage, default_percentage;
178      astring tempstring;
179      float text_height;
180      INT32 curval;
181
182      /* determine the current value and text */
183      curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
184
185      /* compute the current and default percentages */
186      percentage = (float)(curval - curslider->minval) / (float)(curslider->maxval - curslider->minval);
187      default_percentage = (float)(curslider->defval - curslider->minval) / (float)(curslider->maxval - curslider->minval);
188
189      /* assemble the text */
190      tempstring.ins(0, " ").ins(0, curslider->description);
191
192      /* move us to the bottom of the screen, and expand to full width */
193      y2 = 1.0f - UI_BOX_TB_BORDER;
194      y1 = y2 - bottom;
195      x1 = UI_BOX_LR_BORDER;
196      x2 = 1.0f - UI_BOX_LR_BORDER;
197
198      /* draw extra menu area */
199      machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
200      y1 += UI_BOX_TB_BORDER;
201
202      /* determine the text height */
203      machine().ui().draw_text_full(container, tempstring, 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
204               JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, NULL, &text_height);
205
206      /* draw the thermometer */
207      bar_left = x1 + UI_BOX_LR_BORDER;
208      bar_area_top = y1;
209      bar_width = x2 - x1 - 2.0f * UI_BOX_LR_BORDER;
210      bar_area_height = line_height;
211
212      /* compute positions */
213      bar_top = bar_area_top + 0.125f * bar_area_height;
214      bar_bottom = bar_area_top + 0.875f * bar_area_height;
215      default_x = bar_left + bar_width * default_percentage;
216      current_x = bar_left + bar_width * percentage;
217
218      /* fill in the percentage */
219      container->add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
220
221      /* draw the top and bottom lines */
222      container->add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
223      container->add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
224
225      /* draw default marker */
226      container->add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
227      container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
228
229      /* draw the actual text */
230      machine().ui().draw_text_full(container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
231               JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, &text_height);
232   }
233}
234
235
236/*-------------------------------------------------
237 ui_slider_ui_handler - pushes the slider
238 menu on the stack and hands off to the
239 standard menu handler
240 -------------------------------------------------*/
241
242UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *container, UINT32 state)
243{
244   UINT32 result;
245
246   /* if this is the first call, push the sliders menu */
247   if (state)
248      ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_sliders(machine, container, true)));
249
250   /* handle standard menus */
251   result = ui_menu::ui_handler(machine, container, state);
252
253   /* if we are cancelled, pop the sliders menu */
254   if (result == UI_HANDLER_CANCEL)
255      ui_menu::stack_pop(machine);
256
257   ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack);
258   return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL;
259}
trunk/src/emu/ui/sliders.h
r243192r243193
1/***************************************************************************
2
3    ui/miscmenu.h
4
5    Internal MAME menus for the user interface.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_SLIDERS_H__
15#define __UI_SLIDERS_H__
16
17class ui_menu_sliders : public ui_menu {
18public:
19   ui_menu_sliders(running_machine &machine, render_container *container, bool menuless_mode = false);
20   virtual ~ui_menu_sliders();
21   virtual void populate();
22   virtual void handle();
23
24   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
25
26   static UINT32 ui_handler(running_machine &machine, render_container *container, UINT32 state);
27
28private:
29   bool menuless_mode, hidden;
30};
31
32
33#endif  /* __UI_SLIDERS_H__ */
trunk/src/emu/ui/slotopt.h
r243192r243193
11/***************************************************************************
22
33    ui/slotopt.h
4
4
55    Internal menu for the slot options.
6
6
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
trunk/src/emu/ui/tapectrl.c
r243192r243193
5656void ui_menu_tape_control::populate()
5757{
5858   if (current_device())
59   {
59   {     
6060      // name of tape
6161      item_append(current_display_name(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT);
6262
r243192r243193
6767         double t0 = current_device()->get_position();
6868         double t1 = current_device()->get_length();
6969         UINT32 tapeflags = 0;
70
70         
7171         // state
7272         if (t1 > 0)
7373         {
r243192r243193
7676            if (t0 < t1)
7777               tapeflags |= MENU_FLAG_RIGHT_ARROW;
7878         }
79
79         
8080         get_time_string(timepos, current_device(), NULL, NULL);
8181         state = current_device()->get_state();
8282         item_append(
8383                  (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
8484                  ?   "stopped"
8585                  :   ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
86                        ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
87                        : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
88                        ),
86                      ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
87                      : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
88                      ),
8989                  timepos,
9090                  tapeflags,
9191                  TAPECMD_SLIDER);
92
92         
9393         // pause or stop
9494         item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
95
95         
9696         // play
9797         item_append("Play", NULL, 0, TAPECMD_PLAY);
98
98         
9999         // record
100100         item_append("Record", NULL, 0, TAPECMD_RECORD);
101
101         
102102         // rewind
103103         item_append("Rewind", NULL, 0, TAPECMD_REWIND);
104
104         
105105         // fast forward
106106         item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
107107      }
trunk/src/emu/ui/ui.c
r243192r243193
1616#include "render.h"
1717#include "cheat.h"
1818#include "rendfont.h"
19#include "uiinput.h"
2019#include "ui/ui.h"
21#include "ui/cheatopt.h"
20#include "uiinput.h"
2221#include "ui/mainmenu.h"
2322#include "ui/miscmenu.h"
24#include "ui/filemngr.h"
25#include "ui/sliders.h"
2623#include "ui/viewgfx.h"
2724#include "imagedev/cassette.h"
25#include <ctype.h>
2826
2927
3028/***************************************************************************
r243192r243193
308306
309307void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
310308{
311   const int maxstate = 4;
309   const int maxstate = 3;
312310   int str = machine().options().seconds_to_run();
313311   bool show_gameinfo = !machine().options().skip_gameinfo();
314   bool show_warnings = true, show_mandatory_fileman = true;
312   bool show_warnings = true;
315313   int state;
316314
317315   // disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
318316   // or if we are debugging
319317   if (!first_time || (str > 0 && str < 60*5) || &machine().system() == &GAME_NAME(___empty) || (machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
320      show_gameinfo = show_warnings = show_disclaimer = show_mandatory_fileman = FALSE;
318      show_gameinfo = show_warnings = show_disclaimer = FALSE;
321319
322320   #ifdef SDLMAME_EMSCRIPTEN
323321   // also disable for the JavaScript port since the startup screens do not run asynchronously
r243192r243193
354352            if (show_gameinfo && game_info_astring(messagebox_text).len() > 0)
355353               set_handler(handler_messagebox_anykey, 0);
356354            break;
357
358         case 3:
359            if (show_mandatory_fileman && image_mandatory_scan(machine(), messagebox_text).len() > 0)
360            {
361               astring warning;
362               warning.cpy("This driver requires images to be loaded in the following device(s): ").cat(messagebox_text.substr(0, messagebox_text.len() - 2));
363               ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.cstr());
364            }
365            break;
366355      }
367356
368357      // clear the input memory
trunk/src/emu/ui/videoopt.c
r243192r243193
1/*********************************************************************
2
3    ui/videoopt.c
4
5    Internal menus for video options
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12#include "emu.h"
13#include "rendutil.h"
14
15#include "uiinput.h"
16#include "ui/ui.h"
17#include "ui/videoopt.h"
18
19/*-------------------------------------------------
20    menu_video_targets - handle the video targets
21    menu
22-------------------------------------------------*/
23
24void ui_menu_video_targets::handle()
25{
26   /* process the menu */
27   const ui_menu_event *menu_event = process(0);
28   if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT)
29      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, static_cast<render_target *>(menu_event->itemref))));
30}
31
32
33/*-------------------------------------------------
34    menu_video_targets_populate - populate the
35    video targets menu
36-------------------------------------------------*/
37
38ui_menu_video_targets::ui_menu_video_targets(running_machine &machine, render_container *container) : ui_menu(machine, container)
39{
40}
41
42void ui_menu_video_targets::populate()
43{
44   int targetnum;
45
46   /* find the targets */
47   for (targetnum = 0; ; targetnum++)
48   {
49      render_target *target = machine().render().target_by_index(targetnum);
50      char buffer[40];
51
52      /* stop when we run out */
53      if (target == NULL)
54         break;
55
56      /* add a menu item */
57      sprintf(buffer, "Screen #%d", targetnum);
58      item_append(buffer, NULL, 0, target);
59   }
60}
61
62ui_menu_video_targets::~ui_menu_video_targets()
63{
64}
65
66/*-------------------------------------------------
67    menu_video_options - handle the video options
68    menu
69-------------------------------------------------*/
70
71void ui_menu_video_options::handle()
72{
73   bool changed = false;
74
75   /* process the menu */
76   const ui_menu_event *menu_event = process(0);
77   if (menu_event != NULL && menu_event->itemref != NULL)
78   {
79      switch ((FPTR)menu_event->itemref)
80      {
81         /* rotate adds rotation depending on the direction */
82         case VIDEO_ITEM_ROTATE:
83            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
84            {
85               int delta = (menu_event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90;
86               target->set_orientation(orientation_add(delta, target->orientation()));
87               if (target->is_ui_target())
88               {
89                  render_container::user_settings settings;
90                  container->get_user_settings(settings);
91                  settings.m_orientation = orientation_add(delta ^ ROT180, settings.m_orientation);
92                  container->set_user_settings(settings);
93               }
94               changed = true;
95            }
96            break;
97
98         /* layer config bitmasks handle left/right keys the same (toggle) */
99         case VIDEO_ITEM_BACKDROPS:
100            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
101            {
102               target->set_backdrops_enabled(!target->backdrops_enabled());
103               changed = true;
104            }
105            break;
106
107         case VIDEO_ITEM_OVERLAYS:
108            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
109            {
110               target->set_overlays_enabled(!target->overlays_enabled());
111               changed = true;
112            }
113            break;
114
115         case VIDEO_ITEM_BEZELS:
116            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
117            {
118               target->set_bezels_enabled(!target->bezels_enabled());
119               changed = true;
120            }
121            break;
122
123         case VIDEO_ITEM_CPANELS:
124            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
125            {
126               target->set_cpanels_enabled(!target->cpanels_enabled());
127               changed = true;
128            }
129            break;
130
131         case VIDEO_ITEM_MARQUEES:
132            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
133            {
134               target->set_marquees_enabled(!target->marquees_enabled());
135               changed = true;
136            }
137            break;
138
139         case VIDEO_ITEM_ZOOM:
140            if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
141            {
142               target->set_zoom_to_screen(!target->zoom_to_screen());
143               changed = true;
144            }
145            break;
146
147         /* anything else is a view item */
148         default:
149            if (menu_event->iptkey == IPT_UI_SELECT && (int)(FPTR)menu_event->itemref >= VIDEO_ITEM_VIEW)
150            {
151               target->set_view((FPTR)menu_event->itemref - VIDEO_ITEM_VIEW);
152               changed = true;
153            }
154            break;
155      }
156   }
157
158   /* if something changed, rebuild the menu */
159   if (changed)
160      reset(UI_MENU_RESET_REMEMBER_REF);
161}
162
163
164/*-------------------------------------------------
165    menu_video_options_populate - populate the
166    video options menu
167-------------------------------------------------*/
168
169ui_menu_video_options::ui_menu_video_options(running_machine &machine, render_container *container, render_target *_target) : ui_menu(machine, container)
170{
171   target = _target;
172}
173
174void ui_menu_video_options::populate()
175{
176   const char *subtext = "";
177   astring tempstring;
178   int viewnum;
179   int enabled;
180
181   /* add items for each view */
182   for (viewnum = 0; ; viewnum++)
183   {
184      const char *name = target->view_name(viewnum);
185      if (name == NULL)
186         break;
187
188      /* create a string for the item, replacing underscores with spaces */
189      tempstring.cpy(name).replace(0, "_", " ");
190      item_append(tempstring, NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum));
191   }
192
193   /* add a separator */
194   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
195
196   /* add a rotate item */
197   switch (target->orientation())
198   {
199      case ROT0:      subtext = "None";                   break;
200      case ROT90:     subtext = "CW 90" UTF8_DEGREES;     break;
201      case ROT180:    subtext = "180" UTF8_DEGREES;       break;
202      case ROT270:    subtext = "CCW 90" UTF8_DEGREES;    break;
203   }
204   item_append("Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
205
206   /* backdrop item */
207   enabled = target->backdrops_enabled();
208   item_append("Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
209
210   /* overlay item */
211   enabled = target->overlays_enabled();
212   item_append("Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
213
214   /* bezel item */
215   enabled = target->bezels_enabled();
216   item_append("Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
217
218   /* cpanel item */
219   enabled = target->cpanels_enabled();
220   item_append("CPanels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS);
221
222   /* marquee item */
223   enabled = target->marquees_enabled();
224   item_append("Marquees", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES);
225
226   /* cropping */
227   enabled = target->zoom_to_screen();
228   item_append("View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
229}
230
231ui_menu_video_options::~ui_menu_video_options()
232{
233}
trunk/src/emu/ui/videoopt.h
r243192r243193
1/***************************************************************************
2
3    ui/videoopt.h
4
5    Internal menus for video options
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_VIDEOOPT_H__
15#define __UI_VIDEOOPT_H__
16
17
18class ui_menu_video_targets : public ui_menu {
19public:
20   ui_menu_video_targets(running_machine &machine, render_container *container);
21   virtual ~ui_menu_video_targets();
22   virtual void populate();
23   virtual void handle();
24};
25
26class ui_menu_video_options : public ui_menu {
27public:
28   ui_menu_video_options(running_machine &machine, render_container *container, render_target *target);
29   virtual ~ui_menu_video_options();
30   virtual void populate();
31   virtual void handle();
32
33private:
34   enum {
35      VIDEO_ITEM_ROTATE = 0x80000000,
36      VIDEO_ITEM_BACKDROPS,
37      VIDEO_ITEM_OVERLAYS,
38      VIDEO_ITEM_BEZELS,
39      VIDEO_ITEM_CPANELS,
40      VIDEO_ITEM_MARQUEES,
41      VIDEO_ITEM_ZOOM,
42      VIDEO_ITEM_VIEW
43   };
44
45   render_target *target;
46};
47
48
49#endif  /* __UI_VIDEOOPT_H__ */
trunk/src/emu/video/315_5124.c
r243192r243193
1414  - Display mode 1 (text)
1515  - Display mode 3 (multicolor)
1616  - Sprite doubling bug of the 315-5124 chip
17  - Verify timing on the Game Gear (315-5378 chip)
1817
1918
2019SMS Display Timing
r243192r243193
344343         rec.min_x = SEGA315_5124_LBORDER_START;
345344         rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
346345         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
347         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
346         m_y1_bitmap.fill(1, rec);
348347      }
349348      break;
350349
r243192r243193
359358         rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
360359         rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
361360         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
362         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
361         m_y1_bitmap.fill(1, rec);
363362      }
364363      break;
365364
r243192r243193
848847            //logerror("%x %x\n", pixel_plot_x, line);
849848            if (tile_column == 0 && (x_scroll & 0x07))
850849            {
851               /* when the first column hasn't completely entered in the screen, its
852                  background is filled only with color #0 of the selected palette */
853               line_buffer[pixel_plot_x] = m_current_palette[palette_selected ? 0x10 : 0x00];
854               priority_selected[pixel_plot_x] = priority_select;
850               /* the VDP only draws the first column when it has completely entered
851                  in the screen, else it is filled with the sprite pattern #0 */
852               line_buffer[pixel_plot_x] = m_current_palette[0x10];
855853            }
856854            else
857855            {
858856               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
859               priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
860857            }
858            priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
861859         }
862860      }
863861   }
r243192r243193
10141012
10151013      m_sprite_count = max_sprites;
10161014
1017      /* Overflow is flagged only on active display and when VINT isn't active */
1018      if (!(m_status & STATUS_VINT) && line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
1015      if (line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
10191016      {
10201017         m_pending_status |= STATUS_SPROVR;
10211018      }
r243192r243193
10331030   if (m_display_disabled || m_sprite_count == 0)
10341031      return;
10351032
1036   /* Sprites aren't drawn and collisions don't occur on column 0 if it is disabled.
1037      Note: On Megadrive/Genesis VDP, collisions occur on the disabled column 0. */
1033   /* Sprites aren't drawn and collisions don't occur on column 0 if it is disabled */
10381034   if (m_reg[0x00] & 0x20)
10391035      plot_min_x = 8;
10401036
r243192r243193
10881084               continue;
10891085            }
10901086
1091            /* Draw sprite pixel */
1092            /* Check if the background has lower priority */
10931087            if (!(priority_selected[pixel_plot_x] & PRIORITY_BIT))
10941088            {
10951089               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
r243192r243193
13021296
13031297   if ( line < m_frame_timing[ACTIVE_DISPLAY_V] )
13041298   {
1305      memset(priority_selected, 1, sizeof(priority_selected));
1306
13071299      switch( m_vdp_mode )
13081300      {
13091301      case 0:
1302         memset(priority_selected, 1, sizeof(priority_selected));
13101303         if ( line >= 0 )
13111304         {
13121305            draw_scanline_mode0( blitline_buffer, line );
r243192r243193
13181311         break;
13191312
13201313      case 2:
1314         memset(priority_selected, 1, sizeof(priority_selected));
13211315         if ( line >= 0 )
13221316         {
13231317            draw_scanline_mode2( blitline_buffer, line );
r243192r243193
13301324
13311325      case 4:
13321326      default:
1327         memset(priority_selected, 0, sizeof(priority_selected));
13331328         if ( line >= 0 )
13341329         {
13351330            draw_scanline_mode4( blitline_buffer, priority_selected, line );
r243192r243193
13511346      rec.min_x = pixel_offset_x;
13521347      rec.max_x = pixel_offset_x + 255;
13531348      m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
1354      m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
1349      m_y1_bitmap.fill(1, rec);
13551350   }
13561351   else
13571352   {
r243192r243193
13661361   UINT8  *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
13671362   int x = 0;
13681363
1369   if (m_vdp_mode == 4 && (m_reg[0x00] & 0x20))
1364   if (m_vdp_mode == 4 && m_reg[0x00] & 0x20)
13701365   {
13711366      /* Fill column 0 with overscan color from m_reg[0x07] */
13721367      do
13731368      {
13741369         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1375         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
1370         p_y1[x] = 1;
13761371      }
13771372      while(++x < 8);
13781373   }
r243192r243193
13801375   do
13811376   {
13821377      p_bitmap[x] = m_palette->pen(line_buffer[x]);
1383      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
1378      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
13841379   }
13851380   while(++x < 256);
13861381}
r243192r243193
14021397      do
14031398      {
14041399         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1405         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
1400         p_y1[x] = 1; // not verified
14061401      }
14071402      while (++x < 48);
14081403
r243192r243193
14111406         do
14121407         {
14131408            p_bitmap[x] = m_palette->pen(line_buffer[x]);
1414            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
1409            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
14151410         }
14161411         while (++x < 208);
14171412      }
r243192r243193
14211416         do
14221417         {
14231418            p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1424            p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
1419            p_y1[x] = 1; // not verified
14251420         }
14261421         while (++x < 208);
14271422      }
r243192r243193
14301425      do
14311426      {
14321427         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1433         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
1428         p_y1[x] = 1; // not verified
14341429      }
14351430      while (++x < 256);
14361431   }
trunk/src/emu/video/h63484.c
r243192r243193
20012001void h63484_device::device_start()
20022002{
20032003   m_display_cb.bind_relative_to(*owner());
2004
2005   register_save_state();
20062004}
20072005
20082006//-------------------------------------------------
r243192r243193
21272125   }
21282126   return 0;
21292127}
2130
2131void h63484_device::register_save_state()
2132{
2133   save_item(NAME(m_ar));
2134   save_item(NAME(m_vreg));
2135   save_item(NAME(m_sr));
2136   save_item(NAME(m_fifo));
2137   save_item(NAME(m_fifo_ptr));
2138   save_item(NAME(m_fifo_r));
2139   save_item(NAME(m_fifo_r_ptr));
2140   save_item(NAME(m_cr));
2141   save_item(NAME(m_pr));
2142   save_item(NAME(m_param_ptr));
2143   save_item(NAME(m_rwp));
2144   save_item(NAME(m_rwp_dn));
2145   save_item(NAME(m_org_dpa));
2146   save_item(NAME(m_org_dn));
2147   save_item(NAME(m_org_dpd));
2148   save_item(NAME(m_cl0));
2149   save_item(NAME(m_cl1));
2150   save_item(NAME(m_ccmp));
2151   save_item(NAME(m_mask));
2152   save_item(NAME(m_cpx));
2153   save_item(NAME(m_cpy));
2154   save_item(NAME(m_mwr));
2155   save_item(NAME(m_mwr_chr));
2156   save_item(NAME(m_sar));
2157   save_item(NAME(m_sda));
2158   save_item(NAME(m_pram));
2159   save_item(NAME(m_dn));
2160   save_item(NAME(m_ccr));
2161   save_item(NAME(m_omr));
2162   save_item(NAME(m_edg));
2163   save_item(NAME(m_dcr));
2164   save_item(NAME(m_hc));
2165   save_item(NAME(m_hds));
2166   save_item(NAME(m_hdw));
2167   save_item(NAME(m_hws));
2168   save_item(NAME(m_hww));
2169   save_item(NAME(m_sp));
2170   save_item(NAME(m_hsw));
2171   save_item(NAME(m_vc));
2172   save_item(NAME(m_vws));
2173   save_item(NAME(m_vww));
2174   save_item(NAME(m_vds));
2175   save_item(NAME(m_vsw));
2176   save_item(NAME(m_ppy));
2177   save_item(NAME(m_pzcy));
2178   save_item(NAME(m_ppx));
2179   save_item(NAME(m_pzcx));
2180   save_item(NAME(m_psx));
2181   save_item(NAME(m_pex));
2182   save_item(NAME(m_pzx));
2183   save_item(NAME(m_psy));
2184   save_item(NAME(m_pzy));
2185   save_item(NAME(m_pey));
2186   save_item(NAME(m_xmin));
2187   save_item(NAME(m_ymin));
2188   save_item(NAME(m_xmax));
2189   save_item(NAME(m_ymax));
2190}
trunk/src/emu/video/h63484.h
r243192r243193
108108   int translate_command(UINT16 data);
109109   void draw_graphics_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int vs, int y, int layer_n, bool active, bool ins_window);
110110
111   void register_save_state();
112
113111   h63484_display_delegate  m_display_cb;
114112
115113   UINT8 m_ar;
trunk/src/lib/util/astring.h
r243192r243193
3232   ~astring();
3333
3434   // construction with copy
35   astring(const char *string) { init(); if(string) cpy(string); }
35   astring(const char *string) { init().cpy(string); }
3636   astring(const char *string, int length) { init().cpy(string, length); }
3737   astring(const char *str1, const char *str2) { init().cpy(str1).cat(str2); }
3838   astring(const char *str1, const char *str2, const char *str3) { init().cpy(str1).cat(str2).cat(str3); }
trunk/src/lib/util/coretmpl.h
r243192r243193
100100   void resize_keep_and_clear_new(int count, UINT8 data = 0) { int oldcount = m_count; resize_keep(count); if (oldcount < m_count) clear_internal(oldcount, m_count - oldcount, data); }
101101
102102   // batch operations
103   void copyfrom(const dynamic_array<_ElementType> &source)
104   {
105      resize(source.count());
106      for (int i=0; i < source.count(); i++)
107         m_array[i] = source[i];
108   }
103    void copyfrom(const dynamic_array<_ElementType> &source)
104    {
105        resize(source.count());
106        for (int i=0; i < source.count(); i++)
107            m_array[i] = source[i];
108    }
109109
110110private:
111111   // internal helpers
trunk/src/lib/util/palette.h
r243192r243193
171171   // entry list getters
172172   const rgb_t *entry_list_raw() const { return m_entry_color; }
173173   const dynamic_array<rgb_t> *entry_list_adjusted_darray() const { return &m_adjusted_color; }
174   const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
174    const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
175175   const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; }
176176
177177   // group adjustments
trunk/src/mame/audio/mario.c
r243192r243193
4646/* ---------------------------------------------------------------------- */
4747static NETLIST_START(nl_mario_snd0)
4848
49   RES(R17, RES_K(27))               /* 20 according to parts list           */
50                              /* 27 verified, 30K in schematics       */
51   CAP(C14, CAP_U(4.7))              /* verified                             */
49    RES(R17, RES_K(27))               /* 20 according to parts list           */
50                                      /* 27 verified, 30K in schematics       */
51    CAP(C14, CAP_U(4.7))              /* verified                             */
5252
53   TTL_74123(2H_A)
54   NET_C(2H_A.VCC, V5)
55   NET_C(2H_A.GND, GND)
56   NET_C(SOUND0.Q, 2H_A.B)
57   NET_C(GND, 2H_A.A)
58   NET_C(2H_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
59   DIODE(D1, "1N4148")               /* FIXME: try to identify */
60   TTL_7404_INVERT(1H_A, 2H_A.QQ)
61   NET_C(R17.1, V5)
62   NET_C(R17.2, D1.A, C14.1)
63   NET_C(D1.K, 2H_A.RC)
64   NET_C(C14.2, 2H_A.C)
53    TTL_74123(2H_A)
54    NET_C(2H_A.VCC, V5)
55    NET_C(2H_A.GND, GND)
56    NET_C(SOUND0.Q, 2H_A.B)
57    NET_C(GND, 2H_A.A)
58    NET_C(2H_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
59    DIODE(D1, "1N4148")               /* FIXME: try to identify */
60    TTL_7404_INVERT(1H_A, 2H_A.QQ)
61    NET_C(R17.1, V5)
62    NET_C(R17.2, D1.A, C14.1)
63    NET_C(D1.K, 2H_A.RC)
64    NET_C(C14.2, 2H_A.C)
6565
66   RES(R6, RES_K(4.7))               /* verified                             */
67   CAP(C3, CAP_U(10))                /* verified                             */
66    RES(R6, RES_K(4.7))               /* verified                             */
67    CAP(C3, CAP_U(10))                /* verified                             */
6868
69   NET_C(1H_A.Q, R6.1)
70   NET_C(R6.2, C3.1, 1J_A.FC)
71   NET_C(R6.2, 2J_A.FC)
72   NET_C(C3.2, GND)
69    NET_C(1H_A.Q, R6.1)
70    NET_C(R6.2, C3.1, 1J_A.FC)
71    NET_C(R6.2, 2J_A.FC)
72    NET_C(C3.2, GND)
7373
74   //#define MR_C6       CAP_N(3.9)        /* verified                           */
74    //#define MR_C6       CAP_N(3.9)        /* verified                           */
7575
76   SN74LS629(1J_A, CAP_N(3.9))
77   NET_C(1J_A.RNG, V5)
78   NET_C(1J_A.ENQ, ttllow)
79   NET_C(GND, 1J_A.GND)
76    SN74LS629(1J_A, CAP_N(3.9))
77    NET_C(1J_A.RNG, V5)
78    NET_C(1J_A.ENQ, ttllow)
79    NET_C(GND, 1J_A.GND)
8080
81   //#define MR_C17      CAP_N(22)        /* verified                            */
81    //#define MR_C17      CAP_N(22)        /* verified                            */
8282
83   SN74LS629(2J_A, CAP_N(22))
84   NET_C(2J_A.RNG, V5)
85   NET_C(2J_A.ENQ, ttllow)
86   NET_C(GND, 2J_A.GND)
83    SN74LS629(2J_A, CAP_N(22))
84    NET_C(2J_A.RNG, V5)
85    NET_C(2J_A.ENQ, ttllow)
86    NET_C(GND, 2J_A.GND)
8787
88   TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
89   TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
88    TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
89    TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
9090NETLIST_END()
9191
9292/* ---------------------------------------------------------------------- */
r243192r243193
9696// FIXME: Diodes are 1S953
9797static NETLIST_START(nl_mario_snd7)
9898
99   RES(R61, RES_K(47))
100   CAP(C41, CAP_U(4.7))              /* verified                             */
99    RES(R61, RES_K(47))
100    CAP(C41, CAP_U(4.7))              /* verified                             */
101101
102   TTL_74123(4L_A)
103   NET_C(4L_A.VCC, V5)
104   NET_C(4L_A.GND, GND)
105   NET_C(SOUND7.Q, 4L_A.B)
106   NET_C(GND, 4L_A.A)
107   NET_C(4L_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
108   DIODE(D10, "1N4148")               /* FIXME: try to identify */
109   TTL_7404_INVERT(4J_A, 4L_A.Q)
110   NET_C(R61.1, V5)
111   NET_C(R61.2, D10.A, C41.1)
112   NET_C(D10.K, 4L_A.RC)
113   NET_C(C41.2, 4L_A.C)
102    TTL_74123(4L_A)
103    NET_C(4L_A.VCC, V5)
104    NET_C(4L_A.GND, GND)
105    NET_C(SOUND7.Q, 4L_A.B)
106    NET_C(GND, 4L_A.A)
107    NET_C(4L_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
108    DIODE(D10, "1N4148")               /* FIXME: try to identify */
109    TTL_7404_INVERT(4J_A, 4L_A.Q)
110    NET_C(R61.1, V5)
111    NET_C(R61.2, D10.A, C41.1)
112    NET_C(D10.K, 4L_A.RC)
113    NET_C(C41.2, 4L_A.C)
114114
115   RES(R65, RES_K(10))
116   CAP(C44, CAP_U(3.3))              /* verified                             */
115    RES(R65, RES_K(10))
116    CAP(C44, CAP_U(3.3))              /* verified                             */
117117
118   SN74LS629(4K_A, CAP_U(0.022))
119   NET_C(4K_A.RNG, V5)
120   NET_C(4K_A.ENQ, ttllow)
121   NET_C(GND, 4K_A.GND)
122   NET_C(R65.1, 4J_A.Q)
123   NET_C(R65.2, 4K_A.FC, C44.1)
124   NET_C(C44.2, GND)
118    SN74LS629(4K_A, CAP_U(0.022))
119    NET_C(4K_A.RNG, V5)
120    NET_C(4K_A.ENQ, ttllow)
121    NET_C(GND, 4K_A.GND)
122    NET_C(R65.1, 4J_A.Q)
123    NET_C(R65.2, 4K_A.FC, C44.1)
124    NET_C(C44.2, GND)
125125
126   CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
127   TTL_7404_INVERT(4J_B, 3H.Q12)
126    CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
127    TTL_7404_INVERT(4J_B, 3H.Q12)
128128
129   RES(R64, RES_K(20))
130   CAP(C43, CAP_U(3.3))              /* verified                             */
129    RES(R64, RES_K(20))
130    CAP(C43, CAP_U(3.3))              /* verified                             */
131131
132   SN74LS629(4K_B, CAP_U(0.0047))
133   NET_C(4K_B.RNG, V5)
134   NET_C(4K_B.ENQ, ttllow)
135   NET_C(GND, 4K_B.GND)
136   NET_C(R64.1, 4J_B.Q)
137   NET_C(R64.2, 4K_B.FC, C43.1)
138   NET_C(C43.2, GND)
132    SN74LS629(4K_B, CAP_U(0.0047))
133    NET_C(4K_B.RNG, V5)
134    NET_C(4K_B.ENQ, ttllow)
135    NET_C(GND, 4K_B.GND)
136    NET_C(R64.1, 4J_B.Q)
137    NET_C(R64.2, 4K_B.FC, C43.1)
138    NET_C(C43.2, GND)
139139
140   TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
141   TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
140    TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
141    TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
142142
143143NETLIST_END()
144144
r243192r243193
146146/* DAC sound                                                            */
147147/* ---------------------------------------------------------------------- */
148148static NETLIST_START(nl_mario_dac)
149   RES(R34, RES_M(2))
150   RES(R35, RES_M(1))
151   RES(R36, RES_M(1.8))
152   LM3900(3M_1)
153   NET_C(3M_1.VM, GND)
154   NET_C(3M_1.VP, V5)
149    RES(R34, RES_M(2))
150    RES(R35, RES_M(1))
151    RES(R36, RES_M(1.8))
152    LM3900(3M_1)
153    NET_C(3M_1.VM, GND)
154    NET_C(3M_1.VP, V5)
155155
156   NET_C(DAC.VOUT, R34.1)
157   NET_C(3M_1.MINUS, R34.2, R35.2)
158   NET_C(3M_1.OUT, R35.1)
159   NET_C(3M_1.PLUS, R36.1)
160   NET_C(R36.2, GND)
156    NET_C(DAC.VOUT, R34.1)
157    NET_C(3M_1.MINUS, R34.2, R35.2)
158    NET_C(3M_1.OUT, R35.1)
159    NET_C(3M_1.PLUS, R36.1)
160    NET_C(R36.2, GND)
161161
162   RES(R21, RES_M(1.8))
163   RES(R23, RES_K(10))
164   RES(R25, RES_K(10))
165   RES(R37, RES_K(750))
166   RES(R38, RES_K(360))
167   RES(R39, RES_K(750))
162    RES(R21, RES_M(1.8))
163    RES(R23, RES_K(10))
164    RES(R25, RES_K(10))
165    RES(R37, RES_K(750))
166    RES(R38, RES_K(360))
167    RES(R39, RES_K(750))
168168
169   CAP(C18, CAP_P(100))
170   CAP(C19, CAP_U(10))
171   CAP(C20, CAP_U(1))
172   CAP(C30, CAP_P(100))
169    CAP(C18, CAP_P(100))
170    CAP(C19, CAP_U(10))
171    CAP(C20, CAP_U(1))
172    CAP(C30, CAP_P(100))
173173
174   LM3900(3M_2)
175   NET_C(3M_2.VM, GND)
176   NET_C(3M_2.VP, V5)
174    LM3900(3M_2)
175    NET_C(3M_2.VM, GND)
176    NET_C(3M_2.VP, V5)
177177
178   NET_C(R35.1, C20.1)
179   NET_C(C20.2, R37.1)
180   NET_C(R37.2, R38.2, C18.1, R39.2)
178    NET_C(R35.1, C20.1)
179    NET_C(C20.2, R37.1)
180    NET_C(R37.2, R38.2, C18.1, R39.2)
181181
182   NET_C(C18.2, GND)
183   NET_C(R38.1, C30.2, 3M_2.MINUS)
184   NET_C(3M_2.OUT, R39.1, C30.1)
182    NET_C(C18.2, GND)
183    NET_C(R38.1, C30.2, 3M_2.MINUS)
184    NET_C(3M_2.OUT, R39.1, C30.1)
185185
186   NET_C(R21.1, 3M_2.PLUS)
187   NET_C(R21.2, C19.1, R25.2, R23.1)
188   NET_C(C19.2, R23.2, GND)
189   NET_C(R25.1, V5)
186    NET_C(R21.1, 3M_2.PLUS)
187    NET_C(R21.2, C19.1, R25.2, R23.1)
188    NET_C(C19.2, R23.2, GND)
189    NET_C(R25.1, V5)
190190NETLIST_END()
191191
192192static NETLIST_START(nl_mario)
193193
194   /* Standard stuff */
194    /* Standard stuff */
195195
196   SOLVER(Solver, 48000)
197   PARAM(Solver.ACCURACY, 1e-8)
198   PARAM(Solver.SOR_FACTOR, 1.0)
199   PARAM(Solver.GS_THRESHOLD, 5)
200   PARAM(Solver.GS_LOOPS, 4)
201   //PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
202   PARAM(Solver.DYNAMIC_TS,  0)
203   ANALOG_INPUT(V5, 5)
196    SOLVER(Solver, 48000)
197    PARAM(Solver.ACCURACY, 1e-8)
198    PARAM(Solver.SOR_FACTOR, 1.0)
199    PARAM(Solver.GS_THRESHOLD, 5)
200    PARAM(Solver.GS_LOOPS, 4)
201    //PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
202    PARAM(Solver.DYNAMIC_TS,  0)
203    ANALOG_INPUT(V5, 5)
204204
205   TTL_INPUT(SOUND0, 1)
206   INCLUDE(nl_mario_snd0)
205    TTL_INPUT(SOUND0, 1)
206    INCLUDE(nl_mario_snd0)
207207
208   TTL_INPUT(SOUND7, 1)
209   INCLUDE(nl_mario_snd7)
208    TTL_INPUT(SOUND7, 1)
209    INCLUDE(nl_mario_snd7)
210210
211   R2R_DAC(DAC, 3.4, 10000.0, 8)
212   NET_C(DAC.VGND, GND)
211    R2R_DAC(DAC, 3.4, 10000.0, 8)
212    NET_C(DAC.VGND, GND)
213213
214   INCLUDE(nl_mario_dac)
214    INCLUDE(nl_mario_dac)
215215
216   /* ---------------------------------------------------------------------- */
217   /* mixing                                                                 */
218   /* ---------------------------------------------------------------------- */
216    /* ---------------------------------------------------------------------- */
217    /* mixing                                                                 */
218    /* ---------------------------------------------------------------------- */
219219
220   RES(R20, RES_K(22))               /* verified                             */
221   RES(R19, RES_K(22))               /* verified                             */
222   RES(R40, RES_K(22))               /* verified                             */
223   RES(R41, RES_K(100))              /* verified                             */
224   CAP(C31, CAP_U(0.022))            /*                             */
220    RES(R20, RES_K(22))               /* verified                             */
221    RES(R19, RES_K(22))               /* verified                             */
222    RES(R40, RES_K(22))               /* verified                             */
223    RES(R41, RES_K(100))              /* verified                             */
224    CAP(C31, CAP_U(0.022))            /*                             */
225225
226   NET_C(2K_A.Q, R20.1)
227   NET_C(GND, R19.1) //FIXME
228   NET_C(2K_C.Q, R41.1)
226    NET_C(2K_A.Q, R20.1)
227    NET_C(GND, R19.1) //FIXME
228    NET_C(2K_C.Q, R41.1)
229229
230230#if 1
231   RES(DUM, RES_K(22))
232   NET_C(R39.1, DUM.1)
233   NET_C(DUM.2, GND)
234   FRONTIER(front1, R39.1, R40.1)
231    RES(DUM, RES_K(22))
232    NET_C(R39.1, DUM.1)
233    NET_C(DUM.2, GND)
234    FRONTIER(front1, R39.1, R40.1)
235235#else
236   NET_C(R39.1, R40.1)
236    NET_C(R39.1, R40.1)
237237#endif
238238
239   NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
240   NET_C(C31.2, GND)
239    NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
240    NET_C(C31.2, GND)
241241
242   CAP(C32, CAP_U(1))                /* verified                             */
243   RES(R42, RES_K(43))               /* verified                             */
244   RES(R43, RES_K(100))              /* verified                             */
242    CAP(C32, CAP_U(1))                /* verified                             */
243    RES(R42, RES_K(43))               /* verified                             */
244    RES(R43, RES_K(100))              /* verified                             */
245245
246   NET_C(C31.1, C32.1)
247   NET_C(C32.2, R42.1, R43.2, Q10.B)
248   //NET_C(C32.2, R42.1, R43.2)
249   NET_C(R43.1, V5)
250   NET_C(R42.2, GND)
246    NET_C(C31.1, C32.1)
247    NET_C(C32.2, R42.1, R43.2, Q10.B)
248    //NET_C(C32.2, R42.1, R43.2)
249    NET_C(R43.1, V5)
250    NET_C(R42.2, GND)
251251#if 1
252   RES(R63, RES_K(1))                /*                                      */
253   RES(R62, 150)                     /*                                      */
252    RES(R63, RES_K(1))                /*                                      */
253    RES(R62, 150)                     /*                                      */
254254
255   QBJT_EB(Q10, "2SC1815")
255    QBJT_EB(Q10, "2SC1815")
256256
257   NET_C(R62.2, GND)
258   NET_C(R62.1, Q10.E)
257    NET_C(R62.2, GND)
258    NET_C(R62.1, Q10.E)
259259
260   NET_C(R63.1, V5)
261   NET_C(R63.2, Q10.C)
260    NET_C(R63.1, V5)
261    NET_C(R63.2, Q10.C)
262262
263   CAP(C42, CAP_U(0.1))
264   CAP(C47, CAP_U(4.7))
265   RES(VR1, RES_K(10))
263    CAP(C42, CAP_U(0.1))
264    CAP(C47, CAP_U(4.7))
265    RES(VR1, RES_K(10))
266266
267   NET_C(C42.1, C47.1, R62.1)
268   NET_C(C42.2, GND)
269   NET_C(C47.2, VR1.1)
270   NET_C(VR1.2, GND)
267    NET_C(C42.1, C47.1, R62.1)
268    NET_C(C42.2, GND)
269    NET_C(C47.2, VR1.1)
270    NET_C(VR1.2, GND)
271271#endif
272   /* ---------------------------------------------------------------------- */
273   /* Output                                                                 */
274   /* ---------------------------------------------------------------------- */
272    /* ---------------------------------------------------------------------- */
273    /* Output                                                                 */
274    /* ---------------------------------------------------------------------- */
275275
276   RES(ROUT, 1000000)
276    RES(ROUT, 1000000)
277277
278   //NET_C(Q10.C, ROUT.1)
279   //NET_C(R43.2, ROUT.1)
280   NET_C(VR1.1, ROUT.1)
278    //NET_C(Q10.C, ROUT.1)
279    //NET_C(R43.2, ROUT.1)
280    NET_C(VR1.1, ROUT.1)
281281
282   NET_C(GND, ROUT.2)
282    NET_C(GND, ROUT.2)
283283
284284NETLIST_END()
285285
r243192r243193
790790#if OLD_SOUND
791791   m_discrete->write(space, DS_SOUND0_INP, 0);
792792#else
793   m_audio_snd0->write(data);
793    m_audio_snd0->write(data);
794794#endif
795795}
796796
r243192r243193
835835#if OLD_SOUND
836836         machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1);
837837#else
838         m_audio_snd7->write((data & 1) ^ 1);
838          m_audio_snd7->write((data & 1) ^ 1);
839839#endif
840840         break;
841841   }
r243192r243193
891891   MCFG_DISCRETE_INTF(mario)
892892   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
893893#else
894   MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
895   MCFG_NETLIST_SETUP(nl_mario)
896   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
894    MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
895    MCFG_NETLIST_SETUP(nl_mario)
896    MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
897897
898   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
899   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
900   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
898    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
899    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
900    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
901901
902   MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
903   MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
902    MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
903    MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
904904#endif
905905
906906MACHINE_CONFIG_END
trunk/src/mame/drivers/20pacgal.c
r243192r243193
341341   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
342342INPUT_PORTS_END
343343
344static INPUT_PORTS_START( 25pacmano )
345   PORT_INCLUDE(20pacgal)
346344
347   PORT_MODIFY("SERVICE")
348   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
349   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
350   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
351   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
352   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
353   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
354INPUT_PORTS_END
355345
356346/*************************************
357347 *
r243192r243193
534524 *************************************/
535525
536526GAME( 2006, 25pacman,          0, 25pacman, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 3.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
537GAME( 2005, 25pacmano,  25pacman, 20pacgal, 25pacmano,_20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
527GAME( 2005, 25pacmano,  25pacman, 20pacgal, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
538528
539529GAME( 2000, 20pacgal,          0, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.08)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
540530GAME( 2000, 20pacgalr4, 20pacgal, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.04)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
trunk/src/mame/drivers/actfancr.c
r243192r243193
273273
274274/******************************************************************************/
275275
276WRITE_LINE_MEMBER(actfancr_state::sound_irq)
277{
278   m_audiocpu->set_input_line(0, state); /* IRQ */
279}
280
281/******************************************************************************/
282
283MACHINE_START_MEMBER(actfancr_state,actfancr)
284{
285}
286
276287MACHINE_START_MEMBER(actfancr_state,triothep)
277288{
289   MACHINE_START_CALL_MEMBER(actfancr);
290
278291   save_item(NAME(m_trio_control_select));
279292}
280293
294MACHINE_RESET_MEMBER(actfancr_state,actfancr)
295{
296   m_flipscreen = 0;
297}
298
281299MACHINE_RESET_MEMBER(actfancr_state,triothep)
282300{
301   MACHINE_RESET_CALL_MEMBER(actfancr);
283302   m_trio_control_select = 0;
284303}
285304
r243192r243193
295314   MCFG_CPU_ADD("audiocpu",M6502, 1500000) /* Should be accurate */
296315   MCFG_CPU_PROGRAM_MAP(dec0_s_map)
297316
317   MCFG_MACHINE_START_OVERRIDE(actfancr_state,actfancr)
318   MCFG_MACHINE_RESET_OVERRIDE(actfancr_state,actfancr)
319
298320   /* video hardware */
299321   MCFG_SCREEN_ADD("screen", RASTER)
300322   MCFG_SCREEN_REFRESH_RATE(60)
r243192r243193
331353   MCFG_SOUND_ROUTE(3, "mono", 0.50)
332354
333355   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
334   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
356   MCFG_YM3812_IRQ_HANDLER(WRITELINE(actfancr_state, sound_irq))
335357   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
336358
337359   MCFG_OKIM6295_ADD("oki", 1024188, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r243192r243193
387409   MCFG_SOUND_ROUTE(3, "mono", 0.50)
388410
389411   MCFG_SOUND_ADD("ym2", YM3812, XTAL_12MHz/4) /* verified on pcb */
390   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
412   MCFG_YM3812_IRQ_HANDLER(WRITELINE(actfancr_state, sound_irq))
391413   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
392414
393415   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) /* verified on pcb */
trunk/src/mame/drivers/aerofgt.c
r243192r243193
12711271   GFXDECODE_ENTRY( "gfx2", 0, wbbc97_spritelayout, 1024, 64 ) /* colors 1024-2047 in 4 banks */
12721272GFXDECODE_END
12731273
1274WRITE_LINE_MEMBER(aerofgt_state::irqhandler)
1275{
1276   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1277}
12741278
1279
12751280MACHINE_START_MEMBER(aerofgt_state,common)
12761281{
12771282   save_item(NAME(m_pending_command));
r243192r243193
13381343   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
13391344
13401345   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1341   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1346   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
13421347   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
13431348   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
13441349   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
14971502   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
14981503
14991504   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz ) /* verified on pcb */
1500   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1505   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
15011506   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
15021507   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
15031508   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
15511556   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
15521557
15531558   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1554   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1559   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
15551560   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
15561561   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
15571562   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
16041609   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16051610
16061611   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1607   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1612   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
16081613   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
16091614   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
16101615   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
16581663   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16591664
16601665   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1661   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1666   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
16621667   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
16631668   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
16641669   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
17061711   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
17071712
17081713   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1709   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1714   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
17101715   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
17111716   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
17121717   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
18191824   MCFG_SPEAKER_STANDARD_MONO("mono")
18201825
18211826   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1822   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1827   MCFG_YM3812_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
18231828   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18241829
18251830   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/aleck64.c
r243192r243193
3030          Seta E92 Mother PCB
3131         |---------------------------------------------|
3232       --|     VOL_POT                                 |
33       |R|TA8139S                                      |-
33       |R|TA8139S                                      |
3434  RCA  --|  TA8201         BU9480                      |
3535 AUDIO   |                                             |
3636 PLUGS --|           AMP-NUS                           |
r243192r243193
178178public:
179179   aleck64_state(const machine_config &mconfig, device_type type, const char *tag)
180180      : n64_state(mconfig, type, tag),
181         m_e90_vram(*this,"e90vram"),
182         m_e90_pal(*this,"e90pal"),
183181         m_dip_read_offset(0) { }
184182
185   optional_shared_ptr<UINT32> m_e90_vram;
186   optional_shared_ptr<UINT32> m_e90_pal;
187183   DECLARE_DRIVER_INIT(aleck64);
188184   DECLARE_WRITE32_MEMBER(aleck_dips_w);
189185   DECLARE_READ32_MEMBER(aleck_dips_r);
190186   DECLARE_READ16_MEMBER(e90_prot_r);
191187   DECLARE_WRITE16_MEMBER(e90_prot_w);
192   UINT32 screen_update_e90(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
193188private:
194189   UINT32 m_dip_read_offset;
195190};
r243192r243193
322317ADDRESS_MAP_END
323318
324319/*
325 E90 protection handlers
320 E90 protection handlers
326321*/
327322
328323READ16_MEMBER(aleck64_state::e90_prot_r)
r243192r243193
332327}
333328
334329WRITE16_MEMBER(aleck64_state::e90_prot_w)
335{
330{   
336331   switch(offset*2)
337332   {
338333      case 0x16:
r243192r243193
342337         if(data & 1) // 0 -> 1 transition
343338         {
344339            //for(int i=0;i<0x1000;i+=4)
345            //  space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
340            //   space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
346341         }
347342         break;
348343      //0x1e bit 0 probably enables the chip
r243192r243193
354349
355350static ADDRESS_MAP_START( e90_map, AS_PROGRAM, 32, aleck64_state )
356351   AM_IMPORT_FROM( n64_map )
357   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM AM_SHARE("e90vram")// x/y offsets
358   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM AM_SHARE("e90pal")// RGB555 palette
352   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM // x/y offsets
353   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM // RGB555 palette
359354   AM_RANGE(0xd0030000, 0xd003001f) AM_READWRITE16(e90_prot_r, e90_prot_w,0xffffffff)
360355ADDRESS_MAP_END
361356
r243192r243193
878873   MCFG_N64_PERIPHS_ADD("rcp");
879874MACHINE_CONFIG_END
880875
881UINT32 aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
882{
883   bitmap.fill(0, cliprect);
884   screen_update_n64(screen,bitmap,cliprect);
885
886   for(int offs=0;offs<0x1000/4;offs+=2)
887   {
888      int xi,yi;
889      int r,g,b;
890      int pal_offs;
891      int pal_shift;
892      //UINT16 tile = m_e90_vram[offs] >> 16;
893      UINT16 pal = m_e90_vram[offs] & 0xff; // guess: 0x1000 entries / word / 4bpp = 0x7f, divided by two below (TODO: why?)
894      INT16 x = m_e90_vram[offs+1] >> 16;
895      INT16 y = m_e90_vram[offs+1] & 0xffff;
896      pal>>=1;
897      x>>=1;
898      pal_offs = (pal*0x20);
899      pal_offs+= 1; // edit this to get the other colors in the range
900      pal_shift = pal_offs & 1 ? 0 : 16;
901      r = m_e90_pal[pal_offs>>1] >> pal_shift;
902      g = (m_e90_pal[pal_offs>>1] >> (5+pal_shift));
903      b = (m_e90_pal[pal_offs>>1] >> (10+pal_shift));
904      r&=0x1f;
905      g&=0x1f;
906      b&=0x1f;
907      r = (r << 3) | (r >> 2);
908      g = (g << 3) | (g >> 2);
909      b = (b << 3) | (b >> 2);
910      for(yi=0;yi<8;yi++)
911         for(xi=0;xi<8;xi++)
912         {
913            int res_x,res_y;
914            res_x = x+xi + 4;
915            res_y = y+yi + 7;
916
917            if(cliprect.contains(res_x, res_y))
918               bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b;
919         }
920   }
921   return 0;
922}
923
924876static MACHINE_CONFIG_DERIVED( a64_e90, aleck64 )
925877   MCFG_CPU_MODIFY("maincpu")
926878   MCFG_CPU_PROGRAM_MAP(e90_map)
927
928   MCFG_SCREEN_MODIFY("screen")
929   MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90)
930879MACHINE_CONFIG_END
931880
932881DRIVER_INIT_MEMBER(aleck64_state,aleck64)
trunk/src/mame/drivers/aliens.c
r243192r243193
455455   /* second half empty */
456456
457457   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
458   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
459   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
460   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
458   ROM_LOAD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
459   ROM_LOAD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
460   ROM_LOAD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
461461   /* second half empty */
462   ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
462   ROM_LOAD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
463463   /* second half empty */
464464
465465   ROM_REGION( 0x0100, "proms", 0 )
trunk/src/mame/drivers/alpha68k.c
r243192r243193
17871787   m_sound_pa_latch = data & 1;
17881788}
17891789
1790WRITE_LINE_MEMBER(alpha68k_state::ym3812_irq)
1791{
1792   m_audiocpu->set_input_line(0, (state) ? HOLD_LINE : CLEAR_LINE);
1793}
17901794
1795
17911796/******************************************************************************/
17921797
17931798
r243192r243193
20562061   MCFG_SPEAKER_STANDARD_MONO("mono")
20572062
20582063   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000)
2059   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
2064   MCFG_YM3812_IRQ_HANDLER(WRITELINE(alpha68k_state, ym3812_irq))
20602065   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20612066MACHINE_CONFIG_END
20622067
r243192r243193
22912296   MCFG_SPEAKER_STANDARD_MONO("mono")
22922297
22932298   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000)
2294   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
2299   MCFG_YM3812_IRQ_HANDLER(WRITELINE(alpha68k_state, ym3812_irq))
22952300   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
22962301MACHINE_CONFIG_END
22972302
trunk/src/mame/drivers/bogeyman.c
r243192r243193
1313
1414#include "emu.h"
1515#include "cpu/m6502/m6502.h"
16#include "sound/ay8910.h"
1617#include "includes/bogeyman.h"
1718
1819
r243192r243193
2021
2122// Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad
2223
23WRITE8_MEMBER(bogeyman_state::ay8910_latch_w)
24WRITE8_MEMBER(bogeyman_state::bogeyman_8910_latch_w)
2425{
2526   m_psg_latch = data;
2627}
2728
28WRITE8_MEMBER(bogeyman_state::ay8910_control_w)
29WRITE8_MEMBER(bogeyman_state::bogeyman_8910_control_w)
2930{
3031   // bit 0 is flipscreen
3132   flip_screen_set(data & 0x01);
3233
3334   // bit 5 goes to 8910 #0 BDIR pin
3435   if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00)
35      m_ay1->data_address_w(space, m_last_write >> 4, m_psg_latch);
36      machine().device<ay8910_device>("ay1")->data_address_w(space, m_last_write >> 4, m_psg_latch);
3637
3738   // bit 7 goes to 8910 #1 BDIR pin
3839   if ((m_last_write & 0x80) == 0x80 && (data & 0x80) == 0x00)
39      m_ay2->data_address_w(space, m_last_write >> 6, m_psg_latch);
40      machine().device<ay8910_device>("ay2")->data_address_w(space, m_last_write >> 6, m_psg_latch);
4041
4142   m_last_write = data;
4243}
r243192r243193
4546
4647static ADDRESS_MAP_START( bogeyman_map, AS_PROGRAM, 8, bogeyman_state )
4748   AM_RANGE(0x0000, 0x17ff) AM_RAM
48   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2")
49   AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(colorram2_w) AM_SHARE("colorram2")
50   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
51   AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
49   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(bogeyman_videoram2_w) AM_SHARE("videoram2")
50   AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(bogeyman_colorram2_w) AM_SHARE("colorram2")
51   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(bogeyman_videoram_w) AM_SHARE("videoram")
52   AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(bogeyman_colorram_w) AM_SHARE("colorram")
5253   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("spriteram")
53   AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(paletteram_w) AM_SHARE("palette")
54   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(ay8910_control_w)
55   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(ay8910_latch_w)
54   AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(bogeyman_paletteram_w) AM_SHARE("palette")
55   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(bogeyman_8910_control_w)
56   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(bogeyman_8910_latch_w)
5657   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW1")
5758   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW2") AM_WRITENOP // ??? sound
5859   AM_RANGE(0x4000, 0xffff) AM_ROM
r243192r243193
204205{
205206   save_item(NAME(m_psg_latch));
206207   save_item(NAME(m_last_write));
207   save_item(NAME(m_colbank));
208208}
209209
210210void bogeyman_state::machine_reset()
211211{
212212   m_psg_latch = 0;
213213   m_last_write = 0;
214   m_colbank = 0;
215214}
216215
217WRITE8_MEMBER(bogeyman_state::colbank_w)
216WRITE8_MEMBER(bogeyman_state::bogeyman_colbank_w)
218217{
219218   if((data & 1) != (m_colbank & 1))
220219   {
r243192r243193
238237   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
239238   MCFG_SCREEN_SIZE(32*8, 32*8)
240239   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
241   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update)
240   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update_bogeyman)
242241   MCFG_SCREEN_PALETTE("palette")
243242
244243   MCFG_GFXDECODE_ADD("gfxdecode", "palette", bogeyman)
r243192r243193
250249   MCFG_SPEAKER_STANDARD_MONO("mono")
251250
252251   MCFG_SOUND_ADD("ay1", AY8910, 1500000)  /* Verified */
253   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, colbank_w))
252   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, bogeyman_colbank_w))
254253   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
255254
256255   MCFG_SOUND_ADD("ay2", AY8910, 1500000)  /* Verified */
trunk/src/mame/drivers/btime.c
r243192r243193
19351935
19361936ROM_START( discof )
19371937   ROM_REGION( 0x10000, "maincpu", 0 )
1938   ROM_LOAD( "w5-f.1a",     0xa000, 0x1000, CRC(9d53c71c) SHA1(53c410cfa4fbbfd08e1c3cf7aeba1c9627171a71) )
1939   ROM_LOAD( "w4-f.2a",     0xb000, 0x1000, CRC(c1f8d747) SHA1(33f5fe73d1851ef4da670075d1aec1550e0417ce) )
1940   ROM_LOAD( "w3-f.4a",     0xc000, 0x1000, CRC(9aadd252) SHA1(c6da7ef46333d525e676c59f03ccc908108b41ba) )
1941   ROM_LOAD( "w2-f.6a",     0xd000, 0x1000, CRC(f131a5bb) SHA1(84b7dea112dce12e5cb235a13f6dc4edcfb18c06) )
1942   ROM_LOAD( "w1-f.9a",     0xe000, 0x1000, CRC(a6ce9a19) SHA1(e8f380e17a21fb33504d6efe9d01d0f903fa25e1) )
1943//  ROM_LOAD( "w1-f",        0xe000, 0x1000, CRC(c8ec57c5) SHA1(904a9ed0a7f1230c611bf473b9bc52e63eb56dbe) ) // 0x7d3 is 0x10 instead of 0x00, 1 bit different, looks out of place, bad?
1944   ROM_LOAD( "w0-f.9a",     0xf000, 0x1000, CRC(b3787a92) SHA1(7f40621dc739c1108a5df43142ab04709a380219) )
1938   ROM_LOAD( "w5-f",     0xa000, 0x1000, CRC(9d53c71c) SHA1(53c410cfa4fbbfd08e1c3cf7aeba1c9627171a71) )
1939   ROM_LOAD( "w4-f",     0xb000, 0x1000, CRC(c1f8d747) SHA1(33f5fe73d1851ef4da670075d1aec1550e0417ce) )
1940   ROM_LOAD( "w3-f",     0xc000, 0x1000, CRC(9aadd252) SHA1(c6da7ef46333d525e676c59f03ccc908108b41ba) )
1941   ROM_LOAD( "w2-f",     0xd000, 0x1000, CRC(f131a5bb) SHA1(84b7dea112dce12e5cb235a13f6dc4edcfb18c06) )
1942   ROM_LOAD( "w1-f",     0xe000, 0x1000, CRC(c8ec57c5) SHA1(904a9ed0a7f1230c611bf473b9bc52e63eb56dbe) )
1943   ROM_LOAD( "w0-f",     0xf000, 0x1000, CRC(b3787a92) SHA1(7f40621dc739c1108a5df43142ab04709a380219) )
19451944
19461945   ROM_REGION( 0x10000, "audiocpu", 0 )
1947   ROM_LOAD( "w6-.1b",     0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) )
1946   ROM_LOAD( "disco.w6",     0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) )
19481947
1949   ROM_REGION( 0x0020, "proms", 0 ) // board uses 2 proms, not 1
1948   ROM_REGION( 0x0020, "proms", 0 )
19501949   ROM_LOAD( "disco.clr",    0x0000, 0x0020, CRC(a393f913) SHA1(42dce159283427064b3f5ce3a6e2189744ecd943) )
19511950ROM_END
19521951
trunk/src/mame/drivers/calomega.c
r243192r243193
36583658DRIVER_INIT_MEMBER(calomega_state,comg080)
36593659{
36603660   DRIVER_INIT_CALL(sys903);
3661
3661   
36623662   /* Injecting missing Start and NMI vectors...
36633663      Start = $2042;  NMI = $26f8;
36643664      Also a fake vector at $3ff8-$3ff9. The code checks these values to continue.
trunk/src/mame/drivers/circus.c
r243192r243193
66
77Robot Bowl           1977  6502   4020-4027, 4010-4013
88Circus               1977  6502   9000-9003, 9004-9011
9Football         Aug,1978  6502   unknown
109Rip Cord         May,1979  6502   RC30-0014 (cpu) 0015 (snd)
1110                                  9023-9026, 9027-9034, 9035
1211Crash           July,1979  6502   CR30-3162 (cpu) 3161 (snd)  9036 (?)
trunk/src/mame/drivers/cps1.c
r243192r243193
92629262   ROM_LOAD( "s92_19.12c",  0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
92639263ROM_END
92649264
9265
92669265/* B-Board 89625B-1 */
92679266ROM_START( cworld2j )
92689267   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r243192r243193
93179316   ROM_LOAD( "ioc1.ic1",     0x0000, 0x0117, CRC(0d182081) SHA1(475b3d417785da4bc512cce2b274bb00d4cc6792) )
93189317ROM_END
93199318
9320/* B-Board 90629B-3  - all roms have 90629B on the labels, no battery, possibly unofficial / desuicided with reproduction stickers */
9321ROM_START( cworld2ja )
9322   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
9323   ROM_LOAD16_WORD_SWAP("q5 - 34_90629b.8f", 0x00000, 0x80000, CRC(de54487f) SHA1(75b228a6c702c82d4d9a2a992933b5c3c420f6c2) )
9324   ROM_LOAD16_WORD_SWAP("q5 - 33_90629b.6f", 0x80000, 0x80000, CRC(93248458) SHA1(9dcdc6838f52efc9a0a6333fd0d734946db12dbd) )
9325
9326   ROM_REGION( 0x200000, "gfx", 0 )
9327   ROMX_LOAD( "q5 - 06_90629b.8a",  0x000000, 0x80000, CRC(09d0e7ce) SHA1(ea502b975986222acce82ce8396348af72e1df72) , ROM_GROUPWORD | ROM_SKIP(6) )
9328   ROMX_LOAD( "q5 - 08_90629b.10a", 0x000002, 0x80000, CRC(22e4ce9a) SHA1(9e49aec8e1d6d15a68da63e69765b82fd53a9562) , ROM_GROUPWORD | ROM_SKIP(6) )
9329   ROMX_LOAD( "q5 - 05_90629b.7a",  0x000004, 0x80000, CRC(f7b3aed6) SHA1(bdfb4d5988307b07ad878ac9129954d14da8769b) , ROM_GROUPWORD | ROM_SKIP(6) )
9330   ROMX_LOAD( "q5 - 07_90629b.9a",  0x000006, 0x80000, CRC(520c6c88) SHA1(19ba8ca3d75aae71cdf471e6307e86a5df8a2851) , ROM_GROUPWORD | ROM_SKIP(6) )
9331
9332   ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
9333   ROM_LOAD( "q5 - 09_90629b.12a",  0x00000, 0x08000, CRC(e14dc524) SHA1(0020a9002572002458fbfe45e8a959cb90de3f03) )
9334   ROM_CONTINUE(           0x10000, 0x08000 )
9335
9336   ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
9337   ROM_LOAD( "q5 - 18_90629b.11c",  0x00000, 0x20000, CRC(d10c1b68) SHA1(2423241f3340d8ab1b6bf9514ca8c3bba1273873) )
9338   ROM_LOAD( "q5 - 19_90629b.12c",  0x20000, 0x20000, CRC(7d17e496) SHA1(a274b94ec4f042dddc239ecb9ac2e1e2375f5eb2) )
9339
9340   ROM_REGION( 0x0200, "aboardplds", 0 )
9341   ROM_LOAD( "buf1",         0x0000, 0x0117, CRC(eb122de7) SHA1(b26b5bfe258e3e184f069719f9fd008d6b8f6b9b) )
9342   ROM_LOAD( "ioa1",         0x0000, 0x0117, CRC(59c7ee3b) SHA1(fbb887c5b4f5cb8df77cec710eaac2985bc482a6) )
9343   ROM_LOAD( "prg1",         0x0000, 0x0117, CRC(f1129744) SHA1(a5300f301c1a08a7da768f0773fa0fe3f683b237) )
9344   ROM_LOAD( "rom1",         0x0000, 0x0117, CRC(41dc73b9) SHA1(7d4c9f1693c821fbf84e32dd6ef62ddf14967845) )
9345   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
9346
9347   ROM_REGION( 0x0200, "bboardplds", 0 )
9348   ROM_LOAD( "q529b.1a",     0x0000, 0x0117, NO_DUMP )
9349   ROM_LOAD( "iob1.11d",     0x0000, 0x0117, CRC(3abc0700) SHA1(973043aa46ec6d5d1db20dc9d5937005a0f9f6ae) )
9350
9351   ROM_REGION( 0x0200, "cboardplds", 0 )
9352   ROM_LOAD( "ioc1.ic1",     0x0000, 0x0117, CRC(0d182081) SHA1(475b3d417785da4bc512cce2b274bb00d4cc6792) )
9353ROM_END
9354
93559319/* B-Board 89624B-3 */
93569320ROM_START( varth )
93579321   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r243192r243193
1171711681GAME( 1992, sf2koryu,    sf2ce,    cps1_12MHz, sf2hack,  cps_state,   sf2hack,  ROT0,   "bootleg", "Street Fighter II': Champion Edition (Xiang Long, Chinese bootleg)", GAME_SUPPORTS_SAVE )       // 811102 !!! - based on World version
1171811682GAME( 1992, sf2dongb,    sf2ce,    cps1_12MHz, sf2,      cps_state,   sf2dongb, ROT0,   "bootleg", "Street Fighter II': Champion Edition (Dongfang Bubai protection, bootleg)", GAME_SUPPORTS_SAVE ) // 920313 - based on World version
1171911683GAME( 1992, cworld2j,    0,        cps1_12MHz, cworld2j, cps_state,   cps1,     ROT0,   "Capcom", "Adventure Quiz Capcom World 2 (Japan 920611)", GAME_SUPPORTS_SAVE )
11720GAME( 1992, cworld2ja,   cworld2j, cps1_12MHz, cworld2j, cps_state,   cps1,     ROT0,   "Capcom", "Adventure Quiz Capcom World 2 (Japan 920611, B-Board 90629B-3, no battery)", GAME_SUPPORTS_SAVE )
1172111684GAME( 1992, varth,       0,        cps1_12MHz, varth,    cps_state,   cps1,     ROT270, "Capcom", "Varth: Operation Thunderstorm (World 920714)", GAME_SUPPORTS_SAVE )  // "ETC"    // 12MHz verified
1172211685GAME( 1992, varthr1,     varth,    cps1_12MHz, varth,    cps_state,   cps1,     ROT270, "Capcom", "Varth: Operation Thunderstorm (World 920612)", GAME_SUPPORTS_SAVE )  // "ETC"
1172311686GAME( 1992, varthu,      varth,    cps1_12MHz, varth,    cps_state,   cps1,     ROT270, "Capcom (Romstar license)", "Varth: Operation Thunderstorm (USA 920612)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/crospang.c
r243192r243193
314314   GFXDECODE_ENTRY( "gfx1", 0, tlayout,       0, 64 )  /* Sprites 16x16 */
315315GFXDECODE_END
316316
317
318WRITE_LINE_MEMBER(crospang_state::irqhandler)
319{
320   m_audiocpu->set_input_line(0, state);
321}
322
323
317324void crospang_state::machine_start()
318325{
319326   save_item(NAME(m_bestri_tilebank));
r243192r243193
365372   MCFG_SPEAKER_STANDARD_MONO("mono")
366373
367374   MCFG_SOUND_ADD("ymsnd", YM3812, 14318180/4)
368   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
375   MCFG_YM3812_IRQ_HANDLER(WRITELINE(crospang_state, irqhandler))
369376   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
370377
371378   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/ddenlovr.c
r243192r243193
110110#include "cpu/m68000/m68000.h"
111111#include "cpu/z80/z80.h"
112112#include "sound/ay8910.h"
113#include "sound/okim6295.h"
114#include "sound/2413intf.h"
113115#include "machine/msm6242.h"
114116#include "machine/nvram.h"
115117#include "includes/dynax.h"
r243192r243193
151153{
152154public:
153155   ddenlovr_state(const machine_config &mconfig, device_type type, const char *tag)
154      : dynax_state(mconfig, type, tag),
155      m_dsw_sel16(*this, "dsw_sel16"),
156      m_protection1(*this, "protection1"),
157      m_protection2(*this, "protection2") { }
156      : dynax_state(mconfig, type, tag)
157      { }
158158
159
160   optional_shared_ptr<UINT16> m_dsw_sel16;
161   optional_shared_ptr<UINT16> m_protection1;
162   optional_shared_ptr<UINT16> m_protection2;
163
164
165   UINT8 *  m_ddenlovr_pixmap[8];
166
167   /* blitter (TODO: merge with the dynax.h, where possible) */
168   int m_extra_layers;
169   int m_ddenlovr_dest_layer;
170   int m_ddenlovr_blit_flip;
171   int m_ddenlovr_blit_x;
172   int m_ddenlovr_blit_y;
173   int m_ddenlovr_blit_address;
174   int m_ddenlovr_blit_pen;
175   int m_ddenlovr_blit_pen_mode;
176   int m_ddenlovr_blitter_irq_flag;
177   int m_ddenlovr_blitter_irq_enable;
178   int m_ddenlovr_rect_width;
179   int m_ddenlovr_rect_height;
180   int m_ddenlovr_clip_width;
181   int m_ddenlovr_clip_height;
182   int m_ddenlovr_line_length;
183   int m_ddenlovr_clip_ctrl;
184   int m_ddenlovr_clip_x;
185   int m_ddenlovr_clip_y;
186   int m_ddenlovr_scroll[8*2];
187   int m_ddenlovr_priority;
188   int m_ddenlovr_priority2;
189   int m_ddenlovr_bgcolor;
190   int m_ddenlovr_bgcolor2;
191   int m_ddenlovr_layer_enable;
192   int m_ddenlovr_layer_enable2;
193   int m_ddenlovr_palette_base[8];
194   int m_ddenlovr_palette_mask[8];
195   int m_ddenlovr_transparency_pen[8];
196   int m_ddenlovr_transparency_mask[8];
197   int m_ddenlovr_blit_latch;
198   int m_ddenlovr_blit_pen_mask;   // not implemented
199   int m_ddenlovr_blit_rom_bits;           // usually 8, 16 in hanakanz
200   const int *m_ddenlovr_blit_commands;
201   int m_ddenlovr_blit_regs[2];
202
203   /* ddenlovr misc (TODO: merge with dynax.h, where possible) */
204   UINT8 m_palram[0x200];
205   int m_okibank;
206   UINT8 m_rongrong_blitter_busy_select;
207   UINT8 m_prot_val;
208   UINT16 m_prot_16;
209   UINT16 m_quiz365_protection[2];
210
211   UINT16 m_mmpanic_leds;  /* A led for each of the 9 buttons */
212   UINT8 m_funkyfig_lockout;
213   UINT8 m_romdata[2];
214   int m_palette_index;
215   UINT8 m_hginga_rombank;
216   UINT8 m_mjflove_irq_cause;
217   UINT8 m_daimyojn_palette_sel;
218
219159   DECLARE_MACHINE_START(ddenlovr);
220160   DECLARE_MACHINE_RESET(ddenlovr);
221161   DECLARE_VIDEO_START(ddenlovr);
r243192r243193
410350   DECLARE_VIDEO_START(htengoku);
411351   DECLARE_WRITE8_MEMBER(htengoku_dsw_w);
412352   DECLARE_READ8_MEMBER(htengoku_dsw_r);
413   DECLARE_WRITE8_MEMBER( quizchq_oki_bank_w );
414   DECLARE_WRITE16_MEMBER( ddenlovr_oki_bank_w );
415   DECLARE_WRITE16_MEMBER( quiz365_oki_bank1_w );
416   DECLARE_WRITE16_MEMBER( quiz365_oki_bank2_w );
417   DECLARE_WRITE8_MEMBER( ddenlovr_select_w );
418   DECLARE_READ8_MEMBER( quiz365_input_r );
419   DECLARE_WRITE16_MEMBER( nettoqc_oki_bank_w );
420   DECLARE_WRITE8_MEMBER( hanakanz_oki_bank_w );
421   DECLARE_WRITE8_MEMBER( mjchuuka_oki_bank_w );
422   DECLARE_READ8_MEMBER( hginga_dsw_r );
423   DECLARE_WRITE8_MEMBER( mjflove_okibank_w );
424   DECLARE_WRITE8_MEMBER( jongtei_okibank_w );
425   DECLARE_READ8_MEMBER( seljan2_dsw_r );
426   DECLARE_WRITE8_MEMBER( daimyojn_okibank_w );
427353
428354   void ddenlovr_flipscreen_w( UINT8 data );
429355   void ddenlovr_blit_flip_w( UINT8 data );
r243192r243193
442368   void mmpanic_update_leds();
443369   void mjchuuka_get_romdata();
444370   UINT8 hgokou_player_r( int player );
371   DECLARE_WRITE8_MEMBER( quizchq_oki_bank_w );
372   DECLARE_WRITE16_MEMBER( ddenlovr_oki_bank_w );
373   DECLARE_WRITE16_MEMBER( quiz365_oki_bank1_w );
374   DECLARE_WRITE16_MEMBER( quiz365_oki_bank2_w );
375   DECLARE_WRITE8_MEMBER( ddenlovr_select_w );
376   DECLARE_READ8_MEMBER( quiz365_input_r );
377   DECLARE_WRITE16_MEMBER( nettoqc_oki_bank_w );
378   DECLARE_WRITE8_MEMBER( hanakanz_oki_bank_w );
379   DECLARE_WRITE8_MEMBER( mjchuuka_oki_bank_w );
380   DECLARE_READ8_MEMBER( hginga_dsw_r );
381   DECLARE_WRITE8_MEMBER( mjflove_okibank_w );
382   DECLARE_WRITE8_MEMBER( jongtei_okibank_w );
383   DECLARE_READ8_MEMBER( seljan2_dsw_r );
384   DECLARE_WRITE8_MEMBER( daimyojn_okibank_w );
445385};
446386
447387VIDEO_START_MEMBER(ddenlovr_state,ddenlovr)
r243192r243193
19761916   AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r)                             // Video Chip
19771917
19781918   AM_RANGE(0x3002c0, 0x3002c1) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)// Sound
1979   AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
1919   AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
19801920   AM_RANGE(0x300340, 0x30035f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
19811921   AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
19821922   AM_RANGE(0x300384, 0x300385) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243192r243193
20281968   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                       // ? must be 78 on startup (not necessary in ddlover)
20291969   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
20301970   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                             // Video Chip
2031   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
1971   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
20321972   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
20331973   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
20341974   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243192r243193
20952035   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
20962036   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
20972037
2098   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2038   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
20992039   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
21002040   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
21012041   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243192r243193
21332073   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
21342074   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
21352075
2136   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2076   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
21372077   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
21382078   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
21392079   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243192r243193
22072147   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                           // ? must be 78 on startup (not necessary in ddlover)
22082148   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
22092149   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                                 // Video Chip
2210   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2150   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
22112151   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
22122152   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
22132153   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243192r243193
22702210   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
22712211   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
22722212
2273   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2213   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
22742214   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
22752215   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
22762216   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243192r243193
23262266   AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r)
23272267
23282268   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2329   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
2269   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
23302270
23312271   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
23322272   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243192r243193
23632303
23642304   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
23652305   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2366   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
2306   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
23672307
23682308   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
23692309   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243192r243193
25172457   AM_RANGE(0x02, 0x02) AM_READNOP     // read just before port 00
25182458   AM_RANGE(0x04, 0x04) AM_NOP                 // read only once at the start
25192459   AM_RANGE(0x06, 0x06) AM_WRITENOP    // almost always 1, sometimes 0
2520   AM_RANGE(0x08, 0x09) AM_DEVWRITE("ym2413", ym2413_device, write)
2460   AM_RANGE(0x08, 0x09) AM_DEVWRITE("ymsnd", ym2413_device, write)
25212461   AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd", ay8910_device, data_w)
25222462   AM_RANGE(0x0e, 0x0e) AM_DEVWRITE("aysnd", ay8910_device, address_w)
25232463ADDRESS_MAP_END
r243192r243193
28002740   AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w)
28012741   AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w)
28022742   AM_RANGE(0x96, 0x96) AM_READ(hanakanz_rand_r)
2803   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
2743   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
28042744   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
28052745   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
28062746ADDRESS_MAP_END
r243192r243193
28162756   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28172757   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28182758   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2819   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
2759   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
28202760   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
28212761   AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
28222762   AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w)
r243192r243193
28382778   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28392779   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28402780   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2841   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
2781   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
28422782   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
28432783//  AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
28442784   AM_RANGE(0xb1, 0xb1) AM_READ_PORT("KEYB0")
r243192r243193
28622802   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28632803   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28642804   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2865   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
2805   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
28662806   AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
28672807//  AM_RANGE(0x91, 0x91) AM_READ(hanakanz_keyb_r)
28682808   AM_RANGE(0x91, 0x91) AM_READ_PORT("KEYB0")
r243192r243193
29012841   AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM")
29022842   AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r)
29032843   AM_RANGE(0x97, 0x97) AM_WRITE(hanakanz_coincounter_w)
2904   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
2844   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
29052845   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
29062846   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
29072847ADDRESS_MAP_END
r243192r243193
30292969   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4")
30302970   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5")     // DSW 1-4 high bits
30312971   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3032   AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ym2413", ym2413_device, write)
2972   AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ymsnd", ym2413_device, write)
30332973   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
30342974   AM_RANGE(0xe0, 0xe1) AM_MIRROR(0xff00) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
30352975ADDRESS_MAP_END
r243192r243193
31383078   AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r)
31393079   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
31403080   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3141   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write)
3081   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write)
31423082   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
31433083   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
31443084   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243192r243193
33033243   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
33043244   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)
33053245   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
3306   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write)
3246   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write)
33073247   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
33083248   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
33093249   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243192r243193
34263366   AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w)
34273367   AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r)
34283368   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3429   AM_RANGE(0x82, 0x83) AM_DEVWRITE("ym2413", ym2413_device, write)
3369   AM_RANGE(0x82, 0x83) AM_DEVWRITE("ymsnd", ym2413_device, write)
34303370   AM_RANGE(0x84, 0x84) AM_DEVREAD("aysnd", ay8910_device, data_r)
34313371   AM_RANGE(0x86, 0x86) AM_DEVWRITE("aysnd", ay8910_device, data_w)
34323372   AM_RANGE(0x88, 0x88) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243192r243193
34693409   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)        // ? ack on RTC int
34703410   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
34713411   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3472   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write)
3412   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write)
34733413   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
34743414   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
34753415   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243192r243193
35603500   AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r)
35613501   AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w)
35623502   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3563   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
3503   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
35643504   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
35653505   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
35663506   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
r243192r243193
36063546   AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r)
36073547   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
36083548   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3609   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write)
3549   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write)
36103550   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
36113551   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
36123552   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243192r243193
37063646   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
37073647   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
37083648
3709   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
3649   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
37103650   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
37113651   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
37123652   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243192r243193
37973737   AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
37983738   AM_RANGE(0x0181, 0x0181) AM_WRITENOP                        // ? int. enable
37993739   AM_RANGE(0x0184, 0x0184) AM_WRITE(mjflove_coincounter_w)
3800   AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ym2413", ym2413_device, write)
3740   AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ymsnd", ym2413_device, write)
38013741   AM_RANGE(0x0280, 0x028f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
38023742   AM_RANGE(0x0300, 0x0301) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
38033743   AM_RANGE(0x0380, 0x0380) AM_DEVREADWRITE("oki", okim6295_device, read, write)
r243192r243193
38383778   AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w)
38393779   AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w)
38403780   AM_RANGE(0x63, 0x64) AM_READ(hanakanz_gfxrom_r)
3841   AM_RANGE(0x80, 0x81) AM_DEVWRITE("ym2413", ym2413_device, write)
3781   AM_RANGE(0x80, 0x81) AM_DEVWRITE("ymsnd", ym2413_device, write)
38423782   AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
38433783   AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
38443784ADDRESS_MAP_END
r243192r243193
39013841static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, ddenlovr_state )
39023842   ADDRESS_MAP_GLOBAL_MASK(0xff)
39033843   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3904   AM_RANGE(0x02, 0x03) AM_DEVWRITE("ym2413", ym2413_device, write)
3844   AM_RANGE(0x02, 0x03) AM_DEVWRITE("ymsnd", ym2413_device, write)
39053845   AM_RANGE(0x04, 0x05) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
39063846   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(sryudens_rambank_w)    // ? ack on RTC int
39073847   AM_RANGE(0x1e, 0x1e) AM_WRITE(mjflove_rombank_w)
r243192r243193
39883928   AM_RANGE(0x70, 0x70) AM_WRITE(quizchq_oki_bank_w)
39893929   AM_RANGE(0x80, 0x80) AM_RAM
39903930   AM_RANGE(0x90, 0x90) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3991   AM_RANGE(0x92, 0x93) AM_DEVWRITE("ym2413", ym2413_device, write)
3931   AM_RANGE(0x92, 0x93) AM_DEVWRITE("ymsnd", ym2413_device, write)
39923932   AM_RANGE(0x94, 0x95) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
39933933ADDRESS_MAP_END
39943934
r243192r243193
40604000   AM_RANGE(0x38, 0x38) AM_READNOP         // ? ack or watchdog
40614001   AM_RANGE(0x40, 0x41) AM_WRITE(mjflove_blitter_w)
40624002   AM_RANGE(0x43, 0x43) AM_READ(rongrong_gfxrom_r)
4063   AM_RANGE(0x50, 0x51) AM_DEVWRITE("ym2413", ym2413_device, write)
4003   AM_RANGE(0x50, 0x51) AM_DEVWRITE("ymsnd", ym2413_device, write)
40644004   AM_RANGE(0x54, 0x54) AM_DEVREADWRITE("oki", okim6295_device, read, write)
40654005   AM_RANGE(0x58, 0x58) AM_DEVWRITE("aysnd", ay8910_device, address_w)
40664006   AM_RANGE(0x5c, 0x5c) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w)   // dsw
r243192r243193
42144154   AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    // AY8910
42154155   AM_RANGE( 0x42, 0x42 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     //
42164156   AM_RANGE( 0x44, 0x44 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   //
4217   AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
4157   AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
42184158   AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
42194159   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE(ddenlovr_palette_base_w)    // ddenlovr mixer chip
42204160   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE(ddenlovr_palette_mask_w)
r243192r243193
42864226   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(ddenlovr_state, htengoku_dsw_w))
42874227   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
42884228
4289   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4229   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
42904230   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42914231
42924232   /* devices */
r243192r243193
44014341   AM_RANGE(0x42, 0x44) AM_READ(hanakanz_gfxrom_r)
44024342   AM_RANGE(0x8a, 0x8b) AM_READ(daimyojn_year_hack_r)  // ?
44034343   AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
4404   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
4344   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
44054345   AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("oki", okim6295_device, read, write)
44064346   AM_RANGE(0xa8, 0xa8) AM_READ_PORT("SYSTEM")
44074347   AM_RANGE(0xaa, 0xaa) AM_READ(daimyojn_keyb1_r)
r243192r243193
93619301   save_item(NAME(m_mjflove_irq_cause));
93629302   save_item(NAME(m_daimyojn_palette_sel));
93639303   save_item(NAME(m_palram));
9304
9305   save_item(NAME(m_irq_count));
93649306}
93659307
93669308MACHINE_RESET_MEMBER(ddenlovr_state,ddenlovr)
r243192r243193
93819323   m_hginga_rombank = 0;
93829324   m_mjflove_irq_cause = 0;
93839325   m_daimyojn_palette_sel = 0;
9326   m_irq_count = 0;
93849327
93859328   m_quiz365_protection[0] = 0;
93869329   m_quiz365_protection[1] = 0;
r243192r243193
94929435   /* sound hardware */
94939436   MCFG_SPEAKER_STANDARD_MONO("mono")
94949437
9495   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
9438   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
94969439   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
94979440
94989441   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 16)  // or /8 ?
r243192r243193
96109553   /* sound hardware */
96119554   MCFG_SPEAKER_STANDARD_MONO("mono")
96129555
9613   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified
9556   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified
96149557   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50)
96159558
96169559   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz/28, OKIM6295_PIN7_HIGH) // clock frequency verified 1.022MHz, pin 7 verified high
r243192r243193
96949637   /* sound hardware */
96959638   MCFG_SPEAKER_STANDARD_MONO("mono")
96969639
9697   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
9640   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
96989641   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
96999642
97009643   MCFG_SOUND_ADD("aysnd", AY8910, 3579545)
r243192r243193
97719714   /* sound hardware */
97729715   MCFG_SPEAKER_STANDARD_MONO("mono")
97739716
9774   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
9717   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
97759718   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
97769719
97779720   MCFG_OKIM6295_ADD("oki", 1022720, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r243192r243193
98179760   /* sound hardware */
98189761   MCFG_SPEAKER_STANDARD_MONO("mono")
98199762
9820   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_37516MHz / 8)
9763   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_37516MHz / 8)
98219764   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
98229765
98239766   MCFG_OKIM6295_ADD("oki", XTAL_28_37516MHz / 28, OKIM6295_PIN7_HIGH)
r243192r243193
1018610129   /* sound hardware */
1018710130   MCFG_SPEAKER_STANDARD_MONO("mono")
1018810131
10189   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10132   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1019010133   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1019110134
1019210135   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
r243192r243193
1022910172   /* sound hardware */
1023010173   MCFG_SPEAKER_STANDARD_MONO("mono")
1023110174
10232   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10175   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1023310176   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1023410177
1023510178   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243192r243193
1027610219   /* sound hardware */
1027710220   MCFG_SPEAKER_STANDARD_MONO("mono")
1027810221
10279   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10222   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1028010223   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1028110224
1028210225   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243192r243193
1034310286   /* sound hardware */
1034410287   MCFG_SPEAKER_STANDARD_MONO("mono")
1034510288
10346   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10289   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1034710290   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1034810291
1034910292   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243192r243193
1039310336   /* sound hardware */
1039410337   MCFG_SPEAKER_STANDARD_MONO("mono")
1039510338
10396   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10339   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1039710340   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1039810341
1039910342   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/dec0.c
r243192r243193
530530{
531531   save_item(NAME(m_automat_adpcm_byte));
532532   save_item(NAME(m_automat_msm5205_vclk_toggle));
533   save_item(NAME(m_automat_scroll_regs));
533   save_item(NAME(m_automat_scroll_regs));   
534534}
535535
536536
trunk/src/mame/drivers/dec8.c
r243192r243193
19061906
19071907/******************************************************************************/
19081908
1909/* handler called by the 3812 emulator when the internal timers cause an IRQ */
1910WRITE_LINE_MEMBER(dec8_state::irqhandler)
1911{
1912   m_audiocpu->set_input_line(0, state); /* M6502_IRQ_LINE */
1913}
1914
1915/******************************************************************************/
1916
19091917INTERRUPT_GEN_MEMBER(dec8_state::gondo_interrupt)
19101918{
19111919   if (m_nmi_enable)
r243192r243193
22462254   MCFG_SOUND_ROUTE(3, "mono", 0.20)
22472255
22482256   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2249   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
2257   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
22502258   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
22512259MACHINE_CONFIG_END
22522260
r243192r243193
24102418   MCFG_SOUND_ROUTE(3, "mono", 0.20)
24112419
24122420   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2413   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
2421   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
24142422   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
24152423MACHINE_CONFIG_END
24162424
r243192r243193
24672475   MCFG_SOUND_ROUTE(3, "mono", 0.50)
24682476
24692477   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2470   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
2478   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
24712479   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
24722480MACHINE_CONFIG_END
24732481
trunk/src/mame/drivers/deniam.c
r243192r243193
221221GFXDECODE_END
222222
223223
224WRITE_LINE_MEMBER(deniam_state::irqhandler)
225{
226   /* system 16c doesn't have the sound CPU */
227   if (m_audiocpu != NULL)
228      m_audiocpu->set_input_line(0, state);
229}
230
231
232
224233void deniam_state::machine_start()
225234{
226235   save_item(NAME(m_display_enable));
r243192r243193
280289   MCFG_SPEAKER_STANDARD_MONO("mono")
281290
282291   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_25MHz/6) /* "SM64" ym3812 clone; 4.166470 measured, = 4.166666Mhz verified */
283   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
292   MCFG_YM3812_IRQ_HANDLER(WRITELINE(deniam_state, irqhandler))
284293   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
285294
286295   MCFG_OKIM6295_ADD("oki", XTAL_25MHz/24, OKIM6295_PIN7_HIGH) /* 1.041620 measured, = 1.0416666Mhz verified */
r243192r243193
313322   MCFG_SPEAKER_STANDARD_MONO("mono")
314323
315324   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_25MHz/6) /* "SM64" ym3812 clone; 4.166470 measured, = 4.166666Mhz verified) */
325   MCFG_YM3812_IRQ_HANDLER(WRITELINE(deniam_state, irqhandler))
316326   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
317327
318328   MCFG_OKIM6295_ADD("oki", XTAL_25MHz/24, OKIM6295_PIN7_HIGH)  /* 1.041620 measured, = 1.0416666Mhz verified */
trunk/src/mame/drivers/dgpix.c
r243192r243193
164164
165165   required_device<cpu_device> m_maincpu;
166166   required_ioport m_vblank;
167
167   
168168   UINT32 *m_vram;
169169   int m_vbuffer;
170170   int m_flash_roms;
171171   int m_old_vbuf;
172172   UINT32 m_flash_cmd;
173173   INT32 m_first_offset;
174
174   
175175   DECLARE_READ32_MEMBER(flash_r);
176176   DECLARE_WRITE32_MEMBER(flash_w);
177177   DECLARE_WRITE32_MEMBER(vram_w);
r243192r243193
179179   DECLARE_WRITE32_MEMBER(vbuffer_w);
180180   DECLARE_WRITE32_MEMBER(coin_w);
181181   DECLARE_READ32_MEMBER(vblank_r);
182
182   
183183   DECLARE_DRIVER_INIT(elfin);
184184   DECLARE_DRIVER_INIT(jumpjump);
185185   DECLARE_DRIVER_INIT(xfiles);
186186   DECLARE_DRIVER_INIT(xfilesk);
187187   DECLARE_DRIVER_INIT(kdynastg);
188188   DECLARE_DRIVER_INIT(fmaniac3);
189
189   
190190   virtual void machine_start();
191191   virtual void machine_reset();
192192   virtual void video_start();
193
193   
194194   UINT32 screen_update_dgpix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
195195};
196196
trunk/src/mame/drivers/dkong.c
r243192r243193
302302    ------------------------------------------------
303303
304304
305Donkey Kong Notes
306=================
307
308    Nintendo Service Department Bulletin # TKG-02 12-11-81
309    GAME: Donkey Kong
310    SUBJECT: Speed-up Kit #1
311
312    TO prevent extremely long play times, we are making available
313    a speed-up kit. This kit prevents players from waiting on top
314    of ladders, on screen #1, while the barrels roll across
315    instead of coming donw on top of him. Whit this kit, barrels
316    will roll on top of the player on a ladder 70 to 80 percent of
317    the time.
318
319    Machines above serial #30,000 will have this kit installed at
320    the factory, and all TKG4 board sets will come with this kit.
321
322    To install this kit in a four-board set, follow these
323    instructions:
324
325    1) Remove P.C. Boards from game, leaving them
326    attached to P.C. Board bracket.
327
328    2) Using a pair of needle-nose pliers, separate the
329    sound P.C. Board fromt he CPU P.C. Board, exposing
330    the entire surface of the CPU Board.
331
332    3) Remove the EPROMS's at location 5F, 5A, 5H and 5K
333    from the CPU Board. (Note 5A should read 5G - MSH)
334
335    4) Install the speed-up kit EPROM's in the corres-
336    ponding locations.
337
338    5) Reconnect the sound P.C. Board to the CPU P.C.
339    Board and mount the P.C. Boards in the game.
340    --------------------------------------------------------------
341
342    That kit included the following 4 EPROM's
343
344    USA (c) 1981 Nintendo of America set
345    ------------------------------------
346
347    Filename Label Type Loc/PCB *Label *Loc/PCB CSum
348    --------- ---------- ------ ------- ---------- -------- ----
349    2532.5K TKG4-C-5At 2532 5A(CPU) TKG3-C-5K 5K(CPU) A0F0
350    2532.5H TKG4-C-5Bt 2532 5B(CPU) TKG3-C-5H 5H(CPU) B2BC
351    2532.5G TKG4-C-5Ct 2532 5C(CPU) TKG3-C-5G 5G(CPU) 73BA
352    2532.5F TKG4-C-5Et 2532 5E(CPU) TKG3-C-5F 5F(CPU) AA97
353
354    Not only did the eprom fix the ladder bug, but it also changed
355    the copyright screen to read "(C)1981 Nintendo of America".
356
357
358305    D2K Jumpman returns Notes
359306    =========================
360307
r243192r243193
366313    6800 and E800.
367314
368315
369    Donkey Kong "Hard" Kit
370    ======================
316Donkey Kong "Hard" Kit
317======================
371318
372    A yet "unconfirmed original" rom replacement kit which is a replacement for
373    TKG-03 and -04 boards and greatly increases the speed and amount of fireballs
374    showing on all levels.  Such behavior can be seen easily on the Rivet Board,
375    where most of the fireballs have appeared even before removing the first rivet.
319A yet "unconfirmed original" rom replacement kit which is a replacement for
320TKG-03 and -04 boards and greatly increases the speed and amount of fireballs
321showing on all levels.  Such behavior can be seen easily on the Rivet Board,
322where most of the fireballs have appeared even before removing the first rivet.
376323
377    Hopefully confirmation and information will come along later which confirms
378    this is a legitimate Nintendo Kit.
324Hopefully confirmation and information will come along later which confirms
325this is a legitimate Nintendo Kit.
379326
380327***************************************************************************/
381328
r243192r243193
19471894   ROM_LOAD( "trs01v1d.bin",    0x0300, 0x0100, BAD_DUMP CRC(1b828315) SHA1(00c9f8c5ae86b68d38c66f9071b5f1ef421c1005) ) /* character color codes on a per-column basis */
19481895ROM_END
19491896
1950ROM_START( dkong ) /* Confirmed TKG-04 Upgrade as mentioned in Nintendo Service Department Bulletin # TKG-02 12-11-81 */
1897ROM_START( dkong )
19511898   ROM_REGION( 0x10000, "maincpu", 0 )
19521899   ROM_LOAD( "c_5et_g.bin",  0x0000, 0x1000, CRC(ba70b88b) SHA1(d76ebecfea1af098d843ee7e578e480cd658ac1a) )
19531900   ROM_LOAD( "c_5ct_g.bin",  0x1000, 0x1000, CRC(5ec461ec) SHA1(acb11a8fbdbb3ab46068385fe465f681e3c824bd) )
r243192r243193
23072254   ROM_LOAD( "v-2n.bpr",  0x0200, 0x0100, CRC(dbf185bf) SHA1(2697a991a4afdf079dd0b7e732f71c7618f43b70) )   /* character color codes on a per-column basis */
23082255ROM_END
23092256
2310ROM_START( dkongjre )  /* Confirmed E-Kit set mentioned in Nintendo Service Department Bulletin # DJR-03 (02-23-83) */
2257ROM_START( dkongjre )
23112258   ROM_REGION( 0x10000, "maincpu", 0 )
23122259   ROM_LOAD( "djr1-c.5b",    0x0000, 0x1000, CRC(ffe9e1a5) SHA1(715dc79d85169b4c1faf43458592e69b434afefd) )
23132260   ROM_CONTINUE(             0x3000, 0x1000 )
r243192r243193
23442291   ROM_REGION( 0x10000, "maincpu", 0 )
23452292   ROM_LOAD( "dkjr1-c.5b-p", 0x0000, 0x1000, CRC(8d99b3e0) SHA1(311a9f353e62d9d07c678e45baa2efec575a8f3b) ) // does not match SUM16 of bulletin (see notes), definitely not from Nintendo
23462293   ROM_CONTINUE(             0x3000, 0x1000 )
2347   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) )
2294   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) ) // "
23482295   ROM_CONTINUE(             0x4800, 0x0800 )
23492296   ROM_CONTINUE(             0x1000, 0x0800 )
23502297   ROM_CONTINUE(             0x5800, 0x0800 )
trunk/src/mame/drivers/dynax.c
r243192r243193
7979#include "sound/ay8910.h"
8080#include "sound/2203intf.h"
8181#include "sound/3812intf.h"
82#include "sound/msm5205.h"
83#include "sound/2413intf.h"
8284#include "machine/nvram.h"
8385#include "rendlay.h"
8486
r243192r243193
532534   AM_RANGE( 0x74, 0x74 ) AM_WRITE(dynax_blitter_ack_w)        // Blitter IRQ Ack
533535   AM_RANGE( 0x76, 0x76 ) AM_WRITE(dynax_blit_palbank_w)       // Layers Palettes (High Bit)
534536   AM_RANGE( 0x77, 0x77 ) AM_WRITE(hanamai_layer_half_w)       // half of the interleaved layer to write to
535   AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) // 2 x DSW
537   AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) // 2 x DSW
536538   AM_RANGE( 0x7a, 0x7b ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)   // AY8910
537539//  AM_RANGE( 0x7c, 0x7c ) AM_WRITENOP   // CRT Controller
538540//  AM_RANGE( 0x7d, 0x7d ) AM_WRITENOP   //
r243192r243193
554556   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW2")         // DSW3
555557   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
556558   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
557   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
559   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
558560   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
559561   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
560562   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
r243192r243193
638640
639641   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
640642   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
641   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
643   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
642644
643645   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
644646   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
r243192r243193
778780   AM_RANGE( 0x11, 0x17 ) AM_WRITE(dynax_blitter_rev2_w)       // Blitter
779781   AM_RANGE( 0x20, 0x20 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
780782   AM_RANGE( 0x22, 0x22 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
781   AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
783   AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
782784   AM_RANGE( 0x28, 0x28 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
783785   AM_RANGE( 0x2a, 0x2a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
784786   AM_RANGE( 0x48, 0x48 ) AM_WRITE(dynax_extra_scrollx_w)  // screen scroll X
r243192r243193
817819   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW1")         // DSW3
818820   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
819821   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
820   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
822   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
821823   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
822824   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
823825   AM_RANGE( 0x40, 0x40 ) AM_WRITE(dynax_blit_pen_w)       // Destination Pen
r243192r243193
845847static ADDRESS_MAP_START( sprtmtch_io_map, AS_IO, 8, dynax_state )
846848   ADDRESS_MAP_GLOBAL_MASK(0xff)
847849   AM_RANGE( 0x01, 0x07 ) AM_WRITE(dynax_blitter_rev2_w)       // Blitter
848   AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write)  // 2 x DSW
850   AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)  // 2 x DSW
849851//  AM_RANGE( 0x12, 0x12 ) AM_WRITENOP   // CRT Controller
850852//  AM_RANGE( 0x13, 0x13 ) AM_WRITENOP   // CRT Controller
851853   AM_RANGE( 0x20, 0x20 ) AM_READ_PORT("P1")               // P1
r243192r243193
891893   AM_RANGE( 0x63, 0x63 ) AM_READ(hanamai_keyboard_0_r)        // P1
892894   AM_RANGE( 0x64, 0x64 ) AM_READ_PORT("DSW0")         // DSW
893895   AM_RANGE( 0x67, 0x67 ) AM_READ_PORT("DSW1")         // DSW
894   AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
896   AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
895897//  AM_RANGE( 0x80, 0x80 ) AM_WRITENOP   // IRQ ack?
896898ADDRESS_MAP_END
897899
r243192r243193
900902   ADDRESS_MAP_GLOBAL_MASK(0xff)
901903   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
902904   AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
903   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
905   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
904906   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
905907   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
906908   AM_RANGE( 0x10, 0x10 ) AM_WRITE(hanamai_keyboard_w)     // keyboard row select
r243192r243193
10221024   AM_RANGE( 0x10, 0x10 ) AM_WRITE(jantouki_sound_vblank_ack_w)    // VBlank IRQ Ack
10231025   AM_RANGE( 0x21, 0x21 ) AM_DEVREAD("aysnd", ay8910_device, data_r)         // AY8910
10241026   AM_RANGE( 0x22, 0x23 ) AM_DEVWRITE("aysnd", ay8910_device, data_address_w)   //
1025   AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) //
1027   AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) //
10261028   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)      // MSM5205 reset
10271029   AM_RANGE( 0x40, 0x40 ) AM_WRITE(adpcm_data_w)               // MSM5205 data
10281030   AM_RANGE( 0x50, 0x50 ) AM_READ(jantouki_soundlatch_status_r)    // Soundlatch status
r243192r243193
10581060   ADDRESS_MAP_GLOBAL_MASK(0xff)
10591061   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
10601062   AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
1061   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
1063   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
10621064   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
10631065   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
10641066   AM_RANGE( 0x11, 0x12 ) AM_WRITE(mjelctrn_blitter_ack_w) //?
r243192r243193
13371339   AM_RANGE( 0x10000, 0x10000 ) AM_DEVREAD("aysnd", ay8910_device, data_r)       // AY8910
13381340   AM_RANGE( 0x10008, 0x10008 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) //
13391341   AM_RANGE( 0x10010, 0x10010 ) AM_DEVWRITE("aysnd", ay8910_device, address_w)  //
1340   AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ym2413", ym2413_device, write)      //
1342   AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ymsnd", ym2413_device, write)      //
13411343   AM_RANGE( 0x10040, 0x10040 ) AM_WRITE(dynax_blit_pen_w)     // Destination Pen
13421344   AM_RANGE( 0x10044, 0x10044 ) AM_WRITE(tenkai_blit_dest_w)       // Destination Layer
13431345   AM_RANGE( 0x10048, 0x10048 ) AM_WRITE(tenkai_blit_palette23_w)  // Layers Palettes
r243192r243193
14791481         case 0x8050:    // CRT controller
14801482         case 0x8051:    return;
14811483
1482         case 0x8070:    m_ym2413->register_port_w(space, 0, data);    return;
1483         case 0x8071:    m_ym2413->data_port_w(space, 0, data);    return;
1484         case 0x8070:    downcast<ym2413_device *>(m_ymsnd)->register_port_w(space, 0, data);    return;
1485         case 0x8071:    downcast<ym2413_device *>(m_ymsnd)->data_port_w(space, 0, data);    return;
14841486
14851487         case 0x8060:    m_keyb = data;  return;
14861488
r243192r243193
39653967
39663968MACHINE_START_MEMBER(dynax_state,dynax)
39673969{
3970   m_ymsnd = machine().device("ymsnd");
3971
39683972   save_item(NAME(m_sound_irq));
39693973   save_item(NAME(m_vblank_irq));
39703974   save_item(NAME(m_blitter_irq));
r243192r243193
40894093   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
40904094   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
40914095
4092   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4096   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
40934097   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
40944098   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
40954099   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW0"))
r243192r243193
41434147   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41444148   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41454149
4146   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4150   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
41474151   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41484152
41494153   MCFG_SOUND_ADD("msm", MSM5205, 384000)
r243192r243193
41904194   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41914195   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41924196
4193   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_3_579545MHz )
4197   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz )
41944198   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41954199
41964200   MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz )
r243192r243193
42344238   /* sound hardware */
42354239   MCFG_SPEAKER_STANDARD_MONO("mono")
42364240
4237   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4241   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
42384242   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
42394243   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
42404244   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1"))
r243192r243193
42794283   /* sound hardware */
42804284   MCFG_SPEAKER_STANDARD_MONO("mono")
42814285
4282   MCFG_SOUND_ADD("ym2413", YM2413, 24000000/6)
4286   MCFG_SOUND_ADD("ymsnd", YM2413, 24000000/6)
42834287   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42844288MACHINE_CONFIG_END
42854289
r243192r243193
43794383   membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000],  0x8000);
43804384   membank("bank2")->configure_entries(0, 12,   &SOUND[0x8000], 0x8000);
43814385
4386   m_top_scr = machine().device("top");
4387   m_bot_scr = machine().device("bottom");
4388
43824389   MACHINE_START_CALL_MEMBER(dynax);
43834390}
43844391
r243192r243193
44304437   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
44314438   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
44324439
4433   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4440   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
44344441   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, jantouki_sound_callback))
44354442   MCFG_SOUND_ROUTE(0, "mono", 0.20)
44364443   MCFG_SOUND_ROUTE(1, "mono", 0.20)
r243192r243193
46094616   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46104617   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46114618
4612   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4619   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
46134620   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46144621
46154622   /* devices */
r243192r243193
46804687   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46814688   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46824689
4683   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_24MHz / 8) // ?
4690   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_24MHz / 8) // ?
46844691   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46854692MACHINE_CONFIG_END
46864693
trunk/src/mame/drivers/eolith.c
r243192r243193
14941494
14951495   // Configure the sound ROM banking
14961496   membank("sound_bank")->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
1497
1497   
14981498   save_item(NAME(m_sound_data));
14991499}
15001500
trunk/src/mame/drivers/eolith16.c
r243192r243193
2525
2626   UINT16 *m_vram;
2727   int m_vbuffer;
28
28   
2929   DECLARE_WRITE16_MEMBER(eeprom_w);
3030   DECLARE_READ16_MEMBER(eolith16_custom_r);
3131   DECLARE_WRITE16_MEMBER(vram_w);
3232   DECLARE_READ16_MEMBER(vram_r);
33
33   
3434   DECLARE_DRIVER_INIT(eolith16);
3535   DECLARE_VIDEO_START(eolith16);
3636   DECLARE_PALETTE_INIT(eolith16);
37
37   
3838   UINT32 screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3939};
4040
trunk/src/mame/drivers/eolithsp.c
r243192r243193
8484      }
8585      n_game++;
8686   }
87
87   
8888   save_item(NAME(m_speedup_vblank));
8989   save_item(NAME(m_speedup_scanline));
9090}
trunk/src/mame/drivers/exidy.c
r243192r243193
186186
187187WRITE8_MEMBER(exidy_state::fax_bank_select_w)
188188{
189   membank("bank1")->set_entry(data & 0x1f);
189   UINT8 *RAM = memregion("maincpu")->base();
190190
191   membank("bank1")->set_base(&RAM[0x10000 + (0x2000 * (data & 0x1f))]);
191192   if ((data & 0x1f) > 0x17)
192      logerror("Banking to unpopulated ROM bank %02X!\n", data & 0x1f);
193
193      logerror("Banking to unpopulated ROM bank %02X!\n",data & 0x1f);
194194}
195195
196196
197
197198/*************************************
198199 *
199200 *  Main CPU memory handlers
r243192r243193
15361537
15371538DRIVER_INIT_MEMBER(exidy_state,fax)
15381539{
1539   //address_space &space = m_maincpu->space(AS_PROGRAM);
1540   address_space &space = m_maincpu->space(AS_PROGRAM);
15401541
15411542   exidy_video_config(0x04, 0x04, TRUE);
15421543
1543   membank("bank1")->configure_entries(0, 32, memregion("maincpu")->base() + 0x10000, 0x2000);
1544   /* reset the ROM bank */
1545   fax_bank_select_w(space,0,0);
15441546}
15451547
15461548
trunk/src/mame/drivers/exidyttl.c
r243192r243193
66 Attack (1977)
77 Death Race (1976)
88 Destruction Derby (1975)
9 Football (1978)
910 Old Time Basketball (1976)
1011 Spiders From Space (1976)
1112 Score (1977)
trunk/src/mame/drivers/funkball.c
r243192r243193
5353      Cyrix GXm233 - Main CPU; Cyrix GX Media running at 233MHz. Clock is generated by the Cyrix CX5520
5454                     and a 14.31818MHz xtal. That gives a 66.6MHz bus clock with a 3.5X multiplier for 233MHz
5555      Cyrix CX5520 - CPU-support chipset (BGA IC)
56      FLASH.U29/30 - Intel Strata-Flash DA28F320J5 SSOP56 contained on a plug-in daughterboard; main program / gfx
57      FLASH.U3     - Intel Strata-Flash DA28F320J5 SSOP56 contained on a plug-in daughterboard; sound program
56      FLASH.U29/30 - Intel Strata-Flash DA28F320J5 SSOP56 contained on a plug-in daughterboard; graphics ROMs
57      FLASH.U3     - Intel Strata-Flash DA28F320J5 SSOP56 contained on a plug-in daughterboard; main program
5858      KS0164       - Samsung Electronics KS0164 General Midi compliant 32-voice Wavetable Synthesizer chip
5959                     with built-in 16bit CPU and MPU-401 compatibility (QFP100)
6060      512K-EPR     - 512k EPROM, boot-loader program. EPROM is tied to the KS0164 and the XCS05
r243192r243193
7676#include "machine/idectrl.h"
7777#include "video/voodoo.h"
7878#include "machine/pcshare.h"
79#include "machine/bankdev.h"
80#include "machine/intelfsh.h"
8179
8280
8381class funkball_state : public pcat_base_state
r243192r243193
8684   funkball_state(const machine_config &mconfig, device_type type, const char *tag)
8785      : pcat_base_state(mconfig, type, tag),
8886         m_voodoo(*this, "voodoo_0"),
89         m_unk_ram(*this, "unk_ram"),
90         m_flashbank(*this, "flashbank")
91   { }
87         m_unk_ram(*this, "unk_ram"){ }
9288
9389   UINT8 m_funkball_config_reg_sel;
9490   UINT8 m_funkball_config_regs[256];
9591   UINT32 m_cx5510_regs[256/4];
92   UINT16 m_flash_addr;
9693   UINT8 *m_bios_ram;
94   UINT8 m_flash_cmd;
95   UINT8 m_flash_data_cmd;
9796
9897   UINT32 m_biu_ctrl_reg[256/4];
9998
100   UINT32 flashbank_addr;
101
10299   // devices
103100   required_device<voodoo_1_device> m_voodoo;
104101
105102   required_shared_ptr<UINT32> m_unk_ram;
106   required_device<address_map_bank_device> m_flashbank;
107103
108104   DECLARE_READ8_MEMBER( get_slave_ack );
109   DECLARE_WRITE32_MEMBER( flash_w );
105   DECLARE_WRITE8_MEMBER( flash_w );
106   DECLARE_READ8_MEMBER( flash_data_r );
107   DECLARE_WRITE8_MEMBER( flash_data_w );
110108//  DECLARE_WRITE8_MEMBER( bios_ram_w );
111109   DECLARE_READ8_MEMBER( test_r );
112110   DECLARE_READ8_MEMBER( serial_r );
r243192r243193
274272   }
275273}
276274
277WRITE32_MEMBER(funkball_state::flash_w)
275WRITE8_MEMBER( funkball_state::flash_w )
278276{
279   COMBINE_DATA(&flashbank_addr);
280   int tempbank = (flashbank_addr & 0x7fff) | ((flashbank_addr & 0x00800000) >> 8);
281   m_flashbank->set_bank(tempbank);
277   if(!(offset & 0x2))
278   {
279      m_flash_addr = (offset & 1) ? ((m_flash_addr & 0xff) | (data << 8)) : ((m_flash_addr & 0xff00) | (data));
280      //printf("%08x ADDR\n",m_flash_addr << 16);
281   }
282   else if(offset == 2)
283   {
284      /* 0x83: read from u29/u30
285         0x03: read from u3
286         0x81: init device
287      */
288      m_flash_cmd = data;
289      printf("%02x CMD\n",data);
290   }
291   else
292      printf("%02x %02x\n",offset,data);
293}
282294
283   // note, other bits get used, but ignoring to keep the virtual bank space size sane.
295READ8_MEMBER( funkball_state::flash_data_r )
296{
297   if(m_flash_data_cmd == 0x90)
298   {
299      if(offset == 0 && (m_flash_addr == 0))
300         return 0x89; // manufacturer code
284301
302      if(offset == 2 && (m_flash_addr == 0))
303         return (m_flash_cmd & 0x80) ? 0x15 : 0x14; // device code, 32 MBit in both cases
304
305      if(offset > 3)
306         printf("%02x FLASH DATA 0x90\n",offset);
307
308      return 0;
309   }
310
311   if(m_flash_data_cmd == 0xff)
312   {
313      UINT8 *ROM = memregion(m_flash_cmd & 0x80 ? "data_flash" : "prg_flash")->base();
314
315      return ROM[offset + (m_flash_addr << 16)];
316   }
317
318   printf("%02x %08x %02x %02x\n",offset,m_flash_addr << 16,m_flash_cmd,m_flash_data_cmd);
319
320   return 0;
285321}
286322
323WRITE8_MEMBER( funkball_state::flash_data_w )
324{
325   if(offset == 0)
326   {
327      m_flash_data_cmd = data;
328   }
329   else
330      printf("%08x %02x FLASH DATA W %08x\n",offset,data,m_flash_addr << 16);
331}
287332
288333READ32_MEMBER(funkball_state::biu_ctrl_r)
289334{
r243192r243193
333378static ADDRESS_MAP_START(funkball_map, AS_PROGRAM, 32, funkball_state)
334379   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
335380   AM_RANGE(0x000a0000, 0x000affff) AM_RAM
336   AM_RANGE(0x000b0000, 0x000bffff) AM_DEVICE("flashbank", address_map_bank_device, amap32)
381   AM_RANGE(0x000b0000, 0x000bffff) AM_READWRITE8(flash_data_r,flash_data_w,0xffffffff)
337382   AM_RANGE(0x000c0000, 0x000cffff) AM_RAM
338383   AM_RANGE(0x000d0000, 0x000dffff) AM_RAM
339384   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1")
r243192r243193
353398   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)    /* System BIOS */
354399ADDRESS_MAP_END
355400
356static ADDRESS_MAP_START( flashbank_map, AS_PROGRAM, 32, funkball_state )
357   AM_RANGE(0x00000000, 0x003fffff) AM_DEVREADWRITE16("u29", intel_28f320j5_device, read, write, 0xffffffff ) // needed to boot
358   AM_RANGE(0x00400000, 0x007fffff) AM_DEVREADWRITE16("u30", intel_28f320j5_device, read, write, 0xffffffff ) // i assume it maps directly after
359//  AM_RANGE(0x02000000, 0x023fffff) AM_DEVREADWRITE16("u3", intel_28f320j5_device, read, write, 0xffffffff ) // sound program, don't think it matters where we map it, might not even be visible in this space
360   /* it checks for 64MBit chips at 0x80000000 the way things are set up, they must return an intel Flash ID of 0x15 */
361ADDRESS_MAP_END
362
363401static ADDRESS_MAP_START(funkball_io, AS_IO, 32, funkball_state)
364402   AM_RANGE(0x0020, 0x0023) AM_READWRITE8(io20_r, io20_w, 0xffff0000)
365403   AM_IMPORT_FROM(pcat32_io_common)
r243192r243193
371409
372410   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
373411
374   AM_RANGE(0x0360, 0x0363) AM_WRITE(flash_w)
412   AM_RANGE(0x0360, 0x0363) AM_WRITE8(flash_w,0xffffffff)
375413
376414//  AM_RANGE(0x0320, 0x0323) AM_READ(test_r)
377415   AM_RANGE(0x0360, 0x036f) AM_READ8(test_r,0xffffffff) // inputs
r243192r243193
824862   MCFG_IDE_CONTROLLER_ADD("ide", ata_devices, "hdd", NULL, true)
825863   MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir6_w))
826864
827   MCFG_DEVICE_ADD("flashbank", ADDRESS_MAP_BANK, 0)
828   MCFG_DEVICE_PROGRAM_MAP(flashbank_map)
829   MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE)
830   MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32)
831   MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(64)
832   MCFG_ADDRESS_MAP_BANK_STRIDE(0x10000)
833
834865   /* video hardware */
835866   MCFG_DEVICE_ADD("voodoo_0", VOODOO_1, STD_VOODOO_1_CLOCK)
836867   MCFG_VOODOO_FBMEM(2)
r243192r243193
844875   MCFG_SCREEN_UPDATE_DRIVER(funkball_state, screen_update)
845876   MCFG_SCREEN_SIZE(1024, 1024)
846877   MCFG_SCREEN_VISIBLE_AREA(0, 511, 16, 447)
847
848   MCFG_INTEL_28F320J5_ADD("u29")
849   MCFG_INTEL_28F320J5_ADD("u30")
850   MCFG_INTEL_28F320J5_ADD("u3")
851878MACHINE_CONFIG_END
852879
853880ROM_START( funkball )
854881   ROM_REGION32_LE(0x20000, "bios", ROMREGION_ERASEFF)
855882   ROM_LOAD( "512k-epr.u62", 0x010000, 0x010000, CRC(cced894a) SHA1(298c81716e375da4b7215f3e588a45ca3ea7e35c) )
856883
857   ROM_REGION(0x400000, "u3", ROMREGION_ERASE00) // Sound Program / Samples
858   ROM_LOAD16_WORD_SWAP( "flash.u3", 0x000000, 0x400000, CRC(fb376abc) SHA1(ea4c48bb6cd2055431a33f5c426e52c7af6997eb) )
884   ROM_REGION(0x8000000, "prg_flash", ROMREGION_ERASE00)
885   ROM_LOAD16_WORD_SWAP( "flash.u3", 0x0000000, 0x400000, CRC(fb376abc) SHA1(ea4c48bb6cd2055431a33f5c426e52c7af6997eb) )
859886
860   ROM_REGION(0x400000, "u29", ROMREGION_ERASE00) // Main Program
861   ROM_LOAD16_WORD_SWAP( "flash.u29",0x000000, 0x400000, CRC(7cf6ff4b) SHA1(4ccdd4864ad92cc218998f3923997119a1a9dd1d) )
862
863   ROM_REGION(0x400000, "u30", ROMREGION_ERASE00)
864   ROM_LOAD16_WORD_SWAP( "flash.u30",0x000000, 0x400000, CRC(1d46717a) SHA1(acfbd0a2ccf4d717779733c4a9c639296c3bbe0e) )
887   ROM_REGION(0x8000000, "data_flash", ROMREGION_ERASE00)
888   ROM_LOAD( "flash.u29",0x0000000, 0x400000, CRC(7cf6ff4b) SHA1(4ccdd4864ad92cc218998f3923997119a1a9dd1d) )
889   ROM_LOAD( "flash.u30",0x0400000, 0x400000, CRC(1d46717a) SHA1(acfbd0a2ccf4d717779733c4a9c639296c3bbe0e) )
865890ROM_END
866891
867892
trunk/src/mame/drivers/fuukifg2.c
r243192r243193
381381
382382***************************************************************************/
383383
384WRITE_LINE_MEMBER(fuuki16_state::soundirq)
385{
386   m_audiocpu->set_input_line(0, state);
387}
388
384389/*
385390    - Interrupts (pbancho) -
386391
r243192r243193
470475   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.15)
471476
472477   MCFG_SOUND_ADD("ym2", YM3812, XTAL_28_64MHz / 8) /* 3.58 MHz */
473   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
478   MCFG_YM3812_IRQ_HANDLER(WRITELINE(fuuki16_state, soundirq))
474479   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
475480   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
476481
trunk/src/mame/drivers/fuukifg3.c
r243192r243193
540540}
541541
542542
543WRITE_LINE_MEMBER(fuuki32_state::irqhandler)
544{
545   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
546}
547
543548static MACHINE_CONFIG_START(fuuki32, fuuki32_state)
544549
545550   /* basic machine hardware */
r243192r243193
570575   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
571576
572577   MCFG_SOUND_ADD("ymf1", YMF278B, YMF278B_STD_CLOCK) // 33.8688MHz
573   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
578   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(fuuki32_state, irqhandler))
574579   MCFG_SOUND_ROUTE(0, "lspeaker", 0.50)
575580   MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
576581
trunk/src/mame/drivers/galaxian.c
r243192r243193
14831483   AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
14841484ADDRESS_MAP_END
14851485
1486// this is WRONG (a copy of the above) but set does appear to have a similar odd memory map with RAM aronud 0x400 and scrambled ROMs
1487static ADDRESS_MAP_START( spactrai_map, AS_PROGRAM, 8, galaxian_state )
1488   ADDRESS_MAP_UNMAP_HIGH
1489   AM_RANGE(0x0000, 0x03ff) AM_ROM
1490   AM_RANGE(0x0400, 0x0bff) AM_RAM
1491   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(galaxian_videoram_w) AM_SHARE("videoram")
1492   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x01f8) AM_WRITE(irq_enable_w)
1493   AM_RANGE(0x1002, 0x1002) AM_MIRROR(0x01f8) AM_WRITE(coin_count_0_w)
1494   AM_RANGE(0x1003, 0x1003) AM_MIRROR(0x01f8) AM_WRITE(scramble_background_enable_w)
1495   AM_RANGE(0x1004, 0x1004) AM_MIRROR(0x01f8) AM_WRITE(galaxian_stars_enable_w)
1496   AM_RANGE(0x1005, 0x1005) AM_MIRROR(0x01f8) //POUT2
1497   AM_RANGE(0x1006, 0x1006) AM_MIRROR(0x01f8) AM_WRITE(galaxian_flip_screen_x_w)
1498   AM_RANGE(0x1007, 0x1007) AM_MIRROR(0x01f8) AM_WRITE(galaxian_flip_screen_y_w)
1499   AM_RANGE(0x1200, 0x12ff) AM_MIRROR(0x0100) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
1500   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ(watchdog_reset_r)
1501   AM_RANGE(0x4000, 0xbfff) AM_ROM
1502//  AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
1503//  AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
1504ADDRESS_MAP_END
15051486
15061487static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state )
15071488   ADDRESS_MAP_UNMAP_HIGH
r243192r243193
51305111   MCFG_FRAGMENT_ADD(galaxian_audio)
51315112MACHINE_CONFIG_END
51325113
5133static MACHINE_CONFIG_DERIVED( spactrai, galaxian )
51345114
5135   /* strange memory map, maybe a kind of protection */
5136   MCFG_CPU_MODIFY("maincpu")
5137   MCFG_CPU_PROGRAM_MAP(spactrai_map)
5138MACHINE_CONFIG_END
5139
5140
51415115static MACHINE_CONFIG_DERIVED( pacmanbl, galaxian )
51425116
51435117   /* separate tile/sprite ROMs */
r243192r243193
72827256   ROM_LOAD( "warofbug.clr", 0x0000, 0x0020, CRC(8688e64b) SHA1(ed13414257f580b98b50c9892a14159c55e7838d) )
72837257ROM_END
72847258
7285// has a large custom block on the ROM board
7286ROM_START( spactrai )
7287   ROM_REGION( 0x10000, "maincpu", 0 )
7288   ROM_LOAD( "1cen.bin",   0x0000, 0x1000, CRC(fabc7fd8) SHA1(88c42dda38cc79ab4f180c4818cfb928c1cc0661) )
7289   ROM_LOAD( "2cen.bin",   0x1000, 0x1000, CRC(44ddacfa) SHA1(50a9f5f3e4ec12fd3742dcf7cf141e52300a10db) )
7290   ROM_LOAD( "3cen.bin",   0x2000, 0x1000, CRC(822749cb) SHA1(92e617088d462911118842f3f68b7ff8ac77fcf5) )
7291   ROM_LOAD( "4cen.bin",   0x3000, 0x1000, CRC(f9dda0ed) SHA1(a77f6d8ec7b3df7f308354489954c3d9b4f61b0d) )
7292   ROM_LOAD( "5cen.bin",   0x4000, 0x1000, CRC(b8c76675) SHA1(acdda20adf62d1e2eadcc097ecde6a3126231415) )
72937259
7294   ROM_REGION( 0x1000, "gfx1", 0 )
7295   ROM_LOAD( "6cen.bin",  0x0000, 0x0800, CRC(a59a9f3f) SHA1(9564f1d013d566dc0b19762aec66119e2ece0b49) ) // MK2716J
7296   ROM_LOAD( "7cen.bin",  0x0800, 0x0400, CRC(16cf5a5b) SHA1(0369786902544d31e506fe1ba6a69aa6e8ba9b5c) ) // MM2758A
7297
7298   ROM_REGION( 0x0020, "proms", 0 )
7299   ROM_LOAD( "stk.bin", 0x0000, 0x0020, CRC(6a0c7d87) SHA1(140335d85c67c75b65689d4e76d29863c209cf32) )
7300ROM_END
7301
7302
73037260/*  Galaxian hardware mods for War of the Bugs warofbug/warofbugg
73047261
73057262(WotB using daughterboard that plugs into Z80 socket - has a socketed PAL, two other 20-pin ICs,
r243192r243193
1073910696GAME( 1981, warofbug,    0,        galaxian,   warofbug,   galaxian_state, nolock,     ROT90,  "Armenia / Food and Fun Corp", "War of the Bugs or Monsterous Manouvers in a Mushroom Maze", GAME_SUPPORTS_SAVE )
1074010697GAME( 1981, warofbugu,   warofbug, galaxian,   warofbug,   galaxian_state, nolock,     ROT90,  "Armenia / Super Video Games", "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (US)", GAME_SUPPORTS_SAVE )
1074110698GAME( 1981, warofbugg,   warofbug, galaxian,   warofbug,   galaxian_state, nolock,     ROT90,  "Armenia", "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (German)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
10742GAME( 1981, spactrai,    warofbug, spactrai,   warofbug,   galaxian_state, nolock,     ROT90,  "Armenia / Adar", "Space Train", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
1074310699GAME( 1981, redufo,      0,        galaxian,   redufo,     galaxian_state, nolock,     ROT270, "Artic", "Defend the Terra Attack on the Red UFO", GAME_SUPPORTS_SAVE ) // is this the original?
1074410700GAME( 1981, redufob,     redufo,   galaxian,   redufob,    galaxian_state, nolock,     ROT90,  "bootleg", "Defend the Terra Attack on the Red UFO (bootleg)", GAME_SUPPORTS_SAVE ) // rev A?
1074510701GAME( 19??, exodus,      redufo,   galaxian,   redufo,     galaxian_state, nolock,     ROT90,  "bootleg? (Subelectro)", "Exodus (bootleg?)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/galspnbl.c
r243192r243193
204204GFXDECODE_END
205205
206206
207
208WRITE_LINE_MEMBER(galspnbl_state::irqhandler)
209{
210   m_audiocpu->set_input_line(0, state);
211}
212
213
207214void galspnbl_state::machine_start()
208215{
209216}
r243192r243193
245252   MCFG_SPEAKER_STANDARD_MONO("mono")
246253
247254   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* Use value from Super Pinball Action - NEEDS VERIFICATION!! */
248   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
255   MCFG_YM3812_IRQ_HANDLER(WRITELINE(galspnbl_state, irqhandler))
249256   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
250257
251258   MCFG_OKIM6295_ADD("oki", XTAL_4MHz/4, OKIM6295_PIN7_HIGH) /* Use value from Super Pinball Action - clock frequency & pin 7 not verified */
trunk/src/mame/drivers/gticlub.c
r243192r243193
281281   optional_device<k001006_device> m_k001006_2;
282282   optional_device<k001604_device> m_k001604_1;
283283   optional_device<k001604_device> m_k001604_2;
284
284   
285285   required_shared_ptr<UINT32> m_work_ram;
286286   required_shared_ptr<UINT32> m_generic_paletteram_32;
287
287   
288288   optional_ioport m_analog0, m_analog1, m_analog2, m_analog3;
289
289   
290290   required_ioport_array<4> m_ports;
291
291   
292292   DECLARE_IOPORT_ARRAY(ports);
293293
294294   DECLARE_WRITE32_MEMBER(paletteram32_w);
trunk/src/mame/drivers/gts80a.c
r243192r243193
427427ADDRESS_MAP_END
428428
429429static ADDRESS_MAP_START( video_io_map, AS_IO, 8, caveman_state )
430//  AM_RANGE(0x000, 0x002) AM_READWRITE() // 8259 irq controller
431//  AM_RANGE(0x100, 0x102) AM_READWRITE() // HD46505
432//  AM_RANGE(0x200, 0x200) AM_READWRITE() // 8212 in, ?? out
433//  AM_RANGE(0x300, 0x300) AM_READWRITE() // soundlatch (command?) in, ?? out
430//   AM_RANGE(0x000, 0x002) AM_READWRITE() // 8259 irq controller
431//   AM_RANGE(0x100, 0x102) AM_READWRITE() // HD46505
432//   AM_RANGE(0x200, 0x200) AM_READWRITE() // 8212 in, ?? out
433//   AM_RANGE(0x300, 0x300) AM_READWRITE() // soundlatch (command?) in, ?? out
434434
435//  AM_RANGE(0x400, 0x400) AM_READ() // joystick inputs
436//  AM_RANGE(0x500, 0x506) AM_WRITE() // palette
435//   AM_RANGE(0x400, 0x400) AM_READ() // joystick inputs
436//   AM_RANGE(0x500, 0x506) AM_WRITE() // palette
437437
438438ADDRESS_MAP_END
439439
trunk/src/mame/drivers/gumbo.c
r243192r243193
229229
230230static MACHINE_CONFIG_START( gumbo, gumbo_state )
231231
232   MCFG_CPU_ADD("maincpu", M68000, XTAL_14_31818MHz/2)
232   MCFG_CPU_ADD("maincpu", M68000, 14318180 /2)     // or 10mhz? ?
233233   MCFG_CPU_PROGRAM_MAP(gumbo_map)
234234   MCFG_CPU_VBLANK_INT_DRIVER("screen", gumbo_state,  irq1_line_hold) // all the same
235235
r243192r243193
248248
249249   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
250250
251   MCFG_OKIM6295_ADD("oki", XTAL_14_31818MHz/16, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
251   MCFG_OKIM6295_ADD("oki", 1122000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
252252   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47)
253253   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47)
254254MACHINE_CONFIG_END
trunk/src/mame/drivers/hcastle.c
r243192r243193
152152
153153/*****************************************************************************/
154154
155WRITE_LINE_MEMBER(hcastle_state::irqhandler)
156{
157//  m_audiocpu->set_input_line(state);
158}
159
155160WRITE8_MEMBER(hcastle_state::volume_callback)
156161{
157162   m_k007232->set_volume(0, (data >> 4) * 0x11, 0);
r243192r243193
224229   MCFG_SOUND_ROUTE(1, "mono", 0.50)
225230
226231   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
227   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) /* from schematic; NMI handler is just a retn */
232   MCFG_YM3812_IRQ_HANDLER(WRITELINE(hcastle_state, irqhandler))
228233   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
229234
230235   MCFG_K051649_ADD("k051649", 3579545/2)
trunk/src/mame/drivers/hikaru.c
r243192r243193
570570   /* ic65 unpopulated */
571571   /* ic66 unpopulated */
572572
573   // 834-14149   2000     317-0294-COM   Hikaru
574   ROM_PARAMETER( ":rom_board:segam2crypt:key", "091b02c7" )
573   // 315-5881 security IC key
574   ROM_REGION( 4, "rom_key", 0 )
575   ROM_LOAD( "airtrix-key.bin", 0, 4, CRC(bebdc179) SHA1(327ea299934ef78f3c88329fc624dc3771877453) )
575576ROM_END
576577
577578
r243192r243193
608609   ROM_LOAD32_WORD( "mpr-23560.ic65", 0xe000000, 0x1000000, CRC(24bb7072) SHA1(dad5135c89d292e4a1f96bd0ad28be6a17154be0) )
609610   ROM_LOAD32_WORD( "mpr-23564.ic66", 0xe000002, 0x1000000, CRC(255724b6) SHA1(1b382fad165831de3f2e39352c031146759dfc69) )
610611
611   // 834-14144   2001     317-0297-COM   Hikaru
612   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0912c68a" )
612   // 315-5881 security IC key
613   ROM_REGION( 4, "rom_key", 0 )
614   ROM_LOAD( "pharrier-key.bin", 0, 4, CRC(1697d591) SHA1(8ad4c93f63e2e379795e820d3edbdd990f8ca7e1) )
613615ROM_END
614616
615617ROM_START( podrace )
r243192r243193
662664   ROM_LOAD32_WORD("mpr-23117.ic68s" , 0xf000002, 0x0800000, CRC(9d4d3529) SHA1(66008445629681ebf2f26b3f181d8524a8576d2f))
663665
664666   // current 315-5881 decryption simulation code can't produce valid output data with any of keys
665   // 834-14002   2001     317-0277-COM   Hikaru
666   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0903dad5" )
667   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
667668ROM_END
668669
669670ROM_START( braveff )
r243192r243193
707708   ROM_LOAD32_WORD( "mpr-22022.ic59s", 0xb000000, 0x800000, CRC(abd3d888) SHA1(9654c3a38feab46b4983a602831fb29cccdd0526) )
708709   ROM_LOAD32_WORD( "mpr-22023.ic60s", 0xb000002, 0x800000, CRC(07f00869) SHA1(92282d09d72d3e65a91128e06bb0d4426bb90be5) )
709710
710   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0" ) // 315-5881 not populated
711   // 315-5881 not populated
712   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
711713ROM_END
712714
713715ROM_START( sgnascar )
r243192r243193
736738   ROM_LOAD32_WORD( "mpr-23483.ic32", 0xc000002, 0x1000000, CRC(c37adebe) SHA1(e84f6d2cc364c743f7f3b73d8c8d0271952bb093) )
737739   ROM_LOAD32_WORD( "mpr-23480.ic33", 0xe000000, 0x1000000, CRC(f517b8b3) SHA1(c04740adb612473c4c9f8186e7e93d2f73d1bb1a) )
738740   ROM_LOAD32_WORD( "mpr-23484.ic34", 0xe000002, 0x1000000, CRC(2ebe1aa1) SHA1(16b39f7422da1a334dde27169c2949e1d95bddb3) )
739
740   // 317-0283-COM Actel A54SX32
741   // ID 0x4252
742   ROM_PARAMETER( ":rom_board:key", "56dedf33" )
743741ROM_END
744742
745743GAME( 2000, hikaru,   0,        hikaru,   hikaru, driver_device,   0, ROT0, "Sega",            "Hikaru Bios", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
trunk/src/mame/drivers/itech32.c
r243192r243193
7676    Starting with GT Fore!, I.T. moved to a redesigned hardware platform known as the Eagle platform.
7777        It has a main board with a 3Dfx video card and is hard drive based. This series started with
7878        GT Fore! in 2000 and continued through 2006 ending with Golden Tee Complete. This final
79        version included all the courses from all the previous years in the Fore! series.
79        version incuded all the courses from all the previous years in the Fore! series.
8080        The Eagle platform also supports I.T.'s hunting series "Big Buck Hunter", the light game gun
8181        called Carnival King as well as the limited release game Virtual Pool.
8282
r243192r243193
16151615
16161616   PORT_MODIFY("DIPS")
16171617   PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4")   /* Determined by actual use / trial & error */
1618   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" and "Off -- UNUSED --" */
1618   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */
16191619   PORT_DIPSETTING(          0x00100000, "45 Degree Angle" )
16201620   PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")    /* Single controller version -  has no effect */
16211621   PORT_DIPSETTING(          0x00000000, DEF_STR( Off ) )
r243192r243193
16311631
16321632   PORT_MODIFY("DIPS")
16331633   PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4")   /* Determined by actual use / trial & error */
1634   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" and "Off -- UNUSED --" */
1634   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */
16351635   PORT_DIPSETTING(          0x00100000, "45 Degree Angle" )
16361636   PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:3")
16371637   PORT_DIPSETTING(          0x00000000, DEF_STR( Upright ) )
r243192r243193
24502450   ROM_CONTINUE(                 0x08000, 0x08000 )
24512451
24522452   ROM_REGION( 0x880000, "gfx1", 0 )
2453   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2453   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
24542454   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
24552455   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
24562456   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
24852485   ROM_CONTINUE(                 0x08000, 0x08000 )
24862486
24872487   ROM_REGION( 0x880000, "gfx1", 0 )
2488   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2488   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
24892489   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
24902490   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
24912491   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
25202520   ROM_CONTINUE(                 0x08000, 0x08000 )
25212521
25222522   ROM_REGION( 0x880000, "gfx1", 0 )
2523   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2523   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25242524   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25252525   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25262526   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
25552555   ROM_CONTINUE(                 0x08000, 0x08000 )
25562556
25572557   ROM_REGION( 0x880000, "gfx1", 0 )
2558   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2558   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25592559   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25602560   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25612561   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
25902590   ROM_CONTINUE(                 0x08000, 0x08000 )
25912591
25922592   ROM_REGION( 0x880000, "gfx1", 0 )
2593   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2593   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25942594   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25952595   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25962596   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
26252625   ROM_CONTINUE(                 0x08000, 0x08000 )
26262626
26272627   ROM_REGION( 0x880000, "gfx1", 0 )
2628   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2628   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
26292629   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
26302630   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
26312631   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r243192r243193
33543354   ROM_LOAD32_BYTE( "gtg3_grom0_3++.grm0_3", 0x000003, 0x100000, CRC(1173a710) SHA1(1f612c1efbf38796707f5b5fecf9d4044691f031) )
33553355   /*
33563356   The above 4 roms have the same exact data as the other sets, but in 8 meg roms instead of 4 meg roms.
3357   This is the only set that specifically checks for these roms in this format
3357   This is the only set that specificaly checks for these roms in this format
33583358   */
33593359   ROM_LOAD32_BYTE( "gtg3_grom1_0+.grm1_0", 0x400000, 0x080000, CRC(80ae7148) SHA1(e19d3390a2a0dad260d770fdbbb64d1f8e43d53f) ) /* actually labeled "GTG3 GROM1_0*" ect */
33603360   ROM_LOAD32_BYTE( "gtg3_grom1_1+.grm1_1", 0x400001, 0x080000, CRC(0f85a618) SHA1(d9ced21c20f9ed6b7f19e7645d75b239ea709b79) )
r243192r243193
40364036   ROM_LOAD32_BYTE( "gt2k_grom1_3.grm1_3", 0x200003, 0x80000, CRC(59f48688) SHA1(37b2c84e487f4f3a9145bef34c573a3716b4a6a7) )
40374037
40384038   /* GT99, GT2K & GT Classic all share the above listed 8 graphics roms and may be labeled GT99, GT2K or GTClassic */
4039   /* The Euro version has different GROM2_x compared to the standard US versions.  GT Supreme PCBs have been seen  */
4039   /* The Euro version has different GROM2_x compared to the standard US versions.  GT Superme PCBs have been seen  */
40404040   /* with GT 2K mask roms as well as all GROMs labeled "GT SUPREME" */
40414041
40424042   ROM_LOAD32_BYTE( "gt_supreme_grom2_0.grm2_0", 0x400000, 0x80000, CRC(33998a3e) SHA1(53832e37c42155eb9c774eb33b8b36fe387fa162) )
r243192r243193
45054505    NOTE: Due to various different upgrade packages from IT, the 3 tier boards can end up with any combination
45064506        of rom boards and sound boards.  For historical reasons, GTG3 3 tier S versions will use the oldest
45074507        sound file set up. Version L will use the newer Ensoniq sample rom and v2.X sound code, while gt97
4508        through gtclassic will use the latest "NR" versions.
4508        through gtclassic will use the lastest "NR" versions.
45094509
45104510  GT Diamond Edition Tournament is a Euro GT98 with different GROM2_0 through GROM2_3
45114511  GT Royal Edition Tournament is a Euro GT99
45124512  GT Supreme Edition Tournament is a Euro GT2K with different GROM2_0 through GROM2_3
45134513     GT Supreme (on a real PCB with actual tournament data) comes up with a different title screen and is (c) 2002
4514     showing the title as GT Supreme Plus! and the Hole-In-One board shows an additional course, Coconut Cove from GT99
4514     showing the title as GT Supreme Plus! and the Hole-In-One board shows an aditional course, Coconut Cove from GT99
45154515     Current emulation does not reproduce this extra title screen due to missing tournament data.
45164516  There doesn't seem to be a Euro version of GT Classic (at least none have been found).
45174517
45184518NOTE: There is an "8 Meg board" version of the P/N 1083 Rev 2 PCB, so GROM0_0 through GROM0_3 are 8 meg roms and labeled "GTxx GROM0_0 **" ect
45194519      while GROM1_0 through GROM1_3 are 4 meg roms matching "4 Meg board" GROM2_0 through GROM2_3 and are labeled "GTxx GROM1_0 *" ect
4520      It is possible to find these rom combinations on any given GT board set.  There is only 1 known GT set which specifically checks for 8 meg
4520      It is possible to find these rom combinations on any given GT board set.  There is only 1 known GT set which specificly checks for 8 meg
45214521      roms under the GROM Checksum test.
45224522
45234523    Parent set will always be gt(year) with the most recent version.  IE: gt97 is Golden Tee '97 v1.30
trunk/src/mame/drivers/itech8.c
r243192r243193
583583}
584584
585585
586WRITE_LINE_MEMBER(itech8_state::generate_sound_irq)
587{
588   m_soundcpu->set_input_line(M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
589}
586590
591
592
587593/*************************************
588594 *
589595 *  Machine initialization
r243192r243193
16491655
16501656   /* sound hardware */
16511657   MCFG_SOUND_ADD("ymsnd", YM2203, CLOCK_8MHz/2)
1652   MCFG_YM2203_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
1658   MCFG_YM2203_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
16531659   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(itech8_state, ym2203_portb_out))
16541660   MCFG_SOUND_ROUTE(0, "mono", 0.07)
16551661   MCFG_SOUND_ROUTE(1, "mono", 0.07)
r243192r243193
16691675
16701676   /* sound hardware */
16711677   MCFG_SOUND_ADD("ymsnd", YM2608, CLOCK_8MHz)
1672   MCFG_YM2608_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
1678   MCFG_YM2608_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
16731679   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(itech8_state, ym2203_portb_out))
16741680   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
16751681MACHINE_CONFIG_END
r243192r243193
16881694
16891695   /* sound hardware */
16901696   MCFG_SOUND_ADD("ymsnd", YM3812, CLOCK_8MHz/2)
1691   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
1697   MCFG_YM3812_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
16921698   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
16931699
16941700   MCFG_OKIM6295_ADD("oki", CLOCK_8MHz/8, OKIM6295_PIN7_HIGH) // was /128, not /132, so unsure so pin 7 not verified
r243192r243193
17041710
17051711   /* sound hardware */
17061712   MCFG_SOUND_ADD("ymsnd", YM3812, CLOCK_8MHz/2)
1707   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
1713   MCFG_YM3812_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
17081714   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
17091715
17101716   MCFG_OKIM6295_ADD("oki", CLOCK_8MHz/8, OKIM6295_PIN7_HIGH) // was /128, not /132, so unsure so pin 7 not verified
trunk/src/mame/drivers/lordgun.c
r243192r243193
622622
623623***************************************************************************/
624624
625WRITE_LINE_MEMBER(lordgun_state::soundirq)
626{
627   m_soundcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE);
628}
629
625630static MACHINE_CONFIG_START( lordgun, lordgun_state )
626631   MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
627632   MCFG_CPU_PROGRAM_MAP(lordgun_map)
r243192r243193
663668   MCFG_SPEAKER_STANDARD_MONO("mono")
664669
665670   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_3_579545MHz)
666   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
671   MCFG_YM3812_IRQ_HANDLER(WRITELINE(lordgun_state, soundirq))
667672   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
668673
669674   MCFG_OKIM6295_ADD("oki", XTAL_20MHz / 20, OKIM6295_PIN7_HIGH)   // ? 5MHz can't be right!
r243192r243193
713718
714719   MCFG_SOUND_ADD("ymf", YMF278B, 26000000)            // ? 26MHz matches video (decrease for faster music tempo)
715720   MCFG_DEVICE_ADDRESS_MAP(AS_0, ymf278_map)
716   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
721   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(lordgun_state, soundirq))
717722   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
718723
719724   MCFG_OKIM6295_ADD("oki", XTAL_20MHz / 20, OKIM6295_PIN7_HIGH)   // ? 5MHz can't be right
trunk/src/mame/drivers/m58.c
r243192r243193
2626
2727static ADDRESS_MAP_START( yard_map, AS_PROGRAM, 8, m58_state )
2828   AM_RANGE(0x0000, 0x5fff) AM_ROM
29   AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
30   AM_RANGE(0x9000, 0x9fff) AM_WRITE(scroll_panel_w)
29   AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(yard_videoram_w) AM_SHARE("videoram")
30   AM_RANGE(0x9000, 0x9fff) AM_WRITE(yard_scroll_panel_w)
3131   AM_RANGE(0xc820, 0xc87f) AM_RAM AM_SHARE("spriteram")
3232   AM_RANGE(0xa000, 0xa000) AM_RAM AM_SHARE("scroll_x_low")
3333   AM_RANGE(0xa200, 0xa200) AM_RAM AM_SHARE("scroll_x_high")
3434   AM_RANGE(0xa400, 0xa400) AM_RAM AM_SHARE("scroll_y_low")
3535   AM_RANGE(0xa800, 0xa800) AM_RAM AM_SHARE("score_disable")
3636   AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("irem_audio", irem_audio_device, cmd_w)
37   AM_RANGE(0xd001, 0xd001) AM_WRITE(flipscreen_w)    /* + coin counters */
37   AM_RANGE(0xd001, 0xd001) AM_WRITE(yard_flipscreen_w)    /* + coin counters */
3838   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0")
3939   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1")
4040   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2")
r243192r243193
203203
204204   MCFG_SCREEN_ADD("screen", RASTER)
205205   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 256, 282, 42, 266)
206   MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update)
206   MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update_yard)
207207   MCFG_SCREEN_PALETTE("palette")
208208
209209   /* sound hardware */
trunk/src/mame/drivers/mappy.c
r243192r243193
24622462
24632463/* 3x6809, static tilemap, 2bpp sprites (Gaplus type) */
24642464GAME( 1983, phozon,   0,        phozon,   phozon, mappy_state,   phozon,        ROT90, "Namco", "Phozon (Japan)", GAME_SUPPORTS_SAVE )
2465GAME( 1983, phozons,  phozon,   phozon,   phozon, mappy_state,   phozon,        ROT90, "Namco (Sidam license)", "Phozon (Sidam)", GAME_SUPPORTS_SAVE )
2465GAME( 1983, phozons,  phozon,   phozon,   phozon, mappy_state,   phozon,        ROT90, "bootleg? (Sidam)", "Phozon (Sidam)", GAME_SUPPORTS_SAVE )
24662466
24672467/* 2x6809, scroling tilemap, 4bpp sprites (Super Pacman type) */
24682468GAME( 1983, mappy,    0,        mappy,    mappy, mappy_state,   mappy,        ROT90, "Namco", "Mappy (US)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/metro.c
r243192r243193
255255   update_irq_state();
256256}
257257
258WRITE_LINE_MEMBER(metro_state::ymf278b_interrupt)
259{
260   m_maincpu->set_input_line(2, state ? ASSERT_LINE : CLEAR_LINE);
261}
262
263
258264/***************************************************************************
259265
260266
r243192r243193
16021608   membank("bank1")->set_base(&RAM[bankaddress]);
16031609}
16041610
1611WRITE_LINE_MEMBER(metro_state::blzntrnd_irqhandler)
1612{
1613   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1614}
1615
16051616static ADDRESS_MAP_START( blzntrnd_sound_map, AS_PROGRAM, 8, metro_state )
16061617   AM_RANGE(0x0000, 0x7fff) AM_ROM
16071618   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
r243192r243193
36493660
36503661   MCFG_SOUND_ADD("ymf", YMF278B, YMF278B_STD_CLOCK)
36513662   MCFG_DEVICE_ADDRESS_MAP(AS_0, ymf278_map)
3652   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 2))
3663   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(metro_state, ymf278b_interrupt))
36533664   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
36543665   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
36553666MACHINE_CONFIG_END
r243192r243193
43734384   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
43744385
43754386   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_16MHz/2)
4376   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
4387   MCFG_YM2610_IRQ_HANDLER(WRITELINE(metro_state, blzntrnd_irqhandler))
43774388   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
43784389   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
43794390   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
trunk/src/mame/drivers/midtunit.c
r243192r243193
4343   AM_RANGE(0x01000000, 0x013fffff) AM_RAM
4444   AM_RANGE(0x01400000, 0x0141ffff) AM_READWRITE(midtunit_cmos_r, midtunit_cmos_w) AM_SHARE("nvram")
4545   AM_RANGE(0x01480000, 0x014fffff) AM_WRITE(midtunit_cmos_enable_w)
46   AM_RANGE(0x01600000, 0x0160000f) AM_READ_PORT("IN0")
47   AM_RANGE(0x01600010, 0x0160001f) AM_READ_PORT("IN1")
48   AM_RANGE(0x01600020, 0x0160002f) AM_READ_PORT("IN2")
49   AM_RANGE(0x01600030, 0x0160003f) AM_READ_PORT("DSW")
46   AM_RANGE(0x01600000, 0x0160003f) AM_READ(midtunit_input_r)
5047   AM_RANGE(0x01800000, 0x0187ffff) AM_RAM_WRITE(midtunit_paletteram_w) AM_SHARE("paletteram")
5148   AM_RANGE(0x01a80000, 0x01a800ff) AM_READWRITE(midtunit_dma_r, midtunit_dma_w)
5249   AM_RANGE(0x01b00000, 0x01b0001f) AM_WRITE(midtunit_control_w)
trunk/src/mame/drivers/model2.c
r243192r243193
124124#include "sound/2612intf.h"
125125#include "includes/model2.h"
126126
127
127128enum {
128129   DSP_TYPE_TGP    = 1,
129130   DSP_TYPE_SHARC  = 2,
r243192r243193
12221223
12231224/* Protection handling */
12241225
1226static const UINT8 ZGUNProt[] =
1227{
1228   0x7F,0x4E,0x1B,0x1E,0xA8,0x48,0xF5,0x49,0x31,0x32,0x4A,0x09,0x89,0x29,0xC0,0x41,
1229   0x3A,0x49,0x85,0x24,0xA0,0x4D,0x21,0x31,0xEA,0xC3,0x3F,0xAF,0x0E,0x4B,0x25,0x02,
1230   0xFB,0x0F,0x44,0x55,0x2E,0x82,0x55,0xC3,0xCB,0x91,0x52,0x7E,0x72,0x53,0xF2,0xAA,
1231   0x39,0x19,0xB1,0x42,0x33,0x63,0x13,0xFA,0x39,0x9C,0xE0,0x53,0x93,0x8B,0x14,0x91,
1232   0x9D,0x1C,0xFE,0x52,0x59,0xD4,0x2A,0x6A,0xA3,0xC5,0xA0,0xCA,0x92,0x5A,0x58,0xAC,
1233   0x95,0x4A,0x19,0x89,0x65,0xD3,0xA8,0x4A,0xE3,0xCE,0x8D,0x89,0xC5,0x48,0x95,0xE4,
1234   0x94,0xD5,0x73,0x09,0xE4,0x3D,0x2D,0x92,0xC9,0xA7,0xA3,0x53,0x42,0x82,0x55,0x67,
1235   0xE4,0x66,0xD0,0x4A,0x7D,0x4A,0x13,0xDE,0xD7,0x9F,0x38,0xAA,0x00,0x56,0x85,0x0A
1236};
12251237
1226READ32_MEMBER(model2_state::model2_5881prot_r)
1238static const UINT8 DCOPKey1326[]=
12271239{
1240   0x43,0x66,0x54,0x11,0x99,0xfe,0xcc,0x8e,0xdd,0x87,0x11,0x89,0x22,0xdf,0x44,0x09
1241};
1242
1243READ32_MEMBER(model2_state::model2_prot_r)
1244{
12281245   UINT32 retval = 0;
12291246
1230   if (offset == 0x0000/4)
1247   if (offset == 0x10000/4)
12311248   {
12321249      // status: bit 0 = 1 for busy, 0 for ready
1233      retval = 0;   // we're always ready
1250      return 0;   // we're always ready
12341251   }
1235   else if (offset == 0x000e/4)
1252   else if (offset == 0x1000e/4)
12361253   {
1237      if (first_read == 1)
1238      {
1239         // the RAM based schemes expect a dummy value before the start of the stream
1240         // to match the previous simulation (dynamite cop) I use 0x0000 here
1241         first_read = 0;
1242         retval = 0;
1243      }
1254      retval = m_protram[m_protstate+1] | m_protram[m_protstate]<<8;
1255      retval <<= 16;
1256      m_protstate+=2;
1257   }
1258   else if (offset == 0x7ff8/4)
1259   {
1260      retval = m_protram[m_protstate+1] | m_protram[m_protstate]<<8;
1261      m_protstate+=2;
1262   }
1263   else if (offset == 0x400c/4)
1264   {
1265      m_prot_a = !m_prot_a;
1266      if (m_prot_a)
1267         return 0xffff;
12441268      else
1245      {
1246         UINT8* base;
1247         retval = m_cryptdevice->do_decrypt(base);
1248         retval = ((retval & 0xff00) >> 8) | ((retval & 0x00ff) << 8);
1249         retval <<= 16;
1250      }
1269         return 0xfff0;
12511270   }
12521271   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
12531272
1254   logerror("model2_5881prot_r %08x: %08x (%08x)\n", offset*4, retval, mem_mask);
1255
12561273   return retval;
12571274}
12581275
1259WRITE32_MEMBER(model2_state::model2_5881prot_w)
1276WRITE32_MEMBER(model2_state::model2_prot_w)
12601277{
1261   logerror("model2_5881prot_w %08x: %08x (%08x)\n", offset*4, data, mem_mask);
1278   if (mem_mask == 0xffff0000)
1279   {
1280      data >>= 16;
1281   }
12621282
1263
1264   if (offset == 0x0008/4)
1283   if (offset == 0x10008/4)
12651284   {
1266      // Zero Gunner uses this, it's encrypted data in prot.RAM consists of several small chunks, selected using low address
1267      // so far this is only known game with 315-5881 which uses not 0 offset in prot.RAM
1268      if (mem_mask == 0x0000ffff)
1269         m_cryptdevice->set_addr_low(data&0xffff);
1270      else if (mem_mask == 0xffff0000)
1285      m_protpos = data;
1286   }
1287   else if (offset == 0x1000c/4)
1288   {
1289      switch (data)
12711290      {
1272         m_cryptdevice->set_addr_high(0);
1273         if (data != 0)
1274            printf("model2_5881prot_w not zero high address %08x (%08x)\n", data, mem_mask);
1291         // dynamcop
1292         case 0x7700:
1293            strcpy((char *)m_protram+2, "UCHIDA MOMOKA   ");
1294            break;
1295
1296         // dynamcop
1297         case 0x1326:
1298            m_protstate = 0;
1299            memcpy(m_protram+2, DCOPKey1326, sizeof(DCOPKey1326));
1300            break;
1301
1302         // zerogun
1303         case 0xA1BC:
1304         case 0xAD23:
1305         case 0x13CD:
1306         case 0x4D53:
1307         case 0x234D:
1308         case 0x113D:
1309         case 0x1049:
1310         case 0x993D:
1311         case 0x983C:
1312         case 0x935:
1313         case 0x9845:
1314         case 0x556D:
1315         case 0x98CC:
1316         case 0x3422:
1317         case 0x10:
1318            m_protstate = 0;
1319            memcpy(m_protram+2, ZGUNProt+((2*m_protpos)/12)*8, sizeof(ZGUNProt));
1320            break;
1321
1322         // pltkids
1323         case 0x7140:
1324            m_protstate = 0;
1325            strcpy((char *)m_protram+2, "98-PILOT  ");
1326            break;
1327
1328         default:
1329            m_protstate = 0;
1330            break;
12751331      }
1276      first_read = 1;
12771332   }
1278   else if (offset == 0x000c/4)
1333   else if (offset == 0x7ff2/4)
12791334   {
1280      printf("subkey %08x (%08x)\n", data, mem_mask);
1281      m_cryptdevice->set_subkey(data&0xffff);
1335      if (data == 0)
1336      {
1337         m_protstate = 0;
1338         strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00");
1339      }
12821340   }
1283   else printf("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
1341   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
12841342
12851343}
12861344
1287
1288
12891345/* Daytona "To The MAXX" PIC protection simulation */
12901346
12911347
r243192r243193
24782534   MCFG_SEGAM1AUDIO_ADD("m1audio")
24792535MACHINE_CONFIG_END
24802536
2481UINT16 model2_state::crypt_read_callback(UINT32 addr)
2482{
2483   UINT16 dat= m_maincpu->space().read_word((0x1d80000+2*addr));
2484   return ((dat&0xff00)>>8)|((dat&0x00ff)<<8);
2485}
2486
2487static MACHINE_CONFIG_DERIVED( model2a_5881, model2a )
2488   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
2489   MCFG_SET_READ_CALLBACK(model2_state, crypt_read_callback)
2490MACHINE_CONFIG_END
2491
2492static MACHINE_CONFIG_DERIVED( model2a_0229, model2a )
2493   MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0)
2494//  MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
2495MACHINE_CONFIG_END
2496
24972537READ8_MEMBER(model2_state::driveio_port_r)
24982538{
24992539   return m_driveio_comm_data;
r243192r243193
25912631   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
25922632MACHINE_CONFIG_END
25932633
2594
2595static MACHINE_CONFIG_DERIVED( model2b_5881, model2b )
2596   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
2597   MCFG_SET_READ_CALLBACK(model2_state, crypt_read_callback)
2598MACHINE_CONFIG_END
2599
2600static MACHINE_CONFIG_DERIVED( model2b_0229, model2b )
2601   MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0)
2602//  MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
2603MACHINE_CONFIG_END
2604
2605
26062634static ADDRESS_MAP_START( copro_tgpx4_map, AS_PROGRAM, 32, model2_state )
26072635   AM_RANGE(0x00000000, 0x00007fff) AM_RAM AM_SHARE("tgpx4_program")
26082636ADDRESS_MAP_END
r243192r243193
26622690   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
26632691MACHINE_CONFIG_END
26642692
2665static MACHINE_CONFIG_DERIVED( model2c_5881, model2c )
2666   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
2667   MCFG_SET_READ_CALLBACK(model2_state, crypt_read_callback)
2668MACHINE_CONFIG_END
2669
2670
26712693/* ROM definitions */
26722694
26732695/*
r243192r243193
27312753   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
27322754   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
27332755
2734   //             1997     317-5038-COM   Model 2
2735   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
2736
27372756   MODEL2_CPU_BOARD
27382757   MODEL2A_VID_BOARD
27392758ROM_END
r243192r243193
27662785   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
27672786   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
27682787
2769   //             1997     317-5038-COM   Model 2
2770   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
2771
27722788   MODEL2_CPU_BOARD
27732789   MODEL2A_VID_BOARD
27742790ROM_END
r243192r243193
28002816   ROM_REGION( 0x400000, "scsp", 0 ) // Samples
28012817   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
28022818   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
2803
2804   //             1997     317-5038-COM   Model 2
2805   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
28062819ROM_END
28072820
28082821ROM_START( zerogunj ) /* Zero Gunner (Japan), Model 2B */
r243192r243193
28322845   ROM_REGION( 0x400000, "scsp", 0 ) // Samples
28332846   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
28342847   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
2835
2836   //             1997     317-5038-COM   Model 2
2837   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
28382848ROM_END
28392849
28402850ROM_START( gunblade ) /* Gunblade NY Revision A, Model 2B, Sega game ID# 833-12562 GUN BLADE, Sega ROM board ID# 834-12563 */
r243192r243193
35703580   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
35713581   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
35723582
3573   //             1998     317-0236-COM   Model 2
3574   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
3575
35763583   MODEL2_CPU_BOARD
35773584   MODEL2A_VID_BOARD
35783585ROM_END
r243192r243193
36213628   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
36223629   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
36233630
3624   //             1998     317-0236-COM   Model 2
3625   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
3626
36273631   MODEL2_CPU_BOARD
36283632   MODEL2A_VID_BOARD
36293633ROM_END
r243192r243193
36713675   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) )
36723676   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
36733677   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
3674
3675   //             1998     317-0236-COM   Model 2
3676   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
36773678ROM_END
36783679
36793680ROM_START( dyndeka2b ) /* Dynamite Deka 2 (Japan), Model 2B */
r243192r243193
37193720   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) )
37203721   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
37213722   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
3722
3723   //             1998     317-0236-COM   Model 2
3724   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
37253723ROM_END
37263724
37273725ROM_START( dynamcopc ) /* Dynamite Cop (USA), Model 2C */
r243192r243193
37673765   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) ) /* Located at position 33 on 2C-CRX rom board */
37683766   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) ) /* Located at position 34 on 2C-CRX rom board */
37693767   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) ) /* Located at position 35 on 2C-CRX rom board */
3770
3771   //             1998     317-0236-COM   Model 2
3772   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
37733768ROM_END
37743769
37753770ROM_START( schamp ) /* Sonic Championship, Model 2B - Sega ROM board ID# 834-12786 */
r243192r243193
43124307   ROM_LOAD("mpr-21279.sd3", 0x0400000, 0x200000, CRC(3a8dcf68) SHA1(312496b45b699051c8b4dd0e5d94e73fe5f3ad8d) )
43134308   ROM_LOAD("mpr-21280.sd4", 0x0600000, 0x200000, CRC(aa548124) SHA1(a94adfe16b5c3236746451c181ccd3e1c27432f4) )
43144309
4315   //             1998     317-5044-COM   Model 2
4316   ROM_PARAMETER( ":315_5881:key", "042e2dc1" )
4317
43184310   MODEL2_CPU_BOARD
43194311   MODEL2A_VID_BOARD
43204312ROM_END
r243192r243193
43544346   ROM_LOAD("mpr-21278.sd2", 0x0200000, 0x200000, CRC(27e18e08) SHA1(254c0ad4d6bd572ff0efc3ea80489e73716a31a7) )
43554347   ROM_LOAD("mpr-21279.sd3", 0x0400000, 0x200000, CRC(3a8dcf68) SHA1(312496b45b699051c8b4dd0e5d94e73fe5f3ad8d) )
43564348   ROM_LOAD("mpr-21280.sd4", 0x0600000, 0x200000, CRC(aa548124) SHA1(a94adfe16b5c3236746451c181ccd3e1c27432f4) )
4357
4358   //             1998     317-5044-COM   Model 2
4359   ROM_PARAMETER( ":315_5881:key", "042e2dc1" )
43604349ROM_END
43614350
43624351ROM_START( indy500 ) /* Defaults to Twin (Stand Alone) Cab version.  2 credits to start - Can be set to Deluxe setting in service mode, Sega Game ID# 833-12361, ROM board ID# 834-12362 */
r243192r243193
58915880
58925881DRIVER_INIT_MEMBER(model2_state,genprot)
58935882{
5894   //astring key = parameter(":315_5881:key");
5895   m_maincpu->space(AS_PROGRAM).install_ram(0x01d80000, 0x01d8ffff);
5896   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d90000, 0x01d9ffff, read32_delegate(FUNC(model2_state::model2_5881prot_r), this), write32_delegate(FUNC(model2_state::model2_5881prot_w), this));
5883   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5884   m_protstate = m_protpos = 0;
58975885}
58985886
58995887DRIVER_INIT_MEMBER(model2_state,pltkids)
59005888{
5901   DRIVER_INIT_CALL(genprot);
5889   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59025890
5891   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5892   m_protstate = m_protpos = 0;
5893
59035894   // fix bug in program: it destroys the interrupt table and never fixes it
5904   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59055895   ROM[0x730/4] = 0x08000004;
59065896}
59075897
59085898DRIVER_INIT_MEMBER(model2_state,zerogun)
59095899{
5910   DRIVER_INIT_CALL(genprot);
5900   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59115901
5902   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5903   m_protstate = m_protpos = 0;
5904
59125905   // fix bug in program: it destroys the interrupt table and never fixes it
5913   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59145906   ROM[0x700/4] = 0x08000004;
59155907}
59165908
r243192r243193
59475939
59485940DRIVER_INIT_MEMBER(model2_state,sgt24h)
59495941{
5950// DRIVER_INIT_CALL(genprot);
5942   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59515943
5944   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
59525945   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
59535946
5954   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
5947   m_protstate = m_protpos = 0;
5948
59555949   ROM[0x56578/4] = 0x08000004;
59565950   //ROM[0x5b3e8/4] = 0x08000004;
59575951}
r243192r243193
59645958
59655959DRIVER_INIT_MEMBER(model2_state,doa)
59665960{
5967   m_0229crypt->install_doa_protection();
5968
59695961   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
5962
5963   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5964   m_protstate = m_protpos = 0;
5965
59705966   ROM[0x630/4] = 0x08000004;
59715967   ROM[0x808/4] = 0x08000004;
59725968}
r243192r243193
59955991GAME( 1994, vcopa,        vcop, model2o, vcop,    driver_device, 0,       ROT0, "Sega",   "Virtua Cop (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
59965992
59975993// Model 2A-CRX (TGPs, SCSP sound board)
5998GAME( 1995, manxtt,          0, manxttdx     ,manxtt,  driver_device, 0, ROT0, "Sega", "Manx TT Superbike - DX (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5999GAME( 1995, manxttc,         0, model2a,      manxtt,  driver_device, 0,       ROT0, "Sega",   "Manx TT Superbike - Twin (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6000GAME( 1995, srallyc,         0, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6001GAME( 1995, srallycb,  srallyc, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6002GAME( 1995, srallyca,  srallyc, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - DX (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6003GAME( 1995, vf2,             0, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Version 2.1)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6004GAME( 1995, vf2b,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6005GAME( 1995, vf2a,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6006GAME( 1995, vf2o,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6007GAME( 1995, vcop2,           0, model2a,      vcop2,   driver_device, 0,       ROT0, "Sega",   "Virtua Cop 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6008GAME( 1995, skytargt,        0, model2a,      skytargt,driver_device, 0,       ROT0, "Sega",   "Sky Target", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6009GAME( 1996, doaa,          doa, model2a_0229,  model2,  model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2A, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6010GAME( 1997, zeroguna,  zerogun, model2a_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6011GAME( 1997, zerogunaj, zerogun, model2a_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6012GAME( 1997, motoraid,        0, model2a,      manxtt,  driver_device, 0,       ROT0, "Sega",   "Motor Raid - Twin", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6013GAME( 1998, dynamcop,        0, model2a_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6014GAME( 1998, dyndeka2, dynamcop, model2a_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6015GAME( 1998, pltkidsa,  pltkids, model2a_5881, model2,  model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5994GAME( 1995, manxtt,          0, manxttdx,manxtt,  driver_device, 0, ROT0, "Sega", "Manx TT Superbike - DX (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5995GAME( 1995, manxttc,         0, model2a, manxtt,  driver_device, 0,       ROT0, "Sega",   "Manx TT Superbike - Twin (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5996GAME( 1995, srallyc,         0, srallyc, srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5997GAME( 1995, srallycb,  srallyc, srallyc, srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5998GAME( 1995, srallyca,  srallyc, srallyc, srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - DX (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
5999GAME( 1995, vf2,             0, model2a, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Version 2.1)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6000GAME( 1995, vf2b,          vf2, model2a, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6001GAME( 1995, vf2a,          vf2, model2a, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6002GAME( 1995, vf2o,          vf2, model2a, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6003GAME( 1995, vcop2,           0, model2a, vcop2,   driver_device, 0,       ROT0, "Sega",   "Virtua Cop 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6004GAME( 1995, skytargt,        0, model2a, skytargt,driver_device, 0,       ROT0, "Sega",   "Sky Target", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6005GAME( 1996, doaa,          doa, model2a, model2,  model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2A, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6006GAME( 1997, zeroguna,  zerogun, model2a, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6007GAME( 1997, zerogunaj, zerogun, model2a, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6008GAME( 1997, motoraid,        0, model2a, manxtt,  driver_device, 0,       ROT0, "Sega",   "Motor Raid - Twin", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6009GAME( 1998, dynamcop,        0, model2a, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6010GAME( 1998, dyndeka2, dynamcop, model2a, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6011GAME( 1998, pltkidsa,  pltkids, model2a, model2,  model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
60166012
60176013// Model 2B-CRX (SHARC, SCSP sound board)
6018GAME( 1994, vstriker,        0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Striker (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6019GAME( 1994, vstrikero,vstriker, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Striker", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6020GAME( 1995, fvipers,         0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Fighting Vipers (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6021GAME( 1995, gunblade,        0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Gunblade NY (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6022GAME( 1995, indy500,         0, model2b,      srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Twin (Revision A, Newer)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6023GAME( 1995, indy500d,  indy500, model2b,      srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Deluxe (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6024GAME( 1995, indy500to, indy500, model2b,      srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Twin (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6025GAME( 1996, schamp,          0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Sonic Championship (USA)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6026GAME( 1996, sfight,     schamp, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Sonic the Fighters (Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6027GAME( 1996, lastbrnx,        0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (Export, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6028GAME( 1996, lastbrnxu,lastbrnx, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (USA, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6029GAME( 1996, lastbrnxj,lastbrnx, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6030GAME( 1996, doa,             0, model2b_0229, model2,  model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2B, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6031GAME( 1996, sgt24h,          0, model2b,      srallyc, model2_state,  sgt24h,  ROT0, "Jaleco", "Super GT 24h", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6032GAME( 1996, von,             0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Cyber Troopers Virtual-On (USA, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6033GAME( 1996, vonj,          von, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Cyber Troopers Virtual-On (Japan, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6034GAME( 1996, dynabb,          0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Dynamite Baseball", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6035GAME( 1997, dynabb97,        0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Dynamite Baseball 97 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6036GAME( 1997, overrevb,  overrev, model2b,      srallyc, model2_state,  overrev, ROT0, "Jaleco", "Over Rev (Model 2B, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6037GAME( 1997, zerogun,         0, model2b_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6038GAME( 1997, zerogunj,  zerogun, model2b_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6039GAME( 1998, dynamcopb,dynamcop, model2b_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6040GAME( 1998, dyndeka2b,dynamcop, model2b_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6041GAME( 1998, pltkids,         0, model2b_5881, model2,  model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2B, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6042GAME( 1995, rchase2,         0, model2b,      rchase2, model2_state,  rchase2, ROT0, "Sega",   "Rail Chase 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6014GAME( 1994, vstriker,        0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Striker (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6015GAME( 1994, vstrikero,vstriker, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Striker", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6016GAME( 1995, fvipers,         0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Fighting Vipers (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6017GAME( 1995, gunblade,        0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Gunblade NY (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6018GAME( 1995, indy500,         0, model2b, srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Twin (Revision A, Newer)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6019GAME( 1995, indy500d,  indy500, model2b, srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Deluxe (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6020GAME( 1995, indy500to, indy500, model2b, srallyc, driver_device, 0,       ROT0, "Sega",   "INDY 500 Twin (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6021GAME( 1996, schamp,          0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Sonic Championship (USA)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6022GAME( 1996, sfight,     schamp, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Sonic the Fighters (Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6023GAME( 1996, lastbrnx,        0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (Export, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6024GAME( 1996, lastbrnxu,lastbrnx, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (USA, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6025GAME( 1996, lastbrnxj,lastbrnx, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Last Bronx (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6026GAME( 1996, doa,             0, model2b, model2,  model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2B, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6027GAME( 1996, sgt24h,          0, model2b, srallyc, model2_state,  sgt24h,  ROT0, "Jaleco", "Super GT 24h", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6028GAME( 1996, von,             0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Cyber Troopers Virtual-On (USA, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6029GAME( 1996, vonj,          von, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Cyber Troopers Virtual-On (Japan, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6030GAME( 1996, dynabb,          0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Dynamite Baseball", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6031GAME( 1997, dynabb97,        0, model2b, model2,  driver_device, 0,       ROT0, "Sega",   "Dynamite Baseball 97 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6032GAME( 1997, overrevb,  overrev, model2b, srallyc, model2_state,  overrev, ROT0, "Jaleco", "Over Rev (Model 2B, Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6033GAME( 1997, zerogun,         0, model2b, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6034GAME( 1997, zerogunj,  zerogun, model2b, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6035GAME( 1998, dynamcopb,dynamcop, model2b, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6036GAME( 1998, dyndeka2b,dynamcop, model2b, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6037GAME( 1998, pltkids,         0, model2b, model2,  model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2B, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6038GAME( 1995, rchase2,         0, model2b, rchase2, model2_state,  rchase2, ROT0, "Sega",   "Rail Chase 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
60436039
60446040// Model 2C-CRX (TGPx4, SCSP sound board)
6045GAME( 1996, skisuprg,        0, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Sega Ski Super G", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS|GAME_UNEMULATED_PROTECTION )
6046GAME( 1996, stcc,            0,    stcc,      model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6047GAME( 1996, stccb,        stcc,    stcc,      model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6048GAME( 1996, stcca,        stcc,    stcc,      model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6049GAME( 1996, waverunr,        0, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Wave Runner (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6050GAME( 1997, hotd,            0, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "House of the Dead", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6051GAME( 1997, overrev,         0, model2c,      srallyc, model2_state,  overrev, ROT0, "Jaleco", "Over Rev (Model 2C, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6052GAME( 1997, segawski,        0, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Sega Water Ski (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6053GAME( 1997, topskatr,        0, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (Export, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6054GAME( 1997, topskatru,topskatr, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (USA, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6055GAME( 1997, topskatrj,topskatr, model2c,      model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6056GAME( 1998, bel,             0, model2c,      bel,     driver_device, 0,       ROT0, "Sega / EPL Productions", "Behind Enemy Lines", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6057GAME( 1998, dynamcopc,dynamcop, model2c_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (USA, Model 2C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6041GAME( 1996, skisuprg,        0, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Sega Ski Super G", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS|GAME_UNEMULATED_PROTECTION )
6042GAME( 1996, stcc,            0,    stcc, model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6043GAME( 1996, stccb,        stcc,    stcc, model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6044GAME( 1996, stcca,        stcc,    stcc, model2,  driver_device, 0,       ROT0, "Sega",   "Sega Touring Car Championship (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6045GAME( 1996, waverunr,        0, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Wave Runner (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6046GAME( 1997, hotd,            0, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "House of the Dead", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6047GAME( 1997, overrev,         0, model2c, srallyc, model2_state,  overrev, ROT0, "Jaleco", "Over Rev (Model 2C, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6048GAME( 1997, segawski,        0, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Sega Water Ski (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6049GAME( 1997, topskatr,        0, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (Export, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6050GAME( 1997, topskatru,topskatr, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (USA, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6051GAME( 1997, topskatrj,topskatr, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Top Skater (Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6052GAME( 1998, bel,             0, model2c, bel,     driver_device, 0,       ROT0, "Sega / EPL Productions", "Behind Enemy Lines", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
6053GAME( 1998, dynamcopc,dynamcop, model2c, model2,  driver_device, 0,       ROT0, "Sega",   "Dynamite Cop (USA, Model 2C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
trunk/src/mame/drivers/model3.c
r243192r243193
665665#include "includes/model3.h"
666666
667667
668
669668void model3_state::update_irq_state()
670669{
671670   if ((m_irq_enable & m_irq_state) || m_scsi_irq_state)
r243192r243193
16741673}
16751674
16761675
1676static const UINT16 vs299_prot_data[] =
1677{
1678   0xc800, 0x4a20, 0x5041, 0x4e41, 0x4920, 0x4154, 0x594c, 0x4220,
1679   0x4152, 0x4953, 0x204c, 0x5241, 0x4547, 0x544e, 0x4e49, 0x2041,
1680   0x4547, 0x4d52, 0x4e41, 0x2059, 0x4e45, 0x4c47, 0x4e41, 0x2044,
1681   0x454e, 0x4854, 0x5245, 0x414c, 0x444e, 0x2053, 0x5246, 0x4e41,
1682   0x4543, 0x4320, 0x4c4f, 0x4d4f, 0x4942, 0x2041, 0x4150, 0x4152,
1683   0x5547, 0x5941, 0x4220, 0x4c55, 0x4147, 0x4952, 0x2041, 0x5053,
1684   0x4941, 0x204e, 0x5243, 0x414f, 0x4954, 0x2041, 0x4542, 0x474c,
1685   0x5549, 0x204d, 0x494e, 0x4547, 0x4952, 0x2041, 0x4153, 0x4455,
1686   0x2049, 0x4f4b, 0x4552, 0x2041, 0x4544, 0x4d4e, 0x5241, 0x204b,
1687   0x4f52, 0x414d, 0x494e, 0x2041, 0x4353, 0x544f, 0x414c, 0x444e,
1688   0x5520, 0x4153, 0x5320, 0x554f, 0x4854, 0x4641, 0x4952, 0x4143,
1689   0x4d20, 0x5845, 0x4349, 0x204f, 0x5559, 0x4f47, 0x4c53, 0x5641,
1690   0x4149, 0x4620, 0x5f43, 0x4553, 0x4147
1691};
16771692
1678READ64_MEMBER(model3_state::model3_5881prot_r)
1693static const UINT16 swt_prot_data[] =
16791694{
1680   UINT64 retvalue = U64(0xffffffffffffffff);
1695   0xffff,
1696   0x3d3d, 0x3d3d, 0x203d, 0x5453, 0x5241, 0x5720, 0x5241, 0x2053,
1697   0x3d3d, 0x3d3d, 0x0a3d, 0x6f43, 0x7970, 0x6952, 0x6867, 0x2074,
1698   0x4553, 0x4147, 0x4520, 0x746e, 0x7265, 0x7270, 0x7369, 0x7365,
1699   0x202c, 0x744c, 0x2e64, 0x410a, 0x756d, 0x6573, 0x656d, 0x746e,
1700   0x5220, 0x4426, 0x4420, 0x7065, 0x2e74, 0x2320, 0x3231, 0x4b0a,
1701   0x7461, 0x7573, 0x6179, 0x7573, 0x4120, 0x646e, 0x206f, 0x2026,
1702   0x614b, 0x6f79, 0x6f6b, 0x5920, 0x6d61, 0x6d61, 0x746f, 0x0a6f,
1703};
16811704
1682   if (offset == 0x00 / 8)
1683   {
1684      retvalue = 0;
1685   }
1686   else if (offset == 0x18 / 8)
1687   {
1688      if (first_read == 1)
1689      {
1690         // the RAM based schemes expect a dummy value before the start of the stream
1691         // to match the previous simulation I use 0xffff here
1692         first_read = 0;
1693         retvalue = 0xffff << 16;
1694      }
1695      else
1696      {
1697         UINT8* base;
1698         retvalue = m_cryptdevice->do_decrypt(base);
1699         //  retvalue = ((retvalue & 0xff00) >> 8) | ((retvalue & 0x00ff) << 8); // don't endian swap the return value on this hardware
1700         retvalue <<= 16;
1701      }
1705static const UINT16 fvipers2_prot_data[] =
1706{
1707   0x2a2a,
1708   0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x202a, 0x5b5b,
1709   0x4620, 0x6769, 0x7468, 0x6e69, 0x2067, 0x6956, 0x6570, 0x7372,
1710   0x3220, 0x5d20, 0x205d, 0x6e69, 0x3c20, 0x4d3c, 0x444f, 0x4c45,
1711   0x332d, 0x3e3e, 0x4320, 0x706f, 0x7279, 0x6769, 0x7468, 0x2820,
1712   0x2943, 0x3931, 0x3839, 0x5320, 0x4745, 0x2041, 0x6e45, 0x6574,
1713   0x7072, 0x6972, 0x6573, 0x2c73, 0x544c, 0x2e44, 0x2020, 0x4120,
1714   0x6c6c, 0x7220, 0x6769, 0x7468, 0x7220, 0x7365, 0x7265, 0x6576,
1715   0x2e64, 0x2a20, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a,
1716};
17021717
1703   //  printf("model3_5881prot_r offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
1704   }
1705   else
1706   {
1707      printf("model3_5881prot_r offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
1708   }
1718static const UINT16 spikeout_prot_data[] =
1719{
1720   0x0000,
1721   0x4f4d, 0x4544, 0x2d4c, 0x2033, 0x7953, 0x7473, 0x6d65, 0x5020,
1722   0x6f72, 0x7267, 0x6d61, 0x4320, 0x706f, 0x7279, 0x6769, 0x7468,
1723   0x2820, 0x2943, 0x3120, 0x3939, 0x2035, 0x4553, 0x4147, 0x4520,
1724   0x746e, 0x7265, 0x7270, 0x7369, 0x7365, 0x4c2c, 0x4454, 0x202e,
1725   0x6c41, 0x206c, 0x6972, 0x6867, 0x2074, 0x6572, 0x6573, 0x7672,
1726   0x6465, 0x202e, 0x2020, 0x0020
1727};
17091728
1710   return retvalue;
1729static const UINT16 eca_prot_data[] =
1730{
1731   0x0000,
1732   0x2d2f, 0x202d, 0x4d45, 0x5245, 0x4547, 0x434e, 0x2059, 0x4143,
1733   0x4c4c, 0x4120, 0x424d, 0x4c55, 0x4e41, 0x4543, 0x2d20, 0x0a2d,
1734   0x6f43, 0x7970, 0x6952, 0x6867, 0x2074, 0x4553, 0x4147, 0x4520,
1735   0x746e, 0x7265, 0x7270, 0x7369, 0x7365, 0x202c, 0x744c, 0x2e64,
1736   0x530a, 0x666f, 0x7774, 0x7261, 0x2065, 0x2652, 0x2044, 0x6544,
1737   0x7470, 0x202e, 0x3123, 0x660a, 0x726f, 0x7420, 0x7365, 0x0a74,
1738};
17111739
1740static const UINT16 oceanhun_prot_data[] =
1741{
1742   0x0000,    // dummy read
1743   0x3d3d, 0x203d, 0x434f, 0x4145, 0x204e, 0x5548, 0x544e, 0x5245,
1744   0x3d20, 0x3d3d, 0x430a, 0x706f, 0x5279, 0x6769, 0x7468, 0x5320,
1745   0x4745, 0x2041, 0x6e45, 0x6574, 0x7072, 0x6972, 0x6573, 0x2c73,
1746   0x4c20, 0x6474, 0x0a2e, 0x6d41, 0x7375, 0x6d65, 0x6e65, 0x2074,
1747   0x2652, 0x2044, 0x6544, 0x7470, 0x202e, 0x3123, 0x4b0a, 0x7a61,
1748   0x6e75, 0x7261, 0x2069, 0x7354, 0x6b75, 0x6d61, 0x746f, 0x206f,
1749   0x6553, 0x7463, 0x6f69, 0x206e, 0x614d, 0x616e, 0x6567, 0x0a72
1750};
1751/*
1752   dirtdvls: first 2 words read are discarded, then every other word
1753   is written to char RAM starting at f1013400 (in between words are
1754   discarded).
1755*/
17121756
1713}
1714
1715WRITE64_MEMBER(model3_state::model3_5881prot_w)
1757READ64_MEMBER(model3_state::model3_security_r)
17161758{
1717   if (offset == 0x10 / 8)
1759   switch(offset)
17181760   {
1719      // code is copied to RAM first, so base address is always 0
1720      m_cryptdevice->set_addr_low(0);
1721      m_cryptdevice->set_addr_high(0);
1722
1723      if (data != 0)
1724         printf("model3_5881prot_w address isn't 0?\n");
1725
1726      first_read = 1;
1761      case 0x00/8:    return 0;       /* status */
1762      case 0x1c/8:                    /* security board data read */
1763      {
1764         if (core_stricmp(machine().system().name, "vs299") == 0 ||
1765            core_stricmp(machine().system().name, "vs2v991") == 0)
1766         {
1767            return (UINT64)vs299_prot_data[m_prot_data_ptr++] << 48;
1768         }
1769         else if (core_stricmp(machine().system().name, "swtrilgy") == 0 ||
1770                  core_stricmp(machine().system().name, "swtrilgya") == 0)
1771         {
1772            UINT64 data = (UINT64)swt_prot_data[m_prot_data_ptr++] << 16;
1773            if (m_prot_data_ptr > 0x38)
1774            {
1775               m_prot_data_ptr = 0;
1776            }
1777            return data;
1778         }
1779         else if (core_stricmp(machine().system().name, "fvipers2") == 0)
1780         {
1781            UINT64 data = (UINT64)fvipers2_prot_data[m_prot_data_ptr++] << 16;
1782            if (m_prot_data_ptr >= 0x41)
1783            {
1784               m_prot_data_ptr = 0;
1785            }
1786            return data;
1787         }
1788         else if (core_stricmp(machine().system().name, "spikeout") == 0 ||
1789                  core_stricmp(machine().system().name, "spikeofe") == 0)
1790         {
1791            UINT64 data = (UINT64)spikeout_prot_data[m_prot_data_ptr++] << 16;
1792            if (m_prot_data_ptr >= 0x55)
1793            {
1794               m_prot_data_ptr = 0;
1795            }
1796            return data;
1797         }
1798         else if (core_stricmp(machine().system().name, "eca") == 0 ||
1799                  core_stricmp(machine().system().name, "ecax") == 0)
1800         {
1801            UINT64 data = (UINT64)eca_prot_data[m_prot_data_ptr++] << 16;
1802            if (m_prot_data_ptr >= 0x31)
1803            {
1804               m_prot_data_ptr = 0;
1805            }
1806            return data;
1807         }
1808         else if (core_stricmp(machine().system().name, "oceanhun") == 0)
1809         {
1810            UINT64 data = (UINT64)oceanhun_prot_data[m_prot_data_ptr++] << 16;
1811            if (m_prot_data_ptr >= 58)
1812            {
1813               m_prot_data_ptr = 0;
1814            }
1815            return data;
1816         }
1817         else
1818         {
1819            return 0;
1820         }
1821      }
17271822   }
1728   else if (offset == 0x18 / 8)
1729   {
1730      UINT16 subkey = data >> (32 + 16);
1731      subkey = ((subkey & 0xff00) >> 8) | ((subkey & 0x00ff) << 8); // endian swap the sub-key for this hardware
1732      printf("model3_5881prot_w setting subkey %04x\n", subkey);
1733      m_cryptdevice->set_subkey(subkey);
1734   }
1735   else
1736   {
1737      printf("model3_5881prot_w offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(data >> 32), (UINT32)(data & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
1738   }
1823   return U64(0xffffffffffffffff);
17391824}
17401825
17411826WRITE64_MEMBER(model3_state::daytona2_rombank_w)
r243192r243193
17621847   AM_RANGE(0xf00c0000, 0xf00dffff) AM_MIRROR(0x0e000000) AM_RAM AM_SHARE("backup")    /* backup SRAM */
17631848   AM_RANGE(0xf0100000, 0xf010003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_sys_r, model3_sys_w )
17641849   AM_RANGE(0xf0140000, 0xf014003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_rtc_r, model3_rtc_w )
1850   AM_RANGE(0xf0180000, 0xf019ffff) AM_MIRROR(0x0e000000) AM_RAM                           /* Security Board RAM */
1851   AM_RANGE(0xf01a0000, 0xf01a003f) AM_MIRROR(0x0e000000) AM_READ(model3_security_r )  /* Security board */
17651852
17661853   AM_RANGE(0xf1000000, 0xf10f7fff) AM_READWRITE(model3_char_r, model3_char_w )    /* character RAM */
17671854   AM_RANGE(0xf10f8000, 0xf10fffff) AM_READWRITE(model3_tile_r, model3_tile_w )    /* tilemaps */
r243192r243193
33343421
33353422   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
33363423   ROM_FILL( 0x000000, 0x80000, 0 )
3337
3338   //             ????     317-0237-COM   Model 3
3339   ROM_PARAMETER( ":315_5881:key", "09234e96" )
33403424ROM_END
33413425
33423426ROM_START( vs29815 )    /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 */
r243192r243193
34873571
34883572   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
34893573   ROM_FILL( 0x000000, 0x80000, 0 )
3490
3491   //             ????     317-0245-COM   Model 3
3492   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
34933574ROM_END
34943575
34953576ROM_START( vs299b ) /* Step 2.0 */
r243192r243193
35653646
35663647   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
35673648   ROM_FILL( 0x000000, 0x80000, 0 )
3568
3569   //             ????     317-0245-COM   Model 3
3570   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
35713649ROM_END
35723650
35733651ROM_START( vs299a ) /* Step 2.0 */
r243192r243193
36433721
36443722   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
36453723   ROM_FILL( 0x000000, 0x80000, 0 )
3646
3647   //             ????     317-0245-COM   Model 3
3648   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
36493724ROM_END
36503725
36513726ROM_START( vs299 )  /* Step 2.0 */
r243192r243193
37213796
37223797   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
37233798   ROM_FILL( 0x000000, 0x80000, 0 )
3724
3725   //             ????     317-0245-COM   Model 3
3726   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
37273799ROM_END
37283800
37293801ROM_START( von2 )   /* Step 2.0 */
r243192r243193
38003872
38013873   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
38023874   ROM_FILL( 0x000000, 0x80000, 0 )
3803
3804   //             ????     317-0234-COM   Model 3
3805   ROM_PARAMETER( ":315_5881:key", "092a0e97" )
38063875ROM_END
38073876
38083877ROM_START( von254g )    /* Step 2.0, Sega game ID# is 833-13789 */
r243192r243193
38793948
38803949   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
38813950   ROM_FILL( 0x000000, 0x80000, 0 )
3882
3883   //             ????     317-0234-COM   Model 3
3884   ROM_PARAMETER( ":315_5881:key", "092a0e97" )
38853951ROM_END
38863952
38873953ROM_START( skichamp )   /* Step 2.0 */
r243192r243193
40264092
40274093   ROM_REGION( 0x10000, "ffcpu", 0 )   /* force feedback controller prg */
40284094   ROM_LOAD( "epr21119.ic8",  0x00000, 0x10000, CRC(65082b14) SHA1(6c3c192dd6ef3780c6202dd63fc6086328928818) )
4029
4030   //             ????     317-0241-COM   Model 3
4031   ROM_PARAMETER( ":315_5881:key", "11272a01" )
40324095ROM_END
40334096
40344097ROM_START( swtrilgya )  /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 834-13587 STAR WARS TRILOGY, Security board ID# 837-13588-COM */
r243192r243193
40984161
40994162   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
41004163   ROM_FILL( 0x000000, 0x80000, 0 )
4101
4102   //             ????     317-0241-COM   Model 3
4103   ROM_PARAMETER( ":315_5881:key", "11272a01" )
41044164ROM_END
41054165
41064166ROM_START( dirtdvls )   /* Step 2.1, Sega game ID# is 833-13427, ROM board ID# 834-13528 DRT */
r243192r243193
41624222
41634223   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
41644224   ROM_FILL( 0x000000, 0x80000, 0 )
4165
4166   //             ????     317-0238-COM   Model 3
4167   ROM_PARAMETER( ":315_5881:key", "09290f17" )
41684225ROM_END
41694226
41704227ROM_START( dirtdvlsa )  /* Step 2.1 */
r243192r243193
42264283
42274284   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
42284285   ROM_FILL( 0x000000, 0x80000, 0 )
4229
4230   //             ????     317-0238-COM   Model 3
4231   ROM_PARAMETER( ":315_5881:key", "09290f17" )
42324286ROM_END
42334287
42344288ROM_START( daytona2 )   /* Step 2.1, ROM board ID# 834-13428 DAYTONA USA2, Security board ID# 837-13507-COM */
r243192r243193
43094363
43104364   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
43114365   ROM_LOAD( "epr-20985.bin", 0x000000, 0x010000, CRC(b139481d) SHA1(05fca7db7c8b084c53bd157ba3e8296f1a961a99) )
4312
4313   //             ????     317-0239-COM   Model 3
4314   ROM_PARAMETER( ":315_5881:key", "09250e16" )
43154366ROM_END
43164367
43174368ROM_START( dayto2pe )   /* Step 2.1, Sega game ID# is 833-13610 DAYTONA USA2 SP, ROM board ID# 834-13609 DAYTONA USA2 SP, Security board ID# 837-13645-COM */
r243192r243193
43924443
43934444   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
43944445   ROM_LOAD( "epr-20985.bin", 0x000000, 0x010000, CRC(b139481d) SHA1(05fca7db7c8b084c53bd157ba3e8296f1a961a99) )
4395
4396   //             ????     317-5045-COM   Model 3
4397   ROM_PARAMETER( ":315_5881:key", "0" ) // unknown
43984446ROM_END
43994447
44004448ROM_START( srally2 )    /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 834-13374 SRT TWIN */
r243192r243193
47474795
47484796   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
47494797   ROM_FILL( 0x000000, 0x80000, 0 )
4750
4751   //             ????     317-0235-COM   Model 3
4752   ROM_PARAMETER( ":315_5881:key", "09260e96" )
47534798ROM_END
47544799
47554800ROM_START( spikeout )   /* Step 2.1 */
r243192r243193
48274872
48284873   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
48294874   ROM_FILL( 0x000000, 0x80000, 0 )
4830
4831   //             ????     317-0240-COM   Model 3
4832   ROM_PARAMETER( ":315_5881:key", "092f2b04" )
48334875ROM_END
48344876
48354877ROM_START( spikeofe )   /* Step 2.1, Sega game ID# is 833-13746, ROM board ID# 834-13747 SPK F/E, Security board ID# 837-13726-COM */
r243192r243193
49074949
49084950   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
49094951   ROM_FILL( 0x000000, 0x80000, 0 )
4910
4911   //             ????     317-0247-COM   Model 3
4912   ROM_PARAMETER( ":315_5881:key", "09236fc8" )
49134952ROM_END
49144953
49154954ROM_START( eca )    /* Step 2.1, ROM board ID# 834-13946-01 ECA */
r243192r243193
49785017
49795018   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
49805019   ROM_FILL( 0x000000, 0x80000, 0 )
4981
4982   //             ????     317-0265-COM   Model 3
4983   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
49845020ROM_END
49855021
49865022ROM_START( ecax )   /* Step 2.1 */
r243192r243193
50495085
50505086   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
50515087   ROM_FILL( 0x000000, 0x80000, 0 )
5052
5053   //             ????     317-0265-COM   Model 3
5054   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
50555088ROM_END
50565089
50575090ROM_START( ecap )   /* Step 2.1 - Proto or Location test - No security dongle */
r243192r243193
51235156
51245157   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
51255158   ROM_FILL( 0x000000, 0x80000, 0 )
5126
5127   //             ????     317-0265-COM   Model 3
5128   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
51295159ROM_END
51305160
51315161ROM_START( magtruck )   /* Step 2.1, Sega game ID# is 833-13601-01 (Export), ROM board ID# 834-13600-01 RCS EXP (Export), Security board ID# 837-13599-COM */
r243192r243193
51825212
51835213   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
51845214   ROM_FILL( 0x000000, 0x80000, 0 )
5185
5186   //             ????     317-0243-COM   Model 3
5187   ROM_PARAMETER( ":315_5881:key", "09266e45" )
51885215ROM_END
51895216
51905217ROM_START( oceanhun )   /* Step 2.0, Sega game ID# is 833-13571, ROM board ID# 834-13572 THE OCEAN HUNTER, 317-0242-COM security chip (837-13576-COM security board) */
r243192r243193
52535280
52545281   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
52555282   ROM_FILL( 0x000000, 0x80000, 0 )
5256
5257   //             ????     317-0242-COM   Model 3
5258   ROM_PARAMETER( ":315_5881:key", "092b6a01" )
52595283ROM_END
52605284
52615285ROM_START( lamachin )   /* Step 2.0, Sega game ID# is 833-13664, ROM board ID# 834-13665 L.A.MACHINEGUNS, 317-0244-COM security chip (837-13666-COM security board) */
r243192r243193
53255349
53265350   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
53275351   ROM_FILL( 0x000000, 0x80000, 0 )
5328
5329   //             ????     317-0244-COM   Model 3
5330   ROM_PARAMETER( ":315_5881:key", "092a2bc5" )
53315352ROM_END
53325353
53335354/* Model 3 sound board emulation */
r243192r243193
54965517   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
54975518MACHINE_CONFIG_END
54985519
5499static MACHINE_CONFIG_START(model3_20, model3_state)
5520static MACHINE_CONFIG_START( model3_20, model3_state )
55005521   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55015522   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55025523   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243192r243193
55055526   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55065527   MCFG_CPU_PROGRAM_MAP(model3_snd)
55075528
5508   MCFG_MACHINE_START_OVERRIDE(model3_state, model3_20)
5509   MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_20)
5529   MCFG_MACHINE_START_OVERRIDE(model3_state,model3_20)
5530   MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_20)
55105531
55115532   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55125533   MCFG_NVRAM_ADD_1FILL("backup")
r243192r243193
55335554   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
55345555MACHINE_CONFIG_END
55355556
5536static MACHINE_CONFIG_DERIVED(model3_20_5881, model3_20)
5537   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
5538   MCFG_SET_READ_CALLBACK(model3_state, crypt_read_callback)
5539MACHINE_CONFIG_END
5540
5541static MACHINE_CONFIG_START(model3_21, model3_state)
5557static MACHINE_CONFIG_START( model3_21, model3_state )
55425558   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55435559   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55445560   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243192r243193
55475563   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55485564   MCFG_CPU_PROGRAM_MAP(model3_snd)
55495565
5550   MCFG_MACHINE_START_OVERRIDE(model3_state, model3_21)
5551   MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_21)
5566   MCFG_MACHINE_START_OVERRIDE(model3_state,model3_21)
5567   MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_21)
55525568
55535569   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55545570   MCFG_NVRAM_ADD_1FILL("backup")
r243192r243193
55755591   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
55765592MACHINE_CONFIG_END
55775593
5578
5579UINT16 model3_state::crypt_read_callback(UINT32 addr)
5580{
5581   UINT16 dat = 0;
5582   if (addr < 0x8000)
5583   {
5584      dat = m_maincpu->space().read_word((0xf0180000 + 4 * addr)); // every other word is unused in this RAM, probably 32-bit ram on 64-bit bus?
5585   }
5586
5587//  dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8);
5588//  printf("reading %04x\n", dat);
5589
5590   return dat;
5591}
5592
5593static MACHINE_CONFIG_DERIVED( model3_21_5881, model3_21 )
5594   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
5595   MCFG_SET_READ_CALLBACK(model3_state, crypt_read_callback)
5596MACHINE_CONFIG_END
5597
5598
55995594static void interleave_vroms(running_machine &machine)
56005595{
56015596   model3_state *state = machine.driver_data<model3_state>();
r243192r243193
56275622   }
56285623}
56295624
5630DRIVER_INIT_MEMBER(model3_state, genprot)
5631{
5632//  astring key = parameter(":315_5881:key");
5633
5634   m_maincpu->space(AS_PROGRAM).install_ram(0xf0180000, 0xf019ffff, 0, 0x0e000000);
5635
5636   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_5881prot_r), this), write64_delegate(FUNC(model3_state::model3_5881prot_w), this) );
5637
5638}
5639
56405625DRIVER_INIT_MEMBER(model3_state,model3_10)
56415626{
56425627   interleave_vroms(machine());
r243192r243193
58005785DRIVER_INIT_MEMBER(model3_state,vs298)
58015786{
58025787   DRIVER_INIT_CALL(model3_20);
5803   DRIVER_INIT_CALL(genprot);
58045788}
58055789
58065790
5791DRIVER_INIT_MEMBER(model3_state,vs2v991)
5792{
5793   DRIVER_INIT_CALL(model3_20);
5794}
58075795
5796DRIVER_INIT_MEMBER(model3_state,vs299b)
5797{
5798   DRIVER_INIT_CALL(model3_20);
5799}
58085800
5801DRIVER_INIT_MEMBER(model3_state,vs299a)
5802{
5803   DRIVER_INIT_CALL(model3_20);
5804}
5805
58095806DRIVER_INIT_MEMBER(model3_state,vs299)
58105807{
58115808   DRIVER_INIT_CALL(model3_20);
5812   DRIVER_INIT_CALL(genprot);
58135809}
58145810
58155811DRIVER_INIT_MEMBER(model3_state,harley)
r243192r243193
58565852
58575853   rom[(0x043dc^4)/4] = 0x48000090;        // skip force feedback setup
58585854   rom[(0xf6e44^4)/4] = 0x60000000;
5859
5860
5861   DRIVER_INIT_CALL(genprot);
5862
58635855}
58645856
58655857DRIVER_INIT_MEMBER(model3_state,swtrilga)
58665858{
58675859   //UINT32 *rom = (UINT32*)memregion("user1")->base();
58685860   DRIVER_INIT_CALL(model3_20);
5869   DRIVER_INIT_CALL(genprot);
58705861
58715862   //rom[(0xf6dd0^4)/4] = 0x60000000;
58725863}
r243192r243193
58765867   m_step20_with_old_real3d = true;
58775868
58785869   DRIVER_INIT_CALL(model3_20);
5879   DRIVER_INIT_CALL(genprot);
58805870}
58815871
58825872DRIVER_INIT_MEMBER(model3_state,dirtdvls)
r243192r243193
58845874   m_step20_with_old_real3d = true;
58855875
58865876   DRIVER_INIT_CALL(model3_20);
5887   DRIVER_INIT_CALL(genprot);
58885877}
58895878
58905879DRIVER_INIT_MEMBER(model3_state,daytona2)
58915880{
5892//  UINT32 *rom = (UINT32*)memregion("user1")->base();
5881   UINT32 *rom = (UINT32*)memregion("user1")->base();
58935882   DRIVER_INIT_CALL(model3_20);
58945883
58955884   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
58965885   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
58975886
58985887   //rom[(0x68468c^4)/4] = 0x60000000;
5899   //rom[(0x6063c4^4)/4] = 0x60000000;
5900   //rom[(0x616434^4)/4] = 0x60000000;
5901   //rom[(0x69f4e4^4)/4] = 0x60000000;
5902
5903   DRIVER_INIT_CALL(genprot);
5888   rom[(0x6063c4^4)/4] = 0x60000000;
5889   rom[(0x616434^4)/4] = 0x60000000;
5890   rom[(0x69f4e4^4)/4] = 0x60000000;
59045891}
59055892
59065893DRIVER_INIT_MEMBER(model3_state,dayto2pe)
59075894{
5908//  UINT32 *rom = (UINT32*)memregion("user1")->base();
5895   UINT32 *rom = (UINT32*)memregion("user1")->base();
59095896   DRIVER_INIT_CALL(model3_20);
59105897
59115898   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
59125899   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
59135900
5914//  rom[(0x606784^4)/4] = 0x60000000;
5915//  rom[(0x69a3fc^4)/4] = 0x60000000;       // jump to encrypted code
5916//  rom[(0x618b28^4)/4] = 0x60000000;       // jump to encrypted code
5901   rom[(0x606784^4)/4] = 0x60000000;
5902   rom[(0x69a3fc^4)/4] = 0x60000000;       // jump to encrypted code
5903   rom[(0x618b28^4)/4] = 0x60000000;       // jump to encrypted code
59175904
5918//  rom[(0x64ca34^4)/4] = 0x60000000;       // dec
5919
5920   DRIVER_INIT_CALL(genprot);
5905   rom[(0x64ca34^4)/4] = 0x60000000;       // dec
59215906}
59225907
59235908DRIVER_INIT_MEMBER(model3_state,spikeout)
r243192r243193
59275912
59285913   rom[(0x6059cc^4)/4] = 0x60000000;
59295914   rom[(0x6059ec^4)/4] = 0x60000000;
5930   DRIVER_INIT_CALL(genprot);
59315915}
59325916
59335917DRIVER_INIT_MEMBER(model3_state,spikeofe)
r243192r243193
59375921
59385922   rom[(0x6059cc^4)/4] = 0x60000000;
59395923   rom[(0x6059ec^4)/4] = 0x60000000;
5940   DRIVER_INIT_CALL(genprot);
59415924}
59425925
59435926DRIVER_INIT_MEMBER(model3_state,eca)
59445927{
59455928   DRIVER_INIT_CALL(model3_20);
5946   DRIVER_INIT_CALL(genprot);
59475929}
59485930
59495931DRIVER_INIT_MEMBER(model3_state,skichamp)
r243192r243193
59655947   DRIVER_INIT_CALL(model3_20);
59665948
59675949   rom[(0x57995c^4)/4] = 0x60000000;   // decrementer
5968
5969   DRIVER_INIT_CALL(genprot);
59705950}
59715951
59725952DRIVER_INIT_MEMBER(model3_state,magtruck)
r243192r243193
59745954   m_step20_with_old_real3d = true;
59755955
59765956   DRIVER_INIT_CALL(model3_20);
5977   DRIVER_INIT_CALL(genprot);
59785957}
59795958
59805959DRIVER_INIT_MEMBER(model3_state,lamachin)
r243192r243193
59825961   m_step20_with_old_real3d = true;
59835962
59845963   DRIVER_INIT_CALL(model3_20);
5985   DRIVER_INIT_CALL(genprot);
59865964}
59875965
59885966
r243192r243193
60075985GAME( 1998, vs29815,    vs298, model3_15, model3, model3_state,    vs29815, ROT0, "Sega", "Virtua Striker 2 '98 (Step 1.5)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
60085986
60095987/* Model 3 Step 2.0 */
6010GAME( 1997, vs2,            0, model3_20,      model3, model3_state,        vs2, ROT0, "Sega", "Virtua Striker 2 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6011GAME( 1997, harley,         0, model3_20,      harley, model3_state,     harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6012GAME( 1997, harleya,   harley, model3_20,      harley, model3_state,     harleya, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6013GAME( 1998, lamachin,       0, model3_20_5881, model3, model3_state,   lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6014GAME( 1998, oceanhun,       0, model3_20_5881, model3, model3_state,   oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6015GAME( 1998, skichamp,       0, model3_20,      skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6016GAME( 1998, srally2,        0, model3_20,      scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6017GAME( 1998, srally2x,       0, model3_20,      scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6018GAME( 1998, von2,           0, model3_20_5881, model3, model3_state,       von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6019GAME( 1998, von254g,     von2, model3_20_5881, model3, model3_state,       von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (ver 5.4g)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6020GAME( 1998, fvipers2,       0, model3_20_5881, model3, model3_state,      vs299, ROT0, "Sega", "Fighting Vipers 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6021GAME( 1998, vs298,          0, model3_20_5881, model3, model3_state,      vs298, ROT0, "Sega", "Virtua Striker 2 '98 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6022GAME( 1999, vs2v991,        0, model3_20_5881, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99.1 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6023GAME( 1999, vs299b,   vs2v991, model3_20_5881, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6024GAME( 1999, vs299a,   vs2v991, model3_20_5881, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6025GAME( 1999, vs299,    vs2v991, model3_20_5881, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5988GAME( 1997, vs2,            0, model3_20, model3, model3_state,        vs2, ROT0, "Sega", "Virtua Striker 2 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5989GAME( 1997, harley,         0, model3_20, harley, model3_state,     harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5990GAME( 1997, harleya,   harley, model3_20, harley, model3_state,     harleya, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5991GAME( 1998, lamachin,       0, model3_20, model3, model3_state,   lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5992GAME( 1998, oceanhun,       0, model3_20, model3, model3_state,   oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5993GAME( 1998, skichamp,       0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5994GAME( 1998, srally2,        0, model3_20, scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5995GAME( 1998, srally2x,       0, model3_20, scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5996GAME( 1998, von2,           0, model3_20, model3, model3_state,       von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5997GAME( 1998, von254g,     von2, model3_20, model3, model3_state,       von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (ver 5.4g)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5998GAME( 1998, fvipers2,       0, model3_20, model3, model3_state,  model3_20, ROT0, "Sega", "Fighting Vipers 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
5999GAME( 1998, vs298,          0, model3_20, model3, model3_state,      vs298, ROT0, "Sega", "Virtua Striker 2 '98 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6000GAME( 1999, vs2v991,        0, model3_20, model3, model3_state,    vs2v991, ROT0, "Sega", "Virtua Striker 2 '99.1 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6001GAME( 1999, vs299b,   vs2v991, model3_20, model3, model3_state,     vs299b, ROT0, "Sega", "Virtua Striker 2 '99 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6002GAME( 1999, vs299a,   vs2v991, model3_20, model3, model3_state,     vs299a, ROT0, "Sega", "Virtua Striker 2 '99 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6003GAME( 1999, vs299,    vs2v991, model3_20, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
60266004
60276005/* Model 3 Step 2.1 */
6028GAME( 1998, daytona2,         0, model3_21_5881, daytona2, model3_state, daytona2, ROT0, "Sega", "Daytona USA 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6029GAME( 1998, dayto2pe,         0, model3_21_5881, daytona2, model3_state, dayto2pe, ROT0, "Sega", "Daytona USA 2 Power Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6030GAME( 1998, dirtdvls,         0, model3_21_5881, scud,     model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 1) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6031GAME( 1998, dirtdvlsa, dirtdvls, model3_21_5881, scud,     model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 2) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6032GAME( 1998, swtrilgy,         0, model3_21_5881, swtrilgy, model3_state, swtrilgy, ROT0, "Sega / LucasArts", "Star Wars Trilogy (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6033GAME( 1998, swtrilgya, swtrilgy, model3_21_5881, swtrilgy, model3_state, swtrilga, ROT0, "Sega / LucasArts", "Star Wars Trilogy", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6034GAME( 1998, spikeout,         0, model3_21_5881, model3,   model3_state, spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6035GAME( 1998, spikeofe,         0, model3_21_5881, model3,   model3_state, spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6036GAME( 1998, magtruck,         0, model3_21_5881, eca,      model3_state, magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6037GAME( 1999, eca,              0, model3_21_5881, eca,      model3_state, eca,      ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6038GAME( 1999, ecax,           eca, model3_21_5881, eca,      model3_state, eca,      ROT0, "Sega", "Emergency Call Ambulance (Export)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6039GAME( 1999, ecap,           eca, model3_21_5881, eca,      model3_state, eca,      ROT0, "Sega", "Emergency Call Ambulance (US location test?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6006GAME( 1998, daytona2,         0, model3_21, daytona2, model3_state, daytona2, ROT0, "Sega", "Daytona USA 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6007GAME( 1998, dayto2pe,         0, model3_21, daytona2, model3_state, dayto2pe, ROT0, "Sega", "Daytona USA 2 Power Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6008GAME( 1998, dirtdvls,         0, model3_21, scud, model3_state,     dirtdvls, ROT0, "Sega", "Dirt Devils (set 1) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6009GAME( 1998, dirtdvlsa, dirtdvls, model3_21, scud, model3_state,     dirtdvls, ROT0, "Sega", "Dirt Devils (set 2) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6010GAME( 1998, swtrilgy,         0, model3_21, swtrilgy, model3_state, swtrilgy, ROT0, "Sega / LucasArts", "Star Wars Trilogy (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6011GAME( 1998, swtrilgya, swtrilgy, model3_21, swtrilgy, model3_state, swtrilga, ROT0, "Sega / LucasArts", "Star Wars Trilogy", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6012GAME( 1998, spikeout,         0, model3_21, model3, model3_state,   spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6013GAME( 1998, spikeofe,         0, model3_21, model3, model3_state,   spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6014GAME( 1998, magtruck,         0, model3_21, eca, model3_state,      magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6015GAME( 1999, eca,              0, model3_21, eca, model3_state,           eca, ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6016GAME( 1999, ecax,           eca, model3_21, eca, model3_state,           eca, ROT0, "Sega", "Emergency Call Ambulance (Export)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6017GAME( 1999, ecap,           eca, model3_21, eca, model3_state,           eca, ROT0, "Sega", "Emergency Call Ambulance (US location test?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
trunk/src/mame/drivers/namcos21.c
r243192r243193
311311
312312INT32 namcos21_state::read_pointrom_data(unsigned offset)
313313{
314   return m_ptrom24[offset];
314   const INT32 *pPointData = (INT32 *)memregion( "point" )->base();
315   INT32 result = pPointData[offset];
316   return result;
315317}
316318
317319READ16_MEMBER(namcos21_state::namcos21_video_enable_r)
r243192r243193
11661168
11671169READ16_MEMBER(namcos21_state::winrun_dsp_pointrom_data_r)
11681170{
1169   return m_ptrom16[m_winrun_pointrom_addr++];
1171   UINT16 *ptrom = (UINT16 *)memregion("point")->base();
1172   return ptrom[m_winrun_pointrom_addr++];
11701173}
11711174
11721175WRITE16_MEMBER(namcos21_state::winrun_dsp_complete_w)
r243192r243193
16421645   ROM_LOAD16_BYTE( "ac1-edata1-u.3c", 0x000000, 0x80000, CRC(a9547509) SHA1(1bc663cec03b60ad968896bbc2546f02efda135e) )
16431646   ROM_LOAD16_BYTE( "ac1-edata1-l.1c", 0x000001, 0x80000, CRC(a87087dd) SHA1(cd9b83a8f07886ab44e4ded68002b44338777e8c) )
16441647
1645   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
1648   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
16461649   ROM_LOAD32_BYTE( "ac1-poi-h.2f",  0x000001, 0x80000, CRC(573bbc3b) SHA1(371be12b915db6872049f18980c1b55544cfc445) ) /* most significant */
16471650   ROM_LOAD32_BYTE( "ac1-poi-lu.2k", 0x000002, 0x80000, CRC(d99084b9) SHA1(c604d60a2162af7610e5ff7c1aa4195f7df82efe) )
16481651   ROM_LOAD32_BYTE( "ac1-poi-ll.2n", 0x000003, 0x80000, CRC(abb32307) SHA1(8e936ba99479215dd33a951d81ec2b04020dfd62) ) /* least significant */
r243192r243193
17031706   ROM_LOAD16_BYTE( "ac1-edata1-u.3c", 0x000000, 0x80000, CRC(a9547509) SHA1(1bc663cec03b60ad968896bbc2546f02efda135e) )
17041707   ROM_LOAD16_BYTE( "ac1-edata1-l.1c", 0x000001, 0x80000, CRC(a87087dd) SHA1(cd9b83a8f07886ab44e4ded68002b44338777e8c) )
17051708
1706   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
1709   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
17071710   ROM_LOAD32_BYTE( "ac1-poi-h.2f",  0x000001, 0x80000, CRC(573bbc3b) SHA1(371be12b915db6872049f18980c1b55544cfc445) ) /* most significant */
17081711   ROM_LOAD32_BYTE( "ac1-poi-lu.2k", 0x000002, 0x80000, CRC(d99084b9) SHA1(c604d60a2162af7610e5ff7c1aa4195f7df82efe) )
17091712   ROM_LOAD32_BYTE( "ac1-poi-ll.2n", 0x000003, 0x80000, CRC(abb32307) SHA1(8e936ba99479215dd33a951d81ec2b04020dfd62) ) /* least significant */
r243192r243193
17641767   ROM_LOAD16_BYTE( "cy1-edata0-u.3b", 0x000000, 0x80000, CRC(77452533) SHA1(48fc199bcc1beb23c714eebd9b09b153c980170b) )
17651768   ROM_LOAD16_BYTE( "cy1-edata0-l.1b", 0x000001, 0x80000, CRC(e812e290) SHA1(719e0a026ae8ef63d0d0269b67669ea9b4d950dd) )
17661769
1767   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
1770   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
17681771   ROM_LOAD32_BYTE( "cy1-poi-h1.2f",  0x000001, 0x80000, CRC(eaf8bac3) SHA1(7a2caf6672af158b4a23ce4626342d1f17d1a4e4) )    /* most significant */
17691772   ROM_LOAD32_BYTE( "cy1-poi-lu1.2k", 0x000002, 0x80000, CRC(c544a8dc) SHA1(4cce5f2ab3519b4aa7edbdd15b2d79a7fdcade3c) )
17701773   ROM_LOAD32_BYTE( "cy1-poi-ll1.2n", 0x000003, 0x80000, CRC(30acb99b) SHA1(a28dcb3e5405f166644f6353a903c1143ee268f1) )    /* least significant */
r243192r243193
18231826   ROM_LOAD16_BYTE( "cy1-edata0-u.3b", 0x000000, 0x80000, CRC(77452533) SHA1(48fc199bcc1beb23c714eebd9b09b153c980170b) )
18241827   ROM_LOAD16_BYTE( "cy1-edata0-l.1b", 0x000001, 0x80000, CRC(e812e290) SHA1(719e0a026ae8ef63d0d0269b67669ea9b4d950dd) )
18251828
1826   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
1829   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
18271830   ROM_LOAD32_BYTE( "cy1-poi-h1.2f",  0x000001, 0x80000, CRC(eaf8bac3) SHA1(7a2caf6672af158b4a23ce4626342d1f17d1a4e4) )    /* most significant */
18281831   ROM_LOAD32_BYTE( "cy1-poi-lu1.2k", 0x000002, 0x80000, CRC(c544a8dc) SHA1(4cce5f2ab3519b4aa7edbdd15b2d79a7fdcade3c) )
18291832   ROM_LOAD32_BYTE( "cy1-poi-ll1.2n", 0x000003, 0x80000, CRC(30acb99b) SHA1(a28dcb3e5405f166644f6353a903c1143ee268f1) )    /* least significant */
r243192r243193
18841887   ROM_LOAD16_BYTE( "de1-data-u.3a",  0x00000, 0x80000, CRC(fe65d2ab) SHA1(dbe962dda7efa60357fa3a684a265aaad49df5b5) )
18851888   ROM_LOAD16_BYTE( "de1-data-l.1a",  0x00001, 0x80000, CRC(9bb37aca) SHA1(7f5dffc95cadcf12f53ff7944920afc25ed3cf68) )
18861889
1887   ROM_REGION16_BE( 0xc0000, "point16", 0 ) /* 3d objects */
1890   ROM_REGION16_BE( 0xc0000, "point", 0 ) /* 3d objects */
18881891   ROM_LOAD16_BYTE( "de1-pt0-ub.8j", 0x00000, 0x20000, CRC(3b6b746d) SHA1(40c992ef4cf5187b30aba42c5fe7ce0f8f02bee0) )
18891892   ROM_LOAD16_BYTE( "de1-pt0-lb.8d", 0x00001, 0x20000, CRC(9c5c477e) SHA1(c8ae8a663227d636d35bd5f432d23f05d6695942) )
18901893   ROM_LOAD16_BYTE( "de1-pt1-u.8l",  0x40000, 0x20000, CRC(23bc72a1) SHA1(083e2955ae2f88d1ad461517b47054d64375b46e) )
r243192r243193
19341937
19351938   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
19361939
1937   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00) /* 24bit signed point data */
1940   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00) /* 24bit signed point data */
19381941   ROM_LOAD32_BYTE( "st1-pt0-h.bin", 0x000001, 0x80000, CRC(84eb355f) SHA1(89a248b8be2e0afcee29ba4c4c9cca65d5fb246a) )
19391942   ROM_LOAD32_BYTE( "st1-pt0-u.bin", 0x000002, 0x80000, CRC(1956cd0a) SHA1(7d21b3a59f742694de472c545a1f30c3d92e3390) )
19401943   ROM_LOAD32_BYTE( "st1-pt0-l.bin", 0x000003, 0x80000, CRC(ff577049) SHA1(1e1595174094e88d5788753d05ce296c1f7eca75) )
r243192r243193
19871990
19881991   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
19891992
1990   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00) /* 24bit signed point data */
1993   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00) /* 24bit signed point data */
19911994   ROM_LOAD32_BYTE( "st1-pt0-h.bin", 0x000001, 0x80000, CRC(84eb355f) SHA1(89a248b8be2e0afcee29ba4c4c9cca65d5fb246a) )
19921995   ROM_LOAD32_BYTE( "st1-pt0-u.bin", 0x000002, 0x80000, CRC(1956cd0a) SHA1(7d21b3a59f742694de472c545a1f30c3d92e3390) )
19931996   ROM_LOAD32_BYTE( "st1-pt0-l.bin", 0x000003, 0x80000, CRC(ff577049) SHA1(1e1595174094e88d5788753d05ce296c1f7eca75) )
r243192r243193
20442047
20452048   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
20462049
2047   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
2050   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
20482051   ROM_LOAD32_BYTE( "sv1-pt0-h.bin", 0x000001, 0x80000, CRC(3be21115) SHA1(c9f30353c1216f64199f87cd34e787efd728e739) ) /* most significant */
20492052   ROM_LOAD32_BYTE( "sv1-pt0-u.bin", 0x000002, 0x80000, CRC(4aacfc42) SHA1(f0e179e057183b41744ca429764f44306f0ce9bf) )
20502053   ROM_LOAD32_BYTE( "sv1-pt0-l.bin", 0x000003, 0x80000, CRC(6a4dddff) SHA1(9ed182d21d328c6a684ee6658a9dfcf3f3dd8646) ) /* least significant */
r243192r243193
20922095   ROM_LOAD16_BYTE( "wr1-gd0u-2.1p",  0x00000, 0x40000, CRC(9752eef5) SHA1(d6df0faf9c2696247bdf463f53c1e474ec595dd0) )
20932096   ROM_LOAD16_BYTE( "wr1-gd0l-2.3p",  0x00001, 0x40000, CRC(349c95cc) SHA1(8898eecf5918485ec683900520f123483077df28) )
20942097
2095   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* 3d objects */
2098   ROM_REGION16_BE( 0x80000, "point", 0 ) /* 3d objects */
20962099   ROM_LOAD16_BYTE( "wr1-pt0u.8j", 0x00000, 0x20000, CRC(7ec4cf6b) SHA1(92ec92567b9f7321efb4a3724cbcdba216eb22f9) )
20972100   ROM_LOAD16_BYTE( "wr1-pt0l.8d", 0x00001, 0x20000, CRC(58c14b73) SHA1(e34a26866cd870743e166669f7fa5915a82104e9) )
20982101
r243192r243193
21602163   ROM_LOAD16_BYTE( "sg1-gd1-u.1s", 0x80000, 0x40000, CRC(271db29b) SHA1(8b35fcf273b9aec28d4c606c41c0626dded697e1) )
21612164   ROM_LOAD16_BYTE( "sg1-gd1-l.3s", 0x80001, 0x40000, CRC(a6c4da96) SHA1(377dbf21a1bede01de16708c96c112abab4417ce) )
21622165
2163   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* 3d objects */
2166   ROM_REGION16_BE( 0x80000, "point", 0 ) /* 3d objects */
21642167   ROM_LOAD16_BYTE( "sg1-pt0-u.8j", 0x00000, 0x20000, CRC(160c3634) SHA1(485d20d6cc459f17d77682201dee07bdf76bf343) )
21652168   ROM_LOAD16_BYTE( "sg1-pt0-l.8d", 0x00001, 0x20000, CRC(b5a665bf) SHA1(5af6ec492f31395c0492e14590b025b120067b8d) )
21662169   ROM_LOAD16_BYTE( "sg1-pt1-u.8l", 0x40000, 0x20000, CRC(b63d3006) SHA1(78e78619766b0fd91b1e830cfb066495d6773981) )
r243192r243193
22092212   ROM_LOAD16_BYTE( "r911-gd1u.1s", 0x80000, 0x40000, CRC(17e5a61c) SHA1(272ebd7daa56847f1887809535362331b5465dec) )
22102213   ROM_LOAD16_BYTE( "r911-gd1l.3s", 0x80001, 0x40000, CRC(64df59a2) SHA1(1e9d0945b94780bb0be16803e767466d2cda07e8) )
22112214
2212   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* winrun91 - 3d objects */
2215   ROM_REGION16_BE( 0x80000, "point", 0 ) /* winrun91 - 3d objects */
22132216   ROM_LOAD16_BYTE( "r911-pt0u.8j", 0x00000, 0x20000, CRC(abf512a6) SHA1(e86288039d6c4dedfa95b11cb7e4b87637f90c09) ) /* Version on SYSTEM21B CPU only has R911 PTU @ 8W */
22142217   ROM_LOAD16_BYTE( "r911-pt0l.8d", 0x00001, 0x20000, CRC(ac8d468c) SHA1(d1b457a19a5d3259d0caf933f42b3a02b485867b) ) /* and R911 PTL @ 12W with rom type 27C020 */
22152218   ROM_LOAD16_BYTE( "r911-pt1u.8l", 0x40000, 0x20000, CRC(7e5dab74) SHA1(5bde219d5b4305d38d17b494b2e759f05d05329f) )
trunk/src/mame/drivers/naomi.c
r243192r243193
328328House of the Dead 2                             834-13636-01 21585   20 (64Mb)   not present 315-6213  not present
329329Idol Janshi Suchie-Pai 3                        841-0002C    21979   14 (64Mb)   ?           315-6213  317-5047-JPN   requires mahjong panel
330330Jambo! Safari (Rev A)                           840-0013C    22826A   8 (64Mb)   ?           315-6213  317-0264-COM
331Mars TV                                         840-0025C    22993   15 (64Mb)   present     315-6213  317-0274-JPN
331Mars TV                                         840-0025C    22993   15 (64Mb)   present     315-6213  317-0074-JPN
332332OutTrigger                                      840-0017C    22163   19 (64Mb)   ?           315-6213  317-0266-COM   requires regular 837-13551 and 837-13938 rotary JVS boards, and special panel
333333Power Stone                                     841-0001C    21597    8 (64Mb)   present     315-6213  317-5046-COM   joystick + 3 buttons
334334Power Stone 2                                   841-0008C    23127    9 (64Mb)   present     315-6213  317-5054-COM   joystick + 3 buttons
335Puyo Puyo Da!                                   841-0006C    22206   20 (64Mb)   ?           315-6213  317-5052-COM
335Puyo Puyo Da!                                   841-0006C    22206   20 (64Mb)   ?           315-6213  ?
336336Ring Out 4x4                                    840-0004C    21779   10 (64Mb)   present     315-6213  317-0250-COM   requires 2 JVS boards
337337Samba de Amigo (Rev B)                          840-0020C    22966B  16 (64Mb)   present     315-6213  317-0270-COM   will boot but requires special controller to play it
338338Sega Marine Fishing                             840-0027C    22221   10 (64Mb)   ?           315-6213  not present    ROM 3&4 not present. Requires 837-13844 JVS IO with all DIPSW Off and fishing controller
r243192r243193
341341Sega Tetris                                     840-0018C    22909    6 (64Mb)   present     315-6213  317-0268-COM
342342Slashout                                        840-0041C    23341   17 (64Mb)   ?           315-6213  317-0286-COM   joystick + 4 buttons
343343Spawn In the Demon's Hand (Rev B)               841-0005C    22977B  10 (64Mb)   ?           315-6213  317-5051-COM   joystick + 4 buttons
344Super Major League '99                          840-0012C    22059   21 (64Mb)   ?           315-6213  317-0259-COM
344Super Major League '99                          840-0012C    22059   21 (64Mb)   ?           315-6213  ?
345345The Typing of the Dead (Rev A)                  840-0026C    23021A  20 (64Mb)   present     315-6213  not present
346346Touch de UNO! / Unou Nouryoku Check Machine     840-0008C    22073    4 (64Mb)   present     315-6213  317-0255-JPN   requires 837-13844 JVS IO with DIPSW 5 On, ELO AccuTouch-compatible touch screen controller and special printer.
347347Toy Fighter / Waffupu                           840-0011C    22035   10 (64Mb)   present     315-6212  317-0257-COM   joystick + 3 buttons
r243192r243193
349349Virtua NBA (original)                           840-0021C    22949   21 (64Mb)   present     315-6213  317-0271-COM
350350Virtua Striker 2 Ver. 2000 (Rev C)              840-0010C    21929C  14 (64Mb)*  present     315-6213  317-0258-COM   joystick + 3 buttons *(+1x 32Mb)
351351Virtua Tennis / Power Smash                     840-0015C    22927   11 (64Mb)   present     315-6213  317-0263-COM
352Virtual On Oratorio Tangram M.S.B.S. ver5.66    840-0028C    23198   13 (64Mb)   ?           315-6213  317-0279-COM
353352Zombie Revenge                                  840-0003C    21707   19 (64Mb)   ?           315-6213  317-0249-COM   joystick + 3 buttons
354353
355354
r243192r243193
513512Derby Owners Club World Edition (Rev C)         840-0088C  22336C   7 (128Mb)  315-6319A  315-6213  not present
514513Derby Owners Club World Edition (Rev D)         840-0088C  22336D   7 (128Mb)  315-6319A  315-6213  not present   2 MaskROM are different from Rev C
515514Giga Wing 2                                     841-0014C  22270    5 (128Mb)  315-6319A  315-6213  317-5064-COM
516Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  317-5070-COM
515Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  ?
517516Moero Justice Gakuen / Project Justice (Rev A)  841-0015C  23548A  11 (128Mb)  315-6319A  315-6213  317-5065-COM
518517MushiKing - The King Of Beetle 2K5 1ST          840-0158C  24286    7 (128Mb)  315-6319A  315-6213  not present   requires 610-0669 barcode reader
519518Oinori-daimyoujin Matsuri                       840-0126B  24053    5 (128Mb)  315-6319A  315-6213  not present   requires 837-14274 "G2 EXPANSION BD" (similar to hopper 837-14381 but with ARC NET chip)
r243192r243193
522521Star Horse (satellite)                          840-0056C  23627    6 (128Mb)* 315-6319   315-6213  not present   * +1 (64Mb), requires 837-13785 ARCNET&IO BD
523522Star Horse Progress (satellite) (Rev A)         840-0123C  24122A   7 (128Mb)  315-6319A  315-6213  not present   requires 837-13785 ARCNET&IO BD
524523The King of Route 66 (Rev A)                    840-0087C  23819A  10 (128Mb)  315-6319A  315-6213  not present
525Virtua Fighter 4                                840-0080C  23785   11 (128Mb)  ?          ?         317-0324-COM
526Virtua Striker 3                                840-0061C  23663   11 (128Mb)  315-6319A  315-6213  317-0310-COM
527524Virtua Striker 3 (Rev B)                        840-0061C  23663B  11 (128Mb)  315-6319A  315-6213  317-0310-COM
525Virtua Striker 3 (Rev C)                        840-0061C  23663C  11 (128Mb)  315-6319A  315-6213  317-0310-COM
528526Wave Runner GP                                  840-0064C  24059    6 (128Mb)  315-6319A  315-6213  not present
529527Wild Riders                                     840-0046C  23622   10 (128Mb)  315-6319A  315-6213  317-0301-COM
530528WWF Royal Rumble                                840-0040C  22261    8 (128Mb)  315-6319   315-6213  317-0285-COM
r243192r243193
24002398   PORT_INCLUDE( naomi_mie )
24012399   PORT_INCLUDE( naomi_debug )
24022400
2403   PORT_START("OUTPUT")
2404   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_OUTPUT) PORT_CHANGED_MEMBER(DEVICE_SELF, naomi_state,naomi_mp_w, NULL)
2401   PORT_START("P1") /* inputs are all there, it needs a mux write mechanism of some sort ... */
2402   PORT_DIPNAME( 0x0100, 0x0000, "SYSA" )
2403   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2404   PORT_DIPSETTING(    0x0100, DEF_STR( On ) )
2405   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) )
2406   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2407   PORT_DIPSETTING(    0x0200, DEF_STR( On ) )
2408   PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unknown ) )
2409   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2410   PORT_DIPSETTING(    0x0400, DEF_STR( On ) )
2411   PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Unknown ) )
2412   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2413   PORT_DIPSETTING(    0x0800, DEF_STR( On ) )
2414   PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) )
2415   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2416   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
2417   PORT_DIPNAME( 0x2000, 0x0000, DEF_STR( Unknown ) )
2418   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2419   PORT_DIPSETTING(    0x2000, DEF_STR( On ) )
2420   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
2421   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2422   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
2423   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Unknown ) )
2424   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
2425   PORT_DIPSETTING(    0x8000, DEF_STR( On ) )
24052426
2406   PORT_START("P1")
2407   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL )  PORT_CUSTOM_MEMBER(DEVICE_SELF, naomi_state,naomi_mp_r, "KEY1\0KEY2\0KEY3\0KEY4\0KEY5")
2408   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED )
2427   PORT_START("KEY1")
2428   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) //TODO: mahjong panel test & service buttons are presumably here
24092429
2410   PORT_START("KEY1")
2411   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
2412   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
2413   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
2414   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_FLIP_FLOP )
2415   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
2416   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
2417   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
2418   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_LAST_CHANCE )
24192430   PORT_START("KEY2")
24202431   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
24212432   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
r243192r243193
24272438   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
24282439   PORT_START("KEY3")
24292440   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
2430   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_BET )
2441   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
24312442   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
24322443   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
24332444   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
r243192r243193
24542465   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
24552466INPUT_PORTS_END
24562467
2457static INPUT_PORTS_START( suchie3 )
2458   PORT_INCLUDE( naomi_mp )
2459   PORT_MODIFY("P1")
2460   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL )  PORT_CUSTOM_MEMBER(DEVICE_SELF, naomi_state,naomi_mp_r, "KEY5\0KEY2\0KEY3\0KEY4\0KEY1")
2461INPUT_PORTS_END
2462
24632468// Atomiswave - inputs are read as standard Dreamcast controllers.
24642469// Controller bit patterns:
24652470//
r243192r243193
26182623MACHINE_CONFIG_END
26192624
26202625static MACHINE_CONFIG_DERIVED( naomi_base, naomi_aw_base )
2621   MCFG_MIE_ADD("mie", XTAL_32MHz/2, "maple_dc", 0, 0, 0, 0, ":MIE.3", 0, ":MIE.5", 0, 0) // Actual frequency unknown, most likely 1/2 of 32MHz XTAL or even 2/3 (yes, 21MHz Z80 core)
2626   MCFG_MIE_ADD("mie", 4000000, "maple_dc", 0, 0, 0, 0, ":MIE.3", 0, ":MIE.5", 0, 0) // Actual frequency unknown
26222627   MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "mie", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT")
26232628   MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("mie_eeprom")
26242629
r243192r243193
26462651 */
26472652
26482653static MACHINE_CONFIG_DERIVED( naomim1, naomi_base )
2649   MCFG_NAOMI_M1_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
2654   MCFG_NAOMI_M1_BOARD_ADD("rom_board", ":rom_key", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
26502655MACHINE_CONFIG_END
26512656
26522657/*
r243192r243193
26542659 */
26552660
26562661static MACHINE_CONFIG_DERIVED( naomim2, naomi_base )
2657   MCFG_NAOMI_M2_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
2662   MCFG_NAOMI_M2_BOARD_ADD("rom_board", ":rom_key", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
26582663MACHINE_CONFIG_END
26592664
26602665/*
r243192r243193
30973102   ROM_LOAD("mpr-23208.ic11", 0x5800000, 0x0800000, CRC(b9494f4b) SHA1(2f35b25edf5210a82d4b67e639eeae11440d065a) )
30983103   ROM_LOAD("mpr-23209.ic12s",0x6000000, 0x0800000, CRC(560188c0) SHA1(77f14c9a031c6e5414ffa854d20c40115361d715) )
30993104
3100   // 841-0012    2000     317-5060-COM   Naomi
3101   ROM_PARAMETER( "rom_board:segam2crypt:key", "000e2010" )
3105   ROM_REGION( 4, "rom_key", 0 )
3106   ROM_LOAD( "cspike-key.bin", 0, 4, CRC(a3e9c6d0) SHA1(c098eae7aee716fbdca39f0eb1f55bd54d398394) )
31023107ROM_END
31033108
31043109/*
r243192r243193
31413146   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31423147   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31433148
3144   // 841-0011    2000     317-5059-COM   Naomi
3145   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
3149   ROM_REGION( 4, "rom_key", 0 )
3150   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
31463151ROM_END
31473152
31483153// ver 000804
r243192r243193
31603165   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31613166   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31623167
3163   // 841-0011    2000     317-5059-COM   Naomi
3164   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
3168   ROM_REGION( 4, "rom_key", 0 )
3169   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
31653170ROM_END
31663171
31673172// ver 000802
r243192r243193
31793184   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31803185   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31813186
3182   // 841-0011    2000     317-5059-COM   Naomi
3183   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
3187   ROM_REGION( 4, "rom_key", 0 )
3188   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
31843189ROM_END
31853190
31863191/*
r243192r243193
32203225   ROM_LOAD("mpr-23426.ic7",   0x3800000, 0x0800000, CRC(7f91b13f) SHA1(2d534f77291ebfedc011bf0e803a1b9243fb477f) )
32213226   ROM_LOAD("mpr-23427.ic8",   0x4000000, 0x0800000, CRC(5851d525) SHA1(1cb1073542d75a3bcc0d363ed31d49bcaf1fd494) )
32223227
3223   // 840-0044    2000     317-0289-COM   Naomi
3224   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08103347" )
3228   ROM_REGION( 4, "rom_key", 0 )
3229   ROM_LOAD( "csmash-key.bin", 0, 4, CRC(21b1cd6f) SHA1(a74eef5e3475cc6952f4ffe31579769a854b62a9) )
32253230ROM_END
32263231
32273232ROM_START( csmasho )
r243192r243193
32393244   ROM_LOAD("mpr-23426.ic7", 0x3800000, 0x0800000, CRC(7f91b13f) SHA1(2d534f77291ebfedc011bf0e803a1b9243fb477f) )
32403245   ROM_LOAD("mpr-23427.ic8", 0x4000000, 0x0800000, CRC(5851d525) SHA1(1cb1073542d75a3bcc0d363ed31d49bcaf1fd494) )
32413246
3242   // 840-0044    2000     317-0289-COM   Naomi
3243   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08103347" )
3247   ROM_REGION( 4, "rom_key", 0 )
3248   ROM_LOAD( "csmasho-key.bin", 0, 4, CRC(21b1cd6f) SHA1(a74eef5e3475cc6952f4ffe31579769a854b62a9) )
32443249ROM_END
32453250
32463251/*
r243192r243193
32693274   ROM_LOAD("mpr-23522.ic9", 0x4800000, 0x0800000, CRC(7ae6716e) SHA1(658b794ae6e3898885524582a207faa1076a65ca) )
32703275   ROM_LOAD("mpr-23523.ic10",0x5000000, 0x0800000, CRC(c91efb67) SHA1(3d79870551310da7a641858ffec3840714e9cc22) )
32713276
3272   // 841-0016    2000     317-5066-COM   Naomi
3273   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b64d0" )
3277   ROM_REGION( 4, "rom_key", 0 )
3278   ROM_LOAD( "deathcox-key.bin", 0, 4, CRC(aa534c8a) SHA1(fcc45e477c646b51afe7c4168d7246964a1f23b5) )
32743279ROM_END
32753280
32763281/*
r243192r243193
33353340   ROM_LOAD("mpr-22119.ic20s",0xa000000, 0x0800000, CRC(d608fa86) SHA1(54c8107cccec8cbb536f13cda5b220b7972190b7) )
33363341   ROM_LOAD("mpr-22120.ic21s",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) )
33373342
3338   // 841-0003    1999     317-5048-COM   Naomi
3339   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0008ad01" )
3343   ROM_REGION( 4, "rom_key", 0 )
3344   ROM_LOAD( "doa2-key.bin", 0, 4, CRC(43f97c96) SHA1(7d1e6fcca3ca936f33d59d57834c3e4ff74f587d) )
33403345
33413346   // on-cart X76F100 eeprom contents
33423347   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243192r243193
34073412   ROM_LOAD("mpr-22119.ic20s",0xa000000, 0x0800000, CRC(d608fa86) SHA1(54c8107cccec8cbb536f13cda5b220b7972190b7) )
34083413   ROM_LOAD("mpr-22120.ic21s",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) )
34093414
3410   // 841-0003    1999     317-5048-COM   Naomi
3411   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0008ad01" )
3415   ROM_REGION( 4, "rom_key", 0 )
3416   ROM_LOAD( "doa2m-key.bin", 0, 4, CRC(43f97c96) SHA1(7d1e6fcca3ca936f33d59d57834c3e4ff74f587d) )
34123417
34133418   // on-cart X76F100 eeprom contents
34143419   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243192r243193
34643469   ROM_LOAD("mpr-22097.ic13s", 0x6800000, 0x0800000, CRC(f1dedac5) SHA1(9d4499cbafe80dd0b36be617de7994a96e1e9a01) )
34653470   ROM_LOAD("mpr-22098.ic14s", 0x7000000, 0x0800000, CRC(f9824d2e) SHA1(f20f8cc2b1bef9077ede1cb874da8f2a335d39de) )
34663471
3467   // 840-0016    1999     317-0262-JPN   Naomi
3468   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fee35" )
3472   ROM_REGION( 4, "rom_key", 0 )
3473   ROM_LOAD( "derbyoc-key.bin", 0, 4, CRC(bc568260) SHA1(6dc4923a730bc0380490519c82f1443226365c3a) )
34693474ROM_END
34703475
34713476ROM_START( derbyocw )
r243192r243193
34823487   ROM_LOAD( "mpr-22337.ic6", 0x5800000, 0x1000000, CRC(87ca3a2f) SHA1(2ffc01597107eb60dfa7aa49d51f203b51a44334) )
34833488   ROM_LOAD( "mpr-22338.ic7", 0x6800000, 0x1000000, CRC(4bda7303) SHA1(db27d91ef811d741cfdb5c0196e61be722c2f5bd) )
34843489
3485   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3490   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
34863491ROM_END
34873492
34883493ROM_START( drbyocwc )
r243192r243193
34993504   ROM_LOAD( "mpr-22333.ic6", 0x5800000, 0x1000000, CRC(96f324aa) SHA1(bc41e2097c1841771d786ba9ad1a31df1494a856) )
35003505   ROM_LOAD( "mpr-22334.ic7", 0x6800000, 0x1000000, CRC(5389b05a) SHA1(e206e4d82d7b1a59c33043ec0812eb69be08d9b3) )
35013506
3502   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3507   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
35033508ROM_END
35043509
35053510/*
r243192r243193
35273532   ROM_LOAD( "mpr-22304.ic10", 0x9800000, 0x1000000, CRC(46c1fb1f) SHA1(6daca76a75df3501f77e473eb065d48804fcc64a) )
35283533   ROM_LOAD( "mpr-22305.ic11", 0xa800000, 0x1000000, CRC(027d0e7b) SHA1(e3c874e60cabb6f9ce686696d9055a0c0d5289ae) )
35293534
3530   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3535   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
35313536ROM_END
35323537
35333538/*
r243192r243193
36063611   ROM_LOAD("mpr-21573.ic20s", 0xa000000, 0x0800000, CRC(5d822e63) SHA1(8412980b288531c294d5cf9a6394aa0b9503d7df) )
36073612   ROM_LOAD("mpr-21574.ic21s", 0xa800000, 0x0800000, CRC(d794a42c) SHA1(a79c7818c6ec993e718494b1d5407eb270a29abe) )
36083613
3609   // 840-0001    1998     317-0246-JPN   Naomi
3610   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080e6ae1" )
3614   ROM_REGION( 4, "rom_key", 0 )
3615   ROM_LOAD( "dybbnao-key.bin", 0, 4, CRC(63c5a3d5) SHA1(e813197f84dc6bb50b436f8e710d14d77a84e0ec) )
36113616ROM_END
36123617
36133618/*
r243192r243193
36703675   ROM_LOAD("mpr-22139.ic18s", 0x9000000, 0x0800000, CRC(92faa2ca) SHA1(4953f0219c3ae62de0a89473cb7b9dd30b33fcfb) )
36713676   ROM_LOAD("mpr-22140.ic19s", 0x9800000, 0x0800000, CRC(4cb54893) SHA1(a99b39cc3c82c3cf90f794bb8c8ba60638a6f921) )
36723677
3673   // 840-0019    1999     317-0269-JPN   Naomi
3674   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0804ae71" )
3678   ROM_REGION( 4, "rom_key", 0 )
3679   ROM_LOAD( "dybb99-key.bin", 0, 4, CRC(90263797) SHA1(83649c8b3e562bee1f08663e59c5ba8f404ed36c) )
36753680ROM_END
36763681
36773682ROM_START( smlg99 )
r243192r243193
37033708   ROM_LOAD( "mpr-22057.ic20s", 0xa000000, 0x800000, CRC(a056c109) SHA1(637e80c2d605851265430b0fa771a4ad5233be8a) )
37043709   ROM_LOAD( "mpr-22058.ic21s", 0xa800000, 0x800000, CRC(f16edaa0) SHA1(e093f5594df43c592a9acd45002ecc65035c2435) )
37053710
3706   // 840-0012    1999     317-0259-COM   Naomi
3707   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08048a01" )
3711   ROM_REGION( 4, "rom_key", 0 )
3712   ROM_LOAD( "smlg99-key.bin", 0, 4, CRC(90263797) SHA1(83649c8b3e562bee1f08663e59c5ba8f404ed36c) )
37083713ROM_END
37093714
37103715/*
r243192r243193
37453750   ROM_LOAD("mpr-21900.ic20s", 0xa000000, 0x0800000, CRC(81901130) SHA1(1573b5c4360e29ba1a4b4901af49d5399fa1e635) )
37463751   ROM_LOAD("mpr-21901.ic21s", 0xa800000, 0x0800000, CRC(266a3eea) SHA1(795ecc5589a0152b9cf1e03e454ed1ea01501942) )
37473752
3748   // 834-13842   1999     317-0254-COM   Naomi
3749   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080e8f84" )
3753   ROM_REGION( 4, "rom_key", 0 )
3754   ROM_LOAD( "f355-key.bin", 0, 4, CRC(7d1431ab) SHA1(38958860241c600db941b47294bf3ca3273d0df5) )
37503755
37513756   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
37523757   ROM_LOAD( "epr-21867.bin", 0x000000, 0x010000, CRC(4f93a2a0) SHA1(875907e7fcfc44850e2c60c12268ac61c742f217) )
r243192r243193
37803785   ROM_LOAD( "mpr-22846.ic20s", 0xa000000, 0x800000, CRC(d4148f39) SHA1(b6598ce52bcaa42805c581de326c953d27c1b2b4) )
37813786   ROM_LOAD( "mpr-22847.ic21s", 0xa800000, 0x800000, CRC(955ad42e) SHA1(e396ca02b5786557434632c4fac56af3a4a9f8ce) )
37823787
3783   // 834-13950   1999     317-0267-COM   Naomi
3784   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0806efd4" )
3788   ROM_REGION( 4, "rom_key", 0 )
3789   ROM_LOAD( "f355twin-key.bin", 0, 4, CRC(7d915a40) SHA1(ea441c10673b79237a4e7368948cfad31ed45a26) )
37853790ROM_END
37863791
37873792// There is also a development cart (171-7885A). Content is the same.
r243192r243193
38133818   ROM_LOAD( "mpr-23397.ic20s", 0xa000000, 0x800000, CRC(28d2caf6) SHA1(67a3bc19abccf7f211c3aae67e751815857bd564) )
38143819   ROM_LOAD( "mpr-23398.ic21s", 0xa800000, 0x800000, CRC(ea4d4d2a) SHA1(3dc9c7164516ae7f3b988c088ab819d8fd40d75e) )
38153820
3816   // 840-0042    2001     317-0287-COM   Naomi
3817   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081666c6" )
3821   ROM_REGION( 4, "rom_key", 0 )
3822   ROM_LOAD( "f355twn2-key.bin", 0, 4, CRC(784fab7a) SHA1(5d9687876b390d35309c0b1404f5717daa533286) )
38183823ROM_END
38193824
38203825ROM_START( alpiltdx )
r243192r243193
38353840   ROM_LOAD( "mpr-21737.ic10", 0x5000000, 0x800000, CRC(260aaa98) SHA1(d1082587afe9d79f286df8b107a553ee51c27643) )
38363841   ROM_LOAD( "mpr-21738.ic11", 0x5800000, 0x800000, CRC(95a592e8) SHA1(862dce467e8805381bab001df68262f1baf3c498) )
38373842
3838   // 834-?????   1999     317-0251-COM   Naomi
3839   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08070e41" )
3843   ROM_REGION( 4, "rom_key", 0 )
3844   ROM_LOAD( "alpiltdx-key.bin", 0, 4, CRC(bb539511) SHA1(dea206e7db23fdabf7b957104ddd1499eff509ff) )
38403845
38413846   // on-cart X76F100 eeprom contents
38423847   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243192r243193
38613866   ROM_LOAD( "mpr-21737.ic10", 0x5000000, 0x800000, CRC(260aaa98) SHA1(d1082587afe9d79f286df8b107a553ee51c27643) )
38623867   ROM_LOAD( "mpr-21738.ic11", 0x5800000, 0x800000, CRC(95a592e8) SHA1(862dce467e8805381bab001df68262f1baf3c498) )
38633868
3864   // 840-0005    1999     317-0251-COM   Naomi
3865   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08070e41" )
3869   ROM_REGION( 4, "rom_key", 0 )
3870   ROM_LOAD( "alpilota-key.bin", 0, 4, CRC(bb539511) SHA1(dea206e7db23fdabf7b957104ddd1499eff509ff) )
38663871ROM_END
38673872
38683873ROM_START( hotd2 )
r243192r243193
38963901   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
38973902   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
38983903
3899   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3904   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
39003905ROM_END
39013906
39023907ROM_START( hotd2o )
r243192r243193
39303935   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
39313936   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
39323937
3933   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3938   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
39343939ROM_END
39353940
39363941ROM_START( hotd2p )
r243192r243193
39643969   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
39653970   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
39663971
3967   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
3972   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
39683973ROM_END
39693974
39703975/*
r243192r243193
39994004   ROM_LOAD("mpr-21830.ic10", 0x5000000, 0x0800000, CRC(e01ceb86) SHA1(dd5703d7712cfc0053bddfff63e78dda372b6ff2) )
40004005   ROM_LOAD("mpr-21831.ic11", 0x5800000, 0x0800000, CRC(751848d0) SHA1(9c2267fd3c6f9ea5f2679bb2ca20d511a49b2845) )
40014006
4002   // 840-0007    1999     317-0253-JPN   Naomi
4003   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08074a61" )
4007   ROM_REGION( 4, "rom_key", 0 )
4008   ROM_LOAD( "ggram2-key.bin", 0, 4, CRC(14283fd8) SHA1(c928382e512e9fb685436020f88b8245b7c60d41) )
40044009ROM_END
40054010
40064011/*
r243192r243193
40674072
40684073   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
40694074
4070   // 840-0039    2000
4071   ROM_PARAMETER( ":rom_board:key", "3f5c807f" )
4075   ROM_REGION( 4, "rom_key", 0 )
4076   ROM_LOAD( "gram2000-key.bin", 0, 4, CRC(179314d9) SHA1(3dbbc04e9ff62800d08c4a239af3a83252a28dc0) )
40724077ROM_END
40734078
40744079ROM_START( tduno )
r243192r243193
40894094   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
40904095   ROM_LOAD( "x76f100.ic37", 0x000000, 0x000084, CRC(c79251d5) SHA1(3e70bbbb6d28bade7eec7e27d716463045656f98) )
40914096
4092   // 840-0008    1999     317-0255-JPN   Naomi
4093   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08028ea5" )
4097   ROM_REGION( 4, "rom_key", 0 )
4098   ROM_LOAD( "tduno.key",    0x000000, 0x000004, CRC(217ce9d0) SHA1(39d71a84b2769cd0c1521ddf1c617c18f577020c) )
40944099ROM_END
40954100
40964101ROM_START( tduno2 )
r243192r243193
41094114
41104115   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
41114116
4112   // 840-0022    2000
4113   ROM_PARAMETER( ":rom_board:key", "2f6f0f8d" )
4117   ROM_REGION( 4, "rom_key", 0 )
4118   ROM_LOAD( "tduno2.key",   0x000000, 0x000004, CRC(8e0f0f3b) SHA1(914d3db8746c806d559539cc0851169161d32c04) )
41144119ROM_END
41154120
41164121ROM_START( mtkob2 )
r243192r243193
41284133
41294134   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
41304135
4131   // 840-0150    2003
4132   ROM_PARAMETER( ":rom_board:key", "3892fb3a" )
4136   ROM_REGION( 4, "rom_key", 0 )
4137   ROM_LOAD( "mtkob2-key.bin", 0x000000, 0x000004, CRC(db088208) SHA1(14d65ad2555183a445abcd93907c85df4032b41d) )
41334138ROM_END
41344139
41354140ROM_START( mushi2k5 )
r243192r243193
41464151   ROM_LOAD( "mpr-24281.ic6",  0x5800000, 0x1000000, CRC(39133c32) SHA1(09ea8c1a98ba0fac36e18ae14ed5302feaeb89ca) )
41474152   ROM_LOAD( "mpr-24282.ic7",  0x6800000, 0x1000000, CRC(9aa4ad5a) SHA1(2d81f99a579477c5db725f71c51f18afc15abce7) )
41484153
4149   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown // or M1?
4154   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
41504155ROM_END
41514156
41524157ROM_START( crackndj )
r243192r243193
41664171   ROM_LOAD( "mpr-23533.ic9",  0x8800000, 0x1000000, CRC(fc909c00) SHA1(9cf22a97ea272c4586f3942aefdb803bd0e6ede7) )
41674172   ROM_LOAD( "mpr-23534.ic10", 0x9800000, 0x1000000, CRC(62ed85b6) SHA1(b88336bc6115c92a839981cb0c0d0a67b1f7eda5) )
41684173
4169   // 840-0043    2000     317-0288-COM   Naomi
4170   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081c2347" )
4174   ROM_REGION( 4, "rom_key", 0 )
4175   ROM_LOAD( "crackndj-key.bin", 0, 4, CRC(6269265a) SHA1(e2ab31b0058eb130d8f54d30e86d569687f9a068) )
41714176ROM_END
41724177
41734178ROM_START( crakndj2 )
r243192r243193
42004205   ROM_LOAD( "rom19.ic19s",  0x9800000, 0x800000, CRC(31f816ba) SHA1(354f8271eef20eb131f83fb9641002cfcd31c8cd) )
42014206   ROM_LOAD( "rom20.ic20s",  0xa000000, 0x800000, CRC(aabcd580) SHA1(9455e218ab381c7ad5adb2884da39ca7948169d5) )
42024207
4203   // 840-0068    2001     317-0311-COM   Naomi
4204   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08428247" )
4208   ROM_REGION( 4, "rom_key", 0 )   // 317-0311-COM
4209   ROM_LOAD( "crackndj2-key.bin", 0x000000, 0x000004, CRC(b357a848) SHA1(15b5f89583ec2bc65298387a2b8d8e60e71f1617) )
42054210ROM_END
42064211
42074212ROM_START( samba2k )
r243192r243193
42224227   ROM_LOAD( "mpr-23598.ic10", 0x09800000, 0x1000000, CRC(e06ee3dd) SHA1(21985e45e1ab5e3a79dd52492a582324a1a36d56) )
42234228   ROM_LOAD( "mpr-23599.ic11", 0x0a800000, 0x1000000, CRC(1fd2e792) SHA1(6f299e527be529f85d0e8b4ce0e7a06ac0d25fe9) )
42244229
4225   // 840-0047    2000     317-0295-COM   Naomi
4226   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081702cf" )
4230   ROM_REGION( 4, "rom_key", 0 )
4231   ROM_LOAD( "samba2k-key.bin", 0, 4, CRC(01c0d74a) SHA1(4461cfd761919ba4bc6f1d1839a880f11eaf8d0f) )
42274232ROM_END
42284233
42294234ROM_START( alienfnt )
r243192r243193
42384243   ROM_LOAD( "mpr-23584.ic4",   0x3800000, 0x1000000, CRC(8d444756) SHA1(89c480f9ed1239c8ae565c85fa0fd50324264b20) )
42394244   ROM_LOAD( "mpr-23585.ic5",   0x4800000, 0x1000000, CRC(883a6482) SHA1(e3145710df793b7fd67f02707904416210a71978) )
42404245
4241   // 840-0048    2001     317-0293-COM   Naomi
4242   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08174343" )
4246   ROM_REGION( 4, "rom_key", 0 )
4247   ROM_LOAD( "alienfnt-key.bin", 0x000000, 0x000004, CRC(0cac6605) SHA1(7a050f13e3b9a10d6cdb851a8c67006f6548c60a) )
42434248ROM_END
42444249
42454250ROM_START( alienfnta )
r243192r243193
42544259   ROM_LOAD( "mpr-23584.ic4",   0x3800000, 0x1000000, CRC(8d444756) SHA1(89c480f9ed1239c8ae565c85fa0fd50324264b20) )
42554260   ROM_LOAD( "mpr-23585.ic5",   0x4800000, 0x1000000, CRC(883a6482) SHA1(e3145710df793b7fd67f02707904416210a71978) )
42564261
4257   // 840-0048    2001     317-0293-COM   Naomi
4258   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08174343" )
4262   ROM_REGION( 4, "rom_key", 0 )
4263   ROM_LOAD( "alienfnt-key.bin", 0x000000, 0x000004, CRC(0cac6605) SHA1(7a050f13e3b9a10d6cdb851a8c67006f6548c60a) )
42594264ROM_END
42604265
42614266/*
r243192r243193
42864291   ROM_LOAD("mpr-23354.ic13s",0x6800000, 0x0800000, CRC(cea127f7) SHA1(11f12472ebfc93eb72b764c780e30afd4812dbe9) )
42874292   ROM_LOAD("mpr-23355.ic14s",0x7000000, 0x0800000, CRC(e809685f) SHA1(dc052b4eb4fdcfdc22c4807316ce34ee7a0d58a6) )
42884293
4289   // 841-0013    2000     317-5063-COM   Naomi
4290   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00076110" )
4294   ROM_REGION( 4, "rom_key", 0 )
4295   ROM_LOAD( "ggx-key.bin", 0, 4, CRC(455a831b) SHA1(1834fc714224ac990a0677e8925493e92a4b5e5e) )
42914296ROM_END
42924297
42934298/*
r243192r243193
43324337   ROM_LOAD("mpr-23714.ic10",0x5000000, 0x0800000, CRC(da462c44) SHA1(ca450b6c07f939f96eba7b44c45b4e38abd598aa) )
43334338   ROM_LOAD("mpr-23715.ic11",0x5800000, 0x0800000, CRC(c750abbd) SHA1(2a5bedc2b21cd3f991c7145ccfd8c7a9e7f647ae) )
43344339
4335   // HMG016007   2001     317-5071-COM   Naomi
4336   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00038510" )
4340   ROM_REGION( 4, "rom_key", 0 )
4341   ROM_LOAD( "hmgeo-key.bin", 0, 4, CRC(78411d2f) SHA1(9809ef35406ea48639cf78d5d366069a06a411f0) )
43374342ROM_END
43384343
43394344/*
r243192r243193
43714376   ROM_LOAD("mpr-22274.ic4", 0x3800000, 0x1000000, CRC(f8daaaf3) SHA1(8854d3f8e3d55715ede33ee918b641e251f752b4) )
43724377   ROM_LOAD("mpr-22275.ic5", 0x4800000, 0x1000000, CRC(61aa1521) SHA1(7d9f5790e72a9151d128ac7887e236526fdf72a0) )
43734378
4374   // 841-0014    2000     317-5064-COM   Naomi
4375   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b25d0" )
4379   ROM_REGION( 4, "rom_key", 0 )
4380   ROM_LOAD( "gwing2-key.bin", 0, 4, CRC(433132ce) SHA1(27f6e6ba2dd28c777317ff085432c2d43b93a603) )
43764381ROM_END
43774382
43784383/*
r243192r243193
44214426   ROM_LOAD("mpr-21992.ic13s",0x6800000, 0x0800000, CRC(599a2fb8) SHA1(2a0007064ad2ee1e1a0fda1d5676df4ff19a9f2f) )
44224427   ROM_LOAD("mpr-21993.ic14s",0x7000000, 0x0400000, CRC(fb28cf0a) SHA1(d51b1d4514a93074d1f77bd1bc5995739604cf56) )
44234428
4424   // 841-0002    1999     317-5047-JPN   Naomi
4425   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000368e1" )
4429   ROM_REGION( 4, "rom_key", 0 )
4430   ROM_LOAD( "suchie3-key.bin", 0, 4, CRC(592b5204) SHA1(ba18a5302ea271f58617a9793dfb85a0123080c8) )
44264431ROM_END
44274432
44284433/*
r243192r243193
44514456   ROM_LOAD("mpr-22071.ic11", 0x5800000, 0x0800000, CRC(1ab1f1ab) SHA1(bb8fa8d5a681115a82e9598ebe599b106f7aae9d) )
44524457   ROM_LOAD("mpr-22072.ic12s",0x6000000, 0x0800000, CRC(cb8d2634) SHA1(03ac8fb3a1acb1f8e32d9325c4da42417752f934) )
44534458
4454   // 841-0004    1999     317-5050-JPN   Naomi     seems not used by game
4455   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0")
4459   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
44564460ROM_END
44574461
44584462/*
r243192r243193
44934497
44944498   ROM_COPY( "rom_board", 0x1200000, 0x400000, 0x400000 )
44954499
4496   // 841-0007-02 2000
4497   ROM_PARAMETER( ":rom_board:key", "7c6e8bc1" )
4500   ROM_REGION( 4, "rom_key", 0 )
4501   ROM_LOAD( "mvsc2-key.bin", 0, 4, CRC(76f095b4) SHA1(773fd67e1eb471a989b3ee6e969a3d33bf61e779) )
44984502ROM_END
44994503
45004504/* toy fighter - 1999 sega */
r243192r243193
45174521   ROM_LOAD("mpr-22033.ic9", 0x4800000, 0x0800000, CRC(5fe5586e) SHA1(3ff41ae1f81469597684faadd88e62b5e0634352) )
45184522   ROM_LOAD("mpr-22034.ic10",0x5000000, 0x0800000, CRC(3aa5ce5e) SHA1(f00a906235e4522d6fc2ac771324114346875314) )
45194523
4520   // 840-0011    1999     317-0257-COM   Naomi
4521   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0802ca85" )
4524   ROM_REGION( 4, "rom_key", 0 )
4525   ROM_LOAD( "toyfight-key.bin", 0, 4, CRC(8e074319) SHA1(b1b88bc57b81c08853d4aa77a5da48e293da4f42) )
45224526ROM_END
45234527
45244528/* Crazy Taxi */
r243192r243193
45424546   ROM_LOAD( "mpr-21682.ic14s", 0x7000000, 0x800000, CRC(54c0290e) SHA1(6e07ab6e95c29a2aabed0ba1a7af0d7d605e0309) )
45434547   ROM_LOAD( "mpr-21683.ic15s", 0x7800000, 0x800000, CRC(ac8a27e0) SHA1(8e71d853a102dd6c164d5326e6d157ccfb8c7b36) )
45444548
4545   // 840-0002    1999     317-0248-COM   Naomi
4546   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080d2f45" )
4549   ROM_REGION( 4, "rom_key", 0 )
4550   ROM_LOAD( "crzytaxi-key.bin", 0, 4, CRC(3d36c13d) SHA1(746e82e7f1d6f4629dde00fb6b32943741b6ec70) )
45474551ROM_END
45484552
45494553/* Jambo! Safari */
r243192r243193
45624566   ROM_LOAD( "mpr-22824.ic7",  0x3800000, 0x800000, CRC(cc55304a) SHA1(e548d8de83469e5816c55dbbb00afbb894282fd6) )
45634567   ROM_LOAD( "mpr-22825.ic8",  0x4000000, 0x800000, CRC(85bada10) SHA1(b6e15d8f1d6bca12ffa4816ed0393c04ca500fba) )
45644568
4565   // 840-0013    1999     317-0264-COM   Naomi
4566   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fab95" )
4569   ROM_REGION( 4, "rom_key", 0 )
4570   ROM_LOAD( "jambo-key.bin", 0, 4, CRC(e78e9ac8) SHA1(677d7f21c238e12362ad65d6496f285d688fc3a9) )
45674571ROM_END
45684572
45694573/* 18 Wheeler (deluxe) (Rev A) */
r243192r243193
45944598   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
45954599   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
45964600
4597   // 840-0023    2000     317-0273-COM   Naomi
4598   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
4601   ROM_REGION( 4, "rom_key", 0 )
4602   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
45994603
46004604   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46014605   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243192r243193
46364640   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
46374641   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
46384642
4639   // 840-0023    2000     317-0273-COM   Naomi
4640   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
4643   ROM_REGION( 4, "rom_key", 0 )
4644   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
46414645
46424646   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46434647   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243192r243193
46784682   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
46794683   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
46804684
4681   // 840-0023    2000     317-0273-COM   Naomi
4682   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
4685   ROM_REGION( 4, "rom_key", 0 )
4686   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
46834687
46844688   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46854689   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243192r243193
47114715   ROM_LOAD( "mpr-22991.ic14s", 0x7000000, 0x800000, CRC(0c20f313) SHA1(ac335d3015ef348c91319ae0e98b79a60e92f452) )
47124716   ROM_LOAD( "mpr-22992.ic15s", 0x7800000, 0x800000, CRC(5eb6c4c6) SHA1(5dc1bced7ebd7d7e01f74d03706ec4a96585628d) )
47134717
4714   // 840-0025    1999     317-0274-JPN   Naomi
4715   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080b8ef5" )
4718   ROM_REGION( 4, "rom_key", 0 ) // 317-0274-JPN
4719   ROM_LOAD( "marstv-key.bin", 0x000000, 0x000004, CRC(45c683ab) SHA1(1af2a582b54459eb1db56f5d3502917bb012d313) )
47164720ROM_END
47174721
47184722/* Sega Strike Fighter */
r243192r243193
47434747   ROM_LOAD( "mpr-23320.ic19s", 0x9800000, 0x800000, CRC(5ec75a45) SHA1(696e5d14678c794dec67246507bd580f7e5b5043) )
47444748   ROM_LOAD( "mpr-23321.ic20s", 0xa000000, 0x800000, CRC(018627d4) SHA1(2519f39ad046d14f602648fed39bc3719185b55e) )
47454749
4746   // 840-0035    2000     317-0281-COM   Naomi
4747   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08132303" )
4750   ROM_REGION( 4, "rom_key", 0 )
4751   ROM_LOAD( "sstrkfgt-key.bin", 0, 4, CRC(1884e4ee) SHA1(14ec026ed32825252987fed350f19f6e2565aa4d) )
47484752ROM_END
47494753
47504754// EPR ROM have different number, possible updated/bugfixed re-release or STD/DLX version, difference with original set is unknown, have "Rev.A" label too
r243192r243193
47754779   ROM_LOAD( "mpr-23320.ic19s", 0x9800000, 0x800000, CRC(5ec75a45) SHA1(696e5d14678c794dec67246507bd580f7e5b5043) )
47764780   ROM_LOAD( "mpr-23321.ic20s", 0xa000000, 0x800000, CRC(018627d4) SHA1(2519f39ad046d14f602648fed39bc3719185b55e) )
47774781
4778   // 840-0035    2000     317-0281-COM   Naomi
4779   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08132303" )
4782   ROM_REGION( 4, "rom_key", 0 )
4783   ROM_LOAD( "sstrkfgt-key.bin", 0, 4, CRC(1884e4ee) SHA1(14ec026ed32825252987fed350f19f6e2565aa4d) )
47804784ROM_END
47814785
47824786
r243192r243193
47954799   ROM_LOAD( "mpr-22914.ic5", 0x2800000, 0x800000, CRC(77844b60) SHA1(65d71febb8a160d00778ac7b53e082253cad9834) )
47964800   ROM_LOAD( "mpr-22915.ic6", 0x3000000, 0x800000, CRC(e48148ac) SHA1(c1273353eeaf9bb6b185f133281d7d04271bc895) )
47974801
4798   // 840-0018    1999     317-0268-COM   Naomi
4799   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0808ae51" )
4802   ROM_REGION( 4, "rom_key", 0 )
4803   ROM_LOAD( "sgtetris-key.bin", 0, 4, CRC(03bf7ea1) SHA1(0229c1f9a6eca65b09e3571768a1fbf3c1dad6b1) )
48004804ROM_END
48014805
48024806/*
r243192r243193
48524856   ROM_LOAD("mpr-23339.ic16s",0x8000000, 0x0800000, CRC(fd8c2736) SHA1(34ae1a4e35b4aac6666719fb4fc0959bd64ff3d6) )
48534857   ROM_LOAD("mpr-23340.ic17s",0x8800000, 0x0800000, CRC(001604f8) SHA1(615ec027d383d44d4aadb1175be6320e4139d7d1) )
48544858
4855   // 840-0041    2000     317-0286-COM   Naomi
4856   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081a66ca" )
4859   ROM_REGION( 4, "rom_key", 0 )
4860   ROM_LOAD( "slasho-key.bin", 0, 4, CRC(78e31e35) SHA1(a0b06cb7fbb0b2f1734831fc3e6a8315c0e78edd) )
48574861ROM_END
48584862
48594863
r243192r243193
49104914   ROM_LOAD( "mpr-23546.ic10", 0x9800000, 0x1000000, CRC(85db2248) SHA1(37845c269a2e65ee6181a8e7500c2e7dd9b2e343) )
49114915   ROM_LOAD( "mpr-23547.ic11", 0xa800000, 0x1000000, CRC(18b369c7) SHA1(b61cb3fda8cc685865684f7afc7dad0b29d93ca5) )
49124916
4913   // 841-0015    2000     317-5065-COM   Naomi
4914   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000725d0" )
4917   ROM_REGION( 4, "rom_key", 0 )
4918   ROM_LOAD( "pjustic-key.bin", 0, 4, CRC(4a2bcbaa) SHA1(a9434482498f97605f76d08f749685452651a753) )
49154919ROM_END
49164920
49174921/*
r243192r243193
49524956   ROM_LOAD("mpr-21595.ic7", 0x3800000, 0x0800000, CRC(7ab218f7) SHA1(c5c022e63f926cce09d49331647cde20e8e42ab3) )
49534957   ROM_LOAD("mpr-21596.ic8", 0x4000000, 0x0800000, CRC(f27dbdc5) SHA1(d54717d62897546968de2f049239f68bee49bdd8) )
49544958
4955   // 841-0001    1999     317-5046-COM   Naomi
4956   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000e69c1" )
4959   ROM_REGION( 4, "rom_key", 0 )
4960   ROM_LOAD( "pstone-key.bin", 0, 4, CRC(7386d0de) SHA1(72f6b552440e470344f707e349d100d9ba21b69d) )
49574961ROM_END
49584962
49594963/*
r243192r243193
49954999   ROM_LOAD("mpr-23125.ic8", 0x4000000, 0x0800000, CRC(b9938bbc) SHA1(d55d7adecb5a5a4a276a5a17c12808085d980fd9) )
49965000   ROM_LOAD("mpr-23126.ic9", 0x4800000, 0x0800000, CRC(fbb0325b) SHA1(21b965519d7508d84344641d43e8af2c3ca29ba4) )
49975001
4998   // 841-0008    2000     317-5054-COM   Naomi
4999   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b8dc0" )
5002   ROM_REGION( 4, "rom_key", 0 )
5003   ROM_LOAD( "pstone2-key.bin", 0, 4, CRC(3858144b) SHA1(f5fb9157b38969c986f8abbe8ed3f95e788e45c0) )
50005004ROM_END
50015005
50025006
r243192r243193
50605064   ROM_LOAD("mpr-22159.ic18s",0x9000000, 0x0800000, CRC(f8b5e99d) SHA1(bb174a6a80967d0ff05c3a7512e4f0f9c921d130) )
50615065   ROM_LOAD("mpr-22160.ic19s",0x9800000, 0x0800000, CRC(579eef4e) SHA1(bfcabd57f623647053afcedcabfbc74e5736819f) )
50625066
5063   // 840-0017    1999     317-0266-COM   Naomi
5064   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
5067   ROM_REGION( 4, "rom_key", 0 )
5068   ROM_LOAD( "otrigger-key.bin", 0, 4, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
50655069ROM_END
50665070
50675071/*
r243192r243193
50985102
50995103   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
51005104
5101   // 840-0030    2000
5102   ROM_PARAMETER( ":rom_board:key", "96489bcd" )
5105   ROM_REGION( 4, "rom_key", 0 )
5106   ROM_LOAD( "qmegamis-key.bin", 0, 4, CRC(b08650c0) SHA1(9e6b0fac6fb05209da9e01bb1a5437949d218078) )
51035107ROM_END
51045108
51055109/*
r243192r243193
51535157   ROM_LOAD("mpr-22964.ic15s",0x7800000, 0x0800000, CRC(f581d5a3) SHA1(8cf769f5b0a48951246bb60e9cf58232bcee7bc8) )
51545158   ROM_LOAD("mpr-22965.ic16s",0x8000000, 0x0800000, CRC(8f7bfa8a) SHA1(19f137b1552978d232785c4408805b71835585c6) )
51555159
5156   // 840-0020    1999     317-0270-COM   Naomi
5157   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080a8b5d" )
5160   ROM_REGION( 4, "rom_key", 0 )
5161   ROM_LOAD( "samba-key.bin", 0, 4, CRC(e17e3603) SHA1(5611615064a93cc9d957cc4edd12c716a72cd7f2) )
51585162ROM_END
51595163
51605164// prototype - only works with US BIOS
r243192r243193
51815185   ROM_LOAD("mpr-22964.ic15s",0x7800000, 0x0800000, CRC(f581d5a3) SHA1(8cf769f5b0a48951246bb60e9cf58232bcee7bc8) )
51825186   ROM_LOAD("mpr-22965.ic16s",0x8000000, 0x0800000, CRC(8f7bfa8a) SHA1(19f137b1552978d232785c4408805b71835585c6) )
51835187
5184   // 840-0020    1999     317-0270-COM   Naomi
5185   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080a8b5d" )
5188   ROM_REGION( 4, "rom_key", 0 )
5189   ROM_LOAD( "samba-key.bin", 0, 4, CRC(e17e3603) SHA1(5611615064a93cc9d957cc4edd12c716a72cd7f2) )
51865190ROM_END
51875191
51885192/*
r243192r243193
52135217   ROM_LOAD("mpr-22218.ic11",  0x5800000, 0x0800000, CRC(f9ca31b8) SHA1(ea3d0f38ca1a46c896c06f038a6362ad3c9f90b2) )
52145218   ROM_LOAD("mpr-22219.ic12s", 0x6000000, 0x0800000, CRC(b3b45811) SHA1(045e7236b814f848d4c9767618ddcd4344d880ec) )
52155219
5216   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
5220   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
52175221ROM_END
52185222
52195223// Shootout Pool
r243192r243193
52305234
52315235   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52325236
5233   // 840-0098    2002
5234   ROM_PARAMETER( ":rom_board:key", "a77cf3a0" )
5237   ROM_REGION( 4, "rom_key", 0 )
5238   ROM_LOAD( "shootopl-key.bin", 0, 4, CRC(45547e02) SHA1(4f79f478ff1eea14bc939a67ff570143cb56a4bf) )
52355239ROM_END
52365240
52375241// Shootout Pool Prize
r243192r243193
52485252
52495253   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52505254
5251   // 840-0128    2002
5252   ROM_PARAMETER( ":rom_board:key", "cde98d9d" )
5255   ROM_REGION( 4, "rom_key", 0 )
5256   ROM_LOAD( "shootpl-key.bin", 0, 4, CRC(03c30b17) SHA1(e8e8659aa27b3d1cac2268850d3973d9afeaeba9) )
52535257ROM_END
52545258
52555259// Shootout Pool Prize Ver. B
r243192r243193
52665270
52675271   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52685272
5269   // 840-0128    2002
5270   ROM_PARAMETER( ":rom_board:key", "cde98d9d" )
5273   ROM_REGION( 4, "rom_key", 0 )
5274   ROM_LOAD( "shootpl-key.bin", 0, 4, CRC(03c30b17) SHA1(e8e8659aa27b3d1cac2268850d3973d9afeaeba9) )
52715275ROM_END
52725276
52735277/* Oinori-daimyoujin Matsuri (medal) */
r243192r243193
52835287   ROM_LOAD( "mpr-24057.ic4", 0x3800000, 0x1000000, CRC(6dec3518) SHA1(3e65065df22680e2bbf2d3db22da413f347a1abe) )
52845288   ROM_LOAD( "mpr-24058.ic5", 0x4800000, 0x1000000, CRC(0eba9049) SHA1(a71ca72aeaf17180cde59d7c7b42c97a1b4259ab) )
52855289
5286   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
5290   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
52875291ROM_END
52885292
52895293/*
r243192r243193
53275331   ROM_LOAD("mpr-22975.ic9",  0x4800000, 0x0800000, CRC(0d3c70d1) SHA1(22920bc5fd1dda760b5cb17482e9181be899bc08) )
53285332   ROM_LOAD("mpr-22976.ic10", 0x5000000, 0x0800000, CRC(092d8063) SHA1(14fafd3f4c4f2b37172453d1c815fb9b8f4814f4) )
53295333
5330   // 841-0005    1999     317-5051-COM   Naomi
5331   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00078d01" )
5334   ROM_REGION( 4, "rom_key", 0 )
5335   ROM_LOAD( "spawn-key.bin", 0, 4, CRC(dd211f09) SHA1(d436cd5009744c4c69fb94c84837103b4ca1c9a7) )
53325336ROM_END
53335337
53345338/*
r243192r243193
53695373   ROM_LOAD("mpr-23020.ic20s", 0xa000000, 0x0800000, CRC(b5943007) SHA1(d0e95084aec5e05027c21a6b4a3331408853781b) )
53705374   //ic21 not populated
53715375
5372   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
5376   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
53735377ROM_END
53745378
53755379/*
r243192r243193
54335437   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
54345438   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
54355439
5436   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
5440   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
54375441ROM_END
54385442
54395443ROM_START( virnbao )
r243192r243193
54645468   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
54655469   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
54665470
5467   // 840-0021    2000     317-0271-COM   Naomi
5468   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08068b58" )
5471   ROM_REGION( 4, "rom_key", 0 )
5472   ROM_LOAD( "virnbao-key.bin", 0, 4, CRC(980e3be8) SHA1(234a2f8ee408144d2c51e8083d0a033eea6026e0) )
54695473ROM_END
54705474
54715475ROM_START( virnbap )
r243192r243193
54965500   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
54975501   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
54985502
5499   // 840-0021    2000     317-0271-COM   Naomi
5500   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08068b58" )
5503   ROM_REGION( 4, "rom_key", 0 )
5504   ROM_LOAD( "virnbao-key.bin", 0, 4, CRC(980e3be8) SHA1(234a2f8ee408144d2c51e8083d0a033eea6026e0) )
55015505ROM_END
55025506
55035507/*
r243192r243193
55495553   ROM_LOAD("mpr-21922.ic14s",0x7000000, 0x0800000, CRC(a1901e1e) SHA1(2281f91ac696cc14886bcdf4b0685ce2f5bb8117) )
55505554   ROM_LOAD("mpr-21923.ic15s",0x7800000, 0x0400000, CRC(d127d9a5) SHA1(78c95357344ea15469b84fa8b1332e76521892cd) )
55515555
5552   // 840-0010    1999     317-0258-COM   Naomi
5553   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08088b08" )
5556   ROM_REGION( 4, "rom_key", 0 )
5557   ROM_LOAD( "vs2_2k-key.bin", 0, 4, CRC(f9fb4716) SHA1(83277f61e97fc6c4d8d27b903bde0acdfb0c7dbc) )
55545558ROM_END
55555559
55565560/*
r243192r243193
55945598   ROM_LOAD("mpr-22925.ic10",0x5000000, 0x0800000, CRC(81057e42) SHA1(d41137ae28c64dbdb50150db8cf25851bc0709c4) )
55955599   ROM_LOAD("mpr-22926.ic11",0x5800000, 0x0800000, CRC(57eec89d) SHA1(dd8f9a9155e51ee5260f559449fb0ea245077952) )
55965600
5597   // 840-0015    1999     317-0263-COM   Naomi
5598   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0803eb15" )
5601   ROM_REGION( 4, "rom_key", 0 )
5602   ROM_LOAD( "vtennis-key.bin", 0, 4, CRC(f355af89) SHA1(581a9b0f8c2f3606006e85e136f9cf0ea908c773) )
55995603ROM_END
56005604
56015605/*
r243192r243193
56205624   ROM_LOAD( "mpr-22268.ic7", 0x6800000, 0x1000000, CRC(536f5eea) SHA1(f1de8624f82595adf75693b604fb026bf3f778ee) )
56215625   ROM_LOAD( "mpr-22269.ic8", 0x7800000, 0x1000000, CRC(6c0cf740) SHA1(da10b33a6e54afbe1d7e52801216e7119b0b33b1) )
56225626
5623   // 840-0040    2000     317-0285-COM   Naomi
5624   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081627c3" )
5627   ROM_REGION( 4, "rom_key", 0 )
5628   ROM_LOAD( "wwfroyal-key.bin", 0, 4, CRC(e14721b1) SHA1(1f2f447bbc4b1e0b016c5ac545d1d805abc61ebd) )
56255629ROM_END
56265630
56275631ROM_START( mushik2e )
r243192r243193
59375941   ROM_LOAD("mpr-21725.ic18s",0x9000000, 0x0800000, CRC(2202077b) SHA1(0893a85379f994277083c0bc5b178dd34508f816) )
59385942   ROM_LOAD("mpr-21726.ic19s",0x9800000, 0x0800000, CRC(429bf290) SHA1(6733e1bcf100e73ab43273f6feedc187fcaa55d4) )
59395943
5940   // 840-0003    1999     317-0249-COM   Naomi
5941   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08012b41" )
5944   ROM_REGION( 4, "rom_key", 0 )
5945   ROM_LOAD( "zombrvn-key.bin", 0, 4, CRC(572d3944) SHA1(16ae634d85169851b9deae3c03b5dd4d4bf2794a) )
59425946ROM_END
59435947
59445948ROM_START( gunsur2 )
r243192r243193
59625966   ROM_LOAD( "bhf1ma14.6m",  0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) )
59635967   ROM_LOAD( "bhf1ma15.6l",  0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) )
59645968
5965   // 25709801    2001     317-5075-COM   Naomi
5966   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000680d0" )
5969   ROM_REGION( 4, "rom_key", 0 )
5970   ROM_LOAD( "bhf1-key.bin", 0x0000000, 0x0000004, CRC(9899e931) SHA1(c0837262b9069b33d0e72b418e80b5f0da8b9251) )
59675971ROM_END
59685972
59695973ROM_START( gunsur2e )
r243192r243193
59875991   ROM_LOAD( "bhf1ma14.6m",  0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) )
59885992   ROM_LOAD( "bhf1ma15.6l",  0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) )
59895993
5990   // 25709801    2001     317-5075-COM   Naomi
5991   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000680d0" )
5994   ROM_REGION( 4, "rom_key", 0 )
5995   ROM_LOAD( "bhf1-key.bin", 0x0000000, 0x0000004, CRC(9899e931) SHA1(c0837262b9069b33d0e72b418e80b5f0da8b9251) )
59925996ROM_END
59935997
59945998ROM_START( wldkicks )
r243192r243193
60096013   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60106014   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60116015
6012   // 25209801    2000     317-5040-COM   Naomi
6013   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
6016   ROM_REGION( 4, "rom_key", 0 )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60146018ROM_END
60156019
60166020ROM_START( wldkicksa )
r243192r243193
60316035   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60326036   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60336037
6034   // 25209801    2000     317-5040-COM   Naomi
6035   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
6038   ROM_REGION( 4, "rom_key", 0 )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60366040ROM_END
60376041
60386042ROM_START( wldkicksb )
r243192r243193
60536057   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60546058   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60556059
6056   // 25209801    2000     317-5040-COM   Naomi
6057   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
6060   ROM_REGION( 4, "rom_key", 0 )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60586062ROM_END
60596063
60606064ROM_START( toukon4 )
r243192r243193
60806084   ROM_LOAD( "trf1ma14.6m", 0xe000000, 0x1000000, CRC(87cb31a0) SHA1(27aef9ac571a0b5e3a76e4ee22f5bc5d0ae962f2) )
60816085   ROM_LOAD( "trf1ma15.6l", 0xf000000, 0x1000000, CRC(42d318c5) SHA1(f9fe82ffbfc51fcb52333f94c55a7092e7124fb4) )
60826086
6083   // 25349801    2000     317-5040-COM   Naomi
6084   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
6087   ROM_REGION( 4, "rom_key", 0 )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(986a7cee) SHA1(70c3ff80f86de6a0655251658c66a156fb644995) )
60856089ROM_END
60866090
60876091ROM_START( ninjaslt )
r243192r243193
61026106   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61036107   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61046108
6105   // 25469801    2000     317-5068-COM   Naomi
6106   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
6109   ROM_REGION( 4, "rom_key", 0 )
6110   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
61076111
61086112   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61096113   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243192r243193
61276131   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61286132   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61296133
6130   // 25469801    2000     317-5068-COM   Naomi
6131   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
6134   ROM_REGION( 4, "rom_key", 0 )
6135   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
61326136
61336137   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61346138   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243192r243193
61526156   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61536157   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61546158
6155   // 25469801    2000     317-5068-COM   Naomi
6156   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
6159   ROM_REGION( 4, "rom_key", 0 )
6160   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
61576161
61586162   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61596163   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243192r243193
61776181   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61786182   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61796183
6180   // 25469801    2000     317-5068-COM   Naomi
6181   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
6184   ROM_REGION( 4, "rom_key", 0 )
6185   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
61826186
61836187   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61846188   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243192r243193
61996203   ROM_LOAD( "maz1ma7.4e",  0x7000000, 0x1000000, CRC(6103ad9c) SHA1(e4abbb5867cae6a9bf9067ab3a091ef7b18fa0cd) )
62006204   ROM_LOAD( "maz1ma8.4d",  0x8000000, 0x1000000, CRC(d46c9f40) SHA1(45eec7fa3d4261f12438e841254fa75d572331b3) )
62016205
6202   // 25869812    2002     317-0266-COM   Naomi
6203   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
6206   ROM_REGION( 4, "rom_key", 0 )
6207   ROM_LOAD( "maz1-key.bin", 0x000000, 0x000004, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
62046208ROM_END
62056209
62066210ROM_START( mazana )
r243192r243193
62186222   ROM_LOAD( "maz1ma7.4e",  0x7000000, 0x1000000, CRC(6103ad9c) SHA1(e4abbb5867cae6a9bf9067ab3a091ef7b18fa0cd) )
62196223   ROM_LOAD( "maz1ma8.4d",  0x8000000, 0x1000000, CRC(d46c9f40) SHA1(45eec7fa3d4261f12438e841254fa75d572331b3) )
62206224
6221   // 25869812    2002     317-0266-COM   Naomi
6222   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
6225   ROM_REGION( 4, "rom_key", 0 )
6226   ROM_LOAD( "maz1-key.bin", 0x000000, 0x000004, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
62236227ROM_END
62246228
62256229ROM_START( vtenis2c )
r243192r243193
62496253
62506254   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
62516255
6252   // 840-0084    2001
6253   ROM_PARAMETER( ":rom_board:key", "43472d2d" )
6256   ROM_REGION( 4, "rom_key", 0 )
6257   ROM_LOAD( "vtenis2c-key.bin", 0, 4, CRC(b8c5b510) SHA1(f36d037a62a576e71211093e075f0ffa7e312c2d) )
62546258ROM_END
62556259
62566260ROM_START( kick4csh )
r243192r243193
62796283
62806284   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
62816285
6282   // 840-0140    2004
6283   ROM_PARAMETER( ":rom_board:key", "c9570882" )
6286   ROM_REGION( 4, "rom_key", 0 )
6287   ROM_LOAD( "kick4csh-key.bin", 0, 4, CRC(889d2ea1) SHA1(daf7acf41b6bc607d443a93221a3e4554b99547f) )
62846288ROM_END
62856289
62866290ROM_START( wrungp )
r243192r243193
62966300   ROM_LOAD( "mpr-23723.ic5",  0x4800000, 0x1000000, CRC(651610eb) SHA1(4dfe4f876a5440bd1034f41a4d76e1d6bd3e0e32) )
62976301   ROM_LOAD( "mpr-23724.ic6",  0x5800000, 0x1000000, CRC(c633c45a) SHA1(23b45140f965428d33e2424b0574715c0b952d05) )
62986302
6299   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6303   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
63006304ROM_END
63016305
63026306ROM_START( gundmct )
r243192r243193
63166320   ROM_LOAD( "mpr-23636.ic9",  0x8800000, 0x1000000, CRC(57199e9f) SHA1(73a6f20ee7b3133ed4c6286e477e2ff9757106bd) )
63176321   ROM_LOAD( "mpr-23637.ic10", 0x9800000, 0x1000000, CRC(737b5dff) SHA1(0a405b711ffb096a3e6d52ececed73a5f93ebf02) )
63186322
6319   // 841-0017    2001     317-5070-COM   Naomi
6320   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000e8010" )
6323   ROM_REGION( 4, "rom_key", 0 )
6324   ROM_LOAD( "gundmct-key.bin", 0, 4, CRC(0dee7a39) SHA1(24eef111ad7d8ad984e38b63101d01463b36542e) )
63216325ROM_END
63226326
63236327ROM_START( puyoda )
r243192r243193
63476351   ROM_LOAD( "mpr-22204.ic19s", 0x9800000, 0x800000, CRC(2c5e5140) SHA1(7887fc19459dc85ca78256e0c50c762eea001e51) )
63486352   ROM_LOAD( "mpr-22205.ic20s", 0xa000000, 0x800000, CRC(7d523ae5) SHA1(7495082b7e83b6ee8f47660baba4c604d8ba2ff1) )
63496353
6350   // 841-0006    1999     317-5052-COM   Naomi
6351   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000acd40" )
6354   ROM_REGION( 4, "rom_key", 0 )
6355   ROM_LOAD( "puyoda-key.bin", 0, 4, CRC(245bb259) SHA1(7ab675779ebf01ad3a78edd39cb287b71acd8bb5) )
63526356ROM_END
63536357
63546358ROM_START( zerogu2 )
r243192r243193
63636367   ROM_LOAD( "mpr-23687.ic4",  0x3800000, 0x1000000, CRC(e125439a) SHA1(07e7339f3f53aeb0ebddf7a8ac3eb6d8f3fe9de6) )
63646368   ROM_LOAD( "mpr-23688.ic5",  0x4800000, 0x1000000, CRC(38412edf) SHA1(9cae06cf46e134531f47e64deedace449664f69a) )
63656369
6366   // 841-0020    2001     317-5073-COM   Naomi
6367   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0007c010" )
6370   ROM_REGION( 4, "rom_key", 0 )
6371   ROM_LOAD( "zerogu2-key.bin", 0, 4, CRC(f2460eb3) SHA1(69ec4e3933e60caa6a0ac44a855a40deed337d92) )
63686372ROM_END
63696373
63706374ROM_START( inunoos )
r243192r243193
63916395   ROM_LOAD( "ic15s.bin", 0x7800000, 0x800000, CRC(b85e13ef) SHA1(974f6b8f24efe79d72ea9d7a2cfccf479704243d) )
63926396   ROM_LOAD( "ic16s.bin", 0x8000000, 0x800000, CRC(b8493dbe) SHA1(b641417e1bda49341e7ff86340072d74e3330665) )
63936397
6394   // 840-0073    2001     317-0316-JPN   Naomi
6395   ROM_PARAMETER( ":rom_board:segam2crypt:key", "094bc3e3" )
6398   ROM_REGION( 4, "rom_key", 0 )
6399   ROM_LOAD( "inunoos-key.bin", 0, 4, CRC(3ce3ed17) SHA1(d5d6daac0cbcdf7dada2e01f3c458dea04805c05) )
63966400ROM_END
63976401
63986402ROM_START( ringout )
r243192r243193
64126416   ROM_LOAD( "mpr-21769.ic9",  0x4800000, 0x800000, CRC(6d22d29d) SHA1(382dcd62065437b34fe101144b1c047eb261f047) )
64136417   ROM_LOAD( "mpr-21770.ic10", 0x5000000, 0x800000, CRC(c5308e61) SHA1(e51f8026351d5ffbda2a5bed39aeef543366febf) )
64146418
6415   // 840-0004    1999     317-0250-COM   Naomi
6416   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080b1e40" )
6419   ROM_REGION( 4, "rom_key", 0 )
6420   ROM_LOAD( "ringout-key.bin", 0, 4, CRC(8f8c4eb2) SHA1(9bc59c69d04d9ce876415af048f39095ed680a5e) )
64176421ROM_END
64186422
64196423ROM_START( vonot )
r243192r243193
64366440   ROM_LOAD( "mpr-23193.ic12s", 0x6000000, 0x800000, CRC(c86a5b9b) SHA1(4b8dda85003289e1464e12c3abf449bb8df20e3a) )
64376441   ROM_LOAD( "mpr-23194.ic13s", 0x6800000, 0x800000, CRC(5adea0bd) SHA1(f8614ba83d5f61556c3db1a1796a02ed2c51ce2a) )
64386442
6439   // 840-0028    2000     317-0279-COM   Naomi
6440   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08010715" )
6443   ROM_REGION( 4, "rom_key", 0 )
6444   ROM_LOAD( "vonot-key.bin", 0, 4, CRC(021ac707) SHA1(af57844331226d3b1722aedca1a7aef024468b39) )
64416445ROM_END
64426446
64436447ROM_START( derbyo2k )
r243192r243193
64636467   ROM_LOAD( "mpr-22237.ic15s", 0x7800000, 0x800000, CRC(718dd6bf) SHA1(6b71bb6970b582865f53d26e9579587fce86439e) )
64646468   ROM_LOAD( "mpr-22238.ic16s", 0x8000000, 0x800000, CRC(fb3e55da) SHA1(d547ee5b47e6e6fec9e447460300c828fbff8f2e) )
64656469
6466   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6470   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
64676471ROM_END
64686472
64696473ROM_START( starhrse )
r243192r243193
64776481   ROM_LOAD( "mpr-23233.ic3",  0x2800000, 0x1000000, CRC(d6451cab) SHA1(6508e27d0370b19df01150da7baf4875479c166a) )
64786482   ROM_LOAD( "mpr-23234.ic4",  0x3800000, 0x1000000, CRC(44044c14) SHA1(4934cb8d5f9b4085ffb5ddc711343f488aae4c4d) )
64796483
6480   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6484   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
64816485
64826486   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
64836487   ROM_REGION(0x84, "some_eeprom", 0)
r243192r243193
65106514   ROM_LOAD( "ic17s.bin", 0x8800000, 0x800000, CRC(b4c40606) SHA1(4f187dfe44bd89c90b6fa4b90f16222bc0a74d22) )
65116515   // .18s chip is not present but is tested for an FF fill (pull-up resistors on the PCB's data bus presumably accomplish this)
65126516
6513   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6517   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
65146518
65156519   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65166520   ROM_REGION(0x84, "some_eeprom", 0)
r243192r243193
65316535   ROM_LOAD( "mpr-23280.ic6",  0x5800000, 0x1000000, CRC(b1c8daa2) SHA1(a05fb374156ea013e35502abccc92f5117c39daa) )
65326536   ROM_LOAD( "mpr-23281.ic7",  0x6800000, 0x0800000, CRC(c0378369) SHA1(c728a181eddb01b9f8574669d4550baed559a5a4) )
65336537
6534   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6538   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
65356539
65366540   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65376541   ROM_REGION(0x84, "some_eeprom", 0)
r243192r243193
65536557   ROM_LOAD( "mpr-24128.ic6",   0x5800000, 0x1000000, CRC(bfdbb853) SHA1(bfbeb6ab634201af68d1427dea4f50163673fc2c) )
65546558   ROM_LOAD( "mpr-24129.ic7",   0x6800000, 0x1000000, CRC(c3f0f06a) SHA1(152324f2dbbde5560ae3adb1f9394a273fedbe9c) )
65556559
6556   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
6560   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
65576561ROM_END
65586562
65596563/* prototype cartridges for games released on GD-ROM */
r243192r243193
65896593   ROM_COPY( "rom_board", 0x01000000, 0x400000, 0xc00000 )
65906594
65916595   // M1 board, but it doesn't appear the protection is used
6592   ROM_PARAMETER( ":rom_board:key", "0" )
6596   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
65936597
65946598   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65956599   ROM_REGION(0x84, "some_eeprom", 0)
r243192r243193
77867790   NAOMI_DEFAULT_EEPROM
77877791
77887792   ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF)
7789   // rom was handmade from 2 damaged dumps, needs to be verified
7790   ROM_LOAD( "epr-23663.ic22", 0x0000000, 0x0400000, BAD_DUMP CRC(6910a008) SHA1(865affff1cf31321725ef727a17be384555e3aae) )
7793   ROM_LOAD( "epr-23663c.ic22",0x0000000, 0x0400000, CRC(7007fec7) SHA1(523168f0b218d0bd5c815d65bf0caba2c8468c9d) )
77917794   ROM_LOAD( "mpr-23652.ic1",  0x0800000, 0x1000000, CRC(992758a2) SHA1(5e2a25c520c1795128e5026fc00d355c24852ded) )
77927795   ROM_LOAD( "mpr-23653.ic2",  0x1800000, 0x1000000, CRC(e210e932) SHA1(2f6f0a31c3e98b21f1ff3af1680e50b3535b130f) )
77937796   ROM_LOAD( "mpr-23654.ic3",  0x2800000, 0x1000000, CRC(91335971) SHA1(fc7599b836fb7995dd7da940e64b08b3c09cb180) )
r243192r243193
78007803   ROM_LOAD( "mpr-23661.ic10", 0x9800000, 0x1000000, CRC(7d44dc74) SHA1(cfd6253eab3c1a039629b4873946c9dbc7ed6872) )
78017804   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78027805
7803   // 840-0061    2001     317-0310-COM   Naomi 2
7804   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0cee834a" )
7806   ROM_REGION( 4, "rom_key", 0 )
7807   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
78057808ROM_END
78067809
78077810ROM_START( vstrik3cb )
r243192r243193
78227825   ROM_LOAD( "mpr-23661.ic10", 0x9800000, 0x1000000, CRC(7d44dc74) SHA1(cfd6253eab3c1a039629b4873946c9dbc7ed6872) )
78237826   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78247827
7825   // 840-0061    2001     317-0310-COM   Naomi 2
7826   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0cee834a" )
7828   ROM_REGION( 4, "rom_key", 0 )
7829   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
78277830ROM_END
78287831
78297832ROM_START( wldrider )
r243192r243193
78437846   ROM_LOAD( "mpr-23619.ic9",  0x8800000, 0x1000000, CRC(a5f4f6af) SHA1(bb89d3f0f5bbaf7c40fa43680c7e51ef93f7ed26) )
78447847   ROM_LOAD( "mpr-23620.ic10", 0x9800000, 0x1000000, CRC(67aa15a9) SHA1(42c24cbf7069c27430a71509a872cd1c4224aaeb) )
78457848
7846   // 840-0046    2001     317-0301-COM   Naomi 2
7847   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7a703" )
7849   ROM_REGION( 4, "rom_key", 0 )
7850   ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(f5a662ad) SHA1(a75b1e490d1f7d57cd8976115572266d1ca05202) )
78487851ROM_END
78497852
78507853ROM_START( vf4cart )
r243192r243193
78657868   ROM_LOAD( "mpr-23783.ic10", 0x9800000, 0x1000000, CRC(c8d4f6f9) SHA1(9e9df605c050b3780d7df34bd5041d30bc084d2d) )
78667869   ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
78677870
7868   // 840-0080    2002     317-0324-COM   Naomi 2
7869   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0eef2f96" )
7871   ROM_REGION( 4, "rom_key", 0 )
7872   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(22838e16) SHA1(afee674dce3cfdd20360c30da2da5ba69f8d4682) )
78707873ROM_END
78717874
78727875// There is also a development cart (171-7885A) with 20x 64Mb FlashROMs instead of 10x 128Mb MaskROMs. Content is the same.
r243192r243193
78877890   ROM_LOAD("mpr-23816.ic9",  0x08800000,  0x01000000, CRC(bbaf0765) SHA1(3b79a4eff504b2156bea8b86c6cdd8e41e7bf268) )
78887891   ROM_LOAD("mpr-23817.ic10", 0x09800000,  0x01000000, CRC(e179cfb6) SHA1(1120036238439f8ac1041150396e4b60e4a243bc) )
78897892
7890   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
7893   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
78917894ROM_END
78927895
78937896ROM_START( soulsurf )
r243192r243193
79197922   ROM_LOAD( "ic20s.bin", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) )
79207923   ROM_LOAD( "ic21s.bin", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) )
79217924
7922   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
7925   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
79237926ROM_END
79247927
79257928ROM_START( vf4evoct )
r243192r243193
79517954
79527955   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
79537956
7954   // 840-0106    2002
7955   ROM_PARAMETER( ":rom_board:key", "cdb05b1e" )
7957   ROM_REGION( 4, "rom_key", 0 )
7958   ROM_LOAD( "vf4evoct-key.bin", 0, 4, CRC(c37dae2b) SHA1(c42dc01b5918db36e7eb2aca523e2f4df567725a) )
79567959ROM_END
79577960
79587961ROM_START( hopper )
r243192r243193
79887991   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
79897992   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
79907993
7991   // 840-0062    2001     317-0313-COM   Naomi 2
7992   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
7994   ROM_REGION( 4, "rom_key", 0 )
7995   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
79937996ROM_END
79947997
79957998ROM_START( clubkrtd )
r243192r243193
80108013   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
80118014   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
80128015
8013   // 840-0062    2001     317-0313-COM   Naomi 2
8014   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
8016   ROM_REGION( 4, "rom_key", 0 )
8017   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
80158018ROM_END
80168019
80178020ROM_START( clubkrtc )
r243192r243193
80328035   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
80338036   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
80348037
8035   // 840-0062    2001     317-0313-COM   Naomi 2
8036   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
8038   ROM_REGION( 4, "rom_key", 0 )
8039   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
80378040ROM_END
80388041
80398042ROM_START( clubkprz )
r243192r243193
80658068   ROM_REGION(0x84, "some_eeprom", 0)
80668069   ROM_LOAD( "at25010.ic3s", 0x000000, 0x000084, CRC(0142d8be) SHA1(5922b6c47b12b19e1fa7bbe9aae391905038a7ff) )
80678070
8068   // 840-0062    2001     317-0313-COM   Naomi 2
8069   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
8071   ROM_REGION( 4, "rom_key", 0 )   // 317-0368-COM
8072   ROM_LOAD( "clubkprz-key.bin", 0x000000, 0x000004, CRC(c9ed13c1) SHA1(2907985375cd5b04846e7214d200926be64d06fd) )
80708073ROM_END
80718074
80728075ROM_START( clubkpzb )
r243192r243193
80948097
80958098   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
80968099
8097   // 840-0062    2001     317-0313-COM   Naomi 2
8098   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
8100   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
8101   ROM_LOAD( "clubkprz-key.bin", 0x000000, 0x000004, CRC(c9ed13c1) SHA1(2907985375cd5b04846e7214d200926be64d06fd) )
80998102
81008103   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
81018104   ROM_REGION(0x84, "some_eeprom", 0)
r243192r243193
81298132
81308133   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
81318134
8132   // 840-0062    2001     317-0313-COM   Naomi 2
8133   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
8135   ROM_REGION( 4, "rom_key", 0 )
8136   ROM_LOAD( "clubk2k3-key.bin", 0x000000, 0x000004, CRC(96c3b4f6) SHA1(9b85a418153c70f56aaeeb1ed0bbbbd31a1bbad7) )
81348137ROM_END
81358138
81368139// uses the same mask roms data as clubk2k3, but not in 32bit dissected form, EPR doesn't have checksumms for them, so rom test shows all roms as BAD
r243192r243193
90319034
90329035/* 840-xxxxx (Sega Naomi 2 cart games) */
90339036/* 0046 */ GAME( 2001, wldrider, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
9034/* 0061 */ GAME( 2001, vstrik3c, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart)", GAME_FLAGS )
9037/* 0061 */ GAME( 2001, vstrik3c, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev C)", GAME_FLAGS )
90359038/* 0061 */ GAME( 2001, vstrik3cb,vstrik3c,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev B)", GAME_FLAGS )
90369039/* 0062 */ GAME( 2001, clubkrte, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS )
90379040/* 0062 */ GAME( 2001, clubkrtd, clubkrte,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS )
r243192r243193
90489051
90499052/* 841-xxxxx ("Licensed by Sega" Naomi cart games)*/
90509053/* 0001 */ GAME( 1999, pstone,   naomi, naomim2, naomi,   naomi_state, naomi,  ROT0,  "Capcom",          "Power Stone (JPN, USA, EUR, ASI, AUS)", GAME_FLAGS )
9051/* 0002 */ GAME( 1999, suchie3,  naomi, naomim2, suchie3, naomi_state,naomi_mp,ROT0,  "Jaleco",          "Idol Janshi Suchie-Pai 3 (JPN)", GAME_FLAGS )
9054/* 0002 */ GAME( 1999, suchie3,  naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0,  "Jaleco",          "Idol Janshi Suchie-Pai 3 (JPN)", GAME_FLAGS )
90529055/* 0003 */ GAME( 1999, doa2,     naomi, naomim2, naomi,   naomi_state, naomi,  ROT0,  "Tecmo",           "Dead or Alive 2 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
90539056/* 0003 */ GAME( 2000, doa2m,    doa2,  naomim2, naomi,   naomi_state, naomi,  ROT0,  "Tecmo",           "Dead or Alive 2 Millennium (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
90549057/* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0,  "Marvelous Ent.",  "Dengen Tenshi Taisen Janshi Shangri-la (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
trunk/src/mame/drivers/nemesis.c
r243192r243193
14251425
14261426/******************************************************************************/
14271427
1428WRITE_LINE_MEMBER(nemesis_state::sound_irq)
1429{
1430/* Interrupts _are_ generated, I wonder where they go.. */
1431// m_audiocpu->set_input_line(0, HOLD_LINE);
1432}
1433
14281434WRITE8_MEMBER(nemesis_state::volume_callback)
14291435{
14301436   m_k007232->set_volume(0, (data >> 4) * 0x11, 0);
r243192r243193
18151821   MCFG_SOUND_ROUTE(1, "rspeaker", 0.30)
18161822
18171823   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1818//  MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) ... Interrupts _are_ generated, I wonder where they go
1824   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nemesis_state, sound_irq))
18191825   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
18201826   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
18211827
r243192r243193
18621868   MCFG_SOUND_ROUTE(1, "rspeaker", 0.30)
18631869
18641870   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1865//  MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) ... Interrupts _are_ generated, I wonder where they go
1871   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nemesis_state, sound_irq))
18661872   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
18671873   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
18681874
trunk/src/mame/drivers/nl_pongd.c
r243192r243193
6565 *
6666 */
6767
68// identify unknown devices in IDE
6968
70//#define NETLIST_DEVELOPMENT 1
71
7269#include "netlist/nl_dice_compat.h"
7370#include "netlist/devices/net_lib.h"
7471#include "netlist/analog/nld_twoterm.h"
trunk/src/mame/drivers/nmg5.c
r243192r243193
287287   virtual void video_start();
288288   UINT32 screen_update_nmg5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
289289   void draw_bitmap( bitmap_ind16 &bitmap );
290   DECLARE_WRITE_LINE_MEMBER(soundirq);
290291};
291292
292293
r243192r243193
951952GFXDECODE_END
952953
953954
955WRITE_LINE_MEMBER(nmg5_state::soundirq)
956{
957   m_soundcpu->set_input_line(0, state);
958}
959
954960void nmg5_state::machine_start()
955961{
956962   save_item(NAME(m_gfx_bank));
r243192r243193
10051011   MCFG_SPEAKER_STANDARD_MONO("mono")
10061012
10071013   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) /* 4MHz */
1008   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
1014   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nmg5_state, soundirq))
10091015   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
10101016
10111017   MCFG_OKIM6295_ADD("oki", 1000000 , OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/oneshot.c
r243192r243193
327327   GFXDECODE_ENTRY( "gfx1", 0, oneshot8x8_layout,     0x00, 4  ) /* sprites */
328328GFXDECODE_END
329329
330WRITE_LINE_MEMBER(oneshot_state::irqhandler)
331{
332   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
333}
334
330335void oneshot_state::machine_start()
331336{
332337   save_item(NAME(m_gun_x_p1));
r243192r243193
376381   MCFG_SPEAKER_STANDARD_MONO("mono")
377382
378383   MCFG_SOUND_ADD("ymsnd", YM3812, 3500000)
379   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
384   MCFG_YM3812_IRQ_HANDLER(WRITELINE(oneshot_state, irqhandler))
380385   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
381386
382387   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/onetwo.c
r243192r243193
8484   virtual void video_start();
8585   UINT32 screen_update_onetwo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8686   void set_color(int offset);
87   DECLARE_WRITE_LINE_MEMBER(irqhandler);
8788};
8889
8990
r243192r243193
330331   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x6_layout, 0, 2 )
331332GFXDECODE_END
332333
334/*************************************
335 *
336 *  Sound interface
337 *
338 *************************************/
333339
340WRITE_LINE_MEMBER(onetwo_state::irqhandler)
341{
342   m_audiocpu->set_input_line(0, state);
343}
344
334345/*************************************
335346 *
336347 *  Machine driver
r243192r243193
375386   MCFG_SPEAKER_STANDARD_MONO("mono")
376387
377388   MCFG_SOUND_ADD("ymsnd", YM3812, MASTER_CLOCK)
378   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
389   MCFG_YM3812_IRQ_HANDLER(WRITELINE(onetwo_state, irqhandler))
379390   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
380391
381392   MCFG_OKIM6295_ADD("oki", 1056000*2, OKIM6295_PIN7_LOW) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/overdriv.c
r243192r243193
475475
476476GAMEL( 1990, overdriv,         0, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 1)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
477477GAMEL( 1990, overdriva, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 2)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
478GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
478GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
No newline at end of file
trunk/src/mame/drivers/pacman.c
r243192r243193
66166616   membank("bank1")->set_entry(1);
66176617}
66186618
6619DRIVER_INIT_MEMBER(pacman_state, mschamp)
6620{
6621   save_item(NAME(m_counter));
6622}
6623
66246619DRIVER_INIT_MEMBER(pacman_state,woodpek)
66256620{
66266621   int i, len;
r243192r243193
68496844GAME( 1981, mspacii2, mspacman, woodpek,  mspacman, pacman_state,  mspacii,  ROT90,  "bootleg (Orca)", "Ms. Pac-Man II (Orca bootleg set 2)", GAME_SUPPORTS_SAVE )
68506845GAME( 1981, pacgal,   mspacman, woodpek,  mspacman, driver_device, 0,        ROT90,  "hack", "Pac-Gal", GAME_SUPPORTS_SAVE )
68516846GAME( 1981, mspacpls, mspacman, woodpek,  mspacpls, driver_device, 0,        ROT90,  "hack", "Ms. Pac-Man Plus", GAME_SUPPORTS_SAVE )
6852GAME( 1992, mschamp,  mspacman, mschamp,  mschamp,  pacman_state,  mschamp,  ROT90,  "hack", "Ms. Pacman Champion Edition / Zola-Puc Gal", GAME_SUPPORTS_SAVE ) /* Rayglo version */
6853GAME( 1995, mschamps, mspacman, mschamp,  mschamp,  pacman_state,  mschamp,  ROT90,  "hack", "Ms. Pacman Champion Edition / Super Zola-Puc Gal", GAME_SUPPORTS_SAVE )
6847GAME( 1992, mschamp,  mspacman, mschamp,  mschamp,  driver_device, 0,        ROT90,  "hack", "Ms. Pacman Champion Edition / Zola-Puc Gal", GAME_SUPPORTS_SAVE ) /* Rayglo version */
6848GAME( 1995, mschamps, mspacman, mschamp,  mschamp,  driver_device, 0,        ROT90,  "hack", "Ms. Pacman Champion Edition / Super Zola-Puc Gal", GAME_SUPPORTS_SAVE )
68546849
68556850// These bootlegs have MADE IN GREECE clearly visible and etched into the PCBs. They were very common in Spain with several operators having their own versions.
68566851// Based on the PCBs and copyright dates shown they  were produced late 80s / early 90s. Usually they run a version of Ms. Pacman, but were sometimes converted back to regular Pac-Man
trunk/src/mame/drivers/paradise.c
r243192r243193
678678
679679   save_item(NAME(m_palbank));
680680   save_item(NAME(m_priority));
681   save_item(NAME(m_irq_count));
681   save_item(NAME(irq_count));
682682}
683683
684684void paradise_state::machine_reset()
r243192r243193
686686   m_palbank = 0;
687687   m_priority = 0;
688688
689   m_irq_count = 0;
689   irq_count = 0;
690690
691691}
692692
693693INTERRUPT_GEN_MEMBER(paradise_state::paradise_irq)
694694{
695   if (m_irq_count<300)
696      m_irq_count++;
695   if (irq_count<300)
696      irq_count++;
697697   else
698698      m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE);
699699}
trunk/src/mame/drivers/peplus.c
r243192r243193
36873687   ROM_REGION( 0x020000, "gfx1", 0 )
36883688   ROM_LOAD( "mro-cg2153.u72",   0x00000, 0x8000, CRC(004c9c8e) SHA1(ec3fa9d2c658de59e722d9979513d6b0c71d5742) ) /*  05/01/95   @ IGT  L95-1123  */
36893689   ROM_LOAD( "mgo-cg2153.u73",   0x08000, 0x8000, CRC(e6843b35) SHA1(2d5219a3cb054ce8b470797c0496c7e24e94ed81) )
3690   ROM_LOAD( "mbo-cg2153.u74",   0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino card backs */
3690   ROM_LOAD( "mbo-cg2153.u74",   0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino graphics */
36913691   ROM_LOAD( "mxo-cg2153.u75",   0x18000, 0x8000, CRC(3ae44f7e) SHA1(00d625b60bffef6ce622cb50a3aa93b92131f578) )
36923692
36933693   ROM_REGION( 0x100, "proms", 0 )
r243192r243193
51125112   ROM_LOAD( "cap960.u50", 0x0000, 0x0100, CRC(00dd8d0a) SHA1(542763b12aeb0aec2b410f7c075c52907f45d171) )
51135113ROM_END
51145114
5115ROM_START( peps0366 ) /* Normal board : Double Diamonds Deluxe Slots (PS0366) - Payout 94.99% */
5116   ROM_REGION( 0x10000, "maincpu", 0 )
5117   ROM_LOAD( "ps0366_569-a2c.u68",   0x00000, 0x10000, CRC(32fd35c5) SHA1(8562608bc45328559b7c04ef4026384862bf2d51) ) /* 2 Coins Max / 1 Line */
5118
5119   ROM_REGION( 0x020000, "gfx1", 0 )
5120   ROM_LOAD( "mro-cg1303.u72",  0x00000, 0x8000, CRC(f5bcc47f) SHA1(b132960a095996d1790df4dcedf14a29169fe667) )
5121   ROM_LOAD( "mgo-cg1303.u73",  0x08000, 0x8000, CRC(e16cc01b) SHA1(086f2ac533d868dbaa3852516b6fef344dddff13) )
5122   ROM_LOAD( "mbo-cg1303.u74",  0x10000, 0x8000, CRC(2c1ffea2) SHA1(efc16869f994415a03663205ca2396e4c26e25a3) )
5123   ROM_LOAD( "mxo-cg1303.u75",  0x18000, 0x8000, CRC(7c4578e0) SHA1(70b6cf02225a4804592f44c90365f370fb83281a) )
5124
5125   ROM_REGION( 0x100, "proms", 0 )
5126   ROM_LOAD( "cap1303.u50", 0x0000, 0x0100, CRC(5341ea30) SHA1(63c8f7fa94dcb772c308b307f755a188b9b5e7eb) )
5127ROM_END
5128
5129ROM_START( peps0372 ) /* Normal board : Double Diamonds Deluxe Slots (PS0372) - Payout 90.10% */
5130   ROM_REGION( 0x10000, "maincpu", 0 )
5131   ROM_LOAD( "ps0372_569-a2c.u68",   0x00000, 0x10000, CRC(45573591) SHA1(0a15313af506817528eb7319a0994b6993412965) ) /* 3 Coins Max / 1 Line */
5132
5133   ROM_REGION( 0x020000, "gfx1", 0 )
5134   ROM_LOAD( "mro-cg1303.u72",  0x00000, 0x8000, CRC(f5bcc47f) SHA1(b132960a095996d1790df4dcedf14a29169fe667) )
5135   ROM_LOAD( "mgo-cg1303.u73",  0x08000, 0x8000, CRC(e16cc01b) SHA1(086f2ac533d868dbaa3852516b6fef344dddff13) )
5136   ROM_LOAD( "mbo-cg1303.u74",  0x10000, 0x8000, CRC(2c1ffea2) SHA1(efc16869f994415a03663205ca2396e4c26e25a3) )
5137   ROM_LOAD( "mxo-cg1303.u75",  0x18000, 0x8000, CRC(7c4578e0) SHA1(70b6cf02225a4804592f44c90365f370fb83281a) )
5138
5139   ROM_REGION( 0x100, "proms", 0 )
5140   ROM_LOAD( "cap1303.u50", 0x0000, 0x0100, CRC(5341ea30) SHA1(63c8f7fa94dcb772c308b307f755a188b9b5e7eb) )
5141ROM_END
5142
5143ROM_START( peps0373 ) /* Normal board : Double Diamonds Deluxe Slots (PS0373) - Payout 87.56% */
5144   ROM_REGION( 0x10000, "maincpu", 0 )
5145   ROM_LOAD( "ps0373_583-a6c.u68",   0x00000, 0x10000, CRC(085bed76) SHA1(8775f7c9654f92eab616cdda4505cbde30154889) ) /* 3 Coins Max / 1 Line */
5146
5147   ROM_REGION( 0x020000, "gfx1", 0 )
5148   ROM_LOAD( "mro-cg1303.u72",  0x00000, 0x8000, CRC(f5bcc47f) SHA1(b132960a095996d1790df4dcedf14a29169fe667) )
5149   ROM_LOAD( "mgo-cg1303.u73",  0x08000, 0x8000, CRC(e16cc01b) SHA1(086f2ac533d868dbaa3852516b6fef344dddff13) )
5150   ROM_LOAD( "mbo-cg1303.u74",  0x10000, 0x8000, CRC(2c1ffea2) SHA1(efc16869f994415a03663205ca2396e4c26e25a3) )
5151   ROM_LOAD( "mxo-cg1303.u75",  0x18000, 0x8000, CRC(7c4578e0) SHA1(70b6cf02225a4804592f44c90365f370fb83281a) )
5152
5153   ROM_REGION( 0x100, "proms", 0 )
5154   ROM_LOAD( "cap1303.u50", 0x0000, 0x0100, CRC(5341ea30) SHA1(63c8f7fa94dcb772c308b307f755a188b9b5e7eb) )
5155ROM_END
5156
51575115ROM_START( peps0426 ) /* Normal board : Sizzling Sevens Slots (PS0268) - Payout 90.35% */
51585116   ROM_REGION( 0x10000, "maincpu", 0 )
51595117   ROM_LOAD( "ps0426_571-a3h.u68",   0x00000, 0x10000, CRC(b53771c1) SHA1(23fccd5facb98fc83b8903946435be4f15199ff8) ) /* 3 Coins Max / 1 Lines */
r243192r243193
54355393   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54365394
54375395   ROM_REGION( 0x020000, "gfx1", 0 )
5438   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans card backs */
5396   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans graphics */
54395397   ROM_LOAD( "mgo-cg2291.u78",  0x08000, 0x8000, CRC(17bb35f8) SHA1(ba9e8aa3ff42b17c7be6ee46c70db22d8e60e52c) ) /* Compatible with most "standard" game sets */
54405398   ROM_LOAD( "mbo-cg2291.u79",  0x10000, 0x8000, CRC(de1036e4) SHA1(774bbcda301754dc4a606974248847a2264c3827) )
54415399   ROM_LOAD( "mxo-cg2291.u80",  0x18000, 0x8000, CRC(7049403c) SHA1(3a29a00fb8dfdb30dba757c1536151827ea09068) )
r243192r243193
54605418   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54615419
54625420   ROM_REGION( 0x020000, "gfx1", 0 )
5463   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships card backs */
5421   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships graphics */
54645422   ROM_LOAD( "mgo-cg2399.u73",  0x08000, 0x8000, CRC(5848a2fa) SHA1(4173a473016b7a776d2b59bf3ded0be35bd43721) )
54655423   ROM_LOAD( "mbo-cg2399.u74",  0x10000, 0x8000, CRC(5c3e16f6) SHA1(a4aa457f239527bffa6472e0d6f9d836f796b326) )
54665424   ROM_LOAD( "mxo-cg2399.u75",  0x18000, 0x8000, CRC(bd7669d5) SHA1(4343a9764fd563e2e1cdd8558f2f53f77006b159) )
r243192r243193
54855443   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54865444
54875445   ROM_REGION( 0x020000, "gfx1", 0 )
5488   ROM_LOAD( "mro-cg2374.u72",  0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */
5489   ROM_LOAD( "mgo-cg2374.u73",  0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) )
5490   ROM_LOAD( "mbo-cg2374.u74",  0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) )
5491   ROM_LOAD( "mxo-cg2374.u75",  0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) )
5446   ROM_LOAD( "mro-cg2185.u77",  0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) /*  07/10/95   @ IGT  L95-1506  */
5447   ROM_LOAD( "mgo-cg2185.u78",  0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) )
5448   ROM_LOAD( "mbo-cg2185.u79",  0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) )
5449   ROM_LOAD( "mxo-cg2185.u80",  0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) )
54925450
54935451   ROM_REGION( 0x200, "proms", 0 )
5494   ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
5452   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
54955453ROM_END
54965454
54975455ROM_START( pex0055pd ) /* Superboard : Deuces Wild Poker (X000055P+XP000035) */
r243192r243193
79827940   ROM_LOAD( "x002374p.u66",   0x00000, 0x10000, CRC(fc4b6c8d) SHA1(b101f9042bd54dbfdeed4c7a3acf3798096f6857) ) /* Super Aces Poker */
79837941
79847942   ROM_REGION( 0x020000, "gfx1", 0 )
7985   ROM_LOAD( "mro-cg2324.u77",  0x00000, 0x8000, CRC(6eceef42) SHA1(a2ddd2a3290c41e510f483c6b633fe0002694d0b) )
7986   ROM_LOAD( "mgo-cg2324.u78",  0x08000, 0x8000, CRC(26d0acbe) SHA1(09a9127deb88185cd5b748bac657461eadb2f48f) )
7987   ROM_LOAD( "mbo-cg2324.u79",  0x10000, 0x8000, CRC(47baee32) SHA1(d8af09022ccb5fc06aa3aa4c200a734b66cbee00) )
7988   ROM_LOAD( "mxo-cg2324.u80",  0x18000, 0x8000, CRC(60449fc0) SHA1(251d1e04786b70c1d2bc7b02f3b69cd58ac76398) )
7943   ROM_LOAD( "mro-cg2374.u72",  0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */
7944   ROM_LOAD( "mgo-cg2374.u73",  0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) )
7945   ROM_LOAD( "mbo-cg2374.u74",  0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) )
7946   ROM_LOAD( "mxo-cg2374.u75",  0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) )
79897947
79907948   ROM_REGION( 0x200, "proms", 0 )
7991   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
7949   ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
79927950ROM_END
79937951
79947952ROM_START( pex2377p ) /* Superboard : Super Double Bonus Poker (X002377P+XP000112) */
r243192r243193
92909248GAMEL(1996, peps0298, peps0042, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0298) Double Diamond Slots",          0, layout_pe_slots )
92919249GAMEL(1996, peps0308, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0308) Double Jackpot Slots",          0, layout_pe_slots )
92929250GAMEL(1996, peps0364, peps0021, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0364) Red White & Blue Slots",        0, layout_pe_slots )
9293GAMEL(1996, peps0366, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0366) Double Diamond Deluxe Slots",   0, layout_pe_slots )
9294GAMEL(1996, peps0372, peps0366, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0372) Double Diamond Deluxe Slots",   0, layout_pe_slots )
9295GAMEL(1996, peps0373, peps0366, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0373) Double Diamond Deluxe Slots",   0, layout_pe_slots )
92969251GAMEL(1996, peps0426, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0426) Sizzling Sevens Slots",         0, layout_pe_slots )
92979252GAMEL(1996, peps0581, peps0021, peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0581) Red White & Blue Slots",        0, layout_pe_slots )
92989253GAMEL(1996, peps0615, 0,        peplus, peplus_slots,   peplus_state, peplus,   ROT0,  "IGT - International Game Technology", "Player's Edge Plus (PS0615) Chaos Slots",                   0, layout_pe_slots )
r243192r243193
93109265GAMEL(1995, pex0055p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000019) Deuces Wild Poker",   0, layout_pe_poker )
93119266GAMEL(1995, pex0055pa, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000022) Deuces Wild Poker (The Orleans)", 0, layout_pe_poker )
93129267GAMEL(1995, pex0055pb, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000023) Deuces Wild Poker (The Fun Ships)", 0, layout_pe_poker )
9313GAMEL(1995, pex0055pc, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker (Horseshoe)", 0, layout_pe_poker )
9268GAMEL(1995, pex0055pc, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker",  0, layout_pe_poker )
93149269GAMEL(1995, pex0055pd, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000035) Deuces Wild Poker",   0, layout_pe_poker )
93159270GAMEL(1995, pex0055pe, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000038) Deuces Wild Poker",   0, layout_pe_poker )
93169271GAMEL(1995, pex0055pf, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000040) Deuces Wild Poker",   0, layout_pe_poker )
r243192r243193
94089363GAMEL(1995, pex2308p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002308P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker )
94099364GAMEL(1995, pex2310p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002310P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker )
94109365GAMEL(1995, pex2314p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002314P+XP000112) Triple Bonus Poker Plus", 0, layout_pe_poker )
9411GAMEL(1995, pex2374p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker",    0, layout_pe_poker )
9366GAMEL(1995, pex2374p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker (Horseshoe)", 0, layout_pe_poker )
94129367GAMEL(1995, pex2377p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002377P+XP000112) Super Double Bonus Poker", 0, layout_pe_poker )
94139368GAMEL(1995, pex2419p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002419P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker )
94149369GAMEL(1995, pex2420p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002420P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker )
trunk/src/mame/drivers/prehisle.c
r243192r243193
190190
191191/******************************************************************************/
192192
193WRITE_LINE_MEMBER(prehisle_state::irqhandler)
194{
195   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
196}
197
198/******************************************************************************/
199
193200static MACHINE_CONFIG_START( prehisle, prehisle_state )
194201
195202   /* basic machine hardware */
r243192r243193
219226   MCFG_SPEAKER_STANDARD_MONO("mono")
220227
221228   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz)  /* verified on pcb */
222   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
229   MCFG_YM3812_IRQ_HANDLER(WRITELINE(prehisle_state, irqhandler))
223230   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
224231
225232   MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
trunk/src/mame/drivers/psikyo.c
r243192r243193
378378
379379***************************************************************************/
380380
381WRITE_LINE_MEMBER(psikyo_state::sound_irq)
382{
383   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
384}
385
381386READ8_MEMBER(psikyo_state::psikyo_soundlatch_r)
382387{
383388   return m_soundlatch;
r243192r243193
10561061   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
10571062
10581063   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_32MHz/4) /* verified on pcb */
1059   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1064   MCFG_YM2610_IRQ_HANDLER(WRITELINE(psikyo_state, sound_irq))
10601065   MCFG_SOUND_ROUTE(0, "lspeaker",  1.2)
10611066   MCFG_SOUND_ROUTE(0, "rspeaker", 1.2)
10621067   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
11021107   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11031108
11041109   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1105   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1110   MCFG_YM2610_IRQ_HANDLER(WRITELINE(psikyo_state, sound_irq))
11061111   MCFG_SOUND_ROUTE(0, "lspeaker",  1.2)
11071112   MCFG_SOUND_ROUTE(0, "rspeaker", 1.2)
11081113   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243192r243193
11481153***************************************************************************/
11491154
11501155
1156WRITE_LINE_MEMBER(psikyo_state::irqhandler)
1157{
1158   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1159}
1160
11511161static MACHINE_CONFIG_START( s1945, psikyo_state )
11521162
11531163   /* basic machine hardware */
r243192r243193
11821192   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11831193
11841194   MCFG_SOUND_ADD("ymf", YMF278B, YMF278B_STD_CLOCK)
1185   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1195   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyo_state, irqhandler))
11861196   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
11871197   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
11881198MACHINE_CONFIG_END
r243192r243193
12211231   ROM_LOAD32_WORD_SWAP( "4-u127.bin", 0x000000, 0x040000, CRC(8c9911ca) SHA1(821ba648b9a1d495c600cbf4606f2dbddc6f9e6f) ) // 1&0
12221232   ROM_LOAD32_WORD_SWAP( "5-u126.bin", 0x000002, 0x040000, CRC(d20c3ef0) SHA1(264e5a7e45e130a9e7152468733337668dc5b65f) ) // 3&2
12231233
1224   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1234   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
12251235   ROM_LOAD( "3-u58.bin", 0x00000, 0x20000, CRC(310f5c76) SHA1(dbfd1c5a7a514bccd89fc4f7191744cf76bb745d) )
1236   ROM_RELOAD(            0x10000, 0x20000             )
12261237
12271238   ROM_REGION( 0x200000, "gfx1", 0 )   /* Sprites */
12281239   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(00a546cb) SHA1(30a8679b49928d5fcbe58b5eecc2ebd08173adf8) )
r243192r243193
12451256   ROM_LOAD32_WORD_SWAP( "1-u127.bin", 0x000000, 0x040000, CRC(6c45b2f8) SHA1(08473297e174f3a6d67043f3b16f4e6b9c68b826) ) // 1&0
12461257   ROM_LOAD32_WORD_SWAP( "2-u126.bin", 0x000002, 0x040000, CRC(845a6760) SHA1(3b8fed294e28d9d8ef5cb5ec88b9ade396146a48) ) // 3&2
12471258
1248   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1259   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
12491260   ROM_LOAD( "3-u58.bin", 0x00000, 0x20000, CRC(310f5c76) SHA1(dbfd1c5a7a514bccd89fc4f7191744cf76bb745d) )
1261   ROM_RELOAD(            0x10000, 0x20000             )
12501262
12511263   ROM_REGION( 0x200000, "gfx1", 0 )   /* Sprites */
12521264   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(00a546cb) SHA1(30a8679b49928d5fcbe58b5eecc2ebd08173adf8) )
r243192r243193
12881300   ROM_LOAD32_WORD_SWAP( "4.u46", 0x000000, 0x040000, CRC(b78ec99d) SHA1(399b79931652d9df1632cd4d7ec3d214e473a5c3) ) // 1&0
12891301   ROM_LOAD32_WORD_SWAP( "5.u39", 0x000002, 0x040000, CRC(925f095d) SHA1(301a536119a0320a756e9c6e51fb10e36b90ef16) ) // 3&2
12901302
1291   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1303   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
12921304   ROM_LOAD( "3.u71",     0x00000, 0x20000, CRC(2168e4ba) SHA1(ca7ad6acb5f806ce2528e7b52c19e8cceecb8543) )
1305   ROM_RELOAD(            0x10000, 0x20000             )
12931306
12941307   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
12951308   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243192r243193
13201333   ROM_LOAD32_WORD_SWAP( "1k.u46", 0x000000, 0x080000, CRC(745cee52) SHA1(6c5bb92c92c55f882484417bc1aa580684019610) ) // 1&0
13211334   ROM_LOAD32_WORD_SWAP( "2k.u39", 0x000002, 0x080000, CRC(669632fb) SHA1(885dea42e6da35e9166a208b18dbd930642c26cd) ) // 3&2
13221335
1323   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1336   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
13241337   ROM_LOAD( "k3.u71",    0x00000, 0x20000, CRC(11994055) SHA1(619776c178361f23de37ff14e87284ec0f1f4f10) )
1338   ROM_RELOAD(            0x10000, 0x20000             )
13251339
13261340   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13271341   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243192r243193
13491363   ROM_LOAD32_WORD_SWAP( "1.u46", 0x000000, 0x040000, CRC(474abd69) SHA1(27f37333075f9c92849101aad4875e69004d747b) ) // 1&0
13501364   ROM_LOAD32_WORD_SWAP( "2.u39", 0x000002, 0x040000, CRC(3e3e661f) SHA1(b5648546f390539b0f727a9a62d1b9516254ae21) ) // 3&2
13511365
1352   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1366   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
13531367   ROM_LOAD( "3.u71",     0x00000, 0x20000, CRC(2168e4ba) SHA1(ca7ad6acb5f806ce2528e7b52c19e8cceecb8543) )
1368   ROM_RELOAD(            0x10000, 0x20000             )
13541369
13551370   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13561371   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243192r243193
13791394   ROM_LOAD32_WORD_SWAP( "4-u46.bin", 0x000000, 0x040000, CRC(8a7a28b4) SHA1(f7197be673dfd0ddf46998af81792b81d8fe9fbf) ) // 1&0
13801395   ROM_LOAD32_WORD_SWAP( "5-u39.bin", 0x000002, 0x040000, CRC(933561fa) SHA1(f6f3b1e14b1cfeca26ef8260ac4771dc1531c357) ) // 3&2
13811396
1382   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1397   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
13831398   ROM_LOAD( "3-u71.bin", 0x00000, 0x20000, CRC(22411fab) SHA1(1094cb51712e40ae65d0082b408572bdec06ae8b) )
1399   ROM_RELOAD(            0x10000, 0x20000             )
13841400
13851401   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13861402   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(282d89c3) SHA1(3b4b17f4a37efa2f7e232488aaba7c77d10c84d2) )
r243192r243193
14271443   ROM_LOAD32_WORD_SWAP( "1-u46.bin", 0x000000, 0x080000, CRC(45fa8086) SHA1(f1753b9420596f4b828c77e877a044ba5fb01b28) ) // 1&0
14281444   ROM_LOAD32_WORD_SWAP( "2-u39.bin", 0x000002, 0x080000, CRC(0152ab8c) SHA1(2aef4cb88341b35f20bb551716f1e5ac2731e9ba) ) // 3&2
14291445
1430   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1446   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
14311447   ROM_LOAD( "3-u71.bin", 0x00000, 0x20000, CRC(e3e366bd) SHA1(1f5b5909745802e263a896265ea365df76d3eaa5) )
1448   ROM_RELOAD(            0x10000, 0x20000             )
14321449
14331450   ROM_REGION( 0x800000, "gfx1", 0 )   /* Sprites */
14341451   ROM_LOAD( "u20.bin",  0x000000, 0x200000, CRC(28a27fee) SHA1(913f3bc4d0c6fb6b776a020c8099bf96f16fd06f) )
r243192r243193
15571574   ROM_LOAD32_WORD_SWAP( "2s.u40", 0x000000, 0x040000, CRC(9b10062a) SHA1(cf963bba157422b659d8d64b4493eb7d69cd07b7) ) // 1&0
15581575   ROM_LOAD32_WORD_SWAP( "3s.u41", 0x000002, 0x040000, CRC(f87e871a) SHA1(567167c7fcfb622f78e211d74b04060c3d29d6b7) ) // 3&2
15591576
1560   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1577   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
15611578   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1579   ROM_RELOAD(            0x10000, 0x20000             )
15621580
15631581   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU? */
15641582   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
15861604   ROM_LOAD32_WORD_SWAP( "4-u40.bin", 0x000000, 0x040000, CRC(29ffc217) SHA1(12dc3cb32253c3908f4c440c627a0e1b32ee7cac) ) // 1&0
15871605   ROM_LOAD32_WORD_SWAP( "5-u41.bin", 0x000002, 0x040000, CRC(c3d3fb64) SHA1(4388586bc0a6f3d62366b3c38b8b23f8a03dbf15) ) // 3&2
15881606
1589   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1607   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
15901608   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1609   ROM_RELOAD(            0x10000, 0x20000             )
15911610
15921611   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU? */
15931612   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
16151634   ROM_LOAD32_WORD_SWAP( "1-u40.bin", 0x000000, 0x040000, CRC(c00eb012) SHA1(080dae010ca83548ebdb3324585d15e48baf0541) ) // 1&0
16161635   ROM_LOAD32_WORD_SWAP( "2-u41.bin", 0x000002, 0x040000, CRC(3f5a134b) SHA1(18bb3bb1e1adadcf522795f5cf7d4dc5a5dd1f30) ) // 3&2
16171636
1618   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1637   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
16191638   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1639   ROM_RELOAD(            0x10000, 0x20000             )
16201640
16211641   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
16221642   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
16441664   ROM_LOAD32_WORD_SWAP( "10.u40", 0x000000, 0x040000, CRC(5a32af36) SHA1(2eada37fd043c097a11bcf4e3e0bebb473bbc0df) ) // 1&0
16451665   ROM_LOAD32_WORD_SWAP( "9.u41",  0x000002, 0x040000, CRC(29cc6d7d) SHA1(aeee9e88922c25c75885483d115e064c6b71540b) ) // 3&2
16461666
1647   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1667   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
16481668   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1669   ROM_RELOAD(            0x10000, 0x20000             )
16491670
16501671   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
16511672   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
16951716   ROM_LOAD32_WORD_SWAP( "5-u40.bin", 0x000000, 0x080000, CRC(90088195) SHA1(8ec48d581ecd14b3dad36edc65d5a273324cf3c1) ) // 1&0
16961717   ROM_LOAD32_WORD_SWAP( "4-u41.bin", 0x000002, 0x080000, CRC(0d53196c) SHA1(454bb4695b13ce44ca5dac7c6d4142a8b9afa798) ) // 3&2
16971718
1698   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1719   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
16991720   ROM_LOAD( "1-u63.bin", 0x00000, 0x20000, CRC(2025e387) SHA1(334b0eb3b416d46ccaadff3eee6f1abba63285fb) )
1721   ROM_RELOAD(            0x10000, 0x20000             )
17001722
17011723   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
17021724   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
17241746   ROM_LOAD32_WORD_SWAP( "2-u40.bin", 0x000000, 0x080000, CRC(ab6fe58a) SHA1(6687a3af192b3eab60d75ca286ebb8e0636297b5) ) // 1&0
17251747   ROM_LOAD32_WORD_SWAP( "3-u41.bin", 0x000002, 0x080000, CRC(02e42e39) SHA1(6cdb7b1cebab50c0a44cd60cd437f0e878ccac5c) ) // 3&2
17261748
1727   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
1749   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
17281750   ROM_LOAD( "1-u63.bin", 0x00000, 0x20000, CRC(2025e387) SHA1(334b0eb3b416d46ccaadff3eee6f1abba63285fb) )
1751   ROM_RELOAD(            0x10000, 0x20000             )
17291752
17301753   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
17311754   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243192r243193
17791802   m_ka302c_banking = 0; // SH201B doesn't have any gfx banking
17801803
17811804   /* setup audiocpu banks */
1782   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000);
1805   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000, 0x8000);
17831806
17841807   /* Enable other regions */
17851808#if 0
r243192r243193
18361859
18371860   /* setup audiocpu banks */
18381861   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1839   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1862   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
18401863}
18411864
18421865DRIVER_INIT_MEMBER(psikyo_state,gunbird)
r243192r243193
18511874
18521875   /* setup audiocpu banks */
18531876   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1854   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1877   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
18551878}
18561879
18571880
r243192r243193
18731896
18741897   /* setup audiocpu banks */
18751898   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1876   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1899   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
18771900}
18781901
18791902DRIVER_INIT_MEMBER(psikyo_state,s1945a)
r243192r243193
18941917
18951918   /* setup audiocpu banks */
18961919   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1897   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1920   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
18981921}
18991922
19001923DRIVER_INIT_MEMBER(psikyo_state,s1945j)
r243192r243193
19151938
19161939   /* setup audiocpu banks */
19171940   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1918   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1941   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19191942}
19201943
19211944DRIVER_INIT_MEMBER(psikyo_state,s1945jn)
r243192r243193
19301953
19311954   /* setup audiocpu banks */
19321955   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1933   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
1956   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19341957}
19351958
19361959DRIVER_INIT_MEMBER(psikyo_state,s1945bl)
trunk/src/mame/drivers/psikyo4.c
r243192r243193
616616INPUT_PORTS_END
617617
618618
619WRITE_LINE_MEMBER(psikyo4_state::irqhandler)
620{
621   m_maincpu->set_input_line(12, state ? ASSERT_LINE : CLEAR_LINE);
622}
623
624
619625void psikyo4_state::machine_start()
620626{
621627   // configure YMF ROM banks
r243192r243193
687693
688694   MCFG_SOUND_ADD("ymf", YMF278B, MASTER_CLOCK/2)
689695   MCFG_DEVICE_ADDRESS_MAP(AS_0, ps4_ymf_map)
690   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 12))
696   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyo4_state, irqhandler))
691697   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
692698   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
693699MACHINE_CONFIG_END
trunk/src/mame/drivers/psikyosh.c
r243192r243193
756756INPUT_PORTS_END
757757
758758
759WRITE_LINE_MEMBER(psikyosh_state::irqhandler)
760{
761   m_maincpu->set_input_line(12, state ? ASSERT_LINE : CLEAR_LINE);
762}
763
764
759765void psikyosh_state::machine_start()
760766{
761767   membank("gfxbank")->configure_entries(0, 0x1000, memregion("gfx1")->base(), 0x20000);
r243192r243193
778784
779785   MCFG_SCREEN_ADD("screen", RASTER)
780786   MCFG_SCREEN_REFRESH_RATE(60)
787   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
781788   MCFG_SCREEN_SIZE(64*8, 32*8)
782789   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 28*8-1)
783790   MCFG_SCREEN_UPDATE_DRIVER(psikyosh_state, screen_update_psikyosh)
r243192r243193
792799   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
793800
794801   MCFG_SOUND_ADD("ymf", YMF278B, MASTER_CLOCK/2)
795   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 12))
802   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyosh_state, irqhandler))
796803   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
797804   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
798805MACHINE_CONFIG_END
r243192r243193
812819   MCFG_CPU_MODIFY("maincpu")
813820   MCFG_CPU_PROGRAM_MAP(ps5_map)
814821
815   /* Measured Hsync 16.165 KHz, Vsync 61.68 Hz */
816822   /* Ideally this would be driven off the video register. However, it doesn't changeat runtime and MAME will pick a better screen resolution if it knows upfront */
817823   MCFG_SCREEN_MODIFY("screen")
818   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/8, 443, 0, 40*8, 262, 0, 30*8)
824   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 30*8-1)
819825MACHINE_CONFIG_END
820826
821827
trunk/src/mame/drivers/psychic5.c
r243192r243193
947947GAME( 1987, psychic5,  0,        psychic5, psychic5, driver_device, 0, ROT270, "Jaleco / NMK", "Psychic 5 (World)", 0 ) // "Oversea's version V2.00 CHANGED BY TAMIO NAKASATO" text present in ROM, various modifications (English names, more complete attract demo etc.)
948948GAME( 1987, psychic5j, psychic5, psychic5, psychic5, driver_device, 0, ROT270, "Jaleco / NMK", "Psychic 5 (Japan)", 0 )
949949GAME( 1988, bombsa,    0,        bombsa,   bombsa,   driver_device, 0, ROT270, "Jaleco", "Bombs Away", GAME_NOT_WORKING )
950
trunk/src/mame/drivers/punchout.c
r243192r243193
1010driver by Nicola Salmoria
1111
1212TODO:
13- finish spunchout protection, currently using a hacky workaround
1413- add useless driver config to choose between pink and white color proms
1514- video raw params - pixel clock is derived from 20.16mhz xtal
1615- money bag placement might not be 100% correct in Arm Wrestling
r243192r243193
228227   ret |= m_rp5h01->counter_r() ? 0x00 : 0x40;
229228   ret |= m_rp5h01->data_r() ? 0x00 : 0x80;
230229
231   // FIXME - hack d6/d7 state until we figure out why the game resets
232   /* PC = 0x0313 */
233   /* (ret or 0x10) -> (D7DF),(D7A0) - (D7DF),(D7A0) = 0d0h(ret nc) */
234   ret &= 0x3f;
235   if (space.device().safe_pcbase() == 0x0313)
236   {
237      ret |= 0xc0;
238   }
239
240230   return ret;
241231}
242232
trunk/src/mame/drivers/segae.c
r243192r243193
956956
957957      for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ )
958958      {
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp2_ptr[x] : vdp1_ptr[x];
960         //dest_ptr[x] = y1_ptr[x] ? 0x00FF00 : 0xFF0000;
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp1_ptr[x] : vdp2_ptr[x];
960//dest_ptr[x] = y1_ptr[x] ? 0xFF0000 : 0x00FF00;
961961      }
962962   }
963963
trunk/src/mame/drivers/segajw.c
r243192r243193
368368
369369void segajw_state::machine_start()
370370{
371   save_item(NAME(m_coin_start_cycles));
372   save_item(NAME(m_hopper_start_cycles));
373   save_item(NAME(m_coin_counter));
374   save_item(NAME(m_coin_lockout));
375   save_item(NAME(m_hopper_ctrl));
376   save_item(NAME(m_lamps));
377371}
378372
379373
r243192r243193
444438ROM_END
445439
446440
447GAMEL( 1991, segajw,  0,   segajw,  segajw, driver_device,  0, ROT0, "Sega", "Golden Poker Series \"Joker's Wild\" (Rev. B)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE, layout_segajw ) // TODO: correct title
441GAMEL( 1991, segajw,  0,   segajw,  segajw, driver_device,  0, ROT0, "Sega", "Golden Poker Series \"Joker's Wild\" (Rev. B)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS, layout_segajw ) // TODO: correct title
trunk/src/mame/drivers/seta2.c
r243192r243193
15841584   PORT_DIPSETTING(      0x0040, DEF_STR( 1C_5C ) )
15851585   PORT_DIPSETTING(      0x0000, "1 Coin/10 Credits" )
15861586
1587   PORT_START("DSW2")  // $400302.w    PORT_START("DSW2")  // $400302.w
1587   PORT_START("DSW2")  // $400302.w   PORT_START("DSW2")  // $400302.w
15881588   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1")  // used
15891589   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
15901590   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r243192r243193
16481648
16491649static INPUT_PORTS_START( endrichs )
16501650   PORT_INCLUDE(reelquak)
1651
1651   
16521652   PORT_MODIFY("DSW1")  // $400300.w
16531653   PORT_DIPNAME( 0x0001, 0x0001, "Payout Style" ) PORT_DIPLOCATION("SW1:1")
16541654   PORT_DIPSETTING(      0x0001, "Normal Payout" )
trunk/src/mame/drivers/silvmil.c
r243192r243193
2828public:
2929   silvmil_state(const machine_config &mconfig, device_type type, const char *tag)
3030      : driver_device(mconfig, type, tag),
31         m_maincpu(*this, "maincpu"),
32         m_gfxdecode(*this, "gfxdecode"),
33         m_sprgen(*this, "spritegen"),
3431         m_bg_videoram(*this, "bg_videoram"),
3532         m_fg_videoram(*this, "fg_videoram"),
36         m_spriteram(*this, "spriteram") { }
33         m_spriteram(*this, "spriteram"),
34         m_sprgen(*this, "spritegen"),
35         m_maincpu(*this, "maincpu"),
36         m_gfxdecode(*this, "gfxdecode") { }
3737
38
39   /* devices */
40   required_device<cpu_device> m_maincpu;
41   required_device<gfxdecode_device> m_gfxdecode;
42   required_device<decospr_device> m_sprgen;
43
4438   /* memory pointers */
4539   required_shared_ptr<UINT16> m_bg_videoram;
4640   required_shared_ptr<UINT16> m_fg_videoram;
4741   required_shared_ptr<UINT16> m_spriteram;
42   optional_device<decospr_device> m_sprgen;
4843
4944   /* video-related */
5045   tilemap_t   *m_bg_layer;
r243192r243193
119114   virtual void video_start();
120115   UINT32 screen_update_silvmil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
121116   void tumblepb_gfx1_rearrange();
117   required_device<cpu_device> m_maincpu;
118   required_device<gfxdecode_device> m_gfxdecode;
122119};
123120
124121
r243192r243193
283280
284281void silvmil_state::machine_start()
285282{
286   save_item(NAME(m_silvmil_tilebank));
287   save_item(NAME(m_whichbank));
288283}
289284
290285void silvmil_state::machine_reset()
r243192r243193
432427   tumblepb_gfx1_rearrange();
433428}
434429
435GAME( 1995, silvmil, 0, silvmil, silvmil, silvmil_state, silvmil, ROT270, "Para", "Silver Millennium", GAME_SUPPORTS_SAVE )
430GAME( 1995, silvmil, 0, silvmil, silvmil, silvmil_state, silvmil, ROT270, "Para", "Silver Millennium", 0 )
trunk/src/mame/drivers/snk68.c
r243192r243193
569569
570570/******************************************************************************/
571571
572WRITE_LINE_MEMBER(snk68_state::irqhandler)
573{
574   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
575}
576
577/******************************************************************************/
578
572579static MACHINE_CONFIG_START( pow, snk68_state )
573580
574581   /* basic machine hardware */
r243192r243193
597604   MCFG_SPEAKER_STANDARD_MONO("mono")
598605
599606   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) /* verified on pcb  */
600   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
607   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snk68_state, irqhandler))
601608   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
602609
603610   MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
trunk/src/mame/drivers/snowbros.c
r243192r243193
185185   if (ACCESSING_BITS_0_7) soundlatch_byte_w(space,0,data & 0xff);
186186}
187187
188READ16_MEMBER(snowbros_state::toto_read)
189{
190   int pc = space.device().safe_pc();
191   if ((pc!= 0x3f010) && (pc!= 0x38008)) printf("toto prot %08x %04x\n", pc, mem_mask);
192   return 0x0700;
193}
194
195188/* Snow Bros Memory Map */
196189
197190static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state )
r243192r243193
15421535   GFXDECODE_ENTRY( "gfx1", 0, hyperpac_tilelayout,  0, 16 )
15431536GFXDECODE_END
15441537
1538/* handler called by the 3812/2151 emulator when the internal timers cause an IRQ */
1539WRITE_LINE_MEMBER(snowbros_state::irqhandler)
1540{
1541   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1542}
1543
15451544MACHINE_RESET_MEMBER(snowbros_state,semiprot)
15461545{
15471546   UINT16 *PROTDATA = (UINT16*)memregion("user1")->base();
r243192r243193
15931592   MCFG_SPEAKER_STANDARD_MONO("mono")
15941593
15951594   MCFG_SOUND_ADD("ymsnd", YM3812, 3000000)
1596   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
1595   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snowbros_state, irqhandler))
15971596   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
15981597MACHINE_CONFIG_END
15991598
r243192r243193
17051704   /* sound hardware */
17061705
17071706   MCFG_SOUND_ADD("ymsnd", YM3812, 3000000)
1708   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
1707   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snowbros_state, irqhandler))
17091708   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
17101709
17111710
r243192r243193
19561955   ROM_LOAD16_BYTE( "wb09.bin",     0x60001, 0x10000, CRC(9be718ca) SHA1(5c195e4f13efbdb229201d2408d018861bf389cc) )
19571956ROM_END
19581957
1959ROM_START( toto )
1960   ROM_REGION( 0x40000, "maincpu", 0 )
1961   ROM_LOAD16_BYTE( "u60.5j",  0x00000, 0x20000, CRC(39203792) SHA1(4c8d560be02a514cbf91774c7a0b4a95cf573356) )
1962   ROM_LOAD16_BYTE( "u51.4j",  0x00001, 0x20000, CRC(7b846cd4) SHA1(04aa0bbaab4303fb08dff52d5515f7e764f1be6d))
1963
1964   ROM_REGION( 0x10000, "soundcpu", 0 )    /* 64k for z80 sound code */
1965   ROM_LOAD( "u46.4c",   0x0000, 0x8000, CRC(77b1ef42) SHA1(75e3c8c2b687669cc56f972dd7375dab5185859c) )
1966
1967   ROM_REGION( 0x80000, "gfx1", 0 )
1968   ROM_LOAD( "u107.8k",          0x00000, 0x20000, CRC(4486153b) SHA1(a6dc0c17bf2328ab725bce4aaa0a413a42129fb0) )
1969   ROM_LOAD( "u108.8l",          0x20000, 0x20000, CRC(3286cf5f) SHA1(133366b0e10ab86111247cbedf329e8e3a7f2148) )
1970   ROM_LOAD( "u109.8m",          0x40000, 0x20000, CRC(464d7251) SHA1(f03ee54e9301ea87de4171cecdbad4a5e17929c4) )
1971   ROM_LOAD( "u110.8n",          0x60000, 0x20000, CRC(7dea56df) SHA1(7e7b9238837c6f4221cff416a2de21723d2c9272) )
1972ROM_END
1973
19741958/* Barko */
19751959
19761960ROM_START( honeydol )
r243192r243193
28822866
28832867
28842868
2885DRIVER_INIT_MEMBER(snowbros_state,toto)
2886{
2887   // every single rom has bits 0x10 and 0x08 swapped
2888   UINT8 *src = memregion("maincpu")->base();
2889   int len = memregion("maincpu")->bytes();
2890
2891   for (int i = 0; i < len; i++)
2892   {
2893      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2894   }
2895
2896   src = memregion("gfx1")->base();
2897   len = memregion("gfx1")->bytes();
2898
2899   for (int i = 0; i < len; i++)
2900   {
2901      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2902   }
2903
2904   src = memregion("soundcpu")->base();
2905   len = memregion("soundcpu")->bytes();
2906
2907   for (int i = 0; i < len; i++)
2908   {
2909      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2910   }
2911
2912   // protection? (just return 0x07)
2913   m_maincpu->space(AS_PROGRAM).install_read_handler(0x500006, 0x500007, read16_delegate(FUNC(snowbros_state::toto_read),this));
2914}
2915
2916
2917
29182869GAME( 1990, snowbros,  0,        snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 1)", 0 )
29192870GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 2)", 0 )
29202871GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 3)", 0 )
r243192r243193
29242875GAME( 1990, wintbob,   snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg (Sakowa Project Korea)", "The Winter Bobble (bootleg of Snow Bros.)", 0 )
29252876GAME( 1990, snowbroswb,snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg",                        "Snow Bros. - Nick & Tom (The Winter Bobble hardware bootleg)", 0 ) // this was probably unhacked back from the more common Winter Bobble to make it look more original
29262877
2927GAME( 1996, toto,      0,        snowbros, snowbros, snowbros_state, toto, ROT0, "SoftClub",                    "Come Back Toto", 0 ) // modified from 'snowbros' code
2928
29292878// none of the games below are on genuine SnowBros hardware, but they clone the functionality of it.
29302879
29312880// SemiCom / Jeil titles are protected, a dumb MCU copies code into RAM at startup, some also check for a specific return value from an address on startup.
trunk/src/mame/drivers/spbactn.c
r243192r243193
402402GFXDECODE_END
403403
404404
405WRITE_LINE_MEMBER(spbactn_state::irqhandler)
406{
407   m_audiocpu->set_input_line(0, state);
408}
409
405410static MACHINE_CONFIG_START( spbactn, spbactn_state )
406411
407412   /* basic machine hardware */
r243192r243193
438443   MCFG_SPEAKER_STANDARD_MONO("mono")
439444
440445   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* Was 3.579545MHz, a common clock, but no way to generate via on PCB OSCs */
441   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
446   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spbactn_state, irqhandler))
442447   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
443448
444449   MCFG_OKIM6295_ADD("oki", XTAL_4MHz/4, OKIM6295_PIN7_HIGH) /* Was 1.056MHz, a common clock, but no way to generate via on PCB OSCs. clock frequency & pin 7 not verified */
r243192r243193
489494   MCFG_SPEAKER_STANDARD_MONO("mono")
490495
491496   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz)
492   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
497   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spbactn_state, irqhandler))
493498   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
494499
495500   MCFG_OKIM6295_ADD("oki", XTAL_4MHz/4, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/spdodgeb.c
r243192r243193
378378GFXDECODE_END
379379
380380
381WRITE_LINE_MEMBER(spdodgeb_state::irqhandler)
382{
383   m_audiocpu->set_input_line(M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
384}
385
381386void spdodgeb_state::machine_reset()
382387{
383388   m_toggle = 0;
r243192r243193
416421   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
417422
418423   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_12MHz/4)
419   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6809_FIRQ_LINE))
424   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spdodgeb_state, irqhandler))
420425   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
421426   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
422427
trunk/src/mame/drivers/spy.c
r243192r243193
458458   m_k007232_2->set_volume(1, 0, (data & 0x0f) * 0x11);
459459}
460460
461WRITE_LINE_MEMBER(spy_state::irqhandler)
462{
463   m_audiocpu->set_input_line(INPUT_LINE_NMI, state);
464}
461465
466
462467void spy_state::machine_start()
463468{
464469   UINT8 *ROM = memregion("maincpu")->base();
r243192r243193
523528   MCFG_SPEAKER_STANDARD_MONO("mono")
524529
525530   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
526   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
531   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spy_state, irqhandler))
527532   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
528533
529534   MCFG_SOUND_ADD("k007232_1", K007232, 3579545)
trunk/src/mame/drivers/st_mp200.c
r243192r243193
769769/*--------------------------------
770770/ Split Second #144
771771/-------------------------------*/
772ROM_START(spltsecp)
772ROM_START(splitsec)
773773   ROM_REGION(0x10000, "maincpu", 0)
774774   ROM_LOAD( "cpu_u1.716", 0x1000, 0x0800, CRC(c6ff9aa9) SHA1(39f80faca16c869ac14df7c5fc3dfa80b47dad95))
775775   ROM_LOAD( "cpu_u5.716", 0x1800, 0x0800, CRC(fda74efc) SHA1(31becc243ada23e2f4d17927985772c9fcf8a3c3))
r243192r243193
929929GAME(1980,  nineball,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Nine Ball", GAME_IS_SKELETON_MECHANICAL)
930930GAME(1981,  lightnin,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Lightning", GAME_IS_SKELETON_MECHANICAL)
931931GAME(1980,  stargzr,    0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Stargazer", GAME_IS_SKELETON_MECHANICAL)
932GAME(1981,  spltsecp,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Split Second (Pinball)", GAME_IS_SKELETON_MECHANICAL)
932GAME(1981,  splitsec,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Split Second", GAME_IS_SKELETON_MECHANICAL)
933933GAME(1981,  catacomp,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Catacomb (Pinball)", GAME_IS_SKELETON_MECHANICAL)
934934GAME(1982,  dragfist,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Dragonfist", GAME_IS_SKELETON_MECHANICAL)
935935GAME(1984,  lazrlord,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Lazer Lord", GAME_IS_SKELETON_MECHANICAL)
trunk/src/mame/drivers/stadhero.c
r243192r243193
3030
3131/******************************************************************************/
3232
33READ16_MEMBER(stadhero_state::stadhero_control_r)
34{
35   switch (offset<<1)
36   {
37      case 0:
38         return m_inputs->read();
39
40      case 2:
41         return m_coin->read();
42
43      case 4:
44         return m_dsw->read();
45   }
46
47   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",space.device().safe_pc(),0x30c000+offset);
48   return ~0;
49}
50
3351WRITE16_MEMBER(stadhero_state::stadhero_control_w)
3452{
3553   switch (offset<<1)
r243192r243193
5573   AM_RANGE(0x240000, 0x240007) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_0_w)                          /* text layer */
5674   AM_RANGE(0x240010, 0x240017) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_1_w)
5775   AM_RANGE(0x260000, 0x261fff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w)
58   AM_RANGE(0x30c000, 0x30c001) AM_READ_PORT("INPUTS")
59   AM_RANGE(0x30c002, 0x30c003) AM_READ_PORT("COIN")
60   AM_RANGE(0x30c004, 0x30c005) AM_READ_PORT("DSW")
61   AM_RANGE(0x30c000, 0x30c00b) AM_WRITE(stadhero_control_w)
76   AM_RANGE(0x30c000, 0x30c00b) AM_READWRITE(stadhero_control_r, stadhero_control_w)
6277   AM_RANGE(0x310000, 0x3107ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
6378   AM_RANGE(0xff8000, 0xffbfff) AM_RAM /* Main ram */
6479   AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x000800) AM_RAM AM_SHARE("spriteram")
r243192r243193
195210
196211/******************************************************************************/
197212
213WRITE_LINE_MEMBER(stadhero_state::irqhandler)
214{
215   m_audiocpu->set_input_line(0, state);
216}
217
218/******************************************************************************/
219
198220static MACHINE_CONFIG_START( stadhero, stadhero_state )
199221
200222   /* basic machine hardware */
r243192r243193
238260   MCFG_SOUND_ROUTE(3, "mono", 0.40)
239261
240262   MCFG_SOUND_ADD("ym2", YM3812, XTAL_24MHz/8)
241   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
263   MCFG_YM3812_IRQ_HANDLER(WRITELINE(stadhero_state, irqhandler))
242264   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
243265
244266   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/stv.c
r243192r243193
672672   m_maincpu->sh2drc_add_pcflush(0x60011ba);
673673   m_maincpu->sh2drc_add_pcflush(0x605b9da);
674674
675   install_common_protection();
675   install_astrass_protection();
676676
677677   DRIVER_INIT_CALL(stv);
678678}
r243192r243193
766766   m_maincpu->sh2drc_add_pcflush(0x6026398);
767767   m_slave->sh2drc_add_pcflush(0x6028cd6);
768768
769   install_common_protection();
769   install_sss_protection();
770770
771771   DRIVER_INIT_CALL(stv);
772772
r243192r243193
829829   m_slave->sh2drc_add_pcflush(0x6062bca);
830830
831831   DRIVER_INIT_CALL(stv);
832   install_common_protection();
832   install_twcup98_protection();
833833
834834   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(5);
835835}
r243192r243193
886886   m_maincpu->sh2drc_add_pcflush(0x604eac0);
887887   m_slave->sh2drc_add_pcflush(0x605340a);
888888
889   install_common_protection();
889   install_elandore_protection();
890890
891891   DRIVER_INIT_CALL(stv);
892892   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(0);
r243192r243193
897897   m_maincpu->sh2drc_add_pcflush(0x6034d04);
898898   m_slave->sh2drc_add_pcflush(0x6036152);
899899
900   install_common_protection();
900   install_rsgun_protection();
901901
902902   DRIVER_INIT_CALL(stv);
903903
r243192r243193
906906
907907DRIVER_INIT_MEMBER(stv_state,ffreveng)
908908{
909   install_common_protection();
909   install_ffreveng_protection();
910910   DRIVER_INIT_CALL(stv);
911911}
912912
913913DRIVER_INIT_MEMBER(stv_state,decathlt)
914914{
915   m_5838crypt->install_decathlt_protection();
915   m_decathlt_lastcount = 0;
916   m_decathlt_prot_uploadmode = 0;
917   m_decathlt_prot_uploadoffset = 0;
918   install_decathlt_protection();
916919   DRIVER_INIT_CALL(stv);
917920}
918921
r243192r243193
10191022   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
10201023   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
10211024
1022MACHINE_CONFIG_END
1023
1024static MACHINE_CONFIG_DERIVED( stv_5881, stv )
10251025   MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
10261026   MCFG_SET_READ_CALLBACK(stv_state, crypt_read_callback)
10271027MACHINE_CONFIG_END
10281028
1029
1030UINT16 stv_state::crypt_read_callback_ch1(UINT32 addr)
1031{
1032   return m_maincpu->space().read_word(0x02000000 + 0x1000000 + (addr * 2));
1033}
1034
1035UINT16 stv_state::crypt_read_callback_ch2(UINT32 addr)
1036{
1037   return m_maincpu->space().read_word(0x02000000 + 0x0000000 + (addr * 2));
1038}
1039
1040static MACHINE_CONFIG_DERIVED( stv_5838, stv )
1041   MCFG_DEVICE_ADD("315_5838", SEGA315_5838_COMP, 0)
1042   MCFG_SET_5838_READ_CALLBACK_CH1(stv_state, crypt_read_callback_ch1)
1043   MCFG_SET_5838_READ_CALLBACK_CH2(stv_state, crypt_read_callback_ch2)
1044MACHINE_CONFIG_END
1045
1046
10471029/*
10481030    Batman Forever has an extra ADSP, used for sound.
10491031    Similar if not the same as Magic the Gathering, probably needs merging.
r243192r243193
18431825   ROM_LOAD16_WORD_SWAP( "mpr20832.8",     0x1c00000, 0x0400000, CRC(af1b0985) SHA1(d7a0e4e0a8b0556915f924bdde8c3d14e5b3423e) ) // good (was .18s)
18441826   ROM_LOAD16_WORD_SWAP( "mpr20833.9",     0x2000000, 0x0400000, CRC(cb6af231) SHA1(4a2e5d7c2fd6179c19cdefa84a03f9a34fbb9e70) ) // good (was .19s)
18451827
1846   // 25349801    1998     317-5040-COM   ST-V      (yes, the 317-5040-COM chip was reused for 3 different games and on both Naomi and ST-V!)
1847   ROM_PARAMETER( ":315_5881:key", "052e2901" )
1828   ROM_REGION32_BE( 0x11ea0, "user2", 0 )
1829   // protection data (text layer tiles) extracted from Saturn version
1830   // stat_t.bin is name of the file from Saturn version CD
1831   ROM_LOAD( "stat_t.bin", 0x0000000, 0x11ea0,  BAD_DUMP CRC(52a0b542) SHA1(2b352dee919d7e7a5d338ece1691577d0b288eca) )
18481832ROM_END
18491833
18501834ROM_START( bakubaku )
r243192r243193
19891973   ROM_LOAD16_WORD_SWAP( "mpr21305.6",    0x1400000, 0x0400000, CRC(46cfc2a2) SHA1(8ca26bf8fa5ced040e815c125c13dd06d599e189) ) // good (was .16)
19901974   ROM_LOAD16_WORD_SWAP( "mpr21306.1",    0x1800000, 0x0400000, CRC(87a5929c) SHA1(b259341d7b0e1fa98959bf52d23db5c308a8efdd) ) // good (was .17)
19911975   ROM_LOAD16_WORD_SWAP( "mpr21308.8",    0x1c00000, 0x0400000, CRC(336ec1a4) SHA1(20d1fce050cf6132d284b91853a4dd5626372ef0) ) // good (was .18s)
1992
1993   //             1998     317-5043-COM   ST-V
1994   ROM_PARAMETER( ":315_5881:key", "05226d41" )
19951976ROM_END
19961977
19971978ROM_START( ffreveng )
r243192r243193
20051986   ROM_LOAD16_WORD_SWAP( "mpr21876.5",   0x1000000, 0x0400000, CRC(bb92a7fc) SHA1(d9e0fab1104a46adeb0a0cfc0d070d4c63a28d55) ) // good (was .15)
20061987   ROM_LOAD16_WORD_SWAP( "mpr21877.6",   0x1400000, 0x0400000, CRC(c22a4a75) SHA1(3276bc0628e71b432f21ba9a4f5ff7ccc8769cd9) ) // good (was .16)
20071988   ROM_LOAD16_WORD_SWAP( "opr21878.1",   0x1800000, 0x0200000, CRC(2ea4a64d) SHA1(928a973dce5eba0a1628d61ba56a530de990a946) ) // good (was .17)
2008
2009   //             1998     317-5049-COM   ST-V
2010   ROM_PARAMETER( ":315_5881:key", "0524ac01" )
20111989ROM_END
20121990
20131991/* set system to 1 player to test rom */
r243192r243193
22642242   ROM_LOAD16_WORD_SWAP( "mpr20960.3",   0x0800000, 0x0400000, CRC(b5ab9053) SHA1(87c5d077eb1219c35fa65b4e11d5b62e826f5236) ) // good (was .13)
22652243   ROM_LOAD16_WORD_SWAP( "mpr20961.4",   0x0c00000, 0x0400000, CRC(0e06295c) SHA1(0ec2842622f3e9dc5689abd58aeddc7e5603b97a) ) // good (was .14)
22662244   ROM_LOAD16_WORD_SWAP( "mpr20962.5",   0x1000000, 0x0400000, CRC(f1e6c7fc) SHA1(0ba0972f1bc7c56f4e0589d3e363523cea988bb0) ) // good (was .15)
2267
2268   //             1998     317-5041-COM   ST-V
2269   ROM_PARAMETER( ":315_5881:key", "05272d01" )
22702245ROM_END
22712246
22722247ROM_START( sandor )
r243192r243193
24552430
24562431   ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player
24572432   ROM_LOAD( "sss.nv", 0x0000, 0x0080, CRC(3473b2f3) SHA1(6480b4b321af8ee6e967710e74f2556c17bfca97) )
2458
2459   //             1998     317-5042-COM   ST-V
2460   ROM_PARAMETER( ":315_5881:key", "052b6901" )
24612433ROM_END
24622434
24632435ROM_START( suikoenb )
r243192r243193
24882460   ROM_LOAD16_WORD_SWAP( "mpr20822.3",    0x0800000, 0x0400000, CRC(8b33a5e2) SHA1(d5689ac8aad63509febe9aa4077351be09b2d8d4) ) // ic3 good (was .13)
24892461   ROM_LOAD16_WORD_SWAP( "mpr20823.4",    0x0c00000, 0x0400000, CRC(6e6d4e95) SHA1(c387d03ba27580c62ac0bf780915fdf41552df6f) ) // ic4 good (was .14)
24902462   ROM_LOAD16_WORD_SWAP( "mpr20824.5",    0x1000000, 0x0400000, CRC(4cf18a25) SHA1(310961a5f114fea8938a3f514dffd5231e910a5a) ) // ic5 good (was .15)
2491
2492   // 25209801    1998     317-5039-COM   ST-V
2493   ROM_PARAMETER( ":315_5881:key", "05200913" )
24942463ROM_END
24952464
24962465ROM_START( vfkids )
r243192r243193
30433012
30443013//GAME YEAR, NAME,     PARENT,  MACH, INP, INIT,      MONITOR
30453014/* Playable */
3046GAME( 1998, astrass,   stvbios, stv_5881, stv6b, stv_state,      astrass,    ROT0,   "Sunsoft",                      "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3015GAME( 1998, astrass,   stvbios, stv,      stv6b, stv_state,     astrass,    ROT0,   "Sunsoft",                      "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30473016GAME( 1995, bakubaku,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Baku Baku Animal (J 950407 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30483017GAME( 1996, batmanfr,  stvbios, batmanfr, stv, stv_state,        batmanfr,   ROT0,   "Acclaim",                      "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
30493018GAME( 1996, colmns97,  stvbios, stv,      stv, stv_state,        colmns97,   ROT0,   "Sega",                         "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30503019GAME( 1997, cotton2,   stvbios, stv,      stv, stv_state,        cotton2,    ROT0,   "Success",                      "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30513020GAME( 1998, cottonbm,  stvbios, stv,      stv, stv_state,        cottonbm,   ROT0,   "Success",                      "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30523021GAME( 1995, critcrsh,  stvbios, stv,      critcrsh, stv_state,   critcrsh,   ROT0,   "Sega",                         "Critter Crusher (EA 951204 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3053GAME( 1999, danchih,   stvbios, stv,      stvmp, stv_state,      danchih,    ROT0,   "Altron (Tecmo license)",       "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3022GAME( 1999, danchih,   stvbios, stv,      stvmp, stv_state,     danchih,    ROT0,   "Altron (Tecmo license)",       "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30543023GAME( 2000, danchiq,   stvbios, stv,      stv, stv_state,        danchiq,    ROT0,   "Altron",                       "Danchi de Quiz Okusan Yontaku Desuyo! (J 001128 V1.200)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30553024GAME( 1996, diehard,   stvbios, stv,      stv, stv_state,        diehard,    ROT0,   "Sega",                         "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND  )
30563025GAME( 1996, dnmtdeka,  diehard, stv,      stv, stv_state,        dnmtdeka,   ROT0,   "Sega",                         "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND  )
30573026GAME( 1995, ejihon,    stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Ejihon Tantei Jimusyo (J 950613 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3058GAME( 1998, elandore,  stvbios, stv_5881, stv6b, stv_state,      elandore,   ROT0,   "Sai-Mate",                     "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3059GAME( 1999, ffreveng,  stvbios, stv_5881, stv, stv_state,        ffreveng,   ROT0,   "Capcom",                       "Final Fight Revenge (JUET 990714 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30603027GAME( 1995, fhboxers,  stvbios, stv,      stv, stv_state,        fhboxers,   ROT0,   "Sega",                         "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30613028GAME( 1997, findlove,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Daiki / FCF",                  "Zenkoku Seifuku Bishoujo Grand Prix Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3062GAME( 1994, gaxeduel,  stvbios, stv,      stv6b, stv_state,      gaxeduel,   ROT0,   "Sega",                         "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS)
3029GAME( 1994, gaxeduel,  stvbios, stv,      stv6b, stv_state,     gaxeduel,   ROT0,   "Sega",                         "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS)
30633030GAME( 1998, grdforce,  stvbios, stv,      stv, stv_state,        grdforce,   ROT0,   "Success",                      "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3064GAME( 1998, groovef,   stvbios, stv,      stv6b, stv_state,      groovef,    ROT0,   "Atlus",                        "Groove on Fight - Gouketsuji Ichizoku 3 (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3031GAME( 1998, groovef,   stvbios, stv,      stv6b, stv_state,     groovef,    ROT0,   "Atlus",                        "Groove on Fight - Gouketsuji Ichizoku 3 (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30653032GAME( 1997, hanagumi,  stvbios, stv,      stv, stv_state,        hanagumi,   ROT0,   "Sega",                         "Sakura Taisen - Hanagumi Taisen Columns (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30663033GAME( 1996, introdon,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sunsoft / Success",            "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3067GAME( 1995, kiwames,   stvbios, stv,      stvmp, stv_state,      stvmp,      ROT0,   "Athena",                       "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3034GAME( 1995, kiwames,   stvbios, stv,      stvmp, stv_state,     stvmp,      ROT0,   "Athena",                       "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30683035GAME( 1997, maruchan,  stvbios, stv,      stv, stv_state,        maruchan,   ROT0,   "Sega / Toyosuisan",            "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30693036GAME( 1996, mausuke,   stvbios, stv,      stv, stv_state,        mausuke,    ROT0,   "Data East",                    "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30703037GAME( 1998, myfairld,  stvbios, stv,      myfairld, stv_state,   stvmp,      ROT0,   "Micronet",                     "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
r243192r243193
30723039GAME( 1995, pblbeach,  stvbios, stv,      stv, stv_state,        pblbeach,   ROT0,   "T&E Soft",                     "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30733040GAME( 1996, prikura,   stvbios, stv,      stv, stv_state,        prikura,    ROT0,   "Atlus",                        "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30743041GAME( 1996, puyosun,   stvbios, stv,      stv, stv_state,        puyosun,    ROT0,   "Compile",                      "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3075GAME( 1998, rsgun,     stvbios, stv_5881, stv, stv_state,        rsgun,      ROT0,   "Treasure",                     "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3042GAME( 1998, rsgun,     stvbios, stv,      stv, stv_state,        rsgun,      ROT0,   "Treasure",                     "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30763043GAME( 1998, sasissu,   stvbios, stv,      stv, stv_state,        sasissu,    ROT0,   "Sega",                         "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30773044GAME( 1999, sanjeon,   sasissu, stv,      stv, stv_state,        sanjeon,    ROT0,   "Sega / Deniam",                "DaeJeon! SanJeon SuJeon (AJTUE 990412 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30783045GAME( 1997, seabass,   stvbios, stv,      stv, stv_state,        seabass,    ROT0,   "A wave inc. (Able license)",   "Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30793046GAME( 1995, shanhigw,  stvbios, stv,      stv, stv_state,        shanhigw,   ROT0,   "Sunsoft / Activision",         "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30803047GAME( 1997, shienryu,  stvbios, stv,      stv, stv_state,        shienryu,   ROT270, "Warashi",                      "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3081GAME( 1998, sss,       stvbios, stv_5881, stv, stv_state,        sss,        ROT0,   "Capcom / Cave / Victor",       "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3048GAME( 1998, sss,       stvbios, stv,      stv, stv_state,        sss,        ROT0,   "Capcom / Cave / Victor",       "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30823049GAME( 1995, sandor,    stvbios, stv,      stv, stv_state,        sandor,     ROT0,   "Sega",                         "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30833050GAME( 1997, thunt,     sandor,  stv,      stv, stv_state,        thunt,      ROT0,   "Sega",                         "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30843051GAME( 1997, thuntk,    sandor,  stv,      stv, stv_state,        sandor,     ROT0,   "Sega / Deniam",                "Puzzle & Action: BoMulEul Chajara (JUET 970125 V2.00K)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3085GAME( 1998, twcup98,   stvbios, stv_5881, stv, stv_state,        twcup98,    ROT0,   "Tecmo",                        "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30863052GAME( 1995, smleague,  stvbios, stv,      stv, stv_state,        smleague,   ROT0,   "Sega",                         "Super Major League (U 960108 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30873053GAME( 1995, finlarch,  smleague,stv,      stv, stv_state,        finlarch,   ROT0,   "Sega",                         "Final Arch (J 950714 V1.001)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30883054GAME( 1996, sokyugrt,  stvbios, stv,      stv, stv_state,        sokyugrt,   ROT0,   "Raizing / Eighting",           "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
r243192r243193
30923058GAME( 1997, winterht,  stvbios, stv,      stv, stv_state,        winterht,   ROT0,   "Sega",                         "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30933059GAME( 1997, znpwfv,    stvbios, stv,      stv, stv_state,        znpwfv,     ROT0,   "Sega",                         "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30943060
3061/* Almost */
3062GAME( 1998, twcup98,   stvbios, stv,      stv, stv_state,        twcup98,    ROT0,   "Tecmo",                        "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3063GAME( 1998, elandore,  stvbios, stv,      stv6b, stv_state,     elandore,   ROT0,   "Sai-Mate",                     "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3064
30953065/* Unemulated printer / camera devices */
30963066GAME( 1998, stress,    stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Stress Busters (J 981020 V1.000)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30973067GAME( 1997, nclubv3,   stvbios, stv,      stv, stv_state,        nameclv3,   ROT0,   "Sega",                         "Name Club Ver.3 (J 970723 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
r243192r243193
31103080
31113081/* Doing something.. but not enough yet */
31123082GAME( 1995, vfremix,   stvbios, stv,      stv, stv_state,        vfremix,    ROT0,   "Sega",                         "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
3113GAME( 1996, decathlt,  stvbios, stv_5838, stv, stv_state,        decathlt,   ROT0,   "Sega",                         "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
3114GAME( 1996, decathlto, decathlt,stv_5838, stv, stv_state,        decathlt,   ROT0,   "Sega",                         "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
3083GAME( 1996, decathlt,  stvbios, stv,      stv, stv_state,        decathlt,   ROT0,   "Sega",                         "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
3084GAME( 1996, decathlto, decathlt,stv,      stv, stv_state,        decathlt,   ROT0,   "Sega",                         "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION )
31153085
31163086/* Gives I/O errors */
31173087GAME( 1996, magzun,    stvbios, stv,      stv, stv_state,        magzun,     ROT0,   "Sega",                         "Magical Zunou Power (J 961031 V1.000)", GAME_NOT_WORKING )
31183088GAME( 1997, techbowl,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Technical Bowling (J 971212 V1.000)", GAME_NOT_WORKING )
31193089GAME( 1999, micrombc,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Microman Battle Charge (J 990326 V1.000)", GAME_NOT_WORKING )
31203090
3091/* Black screen */
3092GAME( 1999, ffreveng,  stvbios, stv,      stv, stv_state,        ffreveng,   ROT0,   "Capcom",                       "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
3093
31213094/* CD games */
31223095GAME( 1995, sfish2,    0,       stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING )
31233096GAME( 1995, sfish2j,   sfish2,  stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Sport Fishing 2 (J 951201 V1.100)", GAME_NO_SOUND | GAME_NOT_WORKING )
trunk/src/mame/drivers/suna8.c
r243192r243193
17791779
17801780***************************************************************************/
17811781
1782WRITE_LINE_MEMBER(suna8_state::soundirq)
1783{
1784   m_audiocpu->set_input_line(0, state);
1785}
1786
17821787/* In games with only 2 CPUs, port A&B of the AY8910 are used
17831788   for sample playing. */
17841789
r243192r243193
19451950   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
19461951
19471952   MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 6)
1948   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1953   MCFG_YM3812_IRQ_HANDLER(WRITELINE(suna8_state, soundirq))
19491954   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
19501955   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
19511956
trunk/src/mame/drivers/taitottl.c
r243192r243193
33 Taito Discrete Hardware Games
44
55
6 Game Name(s)                                               Part #'s       Data      PROM/ROM Chip Numbers
7 ---------------------------------------------------------+--------------+---------+---------------------------------------
8 Astro Race (11/1973)                                                      UNKNOWN
9 Attack (09/1976)                                                          UNKNOWN
10 Attack UFO (08/1974)                                                      UNKNOWN
11 Avenger (??/1976) (clone of Electra's Avenger)                            UNKNOWN
12 Ball Park/TT Ball Park (??/1974)                                          UNKNOWN
13 Basketball (04/1974)                                                      UNKNOWN
14 Bombs Away (??/1977)                                                      UNKNOWN
15 Cisco/Fisco 400 (04/1977)                                                 UNKNOWN
16 Clean Sweep (??/1976) (clone of Ramtek's Clean Sweep)                     UNKNOWN
17 Clean Sweep II (??/1976) (clone of Ramtek's Clean Sweep)                  UNKNOWN
18 Crashing Race (06/1976)                                                   UNKNOWN
19 Cross Fire (08/1977) (aka Bazooka)                                        UNKNOWN
20 Davis Cup (12/1973)                                                       UNKNOWN
21 Dead Heat (??/1975)                                                       UNKNOWN
22 Elepong (07/1973)                                                         UNKNOWN
23 Flying Fortress (??/1977)                                                 UNKNOWN
24 Flying Fortress II (06/1977)                                             UNKNOWN
25 Gunman (10/1977)                                                          YES        8 x 32bytes (or 11? )
26 Interceptor (03/1976)                                                     UNKNOWN
27 Missile-X (??/1977)                                                       YES        10 - (5 x 512bytes, 5x32bytes)
28 Pro Hockey (11/1973)                                                      UNKNOWN
29 Road Champion (04/1977)                                                   UNKNOWN
30 Road Champion S (06/1977)                                                 UNKNOWN
31 Soccer (11/1973)                                                          UNKNOWN
32 Soccer DX (??/1977)                                                       UNKNOWN
33 Speed Race (11/1974)                                                      UNKNOWN
34 Speed Race CL-5 (10/1978)                                                 UNKNOWN
35 Speed Race Color (10/1978)                                                UNKNOWN
36 Speed Race DX (08/1975)                                                   UNKNOWN
37 Speed Race Twin (04/1976)                                                 UNKNOWN
38 Speed Race GP-5 (??/1980)                                                 UNKNOWN
39 Super Block (02/1978)                                                     UNKNOWN
40 Super Speed Race (12/1977)                                                UNKNOWN
41 Super Speed Race V (07/1978)                                              UNKNOWN
42 Super Speed Race GP-V (??/1980)                                           UNKNOWN
43 Table Football (??/1977)                                                  UNKNOWN
44 Tahitian (??/1975)                                                        UNKNOWN
45 Tennis (??/1977)                                                          UNKNOWN
46 T. T. Block (08/1977)                                                     YES        1 x 2048bytes
47 T. T. Block C (05/1978)                                                   UNKNOWN
48 T. T. Block CU (08/1978)                                                  UNKNOWN
49 T. T. Speed Race (??/1978)                                                UNKNOWN
50 Wall Block (08/1978)                                                      UNKNOWN
51 Wall Break (01/1977)                                                      UNKNOWN
52 Western Gun (09/1975)                                                     UNKNOWN
53 Zun Zun Block (04/1979)                                                   YES        3 - (2 x 512bytes, 1 x 32bytes)
6 Game Name(s)                                Part #'s    Data      PROM/ROM Chip Numbers
7 ------------------------------------------+-----------+---------+---------------------------------------
8 Acrobat (1978)                                          UNKNOWN
9 Astro Race (1973)                                       UNKNOWN
10 Avenger (1976) - Vertical                   EG-1020     UNKNOWN
11 Attack (1976)                                           UNKNOWN
12 Attack UFO (1974)                                       UNKNOWN
13 Barricade II (1977)                                     UNKNOWN
14 Basketball (1974)                                       UNKNOWN
15 Cisco/Fisco 400 (1977)                                  UNKNOWN
16 Crashing Race (1976)                                    UNKNOWN
17 Cross Fire (1977)                                       UNKNOWN - AKA Bazooka
18 Davis Cup (1973)                                        UNKNOWN
19 Elepong (1973)                                          UNKNOWN
20 Flying Fortress/Flying Fortress II (1977)               UNKNOWN
21 Gunman (1977)                                           YES        8 x 32bytes (or 11? )
22 Interceptor (1976)                                      UNKNOWN
23 Missile-X (1977)                                        YES        10 - (5 x 512bytes, 5x32bytes)
24 Pro Hockey (1973)                                       UNKNOWN
25 Road Champion (1978)                                    UNKNOWN
26 Sky Fighter 2 (1970)                                    UNKNOWN
27 Soccer (1973)                                           UNKNOWN
28 Speed Race (1974)                                       UNKNOWN
29 Speed Race Twin (1976)                                  UNKNOWN
30 Speed Race GP-5 (1980)                                  UNKNOWN
31 Sub Hunter (1977)                                       UNKNOWN
32 Super Block (1978) - Vertical                           UNKNOWN
33 Super Speed Race 5 (1978)                               UNKNOWN
34 Super Speed Race GP-V (1980)                            UNKNOWN
35 Top Bowler (1978)                                       UNKNOWN
36 T. T. Block (1977)                                      YES        1 x 2048bytes
37 Trampoline (1978)                                       UNKNOWN
38 Wall Block (1978)                                       UNKNOWN
39 Western Gun (1975)                                      UNKNOWN
40 Zun Zun Block (1979)                                    YES        3 - (2 x 512bytes, 1 x 32bytes)
5441
5542***************************************************************************/
5643
r243192r243193
226213 MS06   M8  74s287      missile animated graphics
227214 MS05   11F IM5610      200pt tank R->L graphic
228215 MS05   11E IM5610      200pt tank L->R graphic
229 MS04   N7  IM5610      player missile trajectory pattern
216 MS04   N7  IM5610       player missile trajectory pattern
230217 MS03   F3  IM5610      anti-missile ack-ack graphics
231218 MS02   L12 IM5610      missile left/right position
232219 MS01   D8  IM5610      100pt tanks graphics
233
220
234221*/
235222
236223ROM_START( missilex )
237224   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
238225
239226   ROM_REGION( 0x0800, "roms", ROMREGION_ERASE00 )
240   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
227   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
241228   ROM_LOAD( "ms09.6f",      0x0000, 0x0200, CRC(80787642) SHA1(9de2419f0ba16f9c2b06e417c1ebba441fdae053) )
242   ROM_LOAD( "ms08.2c",      0x0000, 0x0200, CRC(dd785590) SHA1(7ba6b6f6091595852d6feaef5a029b2aca684440) )
243   ROM_LOAD( "ms07.8n",      0x0000, 0x0200, CRC(e278d03a) SHA1(c40975e5807936fed40cda4a6881f6aef0e7f350) )
244   ROM_LOAD( "ms06.8m",      0x0000, 0x0200, CRC(fe6c9192) SHA1(d110e010cf685ee18479ca7f890fa9da2fa71603) )
245   ROM_LOAD( "ms05.11f",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
246   ROM_LOAD( "ms05.11e",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
247   ROM_LOAD( "ms04.7n",      0x0000, 0x0020, CRC(34d0bee4) SHA1(41848def6aeb128ec985c158f3ed01c5b20bdcf6) )
248   ROM_LOAD( "ms03.3f",      0x0000, 0x0020, CRC(d139f5fa) SHA1(29c05143d05553c2cb2831f9624f307f59436850) )
249   ROM_LOAD( "ms02.12l",     0x0000, 0x0020, CRC(157b7e68) SHA1(d1a98267af1562e6126faaf0850906224f8a608d) )
250   ROM_LOAD( "ms01.8d",      0x0000, 0x0020, CRC(e89e76c3) SHA1(1149b5d1f93baa8aecd54a618083cc13b63a894d) )
229   ROM_LOAD( "ms08.2c",      0x0000, 0x0200, CRC(dd785590) SHA1(7ba6b6f6091595852d6feaef5a029b2aca684440) )
230   ROM_LOAD( "ms07.8n",      0x0000, 0x0200, CRC(e278d03a) SHA1(c40975e5807936fed40cda4a6881f6aef0e7f350) )
231   ROM_LOAD( "ms06.8m",      0x0000, 0x0200, CRC(fe6c9192) SHA1(d110e010cf685ee18479ca7f890fa9da2fa71603) )
232   ROM_LOAD( "ms05.11f",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
233   ROM_LOAD( "ms05.11e",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
234   ROM_LOAD( "ms04.7n",      0x0000, 0x0020, CRC(34d0bee4) SHA1(41848def6aeb128ec985c158f3ed01c5b20bdcf6) )
235   ROM_LOAD( "ms03.3f",      0x0000, 0x0020, CRC(d139f5fa) SHA1(29c05143d05553c2cb2831f9624f307f59436850) )
236   ROM_LOAD( "ms02.12l",     0x0000, 0x0020, CRC(157b7e68) SHA1(d1a98267af1562e6126faaf0850906224f8a608d) )
237   ROM_LOAD( "ms01.8d",      0x0000, 0x0020, CRC(e89e76c3) SHA1(1149b5d1f93baa8aecd54a618083cc13b63a894d) )
251238ROM_END
252239
253240
trunk/src/mame/drivers/tbowl.c
r243192r243193
423423
424424GFXDECODE_END
425425
426/*** Sound Bits
426427
428*/
429
430WRITE_LINE_MEMBER(tbowl_state::irqhandler)
431{
432   m_audiocpu->set_input_line(0, state);
433}
434
435
427436/*** Machine Driver
428437
429438there are 3 boards, each with a cpu, boards b and c contain
r243192r243193
491500   MCFG_SPEAKER_STANDARD_MONO("mono")
492501
493502   MCFG_SOUND_ADD("ym1", YM3812, 4000000)
494   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
503   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tbowl_state, irqhandler))
495504   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
496505
497506   MCFG_SOUND_ADD("ym2", YM3812, 4000000)
trunk/src/mame/drivers/tecmo.c
r243192r243193
600600GFXDECODE_END
601601
602602
603
604WRITE_LINE_MEMBER(tecmo_state::irqhandler)
605{
606   m_soundcpu->set_input_line(0, state);
607}
608
603609MACHINE_RESET_MEMBER(tecmo_state,rygar)
604610{
605611   m_adpcm_pos = 0;
r243192r243193
641647   MCFG_SPEAKER_STANDARD_MONO("mono")
642648
643649   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* verified on pcb */
644   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
650   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tecmo_state, irqhandler))
645651   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
646652
647653   MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb, even if schematics shows a 384khz resonator */
r243192r243193
704710   MCFG_SPEAKER_STANDARD_MONO("mono")
705711
706712   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* verified on pcb */
707   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
713   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tecmo_state, irqhandler))
708714   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
709715
710716   /* no MSM on this PCB */
trunk/src/mame/drivers/toaplan1.c
r243192r243193
17601760GFXDECODE_END
17611761
17621762
1763WRITE_LINE_MEMBER(toaplan1_state::irqhandler)
1764{
1765   m_audiocpu->set_input_line(0, state);
1766}
1767
17631768#define PIXEL_CLOCK         (XTAL_28MHz/4)
17641769
17651770// HTOTAL and VTOTAL taken from CRTC registers (toaplan1_bcu_control_w)
r243192r243193
18111816   MCFG_SPEAKER_STANDARD_MONO("mono")
18121817
18131818   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1814   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1819   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
18151820   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18161821MACHINE_CONFIG_END
18171822
r243192r243193
18491854   MCFG_SPEAKER_STANDARD_MONO("mono")
18501855
18511856   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1852   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1857   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
18531858   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18541859MACHINE_CONFIG_END
18551860
r243192r243193
18871892   MCFG_SPEAKER_STANDARD_MONO("mono")
18881893
18891894   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1890   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1895   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
18911896   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18921897MACHINE_CONFIG_END
18931898
r243192r243193
19251930   MCFG_SPEAKER_STANDARD_MONO("mono")
19261931
19271932   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1928   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1933   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
19291934   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
19301935MACHINE_CONFIG_END
19311936
r243192r243193
19671972   MCFG_SPEAKER_STANDARD_MONO("mono")
19681973
19691974   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1970   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
1975   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
19711976   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
19721977MACHINE_CONFIG_END
19731978
r243192r243193
20032008   MCFG_SPEAKER_STANDARD_MONO("mono")
20042009
20052010   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
2006   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
2011   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
20072012   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20082013MACHINE_CONFIG_END
20092014
r243192r243193
20412046   MCFG_SPEAKER_STANDARD_MONO("mono")
20422047
20432048   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
2044   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
2049   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
20452050   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20462051MACHINE_CONFIG_END
20472052
r243192r243193
20772082   MCFG_SPEAKER_STANDARD_MONO("mono")
20782083
20792084   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)   /* verified on pcb */
2080   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
2085   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
20812086   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20822087MACHINE_CONFIG_END
20832088
trunk/src/mame/drivers/toaplan2.c
r243192r243193
30493049GFXDECODE_END
30503050
30513051
3052WRITE_LINE_MEMBER(toaplan2_state::irqhandler)
3053{
3054   if (m_audiocpu != NULL)       // wouldn't tekipaki have problem without this? "mcu" is not generally added
3055      m_audiocpu->set_input_line(0, state);
3056}
3057
30523058WRITE_LINE_MEMBER(toaplan2_state::bbakraid_irqhandler)
30533059{
30543060   // Not used ???  Connected to a test pin (TP082)
r243192r243193
30943100   MCFG_SPEAKER_STANDARD_MONO("mono")
30953101
30963102   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)
3097#ifdef USE_HD64x180
3098   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
3099#endif
3103   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
31003104   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
31013105MACHINE_CONFIG_END
31023106
r243192r243193
34073411   MCFG_SPEAKER_STANDARD_MONO("mono")
34083412
34093413   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)           /* verified on pcb */
3410   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
3414   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
34113415   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
34123416MACHINE_CONFIG_END
34133417
r243192r243193
34503454   MCFG_SPEAKER_STANDARD_MONO("mono")
34513455
34523456   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)
3453   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
3457   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
34543458   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
34553459MACHINE_CONFIG_END
34563460
trunk/src/mame/drivers/tourtabl.c
r243192r243193
2121      m_maincpu(*this, "maincpu") { }
2222
2323   required_device<cpu_device> m_maincpu;
24
24   
2525   DECLARE_WRITE8_MEMBER(tourtabl_led_w);
2626   DECLARE_READ16_MEMBER(tourtabl_read_input_port);
2727   DECLARE_READ8_MEMBER(tourtabl_get_databus_contents);
trunk/src/mame/drivers/twincobr.c
r243192r243193
646646GFXDECODE_END
647647
648648
649
650
651/* handler called by the 3812 emulator when the internal timers cause an IRQ */
652WRITE_LINE_MEMBER(twincobr_state::irqhandler)
653{
654   m_audiocpu->set_input_line(0, state);
655}
656
657
658
649659static MACHINE_CONFIG_START( twincobr, twincobr_state )
650660
651661   /* basic machine hardware */
r243192r243193
692702   MCFG_SPEAKER_STANDARD_MONO("mono")
693703
694704   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
695   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
705   MCFG_YM3812_IRQ_HANDLER(WRITELINE(twincobr_state, irqhandler))
696706   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
697707MACHINE_CONFIG_END
698708
trunk/src/mame/drivers/twinkle.c
r243192r243193
254254      m_maincpu(*this, "maincpu"),
255255      m_audiocpu(*this, "audiocpu")
256256   {
257      m_spu_hle[0x200] = 0;
258      m_spu_hle[0x202] = 0;
257259   }
258260
259261   required_device<am53cf96_device> m_am53cf96;
r243192r243193
262264
263265   UINT16 m_spu_ctrl;      // SPU board control register
264266   UINT8 m_spu_shared[0x400];  // SPU/PSX shared dual-ported RAM
267   UINT8 m_spu_hle[0x400];
265268   UINT32 m_spu_ata_dma;
266269   int m_spu_ata_dmarq;
267270
r243192r243193
282285   DECLARE_WRITE16_MEMBER(twinkle_waveram_w);
283286   DECLARE_READ16_MEMBER(shared_68k_r);
284287   DECLARE_WRITE16_MEMBER(shared_68k_w);
285   DECLARE_READ16_MEMBER(unk_68k_r);
286288   DECLARE_WRITE_LINE_MEMBER(spu_ata_irq);
287289   DECLARE_WRITE_LINE_MEMBER(spu_ata_dmarq);
288290   required_device<cpu_device> m_maincpu;
r243192r243193
669671
670672WRITE8_MEMBER(twinkle_state::shared_psx_w)
671673{
672//  printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
674   //printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
673675
674676   m_spu_shared[offset] = data;
675677
678   // HLE sound board
679   m_spu_hle[offset] = data;
680
676681   if (offset == 0x03fe && data == 0xff)
677682   {
678//      printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]);
683      //printf("spu command %02x %02x\n", m_spu_hle[1], m_spu_hle[3]);
679684
680      m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE);
685      for (int i = 0x200; i < 0x300; i++) m_spu_hle[i] = 0xea;
686
687      switch (m_spu_hle[1])
688      {
689      case 0x91: // hdd sum 1
690         m_spu_hle[0x200] = 0; // ?
691         m_spu_hle[0x202] = 0; // ?
692         break;
693
694      case 0x9a: // hdd sum 2
695         m_spu_hle[0x200] = 0; // ?
696         m_spu_hle[0x202] = 0; // ?
697         m_spu_hle[0x203] = 1; // Must be 1 to pass test
698         break;
699
700      case 0xa1: // version
701         m_spu_hle[0x200] = 0; // ?
702         m_spu_hle[0x202] = 0; // ?
703
704         if (strcmp(machine().system().name, "bmiidx") == 0 ||
705            strcmp(machine().system().name, "bmiidxa") == 0 ||
706            strcmp(machine().system().name, "bmiidxc") == 0 ||
707            strcmp(machine().system().name, "bmiidxca") == 0)
708         {
709            strcpy((char *)&m_spu_hle[0x204], "GQ863JA_A");
710         }
711         else if (strcmp(machine().system().name, "bmiidxs") == 0 ||
712            strcmp(machine().system().name, "bmiidxc2") == 0)
713         {
714            strcpy((char *)&m_spu_hle[0x204], "GC983JA_R");
715         }
716         else if (strcmp(machine().system().name, "bmiidx2") == 0)
717         {
718            strcpy((char *)&m_spu_hle[0x204], "GC985JA_A");
719         }
720         else if (strcmp(machine().system().name, "bmiidx3") == 0 ||
721            strcmp(machine().system().name, "bmiidx3a") == 0)
722         {
723            strcpy((char *)&m_spu_hle[0x204], "GC992JA_A");
724         }
725         else if (strcmp(machine().system().name, "bmiidx4") == 0)
726         {
727            strcpy((char *)&m_spu_hle[0x204], "GCA03JA_A");
728         }
729         else if (strcmp(machine().system().name, "bmiidx5") == 0)
730         {
731            strcpy((char *)&m_spu_hle[0x204], "GCA17JA_A");
732         }
733         else if (strcmp(machine().system().name, "bmiidx6") == 0 ||
734            strcmp(machine().system().name, "bmiidx6a") == 0)
735         {
736            strcpy((char *)&m_spu_hle[0x204], "GCB4UJA_A");
737         }
738         else if (strcmp(machine().system().name, "bmiidx7") == 0)
739         {
740            strcpy((char *)&m_spu_hle[0x204], "GCB44JA_A");
741         }
742         else if (strcmp(machine().system().name, "bmiidx8") == 0)
743         {
744            strcpy((char *)&m_spu_hle[0x204], "GCC44JA_A");
745         }
746         break;
747
748      case 0x30: // play sound [3]=sound code
749      case 0x51: // sound off
750      case 0x25: // spu rom error ([3]==0x0f)
751      case 0x26: // spu rom error ([3]==0x0f)
752      case 0x08: // spu rom error
753      case 0x40: // spu rom error ([3]==0x01 coin sound?)
754      case 0x2f: // spu rom error
755      case 0x52: // spu rom error
756      case 0x04: // spu rom error ([3]==?)
757         m_spu_hle[0x200] = 0;
758         m_spu_hle[0x202] = 0;
759         break;
760      }
681761   }
682762}
683763
684764READ8_MEMBER(twinkle_state::shared_psx_r)
685765{
686   UINT32 result = m_spu_shared[offset];
766   //UINT32 result = m_spu_shared[offset];
767   UINT32 result = m_spu_hle[offset];
687768
688769   //printf("shared_psx_r: %04x, %04x, %04x\n", offset, result, mem_mask);
689770
r243192r243193
722803/*
723804    System control register (Konami always has one)
724805
725    bit 7  = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be an RF5C400-related timer, or some free-running timing source)
806    bit 7  = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be vblank)
726807    bit 8  = write 0 to ack IRQ 2, write 1 to enable (IRQ 2 appears to be DMA completion)
727    bit 9  = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 is "command available")
728    bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is the ATA IRQ)
729    bit 11 = watchdog toggle
808    bit 9  = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 appears to be "command sent", unsure how the MIPS causes it yet however)
809    bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is IDE)
810    bit 11 = watchdog toggle?
730811
731812    Other bits unknown.
732813*/
r243192r243193
755836WRITE16_MEMBER(twinkle_state::spu_ata_dma_low_w)
756837{
757838   m_spu_ata_dma = (m_spu_ata_dma & ~0xffff) | data;
839
840   //printf("dma_low %08x\n", m_spu_ata_dma * 2);
758841}
759842
760843WRITE16_MEMBER(twinkle_state::spu_ata_dma_high_w)
761844{
762845   m_spu_ata_dma = (m_spu_ata_dma & 0xffff) | (data << 16);
846
847   //printf("dma_high %08x\n", m_spu_ata_dma * 2);
763848}
764849
765850WRITE_LINE_MEMBER(twinkle_state::spu_ata_dmarq)
r243192r243193
779864            //waveram[m_spu_ata_dma++] = (data >> 8) | (data << 8);
780865            // bp 4a0e ;bmiidx4 checksum
781866            // bp 4d62 ;bmiidx4 dma
782
783            // $$$HACK - game DMAs nothing useful to 0x400000 but all sound plays are 0x400000 or above
784            //           so limit sound RAM to 4MB (there's 6 MB on the board) and let the 5c400's address masking
785            //           work for us until we figure out what's actually going on.
786            if (m_spu_ata_dma < 0x200000)
787            {
788               m_waveram[m_spu_ata_dma++] = data;
789            }
867            m_waveram[m_spu_ata_dma++] = data;
790868         }
791869
792870         m_ata->write_dmack(CLEAR_LINE);
r243192r243193
808886{
809887   UINT16 result = m_spu_shared[offset];
810888
811//  printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
889   //printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
812890
813891   return result;
814892}
815893
816894WRITE16_MEMBER(twinkle_state::shared_68k_w)
817895{
818//  printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
896   //printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
819897
820898   m_spu_shared[offset] = data & 0xff;
821899}
822900
823READ16_MEMBER(twinkle_state::unk_68k_r)
824{
825   return 0xffff;  // must return 0xff for 68000 POST to complete properly
826}
827
828901static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state )
829902   AM_RANGE(0x000000, 0x07ffff) AM_ROM
830903   AM_RANGE(0x100000, 0x13ffff) AM_RAM
831   AM_RANGE(0x200000, 0x200001) AM_READ(unk_68k_r)
832904   // 220000 = LEDs?
833905   AM_RANGE(0x230000, 0x230003) AM_WRITE(twinkle_spu_ctrl_w)
834906   AM_RANGE(0x240000, 0x240003) AM_WRITE(spu_ata_dma_low_w)
r243192r243193
837909   AM_RANGE(0x280000, 0x280fff) AM_READWRITE(shared_68k_r, shared_68k_w)
838910   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs0, write_cs0)
839911   // 34000E = ???
840   AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP
841912   AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)
842   AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )
843   AM_RANGE(0xfe0000, 0xffffff) AM_RAM // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?)
913   AM_RANGE(0x800000, 0xffffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )    // 8 MB window wave RAM
844914ADDRESS_MAP_END
845915
846916/* SCSI */
r243192r243193
9411011
9421012   MCFG_CPU_ADD("audiocpu", M68000, 32000000/2)    /* 16.000 MHz */
9431013   MCFG_CPU_PROGRAM_MAP( sound_map )
944   MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq1_line_assert, 60)
945   MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq2_line_assert, 60)
9461014
9471015   MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1200)) /* check TD pin on LTC1232 */
9481016
r243192r243193
10811149   ROM_REGION32_LE( 0x080000, "audiocpu", 0 )\
10821150   ROM_LOAD16_WORD_SWAP( "863a05.2x",    0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) )\
10831151\
1084   ROM_REGION16_LE(0x400000, "rfsnd", ROMREGION_ERASE00)
1152   ROM_REGION16_LE(0x1800000, "rfsnd", ROMREGION_ERASE00)
10851153
10861154ROM_START( gq863 )
10871155   TWINKLE_BIOS
trunk/src/mame/drivers/tx1.c
r243192r243193
795795   ROM_REGION( 0x10000, "audio_cpu", 0 )
796796   ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) )
797797
798   ROM_REGION( 0x8000, "char_tiles", 0 )
798   ROM_REGION( 0x20000, "char_tiles", 0 )
799799   ROM_LOAD( "8411-136027-156.204", 0x0000, 0x4000, CRC(60f3c616) SHA1(59c4361891e4274e27e6279c919e8fd6803af7cf) )
800800   ROM_LOAD( "8411-136027-155.174", 0x4000, 0x4000, CRC(e59a6b72) SHA1(c10efa77ab421ac60b97227a8d547f50f8415670) )
801801
802   ROM_REGION( 0x10000, "obj_tiles", 0 )
802   ROM_REGION( 0x40000, "obj_tiles", 0 )
803803   ROM_LOAD( "8411-136027-114.203", 0x0000, 0x4000, CRC(fc91328b) SHA1(e57fd2056b65d37cf2e1f0af56616c6555df3006) )
804804   ROM_LOAD( "8411-136027-116.258", 0x4000, 0x4000, CRC(5745f671) SHA1(6e471633cd6de9926b3361a84430c088e1f6a097) )
805805   ROM_LOAD( "8411-136027-115.173", 0x8000, 0x4000, CRC(720e5873) SHA1(151d9063c35b26f5876cf94bdf0c2665ec701bbd) )
806806   ROM_LOAD( "8411-136027-117.232", 0xc000, 0x4000, CRC(3c68d0bc) SHA1(2dbaf2a268b90214fd61c016ac945d4371057826) )
807807
808   ROM_REGION( 0x6000, "road", 0 )
808   ROM_REGION( 0x40000, "gfx3", 0 )
809809   ROM_LOAD( "8411-136027-146.56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) )
810810   ROM_LOAD( "8411-136027-147.66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) )
811811   ROM_LOAD( "8411-136027-148.76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) )
r243192r243193
816816   ROM_LOAD16_BYTE( "136027-143.ic223",    0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
817817   ROM_LOAD16_BYTE( "136027-142.ic213",    0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
818818
819   ROM_REGION( 0x8000, "obj_map", 0 )
819   ROM_REGION( 0x50000, "obj_map", 0 )
820820   ROM_LOAD( "8411-136027-119.106", 0x0000, 0x4000, CRC(88eec0fb) SHA1(81d7a69dc1a4b3b81d7f28d97a3f80697cdcc6eb) )
821821   ROM_LOAD( "8411-136027-120.73",  0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) )
822822
823   ROM_REGION( 0x6000, "obj_luts", 0 )
823   ROM_REGION( 0x50000, "user3", 0 )
824824   ROM_LOAD( "8411-136027-113.48",  0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) )
825825   ROM_LOAD( "8411-136027-118.281", 0x2000, 0x4000, CRC(de418dc7) SHA1(1233e2f7499ec5a73a40ee336d3fe26c06187784) )
826826
r243192r243193
882882   ROM_REGION( 0x10000, "audio_cpu", 0 )
883883   ROM_LOAD( "tx1_22h.ic9", 0x00000, 0x2000, CRC(66376232) SHA1(b8a026dae47173e7760eea4f52e67e525ad1b70b) )
884884
885   ROM_REGION( 0x8000, "char_tiles", 0 )
885   ROM_REGION( 0x20000, "char_tiles", 0 )
886886   ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) )
887887   ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) )
888888
889   ROM_REGION( 0x10000, "obj_tiles", 0 )
889   ROM_REGION( 0x40000, "obj_tiles", 0 )
890890   ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) )
891891   ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, CRC(0ad36d68) SHA1(fd5a65c56557c1bc9c0f3916f15f62500b52bfe0) )
892892   ROM_LOAD( "tx1_15b.ic173", 0x8000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) )
893893   ROM_LOAD( "tx1_17b.ic232", 0xc000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) )
894894
895   ROM_REGION( 0x6000, "road", 0 )
895   ROM_REGION( 0x40000, "gfx3", 0 )
896896   ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) )
897897   ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) )
898898   ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) )
r243192r243193
903903   ROM_LOAD16_BYTE( "xb02b.ic223",   0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
904904   ROM_LOAD16_BYTE( "xb01b.ic213",   0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
905905
906   ROM_REGION( 0x8000, "obj_map", 0 )
906   ROM_REGION( 0x50000, "obj_map", 0 )
907907   ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) )
908908   ROM_LOAD( "tx1_13b.ic73",  0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) )
909909
910   ROM_REGION( 0x6000, "obj_luts", 0 )
910   ROM_REGION( 0x50000, "user3", 0 )
911911   ROM_LOAD( "tx1_12b.ic48",  0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) )
912912   ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, CRC(cb250de6) SHA1(4bf3006986fb8cbb3dd4fa988e6471633614e4bb) )
913913
r243192r243193
963963   ROM_REGION( 0x10000, "audio_cpu", 0 ) /* Label was missing */
964964   ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) ) /* Unconfirmed TC013A or the later TC013B */
965965
966   ROM_REGION( 0x8000, "char_tiles", 0 )
966   ROM_REGION( 0x20000, "char_tiles", 0 )
967967   ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) )
968968   ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) )
969969
970   ROM_REGION( 0x10000, "obj_tiles", 0 )
970   ROM_REGION( 0x40000, "obj_tiles", 0 )
971971   ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) )
972972   ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, CRC(0ad36d68) SHA1(fd5a65c56557c1bc9c0f3916f15f62500b52bfe0) )
973973   ROM_LOAD( "tx1_15b.ic173", 0x8000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) )
974974   ROM_LOAD( "tx1_17b.ic232", 0xc000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) )
975975
976   ROM_REGION( 0x6000, "road", 0 )
976   ROM_REGION( 0x40000, "gfx3", 0 )
977977   ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) )
978978   ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) )
979979   ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) )
r243192r243193
984984   ROM_LOAD16_BYTE( "xb02b.ic223",   0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
985985   ROM_LOAD16_BYTE( "xb01b.ic213",   0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
986986
987   ROM_REGION( 0x8000, "obj_map", 0 )
987   ROM_REGION( 0x50000, "obj_map", 0 )
988988   ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) )
989989   ROM_LOAD( "tx1_13b.ic73",  0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) )
990990
991   ROM_REGION( 0x6000, "obj_luts", 0 )
991   ROM_REGION( 0x50000, "user3", 0 )
992992   ROM_LOAD( "tx1_12b.ic48",  0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) )
993993   ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, CRC(cb250de6) SHA1(4bf3006986fb8cbb3dd4fa988e6471633614e4bb) )
994994
r243192r243193
10721072   ROM_LOAD( "bug25.157", 0x2c000, 0x4000, CRC(80c4e045) SHA1(be3b537d3ed3ee74fc51059aa744dca4d63431f6) )
10731073   ROM_RELOAD(            0x38000, 0x4000 )
10741074
1075   ROM_REGION( 0x8000, "road", 0 )
1075   ROM_REGION( 0x40000, "road", 0 )
10761076   ROM_LOAD( "bug12.58", 0x0000, 0x2000, CRC(bd34d55c) SHA1(05a719a6eff5af3aaaa1e0ee783b18597582ed64) )
10771077   ROM_LOAD( "bug11.57", 0x2000, 0x2000, CRC(a44d43eb) SHA1(c4d68c7e123506acaa6adc353579cac19ecb3a9d) )
10781078   ROM_LOAD( "bb3.137",  0x4000, 0x0200, CRC(ad76f3fb) SHA1(bf96f903b32e009a2592df0f28cc3e20b039f4d4) )
r243192r243193
10861086   ROM_LOAD16_BYTE( "bb1.245",   0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )
10871087   ROM_LOAD16_BYTE( "bb2.220",   0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )
10881088
1089   ROM_REGION( 0x10000, "obj_map", 0 )
1089   ROM_REGION( 0x100000, "obj_map", 0 )
10901090   ROM_LOAD( "bug16.210", 0x0000, 0x4000, CRC(8b64409e) SHA1(1fb4c6923e6a9e1f2a63a2c335b63e2bdc44b61f) )
10911091   ROM_LOAD( "bug14.209", 0x4000, 0x4000, CRC(4e765282) SHA1(f7d69d39823a8b33bd0e5b1bd78a5d68a293e221) )
10921092   ROM_LOAD( "bug17.182", 0x8000, 0x4000, CRC(a5d84df6) SHA1(4e33ef0bee383e0d47b0c679cd2a54edb7ca0e3e) )
10931093   ROM_LOAD( "bug15.181", 0xc000, 0x4000, CRC(d519de10) SHA1(535d05e11af65be65f3d9924b0c48faf8dcfd1bf) )
10941094
1095   ROM_REGION( 0x6000, "obj_luts", 0 )
1095   ROM_REGION( 0x10000, "obj_luts", 0 )
10961096   ROM_LOAD( "bug13.124", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
10971097   ROM_LOAD( "bug18.156", 0x2000, 0x4000, CRC(e58321a6) SHA1(81be87d3c6046bb375c74362dc940f0269b39d1d) )
10981098
r243192r243193
11611161   ROM_LOAD( "bug30s.145", 0x20000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) )
11621162   ROM_LOAD( "bug23s.142", 0x28000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) )
11631163
1164   ROM_REGION( 0x8000, "road", 0 )
1164   ROM_REGION( 0x40000, "road", 0 )
11651165   ROM_LOAD( "bug11s.225",0x0000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) )
11661166   ROM_LOAD( "bb3s.195",  0x4000, 0x0200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) )
11671167   ROM_LOAD( "bb4s.193",  0x4200, 0x0200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) )
r243192r243193
11741174   ROM_LOAD16_BYTE( "bb1.163",  0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) )
11751175   ROM_LOAD16_BYTE( "bb2.162",  0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) )
11761176
1177   ROM_REGION( 0x10000, "obj_map", 0 )
1177   ROM_REGION( 0x100000, "obj_map", 0 )
11781178   ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
11791179   ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
11801180
1181   ROM_REGION( 0x6000, "obj_luts", 0 )
1181   ROM_REGION( 0x10000, "obj_luts", 0 )
11821182   ROM_LOAD( "bug13.32",   0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
11831183   ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
11841184
trunk/src/mame/drivers/vegaeo.c
r243192r243193
2626
2727   UINT32 *m_vega_vram;
2828   UINT8 m_vega_vbuffer;
29
29   
3030   DECLARE_WRITE32_MEMBER(vega_vram_w);
3131   DECLARE_READ32_MEMBER(vega_vram_r);
3232   DECLARE_WRITE32_MEMBER(vega_misc_w);
trunk/src/mame/drivers/vicdual.c
r243192r243193
35353535GAME( 1981, pulsar,     0,        pulsar,    pulsar,    driver_device, 0, ROT270, "Sega", "Pulsar", GAME_IMPERFECT_SOUND )
35363536GAME( 1979, heiankyo,   0,        heiankyo,  heiankyo,  driver_device, 0, ROT270, "Denki Onkyo", "Heiankyo Alien", GAME_NO_SOUND )
35373537GAME( 19??, alphaho,    0,        alphaho,   alphaho,   driver_device, 0, ROT270, "Data East Corporation", "Alpha Fighter / Head On", GAME_WRONG_COLORS | GAME_NO_SOUND )
3538
trunk/src/mame/drivers/wardner.c
r243192r243193
146146
147147   DECLARE_WRITE8_MEMBER(wardner_bank_w);
148148   DECLARE_DRIVER_INIT(wardner);
149   DECLARE_WRITE_LINE_MEMBER(irqhandler);
149150
150151protected:
151152   virtual void driver_start();
r243192r243193
336337};
337338
338339
340/* handler called by the 3812 emulator when the internal timers cause an IRQ */
341WRITE_LINE_MEMBER(wardner_state::irqhandler)
342{
343   m_audiocpu->set_input_line(0, state);
344}
345
346
339347static GFXDECODE_START( wardner )
340348   GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   1536, 32 )  /* colors 1536-1791 */
341349   GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout,   1280, 16 )  /* colors 1280-1535 */
r243192r243193
411419   MCFG_SPEAKER_STANDARD_MONO("mono")
412420
413421   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_14MHz/4)
414   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
422   MCFG_YM3812_IRQ_HANDLER(WRITELINE(wardner_state, irqhandler))
415423   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
416424MACHINE_CONFIG_END
417425
trunk/src/mame/drivers/yunsun16.c
r243192r243193
582582                                Magic Bubble
583583***************************************************************************/
584584
585WRITE_LINE_MEMBER(yunsun16_state::soundirq)
586{
587   m_audiocpu->set_input_line(0, state);
588}
589
585590static MACHINE_CONFIG_START( magicbub, yunsun16_state )
586591
587592   /* basic machine hardware */
r243192r243193
609614   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
610615
611616   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_16MHz/4)
612   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
617   MCFG_YM3812_IRQ_HANDLER(WRITELINE(yunsun16_state, soundirq))
613618   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
614619   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
615620
trunk/src/mame/drivers/zn.c
r243192r243193
8383   DECLARE_READ16_MEMBER(bam2_unk_r);
8484   DECLARE_WRITE16_MEMBER(acpsx_00_w);
8585   DECLARE_WRITE16_MEMBER(acpsx_10_w);
86   DECLARE_WRITE16_MEMBER(nbajamex_bank_w);
8786   DECLARE_WRITE16_MEMBER(nbajamex_80_w);
8887   DECLARE_READ16_MEMBER(nbajamex_08_r);
8988   DECLARE_READ16_MEMBER(nbajamex_80_r);
r243192r243193
20352034   verboselog(0, "acpsx_00_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20362035}
20372036
2038WRITE16_MEMBER(zn_state::nbajamex_bank_w)
2039{
2040   UINT32 newbank = 0;
2041
2042   verboselog(0, "nbajamex_bank_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2043
2044   if (offset > 1)
2045   {
2046      logerror("Unknown banking offset %x!\n", offset);
2047   }
2048
2049   if (offset == 1)
2050   {
2051      data -= 1;
2052   }
2053
2054   if (data <= 1)
2055   {
2056      newbank = (data * 0x400000);
2057   }
2058   else if (data >= 0x10)
2059   {
2060      data -= 0x10;
2061      newbank = (data * 0x400000);
2062      newbank += 0x200000;
2063   }
2064
2065   if (offset == 0)
2066   {
2067      membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() + newbank);
2068   }
2069   else if (offset == 1)
2070   {
2071      newbank += 0x200000;
2072      membank( "bankedroms2" )->set_base( memregion( "bankedroms" )->base() + newbank);
2073   }
2074}
2075
20762037WRITE16_MEMBER(zn_state::acpsx_10_w)
20772038{
20782039   verboselog(0, "acpsx_10_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20792040}
20802041
2081// all 16 bits goes to the external soundboard's latch (see sound test menu)
20822042WRITE16_MEMBER(zn_state::nbajamex_80_w)
20832043{
20842044   verboselog(0, "nbajamex_80_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20852045   psxirq_device *psxirq = (psxirq_device *) machine().device("maincpu:irq");
20862046   psxirq->intin10(1);
2047   membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() + (data ? 0xe00000 : 0));
20872048}
20882049
20892050READ16_MEMBER(zn_state::nbajamex_08_r)
r243192r243193
20932054   return data;
20942055}
20952056
2096// possibly a readback from the external soundboard?
20972057READ16_MEMBER(zn_state::nbajamex_80_r)
20982058{
20992059   UINT32 data = 0xffffffff;
r243192r243193
21102070
21112071static ADDRESS_MAP_START(nbajamex_map, AS_PROGRAM, 32, zn_state)
21122072   AM_RANGE(0x1f000000, 0x1f1fffff) AM_ROMBANK("bankedroms")
2113   AM_RANGE(0x1f200000, 0x1f7fffff) AM_ROMBANK("bankedroms2")
2114   AM_RANGE(0x1fbfff00, 0x1fbfff07) AM_WRITE16(nbajamex_bank_w, 0xffffffff)
2073   AM_RANGE(0x1f200000, 0x1f207fff) AM_RAM AM_SHARE("eeprom")
21152074   AM_RANGE(0x1fbfff08, 0x1fbfff0b) AM_READ16(nbajamex_08_r, 0xffff)
21162075   AM_RANGE(0x1fbfff80, 0x1fbfff83) AM_READWRITE16(nbajamex_80_r, nbajamex_80_w, 0xffff)
21172076
r243192r243193
21212080MACHINE_RESET_MEMBER(zn_state,nbajamex)
21222081{
21232082   membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() );
2124   membank( "bankedroms2" )->set_base( memregion( "bankedroms" )->base() + 0x200000 );
21252083}
21262084
21272085static ADDRESS_MAP_START(jdredd_map, AS_PROGRAM, 32, zn_state)
r243192r243193
48674825/* it in every zip file */
48684826GAME( 1995, acpsx,    0,        coh1000a, zn,     driver_device, 0, ROT0, "Acclaim", "Acclaim PSX", GAME_IS_BIOS_ROOT )
48694827
4870GAME( 1996, nbajamex, acpsx,    nbajamex, zn,     driver_device, 0, ROT0, "Acclaim", "NBA Jam Extreme", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
4828GAME( 1996, nbajamex, acpsx,    nbajamex, zn,     driver_device, 0, ROT0, "Acclaim", "NBA Jam Extreme", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
48714829GAME( 1996, jdredd,   acpsx,    jdredd,   jdredd, driver_device, 0, ROT0, "Acclaim", "Judge Dredd (Rev C Dec. 17 1997)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
48724830GAME( 1996, jdreddb,  jdredd,   jdredd,   jdredd, driver_device, 0, ROT0, "Acclaim", "Judge Dredd (Rev B Nov. 26 1997)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
48734831
trunk/src/mame/includes/actfancr.h
r243192r243193
2323   required_shared_ptr<UINT8> m_main_ram;
2424   UINT16 m_spriteram16[0x800/2]; // a 16-bit copy of spriteram for use with the MXC06 code
2525
26   /* video-related */
27   int                 m_flipscreen;
28
2629   /* misc */
2730   int            m_trio_control_select;
2831
r243192r243193
3639   DECLARE_READ8_MEMBER(triothep_control_r);
3740   DECLARE_WRITE8_MEMBER(actfancr_sound_w);
3841   DECLARE_WRITE8_MEMBER(actfancr_buffer_spriteram_w);
42   virtual void video_start();
43   DECLARE_MACHINE_START(actfancr);
44   DECLARE_MACHINE_RESET(actfancr);
3945   DECLARE_MACHINE_START(triothep);
4046   DECLARE_MACHINE_RESET(triothep);
4147   UINT32 screen_update_actfancr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48   void register_savestate(  );
49   DECLARE_WRITE_LINE_MEMBER(sound_irq);
4250};
trunk/src/mame/includes/aerofgt.h
r243192r243193
123123   void spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
124124   void aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
125125   void wbbc97_draw_bitmap( bitmap_rgb32 &bitmap );
126   DECLARE_WRITE_LINE_MEMBER(irqhandler);
126127   required_device<cpu_device> m_maincpu;
127128   optional_device<okim6295_device> m_oki;
128129   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/alpha68k.h
r243192r243193
115115   void jongbou_video_banking(int *bank, int data);
116116   void kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
117117   void sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
118   DECLARE_WRITE_LINE_MEMBER(ym3812_irq);
118119   required_device<cpu_device> m_maincpu;
119120   required_device<gfxdecode_device> m_gfxdecode;
120121   required_device<palette_device> m_palette;
trunk/src/mame/includes/bogeyman.h
r243192r243193
44
55*************************************************************************/
66
7#include "sound/ay8910.h"
8
97class bogeyman_state : public driver_device
108{
119public:
1210   bogeyman_state(const machine_config &mconfig, device_type type, const char *tag)
1311      : driver_device(mconfig, type, tag),
14      m_maincpu(*this, "maincpu"),
15      m_gfxdecode(*this, "gfxdecode"),
16      m_palette(*this, "palette"),
17      m_ay1(*this, "ay1"),
18      m_ay2(*this, "ay2"),
1912      m_videoram(*this, "videoram"),
2013      m_videoram2(*this, "videoram2"),
2114      m_colorram(*this, "colorram"),
2215      m_colorram2(*this, "colorram2"),
23      m_spriteram(*this, "spriteram")  { }
16      m_spriteram(*this, "spriteram"),
17      m_maincpu(*this, "maincpu"),
18      m_gfxdecode(*this, "gfxdecode"),
19      m_palette(*this, "palette") { }
2420
25   /* devices */
26   required_device<cpu_device> m_maincpu;
27   required_device<gfxdecode_device> m_gfxdecode;
28   required_device<palette_device> m_palette;
29   required_device<ay8910_device> m_ay1;
30   required_device<ay8910_device> m_ay2;
31
3221   /* memory pointers */
3322   required_shared_ptr<UINT8> m_videoram;
3423   required_shared_ptr<UINT8> m_videoram2;
r243192r243193
4534   int        m_psg_latch;
4635   int        m_last_write;
4736   int        m_colbank;
48
49   DECLARE_WRITE8_MEMBER(ay8910_latch_w);
50   DECLARE_WRITE8_MEMBER(ay8910_control_w);
51   DECLARE_WRITE8_MEMBER(videoram_w);
52   DECLARE_WRITE8_MEMBER(colorram_w);
53   DECLARE_WRITE8_MEMBER(videoram2_w);
54   DECLARE_WRITE8_MEMBER(colorram2_w);
55   DECLARE_WRITE8_MEMBER(paletteram_w);
56   DECLARE_WRITE8_MEMBER(colbank_w);
57
37   DECLARE_WRITE8_MEMBER(bogeyman_8910_latch_w);
38   DECLARE_WRITE8_MEMBER(bogeyman_8910_control_w);
39   DECLARE_WRITE8_MEMBER(bogeyman_videoram_w);
40   DECLARE_WRITE8_MEMBER(bogeyman_colorram_w);
41   DECLARE_WRITE8_MEMBER(bogeyman_videoram2_w);
42   DECLARE_WRITE8_MEMBER(bogeyman_colorram2_w);
43   DECLARE_WRITE8_MEMBER(bogeyman_paletteram_w);
44   DECLARE_WRITE8_MEMBER(bogeyman_colbank_w);
5845   TILE_GET_INFO_MEMBER(get_bg_tile_info);
5946   TILE_GET_INFO_MEMBER(get_fg_tile_info);
60
6147   virtual void machine_start();
6248   virtual void machine_reset();
6349   virtual void video_start();
64
6550   DECLARE_PALETTE_INIT(bogeyman);
66   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
51   UINT32 screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
52   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
53   required_device<cpu_device> m_maincpu;
54   required_device<gfxdecode_device> m_gfxdecode;
55   required_device<palette_device> m_palette;
6856};
trunk/src/mame/includes/calomega.h
r243192r243193
5151   TILE_GET_INFO_MEMBER(get_bg_tile_info);
5252   UINT32 screen_update_calomega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5353   DECLARE_PALETTE_INIT(calomega);
54
54   
5555protected:
5656   virtual void video_start();
5757
r243192r243193
6464
6565   required_shared_ptr<UINT8> m_videoram;
6666   required_shared_ptr<UINT8> m_colorram;
67
67   
6868   optional_ioport m_in0;
6969   optional_ioport m_in0_0;
7070   optional_ioport m_in0_1;
r243192r243193
7272   optional_ioport m_in0_3;
7373   optional_ioport m_frq;
7474   optional_ioport m_sw2;
75
75     
7676   UINT8 m_tx_line;
7777   int m_s903_mux_data;
7878   int m_s905_mux_data;
trunk/src/mame/includes/crospang.h
r243192r243193
1515      m_bg_videoram(*this, "bg_videoram"),
1616      m_spriteram(*this, "spriteram"),
1717      m_sprgen(*this, "spritegen"),
18      m_audiocpu(*this, "audiocpu"),
1819      m_maincpu(*this, "maincpu"),
1920      m_gfxdecode(*this, "gfxdecode") { }
2021
r243192r243193
3132   int       m_bestri_tilebank;
3233
3334   /* devices */
35   required_device<cpu_device> m_audiocpu;
3436   DECLARE_WRITE16_MEMBER(crospang_soundlatch_w);
3537   DECLARE_WRITE16_MEMBER(bestri_tilebank_w);
3638   DECLARE_WRITE16_MEMBER(bestri_bg_scrolly_w);
r243192r243193
5153   virtual void video_start();
5254   UINT32 screen_update_crospang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5355   void tumblepb_gfx1_rearrange();
56   DECLARE_WRITE_LINE_MEMBER(irqhandler);
5457   required_device<cpu_device> m_maincpu;
5558   required_device<gfxdecode_device> m_gfxdecode;
5659};
trunk/src/mame/includes/dec0.h
r243192r243193
2424      m_paletteram(*this, "palette"),
2525      m_robocop_shared_ram(*this, "robocop_shared"),
2626      m_hippodrm_shared_ram(*this, "hippodrm_shared") { }
27
27     
2828   required_device<cpu_device> m_maincpu;
2929   required_device<cpu_device> m_audiocpu;
3030   optional_device<cpu_device> m_subcpu;
r243192r243193
7777   DECLARE_READ16_MEMBER(ffantasybl_242024_r);
7878   DECLARE_WRITE_LINE_MEMBER(sound_irq);
7979   DECLARE_WRITE_LINE_MEMBER(sound_irq2);
80
80   
8181   DECLARE_DRIVER_INIT(robocop);
8282   DECLARE_DRIVER_INIT(hippodrm);
8383   DECLARE_DRIVER_INIT(hbarrel);
r243192r243193
8686   DECLARE_DRIVER_INIT(baddudes);
8787   DECLARE_DRIVER_INIT(midresb);
8888   DECLARE_DRIVER_INIT(ffantasybl);
89
89   
9090   virtual void machine_start();
9191   DECLARE_MACHINE_RESET(slyspy);
9292   DECLARE_VIDEO_START(dec0);
9393   DECLARE_VIDEO_START(dec0_nodma);
94
94   
9595   UINT32 screen_update_hbarrel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9696   UINT32 screen_update_baddudes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9797   UINT32 screen_update_birdtry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r243192r243193
9999   UINT32 screen_update_hippodrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
100100   UINT32 screen_update_slyspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101101   UINT32 screen_update_midres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102
102   
103103   void baddudes_i8751_write(int data);
104104   void birdtry_i8751_write(int data);
105105   void dec0_i8751_write(int data);
r243192r243193
118118   UINT8 m_automat_adpcm_byte;
119119   int m_automat_msm5205_vclk_toggle;
120120   UINT16 m_automat_scroll_regs[4];
121
121   
122122   DECLARE_WRITE16_MEMBER(automat_control_w);
123123   DECLARE_WRITE8_MEMBER(automat_adpcm_w);
124124   DECLARE_READ16_MEMBER( automat_palette_r );
r243192r243193
128128      COMBINE_DATA(&m_automat_scroll_regs[offset]);
129129   }
130130   DECLARE_WRITE_LINE_MEMBER(automat_vclk_cb);
131
131   
132132   virtual void machine_start();
133
133   
134134   UINT32 screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
135135   UINT32 screen_update_secretab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
136136};
trunk/src/mame/includes/dec8.h
r243192r243193
162162   INTERRUPT_GEN_MEMBER(gondo_interrupt);
163163   INTERRUPT_GEN_MEMBER(oscar_interrupt);
164164   void srdarwin_draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
165   DECLARE_WRITE_LINE_MEMBER(irqhandler);
165166   DECLARE_WRITE_LINE_MEMBER(csilver_adpcm_int);
166167
167168protected:
trunk/src/mame/includes/deniam.h
r243192r243193
6969   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
7070   void set_bg_page( int page, int value );
7171   void set_fg_page( int page, int value );
72   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7273   required_device<cpu_device> m_maincpu;
7374   optional_device<cpu_device> m_audiocpu; // system 16c does not have sound CPU
7475   required_device<okim6295_device> m_oki;
trunk/src/mame/includes/dynax.h
r243192r243193
44
55***************************************************************************/
66#include "machine/msm6242.h"
7#include "sound/2413intf.h"
87#include "sound/msm5205.h"
98#include "sound/okim6295.h"
109
r243192r243193
1312public:
1413   dynax_state(const machine_config &mconfig, device_type type, const char *tag)
1514      : driver_device(mconfig, type, tag),
15         m_dsw_sel16(*this, "dsw_sel16"),
16         m_protection1(*this, "protection1"),
17         m_protection2(*this, "protection2"),
1618         m_maincpu(*this, "maincpu"),
1719         m_soundcpu(*this, "soundcpu"),
18         m_ym2413(*this, "ym2413"),
1920         m_oki(*this, "oki"),
2021         m_msm(*this, "msm"),
2122         m_screen(*this, "screen"),
r243192r243193
2324         m_rtc(*this, "rtc")
2425      { }
2526
26   /* devices */
27   required_device<cpu_device> m_maincpu;
28   optional_device<cpu_device> m_soundcpu;
29   optional_device<ym2413_device> m_ym2413;
30   optional_device<okim6295_device> m_oki;
31   optional_device<msm5205_device> m_msm;
32   optional_device<screen_device> m_screen;
33   required_device<palette_device> m_palette;
34   optional_device<msm6242_device> m_rtc;
35
3627   // up to 8 layers, 2 images per layer (interleaved on screen)
3728   UINT8 *  m_pixmap[8][2];
29   UINT8 *  m_ddenlovr_pixmap[8];
3830
3931   /* irq */
4032   typedef void (dynax_state::*irq_func)();    // some games trigger IRQ at blitter end, some don't
r243192r243193
8476   const int *m_priority_table;
8577   int m_hanamai_priority;
8678
79   /* ddenlovr blitter (TODO: merge with the above, where possible) */
80   int m_extra_layers;
81   int m_ddenlovr_dest_layer;
82   int m_ddenlovr_blit_flip;
83   int m_ddenlovr_blit_x;
84   int m_ddenlovr_blit_y;
85   int m_ddenlovr_blit_address;
86   int m_ddenlovr_blit_pen;
87   int m_ddenlovr_blit_pen_mode;
88   int m_ddenlovr_blitter_irq_flag;
89   int m_ddenlovr_blitter_irq_enable;
90   int m_ddenlovr_rect_width;
91   int m_ddenlovr_rect_height;
92   int m_ddenlovr_clip_width;
93   int m_ddenlovr_clip_height;
94   int m_ddenlovr_line_length;
95   int m_ddenlovr_clip_ctrl;
96   int m_ddenlovr_clip_x;
97   int m_ddenlovr_clip_y;
98   int m_ddenlovr_scroll[8*2];
99   int m_ddenlovr_priority;
100   int m_ddenlovr_priority2;
101   int m_ddenlovr_bgcolor;
102   int m_ddenlovr_bgcolor2;
103   int m_ddenlovr_layer_enable;
104   int m_ddenlovr_layer_enable2;
105   int m_ddenlovr_palette_base[8];
106   int m_ddenlovr_palette_mask[8];
107   int m_ddenlovr_transparency_pen[8];
108   int m_ddenlovr_transparency_mask[8];
109   int m_ddenlovr_blit_latch;
110   int m_ddenlovr_blit_pen_mask;   // not implemented
111   int m_ddenlovr_blit_rom_bits;           // usually 8, 16 in hanakanz
112   const int *m_ddenlovr_blit_commands;
113   int m_ddenlovr_blit_regs[2];
114
87115   /* input */
88116   UINT8 m_input_sel;
89117   UINT8 m_dsw_sel;
r243192r243193
111139   UINT8 m_gekisha_rom_enable;
112140   UINT8 *m_romptr;
113141
142   /* ddenlovr misc (TODO: merge with the above, where possible) */
143   UINT8 m_palram[0x200];
144   int m_okibank;
145   UINT8 m_rongrong_blitter_busy_select;
146
147   optional_shared_ptr<UINT16> m_dsw_sel16;
148   optional_shared_ptr<UINT16> m_protection1;
149   optional_shared_ptr<UINT16> m_protection2;
150   UINT8 m_prot_val;
151   UINT16 m_prot_16;
152   UINT16 m_quiz365_protection[2];
153
154   UINT16 m_mmpanic_leds;  /* A led for each of the 9 buttons */
155   UINT8 m_funkyfig_lockout;
156   UINT8 m_romdata[2];
157   int m_palette_index;
158   UINT8 m_hginga_rombank;
159   UINT8 m_mjflove_irq_cause;
160   UINT8 m_daimyojn_palette_sel;
161
162   int m_irq_count;
163
164
165   /* devices */
166   required_device<cpu_device> m_maincpu;
167   optional_device<cpu_device> m_soundcpu;
168   device_t *m_ymsnd;
169   optional_device<okim6295_device> m_oki;
170   optional_device<msm5205_device> m_msm;
171   optional_device<screen_device> m_screen;
172   required_device<palette_device> m_palette;
173   optional_device<msm6242_device> m_rtc;
174   device_t *m_top_scr;
175   device_t *m_bot_scr;
114176   DECLARE_WRITE8_MEMBER(dynax_vblank_ack_w);
115177   DECLARE_WRITE8_MEMBER(dynax_blitter_ack_w);
116178   DECLARE_WRITE8_MEMBER(jantouki_vblank_ack_w);
r243192r243193
213275   DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w);
214276   DECLARE_WRITE8_MEMBER(hanamai_priority_w);
215277   DECLARE_WRITE8_MEMBER(tenkai_priority_w);
216
217278   DECLARE_DRIVER_INIT(mjelct3);
218279   DECLARE_DRIVER_INIT(blktouch);
219280   DECLARE_DRIVER_INIT(mjelct3a);
220281   DECLARE_DRIVER_INIT(mjreach);
221282   DECLARE_DRIVER_INIT(maya);
222
223283   UINT32 screen_update_hanamai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
224284   UINT32 screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
225285   UINT32 screen_update_sprtmtch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
226286   UINT32 screen_update_mjdialq2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
227287   UINT32 screen_update_jantouki_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
228288   UINT32 screen_update_jantouki_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
229
230289   INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt);
231290   INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt);
232291   INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt);
233292   INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt);
234293   INTERRUPT_GEN_MEMBER(mjelctrn_vblank_interrupt);
235
236294   TIMER_DEVICE_CALLBACK_MEMBER(neruton_irq_scanline);
237295   TIMER_DEVICE_CALLBACK_MEMBER(majxtal7_vblank_interrupt);
238296   TIMER_DEVICE_CALLBACK_MEMBER(tenkai_interrupt);
239
240297   void tenkai_update_rombank();
241298   void gekisha_bank_postload();
242
243299   DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback);
244300   DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback);
245301   DECLARE_WRITE_LINE_MEMBER(adpcm_int);
r243192r243193
268324   DECLARE_VIDEO_START(mcnpshnt);
269325   DECLARE_PALETTE_INIT(janyuki);
270326   DECLARE_VIDEO_START(neruton);
271
272327   inline void blitter_plot_pixel( int layer, int mask, int x, int y, int pen, int wrap, int flags );
273328   int blitter_drawgfx( int layer, int mask, const char *gfx, int src, int pen, int x, int y, int wrap, int flags );
274329   void dynax_blitter_start( int flags );
trunk/src/mame/includes/eolith.h
r243192r243193
2727   optional_device<qs1000_device> m_qs1000;
2828   required_device<screen_device> m_screen;
2929   required_device<palette_device> m_palette;
30
30   
3131   optional_ioport m_in0; // klondkp doesn't have it
3232   optional_ioport m_eepromoutport;
3333   optional_ioport m_penx1port;
3434   optional_ioport m_peny1port;
3535   optional_ioport m_penx2port;
3636   optional_ioport m_peny2port;
37
37   
3838   optional_memory_bank m_sndbank;
39
39   
4040   int m_coin_counter_bit;
4141   int m_buffer;
4242   UINT32 *m_vram;
4343
4444   UINT8 m_sound_data;
45
45   
4646   // speedups - see machine/eolithsp.c
4747   int m_speedup_address;
4848   int m_speedup_address2;
r243192r243193
6666   DECLARE_READ8_MEMBER(qs1000_p1_r);
6767   DECLARE_WRITE8_MEMBER(qs1000_p1_w);
6868   DECLARE_WRITE8_MEMBER(soundcpu_to_qs1000);
69
69   
7070   DECLARE_DRIVER_INIT(eolith);
7171   DECLARE_DRIVER_INIT(landbrk);
7272   DECLARE_DRIVER_INIT(hidctch3);
7373   DECLARE_DRIVER_INIT(hidctch2);
7474   DECLARE_DRIVER_INIT(hidnc2k);
7575   DECLARE_DRIVER_INIT(landbrka);
76
76   
7777   DECLARE_MACHINE_RESET(eolith);
7878   DECLARE_VIDEO_START(eolith);
79
79   
8080   UINT32 screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
81
81   
8282   TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup);
8383};
trunk/src/mame/includes/exidy.h
r243192r243193
3434
3535   exidy_state(const machine_config &mconfig, device_type type, const char *tag)
3636      : driver_device(mconfig, type, tag),
37      m_maincpu(*this, "maincpu"),
38      m_dac(*this, "dac"),
39      m_samples(*this, "samples"),
40      m_gfxdecode(*this, "gfxdecode"),
41      m_screen(*this, "screen"),
42      m_palette(*this, "palette"),
4337      m_videoram(*this, "videoram"),
4438      m_sprite1_xpos(*this, "sprite1_xpos"),
4539      m_sprite1_ypos(*this, "sprite1_ypos"),
r243192r243193
4842      m_spriteno(*this, "spriteno"),
4943      m_sprite_enable(*this, "sprite_enable"),
5044      m_color_latch(*this, "color_latch"),
51      m_characterram(*this, "characterram") { }
45      m_characterram(*this, "characterram"),
46      m_maincpu(*this, "maincpu"),
47      m_dac(*this, "dac"),
48      m_samples(*this, "samples"),
49      m_gfxdecode(*this, "gfxdecode"),
50      m_screen(*this, "screen"),
51      m_palette(*this, "palette") { }
5252
5353
54   required_device<cpu_device> m_maincpu;
55   optional_device<dac_device> m_dac;
56   optional_device<samples_device> m_samples;
57   required_device<gfxdecode_device> m_gfxdecode;
58   required_device<screen_device> m_screen;
59   required_device<palette_device> m_palette;
60
6154   required_shared_ptr<UINT8> m_videoram;
6255   required_shared_ptr<UINT8> m_sprite1_xpos;
6356   required_shared_ptr<UINT8> m_sprite1_ypos;
r243192r243193
6861   required_shared_ptr<UINT8> m_color_latch;
6962   required_shared_ptr<UINT8> m_characterram;
7063
64   required_device<cpu_device> m_maincpu;
65   optional_device<dac_device> m_dac;
66   optional_device<samples_device> m_samples;
67   required_device<gfxdecode_device> m_gfxdecode;
68   required_device<screen_device> m_screen;
69   required_device<palette_device> m_palette;
70
7171   UINT8 m_last_dial;
7272   UINT8 m_collision_mask;
7373   UINT8 m_collision_invert;
r243192r243193
7777   bitmap_ind16 m_motion_object_1_vid;
7878   bitmap_ind16 m_motion_object_2_vid;
7979   bitmap_ind16 m_motion_object_2_clip;
80
8180   DECLARE_WRITE8_MEMBER(fax_bank_select_w);
8281   DECLARE_READ8_MEMBER(exidy_interrupt_r);
83
8482   DECLARE_CUSTOM_INPUT_MEMBER(teetert_input_r);
85
8683   DECLARE_DRIVER_INIT(fax);
8784   DECLARE_DRIVER_INIT(sidetrac);
8885   DECLARE_DRIVER_INIT(pepper2);
r243192r243193
9390   DECLARE_DRIVER_INIT(venture);
9491   DECLARE_DRIVER_INIT(spectar);
9592   DECLARE_DRIVER_INIT(phantoma);
96
9793   virtual void video_start();
9894   DECLARE_MACHINE_START(teetert);
99
10095   UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101
10296   INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt);
103
10497   void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
10598   inline void latch_condition(int collision);
10699   inline void set_1_color(int index, int which);
trunk/src/mame/includes/fuukifg2.h
r243192r243193
6161   inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
6262   inline void fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
6363   void fuuki16_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri );
64   DECLARE_WRITE_LINE_MEMBER(soundirq);
6465   required_device<okim6295_device> m_oki;
6566   required_device<gfxdecode_device> m_gfxdecode;
6667   required_device<screen_device> m_screen;
trunk/src/mame/includes/fuukifg3.h
r243192r243193
2626      m_priority(*this, "priority"),
2727      m_tilebank(*this, "tilebank"),
2828      m_maincpu(*this, "maincpu"),
29      m_soundcpu(*this, "soundcpu"),
2930      m_gfxdecode(*this, "gfxdecode"),
3031      m_screen(*this, "screen"),
3132      m_palette(*this, "palette"),
r243192r243193
5051
5152   /* devices */
5253   required_device<cpu_device> m_maincpu;
54   required_device<cpu_device> m_soundcpu;
5355   required_device<gfxdecode_device> m_gfxdecode;
5456   required_device<screen_device> m_screen;
5557   required_device<palette_device> m_palette;
r243192r243193
8385   inline void fuuki32_vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_);
8486   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
8587   void fuuki32_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri );
88   DECLARE_WRITE_LINE_MEMBER(irqhandler);
8689
8790protected:
8891   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mame/includes/galspnbl.h
r243192r243193
3939   DECLARE_PALETTE_INIT(galspnbl);
4040   UINT32 screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4141   void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
42   DECLARE_WRITE_LINE_MEMBER(irqhandler);
4243   required_device<cpu_device> m_maincpu;
4344   required_device<gfxdecode_device> m_gfxdecode;
4445   required_device<palette_device> m_palette;
trunk/src/mame/includes/hcastle.h
r243192r243193
6565   DECLARE_PALETTE_INIT(hcastle);
6666   UINT32 screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT8 *sbank, int bank );
68   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6869   DECLARE_WRITE8_MEMBER(volume_callback);
6970   required_device<cpu_device> m_maincpu;
7071   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/hyhoo.h
r243192r243193
3232   int m_highcolorflag;
3333   int m_flipscreen;
3434   bitmap_rgb32 m_tmpbitmap;
35
35   
3636   DECLARE_WRITE8_MEMBER(hyhoo_blitter_w);
3737   DECLARE_WRITE8_MEMBER(hyhoo_romsel_w);
38
38   
3939   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
40
40   
4141   virtual void video_start();
42
42   
4343   UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4444   void hyhoo_gfxdraw();
4545
trunk/src/mame/includes/itech8.h
r243192r243193
122122   inline void consume_rle(int count);
123123   void perform_blit(address_space &space);
124124   void itech8_update_interrupts(int periodic, int tms34061, int blitter);
125   DECLARE_WRITE_LINE_MEMBER(generate_sound_irq);
125126
126127   /*----------- defined in machine/slikshot.c -----------*/
127128
trunk/src/mame/includes/lordgun.h
r243192r243193
8383   void lorddgun_calc_gun_scr(int i);
8484   void lordgun_update_gun(int i);
8585   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
86   DECLARE_WRITE_LINE_MEMBER(soundirq);
8687   required_device<cpu_device> m_maincpu;
8788   required_device<cpu_device> m_soundcpu;
8889   required_device<okim6295_device> m_oki;
trunk/src/mame/includes/m58.h
r243192r243193
33public:
44   m58_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_videoram(*this, "videoram"),
7      m_spriteram(*this, "spriteram"),
8      m_yard_scroll_x_low(*this, "scroll_x_low"),
9      m_yard_scroll_x_high(*this, "scroll_x_high"),
10      m_yard_scroll_y_low(*this, "scroll_y_low"),
11      m_yard_score_panel_disabled(*this, "score_disable"),
612      m_maincpu(*this, "maincpu"),
713      m_gfxdecode(*this, "gfxdecode"),
814      m_screen(*this, "screen"),
9      m_palette(*this, "palette"),
10      m_videoram(*this, "videoram"),
11      m_spriteram(*this, "spriteram"),
12      m_scroll_x_low(*this, "scroll_x_low"),
13      m_scroll_x_high(*this, "scroll_x_high"),
14      m_scroll_y_low(*this, "scroll_y_low"),
15      m_score_panel_disabled(*this, "score_disable") { }
15      m_palette(*this, "palette") { }
1616
17   /* devices */
18   required_device<cpu_device> m_maincpu;
19   required_device<gfxdecode_device> m_gfxdecode;
20   required_device<screen_device> m_screen;
21   required_device<palette_device> m_palette;
22
2317   /* memory pointers */
2418   required_shared_ptr<UINT8> m_videoram;
2519   required_shared_ptr<UINT8> m_spriteram;
26   required_shared_ptr<UINT8> m_scroll_x_low;
27   required_shared_ptr<UINT8> m_scroll_x_high;
28   required_shared_ptr<UINT8> m_scroll_y_low;
29   required_shared_ptr<UINT8> m_score_panel_disabled;
3020
3121   /* video-related */
3222   tilemap_t*             m_bg_tilemap;
33   bitmap_ind16             m_scroll_panel_bitmap;
3423
35   DECLARE_WRITE8_MEMBER(videoram_w);
36   DECLARE_WRITE8_MEMBER(scroll_panel_w);
37   DECLARE_WRITE8_MEMBER(flipscreen_w);
38
24   required_shared_ptr<UINT8> m_yard_scroll_x_low;
25   required_shared_ptr<UINT8> m_yard_scroll_x_high;
26   required_shared_ptr<UINT8> m_yard_scroll_y_low;
27   required_shared_ptr<UINT8> m_yard_score_panel_disabled;
28   bitmap_ind16             *m_scroll_panel_bitmap;
29   DECLARE_WRITE8_MEMBER(yard_videoram_w);
30   DECLARE_WRITE8_MEMBER(yard_scroll_panel_w);
31   DECLARE_WRITE8_MEMBER(yard_flipscreen_w);
3932   DECLARE_DRIVER_INIT(yard85);
33   TILE_GET_INFO_MEMBER(yard_get_bg_tile_info);
34   TILEMAP_MAPPER_MEMBER(yard_tilemap_scan_rows);
4035   virtual void video_start();
4136   DECLARE_PALETTE_INIT(m58);
42
43   TILE_GET_INFO_MEMBER(get_bg_tile_info);
44   TILEMAP_MAPPER_MEMBER(tilemap_scan_rows);
45
46   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
37   UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4738   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
4839   void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
40   required_device<cpu_device> m_maincpu;
41   required_device<gfxdecode_device> m_gfxdecode;
42   required_device<screen_device> m_screen;
43   required_device<palette_device> m_palette;
4944};
trunk/src/mame/includes/mario.h
r243192r243193
5454      m_discrete(*this, "discrete"),
5555#else
5656      m_audio_snd0(*this, "snd_nl:snd0"),
57      m_audio_snd7(*this, "snd_nl:snd7"),
58      m_audio_dac(*this, "snd_nl:dac"),
57        m_audio_snd7(*this, "snd_nl:snd7"),
58        m_audio_dac(*this, "snd_nl:dac"),
5959#endif
6060      m_spriteram(*this, "spriteram"),
6161      m_videoram(*this, "videoram"),
r243192r243193
7171   optional_device<discrete_device> m_discrete;
7272#else
7373   optional_device<netlist_mame_logic_input_t> m_audio_snd0;
74   optional_device<netlist_mame_logic_input_t> m_audio_snd7;
75   optional_device<netlist_mame_logic_input_t> m_audio_dac;
74    optional_device<netlist_mame_logic_input_t> m_audio_snd7;
75    optional_device<netlist_mame_logic_input_t> m_audio_dac;
7676#endif
7777
7878   /* memory pointers */
trunk/src/mame/includes/metro.h
r243192r243193
203203   void metro_common(  );
204204   void draw_tilemap( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 pcode,
205205               int sx, int sy, int wx, int wy, int big, UINT16 *tilemapram, int layer );
206   DECLARE_WRITE_LINE_MEMBER(blzntrnd_irqhandler);
207   DECLARE_WRITE_LINE_MEMBER(ymf278b_interrupt);
206208   DECLARE_READ_LINE_MEMBER(metro_rxd_r);
207209
208210protected:
trunk/src/mame/includes/midtunit.h
r243192r243193
2424      m_adpcm_sound(*this, "adpcm") ,
2525      m_generic_paletteram_16(*this, "paletteram"),
2626      m_nvram(*this, "nvram"),
27      m_gfxrom(*this, "gfxrom") { }
27      m_gfxrom(*this, "gfxrom"),
28      m_ports(*this, tunit_ports) { }
2829
2930   required_device<cpu_device> m_maincpu;
3031   required_device<palette_device> m_palette;
r243192r243193
3738
3839   required_memory_region m_gfxrom;
3940
41   required_ioport_array<4> m_ports;
42   DECLARE_IOPORT_ARRAY(tunit_ports);
43
4044   DECLARE_WRITE16_MEMBER(midtunit_cmos_enable_w);
4145   DECLARE_WRITE16_MEMBER(midtunit_cmos_w);
4246   DECLARE_READ16_MEMBER(midtunit_cmos_r);
trunk/src/mame/includes/model2.h
r243192r243193
44#include "machine/eepromser.h"
55#include "cpu/i960/i960.h"
66#include "sound/scsp.h"
7#include "machine/315-5881_crypt.h"
8#include "machine/315-5838_317-0229_comp.h"
97
108struct raster_state;
119struct geo_state;
r243192r243193
3634      m_eeprom(*this, "eeprom"),
3735      m_screen(*this, "screen"),
3836      m_palette(*this, "palette"),
39      m_scsp(*this, "scsp"),
40      m_cryptdevice(*this, "315_5881"),
41      m_0229crypt(*this, "317_0229")
37      m_scsp(*this, "scsp") { }
4238
43      { }
44
4539   required_shared_ptr<UINT32> m_workram;
4640   required_shared_ptr<UINT32> m_bufferram;
4741   UINT16 *m_palram;
r243192r243193
6559   required_device<screen_device> m_screen;
6660   required_device<palette_device> m_palette;
6761   optional_device<scsp_device> m_scsp;
68   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
69   optional_device<sega_315_5838_comp_device> m_0229crypt;
7062
7163   UINT32 m_intreq;
7264   UINT32 m_intena;
r243192r243193
9688   int m_geo_iop_write_num;
9789   UINT32 m_geo_iop_data;
9890   int m_to_68k;
99
91   int m_protstate;
92   int m_protpos;
93   UINT8 m_protram[256];
94   int m_prot_a;
10095   int m_maxxstate;
10196   UINT32 m_netram[0x8000/4];
10297   int m_zflagi;
r243192r243193
159154   DECLARE_READ32_MEMBER(model2_serial_r);
160155   DECLARE_WRITE32_MEMBER(model2o_serial_w);
161156   DECLARE_WRITE32_MEMBER(model2_serial_w);
162   DECLARE_READ32_MEMBER(model2_5881prot_r);
163   DECLARE_WRITE32_MEMBER(model2_5881prot_w);
164   int first_read;
165
157   DECLARE_READ32_MEMBER(model2_prot_r);
158   DECLARE_WRITE32_MEMBER(model2_prot_w);
166159   DECLARE_READ32_MEMBER(maxx_r);
167160   DECLARE_READ32_MEMBER(network_r);
168161   DECLARE_WRITE32_MEMBER(network_w);
r243192r243193
225218   DECLARE_READ8_MEMBER(virtuacop_lightgun_r);
226219   DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r);
227220
228   UINT16 crypt_read_callback(UINT32 addr);
229
230221   bool copro_fifoin_pop(device_t *device, UINT32 *result,UINT32 offset, UINT32 mem_mask);
231222   void copro_fifoin_push(device_t *device, UINT32 data, UINT32 offset, UINT32 mem_mask);
232223   UINT32 copro_fifoout_pop(address_space &space, UINT32 offset, UINT32 mem_mask);
trunk/src/mame/includes/model3.h
r243192r243193
44#include "audio/dsbz80.h"
55#include "machine/eepromser.h"
66#include "sound/scsp.h"
7#include "machine/315-5881_crypt.h"
87
98typedef float MATRIX[4][4];
109typedef float VECTOR[4];
r243192r243193
7877      m_dsbz80(*this, DSBZ80_TAG),
7978      m_soundram(*this, "soundram"),
8079      m_gfxdecode(*this, "gfxdecode"),
81      m_palette(*this, "palette"),
82      m_cryptdevice(*this, "315_5881")
80      m_palette(*this, "palette")
8381   {
8482      m_step15_with_mpc106 = false;
8583      m_step20_with_old_real3d = false;
r243192r243193
9997
10098   required_device<gfxdecode_device> m_gfxdecode;
10199   required_device<palette_device> m_palette;
102   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
103100
104101   tilemap_t *m_layer4[4];
105102   tilemap_t *m_layer8[4];
r243192r243193
230227   DECLARE_WRITE8_MEMBER(model3_sound_w);
231228   DECLARE_READ64_MEMBER(network_r);
232229   DECLARE_WRITE64_MEMBER(network_w);
233
230   DECLARE_READ64_MEMBER(model3_security_r);
234231   DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
235232   DECLARE_WRITE16_MEMBER(model3snd_ctrl);
236233   UINT32 pci_device_get_reg();
237234   void pci_device_set_reg(UINT32 value);
238   DECLARE_DRIVER_INIT(genprot);
239235   DECLARE_DRIVER_INIT(lemans24);
240236   DECLARE_DRIVER_INIT(vs298);
241237   DECLARE_DRIVER_INIT(vs299);
r243192r243193
243239   DECLARE_DRIVER_INIT(scudplus);
244240   DECLARE_DRIVER_INIT(model3_20);
245241   DECLARE_DRIVER_INIT(bass);
242   DECLARE_DRIVER_INIT(vs2v991);
246243   DECLARE_DRIVER_INIT(vs2);
247244   DECLARE_DRIVER_INIT(daytona2);
248245   DECLARE_DRIVER_INIT(eca);
r243192r243193
259256   DECLARE_DRIVER_INIT(getbass);
260257   DECLARE_DRIVER_INIT(scudplusa);
261258   DECLARE_DRIVER_INIT(dirtdvls);
259   DECLARE_DRIVER_INIT(vs299b);
262260   DECLARE_DRIVER_INIT(vf3);
263261   DECLARE_DRIVER_INIT(von2);
262   DECLARE_DRIVER_INIT(vs299a);
264263   DECLARE_DRIVER_INIT(lostwsga);
265264   DECLARE_DRIVER_INIT(oceanhun);
266265   DECLARE_DRIVER_INIT(dayto2pe);
r243192r243193
334333   void tap_write(int tck, int tms, int tdi, int trst);
335334   void tap_reset();
336335   void tap_set_asic_ids();
337
338   DECLARE_READ64_MEMBER(model3_5881prot_r);
339   DECLARE_WRITE64_MEMBER(model3_5881prot_w);
340   int first_read;
341   UINT16 crypt_read_callback(UINT32 addr);
342
343336};
trunk/src/mame/includes/namcos21.h
r243192r243193
4949      m_dspram16(*this,"dspram16"),
5050      m_mpDualPortRAM(*this,"mpdualportram"),
5151      m_master_dsp_code(*this,"master_dsp_code"),
52      m_ptrom24(*this,"point24"),
53      m_ptrom16(*this,"point16"),
5452      m_dsp(*this, "dsp") { }
5553
5654   optional_shared_ptr<UINT16> m_winrun_dspbios;
r243192r243193
6058   required_shared_ptr<UINT8> m_mpDualPortRAM;
6159   optional_shared_ptr<UINT16> m_master_dsp_code;
6260
63   optional_region_ptr<INT32> m_ptrom24;
64   optional_region_ptr<UINT16> m_ptrom16;
65
6661   optional_device<cpu_device> m_dsp;
6762
6863   UINT8 *m_videoram;
trunk/src/mame/includes/naomi.h
r243192r243193
6262   DECLARE_READ64_MEMBER( aw_modem_r );
6363   DECLARE_WRITE64_MEMBER( aw_modem_w );
6464
65   UINT8 m_mp_mux;
66   DECLARE_CUSTOM_INPUT_MEMBER(naomi_mp_r);
67   DECLARE_INPUT_CHANGED_MEMBER(naomi_mp_w);
68
6965   inline int decode_reg32_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift);
7066
67   int jvsboard_type;
7168   UINT16 actel_id;
7269
7370   UINT8 aw_ctrl_type;
trunk/src/mame/includes/nb1413m3.h
r243192r243193
129129
130130   // (static) configuration helpers
131131   static void set_type(device_t &device, int type) { downcast<nb1413m3_device &>(device).m_nb1413m3_type = type; }
132
132   
133133   enum
134134   {
135135      TIMER_CB
r243192r243193
169169   virtual void device_start();
170170   virtual void device_reset();
171171   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
172
172   
173173private:
174174
175175   int m_74ls193_counter;
trunk/src/mame/includes/nemesis.h
r243192r243193
121121   void create_palette_lookups();
122122   void nemesis_postload();
123123   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
124   DECLARE_WRITE_LINE_MEMBER(sound_irq);
124125   DECLARE_WRITE8_MEMBER(volume_callback);
125126};
trunk/src/mame/includes/oneshot.h
r243192r243193
1111      m_fg_videoram(*this, "fg_videoram"),
1212      m_scroll(*this, "scroll"),
1313      m_maincpu(*this, "maincpu"),
14      m_audiocpu(*this, "audiocpu"),
1415      m_oki(*this, "oki"),
1516      m_gfxdecode(*this, "gfxdecode"),
1617      m_palette(*this, "palette")  { }
r243192r243193
3839
3940   /* devices */
4041   required_device<cpu_device> m_maincpu;
42   required_device<cpu_device> m_audiocpu;
4143   DECLARE_READ16_MEMBER(oneshot_in0_word_r);
4244   DECLARE_READ16_MEMBER(oneshot_gun_x_p1_r);
4345   DECLARE_READ16_MEMBER(oneshot_gun_y_p1_r);
r243192r243193
5759   UINT32 screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5860   void draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect );
5961   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
62   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6063   required_device<okim6295_device> m_oki;
6164   required_device<gfxdecode_device> m_gfxdecode;
6265   required_device<palette_device> m_palette;
trunk/src/mame/includes/pacman.h
r243192r243193
125125   DECLARE_DRIVER_INIT(8bpm);
126126   DECLARE_DRIVER_INIT(porky);
127127   DECLARE_DRIVER_INIT(mspacman);
128   DECLARE_DRIVER_INIT(mschamp);
129128   TILEMAP_MAPPER_MEMBER(pacman_scan_rows);
130129   TILE_GET_INFO_MEMBER(pacman_get_tile_info);
131130   TILE_GET_INFO_MEMBER(s2650_get_tile_info);
trunk/src/mame/includes/paradise.h
r243192r243193
55public:
66   paradise_state(const machine_config &mconfig, device_type type, const char *tag)
77      : driver_device(mconfig, type, tag),
8      m_maincpu(*this, "maincpu"),
9      m_oki2(*this, "oki2"),
10      m_gfxdecode(*this, "gfxdecode"),
11      m_screen(*this, "screen"),
12      m_palette(*this, "palette"),
138      m_vram_0(*this, "vram_0"),
149      m_vram_1(*this, "vram_1"),
1510      m_vram_2(*this, "vram_2"),
1611      m_videoram(*this, "videoram"),
1712      m_paletteram(*this, "paletteram"),
18      m_spriteram(*this, "spriteram") { }
13      m_spriteram(*this, "spriteram"),
14      m_maincpu(*this, "maincpu"),
15      m_oki2(*this, "oki2"),
16      m_gfxdecode(*this, "gfxdecode"),
17      m_screen(*this, "screen"),
18      m_palette(*this, "palette") { }
1919
20   /* devices */
21   required_device<cpu_device> m_maincpu;
22   optional_device<okim6295_device> m_oki2;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<screen_device> m_screen;
25   required_device<palette_device> m_palette;
26
2720   /* memory pointers */
2821   required_shared_ptr<UINT8> m_vram_0;
2922   required_shared_ptr<UINT8> m_vram_1;
r243192r243193
3629   tilemap_t *m_tilemap_0;
3730   tilemap_t *m_tilemap_1;
3831   tilemap_t *m_tilemap_2;
39
4032   bitmap_ind16 m_tmpbitmap;
4133   UINT8 m_palbank;
4234   UINT8 m_priority;
4335   UINT8 m_pixbank;
4436   int m_sprite_inc;
45   int m_irq_count;
4637
38   int irq_count;
4739   DECLARE_WRITE8_MEMBER(paradise_rombank_w);
4840   DECLARE_WRITE8_MEMBER(torus_coin_counter_w);
4941   DECLARE_WRITE8_MEMBER(paradise_flipscreen_w);
r243192r243193
5648   DECLARE_WRITE8_MEMBER(paradise_pixmap_w);
5749   DECLARE_WRITE8_MEMBER(paradise_priority_w);
5850   DECLARE_WRITE8_MEMBER(paradise_okibank_w);
59
6051   DECLARE_DRIVER_INIT(torus);
6152   DECLARE_DRIVER_INIT(paradise);
6253   DECLARE_DRIVER_INIT(tgtball);
63
6454   TILE_GET_INFO_MEMBER(get_tile_info_0);
6555   TILE_GET_INFO_MEMBER(get_tile_info_1);
6656   TILE_GET_INFO_MEMBER(get_tile_info_2);
67
6857   virtual void machine_start();
6958   virtual void machine_reset();
7059   virtual void video_start();
71
7260   UINT32 screen_update_paradise(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7361   UINT32 screen_update_torus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7462   UINT32 screen_update_madball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75
7663   INTERRUPT_GEN_MEMBER(paradise_irq);
77
7864   void update_pix_palbank();
79   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
65   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
66   required_device<cpu_device> m_maincpu;
67   optional_device<okim6295_device> m_oki2;
68   required_device<gfxdecode_device> m_gfxdecode;
69   required_device<screen_device> m_screen;
70   required_device<palette_device> m_palette;
8071};
trunk/src/mame/includes/pastelg.h
r243192r243193
3434   int m_palbank;
3535   UINT8 *m_videoram;
3636   int m_flipscreen_old;
37
37   
3838   DECLARE_READ8_MEMBER(pastelg_sndrom_r);
3939   DECLARE_READ8_MEMBER(pastelg_irq_ack_r);
4040   DECLARE_READ8_MEMBER(threeds_inputport1_r);
r243192r243193
4545   DECLARE_WRITE8_MEMBER(threeds_output_w);
4646   DECLARE_READ8_MEMBER(threeds_rom_readback_r);
4747   DECLARE_WRITE8_MEMBER(pastelg_romsel_w);
48
48   
4949   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
5050   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r);
51
51   
5252   virtual void machine_start();
5353   virtual void video_start();
54
54   
5555   DECLARE_PALETTE_INIT(pastelg);
5656   UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5757   int pastelg_blitter_src_addr_r();
r243192r243193
6161protected:
6262   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
6363};
64
trunk/src/mame/includes/prehisle.h
r243192r243193
3939   virtual void video_start();
4040   UINT32 screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4141   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42   DECLARE_WRITE_LINE_MEMBER(irqhandler);
4243
4344   required_device<cpu_device> m_maincpu;
4445   required_device<cpu_device> m_audiocpu;
trunk/src/mame/includes/psikyo.h
r243192r243193
105105   void draw_sprites_bootleg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int trans_pen );
106106   int tilemap_width( int size );
107107   void s1945_mcu_init(  );
108   DECLARE_WRITE_LINE_MEMBER(irqhandler);
109   DECLARE_WRITE_LINE_MEMBER(sound_irq);
108110   required_device<cpu_device> m_maincpu;
109111   optional_device<okim6295_device> m_oki;
110112   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/psikyo4.h
r243192r243193
7373   UINT32 screen_update_psikyo4_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7474   INTERRUPT_GEN_MEMBER(psikyosh_interrupt);
7575   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 scr);
76   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7677};
trunk/src/mame/includes/psikyosh.h
r243192r243193
8484   void psikyosh_drawgfxzoom( bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
8585         UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
8686         int alpha, int zoomx, int zoomy, int wide, int high, UINT32 z);
87   DECLARE_WRITE_LINE_MEMBER(irqhandler);
8788};
trunk/src/mame/includes/senjyo.h
r243192r243193
3636   required_device<dac_device> m_dac;
3737   required_device<gfxdecode_device> m_gfxdecode;
3838   required_device<palette_device> m_palette;
39
39   
4040   /* memory pointers */
4141   required_shared_ptr<UINT8> m_spriteram;
4242   required_shared_ptr<UINT8> m_fgscroll;
r243192r243193
5858   // game specific initialization
5959   int m_is_senjyo;
6060   int m_scrollhack;
61
61   
6262   UINT8 m_sound_cmd;
6363   int m_single_volume;
6464   int m_sound_state;
r243192r243193
6767   tilemap_t *m_bg1_tilemap;
6868   tilemap_t *m_bg2_tilemap;
6969   tilemap_t *m_bg3_tilemap;
70
70   
7171   DECLARE_WRITE8_MEMBER(flip_screen_w);
7272   DECLARE_WRITE8_MEMBER(paletteram_w);
7373   DECLARE_WRITE8_MEMBER(starforb_scrolly2);
r243192r243193
8282   DECLARE_WRITE8_MEMBER(sound_cmd_w);
8383   DECLARE_WRITE8_MEMBER(irq_ctrl_w);
8484   DECLARE_READ8_MEMBER(pio_pa_r);
85
85   
8686   DECLARE_DRIVER_INIT(starfora);
8787   DECLARE_DRIVER_INIT(senjyo);
8888   DECLARE_DRIVER_INIT(starfore);
8989   DECLARE_DRIVER_INIT(starforc);
90
90   
9191   TILE_GET_INFO_MEMBER(get_fg_tile_info);
9292   TILE_GET_INFO_MEMBER(senjyo_bg1_tile_info);
9393   TILE_GET_INFO_MEMBER(starforc_bg1_tile_info);
9494   TILE_GET_INFO_MEMBER(get_bg2_tile_info);
9595   TILE_GET_INFO_MEMBER(get_bg3_tile_info);
96
96   
9797   virtual void machine_start();
9898   virtual void machine_reset();
9999   virtual void video_start();
trunk/src/mame/includes/snk68.h
r243192r243193
5454   UINT32 screen_update_pow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5555   void common_video_start();
5656   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int group);
57   DECLARE_WRITE_LINE_MEMBER(irqhandler);
5758   required_device<cpu_device> m_maincpu;
5859   required_device<cpu_device> m_soundcpu;
5960   required_device<upd7759_device> m_upd7759;
trunk/src/mame/includes/snowbros.h
r243192r243193
5555   DECLARE_DRIVER_INIT(4in1boot);
5656   DECLARE_DRIVER_INIT(3in1semi);
5757   DECLARE_DRIVER_INIT(cookbib2);
58   DECLARE_DRIVER_INIT(toto);
59   DECLARE_READ16_MEMBER(toto_read);
6058   DECLARE_MACHINE_RESET(semiprot);
6159   DECLARE_MACHINE_RESET(finalttr);
6260   UINT32 screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r243192r243193
6967   TIMER_DEVICE_CALLBACK_MEMBER(snowbros3_irq);
7068   void sb3_play_music(int data);
7169   void sb3_play_sound (okim6295_device *oki, int data);
70   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7271};
trunk/src/mame/includes/spbactn.h
r243192r243193
7272   {
7373      return 0xffff;
7474   }
75   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7576   required_device<cpu_device> m_maincpu;
7677   required_device<cpu_device> m_audiocpu;
7778   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/spdodgeb.h
r243192r243193
6464   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
6565   void mcu63705_update_inputs();
6666   DECLARE_CUSTOM_INPUT_MEMBER(mcu63705_busy_r);
67   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6768   void spd_adpcm_int(msm5205_device *device, int chip);
6869   DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_1);
6970   DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_2);
trunk/src/mame/includes/spy.h
r243192r243193
5959   UINT32 screen_update_spy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6060   INTERRUPT_GEN_MEMBER(spy_interrupt);
6161   void spy_collision(  );
62   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6263   DECLARE_WRITE8_MEMBER(volume_callback0);
6364   DECLARE_WRITE8_MEMBER(volume_callback1);
6465   K052109_CB_MEMBER(tile_callback);
trunk/src/mame/includes/stadhero.h
r243192r243193
1212      m_spritegen(*this, "spritegen"),
1313      m_gfxdecode(*this, "gfxdecode"),
1414      m_spriteram(*this, "spriteram"),
15      m_pf1_data(*this, "pf1_data") { }
15      m_pf1_data(*this, "pf1_data"),
16      m_inputs(*this, "INPUTS"),
17      m_coin(*this, "COIN"),
18      m_dsw(*this, "DSW") { }
1619
1720   required_device<cpu_device> m_maincpu;
1821   required_device<cpu_device> m_audiocpu;
1922   required_device<deco_bac06_device> m_tilegen1;
2023   required_device<deco_mxc06_device> m_spritegen;
2124   required_device<gfxdecode_device> m_gfxdecode;
22
25   
2326   required_shared_ptr<UINT16> m_spriteram;
2427   required_shared_ptr<UINT16> m_pf1_data;
28   
29   required_ioport m_inputs;
30   required_ioport m_coin;
31   required_ioport m_dsw;
2532
2633   tilemap_t *m_pf1_tilemap;
27
34   
35   DECLARE_READ16_MEMBER(stadhero_control_r);
2836   DECLARE_WRITE16_MEMBER(stadhero_control_w);
2937   DECLARE_WRITE16_MEMBER(stadhero_pf1_data_w);
30
38   DECLARE_WRITE_LINE_MEMBER(irqhandler);
39   
3140   virtual void video_start();
32
41   
3342   TILE_GET_INFO_MEMBER(get_pf1_tile_info);
3443   UINT32 screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3544};
trunk/src/mame/includes/stfight.h
r243192r243193
2828   required_device<msm5205_device> m_msm;
2929   required_device<gfxdecode_device> m_gfxdecode;
3030   required_device<palette_device> m_palette;
31
31   
3232   optional_shared_ptr<UINT8> m_text_char_ram;
3333   optional_shared_ptr<UINT8> m_text_attr_ram;
3434   optional_shared_ptr<UINT8> m_tx_vram;
trunk/src/mame/includes/stlforce.h
r243192r243193
3636   required_shared_ptr<UINT16> m_mhigh_scrollram;
3737   required_shared_ptr<UINT16> m_vidattrram;
3838   required_shared_ptr<UINT16> m_spriteram;
39
39   
4040   tilemap_t *m_bg_tilemap;
4141   tilemap_t *m_mlow_tilemap;
4242   tilemap_t *m_mhigh_tilemap;
4343   tilemap_t *m_tx_tilemap;
4444
4545   int m_sprxoffs;
46
46   
4747   DECLARE_WRITE16_MEMBER(stlforce_bg_videoram_w);
4848   DECLARE_WRITE16_MEMBER(stlforce_mlow_videoram_w);
4949   DECLARE_WRITE16_MEMBER(stlforce_mhigh_videoram_w);
5050   DECLARE_WRITE16_MEMBER(stlforce_tx_videoram_w);
5151   DECLARE_WRITE16_MEMBER(eeprom_w);
5252   DECLARE_WRITE16_MEMBER(oki_bank_w);
53
53   
5454   DECLARE_DRIVER_INIT(twinbrat);
5555   DECLARE_DRIVER_INIT(stlforce);
56
56   
5757   TILE_GET_INFO_MEMBER(get_stlforce_bg_tile_info);
5858   TILE_GET_INFO_MEMBER(get_stlforce_mlow_tile_info);
5959   TILE_GET_INFO_MEMBER(get_stlforce_mhigh_tile_info);
6060   TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info);
61
61   
6262   virtual void video_start();
6363   UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6464   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
trunk/src/mame/includes/strnskil.h
r243192r243193
1515   required_device<cpu_device> m_subcpu;
1616   required_device<gfxdecode_device> m_gfxdecode;
1717   required_device<palette_device> m_palette;
18
18   
1919   required_shared_ptr<UINT8> m_videoram;
2020   required_shared_ptr<UINT8> m_xscroll;
2121   required_shared_ptr<UINT8> m_spriteram;
r243192r243193
2323   UINT8 m_scrl_ctrl;
2424   tilemap_t *m_bg_tilemap;
2525   UINT8 m_irq_source;
26
26   
2727   TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq);
2828
2929   DECLARE_READ8_MEMBER(strnskil_d800_r);
r243192r243193
3232   DECLARE_WRITE8_MEMBER(protection_w);
3333   DECLARE_WRITE8_MEMBER(strnskil_videoram_w);
3434   DECLARE_WRITE8_MEMBER(strnskil_scrl_ctrl_w);
35
35   
3636   DECLARE_DRIVER_INIT(banbam);
3737   DECLARE_DRIVER_INIT(pettanp);
38
38   
3939   TILE_GET_INFO_MEMBER(get_bg_tile_info);
40
41   virtual void machine_start();
40   
41   virtual void machine_start();   
4242   virtual void video_start();
4343   DECLARE_PALETTE_INIT(strnskil);
4444   UINT32 screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/includes/stv.h
r243192r243193
1010#include "bus/generic/carts.h"
1111
1212#include "machine/315-5881_crypt.h"
13#include "machine/315-5838_317-0229_comp.h"
1413
1514#define MAX_FILTERS (24)
1615#define MAX_BLOCKS  (200)
r243192r243193
702701      : saturn_state(mconfig, type, tag),
703702      m_adsp(*this, "adsp"),
704703      m_adsp_pram(*this, "adsp_pram"),
705      m_cryptdevice(*this, "315_5881"),
706      m_5838crypt(*this, "315_5838")
704      m_cryptdevice(*this, "315_5881")
707705   {
708706   }
709707
r243192r243193
800798
801799   // protection specific variables and functions (see machine/stvprot.c)
802800   UINT32 m_abus_protenable;
801   UINT32 m_abus_prot_addr;
803802   UINT32 m_abus_protkey;
804803
805804   UINT32 m_a_bus[4];
805   UINT32 m_ctrl_index;
806   UINT32 m_internal_counter;
807   UINT8 m_char_offset; //helper to jump the decoding of the NULL chars.
806808
809   UINT32 (*m_prot_readback)(address_space&,int,UINT32);
810
807811   DECLARE_READ32_MEMBER( common_prot_r );
808812   DECLARE_WRITE32_MEMBER( common_prot_w );
809813
810814   void install_common_protection();
815
816   void install_twcup98_protection();
817   void install_sss_protection();
818   void install_astrass_protection();
819   void install_rsgun_protection();
820   void install_elandore_protection();
821   void install_ffreveng_protection();
822
811823   void stv_register_protection_savestates();
812824
825   // Decathlete specific variables and functions (see machine/decathlt.c)
826   UINT32 m_decathlt_protregs[4];
827   UINT32 m_decathlt_lastcount;
828   UINT32 m_decathlt_part;
829   UINT32 m_decathlt_prot_uploadmode;
830   UINT32 m_decathlt_prot_uploadoffset;
831   UINT16 m_decathlt_prottable1[24];
832   UINT16 m_decathlt_prottable2[128];
813833
834   DECLARE_READ32_MEMBER( decathlt_prot_r );
835   DECLARE_WRITE32_MEMBER( decathlt_prot1_w );
836   DECLARE_WRITE32_MEMBER( decathlt_prot2_w );
837   void write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which);
838   void install_decathlt_protection();
814839
815840   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
816   optional_device<sega_315_5838_comp_device> m_5838crypt;
817841   UINT16 crypt_read_callback(UINT32 addr);
818   UINT16 crypt_read_callback_ch1(UINT32 addr);
819   UINT16 crypt_read_callback_ch2(UINT32 addr);
820842};
821843
822844
trunk/src/mame/includes/suna8.h
r243192r243193
157157   void draw_normal_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int which);
158158   void draw_text_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
159159   UINT8 *brickzn_decrypt();
160   DECLARE_WRITE_LINE_MEMBER(soundirq);
160161};
trunk/src/mame/includes/tbowl.h
r243192r243193
6464   UINT32 screen_update_tbowl_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6565   UINT32 screen_update_tbowl_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6666   void tbowl_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int xscroll, UINT8* spriteram);
67   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6768   void tbowl_adpcm_int(msm5205_device *device, int chip);
6869   DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_1);
6970   DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_2);
trunk/src/mame/includes/tecmo.h
r243192r243193
6060   DECLARE_VIDEO_START(tecmo);
6161   UINT32 screen_update_tecmo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6262   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect);
63   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6364   DECLARE_WRITE_LINE_MEMBER(tecmo_adpcm_int);
6465   required_device<cpu_device> m_maincpu;
6566   required_device<cpu_device> m_soundcpu;
trunk/src/mame/includes/toaplan1.h
r243192r243193
150150   void toaplan1_driver_savestate();
151151   void demonwld_driver_savestate();
152152   void vimana_driver_savestate();
153   DECLARE_WRITE_LINE_MEMBER(irqhandler);
153154   DECLARE_WRITE_LINE_MEMBER(toaplan1_reset_callback);
154155   required_device<m68000_device> m_maincpu;
155156   required_device<cpu_device> m_audiocpu;
trunk/src/mame/includes/toaplan2.h
r243192r243193
153153   void truxton2_postload();
154154   void create_tx_tilemap(int dx = 0, int dx_flipped = 0);
155155   void toaplan2_vblank_irq(int irq_line);
156   DECLARE_WRITE_LINE_MEMBER(irqhandler);
156157   DECLARE_WRITE_LINE_MEMBER(bbakraid_irqhandler);
157158
158159   UINT8 m_pwrkick_hopper;
trunk/src/mame/includes/twincobr.h
r243192r243193
1616      m_spriteram8(*this, "spriteram8"),
1717      m_spriteram16(*this, "spriteram16"),
1818      m_maincpu(*this, "maincpu"),
19      m_audiocpu(*this, "audiocpu"),
1920      m_dsp(*this, "dsp"),
2021      m_spritegen(*this, "scu"),
2122      m_gfxdecode(*this, "gfxdecode"),
r243192r243193
118119   void toaplan0_control_w(int offset, int data);
119120   void toaplan0_coin_dsp_w(address_space &space, int offset, int data);
120121   void twincobr_driver_savestate();
122   DECLARE_WRITE_LINE_MEMBER(irqhandler);
121123   required_device<cpu_device> m_maincpu;
124   required_device<cpu_device> m_audiocpu;
122125   required_device<cpu_device> m_dsp;
123126   required_device<toaplan_scu_device> m_spritegen;
124127   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/tx1.h
r243192r243193
107107         m_objram(*this, "objram"),
108108         m_rcram(*this, "rcram"),
109109         m_z80_ram(*this, "z80_ram"),
110         m_char_tiles(*this, "char_tiles"),
111         m_obj_tiles(*this, "obj_tiles"),
112         m_road_rom(*this, "road"),
113         m_obj_map(*this, "obj_map"),
114         m_obj_luts(*this, "obj_luts"),
115         m_proms(*this, "proms"),
116110         m_screen(*this, "screen") { }
117111
118112   required_device<cpu_device> m_maincpu;
r243192r243193
123117   required_shared_ptr<UINT16> m_objram;
124118   required_shared_ptr<UINT16> m_rcram;
125119   required_shared_ptr<UINT8> m_z80_ram;
126
127   required_region_ptr<UINT8> m_char_tiles;
128   required_region_ptr<UINT8> m_obj_tiles;
129   required_region_ptr<UINT8> m_road_rom;
130   required_region_ptr<UINT8> m_obj_map;
131   required_region_ptr<UINT8> m_obj_luts;
132   required_region_ptr<UINT8> m_proms;
133
134120   required_device<screen_device> m_screen;
135121
136122   emu_timer *m_interrupt_timer;
trunk/src/mame/includes/vaportra.h
r243192r243193
4444   DECLARE_WRITE16_MEMBER(vaportra_priority_w);
4545   DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_rg_w);
4646   DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_b_w);
47
47   
4848   DECLARE_DRIVER_INIT(vaportra);
4949   virtual void machine_start();
5050   virtual void machine_reset();
51
51   
5252   UINT32 screen_update_vaportra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5353   void update_24bitcol( int offset );
54
54   
5555   DECO16IC_BANK_CB_MEMBER(bank_callback);
5656};
trunk/src/mame/includes/xyonix.h
r243192r243193
99
1010   required_device<cpu_device> m_maincpu;
1111   required_device<gfxdecode_device> m_gfxdecode;
12
12   
1313   required_shared_ptr<UINT8> m_vidram;
14
14   
1515   tilemap_t *m_tilemap;
1616
1717   int m_e0_data;
1818   int m_credits;
1919   int m_coins;
2020   int m_prev_coin;
21
21   
2222   DECLARE_WRITE8_MEMBER(irqack_w);
2323   DECLARE_READ8_MEMBER(io_r);
2424   DECLARE_WRITE8_MEMBER(io_w);
2525   DECLARE_WRITE8_MEMBER(vidram_w);
26
26   
2727   virtual void machine_start();
2828   virtual void video_start();
2929   TILE_GET_INFO_MEMBER(get_tile_info);
3030   DECLARE_PALETTE_INIT(xyonix);
3131   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
32
32   
3333   void handle_coins(int coin);
3434};
trunk/src/mame/includes/yunsun16.h
r243192r243193
3434   required_shared_ptr<UINT16> m_scrollram_0;
3535   required_shared_ptr<UINT16> m_scrollram_1;
3636   required_shared_ptr<UINT16> m_priorityram;
37//  UINT16 *    m_paletteram; // currently this uses generic palette handling
3738   required_shared_ptr<UINT16> m_spriteram;
3839
3940   /* other video-related elements */
r243192r243193
5758   virtual void video_start();
5859   UINT32 screen_update_yunsun16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5960   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
61   DECLARE_WRITE_LINE_MEMBER(soundirq);
6062};
trunk/src/mame/layout/gts80a_caveman.lay
r243192r243193
151151      <bezel name="text2" element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel>
152152      <bezel name="text1" element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel>
153153      <bezel name="text0" element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel>
154
154   
155155      <screen index="0">
156156         <bounds x="320" y="0" width="320" height="240" />
157157      </screen>
158   </view>
158    </view>
159159</mamelayout>
trunk/src/mame/machine/315-5838_317-0229_comp.c
r243192r243193
1/* Sega Compression (and possibly encryption) device
2
3    315-5838 - Decathlete (ST-V)
4    317-0229 - Dead or Alive (Model 2A)
5
6    Package Type: TQFP100
7
8    This appears to be a dual channel compression chip, used in 1996, predating the 5881.
9    Decathlete uses it to compress ALL the game graphics, Dead or Alive uses it for a
10    dumb security check, decompressing a single string.
11
12    Each channel appears to be connected to a different set of ROMs, however there is
13    defintiely only a single 315-5838 chip. (could the different channels actually just
14    be mirror addresses, with part of the address determining the ROMs to use?)
15
16    Dead of Alive only uses a single channel, and has the source data in RAM, not ROM.
17    This is similar to how some 5881 games were set up, with the ST-V versions decrypting
18    data directly from ROM and the Model 2 ones using a RAM source buffer.
19
20    Looking at the values read I don't think there is any address based encryption, for
21    example many blocks where you'd expect a zero fill start with repeating patterns
22    of 8f708f70 (different lengths) channel would appear to relate to compressed 0x00 data
23
24    read addr 0071253c, blah_r 8f708f70 - read count count 00000004
25    read addr 00712540, blah_r 8f708f70 - read count count 00000008
26    read addr 00712544, blah_r 8f708f70 - read count count 0000000c
27    read addr 00712548, blah_r 8f708f70 - read count count 00000010
28    read addr 0071254c, blah_r 8f708f70 - read count count 00000014
29    read addr 00712550, blah_r 8f708f70 - read count count 00000018
30    read addr 00712554, blah_r 8f708f70 - read count count 0000001c
31
32*/
33
34#include "emu.h"
35#include "machine/315-5838_317-0229_comp.h"
36
37extern const device_type SEGA315_5838_COMP = &device_creator<sega_315_5838_comp_device>;
38
39//#define DEBUG_DATA_DUMP
40
41sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
42   : device_t(mconfig, SEGA315_5838_COMP, "Sega 315-5838 / 317-0029 Compression (Encryption?)", tag, owner, clock, "SEGA315_5838", __FILE__)
43{
44}
45
46
47
48void sega_315_5838_comp_device::device_start()
49{
50   for (int i = 0; i < 2; i++)
51   {
52      m_channel[i].m_decathlt_lastcount = 0;
53      m_channel[i].m_decathlt_prot_uploadmode = 0;
54      m_channel[i].m_decathlt_prot_uploadoffset = 0;
55      m_channel[i].m_read_ch.bind_relative_to(*owner());
56
57   }
58}
59
60void sega_315_5838_comp_device::device_reset()
61{
62   for (int i = 0; i < 2; i++)
63   {
64      m_channel[i].m_srcoffset = 0;
65      m_channel[i].m_decathlt_lastcount = 0;
66      m_channel[i].m_decathlt_prot_uploadmode = 0;
67      m_channel[i].m_decathlt_prot_uploadoffset = 0;
68   }
69
70   m_protstate = 0;
71}
72
73
74/**************************
75*
76* Decathlete
77*
78**************************/
79
80#ifdef DEBUG_DATA_DUMP
81FILE* tempfile;
82#endif
83
84
85READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot1_r)
86{
87   return genericdecathlt_prot_r(mem_mask, 0);
88}
89
90READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot2_r)
91{
92   return genericdecathlt_prot_r(mem_mask, 1);
93}
94
95
96UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int channel)
97{
98//  UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base();
99//  UINT32 retvalue = 0xffff;
100
101   switch (m_channel[channel].m_srcoffset)
102   {
103      default:
104
105      m_channel[channel].m_decathlt_lastcount++;
106
107      UINT32 tempdata = 0;
108      tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 0;
109      m_channel[channel].m_srcoffset++;
110      tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 16;
111      m_channel[channel].m_srcoffset++;
112
113
114      #ifdef DEBUG_DATA_DUMP
115      //printf("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata,  m_channel[channel].m_decathlt_lastcount*4);
116      fwrite(&tempdata, 1, 4, tempfile);
117      #else
118      logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata,  m_channel[channel].m_decathlt_lastcount*4);
119      #endif
120
121      return tempdata;
122#if 0
123      case 0x03228e4:
124         if (fake0) retvalue = fake0[(((0x20080/4)+m_channel[channel].m_decathlt_lastcount))];
125         m_channel[channel].m_decathlt_lastcount++;
126         return retvalue;
127
128      case 0x00a9f3a:
129         if (fake0) retvalue = fake0[(((0x00000/4)+m_channel[channel].m_decathlt_lastcount))];
130         m_channel[channel].m_decathlt_lastcount++;
131         return retvalue;
132
133      case 0x0213ab4:
134         if (fake0) retvalue = fake0[(((0x40000/4)+m_channel[channel].m_decathlt_lastcount))];
135         m_channel[channel].m_decathlt_lastcount++;
136         return retvalue;
137
138      case 0x01efaf0:
139         if (fake0) retvalue = fake0[(((0x60000/4)+m_channel[channel].m_decathlt_lastcount))];
140         m_channel[channel].m_decathlt_lastcount++;
141         return retvalue;
142
143      case 0x033f16c:
144      case 0x038929c:
145
146
147
148      case 0x00de05a:
149      case 0x0334258:
150      case 0x019fb82:
151      case 0x033dbf6:
152      case 0x0011ac6:
153      case 0x00060dc:
154      case 0x0000002:
155      case 0x0008c90:
156      case 0x035cdc8:
157      case 0x0327960:
158      case 0x0329b8c:
159      case 0x00d6e92:
160      case 0x000081e:
161      case 0x00035d6:
162      case 0x00089a6:
163      case 0x03315f4:
164      case 0x0023fe0:
165      case 0x001e290:
166      case 0x0026e86:
167      case 0x0012494:
168      case 0x001b35a:
169      case 0x0018424:
170
171         return retvalue;
172#endif
173   }
174
175   return 0xffffffff;
176}
177
178void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int channel)
179{
180//  printf("set_prot_addr\n");
181   COMBINE_DATA(&m_channel[channel].m_srcoffset);
182
183   //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_channel[channel].m_decathlt_lastcount*4);
184   m_channel[channel].m_decathlt_lastcount = 0;
185
186   if (mem_mask == 0x0000ffff)
187   {
188      printf("set source address to %08x (channel %d)\n", m_channel[channel].m_srcoffset, channel);
189   }
190
191
192#ifdef DEBUG_DATA_DUMP
193   if (mem_mask == 0x0000ffff)
194   {
195      if (tempfile)
196         fclose(tempfile);
197
198      char filename[256];
199      sprintf(filename, "%d_compressed_%08x", channel, m_channel[channel].m_srcoffset * 2);
200      tempfile = fopen(filename, "w+b");
201
202      // the table and dictionary are uploaded repeatedly, usually before groups of data transfers but
203      // it's always the same tables (one pair for each channel)
204      {
205         FILE* fp;
206         sprintf(filename, "%d_compressed_table1", channel);
207         fp = fopen(filename, "w+b");
208         fwrite(&m_channel[channel].m_decathlt_prottable1, 24, 2, fp);
209         fclose(fp);
210      }
211
212      {
213         FILE* fp;
214         sprintf(filename, "%d_compressed_dictionary", channel);
215         fp = fopen(filename, "w+b");
216         fwrite(&m_channel[channel].m_decathlt_dictionary, 128, 2, fp);
217         fclose(fp);
218      }
219   }
220#endif
221
222}
223
224void sega_315_5838_comp_device::set_upload_mode(UINT16 data, int channel)
225{
226   if ((data == 0x8000) || (data == 0x0000))
227   {
228   //  logerror("changed to upload mode 1\n");
229      m_channel[channel].m_decathlt_prot_uploadmode = 1;
230      m_channel[channel].m_decathlt_prot_uploadoffset = 0;
231   }
232   else if ((data == 0x8080) || (data == 0x0080))
233   {
234      m_channel[channel].m_decathlt_prot_uploadmode = 2;
235      m_channel[channel].m_decathlt_prot_uploadoffset = 0;
236   }
237   else
238   {
239      fatalerror("unknown upload mode\n");
240   }
241}
242
243void sega_315_5838_comp_device::upload_table_data(UINT16 data, int channel)
244{
245   if (m_channel[channel].m_decathlt_prot_uploadmode == 1)
246   {
247      if (m_channel[channel].m_decathlt_prot_uploadoffset >= 24)
248      {
249         fatalerror("upload mode 1 error, too big\n");
250         return;
251      }
252
253      //logerror("uploading table 1 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff);
254      m_channel[channel].m_decathlt_prottable1[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff;
255      m_channel[channel].m_decathlt_prot_uploadoffset++;
256      printf("unk table 1 %04x (channel %d)\n", data & 0xffff, channel);
257   }
258   else if (m_channel[channel].m_decathlt_prot_uploadmode == 2)
259   {
260      if (m_channel[channel].m_decathlt_prot_uploadoffset >= 128)
261      {
262         fatalerror("upload mode 2 error, too big\n");
263         return;
264      }
265
266      //logerror("uploading table 2 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff);
267      m_channel[channel].m_decathlt_dictionary[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff;
268      m_channel[channel].m_decathlt_prot_uploadoffset++;
269      printf("dictionary %04x (channel %d)\n", data & 0xffff, channel);
270   }
271}
272
273void sega_315_5838_comp_device::write_prot_data(UINT32 data, UINT32 mem_mask, int channel, int rev_words)
274{
275   if (mem_mask==0xffff0000)
276   {
277      if (rev_words==0) set_upload_mode(data >> 16, channel);
278      else upload_table_data(data >>16, channel);
279   }
280   else if (mem_mask == 0x0000ffff)
281   {
282      if (rev_words==0) upload_table_data(data & 0xffff, channel);
283      else set_upload_mode(data & 0xffff, channel);
284   }
285   else
286   {
287      fatalerror("write_prot_data invalid mem_mask\b");
288   }
289}
290
291
292
293WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_w_doa )  { write_prot_data(data, mem_mask, 0, 1); }
294WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_w)  { write_prot_data(data, mem_mask, 0, 0); }
295WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot2_w)  { write_prot_data(data, mem_mask, 1, 0); }
296
297WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_srcaddr_w ) { set_prot_addr(data, mem_mask, 0); }
298WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot2_srcaddr_w)  { set_prot_addr(data, mem_mask, 1); }
299
300
301void sega_315_5838_comp_device::install_decathlt_protection()
302{
303   //todo, install these in the driver, they differ between games
304   cpu_device* cpu = (cpu_device*)machine().device(":maincpu");
305
306   cpu->space(AS_PROGRAM).install_write_handler(0x37FFFF0, 0x37FFFF3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_srcaddr_w), this)); // set compressed data source address
307   cpu->space(AS_PROGRAM).install_write_handler(0x37FFFF4, 0x37FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w), this)); // upload tables
308   cpu->space(AS_PROGRAM).install_read_handler(0x37FFFF8, 0x37FFFFb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
309
310   // the device is addressed here too, uploading a different set of tables and accessing a different part of ROM
311   cpu->space(AS_PROGRAM).install_write_handler(0x27FFFF0, 0x27FFFF3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_srcaddr_w), this)); // set compressed data source address
312   cpu->space(AS_PROGRAM).install_write_handler(0x27FFFF4, 0x27FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_w), this)); // upload tables
313   cpu->space(AS_PROGRAM).install_read_handler(0x27FFFF8, 0x27FFFFb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_r), this)); // read decompressed data
314}
315
316
317READ32_MEMBER(sega_315_5838_comp_device::doa_prot_r)
318{
319   UINT32 retval = 0;
320
321   if (offset == 0x7ff8/4)
322   {
323      retval = m_protram[m_protstate+1] | m_protram[m_protstate]<<8;
324      m_protstate+=2;
325      printf("doa_prot_read %08x %08x %08x\n", offset*4, retval, mem_mask);
326   }
327   else if (offset == 0x400c/4) // todo, is this actually part of the protection? it's in the address range, but decathlete doesn't have it afaik.
328   {
329      m_prot_a = !m_prot_a;
330      if (m_prot_a)
331         retval = 0xffff;
332      else
333         retval = 0xfff0;
334   }
335   else
336   {
337      printf("doa_prot_read %08x %08x %08x\n", offset*4, retval, mem_mask);
338      logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
339   }
340
341   return retval;
342}
343
344
345WRITE32_MEMBER(sega_315_5838_comp_device::doa_prot_w)
346{
347   printf("doa_prot_w %08x %08x %08x\n", offset*4, data, mem_mask);
348
349   m_protstate = 0;
350}
351
352
353void sega_315_5838_comp_device::install_doa_protection()
354{
355   //todo, install these in the driver, they differ between games
356   cpu_device* cpu = (cpu_device*)machine().device(":maincpu");
357
358   m_protstate = 0;
359   strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00"); // this is the single decompressed string DOA needs, note, 2 spaces at start, might indicate a dummy read like with 5881 on Model 2
360
361   cpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_r), this), write32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_w), this));
362   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff0, 0x01d87ff3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_srcaddr_w), this)); // set compressed data source address (always set 0, data is in RAM)
363   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff4, 0x01d87ff7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w_doa), this)); // upload tab
364//  cpu->space(AS_PROGRAM).install_read_handler(0x01d87ff8, 0x01d87ffb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
365
366}
trunk/src/mame/machine/315-5838_317-0229_comp.h
r243192r243193
1
2#pragma once
3
4#ifndef __SEGA315_5838_COMP__
5#define __SEGA315_5838_COMP__
6
7#define CHANNELS 2
8
9typedef device_delegate<UINT16 (UINT32)> sega_dec_read_delegate;
10
11extern const device_type SEGA315_5838_COMP;
12
13#define MCFG_SET_5838_READ_CALLBACK_CH1( _class, _method) \
14   sega_315_5838_comp_device::set_read_cb_ch1(*device, sega_m2_read_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
15
16#define MCFG_SET_5838_READ_CALLBACK_CH2( _class, _method) \
17   sega_315_5838_comp_device::set_read_cb_ch2(*device, sega_m2_read_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
18
19class sega_315_5838_comp_device :  public device_t
20{
21public:
22   // construction/destruction
23   sega_315_5838_comp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
24
25   sega_dec_read_delegate m_read_ch2;
26
27   static void set_read_cb_ch1(device_t &device,sega_dec_read_delegate readcb)
28   {
29      sega_315_5838_comp_device &dev = downcast<sega_315_5838_comp_device &>(device);
30      dev.m_channel[0].m_read_ch = readcb;
31   }
32
33   static void set_read_cb_ch2(device_t &device,sega_dec_read_delegate readcb)
34   {
35      sega_315_5838_comp_device &dev = downcast<sega_315_5838_comp_device &>(device);
36      dev.m_channel[1].m_read_ch = readcb;
37   }
38
39   DECLARE_READ32_MEMBER(decathlt_prot1_r);
40   DECLARE_READ32_MEMBER(decathlt_prot2_r);;
41   UINT32 genericdecathlt_prot_r(UINT32 mem_mask, int channel);
42
43   void write_prot_data(UINT32 data, UINT32 mem_mask, int channel, int rev_words);
44
45   void upload_table_data(UINT16 data, int channel);
46   void set_upload_mode(UINT16 data, int channel);
47   void set_prot_addr(UINT32 data, UINT32 mem_mask, int channel);
48
49   DECLARE_WRITE32_MEMBER(decathlt_prot1_w_doa);
50   DECLARE_WRITE32_MEMBER(decathlt_prot1_w);
51   DECLARE_WRITE32_MEMBER(decathlt_prot2_w);
52   DECLARE_WRITE32_MEMBER(decathlt_prot1_srcaddr_w);
53   DECLARE_WRITE32_MEMBER(decathlt_prot2_srcaddr_w);
54
55   void install_decathlt_protection();
56   void install_doa_protection();
57
58   DECLARE_READ32_MEMBER(doa_prot_r);
59   DECLARE_WRITE32_MEMBER(doa_prot_w);
60
61protected:
62   virtual void device_start();
63   virtual void device_reset();
64
65private:
66
67   // Decathlete specific variables and functions (see machine/decathlt.c)
68   struct channel_type
69   {
70      UINT32 m_srcoffset;
71      UINT16 m_decathlt_prottable1[24];
72      UINT16 m_decathlt_dictionary[128];
73
74      UINT32 m_decathlt_lastcount;
75      UINT32 m_decathlt_prot_uploadmode;
76      UINT32 m_decathlt_prot_uploadoffset;
77      sega_dec_read_delegate m_read_ch;
78
79   };
80
81   channel_type m_channel[2];
82
83
84
85   // Doa
86   int m_protstate;
87   int m_prot_a;
88   UINT8 m_protram[256];
89};
90
91#endif
trunk/src/mame/machine/315-5881_crypt.c
r243192r243193
4545   save_item(NAME(line_buffer_pos));
4646   save_item(NAME(line_buffer_size));
4747
48   astring skey = parameter("key");
49   if(skey)
50      key = strtoll(skey.cstr(), 0, 16);
51   else
52   {
53      logerror("%s: Warning: key not provided\n", tag());
54      key = 0;
55   }
5648}
5749
5850void sega_315_5881_crypt_device::device_reset()
r243192r243193
7870   if(!enc_ready)
7971      enc_start();
8072   if(dec_header & FLAG_COMPRESSED) {
81      if (line_buffer_pos == line_buffer_size) // if there's no data left to read..
82      {
83         if (done_compression == 1)
84            enc_start();
85
86
87
73      if(line_buffer_pos == line_buffer_size)
8874         line_fill();
89      }
9075      base = line_buffer + line_buffer_pos;
9176      line_buffer_pos += 2;
9277   } else {
r243192r243193
10994{
11095   prot_cur_address = (prot_cur_address & 0x0000ffff) | (data << 16);
11196   enc_ready = false;
112
113   buffer_bit = 7;
114   buffer_bit2 = 15;
11597}
11698
11799void sega_315_5881_crypt_device::set_subkey(UINT16 data)
r243192r243193
120102   enc_ready = false;
121103}
122104
105void sega_315_5881_crypt_device::set_key(UINT32 data)
106{
107   key = data;
108   enc_ready = false;
109}
110
123111/***************************************************************************
124112    DECRYPTION EMULATION
125113
r243192r243193
132120
133121The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher.
134122
135Every stream can be composed by several substreams; there are 18 header bits at the start of every substream, with
136a 1+9+8 format; the highest bit control the mode of operation: set to 1 means that the substream needs to be decompressed
137after being decrypted. The other two blocks (A||B) encode the length of the substream, as (A+1)*(B+1). When a
138substream end, the header of the next one, if existing, follows inmediatly.
123There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means
124that the decrypted stream needs to be decompressed after being decrypted. More on this later.
139125
140126The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been
141127conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests
r243192r243193
148134given plaintext word, and the remaining 2 to the next plaintext word.
149135
150136The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits),
151the game-key (>=29 bits; probably 64) and the sequence-key (16 bits) and output a middle result (16 bits) which will act
152as another key for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key
153and the result from the first FN and will output the decrypted word (16 bits).
137the game-key (>=26 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
138for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result
139from the first FN and will output the decrypted word (16 bits).
154140
155Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the
156XOR of at most one bit from the previous round and at most one bit from the different keys.
141Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input can be the
142XOR of at most two "sources bits", being source bits the bits from the previous round and the bits from the different keys.
157143
158144The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and,
159145indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident,
160as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due).
146as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due). However,
147the key scheduling used by this implementation is much weaker than the CPS-2's one. Many s-boxes inputs aren't XORed with any
148key bit.
161149
150Due to the small key-length, no sophisticated attacks are needed to recover the keys; a brute-force attack knowing just
151some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some
152related keys can produce the same output bytes for some (short) input sequences.
153
154The only difference in the decryption process between M2 and M3 is the initialization of the counter. In M3, the counter is
155always set to 0 at the beginning of the decryption while, in M2, the bits #1-#16 of the ciphertext's address are used
156to initialize the counter.
157
162158Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is
163159mapped to multiples of 128K.
164160
r243192r243193
168164chosen so as to make the key for CAPSNK equal to 0.
169165
170166It can be observed that a couple of sboxes have incomplete tables (a 255 value indicate an unknown value). The recovered keys
171as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the
167as of december/2010 show small randomness and big correlations, making possible that some unseen bits could make the
172168decryption need those incomplete parts.
173169
174SEGA apparently used his security part label (317-xxxx-yyy) as part of the key; the mapping of the current keys to the chip label
175is given by the following function:
176
177void key2label(uint32_t key)
178{
179    int bcd0 = ((BIT(key,17)<<3)|(BIT(key,7)<<2)|(BIT(key,14)<<1)|BIT(key,19))^9;
180    int bcd1 = ((BIT(key,20)<<3)|(BIT(key,1)<<2)|(BIT(key,4)<<1)|BIT(key,13))^5;
181    int bcd2 = (BIT(key,9)<<1)|BIT(key,22);
182    int bcd3 = ((BIT(key,9)<<2)|BIT(key,9))^5;
183
184    char chiplabel[13];
185    sprintf(chiplabel, "317-%d%d%d%d-%s", bcd3, bcd2, bcd1, bcd0, (BIT(key,5)?"JPN":"COM"));
186
187    printf("%s", chiplabel);
188}
189
190Given the use of the BCD-encoded security module labels, it's expected that at least other 6 additional bits be present in the
191real keys but undetected in the current implementation (due to them being set to fixed values on all the known 315-5881 chip labels).
192That would rise the bit count at least to 35.
193
194Other key bits not directly related to the 315-5881 label still show low entropies, making possible that
195they be derived from other non-random sources.
196
197In the second Feistel Network, every key bit seem to be used at most once (the various uses of current bit #9 are fictitious, as
198that bit really represent various bits in the real key; see comments on the use of the labels above). Given that, it seems probable
199that the real key is 64 bits long, exactly as in the related CPS-2 scheme, and the designers tried to cover all 96 input bits with
200the bits provening from the game key, the sequence key and the result from the first feistel network (64+16+16=96). In the first
201Feistel Network, as only 80 bits are available, some bits would be used twice (as can be partially seen in the current implementation).
202The fact that only 29 bits out of the expected 64 have been observed till now would be due to the generation of the key by composing
203low-entropy sources.
204
205170****************************************************************************************/
206171
207172const sega_315_5881_crypt_device::sbox sega_315_5881_crypt_device::fn1_sboxes[4][4] = {
r243192r243193
263228
264229      {
265230         {
266            2,2,2,3,1,1,0,1,3,3,1,1,2,2,2,0,0,3,2,3,3,0,2,1,2,2,3,0,1,3,0,0,
267            3,2,0,3,2,0,1,0,0,1,2,2,3,3,0,2,2,1,3,1,1,1,1,2,0,3,1,0,0,2,3,2,
231            2,2,2,3,1,1,0,1,0,1,2,2,3,3,0,2,0,3,2,3,3,0,2,1,0,3,1,0,0,2,3,2,
232            3,2,0,3,2,0,1,0,3,3,1,1,2,2,2,0,2,1,3,1,1,1,1,2,2,2,3,0,1,3,0,0,
268233         },
269         {1,2,5,6,7,6},
234         {1,2,5,6,7,-1},
270235         {2,7}
271236      },
272237
r243192r243193
370335
371336      {
372337         {
373            0,1,3,0,1,1,2,3,2,0,0,3,2,1,3,1,3,3,0,0,1,0,0,3,0,3,3,2,3,2,0,1,
374            3,2,3,2,2,1,3,1,1,1,0,3,3,2,2,1,1,2,0,2,0,1,1,0,1,0,1,1,2,0,3,0,
338            0,2,3,2,1,1,0,0,2,1,0,3,3,0,0,0,3,2,0,2,1,1,2,1,0,0,3,1,2,2,3,1,
339            3,1,3,0,0,0,1,3,1,0,0,3,2,2,3,1,1,3,0,0,2,1,3,3,1,3,1,2,3,1,2,1,
375340         },
376         {0,3,5,6,5,0},
341         {0,3,5,6,-1,-1},
377342         {1,2}
378343      },
379344
r243192r243193
416381
417382      {
418383         {
419            1,0,3,0,0,1,2,1,0,0,1,0,0,0,2,3,2,2,0,2,0,1,3,0,2,0,1,3,2,3,0,1,
420            1,2,2,2,1,3,0,3,0,1,1,0,3,2,3,3,2,0,0,3,1,2,1,3,3,2,1,0,2,1,2,3,
384            1,2,3,2,0,3,2,3,0,1,1,0,0,2,2,3,2,0,0,3,0,2,3,3,2,2,1,0,2,1,0,3,
385            1,0,2,0,1,1,0,1,0,0,1,0,3,0,3,3,2,2,0,2,1,1,1,0,3,0,1,3,2,3,2,1,
421386         },
422         {2,3,4,6,7,2},
387         {2,3,4,6,7,-1},
423388         {2,3}
424389      },
425390
r243192r243193
435400   {   // 3rd round
436401      {
437402         {
438            0,3,0,1,3,0,0,2,1,0,1,3,2,2,2,0,3,3,3,0,2,2,0,3,0,0,2,3,0,3,2,1,
439            3,3,0,3,0,2,3,3,1,1,1,0,2,2,1,1,3,0,3,1,2,0,2,0,0,0,3,2,1,1,0,0,
403            0,3,0,1,0,2,3,3,1,0,1,3,2,2,1,1,3,3,3,0,2,0,2,0,0,0,2,3,1,1,0,0,
404            3,3,0,3,3,0,0,2,1,1,1,0,2,2,2,0,3,0,3,1,2,2,0,3,0,0,3,2,0,3,2,1,
440405         },
441         {1,4,5,6,7,5},
406         {1,4,5,6,7,-1},
442407         {0,5}
443408      },
444409
r243192r243193
453418
454419      {
455420         {
456            2,2,0,3,0,3,1,0,1,1,2,3,2,3,1,0,0,0,3,2,2,0,2,3,1,3,2,0,3,3,1,3,
421            2,2,3,2,0,3,2,3,1,1,2,0,2,3,1,3,0,0,0,3,2,0,1,0,1,3,2,3,3,3,1,0,
457422            // unused?
458423            255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
459424         },
460         {1,2,4,7,2,-1},
425         {1,2,4,7,-1,-1},
461426         {2,4}
462427      },
463428
r243192r243193
509474   },
510475};
511476
512const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = {
477const int sega_315_5881_crypt_device::fn1_game_key_scheduling[38][2] = {
513478   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
514   {6,51},  {7,92},  {8,89},  {9,9},   {9,39},  {9,58},  {9,86},  {10,90},
515   {11,6},  {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, {18,23},
516   {18,43}, {19,82}, {20,81}, {21,32}, {22,5},  {23,66}, {24,13}, {24,45},
517   {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25}
479   {6,51},  {7,92},  {8,89},  {9,9},   {9,10},  {9,39},  {9,41},  {9,58},
480   {9,59},  {9,86},  {10,90}, {11,6},  {12,64}, {13,49}, {14,44}, {15,40},
481   {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {21,61},
482   {22,5},  {23,66}, {24,13}, {24,45}, {25,12}, {25,35}
518483};
519484
520const int sega_315_5881_crypt_device::fn2_game_key_scheduling[FN2GK][2] = {
485const int sega_315_5881_crypt_device::fn2_game_key_scheduling[34][2] = {
521486   {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
522   {8,39},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {11,57}, {12,59},
523   {13,61}, {14,63}, {15,67}, {16,72}, {17,83}, {18,88}, {19,94}, {20,35},
524   {21,17}, {22,6},  {23,85}, {24,16}, {25,25}, {26,92}, {27,47}, {28,28}
487   {8,39},  {9,47},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {10,53},
488   {11,57}, {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83},
489   {18,88}, {19,94}, {20,35}, {21,17}, {21,92}, {22,6},  {22,11}, {23,85},
490   {24,16}, {25,25}
525491};
526492
527493const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
r243192r243193
567533UINT16 sega_315_5881_crypt_device::block_decrypt(UINT32 game_key, UINT16 sequence_key, UINT16 counter, UINT16 data)
568534{
569535   int j;
570   int aux, aux2;
571   int A, B;
536   int aux,aux2;
537   int A,B;
572538   int middle_result;
573539   UINT32 fn1_subkeys[4];
574540   UINT32 fn2_subkeys[4];
575541
576542   /* Game-key scheduling; this could be done just once per game at initialization time */
577   memset(fn1_subkeys, 0, sizeof(UINT32) * 4);
578   memset(fn2_subkeys, 0, sizeof(UINT32) * 4);
543   memset(fn1_subkeys,0,sizeof(UINT32)*4);
544   memset(fn2_subkeys,0,sizeof(UINT32)*4);
579545
580   for (j = 0; j < FN1GK; ++j) {
581      if (BIT(game_key, fn1_game_key_scheduling[j][0]) != 0) {
582         aux = fn1_game_key_scheduling[j][1] % 24;
583         aux2 = fn1_game_key_scheduling[j][1] / 24;
584         fn1_subkeys[aux2] ^= (1 << aux);
546   for (j=0; j<38; ++j) {
547      if (BIT(game_key, fn1_game_key_scheduling[j][0])!=0) {
548         aux = fn1_game_key_scheduling[j][1]%24;
549         aux2 = fn1_game_key_scheduling[j][1]/24;
550         fn1_subkeys[aux2] ^= (1<<aux);
585551      }
586552   }
587553
588   for (j = 0; j < FN2GK; ++j) {
589      if (BIT(game_key, fn2_game_key_scheduling[j][0]) != 0) {
590         aux = fn2_game_key_scheduling[j][1] % 24;
591         aux2 = fn2_game_key_scheduling[j][1] / 24;
592         fn2_subkeys[aux2] ^= (1 << aux);
554   for (j=0; j<34; ++j) {
555      if (BIT(game_key, fn2_game_key_scheduling[j][0])!=0) {
556         aux = fn2_game_key_scheduling[j][1]%24;
557         aux2 = fn2_game_key_scheduling[j][1]/24;
558         fn2_subkeys[aux2] ^= (1<<aux);
593559      }
594560   }
595561   /********************************************************/
596562
597563   /* Sequence-key scheduling; this could be done just once per decryption run */
598   for (j = 0; j < 20; ++j) {
599      if (BIT(sequence_key, fn1_sequence_key_scheduling[j][0]) != 0) {
600         aux = fn1_sequence_key_scheduling[j][1] % 24;
601         aux2 = fn1_sequence_key_scheduling[j][1] / 24;
602         fn1_subkeys[aux2] ^= (1 << aux);
564   for (j=0; j<20; ++j) {
565      if (BIT(sequence_key,fn1_sequence_key_scheduling[j][0])!=0) {
566         aux = fn1_sequence_key_scheduling[j][1]%24;
567         aux2 = fn1_sequence_key_scheduling[j][1]/24;
568         fn1_subkeys[aux2] ^= (1<<aux);
603569      }
604570   }
605571
606   for (j = 0; j < 16; ++j) {
607      if (BIT(sequence_key, j) != 0) {
608         aux = fn2_sequence_key_scheduling[j] % 24;
609         aux2 = fn2_sequence_key_scheduling[j] / 24;
610         fn2_subkeys[aux2] ^= (1 << aux);
572   for (j=0; j<16; ++j) {
573      if (BIT(sequence_key,j)!=0) {
574         aux = fn2_sequence_key_scheduling[j]%24;
575         aux2 = fn2_sequence_key_scheduling[j]/24;
576         fn2_subkeys[aux2] ^= (1<<aux);
611577      }
612578   }
613579
580   // subkeys bits 10 & 41
581   fn2_subkeys[0] ^= (BIT(sequence_key,2)<<10);
582   fn2_subkeys[1] ^= (BIT(sequence_key,4)<<17);
614583   /**************************************************************/
615584
616585   // First Feistel Network
617586
618   aux = BITSWAP16(counter, 5, 12, 14, 13, 9, 3, 6, 4, 8, 1, 15, 11, 0, 7, 10, 2);
587   aux = BITSWAP16(counter,5,12,14,13,9,3,6,4,    8,1,15,11,0,7,10,2);
619588
620589   // 1st round
621590   B = aux >> 8;
622   A = (aux & 0xff) ^ feistel_function(B, fn1_sboxes[0], fn1_subkeys[0]);
591   A = (aux & 0xff) ^ feistel_function(B,fn1_sboxes[0],fn1_subkeys[0]);
623592
624593   // 2nd round
625   B ^= feistel_function(A, fn1_sboxes[1], fn1_subkeys[1]);
594   B = B ^ feistel_function(A,fn1_sboxes[1],fn1_subkeys[1]);
626595
627596   // 3rd round
628   A ^= feistel_function(B, fn1_sboxes[2], fn1_subkeys[2]);
597   A = A ^ feistel_function(B,fn1_sboxes[2],fn1_subkeys[2]);
629598
630599   // 4th round
631   B ^= feistel_function(A, fn1_sboxes[3], fn1_subkeys[3]);
600   B = B ^ feistel_function(A,fn1_sboxes[3],fn1_subkeys[3]);
632601
633   middle_result = (B << 8) | A;
602   middle_result = (B<<8)|A;
634603
635604
636605   /* Middle-result-key sheduling */
637   for (j = 0; j < 16; ++j) {
638      if (BIT(middle_result, j) != 0) {
639         aux = fn2_middle_result_scheduling[j] % 24;
640         aux2 = fn2_middle_result_scheduling[j] / 24;
641         fn2_subkeys[aux2] ^= (1 << aux);
606   for (j=0; j<16; ++j) {
607      if (BIT(middle_result,j)!=0) {
608         aux = fn2_middle_result_scheduling[j]%24;
609         aux2 = fn2_middle_result_scheduling[j]/24;
610         fn2_subkeys[aux2] ^= (1<<aux);
642611      }
643612   }
644613   /*********************/
645614
646615   // Second Feistel Network
647616
648   aux = BITSWAP16(data, 14, 3, 8, 12, 13, 7, 15, 4, 6, 2, 9, 5, 11, 0, 1, 10);
617   aux = BITSWAP16(data,14,3,8,12,13,7,15,4,    6,2,9,5,11,0,1,10);
649618
650619   // 1st round
651620   B = aux >> 8;
652   A = (aux & 0xff) ^ feistel_function(B, fn2_sboxes[0], fn2_subkeys[0]);
621   A = (aux & 0xff) ^ feistel_function(B,fn2_sboxes[0],fn2_subkeys[0]);
653622
654623   // 2nd round
655   B ^= feistel_function(A, fn2_sboxes[1], fn2_subkeys[1]);
624   B = B ^ feistel_function(A,fn2_sboxes[1],fn2_subkeys[1]);
656625
657626   // 3rd round
658   A ^= feistel_function(B, fn2_sboxes[2], fn2_subkeys[2]);
627   A = A ^ feistel_function(B,fn2_sboxes[2],fn2_subkeys[2]);
659628
660629   // 4th round
661   B ^= feistel_function(A, fn2_sboxes[3], fn2_subkeys[3]);
630   B = B ^ feistel_function(A,fn2_sboxes[3],fn2_subkeys[3]);
662631
663   aux = (B << 8) | A;
632   aux = (B<<8)|A;
664633
665   aux = BITSWAP16(aux, 15, 7, 6, 14, 13, 12, 5, 4, 3, 2, 11, 10, 9, 1, 0, 8);
634   aux = BITSWAP16(aux,15,7,6,14,13,12,5,4,    3,2,11,10,9,1,0,8);
666635
667636   return aux;
668637}
669638
670
671639UINT16 sega_315_5881_crypt_device::get_decrypted_16()
672640{
673641   UINT16 enc;
r243192r243193
679647   dec_hist = dec;
680648
681649   prot_cur_address ++;
682
683//  printf("get_decrypted_16 %04x\n", res);
684
685650   return res;
686651}
687652
688
689653void sega_315_5881_crypt_device::enc_start()
690654{
691   block_pos = 0;
692   done_compression = 0;
693655   buffer_pos = BUFFER_SIZE;
694
695   if (buffer_bit2 != 15) // if we have remaining bits in the decompression buffer we shouldn't read the next word yet but should instead use the bits we have?? (twcup98) (might just be because we should be pulling bytes not words?)
696   {
697//      printf("buffer_bit2 is %d\n", buffer_bit2);
698      dec_header = (buffer2a & 0x0003) << 16;
699   }
700   else
701   {
702      dec_hist = 0; // seems to be needed by astrass at least otherwise any call after the first one will be influenced by the one before it.
703      dec_header = get_decrypted_16() << 16;
704   }
705
656   dec_header = get_decrypted_16() << 16;
706657   dec_header |= get_decrypted_16();
707658
708   // the lower header bits are 2 values that multiply together to get the current stream length
709   // in astrass the first block is 0xffff (for a 0x10000 block) followed by 0x3f3f (for a 0x1000 block)
710   // etc. after each block a new header must be read, it looks like compressed and uncompressed blocks
711   // can be mixed like this, I don't know if the length is src length of decompressed length.
712   // deathcox and others confirm format as 0x20000 bit as compressed bit, 0x1ff00 bits as block size 1, 0x000ff bits as block size 2
713   // for compressed streams the 'line size' is block size 1.
714
715   block_numlines = ((dec_header & 0x000000ff) >> 0) + 1;
716   int blocky = ((dec_header & 0x0001ff00) >> 8) + 1;
717   block_size = block_numlines * blocky;
718
719659   if(dec_header & FLAG_COMPRESSED) {
720      line_buffer_size = blocky;
660      line_buffer_size = dec_header & FLAG_LINE_SIZE_512 ? 512 : 256;
721661      line_buffer_pos = line_buffer_size;
722662      buffer_bit = 7;
723      buffer_bit2 = 15;
724663   }
725
726   printf("header %08x\n", dec_header);
727664   enc_ready = true;
728665}
729666
r243192r243193
734671      UINT16 val = get_decrypted_16();
735672      buffer[i] = val;
736673      buffer[i+1] = val >> 8;
737      block_pos+=2;
738
739      if (!(dec_header & FLAG_COMPRESSED))
740      {
741         if (block_pos == block_size)
742         {
743            // if we reach the size specified we need to read a new header
744            // todo: for compressed blocks this depends on OUTPUT size, not input size, so things get messy
745
746            enc_start();
747         }
748      }
749674   }
750675   buffer_pos = 0;
751676}
r243192r243193
824749
825750int sega_315_5881_crypt_device::get_compressed_bit()
826751{
827//  if(buffer_pos == BUFFER_SIZE)
828//      enc_fill();
829
830   if (buffer_bit2 == 15)
831   {
832      buffer_bit2 = 0;
833      buffer2a = get_decrypted_16();
834      buffer2[0] = buffer2a;
835      buffer2[1] = buffer2a >> 8;
836   //  block_pos+=2;
837      buffer_pos = 0;
838
839   }
840   else
841   {
842      buffer_bit2++;
843   }
844
845//  if (buffer_bit ==7) printf("using byte %02x\n", buffer2[(buffer_pos&1) ^ 1]);
846
847   int res = (buffer2[(buffer_pos&1)^1] >> buffer_bit) & 1;
752   if(buffer_pos == BUFFER_SIZE)
753      enc_fill();
754   int res = (buffer[buffer_pos^1] >> buffer_bit) & 1;
848755   buffer_bit--;
849756   if(buffer_bit == -1) {
850757      buffer_bit = 7;
r243192r243193
852759   }
853760   return res;
854761}
762
855763void sega_315_5881_crypt_device::line_fill()
856764{
857765   assert(line_buffer_pos == line_buffer_size);
r243192r243193
861769   line_buffer_prev = lp;
862770   line_buffer_pos = 0;
863771
772   UINT32 line_buffer_mask = line_buffer_size-1;
773
864774   for(int i=0; i != line_buffer_size;) {
865775      // vlc 0: start of line
866776      // vlc 1: interior of line
r243192r243193
883793            static int offsets[4] = {0, 1, 0, -1};
884794            int offset = offsets[(tmp & 0x18) >> 3];
885795            for(int j=0; j != count; j++) {
886               lc[i^1] = lp[((i+offset) % line_buffer_size)^1];
796               lc[i^1] = lp[((i+offset) & line_buffer_mask)^1];
887797               i++;
888798            }
889799
r243192r243193
904814         }
905815      }
906816   }
907
908   block_pos++;
909   if (block_numlines == block_pos)
910   {
911      done_compression = 1;
912   }
913   else
914   {
915   }
916817}
trunk/src/mame/machine/315-5881_crypt.h
r243192r243193
2323   void set_addr_low(UINT16 data);
2424   void set_addr_high(UINT16 data);
2525   void set_subkey(UINT16 data);
26   void set_key(UINT32 data);
2627
2728   sega_m2_read_delegate m_read;
2829
r243192r243193
3940private:
4041
4142   enum {
42//        BUFFER_SIZE = 32768, LINE_SIZE = 512,
43      BUFFER_SIZE = 2, LINE_SIZE = 512,  // this should be a stream, without any 'BUFFER_SIZE' ? I guess the SH4 DMA implementation isn't on a timer tho?
44      FLAG_COMPRESSED = 0x20000
43      BUFFER_SIZE = 32768, LINE_SIZE = 512,
44      FLAG_COMPRESSED = 0x10000, FLAG_LINE_SIZE_512 = 0x20000
4545   };
4646
4747   UINT32 key;
r243192r243193
5353
5454   bool enc_ready;
5555
56   int buffer_pos, line_buffer_pos, line_buffer_size, buffer_bit, buffer_bit2;
57   UINT8 buffer2[2];
58   UINT16 buffer2a;
56   int buffer_pos, line_buffer_pos, line_buffer_size, buffer_bit;
5957
60   int block_size;
61   int block_pos;
62   int block_numlines;
63   int done_compression;
64
6558   struct sbox {
6659      UINT8 table[64];
6760      int inputs[6];      // positions of the inputs bits, -1 means no input except from key
r243192r243193
7164   static const sbox fn1_sboxes[4][4];
7265   static const sbox fn2_sboxes[4][4];
7366
74   static const int FN1GK = 38;
75   static const int FN2GK = 32;
76   static const int fn1_game_key_scheduling[FN1GK][2];
77   static const int fn2_game_key_scheduling[FN2GK][2];
67   static const int fn1_game_key_scheduling[38][2];
68   static const int fn2_game_key_scheduling[34][2];
7869   static const int fn1_sequence_key_scheduling[20][2];
7970   static const int fn2_sequence_key_scheduling[16];
8071   static const int fn2_middle_result_scheduling[16];
trunk/src/mame/machine/dec0.c
r243192r243193
364364   RAM[0x1af] = 0x60; /* RTS prot area */
365365   RAM[0x1db] = 0x60; /* RTS prot area */
366366   RAM[0x21a] = 0x60; /* RTS prot area */
367
367   
368368   save_item(NAME(m_hippodrm_msb));
369369   save_item(NAME(m_hippodrm_lsb));
370370}
r243192r243193
377377   /* Slyspy sound cpu has some protection */
378378   RAM[0xf2d] = 0xea;
379379   RAM[0xf2e] = 0xea;
380
380   
381381   save_item(NAME(m_slyspy_state));
382382}
383383
trunk/src/mame/machine/decathlt.c
r0r243193
1/* The Decathlete 'protection' seems to be some kind of Huffman style compression on the graphics,
2  the game uploads 2 dictionary tables (for different areas of the ROM) as well as an additional
3  table with each one.  The secondary table doesn't initially appear to be the data needed to
4  build the trees required for decompression */
5
6#include "emu.h"
7#include "includes/stv.h"
8
9/**************************
10*
11* Decathlete
12*
13**************************/
14
15READ32_MEMBER( stv_state::decathlt_prot_r )
16{
17   // the offsets written to the protection device definitely only refer to 2 of the roms
18   //  it's a fair assumption to say that only those 2 are connected to the protection device
19   UINT8 *ROM = (UINT8 *)memregion("abus")->base()+0x1000000;
20   UINT32 *fake0 = (UINT32*)memregion( "fake0" )->base();
21
22   if (offset==2)
23   {
24      UINT32 retvalue = 0xffff;
25
26      switch (m_decathlt_protregs[0])
27      {
28         default:
29         retvalue = ROM[(m_decathlt_protregs[0]*2)-2];
30         retvalue <<= 8;
31         retvalue |= ROM[((m_decathlt_protregs[0]+1)*2)+1-2];
32         retvalue <<= 8;
33         retvalue |= ROM[((m_decathlt_protregs[0]+1)*2)-2];
34         retvalue <<= 8;
35         retvalue |= ROM[((m_decathlt_protregs[0]+2)*2)+1-2];
36         m_decathlt_lastcount++;
37         logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_decathlt_protregs[0], retvalue, m_decathlt_lastcount*4);
38         m_decathlt_protregs[0]+=2;
39         return retvalue;
40
41         case 0x03228e4:
42            if (fake0) retvalue = fake0[(((0x20080/4)+m_decathlt_lastcount))];
43            m_decathlt_lastcount++;
44            return retvalue;
45
46         case 0x00a9f3a:
47            if (fake0) retvalue = fake0[(((0x00000/4)+m_decathlt_lastcount))];
48            m_decathlt_lastcount++;
49            return retvalue;
50
51         case 0x0213ab4:
52            if (fake0) retvalue = fake0[(((0x40000/4)+m_decathlt_lastcount))];
53            m_decathlt_lastcount++;
54            return retvalue;
55
56         case 0x01efaf0:
57            if (fake0) retvalue = fake0[(((0x60000/4)+m_decathlt_lastcount))];
58            m_decathlt_lastcount++;
59            return retvalue;
60
61         case 0x033f16c:
62         case 0x038929c:
63
64
65
66         case 0x00de05a:
67         case 0x0334258:
68         case 0x019fb82:
69         case 0x033dbf6:
70         case 0x0011ac6:
71         case 0x00060dc:
72         case 0x0000002:
73         case 0x0008c90:
74         case 0x035cdc8:
75         case 0x0327960:
76         case 0x0329b8c:
77         case 0x00d6e92:
78         case 0x000081e:
79         case 0x00035d6:
80         case 0x00089a6:
81         case 0x03315f4:
82         case 0x0023fe0:
83         case 0x001e290:
84         case 0x0026e86:
85         case 0x0012494:
86         case 0x001b35a:
87         case 0x0018424:
88
89            return retvalue;
90      }
91
92
93   }
94   else
95   {
96      logerror("%06x Decathlete prot R offset %04x mask %08x regs %08x, %08x, %08x, %08x\n", safe_pc(), offset, mem_mask, m_decathlt_protregs[0], m_decathlt_protregs[1], m_decathlt_protregs[2], m_decathlt_protregs[3]);
97   }
98
99   return m_decathlt_protregs[offset];
100}
101
102
103void stv_state::write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which)
104{
105   m_decathlt_protregs[offset] = (data&mem_mask)|(m_decathlt_protregs[offset]&~mem_mask);
106//  m_decathlt_protregs[0] = 0x0c00000/4;
107
108   if (offset==0) // seems to set a (scrambled?) source address
109   {
110      m_decathlt_part ^=1;
111
112      //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",which, m_decathlt_lastcount*4);
113      m_decathlt_lastcount = 0;
114      if (m_decathlt_part==1) logerror("%d Decathlete prot W offset %04x data %08x, %08x, >>> regs %08x <<<<, %08x, %08x, %08x\n",which, offset, data, m_decathlt_protregs[0], m_decathlt_protregs[0]*4, m_decathlt_protregs[1], m_decathlt_protregs[2], m_decathlt_protregs[3]);
115   }
116
117   if (offset==1) // uploads 2 tables...
118   {
119      if (mem_mask==0xffff0000)
120      {
121         if (data == 0x80000000)
122         {
123         //  logerror("changed to upload mode 1\n");
124            m_decathlt_prot_uploadmode = 1;
125            m_decathlt_prot_uploadoffset = 0;
126         }
127         else if (data == 0x80800000)
128         {
129         //  logerror("changed to upload mode 2\n");
130            m_decathlt_prot_uploadmode = 2;
131            m_decathlt_prot_uploadoffset = 0;
132         }
133         else
134         {
135         //  logerror("unknown upload mode\n");
136            m_decathlt_prot_uploadmode = 2;
137            m_decathlt_prot_uploadoffset = 0;
138         }
139
140//          logerror("ARGH! %08x %08x\n",mem_mask,data);
141      }
142      else if (mem_mask==0x0000ffff)
143      {
144         if (m_decathlt_prot_uploadmode==1)
145         {
146            if (m_decathlt_prot_uploadoffset>=24)
147            {
148            //  logerror("upload mode 1 error, too big\n");
149               return;
150            }
151
152            //logerror("uploading table 1 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff);
153            m_decathlt_prottable1[m_decathlt_prot_uploadoffset]=data&0xffff;
154            m_decathlt_prot_uploadoffset++;
155
156            {
157               /* 0x18 (24) values in this table, rom data is 0x1800000 long, maybe it has
158                  something to do with that? or 24-address bits?
159
160                  uploaded values appear to be 12-bit, some are repeated
161               */
162
163               {
164                  FILE* fp;
165                  if (which==1) fp = fopen("table1x","wb");
166                  else fp = fopen("table1","wb");
167
168                  {
169                     fwrite(&m_decathlt_prottable1,24,2,fp);
170                  }
171                  fclose(fp);
172               }
173            }
174
175         }
176         else if (m_decathlt_prot_uploadmode==2)
177         {
178            if (m_decathlt_prot_uploadoffset>=128)
179            {
180               //logerror("upload mode 2 error, too big\n");
181               return;
182            }
183
184            //logerror("uploading table 2 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff);
185            m_decathlt_prottable2[m_decathlt_prot_uploadoffset]=data&0xffff;
186            m_decathlt_prot_uploadoffset++;
187
188            {
189               /* the table uploaded here is a 256 byte table with 256 unique values, remaps something? */
190
191               {
192                  FILE* fp;
193                  if (which==1) fp = fopen("table2x","wb");
194                  else fp = fopen("table2","wb");
195
196                  {
197                     fwrite(&m_decathlt_prottable2,128,2,fp);
198                  }
199                  fclose(fp);
200               }
201            }
202         }
203         else
204         {
205         //  logerror("unknown upload mode!\n");
206         }
207      }
208   }
209
210   if (offset>1)
211   {
212   //  logerror("higher offset write\n");
213   }
214
215}
216
217WRITE32_MEMBER( stv_state::decathlt_prot1_w )
218{
219   write_prot_data(data,mem_mask, offset, 0);
220
221}
222
223WRITE32_MEMBER( stv_state::decathlt_prot2_w )
224{
225   write_prot_data(data,mem_mask, offset, 1);
226
227
228}
229
230void stv_state::install_decathlt_protection()
231{
232   /* It uploads 2 tables here, then performs what looks like a number of transfers, setting
233      a source address of some kind (scrambled?) and then making many reads from a single address */
234   memset(m_decathlt_protregs, 0, sizeof(m_decathlt_protregs));
235   m_decathlt_lastcount = 0;
236   m_decathlt_prot_uploadmode = 0;
237   m_decathlt_prot_uploadoffset = 0;
238   m_decathlt_part = 1;
239   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x37FFFF0, 0x37FFFFF, read32_delegate(FUNC(stv_state::decathlt_prot_r), this), write32_delegate(FUNC(stv_state::decathlt_prot1_w), this));
240   /* It accesses the device at this address too, with different tables, for the game textures, should it just act like a mirror, or a secondary device? */
241   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x27FFFF0, 0x27FFFFF, read32_delegate(FUNC(stv_state::decathlt_prot_r), this), write32_delegate(FUNC(stv_state::decathlt_prot2_w), this));
242}
trunk/src/mame/machine/jvs13551.c
r243192r243193
144144
145145bool sega_837_13551::swoutputs(UINT8 count, const UINT8 *vals)
146146{
147   // WARNING! JVS standard have reversed bits count order
148   // so "board have 6 output bits" means 6 MSB bits is used, the same rules for input too
149147   if(count > 1)
150148      return false;
151   jvs_outputs = vals[0] & 0xfc;
149   jvs_outputs = vals[0] & 0x3f;
152150   logerror("837-13551: output %02x\n", jvs_outputs);
153   ioport(port_tag[11])->write_safe(jvs_outputs, 0xfc);
151   ioport(port_tag[11])->write_safe(jvs_outputs, 0x3f);
154152   return true;
155153}
156154
trunk/src/mame/machine/midtunit.c
r243192r243193
7373}
7474
7575
76
7677/*************************************
7778 *
79 *  Generic input ports
80 *
81 *************************************/
82
83IOPORT_ARRAY_MEMBER(midtunit_state::tunit_ports) { "IN0", "IN1", "IN2", "DSW" };
84
85READ16_MEMBER(midtunit_state::midtunit_input_r)
86{
87   return m_ports[offset]->read();
88}
89
90
91
92/*************************************
93 *
7894 *  Mortal Kombat (T-unit) protection
7995 *
8096 *************************************/
trunk/src/mame/machine/mie.c
r243192r243193
103103   save_item(NAME(irq_enable));
104104   save_item(NAME(irq_pending));
105105   save_item(NAME(maple_irqlevel));
106
107   // patch out MIE RAM test
108   // TODO: figure out why SH4 code doesn't wait long enough for internal firmware's RAM test completed in the case of reset
109   UINT32 *rom = (UINT32*)memregion("mie")->base();
110   rom[0x144/4] = 0x0001d8c3;
111106}
112107
113108void mie_device::device_reset()
r243192r243193
169164         control |= CTRL_TFB|CTRL_EMP;
170165      }
171166   }
172   if(control & CTRL_HRES) {
173      raise_irq(maple_irqlevel);
174   }
175167}
176168
177169void mie_device::maple_w(const UINT32 *data, UINT32 in_size)
178170{
179171   memcpy(tbuf, data, in_size*4);
180172   lreg = in_size-1;
181   // currently not known how/then CTRL_HRES is cleared after reset, lets clear it at packet receive
182   control &= ~(CTRL_HRES|CTRL_TXB|CTRL_TFB|CTRL_RFB|CTRL_BFOV);
173   control &= ~(CTRL_TXB|CTRL_TFB|CTRL_RFB|CTRL_BFOV);
183174   control |= CTRL_RXB;
184175
185176   timer->adjust(attotime::from_usec(20));
r243192r243193
366357
367358void mie_device::maple_reset()
368359{
369   control &= ~(CTRL_RXB|CTRL_TXB|CTRL_TFB|CTRL_RFB|CTRL_BFOV);
370   control |= CTRL_HRES;
371
372   timer->adjust(attotime::from_usec(20));
360   // ignoring reset maple pattern is HUGE HACK
361   // current implementation works only because of in such case procedure of firmware upload by games will be skipped at all
362   // so in better case - inputs doesnt work if game uses very different firmware version than already uploaded by BIOS, in worst case - game hang/reboot
363   // TODO: figure out why game code doesn't wait long enough for internal firmware's RAM test completed in the case of proper reset
373364}
trunk/src/mame/machine/naomi.c
r243192r243193
192192{
193193   //m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios
194194   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
195   jvsboard_type = JVSBD_DEFAULT;
195196   actel_id = 0xffff;
196197
197198   create_pic_from_retdat();
r243192r243193
200201DRIVER_INIT_MEMBER(naomi_state,naomi2)
201202{
202203   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi2_biose_idle_skip_r),this)); // rev e bios
204   jvsboard_type = JVSBD_DEFAULT;
203205   actel_id = 0xffff;
204206
205207   create_pic_from_retdat();
206208}
207209
208INPUT_CHANGED_MEMBER(naomi_state::naomi_mp_w)
209{
210   m_mp_mux = newval;
211}
212CUSTOM_INPUT_MEMBER(naomi_state::naomi_mp_r)
213{
214   const char *tagptr = (const char *)param;
215   UINT8 retval = 0;
216
217   for (int i = 0x80; i >= 0x08; i >>= 1)
218   {
219      if (m_mp_mux & i)
220         retval |= ioport(tagptr)->read_safe(0);
221      tagptr += strlen(tagptr) + 1;
222   }
223   return retval;
224}
225
226210DRIVER_INIT_MEMBER(naomi_state,naomi_mp)
227211{
228212   //m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios
229213   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
214   jvsboard_type = JVSBD_MAHJONG;
230215   actel_id = 0xffff;
231   m_mp_mux = 0;
232216
233217   create_pic_from_retdat();
234218}
r243192r243193
237221{
238222   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
239223   //m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
224   jvsboard_type = JVSBD_DEFAULT;
240225   actel_id = 0xffff;
241226
242227   create_pic_from_retdat();
r243192r243193
246231{
247232   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
248233   //m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi_biosh_idle_skip_r),this)); // rev h bios
234   jvsboard_type = JVSBD_MAHJONG;
249235   actel_id = 0xffff;
250   m_mp_mux = 0;
251236
252237   create_pic_from_retdat();
253238}
trunk/src/mame/machine/naomibd.h
r243192r243193
22#define _NAOMIBD_H_
33
44#include "machine/naomig1.h"
5#include "machine/naomicrypt.h"
56
67#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _actel_tag, _irq_cb)    \
78   MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb)                        \
trunk/src/mame/machine/naomicrypt.c
r0r243193
1
2/* Naomi cartridge encryption
3
4 see naomim1.c, naomim2.c and naomim4.c for implementation details
5
6 The keys here are totally arbitrary and have nothing to do with the real keys.
7
8 Atomiswave is significantly different and not listed here.
9 Naomi GD-ROMs use DES encryption, and the keys are stored as part of the PIC dumps instead.
10
11 the Naomi schemes are clearly related to CPS2
12 the ST-V scheme could also be related to this.
13
14 */
15
16
17#include "emu.h"
18#include "naomicrypt.h"
19
20struct game_keys
21{
22   const char *name;             /* game driver name */
23   const UINT32 key;
24
25};
26
27static const struct game_keys keys_table[] =
28{
29   // name             key              gameid #         year
30// M2
31   { "wldkicks",        0x00ae2901 }, // 25209801    2000
32   { "toukon4",         0x012e2901 }, // 25349801    2000
33   { "ninjaslt",        0x000ca510 }, // 25469801    2000
34   { "ninjaslt4",       0x000ca510 }, // 25469801    2000
35   { "gunsur2e",        0x000680d0 }, // 25709801    2001
36   { "mazan",           0x000fea94 }, // 25869812    2002
37   { "f355twin",        0x0006efd4 }, // 834-13950   1999
38   { "alpiltdx",        0x00070e41 }, // 834-?????   1999
39   { "f355twn2",        0x001666c6 }, // 834-?????   2001
40   { "crzytaxi",        0x000d2f45 }, // 840-0002    1999
41   { "zombrvn",         0x00012b41 }, // 840-0003    1999
42   { "ringout",         0x000b1e40 }, // 840-0004    1999
43   { "alpilota",        0x00070e41 }, // 840-0005    1999
44   { "ggram2",          0x00074a61 }, // 840-0007    1999
45   { "vs2_2k",          0x00088b08 }, // 840-0010    1999
46   { "toyfight",        0x0002ca85 }, // 840-0011    1999
47   { "smlg99",          0x00048a01 }, // 840-0012    1999
48   { "jambo",           0x000fab95 }, // 840-0013    1999
49   { "vtennis",         0x0003eb15 }, // 840-0015    1999
50   { "derbyoc",         0x000fee35 }, // 840-0016    1999
51   { "otrigger",        0x000fea94 }, // 840-0017    1999
52   { "sgtetris",        0x0008ae51 }, // 840-0018    1999
53   { "dybb99",          0x00048a01 }, // 840-0019    1999
54   { "samba",           0x000a8b5d }, // 840-0020    1999
55   { "sambap",          0x000a8b5d }, // 840-0020    1999
56   { "virnbao",         0x00068b58 }, // 840-0021    2000
57   { "18wheelr",        0x0007cf54 }, // 840-0023    2000
58   { "marstv",          0x000b8ef5 }, // 840-0025    1999
59   { "vonot",           0x00010715 }, // 840-0028    2000
60   { "sstrkfgt",        0x00132303 }, // 840-0035    2000
61   { "18wheels",        0x0007cf54 }, // 840-0036    2000
62   { "wwfroyal",        0x001627c3 }, // 840-0040    2000
63   { "slasho",          0x001a66ca }, // 840-0041    2000
64   { "crackndj",        0x001c2347 }, // 840-0043    2000
65   { "csmash",          0x00103347 }, // 840-0044    2000
66   { "csmasho",         0x00103347 }, // 840-0044    2000
67   { "samba2k",         0x001702cf }, // 840-0047    2000
68   { "alienfnt",        0x00174343 }, // 840-0048    2001
69   { "alienfnta",       0x00174343 }, // 840-0048    2001
70   { "crackdj2",        0x00428247 }, // 840-0068    2001
71   { "vf4cart",         0x02ef2f96 }, // 840-0080    2002
72   { "pstone",          0x000e69c1 }, // 841-0001    1999
73   { "suchie3",         0x000368e1 }, // 841-0002    1999
74   { "doa2",            0x0008ad01 }, // 841-0003    1999
75   { "doa2m",           0x0008ad01 }, // 841-0003    1999
76   { "spawn",           0x00078d01 }, // 841-0005    1999
77   { "puyoda",          0x000acd40 }, // 841-0006    1999
78   { "pstone2",         0x000b8dc0 }, // 841-0008    2000
79   { "capsnk",          0x00000000 }, // 841-0011    2000
80   { "capsnka",         0x00000000 }, // 841-0011    2000
81   { "capsnkb",         0x00000000 }, // 841-0011    2000
82   { "cspike",          0x000e2010 }, // 841-0012    2000
83   { "ggx",             0x00076110 }, // 841-0013    2000
84   { "gwing2",          0x000b25d0 }, // 841-0014    2000
85   { "pjustic",         0x000725d0 }, // 841-0015    2000
86   { "deathcox",        0x000b64d0 }, // 841-0016    2000
87   { "gundmct",         0x000e8010 }, // 841-0017    2001
88   { "zerogu2",         0x0007c010 }, // 841-0020    2001
89   { "hmgeo",           0x00038510 }, // HMG016007   2001
90// M1
91   { "tduno2",          0x2f6f0f8d }, // 840-0022    2000
92   { "qmegamis",        0x96489bcd }, // 840-0030    2000
93   { "gram2000",        0x3f5c807f }, // 840-0039    2000
94   { "vtenis2c",        0x43472d2d }, // 840-0084    2001
95   { "shootopl",        0xa77cf3a0 }, // 840-0098    2002
96   { "vf4evoct",        0xcdb05b1e }, // 840-0106    2002
97   { "shootpl",         0xcde98d9d }, // 840-0128    2002
98   { "shootplm",        0xcde98d9d }, // 840-0136    2002
99   { "kick4csh",        0xc9570882 }, // 840-0140    2004
100   { "mtkob2",          0x3892fb3a }, // 840-0150    2003
101   { "mvsc2",           0x7c6e8bc1 }, // 841-0007-02 2000
102   { NULL, 0 }    // end of table
103};
104
105
106UINT32 get_naomi_key(running_machine &machine)
107{
108   const char *gamename = machine.system().name;
109   const struct game_keys *k = &keys_table[0];
110
111   while (k->name)
112   {
113      if (strcmp(k->name, gamename) == 0)
114      {
115         // we have a proper key so return it
116         return k->key;
117      }
118      ++k;
119   }
120
121   printf("get_naomi_key : KEY NOT FOUND\n");
122
123   return 0;
124}
trunk/src/mame/machine/naomicrypt.h
r0r243193
1/* naomicrypt.h */
2#define USE_NAOMICRYPT 0
3
4UINT32 get_naomi_key(running_machine &machine);
trunk/src/mame/machine/naomim1.c
r243192r243193
1313naomi_m1_board::naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1414   : naomi_board(mconfig, NAOMI_M1_BOARD, "Sega NAOMI M1 Board", tag, owner, clock, "naomi_m1_board", __FILE__)
1515{
16   key_tag = 0;
1617}
1718
19void naomi_m1_board::static_set_tags(device_t &device, const char *_key_tag)
20{
21   naomi_m1_board &dev = downcast<naomi_m1_board &>(device);
22   dev.key_tag = _key_tag;
23}
24
1825READ16_MEMBER(naomi_m1_board::actel_id_r)
1926{
2027   if (rombdid_tag && memregion(rombdid_tag) != NULL)
r243192r243193
3037{
3138   naomi_board::device_start();
3239
33   astring skey = parameter("key");
34   if(skey)
35      key = strtoll(skey.cstr(), 0, 16);
36   else
37   {
38      logerror("%s: Warning: key not provided\n", tag());
39      key = 0;
40   }
41
40#if USE_NAOMICRYPT
41   key = get_naomi_key(machine());
42#else
43   const UINT8 *key_data = memregion(key_tag)->base();
44   key = (key_data[0] << 24) | (key_data[1] << 16) | (key_data[2] << 8) | key_data[3];
45#endif
4246   buffer = auto_alloc_array(machine(), UINT8, BUFFER_SIZE);
4347
4448   save_pointer(NAME(buffer), BUFFER_SIZE);
trunk/src/mame/machine/naomim1.h
r243192r243193
33
44#include "naomibd.h"
55
6#define MCFG_NAOMI_M1_BOARD_ADD(_tag, _eeprom_tag, _actel_tag, _irq_cb) \
7   MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M1_BOARD, _eeprom_tag, _actel_tag, _irq_cb)
6#define MCFG_NAOMI_M1_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _actel_tag, _irq_cb) \
7   MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M1_BOARD, _eeprom_tag, _actel_tag, _irq_cb) \
8   naomi_m1_board::static_set_tags(*device, _key_tag);
89
910class naomi_m1_board : public naomi_board
1011{
1112public:
1213   naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
1314
15   static void static_set_tags(device_t &device, const char *_key_tag);
16
1417   virtual DECLARE_ADDRESS_MAP(submap, 16);
1518
1619   DECLARE_READ16_MEMBER(actel_id_r);
r243192r243193
2528
2629private:
2730   enum { BUFFER_SIZE = 32768 };
31
32   const char *key_tag;
2833   UINT32 key;
2934
3035   UINT8 *buffer;
trunk/src/mame/machine/naomim2.c
r243192r243193
108108   : naomi_board(mconfig, NAOMI_M2_BOARD, "Sega NAOMI M2 Board", tag, owner, clock, "naomi_m2_board", __FILE__),
109109   m_cryptdevice(*this, "segam2crypt")
110110{
111   key_tag = 0;
111112}
112113
114void naomi_m2_board::static_set_tags(device_t &device, const char *_key_tag)
115{
116   naomi_m2_board &dev = downcast<naomi_m2_board &>(device);
117   dev.key_tag = _key_tag;
118}
119
113120void naomi_m2_board::device_start()
114121{
115122   naomi_board::device_start();
r243192r243193
127134   memset(ram, 0, RAM_SIZE);
128135
129136   rom_cur_address = 0;
137
138#if USE_NAOMICRYPT
139   m_cryptdevice->set_key(get_naomi_key(machine()));
140#else
141   const UINT8 *key_data = memregion(key_tag)->base();
142   m_cryptdevice->set_key((key_data[0] << 24) | (key_data[1] << 16) | (key_data[2] << 8) | key_data[3]);
143#endif
130144}
131145
132146void naomi_m2_board::board_setup_address(UINT32 address, bool is_dma)
trunk/src/mame/machine/naomim2.h
r243192r243193
44#include "naomibd.h"
55#include "315-5881_crypt.h"
66
7#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _actel_tag, _irq_cb) \
8   MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _actel_tag, _irq_cb) \
9   naomi_m2_board::static_set_tags(*device, _key_tag);
710
8#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _eeprom_tag, _actel_tag, _irq_cb) \
9   MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _actel_tag, _irq_cb)
10
1111class naomi_m2_board : public naomi_board
1212{
1313public:
r243192r243193
1616   static const int RAM_SIZE = 65536;
1717   UINT8* ram;
1818
19   static void static_set_tags(device_t &device, const char *_key_tag);
1920   UINT16 read_callback(UINT32 addr);
2021
2122protected:
r243192r243193
2930   virtual void board_write(offs_t offset, UINT16 data);
3031
3132private:
33
34
35   const char *key_tag;
36
37
3238   required_device<sega_315_5881_crypt_device> m_cryptdevice;
3339};
3440
trunk/src/mame/machine/ng_memcard.h
r243192r243193
3636
3737   virtual iodevice_t image_type() const { return IO_MEMCARD; }
3838
39   virtual bool is_readable()  const { return true; }
40   virtual bool is_writeable() const { return true; }
41   virtual bool is_creatable() const { return true; }
42   virtual bool must_be_loaded() const { return false; }
43   virtual bool is_reset_on_load() const { return false; }
39   virtual bool is_readable()  const { return 1; }
40   virtual bool is_writeable() const { return 1; }
41   virtual bool is_creatable() const { return 1; }
42   virtual bool must_be_loaded() const { return 0; }
43   virtual bool is_reset_on_load() const { return 0; }
4444   virtual const char *file_extensions() const { return "neo"; }
4545   virtual const option_guide *create_option_guide() const { return NULL; }
4646
trunk/src/mame/machine/stfight.c
r243192r243193
6363            ( ( ( src ^ A ) >> 1 ) & 0x08 ) |
6464            ( ~( ( src >> 6 ) ^ A ) & 0x01 );
6565   }
66
66   
6767}
6868
6969DRIVER_INIT_MEMBER(stfight_state,stfight)
trunk/src/mame/machine/stvprot.c
r243192r243193
1/* ST-V hookup for 315-5881 encryption/compression chip */
1/* ST-V protection stuff */
22
33/*
44
r243192r243193
1111 Steep Slope Sliders (gfx transfer of character portraits)
1212 Tecmo World Cup '98 (tecmo logo, player movement)
1313
14 I think this is an encryption device.  Decathlete is also protected, but uses a different device
15 see machine/decathlt.c for details of that one, unlike this that appears to perform decompression
16 operations.
17
18
19 Astra Superstars data were extracted from Saturn version of the game. It is not known if
20 protection device has data stored inside, or they are read from roms (using decryption/decompression)
21
1422*/
1523
24/****************************************************************************************
25
26Protection & cartridge handling
27
28*****************************************************************************************
29
30These are the known ST-V games that uses this area as a valid protection,I have written
31the data used by the games in the various circumstances for reference:
32-Astra Super Stars [astrass]
33 [0]        [1]        [2]        [3]
34 0x000y0000 0x00000000 0x06130027 0x01230000 test mode,char transfer (3)
35 0x???????? 0x???????? 0x???????? 0x???????? attract mode
36 0x000y0000 0x00000000 0x06130027 0x01230000 gameplay,char transfer (3)
37
38-Elan Doree : Legend of Dragon [elandore]
39 [0]        [1]        [2]        [3]
40 No protection                               test mode
41 No protection                               attract mode
42 0x000y0000 0x00000000 0x****00** 0xff7f0000 gameplay,VDP-1 write (textures on humans)
43 0x000y0000 0x00000000 0x****00** 0xffbf0000 gameplay,VDP-1 write (textures on humans)
44
45 0x000y0000 0x00000000 0x****00** 0xf9ff0000 gameplay,VDP-1 write (textures on dragons)
46 0x000y0000 0x00000000 0x****00** 0xfbff0000 gameplay,VDP-1 write (textures on dragons)
47 0x000y0000 0x00000000 0x****00** 0xfe7f0000 gameplay,VDP-1 write (textures on dragons)
48 0x000y0000 0x00000000 0x****00** 0xfd7f0000 gameplay,VDP-1 write (textures on dragons)
49 0x000y0000 0x00000000 0x****00** 0xfeff0000 gameplay,VDP-1 write (textures on dragons)
50 0x000y0000 0x00000000 0x****00** 0xf9bf0000 gameplay,VDP-1 write (textures on dragons)
51
52-Final Fight Revenge [ffreveng]
53 [0]        [1]        [2]        [3]
54 0x000y0000 0x00000000 0x4bcc0013 0x10da0000 test mode,boot vectors at $06080000
55 0x000y0000 0x00000000 0x0b780013 0x10d70000 attract mode,boot vectors at $06080000
56 0x???????? 0x???????? 0x???????? 0x???????? gameplay
57
58-Radiant Silvergun [rsgun]
59 [0]        [1]        [2]        [3]
60 No protection                               test mode
61 0x000y0000 0x00000000 0x08000010 0x77770000 attract mode,work ram-h $60ff1ec and so on (1)
62 0x???????? 0x???????? 0x???????? 0x???????? gameplay
63
64-Steep Slope Sliders [sss]
65 [0]        [1]        [2]        [3]
66 No protection                               test mode
67*0x000y0000 0x00000000 0x000000a6 0x2c5b0000 attract mode,VDP-1 write
68*0x000y0000 0x00000000 0x000000a6 0x2c5b0000 gameplay,VDP-1 write character 1 (2)
69*0x000y0000 0x00000000 0x0f9800a6 0x47f10000 gameplay,VDP-1 write character 2
70*0x000y0000 0x00000000 0x1d4800a6 0xfcda0000 gameplay,VDP-1 write character 3
71*0x000y0000 0x00000000 0x29e300a6 0xb5e60000 gameplay,VDP-1 write character 4
72*0x000y0000 0x00000000 0x38e900a6 0x392c0000 gameplay,VDP-1 write character 5
73*0x000y0000 0x00000000 0x462500a6 0x77c30000 gameplay,VDP-1 write character 6
74*0x000y0000 0x00000000 0x555c00a6 0x8a620000 gameplay,VDP-1 write character 7
75
76=========================================================================================
77y = setted as a 0,then after the ctrl data is moved is toggled to 1 then again toggled
78    to 0 after the reading,this bit is likely to be a "calculate protection values"
79    if 1,use normal ram if 0.
80* = working checks
81[3,low word]AFAIK this is the cartridge area and it's read-only.
82(1)That area is usually (but not always) used as system registers.
83(2)Same as P.O.S.T. check,it was really simple to look-up because of that.
84(3)Wrong offset,or it requires something else like a bitswap?
85=========================================================================================
86Protection works as a sort of data transfer,it could also be that it uses
87encryption on the data used...
88
89For now I'm writing this function with a command basis so I can work better with it.
90****************************************************************************************/
91
1692#include "emu.h"
1793#include "includes/stv.h"
1894
1995
2096
97/************************
98*
99* Tecmo World Cup '98
100*
101************************/
21102
103/*
104 0x200214
105 0x20de94
106 wpset 0x200214,0x20de94-0x200214,r
107 dump twcup98.dmp,0x200214,0x20de94-0x200214,4,0,0
108 protection tests the data 0x201220 at
109 bp 0x6009a9e
110 with 0x60651f8
111 */
22112
113
114//MAIN : 12120000  DATA : 0ad20069 Tecmo logo
115//MAIN : 12120000  DATA : e332006b title screen
116// TODO: encrypted / compressed data.
117// Both points to a section that has a string ("TECMO" / "TITLE")
118
119
120/*************************
121*
122* Final Fight Revenge
123*
124*************************/
125
126/*
127ffreveng protection notes
128Global:
129R2 is the vector read (where to jump to)
130R3 is the vector pointer
131
132Directory listing for Final Fight Revenge (Saturn Version):
133
134In the ST-V version, most of these file names could be found at relative address 0x346a0 (0x22346a0)
135Also, there's a table at 0x260000 (0x2260000), this points to offsets to the ROM (and are sent to the protection device),
136and the size of it
137
138fad      size     file name   date
139000000aa 00003000  2000/2/8
140000000aa 00003000 ? 2000/2/8
141000000b0 00076080 0;1 2000/2/8
1420001799e 014b2000 ALY.RED;1 1999/11/9
14300002350 00001900 ALYHRAM.BIN;1 2000/2/8
1440000040e 00005204 ANDEND.BIN;1 1999/11/9
145000001a0 0000c700 ANDORE.BIN;1 2000/2/8
146000003c8 00016938 ANDORE.CRT;1 1999/11/9
147000001b9 000f3528 ANDOREM.BIN;1 2000/2/8
14800003525 012db000 ATN.RED;1 1999/11/9
149000024e6 00001900 ATNHRAM.BIN;1 2000/2/8
15000013291 0120d000 ATO.RED;1 1999/11/9
151000024a0 00001100 ATOHRAM.BIN;1 2000/2/8
15200000419 0000f000 BELGER.BIN;1 2000/2/8
153000005f0 00013bdc BELGER.CRT;1 1999/11/9
15400000437 000ce990 BELGERM.BIN;1 2000/2/8
15500002611 00000894 BURGR.BIN;1 2000/2/8
15600002605 00000638 CAFFE.BIN;1 2000/2/8
1570000273b 000022e0 CAPCOM.BIN;1 1999/11/9
15800001d9a 00012100 CAPHRAM.BIN;1 2000/2/8
15900000834 00004cec CDYEND.BIN;1 1999/11/9
1600000218a 00005900 CHSHRAM.BIN;1 2000/2/8
1610000061a 0000b900 CODY.BIN;1 2000/2/8
16200000809 00014e00 CODY.CRT;1 1999/11/9
16300002857 000ff412 CODYANIM.BIN;1 1999/11/9
16400002a56 00011dbc CODYAPAL.BIN;1 1999/11/9
16500000632 000d31cc CODYM.BIN;1 2000/2/8
16600002619 0000046c CURRY.BIN;1 2000/2/8
16700000b36 00005110 DAMEND.BIN;1 1999/11/9
1680000083e 0000b300 DAMND.BIN;1 2000/2/8
16900000aa6 000181ae DAMND.CRT;1 1999/11/9
17000000855 0010c674 DAMNDM.BIN;1 2000/2/8
17100000ad9 000063c0 DDAD.BIN;1 1999/11/9
17200000b2c 00004a30 DDBL.BIN;1 1999/11/9
17300000b25 000034b4 DDCD.BIN;1 1999/11/9
17400000ae6 00004c6c DDDM.BIN;1 1999/11/9
17500000b1c 00004660 DDED.BIN;1 1999/11/9
17600000b15 00003770 DDEL.BIN;1 1999/11/9
17700000b0e 00003268 DDGY.BIN;1 1999/11/9
17800000b06 00003c74 DDHG.BIN;1 1999/11/9
17900000b00 000029a8 DDPS.BIN;1 1999/11/9
18000000af9 000035e4 DDRL.BIN;1 1999/11/9
18100000af0 000044a8 DDSD.BIN;1 1999/11/9
1820000217a 00007d00 DEMHRAM.BIN;1 2000/2/8
1830000278e 00064396 DLOOP.CRT;1 1999/11/9
18400000b41 0000e200 EDDIE.BIN;1 2000/2/8
18500000d25 00019a44 EDDIE.CRT;1 1999/11/9
18600000b5e 000c7758 EDDIEM.BIN;1 2000/2/8
18700000d5a 00005204 EDIEND.BIN;1 1999/11/9
18800000d65 0000d700 ELGADO.BIN;1 2000/2/8
18900001010 00018b2e ELGADO.CRT;1 1999/11/9
19000000d80 0012ec64 ELGADOM.BIN;1 2000/2/8
19100001043 00005204 ELGEND.BIN;1 1999/11/9
19200001d79 0000e5ec ENDING.BIN;1 1999/11/9
19300002bc3 0002e8f4 ENDING.CRT;1 1999/11/9
1940000019e 0000005d FFEXABS.TXT;1 1999/11/9
1950000019f 00000060 FFEXBIB.TXT;1 1999/11/9
1960000019d 00000032 FFEXCPY.TXT;1 1999/11/9
19700002615 0000062c FRIES.BIN;1 2000/2/8
19800001ce1 0004b8b4 GAMEL.BIN;1 1999/11/9
199000003f6 000011fc GANDRE.BIN;1 1999/11/9
2000000040b 00001246 GBEL.BIN;1 1999/11/9
201000003f9 00000af3 GCODY.BIN;1 1999/11/9
202000003fb 00000cc4 GDAM.BIN;1 1999/11/9
203000003fd 00000f6a GEDDIE.BIN;1 1999/11/9
204000003ff 00000c85 GGADO.BIN;1 1999/11/9
20500000401 00000d4c GGUY.BIN;1 1999/11/9
20600000403 00000f16 GHAG.BIN;1 1999/11/9
20700000405 00000a63 GPOISON.BIN;1 1999/11/9
20800000407 00000a85 GROL.BIN;1 1999/11/9
20900005b71 01156000 GRV.RED;1 1999/11/9
2100000243b 00001600 GRVHRAM.BIN;1 2000/2/8
21100000409 00000dad GSODOM.BIN;1 1999/11/9
2120000104e 0000c300 GUY.BIN;1 2000/2/8
2130000123a 00014844 GUY.CRT;1 1999/11/9
21400001266 00005204 GUYEND.BIN;1 1999/11/9
21500001067 000d14aa GUYM.BIN;1 2000/2/8
21600001271 0000c600 HAGGAR.BIN;1 2000/2/8
21700001489 00017ad8 HAGGAR.CRT;1 1999/11/9
2180000128a 000e46fc HAGGARM.BIN;1 2000/2/8
219000014bb 00005204 HGREND.BIN;1 1999/11/9
22000002740 0001b468 HISCORE.BIN;1 1999/11/9
22100002777 00000a00 HISCP.BIN;1 1999/11/9
22200002779 000086c0 HISCTEX.BIN;1 1999/11/9
2230000278b 00001680 HSFACE_T.BIN;1 1999/11/9
22400002607 00000618 HTDOG.BIN;1 2000/2/8
22500015741 010e3800 JNK.RED;1 1999/11/9
226000023cd 00001900 JNKHRAM.BIN;1 2000/2/8
22700002d0b 0003dfc0 KANJI.FON;1 1999/11/9
22800001d98 00000d44 LOAD.BIN;1 1999/11/9
22900001dbf 001dd5a8 LOGO.CPK;1 1999/11/9
23000002d0a 00000400 LVLHRAM.BIN;1 2000/2/8
2310000260a 000005e8 MEAT.BIN;1 2000/2/8
23200007eb3 01253800 MLK.RED;1 1999/11/9
23300002196 00000d00 MLKHRAM.BIN;1 2000/2/8
2340000278a 00000400 NAMEP.BIN;1 1999/11/9
2350000a3f0 011b8000 NPK.RED;1 1999/11/9
236000022d0 00002700 NPKHRAM.BIN;1 2000/2/8
23700010dc0 0121d800 NUK.RED;1 1999/11/9
23800002555 00001100 NUKHRAM.BIN;1 2000/2/8
23900002c21 00036f94 OVER.CRT;1 1999/11/9
240000014c6 0000ab00 POISON.BIN;1 2000/2/8
241000017f1 00018880 POISON.CRT;1 1999/11/9
242000014dc 0017617c POISONM.BIN;1 2000/2/8
2430000c7f6 01166000 PRK.RED;1 1999/11/9
24400002268 00001100 PRKHRAM.BIN;1 2000/2/8
24500002a82 00003940 PSCBCHR.BIN;1 1999/11/9
24600002a8a 00002000 PSCBMAP.BIN;1 1999/11/9
24700002a92 00000ac0 PSCRTEX.BIN;1 1999/11/9
24800002a7b 000033c0 PSFCCHR.BIN;1 1999/11/9
24900001824 000049d4 PSNEND.BIN;1 1999/11/9
25000002a8e 00001e54 PSNMCHR.BIN;1 1999/11/9
25100002a94 000037c0 PSSBCHR.BIN;1 1999/11/9
25200002a9b 00002000 PSSBMAP.BIN;1 1999/11/9
25300002a9f 00000200 PSSBPAL.BIN;1 1999/11/9
25400002a7a 00000600 PS_PAL.BIN;1 1999/11/9
25500002c8f 0003d4c0 RESIDENT.CRT;1 1999/11/9
25600001c68 0003ae40 RESTEXT.BIN;1 1999/11/9
25700001cde 00001220 RESTEXTB.BIN;1 1999/11/9
25800001d97 00000200 RETIMEPA.BIN;1 1999/11/9
2590000261b 000004e8 REVNG.BIN;1 1999/11/9
26000001a5b 00005204 ROLEND.BIN;1 1999/11/9
2610000182e 0000e700 ROLENTO.BIN;1 2000/2/8
26200001a2d 00016bfc ROLENTO.CRT;1 1999/11/9
2630000184b 000d6bf0 ROLENTOM.BIN;1 2000/2/8
264000025c5 000062e4 SDDRVS.TSK;1 1999/11/9
26500002eb3 002ee000 SEGA_WRN.DA;1 1998/4/30
26600002b82 00020492 SELECT.CRT;1 1999/11/9
26700002aa0 00070e04 SODBTEX.BIN;1 1999/11/9
26800001c5d 00005154 SODEND.BIN;1 1999/11/9
26900001a66 0000b100 SODOM.BIN;1 2000/2/8
27000001c29 0001943a SODOM.CRT;1 1999/11/9
27100001a7d 000b9e2f SODOMM.BIN;1 2000/2/8
2720000260d 000004cc SUSHI.BIN;1 2000/2/8
2730000261c 0008f204 TITLE.BIN;1 1999/11/9
2740000eb58 010e9000 WHS.RED;1 1999/11/9
275000021ff 00001100 WHSHRAM.BIN;1 2000/2/8
276000003a0 00009b90 _ADCL00.BIN;1 1999/11/9
277000003b4 00009b90 _ADCL01.BIN;1 1999/11/9
278000023cb 00000c54 _ALYBMAP.BIN;1 1999/11/9
2790000239b 00017ec0 _ALYFCHR.BIN;1 1999/11/9
28000002399 00000c1a _ALYFMAP.BIN;1 1999/11/9
28100002354 00000600 _ALYPAL.BIN;1 1999/11/9
2820000235a 0001f400 _ALYRCHR.BIN;1 1999/11/9
28300002355 0000205c _ALYRMAP.BIN;1 1999/11/9
2840000252a 00015800 _ATNBCHR.BIN;1 1999/11/9
28500002526 00001882 _ATNBMAP.BIN;1 1999/11/9
28600002525 00000416 _ATNFMAP.BIN;1 1999/11/9
287000024ea 00000600 _ATNPAL.BIN;1 1999/11/9
288000024ef 0001af00 _ATNRCHR.BIN;1 1999/11/9
289000024eb 00001d10 _ATNRMAP.BIN;1 1999/11/9
290000024e3 000017fa _ATOBMAP.BIN;1 1999/11/9
291000024e2 00000040 _ATOFCHR.BIN;1 1999/11/9
292000024e1 00000006 _ATOFMAP.BIN;1 1999/11/9
293000024a3 00000600 _ATOPAL.BIN;1 1999/11/9
294000024a9 0001bbc0 _ATORCHR.BIN;1 1999/11/9
295000024a4 00002004 _ATORMAP.BIN;1 1999/11/9
29600000618 00000a20 _BGUNTX.BIN;1 1999/11/9
297000005d5 0000d688 _BLTXURE.BIN;1 1999/11/9
29800002613 00000a80 _BURGRTX.BIN;1 1999/11/9
29900002606 000006c0 _CAFFETX.BIN;1 1999/11/9
300000007d9 0000bdb0 _CDCL00.BIN;1 1999/11/9
301000007f1 0000bdb0 _CDCL01.BIN;1 1999/11/9
30200000ad7 000008a0 _CHSAWTX.BIN;1 1999/11/9
303000025e3 00003500 _CRAT2TX.BIN;1 1999/11/9
304000025ea 00002200 _CRAT3TX.BIN;1 1999/11/9
305000025d5 00003300 _CRATDTX.BIN;1 1999/11/9
306000025dc 00003300 _CRATNTX.BIN;1 1999/11/9
3070000261a 00000500 _CURRYTX.BIN;1 1999/11/9
30800000a6e 0000d918 _DMCL00.BIN;1 1999/11/9
30900000a8a 0000d918 _DMCL01.BIN;1 1999/11/9
310000025ef 00001b60 _DRUMTX.BIN;1 1999/11/9
31100000ced 0000da3c _EDCL00.BIN;1 1999/11/9
31200000d09 0000da3c _EDCL01.BIN;1 1999/11/9
31300000fde 0000c404 _ELCL00.BIN;1 1999/11/9
31400000ff7 0000c404 _ELCL01.BIN;1 1999/11/9
31500002616 000011a0 _FRIESTX.BIN;1 1999/11/9
31600001d96 00000660 _GFNTCHR.BIN;1 1999/11/9
31700001264 00000880 _GKATATX.BIN;1 1999/11/9
31800002488 0000bcc0 _GRVBCHR.BIN;1 1999/11/9
31900002486 00000d76 _GRVBMAP.BIN;1 1999/11/9
32000002483 000010fc _GRVFMAP.BIN;1 1999/11/9
3210000243e 00000600 _GRVPAL.BIN;1 1999/11/9
32200002444 0001f4c0 _GRVRCHR.BIN;1 1999/11/9
3230000243f 00002004 _GRVRMAP.BIN;1 1999/11/9
3240000120a 0000bf44 _GYCL00.BIN;1 1999/11/9
32500001222 0000bf44 _GYCL01.BIN;1 1999/11/9
32600001453 0000d614 _HGCL00.BIN;1 1999/11/9
3270000146e 0000d614 _HGCL01.BIN;1 1999/11/9
32800002608 00000880 _HTDOGTX.BIN;1 1999/11/9
329000025f3 00002b60 _ICEBTX.BIN;1 1999/11/9
33000001042 00000560 _JKNFTX.BIN;1 1999/11/9
33100002419 00010940 _JNKBCHR.BIN;1 1999/11/9
33200002417 00000982 _JNKBMAP.BIN;1 1999/11/9
33300002414 0000113a _JNKFMAP.BIN;1 1999/11/9
334000023d1 00000600 _JNKPAL.BIN;1 1999/11/9
335000023d6 0001ee80 _JNKRCHR.BIN;1 1999/11/9
336000023d2 00001bde _JNKRMAP.BIN;1 1999/11/9
337000025d4 000006c0 _KATA2TX.BIN;1 1999/11/9
33800001c5c 00000780 _KATANTX.BIN;1 1999/11/9
3390000260b 00000cc0 _MEATTX.BIN;1 1999/11/9
340000021dd 00010e80 _MLKBCHR.BIN;1 1999/11/9
341000021db 00000be6 _MLKBMAP.BIN;1 1999/11/9
342000021d9 00000f70 _MLKFMAP.BIN;1 1999/11/9
34300002198 00000600 _MLKPAL.BIN;1 1999/11/9
3440000219c 0001e440 _MLKRCHR.BIN;1 1999/11/9
34500002199 000013de _MLKRMAP.BIN;1 1999/11/9
3460000234d 00001416 _NPKBMAP.BIN;1 1999/11/9
3470000231d 00017dc0 _NPKFCHR.BIN;1 1999/11/9
3480000231a 00001406 _NPKFMAP.BIN;1 1999/11/9
349000022d5 00000600 _NPKPAL.BIN;1 1999/11/9
350000022db 0001f640 _NPKRCHR.BIN;1 1999/11/9
351000022d6 00002202 _NPKRMAP.BIN;1 1999/11/9
3520000259a 000153c0 _NUKBCHR.BIN;1 1999/11/9
35300002596 00001924 _NUKBMAP.BIN;1 1999/11/9
35400002594 00000f6e _NUKFMAP.BIN;1 1999/11/9
35500002558 00000600 _NUKPAL.BIN;1 1999/11/9
3560000255e 0001adc0 _NUKRCHR.BIN;1 1999/11/9
35700002559 00002004 _NUKRMAP.BIN;1 1999/11/9
358000025d3 000005a0 _NYOIBTX.BIN;1 1999/11/9
359000025f9 000039e0 _OILCTX.BIN;1 1999/11/9
360000014b9 00000b40 _PIPETX.BIN;1 1999/11/9
36100001823 00000600 _POISNTX.BIN;1 1999/11/9
362000022cc 000018fc _PRKBMAP.BIN;1 1999/11/9
363000022ac 0000fd00 _PRKFCHR.BIN;1 1999/11/9
364000022a8 00001d4a _PRKFMAP.BIN;1 1999/11/9
3650000226b 00000600 _PRKPAL.BIN;1 1999/11/9
36600002271 0001b0c0 _PRKRCHR.BIN;1 1999/11/9
3670000226c 00002202 _PRKRMAP.BIN;1 1999/11/9
368000017c9 00009874 _PSCL00.BIN;1 1999/11/9
369000017dd 00009874 _PSCL01.BIN;1 1999/11/9
37000000d59 00000180 _PSTKTX.BIN;1 1999/11/9
371000019f9 0000cb2c _RLCL00.BIN;1 1999/11/9
37200001a13 0000cb2c _RLCL01.BIN;1 1999/11/9
37300001bf1 0000dd0c _SDCL00.BIN;1 1999/11/9
37400001c0d 0000dd0c _SDCL01.BIN;1 1999/11/9
37500000833 00000660 _SKNFTX.BIN;1 1999/11/9
376000025d2 00000240 _SPIKETX.BIN;1 1999/11/9
3770000260e 000011e0 _SUSHITX.BIN;1 1999/11/9
37800002601 00001ba0 _TOMBTX.BIN;1 1999/11/9
3790000224b 0000e2c0 _WHSBCHR.BIN;1 1999/11/9
38000002249 00000a36 _WHSBMAP.BIN;1 1999/11/9
38100002245 00001bb8 _WHSFMAP.BIN;1 1999/11/9
38200002202 00000600 _WHSPAL.BIN;1 1999/11/9
38300002207 0001efc0 _WHSRCHR.BIN;1 1999/11/9
38400002203 00001cf4 _WHSRMAP.BIN;1 1999/11/9
385*/
386
387
388
389
390
391
392
393UINT32 rsgun_prot_read_callback( address_space &space, int protaddr, UINT32 key )
394{
395   int tempctrl = protaddr - 0x0201000; // technically it doesn't seem to care, but...
396
397   switch(key)
398   {
399      case 0x77770000:
400      {
401         UINT32 val =
402            ((tempctrl & 0xff)<<24) |
403            (((tempctrl+1) & 0xff)<<16) |
404            (((tempctrl+2) & 0xff)<<8) |
405            ((tempctrl+3) & 0xff);
406         if(tempctrl & 0x100)
407            val &= 0x0f0f0f0f;
408         else
409            val &= 0xf0f0f0f0;
410
411         return val;
412      }
413   }
414
415   return 0;
416}
417
418UINT32 twcup98_prot_read_callback( address_space &space, int protaddr, UINT32 key )
419{
420   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
421   UINT32 res = 0;
422
423   UINT32 twcup_prot_data[8] =
424   {
425      0x23232323, 0x23232323, 0x4c4c4c4c, 0x4c156301
426   };
427
428   switch(key >> 16)
429   {
430      case 0x1212:
431         if(protaddr & 2)
432         {
433            res = (ROM[protaddr / 4] & 0xffff) << 16;
434            res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16;
435         }
436         else
437         {
438            res = ROM[protaddr / 4] & 0xffff0000;
439            res |= ROM[protaddr / 4] & 0xffff;
440         }
441
442         if(protaddr >= 0xD215A4+0x100c && protaddr < 0xD215A4+0x100c+8*4)
443            res = twcup_prot_data[(protaddr-(0xD215A4+0x100c))/4];
444
445         return res;
446   }
447
448   return 0;
449}
450
451UINT32 sss_prot_read_callback( address_space &space, int protaddr, UINT32 key )
452{
453   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
454   int read_offset_hack = 0;
455   UINT32 res;
456
457   /*
458       MAIN : 2c5b0000  DATA : 000000a6 014c0000
459       MAIN : 47f10000  DATA : 0f9800a6 014c1f30
460       MAIN : fcda0000  DATA : 1d4800a6 014c3a90
461       MAIN : b5e60000  DATA : 29e300a6 014c53c6
462       MAIN : 392c0000  DATA : 38e900a6 014c71d2
463       MAIN : 77c30000  DATA : 462500a6 014c8c4a
464       MAIN : 8a620000  DATA : 555c00a6 014caab8
465   */
466
467   // I have a feeling rather than the offsets being scrambled they were lazy
468   // and left unencrypted copies in the ROM... but this still needs verification
469   switch(key>>16)
470   {
471      case 0x2c5b: read_offset_hack = 0x60054; break;
472      case 0x47f1: read_offset_hack = 0x56498; break;
473      case 0xfcda: read_offset_hack = 0x50b0c; break;
474      case 0xb5e6: read_offset_hack = 0x4af56; break;
475      case 0x392c: read_offset_hack = 0x45876; break;
476      case 0x77c3: read_offset_hack = 0x3fe02; break;
477      case 0x8a62: read_offset_hack = 0x3a784; break;
478   }
479
480   switch(key>>16)
481   {
482      default:
483         if(protaddr & 2)
484         {
485            res = (ROM[(protaddr-read_offset_hack) / 4] & 0xffff) << 16;
486            res |= (ROM[((protaddr-read_offset_hack)+4) / 4] & 0xffff0000) >> 16;
487         }
488         else
489         {
490            res = ROM[(protaddr-read_offset_hack) / 4] & 0xffff0000;
491            res |= ROM[(protaddr-read_offset_hack) / 4] & 0xffff;
492         }
493         return res;
494   }
495}
496
497UINT32 astrass_prot_read_callback( address_space &space, int protaddr, UINT32 key )
498{
499   /* we're reading from a custom region where we've loaded the data from the Saturn version
500      NOT the rom address, so we're based at 0.  The real data likely exists at the given
501      address in encrypted form */
502   int read_offset_hack = 0x4ec260;
503   int useoffset = (protaddr-read_offset_hack);
504   UINT32 data = 0;
505   UINT32 *prot_data = (UINT32 *)space.machine().root_device().memregion("user2")->base();
506   int prot_size = space.machine().root_device().memregion("user2")->bytes();
507
508   if (useoffset<prot_size)
509   {
510      data = prot_data[useoffset/4];
511      return data;
512   }
513   return 0x00;
514}
515
516
517UINT32 elandore_prot_read_callback( address_space &space, int protaddr, UINT32 key )
518{
519   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
520   UINT32 res = 0;
521
522   switch(key >> 16)
523   {
524      default:
525         if(protaddr & 2)
526         {
527            res = (ROM[protaddr / 4] & 0xffff) << 16;
528            res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16;
529         }
530         else
531         {
532            res = ROM[protaddr / 4] & 0xffff0000;
533            res |= ROM[protaddr / 4] & 0xffff;
534         }
535         return res;
536   }
537
538   // never executed
539   //return 0;
540}
541
542UINT32 ffreveng_prot_read_callback( address_space &space, int protaddr, UINT32 key )
543{
544   //UINT32 res = 0;
545
546   switch(key >> 16)
547   {
548      case 0x10da://ffreveng, boot vectors at $6080000,test mode
549      case 0x10d7://ffreveng, boot vectors at $6080000,attract mode
550         #if 0
551         if(protaddr & 2)
552         {
553            res = (ROM[protaddr / 4] & 0xffff) << 16;
554            res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16;
555         }
556         else
557         {
558            res = ROM[protaddr / 4] & 0xffff0000;
559            res |= ROM[protaddr / 4] & 0xffff;
560         }
561         #endif
562         return 0;
563   }
564
565   return 0;
566}
567
568
23569/*************************************
24570*
25571* Common Handlers
26572*
27573*************************************/
28574
575// the naomi hookup of 315-5881 reads 16-bits at a time, here we seem to read 32?
576
29577READ32_MEMBER( stv_state::common_prot_r )
30578{
31579   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
r243192r243193
34582   {
35583      if(offset == 3)
36584      {
37         UINT8* base;
38         UINT16 res = m_cryptdevice->do_decrypt(base);
39         UINT16 res2 = m_cryptdevice->do_decrypt(base);
40         res = ((res & 0xff00) >> 8) | ((res & 0x00ff) << 8);
41         res2 = ((res2 & 0xff00) >> 8) | ((res2 & 0x00ff) << 8);
585         #ifdef MAME_DEBUG
586         popmessage("Prot read at %06x with data = %08x",space.device().safe_pc(),m_abus_protkey);
587         #endif
588         UINT32 realret = space.read_dword(0x2000000+m_ctrl_index);
589         UINT32 retdata = m_prot_readback(space, m_ctrl_index, m_abus_protkey);
42590
43         return res2 | (res << 16);
591         logerror("A-Bus control protection read at %06x with data = %08x Returning = %08x Would otherwise return = %08x\n",space.device().safe_pc(),m_abus_protkey, retdata, realret);
592
593         //UINT16 res = m_cryptdevice->do_decrypt(base);
594
595         m_ctrl_index += 4;
596         return retdata;
597
44598      }
45599      return m_a_bus[offset];
46600   }
r243192r243193
54608
55609UINT16 stv_state::crypt_read_callback(UINT32 addr)
56610{
57   UINT16 dat= m_maincpu->space().read_word((0x02000000+2*addr));
58   return ((dat&0xff00)>>8)|((dat&0x00ff)<<8);
611   const UINT8 *base = m_cart_reg[0]->base() + 2*addr;
612   return base[1] | (base[0] << 8);
59613}
60614
61615WRITE32_MEMBER ( stv_state::common_prot_w )
62616{
63617   COMBINE_DATA(&m_a_bus[offset]);
618   //printf("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data);
64619
65620   if (offset == 0)
66621   {
r243192r243193
68623   }
69624   else if(offset == 2)
70625   {
71      if (mem_mask&0xffff0000) m_cryptdevice->set_addr_low(data >> 16);
72      if (mem_mask&0x0000ffff) m_cryptdevice->set_addr_high(data&0xffff);
626      COMBINE_DATA(&m_abus_prot_addr);
73627
628      m_cryptdevice->set_addr_low(m_abus_prot_addr >> 16);
629      m_cryptdevice->set_addr_high(m_abus_prot_addr&0xffff);
630
74631   }
75632   else if(offset == 3)
76633   {
77634      COMBINE_DATA(&m_abus_protkey);
78635
79636      m_cryptdevice->set_subkey(m_abus_protkey>>16);
637
638
639      int a_bus_vector;
640      a_bus_vector = m_abus_prot_addr >> 16;
641      a_bus_vector|= (m_abus_prot_addr & 0xffff) << 16;
642      a_bus_vector<<= 1;
643      //printf("MAIN : %08x  DATA : %08x %08x\n",m_abus_protkey,m_abus_prot_addr,a_bus_vector);
644
645      // if you look at the first transfer in ffreveng this is clearly a ROM address from a table |  MAIN : 10d70000  DATA : 0b780013 002616f0
646      // (opr21872.7, offset 0x616f0, which happens to be 0x2616f0 in the ROM region "game0")
647      // the values sent by the CPU are plucked from a table above where the data is, located at 0x60000
648      // Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
649      // 00060000   00 00 16 F0 00 00 2F A0  00 00 46 90 00 00 4D 04
650      // this is the first entry in the table, 0x16f0 is the address, 0x2fa0 is the length.
651      // the next entry is address 0x4690, length 0x4d04.  0x16f0 + 0x2fa0 == 0x4690 so that entry is located straight after the first one
652      // the game reads the number of bytes specified in the length via the protection device, writing them to RAM.  This suggests there
653      // is no compression going on, only some form of encryption.
654
655      m_ctrl_index = a_bus_vector;
80656   }
81657}
82658
r243192r243193
85661   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4fffff0, 0x4ffffff, read32_delegate(FUNC(stv_state::common_prot_r), this), write32_delegate(FUNC(stv_state::common_prot_w), this));
86662}
87663
664void stv_state::install_sss_protection()
665{
666   install_common_protection();
667   m_prot_readback = sss_prot_read_callback;
668}
669
670void stv_state::install_astrass_protection()
671{
672   install_common_protection();
673   m_prot_readback = astrass_prot_read_callback;
674//  m_cryptdevice->set_key(0x00000000);
675}
676
677void stv_state::install_ffreveng_protection()
678{
679   install_common_protection();
680   m_prot_readback = ffreveng_prot_read_callback;
681}
682
683void stv_state::install_elandore_protection()
684{
685   install_common_protection();
686   m_prot_readback = elandore_prot_read_callback;
687}
688
689void stv_state::install_rsgun_protection()
690{
691   install_common_protection();
692   m_prot_readback = rsgun_prot_read_callback;
693}
694
695void stv_state::install_twcup98_protection()
696{
697   install_common_protection();
698   m_prot_readback = twcup98_prot_read_callback;
699
700}
701
702
703
88704void stv_state::stv_register_protection_savestates()
89705{
90706   save_item(NAME(m_a_bus));
707   save_item(NAME(m_ctrl_index));
708   save_item(NAME(m_internal_counter));
709   save_item(NAME(m_char_offset));
91710}
trunk/src/mame/mame.lst
r243192r243193
209209warofbug        // (c) 1981 Armenia
210210warofbugu       // (c) 1981 Armenia
211211warofbugg       // German Version
212spactrai        //
213212redufo          // (c) Artic
214213redufob         // bootleg
215214exodus          // Subelectro - bootleg?
r243192r243193
26792678snowbrosd       // MIN16-02 (c) 1990 Toaplan + Dooyong license
26802679wintbob         // bootleg
26812680snowbroswb      //
2682toto            //
26832681// modified snowbros 'clone' hardware
26842682honeydol        // (c) 1995 Barko Corp
26852683twinadv         // (c) 1995 Barko Corp
r243192r243193
32313229sf2mdtb         // bootleg
32323230sf2b            // bootleg
32333231cworld2j        // 11/06/1992 (c) 1992 (Japan)
3234cworld2ja       // 11/06/1992 (c) 1992 (Japan)
32353232varth           // 14/07/1992 (c) 1992 (World)
32363233varthr1         // 12/06/1992 (c) 1992 (World)
32373234varthu          // 12/06/1992 (c) 1992 (USA)
r243192r243193
34143411ddsomjr1        // 06/02/1996 (c) 1996 (Japan)
34153412ddsomj          // 19/06/1996 (c) 1996 (Japan)
34163413ddsoma          // 19/06/1996 (c) 1996 (Asia)
3417ddsomar1        // 08/02/1996 (c) 1996 (Asia)
3414ddsomar1      // 08/02/1996 (c) 1996 (Asia)
34183415ddsomh          // 23/02/1996 (c) 1996 (Hispanic)
34193416ddsomb          // 23/02/1996 (c) 1996 (Brazil)
34203417sfa2            // 06/03/1996 (c) 1996 (Euro)
r243192r243193
53815378sprtjam         // 2000.11.13 Sports Jam
53825379pjustic         // 2000.12 Moero Justice Gakuen / Project Justice
53835380samba2k         // 2000.12 Samba de Amigo Ver.2000
5384shaktam         // 2000.12.28 Shakatto Tambourine (Rev B)
5381shaktam           // 2000.12.28 Shakatto Tambourine (Rev B)
53855382            // 2000.?? Boat Race Ocean Heats
53865383csmash          // 2000.?? Cosmic Smash
53875384csmasho         // 2000.?? Cosmic Smash (original)
r243192r243193
54495446starhrsp        // 2003.12.01 Star Horse Progress (satellite) (Rev A)
54505447puyofevp        // 2003.?? Puyo Puyo Fever (prototype)
54515448            // 2003.?? Dragon Treasure
5449            // 2003.?? Rabbit 2
54525450cfield          // 2004.06 Chaos Field
54535451tetkiwam        // 2004.06 Tetris Kiwamemichi (Arcade TV Game List - P.88, Right, 11 from bottom)
54545452trizeal         // 2004.09 Trizeal
r243192r243193
55155513
55165514// NAOMI 2
55175515naomi2          // 2001.?? Naomi 2 BIOS
5518vstrik3c        // 2001.04 Virtua Striker 3 (cartridge)
5519vstrik3cb       // 2001.04 Virtua Striker 3 (Rev B) (cartridge)
55205516vstrik3         // 2001.04.06 Virtua Striker 3 Ver. 2002
5517vstrik3cb       // 2001.04 Virtua Striker 3 (Rev B) (cartridge)
5518vstrik3c        // 2001.04 Virtua Striker 3 (Rev C) (cartridge)
55215519wldrider        // 2001.05 Wild Riders
55225520clubkrte        // 2001.06 Club Kart: European Session
5523clubkrtc        // 2001.?? Club Kart: European Session (Rev C)
55245521clubkrtd        // 2001.06 Club Kart: European Session (Rev D)
5522clubkrtc        // 2001.?? Club Kart: European Session (Rev C)
55255523beachspi        // 2001.07 Beach Spikers
55265524vf4cart         // 2001.08.02 Virtua Fighter 4 (cartridge)
55275525vf4             // 2001.08.02 Virtua Fighter 4 (GD-ROM)
r243192r243193
67106708popn1           // GX803 (c) 1998 (Asia)
67116709//popn1j        // GX803 (c) 1998 (Japan)
67126710popn2           // GX831 (c) 1998 (Japan)
6713popn3           // GX980 (c) 1999 (Japan)
6711popn3            // GX980 (c) 1999 (Japan)
67146712//popnstex      // GX970 (c) 1999 (Japan)
67156713
67166714// Firebeat games
r243192r243193
69646962quantum1        // 136016           (c) 1982        // made by Gencomp
69656963quantump        // 136016           (c) 1982        // made by Gencomp
69666964bwidow          // 136017           (c) 1982
6967bwidowp         // (proto)          (c) 1982
6965bwidowp         // (proto)         (c) 1982
69686966starwars        // 136021           (c) 1983
69696967starwars1       // 136021           (c) 1983
69706968starwarso       // 136021           (c) 1983
r243192r243193
1121711215peps0298        // (c) 1996 IGT - International Game Technology
1121811216peps0308        // (c) 1996 IGT - International Game Technology
1121911217peps0364        // (c) 1996 IGT - International Game Technology
11220peps0366        // (c) 1996 IGT - International Game Technology
11221peps0372        // (c) 1996 IGT - International Game Technology
11222peps0373        // (c) 1996 IGT - International Game Technology
1122311218peps0426        // (c) 1996 IGT - International Game Technology
1122411219peps0581        // (c) 1996 IGT - International Game Technology
1122511220peps0615        // (c) 1996 IGT - International Game Technology
r243192r243193
3114731142orbitor1
3114831143quicksil
3114931144seawitch
31150spltsecp
31145splitsec
3115131146stargzr
3115231147viperp
3115331148gamatron
trunk/src/mame/mame.mak
r243192r243193
17211721   $(DRIVERS)/monacogp.o \
17221722   $(DRIVERS)/naomi.o $(MACHINE)/dc.o $(VIDEO)/powervr2.o $(MACHINE)/naomi.o \
17231723   $(MACHINE)/naomig1.o $(MACHINE)/naomibd.o $(MACHINE)/naomirom.o $(MACHINE)/naomigd.o \
1724   $(MACHINE)/naomim1.o $(MACHINE)/naomim2.o $(MACHINE)/naomim4.o \
1724   $(MACHINE)/naomicrypt.o $(MACHINE)/naomim1.o $(MACHINE)/naomim2.o $(MACHINE)/naomim4.o \
17251725   $(MACHINE)/315-5881_crypt.o \
17261726   $(MACHINE)/awboard.o \
17271727   $(MACHINE)/mie.o $(MACHINE)/maple-dc.o $(MACHINE)/mapledev.o $(MACHINE)/dc-ctrl.o $(MACHINE)/jvs13551.o \
r243192r243193
17471747   $(DRIVERS)/segaybd.o $(VIDEO)/segaybd.o \
17481748   $(DRIVERS)/sg1000a.o \
17491749   $(DRIVERS)/stactics.o $(VIDEO)/stactics.o \
1750   $(DRIVERS)/stv.o $(MACHINE)/stvprot.o $(MACHINE)/315-5838_317-0229_comp.o \
1750   $(DRIVERS)/stv.o $(MACHINE)/stvprot.o $(MACHINE)/decathlt.o \
17511751   $(DRIVERS)/suprloco.o $(VIDEO)/suprloco.o \
17521752   $(DRIVERS)/system1.o $(VIDEO)/system1.o \
17531753   $(DRIVERS)/system16.o $(VIDEO)/system16.o \
trunk/src/mame/video/actfancr.c
r243192r243193
99
1010/******************************************************************************/
1111
12void actfancr_state::register_savestate()
13{
14   save_item(NAME(m_flipscreen));
15}
16
17void actfancr_state::video_start()
18{
19   register_savestate();
20}
21
22/******************************************************************************/
23
1224UINT32 actfancr_state::screen_update_actfancr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
1325{
1426   /* Draw playfield */
trunk/src/mame/video/bogeyman.c
r243192r243193
3636   }
3737}
3838
39WRITE8_MEMBER(bogeyman_state::videoram_w)
39WRITE8_MEMBER(bogeyman_state::bogeyman_videoram_w)
4040{
4141   m_videoram[offset] = data;
4242   m_bg_tilemap->mark_tile_dirty(offset);
4343}
4444
45WRITE8_MEMBER(bogeyman_state::colorram_w)
45WRITE8_MEMBER(bogeyman_state::bogeyman_colorram_w)
4646{
4747   m_colorram[offset] = data;
4848   m_bg_tilemap->mark_tile_dirty(offset);
4949}
5050
51WRITE8_MEMBER(bogeyman_state::videoram2_w)
51WRITE8_MEMBER(bogeyman_state::bogeyman_videoram2_w)
5252{
5353   m_videoram2[offset] = data;
5454   m_fg_tilemap->mark_tile_dirty(offset);
5555}
5656
57WRITE8_MEMBER(bogeyman_state::colorram2_w)
57WRITE8_MEMBER(bogeyman_state::bogeyman_colorram2_w)
5858{
5959   m_colorram2[offset] = data;
6060   m_fg_tilemap->mark_tile_dirty(offset);
6161}
6262
63WRITE8_MEMBER(bogeyman_state::paletteram_w)
63WRITE8_MEMBER(bogeyman_state::bogeyman_paletteram_w)
6464{
6565   /* RGB output is inverted */
6666   m_palette->write(space, offset, UINT8(~data));
r243192r243193
9494   m_fg_tilemap->set_transparent_pen(0);
9595}
9696
97void bogeyman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
97void bogeyman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
9898{
99   for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
99   int offs;
100
101   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
100102   {
101103      int attr = m_spriteram[offs];
102104
r243192r243193
137139   }
138140}
139141
140UINT32 bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
142UINT32 bogeyman_state::screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
141143{
142144   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
143145   draw_sprites(bitmap, cliprect);
trunk/src/mame/video/cps1.c
r243192r243193
15311531   {"varthu",      CPS_B_04,     mapper_VA63B },   /* CPSB test has been patched out (60=0008) register is also written to, possibly leftover from development */
15321532   {"varthj",      CPS_B_21_BT5, mapper_VA22B },   /* CPSB test has been patched out (72=0001) register is also written to, possibly leftover from development */
15331533   {"cworld2j",    CPS_B_21_BT6, mapper_Q522B,  0x36, 0, 0x34 },   /* (ports 36, 34 probably leftover input code from another game) */
1534   {"cworld2ja",   CPS_B_21_DEF, mapper_Q522B }, // patched set, no battery, could be desuicided
15351534   {"wof",         CPS_B_21_QS1, mapper_TK263B },
15361535   {"wofr1",       CPS_B_21_DEF, mapper_TK263B },  // patched set coming from a desuicided board?
15371536   {"wofa",        CPS_B_21_DEF, mapper_TK263B },  // patched set coming from a desuicided board?
trunk/src/mame/video/eolith.c
r243192r243193
3333VIDEO_START_MEMBER(eolith_state,eolith)
3434{
3535   m_vram = auto_alloc_array(machine(), UINT32, 0x40000*2/4);
36   save_pointer(NAME(m_vram), 0x40000*2/4);
36   save_pointer(NAME(m_vram), 0x40000*2/4);
3737   save_item(NAME(m_buffer));
3838}
3939
trunk/src/mame/video/gp9001.c
r243192r243193
141141 The alternative option of allowing sprites to render a priority level higher than tilemaps breaks at least the
142142 'Welcome to..' screen in Batrider after selecting your character.
143143
144 Batrider Gob-Robo boss however definitely requires SPRITES to still have 16 levels of priority against other
145 sprites, see http://mametesters.org/view.php?id=5832
146
147144 It is unknown if the current solution breaks anything.  The majority of titles don't make extensive use of the
148145 priority system.
149146
150147*/
151#define GP9001_PRIMASK (0x000f)
152#define GP9001_PRIMASK_TMAPS (0x000e)
148#define GP9001_PRIMASK (0x000e)
153149
150
154151WRITE16_MEMBER( gp9001vdp_device::gp9001_bg_tmap_w )
155152{
156153   COMBINE_DATA(&m_vram_bg[offset]);
r243192r243193
174171   AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(gp9001_bg_tmap_w) AM_SHARE("vram_bg")
175172   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(gp9001_fg_tmap_w) AM_SHARE("vram_fg")
176173   AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(gp9001_top_tmap_w) AM_SHARE("vram_top")
177   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") AM_MIRROR(0x0800)
178//  AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
174   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram")
175   AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
179176ADDRESS_MAP_END
180177
181178
r243192r243193
888885         int realx = (x+scrollx)&0x1ff;
889886
890887         UINT16 pixdat = srcptr[realx];
891         UINT8 pixpri = ((pixdat & (GP9001_PRIMASK_TMAPS<<12))>>12);
888         UINT8 pixpri = ((pixdat & (GP9001_PRIMASK<<12))>>12);
892889
893890         if (pri_enable[pixpri])
894891         {
trunk/src/mame/video/m58.c
r243192r243193
102102 *
103103 *************************************/
104104
105WRITE8_MEMBER(m58_state::videoram_w)
105WRITE8_MEMBER(m58_state::yard_videoram_w)
106106{
107107   m_videoram[offset] = data;
108108   m_bg_tilemap->mark_tile_dirty(offset / 2);
109109}
110110
111111
112WRITE8_MEMBER(m58_state::scroll_panel_w)
112WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
113113{
114114   int sx,sy,i;
115115
r243192r243193
128128      col = (data >> i) & 0x11;
129129      col = ((col >> 3) | col) & 3;
130130
131      m_scroll_panel_bitmap.pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col;
131      m_scroll_panel_bitmap->pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col;
132132   }
133133}
134134
r243192r243193
140140 *
141141 *************************************/
142142
143TILE_GET_INFO_MEMBER(m58_state::get_bg_tile_info)
143TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info)
144144{
145145   int offs = tile_index * 2;
146146   int attr = m_videoram[offs + 1];
r243192r243193
152152}
153153
154154
155TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows)
155TILEMAP_MAPPER_MEMBER(m58_state::yard_tilemap_scan_rows)
156156{
157157   /* logical (col,row) -> memory offset */
158158   if (col >= 32)
r243192r243193
175175   int height = m_screen->height();
176176   const rectangle &visarea = m_screen->visible_area();
177177
178   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::tilemap_scan_rows),this),  8, 8, 64, 32);
178   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::yard_get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::yard_tilemap_scan_rows),this),  8, 8, 64, 32);
179179   m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1));
180180   m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1));
181181
182   //m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height);
183   m_screen->register_screen_bitmap(m_scroll_panel_bitmap);
184   save_item(NAME(m_scroll_panel_bitmap));
182   m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height);
185183}
186184
187185
r243192r243193
192190 *
193191 *************************************/
194192
195WRITE8_MEMBER(m58_state::flipscreen_w)
193WRITE8_MEMBER(m58_state::yard_flipscreen_w)
196194{
197195   /* screen flip is handled both by software and hardware */
198196   flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01));
r243192r243193
267265
268266void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
269267{
270   if (!*m_score_panel_disabled)
268   if (!*m_yard_score_panel_disabled)
271269   {
272270      const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1);
273271      const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
r243192r243193
280278      clip.max_y += visarea.max_y + yoffs;
281279      clip &= cliprect;
282280
283      copybitmap(bitmap, m_scroll_panel_bitmap, flip_screen(), flip_screen(),
281      copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(),
284282               sx, visarea.min_y + yoffs, clip);
285283   }
286284}
r243192r243193
293291 *
294292 *************************************/
295293
296UINT32 m58_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
294UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
297295{
298   m_bg_tilemap->set_scrollx(0, (*m_scroll_x_high * 0x100) + *m_scroll_x_low);
299   m_bg_tilemap->set_scrolly(0, *m_scroll_y_low);
296   m_bg_tilemap->set_scrollx(0, (*m_yard_scroll_x_high * 0x100) + *m_yard_scroll_x_low);
297   m_bg_tilemap->set_scrolly(0, *m_yard_scroll_y_low);
300298
301299   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
302300   draw_sprites(bitmap, cliprect);
trunk/src/mame/video/paradise.c
r243192r243193
164164   m_tilemap_2->set_transparent_pen(0xff);
165165
166166   save_item(NAME(m_tmpbitmap));
167   save_item(NAME(m_pixbank));
168167}
169168
170169
r243192r243193
180179   m_priority = data;
181180}
182181
183void paradise_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
182void paradise_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
184183{
185   for (int i = 0; i < m_spriteram.bytes() ; i += m_sprite_inc)
184   UINT8 *spriteram = m_spriteram;
185   int i;
186   for (i = 0; i < m_spriteram.bytes() ; i += m_sprite_inc)
186187   {
187      int code = m_spriteram[i + 0];
188      int x    = m_spriteram[i + 1];
189      int y    = m_spriteram[i + 2] - 2;
190      int attr = m_spriteram[i + 3];
188      int code = spriteram[i + 0];
189      int x    = spriteram[i + 1];
190      int y    = spriteram[i + 2] - 2;
191      int attr = spriteram[i + 3];
191192
192193      int flipx = 0;  // ?
193194      int flipy = 0;
trunk/src/mame/video/pastelg.c
r243192r243193
283283   int height = m_screen->height();
284284
285285   m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height);
286
286   
287287   save_item(NAME(m_blitter_desty));
288288   save_item(NAME(m_blitter_sizex));
289289   save_item(NAME(m_blitter_sizey));
trunk/src/mame/video/pc080sn.c
r243192r243193
377377
378378   UINT16 a, color;
379379   int sx, x_index;
380   int y_index, src_y_index, row_index;
380   int i, y, y_index, src_y_index, row_index;
381381
382382   int flip = 0;
383   int machine_flip = 0;   /* for  ROT 180 ? */
383384
384385   int min_x = cliprect.min_x;
385386   int max_x = cliprect.max_x;
r243192r243193
399400      y_index = 0;
400401   }
401402
402   for (int y = min_y; y <= max_y; y++)
403   if (!machine_flip)
404      y = min_y;
405   else
406      y = max_y;
407
408   do
403409   {
404410      src_y_index = y_index & 0x1ff;  /* tilemaps are 512 px up/down */
405411      row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff;
r243192r243193
413419
414420      if (flags & TILEMAP_DRAW_OPAQUE)
415421      {
416         for (int i = 0; i < screen_width; i++)
422         for (i = 0; i < screen_width; i++)
417423         {
418424            a = src16[x_index & width_mask];
419425#ifdef TOPSPEED_ROAD_COLORS
r243192r243193
425431      }
426432      else
427433      {
428         for (int i = 0; i < screen_width; i++)
434         for (i = 0; i < screen_width; i++)
429435         {
430436            if (tsrc[x_index & width_mask])
431437            {
r243192r243193
443449
444450      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
445451      y_index++;
452
453      if (!machine_flip)
454         y++;
455      else
456         y--;
446457   }
458   while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
447459}
448460
449461void pc080sn_device::tilemap_draw( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority )
trunk/src/mame/video/taitoair.c
r243192r243193
229229         int xx1 = x1 >> TAITOAIR_FRAC_SHIFT;
230230         int xx2 = x2 >> TAITOAIR_FRAC_SHIFT;
231231         int grad_col;
232         int base_color;
233232
234233         if (xx1 <= cliprect.max_x || xx2 >= cliprect.min_x)
235234         {
r243192r243193
238237            if (xx2 > cliprect.max_x)
239238               xx2 = cliprect.max_x;
240239
241            if(color & 0x40)
242            {
243               /* Non-terrain elements are colored with this. */
244               base_color = (color & 0x3f) + 0x340;
245               grad_col = 0;
246            }
247            else
248            {
249               /* Terrain elements, with a gradient applied. */
250               /* TODO: it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */
251               base_color = ((color & 0x3f) * 0x80) + 0x2040;
252               grad_col = (y1 >> 3) & 0x3f;
253            }
240            /* TODO: it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */
241            grad_col = (y1 >> 3) & 0x3f;
254242
255243            while (xx1 <= xx2)
256244            {
257               bitmap.pix16(y1, xx1) = base_color + grad_col;
245               bitmap.pix16(y1, xx1) = color + grad_col;
258246               xx1++;
259247            }
260248         }
r243192r243193
405393                  logerror("quad: unknown value %04x at %04x\n", m_line_ram[adr], adr);
406394                  break;
407395               }
408               m_q.col = m_line_ram[adr] & 0x7f;//((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
409
396               m_q.col = ((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
410397               adr--;
411398               pcount = 0;
412399               while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(m_line_ram[adr] & 0xc000))
trunk/src/mame/video/tc0080vco.c
r243192r243193
439439
440440      int sx, zoomx, zoomy;
441441      int dx, ex, dy, ey;
442      int y_index, src_y_index, row_index;
442      int i, y, y_index, src_y_index, row_index;
443443      int x_index, x_step;
444444
445445      int flip = m_flipscreen;
446      int machine_flip = 0;   /* for  ROT 180 ? */
446447
447448      int min_x = cliprect.min_x;
448449      int max_x = cliprect.max_x;
r243192r243193
500501         y_index = ((-m_scroll_ram[3] - 2) << 16) + min_y * zoomy - (max_y + min_y) * (zoomy - 0x10000);
501502      }
502503
503      for (int y = min_y; y <= max_y; y++)
504      if (!machine_flip)
505         y = min_y;
506      else
507         y = max_y;
508
509      do
504510      {
505511         src_y_index = (y_index >> 16) & 0x3ff;  /* tilemaps are 1024 px up/down */
506512
r243192r243193
519525
520526         if (flags & TILEMAP_DRAW_OPAQUE)
521527         {
522            for (int i = 0; i < screen_width; i++)
528            for (i = 0; i < screen_width; i++)
523529            {
524530               *dst16++ = src16[(x_index >> 16) & width_mask];
525531               x_index += x_step;
r243192r243193
527533         }
528534         else
529535         {
530            for (int i = 0; i < screen_width; i++)
536            for (i = 0; i < screen_width; i++)
531537            {
532538               if (tsrc[(x_index >> 16) & width_mask])
533539                  *dst16++ = src16[(x_index >> 16) & width_mask];
r243192r243193
540546         taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1 , ROT0, screen.priority(), priority);
541547
542548         y_index += zoomy;
549
550         if (!machine_flip)
551            y++;
552         else
553            y--;
543554      }
555      while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
544556   }
545557}
546558
trunk/src/mame/video/tc0480scp.c
r243192r243193
717717      bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap();
718718      bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap();
719719      int flip = m_pri_reg & 0x40;
720      int y_index, src_y_index, row_index;
720      int i, y, y_index, src_y_index, row_index;
721721      int x_index, x_step;
722722
723723      UINT16 screen_width = 512; //cliprect.width();
r243192r243193
745745         y_index -= (m_y_offset - min_y) * zoomy;
746746      }
747747
748      for (int y = min_y; y <= max_y; y++)
748      y = min_y;
749
750      do
749751      {
750752         src_y_index = (y_index >> 16) & 0x1ff;
751753
r243192r243193
764766
765767         if (flags & TILEMAP_DRAW_OPAQUE)
766768         {
767            for (int i = 0; i < screen_width; i++)
769            for (i = 0; i < screen_width; i++)
768770            {
769771               *dst16++ = src16[(x_index >> 16) & width_mask];
770772               x_index += x_step;
r243192r243193
772774         }
773775         else
774776         {
775            for (int i = 0; i < screen_width; i++)
777            for (i = 0; i < screen_width; i++)
776778            {
777779               if (tsrc[(x_index >> 16) & width_mask])
778780                  *dst16++ = src16[(x_index >> 16) & width_mask];
r243192r243193
785787         taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
786788
787789         y_index += zoomy;
790         y++;
788791      }
792      while (y <= max_y);
793
789794   }
790795}
791796
r243192r243193
833838
834839   UINT16 *dst16, *src16;
835840   UINT8 *tsrc;
836   int y_index, src_y_index, row_index, row_zoom;
841   int i, y, y_index, src_y_index, row_index, row_zoom;
837842   int sx, x_index, x_step;
838843   UINT32 zoomx, zoomy;
839844   UINT16 scanline[512];
r243192r243193
871876      y_index -= (m_y_offset - min_y) * zoomy;
872877   }
873878
874   for (int y = min_y; y <= max_y; y++)
879      y = min_y;
880
881   do
875882   {
876883      if (!flipscreen)
877884         src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff;
r243192r243193
910917
911918      if (flags & TILEMAP_DRAW_OPAQUE)
912919      {
913         for (int i = 0; i < screen_width; i++)
920         for (i = 0; i < screen_width; i++)
914921         {
915922            *dst16++ = src16[(x_index >> 16) & width_mask];
916923            x_index += x_step;
r243192r243193
918925      }
919926      else
920927      {
921         for (int i = 0; i < screen_width; i++)
928         for (i = 0; i < screen_width; i++)
922929         {
923930            if (tsrc[(x_index >> 16) & width_mask])
924931               *dst16++ = src16[(x_index >> 16) & width_mask];
r243192r243193
931938      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
932939
933940      y_index += zoomy;
941      y++;
934942   }
943   while (y<=max_y);
935944}
936945
937946
trunk/src/mame/video/tia.c
r243192r243193
430430   helper[0] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
431431   helper[1] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
432432   helper[2] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
433
433   
434434   register_save_state();
435435}
436436
trunk/src/mame/video/tia.h
r243192r243193
199199   bitmap_ind16 *helper[3];
200200
201201   UINT16 screen_height;
202
202   
203203   void register_save_state();
204204};
205205
trunk/src/mame/video/tx1.c
r243192r243193
113113
114114PALETTE_INIT_MEMBER(tx1_state,tx1)
115115{
116   const UINT8 *const color_prom = &m_proms[0];
116   const UINT8 *color_prom = memregion("proms")->base();
117117   int i;
118118
119119   static const res_net_info tx1_net_info =
r243192r243193
233233   UINT16 *tx1_vram = m_vram;
234234   INT32 x, y;
235235   UINT32 scroll_x;
236   UINT8 *chars, *gfx2;
236237
237238   /* 2bpp characters */
238   const UINT8 *const chars = &m_char_tiles[0];
239   const UINT8 *const gfx2 = &m_char_tiles[0x4000];
239   chars = memregion("char_tiles")->base();
240   gfx2 = chars + 0x4000;
240241
241242   /* X scroll value is the last word in char RAM */
242243   scroll_x = tx1_vram[0xfff] & 0x3ff;
r243192r243193
413414   UINT8   pix[2][4][3];
414415
415416   /* Road slice map ROMs */
416   const UINT8 *const rom_a = &m_road_rom[0];
417   const UINT8 *const rom_b = &m_road_rom[0x2000];
418   const UINT8 *const rom_c = &m_road_rom[0x4000];
417   const UINT8 *const gfx3 = memregion("gfx3")->base();
418   const UINT8 *const rom_a = gfx3;
419   const UINT8 *const rom_b = gfx3 + 0x2000;
420   const UINT8 *const rom_c = gfx3 + 0x4000;
419421
420422   /* Pixel data */
421   const UINT8 *const prom_a = &m_proms[0x1100];
422   const UINT8 *const prom_b = &m_proms[0x1300];
423   const UINT8 *const prom_c = &m_proms[0x1500];
424   const UINT8 *const vprom  = &m_proms[0x1700];
423   const UINT8 *const proms = memregion("proms")->base();
424   const UINT8 *const prom_a = proms + 0x1100;
425   const UINT8 *const prom_b = proms + 0x1300;
426   const UINT8 *const prom_c = proms + 0x1500;
427   const UINT8 *const vprom  = proms + 0x1700;
425428
426429   rva9_8  = (tx1_vregs.flags & 3) << 8;
427430   rva7    = !BIT(tx1_vregs.flags, TX1_RDFLAG_RVA7) << 7;
r243192r243193
852855   UINT32 offs;
853856
854857   /* The many lookup table ROMs */
855   const UINT8 *const ic48 = &m_obj_luts[0];
856   const UINT8 *const ic281 = &m_obj_luts[0x2000];
858   const UINT8 *const ic48 = memregion("user3")->base();
859   const UINT8 *const ic281 = ic48 + 0x2000;
857860
858   const UINT8 *const ic190 = &m_proms[0xc00];
859   const UINT8 *const ic162 = &m_proms[0xe00];
860   const UINT8 *const ic25  = &m_proms[0x1000];
861   const UINT8 *const proms = memregion("proms")->base();
862   const UINT8 *const ic190 = proms + 0xc00;
863   const UINT8 *const ic162 = proms + 0xe00;
864   const UINT8 *const ic25  = proms + 0x1000;
861865
862   const UINT8 *const ic106 = &m_obj_map[0];
863   const UINT8 *const ic73  = &m_obj_map[0x4000];
866   const UINT8 *const ic106 = memregion("obj_map")->base();
867   const UINT8 *const ic73  = ic106 + 0x4000;
864868
865   const UINT8 *const pixdata_rgn = &m_obj_tiles[0];
869   const UINT8 *const pixdata_rgn = memregion("obj_tiles")->base();
866870
867871   for (offs = 0x0; offs <= 0x300; offs += 8)
868872   {
r243192r243193
991995                  dataend |= ic106_data & 0x40;
992996
993997                  /* Retrieve data for an 8x8 tile */
994                  ic73_data = ic73[rom_addr2 & 0x3fff];
998                  ic73_data = ic73[rom_addr2];
995999
9961000                  /* This is the data from the LUT pair */
9971001                  lut_data = (ic106_data << 8) | ic73_data;
r243192r243193
11261130void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen)
11271131{
11281132   int x, y;
1129   UINT8 *chr_pal = &m_proms[0x900];
1133   UINT8 *chr_pal = memregion("proms")->base() + 0x900;
11301134
11311135   int x_offset = screen * 256;
11321136
r243192r243193
12521256
12531257PALETTE_INIT_MEMBER(tx1_state,buggyboy)
12541258{
1255   const UINT8 *const color_prom = &m_proms[0];
1259   const UINT8 *color_prom = memregion("proms")->base();
12561260   int i;
12571261
12581262   for (i = 0; i < 0x100; i++)
r243192r243193
12971301   UINT16 *buggyboy_vram = m_vram;
12981302   INT32 x, y;
12991303   UINT32 scroll_x, scroll_y;
1304   UINT8 *chars, *gfx2;
13001305   UINT32 total_width;
13011306   UINT32 x_mask;
13021307
13031308   /* 2bpp characters */
1304   const UINT8 *const chars = &m_char_tiles[0];
1305   const UINT8 *const gfx2 = &m_char_tiles[0x4000];
1309   chars = memregion("char_tiles")->base();
1310   gfx2 = memregion("char_tiles")->base() + 0x4000;
13061311
13071312   /* X/Y scroll values are the last word in char RAM */
13081313   if (wide)
r243192r243193
14441449   UINT8 d1 = 0;
14451450
14461451   /* ROM/PROM lookup tables */
1447   const UINT8 *const rom   = &m_road_rom[0];
1448   const UINT8 *const prom0 = &m_road_rom[0x4000];
1449   const UINT8 *const prom1 = &m_road_rom[0x4200];
1450   const UINT8 *const prom2 = &m_road_rom[0x4400];
1452   const UINT8 *rom   = memregion("road")->base();
1453   const UINT8 *prom0 = rom + 0x4000;
1454   const UINT8 *prom1 = rom + 0x4200;
1455   const UINT8 *prom2 = rom + 0x4400;
14511456
14521457   /* Latch road reverse bit */
14531458   *_rorev = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) );
r243192r243193
15381543   UINT32 rva20_6;
15391544
15401545   /* ROM/PROM lookup tables */
1541   const UINT8 *const rcols = &m_proms[0x1500];
1542   const UINT8 *const vprom = &m_road_rom[0x4600];
1546   const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500);
1547   const UINT8 *vprom   = memregion("road")->base() + 0x4600;
15431548
15441549   /* Extract constant values */
15451550   tcmd     = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6);
r243192r243193
21652170   UINT32 rva20_6;
21662171
21672172   /* ROM/PROM lookup tables */
2168   const UINT8 *const rcols = &m_proms[0x1500];
2169   const UINT8 *const vprom = &m_road_rom[0x4600];
2173   const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500);
2174   const UINT8 *vprom = memregion("road")->base() + 0x4600;
21702175
21712176   /* Extract constant values */
21722177   tcmd     = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6);
r243192r243193
25722577   UINT32 x_stride;
25732578
25742579   /* The many lookup table ROMs */
2575   const UINT8 *const bug13  = &m_obj_luts[0];
2576   const UINT8 *const bug18s = &m_obj_luts[0x2000];
2577   const UINT8 *const bb8    = &m_proms[0x1600];
2580   const UINT8 *const bug13  = (UINT8*)memregion("obj_luts")->base();
2581   const UINT8 *const bug18s = bug13 + 0x2000;
2582   const UINT8 *const bb8    = (UINT8*)memregion("proms")->base() + 0x1600;
25782583
2579   const UINT8 *const bug16s = &m_obj_map[0];
2580   const UINT8 *const bug17s = &m_obj_map[0x8000];
2584   const UINT8 *const bug16s = (UINT8*)memregion("obj_map")->base();
2585   const UINT8 *const bug17s = bug16s + 0x8000;
25812586
2582   const UINT8 *const bb9o = &m_proms[0x500];
2583   const UINT8 *const bb9e = &m_proms[0xd00];
2587   const UINT8 *const bb9o = (UINT8*)memregion("proms")->base() + 0x500;
2588   const UINT8 *const bb9e = bb9o + 0x800;
25842589
2585   const UINT8 *const pixdata_rgn = &m_obj_tiles[0];
2590   const UINT8 *const pixdata_rgn = (UINT8*)memregion("obj_tiles")->base();
25862591
25872592   if (wide)
25882593   {
r243192r243193
29222927
29232928void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen)
29242929{
2925   UINT8 *chr_pal = &m_proms[0x400];
2930   UINT8 *chr_pal = memregion("proms")->base() + 0x400;
29262931   UINT32 bmp_stride;
29272932   UINT32 x_offset;
29282933   UINT32 y;
trunk/src/mame/video/wgp.c
r243192r243193
514514
515515   UINT16 *dst16,*src16;
516516   UINT8 *tsrc;
517   int y_index, src_y_index, row_index, row_zoom;
517   int i, y, y_index, src_y_index, row_index, row_zoom;
518518
519519   /* I have a fairly strong feeling these should be UINT32's, x_index is
520520      falling through from max +ve to max -ve quite a lot in this routine */
r243192r243193
524524   UINT16 scanline[512];
525525   UINT16 row_colbank, row_scroll;
526526   int flipscreen = 0; /* n/a */
527   int machine_flip = 0;   /* for  ROT 180 ? */
527528
528529   UINT16 screen_width = cliprect.width();
529530   UINT16 min_y = cliprect.min_y;
r243192r243193
557558      y_index = 0;
558559   }
559560
560   for (int y = min_y; y <= max_y; y++)
561   if (!machine_flip)
562      y = min_y;
563   else
564      y = max_y;
565
566   do
561567   {
562568      int a;
563569
r243192r243193
592598
593599      if (flags & TILEMAP_DRAW_OPAQUE)
594600      {
595         for (int i = 0; i < screen_width; i++)
601         for (i = 0; i < screen_width; i++)
596602         {
597603            *dst16++ = src16[(x_index >> 16) & width_mask] + row_colbank;
598604            x_index += x_step;
r243192r243193
600606      }
601607      else
602608      {
603         for (int i = 0; i < screen_width; i++)
609         for (i = 0; i < screen_width; i++)
604610         {
605611            if (tsrc[(x_index >> 16) & width_mask])
606612               *dst16++ = src16[(x_index >> 16) & width_mask] + row_colbank;
r243192r243193
613619      bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
614620
615621      y_index += zoomy;
622      if (!machine_flip) y++; else y--;
616623   }
624   while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
625
617626}
618627
619628
trunk/src/mess/drivers/a2600.c
r243192r243193
316316
317317   /* Banks may have changed, reset the cpu so it uses the correct reset vector */
318318   m_maincpu->reset();
319
319   
320320   save_item(NAME(m_current_screen_height));
321321}
322322
trunk/src/mess/drivers/amaztron.c
r243192r243193
112112
113113static INPUT_PORTS_START( amaztron )
114114   PORT_START("IN.0") // R0
115   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1")
116   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Button 6")
117   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Button 11")
118   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Button 16")
119   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Button 21")
115   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1")
116   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("Button 6")
117   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Button 11")
118   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("Button 16")
119   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Button 21")
120120
121121   PORT_START("IN.1") // R1
122   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Button 2")
123   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Button 7")
124   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Button 12")
125   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Button 17")
126   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Button 22")
122   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("Button 2")
123   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("Button 7")
124   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("Button 12")
125   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("Button 17")
126   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("Button 22")
127127
128128   PORT_START("IN.2") // R2
129   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Button 3")
130   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Button 8")
131   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Button 13")
132   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Button 18")
133   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Button 23")
129   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("Button 3")
130   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("Button 8")
131   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("Button 13")
132   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("Button 18")
133   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("Button 23")
134134
135135   PORT_START("IN.3") // R3
136   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Button 4")
137   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("Button 9")
138   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Button 14")
139   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Button 19")
140   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Button 24")
136   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("Button 4")
137   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("Button 9")
138   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("Button 14")
139   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("Button 19")
140   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("Button 24")
141141
142142   PORT_START("IN.4") // R4
143   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Button 5")
144   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("Button 10")
145   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Button 15")
146   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Button 20")
147   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Button 25")
143   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("Button 5")
144   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("Button 10")
145   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("Button 15")
146   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("Button 20")
147   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("Button 25")
148148
149149   PORT_START("IN.5") // R5
150   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Game Select")
151   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Game Start")
150   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("Game Select")
151   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("Game Start")
152152   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
153153   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
154154   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
trunk/src/mess/drivers/applix.c
r243192r243193
55    Applix 1616 computer
66
77    See for docs: http;//www.microbee-mspp.org.au
8    You need to sign up and make an introductory thread.
9    Then you will be granted permission to visit the repository.
810
911    First revealed to the world in December 1986 issue of Electronics Today
1012    International (ETI) an Australian electronics magazine which is now defunct.
r243192r243193
934936/* Driver */
935937
936938/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   CLASS         INIT    COMPANY          FULLNAME       FLAGS */
937COMP( 1986, applix, 0,       0,     applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", 0 )
939COMP( 1986, applix, 0,       0,     applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", GAME_NOT_WORKING )
938940
939941
940942
trunk/src/mess/drivers/apricotp.c
r243192r243193
5656   m_video_ram.allocate(0x20000);
5757}
5858
59MC6845_UPDATE_ROW( fp_state::update_row )
60{
61}
6259
6360UINT32 fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6461{
r243192r243193
507504   MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_CRT_TAG, 4000000)
508505   MCFG_MC6845_SHOW_BORDER_AREA(false)
509506   MCFG_MC6845_CHAR_WIDTH(8)
510   MCFG_MC6845_UPDATE_ROW_CB(fp_state, update_row)
511507
512508   // sound hardware
513509   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mess/drivers/banctec.c
r243192r243193
1// license:MAME|GPL2+
2// copyright-holders:Felipe Sanches
3/***************************************************************************
4  This driver covers only the Operator Panel of the BancTec 91690 Document Processor equipment
5
6  Author: Felipe Sanches <juca@members.fsf.org>
7
8  Maintainence Manual: <https://garoa.net.br/w/images/PAINEL_BANCTEC_91690.PDF>
9*/
10
11#include "emu.h"
12#include "cpu/mcs51/mcs51.h"
13#include "cpu/m6805/m6805.h"
14#include "includes/banctec.h"
15#include "video/mc6845.h"
16
17static ADDRESS_MAP_START( banctec_mem , AS_PROGRAM, 8, banctec_state )
18   AM_RANGE(0x0000, 0x07ff) AM_ROM
19   AM_RANGE(0x0800, 0xffff) AM_RAM /* Probably wrong. Must be verified on pcb! */
20ADDRESS_MAP_END
21
22static ADDRESS_MAP_START( banctec_mcu_mem , AS_PROGRAM, 8, banctec_state )
23   AM_RANGE(0x0000, 0x1fff) AM_ROM
24   AM_RANGE(0x2000, 0x7fff) AM_RAM /* Probably wrong. Must be verified on pcb! */
25   AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram") /* Probably wrong. Must be verified on pcb! */
26ADDRESS_MAP_END
27
28void banctec_state::machine_reset()
29{
30}
31
32
33/****************************
34* Video/Character functions *
35****************************/
36
37TILE_GET_INFO_MEMBER(banctec_state::get_bg_tile_info)
38{
39   UINT8 *videoram = m_videoram;
40   int code = videoram[tile_index];
41   int color = 1;
42
43   SET_TILE_INFO_MEMBER(0, code, color, 0);
44}
45
46void banctec_state::video_start()
47{
48   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(banctec_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25);
49}
50
51UINT32 banctec_state::screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
52{
53   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
54
55   return 0;
56}
57
58/* ROCKWELL 6545 - Transparent Memory Addressing */
59
60MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr)
61{
62   /* What is this function meant to do ? */
63}
64
65/******************************
66* Graphics Decode Information *
67******************************/
68
69const gfx_layout banctec_gfx_layout =
70{
71   8, 8,               /* 8x8 characters */
72   256,                /* 256 characters */
73   1,                  /* 1 bits per pixel */
74   {0},                /* no bitplanes; 1 bit per pixel */
75   {0, 1, 2, 3, 4, 5, 6, 7},
76   {0 * 256*8, 1 * 256*8, 2 * 256*8, 3 * 256*8, 4 * 256*8, 5 * 256*8, 6 * 256*8, 7 * 256*8},
77   8                 /* size of one char */
78};
79
80static GFXDECODE_START( banctec )
81         GFXDECODE_ENTRY( "gfx", 0x00000, banctec_gfx_layout, 0, 2 )
82GFXDECODE_END
83
84static MACHINE_CONFIG_START( banctec, banctec_state )
85   /* basic machine hardware */
86
87   MCFG_CPU_ADD("maincpu", I80C31, XTAL_11_0592MHz)
88   MCFG_CPU_PROGRAM_MAP(banctec_mem)
89
90   MCFG_CPU_ADD("mcu", M6805, 4000000)     /* Actual MCU is a Motorola 6803 and the clock frequency is still unknown */
91   MCFG_CPU_PROGRAM_MAP(banctec_mcu_mem)
92
93// The video signal is generated by a R6545EAP character generator chip
94// The U20 EPROM holds the image data for the character set.
95
96   // video hardware
97   MCFG_SCREEN_ADD("screen", RASTER)
98   MCFG_SCREEN_REFRESH_RATE(60)
99   MCFG_SCREEN_SIZE((52+1)*8, (31+1)*8)
100   MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1)
101   MCFG_SCREEN_UPDATE_DRIVER(banctec_state, screen_update_banctec)
102   MCFG_SCREEN_PALETTE("palette")
103
104   MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec)
105   MCFG_PALETTE_ADD("palette", 2)
106//  MCFG_PALETTE_INIT_OWNER(banctec_state, banctec)
107
108   MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */
109   MCFG_MC6845_SHOW_BORDER_AREA(false)
110   MCFG_MC6845_CHAR_WIDTH(8)
111   MCFG_MC6845_ADDR_CHANGED_CB(banctec_state, crtc_addr)
112
113MACHINE_CONFIG_END
114
115ROM_START(banctec)
116   ROM_REGION(0x800,"maincpu",0)
117   ROM_LOAD("banctec_eseries_panel_opnl.u20", 0x000, 0x800, CRC(c2ab9c06) SHA1(a296589034f656790ad5ffbce028dd846a40cf03))
118
119   ROM_REGION(0x2000,"mcu",0)
120   ROM_LOAD("banctec_eseries_panel.u8", 0x0000, 0x2000, CRC(f3335e0a) SHA1(5ca45fdcb7ef45a65c28c79abfa9ebb7a8a06619))
121
122   ROM_REGION(0x1000,"gfx",0)
123   ROM_LOAD("banctec_eseries_panel.u20", 0x0000, 0x1000, CRC(5b6ecec9) SHA1(35aff8f965bce77205e3a43d71e39097585091a7))
124ROM_END
125
126/***************************************************************************
127
128  Game driver(s)
129
130***************************************************************************/
131
132/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    MONITOR COMPANY   FULLNAME */
133CONS( 1989, banctec, 0,        0,      banctec, 0, driver_device, 0,       "DALE Electronics",  "BancTec ESeries Panel", GAME_NOT_WORKING | GAME_NO_SOUND)
trunk/src/mess/drivers/bw12.c
r243192r243193
484484   save_item(NAME(m_motor_on));
485485   save_item(NAME(m_motor0));
486486   save_item(NAME(m_motor1));
487   save_item(NAME(m_centronics_busy));
488   save_item(NAME(m_centronics_fault));
489   save_item(NAME(m_centronics_perror));
490   machine().save().register_postload(save_prepost_delegate(FUNC(bw12_state::bankswitch), this));
491487}
492488
493489void bw12_state::machine_reset()
trunk/src/mess/drivers/c65.c
r243192r243193
7676 *************************************/
7777
7878static ADDRESS_MAP_START( c65_mem , AS_PROGRAM, 8, c65_state )
79   AM_RANGE(0x00000, 0x07fff) AM_RAMBANK("bank11")
80   AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank12")
81   AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank13")
82   AM_RANGE(0x0c000, 0x0cfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank14")
83   AM_RANGE(0x0d000, 0x0d7ff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank5")
84   AM_RANGE(0x0d800, 0x0dbff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7")
85   AM_RANGE(0x0dc00, 0x0dfff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank9")
86   AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank10") AM_WRITE_BANK("bank15")
87   AM_RANGE(0x10000, 0x1f7ff) AM_RAM
88   AM_RANGE(0x1f800, 0x1ffff) AM_RAM AM_SHARE("colorram")
79   AM_RANGE(0xf0000, 0xf7fff) AM_RAMBANK("bank11")
80   AM_RANGE(0xf8000, 0xf9fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank12")
81   AM_RANGE(0xfa000, 0xfbfff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank13")
82   AM_RANGE(0xfc000, 0xfcfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank14")
83   AM_RANGE(0xfd000, 0xfd7ff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank5")
84   AM_RANGE(0xfd800, 0xfdbff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7")
85   AM_RANGE(0xfdc00, 0xfdfff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank9")
86   AM_RANGE(0xfe000, 0xfffff) AM_READ_BANK("bank10") AM_WRITE_BANK("bank15")
87//   AM_RANGE(0x10000, 0x1f7ff) AM_RAM
88//   AM_RANGE(0x1f800, 0x1ffff) AM_RAM AM_SHARE("colorram")
89   AM_RANGE(0x00000, 0x1ffff) AM_ROM AM_REGION("maincpu",0x20000)
90   
91   AM_RANGE(0x20000, 0x207ff) AM_RAM AM_SHARE("colorram")
8992
9093   AM_RANGE(0x20000, 0x23fff) AM_ROM /* &c65_dos,     maps to 0x8000    */
9194   AM_RANGE(0x24000, 0x28fff) AM_ROM /* reserved */
trunk/src/mess/drivers/cat.c
r243192r243193
219219J3: Floppy Connector
220220    (standard DIL 34 pin 2-row rectangular connector for mini-shugart/pc floppy cable; pin 2 IS connected somewhere and ?probably? is used for /DISKCHANGE like on an Amiga, with pin 34 being /TRUEREADY?)
221221    (as opposed to normal ibm pc 3.5" drives where pin 2 is unconnected or is /DENSITY *input to drive*, and pin 34 is /DISKCHANGE)
222J4: 18-pin sip header for keyboard ribbon cable; bottom edge of board is pin 1
223    Pins:
224    1: GND through 220k resistor r78
225    2: ? phone hook related? anode of diode d7; one of the pins of relay k2; topmost (boardwise) pin of transistor Q10
226    3: 74HCT34 pin
227
222J4: 18-pin sip header for keyboard ribbon cable
223    (needs tracing to see the VIA hookup order)
228224J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power
229225    through a small cable with a berg connector at the other end, to the floppy drive
230226    (5v gnd gnd 12v)
r243192r243193
236232J9: unpopulated DIL 40-pin straight connector for a ROM debug/expansion/RAM-shadow daughterboard
237233    the pins after pin 12 connect to that of the ROM-LO 27256 pinout counting pins 1,28,2,27,3,26,etc
238234    the ROM-HI rom has a different /HICE pin which is not connected to this connector
239    /LOCE is a15
240    /HICE is !a15
241    /ROM_OE comes from pin 14 of DECODE_E pal, and is shorted to /ROM_OE' by the cuttable jumper B1 which is not cut
242    /ROM_OE' goes to the two EPROMS
243    DECODE_18 is DECODE_E pal pin 18
235    /LOCE is most likely !(a19|a18)&a15
236    /HICE is most likely !(a19|a18)&!a15
244237    pin 1 (GND) is in the lower left and the pins count low-high then to the right
245    (gnd N/C   E_CLK     R/W    /ROM_OE a17 vcc a14 a13 a8 a9 a11 /ROM_OE' a10 a15 d7 d6 d5 d4 d3 )
246    (GND /IPL1 DECODE_18 /RESET gnd     a16 vcc a12 a7  a6 a5 a4  a3       a2  a1  a0 d0 d1 d2 gnd)
238    (gnd ? ? ? ?   ? vcc a14 a13 a8 a9 a11 /OE a10 /LOCE d7 d6 d5 d4 d3 )
239    (GND ? ? ? gnd ? vcc a12 a7  a6 a5 a4  a3  a2  a1    a0 d0 d1 d2 gnd)
247240Jx: 4 pin on top side, 6 pin on bottom side edge ?debug? connector (doesn't have a Jx number)
248241    (trace me!)
249242B1: a cuttable trace on the pcb. Not cut, affects one of the pins on the unpopulated J9 connector only.
r243192r243193
336329- Forth button (on the port on the back; keep in mind shift-usefront-space ALWAYS enables forth on a swyft)
337330- Multple undumped firmware revisions exist (330 and 331 are dumped)
338331
339// 74ls107 @ u18 pin 1 is 68008 /BERR pin
340
341// mc6850 @ u33 pin 2 (RX_DATA) is
342// mc6850 @ u33 pin 3 (RX_CLK) is 6522 @ u35 pin 17 (PB7)
343// mc6850 @ u33 pin 4 (TX_CLK) is 6522 @ u35 pin 17 (PB7)
344// mc6850 @ u33 pin 5 (/RTS) is
345// mc6850 @ u33 pin 6 (TX_DATA) is
346// mc6850 @ u33 pin 7 (/IRQ) is 68008 /IPL1 pin 41
347// mc6850 @ u33 pin 8 (CS0) is 68008 A12 pin 10
348// mc6850 @ u33 pin 9 (CS2) is DECODE E pin 18
349// mc6850 @ u33 pin 10 (CS1) is 68008 /BERR pin 40
350// mc6850 @ u33 pin 11 (RS) is 68008 A0 pin 46
351// mc6850 @ u33 pin 13 (R/W) is 68008 R/W pin 30
352// mc6850 @ u33 pin 14 (E) is 68008 E pin 38
353// mc6850 @ u33 pin 15-22 (D7-D0) are 68008 D7 to D0 pins 20-27
354// mc6850 @ u33 pin 23 (/DCD) is 74hc02 @ u35 pin 1
355// mc6850 @ u33 pin 24 (/CTS) is N/C?
356
357// 6522 @ u34:
358// pin 2 (PA0) :
359// pin 3 (PA1) :
360// pin 4 (PA2) :
361// pin 5 (PA3) :
362// pin 6 (PA4) :
363// pin 7 (PA5) :
364// pin 8 (PA6) :
365// pin 9 (PA7) :
366// pin 10 (PB0) :
367// pin 11 (PB1) :
368// pin 12 (PB2) :
369// pin 13 (PB3) :
370// pin 14 (PB4) :
371// pin 15 (PB5) :
372// pin 16 (PB6) :
373// pin 17 (PB7) :
374// pin 18 (CB1) : ?from/to? Floppy connector j3 pin 8
375// pin 19 (CB2) : ?from/to? 6522 @ u35 pin 16 (PB6)
376// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41
377// pin 22 (R/W) : in from 68008 R/W pin 30
378// pin 23 (/CS2) : in from DECODE E pin 18
379// pin 24 (CS1) : in from 68008 A13 pin 11
380// pin 25 (Phi2) : in from 68008 E pin 38
381// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27
382// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36
383// pins 35-38 (RS3-RS0) are 68008 A9-A6 pins 7-4
384// pin 39 (CA2) is through inductor L11 and resistor r128 to peripheral connector pin 35 <end minus 26>
385// pin 40 (CA1) is through inductor L30 and resistor r138 to peripheral connector pin 53 <end minus 8>
386
387// 6522 @ u35
388// pin 2 (PA0) :
389// pin 3 (PA1) :
390// pin 4 (PA2) :
391// pin 5 (PA3) :
392// pin 6 (PA4) :
393// pin 7 (PA5) :
394// pin 8 (PA6) :
395// pin 9 (PA7) :
396// pin 10 (PB0) :
397// pin 11 (PB1) : in from 74hc02 @ u36 pin 4
398// pin 12 (PB2) :
399// pin 13 (PB3) :
400// pin 14 (PB4) :
401// pin 15 (PB5) :
402// pin 16 (PB6) : 6522 @ u34 pin 19 (CB2)
403// pin 17 (PB7) : mc6850 @ u33 pins 3 and 4 (RX_CLK, TX_CLK)
404// pin 18 (CB1) : ds1489an @ u45 pin 11
405// pin 19 (CB2) : mn4053b @ u40 pin 11 and mc14412 @ u41 pin 10
406// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41
407// pin 22 (R/W) : in from 68008 R/W pin 30
408// pin 23 (/CS2) : in from DECODE E pin 18
409// pin 24 (CS1) : in from 68008 A14 pin 12
410// pin 25 (Phi2) : in from 68008 E pin 38
411// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27
412// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36
413// pins 35-38 (RS3-RS0) : in from 68008 A9-A6 pins 7-4
414// pin 39 (CA2) : out to 74HCT34 pin 11 (CLK) (keyboard column latch)
415// pin 40 (CA1) : out? to? ds1489an @ u45 pin 8
416
417// 74hc02 @ u36:
418// pin 1 (Y1) : out to mc6850 @ u33 pin 23 /DCD
419// pin 2 (A1) : in from (2 places: resistor R58 to ua339 @ u38 pin 4 (In1-)) <where does this actually come from? modem offhook?>
420// pin 3 (B1) : in from mn4053b @ u40  pin 10 <probably from rs232>
421// pin 4 (Y2) : out to 6522 @u35 pin 11
422// pin 5 (A2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) <ring indicator?>
423// pin 6 (B2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) <ring indicator?>
424// pin 8 (B3) :
425// pin 9 (A3) :
426// pin 10 (Y3) :
427// pin 11 (B4) : in from 68008 A15
428// pin 12 (A4) : in from 68008 A15
429// pin 13 (Y4) : out to EPROM @ U31 /CE
430
431332****************************************************************************/
432333
433334// Defines
r243192r243193
13641265x   x   x   x   0   0   ?   ?   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *        R   ROM-HI (/LOCE is 1, /HICE is 0)
13651266x   x   x   x   0   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   a        RW  RAM
13661267x   x   x   x   1   1  ?0? ?1?  ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   *   *   *   *        R   ? status of something? floppy?
1367x   x   x   x   1   1  ?1? ?0?  ?   0   0   1   x   x   x   x   x   x   x   x   x   x   x   *        RW  6850 acia @U33, gets 0x55 steadystate and 0x57 written to it to reset it
1368x   x   x   x   1   1  ?1? ?0?  ?   0   1   0   x   x   *   *   *   *   x   x   x   x   x   x        RW  Parallel VIA 0 @ U34
1369x   x   x   x   1   1  ?1? ?0?  ?   1   0   0   x   x   *   *   *   *   x   x   x   x   x   x        RW  Keyboard VIA 1 @ U35
1268x   x   x   x   1   1  ?1? ?0?  ?   0   0   1   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?        ?R?W   6850 acia control reg lives here, gets 0x55 steadystate and 0x57 written to it to reset it
1269x   x   x   x   1   1  ?1? ?0?  ?   0   1   0   ?   ?   *   *   *   *  ?*?  ?   ?   ?   ?   ?        RW  VIA 0
1270x   x   x   x   1   1  ?1? ?0?  ?   1   0   0   ?   ?   *   *   *   *  ?*?  ?   ?   ?   ?   ?        RW  VIA 1
13701271              ^               ^               ^               ^               ^
1371
13721272*/
13731273
13741274/* Swyft rom and ram notes:
r243192r243193
16781578   MCFG_VIDEO_START_OVERRIDE(cat_state,swyft)
16791579
16801580   MCFG_DEVICE_ADD("acia6850", ACIA6850, 0)
1681   // acia rx and tx clocks come from one of the VIA pins and are tied together, fix this below? acia e clock comes from 68008
1682   MCFG_DEVICE_ADD("acia_clock", CLOCK, (XTAL_15_8976MHz/2)/5) // out e clock from 68008, ~ 10in clocks per out clock
1581
1582   MCFG_DEVICE_ADD("acia_clock", CLOCK, 3579545) // guess
16831583   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(cat_state, write_acia_clock))
16841584
1685   MCFG_DEVICE_ADD("via6522_0", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008
1585   MCFG_DEVICE_ADD("via6522_0", VIA6522, XTAL_15_8976MHz/16) // unknown clock, GUESSED
16861586   MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via0_pa_r))
16871587   MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via0_pb_r))
16881588   MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via0_pa_w))
r243192r243193
16921592   MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via0_cb2_w))
16931593   MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via0_int_w))
16941594
1695   MCFG_DEVICE_ADD("via6522_1", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008
1595   MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_15_8976MHz/16) // unknown clock, GUESSED
16961596   MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via1_pa_r))
16971597   MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via1_pb_r))
16981598   MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via1_pa_w))
r243192r243193
17231623    */
17241624   /* U9: Timing AMPAL16R4
17251625    *
1726    * pins:
1727    * 111111111000000000
1728    * 987654321987654321
1729    * ??QQQQ??EIIIIIIIIC
1730    * |||||||||||||||||\-< /CK input - 15.8976mhz crystal and transistor oscillator
1731    * ||||||||||||||||\--< ?
1732    * |||||||||||||||\---< ?
1733    * ||||||||||||||\----< ?
1734    * |||||||||||||\-----< ?<also input to decode pal pin 1, video pal pin 1, source is ?>
1735    * ||||||||||||\------< ?
1736    * |||||||||||\-------< ?
1737    * ||||||||||\--------< ?
1738    * |||||||||\---------< ?
1739    * ||||||||\----------< /OE input - shorted to GND
1740    * |||||||\-----------? ?
1741    * ||||||\------------? ?
1742    * |||||\------------Q> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector)
1743    * ||||\-------------Q? ?
1744    * |||\--------------Q? ?
1745    * ||\---------------Q> output to decode pal pin 2
1746    * |\----------------->? output? to ram multiplexer 'A' pins
1747    * \------------------< ?
1748    */
1749   ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3))
1750   /* U20: Decode AMPAL16L8
1626    * input
1627    * 76543210
1628    * |||||||\-- ?
1629    * ||||||\--- ?
1630    * |||||\---- ?
1631    * ||||\----- ?
1632    * |||\------ ?
1633    * ||\------- ?
1634    * |\-------- ?
1635    * \--------- ?
1636    * /CK ------ 15.8976mhz crystal and transistor oscillator
1637    * /OE ------ ?
17511638    *
1752    * pins:
1753    * 111111111000000000
1754    * 987654321987654321
1755    * O??????OIIIIIIIIII
1756    * |||||||||||||||||\-< TIMING PAL pin 5
1757    * ||||||||||||||||\--< TIMING PAL pin 17
1758    * |||||||||||||||\---< 68008 R/W (pin 30)
1759    * ||||||||||||||\----< 68008 /DS (pin 29)
1760    * |||||||||||||\-----< 68008 E (pin 38)
1761    * ||||||||||||\------< 68008 A19
1762    * |||||||||||\-------< 68008 A18
1763    * ||||||||||\--------< 68008 A17
1764    * |||||||||\---------< 68008 A16
1765    * ||||||||\----------< ?
1766    * |||||||\-----------> ?
1767    * ||||||\------------? 68008 /VPA (pin 39)
1768    * |||||\-------------> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector)
1769    * ||||\--------------? ?
1770    * |||\---------------? ?
1771    * ||\----------------? ?
1772    * |\-----------------? goes to j9 connector pin 5
1773    * \------------------< ?
1639    * output
1640    * 76543210
1641    * |||||||\-- ?
1642    * ||||||\--- ?
1643    * |||||\-R-- ?
1644    * ||||\--R-- ?
1645    * |||\---R-- ?
1646    * ||\----R-- ?
1647    * |\-------- ?
1648    * \--------- ?
17741649    */
1650   ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3))
17751651   ROM_LOAD( "decode_e.ampal16l8.u20.jed", 0x1000, 0xb08, CRC(0b1dbd76) SHA1(08c144ad7a7bbdd53eefd271b2f6813f8b3b1594))
17761652   ROM_LOAD( "video_2b.ampal16r4.u25.jed", 0x2000, 0xb08, CRC(caf91148) SHA1(3f8ddcb512a1c05395c74ad9a6ba7b87027ce4ec))
17771653   ROM_LOAD( "disk_3.5c.ampal16r4.u28.jed", 0x3000, 0xb08, CRC(fd994d02) SHA1(f910ab16587dd248d63017da1e5b37855e4c1a0c))
trunk/src/mess/drivers/cnsector.c
r243192r243193
155155
156156static INPUT_PORTS_START( cnsector )
157157   PORT_START("IN.0") // O0
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship")
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Left")
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship")
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("Left")
160160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range")
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range")
162162
163163   PORT_START("IN.1") // O1
164   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim")
165   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Right")
164   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim")
165   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("Right")
166166   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
167167   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
168168
169169   PORT_START("IN.2") // O2
170   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire")
171   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("Evasive Sub") // expert button
170   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire")
171   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME("Evasive Sub") // expert button
172172   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall")
173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall")
174174
175175   PORT_START("IN.3") // O3
176   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button
177   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Slower")
176   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button
177   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("Slower")
178178   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
179179   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
180180
181181   PORT_START("IN.4") // O4
182   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode")
183   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Faster")
182   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode")
183   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("Faster")
184184   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship")
185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship")
186186INPUT_PORTS_END
187187
188188
trunk/src/mess/drivers/comp4.c
r243192r243193
140140
141141static INPUT_PORTS_START( comp4 )
142142   PORT_START("IN.0") // O1
143   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R")
144   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
145   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
146   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
143   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R")
144   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
145   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
146   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
147147
148148   PORT_START("IN.1") // O2
149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
152   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
152   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
153153
154154   PORT_START("IN.2") // O3
155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E")
156   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
158   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E")
156   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
158   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
159159INPUT_PORTS_END
160160
161161
trunk/src/mess/drivers/elecdet.c
r243192r243193
186186
187187static INPUT_PORTS_START( elecdet )
188188   PORT_START("IN.0") // O0 pin18
189   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
189   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
190190   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
191   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
192   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Private Question")
193   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
191   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
192   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Private Question")
193   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
194194
195195   PORT_START("IN.1") // O1 pin17
196196   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
197197   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
198   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
199   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter")
198   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
199   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter")
200200   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
201201
202202   PORT_START("IN.2") // O4 pin14
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
204204   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
205   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
206   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("I Accuse")
207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
205   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
206   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("I Accuse")
207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
208208
209209   PORT_START("IN.3") // O6 pin12
210   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
210   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
211211   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
212   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
213   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Suspect")
214   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
212   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
213   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("Suspect")
214   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
215215
216216   // note: even though power buttons are on the matrix, they are not CPU-controlled
217217   PORT_START("IN.4") // Vss!
218   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, elecdet_state, power_button, (void *)true)
218   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, elecdet_state, power_button, (void *)true)
219219   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
220220   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
221   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("End Turn")
222   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, elecdet_state, power_button, (void *)false)
221   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("End Turn")
222   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, elecdet_state, power_button, (void *)false)
223223INPUT_PORTS_END
224224
225225
r243192r243193
297297
298298ROM_START( elecdet )
299299   ROM_REGION( 0x1000, "maincpu", 0 )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(8160a081) SHA1(14cbfc0529ad83a58e0dc15fe8ba594947e49f08) )
301301
302302   ROM_REGION( 1246, "maincpu:ipla", 0 )
303303   ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) )
trunk/src/mess/drivers/excali64.c
r243192r243193
1919
2020ToDo:
2121- Colours are approximate.
22- Disk controller, works with old wd17xx but crashes on new wd.
2223- Hardware supports 20cm and 13cm floppies, but we only support 13cm as this
2324  is the only software that exists.
2425- The schematic shows the audio counter connected to 2MHz, but this produces
r243192r243193
2829
2930****************************************************************************/
3031
31#define NEWFDC 1
32#define NEWFDC 0
3233
3334
3435#include "emu.h"
r243192r243193
251252FLOPPY_FORMATS_END
252253
253254static SLOT_INTERFACE_START( excali64_floppies )
254   SLOT_INTERFACE( "drive0", FLOPPY_525_QD )
255   SLOT_INTERFACE( "drive1", FLOPPY_525_QD )
255   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
256256SLOT_INTERFACE_END
257257#else
258258static LEGACY_FLOPPY_OPTIONS_START(excali64)
r243192r243193
654654#if NEWFDC
655655   MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 16)
656656   MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w))
657   MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "drive0", excali64_state::floppy_formats)
658   MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "drive1", excali64_state::floppy_formats)
657   MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "525dd", excali64_state::floppy_formats)
658   MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", excali64_state::floppy_formats)
659659#else
660660   MCFG_DEVICE_ADD("fdc", WD2793, 0)
661661   MCFG_WD17XX_DEFAULT_DRIVE2_TAGS
r243192r243193
693693   ROM_FILL(0x4ef, 1, 8)
694694   ROM_FILL(0x4f6, 1, 0)
695695   ROM_FILL(0x4f7, 1, 8)
696   // patch out the protection
697   ROM_FILL(0x3ce7, 1, 0)
698696
699697   ROM_REGION(0x10000, "rambank", ROMREGION_ERASE00)
700698   ROM_REGION(0xA000, "videoram", ROMREGION_ERASE00)
trunk/src/mess/drivers/gamate.c
r243192r243193
2020      : driver_device(mconfig, type, tag)
2121      , m_maincpu(*this, "maincpu")
2222      , m_cart(*this, "cartslot")
23#ifdef USE_GFX
23#ifdef USE_GFX     
2424      , m_gfxdecode(*this, "gfxdecode")
2525#endif
2626      , m_io_joy(*this, "JOY")
r243192r243193
5353
5454   struct
5555   {
56   UINT8 reg[8];
57   struct {
58      bool write;
59      bool page2; // else page1
56     UINT8 reg[8];
57     struct {
58       bool write;
59       bool page2; // else page1
6060   UINT8 ypos, xpos/*tennis*/;
61      UINT8 data[2][0x100][0x20];
62      } bitmap;
63   UINT8 x, y;
61       UINT8 data[2][0x100][0x20];
62     } bitmap;
63     UINT8 x, y;
6464      bool y_increment;
6565   } video;
6666
6767   struct {
68      bool set;
68     bool set;
6969      int bit_shifter;
7070      UINT8 cartridge_byte;
7171      UINT16 address; // in reality something more like short local cartridge address offset
7272      bool unprotected;
7373      bool failed;
74
74     
7575   } card_protection;
7676
7777   required_device<cpu_device> m_maincpu;
r243192r243193
8484   required_shared_ptr<UINT8> m_bios;
8585   emu_timer *timer1;
8686   emu_timer *timer2;
87   UINT8 bank_multi;
88   UINT8 *m_cart_ptr;
87   UINT8 bank_multi; 
8988};
9089
9190WRITE8_MEMBER( gamate_state::gamate_cart_protection_w )
9291{
93      logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
94
92        logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
93 
9594   switch (offset) {
9695   case 0:
9796      card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0);
9897      card_protection.bit_shifter++;
9998      if (card_protection.bit_shifter>=8) {
100         card_protection.cartridge_byte=m_cart_ptr[card_protection.address++];
99         card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];
101100         card_protection.bit_shifter=0;
102101      }
103102      break;
r243192r243193
105104}
106105READ8_MEMBER( gamate_state::gamate_cart_protection_r )
107106{
108   UINT8 ret=1;
109   if (card_protection.bit_shifter==7 && card_protection.unprotected) {
110   ret=m_cart_ptr[bank_multi*0x4000];
111   } else {
107
108  UINT8 ret=1;
109  if (card_protection.bit_shifter==7 && card_protection.unprotected) {
110    ret=m_cart->get_rom_base()[bank_multi*0x4000];
111  } else {
112112   card_protection.bit_shifter++;
113113   if (card_protection.bit_shifter==8) {
114114      card_protection.bit_shifter=0;
r243192r243193
117117   }
118118   ret=(card_protection.cartridge_byte&0x80)?2:0;
119119   if (card_protection.bit_shifter==7 && !card_protection.failed) { // now protection chip on cartridge activates cartridge chip select on cpu accesses
120//        m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working
120//        m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working
121121   }
122122   card_protection.cartridge_byte<<=1;
123   }
124   logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
125   return ret;
123  }
124  logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
125  return ret;
126126}
127127
128128READ8_MEMBER( gamate_state::protection_r ) { return card_protection.set? 3: 1; } // bits 0 and 1 checked
129129
130130WRITE8_MEMBER( gamate_state::protection_reset )
131131{
132   // writes 0x20
133   card_protection.address=0x6005-0x6001;
134   card_protection.bit_shifter=0;
135   card_protection.cartridge_byte=m_cart_ptr[card_protection.address++];//m_cart_rom[card_protection.address++];
136   card_protection.failed=false;
137   card_protection.unprotected=false;
132  // writes 0x20
133  card_protection.address=0x6005-0x6001;
134  card_protection.bit_shifter=0;
135  card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];//m_cart_rom[card_protection.address++];
136  card_protection.failed=false;
137  card_protection.unprotected=false;
138138}
139139
140140READ8_MEMBER( gamate_state::newer_protection_set )
141141{
142   card_protection.set=true;
143   return 0;
142  card_protection.set=true;
143  return 0;
144144}
145145
146146
147147WRITE8_MEMBER( gamate_state::gamate_video_w )
148148{
149   video.reg[offset]=data;
150   switch (offset) {
151   case 1: video.bitmap.write=data&0xc0; // more addressing mode
149  video.reg[offset]=data;
150  switch (offset) {
151  case 1: video.bitmap.write=data&0xc0; // more addressing mode
152152      video.y_increment=data&0x40;
153153      break;
154154   case 2: video.bitmap.xpos=data;break; // at least 7 bits
155155   case 3: video.bitmap.ypos=data;break; // at least 7 bits
156   case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
157   case 5: video.y=data;break;
158   case 7:
159   if (video.bitmap.write) {
160      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
161      video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
162      else
163      logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
164   } else {
165      video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
166   }
167   if (video.y_increment) video.y++;
156  case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
157  case 5: video.y=data;break;
158  case 7:
159    if (video.bitmap.write) {
160      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
161        video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
162      else
163        logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
164    } else {
165        video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
166    }
167    if (video.y_increment) video.y++;
168168      else video.x++;
169   }
169  }
170170}
171171
172172WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w )
173173{
174   bank_multi=data;
175   membank("bankmulti")->set_base(m_cart_ptr+0x4000*data+1);
174  bank_multi=data;
175  membank("bankmulti")->set_base(m_cart->get_rom_base()+0x4000*data+1);
176176}
177177
178178WRITE8_MEMBER( gamate_state::cart_bankswitch_w )
179179{
180   membank("bank")->set_base(m_cart_ptr+0x4000*data);
180   membank("bank")->set_base(m_cart->get_rom_base()+0x4000*data);
181181}
182182
183183READ8_MEMBER( gamate_state::gamate_video_r )
184184{
185185   if (offset!=6) return 0;
186   UINT8 data=0;
187   if (video.bitmap.write) {
188      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
189      data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
190      else
191      logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
192   } else {
193   data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
194   }
195   if (m_maincpu->pc()<0xf000)
196   logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
197   return data;
186  UINT8 data=0;
187  if (video.bitmap.write) {
188      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
189        data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
190      else
191        logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
192  } else {
193    data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
194  }
195  if (m_maincpu->pc()<0xf000)
196    logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
197  return data;
198198}
199199
200200WRITE8_MEMBER( gamate_state::gamate_audio_w )
201201{
202   logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
202  logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
203203}
204204
205205READ8_MEMBER( gamate_state::gamate_audio_r )
206206{
207   logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
207  logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
208208   return 0;
209209}
210210
211211
212212READ8_MEMBER( gamate_state::gamate_pad_r )
213213{
214   UINT8 data=m_io_joy->read();
215   return data;
214  UINT8 data=m_io_joy->read();
215  return data;
216216}
217217
218218static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state )
219   AM_RANGE(0x0000, 0x03ff) AM_RAM
220   AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
221   AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
222   AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
223   AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set)
224   AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset)
225   AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
219    AM_RANGE(0x0000, 0x03ff) AM_RAM
220  AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
221  AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
222  AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
223  AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set)
224  AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset)
225  AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
226226
227   AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti")
228   AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
227  AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti")
228  AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
229229
230230   AM_RANGE(0x6000, 0x6000) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w)
231231   AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w)
232232   AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w)
233233
234   AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
234  AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
235235ADDRESS_MAP_END
236236
237237
r243192r243193
250250#ifdef USE_GFX
251251static const struct gfx_layout gamate_charlayout =
252252{
253      4,      /* width of object */
254      1,      /* height of object */
255      256,/* 256 characters */
256      2,      /* bits per pixel */
257      { 0,4 }, /* no bitplanes */
258      /* x offsets */
259      { 0,1,2,3 },
260      /* y offsets */
261      { 0 },
262      8*1 /* size of 1 object in bits */
253        4,      /* width of object */
254        1,      /* height of object */
255        256,/* 256 characters */
256        2,      /* bits per pixel */
257        { 0,4 }, /* no bitplanes */
258        /* x offsets */
259        { 0,1,2,3 },
260        /* y offsets */
261        { 0 },
262        8*1 /* size of 1 object in bits */
263263};
264264
265265static GFXDECODE_START( gamate )
266      GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
266        GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
267267GFXDECODE_END
268268#endif
269269
270270/* palette in red, green, blue tribles */
271271static const unsigned char gamate_colors[4][3] =
272272{
273   { 255,255,255 },
274   { 0xa0, 0xa0, 0xa0 },
275   { 0x60, 0x60, 0x60 },
276   { 0, 0, 0 }
273  { 255,255,255 },
274  { 0xa0, 0xa0, 0xa0 },
275  { 0x60, 0x60, 0x60 },
276  { 0, 0, 0 }
277277};
278278
279279PALETTE_INIT_MEMBER(gamate_state, gamate)
r243192r243193
298298
299299UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
300300{
301   int x, y, j;
302   for (y=0;y<152;y++) {
303   for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
304      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
305      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
301  int x, y, j;
302  for (y=0;y<152;y++) {
303    for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
304      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
305      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
306306#ifdef USE_GFX
307      m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1&0xf)|((d2&0xf)<<4), 0,0,0,x+4,y);
307      m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1&0xf)|((d2&0xf)<<4), 0,0,0,x+4,y);
308308   m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1>>4)|(d2&0xf0),0,0,0,x,y);
309309#else
310      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
311      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
312#endif
313   }
314   }
315   return 0;
310      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
311      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
312#endif     
313    }
314  }
315  return 0;
316316}
317317
318318DRIVER_INIT_MEMBER(gamate_state,gamate)
r243192r243193
321321#ifdef USE_GFX
322322   UINT8 *gfx=memregion("gfx1")->base();
323323   for (int i=0; i<256; i++) gfx[i]=i;
324#endif
324#endif   
325325   timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this));
326326   timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this));
327327}
r243192r243193
329329
330330void gamate_state::machine_start()
331331{
332   m_cart_ptr = memregion("maincpu")->base() + 0x6000;
333332   if (m_cart->exists()) {
334//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
335      m_cart_ptr = m_cart->get_rom_base();
333//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
336334      membank("bankmulti")->set_base(m_cart->get_rom_base()+1);
337335      membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset
338336   }
339//  m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
337//   m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
340338   card_protection.set=false;
341339   bank_multi=0;
342340   card_protection.unprotected=false;
r243192r243193
389387
390388#ifdef USE_GFX
391389   MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
392#endif
390#endif   
393391   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
394392   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
395393   MCFG_DEFAULT_LAYOUT(layout_lcd)
r243192r243193
407405   ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) )
408406   ROM_SYSTEM_BIOS(1, "newer", "NEWER")
409407   ROMX_LOAD("gamate_bios_9130__unknown__bit_icasc00001_9130-bs_r32261.bin", 0xf000, 0x1000, CRC(03a5f3a7) SHA1(4e9dfbfe916ca485530ef4221593ab68738e2217), ROM_BIOS(2) )
410#ifdef USE_GFX
408#ifdef USE_GFX   
411409   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
412#endif
410#endif   
413411ROM_END
414412
415413
416414/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
417415CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND)
416
417
trunk/src/mess/drivers/hp16500.c
r243192r243193
1919    MC68000 @ 10 MHz
2020    MC68A45 CRTC
2121    Z0765A08PSC floppy controller (NEC765 type)
22    TMS9914A GPIB bus interface
22   TMS9914A GPIB bus interface
2323    SCN2661 DUART/timer
2424
2525  16500b:
r243192r243193
5050#include "video/mc6845.h"
5151#include "machine/mc68681.h"
5252
53#define MAINCPU_TAG "maincpu"
54#define CRTC_TAG    "crtc"
55#define SCREEN_TAG  "screen"
56#define DUART_TAG   "duart"
53#define MAINCPU_TAG   "maincpu"
54#define CRTC_TAG   "crtc"
55#define SCREEN_TAG   "screen"
56#define DUART_TAG   "duart"
5757
5858class hp16500_state : public driver_device
5959{
trunk/src/mess/drivers/hp9k_3xx.c
r243192r243193
11// license:BSD-3-Clause
22// copyright-holders:R. Belmont
33/***************************************************************************
4
4
55  hp9k3xx.c: preliminary driver for HP9000 300 Series (aka HP9000/3xx)
66
77  Currently supporting:
r243192r243193
1616      MC68881 FPU
1717
1818  330:
19      MC68020 CPU @ 16.67 MHz
20      MC68851 MMU
21      MC68881 FPU
19     MC68020 CPU @ 16.67 MHz
20     MC68851 MMU
21     MC68881 FPU
2222
2323  340:
2424      MC68030 CPU @ 16.67 MHz w/built-in MMU
25      MC68881 FPU
25     MC68881 FPU
2626
2727  380:
2828    MC68040 CPU @ 25 MHz w/built-in MMU and FPU
2929
3030  382:
3131    MC68040 CPU @ 25? MHz w/built-in MMU and FPU
32    Built-in VGA compatible video
32   Built-in VGA compatible video
3333
3434  All models have an MC6840 PIT on IRQ6 clocked at 250 kHz.
3535
r243192r243193
132132
133133// shared mappings for all 9000/3xx systems
134134static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state)
135   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP  // writes to 1fffc are the LED
135   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP   // writes to 1fffc are the LED
136136
137   AM_RANGE(0x00500000, 0x0050000f) AM_RAM // this is sufficient to pass the DMA test for now
137   AM_RANGE(0x00500000, 0x0050000f) AM_RAM   // this is sufficient to pass the DMA test for now
138138
139   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)   // no "Alpha display"
140   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
141   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
139   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)    // no "Alpha display"
140   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
141   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
142142   AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff)
143143ADDRESS_MAP_END
144144
145145// 9000/310 - has onboard video that the graphics card used in other 3xxes conflicts with
146146static ADDRESS_MAP_START(hp9k310_map, AS_PROGRAM, 16, hp9k3xx_state)
147   AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP  // writes to 1fffc are the LED
147   AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP   // writes to 1fffc are the LED
148148
149   AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Alpha display"
150   AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Graphics"
151   AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w)   // no add-on FP coprocessor
149   AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w)    // no "Alpha display"
150   AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Graphics"
151   AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w)   // no add-on FP coprocessor
152152
153153   AM_RANGE(0x5f8000, 0x5f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff)
154154
155   AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16")  // 98544 mono framebuffer
156   AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
155   AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16")   // 98544 mono framebuffer
156   AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
157157
158158   AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(buserror16_r, buserror16_w)
159159   AM_RANGE(0x800000, 0xffffff) AM_RAM
r243192r243193
161161
162162// 9000/320
163163static ADDRESS_MAP_START(hp9k320_map, AS_PROGRAM, 32, hp9k3xx_state)
164   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
165   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
164   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
165   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
166166
167167   AM_RANGE(0xffe00000, 0xffefffff) AM_READWRITE(buserror_r, buserror_w)
168168   AM_RANGE(0xfff00000, 0xffffffff) AM_RAM
r243192r243193
172172
173173// 9000/330 and 9000/340
174174static ADDRESS_MAP_START(hp9k330_map, AS_PROGRAM, 32, hp9k3xx_state)
175   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
176   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
175   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
176   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
177177
178178   AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w)
179179   AM_RANGE(0xffc00000, 0xffffffff) AM_RAM
r243192r243193
183183
184184// 9000/370 - 8 MB RAM standard
185185static ADDRESS_MAP_START(hp9k370_map, AS_PROGRAM, 32, hp9k3xx_state)
186   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
187   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
186   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
187   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
188188
189189   AM_RANGE(0xff700000, 0xff7fffff) AM_READWRITE(buserror_r, buserror_w)
190190   AM_RANGE(0xff800000, 0xffffffff) AM_RAM
r243192r243193
292292   MCFG_CPU_PROGRAM_MAP(hp9k310_map)
293293
294294   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
295   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
295   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
296296   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
297297
298298   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
308308   MCFG_CPU_PROGRAM_MAP(hp9k320_map)
309309
310310   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
311   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
311   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
312312   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
313313
314314   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
324324   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
325325
326326   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
327   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
327   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
328328   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
329329
330330   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
340340   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
341341
342342   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
343   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
343   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
344344   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
345345
346346   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
356356   MCFG_CPU_PROGRAM_MAP(hp9k370_map)
357357
358358   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
359   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
359   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
360360   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
361361
362362   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
368368
369369static MACHINE_CONFIG_START( hp9k380, hp9k3xx_state )
370370   /* basic machine hardware */
371   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz?  33?
371   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000)   // 25 MHz?  33?
372372   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
373373
374374   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
375   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
375   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
376376   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
377377
378378   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
384384
385385static MACHINE_CONFIG_START( hp9k382, hp9k3xx_state )
386386   /* basic machine hardware */
387   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz?  33?
387   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000)   // 25 MHz?  33?
388388   MCFG_CPU_PROGRAM_MAP(hp9k382_map)
389389
390390   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
391   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
391   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
392392   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
393393
394394   MCFG_SCREEN_ADD( "screen", RASTER)
r243192r243193
400400
401401ROM_START( hp9k310 )
402402   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
403   ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) )
404   ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) )
403   ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) )
404   ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) )
405405
406406   ROM_REGION( 0x800, "mcu", 0 )
407   ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
408   ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) )
407   ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
408   ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) )
409409
410410   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE )
411411   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243192r243193
413413
414414ROM_START( hp9k320 )
415415   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
416   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
417   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
418   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
419   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
416   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
417   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
418   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
419   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
420420
421421   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
422422   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243192r243193
424424
425425ROM_START( hp9k330 )
426426   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
427   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
428   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
427   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
428   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
429429
430430   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
431431   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243192r243193
433433
434434ROM_START( hp9k340 )
435435   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
436   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
437   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
436   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
437   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
438438
439439   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
440440   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
trunk/src/mess/drivers/mathmagi.c
r243192r243193
131131
132132static INPUT_PORTS_START( mathmagi )
133133   PORT_START("IN.0") // R3
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-")
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-")
138138
139139   PORT_START("IN.1") // R5
140   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
141   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("_") // blank
142   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("r")
143   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+")
140   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
141   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("_") // blank
142   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("r")
143   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+")
144144
145145   PORT_START("IN.2") // R6
146   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
147   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
148   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
149   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY)
146   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
147   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
148   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
149   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY)
150150
151151   PORT_START("IN.3") // R7
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL")
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("NXT")
154   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("?") // check
155   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=")
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL")
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("NXT")
154   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("?") // check
155   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=")
156156
157157   PORT_START("IN.4") // R9
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE)
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE)
162162
163163   PORT_START("IN.5") // R10
164164   PORT_CONFNAME( 0x01, 0x00, "Players")
trunk/src/mess/drivers/merlin.c
r243192r243193
123123
124124static INPUT_PORTS_START( merlin )
125125   PORT_START("IN.0") // O0
126   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0")
127   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 1")
128   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 3")
129   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 2")
126   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0")
127   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 1")
128   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 3")
129   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 2")
130130
131131   PORT_START("IN.1") // O1
132   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4")
133   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5")
134   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 7")
135   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6")
132   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4")
133   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5")
134   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON8) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 7")
135   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6")
136136
137137   PORT_START("IN.2") // O2
138   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 8")
139   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 9")
140   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Same Game")
141   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10")
138   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 8")
139   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 9")
140   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON12) PORT_CODE(KEYCODE_S) PORT_NAME("Same Game")
141   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON11) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10")
142142
143143   PORT_START("IN.3") // O3
144144   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
145   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Comp Turn")
146   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Hit Me")
147   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game")
145   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON13) PORT_CODE(KEYCODE_C) PORT_NAME("Comp Turn")
146   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON15) PORT_CODE(KEYCODE_H) PORT_NAME("Hit Me")
147   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON14) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game")
148148INPUT_PORTS_END
149149
150150
trunk/src/mess/drivers/nes.c
r243192r243193
4848   // 0x8000-0xffff -> HIGH HANDLER defined on a pcb base
4949ADDRESS_MAP_END
5050
51
52static INPUT_PORTS_START( nes_pads12 )
53   PORT_START("PAD1")
54   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 A") PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
55   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 B") PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
56   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)                     PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
57   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)                      PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
58   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)                PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
59   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)              PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
60   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)              PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
61   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
62
63   PORT_START("PAD2")
64   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 A") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
65   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 B") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
66   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(2)                     PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
67   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2)                      PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
68   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)                PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
69   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
70   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
71   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
72INPUT_PORTS_END
73
74static INPUT_PORTS_START( nes_pads34 )
75   PORT_START("PAD3")
76   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 A") PORT_PLAYER(3)  PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
77   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 B") PORT_PLAYER(3)  PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
78   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(3)                     PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
79   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(3)                      PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
80   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3)                PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
81   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)              PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
82   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)              PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
83   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)             PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
84
85   PORT_START("PAD4")
86   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 A") PORT_PLAYER(4)  PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
87   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 B") PORT_PLAYER(4)  PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
88   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(4)                     PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
89   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(4)                      PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
90   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4)                PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
91   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)              PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
92   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)              PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
93   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)             PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
94INPUT_PORTS_END
95
96
97static INPUT_PORTS_START( nes_powerpad )
98// difference between the two sides is that we mirror the key mapping to match the real pad layout!
99   PORT_START("POWERPAD1")
100// side A layout
101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top1")  PORT_CODE(KEYCODE_Y) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid1")  PORT_CODE(KEYCODE_J) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid2")  PORT_CODE(KEYCODE_H) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low1")  PORT_CODE(KEYCODE_N) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low2")  PORT_CODE(KEYCODE_B) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid3")  PORT_CODE(KEYCODE_G) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
109// side B layout
110   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 2")     PORT_CODE(KEYCODE_T) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
111   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 1")     PORT_CODE(KEYCODE_R) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
112   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 5")     PORT_CODE(KEYCODE_F) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
113   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 9")     PORT_CODE(KEYCODE_V) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
114   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 6")     PORT_CODE(KEYCODE_G) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
115   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 10")    PORT_CODE(KEYCODE_B) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
116   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 11")    PORT_CODE(KEYCODE_N) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
117   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 7")     PORT_CODE(KEYCODE_H) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
118   PORT_START("POWERPAD2")
119// side A layout
120   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
121   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top2")  PORT_CODE(KEYCODE_T) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
122   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
123   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid4")  PORT_CODE(KEYCODE_F) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
124   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0050)
125// side B layout
126   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 4")     PORT_CODE(KEYCODE_U) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
127   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 3")     PORT_CODE(KEYCODE_Y) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
128   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 12")    PORT_CODE(KEYCODE_M) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
129   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 8")     PORT_CODE(KEYCODE_J) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
130   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0060)
131INPUT_PORTS_END
132
133static INPUT_PORTS_START( nes_zapper1 )
134   PORT_START("ZAPPER1_X")
135   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0,255) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
136   PORT_START("ZAPPER1_Y")
137   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0,255) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
138   PORT_START("ZAPPER1_T")
139   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Lightgun Trigger") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
140INPUT_PORTS_END
141
142static INPUT_PORTS_START( nes_zapper2 )
143   PORT_START("ZAPPER2_X")
144   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0,255 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
145   PORT_START("ZAPPER2_Y")
146   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0,255 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
147   PORT_START("ZAPPER2_T")
148   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Lightgun Trigger") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
149INPUT_PORTS_END
150
151static INPUT_PORTS_START( nes_paddle )
152   PORT_START("PADDLE")
153   PORT_BIT( 0xff, 0x7f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x62,0xf2) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0040)
154   PORT_START("PADDLE_BUTTON")
155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle button") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0040)
156INPUT_PORTS_END
157
51158static INPUT_PORTS_START( nes )
52   // input devices go through slot options
159   PORT_INCLUDE( nes_pads12 )
160   PORT_INCLUDE( nes_pads34 )
161   PORT_INCLUDE( nes_powerpad )
162   PORT_INCLUDE( nes_zapper1 )
163   PORT_INCLUDE( nes_zapper2 )
164   PORT_INCLUDE( nes_paddle )
165
166   PORT_START("CTRLSEL")
167   PORT_CONFNAME( 0x000f, 0x0001, "P1 Controller")
168   PORT_CONFSETTING(  0x0000, "Unconnected" )
169   PORT_CONFSETTING(  0x0001, "Gamepad" )
170   PORT_CONFSETTING(  0x0002, "Zapper" )
171   PORT_CONFNAME( 0x00f0, 0x0010, "P2 Controller")
172   PORT_CONFSETTING(  0x0000, "Unconnected" )
173   PORT_CONFSETTING(  0x0010, "Gamepad" )
174   PORT_CONFSETTING(  0x0020, "Zapper" )
175   PORT_CONFSETTING(  0x0040, "Arkanoid paddle" )
176   PORT_CONFSETTING(  0x0050, "Power Pad (Side A layout)" )
177   PORT_CONFSETTING(  0x0060, "Power Pad (Side B layout)" )
178   PORT_CONFNAME( 0x0f00, 0x0000, "P3 Controller")
179   PORT_CONFSETTING(  0x0000, "Unconnected" )
180   PORT_CONFSETTING(  0x0100, "Gamepad" )
181   PORT_CONFNAME( 0xf000, 0x0000, "P4 Controller")
182   PORT_CONFSETTING(  0x0000, "Unconnected" )
183   PORT_CONFSETTING(  0x1000, "Gamepad" )
184
53185   PORT_START("CONFIG")
54186   PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines")
55187   PORT_CONFSETTING(    0x01, DEF_STR(No) )
r243192r243193
59191   PORT_CONFSETTING(    0x00, DEF_STR(Yes) )
60192INPUT_PORTS_END
61193
194
195static INPUT_PORTS_START( fc_pads12 )
196   PORT_START("PAD1")
197   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 A") PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
198   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 B") PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
199   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)                     PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
200   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)                      PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
201   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)                PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
202   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)              PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
203   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)              PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
204   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0001)
205
206   PORT_START("PAD2")
207   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 A") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
208   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 B") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
209   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(2)                     PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
210   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2)                      PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
211   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)                PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
212   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
213   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
214   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0010)
215   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 A") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
216   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 B") PORT_PLAYER(2)  PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
217   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Microphone") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
218   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )                                    PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
219   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)                PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
220   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
221   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)              PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
222   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x00f0)
223INPUT_PORTS_END
224
225static INPUT_PORTS_START( fc_pads34 )
226   PORT_START("PAD3")
227   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 A") PORT_PLAYER(3)  PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
228   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 B") PORT_PLAYER(3)  PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
229   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(3)                     PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
230   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(3)                      PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
231   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3)                PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
232   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)              PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
233   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)              PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
234   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)             PORT_CONDITION("CTRLSEL", 0x0f00, EQUALS, 0x0100)
235
236   PORT_START("PAD4")
237   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 A") PORT_PLAYER(4)  PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
238   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 B") PORT_PLAYER(4)  PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
239   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(4)                     PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
240   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(4)                      PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
241   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4)                PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
242   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)              PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
243   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)              PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
244   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)             PORT_CONDITION("CTRLSEL", 0xf000, EQUALS, 0x1000)
245INPUT_PORTS_END
246
247static INPUT_PORTS_START( fc_lightgun )
248   PORT_START("ZAPPER2_X")
249   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_MINMAX(0,255) PORT_PLAYER(2) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x01)
250   PORT_START("ZAPPER2_Y")
251   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_MINMAX(0,255) PORT_PLAYER(2) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x01)
252   PORT_START("ZAPPER2_T")
253   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger") PORT_PLAYER(2) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x01)
254INPUT_PORTS_END
255
256static INPUT_PORTS_START( fc_paddle )
257   PORT_START("PADDLE")
258   PORT_BIT( 0xff, 0x7f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x62,0xf2) PORT_PLAYER(2) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x04)
259   PORT_START("PADDLE_BUTTON")
260   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle button") PORT_PLAYER(2) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x04)
261INPUT_PORTS_END
262
263static INPUT_PORTS_START( fc_cclimb )
264   PORT_START("CC_LEFT")
265   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
266   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
267   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
268   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)              PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
269   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)    PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
270   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
271   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)  PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
272   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x000f, EQUALS, 0x0002)
273
274   PORT_START("CC_RIGHT")
275   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
276   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
277   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
278   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1)             PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
279   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1)   PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
280   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
281   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
282   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1)PORT_CONDITION("CTRLSEL", 0x00f0, EQUALS, 0x0020)
283INPUT_PORTS_END
284
285static INPUT_PORTS_START( fc_keyboard )
286   PORT_START("FCKEY0")
287   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
288   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)           PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
289   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR('[')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
290   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']')      PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
291   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana")                                PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
292   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)                        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
293   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)    PORT_CHAR('\\') PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
294   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_BACKSPACE)   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
295
296   PORT_START("FCKEY1")
297   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
298   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
299   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')      PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
300   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')      PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
301   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_')                               PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
302   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('/')                               PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
303   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')      PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
304   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('^')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
305
306   PORT_START("FCKEY2")
307   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
308   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
309   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
310   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
311   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
312   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
313   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
314   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
315
316   PORT_START("FCKEY3")
317   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
318   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
319   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
320   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
321   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
322   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
323   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
324   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
325
326   PORT_START("FCKEY4")
327   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
328   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
329   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
330   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
331   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
332   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
333   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
334   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
335
336   PORT_START("FCKEY5")
337   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
338   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
339   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
340   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
341   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
342   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
343   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
344   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
345
346   PORT_START("FCKEY6")
347   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
348   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
349   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
350   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
351   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
352   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
353   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
354   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
355
356   PORT_START("FCKEY7")
357   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))           PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
358   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC))         PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
359   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')                          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
360   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)    PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
361   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)        PORT_CHAR(UCHAR_SHIFT_1)    PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
362   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT)        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
363   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')              PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
364   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')              PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
365
366   PORT_START("FCKEY8")
367   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Clr")                                 PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
368   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP)    PORT_CHAR(UCHAR_MAMEKEY(UP))        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
369   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))     PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
370   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
371   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
372   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)     PORT_CHAR(' ')      PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
373   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL)          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
374   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x02)
375
376INPUT_PORTS_END
377
378static INPUT_PORTS_START( subor_keyboard )
379   PORT_START("SUBKEY0")
380   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
381   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
382   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
383   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
384   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
385   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
386   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
387   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
388
389   PORT_START("SUBKEY1")
390   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
391   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
392   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
393   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
394   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
395   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
396   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
397   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
398
399   PORT_START("SUBKEY2")
400   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
401   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)                PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
402   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT")                                            PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
403   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
404   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
405   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PRIOR")                                       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
406   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
407   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
408
409   PORT_START("SUBKEY3")
410   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
411   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
412   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
413   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
414   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
415   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
416   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
417   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
418
419   PORT_START("SUBKEY4")
420   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR(']')          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
421   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)               PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
422   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
423   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
424   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))       PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
425   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
426   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')         PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
427   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
428
429   PORT_START("SUBKEY5")
430   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
431   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
432   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
433   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB)   PORT_CHAR('\t') PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
434   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))         PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
435   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
436   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
437   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
438
439   PORT_START("SUBKEY6")
440   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
441   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
442   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
443   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
444   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
445   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
446   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
447   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
448
449   PORT_START("SUBKEY7")
450   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
451   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
452   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
453   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
454   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
455   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)     PORT_CHAR('P')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
456   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('=')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
457   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)    PORT_CHAR(UCHAR_SHIFT_1)    PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
458
459   PORT_START("SUBKEY8")
460   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
461   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
462   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
463   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
464   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
465   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
466   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
467   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
468
469   PORT_START("SUBKEY9")
470   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
471
472   PORT_START("SUBKEY10")
473   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LMENU")   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
474   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
475   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
476   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11)       PORT_CHAR(UCHAR_MAMEKEY(F11))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
477   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12)       PORT_CHAR(UCHAR_MAMEKEY(F12))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
478   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
479   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
480   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
481
482   PORT_START("SUBKEY11")
483   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
484   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD)  PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
485   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK)  PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
486   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))     PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
487   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))         PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
488   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))     PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
489   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD)PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD))  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
490   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK)   PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))   PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
491
492   PORT_START("SUBKEY12")
493   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`')                  PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
494   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
495   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE")                                           PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
496   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE2")                                          PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
497   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))           PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
498   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
499   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD)         PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
500   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x03)
501
502INPUT_PORTS_END
503
504static INPUT_PORTS_START( mahjong_panel )
505   PORT_START("MAH0")
506   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
507
508   PORT_START("MAH1")
509   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
510   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
511   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
512   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
513   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_K ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
514   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_J ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
515   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_I ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
516
517   PORT_START("MAH2")
518   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
519   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
520   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
521   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_E ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
522   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_D ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
523   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_C ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
524   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_B ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
525   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
526
527   PORT_START("MAH3")
528   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
529   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_RON ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
530   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
531   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
532   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_PON ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
533   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN ) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
534   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P1 Mahjong Select") PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
535   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Mahjong Start") PORT_CONDITION("EXP", 0x0f, EQUALS, 0x07)
536INPUT_PORTS_END
537
538// these are read differently than the powerpad inputs, but we share the tags, to reduce
539static INPUT_PORTS_START( fc_ftrainer )
540// difference between the two sides is that we mirror the key mapping to match the real pad layout!
541   PORT_START("FT_COL0")
542// side A layout
543   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
544   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid1")  PORT_CODE(KEYCODE_J) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
545   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
546// side B layout
547   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 12")    PORT_CODE(KEYCODE_M) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
548   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 8")     PORT_CODE(KEYCODE_J) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
549   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 4")     PORT_CODE(KEYCODE_U) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
550
551   PORT_START("FT_COL1")
552// side A layout
553   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Low1")  PORT_CODE(KEYCODE_N) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
554   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid2")  PORT_CODE(KEYCODE_H) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
555   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Top1")  PORT_CODE(KEYCODE_Y) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
556// side B layout
557   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 11")    PORT_CODE(KEYCODE_N) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
558   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 7")     PORT_CODE(KEYCODE_H) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
559   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 3")     PORT_CODE(KEYCODE_Y) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
560
561   PORT_START("FT_COL2")
562// side A layout
563   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Low2")  PORT_CODE(KEYCODE_B) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
564   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid3")  PORT_CODE(KEYCODE_G) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
565   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Top2")  PORT_CODE(KEYCODE_T) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
566// side B layout
567   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 10")    PORT_CODE(KEYCODE_B) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
568   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 6")     PORT_CODE(KEYCODE_G) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
569   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 2")     PORT_CODE(KEYCODE_T) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
570
571   PORT_START("FT_COL3")
572// side A layout
573   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
574   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid4")  PORT_CODE(KEYCODE_F) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
575   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("EXP", 0x0f, EQUALS, 0x05)
576// side B layout
577   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 9")     PORT_CODE(KEYCODE_V) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
578   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 5")     PORT_CODE(KEYCODE_F) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
579   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 1")     PORT_CODE(KEYCODE_R) PORT_CONDITION("EXP", 0x0f, EQUALS, 0x06)
580INPUT_PORTS_END
581
582
583
62584static INPUT_PORTS_START( famicom )
63   // input devices go through slot options
585   PORT_INCLUDE( fc_pads12 )
586   PORT_INCLUDE( fc_pads34 )
587   PORT_INCLUDE( fc_lightgun )
588   // FIXME: was it possible to attache two paddles in a Famicom (as the Arkanoid 2 box suggests)?!? investigate...
589   PORT_INCLUDE( fc_paddle )
590   // Crazy Climber is not really a separate controller, but a couple of small sticks to be
591   // put on top of d-pads of the regular controllers. Users should then control the game
592   // by using both controllers, turned 90 degrees, as a couple of dual sticks as in the arcade
593   PORT_INCLUDE( fc_cclimb )
594   PORT_INCLUDE( fc_keyboard )
595   PORT_INCLUDE( subor_keyboard )
596   PORT_INCLUDE( mahjong_panel )
597   PORT_INCLUDE( fc_ftrainer )
598
599   PORT_START("CTRLSEL")
600   PORT_CONFNAME( 0x000f, 0x0001, "P1 Controller")
601   PORT_CONFSETTING(  0x0000, "Unconnected" )
602   PORT_CONFSETTING(  0x0001, "Gamepad" )
603   PORT_CONFSETTING(  0x0002, "Crazy Climber pad (Left)" )
604   PORT_CONFNAME( 0x00f0, 0x0010, "P2 Controller")
605   PORT_CONFSETTING(  0x0000, "Unconnected" )
606   PORT_CONFSETTING(  0x0010, "Gamepad" )
607   PORT_CONFSETTING(  0x0020, "Crazy Climber pad (Right)" )
608   PORT_CONFSETTING(  0x00f0, "Gamepad (Older Version)" )
609   PORT_CONFNAME( 0x0f00, 0x0000, "P3 Controller") PORT_CONDITION("EXP", 0x0f, EQUALS, 0x08)
610   PORT_CONFSETTING(  0x0000, "Unconnected" )
611   PORT_CONFSETTING(  0x0100, "Gamepad" )
612   PORT_CONFNAME( 0xf000, 0x0000, "P4 Controller") PORT_CONDITION("EXP", 0x0f, EQUALS, 0x08)
613   PORT_CONFSETTING(  0x0000, "Unconnected" )
614   PORT_CONFSETTING(  0x1000, "Gamepad" )
615
616   PORT_START("EXP")
617   PORT_CONFNAME( 0x0f, 0x00, "Expansion Port")
618   PORT_CONFSETTING(  0x00, "(Empty)" )
619   PORT_CONFSETTING(  0x01, "Light Gun" )
620   PORT_CONFSETTING(  0x02, "FC Keyboard" )
621   PORT_CONFSETTING(  0x03, "Subor Keyboard" )
622   PORT_CONFSETTING(  0x04, "Arkanoid paddle" )
623   PORT_CONFSETTING(  0x05, "Family Trainer (Side A)" )
624   PORT_CONFSETTING(  0x06, "Family Trainer (Side B)" )
625   PORT_CONFSETTING(  0x07, "Mahjong Panel" )
626   PORT_CONFSETTING(  0x08, "Hori Twin Adapter" )
627
64628   PORT_START("CONFIG")
65629   PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines")
66630   PORT_CONFSETTING(    0x01, DEF_STR(No) )
r243192r243193
70634   PORT_CONFSETTING(    0x00, DEF_STR(Yes) )
71635
72636   PORT_START("FLIPDISK") /* fake key */
73   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Change Disk Side") PORT_CODE(KEYCODE_SPACE)
637   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Change Disk Side")
74638INPUT_PORTS_END
75639
76640
r243192r243193
110674   MCFG_NES_APU_CPU("maincpu")
111675   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
112676
113   MCFG_NES_CONTROL_PORT_ADD("ctrl1", nes_control_port1_devices, "joypad")
114   MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel)
115   MCFG_NES_CONTROL_PORT_ADD("ctrl2", nes_control_port2_devices, "joypad")
116   MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel)
117
118677   MCFG_NES_CARTRIDGE_ADD("nes_slot", nes_cart, NULL)
119678   MCFG_SOFTWARE_LIST_ADD("cart_list", "nes")
120679   MCFG_SOFTWARE_LIST_ADD("ade_list", "nes_ade")         // Camerica/Codemasters Aladdin Deck Enhancer mini-carts
r243192r243193
170729MACHINE_CONFIG_END
171730
172731static MACHINE_CONFIG_DERIVED( famicom, nes )
173   MCFG_DEVICE_REMOVE("ctrl1")
174   MCFG_DEVICE_REMOVE("ctrl2")
175   MCFG_NES_CONTROL_PORT_ADD("ctrl1", fc_control_port1_devices, "joypad")
176   MCFG_NES_CONTROL_PORT_ADD("ctrl2", fc_control_port2_devices, "joypad")
177   MCFG_FC_EXPANSION_PORT_ADD("exp", fc_expansion_devices, NULL)
178   MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel)
732   MCFG_CASSETTE_ADD( "tape" )
733   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
734   MCFG_CASSETTE_INTERFACE("fc_cass")
179735
180736   MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop")
181737   MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass")
r243192r243193
213769MACHINE_START_MEMBER( nes_state, fds )
214770{
215771   m_ciram = auto_alloc_array(machine(), UINT8, 0x800);
772   setup_ioports();
216773   setup_disk(m_disk);
217
218   // register saves
219   save_item(NAME(m_last_frame_flip));
220   save_pointer(NAME(m_ciram), 0x800);
774   state_register();
221775}
222776
223777MACHINE_RESET_MEMBER( nes_state, fds )
r243192r243193
227781
228782   // the rest is the same as for nes/famicom/dendy
229783   m_maincpu->reset();
784
785   memset(m_pad_latch, 0, sizeof(m_pad_latch));
786   memset(m_zapper_latch, 0, sizeof(m_zapper_latch));
787   m_paddle_latch = 0;
788   m_paddle_btn_latch = 0;
230789}
231790
232791static MACHINE_CONFIG_DERIVED( fds, famicom )
233792   MCFG_MACHINE_START_OVERRIDE( nes_state, fds )
234793   MCFG_MACHINE_RESET_OVERRIDE( nes_state, fds )
794   MCFG_DEVICE_REMOVE("tape")
235795
236796   MCFG_DEVICE_REMOVE("nes_slot")
237797   MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0)
r243192r243193
267827
268828   // the rest is the same as for nes/famicom/dendy
269829   m_maincpu->reset();
830
831   memset(m_pad_latch, 0, sizeof(m_pad_latch));
832   memset(m_zapper_latch, 0, sizeof(m_zapper_latch));
833   m_paddle_latch = 0;
834   m_paddle_btn_latch = 0;
270835}
271836
272837static MACHINE_CONFIG_DERIVED( famitwin, famicom )
trunk/src/mess/drivers/ngen.c
r243192r243193
6767#include "machine/pit8253.h"
6868#include "machine/z80dart.h"
6969#include "machine/wd_fdc.h"
70#include "machine/wd2010.h"
7170#include "bus/rs232/rs232.h"
7271#include "machine/ngen_kb.h"
7372#include "machine/clock.h"
74#include "imagedev/harddriv.h"
7573
7674class ngen_state : public driver_device
7775{
r243192r243193
9189      m_fdc(*this,"fdc"),
9290      m_fd0(*this,"fdc:0"),
9391      m_fdc_timer(*this,"fdc_timer"),
94      m_hdc(*this,"hdc"),
95      m_hdc_timer(*this,"hdc_timer"),
96      m_hd_buffer(*this,"hd_buffer_ram")
92      m_hdc_timer(*this,"hdc_timer")
9793   {}
9894
9995   DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
r243192r243193
133129   DECLARE_READ8_MEMBER(irq_cb);
134130   DECLARE_WRITE8_MEMBER(hdc_control_w);
135131   DECLARE_WRITE8_MEMBER(disk_addr_ext);
136   DECLARE_READ8_MEMBER(hd_buffer_r);
137   DECLARE_WRITE8_MEMBER(hd_buffer_w);
138132
139133protected:
140134   virtual void machine_reset();
141   virtual void machine_start();
142135
143136private:
144137   required_device<i80186_cpu_device> m_maincpu;
r243192r243193
154147   optional_device<wd2797_t> m_fdc;
155148   optional_device<floppy_connector> m_fd0;
156149   optional_device<pit8253_device> m_fdc_timer;
157   optional_device<wd2010_device> m_hdc;
158150   optional_device<pit8253_device> m_hdc_timer;
159   optional_shared_ptr<UINT8> m_hd_buffer;
160151
161152   void set_dma_channel(int channel, int state);
162153
r243192r243193
406397
407398// X-bus module select
408399// The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each
409// expansion module.  The base I/O address for the currently selected module is set by writing to
400// expansion module.  The base I/O address for the currently selected module is set by writing to
410401// this register (bits 0-7 are ignored)
411402// TODO: make expansion modules slot devices
412403WRITE16_MEMBER(ngen_state::xbus_w)
r243192r243193
435426READ16_MEMBER(ngen_state::xbus_r)
436427{
437428   UINT16 ret = 0xffff;
438
429   
439430   switch(m_xbus_current)
440431   {
441432      case 0x00:
r243192r243193
479470      case 0x0a:
480471      case 0x0b:
481472         if(mem_mask & 0x00ff)
482            m_fdc_timer->write(space,offset-0x08,data & 0xff);
473            m_fdc_timer->write(space,offset,data & 0xff);
483474         break;
484475      case 0x10:
485476      case 0x11:
r243192r243193
489480      case 0x15:
490481      case 0x16:
491482      case 0x17:
492         if(mem_mask & 0x00ff)
493            m_hdc->write(space,offset-0x10,data & 0xff);
494483         logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask);
495484         break;
496485      case 0x18:
r243192r243193
498487      case 0x1a:
499488      case 0x1b:
500489         if(mem_mask & 0x00ff)
501            m_hdc_timer->write(space,offset-0x18,data & 0xff);
490            m_hdc_timer->write(space,offset,data & 0xff);
502491         break;
503492   }
504493}
r243192r243193
521510      case 0x0a:
522511      case 0x0b:
523512         if(mem_mask & 0x00ff)
524            ret = m_fdc_timer->read(space,offset-0x08);
513            ret = m_fdc_timer->read(space,offset);
525514         break;
526515      case 0x10:
527516      case 0x11:
r243192r243193
531520      case 0x15:
532521      case 0x16:
533522      case 0x17:
534         if(mem_mask & 0x00ff)
535            ret = m_hdc->read(space,offset-0x10);
536523         logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask);
537524         break;
538525      case 0x18:
r243192r243193
540527      case 0x1a:
541528      case 0x1b:
542529         if(mem_mask & 0x00ff)
543            ret = m_hdc_timer->read(space,offset-0x18);
530            ret = m_hdc_timer->read(space,offset);
544531         break;
545532   }
546533
r243192r243193
598585   m_disk_page = data & 0x7f;
599586}
600587
601READ8_MEMBER(ngen_state::hd_buffer_r)
602{
603   return m_hd_buffer[offset];
604}
605
606WRITE8_MEMBER(ngen_state::hd_buffer_w)
607{
608   m_hd_buffer[offset] = data;
609}
610
611588WRITE_LINE_MEMBER( ngen_state::dma_hrq_changed )
612589{
613590   m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r243192r243193
626603   {
627604      if(state)
628605      {
629         if(m_hdc_control & 0x04) // ROM transfer
606         if(m_hdc_control & 0x04) // ROM transfer?
630607            m_hdc_control &= ~0x04;  // switch it off when done
631608      }
632609   }
r243192r243193
647624
648625READ8_MEMBER(ngen_state::dma_3_dack_r)
649626{
650   UINT16 ret = 0xffff;
651
627   UINT16 ret = 0xffff;
628   
652629   if((m_hdc_control & 0x04) && m_disk_rom)
653630   {
654631      ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8;
r243192r243193
659636         //m_dmac->dreq3_w(0);
660637      }
661638   }
662   m_dma_high_byte = ret & 0xff00;
639   m_dma_high_byte = ret & 0xff00;
663640   return ret;
664641}
665642
r243192r243193
712689   return m_pic->acknowledge();
713690}
714691
715void ngen_state::machine_start()
716{
717   m_hd_buffer.allocate(1024*8);  // 8kB buffer RAM for HD controller
718}
719
720692void ngen_state::machine_reset()
721693{
722694   m_port00 = 0;
r243192r243193
737709
738710static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state )
739711   AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w)
740
712   
741713   // Floppy/Hard disk module
742//  AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff)  // a guess for now
743//  AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff)
744//  AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff)
745//  AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff)  // X-Bus extended address register
746//  AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff)
714//   AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff)  // a guess for now
715//   AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff)
716//   AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff)
717//   AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff)  // X-Bus extended address register
718//   AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff)
747719   // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated)
748//  AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
749
720//   AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
721   
750722ADDRESS_MAP_END
751723
752724static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state )
r243192r243193
851823
852824   // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board)
853825   MCFG_DEVICE_ADD("videouart", I8251, 0)  // main clock unknown, Rx/Tx clocks are 19.53kHz
854//  MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
826//   MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
855827   MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd))
856828   MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen")
857829   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd))
r243192r243193
866838   MCFG_WD_FDC_FORCE_READY
867839   MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0)
868840   MCFG_PIT8253_CLK0(XTAL_20MHz / 20)
869   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // clocked on FDC data register access
841   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
870842   MCFG_PIT8253_CLK1(XTAL_20MHz / 20)
871   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // 1MHz
872   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)
843   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
844   MCFG_PIT8253_CLK2(XTAL_20MHz / 20)
873845   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
874   // TODO: WD1010 HDC (not implemented), use WD2010 for now
875   MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4)
876   MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r))
877   MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w))
878   MCFG_WD2010_IN_DRDY_CB(VCC)
879   MCFG_WD2010_IN_INDEX_CB(VCC)
880   MCFG_WD2010_IN_WF_CB(VCC)
881   MCFG_WD2010_IN_TK000_CB(VCC)
882   MCFG_WD2010_IN_SC_CB(VCC)
846   // TODO: WD1010 HDC (not implemented)
883847   MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0)
884   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)  // 2MHz
885848   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats)
886   MCFG_HARDDISK_ADD("hard0")
887849
888850MACHINE_CONFIG_END
889851
trunk/src/mess/drivers/pasogo.c
r243192r243193
679679void pasogo_state::machine_reset()
680680{
681681   astring region_tag;
682   m_maincpu_rom = memregion("maincpu");
683682   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
684   if (!m_cart_rom)    // this should never happen, since we make carts mandatory!
685      m_cart_rom = memregion("maincpu");
683   m_maincpu_rom = memregion("maincpu");
686684
687685   membank("bank27")->set_base(m_cart_rom->base());
688686   membank("bank28")->set_base(m_maincpu_rom->base() + 0xb8000/*?*/);
trunk/src/mess/drivers/pc9801.c
r243192r243193
36263626
36273627ROM_START( pc9821ap2 )
36283628   ROM_REGION( 0x80000, "biosrom", ROMREGION_ERASEFF )
3629   ROM_DEFAULT_BIOS("phd0104")
3630   ROM_SYSTEM_BIOS(0, "phd0104",  "PHD0104")
3631   ROMX_LOAD( "phd0104.rom",     0x000000, 0x80000, CRC(da73b372) SHA1(2c15b63a0869b81ef7f04972dbb0975f4e77d384), ROM_BIOS(1) )
3632   ROM_SYSTEM_BIOS(1, "phd0102",  "PHD0102")
3633   ROMX_LOAD( "phd0102.rom",     0x000000, 0x80000, CRC(3036774c) SHA1(59856a348f156adf5eca06326f967aca54ff871c), ROM_BIOS(2) )
3629   ROM_LOAD( "phd0102.rom",     0x000000, 0x80000, CRC(3036774c) SHA1(59856a348f156adf5eca06326f967aca54ff871c) )
36343630
36353631   ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) // TODO: identify ROM banks
36363632   ROM_COPY( "biosrom", 0x20000, 0x18000, 0x08000 )
trunk/src/mess/drivers/slicer.c
r243192r243193
1// Slicer Computers Slicer 80186 SBC
2// The bios makefile refers to a "exe3bin" utility, this can be substituted with FreeDOS exe2bin and the /l=0xf800 option
3// which will fixup the relocations
4
5#include "emu.h"
6#include "cpu/i86/i186.h"
7#include "machine/wd_fdc.h"
8#include "machine/mc68681.h"
9#include "bus/rs232/rs232.h"
10#include "bus/isa/isa.h"
11#include "bus/scsi/scsi.h"
12
13class slicer_state : public driver_device
14{
15public:
16   slicer_state(const machine_config &mconfig, device_type type, const char *tag) :
17   driver_device(mconfig, type, tag),
18   m_fdc(*this, "fdc"),
19   m_sasi(*this, "sasi")
20   {}
21
22   required_device<fd1797_t> m_fdc;
23   required_device<SCSI_PORT_DEVICE> m_sasi;
24
25   DECLARE_WRITE8_MEMBER(sio_out_w);
26   DECLARE_WRITE8_MEMBER(drive_sel_w);
27};
28
29WRITE8_MEMBER(slicer_state::sio_out_w)
30{
31   floppy_image_device *floppy;
32   int state = (data & 0x80) ? 0 : 1;
33   char devname[8];
34
35   for(int i = 0; i < 4; i++)
36   {
37      sprintf(devname, "%d", i);
38      floppy = m_fdc->subdevice<floppy_connector>(devname)->get_device();
39      if(floppy)
40         floppy->mon_w(state);
41   }
42}
43
44WRITE8_MEMBER(slicer_state::drive_sel_w)
45{
46   data &= 1;
47   switch(offset)
48   {
49      case 0:
50         m_sasi->write_sel(data);
51         break;
52      case 1:
53         m_sasi->write_rst(data);
54         break;
55      case 7:
56         m_fdc->dden_w(data);
57         break;
58
59      default:
60      {
61         floppy_image_device *floppy;
62         char devname[8];
63         unsigned int drive = 3 - (offset - 2);
64         if((drive > 3) || !data)
65            break;
66
67         sprintf(devname, "%d", drive);
68         floppy = m_fdc->subdevice<floppy_connector>(devname)->get_device();
69         m_fdc->set_floppy(floppy);
70         break;
71      }
72   }
73}
74
75static ADDRESS_MAP_START( slicer_map, AS_PROGRAM, 16, slicer_state )
76   AM_RANGE(0x00000, 0x3ffff) AM_RAM // fixed 256k for now
77   AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("bios", 0)
78ADDRESS_MAP_END
79
80static ADDRESS_MAP_START( slicer_io, AS_IO, 16, slicer_state )
81   ADDRESS_MAP_UNMAP_HIGH
82   AM_RANGE(0x0000, 0x007f) AM_DEVREADWRITE8("fdc", fd1797_t, read, write, 0x00ff) //PCS0
83   AM_RANGE(0x0080, 0x00ff) AM_DEVREADWRITE8("sc2681", mc68681_device, read, write, 0x00ff) //PCS1
84   AM_RANGE(0x0100, 0x017f) AM_WRITE8(drive_sel_w, 0x00ff) //PCS2
85   // TODO: 0x180 sets ack
86   AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) //PCS3
87   AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00)
88   AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff)
89   AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00)
90ADDRESS_MAP_END
91
92static SLOT_INTERFACE_START( slicer_floppies )
93   SLOT_INTERFACE("525dd", FLOPPY_525_DD)
94   SLOT_INTERFACE("8dsdd", FLOPPY_8_DSDD)
95SLOT_INTERFACE_END
96
97static MACHINE_CONFIG_START( slicer, slicer_state )
98   MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz / 2)
99   MCFG_CPU_PROGRAM_MAP(slicer_map)
100   MCFG_CPU_IO_MAP(slicer_io)
101
102   MCFG_MC68681_ADD("sc2681", XTAL_3_6864MHz)
103   MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int0_w))
104   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232_1", rs232_port_device, write_txd))
105   MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232_2", rs232_port_device, write_txd))
106   MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(slicer_state, sio_out_w))
107
108   MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, "terminal")
109   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_a_w))
110   MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL)
111   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_b_w))
112
113   MCFG_FD1797x_ADD("fdc", XTAL_16MHz/2/8)
114   MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w))
115   MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w))
116   MCFG_FLOPPY_DRIVE_ADD("fdc:0", slicer_floppies, "525dd", floppy_image_device::default_floppy_formats)
117   MCFG_FLOPPY_DRIVE_ADD("fdc:1", slicer_floppies, NULL, floppy_image_device::default_floppy_formats)
118   MCFG_FLOPPY_DRIVE_ADD("fdc:2", slicer_floppies, NULL, floppy_image_device::default_floppy_formats)
119   MCFG_FLOPPY_DRIVE_ADD("fdc:3", slicer_floppies, NULL, floppy_image_device::default_floppy_formats)
120
121   MCFG_DEVICE_ADD("sasi", SCSI_PORT, 0)
122   MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in")
123   MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3))
124   MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4))
125   MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5))
126   MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6))
127   MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit7))
128
129   MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", "sasi")
130   MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0)
131   MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0)
132MACHINE_CONFIG_END
133
134ROM_START( slicer )
135   ROM_REGION(0x8001, "bios", 0)
136   // built from sources, reset.asm adds an extra byte
137   ROM_LOAD("epbios.bin", 0x0000, 0x8001, CRC(96fe9dd4) SHA1(5fc43454fe7d51f2ae97aef822155dcd28eb7f23))
138ROM_END
139
140COMP( 1983, slicer, 0, 0, slicer, 0, driver_device, 0, "Slicer Computers", "Slicer", GAME_NOT_WORKING | GAME_NO_SOUND)
trunk/src/mess/drivers/sms.c
r243192r243193
1414
1515 - SIO interface for Game Gear (needs netplay, I guess)
1616 - Sega Demo Unit II (kiosk expansion device)
17 - SMS 8 slot game changer (kiosk expansion device)
1817 - SMS Disk System (floppy disk drive expansion device) - unreleased
1918 - Rapid button of Japanese Master System
2019 - Keyboard support for Sega Mark III (sg1000m3 driver)
r243192r243193
5857- Few games of the ones with FM support need to detect the system region as
5958  Japanese to play FM sound;
6059- The Light Phaser gun doesn't work with the Japanese SMS;
61- There are reports about Light Phaser working on the second Korean SMS
60- There are reports about Light Phaser working on the second Korean console
6261  version, and a Korean advert shows support on the first version (Gam*Boy I,
6362  although based on Japanese SMS);
6463- The Korean SMS versions have Japanese-format cartridge slot, but only on the
6564  first (Gam*Boy I) the region is detected as Japanese;
6665- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through
6766  the gender adapter;
68- Some SMS ROMs don't run or have issues when are plugged-in to a Game Gear,
69  through the Master Gear adapter;
67- Some SMS ROMs don't run when are plugged-in to a Game Gear, through the
68  Master Gear adapter;
7069
7170--------------------------------------------------------------------------------
7271
r243192r243193
406405INPUT_PORTS_END
407406
408407static INPUT_PORTS_START( smssdisp )
409   // For each peripheral port (for controllers or 3-D glasses), there are sets
410   // of two connectors wired in parallel on the real hardware. This allows to
411   // have different controllers, like a pad and a Light Phaser, plugged together
412   // for a player input, what avoids having to re-plug them every time a game is
413   // changed to another that requires a different controller. Also, this allows
414   // 3-D games to be properly watched by two persons at same time.
415   // For now the driver just uses single input ports.
416408   PORT_INCLUDE( sms1 )
417409
418410   PORT_START("DSW")
r243192r243193
813805
814806   MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear")
815807
816   MCFG_GG_EXT_PORT_ADD("ext", gg_ext_port_devices, NULL)
817   MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) // not verified
818   //MCFG_GG_EXT_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod
808   MCFG_GG_GEAR2GEAR_PORT_ADD("gear2gear", gg_gear2gear_port_devices, NULL)
809   MCFG_GG_GEAR2GEAR_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) // not verified
810   //MCFG_GG_GEAR2GEAR_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod
819811MACHINE_CONFIG_END
820812
821813
trunk/src/mess/drivers/splitsec.c
r243192r243193
55  Parker Brothers Split Second
66  * TMS1400NLL MP7314-N2 (die labeled MP7314)
77
8  This is an electronic handheld reflex gaming device, it's straightforward
9  to use. The included mini-games are:
10  1, 2, 3: Mad Maze*
11  4, 5: Space Attack*
12  6: Auto Cross
13  7: Stomp
14  8: Speedball
158
16  *: higher number indicates higher difficulty
17
18
19  TODO:
20  - MCU clock is unknown
21
229***************************************************************************/
2310
2411#include "emu.h"
r243192r243193
2714
2815#include "splitsec.lh"
2916
30// The master clock is a single stage RC oscillator: R=24K, C=100pf,
31// according to the TMS 1000 series data manual this is around 375kHz.
32// However, this sounds too low-pitched and runs too slow when compared
33// to recordings, maybe the RC osc curve is different for TMS1400?
17// master clock is a single stage RC oscillator: R=24K, C=100pf,
18// according to the TMS 1000 series data manual this is around 375kHz
19#define MASTER_CLOCK (375000)
3420
35// so for now, the value below is an approximation
36#define MASTER_CLOCK (485000)
3721
38
3922class splitsec_state : public driver_device
4023{
4124public:
4225   splitsec_state(const machine_config &mconfig, device_type type, const char *tag)
4326      : driver_device(mconfig, type, tag),
4427      m_maincpu(*this, "maincpu"),
45      m_button_matrix(*this, "IN"),
28//      m_button_matrix(*this, "IN"),
4629      m_speaker(*this, "speaker")
4730   { }
4831
4932   required_device<cpu_device> m_maincpu;
50   required_ioport_array<2> m_button_matrix;
33//   required_ioport_array<4> m_button_matrix;
5134   required_device<speaker_sound_device> m_speaker;
5235
5336   UINT16 m_r;
5437   UINT16 m_o;
5538
56   UINT16 m_leds_state[0x10];
57   UINT16 m_leds_cache[0x10];
58   UINT8 m_leds_decay[0x100];
59
6039   DECLARE_READ8_MEMBER(read_k);
6140   DECLARE_WRITE16_MEMBER(write_o);
6241   DECLARE_WRITE16_MEMBER(write_r);
6342
64   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
65   void leds_update();
66
6743   virtual void machine_start();
6844};
6945
r243192r243193
7147
7248/***************************************************************************
7349
74  LEDs
75
76***************************************************************************/
77
78// The device strobes the outputs very fast, it is unnoticeable to the user.
79// To prevent flickering here, we need to simulate a decay.
80
81// decay time, in steps of 10ms
82#define LEDS_DECAY_TIME 4
83
84/* display layout, where number xy is lamp R(x),O(y)
85
86       00    02    04
87    10 01 12 03 14 05 16
88       11    13    15
89    20 21 22 23 24 25 26
90       31    33    35
91    30 41 32 43 34 45 36
92       51    53    55
93    40 61 42 63 44 65 46
94       71    73    75
95    50 60 52 62 54 64 56
96       70    72    74
97*/
98
99void splitsec_state::leds_update()
100{
101   UINT16 active_state[0x10];
102
103   for (int i = 0; i < 0x10; i++)
104   {
105      // update current state
106      if (m_r >> i & 1)
107         m_leds_state[i] = m_o;
108
109      active_state[i] = 0;
110
111      for (int j = 0; j < 0x10; j++)
112      {
113         int di = j << 4 | i;
114
115         // turn on powered leds
116         if (m_leds_state[i] >> j & 1)
117            m_leds_decay[di] = LEDS_DECAY_TIME;
118
119         // determine active state
120         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
121         active_state[i] |= (ds << j);
122      }
123   }
124
125   // on difference, send to output
126   for (int i = 0; i < 0x10; i++)
127      if (m_leds_cache[i] != active_state[i])
128      {
129         for (int j = 0; j < 8; j++)
130            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
131      }
132
133   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
134}
135
136TIMER_DEVICE_CALLBACK_MEMBER(splitsec_state::leds_decay_tick)
137{
138   // slowly turn off unpowered leds
139   for (int i = 0; i < 0x100; i++)
140      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
141         m_leds_decay[i]--;
142
143   leds_update();
144}
145
146
147
148/***************************************************************************
149
15050  I/O
15151
15252***************************************************************************/
15353
15454READ8_MEMBER(splitsec_state::read_k)
15555{
156   UINT8 k = 0;
157
158   // read selected button rows
159   for (int i = 0; i < 2; i++)
160      if (m_r >> (i+9) & 1)
161         k |= m_button_matrix[i]->read();
162
163   return k;
56   return 0;
16457}
16558
16659WRITE16_MEMBER(splitsec_state::write_r)
16760{
168   // R8: speaker out
169   m_speaker->level_w(data >> 8 & 1);
170
171   // R9,R10: input mux
172   // R0-R7: led columns
17361   m_r = data;
174   leds_update();
17562}
17663
17764WRITE16_MEMBER(splitsec_state::write_o)
17865{
179   // O0-O6: led rows
180   // O7: N/C
18166   m_o = data;
182   leds_update();
18367}
18468
18569
r243192r243193
19175***************************************************************************/
19276
19377static INPUT_PORTS_START( splitsec )
194   PORT_START("IN.0") // R9
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // 4 separate directional buttons, hence 16way
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY
197   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY
198   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
199
200   PORT_START("IN.1") // R10
201   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY
202   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Select")
203   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Start")
204   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
20578INPUT_PORTS_END
20679
20780
r243192r243193
21487
21588void splitsec_state::machine_start()
21689{
217   // zerofill
218   memset(m_leds_state, 0, sizeof(m_leds_state));
219   memset(m_leds_cache, 0, sizeof(m_leds_cache));
220   memset(m_leds_decay, 0, sizeof(m_leds_decay));
221
22290   m_r = 0;
22391   m_o = 0;
22492
225   // register for savestates
226   save_item(NAME(m_leds_state));
227   save_item(NAME(m_leds_cache));
228   save_item(NAME(m_leds_decay));
229
23093   save_item(NAME(m_r));
23194   save_item(NAME(m_o));
23295}
r243192r243193
240103   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o))
241104   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r))
242105
243   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", splitsec_state, leds_decay_tick, attotime::from_msec(10))
244
245106   MCFG_DEFAULT_LAYOUT(layout_splitsec)
246107
247108   /* no video! */
r243192r243193
262123
263124ROM_START( splitsec )
264125   ROM_REGION( 0x1000, "maincpu", 0 )
265   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(e94b2098) SHA1(f0fc1f56a829252185592a2508740354c50bedf8) )
126   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(0cccdf59) SHA1(06a533134a433aaf856b80f0ca239d0498b98d5f) )
266127
267128   ROM_REGION( 867, "maincpu:mpla", 0 )
268129   ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) )
r243192r243193
271132ROM_END
272133
273134
274CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE )
135CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/drivers/starwbc.c
r243192r243193
186186
187187static INPUT_PORTS_START( starwbc )
188188   PORT_START("IN.0") // R0
189   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Basic Game")
190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Intermediate Game")
191   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Advanced Game")
192   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Player Number")
189   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("Basic Game")
190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("Intermediate Game")
191   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("Advanced Game")
192   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_P) PORT_NAME("Player Number")
193193
194194   PORT_START("IN.1") // R1
195   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Start Turn")
195   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Start Turn")
196196   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
197197   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
198   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("End Turn")
198   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("End Turn")
199199
200200   PORT_START("IN.2") // R3
201   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Magna Scan") // only used in adv. game
202   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Enemy Scan") // only used in adv. game
201   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Magna Scan") // only used in adv. game
202   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("Enemy Scan") // only used in adv. game
203203   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
204   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up")
204   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up")
205205
206206   PORT_START("IN.3") // R5
207   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Evasive Maneuvers")
208   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move")
209   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Fire")
210   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Battle Stations")
207   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("Evasive Maneuvers")
208   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("Move")
209   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("Fire")
210   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("Battle Stations")
211211
212212   PORT_START("IN.4") // R7
213   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left")
214   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up")
215   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down")
216   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right")
213   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left")
214   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up")
215   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down")
216   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right")
217217INPUT_PORTS_END
218218
219219
trunk/src/mess/drivers/stopthie.c
r243192r243193
185185
186186static INPUT_PORTS_START( stopthief )
187187   PORT_START("IN.0") // O0
188   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
189   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
190   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
191   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
192   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
188   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
189   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
190   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
191   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
192   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
193193
194194   PORT_START("IN.1") // O6
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
197   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
198   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
199   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
197   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
198   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
199   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
200200
201201   // note: even though power buttons are on the matrix, they are not CPU-controlled
202202   PORT_START("IN.2") // Vss!
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)true)
204   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip")
205   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest")
206   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue")
207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)false)
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)true)
204   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip")
205   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest")
206   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue")
207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, stopthief_state, power_button, (void *)false)
208208INPUT_PORTS_END
209209
210210
trunk/src/mess/drivers/tandy12.c
r243192r243193
130130
131131static INPUT_PORTS_START( tandy12 )
132132   PORT_START("IN.0") // R5
133   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("12")
134   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("11")
135   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("10")
136   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
133   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("12")
134   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("11")
135   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("10")
136   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
137137
138138   PORT_START("IN.1") // R6
139   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Space-2")
140   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Play-2/Hit-7")
141   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Select")
142   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Start")
139   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Space-2")
140   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("Play-2/Hit-7")
141   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_NAME("Select")
142   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Start")
143143
144144   PORT_START("IN.2") // R7
145   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2")
145   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2")
146146   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
147147   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
148148   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
149149
150150   PORT_START("IN.3") // R8
151   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
152   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
153   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
154   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
151   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
152   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
153   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
154   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
155155
156156   PORT_START("IN.4") // R9
157   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
158   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
159   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
160   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
157   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
158   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
159   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
160   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
161161INPUT_PORTS_END
162162
163163
trunk/src/mess/drivers/tispeak.c
r243192r243193
693693COMP( 1980, snspella,   snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (US set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
694694COMP( 1978, snspelluk,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (UK set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
695695COMP( 1981, snspelluka, snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (UK set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // different voice actor
696COMP( 1979, snspelljp,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
696COMP( 1979, snspelljp,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
697697COMP( 1980, ladictee,   snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "La Dictee Magique (France)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // doesn't work due to missing CD2702 MCU dump, German version has CD2702 too
698698
699699COMP( 1980, snmath,     0,       0, snmath,   snmath,   driver_device, 0,        "Texas Instruments", "Speak & Math (US prototype)", GAME_IMPERFECT_SOUND ) // also US set 1
trunk/src/mess/drivers/vt100.c
r243192r243193
758758// does not have integrated STP or AVO populated
759759// 8085 based instead of I8080
760760   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
761   ROM_LOAD( "23-028e4-00.e71", 0x0000, 0x2000, NO_DUMP) // rom is unique to vt101; "CN55004N 8232 // DEC TP03 // 23-028E4-00" 24-pin mask rom (mc68764 pinout)
761   ROM_LOAD( "23-???e4-00.e71", 0x0000, 0x2000, NO_DUMP) // rom is unique to vt101
762762   //e69 socket is empty/unpopulated on vt101?
763763   //e67 socket is empty/unpopulated on vt101?
764764
trunk/src/mess/includes/apricotp.h
r243192r243193
9292   virtual void video_start();
9393   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9494
95   MC6845_UPDATE_ROW(update_row);
9695   DECLARE_READ16_MEMBER( mem_r );
9796   DECLARE_WRITE16_MEMBER( mem_w );
9897   DECLARE_READ8_MEMBER( prtr_snd_r );
trunk/src/mess/includes/banctec.h
r243192r243193
1/*****************************************************************************
2 *
3 * includes/banctec.h
4 *
5 ****************************************************************************/
6
7#ifndef BANCTEC_H_
8#define BANCTEC_H_
9
10#include "video/mc6845.h"
11
12class banctec_state : public driver_device
13{
14public:
15   banctec_state(const machine_config &mconfig, device_type type, const char *tag)
16      : driver_device(mconfig, type, tag),
17      m_maincpu(*this, "maincpu"),
18      m_gfxdecode(*this, "gfxdecode"),
19      m_videoram(*this, "videoram") { }
20
21   DECLARE_READ8_MEMBER(banctec_read);
22   DECLARE_WRITE8_MEMBER(banctec_write);
23   TILE_GET_INFO_MEMBER(get_bg_tile_info);
24   MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
25   virtual void machine_reset();
26   virtual void video_start();
27   UINT32 screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
28
29   required_device<cpu_device> m_maincpu;
30   required_device<gfxdecode_device> m_gfxdecode;
31   required_shared_ptr<UINT8> m_videoram;
32
33   tilemap_t *m_bg_tilemap;
34};
35
36#endif /* BANCTEC_H_ */
trunk/src/mess/includes/mac.h
r243192r243193
291291   INT32 m_adb_linestate;
292292   bool  m_adb_srqflag;
293293#define kADBKeyBufSize 32
294      UINT8 m_adb_keybuf[kADBKeyBufSize];
295      UINT8 m_adb_keybuf_start;
296      UINT8 m_adb_keybuf_end;
294        UINT8 m_adb_keybuf[kADBKeyBufSize];
295        UINT8 m_adb_keybuf_start;
296        UINT8 m_adb_keybuf_end;
297297
298298   // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
299299   UINT8 m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state;
trunk/src/mess/includes/nes.h
r243192r243193
1313#include "video/ppu2c0x.h"
1414#include "bus/nes/nes_slot.h"
1515#include "bus/nes/nes_carts.h"
16#include "bus/nes_ctrl/ctrl.h"
1716#include "sound/nes_apu.h"
17#include "imagedev/cassette.h"
1818
1919/***************************************************************************
2020    CONSTANTS
r243192r243193
3030    TYPE DEFINITIONS
3131***************************************************************************/
3232
33struct nes_input
34{
35   UINT32 shift;
36   UINT32 i0, i1, i2;
37};
38
3339/*PPU fast banking constants and structures */
3440
3541#define CHRROM 0
r243192r243193
5157class nes_state : public driver_device
5258{
5359public:
60   enum
61   {
62      TIMER_ZAPPER_TICK,
63      TIMER_LIGHTGUN_TICK
64   };
65
5466   nes_state(const machine_config &mconfig, device_type type, const char *tag)
5567      : driver_device(mconfig, type, tag),
5668         m_maincpu(*this, "maincpu"),
5769         m_ppu(*this, "ppu"),
5870         m_sound(*this, "nessound"),
59         m_ctrl1(*this, "ctrl1"),
60         m_ctrl2(*this, "ctrl2"),
61         m_exp(*this, "exp"),
6271         m_cartslot(*this, "nes_slot"),
63         m_disk(*this, "disk")
72         m_disk(*this, "disk"),
73         m_cassette(*this, "tape")
6474      { }
6575
6676   /* video-related */
6777   int m_last_frame_flip;
6878
6979   /* misc */
80   ioport_port       *m_io_ctrlsel;
81   ioport_port       *m_io_fckey[9];
82   ioport_port       *m_io_subkey[13];
83   ioport_port       *m_io_pad[4];
84   ioport_port       *m_io_powerpad[2];
85   ioport_port       *m_io_mahjong[4];
86   ioport_port       *m_io_ftrainer[4];
87   ioport_port       *m_io_cc_left;
88   ioport_port       *m_io_cc_right;
89   ioport_port       *m_io_zapper1_t;
90   ioport_port       *m_io_zapper1_x;
91   ioport_port       *m_io_zapper1_y;
92   ioport_port       *m_io_zapper2_t;
93   ioport_port       *m_io_zapper2_x;
94   ioport_port       *m_io_zapper2_y;
95   ioport_port       *m_io_paddle;
96   ioport_port       *m_io_paddle_btn;
97   ioport_port       *m_io_exp;
7098   ioport_port       *m_io_disksel;
7199
72100   UINT8      *m_vram;
r243192r243193
75103   required_device<cpu_device> m_maincpu;
76104   required_device<ppu2c0x_device> m_ppu;
77105   required_device<nesapu_device> m_sound;
78   required_device<nes_control_port_device> m_ctrl1;
79   required_device<nes_control_port_device> m_ctrl2;
80   optional_device<nes_control_port_device> m_exp;
81106   optional_device<nes_cart_slot_device> m_cartslot;
82107   optional_device<nes_disksys_device> m_disk;
108   optional_device<cassette_image_device> m_cassette;
83109
84110   int nes_ppu_vidaccess(int address, int data);
85111   void ppu_nmi(int *ppu_regs);
r243192r243193
87113   DECLARE_READ8_MEMBER(nes_in0_r);
88114   DECLARE_READ8_MEMBER(nes_in1_r);
89115   DECLARE_WRITE8_MEMBER(nes_in0_w);
116   DECLARE_WRITE8_MEMBER(nes_in1_w);
90117   DECLARE_READ8_MEMBER(fc_in0_r);
91118   DECLARE_READ8_MEMBER(fc_in1_r);
92119   DECLARE_WRITE8_MEMBER(fc_in0_w);
r243192r243193
100127   DECLARE_READ8_MEMBER(psg_4015_r);
101128   DECLARE_WRITE8_MEMBER(psg_4015_w);
102129   DECLARE_WRITE8_MEMBER(psg_4017_w);
103   NESCTRL_BRIGHTPIXEL_CB(bright_pixel);
130   void state_register();
131   void setup_ioports();
104132
105133   DECLARE_DRIVER_INIT(famicom);
106134
r243192r243193
111139   DECLARE_MACHINE_RESET(famitwin);
112140   void setup_disk(nes_disksys_device *slot);
113141
142   // input related
143   UINT32 m_pad_latch[4];
144   UINT8 m_zapper_latch[2][3];
145   UINT8 m_paddle_latch, m_paddle_btn_latch;
146   UINT8 m_mjpanel_latch;
147   UINT8 m_fck_scan, m_fck_mode;
148   UINT8 m_mic_obstruct;
149   UINT8 m_powerpad_latch[2];
150   UINT8 m_ftrainer_scan;
151
152protected:
153   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
154
114155private:
115156   memory_bank       *m_prg_bank_mem[5];
116157};
trunk/src/mess/includes/sms.h
r243192r243193
1919#define CONTROL1_TAG   "ctrl1"
2020#define CONTROL2_TAG   "ctrl2"
2121
22#include "bus/gamegear/ggext.h"
22#include "bus/gamegear/gear2gear.h"
2323#include "bus/sms_ctrl/smsctrl.h"
2424#include "bus/sms_exp/smsexp.h"
2525#include "bus/sega8/sega8_slot.h"
r243192r243193
3737      m_region_maincpu(*this, "maincpu"),
3838      m_port_ctrl1(*this, CONTROL1_TAG),
3939      m_port_ctrl2(*this, CONTROL2_TAG),
40      m_port_gg_ext(*this, "ext"),
40      m_port_gear2gear(*this, "gear2gear"),
4141      m_port_gg_dc(*this, "GG_PORT_DC"),
4242      m_port_pause(*this, "PAUSE"),
4343      m_port_reset(*this, "RESET"),
r243192r243193
6666   required_memory_region m_region_maincpu;
6767   optional_device<sms_control_port_device> m_port_ctrl1;
6868   optional_device<sms_control_port_device> m_port_ctrl2;
69   optional_device<gg_ext_port_device> m_port_gg_ext;
69   optional_device<gg_gear2gear_port_device> m_port_gear2gear;
7070   optional_ioport m_port_gg_dc;
7171   optional_ioport m_port_pause;
7272   optional_ioport m_port_reset;
r243192r243193
7575   optional_ioport m_port_scope_binocular;
7676   optional_ioport m_port_persist;
7777
78   device_t *m_left_lcd;
79   device_t *m_right_lcd;
7880   address_space *m_space;
81
82   UINT8 m_bios_page_count;
83   UINT8 m_fm_detect;
84   UINT8 m_io_ctrl_reg;
85   int m_paused;
86   UINT8 m_mem_ctrl_reg;
87   UINT8 m_mem_device_enabled;
7988   UINT8 *m_mainram;
8089   UINT8 *m_BIOS;
90   UINT8 m_mapper[4];
91   UINT8 m_port_dc_reg;
92   UINT8 m_port_dd_reg;
93   UINT8 m_gg_sio[5];
8194
82   // for 3D glass binocular hack
83   device_t *m_left_lcd;
84   device_t *m_right_lcd;
85   bitmap_rgb32 m_prevleft_bitmap;
86   bitmap_rgb32 m_prevright_bitmap;
95   // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
96   UINT8 m_bios_page[4];
8797
8898   // for gamegear LCD persistence hack
8999   bitmap_rgb32 m_prev_bitmap;
r243192r243193
95105   // vertical scaling in the gamegear sms compatibility mode.
96106   int *m_line_buffer;
97107
108   // for 3D glass binocular hack
109   bitmap_rgb32 m_prevleft_bitmap;
110   bitmap_rgb32 m_prevright_bitmap;
111
98112   // model identifiers
99113   UINT8 m_is_gamegear;
100114   UINT8 m_is_gg_region_japan;
r243192r243193
107121   UINT8 m_has_fm;
108122   UINT8 m_has_jpn_sms_cart_slot;
109123
110   // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
111   UINT8 m_bios_page[4];
112
113   UINT8 m_bios_page_count;
114   UINT8 m_mapper[4];
115   UINT8 m_io_ctrl_reg;
116   UINT8 m_mem_ctrl_reg;
117   UINT8 m_mem_device_enabled;
118   UINT8 m_fm_detect;
119   UINT8 m_port_dc_reg;
120   UINT8 m_port_dd_reg;
121   UINT8 m_gg_sio[5];
122   int m_paused;
123
124124   // Data needed for Light Phaser
125125   UINT8 m_ctrl1_th_state;
126126   UINT8 m_ctrl2_th_state;
r243192r243193
132132   UINT8 m_sscope_state;
133133   UINT8 m_frame_sscope_state;
134134
135   // slot devices
136135   sega8_cart_slot_device *m_cartslot;
137136   sega8_card_slot_device *m_cardslot;
138137   sms_expansion_slot_device *m_expslot;
139138
140139   // these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset
141   sega8_cart_slot_device *m_slots[16];
142   sega8_card_slot_device *m_cards[16];
143140   UINT8 m_store_control;
144141   UINT8 m_store_cart_selection_data;
142   sega8_cart_slot_device *m_slots[16];
143   sega8_card_slot_device *m_cards[16];
145144   void store_post_load();
146145   void store_select_cart(UINT8 data);
147146
148   DECLARE_READ8_MEMBER(read_0000);
149   DECLARE_READ8_MEMBER(read_4000);
150   DECLARE_READ8_MEMBER(read_8000);
151   DECLARE_READ8_MEMBER(read_ram);
152   DECLARE_WRITE8_MEMBER(write_ram);
153   DECLARE_WRITE8_MEMBER(write_cart);
154
155   DECLARE_READ8_MEMBER(sms_mapper_r);
156   DECLARE_WRITE8_MEMBER(sms_mapper_w);
157   DECLARE_WRITE8_MEMBER(sms_mem_control_w);
147   /* Cartridge slot info */
148   DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
149   DECLARE_READ8_MEMBER(sms_fm_detect_r);
158150   DECLARE_WRITE8_MEMBER(sms_io_control_w);
159151   DECLARE_READ8_MEMBER(sms_count_r);
160152   DECLARE_READ8_MEMBER(sms_input_port_dc_r);
161153   DECLARE_READ8_MEMBER(sms_input_port_dd_r);
162154   DECLARE_READ8_MEMBER(gg_input_port_00_r);
163   DECLARE_WRITE8_MEMBER(gg_sio_w);
164   DECLARE_READ8_MEMBER(gg_sio_r);
165   DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
166   DECLARE_READ8_MEMBER(sms_fm_detect_r);
167155   DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w);
168156   DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w);
169157   DECLARE_READ8_MEMBER(sms_sscope_r);
170158   DECLARE_WRITE8_MEMBER(sms_sscope_w);
159   DECLARE_READ8_MEMBER(sms_mapper_r);
171160
172   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
173   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
174   DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
175   DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
176   DECLARE_READ32_MEMBER(sms_pixel_color);
161   DECLARE_READ8_MEMBER(read_0000);
162   DECLARE_READ8_MEMBER(read_4000);
163   DECLARE_READ8_MEMBER(read_8000);
164   DECLARE_READ8_MEMBER(read_ram);
165   DECLARE_WRITE8_MEMBER(write_ram);
166   DECLARE_WRITE8_MEMBER(write_cart);
177167
168   DECLARE_WRITE8_MEMBER(sms_mapper_w);
169   DECLARE_WRITE8_MEMBER(sms_mem_control_w);
170   DECLARE_WRITE8_MEMBER(gg_sio_w);
171   DECLARE_READ8_MEMBER(gg_sio_r);
178172   DECLARE_DRIVER_INIT(sg1000m3);
179173   DECLARE_DRIVER_INIT(gamegear);
180174   DECLARE_DRIVER_INIT(gamegeaj);
r243192r243193
189183   DECLARE_VIDEO_RESET(gamegear);
190184   DECLARE_VIDEO_START(sms1);
191185   DECLARE_VIDEO_RESET(sms1);
192
186   void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
187   UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
193188   UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
194189   UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
195   UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
196   void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
197190   void screen_vblank_sms1(screen_device &screen, bool state);
191   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
192   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
193   DECLARE_READ32_MEMBER(sms_pixel_color);
194   DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
195   DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
198196
199197protected:
200198   UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset);
trunk/src/mess/layout/splitsec.lay
r243192r243193
11<?xml version="1.0"?>
22<mamelayout version="2">
33
4<!-- define elements -->
5
6   <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
7
8   <element name="lamp_disk" defstate="0">
9      <disk state="1"><color red="1.0" green="0.24" blue="0.26" /></disk>
10      <disk state="0"><color red="0.15" green="0.043" blue="0.047" /></disk>
11   </element>
12   <element name="lamp_rect" defstate="0">
13      <rect state="1"><color red="1.0" green="0.24" blue="0.26" /></rect>
14      <rect state="0"><color red="0.15" green="0.043" blue="0.047" /></rect>
15   </element>
16
17
18<!-- build screen -->
19
204   <view name="Internal Layout">
21      <bounds left="0" right="18" top="0" bottom="28" />
22      <bezel element="static_black">
23         <bounds left="0" right="18" top="0" bottom="28" />
24      </bezel>
5      <bounds left="0" right="100" top="0" bottom="100" />
256
26   <!-- maze of lamps -->
27
28      <bezel name="lamp0" element="lamp_rect"><bounds x="2" y="1" width="4" height="1" /></bezel>
29      <bezel name="lamp2" element="lamp_rect"><bounds x="7" y="1" width="4" height="1" /></bezel>
30      <bezel name="lamp4" element="lamp_rect"><bounds x="12" y="1" width="4" height="1" /></bezel>
31
32      <bezel name="lamp10" element="lamp_rect"><bounds x="1" y="2" width="1" height="4" /></bezel>
33      <bezel name="lamp1" element="lamp_disk"><bounds x="3" y="3" width="2" height="2" /></bezel>
34      <bezel name="lamp12" element="lamp_rect"><bounds x="6" y="2" width="1" height="4" /></bezel>
35      <bezel name="lamp3" element="lamp_disk"><bounds x="8" y="3" width="2" height="2" /></bezel>
36      <bezel name="lamp14" element="lamp_rect"><bounds x="11" y="2" width="1" height="4" /></bezel>
37      <bezel name="lamp5" element="lamp_disk"><bounds x="13" y="3" width="2" height="2" /></bezel>
38      <bezel name="lamp16" element="lamp_rect"><bounds x="16" y="2" width="1" height="4" /></bezel>
39
40      <bezel name="lamp11" element="lamp_rect"><bounds x="2" y="6" width="4" height="1" /></bezel>
41      <bezel name="lamp13" element="lamp_rect"><bounds x="7" y="6" width="4" height="1" /></bezel>
42      <bezel name="lamp15" element="lamp_rect"><bounds x="12" y="6" width="4" height="1" /></bezel>
43
44      <bezel name="lamp20" element="lamp_rect"><bounds x="1" y="7" width="1" height="4" /></bezel>
45      <bezel name="lamp21" element="lamp_disk"><bounds x="3" y="8" width="2" height="2" /></bezel>
46      <bezel name="lamp22" element="lamp_rect"><bounds x="6" y="7" width="1" height="4" /></bezel>
47      <bezel name="lamp23" element="lamp_disk"><bounds x="8" y="8" width="2" height="2" /></bezel>
48      <bezel name="lamp24" element="lamp_rect"><bounds x="11" y="7" width="1" height="4" /></bezel>
49      <bezel name="lamp25" element="lamp_disk"><bounds x="13" y="8" width="2" height="2" /></bezel>
50      <bezel name="lamp26" element="lamp_rect"><bounds x="16" y="7" width="1" height="4" /></bezel>
51
52      <bezel name="lamp31" element="lamp_rect"><bounds x="2" y="11" width="4" height="1" /></bezel>
53      <bezel name="lamp33" element="lamp_rect"><bounds x="7" y="11" width="4" height="1" /></bezel>
54      <bezel name="lamp35" element="lamp_rect"><bounds x="12" y="11" width="4" height="1" /></bezel>
55
56      <bezel name="lamp30" element="lamp_rect"><bounds x="1" y="12" width="1" height="4" /></bezel>
57      <bezel name="lamp41" element="lamp_disk"><bounds x="3" y="13" width="2" height="2" /></bezel>
58      <bezel name="lamp32" element="lamp_rect"><bounds x="6" y="12" width="1" height="4" /></bezel>
59      <bezel name="lamp43" element="lamp_disk"><bounds x="8" y="13" width="2" height="2" /></bezel>
60      <bezel name="lamp34" element="lamp_rect"><bounds x="11" y="12" width="1" height="4" /></bezel>
61      <bezel name="lamp45" element="lamp_disk"><bounds x="13" y="13" width="2" height="2" /></bezel>
62      <bezel name="lamp36" element="lamp_rect"><bounds x="16" y="12" width="1" height="4" /></bezel>
63
64      <bezel name="lamp51" element="lamp_rect"><bounds x="2" y="16" width="4" height="1" /></bezel>
65      <bezel name="lamp53" element="lamp_rect"><bounds x="7" y="16" width="4" height="1" /></bezel>
66      <bezel name="lamp55" element="lamp_rect"><bounds x="12" y="16" width="4" height="1" /></bezel>
67
68      <bezel name="lamp40" element="lamp_rect"><bounds x="1" y="17" width="1" height="4" /></bezel>
69      <bezel name="lamp61" element="lamp_disk"><bounds x="3" y="18" width="2" height="2" /></bezel>
70      <bezel name="lamp42" element="lamp_rect"><bounds x="6" y="17" width="1" height="4" /></bezel>
71      <bezel name="lamp63" element="lamp_disk"><bounds x="8" y="18" width="2" height="2" /></bezel>
72      <bezel name="lamp44" element="lamp_rect"><bounds x="11" y="17" width="1" height="4" /></bezel>
73      <bezel name="lamp65" element="lamp_disk"><bounds x="13" y="18" width="2" height="2" /></bezel>
74      <bezel name="lamp46" element="lamp_rect"><bounds x="16" y="17" width="1" height="4" /></bezel>
75
76      <bezel name="lamp71" element="lamp_rect"><bounds x="2" y="21" width="4" height="1" /></bezel>
77      <bezel name="lamp73" element="lamp_rect"><bounds x="7" y="21" width="4" height="1" /></bezel>
78      <bezel name="lamp75" element="lamp_rect"><bounds x="12" y="21" width="4" height="1" /></bezel>
79
80      <bezel name="lamp50" element="lamp_rect"><bounds x="1" y="22" width="1" height="4" /></bezel>
81      <bezel name="lamp60" element="lamp_disk"><bounds x="3" y="23" width="2" height="2" /></bezel>
82      <bezel name="lamp52" element="lamp_rect"><bounds x="6" y="22" width="1" height="4" /></bezel>
83      <bezel name="lamp62" element="lamp_disk"><bounds x="8" y="23" width="2" height="2" /></bezel>
84      <bezel name="lamp54" element="lamp_rect"><bounds x="11" y="22" width="1" height="4" /></bezel>
85      <bezel name="lamp64" element="lamp_disk"><bounds x="13" y="23" width="2" height="2" /></bezel>
86      <bezel name="lamp56" element="lamp_rect"><bounds x="16" y="22" width="1" height="4" /></bezel>
87
88      <bezel name="lamp70" element="lamp_rect"><bounds x="2" y="26" width="4" height="1" /></bezel>
89      <bezel name="lamp72" element="lamp_rect"><bounds x="7" y="26" width="4" height="1" /></bezel>
90      <bezel name="lamp74" element="lamp_rect"><bounds x="12" y="26" width="4" height="1" /></bezel>
91
927   </view>
938</mamelayout>
trunk/src/mess/machine/amstrad.c
r243192r243193
28422842   int i;
28432843   bool slot3 = false,slot7 = false;
28442844
2845   if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000)
2845   if(m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000)
28462846   {
28472847      UINT8 *crt = m_region_cart->base();
28482848      int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1;
r243192r243193
30343034
30353035   astring region_tag;
30363036   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
3037   if (!m_region_cart) // this should never happen, since we make carts mandatory!
3038      m_region_cart = memregion("maincpu");
30393037}
30403038
30413039
r243192r243193
30783076
30793077   astring region_tag;
30803078   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
3081   if (!m_region_cart) // this should never happen, since we make carts mandatory!
3082      m_region_cart = memregion("maincpu");
30833079}
30843080
30853081MACHINE_RESET_MEMBER(amstrad_state,gx4000)
trunk/src/mess/machine/macadb.c
r243192r243193
427427                     {
428428                        if(m_adb_keybuf_start == m_adb_keybuf_end)
429429                        {
430   //                              printf("%s: buffer empty\n", __func__);
430   //                        printf("%s: buffer empty\n", __func__);
431431                           m_adb_buffer[0] = 0xff;
432432                           m_adb_buffer[1] = 0xff;
433433                        }
trunk/src/mess/machine/nes.c
r243192r243193
77 ****************************************************************************/
88
99#include "emu.h"
10#include "crsshair.h"
1011#include "cpu/m6502/m6502.h"
1112#include "includes/nes.h"
13#include "imagedev/flopdrv.h"
1214
1315/***************************************************************************
16    CONSTANTS
17***************************************************************************/
18
19/* Set to dump info about the inputs to the errorlog */
20#define LOG_JOY     0
21
22/* Set to generate prg & chr files when the cart is loaded */
23#define SPLIT_PRG   0
24#define SPLIT_CHR   0
25
26/***************************************************************************
1427    FUNCTIONS
1528***************************************************************************/
1629
r243192r243193
3144      m_cartslot->pcb_reset();
3245
3346   m_maincpu->reset();
47
48   memset(m_pad_latch, 0, sizeof(m_pad_latch));
49   memset(m_zapper_latch, 0, sizeof(m_zapper_latch));
50   m_paddle_latch = 0;
51   m_paddle_btn_latch = 0;
3452}
3553
3654//-------------------------------------------------
3755//  machine_start
3856//-------------------------------------------------
3957
58void nes_state::state_register()
59{
60   save_item(NAME(m_last_frame_flip));
61
62   save_pointer(NAME(m_ciram), 0x800);
63
64   save_item(NAME(m_pad_latch));
65   save_item(NAME(m_zapper_latch));
66   save_item(NAME(m_paddle_latch));
67   save_item(NAME(m_paddle_btn_latch));
68   save_item(NAME(m_mjpanel_latch));
69   save_item(NAME(m_fck_scan));
70   save_item(NAME(m_fck_mode));
71   save_item(NAME(m_mic_obstruct));
72   save_item(NAME(m_powerpad_latch));
73   save_item(NAME(m_ftrainer_scan));
74}
75
76void nes_state::setup_ioports()
77{
78   for (int i = 0; i < 9; i++)
79   {
80      char str[7];
81      sprintf(str, "FCKEY%i", i);
82      m_io_fckey[i] = ioport(str);
83   }
84   for (int i = 0; i < 13; i++)
85   {
86      char str[9];
87      sprintf(str, "SUBKEY%i", i);
88      m_io_subkey[i] = ioport(str);
89   }
90   for (int i = 0; i < 4; i++)
91   {
92      char str[8];
93      sprintf(str, "PAD%i", i + 1);
94      m_io_pad[i] = ioport(str);
95      sprintf(str, "MAH%i", i);
96      m_io_mahjong[i] = ioport(str);
97      sprintf(str, "FT_COL%i", i);
98      m_io_ftrainer[i] = ioport(str);
99   }
100
101   m_io_ctrlsel        = ioport("CTRLSEL");
102   m_io_exp            = ioport("EXP");
103   m_io_paddle         = ioport("PADDLE");
104   m_io_paddle_btn     = ioport("PADDLE_BUTTON");
105   m_io_cc_left        = ioport("CC_LEFT");
106   m_io_cc_right       = ioport("CC_RIGHT");
107   m_io_zapper1_t      = ioport("ZAPPER1_T");
108   m_io_zapper1_x      = ioport("ZAPPER1_X");
109   m_io_zapper1_y      = ioport("ZAPPER1_Y");
110   m_io_zapper2_t      = ioport("ZAPPER2_T");
111   m_io_zapper2_x      = ioport("ZAPPER2_X");
112   m_io_zapper2_y      = ioport("ZAPPER2_Y");
113   m_io_powerpad[0]    = ioport("POWERPAD1");
114   m_io_powerpad[1]    = ioport("POWERPAD2");
115   m_io_disksel        = ioport("FLIPDISK");
116}
117
40118void nes_state::machine_start()
41119{
42120   address_space &space = m_maincpu->space(AS_PROGRAM);
r243192r243193
48126   m_ciram = auto_alloc_array(machine(), UINT8, 0x800);
49127   // other pointers got set in the loading routine, because they 'belong' to the cart itself
50128
51   m_io_disksel = ioport("FLIPDISK");
129   setup_ioports();
52130
53131   if (m_cartslot && m_cartslot->m_cart)
54132   {
r243192r243193
100178      m_cartslot->m_cart->pcb_reg_postload(machine());
101179   }
102180
103   // register saves
104   save_item(NAME(m_last_frame_flip));
105   save_pointer(NAME(m_ciram), 0x800);
181   state_register();
106182}
107183
108184
r243192r243193
112188
113189READ8_MEMBER(nes_state::nes_in0_r)
114190{
191   int cfg = m_io_ctrlsel->read();
192
193   // Some games expect bit 6 to be set because the last entry on the data bus shows up
194   // in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there.
115195   UINT8 ret = 0x40;
116   ret |= m_ctrl1->read_bit0();
117   ret |= m_ctrl1->read_bit34();
196   ret |= (m_pad_latch[0] & 0x01);
197
198   // shift
199   m_pad_latch[0] >>= 1;
200
201   // zapper
202   if ((cfg & 0x000f) == 0x0002)
203   {
204      int x = m_zapper_latch[0][1];  // x-position
205      int y = m_zapper_latch[0][2];  // y-position
206      UINT32 pix, color_base;
207
208      // get the pixel at the gun position
209      pix = m_ppu->get_pixel(x, y);
210
211      // get the color base from the ppu
212      color_base = m_ppu->get_colorbase();
213
214      // check if the cursor is over a bright pixel
215      if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
216         (pix == color_base + 0x33) || (pix == color_base + 0x34))
217         ret &= ~0x08; // sprite hit
218      else
219         ret |= 0x08;  // no sprite hit
220
221      // light gun trigger
222      ret |= (m_zapper_latch[0][0] << 4);
223   }
224
225   if (LOG_JOY)
226      logerror("joy 0 read, val: %02x, pc: %04x\n", ret, space.device().safe_pc());
227
118228   return ret;
119229}
120230
121231READ8_MEMBER(nes_state::nes_in1_r)
122232{
233   int cfg = m_io_ctrlsel->read();
234
235   // Some games expect bit 6 to be set because the last entry on the data bus shows up
236   // in the unused upper 3 bits, so typically a read from $4017 leaves 0x40 there.
123237   UINT8 ret = 0x40;
124   ret |= m_ctrl2->read_bit0();
125   ret |= m_ctrl2->read_bit34();
238   ret |= (m_pad_latch[1] & 0x01);
239
240   // shift
241   m_pad_latch[1] >>= 1;
242
243   // zapper
244   if ((cfg & 0x00f0) == 0x0020)
245   {
246      int x = m_zapper_latch[1][1];  // x-position
247      int y = m_zapper_latch[1][2];  // y-position
248      UINT32 pix, color_base;
249
250      // get the pixel at the gun position
251      pix = m_ppu->get_pixel(x, y);
252
253      // get the color base from the ppu
254      color_base = m_ppu->get_colorbase();
255
256      // check if the cursor is over a bright pixel
257      if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
258         (pix == color_base + 0x33) || (pix == color_base + 0x34))
259         ret &= ~0x08; // sprite hit
260      else
261         ret |= 0x08;  // no sprite hit
262
263      // light gun trigger
264      ret |= (m_zapper_latch[1][0] << 4);
265   }
266
267   // arkanoid paddle
268   if ((cfg & 0x00f0) == 0x0040)
269   {
270      ret |= (m_paddle_btn_latch << 3);   // button
271      ret |= ((m_paddle_latch & 0x80) >> 3);      // paddle data
272      m_paddle_latch <<= 1;
273      m_paddle_latch &= 0xff;
274   }
275
276   // powerpad
277   if ((cfg & 0x00f0) == 0x0050 || (cfg & 0x00f0) == 0x0060)
278   {
279      ret |= ((m_powerpad_latch[0] & 0x01) << 3);
280      ret |= ((m_powerpad_latch[1] & 0x01) << 4);
281      m_powerpad_latch[0] >>= 1;
282      m_powerpad_latch[1] >>= 1;
283   }
284
285   if (LOG_JOY)
286      logerror("joy 1 read, val: %02x, pc: %04x\n", ret, space.device().safe_pc());
287
126288   return ret;
127289}
128290
129291WRITE8_MEMBER(nes_state::nes_in0_w)
130292{
131   m_ctrl1->write(data);
132   m_ctrl2->write(data);
293   int cfg = m_io_ctrlsel->read();
294
295   if (LOG_JOY)
296      logerror("joy write, val: %02x, pc: %04x\n", data, space.device().safe_pc());
297
298   // Check if lightgun has been chosen as input: if so, enable crosshair
299   timer_set(attotime::zero, TIMER_ZAPPER_TICK);
300
301   if (data & 0x01)
302      return;
303
304   // Toggling bit 0 high then low resets controllers
305   m_pad_latch[0] = 0;
306   m_pad_latch[1] = 0;
307   m_zapper_latch[0][0] = 0;
308   m_zapper_latch[0][1] = 0;
309   m_zapper_latch[0][2] = 0;
310   m_zapper_latch[1][0] = 0;
311   m_zapper_latch[1][1] = 0;
312   m_zapper_latch[1][2] = 0;
313   m_paddle_btn_latch = 0;
314   m_paddle_latch = 0;
315   m_powerpad_latch[0] = 0;
316   m_powerpad_latch[1] = 0;
317
318   // P1 inputs
319   switch (cfg & 0x000f)
320   {
321      case 0x01:  // pad 1
322         m_pad_latch[0] = m_io_pad[0]->read();
323         break;
324
325      case 0x02:  // zapper (secondary)
326         m_zapper_latch[0][0] = m_io_zapper1_t->read();
327         m_zapper_latch[0][1] = m_io_zapper1_x->read();
328         m_zapper_latch[0][2] = m_io_zapper1_y->read();
329         break;
330   }
331
332   // P2 inputs
333   switch ((cfg & 0x00f0) >> 4)
334   {
335      case 0x01:  // pad 2
336         m_pad_latch[1] = m_io_pad[1]->read();
337         break;
338
339      case 0x02:  // zapper (primary) - most games expect pad in port1 & zapper in port2
340         m_zapper_latch[1][0] = m_io_zapper2_t->read();
341         m_zapper_latch[1][1] = m_io_zapper2_x->read();
342         m_zapper_latch[1][2] = m_io_zapper2_y->read();
343         break;
344
345      case 0x04:  // arkanoid paddle
346         m_paddle_btn_latch = m_io_paddle_btn->read();
347         m_paddle_latch = (UINT8) (m_io_paddle->read() ^ 0xff);
348         break;
349
350      case 0x05:  // power pad
351      case 0x06:  // power pad
352         m_powerpad_latch[0] = m_io_powerpad[0]->read();
353         m_powerpad_latch[1] = m_io_powerpad[1]->read() | 0xf0;
354         break;
355   }
356
357   // P3 & P4 inputs in NES Four Score are read serially with P1 & P2
358   // P3 inputs
359   if ((cfg & 0x0f00))
360      m_pad_latch[0] |= ((m_io_pad[2]->read() << 8) | (0x08 << 16));    // pad 3 + signature
361
362   // P4 inputs
363   if ((cfg & 0xf000))
364      m_pad_latch[1] |= ((m_io_pad[3]->read() << 8) | (0x04 << 16));    // pad 4 + signature
133365}
134366
135367
368WRITE8_MEMBER(nes_state::nes_in1_w)
369{
370}
371
372
136373READ8_MEMBER(nes_state::fc_in0_r)
137374{
375   int cfg = m_io_ctrlsel->read();
376   int exp = m_io_exp->read();
377
378   // Some games expect bit 6 to be set because the last entry on the data bus shows up
379   // in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there.
138380   UINT8 ret = 0x40;
139   // bit 0 to controller port
140   ret |= m_ctrl1->read_bit0();
381   ret |= (m_pad_latch[0] & 0x01);
141382
142   // expansion port bits (in the original FC, P2 controller was hooked to these lines
143   // too, so in principle some homebrew hardware modification could use the same
144   // connection with P1 controller too)
145   ret |= m_ctrl1->read_exp(0);
146   ret |= m_ctrl2->read_exp(0);
383   // shift
384   m_pad_latch[0] >>= 1;
147385
148   // at the same time, we might have a standard joypad connected to the expansion port which
149   // shall be read as P3 (this is needed here to avoid implementing the expansion port as a
150   // different device compared to the standard control port... it might be changed later)
151   ret |= (m_exp->read_bit0() << 1);
152   // finally, read the expansion port as expected
153   ret |= m_exp->read_exp(0);
386   // microphone bit
387   if ((cfg & 0x00f0) == 0x00f0)
388      ret |= m_mic_obstruct;  //bit2!
389
390   // EXP input
391   switch (exp & 0x0f)
392   {
393      case 0x02:  // FC Keyboard: tape input
394         if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY)
395         {
396            double level = m_cassette->input();
397            if (level < 0)
398               ret |= 0x00;
399            else
400               ret |= 0x02;
401         }
402         break;
403
404      case 0x04:  // Arkanoid paddle
405         ret |= (m_paddle_btn_latch << 1);   // button
406         break;
407
408      case 0x07:  // Mahjong Panel
409         ret |= ((m_mjpanel_latch & 0x01) << 1);
410         m_mjpanel_latch >>= 1;
411         break;
412
413      case 0x08:  // 'multitap' p3
414         ret |= ((m_pad_latch[2] & 0x01) << 1);
415         m_pad_latch[2] >>= 1;
416         break;
417   }
418
419   if (LOG_JOY)
420      logerror("joy 0 read, val: %02x, pc: %04x\n", ret, space.device().safe_pc());
421
154422   return ret;
155423}
156424
157425READ8_MEMBER(nes_state::fc_in1_r)
158426{
427   int exp = m_io_exp->read();
428
429   // Some games expect bit 6 to be set because the last entry on the data bus shows up
430   // in the unused upper 3 bits, so typically a read from $4017 leaves 0x40 there.
159431   UINT8 ret = 0x40;
160   // bit 0 to controller port
161   ret |= m_ctrl2->read_bit0();
432   ret |= (m_pad_latch[1] & 0x01);
162433
163   // expansion port bits (in the original FC, P2 controller was hooked to these lines
164   // too, so in principle some homebrew hardware modification could use the same
165   // connection with P1 controller too)
166   ret |= m_ctrl1->read_exp(1);
167   ret |= m_ctrl2->read_exp(1);
434   // shift
435   m_pad_latch[1] >>= 1;
168436
169   // finally, read the expansion port as expected (standard pad cannot be hooked as P4, so
170   // no read_bit0 here)
171   ret |= m_exp->read_exp(1);
437
438   // EXP input
439   switch (exp & 0x0f)
440   {
441      case 0x01:  // Lightgun
442         {
443            int x = m_zapper_latch[0][1];  // x-position
444            int y = m_zapper_latch[0][2];  // y-position
445            UINT32 pix, color_base;
446
447            // get the pixel at the gun position
448            pix = m_ppu->get_pixel(x, y);
449
450            // get the color base from the ppu
451            color_base = m_ppu->get_colorbase();
452
453            // check if the cursor is over a bright pixel
454            if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
455               (pix == color_base + 0x33) || (pix == color_base + 0x34))
456               ret &= ~0x08; // sprite hit
457            else
458               ret |= 0x08;  // no sprite hit
459
460            // light gun trigger
461            ret |= (m_zapper_latch[0][0] << 4);
462         }
463         break;
464
465      case 0x02:  // FC Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
466         if (m_fck_scan < 9)
467            ret |= ~(((m_io_fckey[m_fck_scan]->read() >> (m_fck_mode * 4)) & 0x0f) << 1) & 0x1e;
468         else
469            ret |= 0x1e;
470         break;
471
472      case 0x03:  // Subor Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
473         if (m_fck_scan < 12)
474            ret |= ~(((m_io_subkey[m_fck_scan]->read() >> (m_fck_mode * 4)) & 0x0f) << 1) & 0x1e;
475         else
476            ret |= 0x1e;
477         break;
478
479      case 0x04:  // Arkanoid paddle
480         ret |= ((m_paddle_latch & 0x80) >> 6);      // paddle data
481         m_paddle_latch <<= 1;
482         m_paddle_latch &= 0xff;
483         break;
484
485      case 0x05:  // family trainer
486      case 0x06:  // family trainer
487         if (!BIT(m_ftrainer_scan, 0))
488         {
489            // read low line: buttons 9,10,11,12
490            for (int i = 0; i < 4; i++)
491               ret |= ((m_io_ftrainer[i]->read() & 0x01) << (1 + i));
492         }
493         else if (!BIT(m_ftrainer_scan, 1))
494         {
495            // read mid line: buttons 5,6,7,8
496            for (int i = 0; i < 4; i++)
497               ret |= ((m_io_ftrainer[i]->read() & 0x02) << (1 + i));
498         }
499         else if (!BIT(m_ftrainer_scan, 2))
500         {
501            // read high line: buttons 1,2,3,4
502            for (int i = 0; i < 4; i++)
503               ret |= ((m_io_ftrainer[i]->read() & 0x04) << (1 + i));
504         }
505         break;
506
507      case 0x07:  // Mahjong Panel
508         ret |= ((m_mjpanel_latch & 0x01) << 1);
509         m_mjpanel_latch >>= 1;
510         break;
511
512      case 0x08:  // 'multitap' p4
513         ret |= ((m_pad_latch[3] & 0x01) << 1);
514         m_pad_latch[3] >>= 1;
515         break;
516   }
517
518   if (LOG_JOY)
519      logerror("joy 1 read, val: %02x, pc: %04x\n", ret, space.device().safe_pc());
520
172521   return ret;
173522}
174523
175524WRITE8_MEMBER(nes_state::fc_in0_w)
176525{
177   m_ctrl1->write(data);
178   m_ctrl2->write(data);
179   m_exp->write(data);
526   int cfg = m_io_ctrlsel->read();
527   int exp = m_io_exp->read();
528
529   if (LOG_JOY)
530      logerror("joy write, val: %02x, pc: %04x\n", data, space.device().safe_pc());
531
532   // Check if lightgun has been chosen as input: if so, enable crosshair
533   timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
534
535   // keyboards
536   if ((exp & 0x0f) == 0x02 || (exp & 0x0f) == 0x03)
537   {
538      // tape output (not fully tested)
539      if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_RECORD)
540         m_cassette->output(((data & 0x07) == 0x07) ? +1.0 : -1.0);
541
542      if (BIT(data, 2))   // keyboard active
543      {
544         int lines = ((exp & 0x0f) == 0x02) ? 9 : 12;
545         UINT8 out = BIT(data, 1);   // scan
546
547         if (m_fck_mode && !out && ++m_fck_scan > lines)
548            m_fck_scan = 0;
549
550         m_fck_mode = out;   // access lower or upper 4 bits
551
552         if (BIT(data, 0))   // reset
553            m_fck_scan = 0;
554      }
555   }
556
557   // family trainer
558   if ((exp & 0x0f) == 0x05 || (exp & 0x0f) == 0x06)
559   {
560      // select raw to scan
561      m_ftrainer_scan = data & 0x07;
562   }
563
564   if (data & 0x01)
565      return;
566
567   // Toggling bit 0 high then low resets controllers
568   m_pad_latch[0] = 0;
569   m_pad_latch[1] = 0;
570   m_pad_latch[2] = 0;
571   m_pad_latch[3] = 0;
572   m_zapper_latch[0][0] = 0;
573   m_zapper_latch[0][1] = 0;
574   m_zapper_latch[0][2] = 0;
575   m_paddle_btn_latch = 0;
576   m_paddle_latch = 0;
577   m_mjpanel_latch = 0;
578   m_mic_obstruct = 0;
579
580   // P1 inputs
581   switch (cfg & 0x000f)
582   {
583      case 0x01:  // pad 1
584         m_pad_latch[0] = m_io_pad[0]->read();
585         break;
586
587      case 0x02:  // crazy climber (left stick)
588         m_pad_latch[0] = m_io_cc_left->read();
589         break;
590   }
591
592   // P2 inputs
593   switch ((cfg & 0x00f0) >> 4)
594   {
595      case 0x01:  // pad 2
596         m_pad_latch[1] = m_io_pad[1]->read();
597         break;
598
599      case 0x02:  // crazy climber (right stick)
600         m_pad_latch[1] = m_io_cc_right->read();
601         break;
602
603      case 0x0f:  // pad 2 old style with microphone instead of START/SELECT keys
604         // we only emulate obstruction of mic (when you blow or talk into it)
605         m_mic_obstruct = m_io_pad[1]->read() & 0x04;
606         m_pad_latch[1] = (m_io_pad[1]->read() & ~0x04);
607         break;
608   }
609
610   // P3 & P4 inputs in Famicom (e.g. through Hori Twin Adapter or Hori 4 Players Adapter)
611   // are read in parallel with P1 & P2 (just using diff bits)
612   // P3 inputs
613   if ((exp & 0x0f) == 8 && (cfg & 0x0f00) == 0x0100)
614      m_pad_latch[2] = m_io_pad[2]->read();     // pad 3
615
616   // P4 inputs
617   if ((exp & 0x0f) == 8 && (cfg & 0xf000) == 0x1000)
618      m_pad_latch[3] = m_io_pad[3]->read();     // pad 4
619
620
621   // EXP input
622   switch (exp & 0x0f)
623   {
624      case 0x01:  // Lightgun
625         m_zapper_latch[0][0] = m_io_zapper2_t->read();
626         m_zapper_latch[0][1] = m_io_zapper2_x->read();
627         m_zapper_latch[0][2] = m_io_zapper2_y->read();
628         break;
629
630      case 0x02:  // FC Keyboard
631      case 0x03:  // Subor Keyboard
632         // these are scanned differently than other devices:
633         // writes to $4016 with bit2 set always update the
634         // line counter and writing bit0 set resets the counter
635         break;
636
637      case 0x04:  // Arkanoid paddle
638         m_paddle_btn_latch = m_io_paddle_btn->read();
639         m_paddle_latch = (UINT8) (m_io_paddle->read() ^ 0xff);
640         break;
641
642      case 0x05:  // family trainer
643      case 0x06:  // family trainer
644         // these are scanned differently than other devices:
645         // bit0-bit2 of writes to $4016 select the row to read
646         // from from the mat input "columns"
647         break;
648
649
650      case 0x07:  // Mahjong Panel
651         if (data & 0xf8)
652            logerror("Error: Mahjong panel read with mux data %02x\n", (data & 0xfe));
653         else
654            m_mjpanel_latch = m_io_mahjong[(data & 0xfe) >> 1]->read();
655         break;
656   }
657
180658}
181659
182660
661void nes_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
662{
663   switch (id)
664   {
665      case TIMER_ZAPPER_TICK:
666         if ((m_io_ctrlsel->read() & 0x000f) == 0x0002)
667         {
668            /* enable lightpen crosshair */
669            crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL);
670         }
671         else
672         {
673            /* disable lightpen crosshair */
674            crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE);
675         }
676
677         if ((m_io_ctrlsel->read() & 0x00f0) == 0x0020)
678         {
679            /* enable lightpen crosshair */
680            crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_ALL);
681         }
682         else
683         {
684            /* disable lightpen crosshair */
685            crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_NONE);
686         }
687         break;
688      case TIMER_LIGHTGUN_TICK:
689         if ((m_io_exp->read() & 0x0f) == 0x01)
690         {
691            /* enable lightpen crosshair */
692            crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL);
693         }
694         else
695         {
696            /* disable lightpen crosshair */
697            crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE);
698         }
699         break;
700      default:
701         assert_always(FALSE, "Unknown id in nes_state::device_timer");
702   }
703}
704
705
183706DRIVER_INIT_MEMBER(nes_state,famicom)
184707{
185708   // setup alt input handlers for additional FC input devices
r243192r243193
188711   space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this));
189712   space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this));
190713}
191
192NESCTRL_BRIGHTPIXEL_CB(nes_state::bright_pixel)
193{
194   // get the pixel at the gun position
195   UINT32 pix = m_ppu->get_pixel(x, y);
196
197   // get the color base from the ppu
198   UINT32 color_base = m_ppu->get_colorbase();
199
200   // check if the cursor is over a bright pixel
201   if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
202      (pix == color_base + 0x33) || (pix == color_base + 0x34))
203      return true;
204   else
205      return false;
206}
trunk/src/mess/machine/sms.c
r243192r243193
9494      data1 = m_port_gg_dc->read();
9595      m_port_dc_reg &= ~0x03f | data1;
9696
97      data2 = m_port_gg_ext->port_r();
97      data2 = m_port_gear2gear->port_r();
9898   }
9999   else
100100   {
r243192r243193
207207      if (!m_is_gamegear)
208208         m_port_ctrl2->port_w(ctrl2_port_data);
209209      else
210         m_port_gg_ext->port_w(ctrl2_port_data); // not verified
210         m_port_gear2gear->port_w(ctrl2_port_data); // not verified
211211   }
212212   // check if TH is set to input (1).
213213   if (data & 0x08)
r243192r243193
215215      if (!m_is_gamegear)
216216         ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r();
217217      else
218         ctrl2_port_data &= ~0x40 | m_port_gg_ext->port_r(); // not verified
218         ctrl2_port_data &= ~0x40 | m_port_gear2gear->port_r(); // not verified
219219
220220      // check if TH input level is high (1) and was output/low (0)
221221      if ((ctrl2_port_data & 0x40) && !(m_io_ctrl_reg & 0x88))
trunk/src/mess/mess.lst
r243192r243193
5454jaguar  // Atari Jaguar
5555jaguarcd  // Atari Jaguar CD
5656
57//BancTec
58banctec // BancTec ESeries panel
59
6057// Nintendo
6158nes       // Nintendo Entertainment System
6259nespal    // Nintendo Entertainment System PAL
r243192r243193
774771compc1  // 1984 Commodore PC-1
775772pc10iii // 1987 Commodore PC-10 III
776773pc7000  // 1985 Sharp PC-7000
774pcd     // Siemens PC-D
777775olypeopl // Olympia People PC
778776sx16    // Sanyo SX-16
779777mbc16   // Sanyo MBC-16
780778ataripc3
781779ssam88s
782780
783// Non-PC msdos
784pcd     // Siemens PC-D
785slicer  // 1983 Slicer Computers
786
787781// PC Junior
788782ibmpcjr   // 1984 IBM PC Jr
789783ibmpcjx   // 1985 IBM PC JX
trunk/src/mess/mess.mak
r243192r243193
614614BUSES += MSX_SLOT
615615BUSES += NEOGEO
616616BUSES += NES
617BUSES += NES_CTRL
618617BUSES += NUBUS
619618BUSES += O2
620619BUSES += ORICEXT
r243192r243193
679678   $(MESSOBJ)/att.a \
680679   $(MESSOBJ)/bally.a \
681680   $(MESSOBJ)/bandai.a \
682   $(MESSOBJ)/banctec.a \
683681   $(MESSOBJ)/be.a \
684682   $(MESSOBJ)/bnpo.a \
685683   $(MESSOBJ)/bondwell.a \
r243192r243193
798796   $(MESSOBJ)/siemens.a \
799797   $(MESSOBJ)/sinclair.a \
800798   $(MESSOBJ)/skeleton.a \
801   $(MESSOBJ)/slicer.a \
802799   $(MESSOBJ)/snk.a \
803800   $(MESSOBJ)/sony.a \
804801   $(MESSOBJ)/sord.a \
r243192r243193
10431040$(MESSOBJ)/bally.a:             \
10441041   $(MESS_DRIVERS)/astrocde.o  \
10451042
1046$(MESSOBJ)/banctec.a:            \
1047   $(MESS_DRIVERS)/banctec.o    \
1048
10491043$(MESSOBJ)/bandai.a:            \
10501044   $(MESS_DRIVERS)/sv8000.o    \
10511045   $(MESS_DRIVERS)/rx78.o      \
r243192r243193
16541648$(MESSOBJ)/siemens.a:           \
16551649   $(MESS_DRIVERS)/pcd.o       \
16561650
1657$(MESSOBJ)/slicer.a:           \
1658   $(MESS_DRIVERS)/slicer.o   \
1659
16601651$(MESSOBJ)/snk.a:               \
16611652   $(MESS_DRIVERS)/ng_aes.o    \
16621653   $(MESS_DRIVERS)/ngp.o $(MESS_VIDEO)/k1ge.o \
trunk/src/osd/modules/debugger/debug_module.h
r243192r243193
1/*
2 * debug_module.h
3 *
4 */
5
6#ifndef DEBUG_MODULE_H_
7#define DEBUG_MODULE_H_
8
9#include "osdepend.h"
10#include "modules/osdmodule.h"
11#include "emu.h"
12
13//============================================================
14//  CONSTANTS
15//============================================================
16
17#define OSD_DEBUG_PROVIDER "debugger"
18
19class debug_module
20{
21public:
22
23   virtual ~debug_module() { }
24
25   virtual void init_debugger(running_machine &machine) = 0;
26   virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
27   virtual void debugger_update() = 0;
28};
29
30
31
32#endif /* DEBUG_MODULE_H_ */
trunk/src/osd/modules/debugger/debugint.c
r243192r243193
1010*********************************************************************/
1111
1212#include "emu.h"
13#include "debugint.h"
1314#include "ui/ui.h"
1415#include "rendfont.h"
1516#include "uiinput.h"
r243192r243193
2122#include "debug/debugcon.h"
2223#include "debug/debugcpu.h"
2324
24#include "debug_module.h"
25#include "modules/osdmodule.h"
2625
27class debug_internal : public osd_module, public debug_module
28{
29public:
30   debug_internal()
31   : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(),
32      m_machine(NULL)
33   {
34   }
35
36   virtual ~debug_internal() { }
37
38   virtual int init() { return 0;}
39   virtual void exit();
40
41   virtual void init_debugger(running_machine &machine);
42   virtual void wait_for_debugger(device_t &device, bool firststop);
43   virtual void debugger_update();
44
45private:
46   running_machine *m_machine;
47};
48
49
50
5126/***************************************************************************
5227    CONSTANTS
5328***************************************************************************/
5429
30const osd_debugger_type OSD_DEBUGGER_INTERNAL = &osd_debugger_creator<debugger_internal>;
31
5532#define BORDER_YTHICKNESS 1
5633#define BORDER_XTHICKNESS 1
5734#define HSB_HEIGHT 20
r243192r243193
262239    LOCAL VARIABLES
263240***************************************************************************/
264241
265static render_font *    debug_font = NULL;
242static render_font *    debug_font;
266243static int              debug_font_width;
267244static int              debug_font_height;
268245static float            debug_font_aspect;
269static DView *          list = NULL;
246static DView *          list;
270247static DView *          focus_view;
271248
272249static ui_menu *        menu;
r243192r243193
864841#endif
865842}
866843
867void debug_internal::exit()
844void debugger_internal::debugger_exit()
868845{
869846   for (DView *ndv = list; ndv != NULL; )
870847   {
r243192r243193
881858      global_free(menu);
882859}
883860
884void debug_internal::init_debugger(running_machine &machine)
861void debugger_internal::init_debugger(running_machine &machine)
885862{
886863   unicode_char ch;
887864   int chw;
r243192r243193
14331410}
14341411
14351412
1436void debug_internal::wait_for_debugger(device_t &device, bool firststop)
1413void debugger_internal::wait_for_debugger(device_t &device, bool firststop)
14371414{
14381415   if (firststop && list == NULL)
14391416   {
r243192r243193
14661443
14671444}
14681445
1469void debug_internal::debugger_update()
1446void debugger_internal::debugger_update()
14701447{
1471   if ((m_machine != NULL) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING))
1448   if (!debug_cpu_is_stopped(*m_machine) && m_machine->phase() == MACHINE_PHASE_RUNNING)
14721449   {
14731450      update_views();
14741451   }
14751452}
14761453
1477MODULE_DEFINITION(DEBUG_INTERNAL, debug_internal)
1454//-------------------------------------------------
1455//  debugger_internal - constructor
1456//-------------------------------------------------
1457debugger_internal::debugger_internal(const osd_interface &osd)
1458   : osd_debugger_interface(osd), m_machine(NULL)
1459{
1460}
trunk/src/osd/modules/debugger/debugint.h
r0r243193
1/*********************************************************************
2
3    debugint.c
4
5    Internal debugger frontend using render interface.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12#pragma once
13
14#ifndef __DEBUGGER_INTERNAL_H__
15#define __DEBUGGER_INTERNAL_H__
16
17#include "osdepend.h"
18#include "modules/lib/osdobj_common.h"
19
20class debugger_internal : public osd_debugger_interface
21{
22public:
23   // construction/destruction
24   debugger_internal(const osd_interface &osd);
25   virtual ~debugger_internal() { }
26
27   virtual void init_debugger(running_machine &machine);
28   virtual void wait_for_debugger(device_t &device, bool firststop);
29   virtual void debugger_update();
30   virtual void debugger_exit();
31private:
32   running_machine *m_machine;
33};
34
35extern const osd_debugger_type OSD_DEBUGGER_INTERNAL;
36
37#endif /* __DEBUGGER_INTERNAL_H__ */
trunk/src/osd/modules/debugger/debugosx.h
r243192r243193
367367
368368#endif // __OBJC__
369369
370class debugger_osx : public osd_debugger_interface
371{
372public:
373   // construction/destruction
374   debugger_osx(const osd_interface &osd);
375   virtual ~debugger_osx() { }
376
377   virtual void init_debugger(running_machine &machine);
378   virtual void wait_for_debugger(device_t &device, bool firststop);
379   virtual void debugger_update();
380   virtual void debugger_exit();
381private:
382   running_machine *m_machine;
383};
384
385extern const osd_debugger_type OSD_DEBUGGER_OSX;
386
387
370388#endif // __SDL_DEBUGOSX__
trunk/src/osd/modules/debugger/debugosx.m
r243192r243193
4242// MAMEOS headers
4343#include "debugosx.h"
4444#include "osdsdl.h"
45#include "debug_module.h"
4645
47//============================================================
48//  MODULE SUPPORT
49//============================================================
5046
51static MAMEDebugConsole *main_console = nil;
5247
53class debugger_osx : public osd_module, public debug_module
54{
55public:
56    debugger_osx()
57    : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
58      m_machine(NULL)
59    {
60    }
61
62    virtual ~debugger_osx() { }
63
64    virtual int init() { return 0;}
65    virtual void exit()
66    {
67    }
68
69    virtual void init_debugger(running_machine &machine);
70    virtual void wait_for_debugger(device_t &device, bool firststop);
71    virtual void debugger_update();
72
73private:
74    running_machine *m_machine;
75};
76
77MODULE_DEFINITION(DEBUG_OSX, debugger_osx)
78
7948//============================================================
8049//  LOCAL VARIABLES
8150//============================================================
8251
52static MAMEDebugConsole *main_console = nil;
8353
8454static BOOL waiting_for_debugger = NO;
8555
r243192r243193
9767
9868static void console_create_window(running_machine &machine);
9969
70const osd_debugger_type OSD_DEBUGGER_OSX = &osd_debugger_creator<debugger_osx>;
71
72//-------------------------------------------------
73//  debugger_osx - constructor
74//-------------------------------------------------
75debugger_osx::debugger_osx(const osd_interface &osd)
76   : osd_debugger_interface(osd), m_machine(NULL)
77{
78}
79
10080//============================================================
10181//  debugger_osx::init_debugger
10282//============================================================
r243192r243193
151131}
152132
153133//============================================================
134//  debugger_exit
135//============================================================
136
137void debugger_osx::debugger_exit()
138{
139}
140
141//============================================================
154142//  debugwin_view_update
155143//============================================================
156144
trunk/src/osd/modules/debugger/debugqt.c
r243192r243193
1111
1212#define NO_MEM_TRACKING
1313
14#include "debug_module.h"
15#include "modules/osdmodule.h"
16
17#if (USE_QTDEBUG)
18
1914#include <vector>
2015
2116#include <QtGui/QtGui>
r243192r243193
3328#include "qt/debugqtbreakpointswindow.h"
3429#include "qt/debugqtdeviceswindow.h"
3530#include "qt/debugqtdeviceinformationwindow.h"
31#include "debugqt.h"
3632
37class debug_qt : public osd_module, public debug_module
33
34osd_debugger_interface *qt_osd_debugger_creator(const osd_interface &osd)
3835{
39public:
40   debug_qt()
41   : osd_module(OSD_DEBUG_PROVIDER, "qt"), debug_module(),
42      m_machine(NULL)
43   {
44   }
36   return new debugger_qt(osd);
37}
38const osd_debugger_type OSD_DEBUGGER_QT = &qt_osd_debugger_creator;
4539
46   virtual ~debug_qt() { }
47
48   virtual int init() { return 0;}
49   virtual void exit() { }
50
51   virtual void init_debugger(running_machine &machine);
52   virtual void wait_for_debugger(device_t &device, bool firststop);
53   virtual void debugger_update();
54
55private:
56   running_machine *m_machine;
57};
58
5940//============================================================
6041//  "Global" variables to make QT happy
6142//============================================================
r243192r243193
6647bool oneShot = true;
6748static MainWindow* mainQtWindow = NULL;
6849
50//-------------------------------------------------
51//  debugger_qt - constructor
52//-------------------------------------------------
53debugger_qt::debugger_qt(const osd_interface &osd)
54   : osd_debugger_interface(osd), m_machine(NULL)
55{
56}
57
58debugger_qt::~debugger_qt()
59{
60}
61
6962//============================================================
7063//  XML configuration save/load
7164//============================================================
r243192r243193
235228bool winwindow_qt_filter(void *message);
236229#endif
237230
238void debug_qt::init_debugger(running_machine &machine)
231void debugger_qt::init_debugger(running_machine &machine)
239232{
240233   if (qApp == NULL)
241234   {
r243192r243193
276269void winwindow_update_cursor_state(running_machine &machine);
277270#endif
278271
279void debug_qt::wait_for_debugger(device_t &device, bool firststop)
272void debugger_qt::wait_for_debugger(device_t &device, bool firststop)
280273{
281274#if defined(SDLMAME_UNIX) || defined(SDLMAME_WIN32)
282275   sdl_entered_debugger = 1;
r243192r243193
351344//  Available for video.*
352345//============================================================
353346
354void debug_qt::debugger_update()
347void debugger_qt::debugger_update()
355348{
356349   qApp->processEvents(QEventLoop::AllEvents, 1);
357350}
358351
359#else /* SDLMAME_UNIX */
360   MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt")
361#endif
362
363MODULE_DEFINITION(DEBUG_QT, debug_qt)
352void debugger_qt::debugger_exit()
353{
354}
trunk/src/osd/modules/debugger/debugqt.h
r0r243193
1//============================================================
2//
3//  debugqt.h - SDL/QT debug window handling
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11
12#pragma once
13
14#ifndef __DEBUGGER_QT_H__
15#define __DEBUGGER_QT_H__
16
17#include "emu.h"
18
19class debugger_qt : public osd_debugger_interface
20{
21public:
22   // construction/destruction
23   debugger_qt(const osd_interface &osd);
24   virtual ~debugger_qt();
25
26   virtual void init_debugger(running_machine &machine);
27   virtual void wait_for_debugger(device_t &device, bool firststop);
28   virtual void debugger_update();
29   virtual void debugger_exit();
30
31private:
32   running_machine *m_machine;
33};
34
35extern const osd_debugger_type OSD_DEBUGGER_QT;
36
37#endif /* __DEBUGGER_QT_H__ */
trunk/src/osd/modules/debugger/debugwin.c
r243192r243193
66//
77//============================================================
88
9#include "debug_module.h"
10#include "modules/osdmodule.h"
11
12#if defined(OSD_WINDOWS) /*|| defined(SDLMAME_WIN32)*/
13
149// standard windows headers
1510#define WIN32_LEAN_AND_MEAN
1611#include <windows.h>
r243192r243193
4136#include "strconv.h"
4237#include "winutf8.h"
4338
44class debugger_windows : public osd_module, public debug_module
45{
46public:
47   debugger_windows()
48   : osd_module(OSD_DEBUG_PROVIDER, "windows"), debug_module(),
49      m_machine(NULL)
50   {
51   }
39#include "debugwin.h"
5240
53   virtual ~debugger_windows() { }
41const osd_debugger_type OSD_DEBUGGER_WINDOWS = &osd_debugger_creator<debugger_windows>;
5442
55   virtual int init() { return 0;}
56   virtual void exit();
57
58   virtual void init_debugger(running_machine &machine);
59   virtual void wait_for_debugger(device_t &device, bool firststop);
60   virtual void debugger_update();
61
62private:
63   running_machine *m_machine;
64};
6543//============================================================
6644//  PARAMETERS
6745//============================================================
r243192r243193
196174//  LOCAL VARIABLES
197175//============================================================
198176
199static debugwin_info *window_list = NULL;
177static debugwin_info *window_list;
200178static debugwin_info *main_console;
201179static UINT32 main_console_regwidth;
202180
r243192r243193
261239static void image_update_menu(debugwin_info *info);
262240
263241
242//-------------------------------------------------
243//  debugger_windows - constructor
244//-------------------------------------------------
245debugger_windows::debugger_windows(const osd_interface &osd)
246   : osd_debugger_interface(osd)
247{
248}
249
264250//============================================================
265251//  wait_for_debugger
266252//============================================================
r243192r243193
467453//  debugwin_destroy_windows
468454//============================================================
469455
470void debugger_windows::exit()
456void debugger_windows::debugger_exit()
471457{
472458   // loop over windows and free them
473459   while (window_list != NULL)
r243192r243193
30933079   for (info = window_list; info != NULL; info = info->next)
30943080      smart_show_window(info->wnd, show);
30953081}
3096#else /* not windows */
3097   MODULE_NOT_SUPPORTED(debugger_windows, OSD_DEBUG_PROVIDER, "windows")
3098#endif
3099
3100MODULE_DEFINITION(DEBUG_WINDOWS, debugger_windows)
trunk/src/osd/modules/debugger/debugwin.h
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3//============================================================
4//
5//  debugwin.h - Win32 debug window handling
6//
7//============================================================
8
9
10#pragma once
11
12#ifndef __DEBUGGER_WINDOWS_H__
13#define __DEBUGGER_WINDOWS_H__
14
15#include "osdepend.h"
16#include "modules/lib/osdobj_common.h"
17
18class debugger_windows : public osd_debugger_interface
19{
20public:
21   // construction/destruction
22   debugger_windows(const osd_interface &osd);
23   virtual ~debugger_windows() { }
24
25   virtual void init_debugger(running_machine &machine);
26   virtual void wait_for_debugger(device_t &device, bool firststop);
27   virtual void debugger_update();
28   virtual void debugger_exit();
29private:
30   running_machine *m_machine;
31};
32
33extern const osd_debugger_type OSD_DEBUGGER_WINDOWS;
34
35#endif /* __DEBUGGER_WINDOWS_H__ */
trunk/src/osd/modules/debugger/none.c
r243192r243193
44//
55//============================================================
66
7#include "debug_module.h"
8#include "modules/osdmodule.h"
9
7#include "none.h"
108#include "debug/debugcpu.h"
119
12class debug_none : public osd_module, public debug_module
10const osd_debugger_type OSD_DEBUGGER_NONE = &osd_debugger_creator<debugger_none>;
11
12//-------------------------------------------------
13//  debugger_none - constructor
14//-------------------------------------------------
15debugger_none::debugger_none(const osd_interface &osd)
16   : osd_debugger_interface(osd), m_machine(NULL)
1317{
14public:
15   debug_none()
16   : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(),
17      m_machine(NULL)
18   {
19   }
18}
2019
21   virtual ~debug_none() { }
22
23   virtual int init() { return 0;}
24   virtual void exit() { }
25
26   virtual void init_debugger(running_machine &machine);
27   virtual void wait_for_debugger(device_t &device, bool firststop);
28   virtual void debugger_update();
29
30private:
31   running_machine *m_machine;
32};
33
34void debug_none::init_debugger(running_machine &machine)
20void debugger_none::init_debugger(running_machine &machine)
3521{
36   m_machine = &machine;
22    m_machine = &machine;
3723}
3824
39void debug_none::wait_for_debugger(device_t &device, bool firststop)
25void debugger_none::wait_for_debugger(device_t &device, bool firststop)
4026{
4127   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
4228}
4329
44void debug_none::debugger_update()
30void debugger_none::debugger_update()
4531{
4632}
4733
48MODULE_DEFINITION(DEBUG_NONE, debug_none)
34void debugger_none::debugger_exit()
35{
36}
trunk/src/osd/modules/debugger/none.h
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic
3/***************************************************************************
4
5    none.h
6
7    Dummy debugger interface.
8
9*******************************************************************c********/
10
11#pragma once
12
13#ifndef __DEBUGGER_NONE_H__
14#define __DEBUGGER_NONE_H__
15
16#include "osdepend.h"
17#include "modules/lib/osdobj_common.h"
18
19class debugger_none : public osd_debugger_interface
20{
21public:
22   // construction/destruction
23   debugger_none(const osd_interface &osd);
24   virtual ~debugger_none() { }
25
26   virtual void init_debugger(running_machine &machine);
27   virtual void wait_for_debugger(device_t &device, bool firststop);
28   virtual void debugger_update();
29   virtual void debugger_exit();
30private:
31   running_machine *m_machine;
32};
33
34extern const osd_debugger_type OSD_DEBUGGER_NONE;
35
36#endif  /* __DEBUGGER_NONE_H__ */
trunk/src/osd/modules/lib/osdlib.h
r243192r243193
4747void osd_process_kill(void);
4848
4949/*-----------------------------------------------------------------------------
50    osd_getenv: return pointer to environment variable
51
52    Parameters:
53
54        name  - name of environment variable
55
56    Return value:
57
58        pointer to value
59-----------------------------------------------------------------------------*/
60char *osd_getenv(const char *name);
61
62/*-----------------------------------------------------------------------------
5063    osd_setenv: set environment variable
5164
5265    Parameters:
trunk/src/osd/modules/lib/osdlib_macosx.c
r243192r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
1// This file is a placeholder.
112
12#include <stdlib.h>
13#include <unistd.h>
14#include <sys/mman.h>
153#include <sys/types.h>
164#include <signal.h>
5#include <unistd.h>
176
187#include <mach/mach.h>
198#include <mach/mach_time.h>
r243192r243193
2918#include "sdlinc.h"
3019
3120//============================================================
32//  osd_getenv
33//============================================================
34
35const char *osd_getenv(const char *name)
36{
37   return getenv(name);
38}
39
40//============================================================
41//  osd_setenv
42//============================================================
43
44int osd_setenv(const char *name, const char *value, int overwrite)
45{
46   return setenv(name, value, overwrite);
47}
48
49//============================================================
5021//  osd_process_kill
5122//============================================================
5223
5324void osd_process_kill(void)
5425{
55   kill(getpid(), SIGKILL);
26    kill(getpid(), SIGKILL);
5627}
5728
5829//============================================================
r243192r243193
6132
6233int osd_get_num_processors(void)
6334{
64   int processors = 1;
35    int processors = 1;
6536
66   struct host_basic_info host_basic_info;
67   unsigned int count;
68   kern_return_t r;
69   mach_port_t my_mach_host_self;
37    struct host_basic_info host_basic_info;
38    unsigned int count;
39    kern_return_t r;
40    mach_port_t my_mach_host_self;
7041
71   count = HOST_BASIC_INFO_COUNT;
72   my_mach_host_self = mach_host_self();
73   if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
74   {
75      processors = host_basic_info.avail_cpus;
76   }
77   mach_port_deallocate(mach_task_self(), my_mach_host_self);
42    count = HOST_BASIC_INFO_COUNT;
43    my_mach_host_self = mach_host_self();
44    if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
45    {
46        processors = host_basic_info.avail_cpus;
47    }
48    mach_port_deallocate(mach_task_self(), my_mach_host_self);
7849
79   return processors;
50    return processors;
8051}
8152
8253//============================================================
r243192r243193
8657void *osd_malloc(size_t size)
8758{
8859#ifndef MALLOC_DEBUG
89   return malloc(size);
60    return malloc(size);
9061#else
9162#error "MALLOC_DEBUG not yet supported"
9263#endif
r243192r243193
10071void *osd_malloc_array(size_t size)
10172{
10273#ifndef MALLOC_DEBUG
103   return malloc(size);
74    return malloc(size);
10475#else
10576#error "MALLOC_DEBUG not yet supported"
10677#endif
r243192r243193
11485void osd_free(void *ptr)
11586{
11687#ifndef MALLOC_DEBUG
117   free(ptr);
88    free(ptr);
11889#else
11990#error "MALLOC_DEBUG not yet supported"
12091#endif
12192}
12293
123
12494//============================================================
125//  osd_alloc_executable
126//
127//  allocates "size" bytes of executable memory.  this must take
128//  things like NX support into account.
95//  osd_getenv
12996//============================================================
13097
131void *osd_alloc_executable(size_t size)
98char *osd_getenv(const char *name)
13299{
133#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
134   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
135#elif defined(SDLMAME_UNIX)
136   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
137#endif
100    return getenv(name);
138101}
139102
140103//============================================================
141//  osd_free_executable
142//
143//  frees memory allocated with osd_alloc_executable
104//  osd_setenv
144105//============================================================
145106
146void osd_free_executable(void *ptr, size_t size)
107int osd_setenv(const char *name, const char *value, int overwrite)
147108{
148#ifdef SDLMAME_SOLARIS
149   munmap((char *)ptr, size);
150#else
151   munmap(ptr, size);
152#endif
109    return setenv(name, value, overwrite);
153110}
154111
155112//============================================================
156//  osd_break_into_debugger
157//============================================================
158
159void osd_break_into_debugger(const char *message)
160{
161   #ifdef MAME_DEBUG
162   printf("MAME exception: %s\n", message);
163   printf("Attempting to fall into debugger\n");
164   kill(getpid(), SIGTRAP);
165   #else
166   printf("Ignoring MAME exception: %s\n", message);
167   #endif
168}
169
170
171//============================================================
172113//  PROTOTYPES
173114//============================================================
174115
r243192r243193
191132
192133static osd_ticks_t init_cycle_counter(void)
193134{
194   osd_ticks_t start, end;
195   osd_ticks_t a, b;
135    osd_ticks_t start, end;
136    osd_ticks_t a, b;
196137
197   cycle_counter = mach_cycle_counter;
198   ticks_counter = mach_cycle_counter;
138    cycle_counter = mach_cycle_counter;
139    ticks_counter = mach_cycle_counter;
199140
200   // wait for an edge on the timeGetTime call
201   a = SDL_GetTicks();
202   do
203   {
204      b = SDL_GetTicks();
205   } while (a == b);
141    // wait for an edge on the timeGetTime call
142    a = SDL_GetTicks();
143    do
144    {
145        b = SDL_GetTicks();
146    } while (a == b);
206147
207   // get the starting cycle count
208   start = (*cycle_counter)();
148    // get the starting cycle count
149    start = (*cycle_counter)();
209150
210   // now wait for 1/4 second total
211   do
212   {
213      a = SDL_GetTicks();
214   } while (a - b < 250);
151    // now wait for 1/4 second total
152    do
153    {
154        a = SDL_GetTicks();
155    } while (a - b < 250);
215156
216   // get the ending cycle count
217   end = (*cycle_counter)();
157    // get the ending cycle count
158    end = (*cycle_counter)();
218159
219   // compute ticks_per_sec
220   ticks_per_second = (end - start) * 4;
160    // compute ticks_per_sec
161    ticks_per_second = (end - start) * 4;
221162
222   // return the current cycle count
223   return (*cycle_counter)();
163    // return the current cycle count
164    return (*cycle_counter)();
224165}
225166
226167//============================================================
r243192r243193
232173//============================================================
233174static osd_ticks_t mach_cycle_counter(void)
234175{
235   return mach_absolute_time();
176    return mach_absolute_time();
236177}
237178
238179//============================================================
239//   osd_ticks
180//   osd_cycles
240181//============================================================
241182
242183osd_ticks_t osd_ticks(void)
243184{
244   return (*cycle_counter)();
185    return (*cycle_counter)();
245186}
246187
247188
r243192r243193
251192
252193osd_ticks_t osd_ticks_per_second(void)
253194{
254   if (ticks_per_second == 0)
255   {
256      // if we haven't computed the value yet, there's no time like the present
257      init_cycle_counter();
258   }
259   return ticks_per_second;
195    if (ticks_per_second == 0)
196    {
197        // if we haven't computed the value yet, there's no time like the present
198        init_cycle_counter();
199    }
200    return ticks_per_second;
260201}
261202
262203
r243192r243193
267208
268209void osd_sleep(osd_ticks_t duration)
269210{
270   UINT32 msec;
211    UINT32 msec;
271212
272   // make sure we've computed ticks_per_second
273   if (ticks_per_second == 0)
274      (void)osd_ticks();
213    // make sure we've computed ticks_per_second
214    if (ticks_per_second == 0)
215        (void)osd_ticks();
275216
276   // convert to milliseconds, rounding down
277   msec = (UINT32)(duration * 1000 / ticks_per_second);
217    // convert to milliseconds, rounding down
218    msec = (UINT32)(duration * 1000 / ticks_per_second);
278219
279   // only sleep if at least 2 full milliseconds
280   if (msec >= 2)
281   {
282      // take a couple of msecs off the top for good measure
283      msec -= 2;
284      usleep(msec*1000);
285   }
220    // only sleep if at least 2 full milliseconds
221    if (msec >= 2)
222    {
223        // take a couple of msecs off the top for good measure
224        msec -= 2;
225        usleep(msec*1000);
226    }
286227}
228
trunk/src/osd/modules/lib/osdlib_os2.c
r243192r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
1// This file is a placeholder.
112
12// standard sdl header
13#include "sdlinc.h"
14#include <unistd.h>
15#include <stdio.h>
16#include <string.h>
17#include <ctype.h>
18#include <stdlib.h>
19#include <sys/stat.h>
20
21#define INCL_DOS
22#include <os2.h>
23
243// MAME headers
25#include "osdcore.h"
264#include "osdlib.h"
27
28//============================================================
29//  osd_getenv
30//============================================================
31
32const char *osd_getenv(const char *name)
33{
34   return getenv(name);
35}
36
37//============================================================
38//  osd_setenv
39//============================================================
40
41int osd_setenv(const char *name, const char *value, int overwrite)
42{
43   return setenv(name, value, overwrite);
44}
45
46//============================================================
47//  osd_process_kill
48//============================================================
49
50void osd_process_kill(void)
51{
52   fprintf(stderr,"osd_process_kill missing in OS/2 build\n");
53}
54
55//============================================================
56//  osd_num_processors
57//============================================================
58
59int osd_get_num_processors(void)
60{
61   ULONG numprocs = 1;
62
63   DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numprocs, sizeof(numprocs));
64
65   return numprocs;
66}
67
68//============================================================
69//  osd_malloc
70//============================================================
71
72void *osd_malloc(size_t size)
73{
74#ifndef MALLOC_DEBUG
75   return malloc(size);
76#else
77#error "MALLOC_DEBUG not yet supported"
78#endif
79}
80
81
82//============================================================
83//  osd_malloc_array
84//============================================================
85
86void *osd_malloc_array(size_t size)
87{
88#ifndef MALLOC_DEBUG
89   return malloc(size);
90#else
91#error "MALLOC_DEBUG not yet supported"
92#endif
93}
94
95
96//============================================================
97//  osd_free
98//============================================================
99
100void osd_free(void *ptr)
101{
102#ifndef MALLOC_DEBUG
103   free(ptr);
104#else
105#error "MALLOC_DEBUG not yet supported"
106#endif
107}
108
109
110//============================================================
111//  osd_alloc_executable
112//
113//  allocates "size" bytes of executable memory.  this must take
114//  things like NX support into account.
115//============================================================
116
117void *osd_alloc_executable(size_t size)
118{
119   void *p;
120
121   DosAllocMem( &p, size, fALLOC );
122   return p;
123}
124
125//============================================================
126//  osd_free_executable
127//
128//  frees memory allocated with osd_alloc_executable
129//============================================================
130
131void osd_free_executable(void *ptr, size_t size)
132{
133   DosFreeMem( ptr );
134}
135
136//============================================================
137//  osd_break_into_debugger
138//============================================================
139
140void osd_break_into_debugger(const char *message)
141{
142   printf("Ignoring MAME exception: %s\n", message);
143}
144
145//============================================================
146//  PROTOTYPES
147//============================================================
148
149
150static osd_ticks_t init_cycle_counter(void);
151static osd_ticks_t performance_cycle_counter(void);
152
153//============================================================
154//  STATIC VARIABLES
155//============================================================
156
157// global cycle_counter function and divider
158static osd_ticks_t      (*cycle_counter)(void) = init_cycle_counter;
159static osd_ticks_t      (*ticks_counter)(void) = init_cycle_counter;
160static osd_ticks_t      ticks_per_second;
161
162//============================================================
163//  init_cycle_counter
164//
165//  to avoid total grossness, this function is split by subarch
166//============================================================
167
168static osd_ticks_t init_cycle_counter(void)
169{
170   osd_ticks_t start, end;
171   osd_ticks_t a, b;
172
173   ULONG  frequency;
174   PTIB   ptib;
175   ULONG  ulClass;
176   ULONG  ulDelta;
177
178   DosGetInfoBlocks( &ptib, NULL );
179   ulClass = HIBYTE( ptib->tib_ptib2->tib2_ulpri );
180   ulDelta = LOBYTE( ptib->tib_ptib2->tib2_ulpri );
181
182   if ( DosTmrQueryFreq( &frequency ) == 0 )
183   {
184      // use performance counter if available as it is constant
185      cycle_counter = performance_cycle_counter;
186      ticks_counter = performance_cycle_counter;
187
188      ticks_per_second = frequency;
189
190      // return the current cycle count
191      return (*cycle_counter)();
192   }
193   else
194   {
195      fprintf(stderr, "No Timer available!\n");
196      exit(-1);
197   }
198
199   // temporarily set our priority higher
200   DosSetPriority( PRTYS_THREAD, PRTYC_TIMECRITICAL, PRTYD_MAXIMUM, 0 );
201
202   // wait for an edge on the timeGetTime call
203   a = SDL_GetTicks();
204   do
205   {
206      b = SDL_GetTicks();
207   } while (a == b);
208
209   // get the starting cycle count
210   start = (*cycle_counter)();
211
212   // now wait for 1/4 second total
213   do
214   {
215      a = SDL_GetTicks();
216   } while (a - b < 250);
217
218   // get the ending cycle count
219   end = (*cycle_counter)();
220
221   // compute ticks_per_sec
222   ticks_per_second = (end - start) * 4;
223
224   // restore our priority
225   DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 );
226
227   // return the current cycle count
228   return (*cycle_counter)();
229}
230
231//============================================================
232//  performance_cycle_counter
233//============================================================
234
235static osd_ticks_t performance_cycle_counter(void)
236{
237   QWORD qwTime;
238
239   DosTmrQueryTime( &qwTime );
240   return (osd_ticks_t)qwTime.ulLo;
241}
242
243//============================================================
244//   osd_ticks
245//============================================================
246
247osd_ticks_t osd_ticks(void)
248{
249   return (*cycle_counter)();
250}
251
252
253//============================================================
254//  osd_ticks_per_second
255//============================================================
256
257osd_ticks_t osd_ticks_per_second(void)
258{
259   if (ticks_per_second == 0)
260   {
261      // if we haven't computed the value yet, there's no time like the present
262      init_cycle_counter();
263   }
264   return ticks_per_second;
265}
266
267
268//============================================================
269//  osd_sleep
270//============================================================
271
272void osd_sleep(osd_ticks_t duration)
273{
274   UINT32 msec;
275
276   // make sure we've computed ticks_per_second
277   if (ticks_per_second == 0)
278      (void)osd_ticks();
279
280   // convert to milliseconds, rounding down
281   msec = (UINT32)(duration * 1000 / ticks_per_second);
282
283   // only sleep if at least 2 full milliseconds
284   if (msec >= 2)
285   {
286      // take a couple of msecs off the top for good measure
287      msec -= 2;
288      usleep(msec*1000);
289   }
290}
trunk/src/osd/modules/lib/osdlib_unix.c
r243192r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
111
122#include <stdlib.h>
133#include <unistd.h>
r243192r243193
2818//  osd_getenv
2919//============================================================
3020
31const char *osd_getenv(const char *name)
21char *osd_getenv(const char *name)
3222{
33   return getenv(name);
23    return getenv(name);
3424}
3525
3626//============================================================
r243192r243193
3929
4030int osd_setenv(const char *name, const char *value, int overwrite)
4131{
42   return setenv(name, value, overwrite);
32    return setenv(name, value, overwrite);
4333}
4434
4535//============================================================
46//  osd_process_kill
36//  osd_num_processors
4737//============================================================
4838
49void osd_process_kill(void)
39int osd_get_num_processors(void)
5040{
51   kill(getpid(), SIGKILL);
41    int processors = 1;
42
43#if defined(_SC_NPROCESSORS_ONLN)
44    processors = sysconf(_SC_NPROCESSORS_ONLN);
45#endif
46    return processors;
5247}
5348
5449//============================================================
55//  osd_num_processors
50//  osd_process_kill
5651//============================================================
5752
58int osd_get_num_processors(void)
53void osd_process_kill(void)
5954{
60   int processors = 1;
61
62#if defined(_SC_NPROCESSORS_ONLN)
63   processors = sysconf(_SC_NPROCESSORS_ONLN);
64#endif
65   return processors;
55    kill(getpid(), SIGKILL);
6656}
6757
6858//============================================================
r243192r243193
7262void *osd_malloc(size_t size)
7363{
7464#ifndef MALLOC_DEBUG
75   return malloc(size);
65    return malloc(size);
7666#else
7767#error "MALLOC_DEBUG not yet supported"
7868#endif
r243192r243193
8676void *osd_malloc_array(size_t size)
8777{
8878#ifndef MALLOC_DEBUG
89   return malloc(size);
79    return malloc(size);
9080#else
9181#error "MALLOC_DEBUG not yet supported"
9282#endif
r243192r243193
10090void osd_free(void *ptr)
10191{
10292#ifndef MALLOC_DEBUG
103   free(ptr);
93    free(ptr);
10494#else
10595#error "MALLOC_DEBUG not yet supported"
10696#endif
10797}
10898
10999//============================================================
110//  osd_alloc_executable
111//
112//  allocates "size" bytes of executable memory.  this must take
113//  things like NX support into account.
100//   osd_cycles
114101//============================================================
115102
116void *osd_alloc_executable(size_t size)
117{
118#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
119   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
120#elif defined(SDLMAME_UNIX)
121   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
122#endif
123}
124
125//============================================================
126//  osd_free_executable
127//
128//  frees memory allocated with osd_alloc_executable
129//============================================================
130
131void osd_free_executable(void *ptr, size_t size)
132{
133#ifdef SDLMAME_SOLARIS
134   munmap((char *)ptr, size);
135#else
136   munmap(ptr, size);
137#endif
138}
139
140//============================================================
141//  osd_break_into_debugger
142//============================================================
143
144void osd_break_into_debugger(const char *message)
145{
146   #ifdef MAME_DEBUG
147   printf("MAME exception: %s\n", message);
148   printf("Attempting to fall into debugger\n");
149   kill(getpid(), SIGTRAP);
150   #else
151   printf("Ignoring MAME exception: %s\n", message);
152   #endif
153}
154
155
156//============================================================
157//   osd_ticks
158//============================================================
159
160103osd_ticks_t osd_ticks(void)
161104{
162105#ifdef SDLMAME_EMSCRIPTEN
163      return (osd_ticks_t)(emscripten_get_now() * 1000.0);
106        return (osd_ticks_t)(emscripten_get_now() * 1000.0);
164107#else
165      struct timeval    tp;
166      static osd_ticks_t start_sec = 0;
108        struct timeval    tp;
109        static osd_ticks_t start_sec = 0;
167110
168      gettimeofday(&tp, NULL);
169      if (start_sec==0)
170         start_sec = tp.tv_sec;
171      return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
111        gettimeofday(&tp, NULL);
112        if (start_sec==0)
113            start_sec = tp.tv_sec;
114        return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
172115#endif
173116}
174117
175
176//============================================================
177//  osd_ticks_per_second
178//============================================================
179
180118osd_ticks_t osd_ticks_per_second(void)
181119{
182   return (osd_ticks_t) 1000000;
120    return (osd_ticks_t) 1000000;
183121}
184122
185123//============================================================
r243192r243193
188126
189127void osd_sleep(osd_ticks_t duration)
190128{
191   UINT32 msec;
129    UINT32 msec;
192130
193   // convert to milliseconds, rounding down
194   msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
131    // convert to milliseconds, rounding down
132    msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
195133
196   // only sleep if at least 2 full milliseconds
197   if (msec >= 2)
198   {
199      // take a couple of msecs off the top for good measure
200      msec -= 2;
201      usleep(msec*1000);
202   }
134    // only sleep if at least 2 full milliseconds
135    if (msec >= 2)
136    {
137        // take a couple of msecs off the top for good measure
138        msec -= 2;
139        usleep(msec*1000);
140    }
203141}
trunk/src/osd/modules/lib/osdlib_win32.c
r243192r243193
11//============================================================
22//
3//  sdlos_*.c - OS specific low level code
3//  winos.c - Win32 OS specific low level code
44//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
105//============================================================
116
127#define WIN32_LEAN_AND_MEAN
r243192r243193
2318#include "osdcomm.h"
2419#include "osdcore.h"
2520
26#ifdef OSD_WINDOWS
27#include "winutf8.h"
28#endif
29
3021//============================================================
3122//  MACROS
3223//============================================================
r243192r243193
3728// align allocations to start or end of the page?
3829#define GUARD_ALIGN_START   0
3930
40
4131//============================================================
42//  GLOBAL VARIABLES
32//  osd_num_processors
4333//============================================================
4434
45#ifdef OSD_WINDOWS
46void (*s_debugger_stack_crawler)() = NULL;
47#endif
35int osd_get_num_processors(void)
36{
37    SYSTEM_INFO info;
4838
39    // otherwise, fetch the info from the system
40    GetSystemInfo(&info);
4941
42    // max out at 4 for now since scaling above that seems to do poorly
43    return MIN(info.dwNumberOfProcessors, 4);
44}
45
5046//============================================================
5147//  osd_getenv
5248//============================================================
5349
54const char *osd_getenv(const char *name)
50char *osd_getenv(const char *name)
5551{
56   return getenv(name);
52    return getenv(name);
5753}
5854
59
6055//============================================================
6156//  osd_setenv
6257//============================================================
6358
6459int osd_setenv(const char *name, const char *value, int overwrite)
6560{
66   char *buf;
67   int result;
61    char *buf;
62    int result;
6863
69   if (!overwrite)
70   {
71      if (osd_getenv(name) != NULL)
72         return 0;
73   }
74   buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
75   sprintf(buf, "%s=%s", name, value);
76   result = putenv(buf);
64    if (!overwrite)
65    {
66        if (osd_getenv(name) != NULL)
67            return 0;
68    }
69    buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
70    sprintf(buf, "%s=%s", name, value);
71    result = putenv(buf);
7772
78   /* will be referenced by environment
79    * Therefore it is not freed here
80    */
73    /* will be referenced by environment
74     * Therefore it is not freed here
75     */
8176
82   return result;
77    return result;
8378}
8479
8580//============================================================
r243192r243193
8883
8984void osd_process_kill(void)
9085{
91   TerminateProcess(GetCurrentProcess(), -1);
86    TerminateProcess(GetCurrentProcess(), -1);
9287}
9388
9489//============================================================
95//  osd_num_processors
96//============================================================
97
98int osd_get_num_processors(void)
99{
100   SYSTEM_INFO info;
101
102   // otherwise, fetch the info from the system
103   GetSystemInfo(&info);
104
105   // max out at 4 for now since scaling above that seems to do poorly
106   return MIN(info.dwNumberOfProcessors, 4);
107}
108
109//============================================================
11090//  osd_malloc
11191//============================================================
11292
11393void *osd_malloc(size_t size)
11494{
11595#ifndef MALLOC_DEBUG
116   return HeapAlloc(GetProcessHeap(), 0, size);
96    return HeapAlloc(GetProcessHeap(), 0, size);
11797#else
118   // add in space for the size
119   size += sizeof(size_t);
98    // add in space for the size
99    size += sizeof(size_t);
120100
121   // basic objects just come from the heap
122   void *result = HeapAlloc(GetProcessHeap(), 0, size);
101    // basic objects just come from the heap
102    void *result = HeapAlloc(GetProcessHeap(), 0, size);
123103
124   // store the size and return and pointer to the data afterward
125   *reinterpret_cast<size_t *>(result) = size;
126   return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
104    // store the size and return and pointer to the data afterward
105    *reinterpret_cast<size_t *>(result) = size;
106    return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
127107#endif
128108}
129109
r243192r243193
135115void *osd_malloc_array(size_t size)
136116{
137117#ifndef MALLOC_DEBUG
138   return HeapAlloc(GetProcessHeap(), 0, size);
118    return HeapAlloc(GetProcessHeap(), 0, size);
139119#else
140   // add in space for the size
141   size += sizeof(size_t);
120    // add in space for the size
121    size += sizeof(size_t);
142122
143   // round the size up to a page boundary
144   size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
123    // round the size up to a page boundary
124    size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
145125
146   // reserve that much memory, plus two guard pages
147   void *page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
148   if (page_base == NULL)
149      return NULL;
126    // reserve that much memory, plus two guard pages
127    void *page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
128    if (page_base == NULL)
129        return NULL;
150130
151   // now allow access to everything but the first and last pages
152   page_base = VirtualAlloc(reinterpret_cast<UINT8 *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
153   if (page_base == NULL)
154      return NULL;
131    // now allow access to everything but the first and last pages
132    page_base = VirtualAlloc(reinterpret_cast<UINT8 *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
133    if (page_base == NULL)
134        return NULL;
155135
156   // work backwards from the page base to get to the block base
157   void *result = GUARD_ALIGN_START ? page_base : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size);
136    // work backwards from the page base to get to the block base
137    void *result = GUARD_ALIGN_START ? page_base : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size);
158138
159   // store the size at the start with a flag indicating it has a guard page
160   *reinterpret_cast<size_t *>(result) = size | 0x80000000;
161   return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
139    // store the size at the start with a flag indicating it has a guard page
140    *reinterpret_cast<size_t *>(result) = size | 0x80000000;
141    return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
162142#endif
163143}
164144
r243192r243193
170150void osd_free(void *ptr)
171151{
172152#ifndef MALLOC_DEBUG
173   HeapFree(GetProcessHeap(), 0, ptr);
153    HeapFree(GetProcessHeap(), 0, ptr);
174154#else
175   size_t size = reinterpret_cast<size_t *>(ptr)[-1];
155    size_t size = reinterpret_cast<size_t *>(ptr)[-1];
176156
177   // if no guard page, just free the pointer
178   if ((size & 0x80000000) == 0)
179      HeapFree(GetProcessHeap(), 0, reinterpret_cast<UINT8 *>(ptr) - sizeof(size_t));
157    // if no guard page, just free the pointer
158    if ((size & 0x80000000) == 0)
159        HeapFree(GetProcessHeap(), 0, reinterpret_cast<UINT8 *>(ptr) - sizeof(size_t));
180160
181   // large items need more care
182   else
183   {
184      ULONG_PTR page_base = (reinterpret_cast<ULONG_PTR>(ptr) - sizeof(size_t)) & ~(PAGE_SIZE - 1);
185      VirtualFree(reinterpret_cast<void *>(page_base - PAGE_SIZE), 0, MEM_RELEASE);
186   }
161    // large items need more care
162    else
163    {
164        ULONG_PTR page_base = (reinterpret_cast<ULONG_PTR>(ptr) - sizeof(size_t)) & ~(PAGE_SIZE - 1);
165        VirtualFree(reinterpret_cast<void *>(page_base - PAGE_SIZE), 0, MEM_RELEASE);
166    }
187167#endif
188168}
189169
190170
191171//============================================================
192//  osd_alloc_executable
193//
194//  allocates "size" bytes of executable memory.  this must take
195//  things like NX support into account.
196//============================================================
197
198void *osd_alloc_executable(size_t size)
199{
200   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
201}
202
203
204//============================================================
205//  osd_free_executable
206//
207//  frees memory allocated with osd_alloc_executable
208//============================================================
209
210void osd_free_executable(void *ptr, size_t size)
211{
212   VirtualFree(ptr, 0, MEM_RELEASE);
213}
214
215
216//============================================================
217//  osd_break_into_debugger
218//============================================================
219
220void osd_break_into_debugger(const char *message)
221{
222#ifdef OSD_WINDOWS
223   if (IsDebuggerPresent())
224   {
225      win_output_debug_string_utf8(message);
226      DebugBreak();
227   }
228   else if (s_debugger_stack_crawler != NULL)
229      (*s_debugger_stack_crawler)();
230#else
231   if (IsDebuggerPresent())
232   {
233      OutputDebugStringA(message);
234      DebugBreak();
235   }
236#endif
237}
238
239//============================================================
240172//  GLOBAL VARIABLES
241173//============================================================
242174
r243192r243193
252184
253185osd_ticks_t osd_ticks(void)
254186{
255   LARGE_INTEGER performance_count;
187    LARGE_INTEGER performance_count;
256188
257   // if we're suspended, just return that
258   if (suspend_ticks != 0)
259      return suspend_ticks;
189    // if we're suspended, just return that
190    if (suspend_ticks != 0)
191        return suspend_ticks;
260192
261   // if we have a per second count, just go for it
262   if (ticks_per_second != 0)
263   {
264      // QueryPerformanceCounter if we can
265      if (using_qpc)
266      {
267         QueryPerformanceCounter(&performance_count);
268         return (osd_ticks_t)performance_count.QuadPart - suspend_ticks;
269      }
193    // if we have a per second count, just go for it
194    if (ticks_per_second != 0)
195    {
196        // QueryPerformanceCounter if we can
197        if (using_qpc)
198        {
199            QueryPerformanceCounter(&performance_count);
200            return (osd_ticks_t)performance_count.QuadPart - suspend_ticks;
201        }
270202
271      // otherwise, fall back to timeGetTime
272      else
273         return (osd_ticks_t)timeGetTime() - suspend_ticks;
274   }
203        // otherwise, fall back to timeGetTime
204        else
205            return (osd_ticks_t)timeGetTime() - suspend_ticks;
206    }
275207
276   // if not, we have to determine it
277   using_qpc = QueryPerformanceFrequency(&performance_count) && (performance_count.QuadPart != 0);
278   if (using_qpc)
279      ticks_per_second = (osd_ticks_t)performance_count.QuadPart;
280   else
281      ticks_per_second = 1000;
208    // if not, we have to determine it
209    using_qpc = QueryPerformanceFrequency(&performance_count) && (performance_count.QuadPart != 0);
210    if (using_qpc)
211        ticks_per_second = (osd_ticks_t)performance_count.QuadPart;
212    else
213        ticks_per_second = 1000;
282214
283   // call ourselves to get the first value
284   return osd_ticks();
215    // call ourselves to get the first value
216    return osd_ticks();
285217}
286218
287219
r243192r243193
291223
292224osd_ticks_t osd_ticks_per_second(void)
293225{
294   if (ticks_per_second == 0)
295      osd_ticks();
296   return ticks_per_second;
226    if (ticks_per_second == 0)
227        osd_ticks();
228    return ticks_per_second;
297229}
298230
231
299232//============================================================
300233//  osd_sleep
301234//============================================================
302235
303236void osd_sleep(osd_ticks_t duration)
304237{
305   DWORD msec;
238    DWORD msec;
306239
307   // make sure we've computed ticks_per_second
308   if (ticks_per_second == 0)
309      (void)osd_ticks();
240    // make sure we've computed ticks_per_second
241    if (ticks_per_second == 0)
242        (void)osd_ticks();
310243
311   // convert to milliseconds, rounding down
312   msec = (DWORD)(duration * 1000 / ticks_per_second);
244    // convert to milliseconds, rounding down
245    msec = (DWORD)(duration * 1000 / ticks_per_second);
313246
314   // only sleep if at least 2 full milliseconds
315   if (msec >= 2)
316   {
317      HANDLE current_thread = GetCurrentThread();
318      int old_priority = GetThreadPriority(current_thread);
247    // only sleep if at least 2 full milliseconds
248    if (msec >= 2)
249    {
250        HANDLE current_thread = GetCurrentThread();
251        int old_priority = GetThreadPriority(current_thread);
319252
320      // take a couple of msecs off the top for good measure
321      msec -= 2;
253        // take a couple of msecs off the top for good measure
254        msec -= 2;
322255
323      // bump our thread priority super high so that we get
324      // priority when we need it
325      SetThreadPriority(current_thread, THREAD_PRIORITY_TIME_CRITICAL);
326      Sleep(msec);
327      SetThreadPriority(current_thread, old_priority);
328   }
256        // bump our thread priority super high so that we get
257        // priority when we need it
258        SetThreadPriority(current_thread, THREAD_PRIORITY_TIME_CRITICAL);
259        Sleep(msec);
260        SetThreadPriority(current_thread, old_priority);
261    }
329262}
trunk/src/osd/modules/lib/osdobj_common.c
r243192r243193
1111
1212#include "emu.h"
1313#include "osdepend.h"
14#include "modules/sound/none.h"
15#include "modules/debugger/none.h"
16#include "modules/debugger/debugint.h"
1417#include "modules/lib/osdobj_common.h"
1518
1619extern bool g_print_verbose;
1720
1821const options_entry osd_options::s_option_entries[] =
1922{
20   { NULL,                                   NULL,       OPTION_HEADER,     "OSD FONT OPTIONS" },
21   { OSD_FONT_PROVIDER,                      "auto",     OPTION_STRING,     "provider for ui font: " },
23    { NULL,                                   NULL,       OPTION_HEADER,     "OSD CLI OPTIONS" },
24    { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist",  "0",        OPTION_COMMAND,    "list available MIDI I/O devices" },
25    { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0",     OPTION_COMMAND,    "list available network adapters" },
2226
23   { NULL,                                   NULL,       OPTION_HEADER,     "OSD CLI OPTIONS" },
24   { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist",  "0",        OPTION_COMMAND,    "list available MIDI I/O devices" },
25   { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0",     OPTION_COMMAND,    "list available network adapters" },
27    // debugging options
28    { NULL,                                   NULL,       OPTION_HEADER,     "OSD DEBUGGING OPTIONS" },
29    { OSDOPTION_DEBUGGER,                     OSDOPTVAL_AUTO,      OPTION_STRING,    "debugger used : " },
30    { OSDOPTION_WATCHDOG ";wdog",             "0",        OPTION_INTEGER,    "force the program to terminate if no updates within specified number of seconds" },
2631
27   // debugging options
28   { NULL,                                   NULL,       OPTION_HEADER,     "OSD DEBUGGING OPTIONS" },
29   { OSDOPTION_DEBUGGER,                     OSDOPTVAL_AUTO,      OPTION_STRING,    "debugger used : " },
30   { OSDOPTION_WATCHDOG ";wdog",             "0",        OPTION_INTEGER,    "force the program to terminate if no updates within specified number of seconds" },
31
32   // performance options
33   { NULL,                                   NULL,       OPTION_HEADER,     "OSD PERFORMANCE OPTIONS" },
34   { OSDOPTION_MULTITHREADING ";mt",         "0",        OPTION_BOOLEAN,    "enable multithreading; this enables rendering and blitting on a separate thread" },
35   { OSDOPTION_NUMPROCESSORS ";np",          OSDOPTVAL_AUTO,      OPTION_STRING,     "number of processors; this overrides the number the system reports" },
36   { OSDOPTION_BENCH,                        "0",        OPTION_INTEGER,    "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" },
37   // video options
38   { NULL,                                   NULL,       OPTION_HEADER,     "OSD VIDEO OPTIONS" },
32    // performance options
33    { NULL,                                   NULL,       OPTION_HEADER,     "OSD PERFORMANCE OPTIONS" },
34    { OSDOPTION_MULTITHREADING ";mt",         "0",        OPTION_BOOLEAN,    "enable multithreading; this enables rendering and blitting on a separate thread" },
35    { OSDOPTION_NUMPROCESSORS ";np",          OSDOPTVAL_AUTO,      OPTION_STRING,     "number of processors; this overrides the number the system reports" },
36    { OSDOPTION_BENCH,                        "0",        OPTION_INTEGER,    "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" },
37    // video options
38    { NULL,                                   NULL,       OPTION_HEADER,     "OSD VIDEO OPTIONS" },
3939// OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience
40   { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,     OPTION_STRING,     "video output method: " },
41   { OSDOPTION_NUMSCREENS "(1-4)",           "1",        OPTION_INTEGER,    "number of screens to create; usually, you want just one" },
42   { OSDOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
43   { OSDOPTION_MAXIMIZE ";max",              "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
44   { OSDOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
45   { OSDOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
46   { OSDOPTION_WAITVSYNC ";vs",              "0",        OPTION_BOOLEAN,    "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
47   { OSDOPTION_SYNCREFRESH ";srf",           "0",        OPTION_BOOLEAN,    "enable using the start of VBLANK for throttling instead of the game time" },
40    { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,     OPTION_STRING,     "video output method: " },
41    { OSDOPTION_NUMSCREENS "(1-4)",           "1",        OPTION_INTEGER,    "number of screens to create; usually, you want just one" },
42    { OSDOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
43    { OSDOPTION_MAXIMIZE ";max",              "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
44    { OSDOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
45    { OSDOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
46    { OSDOPTION_WAITVSYNC ";vs",              "0",        OPTION_BOOLEAN,    "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
47    { OSDOPTION_SYNCREFRESH ";srf",           "0",        OPTION_BOOLEAN,    "enable using the start of VBLANK for throttling instead of the game time" },
4848
49   // per-window options
50   { NULL,                                   NULL,             OPTION_HEADER,    "OSD PER-WINDOW VIDEO OPTIONS" },
51   { OSDOPTION_SCREEN,                   OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
52   { OSDOPTION_ASPECT ";screen_aspect",  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio for all screens; 'auto' here will try to make a best guess" },
53   { OSDOPTION_RESOLUTION ";r",          OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
54   { OSDOPTION_VIEW,                     OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for all screens" },
49    // per-window options
50    { NULL,                                   NULL,             OPTION_HEADER,    "OSD PER-WINDOW VIDEO OPTIONS" },
51    { OSDOPTION_SCREEN,                   OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
52    { OSDOPTION_ASPECT ";screen_aspect",  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio for all screens; 'auto' here will try to make a best guess" },
53    { OSDOPTION_RESOLUTION ";r",          OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
54    { OSDOPTION_VIEW,                     OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for all screens" },
5555
56   { OSDOPTION_SCREEN "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
57   { OSDOPTION_ASPECT "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
58   { OSDOPTION_RESOLUTION "0;r0",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
59   { OSDOPTION_VIEW "0",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the first screen" },
56    { OSDOPTION_SCREEN "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
57    { OSDOPTION_ASPECT "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
58    { OSDOPTION_RESOLUTION "0;r0",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
59    { OSDOPTION_VIEW "0",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the first screen" },
6060
61   { OSDOPTION_SCREEN "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the second screen; 'auto' here will try to make a best guess" },
62   { OSDOPTION_ASPECT "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
63   { OSDOPTION_RESOLUTION "1;r1",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
64   { OSDOPTION_VIEW "1",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the second screen" },
61    { OSDOPTION_SCREEN "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the second screen; 'auto' here will try to make a best guess" },
62    { OSDOPTION_ASPECT "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
63    { OSDOPTION_RESOLUTION "1;r1",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
64    { OSDOPTION_VIEW "1",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the second screen" },
6565
66   { OSDOPTION_SCREEN "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the third screen; 'auto' here will try to make a best guess" },
67   { OSDOPTION_ASPECT "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
68   { OSDOPTION_RESOLUTION "2;r2",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
69   { OSDOPTION_VIEW "2",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the third screen" },
66    { OSDOPTION_SCREEN "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the third screen; 'auto' here will try to make a best guess" },
67    { OSDOPTION_ASPECT "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
68    { OSDOPTION_RESOLUTION "2;r2",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
69    { OSDOPTION_VIEW "2",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the third screen" },
7070
71   { OSDOPTION_SCREEN "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
72   { OSDOPTION_ASPECT "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
73   { OSDOPTION_RESOLUTION "3;r3",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
74   { OSDOPTION_VIEW "3",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the fourth screen" },
71    { OSDOPTION_SCREEN "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
72    { OSDOPTION_ASPECT "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
73    { OSDOPTION_RESOLUTION "3;r3",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
74    { OSDOPTION_VIEW "3",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the fourth screen" },
7575
76   // full screen options
77   { NULL,                                   NULL,  OPTION_HEADER,     "OSD FULL SCREEN OPTIONS" },
78   { OSDOPTION_SWITCHRES,                    "0",   OPTION_BOOLEAN,    "enable resolution switching" },
76    // full screen options
77    { NULL,                                   NULL,  OPTION_HEADER,     "OSD FULL SCREEN OPTIONS" },
78    { OSDOPTION_SWITCHRES,                    "0",   OPTION_BOOLEAN,    "enable resolution switching" },
7979
80   // sound options
81   { NULL,                                   NULL,  OPTION_HEADER,     "OSD SOUND OPTIONS" },
82   { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },
83   { OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
80    // sound options
81    { NULL,                                   NULL,  OPTION_HEADER,     "OSD SOUND OPTIONS" },
82    { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },
83    { OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
8484
85   // End of list
86   { NULL }
85    // End of list
86    { NULL }
8787};
8888
8989osd_options::osd_options()
9090: cli_options()
9191{
92   add_entries(osd_options::s_option_entries);
92    add_entries(osd_options::s_option_entries);
9393};
9494
9595
r243192r243193
9999
100100osd_common_t::osd_common_t(osd_options &options)
101101   : m_machine(NULL),
102      m_options(options),
103      m_sound(NULL),
104      m_debugger(NULL)
102     m_options(options),
103     m_sound(NULL),
104     m_debugger(NULL)
105105
106106{
107107}
108108
109#define REGISTER_MODULE(_O, _X ) { extern const module_type _X; _O . register_module( _X ); }
110109
111110void osd_common_t::register_options()
112111{
113   REGISTER_MODULE(m_mod_man, FONT_OSX);
114   REGISTER_MODULE(m_mod_man, FONT_WINDOWS);
115   REGISTER_MODULE(m_mod_man, FONT_SDL);
116   REGISTER_MODULE(m_mod_man, FONT_NONE);
112    // Register video options and update options
113    video_options_add("none", NULL);
114    video_register();
115    update_option(OSDOPTION_VIDEO, m_video_names);
117116
118   REGISTER_MODULE(m_mod_man, SOUND_DSOUND);
119   REGISTER_MODULE(m_mod_man, SOUND_JS);
120   REGISTER_MODULE(m_mod_man, SOUND_SDL);
121   REGISTER_MODULE(m_mod_man, SOUND_NONE);
117    // Register sound options and update options
118    sound_options_add("none", OSD_SOUND_NONE);
119    sound_register();
120    update_option(OSDOPTION_SOUND, m_sound_names);
122121
123#ifdef SDLMAME_MACOSX
124   REGISTER_MODULE(m_mod_man, DEBUG_OSX);
125#endif
126   REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS);
127   REGISTER_MODULE(m_mod_man, DEBUG_QT);
128   REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL);
129   REGISTER_MODULE(m_mod_man, DEBUG_NONE);
130
131   // after initialization we know which modules are supported
132
133   const char *names[20];
134   int num;
135   m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names);
136   dynamic_array<const char *> dnames;
137   for (int i = 0; i < num; i++)
138      dnames.append(names[i]);
139   update_option(OSD_FONT_PROVIDER, dnames);
140
141   m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names);
142   dnames.reset();
143   for (int i = 0; i < num; i++)
144      dnames.append(names[i]);
145   update_option(OSD_SOUND_PROVIDER, dnames);
146
147   // Register debugger options and update options
148   m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names);
149   dnames.reset();
150   for (int i = 0; i < num; i++)
151      dnames.append(names[i]);
152   update_option(OSD_DEBUG_PROVIDER, dnames);
153
154   // Register video options and update options
155   video_options_add("none", NULL);
156   video_register();
157   update_option(OSDOPTION_VIDEO, m_video_names);
122    // Register debugger options and update options
123    debugger_options_add("none", OSD_DEBUGGER_NONE);
124    debugger_options_add("internal", OSD_DEBUGGER_INTERNAL);
125    debugger_register();
126    update_option(OSDOPTION_DEBUGGER, m_debugger_names);
158127}
159128
160129void osd_common_t::update_option(const char * key, dynamic_array<const char *> &values)
r243192r243193
186155   for(int i= 0; i < m_video_names.count(); ++i)
187156      osd_free(const_cast<char*>(m_video_names[i]));
188157   //m_video_options,reset();
158
159   for(int i= 0; i < m_sound_names.count(); ++i)
160      osd_free(const_cast<char*>(m_sound_names[i]));
161   m_sound_options.reset();
162
163   for(int i= 0; i < m_debugger_names.count(); ++i)
164      osd_free(const_cast<char*>(m_debugger_names[i]));
165   m_debugger_options.reset();
189166}
190167
191168
r243192r243193
266243   // is active. This gives any OSD debugger interface a chance to
267244   // create all of its structures.
268245   //
246   osd_debugger_type debugger = m_debugger_options.find(options().debugger());
247   if (debugger==NULL)
248   {
249      osd_printf_warning("debugger_init: option %s not found switching to auto\n",options().debugger());
250      debugger = m_debugger_options.find("auto");
251   }
252   m_debugger = (*debugger)(*this);
253
269254   m_debugger->init_debugger(machine());
270255}
271256
r243192r243193
291276   if (m_debugger) m_debugger->debugger_update();
292277}
293278
279void osd_common_t::debugger_exit()
280{
281   if (m_debugger)
282   {
283      m_debugger->debugger_exit();
284      global_free(m_debugger);
285      m_debugger = NULL;
286   }
287}
294288
295289//-------------------------------------------------
296290//  update_audio_stream - update the stereo audio
r243192r243193
304298   // It provides an array of stereo samples in L-R order which should be
305299   // output at the configured sample_rate.
306300   //
307   m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
301    if (m_sound != NULL)
302        m_sound->update_audio_stream(buffer,samples_this_frame);
308303}
309304
310305
r243192r243193
321316   //    while (attenuation++ < 0)
322317   //       volume /= 1.122018454;      //  = (10 ^ (1/20)) = 1dB
323318   //
324   if (m_sound != NULL)
325      m_sound->set_mastervolume(attenuation);
319    if (m_sound != NULL)
320        m_sound->set_mastervolume(attenuation);
326321}
327322
328323
r243192r243193
397392
398393bool osd_common_t::execute_command(const char *command)
399394{
400   if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
401   {
402      network_init();
403      osd_list_network_adapters();
404      network_exit();
405      return true;
406   }
407   else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
408   {
409      osd_list_midi_devices();
410      return true;
411   }
395    if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
396    {
397        network_init();
398        osd_list_network_adapters();
399        network_exit();
400        return true;
401    }
402    else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
403    {
404        osd_list_midi_devices();
405        return true;
406    }
412407
413   return false;
408    return false;
414409
415410}
416411
r243192r243193
425420      exit(-1);
426421   }
427422
423   sound_init();
428424   input_init();
429425   // we need pause callbacks
430426   machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_common_t::input_pause), this));
r243192r243193
435431   network_init();
436432#endif
437433   midi_init();
438
439   m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);
440
441   m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
442   m_sound->m_sample_rate = options().sample_rate();
443   m_sound->m_audio_latency = options().audio_latency();
444
445   m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER);
446
447   m_mod_man.init();
448
449434}
450435
451436bool osd_common_t::video_init()
r243192r243193
458443   return true;
459444}
460445
446bool osd_common_t::sound_init()
447{
448   osd_sound_type sound = m_sound_options.find(options().sound());
449   if (sound==NULL)
450   {
451      osd_printf_warning("sound_init: option %s not found switching to auto\n",options().sound());
452      sound = m_sound_options.find("auto");
453   }
454   if (sound != NULL)
455       m_sound = (*sound)(*this, machine());
456   else
457       m_sound = NULL;
458   return true;
459}
460
461461bool osd_common_t::no_sound()
462462{
463463   return (strcmp(options().sound(),"none")==0) ? true : false;
r243192r243193
467467{
468468}
469469
470void osd_common_t::sound_register()
471{
472}
473
474void osd_common_t::debugger_register()
475{
476}
477
470478bool osd_common_t::input_init()
471479{
472480   return true;
r243192r243193
493501void osd_common_t::exit_subsystems()
494502{
495503   video_exit();
504   sound_exit();
496505   input_exit();
497506   output_exit();
498507   #ifdef USE_NETWORK
499508   network_exit();
500509   #endif
501510   midi_exit();
511   debugger_exit();
502512}
503513
504514void osd_common_t::video_exit()
r243192r243193
509519{
510520}
511521
522void osd_common_t::sound_exit()
523{
524    if (m_sound != NULL)
525        global_free(m_sound);
526}
527
512528void osd_common_t::input_exit()
513529{
514530}
r243192r243193
523539
524540void osd_common_t::osd_exit()
525541{
526   m_mod_man.exit();
527
528542   exit_subsystems();
529543}
530544
r243192r243193
534548   m_video_names.append(core_strdup(name));
535549}
536550
551void osd_common_t::sound_options_add(const char *name, osd_sound_type type)
552{
553   m_sound_options.add(name, type, false);
554   m_sound_names.append(core_strdup(name));
555}
556
557void osd_common_t::debugger_options_add(const char *name, osd_debugger_type type)
558{
559   m_debugger_options.add(name, type, false);
560   m_debugger_names.append(core_strdup(name));
561}
562
537563bool osd_common_t::midi_init()
538564{
539   // this should be done on the OS_level
540   return osd_midi_init();
565    // this should be done on the OS_level
566    return osd_midi_init();
541567}
542568
543569void osd_common_t::midi_exit()
544570{
545   osd_midi_exit();
571    osd_midi_exit();
546572}
573
574//-------------------------------------------------
575//  osd_sound_interface - constructor
576//-------------------------------------------------
577
578osd_sound_interface::osd_sound_interface(const osd_interface &osd, running_machine &machine)
579    : m_osd(osd), m_machine(machine)
580{
581}
582
583//-------------------------------------------------
584//  osd_sound_interface - destructor
585//-------------------------------------------------
586
587osd_sound_interface::~osd_sound_interface()
588{
589}
590
591//-------------------------------------------------
592//  osd_debugger_interface - constructor
593//-------------------------------------------------
594
595osd_debugger_interface::osd_debugger_interface(const osd_interface &osd)
596    : m_osd(osd)
597{
598}
599
600//-------------------------------------------------
601//  osd_debugger_interface - destructor
602//-------------------------------------------------
603
604osd_debugger_interface::~osd_debugger_interface()
605{
606}
607
trunk/src/osd/modules/lib/osdobj_common.h
r243192r243193
1414#define __OSDOBJ_COMMON__
1515
1616#include "osdepend.h"
17#include "modules/osdmodule.h"
18#include "modules/font/font_module.h"
19#include "modules/sound/sound_module.h"
20#include "modules/debugger/debug_module.h"
2117#include "cliopts.h"
2218
2319//============================================================
r243192r243193
5955//  TYPE DEFINITIONS
6056//============================================================
6157
58/* FIXME: core_options inherits from osd_options. This will force any
59 * future osd implementation to use the options below. Actually, these
60 * options are *private* to the osd_core. This object should actually be an
61 * accessor object. Later ...
62 */
63
64/* FIXME: core_options inherits from osd_options. This will force any
65 * future osd implementation to use the options below. Actually, these
66 * options are *private* to the osd_core. This object should actually be an
67 * accessor object. Later ...
68 */
69
6270class osd_options : public cli_options
6371{
6472public:
65   // construction/destruction
66   osd_options();
73    // construction/destruction
74    osd_options();
6775
68   // debugging options
69   const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
70   int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
76    // debugging options
77    const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
78    int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
7179
72   // performance options
73   bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
74   const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
75   int bench() const { return int_value(OSDOPTION_BENCH); }
80    // performance options
81    bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
82    const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
83    int bench() const { return int_value(OSDOPTION_BENCH); }
7684
77   // video options
78   const char *video() const { return value(OSDOPTION_VIDEO); }
79   int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
80   bool window() const { return bool_value(OSDOPTION_WINDOW); }
81   bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
82   bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
83   bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
84   bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
85   bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
85    // video options
86    const char *video() const { return value(OSDOPTION_VIDEO); }
87    int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
88    bool window() const { return bool_value(OSDOPTION_WINDOW); }
89    bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
90    bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
91    bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
92    bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
93    bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
8694
87   // per-window options
88   const char *screen() const { return value(OSDOPTION_SCREEN); }
89   const char *aspect() const { return value(OSDOPTION_ASPECT); }
90   const char *resolution() const { return value(OSDOPTION_RESOLUTION); }
91   const char *view() const { return value(OSDOPTION_VIEW); }
92   const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); }
93   const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); }
94   const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); }
95   const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); }
95    // per-window options
96    const char *screen() const { return value(OSDOPTION_SCREEN); }
97    const char *aspect() const { return value(OSDOPTION_ASPECT); }
98    const char *resolution() const { return value(OSDOPTION_RESOLUTION); }
99    const char *view() const { return value(OSDOPTION_VIEW); }
100    const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); }
101    const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); }
102    const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); }
103    const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); }
96104
97   // full screen options
98   bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
105    // full screen options
106    bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
99107
100   // sound options
101   const char *sound() const { return value(OSDOPTION_SOUND); }
102   int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
108    // sound options
109    const char *sound() const { return value(OSDOPTION_SOUND); }
110    int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
103111
104112private:
105   static const options_entry s_option_entries[];
113    static const options_entry s_option_entries[];
106114};
107115
116class osd_sound_interface;
117class osd_debugger_interface;
118
119// a osd_sound_type is simply a pointer to its alloc function
120typedef osd_sound_interface *(*osd_sound_type)(const osd_interface &osd, running_machine &machine);
121
122// a osd_sound_type is simply a pointer to its alloc function
123typedef osd_debugger_interface *(*osd_debugger_type)(const osd_interface &osd);
124
125
108126// ======================> osd_interface
109127
110128// description of the currently-running machine
r243192r243193
142160   // video overridables
143161   virtual void *get_slider_list();
144162
145   // command option overrides
146   virtual bool execute_command(const char *command);
163    // command option overrides
164    virtual bool execute_command(const char *command);
147165
148   osd_font *font_alloc() { return m_font_module->font_alloc(); }
149
150166   // FIXME: everything below seems to be osd specific and not part of
151167   //        this INTERFACE but part of the osd IMPLEMENTATION
152168
153   // getters
154   running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
169    // getters
170    running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
155171
156172
157   virtual void debugger_update();
173    virtual void debugger_update();
174    virtual void debugger_exit();
175    virtual void debugger_register();
158176
159   virtual void init_subsystems();
177    virtual void init_subsystems();
160178
161   virtual bool video_init();
162   virtual void video_register();
163   virtual bool window_init();
179    virtual bool video_init();
180    virtual void video_register();
181    virtual bool window_init();
164182
165   virtual void input_resume();
166   virtual bool output_init();
167   virtual bool network_init();
168   virtual bool midi_init();
183    virtual bool sound_init();
184    virtual void sound_register();
169185
170   virtual void exit_subsystems();
171   virtual void video_exit();
172   virtual void window_exit();
173   virtual void input_exit();
174   virtual void output_exit();
175   virtual void network_exit();
176   virtual void midi_exit();
186    virtual void input_resume();
187    virtual bool output_init();
188    virtual bool network_init();
189    virtual bool midi_init();
177190
178   virtual void osd_exit();
191    virtual void exit_subsystems();
192    virtual void video_exit();
193    virtual void window_exit();
194    virtual void sound_exit();
195    virtual void input_exit();
196    virtual void output_exit();
197    virtual void network_exit();
198    virtual void midi_exit();
179199
180   virtual void video_options_add(const char *name, void *type);
200    virtual void osd_exit();
181201
182   osd_options &options() { return m_options; }
202    virtual void video_options_add(const char *name, void *type);
203    virtual void sound_options_add(const char *name, osd_sound_type type);
204    virtual void debugger_options_add(const char *name, osd_debugger_type type);
183205
206    osd_options &options() { return m_options; }
207
184208protected:
185   virtual bool input_init();
186   virtual void input_pause();
209    virtual bool input_init();
210    virtual void input_pause();
187211
188212private:
189213   // internal state
190214   running_machine *   m_machine;
191215   osd_options& m_options;
192216
193   osd_module_manager m_mod_man;
194   font_module *m_font_module;
195
196217   void update_option(const char * key, dynamic_array<const char *> &values);
197   // FIXME: should be elsewhere
198   osd_module *select_module_options(const core_options &opts, const astring &opt_name)
199   {
200      astring opt_val = opts.value(opt_name);
201      if (opt_val == "auto")
202         opt_val = "";
203      else if (!m_mod_man.type_has_name(opt_name, opt_val))
204      {
205         osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr());
206         opt_val = "";
207      }
208      return m_mod_man.select_module(opt_name, opt_val);
209   }
210218
211   template<class C>
212   C select_module_options(const core_options &opts, const astring &opt_name)
213   {
214      return dynamic_cast<C>(select_module_options(opts, opt_name));
215   }
216
217219protected:
218   sound_module* m_sound;
219   debug_module* m_debugger;
220   osd_sound_interface* m_sound;
221   osd_debugger_interface* m_debugger;
220222private:
221223   //tagmap_t<osd_video_type>  m_video_options;
222224   dynamic_array<const char *> m_video_names;
225   tagmap_t<osd_sound_type>  m_sound_options;
226   dynamic_array<const char *> m_sound_names;
227   tagmap_t<osd_debugger_type>  m_debugger_options;
228   dynamic_array<const char *> m_debugger_names;
223229};
224230
225231
232class osd_sound_interface
233{
234public:
235   // construction/destruction
236   osd_sound_interface(const osd_interface &osd, running_machine &machine);
237   virtual ~osd_sound_interface();
238
239   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) = 0;
240   virtual void set_mastervolume(int attenuation) = 0;
241protected:
242   const osd_interface& m_osd;
243   running_machine& m_machine;
244};
245
246// this template function creates a stub which constructs a sound subsystem
247template<class _DeviceClass>
248osd_sound_interface *osd_sound_creator(const osd_interface &osd, running_machine &machine)
249{
250   return global_alloc(_DeviceClass(osd, machine));
251}
252
253class osd_debugger_interface
254{
255public:
256   // construction/destruction
257   osd_debugger_interface(const osd_interface &osd);
258   virtual ~osd_debugger_interface();
259
260   virtual void init_debugger(running_machine &machine) = 0;
261   virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
262   virtual void debugger_update() = 0;
263   virtual void debugger_exit() = 0;
264
265protected:
266   const osd_interface& m_osd;
267};
268
226269// this template function creates a stub which constructs a debugger
227270template<class _DeviceClass>
228debug_module *osd_debugger_creator()
271osd_debugger_interface *osd_debugger_creator(const osd_interface &osd)
229272{
230   return global_alloc(_DeviceClass());
273   return global_alloc(_DeviceClass(osd));
231274}
232275
233276#endif  /* __OSDOBJ_COMMON_H__ */
trunk/src/osd/modules/midi/none.c
r243192r243193
1010
1111struct osd_midi_device
1212{
13   int dummy;
13    int dummy;
1414};
1515
1616bool osd_midi_init()
1717{
18   return true;
18    return true;
1919}
2020
2121void osd_midi_exit()
r243192r243193
2424
2525void osd_list_midi_devices(void)
2626{
27   osd_printf_warning("\nMIDI is not supported in this build\n");
27    osd_printf_warning("\nMIDI is not supported in this build\n");
2828}
2929
3030osd_midi_device *osd_open_midi_input(const char *devname)
3131{
32   return NULL;
32    return NULL;
3333}
3434
3535osd_midi_device *osd_open_midi_output(const char *devname)
3636{
37   return NULL;
37    return NULL;
3838}
3939
4040void osd_close_midi_channel(osd_midi_device *dev)
r243192r243193
4343
4444bool osd_poll_midi_channel(osd_midi_device *dev)
4545{
46   return false;
46    return false;
4747}
4848
4949int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
5050{
51   return 0;
51    return 0;
5252}
5353
5454void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
trunk/src/osd/modules/midi/portmidi.c
r243192r243193
1616
1717struct osd_midi_device
1818{
19   PortMidiStream *pmStream;
20   PmEvent rx_evBuf[RX_EVENT_BUF_SIZE];
21   UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
22   int xmit_cnt;
23   UINT8 last_status;
24   bool rx_sysex;
19    PortMidiStream *pmStream;
20    PmEvent rx_evBuf[RX_EVENT_BUF_SIZE];
21    UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
22    int xmit_cnt;
23    UINT8 last_status;
24    bool rx_sysex;
2525};
2626
2727bool osd_midi_init()
2828{
29   Pm_Initialize();
30   return true;
29    Pm_Initialize();
30    return true;
3131}
3232
3333void osd_midi_exit()
3434{
35   Pm_Terminate();
35    Pm_Terminate();
3636}
3737
3838void osd_list_midi_devices(void)
3939{
40   int num_devs = Pm_CountDevices();
41   const PmDeviceInfo *pmInfo;
40    int num_devs = Pm_CountDevices();
41    const PmDeviceInfo *pmInfo;
4242
43   printf("\n");
43    printf("\n");
4444
45   if (num_devs == 0)
46   {
47      printf("No MIDI ports were found\n");
48      return;
49   }
45    if (num_devs == 0)
46    {
47        printf("No MIDI ports were found\n");
48        return;
49    }
5050
51   printf("MIDI input ports:\n");
52   for (int i = 0; i < num_devs; i++)
53   {
54      pmInfo = Pm_GetDeviceInfo(i);
51    printf("MIDI input ports:\n");
52    for (int i = 0; i < num_devs; i++)
53    {
54        pmInfo = Pm_GetDeviceInfo(i);
5555
56      if (pmInfo->input)
57      {
58         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
59      }
60   }
56        if (pmInfo->input)
57        {
58            printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
59        }
60    }
6161
62   printf("\nMIDI output ports:\n");
63   for (int i = 0; i < num_devs; i++)
64   {
65      pmInfo = Pm_GetDeviceInfo(i);
62    printf("\nMIDI output ports:\n");
63    for (int i = 0; i < num_devs; i++)
64    {
65        pmInfo = Pm_GetDeviceInfo(i);
6666
67      if (pmInfo->output)
68      {
69         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
70      }
71   }
67        if (pmInfo->output)
68        {
69            printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
70        }
71    }
7272}
7373
7474osd_midi_device *osd_open_midi_input(const char *devname)
7575{
76   int num_devs = Pm_CountDevices();
77   int found_dev = -1;
78   const PmDeviceInfo *pmInfo;
79   PortMidiStream *stm;
80   osd_midi_device *ret;
76    int num_devs = Pm_CountDevices();
77    int found_dev = -1;
78    const PmDeviceInfo *pmInfo;
79    PortMidiStream *stm;
80    osd_midi_device *ret;
8181
82   if (!strcmp("default", devname))
83   {
84      found_dev = Pm_GetDefaultInputDeviceID();
85   }
86   else
87   {
88      for (int i = 0; i < num_devs; i++)
89      {
90         pmInfo = Pm_GetDeviceInfo(i);
82    if (!strcmp("default", devname))
83    {
84        found_dev = Pm_GetDefaultInputDeviceID();
85    }
86    else
87    {
88        for (int i = 0; i < num_devs; i++)
89        {
90            pmInfo = Pm_GetDeviceInfo(i);
9191
92         if (pmInfo->input)
93         {
94            if (!strcmp(devname, pmInfo->name))
95            {
96               found_dev = i;
97               break;
98            }
99         }
100      }
101   }
92            if (pmInfo->input)
93            {
94                if (!strcmp(devname, pmInfo->name))
95                {
96                    found_dev = i;
97                    break;
98                }
99            }
100        }
101    }
102102
103   if (found_dev >= 0)
104   {
105      if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
106      {
107         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
108         memset(ret, 0, sizeof(osd_midi_device));
109         ret->pmStream = stm;
110         return ret;
111      }
112      else
113      {
114         printf("Couldn't open PM device\n");
115         return NULL;
116      }
117   }
118   else
119   {
120      return NULL;
121   }
103    if (found_dev >= 0)
104    {
105        if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
106        {
107            ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
108            memset(ret, 0, sizeof(osd_midi_device));
109            ret->pmStream = stm;
110            return ret;
111        }
112        else
113        {
114            printf("Couldn't open PM device\n");
115            return NULL;
116        }
117    }
118    else
119    {
120        return NULL;
121    }
122122}
123123
124124osd_midi_device *osd_open_midi_output(const char *devname)
125125{
126   int num_devs = Pm_CountDevices();
127   int found_dev = -1;
128   const PmDeviceInfo *pmInfo;
129   PortMidiStream *stm;
130   osd_midi_device *ret;
126    int num_devs = Pm_CountDevices();
127    int found_dev = -1;
128    const PmDeviceInfo *pmInfo;
129    PortMidiStream *stm;
130    osd_midi_device *ret;
131131
132   if (!strcmp("default", devname))
133   {
134      found_dev = Pm_GetDefaultOutputDeviceID();
135   }
136   else
137   {
138      for (int i = 0; i < num_devs; i++)
139      {
140         pmInfo = Pm_GetDeviceInfo(i);
132    if (!strcmp("default", devname))
133    {
134        found_dev = Pm_GetDefaultOutputDeviceID();
135    }
136    else
137    {
138        for (int i = 0; i < num_devs; i++)
139        {
140            pmInfo = Pm_GetDeviceInfo(i);
141141
142         if (pmInfo->output)
143         {
144            if (!strcmp(devname, pmInfo->name))
145            {
146               found_dev = i;
147               break;
148            }
149         }
150      }
151   }
142            if (pmInfo->output)
143            {
144                if (!strcmp(devname, pmInfo->name))
145                {
146                    found_dev = i;
147                    break;
148                }
149            }
150        }
151    }
152152
153   if (found_dev >= 0)
154   {
155      if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
156      {
157         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
158         memset(ret, 0, sizeof(osd_midi_device));
159         ret->pmStream = stm;
160         return ret;
161      }
162      else
163      {
164         printf("Couldn't open PM device\n");
165         return NULL;
166      }
167   }
168   else
169   {
170      return NULL;
171   }
172   return NULL;
153    if (found_dev >= 0)
154    {
155        if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
156        {
157            ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
158            memset(ret, 0, sizeof(osd_midi_device));
159            ret->pmStream = stm;
160            return ret;
161        }
162        else
163        {
164            printf("Couldn't open PM device\n");
165            return NULL;
166        }
167    }
168    else
169    {
170        return NULL;
171    }
172    return NULL;
173173}
174174
175175void osd_close_midi_channel(osd_midi_device *dev)
176176{
177   Pm_Close(dev->pmStream);
178   osd_free(dev);
177    Pm_Close(dev->pmStream);
178    osd_free(dev);
179179}
180180
181181bool osd_poll_midi_channel(osd_midi_device *dev)
182182{
183   PmError chk = Pm_Poll(dev->pmStream);
183    PmError chk = Pm_Poll(dev->pmStream);
184184
185   return (chk == pmGotData) ? true : false;
185    return (chk == pmGotData) ? true : false;
186186}
187187
188188int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
189189{
190   int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE);
191   int bytesOut = 0;
190    int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE);
191    int bytesOut = 0;
192192
193   if (msgsRead <= 0)
194   {
195      return 0;
196   }
193    if (msgsRead <= 0)
194    {
195        return 0;
196    }
197197
198   for (int msg = 0; msg < msgsRead; msg++)
199   {
200      UINT8 status = Pm_MessageStatus(dev->rx_evBuf[msg].message);
198    for (int msg = 0; msg < msgsRead; msg++)
199    {
200        UINT8 status = Pm_MessageStatus(dev->rx_evBuf[msg].message);
201201
202      if (dev->rx_sysex)
203      {
204         if (status & 0x80)  // sys real-time imposing on us?
205         {
206            if ((status == 0xf2) || (status == 0xf3))
207            {
208               *pOut++ = status;
209               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
210               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
211               bytesOut += 3;
212            }
213            else
214            {
215               *pOut++ = status;
216               bytesOut++;
217               if (status == MIDI_EOX)
218               {
219                  dev->rx_sysex = false;
220               }
221            }
222         }
223         else    // shift out the sysex bytes
224         {
225            for (int i = 0; i < 4; i++)
226            {
227               UINT8 byte = dev->rx_evBuf[msg].message & 0xff;
228               *pOut++ = byte;
229               bytesOut++;
230               if (byte == MIDI_EOX)
231               {
232                  dev->rx_sysex = false;
233                  break;
234               }
235               dev->rx_evBuf[msg].message >>= 8;
236            }
237         }
238      }
239      else
240      {
241         switch ((status>>4) & 0xf)
242         {
243            case 0xc:   // 2-byte messages
244            case 0xd:
245               *pOut++ = status;
246               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
247               bytesOut += 2;
248               break;
202        if (dev->rx_sysex)
203        {
204            if (status & 0x80)  // sys real-time imposing on us?
205            {
206                if ((status == 0xf2) || (status == 0xf3))
207                {
208                    *pOut++ = status;
209                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
210                    *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
211                    bytesOut += 3;
212                }
213                else
214                {
215                    *pOut++ = status;
216                    bytesOut++;
217                    if (status == MIDI_EOX)
218                    {
219                        dev->rx_sysex = false;
220                    }
221                }
222            }
223            else    // shift out the sysex bytes
224            {
225                for (int i = 0; i < 4; i++)
226                {
227                    UINT8 byte = dev->rx_evBuf[msg].message & 0xff;
228                    *pOut++ = byte;
229                    bytesOut++;
230                    if (byte == MIDI_EOX)
231                    {
232                        dev->rx_sysex = false;
233                        break;
234                    }
235                    dev->rx_evBuf[msg].message >>= 8;
236                }
237            }
238        }
239        else
240        {
241            switch ((status>>4) & 0xf)
242            {
243                case 0xc:   // 2-byte messages
244                case 0xd:
245                    *pOut++ = status;
246                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
247                    bytesOut += 2;
248                    break;
249249
250            case 0xf:   // system common
251               switch (status & 0xf)
252               {
253                  case 0: // System Exclusive
254                  {
255                     *pOut++ = status;   // this should be OK: the shortest legal sysex is F0 tt dd F7, I believe
256                     *pOut++ = (dev->rx_evBuf[msg].message>>8) & 0xff;
257                     *pOut++ = (dev->rx_evBuf[msg].message>>16) & 0xff;
258                     UINT8 last = *pOut++ = (dev->rx_evBuf[msg].message>>24) & 0xff;
259                     bytesOut += 4;
260                     dev->rx_sysex = (last != MIDI_EOX);
261                     break;
262                  }
250                case 0xf:   // system common
251                    switch (status & 0xf)
252                    {
253                        case 0: // System Exclusive
254                        {
255                            *pOut++ = status;   // this should be OK: the shortest legal sysex is F0 tt dd F7, I believe
256                            *pOut++ = (dev->rx_evBuf[msg].message>>8) & 0xff;
257                            *pOut++ = (dev->rx_evBuf[msg].message>>16) & 0xff;
258                            UINT8 last = *pOut++ = (dev->rx_evBuf[msg].message>>24) & 0xff;
259                            bytesOut += 4;
260                            dev->rx_sysex = (last != MIDI_EOX);
261                            break;
262                        }
263263
264                  case 7: // End of System Exclusive
265                     *pOut++ = status;
266                     bytesOut += 1;
267                     dev->rx_sysex = false;
268                     break;
264                        case 7: // End of System Exclusive
265                            *pOut++ = status;
266                            bytesOut += 1;
267                            dev->rx_sysex = false;
268                            break;
269269
270                  case 2: // song pos
271                  case 3: // song select
272                     *pOut++ = status;
273                     *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
274                     *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
275                     bytesOut += 3;
276                     break;
270                        case 2: // song pos
271                        case 3: // song select
272                            *pOut++ = status;
273                            *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
274                            *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
275                            bytesOut += 3;
276                            break;
277277
278                  default:    // all other defined Fx messages are 1 byte
279                     break;
280               }
281               break;
278                        default:    // all other defined Fx messages are 1 byte
279                            break;
280                    }
281                    break;
282282
283            default:
284               *pOut++ = status;
285               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
286               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
287               bytesOut += 3;
288               break;
289         }
290      }
291   }
283                default:
284                    *pOut++ = status;
285                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
286                    *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
287                    bytesOut += 3;
288                    break;
289            }
290        }
291    }
292292
293   return bytesOut;
293    return bytesOut;
294294}
295295
296296void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
297297{
298   int bytes_needed = 0;
299   PmEvent ev;
300   ev.timestamp = 0;   // use the current time
298    int bytes_needed = 0;
299    PmEvent ev;
300    ev.timestamp = 0;   // use the current time
301301
302302//  printf("write: %02x (%d)\n", data, dev->xmit_cnt);
303303
304   // reject data bytes when no valid status exists
305   if ((dev->last_status == 0) && !(data & 0x80))
306   {
307      dev->xmit_cnt = 0;
308      return;
309   }
304    // reject data bytes when no valid status exists
305    if ((dev->last_status == 0) && !(data & 0x80))
306    {
307        dev->xmit_cnt = 0;
308        return;
309    }
310310
311   if (dev->xmit_cnt >= 4)
312   {
313      printf("MIDI out: packet assembly overflow, contact MAMEdev!\n");
314      return;
315   }
311    if (dev->xmit_cnt >= 4)
312    {
313        printf("MIDI out: packet assembly overflow, contact MAMEdev!\n");
314        return;
315    }
316316
317   // handle sysex
318   if (dev->last_status == MIDI_SYSEX)
319   {
317    // handle sysex
318    if (dev->last_status == MIDI_SYSEX)
319    {
320320//      printf("sysex: %02x (%d)\n", data, dev->xmit_cnt);
321321
322      // if we get a status that isn't sysex, assume it's system common
323      if ((data & 0x80) && (data != MIDI_EOX))
324      {
322        // if we get a status that isn't sysex, assume it's system common
323        if ((data & 0x80) && (data != MIDI_EOX))
324        {
325325//          printf("common during sysex!\n");
326         ev.message = Pm_Message(data, 0, 0);
327         Pm_Write(dev->pmStream, &ev, 1);
328         return;
329      }
326            ev.message = Pm_Message(data, 0, 0);
327            Pm_Write(dev->pmStream, &ev, 1);
328            return;
329        }
330330
331      dev->xmit_in[dev->xmit_cnt++] = data;
331        dev->xmit_in[dev->xmit_cnt++] = data;
332332
333      // if EOX or 4 bytes filled, transmit 4 bytes
334      if ((dev->xmit_cnt == 4) || (data == MIDI_EOX))
335      {
336         ev.message = dev->xmit_in[0] | (dev->xmit_in[1]<<8) | (dev->xmit_in[2]<<16) | (dev->xmit_in[3]<<24);
337         Pm_Write(dev->pmStream, &ev, 1);
338         dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
339         dev->xmit_cnt = 0;
333        // if EOX or 4 bytes filled, transmit 4 bytes
334        if ((dev->xmit_cnt == 4) || (data == MIDI_EOX))
335        {
336            ev.message = dev->xmit_in[0] | (dev->xmit_in[1]<<8) | (dev->xmit_in[2]<<16) | (dev->xmit_in[3]<<24);
337            Pm_Write(dev->pmStream, &ev, 1);
338            dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
339            dev->xmit_cnt = 0;
340340
341341//          printf("SysEx packet: %08x\n", ev.message);
342342
343         // if this is EOX, kill the running status
344         if (data == MIDI_EOX)
345         {
346            dev->last_status = 0;
347         }
348      }
343            // if this is EOX, kill the running status
344            if (data == MIDI_EOX)
345            {
346                dev->last_status = 0;
347            }
348        }
349349
350      return;
351   }
350        return;
351    }
352352
353   // handle running status.  don't allow system real-time messages to be considered as running status.
354   if ((dev->xmit_cnt == 0) && (data & 0x80) && (data < 0xf8))
355   {
356      dev->last_status = data;
357   }
353    // handle running status.  don't allow system real-time messages to be considered as running status.
354    if ((dev->xmit_cnt == 0) && (data & 0x80) && (data < 0xf8))
355    {
356        dev->last_status = data;
357    }
358358
359   if ((dev->xmit_cnt == 0) && !(data & 0x80))
360   {
361      dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
362      dev->xmit_in[dev->xmit_cnt++] = data;
359    if ((dev->xmit_cnt == 0) && !(data & 0x80))
360    {
361        dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
362        dev->xmit_in[dev->xmit_cnt++] = data;
363363//      printf("\trunning status: [%d] = %02x, [%d] = %02x, last_status = %02x\n", dev->xmit_cnt-2, dev->last_status, dev->xmit_cnt-1, data, dev->last_status);
364   }
365   else
366   {
367      dev->xmit_in[dev->xmit_cnt++] = data;
364    }
365    else
366    {
367        dev->xmit_in[dev->xmit_cnt++] = data;
368368//      printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data);
369   }
369    }
370370
371   if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
372   {
371    if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
372    {
373373//      printf("Start SysEx!\n");
374      dev->last_status = MIDI_SYSEX;
375      return;
376   }
374        dev->last_status = MIDI_SYSEX;
375        return;
376    }
377377
378   // are we there yet?
378    // are we there yet?
379379//  printf("status check: %02x\n", dev->xmit_in[0]);
380   switch ((dev->xmit_in[0]>>4) & 0xf)
381   {
382      case 0xc:   // 2-byte messages
383      case 0xd:
384         bytes_needed = 2;
385         break;
380    switch ((dev->xmit_in[0]>>4) & 0xf)
381    {
382        case 0xc:   // 2-byte messages
383        case 0xd:
384            bytes_needed = 2;
385            break;
386386
387      case 0xf:   // system common
388         switch (dev->xmit_in[0] & 0xf)
389         {
390            case 0: // System Exclusive is handled above
391               break;
387        case 0xf:   // system common
388            switch (dev->xmit_in[0] & 0xf)
389            {
390                case 0: // System Exclusive is handled above
391                    break;
392392
393            case 7: // End of System Exclusive
394               bytes_needed = 1;
395               break;
393                case 7: // End of System Exclusive
394                    bytes_needed = 1;
395                    break;
396396
397            case 2: // song pos
398            case 3: // song select
399               bytes_needed = 3;
400               break;
397                case 2: // song pos
398                case 3: // song select
399                    bytes_needed = 3;
400                    break;
401401
402            default:    // all other defined Fx messages are 1 byte
403               bytes_needed = 1;
404               break;
405         }
406         break;
402                default:    // all other defined Fx messages are 1 byte
403                    bytes_needed = 1;
404                    break;
405            }
406            break;
407407
408      default:
409         bytes_needed = 3;
410         break;
411   }
408        default:
409            bytes_needed = 3;
410            break;
411    }
412412
413   if (dev->xmit_cnt == bytes_needed)
414   {
415      ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
416      Pm_Write(dev->pmStream, &ev, 1);
417      dev->xmit_cnt = 0;
418   }
413    if (dev->xmit_cnt == bytes_needed)
414    {
415        ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
416        Pm_Write(dev->pmStream, &ev, 1);
417        dev->xmit_cnt = 0;
418    }
419419
420420}
trunk/src/osd/modules/osdmodule.c
r243192r243193
1/*
2 * osdmodule.c
3 *
4 */
5
6#include "modules/osdmodule.h"
7
8osd_module_manager::osd_module_manager()
9{
10   for (int i=0; i<MAX_MODULES; i++)
11   {
12      m_modules[i]  = NULL;
13      m_selected[i] = NULL;
14   }
15}
16osd_module_manager::~osd_module_manager()
17{
18   for (int i = 0; m_modules[i] != NULL; i++)
19   {
20      m_modules[i]->~osd_module();
21      osd_free(m_modules[i]);
22   }
23}
24
25void osd_module_manager::register_module(const module_type &mod_type)
26{
27   osd_module *module = mod_type();
28   if (module->probe())
29   {
30      osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type());
31
32      int i;
33      for (i = 0; m_modules[i] != NULL; i++)
34         ;
35      m_modules[i] = module;
36   }
37   else
38   {
39      osd_printf_verbose("===> not supported %s %s\n", module->name(), module->type());
40      module->~osd_module();
41      osd_free(module);
42   }
43}
44
45bool osd_module_manager::type_has_name(const char *type, const char *name)
46{
47   return (get_module_index(type, name) >= 0);
48}
49
50osd_module *osd_module_manager::get_module_generic(const char *type, const char *name)
51{
52   int i = get_module_index(type, name);
53   if (i>=0)
54      return m_modules[i];
55   else
56      return NULL;
57}
58
59osd_module *osd_module_manager::select_module(const char *type, const char *name)
60{
61   osd_module *m = get_module_generic(type, name);
62
63   // FIXME: check if already exists!
64   int i;
65   for (i = 0; m_selected[i] != NULL; i++)
66      ;
67   m_selected[i] = m;
68   return m;
69}
70
71void osd_module_manager::init()
72{
73   for (int i = 0; m_selected[i] != NULL; i++)
74   {
75      m_selected[i]->init();
76   }
77}
78
79void osd_module_manager::exit()
80{
81   // Find count
82   int cnt;
83   for (cnt = 0; m_selected[cnt] != NULL; cnt++)
84      ;
85   for (int i = cnt - 1; i >= 0; i--)
86   {
87      m_selected[i]->exit();
88      m_selected[i] = NULL;
89   }
90}
91
92int osd_module_manager::get_module_index(const char *type, const char *name)
93{
94   for (int i = 0; m_modules[i] != NULL; i++)
95   {
96      if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0)))
97         return i;
98   }
99   return -1;
100}
101
102void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[])
103{
104   *num = 0;
105   for (int i = 0; m_modules[i] != NULL; i++)
106   {
107      if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max))
108      {
109         names[*num] = m_modules[i]->name();
110         *num = *num + 1;
111      }
112
113   }
114}
trunk/src/osd/modules/osdmodule.h
r243192r243193
1/***************************************************************************
2
3    osdmodule.h
4
5    OSD module manangement
6
7*******************************************************************c********/
8
9//#pragma once
10
11#ifndef __OSDMODULE_H__
12#define __OSDMODULE_H__
13
14#include "osdcore.h"
15#include "osdepend.h"
16
17//============================================================
18//  TYPE DEFINITIONS
19//============================================================
20
21class osd_module;
22
23// ======================> osd_module
24
25class osd_module
26{
27public:
28
29   osd_module(const char *type, const char *name)
30   : m_name(name), m_type(type)
31   {}
32   virtual ~osd_module() { }
33
34   const char * name() const { return m_name; }
35   const char * type() const { return m_type; }
36
37   virtual bool probe() const { return true; }
38
39   virtual int init() { return 0; }
40   virtual void exit() { }
41
42private:
43   astring     m_name;
44   astring     m_type;
45};
46
47// a module_type is simply a pointer to its alloc function
48typedef osd_module *(*module_type)();
49
50// this template function creates a stub which constructs a module
51template<class _ModuleClass>
52osd_module *module_creator()
53{
54   void *p = osd_malloc(sizeof(_ModuleClass));
55   return new(p) _ModuleClass;
56}
57
58class osd_module_manager
59{
60public:
61
62   static const int MAX_MODULES = 32;
63
64   osd_module_manager();
65   ~osd_module_manager();
66
67   void register_module(const module_type &mod_type);
68   bool type_has_name(const char *type, const char *name);
69
70   osd_module *get_module_generic(const char *type, const char *name);
71
72   template<class C>
73   C select_module(const char *type, const char *name = "")
74   {
75      return dynamic_cast<C>(select_module(type, name));
76   }
77
78   osd_module *select_module(const char *type, const char *name = "");
79
80   void get_module_names(const char *type, const int max, int *num, const char *names[]);
81
82   void init();
83
84   void exit();
85
86private:
87   int get_module_index(const char *type, const char *name);
88
89   osd_module *m_modules[MAX_MODULES];
90   osd_module *m_selected[MAX_MODULES];
91};
92
93#define MODULE_DEFINITION(_id, _class) \
94   extern const module_type _id ;  \
95   const module_type _id = &module_creator< _class >;
96
97
98#define MODULE_NOT_SUPPORTED(_mod, _type, _name) \
99   class _mod : public osd_module { \
100   public: \
101      _mod () \
102      : osd_module(_type, _name) {} \
103      bool probe() const { return false; } \
104   };
105
106#endif  /* __OSDMODULE_H__ */
trunk/src/osd/modules/sound/direct_sound.c
r243192r243193
66//
77//============================================================
88
9#include "sound_module.h"
10#include "modules/osdmodule.h"
11
12#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
13
149// standard windows headers
1510#define WIN32_LEAN_AND_MEAN
1611#include <windows.h>
r243192r243193
2621#include "osdepend.h"
2722#include "emuopts.h"
2823
24// MAMEOS headers
25#include "direct_sound.h"
26
2927#ifdef SDLMAME_WIN32
3028#include "../../sdl/osdsdl.h"
3129#if (SDLMAME_SDL2)
r243192r243193
4745
4846#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0)
4947
50class sound_direct_sound : public osd_module, public sound_module
51{
52public:
5348
54   sound_direct_sound()
55   : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module()
56   {
57   }
58   virtual ~sound_direct_sound() { }
59
60   virtual int init();
61   virtual void exit();
62
63   // sound_module
64
65   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
66   virtual void set_mastervolume(int attenuation);
67
68private:
69   HRESULT      dsound_init();
70   void         dsound_kill();
71   HRESULT      dsound_create_buffers();
72   void         dsound_destroy_buffers();
73   void         copy_sample_data(const INT16 *data, int bytes_to_copy);
74
75};
76
77
78
7949//============================================================
8050//  LOCAL VARIABLES
8151//============================================================
r243192r243193
9969// buffer over/underflow counts
10070static int                  buffer_underflows;
10171static int                  buffer_overflows;
102
10372//============================================================
10473//  PROTOTYPES
10574//============================================================
10675
76const osd_sound_type OSD_SOUND_DIRECT_SOUND = &osd_sound_creator<sound_direct_sound>;
77
10778//-------------------------------------------------
10879//  sound_direct_sound - constructor
10980//-------------------------------------------------
110
111int sound_direct_sound::init()
81sound_direct_sound::sound_direct_sound(const osd_interface &osd, running_machine &machine)
82   : osd_sound_interface(osd, machine)
11283{
11384   // attempt to initialize directsound
11485   // don't make it fatal if we can't -- we'll just run without sound
11586   dsound_init();
116   return 0;
11787}
11888
11989
120void sound_direct_sound::exit()
90sound_direct_sound::~sound_direct_sound()
12191{
12292   // kill the buffers and dsound
12393   dsound_destroy_buffers();
r243192r243193
179149//  update_audio_stream
180150//============================================================
181151
182void sound_direct_sound::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
152void sound_direct_sound::update_audio_stream(const INT16 *buffer, int samples_this_frame)
183153{
184154   int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign;
185155   DWORD play_position, write_position;
r243192r243193
298268   stream_format.wBitsPerSample    = 16;
299269   stream_format.wFormatTag        = WAVE_FORMAT_PCM;
300270   stream_format.nChannels         = 2;
301   stream_format.nSamplesPerSec    = sample_rate();
271   stream_format.nSamplesPerSec    = m_machine.sample_rate();
302272   stream_format.nBlockAlign       = stream_format.wBitsPerSample * stream_format.nChannels / 8;
303273   stream_format.nAvgBytesPerSec   = stream_format.nSamplesPerSec * stream_format.nBlockAlign;
304274
305275
306276   // compute the buffer size based on the output sample rate
307277   int audio_latency;
308   audio_latency = m_audio_latency;
309
278   #ifdef SDLMAME_WIN32
279   audio_latency = downcast<sdl_options &>(m_machine.options()).audio_latency();
280   #else
281   audio_latency = downcast<windows_options &>(m_machine.options()).audio_latency();
282   #endif
310283   stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * audio_latency / 10;
311284   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
312285   if (stream_buffer_size < 1024)
r243192r243193
446419      IDirectSoundBuffer_Release(primary_buffer);
447420   primary_buffer = NULL;
448421}
449
450#else /* SDLMAME_UNIX */
451   MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound")
452#endif
453
454MODULE_DEFINITION(SOUND_DSOUND, sound_direct_sound)
trunk/src/osd/modules/sound/direct_sound.h
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3//============================================================
4//
5//  sound.c - Win32 implementation of MAME sound routines
6//
7//============================================================
8#pragma once
9
10#ifndef __SOUND_DSOUND_H__
11#define __SOUND_DSOUND_H__
12
13// standard windows headers
14#define WIN32_LEAN_AND_MEAN
15#include <windows.h>
16#include <mmsystem.h>
17
18// undef WINNT for dsound.h to prevent duplicate definition
19#undef WINNT
20#include <dsound.h>
21#undef interface
22
23#include "osdepend.h"
24#include "modules/lib/osdobj_common.h"
25
26class sound_direct_sound : public osd_sound_interface
27{
28public:
29   // construction/destruction
30   sound_direct_sound(const osd_interface &osd, running_machine &machine);
31   virtual ~sound_direct_sound();
32
33   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
34   virtual void set_mastervolume(int attenuation);
35
36   HRESULT      dsound_init();
37   void         dsound_kill();
38   HRESULT      dsound_create_buffers();
39   void         dsound_destroy_buffers();
40   void         copy_sample_data(const INT16 *data, int bytes_to_copy);
41private:
42};
43
44extern const osd_sound_type OSD_SOUND_DIRECT_SOUND;
45
46#endif  /* __SOUND_DSOUND_H__ */
trunk/src/osd/modules/sound/js_sound.c
r243192r243193
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1311
14#if (defined(SDLMAME_EMSCRIPTEN))
15
12#include "js_sound.h"
1613#include "emscripten.h"
1714
18class sound_js : public osd_module, public sound_module
15//-------------------------------------------------
16//  sound_js - constructor
17//-------------------------------------------------
18sound_js::sound_js(const osd_interface &osd)
19   : osd_sound_interface(osd)
1920{
20public:
21}
2122
22   sound_js()
23   : osd_module(OSD_SOUND_PROVIDER, "js"), sound_module()
24   {
25   }
26   virtual ~sound_js() { }
23void sound_js::update_audio_stream(const INT16 *buffer, int samples_this_frame)
24{
25   EM_ASM_ARGS({
26   // Forward audio stream update on to JS backend implementation.
27   jsmess_update_audio_stream($0, $1);
28   }, (unsigned int)buffer, samples_this_frame);
29}
2730
28   virtual int init();
29   virtual void exit();
31void sound_js::set_mastervolume(int attenuation)
32{
33   EM_ASM_ARGS({
34   // Forward volume update on to JS backend implementation.
35   jsmess_set_mastervolume($0);
36   }, attenuation);
37}
3038
31   // sound_module
32
33   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
34   {
35      EM_ASM_ARGS({
36      // Forward audio stream update on to JS backend implementation.
37      jsmess_update_audio_stream($1, $2);
38      }, (unsigned int)buffer, samples_this_frame);
39   }
40   virtual void set_mastervolume(int attenuation)
41   {
42      EM_ASM_ARGS({
43      // Forward volume update on to JS backend implementation.
44      jsmess_set_mastervolume($0);
45      }, attenuation);
46   }
47
48};
49
50#else /* SDLMAME_UNIX */
51   MODULE_NOT_SUPPORTED(sound_js, OSD_SOUND_PROVIDER, "js")
52#endif
53
54MODULE_DEFINITION(SOUND_JS, sound_js)
39const osd_sound_type OSD_SOUND_JS = &osd_sound_creator<sound_js>;
trunk/src/osd/modules/sound/js_sound.h
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic, Katelyn Gadd
3/***************************************************************************
4
5    js_sound.h
6
7    Shim for native JavaScript sound interface implementations (Emscripten only).
8
9*******************************************************************c********/
10
11#pragma once
12
13#ifndef __SOUND_JS_H__
14#define __SOUND_JS_H__
15
16#include "osdepend.h"
17
18class sound_js : public osd_sound_interface
19{
20public:
21   // construction/destruction
22   sound_js(const osd_interface &osd);
23   virtual ~sound_js() { }
24
25   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
26   virtual void set_mastervolume(int attenuation);
27};
28
29extern const osd_sound_type OSD_SOUND_JS;
30
31#endif  /* __SOUND_JS_H__ */
trunk/src/osd/modules/sound/none.c
r243192r243193
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1311
14class sound_none : public osd_module, public sound_module
12#include "none.h"
13
14//-------------------------------------------------
15//  sound_none - constructor
16//-------------------------------------------------
17sound_none::sound_none(const osd_interface &osd, running_machine &machine)
18   : osd_sound_interface(osd, machine)
1519{
16public:
17   sound_none()
18   : osd_module(OSD_SOUND_PROVIDER, "none"), sound_module()
19   {
20   }
21   virtual ~sound_none() { }
20}
2221
23   virtual int init() { return 0; }
24   virtual void exit() { }
2522
26   // sound_module
27
28   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { }
29   virtual void set_mastervolume(int attenuation) { }
30
31};
32
33MODULE_DEFINITION(SOUND_NONE, sound_none)
23const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;
trunk/src/osd/modules/sound/none.h
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic
3/***************************************************************************
4
5    none.h
6
7    Dummy sound interface.
8
9*******************************************************************c********/
10
11#pragma once
12
13#ifndef __SOUND_NONE_H__
14#define __SOUND_NONE_H__
15
16#include "osdepend.h"
17#include "modules/lib/osdobj_common.h"
18
19class sound_none : public osd_sound_interface
20{
21public:
22   // construction/destruction
23   sound_none(const osd_interface &osd, running_machine &machine);
24   virtual ~sound_none() { }
25
26   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) { }
27   virtual void set_mastervolume(int attenuation) { }
28};
29
30extern const osd_sound_type OSD_SOUND_NONE;
31
32#endif  /* __SOUND_NONE_H__ */
trunk/src/osd/modules/sound/sdl_sound.c
r243192r243193
99//
1010//============================================================
1111
12#include "sound_module.h"
13#include "modules/osdmodule.h"
14
15#if (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(OSD_WINDOWS))
16
1712// standard sdl header
1813#include "../../sdl/sdlinc.h"
1914
r243192r243193
2116#include "emu.h"
2217#include "emuopts.h"
2318
19#include "sdl_sound.h"
2420#include "../../sdl/osdsdl.h"
2521
2622//============================================================
r243192r243193
3026#define LOG_SOUND       0
3127
3228//============================================================
33//  PROTOTYPES
29//  PARAMETERS
3430//============================================================
3531
36static void sdl_callback(void *userdata, Uint8 *stream, int len);
32// number of samples per SDL callback
33#define SDL_XFER_SAMPLES    (512)
3734
35static int sdl_xfer_samples = SDL_XFER_SAMPLES;
36static int stream_in_initialized = 0;
37static int stream_loop = 0;
38
39// maximum audio latency
40#define MAX_AUDIO_LATENCY       5
41
3842//============================================================
39//  CLASS
43//  LOCAL VARIABLES
4044//============================================================
4145
42class sound_sdl : public osd_module, public sound_module
43{
44public:
46static int              attenuation = 0;
4547
46   friend void sdl_callback(void *userdata, Uint8 *stream, int len);
48static int              initialized_audio = 0;
49static int              buf_locked;
4750
48   // number of samples per SDL callback
49   static const int SDL_XFER_SAMPLES = 512;
51static INT8             *stream_buffer;
52static volatile INT32   stream_playpos;
5053
51   sound_sdl()
52   : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(),
53      stream_in_initialized(0),
54      stream_loop(0),
55      attenuation(0)
56   {
57      sdl_xfer_samples = SDL_XFER_SAMPLES;
58   }
59   virtual ~sound_sdl() { }
54static UINT32           stream_buffer_size;
55static UINT32           stream_buffer_in;
6056
61   virtual int init();
62   virtual void exit();
57// buffer over/underflow counts
58static int              buffer_underflows;
59static int              buffer_overflows;
6360
64   // sound_module
61// debugging
62static FILE *sound_log;
6563
66   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
67   virtual void set_mastervolume(int attenuation);
6864
69private:
70   int lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2);
71   void unlock_buffer(void);
72   void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy);
73   void copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy);
74   int sdl_create_buffers(void);
75   void sdl_destroy_buffers(void);
65// sound enable
66static int snd_enabled;
7667
77   int sdl_xfer_samples;
78   int stream_in_initialized;
79   int stream_loop;
80   int attenuation;
68//============================================================
69//  PROTOTYPES
70//============================================================
8171
82   int              buf_locked;
72static int          sdl_init(running_machine &machine);
73static void         sdl_kill(running_machine &machine);
74static int          sdl_create_buffers(void);
75static void         sdl_destroy_buffers(void);
76static void         SDLCALL sdl_callback(void *userdata, Uint8 *stream, int len);
8377
84   INT8             *stream_buffer;
85   volatile INT32   stream_playpos;
78const osd_sound_type OSD_SOUND_SDL = &osd_sound_creator<sound_sdl>;
8679
87   UINT32           stream_buffer_size;
88   UINT32           stream_buffer_in;
80//-------------------------------------------------
81//  sound_sdl - constructor
82//-------------------------------------------------
83sound_sdl::sound_sdl(const osd_interface &osd, running_machine &machine)
84   : osd_sound_interface(osd, machine)
85{
86   if (LOG_SOUND)
87      sound_log = fopen(SDLMAME_SOUND_LOG, "w");
8988
90   // buffer over/underflow counts
91   int              buffer_underflows;
92   int              buffer_overflows;
89   // skip if sound disabled
90   if (m_machine.sample_rate() != 0)
91   {
92      if (initialized_audio)
93      {
94         //sound_exit();
95      }
9396
97      // attempt to initialize SDL
98      if (sdl_init(m_machine))
99         return;
94100
95};
101      // set the startup volume
102      set_mastervolume(attenuation);
103   }
104}
96105
97106
107
98108//============================================================
99//  PARAMETERS
109//  sound_sdl - destructor
100110//============================================================
101111
102// maximum audio latency
103#define MAX_AUDIO_LATENCY       5
112sound_sdl::~sound_sdl()
113{
114   // if nothing to do, don't do it
115   if (m_machine.sample_rate() == 0)
116      return;
104117
105//============================================================
106//  LOCAL VARIABLES
107//============================================================
118   // kill the buffers and dsound
119   sdl_kill(m_machine);
120   sdl_destroy_buffers();
108121
109// debugging
110static FILE *sound_log;
122   // print out over/underflow stats
123   if (buffer_overflows || buffer_underflows)
124      osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
111125
112//============================================================
113//  sound_sdl - destructor
114//============================================================
126   if (LOG_SOUND)
127   {
128      fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
129      fclose(sound_log);
130   }
131}
115132
116133//============================================================
117134//  lock_buffer
118135//============================================================
119int sound_sdl::lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
136static int lock_buffer(running_machine &machine, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
120137{
121138   volatile long pstart, pend, lstart, lend;
122139
123140   if (!buf_locked)
124141   {
125      if (is_throttled)
142      if (machine.video().throttled())
126143      {
127144         pstart = stream_playpos;
128145         pend = (pstart + sdl_xfer_samples);
r243192r243193
168185//============================================================
169186//  unlock_buffer
170187//============================================================
171void sound_sdl::unlock_buffer(void)
188static void unlock_buffer(void)
172189{
173190   buf_locked--;
174191   if (!buf_locked)
r243192r243193
183200//  Apply attenuation
184201//============================================================
185202
186void sound_sdl::att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
203static void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
187204{
188205   int level= (int) (pow(10.0, (float) attenuation / 20.0) * 128.0);
189206   INT16 *d = (INT16 *) dest;
r243192r243193
199216//  copy_sample_data
200217//============================================================
201218
202void sound_sdl::copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy)
219static void copy_sample_data(running_machine &machine, const INT16 *data, int bytes_to_copy)
203220{
204221   void *buffer1, *buffer2 = (void *)NULL;
205222   long length1, length2;
206223   int cur_bytes;
207224
208225   // attempt to lock the stream buffer
209   if (lock_buffer(is_throttled, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
226   if (lock_buffer(machine, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
210227   {
211228      buffer_underflows++;
212229      return;
r243192r243193
247264//  update_audio_stream
248265//============================================================
249266
250void sound_sdl::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
267void sound_sdl::update_audio_stream(const INT16 *buffer, int samples_this_frame)
251268{
252269   // if nothing to do, don't do it
253   if (sample_rate() != 0 && stream_buffer)
270   if (m_machine.sample_rate() != 0 && stream_buffer)
254271   {
255272      int bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
256273      int play_position, write_position, stream_in;
r243192r243193
258275
259276      play_position = stream_playpos;
260277
261      write_position = stream_playpos + ((sample_rate() / 50) * sizeof(INT16) * 2);
278      write_position = stream_playpos + ((m_machine.sample_rate() / 50) * sizeof(INT16) * 2);
262279      orig_write = write_position;
263280
264281      if (!stream_in_initialized)
r243192r243193
319336
320337      // now we know where to copy; let's do it
321338      stream_buffer_in = stream_in;
322      copy_sample_data(is_throttled, buffer, bytes_this_frame);
339      copy_sample_data(m_machine, buffer, bytes_this_frame);
323340   }
324341}
325342
r243192r243193
354371//============================================================
355372static void sdl_callback(void *userdata, Uint8 *stream, int len)
356373{
357   sound_sdl *thiz = (sound_sdl *) userdata;
358374   int len1, len2, sb_in;
359375
360   sb_in = thiz->stream_buffer_in;
361   if (thiz->stream_loop)
362      sb_in += thiz->stream_buffer_size;
376   sb_in = stream_buffer_in;
377   if (stream_loop)
378      sb_in += stream_buffer_size;
363379
364   if (sb_in < (thiz->stream_playpos+len))
380   if (sb_in < (stream_playpos+len))
365381   {
366382      if (LOG_SOUND)
367         fprintf(sound_log, "Underflow at sdl_callback: SPP=%d SBI=%d(%d) Len=%d\n", (int)thiz->stream_playpos, (int)sb_in, (int)thiz->stream_buffer_in, (int)len);
383         fprintf(sound_log, "Underflow at sdl_callback: SPP=%d SBI=%d(%d) Len=%d\n", (int)stream_playpos, (int)sb_in, (int)stream_buffer_in, (int)len);
368384
369385      return;
370386   }
371   else if ((thiz->stream_playpos+len) > thiz->stream_buffer_size)
387   else if ((stream_playpos+len) > stream_buffer_size)
372388   {
373      len1 = thiz->stream_buffer_size - thiz->stream_playpos;
389      len1 = stream_buffer_size - stream_playpos;
374390      len2 = len - len1;
375391   }
376392   else
r243192r243193
379395      len2 = 0;
380396   }
381397
382   memcpy(stream, thiz->stream_buffer + thiz->stream_playpos, len1);
383   memset(thiz->stream_buffer + thiz->stream_playpos, 0, len1); // no longer needed
384   if (len2)
398   if (snd_enabled)
385399   {
386      memcpy(stream+len1, thiz->stream_buffer, len2);
387      memset(thiz->stream_buffer, 0, len2); // no longer needed
400      memcpy(stream, stream_buffer + stream_playpos, len1);
401      memset(stream_buffer + stream_playpos, 0, len1); // no longer needed
402      if (len2)
403      {
404         memcpy(stream+len1, stream_buffer, len2);
405         memset(stream_buffer, 0, len2); // no longer needed
406      }
407
388408   }
409   else
410   {
411      memset(stream, 0, len);
412   }
389413
390
391414   // move the play cursor
392   thiz->stream_playpos += len1 + len2;
393   if (thiz->stream_playpos >= thiz->stream_buffer_size)
415   stream_playpos += len1 + len2;
416   if (stream_playpos >= stream_buffer_size)
394417   {
395      thiz->stream_playpos -= thiz->stream_buffer_size;
396      thiz->stream_loop = 0;
418      stream_playpos -= stream_buffer_size;
419      stream_loop = 0;
397420
398421      if (LOG_SOUND)
399422         fprintf(sound_log, "stream_loop set to 0 (stream_playpos looped)\n");
r243192r243193
401424
402425   if (LOG_SOUND)
403426      fprintf(sound_log, "callback: xfer len1 %d len2 %d, playpos %d\n",
404            len1, len2, thiz->stream_playpos);
427            len1, len2, stream_playpos);
405428}
406429
407430
408431//============================================================
409//  sound_sdl::init
432//  sdl_init
410433//============================================================
411
412int sound_sdl::init()
434static int sdl_init(running_machine &machine)
413435{
414436   int         n_channels = 2;
415437   int         audio_latency;
416438   SDL_AudioSpec   aspec, obtained;
417439   char audio_driver[16] = "";
418440
419   if (LOG_SOUND)
420      sound_log = fopen(SDLMAME_SOUND_LOG, "w");
441   if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
442      osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
443      exit(-1);
444   }
421445
422   // skip if sound disabled
423   if (sample_rate() != 0)
424   {
425      if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
426         osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
427         return -1;
428      }
446   osd_printf_verbose("Audio: Start initialization\n");
447#if (SDLMAME_SDL2)
448   strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
449#else
450   SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
451#endif
452   osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
429453
430      osd_printf_verbose("Audio: Start initialization\n");
431   #if (SDLMAME_SDL2)
432      strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
433   #else
434      SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
435   #endif
436      osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
454   initialized_audio = 0;
437455
438      sdl_xfer_samples = SDL_XFER_SAMPLES;
439      stream_in_initialized = 0;
440      stream_loop = 0;
456   sdl_xfer_samples = SDL_XFER_SAMPLES;
457   stream_in_initialized = 0;
458   stream_loop = 0;
441459
442      // set up the audio specs
443      aspec.freq = sample_rate();
444      aspec.format = AUDIO_S16SYS;    // keep endian independent
445      aspec.channels = n_channels;
446      aspec.samples = sdl_xfer_samples;
447      aspec.callback = sdl_callback;
448      aspec.userdata = this;
460   // set up the audio specs
461   aspec.freq = machine.sample_rate();
462   aspec.format = AUDIO_S16SYS;    // keep endian independent
463   aspec.channels = n_channels;
464   aspec.samples = sdl_xfer_samples;
465   aspec.callback = sdl_callback;
466   aspec.userdata = 0;
449467
450      if (SDL_OpenAudio(&aspec, &obtained) < 0)
451         goto cant_start_audio;
468   if (SDL_OpenAudio(&aspec, &obtained) < 0)
469      goto cant_start_audio;
452470
453      osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
454                     obtained.freq, obtained.channels, obtained.samples);
471   initialized_audio = 1;
472   snd_enabled = 1;
455473
456      sdl_xfer_samples = obtained.samples;
474   osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
475                  obtained.freq, obtained.channels, obtained.samples);
457476
458      audio_latency = m_audio_latency;
477   sdl_xfer_samples = obtained.samples;
459478
460      // pin audio latency
461      if (audio_latency > MAX_AUDIO_LATENCY)
462      {
463         audio_latency = MAX_AUDIO_LATENCY;
464      }
465      else if (audio_latency < 1)
466      {
467         audio_latency = 1;
468      }
479   audio_latency = downcast<sdl_options &>(machine.options()).audio_latency();
469480
470      // compute the buffer sizes
471      stream_buffer_size = (sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
472      stream_buffer_size = (stream_buffer_size / 1024) * 1024;
473      if (stream_buffer_size < 1024)
474         stream_buffer_size = 1024;
481   // pin audio latency
482   if (audio_latency > MAX_AUDIO_LATENCY)
483   {
484      audio_latency = MAX_AUDIO_LATENCY;
485   }
486   else if (audio_latency < 1)
487   {
488      audio_latency = 1;
489   }
475490
476      // create the buffers
477      if (sdl_create_buffers())
478         goto cant_create_buffers;
491   // compute the buffer sizes
492   stream_buffer_size = (machine.sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
493   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
494   if (stream_buffer_size < 1024)
495      stream_buffer_size = 1024;
479496
480      // set the startup volume
481      set_mastervolume(attenuation);
482      osd_printf_verbose("Audio: End initialization\n");
483      return 0;
497   // create the buffers
498   if (sdl_create_buffers())
499      goto cant_create_buffers;
484500
485      // error handling
486   cant_create_buffers:
487   cant_start_audio:
488      osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
501   osd_printf_verbose("Audio: End initialization\n");
502   return 0;
489503
490      return -1;
491   }
504   // error handling
505cant_create_buffers:
506cant_start_audio:
507   osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
492508
493509   return 0;
494510}
r243192r243193
499515//  sdl_kill
500516//============================================================
501517
502void sound_sdl::exit()
518static void sdl_kill(running_machine &machine)
503519{
504   // if nothing to do, don't do it
505   if (sample_rate() == 0)
506      return;
507
508   osd_printf_verbose("sdl_kill: closing audio\n");
509   SDL_CloseAudio();
510
511   SDL_QuitSubSystem(SDL_INIT_AUDIO);
512
513   // kill the buffers
514   sdl_destroy_buffers();
515
516   // print out over/underflow stats
517   if (buffer_overflows || buffer_underflows)
518      osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
519
520   if (LOG_SOUND)
520   if (initialized_audio)
521521   {
522      fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
523      fclose(sound_log);
522      osd_printf_verbose("sdl_kill: closing audio\n");
523
524      SDL_CloseAudio();
524525   }
526   SDL_QuitSubSystem(SDL_INIT_AUDIO);
525527}
526528
527529
r243192r243193
530532//  dsound_create_buffers
531533//============================================================
532534
533int sound_sdl::sdl_create_buffers(void)
535static int sdl_create_buffers(void)
534536{
535537   osd_printf_verbose("sdl_create_buffers: creating stream buffer of %u bytes\n", stream_buffer_size);
536538
r243192r243193
540542   return 0;
541543}
542544
545
546
543547//============================================================
544548//  sdl_destroy_buffers
545549//============================================================
546550
547void sound_sdl::sdl_destroy_buffers(void)
551static void sdl_destroy_buffers(void)
548552{
549553   // release the buffer
550554   if (stream_buffer)
551555      global_free_array(stream_buffer);
552556   stream_buffer = NULL;
553557}
554
555
556
557#else /* SDLMAME_UNIX */
558   MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl")
559#endif
560
561MODULE_DEFINITION(SOUND_SDL, sound_sdl)
trunk/src/osd/modules/sound/sdl_sound.h
r0r243193
1//============================================================
2//
3//  sound.c - SDL implementation of MAME sound routines
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11#pragma once
12
13#ifndef __SOUND_SDL_H__
14#define __SOUND_SDL_H__
15
16#include "osdepend.h"
17#include "modules/lib/osdobj_common.h"
18
19class sound_sdl : public osd_sound_interface
20{
21public:
22   // construction/destruction
23   sound_sdl(const osd_interface &osd, running_machine &machine);
24   virtual ~sound_sdl();
25
26   virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
27   virtual void set_mastervolume(int attenuation);
28};
29
30extern const osd_sound_type OSD_SOUND_SDL;
31
32#endif  /* __SOUND_SDL_H__ */
trunk/src/osd/modules/sound/sound_module.h
r243192r243193
1/*
2 * sound_module.h
3 *
4 */
5
6#ifndef SOUND_MODULE_H_
7#define SOUND_MODULE_H_
8
9#include "osdepend.h"
10#include "modules/osdmodule.h"
11
12//============================================================
13//  CONSTANTS
14//============================================================
15
16#define OSD_SOUND_PROVIDER   "sound"
17
18class sound_module
19{
20public:
21   sound_module() : m_sample_rate(0), m_audio_latency(1) { }
22
23   virtual ~sound_module() { }
24
25   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0;
26   virtual void set_mastervolume(int attenuation) = 0;
27
28   int sample_rate() { return m_sample_rate; }
29
30   int m_sample_rate;
31   int m_audio_latency;
32};
33
34#endif /* FONT_MODULE_H_ */
trunk/src/osd/modules/sync/sync_mini.c
r243192r243193
160160void osd_thread_wait_free(osd_thread *thread)
161161{
162162}
163
trunk/src/osd/modules/sync/sync_ntc.c
r243192r243193
411411{
412412   if (timeout == OSD_EVENT_WAIT_INFINITE)
413413      timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
414
414   
415415   pthread_mutex_lock(&event->mutex);
416416   if (!timeout)
417417   {
r243192r243193
531531   pthread_join(thread->thread, NULL);
532532   free(thread);
533533}
534
trunk/src/osd/modules/sync/sync_os2.c
r243192r243193
388388{
389389   ULONG rc;
390390   ULONG timeout_param;
391
391   
392392   if (timeout == OSD_EVENT_WAIT_INFINITE)
393393      timeout_param = SEM_INDEFINITE_WAIT;
394394   else
trunk/src/osd/modules/sync/sync_sdl.c
r243192r243193
326326   thread->callback = callback;
327327   thread->param = cbparam;
328328#ifdef SDLMAME_SDL2
329   thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread);
329    thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread);
330330#else
331   thread->thread = SDL_CreateThread(worker_thread_entry, thread);
331    thread->thread = SDL_CreateThread(worker_thread_entry, thread);
332332#endif
333333   if ( thread->thread == NULL )
334334   {
r243192r243193
366366   SDL_WaitThread(thread->thread, &status);
367367   free(thread);
368368}
369
trunk/src/osd/modules/sync/sync_tc.c
r243192r243193
246246{
247247   if (timeout == OSD_EVENT_WAIT_INFINITE)
248248      timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
249
249   
250250   pthread_mutex_lock(&event->mutex);
251251   if (!timeout)
252252   {
r243192r243193
389389   pthread_join(thread->thread, NULL);
390390   free(thread);
391391}
392
trunk/src/osd/modules/sync/sync_windows.c
r243192r243193
244244      timeout_param = INFINITE;
245245   else
246246      timeout_param = timeout * 1000 / osd_ticks_per_second();
247
247   
248248   int ret = WaitForSingleObject((HANDLE) event, timeout_param);
249249   return (ret == WAIT_OBJECT_0);
250250}
trunk/src/osd/modules/sync/work_osd.c
r243192r243193
7070template<typename _PtrType>
7171static void spin_while(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout, const int invert = 0)
7272{
73   osd_ticks_t stopspin = osd_ticks() + timeout;
73    osd_ticks_t stopspin = osd_ticks() + timeout;
7474
75   do {
76      int spin = 10000;
77      while (--spin)
78      {
79         if ((*ptr != val) ^ invert)
80            return;
81      }
82   } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin);
75    do {
76        int spin = 10000;
77        while (--spin)
78        {
79            if ((*ptr != val) ^ invert)
80                return;
81        }
82    } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin);
8383}
8484
8585template<typename _PtrType>
8686static void spin_while_not(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout)
8787{
88   spin_while(ptr, val, timeout, 1);
88    spin_while(ptr, val, timeout, 1);
8989}
9090
9191
r243192r243193
173173   osd_work_queue *queue;
174174   int osdthreadnum = 0;
175175   int allocthreadnum;
176   const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
176   char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
177177
178178   // allocate a new queue
179179   queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
r243192r243193
553553   if (item->event == NULL)
554554   {
555555      // TODO: do we need to measure the spin time here as well? and how can we do it?
556      spin_while(&item->done, 0, timeout);
556        spin_while(&item->done, 0, timeout);
557557   }
558558
559559   // otherwise, block on the event until done
r243192r243193
612612   }
613613   else
614614   {
615      char *procsoverride;
615616      int numprocs = 0;
616617
617618      // if the OSDPROCESSORS environment variable is set, use that value if valid
618619      // note that we permit more than the real number of processors for testing
619      const char *procsoverride = osd_getenv(ENV_PROCESSORS);
620      procsoverride = osd_getenv(ENV_PROCESSORS);
620621      if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
621622         return MIN(4 * physprocs, numprocs);
622623
trunk/src/osd/osdcore.c
r243192r243193
5454output_delegate osd_set_output_channel(output_channel channel, output_delegate callback)
5555{
5656   if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull())
57   {
58      throw std::exception();
59   }
57    {
58       throw std::exception();
59    }
6060
6161   /* return the originals if requested */
6262   output_delegate prevcb = output_cb[channel];
r243192r243193
166166   va_end(argptr);
167167}
168168#endif
169
trunk/src/osd/osdcore.h
r243192r243193
196196
197197
198198/*-----------------------------------------------------------------------------
199    osd_getenv: return pointer to environment variable
200
201    Parameters:
202
203        name  - name of environment variable
204
205    Return value:
206
207        pointer to value
208-----------------------------------------------------------------------------*/
209const char *osd_getenv(const char *name);
210
211
212/*-----------------------------------------------------------------------------
213199    osd_get_physical_drive_geometry: if the given path points to a physical
214200        drive, return the geometry of that drive
215201
trunk/src/osd/osdepend.h
r243192r243193
1818#include "unicode.h"
1919#include "cliopts.h"
2020
21
2221// forward references
2322class input_type_entry;     // FIXME: including emu.h does not work because emu.h includes osdepend.h
2423
r243192r243193
2726//  TYPE DEFINITIONS
2827//============================================================
2928
30// ======================> osd_font interface
29// FIXME: We can do better than this
30class osd_font;
3131
32class osd_font
33{
34public:
35   virtual ~osd_font() {}
36
37   virtual bool open(const char *font_path, const char *name, int &height) = 0;
38   virtual void close() = 0;
39   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
40};
41
4232// ======================> osd_interface
4333
4434// description of the currently-running machine
r243192r243193
6252   // input overridables
6353   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
6454
55   // font overridables
56   virtual osd_font *font_open(const char *name, int &height) = 0;
57   virtual void font_close(osd_font *font) = 0;
58   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
59
6560   // video overridables
6661   virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
6762
68   // font interface
69   virtual osd_font *font_alloc() = 0;
70
7163   // command option overrides
7264   virtual bool execute_command(const char *command) = 0;
7365
trunk/src/osd/osdmini/minimisc.c
r243192r243193
8181   // can't support clipboards generically
8282   return NULL;
8383}
84
trunk/src/osd/sdl/blit13.h
r243192r243193
114114
115115#define TEXCOPY_M( _name, _src_type, _dest_type,  _op, _len_div) \
116116INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \
117   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
117    ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
118118   int x, y; \
119119   /* loop over Y */ \
120120   for (y = 0; y < texsource->height; y++) { \
r243192r243193
134134
135135#define TEXROT( _name, _src_type, _dest_type, _op) \
136136INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \
137   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
137    ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
138138   int x, y; \
139139   const quad_setup_data *setup = &texture->m_setup; \
140140   int dudx = setup->dudx; \
trunk/src/osd/sdl/draw13.c
r243192r243193
4848
4949static inline bool is_opaque(const float &a)
5050{
51   return (a >= 1.0f);
51    return (a >= 1.0f);
5252}
5353
5454static inline bool is_transparent(const float &a)
5555{
56   return (a <  0.0001f);
56    return (a <  0.0001f);
5757}
5858
5959//============================================================
r243192r243193
6363
6464struct quad_setup_data
6565{
66   quad_setup_data()
67   : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69   {}
70   void compute(const render_primitive &prim);
66    quad_setup_data()
67    : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69    {}
70    void compute(const render_primitive &prim);
7171
7272   INT32           dudx, dvdx, dudy, dvdy;
7373   INT32           startu, startv;
r243192r243193
105105/* texture_info holds information about a texture */
106106class texture_info
107107{
108   friend class simple_list<texture_info>;
108    friend class simple_list<texture_info>;
109109public:
110   texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111   ~texture_info();
110    texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111    ~texture_info();
112112
113   void set_data(const render_texinfo &texsource, const UINT32 flags);
114   void render_quad(const render_primitive *prim, const int x, const int y);
115   bool matches(const render_primitive &prim, const quad_setup_data &setup);
113    void set_data(const render_texinfo &texsource, const UINT32 flags);
114    void render_quad(const render_primitive *prim, const int x, const int y);
115    bool matches(const render_primitive &prim, const quad_setup_data &setup);
116116
117   copy_info_t *compute_size_type();
117    copy_info_t *compute_size_type();
118118
119119   void                *m_pixels;            // pixels for the texture
120120   int                 m_pitch;
r243192r243193
125125   osd_ticks_t         m_last_access;
126126
127127   int raw_width() const { return m_texinfo.width; }
128   int raw_height() const { return m_texinfo.height; }
128    int raw_height() const { return m_texinfo.height; }
129129
130   texture_info *next() { return m_next; }
131   const render_texinfo &texinfo() const { return m_texinfo; }
132   render_texinfo &texinfo() { return m_texinfo; }
130    texture_info *next() { return m_next; }
131    const render_texinfo &texinfo() const { return m_texinfo; }
132    render_texinfo &texinfo() { return m_texinfo; }
133133
134   const HashT hash() const { return m_hash; }
135   const UINT32 flags() const { return m_flags; }
136   const bool is_pixels_owned() const { // do we own / allocated it ?
137      return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138            && (m_copyinfo->func != NULL)) ;
139   }
134    const HashT hash() const { return m_hash; }
135    const UINT32 flags() const { return m_flags; }
136    const bool is_pixels_owned() const { // do we own / allocated it ?
137        return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138                && (m_copyinfo->func != NULL)) ;
139    }
140140
141141private:
142   Uint32              m_sdl_access;
143   SDL_Renderer *      m_renderer;
144   render_texinfo      m_texinfo;            // copy of the texture info
145   HashT               m_hash;               // hash value for the texture (must be >= pointer size)
146   UINT32              m_flags;              // rendering flags
142    Uint32              m_sdl_access;
143    SDL_Renderer *      m_renderer;
144    render_texinfo      m_texinfo;            // copy of the texture info
145    HashT               m_hash;               // hash value for the texture (must be >= pointer size)
146    UINT32              m_flags;              // rendering flags
147147
148   SDL_Texture *       m_texture_id;
149   int                 m_is_rotated;
148    SDL_Texture *       m_texture_id;
149    int                 m_is_rotated;
150150
151   int                 m_format;             // texture format
152   SDL_BlendMode       m_sdl_blendmode;
151    int                 m_format;             // texture format
152    SDL_BlendMode       m_sdl_blendmode;
153153
154   texture_info *      m_next;               // next texture in the list
154    texture_info *      m_next;               // next texture in the list
155155};
156156
157157/* sdl_info is the information about SDL for the current screen */
158158struct sdl_info
159159{
160   sdl_info()
161   : m_blittimer(0), m_renderer(NULL),
162      m_hofs(0), m_vofs(0),
163      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
164      m_last_blit_time(0), m_last_blit_pixels(0)
165   {}
160    sdl_info()
161    : m_blittimer(0), m_renderer(NULL),
162      m_hofs(0), m_vofs(0),
163      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
164      m_last_blit_time(0), m_last_blit_pixels(0)
165    {}
166166
167   void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
167    void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
168168
169   texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
170   texture_info *texture_update(const render_primitive &prim);
169    texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
170    texture_info *texture_update(const render_primitive &prim);
171171
172172   INT32           m_blittimer;
173173
r243192r243193
389389   target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
390390   target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
391391
392   SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
393   set_coloralphamode(m_texture_id, &prim->color);
394   SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
392    SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
393    set_coloralphamode(m_texture_id, &prim->color);
394    SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
395395}
396396
397397void sdl_info::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y)
398398{
399   SDL_Rect target_rect;
399    SDL_Rect target_rect;
400400
401   target_rect.x = x;
402   target_rect.y = y;
403   target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
404   target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
401    target_rect.x = x;
402    target_rect.y = y;
403    target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
404    target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
405405
406   if (texture)
407   {
408      copy_info_t *copyinfo = texture->m_copyinfo;
409      copyinfo->time -= osd_ticks();
410      texture->render_quad(prim, x, y);
411      copyinfo->time += osd_ticks();
406    if (texture)
407    {
408        copy_info_t *copyinfo = texture->m_copyinfo;
409        copyinfo->time -= osd_ticks();
410        texture->render_quad(prim, x, y);
411        copyinfo->time += osd_ticks();
412412
413      copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height()));
414      if (m_last_blit_pixels)
415      {
416         copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels;
417      }
418      copyinfo->samples++;
419      copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time;
420   }
421   else
422   {
423      UINT32 sr = (UINT32)(255.0f * prim->color.r);
424      UINT32 sg = (UINT32)(255.0f * prim->color.g);
425      UINT32 sb = (UINT32)(255.0f * prim->color.b);
426      UINT32 sa = (UINT32)(255.0f * prim->color.a);
413        copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height()));
414        if (m_last_blit_pixels)
415        {
416            copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels;
417        }
418        copyinfo->samples++;
419        copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time;
420    }
421    else
422    {
423        UINT32 sr = (UINT32)(255.0f * prim->color.r);
424        UINT32 sg = (UINT32)(255.0f * prim->color.g);
425        UINT32 sb = (UINT32)(255.0f * prim->color.b);
426        UINT32 sa = (UINT32)(255.0f * prim->color.a);
427427
428      SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
429      SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
430      SDL_RenderFillRect(m_renderer, &target_rect);
431   }
428        SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
429        SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
430        SDL_RenderFillRect(m_renderer, &target_rect);
431    }
432432}
433433
434434static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat)
r243192r243193
518518   else
519519      osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
520520
521   /* Enable bilinear filtering in case it is supported.
522    * This applies to all texture operations. However, artwort is pre-scaled
523    * and thus shouldn't be affected.
524    */
525   if (video_config.filter)
526   {
527      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
528   }
529   else
530   {
531      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
532   }
521    /* Enable bilinear filtering in case it is supported.
522     * This applies to all texture operations. However, artwort is pre-scaled
523     * and thus shouldn't be affected.
524     */
525    if (video_config.filter)
526    {
527        SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
528    }
529    else
530    {
531        SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
532    }
533533
534534   return 0;
535535}
r243192r243193
604604   {
605605      SDL_DisplayMode mode;
606606      //SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode);
607      SDL_GetWindowDisplayMode(window->sdl_window, &mode);
607        SDL_GetWindowDisplayMode(window->sdl_window, &mode);
608608      sdl->m_original_mode = mode;
609609      mode.w = width;
610610      mode.h = height;
r243192r243193
630630            osd_printf_warning("Ignoring depth %d\n", window->depth);
631631         }
632632      }
633      SDL_SetWindowDisplayMode(window->sdl_window, &mode);    // Try to set mode
633        SDL_SetWindowDisplayMode(window->sdl_window, &mode);    // Try to set mode
634634#ifndef SDLMAME_WIN32
635      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
636       * is in place after the mode switch - which will most likely be the case
637       * This is a hack to work around a deficiency in SDL2
638       */
639      SDL_WarpMouseInWindow(window->sdl_window, 1, 1);
635        /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
636         * is in place after the mode switch - which will most likely be the case
637         * This is a hack to work around a deficiency in SDL2
638         */
639        SDL_WarpMouseInWindow(window->sdl_window, 1, 1);
640640#endif
641641   }
642642   else
r243192r243193
736736      SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
737737      sdl->m_resize_pending = 0;
738738      SDL_RenderSetViewport(sdl->m_renderer, NULL);
739      //sdlvideo_monitor_refresh(window->monitor());
739       //sdlvideo_monitor_refresh(window->monitor());
740740
741741   }
742742
r243192r243193
855855
856856   drawsdl2_destroy_all_textures(window);
857857
858   if (window->fullscreen() && video_config.switchres)
859   {
860      SDL_SetWindowFullscreen(window->sdl_window, 0);    // Try to set mode
861      SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode);    // Try to set mode
862      SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
863   }
858    if (window->fullscreen() && video_config.switchres)
859    {
860        SDL_SetWindowFullscreen(window->sdl_window, 0);    // Try to set mode
861        SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode);    // Try to set mode
862        SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
863    }
864864
865   SDL_DestroyWindow(window->sdl_window);
865    SDL_DestroyWindow(window->sdl_window);
866866
867867   global_free(sdl);
868868   window->dxdata = NULL;
r243192r243193
889889      {
890890         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
891891         {
892            int perf = bi->perf;
892             int perf = bi->perf;
893893            if (perf == 0)
894894               return bi;
895895            else if (perf > (maxperf * 102) / 100)
r243192r243193
920920
921921bool texture_info::matches(const render_primitive &prim, const quad_setup_data &setup)
922922{
923   return  texinfo().base == prim.texture.base &&
924         texinfo().width == prim.texture.width &&
925         texinfo().height == prim.texture.height &&
926         texinfo().rowpixels == prim.texture.rowpixels &&
927         m_setup.dudx == setup.dudx &&
928         m_setup.dvdx == setup.dvdx &&
929         m_setup.dudy == setup.dudy &&
930         m_setup.dvdy == setup.dvdy &&
931         ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0;
923    return  texinfo().base == prim.texture.base &&
924            texinfo().width == prim.texture.width &&
925            texinfo().height == prim.texture.height &&
926            texinfo().rowpixels == prim.texture.rowpixels &&
927            m_setup.dudx == setup.dudx &&
928            m_setup.dvdx == setup.dvdx &&
929            m_setup.dudy == setup.dudy &&
930            m_setup.dvdy == setup.dvdy &&
931            ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0;
932932}
933933
934934//============================================================
r243192r243193
937937
938938texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags)
939939{
940
940941   // fill in the core data
941   m_renderer = renderer;
942    m_renderer = renderer;
942943   m_hash = texture_compute_hash(texsource, flags);
943944   m_flags = flags;
944945   m_texinfo = texsource;
r243192r243193
996997
997998   if (m_sdl_access == SDL_TEXTUREACCESS_STATIC)
998999   {
999      if (m_copyinfo->func != NULL)
1000         m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp);
1001      else
1002         m_pixels = NULL;
1000       if (m_copyinfo->func != NULL)
1001           m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp);
1002       else
1003           m_pixels = NULL;
10031004   }
10041005   m_last_access = osd_ticks();
10051006
r243192r243193
10071008
10081009texture_info::~texture_info()
10091010{
1010   if ( is_pixels_owned() && (m_pixels != NULL) )
1011      free(m_pixels);
1012   SDL_DestroyTexture(m_texture_id);
1011    if ( is_pixels_owned() && (m_pixels != NULL) )
1012        free(m_pixels);
1013    SDL_DestroyTexture(m_texture_id);
10131014}
10141015
10151016//============================================================
r243192r243193
10811082
10821083#if 0
10831084   printf("tl.u %f tl.v %f\n", texcoords->tl.u, texcoords->tl.v);
1084   printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v);
1085   printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v);
1086   printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v);
1085    printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v);
1086    printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v);
1087    printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v);
10871088   /* compute start and delta U,V coordinates now */
10881089#endif
10891090
r243192r243193
11611162   if (texture == NULL && prim.texture.base != NULL)
11621163   {
11631164      texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags));
1164      /* add us to the texture list */
1165       /* add us to the texture list */
11651166      m_texlist.prepend(*texture);
11661167
11671168   }
r243192r243193
11901191   if(window->primlist)
11911192   {
11921193      window->primlist->acquire_lock();
1193      sdl->m_texlist.reset();
1194      window->primlist->release_lock();
1194        sdl->m_texlist.reset();
1195        window->primlist->release_lock();
11951196   }
11961197   else
1197      sdl->m_texlist.reset();
1198        sdl->m_texlist.reset();
11981199}
trunk/src/osd/sdl/drawogl.c
r243192r243193
161161/* texture_info holds information about a texture */
162162struct texture_info
163163{
164   texture_info()
165   : hash(0), flags(0), rawwidth(0), rawheight(0),
166      rawwidth_create(0), rawheight_create(0),
167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
169      data_own(0), texCoordBufferName(0)
170   {
171      for (int i=0; i<2; i++)
172      {
173         mpass_textureunit[i] = 0;
174         mpass_texture_mamebm[i] = 0;
175         mpass_fbo_mamebm[i] = 0;
176         mpass_texture_scrn[i] = 0;
177         mpass_fbo_scrn[i] = 0;
178      }
179      for (int i=0; i<8; i++)
180         texCoord[i] = 0.0f;
181   }
164    texture_info()
165    : hash(0), flags(0), rawwidth(0), rawheight(0),
166      rawwidth_create(0), rawheight_create(0),
167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
169      data_own(0), texCoordBufferName(0)
170    {
171        for (int i=0; i<2; i++)
172        {
173            mpass_textureunit[i] = 0;
174            mpass_texture_mamebm[i] = 0;
175            mpass_fbo_mamebm[i] = 0;
176            mpass_texture_scrn[i] = 0;
177            mpass_fbo_scrn[i] = 0;
178        }
179        for (int i=0; i<8; i++)
180            texCoord[i] = 0.0f;
181    }
182182
183183   HashT               hash;               // hash value for the texture (must be >= pointer size)
184184   UINT32              flags;              // rendering flags
r243192r243193
217217/* sdl_info is the information about SDL for the current screen */
218218struct sdl_info
219219{
220   sdl_info()
221   : blittimer(0), extra_flags(0),
220    sdl_info()
221    : blittimer(0), extra_flags(0),
222222#if (SDLMAME_SDL2)
223      gl_context_id(0),
223      gl_context_id(0),
224224#else
225      sdlsurf(NULL),
225      sdlsurf(NULL),
226226#endif
227      initialized(0),
228      last_blendmode(0),
229      texture_max_width(0),
230      texture_max_height(0),
231      texpoweroftwo(0),
232      usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL),
233      glsl_program_num(0),
234      glsl_program_mb2sc(0),
235      usetexturerect(0),
236      init_context(0),
237      last_hofs(0.0f),
238      last_vofs(0.0f),
239      surf_w(0),
240      surf_h(0)
241   {
242      for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++)
243         texhash[i] = NULL;
244      for (int i=0; i < 2*GLSL_SHADER_MAX; i++)
245         glsl_program[i] = 0;
246      for (int i=0; i < 8; i++)
247         texVerticex[i] = 0.0f;
248   }
227      initialized(0),
228      last_blendmode(0),
229      texture_max_width(0),
230      texture_max_height(0),
231      texpoweroftwo(0),
232      usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL),
233      glsl_program_num(0),
234      glsl_program_mb2sc(0),
235      usetexturerect(0),
236      init_context(0),
237      last_hofs(0.0f),
238      last_vofs(0.0f),
239      surf_w(0),
240      surf_h(0)
241    {
242        for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++)
243            texhash[i] = NULL;
244        for (int i=0; i < 2*GLSL_SHADER_MAX; i++)
245            glsl_program[i] = 0;
246        for (int i=0; i < 8; i++)
247            texVerticex[i] = 0.0f;
248    }
249249
250250   INT32           blittimer;
251251   UINT32          extra_flags;
r243192r243193
30793079      sdl->texhash[i] = NULL;
30803080      if (texture != NULL)
30813081      {
3082         if(sdl->usevbo)
3083         {
3084            pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3085            texture->texCoordBufferName=0;
3086         }
3082            if(sdl->usevbo)
3083            {
3084                pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3085                texture->texCoordBufferName=0;
3086            }
30873087
3088         if(sdl->usepbo && texture->pbo)
3089         {
3090            pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3091            texture->pbo=0;
3092         }
3088            if(sdl->usepbo && texture->pbo)
3089            {
3090                pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3091                texture->pbo=0;
3092            }
30933093
3094         if( sdl->glsl_program_num > 1 )
3095         {
3096            assert(sdl->usefbo);
3097            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3098            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3099         }
3094            if( sdl->glsl_program_num > 1 )
3095            {
3096                assert(sdl->usefbo);
3097                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3098                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3099            }
31003100
3101         if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3102         {
3103            assert(sdl->usefbo);
3104            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3105            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3106         }
3101            if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3102            {
3103                assert(sdl->usefbo);
3104                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3105                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3106            }
31073107
3108         glDeleteTextures(1, (GLuint *)&texture->texture);
3109         if ( texture->data_own )
3110         {
3111            free(texture->data);
3112            texture->data=NULL;
3113            texture->data_own=FALSE;
3114         }
3115         global_free(texture);
3108            glDeleteTextures(1, (GLuint *)&texture->texture);
3109            if ( texture->data_own )
3110            {
3111                free(texture->data);
3112                texture->data=NULL;
3113                texture->data_own=FALSE;
3114            }
3115            global_free(texture);
31163116      }
31173117      i++;
31183118   }
trunk/src/osd/sdl/input.c
r243192r243193
19861986            else
19871987            {
19881988#ifndef SDLMAME_WIN32
1989               /* FIXME: SDL2 sends some spurious resize events on Ubuntu
1990                * while in fullscreen mode. Ignore them for now.
1991                */
1992               if (!window->fullscreen())
1989                /* FIXME: SDL2 sends some spurious resize events on Ubuntu
1990                 * while in fullscreen mode. Ignore them for now.
1991                 */
1992                if (!window->fullscreen())
19931993#endif
1994               {
1995                  //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
1996                  if (event.window.data1 != window->width || event.window.data2 != window->height)
1997                     window->window_resize(event.window.data1, event.window.data2);
1998               }
1994                {
1995                       //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
1996                       if (event.window.data1 != window->width || event.window.data2 != window->height)
1997                           window->window_resize(event.window.data1, event.window.data2);
1998                }
19991999            }
20002000            focus_window = window;
20012001            break;
trunk/src/osd/sdl/main.c
r243192r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
31//============================================================
42//
53//  main.c - Win32 main program
64//
5//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
710//============================================================
811
912// standard windows headers
10#ifdef OSD_SDL
1113#define _WIN32_WINNT 0x0400
12#endif
1314#define WIN32_LEAN_AND_MEAN
1415#include <windows.h>
1516#include <tchar.h>
r243192r243193
3738   int i, rc;
3839   char **utf8_argv;
3940
40#ifdef OSD_SDL
4141#ifdef MALLOC_DEBUG
4242{
4343   extern int winalloc_in_main_code;
4444   winalloc_in_main_code = TRUE;
4545#endif
46#endif
4746
4847   /* convert arguments to UTF-8 */
4948   utf8_argv = (char **) malloc(argc * sizeof(*argv));
r243192r243193
6463      osd_free(utf8_argv[i]);
6564   free(utf8_argv);
6665
67#ifdef OSD_SDL
6866#ifdef MALLOC_DEBUG
6967   {
7068      void check_unfreed_mem(void);
r243192r243193
7371   winalloc_in_main_code = FALSE;
7472}
7573#endif
76#endif
7774
7875   return rc;
7976}
trunk/src/osd/sdl/man/castool.1
r243192r243193
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH CASTOOL 1 2015-01-18 0.158 "MESS Generic cassette manipulation tool"
9.TH CASTOOL 1 2014-12-15 0.157 "MESS Generic cassette manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/chdman.1
r243192r243193
66.\" Ashley T. Howes <debiandev@ashleyhowes.com>, February 2005
77.\" updated by Cesare Falco <c.falco@ubuntu.com>, February 2007
88.\"
9.TH CHDMAN 1 2015-01-18 0.158 "MAME Compressed Hunks of Data (CHD) manager"
9.TH CHDMAN 1 2014-12-15 0.157 "MAME Compressed Hunks of Data (CHD) manager"
1010.\"
1111.\" NAME chapter
1212.SH NAME
trunk/src/osd/sdl/man/floptool.1
r243192r243193
66.\" Cesare Falco <c.falco@ubuntu.com>, April 2014
77.\"
88.\"
9.TH FLOPTOOL 1 2015-01-18 0.158 "MESS Generic floppy manipulation tool"
9.TH FLOPTOOL 1 2014-12-15 0.157 "MESS Generic floppy manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/imgtool.1
r243192r243193
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH IMGTOOL 1 2015-01-18 0.158 "MESS media image manipulation tool"
9.TH IMGTOOL 1 2014-12-15 0.157 "MESS media image manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/jedutil.1
r243192r243193
88.\" References
99.\" http://aarongiles.com/?p=159
1010.\"
11.TH JEDUTIL 1 2015-01-18 0.158 "MAME JEDEC file utilities"
11.TH JEDUTIL 1 2014-12-15 0.157 "MAME JEDEC file utilities"
1212.\"
1313.\" NAME chapter
1414.SH NAME
trunk/src/osd/sdl/man/ldresample.1
r243192r243193
33.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
44.\" other parameters are allowed: see man(7), man(1)
55.\"
6.TH LDRESAMPLE 1 2015-01-18 0.158 "MAME laserdisc audio manipulation tool"
6.TH LDRESAMPLE 1 2014-12-15 0.157 "MAME laserdisc audio manipulation tool"
77.\"
88.\" Please adjust this date whenever revising the manpage.
99.\"
trunk/src/osd/sdl/man/ldverify.1
r243192r243193
55.\" Man page created from source and usage information by
66.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
77.\"
8.TH LDVERIFY 1 2015-01-18 0.158 "MAME laserdisc data checker"
8.TH LDVERIFY 1 2014-12-15 0.157 "MAME laserdisc data checker"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/man/mame.6
r243192r243193
1313.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
1414.\"
1515.\"
16.TH MAME 6 2015-01-18 0.158 "MAME \- The Multiple Arcade Machine Emulator"
16.TH MAME 6 2014-12-15 0.157 "MAME \- The Multiple Arcade Machine Emulator"
1717.\"
1818.\"
1919.\" NAME chapter
trunk/src/osd/sdl/man/mess.6
r243192r243193
1616.\" http://www.mess.org/
1717.\"
1818.\"
19.TH MESS 6 2015-01-18 0.158 "The Multiple Emulator Super System (MESS)"
19.TH MESS 6 2014-12-15 0.157 "The Multiple Emulator Super System (MESS)"
2020.\"
2121.\"
2222.\" NAME chapter
trunk/src/osd/sdl/man/romcmp.1
r243192r243193
99.\" References
1010.\" http://www.mame.net/mamefaq.html
1111.\"
12.TH ROMCMP 1 2015-01-18 0.158 "MAME romset checking tool"
12.TH ROMCMP 1 2014-12-15 0.157 "MAME romset checking tool"
1313.\"
1414.\" NAME chapter
1515.SH NAME
trunk/src/osd/sdl/man/testkeys.1
r243192r243193
55.\" Man page created from source and usage information
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
77.\"
8.TH TESTKEYS 1 2015-01-18 0.158 "MAME SDL keycode scanner"
8.TH TESTKEYS 1 2014-12-15 0.157 "MAME SDL keycode scanner"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/netdev_pcap.c
r243192r243193
66#include "emu.h"
77#include "osdnet.h"
88
9#define pcap_compile_dl pcap_compile
10#define pcap_findalldevs_dl pcap_findalldevs
11#define pcap_open_live_dl pcap_open_live
12#define pcap_next_ex_dl pcap_next_ex
13#define pcap_close_dl pcap_close
14#define pcap_setfilter_dl pcap_setfilter
15#define pcap_sendpacket_dl pcap_sendpacket
16#define pcap_set_datalink_dl pcap_set_datalink
17
18
199class netdev_pcap : public netdev
2010{
2111public:
r243192r243193
3424   : netdev(ifdev, rate)
3525{
3626   char errbuf[PCAP_ERRBUF_SIZE];
37   m_p = pcap_open_live_dl(name, 65535, 1, 1, errbuf);
27   m_p = pcap_open_live(name, 65535, 1, 1, errbuf);
3828   if(!m_p)
3929   {
4030      osd_printf_verbose("Unable to open %s: %s\n", name, errbuf);
4131      return;
4232   }
43   if(pcap_set_datalink_dl(m_p, DLT_EN10MB) == -1)
33   if(pcap_set_datalink(m_p, DLT_EN10MB) == -1)
4434   {
45      osd_printf_verbose("Unable to set %s to ethernet\n", name);
46      pcap_close_dl(m_p);
35      osd_printf_verbose("Unable to set %s to ethernet", name);
36      pcap_close(m_p);
4737      m_p = NULL;
4838      return;
4939   }
r243192r243193
5646   struct bpf_program fp;
5747   if(!m_p) return;
5848   sprintf(filter, "ether dst %.2X:%.2X:%.2X:%.2X:%.2X:%.2X or ether multicast or ether broadcast", (unsigned char)mac[0], (unsigned char)mac[1], (unsigned char)mac[2],(unsigned char)mac[3], (unsigned char)mac[4], (unsigned char)mac[5]);
59   if(pcap_compile_dl(m_p, &fp, filter, 1, 0) == -1) {
60      osd_printf_verbose("Error with pcap_compile\n");
61   }
62   if(pcap_setfilter_dl(m_p, &fp) == -1) {
63      osd_printf_verbose("Error with pcap_setfilter\n");
64   }
49   pcap_compile(m_p, &fp, filter, 1, 0);
50   pcap_setfilter(m_p, &fp);
6551}
6652
6753int netdev_pcap::send(UINT8 *buf, int len)
6854{
6955   if(!m_p) return 0;
70   return (!pcap_sendpacket_dl(m_p, buf, len))?len:0;
56   return (!pcap_sendpacket(m_p, buf, len))?len:0;
7157}
7258
7359int netdev_pcap::recv_dev(UINT8 **buf)
7460{
7561   struct pcap_pkthdr *header;
7662   if(!m_p) return 0;
77   return (pcap_next_ex_dl(m_p, &header, (const u_char **)buf) == 1)?header->len:0;
63   return (pcap_next_ex(m_p, &header, (const u_char **)buf) == 1)?header->len:0;
7864}
7965
8066netdev_pcap::~netdev_pcap()
8167{
82   if(m_p) pcap_close_dl(m_p);
68   if(m_p) pcap_close(m_p);
8369}
8470
8571static CREATE_NETDEV(create_pcap)
r243192r243193
9278{
9379   pcap_if_t *devs;
9480   char errbuf[PCAP_ERRBUF_SIZE];
95   if(pcap_findalldevs_dl(&devs, errbuf) == -1)
81   if(pcap_findalldevs(&devs, errbuf) == -1)
9682   {
9783      osd_printf_verbose("Unable to get network devices: %s\n", errbuf);
9884      return;
9985   }
10086
101   while(devs)
87   if (devs)
10288   {
103      add_netdev(devs->name, devs->description, create_pcap);
104      devs = devs->next;
89      while(devs->next)
90      {
91         add_netdev(devs->name, devs->description, create_pcap);
92         devs = devs->next;
93      }
10594   }
10695}
10796
trunk/src/osd/sdl/netdev_pcap_osx.c
r243192r243193
88#include <pthread.h>
99#include <libkern/OSAtomic.h>
1010
11#define pcap_compile_dl pcap_compile
12#define pcap_findalldevs_dl pcap_findalldevs
13#define pcap_open_live_dl pcap_open_live
14#define pcap_next_ex_dl pcap_next_ex
15#define pcap_close_dl pcap_close
16#define pcap_setfilter_dl pcap_setfilter
17#define pcap_sendpacket_dl pcap_sendpacket
18#define pcap_set_datalink_dl pcap_set_datalink
19
2011struct netdev_pcap_context {
2112   UINT8 *pkt;
2213   int len;
r243192r243193
7061   : netdev(ifdev, rate)
7162{
7263   char errbuf[PCAP_ERRBUF_SIZE];
73   m_p = pcap_open_live_dl(name, 65535, 1, 1, errbuf);
64   m_p = pcap_open_live(name, 65535, 1, 1, errbuf);
7465   if(!m_p)
7566   {
7667      osd_printf_verbose("Unable to open %s: %s\n", name, errbuf);
7768      return;
7869   }
79   if(pcap_set_datalink_dl(m_p, DLT_EN10MB) == -1)
70   if(pcap_set_datalink(m_p, DLT_EN10MB) == -1)
8071   {
8172      osd_printf_verbose("Unable to set %s to ethernet\n", name);
82      pcap_close_dl(m_p);
73      pcap_close(m_p);
8374      m_p = NULL;
8475      return;
8576   }
r243192r243193
9788   struct bpf_program fp;
9889   if(!m_p) return;
9990   sprintf(filter, "not ether src %.2X:%.2X:%.2X:%.2X:%.2X:%.2X and (ether dst %.2X:%.2X:%.2X:%.2X:%.2X:%.2X or ether multicast or ether broadcast or ether dst 09:00:07:ff:ff:ff)", (unsigned char)mac[0], (unsigned char)mac[1], (unsigned char)mac[2],(unsigned char)mac[3], (unsigned char)mac[4], (unsigned char)mac[5], (unsigned char)mac[0], (unsigned char)mac[1], (unsigned char)mac[2],(unsigned char)mac[3], (unsigned char)mac[4], (unsigned char)mac[5]);
100   if(pcap_compile_dl(m_p, &fp, filter, 1, 0) == -1) {
91   if(pcap_compile(m_p, &fp, filter, 1, 0) == -1) {
10192      osd_printf_verbose("Error with pcap_compile\n");
10293   }
103   if(pcap_setfilter_dl(m_p, &fp) == -1) {
94   if(pcap_setfilter(m_p, &fp) == -1) {
10495      osd_printf_verbose("Error with pcap_setfilter\n");
10596   }
10697}
r243192r243193
10899int netdev_pcap::send(UINT8 *buf, int len)
109100{
110101   if(!m_p) return 0;
111   return (!pcap_sendpacket_dl(m_p, buf, len))?len:0;
102   return (!pcap_sendpacket(m_p, buf, len))?len:0;
112103}
113104
114105int netdev_pcap::recv_dev(UINT8 **buf)
r243192r243193
130121
131122netdev_pcap::~netdev_pcap()
132123{
133   if(m_p) pcap_close_dl(m_p);
124   if(m_p) pcap_close(m_p);
134125}
135126
136127static CREATE_NETDEV(create_pcap)
r243192r243193
143134{
144135   pcap_if_t *devs;
145136   char errbuf[PCAP_ERRBUF_SIZE];
146   if(pcap_findalldevs_dl(&devs, errbuf) == -1)
137   if(pcap_findalldevs(&devs, errbuf) == -1)
147138   {
148139      osd_printf_verbose("Unable to get network devices: %s\n", errbuf);
149140      return;
150141   }
151142
152#if 1
153   while(devs)
154   {
155      add_netdev(devs->name, devs->description, create_pcap);
156      devs = devs->next;
157   }
158#else
159143   if (devs)
160144   {
161145      while(devs->next)
r243192r243193
164148         devs = devs->next;
165149      }
166150   }
167#endif
168151}
169152
170153void deinit_pcap()
trunk/src/osd/sdl/osdsdl.h
r243192r243193
77#include "clifront.h"
88#include "modules/lib/osdobj_common.h"
99#include "video.h"
10#include "modules/osdmodule.h"
11#include "modules/font/font_module.h"
1210
1311//============================================================
1412//  System dependent defines
r243192r243193
3028      #define SDL13_COMBINE_RESIZE (0)
3129   #endif
3230#else
33   #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
31    #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
3432   #define SDL13_COMBINE_RESIZE (0)
3533#endif
3634
r243192r243193
188186   // input overridables
189187   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
190188
189   // font overridables
190   virtual osd_font *font_open(const char *name, int &height);
191   virtual void font_close(osd_font *font);
192   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
193
191194   virtual void video_register();
195   virtual void sound_register();
196   virtual void debugger_register();
192197
193198   virtual bool video_init();
194199   virtual bool window_init();
r243192r243193
199204   #ifdef USE_NETWORK
200205   virtual bool network_init();
201206   #endif
202   //virtual bool midi_init();
207    //virtual bool midi_init();
203208
204209   virtual void video_exit();
205210   virtual void window_exit();
r243192r243193
208213   #ifdef USE_NETWORK
209214   virtual void network_exit();
210215   #endif
211   //virtual void midi_exit();
216    //virtual void midi_exit();
212217
213   sdl_options &options() { return m_options; }
218    sdl_options &options() { return m_options; }
214219
215220private:
216221   virtual void osd_exit();
r243192r243193
220225   // FIXME: remove machine usage
221226   void extract_video_config(running_machine &machine);
222227
223   sdl_options &m_options;
224228
229    sdl_options &m_options;
230
225231   watchdog *m_watchdog;
226232
227233};
trunk/src/osd/sdl/sdl.mak
r243192r243193
210210BASE_TARGETOS = unix
211211SYNC_IMPLEMENTATION = tc
212212SDL_NETWORK = taptun
213#SDL_NETWORK = pcap
214213
215214ifndef NO_USE_MIDI
216215INCPATH += `pkg-config --cflags alsa`
r243192r243193
246245
247246ifeq ($(TARGETOS),solaris)
248247BASE_TARGETOS = unix
249#DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
250DEFS += -DNO_AFFINITY_NP
248DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
251249SYNC_IMPLEMENTATION = tc
252250NO_USE_MIDI = 1
253NO_USE_QTDEBUG = 1
254251endif
255252
256253ifeq ($(TARGETOS),haiku)
r243192r243193
401398   $(OSDOBJ)/modules/sync \
402399   $(OSDOBJ)/modules/lib \
403400   $(OSDOBJ)/modules/midi \
404   $(OSDOBJ)/modules/font \
405401
406402#-------------------------------------------------
407403# OSD core library
r243192r243193
413409   $(SDLOBJ)/sdlfile.o     \
414410   $(SDLOBJ)/sdlptty_$(BASE_TARGETOS).o    \
415411   $(SDLOBJ)/sdlsocket.o   \
412   $(SDLOBJ)/sdlmisc_$(BASE_TARGETOS).o    \
416413   $(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
417414   $(OSDOBJ)/modules/lib/osdlib_$(SDLOS_TARGETOS).o \
418   $(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
419   $(OSDOBJ)/modules/osdmodule.o \
415   $(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o
420416
421417ifdef NOASM
422418OSDCOREOBJS += $(OSDOBJ)/modules/sync/work_mini.o
r243192r243193
430426   $(SDLMAIN) \
431427   $(SDLOBJ)/sdlmain.o \
432428   $(SDLOBJ)/input.o \
433   $(OSDOBJ)/modules/sound/js_sound.o  \
434   $(OSDOBJ)/modules/sound/direct_sound.o  \
435429   $(OSDOBJ)/modules/sound/sdl_sound.o  \
436   $(OSDOBJ)/modules/sound/none.o  \
437430   $(SDLOBJ)/video.o \
438431   $(SDLOBJ)/drawsdl.o \
439432   $(SDLOBJ)/window.o \
440433   $(SDLOBJ)/output.o \
441434   $(SDLOBJ)/watchdog.o \
442435   $(OSDOBJ)/modules/lib/osdobj_common.o  \
443   $(OSDOBJ)/modules/font/font_sdl.o \
444   $(OSDOBJ)/modules/font/font_windows.o \
445   $(OSDOBJ)/modules/font/font_osx.o \
446   $(OSDOBJ)/modules/font/font_none.o \
447436
448437ifdef NO_USE_MIDI
449438   OSDOBJS += $(OSDOBJ)/modules/midi/none.o
r243192r243193
608597LIBS += -lSDL_ttf
609598endif
610599
611# FIXME: should be dealt with elsewhere
612600# libs that Haiku doesn't want but are mandatory on *IX
613601ifneq ($(TARGETOS),haiku)
614BASELIBS += -lm -lpthread
615LIBS += -lm -lpthread
616ifneq ($(TARGETOS),solaris)
617BASELIBS += -lutil
618LIBS += -lutil
619else
620SUPPORTSM32M64 = 1
621BASELIBS += -lsocket -lnsl
622LIBS += -lsocket -lnsl
602BASELIBS += -lm -lutil -lpthread
603LIBS += -lm -lutil -lpthread
623604endif
624endif
625605
626
627606endif # not Mac OS X
628607
629608ifneq (,$(findstring ppc,$(UNAME)))
r243192r243193
718697   $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@
719698
720699DEBUGOBJS = \
700   $(OSDOBJ)/modules/debugger/debugqt.o \
721701   $(OSDOBJ)/modules/debugger/qt/debugqtview.o \
722702   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
723703   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
r243192r243193
736716   $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o \
737717   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.moc.o \
738718   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o
739
740DEFS += -DUSE_QTDEBUG=1
741
742else
743DEFS += -DUSE_QTDEBUG=0
744719endif
745720
746721ifeq ($(NO_DEBUGGER),1)
r243192r243193
749724OSDOBJS += $(DEBUGOBJS)
750725endif # NO_DEBUGGER
751726
752# Always add these
753OSDOBJS += \
754   $(OSDOBJ)/modules/debugger/none.o \
755   $(OSDOBJ)/modules/debugger/debugint.o \
756   $(OSDOBJ)/modules/debugger/debugwin.o \
757   $(OSDOBJ)/modules/debugger/debugqt.o \
758
759
760727#-------------------------------------------------
761728# OPENGL
762729#-------------------------------------------------
trunk/src/osd/sdl/sdldir.c
r243192r243193
152152
153153   if (tmpstr[0] == '$')
154154   {
155      char *envval;
155156      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
156157
157158      strcpy(envstr, tmpstr);
r243192r243193
164165
165166      envstr[i] = '\0';
166167
167      const char *envval = osd_getenv(&envstr[1]);
168      envval = osd_getenv(&envstr[1]);
168169      if (envval != NULL)
169170      {
170171         j = strlen(envval) + strlen(tmpstr) + 1;
trunk/src/osd/sdl/sdlfile.c
r243192r243193
176176   // does path start with an environment variable?
177177   if (tmpstr[0] == '$')
178178   {
179      char *envval;
179180      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
180181
181182      strcpy(envstr, tmpstr);
r243192r243193
188189
189190      envstr[i] = '\0';
190191
191      const char *envval = osd_getenv(&envstr[1]);
192      envval = osd_getenv(&envstr[1]);
192193      if (envval != NULL)
193194      {
194195         j = strlen(envval) + strlen(tmpstr) + 1;
r243192r243193
505506
506507osd_directory_entry *osd_stat(const char *path)
507508{
508   int err;
509   osd_directory_entry *result = NULL;
510   #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
511   struct stat st;
512   #else
513   struct stat64 st;
514   #endif
509    int err;
510    osd_directory_entry *result = NULL;
511    #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
512    struct stat st;
513    #else
514    struct stat64 st;
515    #endif
515516
516   #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
517   err = stat(path, &st);
518   #else
519   err = stat64(path, &st);
520   #endif
517    #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
518    err = stat(path, &st);
519    #else
520    err = stat64(path, &st);
521    #endif
521522
522   if( err == -1) return NULL;
523    if( err == -1) return NULL;
523524
524   // create an osd_directory_entry; be sure to make sure that the caller can
525   // free all resources by just freeing the resulting osd_directory_entry
526   result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1);
527   strcpy(((char *) result) + sizeof(*result), path);
528   result->name = ((char *) result) + sizeof(*result);
529   result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
530   result->size = (UINT64)st.st_size;
525    // create an osd_directory_entry; be sure to make sure that the caller can
526    // free all resources by just freeing the resulting osd_directory_entry
527    result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1);
528    strcpy(((char *) result) + sizeof(*result), path);
529    result->name = ((char *) result) + sizeof(*result);
530    result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
531    result->size = (UINT64)st.st_size;
531532
532   return result;
533    return result;
533534}
534535
535536//============================================================
r243192r243193
538539
539540file_error osd_get_full_path(char **dst, const char *path)
540541{
541   file_error err;
542   char path_buffer[512];
542    file_error err;
543    char path_buffer[512];
543544
544   err = FILERR_NONE;
545    err = FILERR_NONE;
545546
546   if (getcwd(path_buffer, 511) == NULL)
547   {
548      printf("osd_get_full_path: failed!\n");
549      err = FILERR_FAILURE;
550   }
551   else
552   {
553      *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3);
547    if (getcwd(path_buffer, 511) == NULL)
548    {
549        printf("osd_get_full_path: failed!\n");
550        err = FILERR_FAILURE;
551    }
552    else
553    {
554        *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3);
554555
555      // if it's already a full path, just pass it through
556      if (path[0] == '/')
557      {
558         strcpy(*dst, path);
559      }
560      else
561      {
562         sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path);
563      }
564   }
556        // if it's already a full path, just pass it through
557        if (path[0] == '/')
558        {
559            strcpy(*dst, path);
560        }
561        else
562        {
563            sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path);
564        }
565    }
565566
566   return err;
567    return err;
567568}
568569
569570//============================================================
r243192r243193
572573
573574const char *osd_get_volume_name(int idx)
574575{
575   if (idx!=0) return NULL;
576   return "/";
576    if (idx!=0) return NULL;
577    return "/";
577578}
578579
579580#endif
trunk/src/osd/sdl/sdlmain.c
r243192r243193
1212
1313#ifdef SDLMAME_UNIX
1414#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
15#if (SDLMAME_SDL2)
16#include <SDL2/SDL_ttf.h>
17#else
18#include <SDL/SDL_ttf.h>
19#endif
1520#ifndef SDLMAME_HAIKU
1621#include <fontconfig/fontconfig.h>
1722#endif
r243192r243193
2631#include <unistd.h>
2732#endif
2833
29// only for strconv.h
30#if defined(SDLMAME_WIN32)
31#define WIN32_LEAN_AND_MEAN
32#include <windows.h>
33#endif
34
35
3634#ifdef SDLMAME_OS2
3735#define INCL_DOS
3836#include <os2.h>
r243192r243193
4947#include "emu.h"
5048#include "clifront.h"
5149#include "emuopts.h"
52#include "strconv.h"
5350
5451// OSD headers
5552#include "video.h"
5653#include "input.h"
5754#include "osdsdl.h"
5855#include "modules/lib/osdlib.h"
59
56#include "modules/sound/sdl_sound.h"
57#if defined(SDLMAME_EMSCRIPTEN)
58#include "modules/sound/js_sound.h"
59#endif
60#if defined(SDLMAME_WIN32)
61#include "modules/sound/direct_sound.h"
62#endif
63#if !defined(NO_DEBUGGER)
64#include "modules/debugger/debugqt.h"
65#endif
66#include "modules/debugger/none.h"
67#if defined(SDLMAME_MACOSX)
68#include "modules/debugger/debugosx.h"
69#endif
6070// we override SDL's normal startup on Win32
6171// please see sdlprefix.h as well
6272
r243192r243193
6777
6878#include "watchdog.h"
6979
80#define DEFAULT_FONT_HEIGHT (200)
81
7082//============================================================
7183//  OPTIONS
7284//============================================================
r243192r243193
251263   set_default_value(SDLOPTION_INIPATH, ini_path.cstr());
252264}
253265
266
254267//============================================================
255268//  main
256269//============================================================
r243192r243193
282295   setvbuf(stdout, (char *) NULL, _IONBF, 0);
283296   setvbuf(stderr, (char *) NULL, _IONBF, 0);
284297
285   // FIXME: this should be done differently
286
287298   #ifdef SDLMAME_UNIX
288299   sdl_entered_debugger = 0;
289300   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
301   if (TTF_Init() == -1)
302   {
303      printf("SDL_ttf failed: %s\n", TTF_GetError());
304   }
290305   FcInit();
291306   #endif
292307   #endif
r243192r243193
319334#endif
320335
321336   {
322      sdl_options options;
337       sdl_options options;
323338      sdl_osd_interface osd(options);
324339      osd.register_options();
325340      cli_frontend frontend(options, osd);
r243192r243193
333348   }
334349#endif
335350
351   // already called...
352   //SDL_Quit();
353
336354   #ifdef SDLMAME_UNIX
337355   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
356   TTF_Quit();
338357   if (!sdl_entered_debugger)
339358   {
340359      FcFini();
r243192r243193
524543}
525544
526545//============================================================
546//  sound_register
547//============================================================
548
549void sdl_osd_interface::sound_register()
550{
551   sound_options_add("sdl", OSD_SOUND_SDL);
552#if defined(SDLMAME_WIN32)
553   sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
554#endif
555
556#if defined(SDLMAME_EMSCRIPTEN)
557   sound_options_add("js", OSD_SOUND_JS);
558   sound_options_add("auto", OSD_SOUND_JS); // making JS audio default one
559#else
560   sound_options_add("auto", OSD_SOUND_SDL); // making SDL audio default one
561#endif
562}
563
564//============================================================
565//  debugger_register
566//============================================================
567
568void sdl_osd_interface::debugger_register()
569{
570#if defined(NO_DEBUGGER)
571   debugger_options_add("auto", OSD_DEBUGGER_NONE);
572#else
573#if defined(SDLMAME_MACOSX)
574   debugger_options_add("osx", OSD_DEBUGGER_OSX);
575   debugger_options_add("auto", OSD_DEBUGGER_OSX); // making OSX debugger default one
576#else
577   debugger_options_add("qt", OSD_DEBUGGER_QT);
578   debugger_options_add("auto", OSD_DEBUGGER_QT); // making QT debugger default one
579#endif // SDLMAME_MACOSX
580#endif // NO_DEBUGGER
581}
582
583//============================================================
527584//  init
528585//============================================================
529586
530
531587void sdl_osd_interface::init(running_machine &machine)
532588{
533589   // call our parent
r243192r243193
648704#endif
649705}
650706
707#if defined(SDLMAME_UNIX) && (!defined(SDLMAME_EMSCRIPTEN))
708#define POINT_SIZE 144.0
709
710#ifdef SDLMAME_MACOSX
711
712#define EXTRA_HEIGHT 1.0
713#define EXTRA_WIDTH 1.15
714
715//-------------------------------------------------
716//  font_open - attempt to "open" a handle to the
717//  font with the given name
718//-------------------------------------------------
719
720class osd_font
721{
722public:
723    CTFontRef m_font;
724};
725
726osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
727{
728   CFStringRef font_name = NULL;
729   CTFontRef ct_font = NULL;
730   CTFontDescriptorRef font_descriptor;
731   CGAffineTransform affine_transform = CGAffineTransformIdentity;
732
733   astring name(_name);
734
735   if (name == "default")
736   {
737      name = "LucidaGrande";
738   }
739
740   /* handle bdf fonts in the core */
741   if (name.len() > 4)
742      if (name.makeupper().substr(name.len()-4,4) == ".BDF" )
743         return NULL;
744
745   font_name = CFStringCreateWithCString( NULL, name.cstr(), kCFStringEncodingUTF8 );
746
747   if( font_name != NULL )
748   {
749      font_descriptor = CTFontDescriptorCreateWithNameAndSize( font_name, POINT_SIZE );
750
751      if( font_descriptor != NULL )
752      {
753         ct_font = CTFontCreateWithFontDescriptor( font_descriptor, POINT_SIZE, &affine_transform );
754
755         CFRelease( font_descriptor );
756      }
757   }
758
759   CFRelease( font_name );
760
761   if (!ct_font)
762   {
763      osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.cstr());
764      return NULL;
765   }
766
767   CFStringRef real_name = CTFontCopyPostScriptName( ct_font );
768   char real_name_c_string[255];
769   CFStringGetCString ( real_name, real_name_c_string, 255, kCFStringEncodingUTF8 );
770   osd_printf_verbose("Matching font: %s\n", real_name_c_string);
771   CFRelease( real_name );
772
773   CGFloat line_height = 0.0;
774   line_height += CTFontGetAscent(ct_font);
775   line_height += CTFontGetDescent(ct_font);
776   line_height += CTFontGetLeading(ct_font);
777   height = ceilf(line_height * EXTRA_HEIGHT);
778
779   osd_font *ret = global_alloc(osd_font);
780   ret->m_font = ct_font;
781   return ret;
782}
783
784//-------------------------------------------------
785//  font_close - release resources associated with
786//  a given OSD font
787//-------------------------------------------------
788
789void sdl_osd_interface::font_close(osd_font *font)
790{
791   CTFontRef ct_font = font->m_font;
792
793   if( ct_font != NULL )
794   {
795      CFRelease( ct_font );
796   }
797   global_free(font);
798}
799
800//-------------------------------------------------
801//  font_get_bitmap - allocate and populate a
802//  BITMAP_FORMAT_ARGB32 bitmap containing the
803//  pixel values rgb_t(0xff,0xff,0xff,0xff)
804//  or rgb_t(0x00,0xff,0xff,0xff) for each
805//  pixel of a black & white font
806//-------------------------------------------------
807
808bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
809{
810   UniChar uni_char;
811   CGGlyph glyph;
812   CTFontRef ct_font = font->m_font;
813   const CFIndex count = 1;
814   CGRect bounding_rect, success_rect;
815   CGContextRef context_ref;
816
817   if( chnum == ' ' )
818   {
819      uni_char = 'n';
820      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
821      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
822      uni_char = chnum;
823      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
824   }
825   else
826   {
827      uni_char = chnum;
828      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
829      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
830   }
831
832   if( CGRectEqualToRect( success_rect, CGRectNull ) == false )
833   {
834      size_t bitmap_width;
835      size_t bitmap_height;
836
837      bitmap_width = ceilf(bounding_rect.size.width * EXTRA_WIDTH);
838      bitmap_width = bitmap_width == 0 ? 1 : bitmap_width;
839
840      bitmap_height = ceilf( (CTFontGetAscent(ct_font) + CTFontGetDescent(ct_font) + CTFontGetLeading(ct_font)) * EXTRA_HEIGHT);
841
842      xoffs = yoffs = 0;
843      width = bitmap_width;
844
845      size_t bits_per_component;
846      CGColorSpaceRef color_space;
847      CGBitmapInfo bitmap_info = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;
848
849      color_space = CGColorSpaceCreateDeviceRGB();
850      bits_per_component = 8;
851
852      bitmap.allocate(bitmap_width, bitmap_height);
853
854      context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info );
855
856      if( context_ref != NULL )
857      {
858         CGFontRef font_ref;
859         font_ref = CTFontCopyGraphicsFont( ct_font, NULL );
860         CGContextSetTextPosition(context_ref, -bounding_rect.origin.x*EXTRA_WIDTH, CTFontGetDescent(ct_font)+CTFontGetLeading(ct_font) );
861         CGContextSetRGBFillColor(context_ref, 1.0, 1.0, 1.0, 1.0);
862         CGContextSetFont( context_ref, font_ref );
863         CGContextSetFontSize( context_ref, POINT_SIZE );
864         CGContextShowGlyphs( context_ref, &glyph, count );
865         CGFontRelease( font_ref );
866         CGContextRelease( context_ref );
867      }
868
869      CGColorSpaceRelease( color_space );
870   }
871
872   return bitmap.valid();
873}
874#else // UNIX but not OSX
875
876static TTF_Font * TTF_OpenFont_Magic(astring name, int fsize)
877{
878   emu_file file(OPEN_FLAG_READ);
879   if (file.open(name) == FILERR_NONE)
880   {
881      unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
882      unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 };
883      file.read(buffer,5);
884      if (memcmp(buffer, magic, 5))
885         return NULL;
886   }
887   return TTF_OpenFont(name.cstr(), POINT_SIZE);
888}
889
890static bool BDF_Check_Magic(astring name)
891{
892   emu_file file(OPEN_FLAG_READ);
893   if (file.open(name) == FILERR_NONE)
894   {
895      unsigned char buffer[9];
896      unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' };
897      file.read(buffer, 9);
898      file.close();
899      if (!memcmp(buffer, magic, 9))
900         return true;
901   }
902
903   return false;
904}
905
906#ifndef SDLMAME_HAIKU
907static TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles)
908{
909   TTF_Font *font = (TTF_Font *)NULL;
910   FcConfig *config;
911   FcPattern *pat;
912   FcObjectSet *os;
913   FcFontSet *fontset;
914   FcValue val;
915
916   config = FcConfigGetCurrent();
917   pat = FcPatternCreate();
918   os = FcObjectSetCreate();
919   FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
920
921   // try and get a font with the requested styles baked-in
922   if (bold)
923   {
924      if (italic)
925      {
926         FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic");
927      }
928      else
929      {
930         FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold");
931      }
932   }
933   else if (italic)
934   {
935      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic");
936   }
937   else
938   {
939      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular");
940   }
941
942   FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
943
944   FcObjectSetAdd(os, FC_FILE);
945   fontset = FcFontList(config, pat, os);
946
947   for (int i = 0; i < fontset->nfont; i++)
948   {
949      if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch)
950      {
951         continue;
952      }
953
954      if (val.type != FcTypeString)
955      {
956         continue;
957      }
958
959      osd_printf_verbose("Matching font: %s\n", val.u.s);
960      {
961         astring match_name((const char*)val.u.s);
962         font = TTF_OpenFont_Magic(match_name, POINT_SIZE);
963      }
964
965      if (font)
966      {
967         bakedstyles = true;
968         break;
969      }
970   }
971
972   // didn't get a font above?  try again with no baked-in styles
973   if (!font)
974   {
975      FcPatternDestroy(pat);
976      FcFontSetDestroy(fontset);
977
978      pat = FcPatternCreate();
979      FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
980      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular");
981      FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
982      fontset = FcFontList(config, pat, os);
983
984      for (int i = 0; i < fontset->nfont; i++)
985      {
986         if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch)
987         {
988            continue;
989         }
990
991         if (val.type != FcTypeString)
992         {
993            continue;
994         }
995
996         osd_printf_verbose("Matching unstyled font: %s\n", val.u.s);
997         {
998            astring match_name((const char*)val.u.s);
999            font = TTF_OpenFont_Magic(match_name, POINT_SIZE);
1000         }
1001
1002         if (font)
1003         {
1004            break;
1005         }
1006      }
1007   }
1008
1009   FcPatternDestroy(pat);
1010   FcObjectSetDestroy(os);
1011   FcFontSetDestroy(fontset);
1012   return font;
1013}
1014#endif
1015
1016//-------------------------------------------------
1017//  font_open - attempt to "open" a handle to the
1018//  font with the given name
1019//-------------------------------------------------
1020
1021class osd_font
1022{
1023public:
1024    TTF_Font *m_font;
1025};
1026
1027osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
1028{
1029   TTF_Font *font = (TTF_Font *)NULL;
1030   bool bakedstyles = false;
1031   int style = 0;
1032
1033   // accept qualifiers from the name
1034   astring name(_name);
1035
1036   if (name == "default")
1037   {
1038      name = "Liberation Sans";
1039   }
1040
1041   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
1042   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
1043   bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0);
1044   bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0);
1045
1046   // first up, try it as a filename
1047   font = TTF_OpenFont_Magic(name, POINT_SIZE);
1048
1049   // if no success, try the font path
1050
1051   if (!font)
1052   {
1053      osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH);
1054      emu_file file(options().font_path(), OPEN_FLAG_READ);
1055      if (file.open(name) == FILERR_NONE)
1056      {
1057         astring full_name = file.fullpath();
1058         font = TTF_OpenFont_Magic(full_name, POINT_SIZE);
1059         if (font)
1060            osd_printf_verbose("Found font %s\n", full_name.cstr());
1061      }
1062   }
1063
1064   // if that didn't work, crank up the FontConfig database
1065#ifndef SDLMAME_HAIKU
1066   if (!font)
1067   {
1068      font = search_font_config(name, bold, italic, underline, bakedstyles);
1069   }
1070#endif
1071
1072   if (!font)
1073   {
1074      if (!BDF_Check_Magic(name))
1075      {
1076         osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr());
1077      }
1078      return NULL;
1079   }
1080
1081   // apply styles
1082   if (!bakedstyles)
1083   {
1084      style |= bold ? TTF_STYLE_BOLD : 0;
1085      style |= italic ? TTF_STYLE_ITALIC : 0;
1086   }
1087   style |= underline ? TTF_STYLE_UNDERLINE : 0;
1088   // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH
1089#if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9)
1090   style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
1091#else
1092   if (strike)
1093      osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n");
1094#endif // PATCHLEVEL
1095   TTF_SetFontStyle(font, style);
1096
1097   height = TTF_FontLineSkip(font);
1098
1099   osd_font *ret = global_alloc(osd_font);
1100   ret->m_font = font;
1101   return ret;
1102}
1103
1104//-------------------------------------------------
1105//  font_close - release resources associated with
1106//  a given OSD font
1107//-------------------------------------------------
1108
1109void sdl_osd_interface::font_close(osd_font *font)
1110{
1111   TTF_CloseFont(font->m_font);
1112   global_free(font);
1113}
1114
1115//-------------------------------------------------
1116//  font_get_bitmap - allocate and populate a
1117//  BITMAP_FORMAT_ARGB32 bitmap containing the
1118//  pixel values rgb_t(0xff,0xff,0xff,0xff)
1119//  or rgb_t(0x00,0xff,0xff,0xff) for each
1120//  pixel of a black & white font
1121//-------------------------------------------------
1122
1123bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1124{
1125   TTF_Font *ttffont;
1126   SDL_Surface *drawsurf;
1127   SDL_Color fcol = { 0xff, 0xff, 0xff };
1128   UINT16 ustr[16];
1129
1130   ttffont = font->m_font;
1131
1132   memset(ustr,0,sizeof(ustr));
1133   ustr[0] = (UINT16)chnum;
1134   drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);
1135
1136   // was nothing returned?
1137   if (drawsurf)
1138   {
1139      // allocate a MAME destination bitmap
1140      bitmap.allocate(drawsurf->w, drawsurf->h);
1141
1142      // copy the rendered character image into it
1143      for (int y = 0; y < bitmap.height(); y++)
1144      {
1145         UINT32 *dstrow = &bitmap.pix32(y);
1146         UINT8 *srcrow = (UINT8 *)drawsurf->pixels;
1147
1148         srcrow += (y * drawsurf->pitch);
1149
1150         for (int x = 0; x < drawsurf->w; x++)
1151         {
1152            dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff);
1153         }
1154      }
1155
1156      // what are these?
1157      xoffs = yoffs = 0;
1158      width = drawsurf->w;
1159
1160      SDL_FreeSurface(drawsurf);
1161   }
1162
1163   return bitmap.valid();
1164}
1165#endif  // not OSX
1166#else   // not UNIX
6511167#ifdef SDLMAME_WIN32
6521168
6531169//============================================================
r243192r243193
6871203   return result;
6881204}
6891205
1206osd_font sdl_osd_interface::font_open(const char *_name, int &height)
1207{
1208   // accept qualifiers from the name
1209   astring name(_name);
1210   if (name == "default") name = "Tahoma";
1211   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
1212   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
1213
1214   // build a basic LOGFONT description of what we want
1215   LOGFONT logfont;
1216   logfont.lfHeight = DEFAULT_FONT_HEIGHT;
1217   logfont.lfWidth = 0;
1218   logfont.lfEscapement = 0;
1219   logfont.lfOrientation = 0;
1220   logfont.lfWeight = bold ? FW_BOLD : FW_MEDIUM;
1221   logfont.lfItalic = italic;
1222   logfont.lfUnderline = FALSE;
1223   logfont.lfStrikeOut = FALSE;
1224   logfont.lfCharSet = ANSI_CHARSET;
1225   logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1226   logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1227   logfont.lfQuality = NONANTIALIASED_QUALITY;
1228   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
1229
1230   // copy in the face name
1231   TCHAR *face = wstring_from_utf8(name);
1232   wcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
1233   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
1234   osd_free(face);
1235
1236   // create the font
1237   height = logfont.lfHeight;
1238   osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont));
1239   if (font == NULL)
1240      return NULL;
1241
1242   // select it into a temp DC and get the real font name
1243   HDC dummyDC = CreateCompatibleDC(NULL);
1244   HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast<HGDIOBJ>(font));
1245   TCHAR realname[100];
1246   GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname);
1247   SelectObject(dummyDC, oldfont);
1248   DeleteDC(dummyDC);
1249
1250   // if it doesn't match our request, fail
1251   char *utf = utf8_from_wstring(realname);
1252   int result = core_stricmp(utf, name);
1253   osd_free(utf);
1254
1255   // if we didn't match, nuke our font and fall back
1256   if (result != 0)
1257   {
1258      DeleteObject(reinterpret_cast<HFONT>(font));
1259      font = NULL;
1260   }
1261   return font;
1262}
1263
1264
1265//-------------------------------------------------
1266//  font_close - release resources associated with
1267//  a given OSD font
1268//-------------------------------------------------
1269
1270void sdl_osd_interface::font_close(osd_font font)
1271{
1272   // delete the font ojbect
1273   if (font != NULL)
1274      DeleteObject(reinterpret_cast<HFONT>(font));
1275}
1276
1277
1278//-------------------------------------------------
1279//  font_get_bitmap - allocate and populate a
1280//  BITMAP_FORMAT_ARGB32 bitmap containing the
1281//  pixel values rgb_t(0xff,0xff,0xff,0xff)
1282//  or rgb_t(0x00,0xff,0xff,0xff) for each
1283//  pixel of a black & white font
1284//-------------------------------------------------
1285
1286bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1287{
1288   // create a dummy DC to work with
1289   HDC dummyDC = CreateCompatibleDC(NULL);
1290   HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast<HGDIOBJ>(font));
1291
1292   // get the text metrics
1293   TEXTMETRIC metrics = { 0 };
1294   GetTextMetrics(dummyDC, &metrics);
1295
1296   // get the width of this character
1297   ABC abc;
1298   if (!GetCharABCWidths(dummyDC, chnum, chnum, &abc))
1299   {
1300      abc.abcA = 0;
1301      abc.abcC = 0;
1302      GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast<LPINT>(&abc.abcB));
1303   }
1304   width = abc.abcA + abc.abcB + abc.abcC;
1305
1306   // determine desired bitmap size
1307   int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31;
1308   int bmheight = 50 + metrics.tmHeight + 50;
1309
1310   // describe the bitmap we want
1311   BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER)+2 * sizeof(RGBQUAD)] = { 0 };
1312   BITMAPINFO &info = *reinterpret_cast<BITMAPINFO *>(bitmapinfodata);
1313   info.bmiHeader.biSize = sizeof(info.bmiHeader);
1314   info.bmiHeader.biWidth = bmwidth;
1315   info.bmiHeader.biHeight = -bmheight;
1316   info.bmiHeader.biPlanes = 1;
1317   info.bmiHeader.biBitCount = 1;
1318   info.bmiHeader.biCompression = BI_RGB;
1319   info.bmiHeader.biSizeImage = 0;
1320   info.bmiHeader.biXPelsPerMeter = GetDeviceCaps(dummyDC, HORZRES) / GetDeviceCaps(dummyDC, HORZSIZE);
1321   info.bmiHeader.biYPelsPerMeter = GetDeviceCaps(dummyDC, VERTRES) / GetDeviceCaps(dummyDC, VERTSIZE);
1322   info.bmiHeader.biClrUsed = 0;
1323   info.bmiHeader.biClrImportant = 0;
1324   RGBQUAD col1 = info.bmiColors[0];
1325   RGBQUAD col2 = info.bmiColors[1];
1326   col1.rgbBlue = col1.rgbGreen = col1.rgbRed = 0x00;
1327   col2.rgbBlue = col2.rgbGreen = col2.rgbRed = 0xff;
1328
1329   // create a DIB to render to
1330   BYTE *bits;
1331   HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
1332   HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
1333
1334   // clear the bitmap
1335   int rowbytes = bmwidth / 8;
1336   memset(bits, 0, rowbytes * bmheight);
1337
1338   // now draw the character
1339   WCHAR tempchar = chnum;
1340   SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff));
1341   SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00));
1342   ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL);
1343
1344   // characters are expected to be full-height
1345   rectangle actbounds;
1346   actbounds.min_y = 50;
1347   actbounds.max_y = 50 + metrics.tmHeight - 1;
1348
1349   // determine the actual left of the character
1350   for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++)
1351   {
1352      BYTE *offs = bits + actbounds.min_x;
1353      UINT8 summary = 0;
1354      for (int y = 0; y < bmheight; y++)
1355         summary |= offs[y * rowbytes];
1356      if (summary != 0)
1357      {
1358         actbounds.min_x *= 8;
1359         if (!(summary & 0x80)) actbounds.min_x++;
1360         if (!(summary & 0xc0)) actbounds.min_x++;
1361         if (!(summary & 0xe0)) actbounds.min_x++;
1362         if (!(summary & 0xf0)) actbounds.min_x++;
1363         if (!(summary & 0xf8)) actbounds.min_x++;
1364         if (!(summary & 0xfc)) actbounds.min_x++;
1365         if (!(summary & 0xfe)) actbounds.min_x++;
1366         break;
1367      }
1368   }
1369
1370   // determine the actual right of the character
1371   for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--)
1372   {
1373      BYTE *offs = bits + actbounds.max_x;
1374      UINT8 summary = 0;
1375      for (int y = 0; y < bmheight; y++)
1376         summary |= offs[y * rowbytes];
1377      if (summary != 0)
1378      {
1379         actbounds.max_x *= 8;
1380         if (summary & 0x7f) actbounds.max_x++;
1381         if (summary & 0x3f) actbounds.max_x++;
1382         if (summary & 0x1f) actbounds.max_x++;
1383         if (summary & 0x0f) actbounds.max_x++;
1384         if (summary & 0x07) actbounds.max_x++;
1385         if (summary & 0x03) actbounds.max_x++;
1386         if (summary & 0x01) actbounds.max_x++;
1387         break;
1388      }
1389   }
1390
1391   // allocate a new bitmap
1392   if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y)
1393   {
1394      bitmap.allocate(actbounds.max_x + 1 - actbounds.min_x, actbounds.max_y + 1 - actbounds.min_y);
1395
1396      // copy the bits into it
1397      for (int y = 0; y < bitmap.height(); y++)
1398      {
1399         UINT32 *dstrow = &bitmap.pix32(y);
1400         UINT8 *srcrow = &bits[(y + actbounds.min_y) * rowbytes];
1401         for (int x = 0; x < bitmap.width(); x++)
1402         {
1403            int effx = x + actbounds.min_x;
1404            dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? rgb_t(0xff, 0xff, 0xff, 0xff) : rgb_t(0x00, 0xff, 0xff, 0xff);
1405         }
1406      }
1407
1408      // set the final offset values
1409      xoffs = actbounds.min_x - (50 + abc.abcA);
1410      yoffs = actbounds.max_y - (50 + metrics.tmAscent);
1411   }
1412
1413   // de-select the font and release the DC
1414   SelectObject(dummyDC, oldbitmap);
1415   DeleteObject(dib);
1416   SelectObject(dummyDC, oldfont);
1417   DeleteDC(dummyDC);
1418   return bitmap.valid();
1419}
1420
1421#else
1422
1423//-------------------------------------------------
1424//  font_open - attempt to "open" a handle to the
1425//  font with the given name
1426//-------------------------------------------------
1427
1428osd_font sdl_osd_interface::font_open(const char *_name, int &height)
1429{
1430   return (osd_font)NULL;
1431}
1432
1433//-------------------------------------------------
1434//  font_close - release resources associated with
1435//  a given OSD font
1436//-------------------------------------------------
1437
1438void sdl_osd_interface::font_close(osd_font font)
1439{
1440}
1441
1442//-------------------------------------------------
1443//  font_get_bitmap - allocate and populate a
1444//  BITMAP_FORMAT_ARGB32 bitmap containing the
1445//  pixel values rgb_t(0xff,0xff,0xff,0xff)
1446//  or rgb_t(0x00,0xff,0xff,0xff) for each
1447//  pixel of a black & white font
1448//-------------------------------------------------
1449
1450bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1451{
1452   return false;
1453}
6901454#endif
1455#endif
1456
1457
trunk/src/osd/sdl/sdlmisc_os2.c
r0r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11
12// standard sdl header
13#include "sdlinc.h"
14#include <unistd.h>
15#include <stdio.h>
16#include <string.h>
17#include <ctype.h>
18#include <stdlib.h>
19
20#define INCL_DOS
21#include <os2.h>
22
23// MAME headers
24#include "osdcore.h"
25
26//============================================================
27//  osd_alloc_executable
28//
29//  allocates "size" bytes of executable memory.  this must take
30//  things like NX support into account.
31//============================================================
32
33void *osd_alloc_executable(size_t size)
34{
35   void *p;
36
37   DosAllocMem( &p, size, fALLOC );
38   return p;
39}
40
41//============================================================
42//  osd_free_executable
43//
44//  frees memory allocated with osd_alloc_executable
45//============================================================
46
47void osd_free_executable(void *ptr, size_t size)
48{
49   DosFreeMem( ptr );
50}
51
52//============================================================
53//  osd_break_into_debugger
54//============================================================
55
56void osd_break_into_debugger(const char *message)
57{
58   printf("Ignoring MAME exception: %s\n", message);
59}
trunk/src/osd/sdl/sdlmisc_unix.c
r0r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11
12#include <sys/mman.h>
13#include <signal.h>
14#ifdef MAME_DEBUG
15#include <unistd.h>
16#endif
17
18// MAME headers
19#include "osdcore.h"
20
21
22//============================================================
23//  osd_alloc_executable
24//
25//  allocates "size" bytes of executable memory.  this must take
26//  things like NX support into account.
27//============================================================
28
29void *osd_alloc_executable(size_t size)
30{
31#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
32   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
33#elif defined(SDLMAME_UNIX)
34   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
35#endif
36}
37
38//============================================================
39//  osd_free_executable
40//
41//  frees memory allocated with osd_alloc_executable
42//============================================================
43
44void osd_free_executable(void *ptr, size_t size)
45{
46#ifdef SDLMAME_SOLARIS
47   munmap((char *)ptr, size);
48#else
49   munmap(ptr, size);
50#endif
51}
52
53//============================================================
54//  osd_break_into_debugger
55//============================================================
56
57void osd_break_into_debugger(const char *message)
58{
59   #ifdef MAME_DEBUG
60   printf("MAME exception: %s\n", message);
61   printf("Attempting to fall into debugger\n");
62   kill(getpid(), SIGTRAP);
63   #else
64   printf("Ignoring MAME exception: %s\n", message);
65   #endif
66}
trunk/src/osd/sdl/sdlmisc_win32.c
r0r243193
1//============================================================
2//
3//  sdlos_*.c - OS specific low level code
4//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
10//============================================================
11
12// standard sdl header
13#include "sdlinc.h"
14
15
16#define WIN32_LEAN_AND_MEAN
17#include <windows.h>
18
19// MAME headers
20#include "osdcore.h"
21
22//============================================================
23//  osd_alloc_executable
24//
25//  allocates "size" bytes of executable memory.  this must take
26//  things like NX support into account.
27//============================================================
28
29void *osd_alloc_executable(size_t size)
30{
31   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
32}
33
34//============================================================
35//  osd_free_executable
36//
37//  frees memory allocated with osd_alloc_executable
38//============================================================
39
40void osd_free_executable(void *ptr, size_t size)
41{
42   VirtualFree(ptr, 0, MEM_RELEASE);
43}
44
45//============================================================
46//  osd_break_into_debugger
47//============================================================
48
49void osd_break_into_debugger(const char *message)
50{
51   if (IsDebuggerPresent())
52   {
53      OutputDebugStringA(message);
54      DebugBreak();
55   }
56}
trunk/src/osd/sdl/sdlos_macosx.c
r243192r243193
121121
122122   return result;
123123}
124
trunk/src/osd/sdl/sdlos_os2.c
r243192r243193
2323
2424// MAME headers
2525#include "osdcore.h"
26#include "osdlib.h"
2726
27
2828//============================================================
29//  PROTOTYPES
30//============================================================
31
32
33static osd_ticks_t init_cycle_counter(void);
34static osd_ticks_t performance_cycle_counter(void);
35
36//============================================================
37//  STATIC VARIABLES
38//============================================================
39
40// global cycle_counter function and divider
41static osd_ticks_t      (*cycle_counter)(void) = init_cycle_counter;
42static osd_ticks_t      (*ticks_counter)(void) = init_cycle_counter;
43static osd_ticks_t      ticks_per_second;
44
45//============================================================
46//  init_cycle_counter
47//
48//  to avoid total grossness, this function is split by subarch
49//============================================================
50
51static osd_ticks_t init_cycle_counter(void)
52{
53   osd_ticks_t start, end;
54   osd_ticks_t a, b;
55
56   ULONG  frequency;
57   PTIB   ptib;
58   ULONG  ulClass;
59   ULONG  ulDelta;
60
61   DosGetInfoBlocks( &ptib, NULL );
62   ulClass = HIBYTE( ptib->tib_ptib2->tib2_ulpri );
63   ulDelta = LOBYTE( ptib->tib_ptib2->tib2_ulpri );
64
65   if ( DosTmrQueryFreq( &frequency ) == 0 )
66   {
67      // use performance counter if available as it is constant
68      cycle_counter = performance_cycle_counter;
69      ticks_counter = performance_cycle_counter;
70
71      ticks_per_second = frequency;
72
73      // return the current cycle count
74      return (*cycle_counter)();
75   }
76   else
77   {
78      fprintf(stderr, "No Timer available!\n");
79      exit(-1);
80   }
81
82   // temporarily set our priority higher
83   DosSetPriority( PRTYS_THREAD, PRTYC_TIMECRITICAL, PRTYD_MAXIMUM, 0 );
84
85   // wait for an edge on the timeGetTime call
86   a = SDL_GetTicks();
87   do
88   {
89      b = SDL_GetTicks();
90   } while (a == b);
91
92   // get the starting cycle count
93   start = (*cycle_counter)();
94
95   // now wait for 1/4 second total
96   do
97   {
98      a = SDL_GetTicks();
99   } while (a - b < 250);
100
101   // get the ending cycle count
102   end = (*cycle_counter)();
103
104   // compute ticks_per_sec
105   ticks_per_second = (end - start) * 4;
106
107   // restore our priority
108   DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 );
109
110   // return the current cycle count
111   return (*cycle_counter)();
112}
113
114//============================================================
115//  performance_cycle_counter
116//============================================================
117
118static osd_ticks_t performance_cycle_counter(void)
119{
120   QWORD qwTime;
121
122   DosTmrQueryTime( &qwTime );
123   return (osd_ticks_t)qwTime.ulLo;
124}
125
126//============================================================
127//   osd_cycles
128//============================================================
129
130osd_ticks_t osd_ticks(void)
131{
132   return (*cycle_counter)();
133}
134
135
136//============================================================
137//  osd_ticks_per_second
138//============================================================
139
140osd_ticks_t osd_ticks_per_second(void)
141{
142   if (ticks_per_second == 0)
143   {
144      // if we haven't computed the value yet, there's no time like the present
145      init_cycle_counter();
146   }
147   return ticks_per_second;
148}
149
150
151//============================================================
152//  osd_sleep
153//============================================================
154
155void osd_sleep(osd_ticks_t duration)
156{
157   UINT32 msec;
158
159   // make sure we've computed ticks_per_second
160   if (ticks_per_second == 0)
161      (void)osd_ticks();
162
163   // convert to milliseconds, rounding down
164   msec = (UINT32)(duration * 1000 / ticks_per_second);
165
166   // only sleep if at least 2 full milliseconds
167   if (msec >= 2)
168   {
169      // take a couple of msecs off the top for good measure
170      msec -= 2;
171      usleep(msec*1000);
172   }
173}
174
175//============================================================
176//  osd_num_processors
177//============================================================
178
179int osd_get_num_processors(void)
180{
181   ULONG numprocs = 1;
182
183   DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numprocs, sizeof(numprocs));
184
185   return numprocs;
186}
187
188//============================================================
189//  osd_malloc
190//============================================================
191
192void *osd_malloc(size_t size)
193{
194#ifndef MALLOC_DEBUG
195   return malloc(size);
196#else
197#error "MALLOC_DEBUG not yet supported"
198#endif
199}
200
201
202//============================================================
203//  osd_malloc_array
204//============================================================
205
206void *osd_malloc_array(size_t size)
207{
208#ifndef MALLOC_DEBUG
209   return malloc(size);
210#else
211#error "MALLOC_DEBUG not yet supported"
212#endif
213}
214
215
216//============================================================
217//  osd_free
218//============================================================
219
220void osd_free(void *ptr)
221{
222#ifndef MALLOC_DEBUG
223   free(ptr);
224#else
225#error "MALLOC_DEBUG not yet supported"
226#endif
227}
228
229//============================================================
230//  osd_getenv
231//============================================================
232
233char *osd_getenv(const char *name)
234{
235   return getenv(name);
236}
237
238//============================================================
239//  osd_setenv
240//============================================================
241
242int osd_setenv(const char *name, const char *value, int overwrite)
243{
244   return setenv(name, value, overwrite);
245}
246
247
248//============================================================
29249//  osd_get_clipboard_text
30250//    - used in MESS
31251//============================================================
trunk/src/osd/sdl/sdlos_unix.c
r243192r243193
147147   return result;
148148}
149149#endif
150
151
152
trunk/src/osd/sdl/sdlos_win32.c
r243192r243193
101101
102102   return result;
103103}
104
105//============================================================
106//  astring_from_utf8
107//============================================================
108
109CHAR *astring_from_utf8(const char *utf8string)
110{
111   WCHAR *wstring;
112   int char_count;
113   CHAR *result;
114
115   // convert MAME string (UTF-8) to UTF-16
116   char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0);
117   wstring = (WCHAR *)alloca(char_count * sizeof(*wstring));
118   MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, wstring, char_count);
119
120   // convert UTF-16 to "ANSI code page" string
121   char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, NULL, 0, NULL, NULL);
122   result = (CHAR *)osd_malloc_array(char_count * sizeof(*result));
123   if (result != NULL)
124      WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, NULL, NULL);
125
126   return result;
127}
128
129//============================================================
130//  wstring_from_utf8
131//============================================================
132
133WCHAR *wstring_from_utf8(const char *utf8string)
134{
135   int char_count;
136   WCHAR *result;
137
138   // convert MAME string (UTF-8) to UTF-16
139   char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0);
140   result = (WCHAR *)osd_malloc_array(char_count * sizeof(*result));
141   if (result != NULL)
142      MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count);
143
144   return result;
145}
146
trunk/src/osd/sdl/sdlprefix.h
r243192r243193
2727
2828#if defined(__sun__) && defined(__svr4__)
2929#define SDLMAME_SOLARIS 1
30//#undef _XOPEN_SOURCE
31//#undef _XOPEN_VERSION
32//#undef _XOPEN_SOURCE_EXTENDED
33//#undef _XPG6
34//#undef _XPG5
35//#undef _XPG4_2
36//#define _XOPEN_SOURCE
37//#define _XOPEN_VERSION 4
30#undef _XOPEN_SOURCE
31#undef _XOPEN_VERSION
32#undef _XOPEN_SOURCE_EXTENDED
33#undef _XPG6
34#undef _XPG5
35#undef _XPG4_2
36
37#define _XOPEN_SOURCE
38#define _XOPEN_VERSION 4
39
3840#elif defined(__irix__) || defined(__sgi)
3941#define SDLMAME_IRIX 1
4042/* Large file support on IRIX needs _SGI_SOURCE */
trunk/src/osd/sdl/sdlptty_unix.c
r243192r243193
99//
1010//============================================================
1111
12#if (!defined(SDLMAME_SOLARIS) && !(defined(SDLMAME_OS2)))
13
1412#include <sys/types.h>
1513#include <sys/uio.h>
1614#include <unistd.h>
r243192r243193
103101
104102   return FILERR_NONE;
105103}
106
107#else
108#include "sdlfile.h"
109
110const char *sdlfile_ptty_identifier  = "";
111
112file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize)
113{
114   return FILERR_ACCESS_DENIED;
115}
116
117file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
118{
119   return FILERR_ACCESS_DENIED;
120}
121
122file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
123{
124   return FILERR_ACCESS_DENIED;
125}
126
127file_error sdl_close_ptty(osd_file *file)
128{
129   return FILERR_ACCESS_DENIED;
130}
131#endif
trunk/src/osd/sdl/strconv.c
r243192r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
31//============================================================
42//
5//  strconv.c - Win32 string conversion
3//  strconv.c - SDL (POSIX) string conversion
64//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//  SDLMAME by Olivier Galibert and R. Belmont
9//
710//============================================================
811
9#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
12#ifdef SDLMAME_WIN32
1013#define WIN32_LEAN_AND_MEAN
1114#include <windows.h>
1215#endif
1316
17#include <stdlib.h>
18
1419// MAMEOS headers
1520#include "strconv.h"
1621#include "unicode.h"
1722
18#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
23#ifdef SDLMAME_WIN32
1924//============================================================
20//  astring_from_utf8
21//============================================================
22
23CHAR *astring_from_utf8(const char *utf8string)
24{
25   WCHAR *wstring;
26   int char_count;
27   CHAR *result;
28
29   // convert MAME string (UTF-8) to UTF-16
30   char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0);
31   wstring = (WCHAR *)alloca(char_count * sizeof(*wstring));
32   MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, wstring, char_count);
33
34   // convert UTF-16 to "ANSI code page" string
35   char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, NULL, 0, NULL, NULL);
36   result = (CHAR *)osd_malloc_array(char_count * sizeof(*result));
37   if (result != NULL)
38      WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, NULL, NULL);
39
40   return result;
41}
42
43
44//============================================================
4525//  utf8_from_astring
4626//============================================================
4727
r243192r243193
6545   return result;
6646}
6747
68
6948//============================================================
70//  wstring_from_utf8
71//============================================================
72
73WCHAR *wstring_from_utf8(const char *utf8string)
74{
75   int char_count;
76   WCHAR *result;
77
78   // convert MAME string (UTF-8) to UTF-16
79   char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, NULL, 0);
80   result = (WCHAR *)osd_malloc_array(char_count * sizeof(*result));
81   if (result != NULL)
82      MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count);
83
84   return result;
85}
86
87
88//============================================================
8949//  utf8_from_wstring
9050//============================================================
9151
r243192r243193
10262
10363   return result;
10464}
65#endif
10566
10667//============================================================
10768//  osd_uchar_from_osdchar
10869//============================================================
10970
110int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count)
111{
112   WCHAR wch;
113
114   count = MIN(count, IsDBCSLeadByte(*osdchar) ? 2 : 1);
115   if (MultiByteToWideChar(CP_ACP, 0, osdchar, (DWORD)count, &wch, 1) != 0)
116      *uchar = wch;
117   else
118      *uchar = 0;
119   return (int) count;
120}
121
122#else
123
124//============================================================
125//  osd_uchar_from_osdchar
126//============================================================
127
12871int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count)
12972{
13073   wchar_t wch;
r243192r243193
13780
13881   return count;
13982}
140
141#endif
trunk/src/osd/sdl/strconv.h
r243192r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
31//============================================================
42//
5//  strconv.h - String conversion
3//  strconv.h - SDL string conversion
64//
75//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
86//  Visit http://mamedev.org for licensing and usage restrictions.
97//
108//============================================================
119
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
10#ifndef __SDLSTRCONV__
11#define __SDLSTRCONV__
1412
1513#include "osdcore.h"
1614
r243192r243193
2018//  FUNCTION PROTOTYPES
2119//============================================================
2220
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
21#ifdef SDLMAME_WIN32
2422
25#if defined(SDLMAME_WIN32)
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28#endif
2923// the result of these functions has to be released with osd_free()
3024
3125CHAR *astring_from_utf8(const char *s);
r243192r243193
4236#define utf8_from_tstring   utf8_from_astring
4337#endif // UNICODE
4438
45#if defined(SDLMAME_WIN32)
46#define _tcsncpy wcsncpy
47#endif
48
4939#endif //SDLMAME_WIN32
5040
51
52#endif // __OSD_STRCONV__
41#endif // __SDLSTRCONV__
trunk/src/osd/sdl/video.c
r243192r243193
154154
155155   #if defined(SDLMAME_WIN32)
156156   SDL_GetDesktopDisplayMode(monitor->handle, &dmode);
157   #else
158   SDL_GetCurrentDisplayMode(monitor->handle, &dmode);
159   #endif
157    #else
158    SDL_GetCurrentDisplayMode(monitor->handle, &dmode);
159    #endif
160160   monitor->monitor_width = dmode.w;
161161   monitor->monitor_height = dmode.h;
162162   monitor->center_width = dmode.w;
r243192r243193
227227         SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1);
228228         if (first_call==0)
229229         {
230            const char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
230            char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
231231            const SDL_VideoInfo *sdl_vi;
232232
233233            sdl_vi = SDL_GetVideoInfo();
r243192r243193
648648   stemp = options().video();
649649   if (strcmp(stemp, "auto") == 0)
650650   {
651#if (defined SDLMAME_MACOSX || defined SDLMAME_WIN32)
651#ifdef SDLMAME_MACOSX
652652      stemp = "opengl";
653653#else
654654      stemp = "soft";
trunk/src/osd/sdl/window.c
r243192r243193
269269   /* We may want to set a number of the hints SDL2 provides.
270270    * The code below will document which hints were set.
271271    */
272   const char * hints[] = { SDL_HINT_FRAMEBUFFER_ACCELERATION,
273         SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_OPENGL_SHADERS,
274         SDL_HINT_RENDER_SCALE_QUALITY,
275         SDL_HINT_RENDER_VSYNC,
276         SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
277         SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
278         SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
279         SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
280         SDL_HINT_ORIENTATIONS,
281         SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
282         SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST,
283         SDL_HINT_TIMER_RESOLUTION,
284#if SDL_VERSION_ATLEAST(2, 0, 2)
285         SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
286         SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
287         SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
288         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
289#endif
290#if SDL_VERSION_ATLEAST(2, 0, 3)
291         SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED,
292         SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL,
293         SDL_HINT_WINRT_HANDLE_BACK_BUTTON,
294#endif
295         NULL
296   };
272    const char * hints[] = { SDL_HINT_RENDER_DRIVER,    SDL_HINT_RENDER_OPENGL_SHADERS,
273            SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_RENDER_SCALE_QUALITY,
274            SDL_HINT_RENDER_VSYNC, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
275            SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
276            SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
277            SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
278            SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
279            SDL_HINT_ORIENTATIONS, SDL_HINT_ACCELEROMETER_AS_JOYSTICK,
280            SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
281            SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST,
282            SDL_HINT_TIMER_RESOLUTION, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
283            SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
284            SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
285            NULL
286    };
297287
298
299   osd_printf_verbose("\nHints:\n");
300   for (int i = 0; hints[i] != NULL; i++)
301      osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i]));
288    osd_printf_verbose("\nHints:\n");
289    for (int i = 0; hints[i] != NULL; i++)
290        osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i]));
302291#endif
303292
304293   // set up the window list
r243192r243193
10181007
10191008      if (osd_event_wait(rendered_event, event_wait_ticks))
10201009      {
1021         if ((!fullscreen()) || (video_config.switchres))
1022         {
1023            blit_surface_size(width, height);
1024         }
1025         else
1026         {
1027            blit_surface_size(monitor()->center_width, monitor()->center_height);
1028         }
1010          if ((!fullscreen()) || (video_config.switchres))
1011          {
1012              blit_surface_size(width, height);
1013          }
1014          else
1015          {
1016              blit_surface_size(monitor()->center_width, monitor()->center_height);
1017          }
10291018
10301019         // ensure the target bounds are up-to-date, and then get the primitives
1031         set_target_bounds(this);
1020          set_target_bounds(this);
10321021
10331022         render_primitive_list &primlist = target->get_primitives();
10341023
trunk/src/osd/sdl/window.h
r243192r243193
6161      m_fullscreen = !video_config.windowed;
6262      prescale = video_config.prescale;
6363
64      windowed_width = config->width;
65      windowed_height = config->height;
64        windowed_width = config->width;
65        windowed_height = config->height;
6666   }
6767
6868   void video_window_update(running_machine &machine);
trunk/src/osd/windows/main.c
r243192r243193
77//============================================================
88
99// standard windows headers
10#ifdef OSD_SDL
11#define _WIN32_WINNT 0x0400
12#endif
1310#define WIN32_LEAN_AND_MEAN
1411#include <windows.h>
1512#include <tchar.h>
r243192r243193
3734   int i, rc;
3835   char **utf8_argv;
3936
40#ifdef OSD_SDL
41#ifdef MALLOC_DEBUG
42{
43   extern int winalloc_in_main_code;
44   winalloc_in_main_code = TRUE;
45#endif
46#endif
47
4837   /* convert arguments to UTF-8 */
4938   utf8_argv = (char **) malloc(argc * sizeof(*argv));
5039   if (utf8_argv == NULL)
r243192r243193
6453      osd_free(utf8_argv[i]);
6554   free(utf8_argv);
6655
67#ifdef OSD_SDL
68#ifdef MALLOC_DEBUG
69   {
70      void check_unfreed_mem(void);
71      check_unfreed_mem();
72   }
73   winalloc_in_main_code = FALSE;
74}
75#endif
76#endif
77
7856   return rc;
7957}
trunk/src/osd/windows/netdev_pcap.h
r243192r243193
1#ifndef __NETDEV_PCAP_H__
2#define __NETDEV_PCAP_H__
1#ifndef __NETDEV_H
2#define __NETDEV_H
33
44void init_pcap();
55void deinit_pcap();
trunk/src/osd/windows/strconv.c
r243192r243193
66//
77//============================================================
88
9#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
9// standard windows headers
1010#define WIN32_LEAN_AND_MEAN
1111#include <windows.h>
12#endif
1312
1413// MAMEOS headers
1514#include "strconv.h"
1615#include "unicode.h"
1716
18#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
17
1918//============================================================
2019//  astring_from_utf8
2120//============================================================
r243192r243193
102101
103102   return result;
104103}
105
106//============================================================
107//  osd_uchar_from_osdchar
108//============================================================
109
110int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count)
111{
112   WCHAR wch;
113
114   count = MIN(count, IsDBCSLeadByte(*osdchar) ? 2 : 1);
115   if (MultiByteToWideChar(CP_ACP, 0, osdchar, (DWORD)count, &wch, 1) != 0)
116      *uchar = wch;
117   else
118      *uchar = 0;
119   return (int) count;
120}
121
122#else
123
124//============================================================
125//  osd_uchar_from_osdchar
126//============================================================
127
128int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count)
129{
130   wchar_t wch;
131
132   count = mbstowcs(&wch, (char *)osdchar, 1);
133   if (count != -1)
134      *uchar = wch;
135   else
136      *uchar = 0;
137
138   return count;
139}
140
141#endif
trunk/src/osd/windows/strconv.h
r243192r243193
22// copyright-holders:Aaron Giles
33//============================================================
44//
5//  strconv.h - String conversion
5//  strconv.h - Win32 string conversion
66//
7//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
107//============================================================
118
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
9#ifndef __WIN_STRCONV__
10#define __WIN_STRCONV__
1411
1512#include "osdcore.h"
1613
r243192r243193
2017//  FUNCTION PROTOTYPES
2118//============================================================
2219
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
24
25#if defined(SDLMAME_WIN32)
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28#endif
2920// the result of these functions has to be released with osd_free()
3021
3122CHAR *astring_from_utf8(const char *s);
r243192r243193
4233#define utf8_from_tstring   utf8_from_astring
4334#endif // UNICODE
4435
45#if defined(SDLMAME_WIN32)
46#define _tcsncpy wcsncpy
47#endif
4836
49#endif //SDLMAME_WIN32
5037
51
52#endif // __OSD_STRCONV__
38#endif // __WIN_STRCONV__
trunk/src/osd/windows/vconv.c
r243192r243193
2525#define VS2008  0x00090000
2626#define VS2010  0x00100000
2727#define VS2012  0x00110000
28#define VS2013  0x00120000
2928
3029
3130
r243192r243193
6867   { 0,        "-fno-omit-frame-pointer",  "" },
6968   { 0,        "-fomit-frame-pointer",     "" },
7069   { 0,        "-Werror",                  "/WX" },
71   // warning C4003: not enough actual parameters for macro 'xxx'
72   // warning C4018: 'x' : signed/unsigned mismatch
73   // warning C4061: enumerator 'xxx' in switch of enum 'xxx' is not explicitly handled by a case label
74   // warning C4100: 'xxx' : unreferenced formal parameter
75   // warning C4127: conditional expression is constant
76   // warning C4131: 'xxx' : uses old-style declarator
77   // warning C4141: 'xxx' : used more than once
78   // warning C4146: unary minus operator applied to unsigned type, result still unsigned
79   // warning C4150: deletion of pointer to incomplete type 'xxx'; no destructor called
80   // warning C4189: 'xxx' : local variable is initialized but not referenced
81   // warning C4201: nonstandard extension used : nameless struct/union
82   // warning C4242: 'x' : conversion from 'xxx' to 'xxx', possible loss of data
83   // warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data
84   // warning C4250: 'xxx' : inherits 'xxx' via dominance
85   // warning C4255: 'xxx' : no function prototype given: converting '()' to '(void)'
86   // warning C4296: 'x' : expression is always false
87   // warning C4310: cast truncates constant value
88   // warning C4324: 'xxx' : structure was padded due to __declspec(align())
89   // warning C4347: behavior change: 'xxx' is called instead of 'xxx' // obsolete VS2005 - VS2010 only
90   // warning C4435: 'xxx' : Object layout under /vd2 will change due to virtual base 'xxx'
91   // warning C4510: 'xxx' : default constructor could not be generated
92   // warning C4512: 'xxx' : assignment operator could not be generated
93   // warning C4514: 'xxx' : unreferenced inline function has been removed
94   // warning C4619: #pragma warning : there is no warning number 'xxx'
95   // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
96   // warning C4610: struct 'xxx' can never be instantiated - user defined constructor required
97   // warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted
98   // warning C4626: 'xxx' : assignment operator could not be generated because a base class assignment operator is inaccessible or deleted
99   // warning C4668: 'xxx' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
100   // warning C4702: unreachable code
101   // warning C4706: assignment within conditional expression
102   // warning C4710: 'xxx' : function not inlined
103   // warning C4711: function 'xxx' selected for automatic inline expansion // optimized only
104   // warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation
105   // warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx'
106   { VS7,      "-Wall",                    "/Wall /W4 /wd4003 /wd4018 /wd4061 /wd4100 /wd4127 /wd4131 /wd4141 /wd4146 /wd4150 /wd4189 /wd4201 /wd4242 /wd4244 /wd4250 /wd4255 /wd4296 /wd4310 /wd4324 /wd4347 /wd4435 /wd4510 /wd4512 /wd4514 /wd4571 /wd4610 /wd4619 /wd4625 /wd4626 /wd4668 /wd4702 /wd4706 /wd4710 /wd4711 /wd4805 /wd4820" },
70   //{ VS7,        "-Wall",                    "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
71   { VS7,      "-Wall",                    "/Wall /W4 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826 /wd4820 /wd4514 /wd4668 /wd4127 /wd4625 /wd4626 /wd4512 /wd4100 /wd4310 /wd4571 /wd4061 /wd4131 /wd4255 /wd4510 /wd4610 /wd4505 /wd4324 /wd4611 /wd4201 /wd4189 /wd4296 /wd4986 /wd4347 /wd4987 /wd4250 /wd4435 /wd4150 /wd4805 /wd4141" },
10772   { 0,        "-Wall",                    "/W0" },
10873   { VS7,      "-Wno-unused",              "/wd4100 /wd4101 /wd4102 /wd4505" },
10974   { 0,        "-Wno-sign-compare",        "/wd4365 /wd4389 /wd4245 /wd4388" },
trunk/src/osd/windows/windows.mak
r243192r243193
9191   $(OSDOBJ)/modules/sync \
9292   $(OSDOBJ)/modules/lib \
9393   $(OSDOBJ)/modules/midi \
94   $(OSDOBJ)/modules/font \
9594
9695ifdef USE_QTDEBUG
9796OBJDIRS += $(OSDOBJ)/modules/debugger/qt
r243192r243193
313312
314313ifeq ($(CROSS_BUILD),1)
315314   LDFLAGS += -static
316endif
315endif   
317316
318317# TODO: needs to use $(CC)
319318TEST_GCC := $(shell gcc --version)
r243192r243193
349348   $(WINOBJ)/strconv.o \
350349   $(WINOBJ)/windir.o \
351350   $(WINOBJ)/winfile.o \
351   $(WINOBJ)/winmisc.o \
352352   $(OSDOBJ)/modules/sync/sync_windows.o \
353353   $(WINOBJ)/winutf8.o \
354354   $(WINOBJ)/winutil.o \
r243192r243193
356356   $(WINOBJ)/winsocket.o \
357357   $(OSDOBJ)/modules/sync/work_osd.o \
358358   $(OSDOBJ)/modules/lib/osdlib_win32.o \
359   $(OSDOBJ)/modules/osdmodule.o \
360359   $(WINOBJ)/winptty.o \
361360
362361
r243192r243193
373372   $(WINOBJ)/drawnone.o \
374373   $(WINOBJ)/input.o \
375374   $(WINOBJ)/output.o \
376   $(OSDOBJ)/modules/sound/js_sound.o  \
377   $(OSDOBJ)/modules/sound/direct_sound.o  \
378   $(OSDOBJ)/modules/sound/sdl_sound.o  \
379   $(OSDOBJ)/modules/sound/none.o  \
375   $(OSDOBJ)/modules/sound/direct_sound.o \
380376   $(WINOBJ)/video.o \
381377   $(WINOBJ)/window.o \
382378   $(WINOBJ)/winmenu.o \
383379   $(WINOBJ)/winmain.o \
384380   $(OSDOBJ)/modules/midi/portmidi.o \
385381   $(OSDOBJ)/modules/lib/osdobj_common.o  \
386   $(OSDOBJ)/modules/font/font_sdl.o \
387   $(OSDOBJ)/modules/font/font_windows.o \
388   $(OSDOBJ)/modules/font/font_osx.o \
389   $(OSDOBJ)/modules/font/font_none.o \
390382
391383ifdef USE_SDL
392384OSDOBJS += \
r243192r243193
407399
408400# add debug-specific files
409401OSDOBJS += \
410   $(OSDOBJ)/modules/debugger/debugwin.o \
411   $(OSDOBJ)/modules/debugger/debugint.o \
412   $(OSDOBJ)/modules/debugger/debugqt.o \
413   $(OSDOBJ)/modules/debugger/none.o \
402   $(OSDOBJ)/modules/debugger/debugwin.o
414403
415404# add a stub resource file
416405RESFILE = $(WINOBJ)/mame.res
r243192r243193
423412QT_LIBS := -L$(shell qmake -query QT_INSTALL_LIBS)
424413LIBS += $(QT_LIBS) -lqtmain -lQtGui4 -lQtCore4
425414INCPATH += -I$(QT_INSTALL_HEADERS)/QtCore -I$(QT_INSTALL_HEADERS)/QtGui -I$(QT_INSTALL_HEADERS)
415CFLAGS += -DUSE_QTDEBUG
426416
427417MOC = @moc
428418$(OSDOBJ)/%.moc.c: $(OSDSRC)/%.h
429419   $(MOC) $(INCPATH) $(DEFS) $< -o $@
430420
431421OSDOBJS += \
422   $(OSDOBJ)/modules/debugger/debugqt.o \
432423   $(OSDOBJ)/modules/debugger/qt/debugqtview.o \
433424   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
434425   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
trunk/src/osd/windows/winfile.c
r243192r243193
383383
384384
385385//============================================================
386//  osd_uchar_from_osdchar
387//============================================================
388
389int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count)
390{
391   WCHAR wch;
392
393   count = MIN(count, IsDBCSLeadByte(*osdchar) ? 2 : 1);
394   if (MultiByteToWideChar(CP_ACP, 0, osdchar, (DWORD)count, &wch, 1) != 0)
395      *uchar = wch;
396   else
397      *uchar = 0;
398   return (int) count;
399}
400
401
402//============================================================
386403//  create_path_recursive
387404//============================================================
388405
trunk/src/osd/windows/winmain.c
r243192r243193
3939#include "debugger.h"
4040#include "winfile.h"
4141
42#include "modules/sound/direct_sound.h"
43#if (USE_SDL)
44#include "modules/sound/sdl_sound.h"
45#endif
46
47#include "modules/debugger/debugwin.h"
48
49#if (USE_QTDEBUG)
50#include "modules/debugger/debugqt.h"
51#endif
4252#define DEBUG_SLOW_LOCKS    0
4353
54
4455//**************************************************************************
4556//  MACROS
4657//**************************************************************************
r243192r243193
530541}
531542
532543//============================================================
544//  sound_register
545//============================================================
546
547void windows_osd_interface::sound_register()
548{
549   sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
550#if (USE_SDL)
551   sound_options_add("sdl", OSD_SOUND_SDL);
552#endif
553   sound_options_add("auto", OSD_SOUND_DIRECT_SOUND); // making Direct Sound audio default one
554}
555
556
557//============================================================
558//  debugger_register
559//============================================================
560
561void windows_osd_interface::debugger_register()
562{
563   debugger_options_add("windows", OSD_DEBUGGER_WINDOWS);
564#if (USE_QTDEBUG)
565   debugger_options_add("qt", OSD_DEBUGGER_QT);
566#endif
567   debugger_options_add("auto", OSD_DEBUGGER_WINDOWS); // making windows debugger default one
568}
569
570//============================================================
533571//  init
534572//============================================================
535573
r243192r243193
675713   winwindow_process_events(machine(), 0, 0);
676714}
677715
716
717//-------------------------------------------------
718//  font_open - attempt to "open" a handle to the
719//  font with the given name
720//-------------------------------------------------
721
722osd_font *windows_osd_interface::font_open(const char *_name, int &height)
723{
724   // accept qualifiers from the name
725   astring name(_name);
726   if (name == "default") name = "Tahoma";
727   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
728   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
729
730   // build a basic LOGFONT description of what we want
731   LOGFONT logfont;
732   logfont.lfHeight = DEFAULT_FONT_HEIGHT;
733   logfont.lfWidth = 0;
734   logfont.lfEscapement = 0;
735   logfont.lfOrientation = 0;
736   logfont.lfWeight = bold ? FW_BOLD : FW_MEDIUM;
737   logfont.lfItalic = italic;
738   logfont.lfUnderline = FALSE;
739   logfont.lfStrikeOut = FALSE;
740   logfont.lfCharSet = ANSI_CHARSET;
741   logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
742   logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
743   logfont.lfQuality = NONANTIALIASED_QUALITY;
744   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
745
746   // copy in the face name
747   TCHAR *face = tstring_from_utf8(name);
748   _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
749   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR) - 1] = 0;
750   osd_free(face);
751
752   // create the font
753   height = logfont.lfHeight;
754   osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont));
755   if (font == NULL)
756      return NULL;
757
758   // select it into a temp DC and get the real font name
759   HDC dummyDC = CreateCompatibleDC(NULL);
760   HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast<HGDIOBJ>(font));
761   TCHAR realname[100];
762   GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname);
763   SelectObject(dummyDC, oldfont);
764   DeleteDC(dummyDC);
765
766   // if it doesn't match our request, fail
767   char *utf = utf8_from_tstring(realname);
768   int result = core_stricmp(utf, name);
769   osd_free(utf);
770
771   // if we didn't match, nuke our font and fall back
772   if (result != 0)
773   {
774      DeleteObject(reinterpret_cast<HFONT>(font));
775      font = NULL;
776   }
777   return font;
778}
779
780
781//-------------------------------------------------
782//  font_close - release resources associated with
783//  a given OSD font
784//-------------------------------------------------
785
786void windows_osd_interface::font_close(osd_font *font)
787{
788   // delete the font ojbect
789   if (font != NULL)
790      DeleteObject(reinterpret_cast<HFONT>(font));
791}
792
793
794//-------------------------------------------------
795//  font_get_bitmap - allocate and populate a
796//  BITMAP_FORMAT_ARGB32 bitmap containing the
797//  pixel values rgb_t(0xff,0xff,0xff,0xff)
798//  or rgb_t(0x00,0xff,0xff,0xff) for each
799//  pixel of a black & white font
800//-------------------------------------------------
801
802bool windows_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
803{
804   // create a dummy DC to work with
805   HDC dummyDC = CreateCompatibleDC(NULL);
806   HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast<HGDIOBJ>(font));
807
808   // get the text metrics
809   TEXTMETRIC metrics = { 0 };
810   GetTextMetrics(dummyDC, &metrics);
811
812   // get the width of this character
813   ABC abc;
814   if (!GetCharABCWidths(dummyDC, chnum, chnum, &abc))
815   {
816      abc.abcA = 0;
817      abc.abcC = 0;
818      GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast<LPINT>(&abc.abcB));
819   }
820   width = abc.abcA + abc.abcB + abc.abcC;
821
822   // determine desired bitmap size
823   int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31;
824   int bmheight = 50 + metrics.tmHeight + 50;
825
826   // describe the bitmap we want
827   BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)] = { 0 };
828   BITMAPINFO &info = *reinterpret_cast<BITMAPINFO *>(bitmapinfodata);
829   info.bmiHeader.biSize = sizeof(info.bmiHeader);
830   info.bmiHeader.biWidth = bmwidth;
831   info.bmiHeader.biHeight = -bmheight;
832   info.bmiHeader.biPlanes = 1;
833   info.bmiHeader.biBitCount = 1;
834   info.bmiHeader.biCompression = BI_RGB;
835   info.bmiHeader.biSizeImage = 0;
836   info.bmiHeader.biXPelsPerMeter = GetDeviceCaps(dummyDC, HORZRES) / GetDeviceCaps(dummyDC, HORZSIZE);
837   info.bmiHeader.biYPelsPerMeter = GetDeviceCaps(dummyDC, VERTRES) / GetDeviceCaps(dummyDC, VERTSIZE);
838   info.bmiHeader.biClrUsed = 0;
839   info.bmiHeader.biClrImportant = 0;
840   RGBQUAD col1 = info.bmiColors[0];
841   RGBQUAD col2 = info.bmiColors[1];
842   col1.rgbBlue = col1.rgbGreen = col1.rgbRed = 0x00;
843   col2.rgbBlue = col2.rgbGreen = col2.rgbRed = 0xff;
844
845   // create a DIB to render to
846   BYTE *bits;
847   HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
848   HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
849
850   // clear the bitmap
851   int rowbytes = bmwidth / 8;
852   memset(bits, 0, rowbytes * bmheight);
853
854   // now draw the character
855   WCHAR tempchar = chnum;
856   SetTextColor(dummyDC, RGB(0xff,0xff,0xff));
857   SetBkColor(dummyDC, RGB(0x00,0x00,0x00));
858   ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL);
859
860   // characters are expected to be full-height
861   rectangle actbounds;
862   actbounds.min_y = 50;
863   actbounds.max_y = 50 + metrics.tmHeight - 1;
864
865   // determine the actual left of the character
866   for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++)
867   {
868      BYTE *offs = bits + actbounds.min_x;
869      UINT8 summary = 0;
870      for (int y = 0; y < bmheight; y++)
871         summary |= offs[y * rowbytes];
872      if (summary != 0)
873      {
874         actbounds.min_x *= 8;
875         if (!(summary & 0x80)) actbounds.min_x++;
876         if (!(summary & 0xc0)) actbounds.min_x++;
877         if (!(summary & 0xe0)) actbounds.min_x++;
878         if (!(summary & 0xf0)) actbounds.min_x++;
879         if (!(summary & 0xf8)) actbounds.min_x++;
880         if (!(summary & 0xfc)) actbounds.min_x++;
881         if (!(summary & 0xfe)) actbounds.min_x++;
882         break;
883      }
884   }
885
886   // determine the actual right of the character
887   for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--)
888   {
889      BYTE *offs = bits + actbounds.max_x;
890      UINT8 summary = 0;
891      for (int y = 0; y < bmheight; y++)
892         summary |= offs[y * rowbytes];
893      if (summary != 0)
894      {
895         actbounds.max_x *= 8;
896         if (summary & 0x7f) actbounds.max_x++;
897         if (summary & 0x3f) actbounds.max_x++;
898         if (summary & 0x1f) actbounds.max_x++;
899         if (summary & 0x0f) actbounds.max_x++;
900         if (summary & 0x07) actbounds.max_x++;
901         if (summary & 0x03) actbounds.max_x++;
902         if (summary & 0x01) actbounds.max_x++;
903         break;
904      }
905   }
906
907   // allocate a new bitmap
908   if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y)
909   {
910      bitmap.allocate(actbounds.max_x + 1 - actbounds.min_x, actbounds.max_y + 1 - actbounds.min_y);
911
912      // copy the bits into it
913      for (int y = 0; y < bitmap.height(); y++)
914      {
915         UINT32 *dstrow = &bitmap.pix32(y);
916         UINT8 *srcrow = &bits[(y + actbounds.min_y) * rowbytes];
917         for (int x = 0; x < bitmap.width(); x++)
918         {
919            int effx = x + actbounds.min_x;
920            dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff);
921         }
922      }
923
924      // set the final offset values
925      xoffs = actbounds.min_x - (50 + abc.abcA);
926      yoffs = actbounds.max_y - (50 + metrics.tmAscent);
927   }
928
929   // de-select the font and release the DC
930   SelectObject(dummyDC, oldbitmap);
931   DeleteObject(dib);
932   SelectObject(dummyDC, oldfont);
933   DeleteDC(dummyDC);
934   return bitmap.valid();
935}
936
937
678938//============================================================
679939//  winmain_dump_stack
680940//============================================================
trunk/src/osd/windows/winmain.h
r243192r243193
252252   // input overridables
253253   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
254254
255   // font overridables
256   virtual osd_font *font_open(const char *name, int &height);
257   virtual void font_close(osd_font *font);
258   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
259
255260   virtual void video_register();
261   virtual void sound_register();
262   virtual void debugger_register();
256263
257264   virtual bool video_init();
258265   virtual bool window_init();
trunk/src/osd/windows/winmisc.c
r0r243193
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3//============================================================
4//
5//  winmisc.c - Win32 OSD core miscellaneous functions
6//
7//============================================================
8
9// standard windows headers
10#define WIN32_LEAN_AND_MEAN
11#include <windows.h>
12#include <tchar.h>
13
14// MAME headers
15#include "osdcore.h"
16
17// MAMEOS headers
18#include "winutf8.h"
19#include "strconv.h"
20#include "strconv.h"
21
22
23//============================================================
24//  GLOBAL VARIABLES
25//============================================================
26
27void (*s_debugger_stack_crawler)() = NULL;
28
29
30//============================================================
31//  osd_alloc_executable
32//============================================================
33
34void *osd_alloc_executable(size_t size)
35{
36   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
37}
38
39
40//============================================================
41//  osd_free_executable
42//============================================================
43
44void osd_free_executable(void *ptr, size_t size)
45{
46   VirtualFree(ptr, 0, MEM_RELEASE);
47}
48
49
50//============================================================
51//  osd_break_into_debugger
52//============================================================
53
54void osd_break_into_debugger(const char *message)
55{
56   if (IsDebuggerPresent())
57   {
58      win_output_debug_string_utf8(message);
59      DebugBreak();
60   }
61   else if (s_debugger_stack_crawler != NULL)
62      (*s_debugger_stack_crawler)();
63}
trunk/src/tools/chdman.c
r243192r243193
17021702            report_error(1, "Invalid size string");
17031703      }
17041704   }
1705
1705   
17061706   // process compression
17071707   chd_codec_type compression[4];
17081708   memcpy(compression, s_default_hd_compression, sizeof(compression));
r243192r243193
17571757      if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, &sectors, &sector_size) != 4)
17581758         report_error(1, "Error parsing hard disk metadata in parent CHD");
17591759   }
1760
1760     
17611761   // validate the size
17621762   if (filesize % sector_size != 0)
17631763      report_error(1, "Data size is not divisible by sector size %d", sector_size);
trunk/src/tools/nltool.c
r243192r243193
1818#include "netlist/nl_base.h"
1919#include "netlist/nl_setup.h"
2020#include "netlist/nl_parser.h"
21#include "netlist/nl_factory.h"
2221#include "netlist/nl_util.h"
23#include "netlist/devices/net_lib.h"
2422#include "options.h"
2523
2624/***************************************************************************
27 * MAME COMPATIBILITY ...
28 *
29 * These are needed if we link without libutil
30 ***************************************************************************/
25    MAME COMPATIBILITY ...
26***************************************************************************/
3127
3228#if 0
3329void ATTR_PRINTF(1,2) osd_printf_warning(const char *format, ...)
r243192r243193
3935   vprintf(format, argptr);
4036   va_end(argptr);
4137}
38#endif
4239
4340void *malloc_file_line(size_t size, const char *file, int line)
4441{
r243192r243193
7572         src_type.name(), dst_type.name());
7673   throw;
7774}
78#endif
7975
8076struct options_entry oplist[] =
8177{
r243192r243193
8783   { NULL }
8884};
8985
90NETLIST_START(dummy)
91   /* Standard stuff */
92
93   CLOCK(clk, 1000) // 1000 Hz
94   SOLVER(Solver, 48000)
95
96NETLIST_END()
97
9886/***************************************************************************
9987    CORE IMPLEMENTATION
10088***************************************************************************/
r243192r243193
172160      nl_util::pstring_list ll = nl_util::split(m_logs, ":");
173161      for (int i=0; i < ll.count(); i++)
174162      {
163         netlist_device_t *nc = m_setup->factory().new_device_by_classname("nld_log", *m_setup);
175164         pstring name = "log_" + ll[i];
176         /*netlist_device_t *nc = */ m_setup->register_dev("nld_log", name);
165         m_setup->register_dev(nc, name);
177166         m_setup->register_link(name + ".I", ll[i]);
178167      }
179168   }
r243192r243193
241230   nt.init();
242231   const netlist_factory_t::list_t &list = nt.setup().factory().list();
243232
244   netlist_sources_t sources;
245
246   sources.add(netlist_source_t("dummy", &netlist_dummy));
247   sources.parse(nt.setup(),"dummy");
248
249233   nt.setup().start_devices();
250234   nt.setup().resolve_inputs();
251235
trunk/src/version.c
r243192r243193
88
99***************************************************************************/
1010
11#define BARE_BUILD_VERSION "0.158"
11#define BARE_BUILD_VERSION "0.157"
1212
1313extern const char bare_build_version[];
1414extern const char build_version[];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team