Previous 199869 Revisions Next

r34692 Wednesday 28th January, 2015 at 10:39:40 UTC by Olivier Galibert
Merge branch 'kale' - c65 progress (nw)
[/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 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
r243203r243204
650650
651651   <software name="barbie">
652652      <description>Barbie Super Model (Prototype)</description>
653      <year>199?</year>
654      <publisher>&lt;unknown&gt;</publisher>
653      <year>1993</year>
654      <publisher>Hi Tech Expressions</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" />
r243203r243204
12961296
12971297   <software name="carlicen">
12981298      <description>Car Licence (Jpn)</description>
1299      <year>199?</year>
1300      <publisher>&lt;unknown&gt;</publisher>
1299      <year>1995</year>
1300      <publisher>Mitsubishi Chemical</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" />
r243203r243204
23582358      </part>
23592359   </software>
23602360
2361   <software name="ecco" supported="no">
2361   <software name="ecco">
23622362      <description>Ecco the Dolphin (Euro, USA)</description>
23632363      <year>1994</year>
23642364      <publisher>Sega</publisher>
r243203r243204
27052705
27062706   <software name="frogger">
27072707      <description>Frogger (USA, Prototype)</description>
2708      <year>199?</year>
2709      <publisher>&lt;unknown&gt;</publisher>
2708      <year>1991</year>
2709      <publisher>Sega</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" />
r243203r243204
34493449   <software name="jangpun2">
34503450      <description>Jang Pung II (Kor, SMS Mode)</description>
34513451      <year>1993</year>
3452      <publisher>&lt;unknown&gt;</publisher>
3452      <publisher>Sieco</publisher>
34533453      <part name="cart" interface="gamegear_cart">
34543454         <feature name="slot" value="codemasters" />
34553455         <feature name="pin_42" value="sms_mode" />
r243203r243204
46714671
46724672   <software name="mspacman">
46734673      <description>Ms. Pac-Man (USA)</description>
4674      <year>199?</year>
4675      <publisher>&lt;unknown&gt;</publisher>
4674      <year>1993</year> <!-- re-released in 2000 my Majesco -->
4675      <publisher>Namco</publisher>
46764676      <info name="serial" value="T-14048"/>
46774677      <part name="cart" interface="gamegear_cart">
46784678         <dataarea name="rom" size="131072">
r243203r243204
57775777
57785778   <software name="pacintim">
57795779      <description>Pac-In-Time (Prototype)</description>
5780      <year>199?</year>
5781      <publisher>&lt;unknown&gt;</publisher>
5780      <year>1994</year>
5781      <publisher>Namco</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" />
r243203r243204
77227722
77237723   <software name="spirou">
77247724      <description>Spirou (Euro, Prototype)</description>
7725      <year>199?</year>
7726      <publisher>&lt;unknown&gt;</publisher>
7725      <year>1996</year>
7726      <publisher>Infogrames</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" />
r243203r243204
98559855
98569856   <software name="yogibear">
98579857      <description>Yogi Bear in Yogi Bear's Goldrush (Prototype)</description>
9858      <year>199?</year>
9859      <publisher>&lt;unknown&gt;</publisher>
9858      <year>1994</year>
9859      <publisher>GameTek</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" />
r243203r243204
99729972
99739973   <software name="mgear">
99749974      <description>Master Gear Adapter</description>
9975      <year>198?</year>
9976      <publisher>&lt;unknown&gt;</publisher>
9975      <year>1991</year>
9976      <publisher>Sega</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
r243203r243204
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
r243203r243204
11<?xml version="1.0"?>
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33<softwarelist name="pasogo" description="Koei PasoGo cartridges">
4   <!-- KS-1010. Contians 8M SOP44 ROM, 62256 SOP32 RAM, Microchip 1081N (reset IC?watchdog?battery-power-switcher?) and 3V battery. -->
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. -->
515   <software name="dgoban">
616      <description>Denshi Goban</description>
717      <year>1996</year>
818      <publisher>Koei</publisher>
19      <info name="serial" value="KS-1009"/>
20      <info name="alt_title" value="電子碁盤"/>
921      <part name="cart" interface="pasogo_cart">
1022         <dataarea name="rom" width="16" endianness="little" size="1048576">
1123            <rom name="ks-1010.ic4" size="1048576" crc="b6a3f97c" sha1="2de63b05ec93a4ba3ea55ba131c0706927a5bf39" offset="00000000" />
r243203r243204
1325      </part>
1426   </software>
1527
16   <!-- KS-1004. Contains 4M SOP40 ROM only. -->
28
29   <!-- Contains 4M SOP40 ROM only. -->
1730   <software name="igmks1">
18      <description>Igo Meikyokushuu - Dai Ikkan</description>
31      <description>Igo Meikyokushuu - Dai-1-kan</description>
1932      <year>1996</year>
2033      <publisher>Koei</publisher>
34      <info name="serial" value="KS-1004"/>
35      <info name="alt_title" value="囲碁名局集 第1巻"/>
2136      <part name="cart" interface="pasogo_cart">
2237         <dataarea name="rom" width="16" endianness="little" size="524288">
2338            <rom name="yrm0442m-184s" size="524288" crc="32f9c38a" sha1="1be82afcdf5e2d1a0e873fda4161e663d7a53a85" offset="00000000" />
r243203r243204
2540      </part>
2641   </software>
2742
28   <!-- KS-1009. Contains 4M SOP40 ROM only. -->
43   <!-- Contains 4M SOP40 ROM only. -->
2944   <software name="tnt1">
30      <description>Tsuyoku Naru Tesuji - Dai Ikkan</description>
45      <description>Tsuyoku Naru Tesuji - Dai-1-kan</description>
3146      <year>1996</year>
3247      <publisher>Koei</publisher>
48      <info name="serial" value="KS-1010"/>
49      <info name="alt_title" value="強くなる手筋・第1巻"/>
3350      <part name="cart" interface="pasogo_cart">
3451         <dataarea name="rom" width="16" endianness="little" size="524288">
3552            <rom name="ks-1009.ic4" size="524288" crc="3e70fca6" sha1="c46cdc9e01f2f5c66b2523e1d30355e51c839f27" offset="00000000" />
trunk/makefile
r243203r243204
9898ifeq ($(firstword $(filter Haiku,$(UNAME))),Haiku)
9999TARGETOS = haiku
100100endif
101ifeq ($(firstword $(filter SunOS,$(UNAME))),SunOS)
102TARGETOS = solaris
103SDL_LIBVER = sdl
104endif
101105
102106ifndef TARGETOS
103107$(error Unable to detect TARGETOS from uname -a: $(UNAME))
r243203r243204
114118ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
115119PTR64 = 1
116120endif
121ifeq ($(TARGETOS), solaris)
122ifeq ($(firstword $(filter amd64,$(shell /usr/bin/isainfo -k))),amd64)
123PTR64 = 1
117124endif
125endif
126endif
118127
119128# Autodetect BIGENDIAN
120129# MacOSX
r243203r243204
598607# warnings only applicable to C++ compiles
599608CPPONLYFLAGS += \
600609   -Woverloaded-virtual
601   
602include $(SRC)/build/cc_detection.mak
603610
604611ifdef SANITIZE
605612CCOMFLAGS += -fsanitize=$(SANITIZE)
613
606614ifneq (,$(findstring thread,$(SANITIZE)))
607615CCOMFLAGS += -fPIE
608616endif
609ifneq (,$(findstring memory,$(SANITIZE)))
610ifneq (,$(findstring clang,$(CC)))
611CCOMFLAGS += -fsanitize-memory-track-origins -fPIE
612617endif
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
634618
619include $(SRC)/build/cc_detection.mak
620
635621#-------------------------------------------------
636622# include paths
637623#-------------------------------------------------
trunk/src/build/file2str.py
r243203r243204
22
33from __future__ import with_statement
44
5import string
65import sys
76import os
87
trunk/src/build/flags_clang.mak
r243203r243204
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
1224# TODO: needs to use $(CC)
1325TEST_CLANG := $(shell clang --version)
1426
r243203r243204
2941CCOMFLAGS += -Wno-unknown-warning-option
3042# 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
3143CCOMFLAGS += -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
3256endif
57endif
3358
3459ifeq ($(TARGETOS),emscripten)
3560CCOMFLAGS += -Qunused-arguments
trunk/src/build/png.py
r243203r243204
26602660
26612661    # Parse command line arguments
26622662    from optparse import OptionParser
2663    import re
26642663    version = '%prog ' + __version__
26652664    parser = OptionParser(version=version)
26662665    parser.set_usage("%prog [options] [imagefile]")
trunk/src/build/png2bdc.py
r243203r243204
121121        fp.write('o')
122122        fp.write('n')
123123        fp.write('t')
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]))
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))
136136       
137137        # Write a blank table at first (?)
138138        charTable = [0]*(numChars * CACHED_CHAR_SIZE)
139        fp.write(bytearray(charTable))
139        for i in range(numChars * CACHED_CHAR_SIZE):
140            fp.write(chr(charTable[i]))
140141       
141142        # Loop over all characters
142143        tableIndex = 0
r243203r243204
171172                    dBuffer.append(accum)
172173               
173174                # Write the data
174                fp.write(bytearray(dBuffer))
175                for j in range(len(dBuffer)):
176                    fp.write(chr(dBuffer[j]))
175177           
176178            destIndex = tableIndex * CACHED_CHAR_SIZE
177179            charTable[destIndex +  0] = i >> 8 & 0xff
r243203r243204
190192   
191193        # Seek back to the beginning and rewrite the table
192194        fp.seek(CACHED_HEADER_SIZE, 0)
193        fp.write(bytearray(charTable))
195        for i in range(numChars * CACHED_CHAR_SIZE):
196            fp.write(chr(charTable[i]))
194197   
195198        fp.close()
196199        return 0
trunk/src/emu/bus/a8sio/a8sio.c
r243203r243204
217217SLOT_INTERFACE_START(a8sio_cards)
218218   SLOT_INTERFACE("cassette", A8SIO_CASSETTE)
219219SLOT_INTERFACE_END
220
trunk/src/emu/bus/a8sio/cassette.c
r243203r243204
115115         break;
116116   }
117117}
118
trunk/src/emu/bus/bus.mak
r243203r243204
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#
10901115#@src/emu/bus/snes/snes_slot.h,BUSES += SNES
10911116#-------------------------------------------------
10921117
r243203r243204
12661291
12671292#-------------------------------------------------
12681293#
1269#@src/emu/bus/gamegear/gear2gear.h,BUSES += GAMEGEAR
1294#@src/emu/bus/gamegear/ggext.h,BUSES += GAMEGEAR
12701295#-------------------------------------------------
12711296
12721297ifneq ($(filter GAMEGEAR,$(BUSES)),)
12731298OBJDIRS += $(BUSOBJ)/gamegear
1274BUSOBJS += $(BUSOBJ)/gamegear/gear2gear.o
1299BUSOBJS += $(BUSOBJ)/gamegear/ggext.o
12751300BUSOBJS += $(BUSOBJ)/gamegear/smsctrladp.o
12761301endif
12771302
trunk/src/emu/bus/gamegear/gear2gear.c
r243203r243204
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
r243203r243204
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
r0r243204
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
r0r243204
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
r243203r243204
11/**********************************************************************
22
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
3    Sega Game Gear "SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243203r243204
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_gear2gear_port_interface(mconfig, *this),
32   device_gg_ext_port_interface(mconfig, *this),
3333   m_subctrl_port(*this, "ctrl")
3434{
3535}
trunk/src/emu/bus/gamegear/smsctrladp.h
r243203r243204
11/**********************************************************************
22
3    Sega Game Gear "Gear to Gear Port SMS Controller Adaptor" emulation
3    Sega Game Gear "SMS Controller Adaptor" emulation
44    Also known as "Master Link" cable.
55
66    Copyright MESS Team.
r243203r243204
1515
1616
1717#include "emu.h"
18#include "gear2gear.h"
18#include "ggext.h"
1919#include "../sms_ctrl/smsctrl.h"
2020
2121
r243203r243204
2727// ======================> sms_ctrl_adaptor_device
2828
2929class sms_ctrl_adaptor_device : public device_t,
30                     public device_gg_gear2gear_port_interface
30                     public device_gg_ext_port_interface
3131{
3232public:
3333   // construction/destruction
r243203r243204
4141   virtual void device_start();
4242   virtual machine_config_constructor device_mconfig_additions() const;
4343
44   // device_gg_gear2gear_port_interface overrides
44   // device_gg_ext_port_interface overrides
4545   virtual UINT8 peripheral_r();
4646   virtual void peripheral_w(UINT8 data);
4747
trunk/src/emu/bus/nes_ctrl/4score.c
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System Four Score Adapter
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8
9 TODO: current implementation is a HACK, due to limitations of the
10 slot system!
11 A real Four Score would be connected to both the controller ports of
12 the NES, but current core cannot emulate something like this until
13 devices can live their own life and being connected to other devices
14 at request.
15 In current implementation the device has to be mounted separately in
16 the two ports and each enables 2 inputs (this is more or less as hacky
17 as the non-slot previous one, where the 4 ports were always available
18 to the emulated system, but it's not a great consolation :( )
19 Two subdevices are currently used so to warn the user that the first
20 one gives P1+P3 inputs and the second one gives P2+P4 inputs.
21 For the same reason, we don't currently emulate the 2P/4P switch,
22 since we could at best have two switches to disable the second player
23 inputs.
24
25 Note: Two Pads are hardcoded in inputs below, instead of acting as
26 passthrough for 2 standard joypad devices, in order to show in the
27 internal UI that they belong to P1+P3 and P2+P4, otherwise they would
28 be listed as P1+P2 and P3+P4 respectively. This *HAS* to be changed
29 once the slot support in the code has improved (4 standard joypads
30 shall be attached to the unit!)
31
32**********************************************************************/
33
34#include "4score.h"
35
36//**************************************************************************
37//  DEVICE DEFINITIONS
38//**************************************************************************
39
40const device_type NES_4SCORE_P1P3 = &device_creator<nes_4score_p1p3_device>;
41const device_type NES_4SCORE_P2P4 = &device_creator<nes_4score_p2p4_device>;
42
43
44static INPUT_PORTS_START( nes_4score_p1p3 )
45   PORT_START("PAD1")
46   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(1)
47   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(1)
48   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)
49   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)
50   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
51   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
52   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
53   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
54
55   PORT_START("PAD3")
56   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(3)
57   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(3)
58   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(3)
59   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(3)
60   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
61   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
62   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
63   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
64INPUT_PORTS_END
65
66
67static INPUT_PORTS_START( nes_4score_p2p4 )
68   PORT_START("PAD2")
69   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(2)
70   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(2)
71   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(2)
72   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2)
73   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
74   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
75   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
76   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
77
78   PORT_START("PAD4")
79   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(4)
80   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(4)
81   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(4)
82   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(4)
83   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
84   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
85   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
86   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
87INPUT_PORTS_END
88
89
90//-------------------------------------------------
91//  input_ports - device-specific input ports
92//-------------------------------------------------
93
94ioport_constructor nes_4score_p1p3_device::device_input_ports() const
95{
96   return INPUT_PORTS_NAME( nes_4score_p1p3 );
97}
98
99ioport_constructor nes_4score_p2p4_device::device_input_ports() const
100{
101   return INPUT_PORTS_NAME( nes_4score_p2p4 );
102}
103
104
105
106//**************************************************************************
107//  LIVE DEVICE
108//**************************************************************************
109
110//-------------------------------------------------
111//  nes_4score_device - constructor
112//-------------------------------------------------
113
114nes_4score_device::nes_4score_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
115               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
116                  device_nes_control_port_interface(mconfig, *this)
117{
118}
119
120nes_4score_p1p3_device::nes_4score_p1p3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
121               nes_4score_device(mconfig, NES_4SCORE_P1P3, "Nintendo Four Score Adapter P1/P3", tag, owner, clock, "nes_4score_p1p3", __FILE__),
122               m_joypad1(*this, "PAD1"),
123               m_joypad3(*this, "PAD3")
124{
125}
126
127nes_4score_p2p4_device::nes_4score_p2p4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
128               nes_4score_device(mconfig, NES_4SCORE_P2P4, "Nintendo Four Score Adapter P2/P4", tag, owner, clock, "nes_4score_p2p4", __FILE__),
129               m_joypad2(*this, "PAD2"),
130               m_joypad4(*this, "PAD4")
131{
132}
133
134
135//-------------------------------------------------
136//  device_start
137//-------------------------------------------------
138
139void nes_4score_device::device_start()
140{
141   save_item(NAME(m_latch));
142}
143
144
145//-------------------------------------------------
146//  device_reset
147//-------------------------------------------------
148
149void nes_4score_device::device_reset()
150{
151   m_latch = 0;
152}
153
154
155//-------------------------------------------------
156//  read
157//-------------------------------------------------
158
159UINT8 nes_4score_device::read_bit0()
160{
161   UINT8 ret = m_latch & 1;
162   m_latch >>= 1;
163   return ret;
164}
165
166//-------------------------------------------------
167//  write
168//-------------------------------------------------
169
170void nes_4score_p1p3_device::write(UINT8 data)
171{
172   if (data & 0x01)
173      return;
174
175   // P3 & P4 inputs in NES Four Score are read serially with P1 & P2
176   m_latch  = m_joypad1->read();
177   m_latch |= (m_joypad3->read() << 8); // pad 3
178   m_latch |= (0x08 << 16); // signature
179}
180
181void nes_4score_p2p4_device::write(UINT8 data)
182{
183   if (data & 0x01)
184      return;
185
186   // P3 & P4 inputs in NES Four Score are read serially with P1 & P2
187   m_latch = m_joypad2->read();
188   m_latch |= (m_joypad4->read() << 8); // pad 4
189   m_latch |= (0x04 << 16); // signature
190}
trunk/src/emu/bus/nes_ctrl/4score.h
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System Four Score Adapter
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_FOURSCORE__
13#define __NES_FOURSCORE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_4score_device
24
25class nes_4score_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_4score_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
31
32protected:
33   // device-level overrides
34   virtual void device_start();
35   virtual void device_reset();
36
37   virtual UINT8 read_bit0();
38
39protected:
40   UINT32 m_latch;
41};
42
43// ======================> nes_4score_p1p3_device
44
45class nes_4score_p1p3_device : public nes_4score_device
46{
47public:
48   // construction/destruction
49   nes_4score_p1p3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
50
51   virtual ioport_constructor device_input_ports() const;
52
53protected:
54   virtual void write(UINT8 data);
55
56private:
57   required_ioport m_joypad1;
58   required_ioport m_joypad3;
59};
60
61// ======================> nes_4score_p2p4_device
62
63class nes_4score_p2p4_device : public nes_4score_device
64{
65public:
66   // construction/destruction
67   nes_4score_p2p4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
68
69   virtual ioport_constructor device_input_ports() const;
70
71protected:
72   virtual void write(UINT8 data);
73
74private:
75   required_ioport m_joypad2;
76   required_ioport m_joypad4;
77};
78
79
80// device type definition
81extern const device_type NES_4SCORE_P1P3;
82extern const device_type NES_4SCORE_P2P4;
83
84
85#endif
trunk/src/emu/bus/nes_ctrl/arkpaddle.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System -
4    Arkanoid Paddle input device
5
6    Copyright MESS Team.
7    Visit http://mamedev.org for licensing and usage restrictions.
8
9**********************************************************************/
10
11#include "arkpaddle.h"
12
13//**************************************************************************
14//  DEVICE DEFINITIONS
15//**************************************************************************
16
17const device_type NES_ARKPADDLE = &device_creator<nes_vaus_device>;
18const device_type NES_ARKPADDLE_FC = &device_creator<nes_vausfc_device>;
19
20
21static INPUT_PORTS_START( arkanoid_paddle )
22   PORT_START("PADDLE")
23   PORT_BIT( 0xff, 0x7f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x62,0xf2)
24   PORT_START("BUTTON")
25   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle button")
26INPUT_PORTS_END
27
28
29//-------------------------------------------------
30//  input_ports - device-specific input ports
31//-------------------------------------------------
32
33ioport_constructor nes_vaus_device::device_input_ports() const
34{
35   return INPUT_PORTS_NAME( arkanoid_paddle );
36}
37
38
39
40//**************************************************************************
41//  LIVE DEVICE
42//**************************************************************************
43
44//-------------------------------------------------
45//  nes_vaus_device - constructor
46//-------------------------------------------------
47
48nes_vaus_device::nes_vaus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
49               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
50                  device_nes_control_port_interface(mconfig, *this),
51                  m_paddle(*this, "PADDLE"),
52                  m_button(*this, "BUTTON")
53{
54}
55
56nes_vaus_device::nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
57               device_t(mconfig, NES_ARKPADDLE, "NES Arkanoid Vaus Controller", tag, owner, clock, "nes_vaus", __FILE__),
58               device_nes_control_port_interface(mconfig, *this),
59               m_paddle(*this, "PADDLE"),
60               m_button(*this, "BUTTON")
61{
62}
63
64nes_vausfc_device::nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
65               nes_vaus_device(mconfig, NES_ARKPADDLE_FC, "FC Arkanoid Vaus Controller", tag, owner, clock, "nes_vausfc", __FILE__)
66{
67}
68
69
70//-------------------------------------------------
71//  device_start
72//-------------------------------------------------
73
74void nes_vaus_device::device_start()
75{
76   save_item(NAME(m_latch));
77   save_item(NAME(m_start_conv));
78}
79
80
81//-------------------------------------------------
82//  device_reset
83//-------------------------------------------------
84
85void nes_vaus_device::device_reset()
86{
87   m_latch = 0;
88   m_start_conv = 0;
89}
90
91
92//-------------------------------------------------
93//  read
94//-------------------------------------------------
95
96UINT8 nes_vaus_device::read_bit34()
97{
98   UINT8 ret = (m_button->read() << 3);
99   ret |= (m_latch & 0x80) >> 3;
100   m_latch <<= 1;
101   m_latch &= 0xff;
102   return ret;
103}
104
105UINT8 nes_vausfc_device::read_exp(offs_t offset)
106{
107   UINT8 ret = 0;
108   if (offset == 0)    //$4016
109      ret = m_button->read() << 1;
110   else    //$4017
111   {
112      ret = (m_latch & 0x80) >> 6;
113      m_latch <<= 1;
114      m_latch &= 0xff;
115   }
116   return ret;
117}
118
119//-------------------------------------------------
120//  write
121//-------------------------------------------------
122
123void nes_vaus_device::write(UINT8 data)
124{
125   int old = m_start_conv;
126
127   if (data == 0 && old == 1)
128      m_latch = (UINT8) (m_paddle->read() ^ 0xff);
129
130   m_start_conv = data;
131}
trunk/src/emu/bus/nes_ctrl/arkpaddle.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System -
4    Arkanoid Paddle input device
5
6    Copyright MESS Team.
7    Visit http://mamedev.org for licensing and usage restrictions.
8
9**********************************************************************/
10
11#pragma once
12
13#ifndef __NES_ARKPADDLE__
14#define __NES_ARKPADDLE__
15
16
17#include "emu.h"
18#include "ctrl.h"
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> nes_vaus_device
25
26class nes_vaus_device : public device_t,
27                     public device_nes_control_port_interface
28{
29public:
30   // construction/destruction
31   nes_vaus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
32   nes_vaus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual ioport_constructor device_input_ports() const;
36
37protected:
38   // device-level overrides
39   virtual void device_start();
40   virtual void device_reset();
41
42   virtual UINT8 read_bit34();
43   virtual void write(UINT8 data);
44
45   required_ioport m_paddle;
46   required_ioport m_button;
47   UINT8 m_start_conv;
48   UINT32 m_latch;
49};
50
51
52// ======================> nes_vaus_device
53
54class nes_vausfc_device : public nes_vaus_device
55{
56public:
57   // construction/destruction
58   nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59
60protected:
61   virtual UINT8 read_bit34() { return 0; }
62   virtual UINT8 read_exp(offs_t offset);
63};
64
65
66// device type definition
67extern const device_type NES_ARKPADDLE;
68extern const device_type NES_ARKPADDLE_FC;
69
70
71#endif
trunk/src/emu/bus/nes_ctrl/bcbattle.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer - Epoch Barcode Battler
4
5    TODO: this should be actually emulated as a standalone system with
6    a few 7segments LEDs, once we get a dump of its BIOS
7    At the moment we only emulated the connection with a Famicom
8
9    Copyright MESS Team.
10    Visit http://mamedev.org for licensing and usage restrictions.
11
12**********************************************************************/
13
14#include "bcbattle.h"
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type NES_BARCODE_BATTLER = &device_creator<nes_bcbattle_device>;
21
22
23static INPUT_PORTS_START( nes_battler )
24INPUT_PORTS_END
25
26//-------------------------------------------------
27//  input_ports - device-specific input ports
28//-------------------------------------------------
29
30ioport_constructor nes_bcbattle_device::device_input_ports() const
31{
32   return INPUT_PORTS_NAME( nes_battler );
33}
34
35MACHINE_CONFIG_FRAGMENT( nes_battler )
36   MCFG_BARCODE_READER_ADD("battler")
37MACHINE_CONFIG_END
38
39machine_config_constructor nes_bcbattle_device::device_mconfig_additions() const
40{
41   return MACHINE_CONFIG_NAME( nes_battler );
42}
43
44
45//-------------------------------------------------
46//  device_timer - handler timer events
47//-------------------------------------------------
48
49void nes_bcbattle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
50{
51   if (id == TIMER_BATTLER)
52   {
53      int old = m_new_code;
54      // has something new been scanned?
55      if (old < m_reader->get_pending_code())
56      {
57         if (m_reader->get_byte_length() == 13)
58         {
59            for (int i = 0; i < 13; i++)
60               m_current_barcode[i] = m_reader->read_code() + '0';
61         }
62         else if (m_reader->get_byte_length() == 8)
63         {
64            for (int i = 0; i < 5; i++)
65               m_current_barcode[i] = 0x20;
66            for (int i = 5; i < 13; i++)
67               m_current_barcode[i] = m_reader->read_code() + '0';
68         }
69         // read one more, to reset the internal byte counter
70         m_reader->read_code();
71
72         // the string "SUNSOFT" is accepted as well by Barcode World
73         m_current_barcode[13] = 'E';
74         m_current_barcode[14] = 'P';
75         m_current_barcode[15] = 'O';
76         m_current_barcode[16] = 'C';
77         m_current_barcode[17] = 'H';
78         m_current_barcode[18] = 0x0d;
79         m_current_barcode[19] = 0x0a;
80         m_pending_code = 1;
81      }
82      m_new_code = m_reader->get_pending_code();
83   }
84}
85
86//**************************************************************************
87//  LIVE DEVICE
88//**************************************************************************
89
90//-------------------------------------------------
91//  nes_bcbattle_device - constructor
92//-------------------------------------------------
93
94nes_bcbattle_device::nes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
95               device_t(mconfig, NES_BARCODE_BATTLER, "Epoch Barcode Battler", tag, owner, clock, "nes_bcbattle", __FILE__),
96               device_nes_control_port_interface(mconfig, *this),
97               m_reader(*this, "battler")
98{
99}
100
101
102//-------------------------------------------------
103//  device_start
104//-------------------------------------------------
105
106void nes_bcbattle_device::device_start()
107{
108   // lacking emulation of the standalone Barcode Battler, we refresh periodically the input from the reader
109   // proper emulation would have the standalone unit acknowledging that a new barcode has been scanned
110   // and sending the proper serial bits, instead of our read_current_bit() function!
111   battler_timer = timer_alloc(TIMER_BATTLER);
112   battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000));
113
114   save_item(NAME(m_current_barcode));
115   save_item(NAME(m_new_code));
116   save_item(NAME(m_pending_code));
117   save_item(NAME(m_transmitting));
118   save_item(NAME(m_cur_bit));
119   save_item(NAME(m_cur_byte));
120}
121
122
123//-------------------------------------------------
124//  device_reset
125//-------------------------------------------------
126
127void nes_bcbattle_device::device_reset()
128{
129   m_pending_code = 0;
130   m_new_code = 0;
131   m_transmitting = 0;
132   m_cur_bit = 0;
133   m_cur_byte = 0;
134   memset(m_current_barcode, 0, ARRAY_LENGTH(m_current_barcode));
135}
136
137
138//-------------------------------------------------
139//  read
140//-------------------------------------------------
141
142int nes_bcbattle_device::read_current_bit()
143{
144   if (m_pending_code && !m_transmitting)
145   {
146      // we start with 1
147      m_transmitting = 1;
148      m_cur_byte = 0;
149      m_cur_bit = 0;
150      return 1;
151   }
152
153   if (m_transmitting)
154   {
155      if (m_cur_bit == 0)
156      {
157         m_cur_bit++;
158         return 1;
159      }
160      if (m_cur_bit < 9)
161      {
162         int bit = (BIT(m_current_barcode[m_cur_byte], m_cur_bit - 1)) ^ 1;
163         m_cur_bit++;
164         return bit;
165      }
166      if (m_cur_bit == 9)
167      {
168         m_cur_bit = 0;
169         //printf("%X ", m_current_barcode[m_cur_byte]);
170         m_cur_byte++;
171         if (m_cur_byte == 20)
172         {
173            m_cur_byte = 0;
174            m_transmitting = 0;
175            m_pending_code = 0;
176         }
177         return 0;
178      }
179   }
180
181   return 0;
182}
183
184UINT8 nes_bcbattle_device::read_exp(offs_t offset)
185{
186   UINT8 ret = 0;
187   if (offset == 1)    //$4017
188   {
189      ret |= read_current_bit() << 2;
190   }
191
192   return ret;
193}
trunk/src/emu/bus/nes_ctrl/bcbattle.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer - Epoch Barcode Battler
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_BCBATTLE__
13#define __NES_BCBATTLE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18#include "machine/bcreader.h"
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> nes_bcbattle_device
25
26class nes_bcbattle_device : public device_t,
27                     public device_nes_control_port_interface
28{
29public:
30   // construction/destruction
31   nes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   virtual ioport_constructor device_input_ports() const;
34   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
35   virtual machine_config_constructor device_mconfig_additions() const;
36
37protected:
38   // device-level overrides
39   virtual void device_start();
40   virtual void device_reset();
41
42   virtual UINT8 read_exp(offs_t offset);
43   int read_current_bit();
44
45   static const device_timer_id TIMER_BATTLER = 1;
46   required_device<barcode_reader_device> m_reader;
47   UINT8 m_current_barcode[20];
48   int m_pending_code, m_new_code, m_transmitting, m_cur_bit, m_cur_byte;
49   emu_timer *battler_timer;
50};
51
52// device type definition
53extern const device_type NES_BARCODE_BATTLER;
54
55#endif
trunk/src/emu/bus/nes_ctrl/ctrl.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System controller ports
4    and Family Computer expansion port emulation
5
6    Here we emulate in fact 3 different kind of ports, which are
7    connected to different bis of memory locations $4016 and $4017:
8    - NES controller ports: these are hooked to bit 0,3,4 of the
9      corresponding address ($4016 for port1, $4017 for port2)
10    - FC controller ports: these are only hooked to bit 0 of the
11      corresponding address (so that e.g. a NES Zapper could not
12      be connected to a later FC AV model, because its inputs
13      would not be detected)
14    - FC expansion port: this is hooked to bits 0-4 of both addresses
15    To make things a little bit more complex, old FC models have the
16    controller hardwired to the unit, and the P2 controllers are
17    directly hooked also to one of the expansion port lines (namely,
18    microphone inputs from P2 go to $4016 bit 2)
19
20    Even if the controller port and the expansion port are
21    physically different (the FC expansion is a 15pin port, while
22    the controller ports are 7pin), we emulate them as variants of a
23    common device, exposing the following handlers:
24    - read_bit0: for bit0 reads, which are typically used for serial
25      inputs from controllers
26    - read_bit34: for bit3,4 reading, expected to be at the correct
27      offset (but we don't currently check for read_bit34 & 0xf8==0)
28    - read_exp: for reads going through the expansion, with a offset
29      parameter to decide whether we are reading from $4016 and $4017
30    - write: to acknowledge writes to $4016
31
32    The driver emulation will take care to only call the correct
33    handlers they have hooks for: Basic usage is that the expansion
34    port calls read_exp, FC ctrl ports call read_bit0, and NES ctrl
35    ports call both read_bit0 and read_bit34. However, to cope with
36    the original FC microphone, we will have the second controller
37    port calling read_exp too.
38
39    Copyright MESS Team.
40    Visit http://mamedev.org for licensing and usage restrictions.
41
42**********************************************************************/
43
44#include "ctrl.h"
45// slot devices
46#include "4score.h"
47#include "arkpaddle.h"
48#include "bcbattle.h"
49#include "ftrainer.h"
50#include "fckeybrd.h"
51#include "hori.h"
52#include "joypad.h"
53#include "konamihs.h"
54#include "miracle.h"
55#include "mjpanel.h"
56#include "pachinko.h"
57#include "partytap.h"
58#include "powerpad.h"
59#include "suborkey.h"
60#include "zapper.h"
61
62
63//**************************************************************************
64//  GLOBAL VARIABLES
65//**************************************************************************
66
67const device_type NES_CONTROL_PORT = &device_creator<nes_control_port_device>;
68
69
70
71//**************************************************************************
72//  CARD INTERFACE
73//**************************************************************************
74
75//-------------------------------------------------
76//  device_nes_control_port_interface - constructor
77//-------------------------------------------------
78
79device_nes_control_port_interface::device_nes_control_port_interface(const machine_config &mconfig, device_t &device) :
80                           device_slot_card_interface(mconfig, device)
81{
82   m_port = dynamic_cast<nes_control_port_device *>(device.owner());
83}
84
85
86//-------------------------------------------------
87//  ~device_nes_control_port_interface - destructor
88//-------------------------------------------------
89
90device_nes_control_port_interface::~device_nes_control_port_interface()
91{
92}
93
94
95
96//**************************************************************************
97//  LIVE DEVICE
98//**************************************************************************
99
100//-------------------------------------------------
101//  nes_control_port_device - constructor
102//-------------------------------------------------
103
104nes_control_port_device::nes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
105                  device_t(mconfig, NES_CONTROL_PORT, "Nintendo NES/FC control port", tag, owner, clock, "nes_control_port", __FILE__),
106                  device_slot_interface(mconfig, *this)
107{
108}
109
110
111//-------------------------------------------------
112//  nes_control_port_device - destructor
113//-------------------------------------------------
114
115nes_control_port_device::~nes_control_port_device()
116{
117}
118
119
120//-------------------------------------------------
121//  device_start - device-specific startup
122//-------------------------------------------------
123
124void nes_control_port_device::device_start()
125{
126   m_device = dynamic_cast<device_nes_control_port_interface *>(get_card_device());
127   m_brightpixel_cb.bind_relative_to(*owner());
128}
129
130
131UINT8 nes_control_port_device::read_bit0()
132{
133   UINT8 data = 0;
134   if (m_device)
135      data = m_device->read_bit0();
136   return data;
137}
138
139UINT8 nes_control_port_device::read_bit34()
140{
141   UINT8 data = 0;
142   if (m_device)
143      data = m_device->read_bit34();
144   return data;
145}
146
147UINT8 nes_control_port_device::read_exp(offs_t offset)
148{
149   UINT8 data = 0;
150   if (m_device)
151      data = m_device->read_exp(offset);
152   return data;
153}
154
155void nes_control_port_device::write(UINT8 data)
156{
157   if (m_device)
158      m_device->write(data);
159}
160
161
162
163//-------------------------------------------------
164//  SLOT_INTERFACE( nes_control_port_devices )
165//-------------------------------------------------
166
167SLOT_INTERFACE_START( nes_control_port1_devices )
168   SLOT_INTERFACE("joypad", NES_JOYPAD)
169   SLOT_INTERFACE("zapper", NES_ZAPPER)
170   SLOT_INTERFACE("4score_p1p3", NES_4SCORE_P1P3)
171//  SLOT_INTERFACE("miracle_piano", NES_MIRACLE)
172SLOT_INTERFACE_END
173
174SLOT_INTERFACE_START( nes_control_port2_devices )
175   SLOT_INTERFACE("joypad", NES_JOYPAD)
176   SLOT_INTERFACE("zapper", NES_ZAPPER)
177   SLOT_INTERFACE("vaus", NES_ARKPADDLE)
178   SLOT_INTERFACE("powerpad", NES_POWERPAD)
179   SLOT_INTERFACE("4score_p2p4", NES_4SCORE_P2P4)
180SLOT_INTERFACE_END
181
182SLOT_INTERFACE_START( fc_control_port1_devices )
183   SLOT_INTERFACE("joypad", NES_JOYPAD)
184   SLOT_INTERFACE("ccpad_left", NES_CCPAD_LEFT)
185SLOT_INTERFACE_END
186
187SLOT_INTERFACE_START( fc_control_port2_devices )
188   SLOT_INTERFACE("joypad", NES_JOYPAD)
189   SLOT_INTERFACE("joypad_old", NES_FCPAD_P2)
190   SLOT_INTERFACE("ccpad_right", NES_CCPAD_RIGHT)
191SLOT_INTERFACE_END
192
193SLOT_INTERFACE_START( fc_expansion_devices )
194   SLOT_INTERFACE("joypad", NES_JOYPAD)
195   SLOT_INTERFACE("arcstick", NES_ARCSTICK)
196   SLOT_INTERFACE("fc_keyboard", NES_FCKEYBOARD)
197   SLOT_INTERFACE("zapper", NES_ZAPPER)
198   SLOT_INTERFACE("vaus", NES_ARKPADDLE_FC)
199   SLOT_INTERFACE("family_trainer", NES_FTRAINER)
200   SLOT_INTERFACE("konamihs", NES_KONAMIHS)
201   SLOT_INTERFACE("mj_panel", NES_MJPANEL)
202   SLOT_INTERFACE("pachinko", NES_PACHINKO)
203   SLOT_INTERFACE("partytap", NES_PARTYTAP)
204   SLOT_INTERFACE("hori_twin", NES_HORITWIN)
205   SLOT_INTERFACE("hori_4p", NES_HORI4P)
206   SLOT_INTERFACE("barcode_battler", NES_BARCODE_BATTLER)
207   SLOT_INTERFACE("subor_keyboard", NES_SUBORKEYBOARD)
208SLOT_INTERFACE_END
trunk/src/emu/bus/nes_ctrl/ctrl.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System controller port
4    emulation
5
6    Copyright MESS Team.
7    Visit http://mamedev.org for licensing and usage restrictions.
8
9**********************************************************************
10
11
12**********************************************************************/
13
14#pragma once
15
16#ifndef __NES_CONTROL_PORT__
17#define __NES_CONTROL_PORT__
18
19#include "emu.h"
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25class nes_control_port_device;
26
27// ======================> device_nes_control_port_interface
28
29class device_nes_control_port_interface : public device_slot_card_interface
30{
31public:
32   // construction/destruction
33   device_nes_control_port_interface(const machine_config &mconfig, device_t &device);
34   virtual ~device_nes_control_port_interface();
35
36   virtual UINT8 read_bit0() { return 0; };
37   virtual UINT8 read_bit34() { return 0; };
38   virtual UINT8 read_exp(offs_t offset) { return 0; };
39   virtual void write(UINT8 data) { };
40
41protected:
42   nes_control_port_device *m_port;
43};
44
45
46typedef device_delegate<bool (int x, int y)> nesctrl_brightpixel_delegate;
47#define NESCTRL_BRIGHTPIXEL_CB(name)  bool name(int x, int y)
48
49
50// ======================> nes_control_port_device
51
52class nes_control_port_device : public device_t,
53                        public device_slot_interface
54{
55public:
56   // construction/destruction
57   nes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
58   virtual ~nes_control_port_device();
59
60   static void set_brightpixel_callback(device_t &device, nesctrl_brightpixel_delegate callback) { downcast<nes_control_port_device &>(device).m_brightpixel_cb = callback; }
61
62   UINT8 read_bit0();
63   UINT8 read_bit34();
64   UINT8 read_exp(offs_t offset);
65   void write(UINT8 data);
66
67   nesctrl_brightpixel_delegate m_brightpixel_cb;
68
69protected:
70   // device-level overrides
71   virtual void device_start();
72   device_nes_control_port_interface *m_device;
73};
74
75
76// device type definition
77extern const device_type NES_CONTROL_PORT;
78
79
80//**************************************************************************
81//  INTERFACE CONFIGURATION MACROS
82//**************************************************************************
83
84#define MCFG_NES_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
85   MCFG_DEVICE_ADD(_tag, NES_CONTROL_PORT, 0) \
86   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
87
88// currently this is emulated as a control port...
89#define MCFG_FC_EXPANSION_PORT_ADD(_tag, _slot_intf, _def_slot) \
90   MCFG_DEVICE_ADD(_tag, NES_CONTROL_PORT, 0) \
91   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
92
93#define MCFG_NESCTRL_BRIGHTPIXEL_CB(_class, _method) \
94   nes_control_port_device::set_brightpixel_callback(*device, nesctrl_brightpixel_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
95
96
97SLOT_INTERFACE_EXTERN( nes_control_port1_devices );
98SLOT_INTERFACE_EXTERN( nes_control_port2_devices );
99SLOT_INTERFACE_EXTERN( fc_control_port1_devices );
100SLOT_INTERFACE_EXTERN( fc_control_port2_devices );
101SLOT_INTERFACE_EXTERN( fc_expansion_devices );
102
103
104#endif
trunk/src/emu/bus/nes_ctrl/fckeybrd.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Keyboard Component
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "fckeybrd.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_FCKEYBOARD = &device_creator<nes_fckeybrd_device>;
17
18
19static INPUT_PORTS_START( fc_keyboard )
20   PORT_START("FCKEY.0")
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
23   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR('[')
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']')
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana")
26   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)
27   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)    PORT_CHAR('\\')
28   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_BACKSPACE)
29
30   PORT_START("FCKEY.1")
31   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
32   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@')
33   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
34   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_')
36   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('/')
37   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
38   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('^')
39
40   PORT_START("FCKEY.2")
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
42   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
43   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
44   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
45   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.')
46   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
47   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
48   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
49
50   PORT_START("FCKEY.3")
51   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
52   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
53   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
54   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
55   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
56   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
57   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
58   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
59
60   PORT_START("FCKEY.4")
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
62   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
63   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
64   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
65   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
66   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
67   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')
68   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
69
70   PORT_START("FCKEY.5")
71   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
72   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
73   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
74   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
75   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
76   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
77   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')
78   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')
79
80   PORT_START("FCKEY.6")
81   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
82   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
83   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
84   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
85   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
86   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
87   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
88   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
89
90   PORT_START("FCKEY.7")
91   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
92   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC))
93   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
94   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)        PORT_CHAR(UCHAR_SHIFT_1)
96   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT)
97   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')
99
100   PORT_START("FCKEY.8")
101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Clr")
102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP)    PORT_CHAR(UCHAR_MAMEKEY(UP))
103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)     PORT_CHAR(' ')
107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL)
108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)
109INPUT_PORTS_END
110
111
112//-------------------------------------------------
113//  input_ports - device-specific input ports
114//-------------------------------------------------
115
116ioport_constructor nes_fckeybrd_device::device_input_ports() const
117{
118   return INPUT_PORTS_NAME( fc_keyboard );
119}
120
121
122static MACHINE_CONFIG_FRAGMENT( fc_keyboard )
123   MCFG_CASSETTE_ADD("tape")
124   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
125   MCFG_CASSETTE_INTERFACE("fc_cass")
126MACHINE_CONFIG_END
127
128
129//-------------------------------------------------
130//  machine_config_additions - device-specific
131//  machine configurations
132//-------------------------------------------------
133
134machine_config_constructor nes_fckeybrd_device::device_mconfig_additions() const
135{
136   return MACHINE_CONFIG_NAME( fc_keyboard );
137}
138
139
140//**************************************************************************
141//  LIVE DEVICE
142//**************************************************************************
143
144//-------------------------------------------------
145//  nes_fckeybrd_device - constructor
146//-------------------------------------------------
147
148nes_fckeybrd_device::nes_fckeybrd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
149               device_t(mconfig, NES_FCKEYBOARD, "Nintendo Family Computer Keyboard Component", tag, owner, clock, "nes_fckeybrd", __FILE__),
150               device_nes_control_port_interface(mconfig, *this),
151               m_cassette(*this, "tape"),
152               m_kbd(*this, "FCKEY")
153{
154}
155
156
157//-------------------------------------------------
158//  device_start
159//-------------------------------------------------
160
161void nes_fckeybrd_device::device_start()
162{
163   save_item(NAME(m_fck_scan));
164   save_item(NAME(m_fck_mode));
165}
166
167
168//-------------------------------------------------
169//  device_reset
170//-------------------------------------------------
171
172void nes_fckeybrd_device::device_reset()
173{
174   m_fck_scan = 0;
175   m_fck_mode = 0;
176}
177
178
179//-------------------------------------------------
180//  read
181//-------------------------------------------------
182
183UINT8 nes_fckeybrd_device::read_exp(offs_t offset)
184{
185   UINT8 ret = 0;
186   if (offset == 0)    //$4016
187   {
188      // FC Keyboard: tape input
189      if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY)
190      {
191         double level = m_cassette->input();
192         if (level < 0)
193            ret |= 0x00;
194         else
195            ret |= 0x02;
196      }
197   }
198   else    //$4017
199   {
200      // FC Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
201      if (m_fck_scan < 9)
202         ret |= ~(((m_kbd[m_fck_scan]->read() >> (m_fck_mode * 4)) & 0x0f) << 1) & 0x1e;
203      else
204         ret |= 0x1e;
205   }
206
207   return ret;
208}
209
210//-------------------------------------------------
211//  write
212//-------------------------------------------------
213
214void nes_fckeybrd_device::write(UINT8 data)
215{
216   // tape output (not fully tested)
217   if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_RECORD)
218      m_cassette->output(((data & 0x07) == 0x07) ? +1.0 : -1.0);
219
220   if (BIT(data, 2))   // keyboard active
221   {
222      UINT8 out = BIT(data, 1);   // scan
223
224      if (m_fck_mode && !out && ++m_fck_scan > 9)
225         m_fck_scan = 0;
226
227      m_fck_mode = out;   // access lower or upper 4 bits
228
229      if (BIT(data, 0))   // reset
230         m_fck_scan = 0;
231   }
232}
trunk/src/emu/bus/nes_ctrl/fckeybrd.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Keyboard Component
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_FCKEYBRD__
13#define __NES_FCKEYBRD__
14
15
16#include "emu.h"
17#include "ctrl.h"
18#include "imagedev/cassette.h"
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> nes_fckeybrd_device
25
26class nes_fckeybrd_device : public device_t,
27                     public device_nes_control_port_interface
28{
29public:
30   // construction/destruction
31   nes_fckeybrd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   virtual ioport_constructor device_input_ports() const;
34   virtual machine_config_constructor device_mconfig_additions() const;
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39   virtual void device_reset();
40
41   virtual UINT8 read_exp(offs_t offset);
42   virtual void write(UINT8 data);
43
44private:
45   required_device<cassette_image_device> m_cassette;
46   required_ioport_array<9> m_kbd;
47   UINT8 m_fck_scan, m_fck_mode;
48};
49
50
51// device type definition
52extern const device_type NES_FCKEYBOARD;
53
54
55#endif
trunk/src/emu/bus/nes_ctrl/ftrainer.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer - Bandai Family Trainer Mat
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "ftrainer.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_FTRAINER = &device_creator<nes_ftrainer_device>;
17
18
19static INPUT_PORTS_START( nes_joypad )
20   PORT_START("LAYOUT")
21   PORT_CONFNAME( 0x01, 0x00, "Family Trainer Button Layout")
22   PORT_CONFSETTING(  0x00, "Side A" )
23   PORT_CONFSETTING(  0x01, "Side B" )
24
25   // difference between the two sides is that we mirror the key mapping to match the real pad layout!
26   PORT_START("FT_COL.0")
27   // side A layout
28   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
29   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid1")  PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
30   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
31   // side B layout
32   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 12")    PORT_CODE(KEYCODE_M) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
33   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 8")     PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
34   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 4")     PORT_CODE(KEYCODE_U) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
35
36   PORT_START("FT_COL.1")
37   // side A layout
38   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Low1")  PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
39   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid2")  PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
40   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Top1")  PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
41   // side B layout
42   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 11")    PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
43   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 7")     PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
44   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 3")     PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
45
46   PORT_START("FT_COL.2")
47   // side A layout
48   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Low2")  PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
49   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid3")  PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
50   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Top2")  PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
51   // side B layout
52   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 10")    PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
53   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 6")     PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
54   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 2")     PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
55
56   PORT_START("FT_COL.3")
57   // side A layout
58   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
59   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer Mid4")  PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
60   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                        PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
61   // side B layout
62   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 9")     PORT_CODE(KEYCODE_V) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
63   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 5")     PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
64   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Family Trainer 1")     PORT_CODE(KEYCODE_R) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
65INPUT_PORTS_END
66
67
68//-------------------------------------------------
69//  input_ports - device-specific input ports
70//-------------------------------------------------
71
72ioport_constructor nes_ftrainer_device::device_input_ports() const
73{
74   return INPUT_PORTS_NAME( nes_joypad );
75}
76
77
78
79//**************************************************************************
80//  LIVE DEVICE
81//**************************************************************************
82
83//-------------------------------------------------
84//  nes_ftrainer_device - constructor
85//-------------------------------------------------
86
87nes_ftrainer_device::nes_ftrainer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
88               device_t(mconfig, NES_FTRAINER, "Bandai Family Trainer", tag, owner, clock, "nes_famtrain", __FILE__),
89               device_nes_control_port_interface(mconfig, *this),
90               m_trainer(*this, "FT_COL")
91{
92}
93
94
95//-------------------------------------------------
96//  device_start
97//-------------------------------------------------
98
99void nes_ftrainer_device::device_start()
100{
101   save_item(NAME(m_row_scan));
102}
103
104
105//-------------------------------------------------
106//  device_reset
107//-------------------------------------------------
108
109void nes_ftrainer_device::device_reset()
110{
111   m_row_scan = 0;
112}
113
114
115//-------------------------------------------------
116//  read
117//-------------------------------------------------
118
119UINT8 nes_ftrainer_device::read_exp(offs_t offset)
120{
121   UINT8 ret = 0;
122   if (offset == 1)    //$4017
123   {
124      if (!BIT(m_row_scan, 0))
125      {
126         // read low line: buttons 9,10,11,12
127         for (int i = 0; i < 4; i++)
128            ret |= ((m_trainer[i]->read() & 0x01) << (1 + i));
129      }
130      else if (!BIT(m_row_scan, 1))
131      {
132         // read mid line: buttons 5,6,7,8
133         for (int i = 0; i < 4; i++)
134            ret |= ((m_trainer[i]->read() & 0x02) << (1 + i));
135      }
136      else if (!BIT(m_row_scan, 2))
137      {
138         // read high line: buttons 1,2,3,4
139         for (int i = 0; i < 4; i++)
140            ret |= ((m_trainer[i]->read() & 0x04) << (1 + i));
141      }
142   }
143   return ret;
144}
145
146//-------------------------------------------------
147//  write
148//-------------------------------------------------
149
150void nes_ftrainer_device::write(UINT8 data)
151{
152   // select row to scan
153   m_row_scan = data & 0x07;
154}
trunk/src/emu/bus/nes_ctrl/ftrainer.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer - Bandai Family Trainer Mat
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_FTRAINER__
13#define __NES_FTRAINER__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_ftrainer_device
24
25class nes_ftrainer_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_ftrainer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42private:
43   required_ioport_array<4> m_trainer;
44   UINT8 m_row_scan;
45};
46
47
48// device type definition
49extern const device_type NES_FTRAINER;
50
51
52#endif
trunk/src/emu/bus/nes_ctrl/hori.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Hori Twin (and 4P?) adapters
4
5    Emulation of the 4Players adapter is quite pointless: if 2P mode
6    (default mode) it behaves like a Hori Twin adapter, in 4P mode
7    it has P1 and P2 inputs overwriting the inputs coming from the
8    main controllers (possibly creating a bit of confusion, since
9    you get 6 sets of inputs with only 4 acknowledged by the running
10    system).
11    For the moment we keep it available for documentation purposes.
12
13    TODO: find out confirmation whether in 2P mode, inputs from joypads
14    connected to the 4players adapter are really seen as P3 and P4 inputs.
15    it seems the most reasonable setup (so that users with only 2
16    external pads can use the adapter in 4P games), but one never knows...
17
18    Copyright MESS Team.
19    Visit http://mamedev.org for licensing and usage restrictions.
20
21**********************************************************************/
22
23#include "hori.h"
24#include "joypad.h"
25
26//**************************************************************************
27//  DEVICE DEFINITIONS
28//**************************************************************************
29
30const device_type NES_HORITWIN = &device_creator<nes_horitwin_device>;
31const device_type NES_HORI4P = &device_creator<nes_hori4p_device>;
32
33
34static INPUT_PORTS_START( nes_hori4p )
35   PORT_START("CONFIG")
36   PORT_CONFNAME( 0x01, 0x00, "4 Players / 2 Players")
37   PORT_CONFSETTING(  0x00, "2 Players" )
38   PORT_CONFSETTING(  0x01, "4 Players" )
39INPUT_PORTS_END
40
41
42//-------------------------------------------------
43//  input_ports - device-specific input ports
44//-------------------------------------------------
45
46ioport_constructor nes_hori4p_device::device_input_ports() const
47{
48   return INPUT_PORTS_NAME( nes_hori4p );
49}
50
51
52static SLOT_INTERFACE_START( hori_adapter )
53   SLOT_INTERFACE("joypad", NES_JOYPAD)
54SLOT_INTERFACE_END
55
56static MACHINE_CONFIG_FRAGMENT( horitwin )
57   MCFG_FC_EXPANSION_PORT_ADD("port1", hori_adapter, "joypad")
58   MCFG_FC_EXPANSION_PORT_ADD("port2", hori_adapter, "joypad")
59MACHINE_CONFIG_END
60
61static MACHINE_CONFIG_FRAGMENT( hori4p )
62   MCFG_FC_EXPANSION_PORT_ADD("port1", hori_adapter, "joypad")
63   MCFG_FC_EXPANSION_PORT_ADD("port2", hori_adapter, "joypad")
64   MCFG_FC_EXPANSION_PORT_ADD("port3", hori_adapter, "joypad")
65   MCFG_FC_EXPANSION_PORT_ADD("port4", hori_adapter, "joypad")
66MACHINE_CONFIG_END
67
68
69//-------------------------------------------------
70//  machine_config_additions - device-specific
71//  machine configurations
72//-------------------------------------------------
73
74machine_config_constructor nes_horitwin_device::device_mconfig_additions() const
75{
76   return MACHINE_CONFIG_NAME( horitwin );
77}
78
79machine_config_constructor nes_hori4p_device::device_mconfig_additions() const
80{
81   return MACHINE_CONFIG_NAME( hori4p );
82}
83
84
85//**************************************************************************
86//  LIVE DEVICE
87//**************************************************************************
88
89//-------------------------------------------------
90//  nes_horitwin_device - constructor
91//-------------------------------------------------
92
93nes_horitwin_device::nes_horitwin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
94               device_t(mconfig, NES_HORITWIN, "Hori Twin Adapter", tag, owner, clock, "nes_horitwin", __FILE__),
95               device_nes_control_port_interface(mconfig, *this),
96               m_port1(*this, "port1"),
97               m_port2(*this, "port2")
98{
99}
100
101nes_hori4p_device::nes_hori4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
102               device_t(mconfig, NES_HORI4P, "Hori 4P Adapter", tag, owner, clock, "nes_hori4p", __FILE__),
103               device_nes_control_port_interface(mconfig, *this),
104               m_port1(*this, "port1"),
105               m_port2(*this, "port2"),
106               m_port3(*this, "port3"),
107               m_port4(*this, "port4"),
108               m_cfg(*this, "CONFIG")
109{
110}
111
112
113//-------------------------------------------------
114//  read
115//-------------------------------------------------
116
117UINT8 nes_horitwin_device::read_exp(offs_t offset)
118{
119   UINT8 ret = 0;
120   if (offset == 0)    //$4016
121      ret |= (m_port1->read_bit0() << 1);
122   else    //$4017
123      ret |= (m_port2->read_bit0() << 1);
124   return ret;
125}
126
127UINT8 nes_hori4p_device::read_exp(offs_t offset)
128{
129   UINT8 ret = 0;
130   if (m_cfg->read() == 0) // 2P
131   {
132      if (offset == 0)    //$4016
133         ret |= (m_port1->read_bit0() << 1);
134      else    //$4017
135         ret |= (m_port2->read_bit0() << 1);
136   }
137   else    // 4P
138   {
139      if (offset == 0)    //$4016
140      {
141         ret |= (m_port1->read_bit0() << 0);
142         ret |= (m_port3->read_bit0() << 1);
143      }
144      else    //$4017
145      {
146         ret |= (m_port2->read_bit0() << 0);
147         ret |= (m_port4->read_bit0() << 1);
148      }
149   }
150   return ret;
151}
152
153//-------------------------------------------------
154//  write
155//-------------------------------------------------
156
157void nes_horitwin_device::write(UINT8 data)
158{
159   m_port1->write(data);
160   m_port2->write(data);
161}
162
163void nes_hori4p_device::write(UINT8 data)
164{
165   m_port1->write(data);
166   m_port2->write(data);
167   m_port3->write(data);
168   m_port4->write(data);
169}
trunk/src/emu/bus/nes_ctrl/hori.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Hori Twin (and 4P?) adapters
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_HORI__
13#define __NES_HORI__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_horitwin_device
24
25class nes_horitwin_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_horitwin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual machine_config_constructor device_mconfig_additions() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start() {}
37
38   virtual UINT8 read_exp(offs_t offset);
39   virtual void write(UINT8 data);
40
41private:
42   required_device<nes_control_port_device> m_port1;
43   required_device<nes_control_port_device> m_port2;
44};
45
46// ======================> nes_hori4p_device
47
48class nes_hori4p_device : public device_t,
49                     public device_nes_control_port_interface
50{
51public:
52   // construction/destruction
53   nes_hori4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
54
55   virtual ioport_constructor device_input_ports() const;
56   virtual machine_config_constructor device_mconfig_additions() const;
57
58protected:
59   // device-level overrides
60   virtual void device_start() {}
61
62   virtual UINT8 read_exp(offs_t offset);
63   virtual void write(UINT8 data);
64
65private:
66   required_device<nes_control_port_device> m_port1;
67   required_device<nes_control_port_device> m_port2;
68   required_device<nes_control_port_device> m_port3;
69   required_device<nes_control_port_device> m_port4;
70   required_ioport m_cfg;
71};
72
73
74// device type definition
75extern const device_type NES_HORITWIN;
76extern const device_type NES_HORI4P;
77
78
79#endif
trunk/src/emu/bus/nes_ctrl/joypad.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System Joypads
4
5    The original Famicom had two hardwired controller, with the second
6    controller slightly different from the first one: it featured no
7    Start nor Select buttons, but had a built-in microphone (with
8    very limited capabilities, since it basically only detected two
9    states: something blowing into it / nothing blowing into it) for
10    some games to react to users "talking" into it
11
12    Crazy Climber Pads are not really a kind of separate controllers,
13    but just a couple of small sticks to be put on top of d-pads of
14    the regular controllers. Users should then control the game by
15    using both controllers, turned 90 degrees, as a couple of dual
16    sticks like in the arcade control panel. However, we emulate them
17    separately so to map the controls to a friendlier default.
18
19    The Arcade Stick we emulate is a controller (apparently manufactured
20    by Hori, but possibly licensed by Nintendo, since it use the official
21    logo and brand) which fits into the expansion port and allows to
22    daisy chain a second controller to the first one, to play 4players
23    game (an image of such connection is shown e.g. in Nekketsu Koukou
24    Dodgeball Bu manual)
25
26    Copyright MESS Team.
27    Visit http://mamedev.org for licensing and usage restrictions.
28
29**********************************************************************/
30
31#include "joypad.h"
32
33//**************************************************************************
34//  DEVICE DEFINITIONS
35//**************************************************************************
36
37const device_type NES_JOYPAD = &device_creator<nes_joypad_device>;
38const device_type NES_FCPAD_P2 = &device_creator<nes_fcpad2_device>;
39const device_type NES_CCPAD_LEFT = &device_creator<nes_ccpadl_device>;
40const device_type NES_CCPAD_RIGHT = &device_creator<nes_ccpadr_device>;
41const device_type NES_ARCSTICK = &device_creator<nes_arcstick_device>;
42
43
44static INPUT_PORTS_START( nes_joypad )
45   PORT_START("JOYPAD")
46   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
47   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
48   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
49   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
50   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
51   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
52   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
53   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
54INPUT_PORTS_END
55
56static INPUT_PORTS_START( nes_fcpad_p2 )
57   PORT_START("JOYPAD")
58   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
59   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
60   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Microphone")
61   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
62   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
63   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
64   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
65   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
66INPUT_PORTS_END
67
68static INPUT_PORTS_START( nes_ccpad_left )
69   PORT_START("JOYPAD")
70   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
71   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
72   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
73   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
74   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY
75   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY
76   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_8WAY
77   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY
78INPUT_PORTS_END
79
80static INPUT_PORTS_START( nes_ccpad_right )
81   PORT_START("JOYPAD")
82   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
83   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
84   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
85   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
86   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY
87   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY
88   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY
89   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY
90INPUT_PORTS_END
91
92static INPUT_PORTS_START( nes_arcstick )
93   PORT_START("CONFIG")
94   PORT_CONFNAME( 0x01, 0x01, "4 Way / 8 Way Joystick")
95   PORT_CONFSETTING(  0x00, "4 Way" )
96   PORT_CONFSETTING(  0x01, "8 Way" )
97   PORT_CONFNAME( 0x02, 0x00, "Player ID")
98   PORT_CONFSETTING(  0x00, "Player I" )
99   PORT_CONFSETTING(  0x02, "Player II" )
100
101   PORT_START("JOYPAD")
102   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
103   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
104   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
105   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
106   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY     PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
107   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
108   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
109   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY  PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
110   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY     PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
111   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
112   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
113   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY  PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
114INPUT_PORTS_END
115
116//-------------------------------------------------
117//  input_ports - device-specific input ports
118//-------------------------------------------------
119
120ioport_constructor nes_joypad_device::device_input_ports() const
121{
122   return INPUT_PORTS_NAME( nes_joypad );
123}
124
125ioport_constructor nes_fcpad2_device::device_input_ports() const
126{
127   return INPUT_PORTS_NAME( nes_fcpad_p2 );
128}
129
130ioport_constructor nes_ccpadl_device::device_input_ports() const
131{
132   return INPUT_PORTS_NAME( nes_ccpad_left );
133}
134
135ioport_constructor nes_ccpadr_device::device_input_ports() const
136{
137   return INPUT_PORTS_NAME( nes_ccpad_right );
138}
139
140ioport_constructor nes_arcstick_device::device_input_ports() const
141{
142   return INPUT_PORTS_NAME( nes_arcstick );
143}
144
145
146
147static SLOT_INTERFACE_START( arcstick_daisy )
148   SLOT_INTERFACE("arcstick", NES_ARCSTICK)
149SLOT_INTERFACE_END
150
151static MACHINE_CONFIG_FRAGMENT( arcstick )
152   // expansion port to allow daisy chaining
153   MCFG_FC_EXPANSION_PORT_ADD("subexp", arcstick_daisy, NULL)
154MACHINE_CONFIG_END
155
156
157//-------------------------------------------------
158//  machine_config_additions - device-specific
159//  machine configurations
160//-------------------------------------------------
161
162machine_config_constructor nes_arcstick_device::device_mconfig_additions() const
163{
164   return MACHINE_CONFIG_NAME( arcstick );
165}
166
167
168
169//**************************************************************************
170//  LIVE DEVICE
171//**************************************************************************
172
173//-------------------------------------------------
174//  nes_joypad_device - constructor
175//-------------------------------------------------
176
177nes_joypad_device::nes_joypad_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
178               device_t(mconfig, type, name, tag, owner, clock, shortname, source),
179               device_nes_control_port_interface(mconfig, *this),
180               m_joypad(*this, "JOYPAD")
181{
182}
183
184nes_joypad_device::nes_joypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
185               device_t(mconfig, NES_JOYPAD, "Nintendo NES / FC Control Pad", tag, owner, clock, "nes_joypad", __FILE__),
186               device_nes_control_port_interface(mconfig, *this),
187               m_joypad(*this, "JOYPAD")
188{
189}
190
191nes_fcpad2_device::nes_fcpad2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
192               nes_joypad_device(mconfig, NES_FCPAD_P2, "Nintendo Family Computer P2 Pad", tag, owner, clock, "nes_fcpad2", __FILE__)
193{
194}
195
196nes_ccpadl_device::nes_ccpadl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
197               nes_joypad_device(mconfig, NES_CCPAD_LEFT, "FC Crazy Climber Left Pad", tag, owner, clock, "nes_ccpadl", __FILE__)
198{
199}
200
201nes_ccpadr_device::nes_ccpadr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
202               nes_joypad_device(mconfig, NES_CCPAD_RIGHT, "FC Crazy Climber Right Pad", tag, owner, clock, "nes_ccpadr", __FILE__)
203{
204}
205
206nes_arcstick_device::nes_arcstick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
207                  nes_joypad_device(mconfig, NES_ARCSTICK, "Nintendo Family Computer Arcade Stick", tag, owner, clock, "nes_arcstick", __FILE__),
208                  m_daisychain(*this, "subexp"),
209                  m_cfg(*this, "CONFIG")
210{
211}
212
213
214//-------------------------------------------------
215//  device_start
216//-------------------------------------------------
217
218void nes_joypad_device::device_start()
219{
220   save_item(NAME(m_latch));
221}
222
223
224//-------------------------------------------------
225//  device_reset
226//-------------------------------------------------
227
228void nes_joypad_device::device_reset()
229{
230   m_latch = 0;
231}
232
233
234//-------------------------------------------------
235//  read
236//-------------------------------------------------
237
238UINT8 nes_joypad_device::read_bit0()
239{
240   UINT8 ret = m_latch & 1;
241   m_latch >>= 1;
242   return ret;
243}
244
245UINT8 nes_fcpad2_device::read_exp(offs_t offset)
246{
247   UINT8 ret = 0;
248   if (!offset)    // microphone input
249      ret |= m_joypad->read() & 0x04;
250
251   return ret;
252}
253
254// NOTE: I haven't found any documentation about what happens when
255// users connect two arcade stick both set as P1 or P2 in config.
256// does the FC only acknowledge the first one, or do they conflict
257// with each other? currently, we only support the following setup:
258// if the first pad is set as P1, the daisy chained pad is checked
259// for P2 only, and vice versa.
260UINT8 nes_arcstick_device::read_exp(offs_t offset)
261{
262   UINT8 ret = 0;
263   if (offset == 0)    //$4016
264   {
265      if ((m_cfg->read() & 2) == 0)   // we are P1 input
266      {
267         ret |= (m_latch & 1) << 1;
268         m_latch >>= 1;
269      }
270      else
271         ret |= m_daisychain->read_exp(0);
272   }
273   else    //$4017
274   {
275      if ((m_cfg->read() & 2) == 2)   // we are P2 input
276      {
277         ret |= (m_latch & 1) << 1;
278         m_latch >>= 1;
279      }
280      else
281         ret |= m_daisychain->read_exp(1);
282   }
283
284   return ret;
285}
286
287//-------------------------------------------------
288//  write
289//-------------------------------------------------
290
291void nes_joypad_device::write(UINT8 data)
292{
293   if (data & 0x01)
294      return;
295
296   m_latch = m_joypad->read();
297}
298
299void nes_fcpad2_device::write(UINT8 data)
300{
301   if (data & 0x01)
302      return;
303
304   // microphone is hooked to expansion bits, not to the controller bit
305   m_latch = m_joypad->read() & ~0x04;
306}
307
308void nes_arcstick_device::write(UINT8 data)
309{
310   m_daisychain->write(data);
311
312   if (data & 0x01)
313      return;
314
315   m_latch = m_joypad->read();
316}
trunk/src/emu/bus/nes_ctrl/joypad.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System Joypads
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_JOYPAD__
13#define __NES_JOYPAD__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_joypad_device
24
25class nes_joypad_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_joypad_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
31   nes_joypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   virtual UINT8 read_bit0();
41   virtual void write(UINT8 data);
42
43   required_ioport m_joypad;
44   UINT32 m_latch;
45};
46
47// ======================> nes_fcpad2_device
48
49class nes_fcpad2_device : public nes_joypad_device
50{
51public:
52   // construction/destruction
53   nes_fcpad2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
54
55   virtual ioport_constructor device_input_ports() const;
56
57protected:
58   virtual UINT8 read_exp(offs_t offset);
59   virtual void write(UINT8 data);
60};
61
62// ======================> nes_ccpadl_device
63
64class nes_ccpadl_device : public nes_joypad_device
65{
66public:
67   // construction/destruction
68   nes_ccpadl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
69
70   virtual ioport_constructor device_input_ports() const;
71};
72
73// ======================> nes_ccpadr_device
74
75class nes_ccpadr_device : public nes_joypad_device
76{
77public:
78   // construction/destruction
79   nes_ccpadr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
80
81   virtual ioport_constructor device_input_ports() const;
82};
83
84// ======================> nes_arcstick_device
85
86class nes_arcstick_device : public nes_joypad_device
87{
88public:
89   // construction/destruction
90   nes_arcstick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
91
92   virtual ioport_constructor device_input_ports() const;
93   virtual machine_config_constructor device_mconfig_additions() const;
94
95protected:
96   virtual UINT8 read_bit0() { return 0; }
97   virtual UINT8 read_exp(offs_t offset);
98   virtual void write(UINT8 data);
99
100   required_device<nes_control_port_device> m_daisychain;
101   required_ioport m_cfg;
102};
103
104
105// device type definition
106extern const device_type NES_JOYPAD;
107extern const device_type NES_FCPAD_P2;
108extern const device_type NES_CCPAD_LEFT;
109extern const device_type NES_CCPAD_RIGHT;
110extern const device_type NES_ARCSTICK;
111
112#endif
trunk/src/emu/bus/nes_ctrl/konamihs.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Konami Hyper Shot Controllers
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "konamihs.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_KONAMIHS = &device_creator<nes_konamihs_device>;
17
18
19static INPUT_PORTS_START( nes_konamihs )
20   PORT_START("P1")
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PI Run")
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("PI Jump")
23
24   PORT_START("P2")
25   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("PII Run")
26   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("PII Jump")
27INPUT_PORTS_END
28
29//-------------------------------------------------
30//  input_ports - device-specific input ports
31//-------------------------------------------------
32
33ioport_constructor nes_konamihs_device::device_input_ports() const
34{
35   return INPUT_PORTS_NAME( nes_konamihs );
36}
37
38//**************************************************************************
39//  LIVE DEVICE
40//**************************************************************************
41
42//-------------------------------------------------
43//  nes_konamihs_device - constructor
44//-------------------------------------------------
45
46nes_konamihs_device::nes_konamihs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
47               device_t(mconfig, NES_KONAMIHS, "Konami Hyper Shot Controller", tag, owner, clock, "nes_konamihs", __FILE__),
48               device_nes_control_port_interface(mconfig, *this),
49               m_ipt_p1(*this, "P1"),
50               m_ipt_p2(*this, "P2")
51{
52}
53
54
55//-------------------------------------------------
56//  device_start
57//-------------------------------------------------
58
59void nes_konamihs_device::device_start()
60{
61   save_item(NAME(m_latch_p1));
62   save_item(NAME(m_latch_p2));
63}
64
65
66//-------------------------------------------------
67//  device_reset
68//-------------------------------------------------
69
70void nes_konamihs_device::device_reset()
71{
72   m_latch_p1 = 0;
73   m_latch_p2 = 0;
74}
75
76
77//-------------------------------------------------
78//  read
79//-------------------------------------------------
80
81UINT8 nes_konamihs_device::read_exp(offs_t offset)
82{
83   UINT8 ret = 0;
84   if (offset == 1)    //$4017
85   {
86      ret |= m_latch_p1 << 1;
87      ret |= m_latch_p2 << 3;
88   }
89   return ret;
90}
91
92//-------------------------------------------------
93//  write
94//-------------------------------------------------
95
96void nes_konamihs_device::write(UINT8 data)
97{
98   if ((data & 0x02) == 0)
99      m_latch_p1 = m_ipt_p1->read();
100   if ((data & 0x04) == 0)
101      m_latch_p2 = m_ipt_p2->read();
102}
trunk/src/emu/bus/nes_ctrl/konamihs.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Konami Hyper Shot Controllers
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_KONAMIHS__
13#define __NES_KONAMIHS__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_konamihs_device
24
25class nes_konamihs_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_konamihs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42   required_ioport m_ipt_p1;
43   required_ioport m_ipt_p2;
44   UINT32 m_latch_p1, m_latch_p2;
45};
46
47// device type definition
48extern const device_type NES_KONAMIHS;
49
50#endif
trunk/src/emu/bus/nes_ctrl/miracle.c
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System - Miracle Piano Keyboard
4
5    TODO: basically everything, this is just a skeleton with no
6    real MIDI handling at the moment.
7
8    Copyright MESS Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11**********************************************************************/
12
13#include "miracle.h"
14
15#define MIRACLE_MIDI_WAITING 0
16#define MIRACLE_MIDI_RECEIVE 1      // receive byte from piano
17#define MIRACLE_MIDI_SEND 2         // send byte to piano
18
19//**************************************************************************
20//  DEVICE DEFINITIONS
21//**************************************************************************
22
23const device_type NES_MIRACLE = &device_creator<nes_miracle_device>;
24
25
26MACHINE_CONFIG_FRAGMENT( nes_miracle )
27   MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
28   MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
29MACHINE_CONFIG_END
30
31machine_config_constructor nes_miracle_device::device_mconfig_additions() const
32{
33   return MACHINE_CONFIG_NAME( nes_miracle );
34}
35
36
37//-------------------------------------------------
38//  device_timer - handler timer events
39//-------------------------------------------------
40
41void nes_miracle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
42{
43   if (id == TIMER_STROBE_ON)
44   {
45      m_strobe_clock++;
46   }
47}
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  nes_miracle_device - constructor
55//-------------------------------------------------
56
57nes_miracle_device::nes_miracle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58               device_t(mconfig, NES_MIRACLE, "Miracle Piano Controller", tag, owner, clock, "nes_miracle", __FILE__),
59               device_serial_interface(mconfig, *this),
60               device_nes_control_port_interface(mconfig, *this),
61               m_midiin(*this, "mdin"),
62               m_midiout(*this, "mdout")
63{
64}
65
66
67//-------------------------------------------------
68//  device_start
69//-------------------------------------------------
70
71void nes_miracle_device::device_start()
72{
73   strobe_timer = timer_alloc(TIMER_STROBE_ON);
74   strobe_timer->adjust(attotime::never);
75   save_item(NAME(m_strobe_on));
76   save_item(NAME(m_sent_bits));
77   save_item(NAME(m_strobe_clock));
78   save_item(NAME(m_midi_mode));
79}
80
81
82//-------------------------------------------------
83//  device_reset
84//-------------------------------------------------
85
86void nes_miracle_device::device_reset()
87{
88   m_strobe_on = 0;
89   m_sent_bits = 0;
90   m_strobe_clock = 0;
91   m_midi_mode = MIRACLE_MIDI_WAITING;
92
93   // set standard MIDI parameters
94   set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
95   set_rcv_rate(31250);
96   set_tra_rate(31250);
97
98   m_xmit_read = m_xmit_write = 0;
99   m_tx_busy = false;
100}
101
102
103//-------------------------------------------------
104//  read
105//-------------------------------------------------
106
107// TODO: here, reads from serial midi in bit0, when in MIDI_SEND mode
108
109UINT8 nes_miracle_device::read_bit0()
110{
111   UINT8 ret = 0;
112
113   if (m_midi_mode == MIRACLE_MIDI_RECEIVE)
114   {
115      //NES reads from Miracle Piano!
116      // ret |= ...
117   }
118
119   return ret;
120}
121
122//-------------------------------------------------
123//  write
124//-------------------------------------------------
125
126// TODO: here, writes to serial midi in bit0, when in MIDI_RECEIVE mode
127// c4fc = start of recv routine
128// c53a = start of send routine
129
130void nes_miracle_device::write(UINT8 data)
131{
132//  printf("write: %d (%d %02x %d)\n", data & 1, m_sent_bits, m_data_sent, m_midi_mode);
133
134   if (m_midi_mode == MIRACLE_MIDI_SEND)
135   {
136      //NES writes (data & 1) to Miracle Piano!
137      // 1st write is data present flag (1=data present)
138      // next 8 writes are actual data bits (with ^1)
139      m_sent_bits++;
140      m_data_sent <<= 1;
141      m_data_sent |= (data & 1);
142      // then we go back to waiting
143      if (m_sent_bits == 8)
144      {
145//          printf("xmit MIDI byte %02x\n", m_data_sent);
146         xmit_char(m_data_sent);
147         m_midi_mode = MIRACLE_MIDI_WAITING;
148         m_sent_bits = 0;
149      }
150
151      return;
152   }
153
154   if (data == 1 && !m_strobe_on)
155   {
156      strobe_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1));
157      m_strobe_on = 1;
158      return;
159   }
160
161   if (m_strobe_on)
162   {
163      // was timer running?
164      if (m_strobe_clock > 0)
165      {
166//          printf("got strobe at %d clocks\n", m_strobe_clock);
167
168         if (m_strobe_clock < 66 && data == 0)
169         {
170            // short delay is recieve mode
171            m_midi_mode = MIRACLE_MIDI_RECEIVE;
172            strobe_timer->reset();
173            m_strobe_on = 0;
174            m_strobe_clock = 0;
175            return;
176         }
177         else if (m_strobe_clock >= 66)
178         {
179            // more than 66 clocks since strobe on write means send mode
180            m_midi_mode = MIRACLE_MIDI_SEND;
181            strobe_timer->reset();
182            m_strobe_on = 0;
183            m_strobe_clock = 0;
184            m_sent_bits = 1;
185            m_data_sent <<= 1;
186            m_data_sent |= (data & 1);
187            return;
188         }
189      }
190
191      if (m_midi_mode == MIRACLE_MIDI_SEND &&  data == 0)
192      {
193         // strobe off after the end of a byte
194         m_midi_mode = MIRACLE_MIDI_WAITING;
195      }
196   }
197}
198
199void nes_miracle_device::rcv_complete()    // Rx completed receiving byte
200{
201   receive_register_extract();
202//  UINT8 rcv = get_received_char();
203}
204
205void nes_miracle_device::tra_complete()    // Tx completed sending byte
206{
207//  printf("Tx complete\n");
208   // is there more waiting to send?
209   if (m_xmit_read != m_xmit_write)
210   {
211      transmit_register_setup(m_xmitring[m_xmit_read++]);
212      if (m_xmit_read >= XMIT_RING_SIZE)
213      {
214         m_xmit_read = 0;
215      }
216   }
217   else
218   {
219      m_tx_busy = false;
220   }
221}
222
223void nes_miracle_device::tra_callback()    // Tx send bit
224{
225   // send this to midi out
226   m_midiout->write_txd(transmit_register_get_data_bit());
227}
228
229void nes_miracle_device::xmit_char(UINT8 data)
230{
231//  printf("xmit %02x\n", data);
232
233   // if tx is busy it'll pick this up automatically when it completes
234   // if not, send now!
235   if (!m_tx_busy)
236   {
237      m_tx_busy = true;
238      transmit_register_setup(data);
239   }
240   else
241   {
242      // tx is busy, it'll pick this up next time
243      m_xmitring[m_xmit_write++] = data;
244      if (m_xmit_write >= XMIT_RING_SIZE)
245      {
246         m_xmit_write = 0;
247      }
248   }
249}
trunk/src/emu/bus/nes_ctrl/miracle.h
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System - Miracle Piano Keyboard
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_MIRACLE__
13#define __NES_MIRACLE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18#include "bus/midi/midi.h"
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> nes_miracle_device
25
26class nes_miracle_device : public device_t,
27                     public device_serial_interface,
28                     public device_nes_control_port_interface
29{
30public:
31   static const int XMIT_RING_SIZE = 16;
32
33   // construction/destruction
34   nes_miracle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
35
36   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
37   virtual machine_config_constructor device_mconfig_additions() const;
38
39   // serial overrides
40   virtual void rcv_complete();    // Rx completed receiving byte
41   virtual void tra_complete();    // Tx completed sending byte
42   virtual void tra_callback();    // Tx send bit
43
44   void xmit_char(UINT8 data);
45
46   required_device<midi_port_device> m_midiin, m_midiout;
47
48protected:
49   // device-level overrides
50   virtual void device_start();
51   virtual void device_reset();
52
53   virtual UINT8 read_bit0();
54   virtual void write(UINT8 data);
55
56   static const device_timer_id TIMER_STROBE_ON = 0;
57   emu_timer *strobe_timer;
58
59   int m_strobe_on, m_midi_mode, m_sent_bits;
60   UINT32 m_strobe_clock;
61   UINT8 m_data_sent;
62   UINT8 m_xmitring[XMIT_RING_SIZE];
63   int m_xmit_read, m_xmit_write;
64   bool m_tx_busy;
65};
66
67// device type definition
68extern const device_type NES_MIRACLE;
69
70#endif
trunk/src/emu/bus/nes_ctrl/mjpanel.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Mahjong Panel
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "mjpanel.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_MJPANEL = &device_creator<nes_mjpanel_device>;
17
18
19static INPUT_PORTS_START( nes_mjpanel )
20   PORT_START("MJPANEL.0")
21   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
22
23   PORT_START("MJPANEL.1")
24   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
25   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
26   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
27   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
28   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
29   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
30   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
31
32   PORT_START("MJPANEL.2")
33   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
34   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
35   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
36   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
37   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
38   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
39   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
40   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
41
42   PORT_START("MJPANEL.3")
43   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
44   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
45   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
46   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
47   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
48   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
49   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Mahjong Select")
50   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Mahjong Start")
51INPUT_PORTS_END
52
53
54//-------------------------------------------------
55//  input_ports - device-specific input ports
56//-------------------------------------------------
57
58ioport_constructor nes_mjpanel_device::device_input_ports() const
59{
60   return INPUT_PORTS_NAME( nes_mjpanel );
61}
62
63
64
65//**************************************************************************
66//  LIVE DEVICE
67//**************************************************************************
68
69//-------------------------------------------------
70//  nes_mjpanel_device - constructor
71//-------------------------------------------------
72
73nes_mjpanel_device::nes_mjpanel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
74               device_t(mconfig, NES_MJPANEL, "Famicom Mahjong Panel", tag, owner, clock, "nes_mjpanel", __FILE__),
75               device_nes_control_port_interface(mconfig, *this),
76               m_panel(*this, "MJPANEL")
77{
78}
79
80
81//-------------------------------------------------
82//  device_start
83//-------------------------------------------------
84
85void nes_mjpanel_device::device_start()
86{
87   save_item(NAME(m_latch));
88}
89
90
91//-------------------------------------------------
92//  device_reset
93//-------------------------------------------------
94
95void nes_mjpanel_device::device_reset()
96{
97   m_latch = 0;
98}
99
100
101//-------------------------------------------------
102//  read
103//-------------------------------------------------
104
105UINT8 nes_mjpanel_device::read_exp(offs_t offset)
106{
107   UINT8 ret = 0;
108   if (offset)
109   {
110      ret = (m_latch & 1) << 1;
111      m_latch >>= 1;
112   }
113   else
114      logerror("Error: Mahjong panel read from $4016\n");
115
116   return ret;
117}
118
119//-------------------------------------------------
120//  write
121//-------------------------------------------------
122
123void nes_mjpanel_device::write(UINT8 data)
124{
125   if (data & 0x01)
126      return;
127
128   if (data & 0xf8)
129      logerror("Error: Mahjong panel read with mux data %02x\n", (data & 0xfe));
130   else
131      m_latch = m_panel[(data & 0xfe) >> 1]->read();
132}
trunk/src/emu/bus/nes_ctrl/mjpanel.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Mahjong Panel
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_MJPANEL__
13#define __NES_MJPANEL__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_mjpanel_device
24
25class nes_mjpanel_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_mjpanel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42private:
43   required_ioport_array<4> m_panel;
44   UINT32 m_latch;
45};
46
47
48// device type definition
49extern const device_type NES_MJPANEL;
50
51
52#endif
trunk/src/emu/bus/nes_ctrl/pachinko.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Pachinko Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "pachinko.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_PACHINKO = &device_creator<nes_pachinko_device>;
17
18
19static INPUT_PORTS_START( nes_pachinko )
20   PORT_START("JOYPAD")
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
23   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
26   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
27   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
28   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
29
30   PORT_START("TRIGGER")
31   PORT_BIT( 0xff, 0, IPT_PEDAL ) PORT_MINMAX(0, 0x63) PORT_SENSITIVITY(25) PORT_KEYDELTA(20)
32INPUT_PORTS_END
33
34//-------------------------------------------------
35//  input_ports - device-specific input ports
36//-------------------------------------------------
37
38ioport_constructor nes_pachinko_device::device_input_ports() const
39{
40   return INPUT_PORTS_NAME( nes_pachinko );
41}
42
43//**************************************************************************
44//  LIVE DEVICE
45//**************************************************************************
46
47//-------------------------------------------------
48//  nes_pachinko_device - constructor
49//-------------------------------------------------
50
51nes_pachinko_device::nes_pachinko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
52               device_t(mconfig, NES_PACHINKO, "Famicom Pachinko Controller", tag, owner, clock, "nes_pachinko", __FILE__),
53               device_nes_control_port_interface(mconfig, *this),
54               m_joypad(*this, "JOYPAD"),
55               m_trigger(*this, "TRIGGER")
56{
57}
58
59
60//-------------------------------------------------
61//  device_start
62//-------------------------------------------------
63
64void nes_pachinko_device::device_start()
65{
66   save_item(NAME(m_latch));
67}
68
69
70//-------------------------------------------------
71//  device_reset
72//-------------------------------------------------
73
74void nes_pachinko_device::device_reset()
75{
76   m_latch = 0;
77}
78
79
80//-------------------------------------------------
81//  read
82//-------------------------------------------------
83
84UINT8 nes_pachinko_device::read_exp(offs_t offset)
85{
86   UINT8 ret = 0;
87   // this controller behaves like a standard P3 joypad, with longer stream of inputs
88   if (offset == 0)    //$4016
89   {
90      ret |= (m_latch & 1) << 1;
91      m_latch >>= 1;
92   }
93   return ret;
94}
95
96//-------------------------------------------------
97//  write
98//-------------------------------------------------
99
100void nes_pachinko_device::write(UINT8 data)
101{
102   if (data & 0x01)
103      return;
104
105   m_latch = m_joypad->read();
106   m_latch |= ((m_trigger->read() ^ 0xff) & 0xff) << 8;
107   m_latch |= 0xff0000;
108}
trunk/src/emu/bus/nes_ctrl/pachinko.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Pachinko Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_PACHINKO__
13#define __NES_PACHINKO__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_pachinko_device
24
25class nes_pachinko_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_pachinko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42   required_ioport m_joypad;
43   required_ioport m_trigger;
44   UINT32 m_latch;
45};
46
47// device type definition
48extern const device_type NES_PACHINKO;
49
50#endif
trunk/src/emu/bus/nes_ctrl/partytap.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Yonezawa / PartyRoom 21 Party Tap Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "partytap.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_PARTYTAP = &device_creator<nes_partytap_device>;
17
18
19static INPUT_PORTS_START( nes_partytap )
20   PORT_START("INPUTS")
21   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
22   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Button") PORT_CODE(KEYCODE_Z)
23   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Button") PORT_CODE(KEYCODE_X)
24   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P3 Button") PORT_CODE(KEYCODE_C)
25   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P4 Button") PORT_CODE(KEYCODE_V)
26   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P5 Button") PORT_CODE(KEYCODE_B)
27   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P6 Button") PORT_CODE(KEYCODE_N)
28INPUT_PORTS_END
29
30//-------------------------------------------------
31//  input_ports - device-specific input ports
32//-------------------------------------------------
33
34ioport_constructor nes_partytap_device::device_input_ports() const
35{
36   return INPUT_PORTS_NAME( nes_partytap );
37}
38
39//**************************************************************************
40//  LIVE DEVICE
41//**************************************************************************
42
43//-------------------------------------------------
44//  nes_partytap_device - constructor
45//-------------------------------------------------
46
47nes_partytap_device::nes_partytap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
48               device_t(mconfig, NES_PARTYTAP, "Yonezawa Party Tap Controller", tag, owner, clock, "nes_partytap", __FILE__),
49               device_nes_control_port_interface(mconfig, *this),
50               m_inputs(*this, "INPUTS")
51{
52}
53
54
55//-------------------------------------------------
56//  device_start
57//-------------------------------------------------
58
59void nes_partytap_device::device_start()
60{
61   save_item(NAME(m_latch));
62   save_item(NAME(m_mode));
63}
64
65
66//-------------------------------------------------
67//  device_reset
68//-------------------------------------------------
69
70void nes_partytap_device::device_reset()
71{
72   m_mode = 0xe0;
73   m_latch = 0;
74}
75
76
77//-------------------------------------------------
78//  read
79//-------------------------------------------------
80
81UINT8 nes_partytap_device::read_exp(offs_t offset)
82{
83   UINT8 ret = 0;
84   if (offset == 1)    //$4017
85   {
86      ret |= m_latch & 0x1c;
87      m_latch >>= 3;
88      // append mode bits
89      m_latch |= m_mode;
90   }
91   return ret;
92}
93
94//-------------------------------------------------
95//  write
96//-------------------------------------------------
97
98void nes_partytap_device::write(UINT8 data)
99{
100   // inputs are read in two chunks of 3 bits, before the second one is read bit2 is written here
101   // probably a mechanism for the game to detect which group of inputs is being read
102   m_mode = BIT(data, 2) ? 0xa0 : 0xe0;
103
104   if (data & 0x01)
105      return;
106
107   m_latch = m_inputs->read();
108}
trunk/src/emu/bus/nes_ctrl/partytap.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Yonezawa / PartyRoom 21 Party Tap Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_PARTYTAP__
13#define __NES_PARTYTAP__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_partytap_device
24
25class nes_partytap_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_partytap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42   required_ioport m_inputs;
43   UINT8 m_mode;
44   UINT32 m_latch;
45};
46
47// device type definition
48extern const device_type NES_PARTYTAP;
49
50#endif
trunk/src/emu/bus/nes_ctrl/powerpad.c
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System - Bandai Power Pad
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "powerpad.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_POWERPAD = &device_creator<nes_powerpad_device>;
17
18
19static INPUT_PORTS_START( nes_powerpad )
20   PORT_START("LAYOUT")
21   PORT_CONFNAME( 0x01, 0x00, "Power Pad Button Layout")
22   PORT_CONFSETTING(  0x00, "Side A" )
23   PORT_CONFSETTING(  0x01, "Side B" )
24
25   // difference between the two sides is that we mirror the key mapping to match the real pad layout!
26   PORT_START("POWERPAD1")
27   // side A layout
28   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top1")  PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
29   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
30   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid1")  PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
31   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
32   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid2")  PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
33   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low1")  PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
34   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Low2")  PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
35   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid3")  PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
36   // side B layout
37   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 2")     PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
38   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 1")     PORT_CODE(KEYCODE_R) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
39   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 5")     PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
40   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 9")     PORT_CODE(KEYCODE_V) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
41   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 6")     PORT_CODE(KEYCODE_G) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
42   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 10")    PORT_CODE(KEYCODE_B) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
43   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 11")    PORT_CODE(KEYCODE_N) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
44   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 7")     PORT_CODE(KEYCODE_H) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
45
46   PORT_START("POWERPAD2")
47   // side A layout
48   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
49   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Top2")  PORT_CODE(KEYCODE_T) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
50   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
51   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad Mid4")  PORT_CODE(KEYCODE_F) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
52   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x00)
53   // side B layout
54   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 4")     PORT_CODE(KEYCODE_U) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
55   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 3")     PORT_CODE(KEYCODE_Y) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
56   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 12")    PORT_CODE(KEYCODE_M) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
57   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("PowerPad 8")     PORT_CODE(KEYCODE_J) PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
58   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )                                                  PORT_CONDITION("LAYOUT", 0x01, EQUALS, 0x01)
59INPUT_PORTS_END
60
61
62//-------------------------------------------------
63//  input_ports - device-specific input ports
64//-------------------------------------------------
65
66ioport_constructor nes_powerpad_device::device_input_ports() const
67{
68   return INPUT_PORTS_NAME( nes_powerpad );
69}
70
71
72
73//**************************************************************************
74//  LIVE DEVICE
75//**************************************************************************
76
77//-------------------------------------------------
78//  nes_powerpad_device - constructor
79//-------------------------------------------------
80
81nes_powerpad_device::nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
82               device_t(mconfig, NES_POWERPAD, "Bandai Power Pad", tag, owner, clock, "nes_powerpad", __FILE__),
83               device_nes_control_port_interface(mconfig, *this),
84               m_ipt1(*this, "POWERPAD1"),
85               m_ipt2(*this, "POWERPAD2")
86{
87}
88
89
90//-------------------------------------------------
91//  device_start
92//-------------------------------------------------
93
94void nes_powerpad_device::device_start()
95{
96   save_item(NAME(m_latch));
97}
98
99
100//-------------------------------------------------
101//  device_reset
102//-------------------------------------------------
103
104void nes_powerpad_device::device_reset()
105{
106   m_latch[0] = 0;
107   m_latch[1] = 0;
108}
109
110
111//-------------------------------------------------
112//  read
113//-------------------------------------------------
114
115UINT8 nes_powerpad_device::read_bit34()
116{
117   UINT8 ret = 0;
118   ret |= (m_latch[0] & 0x01) << 3;
119   ret |= (m_latch[1] & 0x01) << 4;
120   m_latch[0] >>= 1;
121   m_latch[1] >>= 1;
122   return ret;
123}
124
125//-------------------------------------------------
126//  write
127//-------------------------------------------------
128
129void nes_powerpad_device::write(UINT8 data)
130{
131   if (data & 0x01)
132      return;
133
134   m_latch[0] = m_ipt1->read();
135   m_latch[1] = m_ipt2->read() | 0xf0;
136}
trunk/src/emu/bus/nes_ctrl/powerpad.h
r0r243204
1/**********************************************************************
2
3    Nintendo Entertainment System - Bandai Power Pad
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_POWERPAD__
13#define __NES_POWERPAD__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_powerpad_device
24
25class nes_powerpad_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_powerpad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_bit34();
40   virtual void write(UINT8 data);
41
42private:
43   required_ioport m_ipt1;
44   required_ioport m_ipt2;
45   UINT32 m_latch[2];
46};
47
48
49// device type definition
50extern const device_type NES_POWERPAD;
51
52
53#endif
trunk/src/emu/bus/nes_ctrl/suborkey.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Subor Keyboard (used by some Famiclones)
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "suborkey.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_SUBORKEYBOARD = &device_creator<nes_suborkey_device>;
17
18
19static INPUT_PORTS_START( fc_suborkey )
20   PORT_START("SUBOR.0")
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
23   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
26   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
27   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')
28   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
29
30   PORT_START("SUBOR.1")
31   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')
32   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
33   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
34   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
36   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
37   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
38   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
39
40   PORT_START("SUBOR.2")
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
42   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
43   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT")
44   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
45   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
46   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PRIOR")
47   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
48   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
49
50   PORT_START("SUBOR.3")
51   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
52   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
53   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
54   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
55   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
56   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
57   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
58   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.')
59
60   PORT_START("SUBOR.4")
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR(']')
62   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
63   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
64   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
65   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
66   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')
67   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
68   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
69
70   PORT_START("SUBOR.5")
71   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
72   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
73   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
74   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB)   PORT_CHAR('\t')
75   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
76   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
77   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')
78   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
79
80   PORT_START("SUBOR.6")
81   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')
82   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
83   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
84   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
85   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
86   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
87   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
88   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
89
90   PORT_START("SUBOR.7")
91   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
92   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
93   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'')
94   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
96   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)     PORT_CHAR('P')
97   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('=')
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)    PORT_CHAR(UCHAR_SHIFT_1)
99
100   PORT_START("SUBOR.8")
101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
109
110   PORT_START("SUBOR.9")
111   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
112
113   PORT_START("SUBOR.10")
114   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LMENU")
115   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
116   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
117   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11)       PORT_CHAR(UCHAR_MAMEKEY(F11))
118   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12)       PORT_CHAR(UCHAR_MAMEKEY(F12))
119   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
120   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
121   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
122
123   PORT_START("SUBOR.11")
124   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
125   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD)  PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
126   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK)  PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
127   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
128   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
129   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD)PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD))
131   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK)   PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
132
133   PORT_START("SUBOR.12")
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`')
135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE")
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE2")
138   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
139   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
140   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD)
141   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
142INPUT_PORTS_END
143
144
145//-------------------------------------------------
146//  input_ports - device-specific input ports
147//-------------------------------------------------
148
149ioport_constructor nes_suborkey_device::device_input_ports() const
150{
151   return INPUT_PORTS_NAME( fc_suborkey );
152}
153
154
155
156//**************************************************************************
157//  LIVE DEVICE
158//**************************************************************************
159
160//-------------------------------------------------
161//  nes_suborkey_device - constructor
162//-------------------------------------------------
163
164nes_suborkey_device::nes_suborkey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
165               device_t(mconfig, NES_SUBORKEYBOARD, "Subor FC Keyboard", tag, owner, clock, "nes_suborkey", __FILE__),
166               device_nes_control_port_interface(mconfig, *this),
167               m_kbd(*this, "SUBOR")
168{
169}
170
171
172//-------------------------------------------------
173//  device_start
174//-------------------------------------------------
175
176void nes_suborkey_device::device_start()
177{
178   save_item(NAME(m_fck_scan));
179   save_item(NAME(m_fck_mode));
180}
181
182
183//-------------------------------------------------
184//  device_reset
185//-------------------------------------------------
186
187void nes_suborkey_device::device_reset()
188{
189   m_fck_scan = 0;
190   m_fck_mode = 0;
191}
192
193
194//-------------------------------------------------
195//  read
196//-------------------------------------------------
197
198UINT8 nes_suborkey_device::read_exp(offs_t offset)
199{
200   UINT8 ret = 0;
201   if (offset == 1)    //$4017
202   {
203      // Subor Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
204      if (m_fck_scan < 13)
205         ret |= ~(((m_kbd[m_fck_scan]->read() >> (m_fck_mode * 4)) & 0x0f) << 1) & 0x1e;
206      else
207         ret |= 0x1e;
208   }
209
210   return ret;
211}
212
213//-------------------------------------------------
214//  write
215//-------------------------------------------------
216
217void nes_suborkey_device::write(UINT8 data)
218{
219   if (BIT(data, 2))   // keyboard active
220   {
221      UINT8 out = BIT(data, 1);   // scan
222      if (m_fck_mode && !out && ++m_fck_scan > 12)
223         m_fck_scan = 0;
224
225      m_fck_mode = out;   // access lower or upper 4 bits
226
227      if (BIT(data, 0))   // reset
228         m_fck_scan = 0;
229   }
230}
trunk/src/emu/bus/nes_ctrl/suborkey.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer Subor Keyboard (used by some Famiclones)
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_SUBORKEY__
13#define __NES_SUBORKEY__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_suborkey_device
24
25class nes_suborkey_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_suborkey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_exp(offs_t offset);
40   virtual void write(UINT8 data);
41
42private:
43   required_ioport_array<13> m_kbd;
44   UINT8 m_fck_scan, m_fck_mode;
45};
46
47
48// device type definition
49extern const device_type NES_SUBORKEYBOARD;
50
51
52#endif
trunk/src/emu/bus/nes_ctrl/zapper.c
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System Zapper Lightgun
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "zapper.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type NES_ZAPPER = &device_creator<nes_zapper_device>;
17
18
19static INPUT_PORTS_START( nes_zapper )
20   PORT_START("ZAPPER_X")
21   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)
22   PORT_START("ZAPPER_Y")
23   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)
24   PORT_START("ZAPPER_T")
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger")
26INPUT_PORTS_END
27
28
29//-------------------------------------------------
30//  input_ports - device-specific input ports
31//-------------------------------------------------
32
33ioport_constructor nes_zapper_device::device_input_ports() const
34{
35   return INPUT_PORTS_NAME( nes_zapper );
36}
37
38
39
40//**************************************************************************
41//  LIVE DEVICE
42//**************************************************************************
43
44//-------------------------------------------------
45//  nes_zapper_device - constructor
46//-------------------------------------------------
47
48nes_zapper_device::nes_zapper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
49               device_t(mconfig, NES_ZAPPER, "Nintendo Zapper Lightgun", tag, owner, clock, "nes_zapper", __FILE__),
50               device_nes_control_port_interface(mconfig, *this),
51               m_lightx(*this, "ZAPPER_X"),
52               m_lighty(*this, "ZAPPER_Y"),
53               m_trigger(*this, "ZAPPER_T")
54{
55}
56
57
58//-------------------------------------------------
59//  device_start
60//-------------------------------------------------
61
62void nes_zapper_device::device_start()
63{
64}
65
66
67//-------------------------------------------------
68//  device_reset
69//-------------------------------------------------
70
71void nes_zapper_device::device_reset()
72{
73}
74
75
76//-------------------------------------------------
77//  read
78//-------------------------------------------------
79
80UINT8 nes_zapper_device::read_bit34()
81{
82   UINT8 ret = m_trigger->read();
83   if (!m_port->m_brightpixel_cb.isnull() &&
84      m_port->m_brightpixel_cb(m_lightx->read(), m_lighty->read()))
85      ret &= ~0x08; // sprite hit
86   else
87      ret |= 0x08;  // no sprite hit
88   return ret;
89}
90
91UINT8 nes_zapper_device::read_exp(offs_t offset)
92{
93   UINT8 ret = 0;
94   if (offset == 1)    // $4017
95      ret |= nes_zapper_device::read_bit34();
96   return ret;
97}
trunk/src/emu/bus/nes_ctrl/zapper.h
r0r243204
1/**********************************************************************
2
3    Nintendo Family Computer & Entertainment System Zapper Lightgun
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NES_ZAPPER__
13#define __NES_ZAPPER__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> nes_zapper_device
24
25class nes_zapper_device : public device_t,
26                     public device_nes_control_port_interface
27{
28public:
29   // construction/destruction
30   nes_zapper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   virtual ioport_constructor device_input_ports() const;
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38
39   virtual UINT8 read_bit34();
40   virtual UINT8 read_exp(offs_t offset);
41
42private:
43   required_ioport m_lightx;
44   required_ioport m_lighty;
45   required_ioport m_trigger;
46};
47
48
49// device type definition
50extern const device_type NES_ZAPPER;
51
52
53#endif
trunk/src/emu/bus/sms_ctrl/graphic.c
r243203r243204
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, "Graphic Board", tag, owner, clock, "sms_graphic", __FILE__)
80   : device_t(mconfig, SMS_GRAPHIC, "Sega SMS 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
r243203r243204
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
r243203r243204
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, "Control Pad", tag, owner, clock, "sms_joypad", __FILE__),
54   device_t(mconfig, SMS_JOYPAD, "Sega SMS 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
r243203r243204
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, "Light Phaser", tag, owner, clock, "sms_light_phaser", __FILE__),
73   device_t(mconfig, SMS_LIGHT_PHASER, "Sega SMS 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
r243203r243204
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, "Multitap", tag, owner, clock, "sms_multitap", __FILE__),
32   device_t(mconfig, SMS_MULTITAP, "Sega SMS 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
r243203r243204
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, "Paddle", tag, owner, clock, "sms_paddle", __FILE__),
76   device_t(mconfig, SMS_PADDLE, "Sega SMS 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
r243203r243204
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, "Rapid Fire", tag, owner, clock, "sms_rapid_fire", __FILE__),
54   device_t(mconfig, SMS_RAPID_FIRE, "Sega SMS 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
r243203r243204
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, "Sports Pad US", tag, owner, clock, "sms_sports_pad", __FILE__),
115   device_t(mconfig, SMS_SPORTS_PAD, "Sega SMS 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
r243203r243204
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, "Sports Pad JP", tag, owner, clock, "sms_sports_pad_jp", __FILE__),
90   device_t(mconfig, SMS_SPORTS_PAD_JP, "Sega SMS 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
r243203r243204
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
r243203r243204
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, "Digital joystick with Boostergrip", tag, owner, clock, "vcs_joystick_booster", __FILE__),
61   device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Atari / CBM 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
r243203r243204
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, "Digital joystick", tag, owner, clock, "vcs_joystick", __FILE__),
54   device_t(mconfig, VCS_JOYSTICK, "Atari / CBM 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
r243203r243204
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, "Keypad", tag, owner, clock, "vcs_keypad", __FILE__),
58   device_t(mconfig, VCS_KEYPAD, "Atari / CBM 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
r243203r243204
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, "Light Pen", tag, owner, clock, "vcs_lightpen", __FILE__),
63   device_t(mconfig, VCS_LIGHTPEN, "Atari / CBM 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
r243203r243204
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, "Digital paddles", tag, owner, clock, "vcs_paddles", __FILE__),
57   device_t(mconfig, VCS_PADDLES, "Atari / CBM 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
r243203r243204
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, "Driving Wheel", tag, owner, clock, "vcs_wheel", __FILE__),
51   device_t(mconfig, VCS_WHEEL, "Atari / CBM 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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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();
r243203r243204
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);
r243203r243204
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   
774773
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
r243203r243204
21422142         size = 8;
21432143      }
21442144
2145   //   c = limm;
2145   //  c = limm;
21462146
21472147   }
21482148   else
r243203r243204
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
r243203r243204
11#!/usr/bin/python
22
33import sys
4import re
54
65def EmitGroup04_Handle_NZ_Flags(f, funcname, opname):
76        print >>f, "      if (result & 0x80000000) { STATUS32_SET_N; }"
r243203r243204
353352try:
354353    f = open(sys.argv[1], "w")
355354except Exception, err:
356    logging.error("cannot write file %s [%s]", fname, err)
355    sys.stderr.write("cannot write file %s [%s]\n" % (sys.argv[1], err))
357356    sys.exit(1)
358357
359358
trunk/src/emu/cpu/h8/h8make.py
r243203r243204
139139        for i in range(0, extra_words):
140140            self.source.append("\tfetch(%d);\n" % (i+base_offset));
141141
142    def description():
142    def description(self):
143143        return "%s %s %s" % (self.name, self.am1, self.am2)
144144   
145145    def add_source_line(self, line):
r243203r243204
451451    try:
452452        f = open(argv[3], "w")
453453    except Exception, err:
454        logging.error("cannot write file %s [%s]", fname, err)
454        sys.stderr.write("cannot write file %s [%s]\n" % (argv[3], err))
455455        sys.exit(1)
456456
457457    opcodes.build_dispatch()
trunk/src/emu/cpu/i386/i386dasm.c
r243203r243204
9898#define ALWAYS64            0x400
9999#define SPECIAL64           0x800
100100#define SPECIAL64_ENT(x)    (SPECIAL64 | ((x) << 24))
101#define GROUP_MOD           0x1000
101102
102103struct I386_OPCODE {
103104   const char *mnemonic;
r243203r243204
425426      "movupd\0"
426427      "movsd\0"
427428      "movss",            MODRM|VAR_NAME4,PARAM_XMMM,         PARAM_XMM,          0               },
429   {"group0F12",      GROUP|GROUP_MOD, 0,                  0,                  0                   },
428430   {"movlps\0"
429431      "movlpd\0"
430      "movddup\0"
431      "movsldup",     MODRM|VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
432   {"movlps\0"
433      "movlpd\0"
434432      "???\0"
435433      "???",              MODRM|VAR_NAME4,PARAM_XMMM,         PARAM_XMM,          0               },
436434   {"unpcklps\0"
r243203r243204
441439      "unpckhpd\0"
442440      "???\0"
443441      "???",              MODRM|VAR_NAME4,PARAM_XMM,          PARAM_XMMM,         0               },
442   { "group0F16",     GROUP|GROUP_MOD, 0,                  0,                  0                   },
444443   {"movhps\0"
445444      "movhpd\0"
446445      "???\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               },
446      "???",              MODRM|VAR_NAME4,PARAM_XMMM,          PARAM_XMM,         0               },
452447   {"group0F18",       GROUP,          0,                  0,                  0               },
453448   {"nop_hint",        0,              PARAM_RMPTR8,               0,                  0               },
454449   {"nop_hint",        0,              PARAM_RMPTR8,               0,                  0               },
r243203r243204
18101805   {"???",             0,              0,                  0,                  0               }
18111806};
18121807
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
18131848static const I386_OPCODE group0F18_table[8] =
18141849{
18151850   {"prefetchnta",     0,              PARAM_RM8,          0,                  0               },
r243203r243204
19161951   { "group0F00",          group0F00_table         },
19171952   { "group0F01",          group0F01_table         },
19181953   { "group0F0D",          group0F0D_table         },
1954   { "group0F12",          group0F12_table         },
1955   { "group0F16",          group0F16_table         },
19191956   { "group0F18",          group0F18_table         },
19201957   { "group0F71",          group0F71_table         },
19211958   { "group0F72",          group0F72_table         },
r243203r243204
19541991
19551992#define MODRM_REG1  ((modrm >> 3) & 0x7)
19561993#define MODRM_REG2  (modrm & 0x7)
1994#define MODRM_MOD   ((modrm >> 6) & 0x3)
19571995
19581996INLINE UINT8 FETCH(void)
19591997{
r243203r243204
29592997         handle_modrm( modrm_string );
29602998         for( i=0; i < ARRAY_LENGTH(group_op_table); i++ ) {
29612999            if( strcmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) {
2962               decode_opcode( s, &group_op_table[i].opcode[MODRM_REG1], op1 );
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 );
29633004               return;
29643005            }
29653006         }
trunk/src/emu/cpu/i386/i386op16.inc
r243203r243204
33303330               ea = GetEA(modrm,1);
33313331            }
33323332            WRITE16(ea, m_gdtr.limit);
3333            WRITE32(ea + 2, m_gdtr.base & 0xffffff);
3333            WRITE32(ea + 2, m_gdtr.base);
33343334            CYCLES(CYCLES_SGDT);
33353335            break;
33363336         }
r243203r243204
33463346               ea = GetEA(modrm,1);
33473347            }
33483348            WRITE16(ea, m_idtr.limit);
3349            WRITE32(ea + 2, m_idtr.base & 0xffffff);
3349            WRITE32(ea + 2, m_idtr.base);
33503350            CYCLES(CYCLES_SIDT);
33513351            break;
33523352         }
trunk/src/emu/cpu/i386/pentops.inc
r243203r243204
22492249   MMXPROLOG();
22502250   UINT8 modrm = FETCH();
22512251   if( modrm >= 0xc0 ) {
2252      MMX_REG ds, sd;
22522253      int s,d;
22532254      s=modrm & 0x7;
22542255      d=(modrm >> 3) & 0x7;
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]);
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]);
22632266   } else {
2264      MMX_REG s;
2267      MMX_REG s,t;
22652268      int d=(modrm >> 3) & 0x7;
22662269      UINT32 ea = GetEA(modrm, 0);
22672270      READMMX(ea, s);
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]);
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]);
22722276      MMX(d).b[4]=SaturatedSignedWordToUnsignedByte(s.s[0]);
22732277      MMX(d).b[5]=SaturatedSignedWordToUnsignedByte(s.s[1]);
22742278      MMX(d).b[6]=SaturatedSignedWordToUnsignedByte(s.s[2]);
r243203r243204
23622366   UINT8 modrm = FETCH();
23632367   if( modrm >= 0xc0 ) {
23642368      int s,d;
2369      INT32 t1, t2, t3, t4;
23652370      s=modrm & 0x7;
23662371      d=(modrm >> 3) & 0x7;
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 {
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 {
23722382      MMX_REG s;
2383      INT32 t1, t2;
23732384      int d=(modrm >> 3) & 0x7;
23742385      UINT32 ea = GetEA(modrm, 0);
23752386      READMMX(ea, s);
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]);
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]);
23802393   }
23812394   CYCLES(1);     // TODO: correct cycle count
23822395}
r243203r243204
27112724{
27122725   UINT8 modrm = FETCH();
27132726   if( modrm >= 0xc0 ) {
2714      // unsupported by cpu
2727      // MOVHLPS opcode
2728      XMM((modrm >> 3) & 0x7).q[0] = XMM(modrm & 0x7).q[1];
27152729      CYCLES(1);     // TODO: correct cycle count
27162730   } else {
2731      // MOVLPS opcode
27172732      UINT32 ea = GetEA(modrm, 0);
27182733      READXMM_LO64(ea, XMM((modrm >> 3) & 0x7));
27192734      CYCLES(1);     // TODO: correct cycle count
r243203r243204
27372752{
27382753   UINT8 modrm = FETCH();
27392754   if( modrm >= 0xc0 ) {
2740      // unsupported by cpu
2755      // MOVLHPS opcode
2756      XMM((modrm >> 3) & 0x7).q[1] = XMM(modrm & 0x7).q[0];
27412757      CYCLES(1);     // TODO: correct cycle count
27422758   } else {
2759      // MOVHPS opcode
27432760      UINT32 ea = GetEA(modrm, 0);
27442761      READXMM_HI64(ea, XMM((modrm >> 3) & 0x7));
27452762      CYCLES(1);     // TODO: correct cycle count
r243203r243204
33673384   CYCLES(1);     // TODO: correct cycle count
33683385}
33693386
3370void i386_device::sse_shufps() // Opcode 0f 67
3387void i386_device::sse_shufps() // Opcode 0f c6
33713388{
33723389   UINT8 modrm = FETCH();
33733390   UINT8 sel = FETCH();
r243203r243204
33803397   s=modrm & 0x7;
33813398   d=(modrm >> 3) & 0x7;
33823399   if( modrm >= 0xc0 ) {
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];
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;
33893409   } else {
3390      UINT32 t;
3410      UINT32 t1,t2;
33913411      XMM_REG src;
33923412      UINT32 ea = GetEA(modrm, 0);
33933413      READXMM(ea, src);
3394      t=XMM(d).d[m1];
3395      XMM(d).d[1]=XMM(d).d[m2];
3396      XMM(d).d[0]=t;
3414      t1=XMM(d).d[m1];
3415      t2=XMM(d).d[m2];
3416      XMM(d).d[0]=t1;
3417      XMM(d).d[1]=t2;
33973418      XMM(d).d[2]=src.d[m3];
33983419      XMM(d).d[3]=src.d[m4];
33993420   }
r243203r243204
34043425{
34053426   UINT8 modrm = FETCH();
34063427   int s,d;
3428   UINT32 t1, t2, t3, t4;
34073429   s=modrm & 0x7;
34083430   d=(modrm >> 3) & 0x7;
34093431   if( modrm >= 0xc0 ) {
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];
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;
34143440   } else {
34153441      XMM_REG src;
34163442      UINT32 ea = GetEA(modrm, 0);
34173443      READXMM(ea, src);
3444      t2 = XMM(d).d[1];
34183445      XMM(d).d[3]=src.d[1];
3419      XMM(d).d[2]=XMM(d).d[1];
3446      XMM(d).d[2]=t2;
34203447      XMM(d).d[1]=src.d[0];
34213448   }
34223449   CYCLES(1);     // TODO: correct cycle count
r243203r243204
34263453{
34273454   UINT8 modrm = FETCH();
34283455   int s,d;
3456   UINT32 t1, t2, t3, t4;
34293457   s=modrm & 0x7;
34303458   d=(modrm >> 3) & 0x7;
34313459   if( modrm >= 0xc0 ) {
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];
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;
34363468   } else {
34373469      XMM_REG src;
34383470      UINT32 ea = GetEA(modrm, 0);
34393471      READXMM(ea, src);
3440      XMM(d).d[0]=XMM(d).d[2];
3472      t1 = XMM(d).d[2];
3473      t3 = XMM(d).d[3];
3474      XMM(d).d[0]=t1;
34413475      XMM(d).d[1]=src.d[2];
3442      XMM(d).d[2]=XMM(d).d[3];
3476      XMM(d).d[2]=t3;
34433477      XMM(d).d[3]=src.d[3];
34443478   }
34453479   CYCLES(1);     // TODO: correct cycle count
trunk/src/emu/cpu/m68000/m68k_in.c
r243203r243204
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
r243203r243204
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
r243203r243204
3232
3333#include <limits.h>
3434
35#ifdef SDLMAME_SOLARIS
36#undef REG_SP
37#undef REG_PC
38#undef REG_FP
39#endif
3540
3641/* ======================================================================== */
3742/* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */
trunk/src/emu/cpu/m68000/m68kfpu.inc
r243203r243204
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
r243203r243204
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
r243203r243204
11#!/usr/bin/python
22
33import sys
4import logging
5import fileinput
64import re
75
86# Initial state
trunk/src/emu/cpu/mcs96/mcs96make.py
r243203r243204
175175    try:
176176        f = open(argv[3], "w")
177177    except Exception, err:
178        logging.error("cannot write file %s [%s]", fname, err)
178        sys.stderr.write("cannot write file %s [%s]\n" % (argv[3], err))
179179        sys.exit(1)
180180   
181181    if t != "mcs96":
trunk/src/emu/cpu/mips/mips3drc.c
r243203r243204
10131013    an exception if out
10141014-------------------------------------------------*/
10151015
1016void mips3_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
1016void mips3_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
10171017{
10181018   /* check software interrupts if pending */
10191019   if (compiler->checksoftints)
trunk/src/emu/cpu/powerpc/ppccom.c
r243203r243204
693693   m_hotspot_select = 0;
694694   memset(m_hotspot, 0, sizeof(m_hotspot));
695695
696   m_debugger_temp = 0;
697
696698   m_cache_line_size = 32;
697699   m_cpu_clock = clock();
698700   m_program = &space(AS_PROGRAM);
trunk/src/emu/cpu/powerpc/ppcdrc.c
r243203r243204
5757***************************************************************************/
5858
5959#define R32(reg)                m_regmap[reg]
60#define R32Z(reg)               (((reg) == 0) ? parameter(0) : m_regmap[reg])
60#define R32Z(reg)               (((reg) == 0) ? uml::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)
r243203r243204
15491549    an exception if out
15501550-------------------------------------------------*/
15511551
1552void ppc_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, parameter param, int allow_exception)
1552void ppc_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
15531553{
15541554   /* check full interrupts if pending */
15551555   if (compiler->checkints)
trunk/src/emu/cpu/rsp/rspdrc.c
r243203r243204
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, parameter param, int allow_exception)
644void rsp_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
645645{
646646   /* account for cycles */
647647   if (compiler->cycles > 0)
trunk/src/emu/cpu/sh2/sh2drc.c
r243203r243204
9191   {
9292      if (m_regmap[regnum].is_int_register())
9393      {
94         UML_MOV(block, parameter::make_ireg(m_regmap[regnum].ireg()), mem(&m_sh2_state->r[regnum]));
94         UML_MOV(block, uml::parameter::make_ireg(m_regmap[regnum].ireg()), mem(&m_sh2_state->r[regnum]));
9595      }
9696   }
9797}
r243203r243204
110110   {
111111      if (m_regmap[regnum].is_int_register())
112112      {
113         UML_MOV(block, mem(&m_sh2_state->r[regnum]), parameter::make_ireg(m_regmap[regnum].ireg()));
113         UML_MOV(block, mem(&m_sh2_state->r[regnum]), uml::parameter::make_ireg(m_regmap[regnum].ireg()));
114114      }
115115   }
116116}
r243203r243204
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, parameter param, int allow_exception)
1223void sh2_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, int allow_exception)
12241224{
12251225   /* check full interrupts if pending */
12261226   if (compiler->checkints)
trunk/src/emu/cpu/tms0980/tms0980.c
r243203r243204
429429   m_sr = 0;
430430   m_pa = 0;
431431   m_pb = 0;
432   m_ps = 0;
432433   m_a = 0;
433434   m_x = 0;
434435   m_y = 0;
r243203r243204
466467   save_item(NAME(m_sr));
467468   save_item(NAME(m_pa));
468469   save_item(NAME(m_pb));
470   save_item(NAME(m_ps));
469471   save_item(NAME(m_a));
470472   save_item(NAME(m_x));
471473   save_item(NAME(m_y));
r243203r243204
636638   tms1100_cpu_device::device_reset();
637639
638640   // small differences in 00-3f area
639   m_fixed_decode[0x09] = F_COMX; // !
640641   m_fixed_decode[0x0b] = F_TPC;
641642}
642643
r243203r243204
958959//-------------------------------------------------
959960
960961// handle branches:
962
963// TMS1000/common
961964// note: add(latch) and bl(branch latch) are specific to 0980 series,
962965// c(chapter) bits are specific to 1100(and 1400) series
963966
964// TMS1000/common:
965
966967void tms1xxx_cpu_device::op_br()
967968{
968969   // BR/BL: conditional branch
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;
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   }
976977}
977978
978979void tms1xxx_cpu_device::op_call()
979980{
980981   // CALL/CALLL: conditional call
981   if (!m_status)
982      return;
982   if (m_status)
983   {
984      UINT8 prev_pa = m_pa;
983985
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;
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;
991996   }
992   m_ca = m_cb;
993   m_pb = prev_pa;
994   m_pc = m_opcode & m_pc_mask;
995997}
996998
997999void tms1xxx_cpu_device::op_retn()
9981000{
9991001   // RETN: return from subroutine
1000   if (m_clatch)
1002   if (m_clatch == 1)
10011003   {
1004      m_clatch = 0;
10021005      m_pc = m_sr;
1003      m_clatch = 0;
10041006      m_ca = m_cs;
10051007   }
10061008   m_add = 0;
r243203r243204
10141016void tms1400_cpu_device::op_br()
10151017{
10161018   // BR/BL: conditional branch
1017   if (!m_status)
1018      return;
1019   
1020   //..
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   }
10211025}
10221026
10231027void tms1400_cpu_device::op_call()
10241028{
10251029   // CALL/CALLL: conditional call
1026   if (!m_status)
1027      return;
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;
10281034
1029   //..
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   }
10301049}
10311050
10321051void tms1400_cpu_device::op_retn()
10331052{
10341053   // RETN: return from subroutine
1035   //..
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   }
10361067}
10371068
10381069
10391070// handle other:
10401071
1041// TMS1000/common:
1072// TMS1000/common
10421073
10431074void tms1xxx_cpu_device::op_sbit()
10441075{
r243203r243204
11581189
11591190
11601191// TMS0980-specific (and possibly child classes)
1192
11611193void tms0980_cpu_device::op_comx()
11621194{
11631195   // COMX: complement X register, but not the MSB
r243203r243204
12031235
12041236
12051237// TMS0270-specific
1238
12061239void tms0270_cpu_device::op_setr()
12071240{
12081241   // same as default, but handle write to output in dynamic_output
trunk/src/emu/cpu/tms0980/tms0980.h
r243203r243204
139139   optional_device<pla_device> m_spla;
140140
141141   UINT8   m_pc;        // 6 or 7-bit program counter
142   UINT8  m_sr;        // 6 or 7-bit subroutine return register
142   UINT32  m_sr;        // 6 or 7-bit subroutine return register(s)
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)
145146   UINT8   m_a;         // 4-bit accumulator
146147   UINT8   m_x;         // 2,3,or 4-bit RAM X register
147148   UINT8   m_y;         // 4-bit RAM Y register
148   UINT8   m_ca;        // chapter address bit
149   UINT8   m_cb;        // chapter buffer bit
150   UINT8   m_cs;        // chapter subroutine bit
149   UINT8   m_ca;        // chapter address register
150   UINT8   m_cb;        // chapter buffer register
151   UINT16  m_cs;        // chapter subroutine register(s)
151152   UINT16  m_r;
152153   UINT16  m_o;
153154   UINT8   m_cki_bus;
r243203r243204
160161   UINT8   m_status;
161162   UINT8   m_status_latch;
162163   UINT8   m_eac;       // end around carry bit
163   UINT8   m_clatch;    // call latch bit
164   UINT8   m_clatch;    // call latch bit(s)
164165   UINT8   m_add;       // add latch bit
165166   UINT8   m_bl;        // branch latch bit
166167
trunk/src/emu/cpu/tms57002/tmsmake.py
r243203r243204
417417try:
418418    f = open(sys.argv[2], "w")
419419except Exception, err:
420    logging.error("cannot write file %s [%s]", fname, err)
420    sys.stderr.write("cannot write file %s [%s]\n" % (sys.argv[2], err))
421421    sys.exit(1)
422422
423423EmitDasm(f, ins_list)
trunk/src/emu/devfind.c
r243203r243204
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
r243203r243204
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
r243203r243204
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//-------------------------------------------------
189206//  static_set_clock - set/change the clock on
190207//  a device
191208//-------------------------------------------------
trunk/src/emu/device.h
r243203r243204
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;
133134
134135   // interface helpers
135136   device_interface *first_interface() const { return m_interface_list; }
trunk/src/emu/distate.c
r243203r243204
4949//  device_state_entry - constructor
5050//-------------------------------------------------
5151
52device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size)
53   : m_next(NULL),
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),
5455      m_index(index),
5556      m_dataptr(dataptr),
5657      m_datamask(0),
r243203r243204
8687      m_symbol.cpy("CURFLAGS");
8788}
8889
89device_state_entry::device_state_entry(int index)
90   : m_next(NULL),
90device_state_entry::device_state_entry(int index, device_state_interface *dev)
91   : m_device_state(dev),
92      m_next(NULL),
9193      m_index(index),
9294      m_dataptr(NULL),
9395      m_datamask(0),
r243203r243204
523525   assert(symbol != NULL);
524526
525527   // allocate new entry
526   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size));
528   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size, this));
527529
528530   // append to the end of the list
529531   m_state_list.append(*entry);
r243203r243204
543545device_state_entry &device_state_interface::state_add_divider(int index)
544546{
545547   // allocate new entry
546   device_state_entry *entry = global_alloc(device_state_entry(index));
548   device_state_entry *entry = global_alloc(device_state_entry(index, this));
547549
548550   // append to the end of the list
549551   m_state_list.append(*entry);
trunk/src/emu/distate.h
r243203r243204
4545{
4646   friend class device_state_interface;
4747   friend class simple_list<device_state_entry>;
48   friend class lua_engine;
4948
5049private:
5150   // construction/destruction
52   device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size);
53   device_state_entry(int index);
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);
5453
5554public:
5655   // post-construction modifiers
r243203r243204
7069   const char *symbol() const { return m_symbol; }
7170   bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
7271   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
r243203r243204
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
101102   device_state_entry *    m_next;                 // link to next item
102103   UINT32                  m_index;                // index by which this item is referred
103104   generic_ptr             m_dataptr;              // pointer to where the data lives
trunk/src/emu/emu.h
r243203r243204
8282// machine and driver configuration
8383#include "mconfig.h"
8484#include "gamedrv.h"
85#include "parameters.h"
8586
8687// timers, CPU and scheduling
8788#include "devcpu.h"
trunk/src/emu/emu.mak
r243203r243204
9999   $(EMUOBJ)/memarray.o \
100100   $(EMUOBJ)/memory.o \
101101   $(EMUOBJ)/network.o \
102   $(EMUOBJ)/parameters.o \
102103   $(EMUOBJ)/output.o \
103104   $(EMUOBJ)/render.o \
104105   $(EMUOBJ)/rendfont.o \
r243203r243204
120121   $(EMUOBJ)/ui/mainmenu.o \
121122   $(EMUOBJ)/ui/miscmenu.o \
122123   $(EMUOBJ)/ui/barcode.o \
124   $(EMUOBJ)/ui/cheatopt.o \
123125   $(EMUOBJ)/ui/devopt.o \
124126   $(EMUOBJ)/ui/filemngr.o \
125127   $(EMUOBJ)/ui/filesel.o \
126128   $(EMUOBJ)/ui/imgcntrl.o \
127   $(EMUOBJ)/ui/imginfo.o \
129   $(EMUOBJ)/ui/info.o \
128130   $(EMUOBJ)/ui/inputmap.o \
129131   $(EMUOBJ)/ui/selgame.o \
132   $(EMUOBJ)/ui/sliders.o \
130133   $(EMUOBJ)/ui/slotopt.o \
131134   $(EMUOBJ)/ui/swlist.o \
132135   $(EMUOBJ)/ui/tapectrl.o \
136   $(EMUOBJ)/ui/videoopt.o \
133137   $(EMUOBJ)/ui/viewgfx.o \
134138   $(EMUOBJ)/validity.o \
135139   $(EMUOBJ)/video.o \
r243203r243204
149153   $(EMUOBJ)/profiler.o \
150154   $(EMUOBJ)/webengine.o \
151155   $(OSDOBJ)/osdnet.o \
152   $(OSDOBJ)/modules/sound/none.o \
153   $(OSDOBJ)/modules/debugger/none.o \
154   $(OSDOBJ)/modules/debugger/debugint.o \
155156
156157EMUSOUNDOBJS = \
157158   $(EMUOBJ)/sound/filter.o \
trunk/src/emu/emucore.c
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
278278         }
279279      }
280280   }
281   while (add_slot_options(false));
282   add_device_options(false);
281283}
282284
283285
r243203r243204
365367   do {
366368      num = options_count();
367369      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
r243203r243204
502502      do {
503503         num = options_count();
504504         update_slot_options();
505         while (add_slot_options(false));
506         add_device_options(false);
507505      } while(num != options_count());
508506   }
509507}
trunk/src/emu/emuopts.h
r243203r243204
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
r243203r243204
237237         }
238238      }
239239   }
240}
240241
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());
241252   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
242253   {
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      }
254      if (image->filename() == NULL && image->must_be_loaded())
255         mandatory.cat("\"").cat(image->instance_name()).cat("\", ");
254256   }
257   return mandatory;
255258}
256259
257260/*-------------------------------------------------
trunk/src/emu/image.h
r243203r243204
2020
2121void image_init(running_machine &machine);
2222void image_postdevice_init(running_machine &machine);
23astring &image_mandatory_scan(running_machine &machine, astring &mandatory);
2324
2425extern struct io_procs image_ioprocs;
2526
trunk/src/emu/luaengine.c
r243203r243204
11// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic
2// copyright-holders:Miodrag Milanovic,Luca Bruno
33/***************************************************************************
44
55    luaengine.c
r243203r243204
130130   cb = -1;
131131}
132132
133#ifdef SDLMAME_SOLARIS
134#undef _L
135#endif
136
133137void lua_engine::hook::set(lua_State *_L, int idx)
134138{
135139   if (L)
r243203r243204
456460}
457461
458462//-------------------------------------------------
459//  state_get_value - return value of a devices state
463//  state_get_value - return value of a device state entry
460464//  -> manager:machine().devices[":maincpu"].state["PC"].value
461465//-------------------------------------------------
462466
463467UINT64 lua_engine::l_state_get_value(const device_state_entry *d)
464468{
465   return d->value();
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   }
466476}
467477
468478//-------------------------------------------------
469//  state_set_value - set value of a devices state
479//  state_set_value - set value of a device state entry
470480//  -> manager:machine().devices[":maincpu"].state["D0"].value = 0x0c00
471481//-------------------------------------------------
472482
473483void lua_engine::l_state_set_value(device_state_entry *d, UINT64 val)
474484{
475   d->set_value(val);
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   }
476490}
477491
478492//-------------------------------------------------
r243203r243204
527541}
528542
529543//-------------------------------------------------
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//-------------------------------------------------
530622//  draw_box - draw a box on a screen container
531623//  -> manager:machine().screens[":screen"]:draw_box(x1, y1, x2, y2, bgcolor, linecolor)
532624//-------------------------------------------------
r243203r243204
548640
549641   // retrieve all parameters
550642   float x1, y1, x2, y2;
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);
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);
555647   UINT32 bgcolor = lua_tounsigned(L, 6);
556648   UINT32 fgcolor = lua_tounsigned(L, 7);
557649
r243203r243204
584676
585677   // retrieve all parameters
586678   float x1, y1, x2, y2;
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);
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);
591683   UINT32 color = lua_tounsigned(L, 6);
592684
593685   // draw the line
r243203r243204
613705   luaL_argcheck(L, lua_isstring(L, 4), 4, "message (string) expected");
614706
615707   // retrieve all parameters
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);
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);
618710   const char *msg = luaL_checkstring(L,4);
619711   // TODO: add optional parameters (colors, etc.)
620712
r243203r243204
622714   render_container &rc = sc->container();
623715   ui_manager &ui = sc->machine().ui();
624716   ui.draw_text_full(&rc, msg, x, y , (1.0f - x),
625                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
626                  UI_TEXT_BG_COLOR, NULL, NULL);
717                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
718                  UI_TEXT_BG_COLOR, NULL, NULL);
627719
628720   return 0;
629721}
r243203r243204
882974            .addCFunction ("read_u32", &lua_addr_space::l_mem_read<UINT32>)
883975            .addCFunction ("read_i64", &lua_addr_space::l_mem_read<INT64>)
884976            .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>)
885985         .endClass()
886986         .deriveClass <address_space, lua_addr_space> ("addr_space")
887987            .addFunction("name", &address_space::name)
r243203r243204
890990            .addCFunction ("draw_box",  &lua_screen::l_draw_box)
891991            .addCFunction ("draw_line", &lua_screen::l_draw_line)
892992            .addCFunction ("draw_text", &lua_screen::l_draw_text)
993            .addCFunction ("height", &lua_screen::l_height)
994            .addCFunction ("width", &lua_screen::l_width)
893995         .endClass()
894996         .deriveClass <screen_device, lua_screen> ("screen_dev")
997            .addFunction ("frame_number", &screen_device::frame_number)
895998            .addFunction ("name", &screen_device::name)
896999            .addFunction ("shortname", &screen_device::shortname)
8971000            .addFunction ("tag", &screen_device::tag)
898            .addFunction ("height", &screen_device::height)
899            .addFunction ("width", &screen_device::width)
9001001         .endClass()
9011002         .beginClass <device_state_entry> ("dev_space")
9021003            .addFunction ("name", &device_state_entry::symbol)
trunk/src/emu/luaengine.h
r243203r243204
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);
115116   };
116117   static luabridge::LuaRef l_machine_get_screens(const running_machine *r);
117118   struct lua_screen {
119      int l_height(lua_State *L);
120      int l_width(lua_State *L);
118121      int l_draw_box(lua_State *L);
119122      int l_draw_line(lua_State *L);
120123      int l_draw_text(lua_State *L);
trunk/src/emu/machine.c
r243203r243204
108108
109109osd_interface &running_machine::osd() const
110110{
111    return m_manager.osd();
111   return m_manager.osd();
112112}
113113
114114//-------------------------------------------------
r243203r243204
142142      m_save(*this),
143143      m_memory(*this),
144144      m_ioport(*this),
145      m_parameters(*this),
145146      m_scheduler(*this)
146147{
147148   memset(&m_base_time, 0, sizeof(m_base_time));
trunk/src/emu/machine.h
r243203r243204
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; }
168169   cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; }
169170   render_manager &render() const { assert(m_render != NULL); return *m_render; }
170171   input_manager &input() const { assert(m_input != NULL); return *m_input; }
r243203r243204
357358   save_manager            m_save;                 // save manager
358359   memory_manager          m_memory;               // memory manager
359360   ioport_manager          m_ioport;               // I/O port manager
361   parameters_manager      m_parameters;           // parameters manager
360362   device_scheduler        m_scheduler;            // scheduler object
361363   emu_timer               *m_autoboot_timer;      // autoboot timer
362364};
trunk/src/emu/machine/6522via.c
r243203r243204
223223   save_item(NAME(m_acr));
224224   save_item(NAME(m_ier));
225225   save_item(NAME(m_ifr));
226   save_item(NAME(m_time1));
226227   save_item(NAME(m_t1_active));
227228   save_item(NAME(m_t1_pb7));
229   save_item(NAME(m_time2));
228230   save_item(NAME(m_t2_active));
229231   save_item(NAME(m_shift_counter));
230232}
trunk/src/emu/machine/bcreader.c
r243203r243204
269269   {
270270      if (m_byte_count < m_byte_length)
271271      {
272         UINT8 val = m_pixel_data[m_byte_count];
272         UINT8 val = m_byte_data[m_byte_count];
273273         m_byte_count++;
274274         return val;
275275      }
trunk/src/emu/machine/bcreader.h
r243203r243204
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; }
2830   UINT8 read_code();
2931   int read_pixel();
3032
trunk/src/emu/machine/intelfsh.c
r243203r243204
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
105107const device_type SST_39VF400A = &device_creator<sst_39vf400a_device>;
106108
107109static ADDRESS_MAP_START( memory_map8_512Kb, AS_PROGRAM, 8, intelfsh_device )
r243203r243204
246248      m_sector_is_4k = true;
247249      map = ADDRESS_MAP_NAME( memory_map16_32Mb );
248250      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;
249259   case FLASH_SST_39VF020:
250260      m_bits = 8;
251261      m_size = 0x40000;
r243203r243204
446456intel_28f320j3d_device::intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
447457   : intelfsh16_device(mconfig, INTEL_28F320J3D, "Intel 28F320J3D Flash", tag, owner, clock, FLASH_INTEL_28F320J3D, "intel_28f320j3d", __FILE__) { }
448458
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
449463sst_39vf400a_device::sst_39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
450464   : intelfsh16_device(mconfig, SST_39VF400A, "SST 39VF400A Flash", tag, owner, clock, FLASH_SST_39VF400A, "sst_39vf400a", __FILE__) { }
451465
trunk/src/emu/machine/intelfsh.h
r243203r243204
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
8588#define MCFG_SST_39VF400A_ADD(_tag) \
8689   MCFG_DEVICE_ADD(_tag, SST_39VF400A, 0)
8790
r243203r243204
128131      FLASH_INTEL_TE28F160,
129132      FLASH_SHARP_UNK128MBIT,
130133      FLASH_INTEL_28F320J3D,
134      FLASH_INTEL_28F320J5,
131135      FLASH_SST_39VF400A
132136   };
133137
r243203r243204
363367   intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
364368};
365369
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
366376class sst_39vf400a_device : public intelfsh16_device
367377{
368378public:
r243203r243204
397407extern const device_type INTEL_TE28F160;
398408extern const device_type SHARP_UNK128MBIT;
399409extern const device_type INTEL_28F320J3D;
410extern const device_type INTEL_28F320J5;
400411extern const device_type SST_39VF400A;
401412
402413#endif
trunk/src/emu/machine/jvshost.c
r243203r243204
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      // "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;
52   } /*
53        Naomi suchie3 have bad working controls with this
5754
58   } else {
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 */ {
5962      if(first_device) {
6063         first_device->message(send_buffer[0], send_buffer+2, send_size-2, recv_buffer+2, recv_size);
6164         recv_is_encoded = false;
trunk/src/emu/machine/netlist.c
r243203r243204
4848#include "netlist.h"
4949#include "netlist/nl_base.h"
5050#include "netlist/nl_setup.h"
51#include "netlist/nl_factory.h"
5152#include "netlist/devices/net_lib.h"
5253#include "debugger.h"
5354
r243203r243204
134135   pstring dname = "OUT_" + m_in;
135136   m_delegate.bind_relative_to(owner()->machine().root_device());
136137   NETLIB_NAME(analog_callback) *dev = downcast<NETLIB_NAME(analog_callback) *>(
137         setup.factory().new_device_by_classname("nld_analog_callback", setup));
138         setup.register_dev("nld_analog_callback", dname));
138139
139   setup.register_dev(dev, dname);
140140   dev->register_callback(m_delegate);
141141   setup.register_link(dname + ".IN", m_in);
142142}
r243203r243204
208208{
209209   NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device<NETLIB_NAME(sound_in)>();
210210   if (snd_in == NULL)
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   }
211      snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.register_dev("nld_sound_in", "STREAM_INPUT"));
215212
216213   pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel);
217214   setup.register_param(sparam, m_param_name);
r243203r243204
247244
248245void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &setup)
249246{
250   NETLIB_NAME(sound_out) *snd_out;
247   //NETLIB_NAME(sound_out) *snd_out;
251248   pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel);
252249
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);
250   //snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname));
251   setup.register_dev("nld_sound_out", sname);
255252
256253   setup.register_param(sname + ".CHAN" , m_channel);
257254   setup.register_param(sname + ".MULT",  m_mult);
r243203r243204
443440               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
444441            }
445442            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;
446449         case DT_INT64:
447450            save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
448451            break;
trunk/src/emu/mame.c
r243203r243204
9494
9595osd_interface &machine_manager::osd() const
9696{
97    return m_osd;
97   return m_osd;
9898}
9999
100100
trunk/src/emu/memory.c
r243203r243204
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(), endianness());
1814   m_map->uplift_submaps(machine(), m_device, m_device.owner() ? *m_device.owner() : m_device, 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
r243203r243204
1111{
1212public:
1313   diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
14   diode(const double Is, const double n)
14   diode(const nl_double Is, const nl_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 double Is, const double n)
20   void set(const nl_double Is, const nl_double n)
2121   {
2222      m_Is = Is;
2323      m_VT = 0.0258 * n;
2424      m_VT_inv = 1.0 / m_VT;
2525   }
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); }
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); }
3030
3131private:
32   double m_Is;
33   double m_VT;
34   double m_VT_inv;
32   nl_double m_Is;
33   nl_double m_VT;
34   nl_double m_VT_inv;
3535};
3636
3737
r243203r243204
8585   m_state_on = 0;
8686
8787   {
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);
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);
9292
9393      set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP);
9494
95      double alpha = BF / (1.0 + BF);
95      nl_double alpha = BF / (1.0 + BF);
9696
9797      diode d(IS, NF);
9898
r243203r243204
155155   m_gD_BC.save("m_D_BC", *this);
156156
157157   {
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);
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);
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
r243203r243204
9898
9999   NETLIB_UPDATE_TERMINALS()
100100   {
101      const double m = (is_qtype( BJT_NPN) ? 1 : -1);
101      const nl_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         double gb = m_gB;
108         double gc = m_gC;
109         double v  = m_V * m;
107         nl_double gb = m_gB;
108         nl_double gc = m_gC;
109         nl_double v  = m_V * m;
110110         if (!new_state )
111111         {
112112            // not conducting
r243203r243204
115115            gc = netlist().gmin();
116116         }
117117#else
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;
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;
121121#endif
122122         m_RB.set(gb, v,   0.0);
123123         m_RC.set(gc, 0.0, 0.0);
r243203r243204
142142   ATTR_COLD virtual void start();
143143   ATTR_HOT void update_param();
144144
145   double m_gB; // base conductance / switch on
146   double m_gC; // collector conductance / switch on
147   double m_V; // internal voltage source
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
148148   UINT8 m_state_on;
149149
150150private:
r243203r243204
169169
170170   NETLIB_UPDATE_TERMINALS()
171171   {
172      const double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0);
172      const nl_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 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;
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;
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);
r243203r243204
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   double m_alpha_f;
206   double m_alpha_r;
205   nl_double m_alpha_f;
206   nl_double m_alpha_r;
207207
208208private:
209209};
trunk/src/emu/netlist/analog/nld_fourterm.c
r243203r243204
1717   m_gfac = 1.0;
1818}
1919
20void NETLIB_NAME(VCCS)::start_internal(const double def_RI)
20void NETLIB_NAME(VCCS)::start_internal(const nl_double def_RI)
2121{
2222   register_param("G", m_G, 1.0);
2323   register_param("RI", m_RI, def_RI);
r243203r243204
4545
4646NETLIB_RESET(VCCS)
4747{
48   const double m_mult = m_G.Value() * m_gfac; // 1.0 ==> 1V ==> 1A
49   const double GI = 1.0 / m_RI.Value();
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();
5050
5151   m_IP.set(GI);
5252   m_IN.set(GI);
trunk/src/emu/netlist/analog/nld_fourterm.h
r243203r243204
5959   ATTR_COLD virtual void update_param();
6060   ATTR_HOT ATTR_ALIGN void update();
6161
62   ATTR_COLD void start_internal(const double def_RI);
62   ATTR_COLD void start_internal(const nl_double def_RI);
6363
6464   netlist_terminal_t m_OP;
6565   netlist_terminal_t m_ON;
r243203r243204
7373   netlist_param_double_t m_G;
7474   netlist_param_double_t m_RI;
7575
76   double m_gfac;
76   nl_double m_gfac;
7777};
7878
7979// ----------------------------------------------------------------------------------------
r243203r243204
115115   ATTR_COLD virtual void update_param();
116116   ATTR_HOT ATTR_ALIGN void update();
117117
118   double m_gfac;
118   nl_double m_gfac;
119119};
120120
121121
trunk/src/emu/netlist/analog/nld_ms_direct.h
r243203r243204
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
r243203r243204
2828protected:
2929   ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term);
3030
31   ATTR_HOT virtual double vsolve();
31   ATTR_HOT virtual nl_double vsolve();
3232
3333   ATTR_HOT int solve_non_dynamic();
3434   ATTR_HOT void build_LE();
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);
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);
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 double compute_next_timestep();
43   ATTR_HOT nl_double compute_next_timestep();
4444
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];
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];
5050
5151   terms_t **m_terms;
5252   terms_t *m_rails_temp;
r243203r243204
5555   vector_ops_t *m_row_ops[_storage_N + 1];
5656
5757   int m_dim;
58   double m_lp_fact;
58   nl_double m_lp_fact;
5959};
6060
6161// ----------------------------------------------------------------------------------------
r243203r243204
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()]);
7278   //delete[] m_last_RHS;
7379   //delete[] m_RHS;
74   delete[] m_terms;
75   delete[] m_rails_temp;
80   nl_free_array(m_terms);
81   nl_free_array(m_rails_temp);
7682   //delete[] m_row_ops;
7783
7884}
7985
8086template <int m_N, int _storage_N>
81ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
87ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
8288{
83   double new_solver_timestep = m_params.m_max_timestep;
89   nl_double new_solver_timestep = m_params.m_max_timestep;
8490
8591   if (m_params.m_dynamic)
8692   {
r243203r243204
97103      {
98104         netlist_analog_net_t *n = m_nets[k];
99105#endif
100         const double DD_n = (n->m_cur_Analog - m_last_V[k]);
101         const double hn = current_timestep();
106         const nl_double DD_n = (n->m_cur_Analog - m_last_V[k]);
107         const nl_double hn = current_timestep();
102108
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;
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;
105111
106112         n->m_h_n_m_1 = hn;
107113         n->m_DD_n_m_1 = DD_n;
r243203r243204
187193    * Sorting as a general matrix pre-conditioning is mentioned in
188194    * literature but I have found no articles about Gauss Seidel.
189195    *
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     *
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    *
193199    */
194200
195    int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
201   int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
196202
197203   for (int k = 0; k < N() / 2; k++)
198204      for (int i = 0; i < N() - 1; i++)
199205      {
200            if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
206         if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
201207         {
202208            std::swap(m_terms[i],m_terms[i+1]);
203209            m_nets.swap(i, i+1);
r243203r243204
230236      for (int i=0; i < N(); i++)
231237         m_A[k][i] = 0.0;
232238
233      double rhsk = 0.0;
234      double akk  = 0.0;
239      nl_double rhsk = 0.0;
240      nl_double akk  = 0.0;
235241      {
236242         const int terms_count = m_terms[k]->count();
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();
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();
240246#if VECTALT
241247
242248         for (int i = 0; i < terms_count; i++)
r243203r243204
247253#else
248254         m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk);
249255#endif
250         double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
256         nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
251257         for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
252258         {
253259            //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
r243203r243204
266272      m_A[k][k] += 1.0;
267273      {
268274         const int *net_other = m_terms[k]->net_other();
269         const double *go = m_terms[k]->go();
275         const nl_double *go = m_terms[k]->go();
270276         const int railstart =  m_terms[k]->m_railstart;
271277
272278         for (int i = 0; i < railstart; i++)
r243203r243204
279285      m_A[k][k] += akk;
280286      {
281287         const int * RESTRICT net_other = m_terms[k]->net_other();
282         const double * RESTRICT go = m_terms[k]->go();
288         const nl_double * RESTRICT go = m_terms[k]->go();
283289         const int railstart =  m_terms[k]->m_railstart;
284290
285291         for (int i = 0; i < railstart; i++)
r243203r243204
293299
294300template <int m_N, int _storage_N>
295301ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE(
296      double (* RESTRICT x))
302      nl_double (* RESTRICT x))
297303{
298304#if 0
299305   for (int i = 0; i < N(); i++)
r243203r243204
330336      }
331337
332338      /* FIXME: Singular matrix? */
333      const double f = 1.0 / m_A[i][i];
339      const nl_double f = 1.0 / m_A[i][i];
334340
335341      /* Eliminate column i from row j */
336342
337343      for (int j = i + 1; j < kN; j++)
338344      {
339         const double f1 = - m_A[j][i] * f;
345         const nl_double f1 = - m_A[j][i] * f;
340346         if (f1 != 0.0)
341347         {
342348#if 0 && VECTALT
r243203r243204
353359   /* back substitution */
354360   for (int j = kN - 1; j >= 0; j--)
355361   {
356      double tmp = 0;
362      nl_double tmp = 0;
357363
358364      for (int k = j + 1; k < kN; k++)
359365         tmp += m_A[j][k] * x[k];
r243203r243204
374380}
375381
376382template <int m_N, int _storage_N>
377ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
378      const double (* RESTRICT V))
383ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
384      const nl_double (* RESTRICT V))
379385{
380   double cerr = 0;
381   double cerr2 = 0;
386   nl_double cerr = 0;
387   nl_double cerr2 = 0;
382388   for (int i = 0; i < this->N(); i++)
383389   {
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]);
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]);
386392      cerr = (fabs(e) > cerr ? fabs(e) : cerr);
387393      cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2);
388394   }
r243203r243204
392398
393399template <int m_N, int _storage_N>
394400ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store(
395      const double (* RESTRICT V), const bool store_RHS)
401      const nl_double (* RESTRICT V), const bool store_RHS)
396402{
397403   for (int i = 0; i < this->N(); i++)
398404   {
r243203r243204
408414}
409415
410416template <int m_N, int _storage_N>
411ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
417ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
412418{
413419   solve_base<netlist_matrix_solver_direct_t>(this);
414420   return this->compute_next_timestep();
r243203r243204
418424template <int m_N, int _storage_N>
419425ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic()
420426{
421   double new_v[_storage_N] = { 0.0 };
427   nl_double new_v[_storage_N] = { 0.0 };
422428
423429   this->gauss_LE(new_v);
424430
425431   if (this->is_dynamic())
426432   {
427      double err = delta(new_v);
433      nl_double err = delta(new_v);
428434
429435      store(new_v, true);
430436
r243203r243204
452458, m_dim(size)
453459, m_lp_fact(0)
454460{
455   m_terms = new terms_t *[N()];
456   m_rails_temp = new terms_t[N()];
461   m_terms = nl_alloc_array(terms_t *, N());
462   m_rails_temp = nl_alloc_array(terms_t, N());
457463
458464   for (int k = 0; k < N(); k++)
459465   {
460      m_terms[k] = new terms_t;
466      m_terms[k] = nl_alloc(terms_t);
461467      m_row_ops[k] = vector_ops_t::create_ops(k);
462468   }
463469   m_row_ops[N()] = vector_ops_t::create_ops(N());
r243203r243204
469475, m_dim(size)
470476, m_lp_fact(0)
471477{
472    m_terms = new terms_t *[N()];
473    m_rails_temp = new terms_t[N()];
478   m_terms = nl_alloc_array(terms_t *, N());
479   m_rails_temp = nl_alloc_array(terms_t, N());
474480
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());
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());
481487}
482488
483489
trunk/src/emu/netlist/analog/nld_ms_direct1.h
r243203r243204
1818      {}
1919   ATTR_HOT inline int vsolve_non_dynamic();
2020protected:
21   ATTR_HOT virtual double vsolve();
21   ATTR_HOT virtual nl_double vsolve();
2222private:
2323};
2424
r243203r243204
2626// netlist_matrix_solver - Direct1
2727// ----------------------------------------------------------------------------------------
2828
29ATTR_HOT double netlist_matrix_solver_direct1_t::vsolve()
29ATTR_HOT nl_double netlist_matrix_solver_direct1_t::vsolve()
3030{
3131   solve_base<netlist_matrix_solver_direct1_t>(this);
3232   return this->compute_next_timestep();
r243203r243204
3838   this->build_LE();
3939   //NL_VERBOSE_OUT(("%f %f\n", new_val, m_RHS[0] / m_A[0][0]);
4040
41   double new_val =  m_RHS[0] / m_A[0][0];
41   nl_double new_val =  m_RHS[0] / m_A[0][0];
4242
43   double e = (new_val - net->m_cur_Analog);
44   double cerr = fabs(e);
43   nl_double e = (new_val - net->m_cur_Analog);
44   nl_double cerr = fabs(e);
4545
4646   net->m_cur_Analog = new_val;
4747
trunk/src/emu/netlist/analog/nld_ms_direct2.h
r243203r243204
2020      {}
2121   ATTR_HOT inline int vsolve_non_dynamic();
2222protected:
23   ATTR_HOT virtual double vsolve();
23   ATTR_HOT virtual nl_double vsolve();
2424private:
2525};
2626
r243203r243204
2828// netlist_matrix_solver - Direct2
2929// ----------------------------------------------------------------------------------------
3030
31ATTR_HOT double netlist_matrix_solver_direct2_t::vsolve()
31ATTR_HOT nl_double netlist_matrix_solver_direct2_t::vsolve()
3232{
3333   solve_base<netlist_matrix_solver_direct2_t>(this);
3434   return this->compute_next_timestep();
r243203r243204
3838{
3939   build_LE();
4040
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];
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];
4545
46   double new_val[2];
46   nl_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      double err = this->delta(new_val);
52      nl_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
r243203r243204
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      {}
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      }
2531
2632   virtual ~netlist_matrix_solver_gauss_seidel_t() {}
2733
r243203r243204
2935
3036   ATTR_HOT inline int vsolve_non_dynamic();
3137protected:
32   ATTR_HOT virtual double vsolve();
38   ATTR_HOT virtual nl_double vsolve();
3339
3440private:
35   double m_lp_fact;
41   nl_double m_lp_fact;
3642   int m_gs_fail;
3743   int m_gs_total;
44   bool m_log_stats;
3845
3946};
4047
r243203r243204
4552template <int m_N, int _storage_N>
4653void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
4754{
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
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   }
6470}
6571
6672template <int m_N, int _storage_N>
67ATTR_HOT double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
73ATTR_HOT nl_double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
6874{
6975   /*
7076    * enable linear prediction on first newton pass
r243203r243204
8692
8793   if (USE_LINEAR_PREDICTION)
8894   {
89      double sq = 0;
90      double sqo = 0;
91      const double rez_cts = 1.0 / this->current_timestep();
95      nl_double sq = 0;
96      nl_double sqo = 0;
97      const nl_double rez_cts = 1.0 / this->current_timestep();
9298      for (int k = 0; k < this->N(); k++)
9399      {
94100         const netlist_analog_net_t *n = this->m_nets[k];
95         const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
101         const nl_double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
96102         sq += nv * nv;
97103         sqo += this->m_Vdelta[k] * this->m_Vdelta[k];
98104         this->m_Vdelta[k] = nv;
r243203r243204
116122    */
117123
118124#if 0 || USE_MATRIX_GS
119   static double ws = 1.0;
120   ATTR_ALIGN double new_v[_storage_N] = { 0.0 };
125   static nl_double ws = 1.0;
126   ATTR_ALIGN nl_double new_v[_storage_N] = { 0.0 };
121127   const int iN = this->N();
122128
123129   bool resched = false;
r243203r243204
127133   this->build_LE();
128134
129135   {
130      double frob;
136      nl_double frob;
131137      frob = 0;
132      double rmin = 1e99, rmax = -1e99;
138      nl_double rmin = 1e99, rmax = -1e99;
133139      for (int k = 0; k < iN; k++)
134140      {
135141         new_v[k] = this->m_nets[k]->m_cur_Analog;
136         double s=0.0;
142         nl_double s=0.0;
137143         for (int i = 0; i < iN; i++)
138144         {
139145            frob += this->m_A[k][i] * this->m_A[k][i];
r243203r243204
146152            rmax = s;
147153      }
148154#if 0
149      double frobA = sqrt(frob /(iN));
155      nl_double frobA = sqrt(frob /(iN));
150156      if (1 &&frobA < 1.0)
151157         //ws = 2.0 / (1.0 + sqrt(1.0-frobA));
152158         ws = 2.0 / (2.0 - frobA);
r243203r243204
161167      // overhead is bigger than the gain. Consequently the fast GS below
162168      // uses a fixed GS. One can however use this here to determine a
163169      // suitable parameter.
164      double rm = (rmax + rmin) * 0.5;
170      nl_double rm = (rmax + rmin) * 0.5;
165171      if (rm < 1.0)
166172         ws = 2.0 / (1.0 + sqrt(1.0-rm));
167173      else
r243203r243204
172178   }
173179
174180   // Frobenius norm for (D-L)^(-1)U
175   //double frobU;
176   //double frobL;
177   //double norm;
181   //nl_double frobU;
182   //nl_double frobL;
183   //nl_double norm;
178184   do {
179185      resched = false;
180      double cerr = 0.0;
186      nl_double cerr = 0.0;
181187      //frobU = 0;
182188      //frobL = 0;
183189      //norm = 0;
184190
185191      for (int k = 0; k < iN; k++)
186192      {
187         double Idrive = 0;
188         //double norm_t = 0;
193         nl_double Idrive = 0;
194         //nl_double norm_t = 0;
189195         // Reduction loops need -ffast-math
190196         for (int i = 0; i < iN; i++)
191197            Idrive += this->m_A[k][i] * new_v[i];
r243203r243204
198204         }
199205
200206         //if (norm_t > norm) norm = norm_t;
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];
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];
202208
203         const double e = fabs(new_val - new_v[k]);
209         const nl_double e = fabs(new_val - new_v[k]);
204210         cerr = (e > cerr ? e : cerr);
205211         new_v[k] = new_val;
206212      }
r243203r243204
210216         resched = true;
211217      }
212218      resched_cnt++;
213      //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
219      //ATTR_UNUSED nl_double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
214220   } while (resched && (resched_cnt < this->m_params.m_gs_loops));
215221   //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm);
216222   //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) ));
r243203r243204
247253    * omega = 2.0 / (1.0 + sqrt(1-rho))
248254    */
249255
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())));
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())));
252258
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];
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];
257263
258264   for (int k = 0; k < iN; k++)
259265   {
260      double gtot_t = 0.0;
261      double gabs_t = 0.0;
262      double RHS_t = 0.0;
266      nl_double gtot_t = 0.0;
267      nl_double gabs_t = 0.0;
268      nl_double RHS_t = 0.0;
263269
264270      new_V[k] = this->m_nets[k]->m_cur_Analog;
265271
266272      {
267273         const int term_count = this->m_terms[k]->count();
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();
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();
272278#if VECTALT
273279         for (int i = 0; i < term_count; i++)
274280         {
r243203r243204
293299      //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20)
294300      //    printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t);
295301
296        gabs_t *= 0.95; // avoid rounding issues
302      gabs_t *= 0.95; // avoid rounding issues
297303      if (!USE_GABS || gabs_t <= gtot_t)
298304      {
299305         w[k] = ws / gtot_t;
r243203r243204
308314
309315   }
310316
311   const double accuracy = this->m_params.m_accuracy;
317   const nl_double accuracy = this->m_params.m_accuracy;
312318
313319   do {
314320      resched = false;
r243203r243204
317323      {
318324         const int * RESTRICT net_other = this->m_terms[k]->net_other();
319325         const int railstart = this->m_terms[k]->m_railstart;
320         const double * RESTRICT go = this->m_terms[k]->go();
326         const nl_double * RESTRICT go = this->m_terms[k]->go();
321327
322         double Idrive = 0.0;
328         nl_double Idrive = 0.0;
323329         for (int i = 0; i < railstart; i++)
324330            Idrive = Idrive + go[i] * new_V[net_other[i]];
325331
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];
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];
328334
329335         resched = resched || (std::abs(new_val - new_V[k]) > accuracy);
330336         new_V[k] = new_val;
r243203r243204
337343      this->m_nets[k]->m_cur_Analog = new_V[k];
338344
339345   this->m_gs_total += resched_cnt;
340    this->m_stat_calculations++;
346   this->m_stat_calculations++;
341347
342348   if (resched)
343349   {
trunk/src/emu/netlist/analog/nld_opamps.c
r243203r243204
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
r243203r243204
4444   switch (size)
4545   {
4646      case 1:
47         return new vector_ops_impl_t<1>();
47         return nl_alloc(vector_ops_impl_t<1>);
4848      case 2:
49         return new vector_ops_impl_t<2>();
49         return nl_alloc(vector_ops_impl_t<2>);
5050      case 3:
51         return new vector_ops_impl_t<3>();
51         return nl_alloc(vector_ops_impl_t<3>);
5252      case 4:
53         return new vector_ops_impl_t<4>();
53         return nl_alloc(vector_ops_impl_t<4>);
5454      case 5:
55         return new vector_ops_impl_t<5>();
55         return nl_alloc(vector_ops_impl_t<5>);
5656      case 6:
57         return new vector_ops_impl_t<6>();
57         return nl_alloc(vector_ops_impl_t<6>);
5858      case 7:
59         return new vector_ops_impl_t<7>();
59         return nl_alloc(vector_ops_impl_t<7>);
6060      case 8:
61         return new vector_ops_impl_t<8>();
61         return nl_alloc(vector_ops_impl_t<8>);
6262      case 9:
63         return new vector_ops_impl_t<9>();
63         return nl_alloc(vector_ops_impl_t<9>);
6464      case 10:
65         return new vector_ops_impl_t<10>();
65         return nl_alloc(vector_ops_impl_t<10>);
6666      case 11:
67         return new vector_ops_impl_t<11>();
67         return nl_alloc(vector_ops_impl_t<11>);
6868      case 12:
69         return new vector_ops_impl_t<12>();
69         return nl_alloc(vector_ops_impl_t<12>);
7070      default:
71         return new vector_ops_impl_t<0>(size);
71         return nl_alloc(vector_ops_impl_t<0>, size);
7272   }
7373}
7474
r243203r243204
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());
9694}
9795
9896// ----------------------------------------------------------------------------------------
r243203r243204
10199
102100ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params)
103101: m_stat_calculations(0),
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)
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)
109107{
110108}
111109
112110ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t()
113111{
114112   for (int i = 0; i < m_inps.count(); i++)
115      delete m_inps[i];
113      global_free(m_inps[i]);
116114}
117115
118116ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets)
r243203r243204
176174
177175                  if (net_proxy_output == NULL)
178176                  {
179                     net_proxy_output = new netlist_analog_output_t();
177                     net_proxy_output = nl_alloc(netlist_analog_output_t);
180178                     net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
181179                     m_inps.add(net_proxy_output);
182180                     net_proxy_output->m_proxied_net = &p->net().as_analog();
r243203r243204
235233
236234ATTR_COLD void netlist_matrix_solver_t::update()
237235{
238   const double new_timestep = solve();
236   const nl_double new_timestep = solve();
239237
240238   if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
241239      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
r243203r243204
243241
244242ATTR_COLD void netlist_matrix_solver_t::update_forced()
245243{
246   ATTR_UNUSED const double new_timestep = solve();
244   ATTR_UNUSED const nl_double new_timestep = solve();
247245
248246   if (m_params.m_dynamic && is_timestep())
249247      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
r243203r243204
251249
252250ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
253251{
254   const double dd = delta.as_double();
252   const nl_double dd = delta.as_double();
255253   for (int k=0; k < m_step_devices.count(); k++)
256254      m_step_devices[k]->step_time(dd);
257255}
r243203r243204
259257template<class C >
260258void netlist_matrix_solver_t::solve_base(C *p)
261259{
262    m_stat_vsolver_calls++;
260   m_stat_vsolver_calls++;
263261   if (is_dynamic())
264262   {
265263      int this_resched;
r243203r243204
272270         newton_loops++;
273271      } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
274272
275        m_stat_newton_raphson += newton_loops;
273      m_stat_newton_raphson += newton_loops;
276274      // reschedule ....
277275      if (this_resched > 1 && !m_Q_sync.net().is_queued())
278276      {
r243203r243204
286284   }
287285}
288286
289ATTR_HOT double netlist_matrix_solver_t::solve()
287ATTR_HOT nl_double netlist_matrix_solver_t::solve()
290288{
291289   netlist_time now = netlist().time();
292290   netlist_time delta = now - m_last_step;
r243203r243204
302300
303301   step(delta);
304302
305   const double next_time_step = vsolve();
303   const nl_double next_time_step = vsolve();
306304
307305   update_inputs();
308306   return next_time_step;
r243203r243204
350348   register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
351349   register_param("DYNAMIC_TS", m_dynamic, 0);
352350   register_param("LTE", m_lte, 5e-5);                     // diff/timestep
353   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // double timestep resolution
351   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // nl_double timestep resolution
354352
355353   // internal staff
356354
r243203r243204
380378   while (e != NULL)
381379   {
382380      netlist_matrix_solver_t * const *en = m_mat_solvers.next(e);
383      delete *e;
381      global_free(*e);
384382      e = en;
385383   }
386384
r243203r243204
419417      if (m_mat_solvers[i]->is_timestep())
420418         {
421419            // Ignore return value
422            ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
420            ATTR_UNUSED const nl_double ts = m_mat_solvers[i]->solve();
423421         }
424422   }
425423#endif
r243203r243204
435433netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific)
436434{
437435   if (use_specific && m_N == 1)
438      return new netlist_matrix_solver_direct1_t(m_params);
436      return nl_alloc(netlist_matrix_solver_direct1_t, m_params);
439437   else if (use_specific && m_N == 2)
440      return new netlist_matrix_solver_direct2_t(m_params);
438      return nl_alloc(netlist_matrix_solver_direct2_t, m_params);
441439   else
442440   {
441      typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N;
443442      if (size >= gs_threshold)
444         return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size);
443         return nl_alloc(solver_N, m_params, size);
445444      else
446         return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size);
445         return nl_alloc(solver_N, m_params, size);
447446   }
448447}
449448
trunk/src/emu/netlist/analog/nld_solver.h
r243203r243204
3737
3838struct netlist_solver_parameters_t
3939{
40   double m_accuracy;
41   double m_lte;
42   double m_min_timestep;
43   double m_max_timestep;
44   double m_sor;
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;
4545   bool m_dynamic;
4646   int m_gs_loops;
4747   int m_nr_loops;
r243203r243204
5959
6060   virtual ~vector_ops_t() {}
6161
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;
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;
6666
67   virtual const double sumabs(const double * v) = 0;
67   virtual const nl_double sumabs(const nl_double * v) = 0;
6868
6969   static vector_ops_t *create_ops(const int size);
7070
r243203r243204
9595
9696   ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; }
9797
98   const double sum(const double * v)
98   const nl_double sum(const nl_double * v)
9999   {
100      const double *  RESTRICT vl = v;
101      double tmp = 0.0;
100      const nl_double *  RESTRICT vl = v;
101      nl_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 double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2)
107   void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2)
108108   {
109      const double * RESTRICT v1l = v1;
110      const double * RESTRICT v2l = v2;
109      const nl_double * RESTRICT v1l = v1;
110      const nl_double * RESTRICT v2l = v2;
111111      for (int i=0; i < N(); i++)
112112      {
113113         s1 += v1l[i];
r243203r243204
115115      }
116116   }
117117
118   void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult)
118   void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult)
119119   {
120      double * RESTRICT v1l = v1;
121      const double * RESTRICT v2l = v2;
120      nl_double * RESTRICT v1l = v1;
121      const nl_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 double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs)
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)
129129   {
130      const double * RESTRICT v1l = v1;
131      const double * RESTRICT v2l = v2;
132      const double * RESTRICT v3l = v3abs;
130      const nl_double * RESTRICT v1l = v1;
131      const nl_double * RESTRICT v2l = v2;
132      const nl_double * RESTRICT v3l = v3abs;
133133      for (int i=0; i < N(); i++)
134134      {
135135         s1 += v1l[i];
r243203r243204
138138      }
139139   }
140140
141   const double sumabs(const double * v)
141   const nl_double sumabs(const nl_double * v)
142142   {
143      const double * RESTRICT vl = v;
144      double tmp = 0.0;
143      const nl_double * RESTRICT vl = v;
144      nl_double tmp = 0.0;
145145      for (int i=0; i < N(); i++)
146146         tmp += fabs(vl[i]);
147147      return tmp;
r243203r243204
155155   NETLIST_PREVENT_COPYING(terms_t)
156156
157157   public:
158   ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL)
158   ATTR_COLD terms_t() : m_railstart(0)
159159   {}
160160
161161   ATTR_COLD void clear()
r243203r243204
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 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; }
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; }
179178
180179   ATTR_COLD void set_pointers();
181180
r243203r243204
184183private:
185184   plinearlist_t<netlist_terminal_t *> m_term;
186185   plinearlist_t<int> m_net_other;
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;
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;
192190};
193191
194192class netlist_matrix_solver_t : public netlist_device_t
r243203r243204
199197
200198   enum eSolverType
201199   {
202       GAUSSIAN_ELIMINATION,
203       GAUSS_SEIDEL
200      GAUSSIAN_ELIMINATION,
201      GAUSS_SEIDEL
204202   };
205203
206204   ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params);
r243203r243204
211209   template<class C>
212210   void solve_base(C *p);
213211
214   ATTR_HOT double solve();
212   ATTR_HOT nl_double solve();
215213
216214   ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; }
217215   ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; }
r243203r243204
238236   ATTR_HOT void update_dynamic();
239237
240238   // should return next time step
241   ATTR_HOT virtual double vsolve() = 0;
239   ATTR_HOT virtual nl_double vsolve() = 0;
242240
243241   ATTR_COLD virtual void  add_term(int net_idx, netlist_terminal_t *term) = 0;
244242
245243   plinearlist_t<netlist_analog_net_t *> m_nets;
246244   plinearlist_t<netlist_analog_output_t *> m_inps;
247245
248    int m_stat_calculations;
249    int m_stat_newton_raphson;
250    int m_stat_vsolver_calls;
246   int m_stat_calculations;
247   int m_stat_newton_raphson;
248   int m_stat_vsolver_calls;
251249
252250   const netlist_solver_parameters_t &m_params;
253251
254   ATTR_HOT inline const double current_timestep() { return m_cur_ts; }
252   ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; }
255253private:
256254
257255   netlist_time m_last_step;
258   double m_cur_ts;
256   nl_double m_cur_ts;
259257   dev_list_t m_step_devices;
260258   dev_list_t m_dynamic_devices;
261259
r243203r243204
266264
267265   ATTR_HOT void update_inputs();
268266
269    const eSolverType m_type;
267   const eSolverType m_type;
270268};
271269
272270
r243203r243204
281279
282280   ATTR_COLD void post_start();
283281
284   ATTR_HOT inline double gmin() { return m_gmin.Value(); }
282   ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); }
285283
286284protected:
287285   ATTR_HOT void update();
trunk/src/emu/netlist/analog/nld_twoterm.c
r243203r243204
1616   set_param(1e-15, 1, 1e-15);
1717}
1818
19ATTR_COLD void netlist_generic_diode::set_param(const double Is, const double n, double gmin)
19ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin)
2020{
2121   m_Is = Is;
2222   m_n = n;
r243203r243204
157157
158158NETLIB_UPDATE_PARAM(POT)
159159{
160   double v = m_Dial.Value();
160   nl_double v = m_Dial.Value();
161161   if (m_DialIsLog.Value())
162162      v = (exp(v) - 1.0) / (exp(1.0) - 1.0);
163163
r243203r243204
221221
222222NETLIB_UPDATE_PARAM(D)
223223{
224   double Is = m_model.model_value("Is", 1e-15);
225   double n = m_model.model_value("N", 1);
224   nl_double Is = m_model.model_value("Is", 1e-15);
225   nl_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
r243203r243204
9797   {
9898   }
9999
100   ATTR_HOT inline void set(const double G, const double V, const double I)
100   ATTR_HOT inline void set(const nl_double G, const nl_double V, const nl_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 double deltaV() const
107   ATTR_HOT inline nl_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(double a11, double a12, double a21, double a22, double r1, double r2)
112   ATTR_HOT void set_mat(nl_double a11, nl_double a12, nl_double a21, nl_double a22, nl_double r1, nl_double r2)
113113   {
114114      /*      GO, GT, I                */
115115      m_P.set(-a12, a11, -r1);
r243203r243204
133133public:
134134   ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
135135
136   inline void set_R(const double R)
136   inline void set_R(const nl_double R)
137137   {
138138      set(1.0 / R, 0.0, 0.0);
139139   }
r243203r243204
171171public:
172172   ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
173173
174   ATTR_HOT void step_time(const double st)
174   ATTR_HOT void step_time(const nl_double st)
175175   {
176      const double G = m_C.Value() / st;
177      const double I = -G * deltaV();
176      const nl_double G = m_C.Value() / st;
177      const nl_double I = -G * deltaV();
178178      set(G, 0.0, I);
179179   }
180180
r243203r243204
198198public:
199199   ATTR_COLD netlist_generic_diode();
200200
201   ATTR_HOT inline void update_diode(const double nVd)
201   ATTR_HOT inline void update_diode(const nl_double nVd)
202202   {
203203      //FIXME: Optimize cutoff case
204204
r243203r243204
212212      {
213213         m_Vd = nVd;
214214
215         const double eVDVt = exp(m_Vd * m_VtInv);
215         const nl_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      }
r243203r243204
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         double a = (nVd - m_Vd) * m_VtInv;
224         nl_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 double eVDVt = exp(m_Vd * m_VtInv);
228         const nl_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;
r243203r243204
234234      //printf("nVd %f m_Vd %f Vcrit %f\n", nVd, m_Vd, m_Vcrit);
235235   }
236236
237   ATTR_COLD void set_param(const double Is, const double n, double gmin);
237   ATTR_COLD void set_param(const nl_double Is, const nl_double n, nl_double gmin);
238238
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; }
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; }
243243
244244   /* owning object must save those ... */
245245
246246   ATTR_COLD void save(pstring name, netlist_object_t &parent);
247247
248248private:
249   double m_Vd;
250   double m_Id;
251   double m_G;
249   nl_double m_Vd;
250   nl_double m_Id;
251   nl_double m_G;
252252
253   double m_Vt;
254   double m_Is;
255   double m_n;
256   double m_gmin;
253   nl_double m_Vt;
254   nl_double m_Is;
255   nl_double m_n;
256   nl_double m_gmin;
257257
258   double m_VtInv;
259   double m_Vcrit;
258   nl_double m_VtInv;
259   nl_double m_Vcrit;
260260};
261261
262262// ----------------------------------------------------------------------------------------
r243203r243204
268268// add c3 and it'll be better than 1%
269269
270270#if 0
271inline double fastexp_h(const double x)
271inline nl_double fastexp_h(const nl_double x)
272272{
273   static const double ln2r = 1.442695040888963387;
274   static const double ln2  = 0.693147180559945286;
275   //static const double c3   = 0.166666666666666667;
273   static const nl_double ln2r = 1.442695040888963387;
274   static const nl_double ln2  = 0.693147180559945286;
275   //static const nl_double c3   = 0.166666666666666667;
276276
277   const double y = x * ln2r;
277   const nl_double y = x * ln2r;
278278   const unsigned int t = y;
279   const double z = (x - ln2 * (double) t);
280   const double zz = z * z;
281   //const double zzz = zz * z;
279   const nl_double z = (x - ln2 * (double) t);
280   const nl_double zz = z * z;
281   //const nl_double zzz = zz * z;
282282
283283   return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
284284}
285285
286inline double fastexp(const double x)
286inline nl_double fastexp(const nl_double x)
287287{
288288   if (x<0)
289289      return 1.0 / fastexp_h(-x);
trunk/src/emu/netlist/devices/net_lib.c
r243203r243204
4949
5050#include "net_lib.h"
5151#include "nld_system.h"
52#include "../nl_factory.h"
5253
5354NETLIST_START(diode_models)
5455   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)")
r243203r243204
6465
6566
6667#define xstr(s) # s
67#define ENTRY1(_nic, _name, _defparam) register_device<_nic>( # _name, xstr(_nic), _defparam );
68#define ENTRY1(_nic, _name, _defparam) factory.register_device<_nic>( # _name, xstr(_nic), _defparam );
6869#define ENTRY(_nic, _name, _defparam) ENTRY1(NETLIB_NAME(_nic), _name, _defparam)
6970
70netlist_factory_t::netlist_factory_t()
71void nl_initialize_factory(netlist_factory_t &factory)
7172{
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{
8673   ENTRY(R,                    RES,                    "R")
8774   ENTRY(POT,                  POT,                    "R")
8875   ENTRY(C,                    CAP,                    "C")
r243203r243204
9178   ENTRY(VCCS,                 VCCS,                   "-")
9279   ENTRY(CCCS,                 CCCS,                   "-")
9380   ENTRY(dummy_input,          DUMMY_INPUT,            "-")
94    ENTRY(frontier,             FRONTIER,               "+I,Q")
81   ENTRY(frontier,             FRONTIER,               "+I,Q")
9582   ENTRY(QBJT_EB,              QBJT_EB,                "model")
9683   ENTRY(QBJT_switch,          QBJT_SW,                "model")
9784   ENTRY(ttl_input,            TTL_INPUT,              "IN")
r243203r243204
161148   ENTRY(SN74LS629_dip,        SN74LS629_DIP,          "1.CAP1,2.CAP2")
162149   ENTRY(NE555_dip,            NE555_DIP,              "-")
163150}
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
r243203r243204
9999NETLIST_EXTERNAL(diode_models);
100100NETLIST_EXTERNAL(bjt_models);
101101
102void nl_initialize_factory(netlist_factory_t &factory);
103
102104#endif
trunk/src/emu/netlist/devices/nld_4020.c
r243203r243204
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]);
r243203r243204
125125   register_subalias("7", sub.m_Q[3]);
126126   register_subalias("8", m_supply.m_vss);
127127
128   register_subalias("9", sub.m_Q[1]);
128   register_subalias("9", sub.m_Q[0]);
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
r243203r243204
1919
2020NETLIB_UPDATE(4066)
2121{
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;
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;
2727
2828   if (in < low)
2929   {
r243203r243204
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_input("7", m_supply.m_vss);
56   register_subalias("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);
r243203r243204
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_input("14", m_supply.m_vdd);
64   register_subalias("14", m_supply.m_vdd);
6565
6666}
6767
trunk/src/emu/netlist/devices/nld_74123.c
r243203r243204
6969
7070   if (m_state == 1)
7171   {
72      const double vLow = m_KP * TERMANALOG(m_RP.m_P);
72      const nl_double vLow = m_KP * TERMANALOG(m_RP.m_P);
7373      if (INPANALOG(m_CV) < vLow)
7474      {
7575         m_RN.set_R(R_OFF);
r243203r243204
7878   }
7979   else if (m_state == 2)
8080   {
81      const double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
81      const nl_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
r243203r243204
104104{
105105   {
106106      // recompute
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);
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);
111111
112112      /* coefficients */
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;
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;
123123
124124      /* scale due to input resistance */
125125
trunk/src/emu/netlist/devices/nld_cmos.h
r243203r243204
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 double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline double vss() { return INPANALOG(m_vss); }
32   ATTR_HOT inline nl_double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline nl_double vss() { return INPANALOG(m_vss); }
3434};
3535
3636#endif /* NLD_CMOS_H_ */
trunk/src/emu/netlist/devices/nld_ne555.c
r243203r243204
1010#define R_OFF (1E20)
1111#define R_ON (25)   // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2
1212
13inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
13inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b)
1414{
15   double ret = v;
16   double vcc = TERMANALOG(m_R1.m_P);
15   nl_double ret = v;
16   nl_double vcc = TERMANALOG(m_R1.m_P);
1717
1818   if (ret >  vcc - a)
1919      ret = vcc - a;
r243203r243204
6464{
6565   // FIXME: assumes GND is connected to 0V.
6666
67   double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
67   nl_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
r243203r243204
3939
4040   netlist_state_t<bool> m_last_out;
4141
42   inline double clamp(const double v, const double a, const double b);
42   inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b);
4343
4444);
4545
trunk/src/emu/netlist/devices/nld_r2r_dac.c
r243203r243204
3232
3333   update_dev();
3434
35   double V = m_VIN.Value() / (double) (1 << m_num.Value()) * (double) m_val.Value();
35   nl_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
r243203r243204
118118   if (state != m_last_state)
119119   {
120120      m_last_state = state;
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;
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;
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
r243203r243204
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)                                                   \
46
43      NET_REGISTER_DEV(frontier, _name)                                      \
44      NET_C(_IN, _name.I)                                                    \
45      NET_C(_OUT, _name.Q)
4746// -----------------------------------------------------------------------------
4847// mainclock
4948// -----------------------------------------------------------------------------
r243203r243204
159158class NETLIB_NAME(frontier) : public netlist_device_t
160159{
161160public:
162    ATTR_COLD NETLIB_NAME(frontier)()
163            : netlist_device_t(DUMMY) { }
161   ATTR_COLD NETLIB_NAME(frontier)()
162         : netlist_device_t(DUMMY) { }
164163
165    ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
164   ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
166165
167166protected:
168167
169    ATTR_COLD void start()
170    {
171        register_input("I", m_I);
172        register_output("Q", m_Q);
173    }
168   ATTR_COLD void start()
169   {
170      register_input("I", m_I);
171      register_output("Q", m_Q);
172   }
174173
175    ATTR_COLD void reset()
176    {
177    }
174   ATTR_COLD void reset()
175   {
176   }
178177
179    ATTR_HOT ATTR_ALIGN void update()
180    {
181        OUTANALOG(m_Q, INPANALOG(m_I));
182    }
178   ATTR_HOT ATTR_ALIGN void update()
179   {
180      OUTANALOG(m_Q, INPANALOG(m_I));
181   }
183182
184183private:
185    netlist_analog_input_t m_I;
186    netlist_analog_output_t m_Q;
184   netlist_analog_input_t m_I;
185   netlist_analog_output_t m_Q;
187186
188187};
189188
trunk/src/emu/netlist/netlist.mak
r243203r243204
2626   $(NETLISTOBJ)/nl_base.o \
2727   $(NETLISTOBJ)/nl_parser.o \
2828   $(NETLISTOBJ)/nl_setup.o \
29   $(NETLISTOBJ)/nl_factory.o \
2930   $(NETLISTOBJ)/pstring.o \
3031   $(NETLISTOBJ)/pstate.o \
3132   $(NETLISTOBJ)/analog/nld_bjt.o \
trunk/src/emu/netlist/nl_base.c
r243203r243204
152152   {
153153      if (!m_nets[i]->isRailNet())
154154      {
155         delete m_nets[i];
155         global_free(m_nets[i]);
156156      }
157157   }
158158
r243203r243204
170170   netlist_object_t::save_register();
171171}
172172
173ATTR_HOT const double netlist_base_t::gmin() const
173ATTR_HOT const nl_double netlist_base_t::gmin() const
174174{
175175   return solver()->gmin();
176176}
r243203r243204
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);
455456template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_int_t &param, const int initialVal);
456457template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_logic_t &param, const int initialVal);
457458template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_str_t &param, const char * const initialVal);
r243203r243204
874875   net().as_analog().m_cur_Analog = 0.98;
875876}
876877
877ATTR_COLD void netlist_analog_output_t::initial(const double val)
878ATTR_COLD void netlist_analog_output_t::initial(const nl_double val)
878879{
879880   net().as_analog().m_cur_Analog = val * 0.99;
880881}
r243203r243204
931932}
932933
933934
934ATTR_COLD double netlist_param_model_t::model_value(const pstring &entity, const double defval) const
935ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const
935936{
936937   pstring tmp = this->Value();
937938   // .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)
r243203r243204
945946      if (pequal < 0)
946947         netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
947948      tmp = tmp.substr(pequal+1);
948      double factor = 1.0;
949      nl_double factor = 1.0;
949950      switch (*(tmp.right(1).cstr()))
950951      {
951952         case 'm': factor = 1e-3; break;
r243203r243204
10001001   net.toggle_new_Q();
10011002   net.set_time(netlist().time() + m_inc);
10021003}
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
r243203r243204
272272
273273struct netlist_logic_family_desc_t
274274{
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;
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;
281281};
282282
283283/* Terminals inherit the family description from the netlist_device
r243203r243204
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
r243203r243204
474474
475475   ATTR_COLD netlist_terminal_t();
476476
477   double *m_Idr1; // drive current
478   double *m_go1;  // conductance for Voltage from other term
479   double *m_gt1;  // conductance for total conductance
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
480480
481   ATTR_HOT inline void set(const double G)
481   ATTR_HOT inline void set(const nl_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 double GO, const double GT)
488   ATTR_HOT inline void set(const nl_double GO, const nl_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 double GO, const double GT, const double I)
495   ATTR_HOT inline void set(const nl_double GO, const nl_double GT, const nl_double I)
496496   {
497497      set_ptr(m_Idr1, I);
498498      set_ptr(m_go1, GO);
r243203r243204
509509
510510   ATTR_COLD virtual void reset();
511511private:
512   inline void set_ptr(double *ptr, const double val)
512   inline void set_ptr(nl_double *ptr, const nl_double val)
513513   {
514514      if (ptr != NULL)
515515         *ptr = val;
r243203r243204
586586   ATTR_COLD netlist_analog_input_t()
587587      : netlist_input_t(INPUT, ANALOG) { }
588588
589   ATTR_HOT inline const double Q_Analog() const;
589   ATTR_HOT inline const nl_double Q_Analog() const;
590590};
591591
592592//#define INPVAL(_x) (_x).Q()
r243203r243204
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   double m_cur_Analog;
664   nl_double m_cur_Analog;
665665
666666};
667667
r243203r243204
736736   ATTR_COLD netlist_analog_net_t();
737737   ATTR_COLD virtual ~netlist_analog_net_t() { };
738738
739   ATTR_HOT inline const double Q_Analog() const
739   ATTR_HOT inline const nl_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 double &Q_Analog_state_ptr()
746   ATTR_COLD inline nl_double &Q_Analog_state_ptr()
747747   {
748748      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
749749      nl_assert(family() == ANALOG);
r243203r243204
764764private:
765765
766766public:
767   double m_DD_n_m_1;
768   double m_h_n_m_1;
767   nl_double m_DD_n_m_1;
768   nl_double m_h_n_m_1;
769769
770770   //FIXME: needed by current solver code
771771   netlist_matrix_solver_t *m_solver;
r243203r243204
831831
832832   ATTR_COLD netlist_analog_output_t();
833833
834   ATTR_COLD void initial(const double val);
834   ATTR_COLD void initial(const nl_double val);
835835
836   ATTR_HOT inline void set_Q(const double newQ);
836   ATTR_HOT inline void set_Q(const nl_double newQ);
837837
838838   netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic
839839
r243203r243204
876876public:
877877   ATTR_COLD netlist_param_double_t();
878878
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;   }
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;   }
882882
883883protected:
884884   ATTR_COLD virtual void save_register()
r243203r243204
888888   }
889889
890890private:
891   double m_param;
891   nl_double m_param;
892892};
893893
894894class netlist_param_int_t : public netlist_param_t
r243203r243204
946946   ATTR_HOT inline const pstring &Value() const     { return m_param;     }
947947
948948   /* these should be cached! */
949   ATTR_COLD double model_value(const pstring &entity, const double defval = 0.0) const;
949   ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const;
950950   ATTR_COLD const pstring model_type() const;
951951
952952private:
r243203r243204
997997      out.set_Q(val, delay);
998998   }
999999
1000   ATTR_HOT inline const double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
1000   ATTR_HOT inline const nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
10011001
1002   ATTR_HOT inline const double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
1002   ATTR_HOT inline const nl_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 double val)
1004   ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
10051005   {
10061006      out.set_Q(val);
10071007   }
r243203r243204
10101010
10111011   ATTR_HOT virtual void dec_active() {  }
10121012
1013   ATTR_HOT virtual void step_time(const double st) { }
1013   ATTR_HOT virtual void step_time(const nl_double st) { }
10141014   ATTR_HOT virtual void update_terminals() { }
10151015
10161016
r243203r243204
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 double gmin() const;
1123   ATTR_HOT const nl_double gmin() const;
11241124
11251125   ATTR_HOT inline void push_to_queue(netlist_net_t *out, const netlist_time attime)
11261126   {
r243203r243204
12511251   }
12521252}
12531253
1254ATTR_HOT inline void netlist_param_double_t::setTo(const double param)
1254ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param)
12551255{
12561256   if (m_param != param)
12571257   {
r243203r243204
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
r243203r243204
13561356   return net().as_logic().Q();
13571357}
13581358
1359ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const
1359ATTR_HOT inline const nl_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 double newQ)
1364ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ)
13651365{
13661366   if (newQ != net().as_analog().m_cur_Analog)
13671367   {
r243203r243204
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
14491373#endif /* NLBASE_H_ */
trunk/src/emu/netlist/nl_config.h
r243203r243204
4949
5050#define NETLIST_GMIN_DEFAULT    (1e-9)
5151
52//typedef double   nl_double;
53
54#define nl_double double
55
5256//============================================================
5357//  DEBUGGING
5458//============================================================
r243203r243204
109113// this macro passes an item followed by a string version of itself as two consecutive parameters
110114#define NLNAME(x) x, #x
111115
116//============================================================
117//  Exceptions
118//============================================================
119
112120// emu_fatalerror is a generic fatal exception that provides an error string
113121class nl_fatalerror : public std::exception
114122{
115123public:
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    }
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   }
131139};
132140
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
133156#ifdef MAME_DEBUG
134157#define nl_assert(x)               do { if (!(x)) throw nl_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0)
135158#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)
136159#else
137160#define nl_assert(x)               do { } while (0)
138161//#define assert_always(x, msg)   do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0)
139#define nl_assert_always(x, msg)   do { } 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)
140163#endif
141164
142165//============================================================
trunk/src/emu/netlist/nl_dice_compat.h
r243203r243204
88#ifndef NL_DICE_COMPAT_H_
99#define NL_DICE_COMPAT_H_
1010
11#include "netlist/devices/net_lib.h"
12
1113/* --------------------------------------------------------------------
1214 * Compatibility macros for DICE netlists ...
1315 * -------------------------------------------------------------------- */
1416
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);
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 */
1722
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
1829#define CONNECTION( ... ) CONNECTIONY( CONNECTIONX( __VA_ARGS__ ) )
1930#define CONNECTIONY(_a) _a
2031#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
r243203r243204
3041struct Mono555Desc
3142{
3243public:
33      double r, c;
44      nl_double r, c;
3445
35      Mono555Desc(double res, double cap) : r(res), c(cap) { }
46      Mono555Desc(nl_double res, nl_double cap) : r(res), c(cap) { }
3647};
3748
3849struct SeriesRCDesc
3950{
4051public:
41      double r, c;
52      nl_double r, c;
4253
43      SeriesRCDesc(double res, double cap) : r(res), c(cap) { }
54      SeriesRCDesc(nl_double res, nl_double cap) : r(res), c(cap) { }
4455};
4556
4657#define CHIP_555_Mono(_name,  _pdesc)   \
trunk/src/emu/netlist/nl_factory.c
r0r243204
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
r0r243204
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
r243203r243204
66 */
77
88#include "nl_parser.h"
9#include "nl_factory.h"
910
1011//#undef NL_VERBOSE_OUT
1112//#define NL_VERBOSE_OUT(x) printf x
r243203r243204
399400void netlist_parser::netdev_param()
400401{
401402   pstring param;
402   double val;
403   nl_double val;
403404   param = get_identifier();
404405   require_token(m_tok_comma);
405406   val = eval_param(get_token());
r243203r243204
439440      }
440441      else
441442      {
442         double val = eval_param(tok);
443         nl_double val = eval_param(tok);
443444         m_setup.register_param(paramfq, val);
444445      }
445446      cnt++;
r243203r243204
467468// ----------------------------------------------------------------------------------------
468469
469470
470double netlist_parser::eval_param(const token_t tok)
471nl_double netlist_parser::eval_param(const token_t tok)
471472{
472473   static const char *macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
473   static double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
474   static nl_double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
474475   int i;
475476   int f=0;
476477   bool e;
477   double ret;
478   nl_double ret;
478479   pstring val;
479480
480481   //printf("param %s\n", tok.m_token.cstr());
trunk/src/emu/netlist/nl_parser.h
r243203r243204
160160   virtual void verror(pstring msg, int line_num, pstring line);
161161private:
162162
163   double eval_param(const token_t tok);
163   nl_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
r243203r243204
99#include "nl_setup.h"
1010#include "nl_parser.h"
1111#include "nl_util.h"
12#include "nl_factory.h"
1213#include "devices/net_lib.h"
1314#include "devices/nld_system.h"
1415#include "analog/nld_solver.h"
r243203r243204
3738   , m_proxy_cnt(0)
3839{
3940   netlist.set_setup(this);
41   m_factory = nl_alloc(netlist_factory_t);
4042}
4143
4244void netlist_setup_t::init()
4345{
44   m_factory.initialize();
46   nl_initialize_factory(factory());
4547   NETLIST_NAME(base)(*this);
4648}
4749
r243203r243204
5557   m_params_temp.clear();
5658
5759   netlist().set_setup(NULL);
60   nl_free(m_factory);
5861
5962   pstring::resetmem();
6063}
r243203r243204
9295   return dev;
9396}
9497
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
95106template <class T>
96107static void remove_start_with(T &hm, pstring &sw)
97108{
r243203r243204
390401   if (proxy == NULL)
391402   {
392403      // create a new one ...
393      proxy = new nld_d_to_a_proxy(out);
404      proxy = nl_alloc(nld_d_to_a_proxy ,out);
394405      pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt);
395406      m_proxy_cnt++;
396407
r243203r243204
419430{
420431   if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
421432   {
422      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
433      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, in);
423434      pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt);
424435      m_proxy_cnt++;
425436
r243203r243204
455466   else if (inp.isFamily(netlist_terminal_t::LOGIC))
456467   {
457468      NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
458      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
469      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, inp);
459470      pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt);
460471      m_proxy_cnt++;
461472
r243203r243204
523534   else
524535   {
525536      NL_VERBOSE_OUT(("adding net ...\n"));
526      netlist_analog_net_t *anet =  new netlist_analog_net_t();
537      netlist_analog_net_t *anet =  nl_alloc(netlist_analog_net_t);
527538      t1.set_net(*anet);
528539      //m_netlist.solver()->m_nets.add(anet);
529540      // FIXME: Nets should have a unique name
r243203r243204
686697
687698void netlist_setup_t::start_devices()
688699{
689    //FIXME: we need a nl_getenv
700   //FIXME: we need a nl_getenv
690701   if (getenv("NL_LOGS"))
691702   {
692703      NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
r243203r243204
695706      {
696707         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
697708         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
698         netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
709         netlist_device_t *nc = factory().new_device_by_classname("nld_log");
699710         pstring name = "log_" + ll[i];
700711         register_dev(nc, name);
701712         register_link(name + ".I", ll[i]);
trunk/src/emu/netlist/nl_setup.h
r243203r243204
33/*
44 * nlsetup.h
55 *
6 *  Created on: 3 Nov 2013
7 *      Author: andre
86 */
97
108#ifndef NLSETUP_H_
119#define NLSETUP_H_
1210
1311#include "nl_base.h"
12//#include "nl_factory.h"
1413
1514//============================================================
1615//  MACROS / inline netlist definitions
r243203r243204
2423#define ALIAS(_alias, _name)                                                        \
2524   setup.register_alias(# _alias, # _name);
2625
27#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
26//#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
2827
2928#define NET_REGISTER_DEV(_type, _name)                                              \
30      setup.register_dev(NET_NEW(_type), # _name);
29      setup.register_dev(NETLIB_NAME_STR(_type), # _name);
3130
3231#define NET_REMOVE_DEV(_name)                                                       \
3332      setup.remove_dev(# _name);
r243203r243204
6665      setup.namespace_pop();
6766
6867// ----------------------------------------------------------------------------------------
69// FIXME: Clean this up
70// ----------------------------------------------------------------------------------------
71
72//class NETLIB_NAME(analog_callback);
73
74// ----------------------------------------------------------------------------------------
7568// netlist_setup_t
7669// ----------------------------------------------------------------------------------------
7770
71// Forward definition so we keep nl_factory.h out of the public
72class netlist_factory_t;
73
7874class netlist_setup_t
7975{
8076   NETLIST_PREVENT_COPYING(netlist_setup_t)
r243203r243204
117113
118114   netlist_base_t &netlist() { return m_netlist; }
119115   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; }
122116
123117   pstring build_fqn(const pstring &obj_name) const;
124118
125119   netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
120   netlist_device_t *register_dev(const pstring &classname, const pstring &name);
126121   void remove_dev(const pstring &name);
127122
128123   void register_model(const pstring &model);
r243203r243204
151146   void namespace_push(const pstring &aname);
152147   void namespace_pop();
153148
149   netlist_factory_t &factory() { return *m_factory; }
150   const netlist_factory_t &factory() const { return *m_factory; }
151
154152   /* not ideal, but needed for save_state */
155153   tagmap_terminal_t  m_terminals;
156154
r243203r243204
167165   tagmap_link_t   m_links;
168166   tagmap_nstring_t m_params_temp;
169167
170   netlist_factory_t m_factory;
168   netlist_factory_t *m_factory;
171169
172170   plinearlist_t<pstring> m_models;
173171
trunk/src/emu/netlist/plists.h
r243203r243204
2828      if (m_num_elements == 0)
2929         m_list = NULL;
3030      else
31         m_list = new _ListClass[m_num_elements];
31         m_list = nl_alloc_array(_ListClass, m_num_elements);
3232      m_count = 0;
3333   }
3434
r243203r243204
3838      if (m_num_elements == 0)
3939         m_list = NULL;
4040      else
41         m_list = new _ListClass[m_num_elements];
41         m_list = nl_alloc_array(_ListClass, m_num_elements);
4242      m_count = 0;
4343      for (int i=0; i<rhs.count(); i++)
4444      {
r243203r243204
6060   ATTR_COLD ~plinearlist_t()
6161   {
6262      if (m_list != NULL)
63         delete[] m_list;
63         nl_free_array(m_list);
6464      m_list = NULL;
6565   }
6666
r243203r243204
157157   {
158158      for (_ListClass *i = m_list; i < m_list + m_count; i++)
159159      {
160         delete *i;
160         nl_free(*i);
161161      }
162162      clear();
163163   }
164164
165165private:
166   ATTR_HOT inline void resize(const int new_size)
166   ATTR_COLD void resize(const int new_size)
167167   {
168168      int cnt = count();
169169      if (new_size > 0)
170170      {
171         _ListClass *m_new = new _ListClass[new_size];
171         _ListClass *m_new = nl_alloc_array(_ListClass, new_size);
172172         _ListClass *pd = m_new;
173173
174174         if (cnt > new_size)
r243203r243204
176176         for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++)
177177            *pd = *ps;
178178         if (m_list != NULL)
179            delete[] m_list;
179            nl_free_array(m_list);
180180         m_list = m_new;
181181         m_count = cnt;
182182      }
183183      else
184184      {
185185         if (m_list != NULL)
186            delete[] m_list;
186            nl_free_array(m_list);
187187         m_list = NULL;
188188         m_count = 0;
189189      }
r243203r243204
199199// pnamedlist_t: a simple list
200200// ----------------------------------------------------------------------------------------
201201
202#ifdef SDLMAME_SOLARIS
203#undef _C
204#endif
205
202206template <class _C>
203207class pnamedlist_t : public plinearlist_t<_C>
204208{
trunk/src/emu/netlist/pstate.c
r243203r243204
2323         "DT_INT16",
2424         "DT_INT8",
2525         "DT_INT",
26         "DT_BOOLEAN"
26         "DT_BOOLEAN",
27         "DT_FLOAT"
2728   };
2829
2930   NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
30   pstate_entry_t *p = new pstate_entry_t(stname, dt, owner, size, count, ptr, is_ptr);
31   pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, dt, owner, size, count, ptr, is_ptr);
3132   m_save.add(p);
3233}
3334
r243203r243204
6061      if (m_save[i]->m_dt == DT_CUSTOM)
6162         m_save[i]->m_callback->on_post_load();
6263}
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
r243203r243204
3232   DT_INT16,
3333   DT_INT8,
3434   DT_INT,
35   DT_BOOLEAN
35   DT_BOOLEAN,
36   DT_FLOAT
3637};
3738
3839template<typename _ItemType> struct nl_datatype
r243203r243204
5556
5657NETLIST_SAVE_TYPE(char, DT_INT8);
5758NETLIST_SAVE_TYPE(double, DT_DOUBLE);
59NETLIST_SAVE_TYPE(float, DT_FLOAT);
5860NETLIST_SAVE_TYPE(INT8, DT_INT8);
5961NETLIST_SAVE_TYPE(UINT8, DT_INT8);
6062NETLIST_SAVE_TYPE(INT64, DT_INT64);
r243203r243204
145147   pstate_entry_t::list_t m_save;
146148};
147149
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}
150template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname);
155151
156152template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname)
157153{
trunk/src/emu/netlist/pstring.c
r243203r243204
1414//pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
1515
1616pblockpool pstring::m_pool;
17
1817pstring::str_t pstring::m_zero;
1918
2019/*
r243203r243204
109108   return 1;
110109}
111110
112double pstring::as_double(bool *error) const
111nl_double pstring::as_double(bool *error) const
113112{
114   double ret;
113   nl_double ret;
115114   char *e = NULL;
116115
117116   if (error != NULL)
r243203r243204
125124
126125long pstring::as_long(bool *error) const
127126{
128   double ret;
127   nl_double ret;
129128   char *e = NULL;
130129
131130   if (error != NULL)
trunk/src/emu/netlist/pstring.h
r243203r243204
159159
160160   // conversions
161161
162   double as_double(bool *error = NULL) const;
162   nl_double as_double(bool *error = NULL) const;
163163
164164   long as_long(bool *error = NULL) const;
165165
trunk/src/emu/parameters.c
r0r243204
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
r0r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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            {
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
8989   // if this is an OSD font, we're done
9090   if (filename != NULL)
9191   {
92      m_osdfont = manager.machine().osd().font_open(filename, m_height);
92      m_osdfont = manager.machine().osd().font_alloc();
9393      if (m_osdfont != NULL)
9494      {
95         m_scale = 1.0f / (float)m_height;
96         m_format = FF_OSD;
97         return;
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;
98103      }
99104   }
100105
r243203r243204
130135
131136   // release the OSD font
132137   if (m_osdfont != NULL)
133      m_manager.machine().osd().font_close(m_osdfont);
138   {
139      m_osdfont->close();
140      global_free(m_osdfont);
141   }
134142}
135143
136144
r243203r243204
149157         return;
150158
151159      // attempt to get the font bitmap; if we fail, set bmwidth to -1
152      if (!m_manager.machine().osd().font_get_bitmap(m_osdfont, chnum, gl.bitmap, gl.width, gl.xoffs, gl.yoffs))
160      if (!m_osdfont->get_bitmap(chnum, gl.bitmap, gl.width, gl.xoffs, gl.yoffs))
153161      {
154162         gl.bitmap.reset();
155163         gl.bmwidth = -1;
trunk/src/emu/romload.c
r243203r243204
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++;
174176   return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL;
175177}
176178
r243203r243204
185187   romp++;
186188   while (!ROMENTRY_ISREGIONEND(romp))
187189      romp++;
190   while (ROMENTRY_ISPARAMETER(romp))
191      romp++;
188192   return ROMENTRY_ISEND(romp) ? NULL : romp;
189193}
190194
r243203r243204
218222
219223
220224/*-------------------------------------------------
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/*-------------------------------------------------
221253    rom_region_name - return the appropriate name
222254    for a rom region
223255-------------------------------------------------*/
r243203r243204
229261
230262
231263/*-------------------------------------------------
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/*-------------------------------------------------
232286    rom_file_size - return the expected size of a
233287    file given the ROM description
234288-------------------------------------------------*/
r243203r243204
14541508         rom_region_name(regiontag, *device, region);
14551509         region_post_process(romdata, regiontag, ROMREGION_ISINVERTED(region));
14561510      }
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      }
14571519}
14581520
14591521
trunk/src/emu/romload.h
r243203r243204
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 */
4243   ROMENTRYTYPE_COUNT
4344};
4445
r243203r243204
152153#define ROMENTRY_ISIGNORE(r)        (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_IGNORE)
153154#define ROMENTRY_ISSYSTEM_BIOS(r)   (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_SYSTEM_BIOS)
154155#define ROMENTRY_ISDEFAULT_BIOS(r)  (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_DEFAULT_BIOS)
155#define ROMENTRY_ISREGIONEND(r)     (ROMENTRY_ISREGION(r) || ROMENTRY_ISEND(r))
156#define ROMENTRY_ISPARAMETER(r)     (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_PARAMETER)
157#define ROMENTRY_ISREGIONEND(r)     (ROMENTRY_ISREGION(r) || ROMENTRY_ISPARAMETER(r) || ROMENTRY_ISEND(r))
156158
157159/* ----- per-region macros ----- */
158160#define ROMREGION_GETTAG(r)         ((r)->_name)
r243203r243204
243245#define ROM_DEFAULT_BIOS(name)                      { name, NULL, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS },
244246
245247
248/* ----- game parameter macro ----- */
249#define ROM_PARAMETER(tag, value)                   { tag, value, 0, 0, ROMENTRYTYPE_PARAMETER },
250
246251/* ----- disk loading macros ----- */
247252#define DISK_REGION(tag)                            ROM_REGION(1, tag, ROMREGION_DATATYPEDISK)
248253#define DISK_IMAGE(name,idx,hash)                   ROMX_LOAD(name, idx, 0, hash, DISK_READWRITE)
r243203r243204
277282/* ----- ROM iteration ----- */
278283
279284/* return pointer to the first ROM region within a source */
280const rom_entry *rom_first_region(const device_t &romp);
285const rom_entry *rom_first_region(const device_t &device);
281286
282287/* return pointer to the next ROM region within a source */
283288const rom_entry *rom_next_region(const rom_entry *romp);
r243203r243204
294299/* return the appropriate name for a rom region */
295300astring &rom_region_name(astring &result, const device_t &device, const rom_entry *romp);
296301
302/* return pointer to the first per-game parameter */
303const rom_entry *rom_first_parameter(const device_t &device);
297304
305/* return pointer to the next per-game parameter */
306const rom_entry *rom_next_parameter(const rom_entry *romp);
298307
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
299315/* ----- disk handling ----- */
300316
301317/* open a disk image, searching up the parent and loading by checksum */
trunk/src/emu/save.c
r243203r243204
213213   return validate_header(header, gamename, sig, errormsg, "");
214214}
215215
216//-------------------------------------------------
217//  dispatch_postload - invoke all registered
218//  postload callbacks for updates
219//-------------------------------------------------
216220
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
217228//-------------------------------------------------
218229//  read_file - read the data from a file
219230//-------------------------------------------------
r243203r243204
253264   }
254265
255266   // call the post-load functions
256   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
257      func->m_func();
267   dispatch_postload();
258268
259269   return STATERR_NONE;
260270}
261271
272//-------------------------------------------------
273//  dispatch_presave - invoke all registered
274//  presave callbacks for updates
275//-------------------------------------------------
262276
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
263284//-------------------------------------------------
264285//  write_file - writes the data to a file
265286//-------------------------------------------------
r243203r243204
287308   file.compress(FCOMPRESS_MEDIUM);
288309
289310   // call the pre-save functions
290   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
291      func->m_func();
311   dispatch_presave();
292312
293313   // then write all the data
294314   for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
trunk/src/emu/save.h
r243203r243204
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
102106   // generic memory registration
103107   void save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
104108
trunk/src/emu/sound/qs1000.c
r243203r243204
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
r243203r243204
129129
130130         if (env_phase == PHASE_NONE) break;
131131
132         tmp = rom[pos>>16];
132         tmp = rom[(pos>>16) & m_rommask];
133133         switch ( type )
134134         {
135135            case TYPE_16:
r243203r243204
331331   }
332332
333333   m_stream = stream_alloc(0, 2, clock()/384);
334
335   m_rommask = m_rom.length() - 1;
334336}
335337
336338
trunk/src/emu/sound/rf5c400.h
r243203r243204
9898private:
9999   required_region_ptr<INT16> m_rom;
100100
101   UINT32 m_rommask;
102
101103   sound_stream *m_stream;
102104
103105   double m_env_ar_table[0x9f];
trunk/src/emu/sound/tiasound.c
r243203r243204
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
r243203r243204
2020
2121
2222/**************************************************
23
23
2424 BARCODE READER MENU
25
25
2626 **************************************************/
2727
2828
r243203r243204
5151void ui_menu_barcode_reader::populate()
5252{
5353   if (current_device())
54   {     
54   {
5555      astring buffer;
5656      const char *new_barcode;
5757
r243203r243204
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}
r243203r243204
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
r0r243204
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
r0r243204
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
r243203r243204
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
r243203r243204
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");
r243203r243204
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();
r243203r243204
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);
r243203r243204
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)
r243203r243204
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)
r243203r243204
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);
r243203r243204
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)
r243203r243204
153153            string.cat("\n");
154154      }
155155   }
156   
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
157182   int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0;
158   int dips = 0, confs = 0;
183   int input_keypad = 0, input_keyboard = 0, dips = 0, confs = 0;
159184   astring errors, dips_opt, confs_opt;
160185   ioport_list portlist;
161186   device_iterator iptiter(*dev);
r243203r243204
176201            input_analog++;
177202         else if (field->type() == IPT_ADJUSTER)
178203            input_adjust++;
204         else if (field->type() == IPT_KEYPAD)
205            input_keypad++;
206         else if (field->type() == IPT_KEYBOARD)
207            input_keyboard++;
179208         else if (field->type() >= IPT_START1 && field->type() < IPT_UI_FIRST)
180209            input++;
181210         else if (field->type() == IPT_DIPSWITCH)
r243203r243204
210239      string.cat("* Dispwitch settings:\n").cat(dips_opt);
211240   if (confs)
212241      string.cat("* Configuration settings:\n").cat(confs_opt);
213   if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust)
242   if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard)
214243      string.cat("* Input device(s):\n");
215244   if (input)
216      string.catprintf("  Player inputs    [%d inputs]\n", input);
245      string.catprintf("  User inputs    [%d inputs]\n", input);
217246   if (input_mj)
218247      string.catprintf("  Mahjong inputs    [%d inputs]\n", input_mj);
219248   if (input_hana)
r243203r243204
224253      string.catprintf("  Analog inputs    [%d inputs]\n", input_analog);
225254   if (input_adjust)
226255      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);
227260
228261   image_interface_iterator imgiter(*dev);
229262   if (imgiter.count() > 0)
r243203r243204
232265      for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next())
233266         string.catprintf("  %s    [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag());
234267   }
235   
268
236269   slot_interface_iterator slotiter(*dev);
237270   if (slotiter.count() > 0)
238271   {
r243203r243204
241274         string.catprintf("  %s    [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----");
242275   }
243276
244   if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + input + input_mj + input_hana + input_gamble + input_analog + input_adjust) == 0)
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)
245279      string.cat("[None]\n");
246280
247281   const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name());
trunk/src/emu/ui/devopt.h
r243203r243204
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
r243203r243204
66
77    TODO
88        - Restrict directory listing by file extension
9        - Support file manager invocation from the main menu for
10          required images
119
1210*********************************************************************/
1311
14#include <stdio.h>
15#include <ctype.h>
16#include <stdlib.h>
17
1812#include "emu.h"
1913#include "ui/ui.h"
2014#include "ui/swlist.h"
2115#include "ui/filemngr.h"
2216#include "ui/filesel.h"
17#include "ui/miscmenu.h"
2318
2419
2520/***************************************************************************
r243203r243204
3025//  ctor
3126//-------------------------------------------------
3227
33ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container)
28ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings) : ui_menu(machine, container)
3429{
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();
3536}
3637
3738
r243203r243204
6364{
6465   // get the image type/id
6566   instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name());
66   
67
6768   // get the base name
6869   if (img->basename() != NULL)
6970   {
7071      filename.cpy(img->basename());
71     
72
7273      // if the image has been loaded through softlist, also show the loaded part
7374      if (img->part_entry() != NULL)
7475      {
r243203r243204
101102   bool first_entry = true;
102103   astring prev_owner;
103104
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
104111   // cycle through all devices for this system
105112   device_iterator iter(machine().root_device());
106113   tagmap_t<UINT8> devtags;
r243203r243204
113120      // check whether it owns an image interface
114121      image_interface_iterator subiter(*dev);
115122      if (subiter.count() > 0)
116      {         
123      {
117124         // if so, cycle through all its image interfaces
118125         image_interface_iterator subiter(*dev);
119126         for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next())
r243203r243204
165172         if (selected_device != NULL)
166173         {
167174            ui_menu::stack_push(selected_device->get_selection_menu(machine(), container));
168           
175
169176            // reset the existing menu
170177            reset(UI_MENU_RESET_REMEMBER_POSITION);
171178         }
172179      }
173180   }
174181}
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
r243203r243204
2020   astring current_file;
2121   device_image_interface *selected_device;
2222
23   ui_menu_file_manager(running_machine &machine, render_container *container);
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);
2426   virtual ~ui_menu_file_manager();
2527   virtual void populate();
2628   virtual void handle();
2729   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
2830
2931   void fill_image_line(device_image_interface *img, astring &instance, astring &filename);
32
33private:
34   astring m_warnings;
3035};
3136
3237#endif  /* __UI_FILEMNGR_H__ */
trunk/src/emu/ui/imgcntrl.c
r243203r243204
1616#include "ui/filesel.h"
1717#include "ui/swlist.h"
1818#include "zippath.h"
19#include "audit.h"
1920
2021
2122/***************************************************************************
r243203r243204
132133void ui_menu_control_device_image::load_software_part()
133134{
134135   astring temp_name(sld->list_name(), ":", swi->shortname(), ":", swp->name());
135   hook_load(temp_name, true);
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   }
136148}
137149
138150
r243203r243204
217229      {
218230         swp = swi->first_part();
219231         load_software_part();
220         ui_menu::stack_pop(machine());
221232      }
222233      break;
223234
r243203r243204
225236      switch(submenu_result) {
226237      case ui_menu_software_parts::T_ENTRY: {
227238         load_software_part();
228         ui_menu::stack_pop(machine());
229239         break;
230240      }
231241
r243203r243204
318328      state = create_ok ? CREATE_FILE : START_FILE;
319329      handle();
320330      break;
321         
331
322332   case DO_CREATE: {
323333      astring path;
324334      zippath_combine(path, current_directory, current_file);
trunk/src/emu/ui/imgcntrl.h
r243203r243204
1414#ifndef __UI_IMGCNTRL_H__
1515#define __UI_IMGCNTRL_H__
1616
17#include "drivenum.h"
18
1719// ======================> ui_menu_control_device_image
1820
1921class ui_menu_control_device_image : public ui_menu {
r243203r243204
2527
2628protected:
2729   enum {
28      START_FILE, START_OTHER_PART, START_SOFTLIST,
29      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
30      START_FILE, START_OTHER_PART, START_SOFTLIST,
31      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
3032      SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, CHECK_CREATE, DO_CREATE, SELECT_SOFTLIST,
3133      LAST_ID
3234   };
trunk/src/emu/ui/imginfo.c
r243203r243204
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
r243203r243204
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
r0r243204
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
r0r243204
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
r243203r243204
154154void ui_menu_input_specific::populate()
155155{
156156   input_item_data *itemlist = NULL;
157   ioport_field *field;
158   ioport_port *port;
159157   int suborder[SEQ_TYPE_TOTAL];
160158   astring tempstring;
159   int port_count = 0;
161160
162161   /* create a mini lookup table for sort order based on sequence type */
163162   suborder[SEQ_TYPE_STANDARD] = 0;
r243203r243204
165164   suborder[SEQ_TYPE_INCREMENT] = 2;
166165
167166   /* iterate over the input ports and add menu items */
168   for (port = machine().ioport().first_port(); port != NULL; port = port->next())
169      for (field = port->first_field(); field != NULL; field = field->next())
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())
170171      {
171172         const char *name = field->name();
172173
r243203r243204
182183            {
183184               sortorder = (field->type() << 2) | (field->player() << 12);
184185               if (strcmp(field->device().tag(), ":"))
185                  sortorder |= 0x10000;
186                  sortorder |= (port_count & 0xfff) * 0x10000;
186187            }
187188            else
188189               sortorder = field->type() | 0xf000;
r243203r243204
212213            }
213214         }
214215      }
216   }
215217
216218   /* sort and populate the menu in a standard fashion */
217219   populate_and_sort(itemlist);
r243203r243204
485487   if (menu_event != NULL && menu_event->itemref != NULL)
486488   {
487489      // reset
488      if ((FPTR)menu_event->itemref == 1)
490      if ((FPTR)menu_event->itemref == 1)
489491      {
490492         if (menu_event->iptkey == IPT_UI_SELECT)
491493            machine().schedule_hard_reset();
r243203r243204
496498         ioport_field *field = (ioport_field *)menu_event->itemref;
497499         ioport_field::user_settings settings;
498500         int changed = false;
499         
501
500502         switch (menu_event->iptkey)
501503         {
502504            /* if selected, reset to default value */
r243203r243204
506508               field->set_user_settings(settings);
507509               changed = true;
508510               break;
509               
511
510512            /* left goes to previous setting */
511513            case IPT_UI_LEFT:
512514               field->select_previous_setting();
513515               changed = true;
514516               break;
515               
517
516518            /* right goes to next setting */
517519            case IPT_UI_RIGHT:
518520               field->select_next_setting();
519521               changed = true;
520522               break;
521523         }
522         
524
523525         /* if anything changed, rebuild the menu, trying to stay on the same field */
524526         if (changed)
525527            reset(UI_MENU_RESET_REMEMBER_REF);
r243203r243204
626628         }
627629   if (type == IPT_DIPSWITCH)
628630      custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0;
629   
631
630632   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
631633   item_append("Reset",  NULL, 0, (void *)1);
632634}
r243203r243204
659661   {
660662      const ioport_diplocation *diploc;
661663      UINT32 selectedmask = 0;
662     
664
663665      // determine the mask of selected bits
664666      if ((FPTR)selectedref != 1)
665667      {
666668         ioport_field *field = (ioport_field *)selectedref;
667         
669
668670         if (field != NULL && field->first_diplocation() != NULL)
669671            for (diploc = field->first_diplocation(); diploc != NULL; diploc = diploc->next())
670672               if (strcmp(dip->name, diploc->name()) == 0)
671673                  selectedmask |= 1 << (diploc->number() - 1);
672674      }
673     
675
674676      // draw one switch
675677      custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask);
676678      y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT);
r243203r243204
882884                  }
883885
884886                  name.cpy(field->name());
885                 
887
886888                  /* allocate a data item for tracking what this menu item refers to */
887889                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
888890                  data->field = field;
trunk/src/emu/ui/mainmenu.c
r243203r243204
1010*********************************************************************/
1111
1212#include "emu.h"
13#include "audit.h"
14#include "crsshair.h"
1315#include "osdnet.h"
1416#include "emuopts.h"
15#include "ui/ui.h"
1617#include "rendutil.h"
1718#include "cheat.h"
1819#include "uiinput.h"
20#include "ui/ui.h"
1921#include "ui/filemngr.h"
2022#include "ui/filesel.h"
2123#include "ui/barcode.h"
22#include "ui/imginfo.h"
24#include "ui/cheatopt.h"
25#include "ui/info.h"
2326#include "ui/inputmap.h"
2427#include "ui/mainmenu.h"
2528#include "ui/miscmenu.h"
2629#include "ui/selgame.h"
30#include "ui/sliders.h"
2731#include "ui/slotopt.h"
2832#include "ui/tapectrl.h"
29#include "audit.h"
30#include "crsshair.h"
31#include <ctype.h>
33#include "ui/videoopt.h"
3234#include "imagedev/cassette.h"
3335#include "imagedev/bitbngr.h"
3436#include "machine/bcreader.h"
r243203r243204
183185         break;
184186
185187      case IMAGE_MENU_FILE_MANAGER:
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
188         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container, NULL)));
187189         break;
188190
189191      case TAPE_CONTROL:
trunk/src/emu/ui/mainmenu.h
r243203r243204
1414#ifndef __UI_MAINMENU_H__
1515#define __UI_MAINMENU_H__
1616
17#include "crsshair.h"
1817#include "drivenum.h"
1918
2019class ui_menu_main : public ui_menu {
trunk/src/emu/ui/menu.c
r243203r243204
1111
1212#include "emu.h"
1313#include "emuopts.h"
14#include "ui/ui.h"
1514#include "rendutil.h"
16#include "uiinput.h"
1715#include "cheat.h"
16#include "uiinput.h"
17#include "ui/ui.h"
1818#include "ui/mainmenu.h"
19#include "ui/miscmenu.h"
20#include <ctype.h>
19#include "ui/cheatopt.h"
2120
2221
2322
trunk/src/emu/ui/miscmenu.c
r243203r243204
99
1010*********************************************************************/
1111
12#include <ctype.h>
13
1412#include "emu.h"
15#include "emuopts.h"
16
17#include "cheat.h"
1813#include "osdnet.h"
19#include "rendutil.h"
2014
2115#include "uiinput.h"
2216#include "ui/ui.h"
2317#include "ui/miscmenu.h"
2418#include "ui/filemngr.h"
2519
26#include "osdepend.h"
2720
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
5421/***************************************************************************
5522    MENU HANDLERS
5623***************************************************************************/
r243203r243204
303270   item_append(tempstring, NULL, MENU_FLAG_MULTILINE, NULL);
304271}
305272
306
307273/*-------------------------------------------------
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/*-------------------------------------------------
882274    menu_crosshair - handle the crosshair settings
883275    menu
884276-------------------------------------------------*/
trunk/src/emu/ui/miscmenu.h
r243203r243204
1414#ifndef __UI_MISCMENU_H__
1515#define __UI_MISCMENU_H__
1616
17#include "crsshair.h"
1817#include "drivenum.h"
18#include "crsshair.h"
1919
2020class ui_menu_keyboard_mode : public ui_menu {
2121public:
r243203r243204
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
10847class ui_menu_crosshair : public ui_menu {
10948public:
11049   ui_menu_crosshair(running_machine &machine, render_container *container);
trunk/src/emu/ui/selgame.c
r243203r243204
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)
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
161161      {
162162         machine().manager().schedule_new_driver(*driver);
163163         machine().schedule_hard_reset();
trunk/src/emu/ui/sliders.c
r0r243204
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
r0r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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         {
r243203r243204
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
r243203r243204
1616#include "render.h"
1717#include "cheat.h"
1818#include "rendfont.h"
19#include "uiinput.h"
1920#include "ui/ui.h"
20#include "uiinput.h"
21#include "ui/cheatopt.h"
2122#include "ui/mainmenu.h"
2223#include "ui/miscmenu.h"
24#include "ui/filemngr.h"
25#include "ui/sliders.h"
2326#include "ui/viewgfx.h"
2427#include "imagedev/cassette.h"
25#include <ctype.h>
2628
2729
2830/***************************************************************************
r243203r243204
306308
307309void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
308310{
309   const int maxstate = 3;
311   const int maxstate = 4;
310312   int str = machine().options().seconds_to_run();
311313   bool show_gameinfo = !machine().options().skip_gameinfo();
312   bool show_warnings = true;
314   bool show_warnings = true, show_mandatory_fileman = true;
313315   int state;
314316
315317   // disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
316318   // or if we are debugging
317319   if (!first_time || (str > 0 && str < 60*5) || &machine().system() == &GAME_NAME(___empty) || (machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
318      show_gameinfo = show_warnings = show_disclaimer = FALSE;
320      show_gameinfo = show_warnings = show_disclaimer = show_mandatory_fileman = FALSE;
319321
320322   #ifdef SDLMAME_EMSCRIPTEN
321323   // also disable for the JavaScript port since the startup screens do not run asynchronously
r243203r243204
352354            if (show_gameinfo && game_info_astring(messagebox_text).len() > 0)
353355               set_handler(handler_messagebox_anykey, 0);
354356            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;
355366      }
356367
357368      // clear the input memory
trunk/src/emu/ui/videoopt.c
r0r243204
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
r0r243204
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
r243203r243204
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)
1718
1819
1920SMS Display Timing
r243203r243204
343344         rec.min_x = SEGA315_5124_LBORDER_START;
344345         rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
345346         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
346         m_y1_bitmap.fill(1, rec);
347         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
347348      }
348349      break;
349350
r243203r243204
358359         rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
359360         rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
360361         m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
361         m_y1_bitmap.fill(1, rec);
362         m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
362363      }
363364      break;
364365
r243203r243204
847848            //logerror("%x %x\n", pixel_plot_x, line);
848849            if (tile_column == 0 && (x_scroll & 0x07))
849850            {
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];
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;
853855            }
854856            else
855857            {
856858               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
859               priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
857860            }
858            priority_selected[pixel_plot_x] = priority_select | (pen_selected & 0x0f);
859861         }
860862      }
861863   }
r243203r243204
10121014
10131015      m_sprite_count = max_sprites;
10141016
1015      if (line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
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])
10161019      {
10171020         m_pending_status |= STATUS_SPROVR;
10181021      }
r243203r243204
10301033   if (m_display_disabled || m_sprite_count == 0)
10311034      return;
10321035
1033   /* Sprites aren't drawn and collisions don't occur on column 0 if it is disabled */
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. */
10341038   if (m_reg[0x00] & 0x20)
10351039      plot_min_x = 8;
10361040
r243203r243204
10841088               continue;
10851089            }
10861090
1091            /* Draw sprite pixel */
1092            /* Check if the background has lower priority */
10871093            if (!(priority_selected[pixel_plot_x] & PRIORITY_BIT))
10881094            {
10891095               line_buffer[pixel_plot_x] = m_current_palette[pen_selected];
r243203r243204
12961302
12971303   if ( line < m_frame_timing[ACTIVE_DISPLAY_V] )
12981304   {
1305      memset(priority_selected, 1, sizeof(priority_selected));
1306
12991307      switch( m_vdp_mode )
13001308      {
13011309      case 0:
1302         memset(priority_selected, 1, sizeof(priority_selected));
13031310         if ( line >= 0 )
13041311         {
13051312            draw_scanline_mode0( blitline_buffer, line );
r243203r243204
13111318         break;
13121319
13131320      case 2:
1314         memset(priority_selected, 1, sizeof(priority_selected));
13151321         if ( line >= 0 )
13161322         {
13171323            draw_scanline_mode2( blitline_buffer, line );
r243203r243204
13241330
13251331      case 4:
13261332      default:
1327         memset(priority_selected, 0, sizeof(priority_selected));
13281333         if ( line >= 0 )
13291334         {
13301335            draw_scanline_mode4( blitline_buffer, priority_selected, line );
r243203r243204
13461351      rec.min_x = pixel_offset_x;
13471352      rec.max_x = pixel_offset_x + 255;
13481353      m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
1349      m_y1_bitmap.fill(1, rec);
1354      m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
13501355   }
13511356   else
13521357   {
r243203r243204
13611366   UINT8  *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
13621367   int x = 0;
13631368
1364   if (m_vdp_mode == 4 && m_reg[0x00] & 0x20)
1369   if (m_vdp_mode == 4 && (m_reg[0x00] & 0x20))
13651370   {
13661371      /* Fill column 0 with overscan color from m_reg[0x07] */
13671372      do
13681373      {
13691374         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1370         p_y1[x] = 1;
1375         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
13711376      }
13721377      while(++x < 8);
13731378   }
r243203r243204
13751380   do
13761381   {
13771382      p_bitmap[x] = m_palette->pen(line_buffer[x]);
1378      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
1383      p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
13791384   }
13801385   while(++x < 256);
13811386}
r243203r243204
13971402      do
13981403      {
13991404         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1400         p_y1[x] = 1; // not verified
1405         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14011406      }
14021407      while (++x < 48);
14031408
r243203r243204
14061411         do
14071412         {
14081413            p_bitmap[x] = m_palette->pen(line_buffer[x]);
1409            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
1414            p_y1[x] = ( priority_selected[x] & 0x0f ) ? 1 : 0;
14101415         }
14111416         while (++x < 208);
14121417      }
r243203r243204
14161421         do
14171422         {
14181423            p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1419            p_y1[x] = 1; // not verified
1424            p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14201425         }
14211426         while (++x < 208);
14221427      }
r243203r243204
14251430      do
14261431      {
14271432         p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
1428         p_y1[x] = 1; // not verified
1433         p_y1[x] = ( m_reg[0x07] & 0x0f ) ? 1 : 0;
14291434      }
14301435      while (++x < 256);
14311436   }
trunk/src/emu/video/h63484.c
r243203r243204
20012001void h63484_device::device_start()
20022002{
20032003   m_display_cb.bind_relative_to(*owner());
2004
2005   register_save_state();
20042006}
20052007
20062008//-------------------------------------------------
r243203r243204
21252127   }
21262128   return 0;
21272129}
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
r243203r243204
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
111113   h63484_display_delegate  m_display_cb;
112114
113115   UINT8 m_ar;
trunk/src/lib/util/astring.h
r243203r243204
3232   ~astring();
3333
3434   // construction with copy
35   astring(const char *string) { init().cpy(string); }
35   astring(const char *string) { init(); if(string) 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
r243203r243204
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
r243203r243204
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
r243203r243204
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/* ---------------------------------------------------------------------- */
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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   }
r243203r243204
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
r243203r243204
341341   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
342342INPUT_PORTS_END
343343
344static INPUT_PORTS_START( 25pacmano )
345   PORT_INCLUDE(20pacgal)
344346
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
345355
346356/*************************************
347357 *
r243203r243204
524534 *************************************/
525535
526536GAME( 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 )
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)
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)
528538
529539GAME( 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)
530540GAME( 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
r243203r243204
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
287276MACHINE_START_MEMBER(actfancr_state,triothep)
288277{
289   MACHINE_START_CALL_MEMBER(actfancr);
290
291278   save_item(NAME(m_trio_control_select));
292279}
293280
294MACHINE_RESET_MEMBER(actfancr_state,actfancr)
295{
296   m_flipscreen = 0;
297}
298
299281MACHINE_RESET_MEMBER(actfancr_state,triothep)
300282{
301   MACHINE_RESET_CALL_MEMBER(actfancr);
302283   m_trio_control_select = 0;
303284}
304285
r243203r243204
314295   MCFG_CPU_ADD("audiocpu",M6502, 1500000) /* Should be accurate */
315296   MCFG_CPU_PROGRAM_MAP(dec0_s_map)
316297
317   MCFG_MACHINE_START_OVERRIDE(actfancr_state,actfancr)
318   MCFG_MACHINE_RESET_OVERRIDE(actfancr_state,actfancr)
319
320298   /* video hardware */
321299   MCFG_SCREEN_ADD("screen", RASTER)
322300   MCFG_SCREEN_REFRESH_RATE(60)
r243203r243204
353331   MCFG_SOUND_ROUTE(3, "mono", 0.50)
354332
355333   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
356   MCFG_YM3812_IRQ_HANDLER(WRITELINE(actfancr_state, sound_irq))
334   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
357335   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
358336
359337   MCFG_OKIM6295_ADD("oki", 1024188, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r243203r243204
409387   MCFG_SOUND_ROUTE(3, "mono", 0.50)
410388
411389   MCFG_SOUND_ADD("ym2", YM3812, XTAL_12MHz/4) /* verified on pcb */
412   MCFG_YM3812_IRQ_HANDLER(WRITELINE(actfancr_state, sound_irq))
390   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
413391   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
414392
415393   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) /* verified on pcb */
trunk/src/mame/drivers/aerofgt.c
r243203r243204
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}
12781274
1279
12801275MACHINE_START_MEMBER(aerofgt_state,common)
12811276{
12821277   save_item(NAME(m_pending_command));
r243203r243204
13431338   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
13441339
13451340   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1346   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1341   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
13471342   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
13481343   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
13491344   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
15021497   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
15031498
15041499   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz ) /* verified on pcb */
1505   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1500   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
15061501   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
15071502   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
15081503   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
15561551   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
15571552
15581553   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1559   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1554   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
15601555   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
15611556   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
15621557   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
16091604   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16101605
16111606   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1612   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1607   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
16131608   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
16141609   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
16151610   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
16631658   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16641659
16651660   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1666   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1661   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
16671662   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
16681663   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
16691664   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
17111706   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
17121707
17131708   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_8MHz)  /* verified on pcb */
1714   MCFG_YM2610_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1709   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
17151710   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
17161711   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
17171712   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
18241819   MCFG_SPEAKER_STANDARD_MONO("mono")
18251820
18261821   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1827   MCFG_YM3812_IRQ_HANDLER(WRITELINE(aerofgt_state, irqhandler))
1822   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
18281823   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18291824
18301825   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/aleck64.c
r243203r243204
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                           |
r243203r243204
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"),
181183         m_dip_read_offset(0) { }
182184
185   optional_shared_ptr<UINT32> m_e90_vram;
186   optional_shared_ptr<UINT32> m_e90_pal;
183187   DECLARE_DRIVER_INIT(aleck64);
184188   DECLARE_WRITE32_MEMBER(aleck_dips_w);
185189   DECLARE_READ32_MEMBER(aleck_dips_r);
186190   DECLARE_READ16_MEMBER(e90_prot_r);
187191   DECLARE_WRITE16_MEMBER(e90_prot_w);
192   UINT32 screen_update_e90(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
188193private:
189194   UINT32 m_dip_read_offset;
190195};
r243203r243204
317322ADDRESS_MAP_END
318323
319324/*
320 E90 protection handlers
325 E90 protection handlers
321326*/
322327
323328READ16_MEMBER(aleck64_state::e90_prot_r)
r243203r243204
327332}
328333
329334WRITE16_MEMBER(aleck64_state::e90_prot_w)
330{   
335{
331336   switch(offset*2)
332337   {
333338      case 0x16:
r243203r243204
337342         if(data & 1) // 0 -> 1 transition
338343         {
339344            //for(int i=0;i<0x1000;i+=4)
340            //   space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
345            //  space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
341346         }
342347         break;
343348      //0x1e bit 0 probably enables the chip
r243203r243204
349354
350355static ADDRESS_MAP_START( e90_map, AS_PROGRAM, 32, aleck64_state )
351356   AM_IMPORT_FROM( n64_map )
352   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM // x/y offsets
353   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM // RGB555 palette
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
354359   AM_RANGE(0xd0030000, 0xd003001f) AM_READWRITE16(e90_prot_r, e90_prot_w,0xffffffff)
355360ADDRESS_MAP_END
356361
r243203r243204
873878   MCFG_N64_PERIPHS_ADD("rcp");
874879MACHINE_CONFIG_END
875880
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
876924static MACHINE_CONFIG_DERIVED( a64_e90, aleck64 )
877925   MCFG_CPU_MODIFY("maincpu")
878926   MCFG_CPU_PROGRAM_MAP(e90_map)
927
928   MCFG_SCREEN_MODIFY("screen")
929   MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90)
879930MACHINE_CONFIG_END
880931
881932DRIVER_INIT_MEMBER(aleck64_state,aleck64)
trunk/src/mame/drivers/aliens.c
r243203r243204
455455   /* second half empty */
456456
457457   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
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) )
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) )
461461   /* second half empty */
462   ROM_LOAD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
462   ROM_LOAD32_WORD( "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
r243203r243204
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}
17941790
1795
17961791/******************************************************************************/
17971792
17981793
r243203r243204
20612056   MCFG_SPEAKER_STANDARD_MONO("mono")
20622057
20632058   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000)
2064   MCFG_YM3812_IRQ_HANDLER(WRITELINE(alpha68k_state, ym3812_irq))
2059   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
20652060   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20662061MACHINE_CONFIG_END
20672062
r243203r243204
22962291   MCFG_SPEAKER_STANDARD_MONO("mono")
22972292
22982293   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000)
2299   MCFG_YM3812_IRQ_HANDLER(WRITELINE(alpha68k_state, ym3812_irq))
2294   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
23002295   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
23012296MACHINE_CONFIG_END
23022297
trunk/src/mame/drivers/bogeyman.c
r243203r243204
1313
1414#include "emu.h"
1515#include "cpu/m6502/m6502.h"
16#include "sound/ay8910.h"
1716#include "includes/bogeyman.h"
1817
1918
r243203r243204
2120
2221// Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad
2322
24WRITE8_MEMBER(bogeyman_state::bogeyman_8910_latch_w)
23WRITE8_MEMBER(bogeyman_state::ay8910_latch_w)
2524{
2625   m_psg_latch = data;
2726}
2827
29WRITE8_MEMBER(bogeyman_state::bogeyman_8910_control_w)
28WRITE8_MEMBER(bogeyman_state::ay8910_control_w)
3029{
3130   // bit 0 is flipscreen
3231   flip_screen_set(data & 0x01);
3332
3433   // bit 5 goes to 8910 #0 BDIR pin
3534   if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00)
36      machine().device<ay8910_device>("ay1")->data_address_w(space, m_last_write >> 4, m_psg_latch);
35      m_ay1->data_address_w(space, m_last_write >> 4, m_psg_latch);
3736
3837   // bit 7 goes to 8910 #1 BDIR pin
3938   if ((m_last_write & 0x80) == 0x80 && (data & 0x80) == 0x00)
40      machine().device<ay8910_device>("ay2")->data_address_w(space, m_last_write >> 6, m_psg_latch);
39      m_ay2->data_address_w(space, m_last_write >> 6, m_psg_latch);
4140
4241   m_last_write = data;
4342}
r243203r243204
4645
4746static ADDRESS_MAP_START( bogeyman_map, AS_PROGRAM, 8, bogeyman_state )
4847   AM_RANGE(0x0000, 0x17ff) AM_RAM
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")
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")
5352   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("spriteram")
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)
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)
5756   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW1")
5857   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW2") AM_WRITENOP // ??? sound
5958   AM_RANGE(0x4000, 0xffff) AM_ROM
r243203r243204
205204{
206205   save_item(NAME(m_psg_latch));
207206   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;
214215}
215216
216WRITE8_MEMBER(bogeyman_state::bogeyman_colbank_w)
217WRITE8_MEMBER(bogeyman_state::colbank_w)
217218{
218219   if((data & 1) != (m_colbank & 1))
219220   {
r243203r243204
237238   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
238239   MCFG_SCREEN_SIZE(32*8, 32*8)
239240   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
240   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update_bogeyman)
241   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update)
241242   MCFG_SCREEN_PALETTE("palette")
242243
243244   MCFG_GFXDECODE_ADD("gfxdecode", "palette", bogeyman)
r243203r243204
249250   MCFG_SPEAKER_STANDARD_MONO("mono")
250251
251252   MCFG_SOUND_ADD("ay1", AY8910, 1500000)  /* Verified */
252   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, bogeyman_colbank_w))
253   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, colbank_w))
253254   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
254255
255256   MCFG_SOUND_ADD("ay2", AY8910, 1500000)  /* Verified */
trunk/src/mame/drivers/btime.c
r243203r243204
19351935
19361936ROM_START( discof )
19371937   ROM_REGION( 0x10000, "maincpu", 0 )
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) )
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) )
19441945
19451946   ROM_REGION( 0x10000, "audiocpu", 0 )
1946   ROM_LOAD( "disco.w6",     0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) )
1947   ROM_LOAD( "w6-.1b",     0xf000, 0x1000, CRC(d81e781e) SHA1(bde510bfed06a13bd56bf7ddbf220e7cf82f79b6) )
19471948
1948   ROM_REGION( 0x0020, "proms", 0 )
1949   ROM_REGION( 0x0020, "proms", 0 ) // board uses 2 proms, not 1
19491950   ROM_LOAD( "disco.clr",    0x0000, 0x0020, CRC(a393f913) SHA1(42dce159283427064b3f5ce3a6e2189744ecd943) )
19501951ROM_END
19511952
trunk/src/mame/drivers/calomega.c
r243203r243204
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
r243203r243204
66
77Robot Bowl           1977  6502   4020-4027, 4010-4013
88Circus               1977  6502   9000-9003, 9004-9011
9Football         Aug,1978  6502   unknown
910Rip Cord         May,1979  6502   RC30-0014 (cpu) 0015 (snd)
1011                                  9023-9026, 9027-9034, 9035
1112Crash           July,1979  6502   CR30-3162 (cpu) 3161 (snd)  9036 (?)
trunk/src/mame/drivers/cps1.c
r243203r243204
92629262   ROM_LOAD( "s92_19.12c",  0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
92639263ROM_END
92649264
9265
92659266/* B-Board 89625B-1 */
92669267ROM_START( cworld2j )
92679268   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r243203r243204
93169317   ROM_LOAD( "ioc1.ic1",     0x0000, 0x0117, CRC(0d182081) SHA1(475b3d417785da4bc512cce2b274bb00d4cc6792) )
93179318ROM_END
93189319
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
93199355/* B-Board 89624B-3 */
93209356ROM_START( varth )
93219357   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
r243203r243204
1168111717GAME( 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
1168211718GAME( 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
1168311719GAME( 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 )
1168411721GAME( 1992, varth,       0,        cps1_12MHz, varth,    cps_state,   cps1,     ROT270, "Capcom", "Varth: Operation Thunderstorm (World 920714)", GAME_SUPPORTS_SAVE )  // "ETC"    // 12MHz verified
1168511722GAME( 1992, varthr1,     varth,    cps1_12MHz, varth,    cps_state,   cps1,     ROT270, "Capcom", "Varth: Operation Thunderstorm (World 920612)", GAME_SUPPORTS_SAVE )  // "ETC"
1168611723GAME( 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
r243203r243204
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
324317void crospang_state::machine_start()
325318{
326319   save_item(NAME(m_bestri_tilebank));
r243203r243204
372365   MCFG_SPEAKER_STANDARD_MONO("mono")
373366
374367   MCFG_SOUND_ADD("ymsnd", YM3812, 14318180/4)
375   MCFG_YM3812_IRQ_HANDLER(WRITELINE(crospang_state, irqhandler))
368   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
376369   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
377370
378371   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/ddenlovr.c
r243203r243204
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"
115113#include "machine/msm6242.h"
116114#include "machine/nvram.h"
117115#include "includes/dynax.h"
r243203r243204
153151{
154152public:
155153   ddenlovr_state(const machine_config &mconfig, device_type type, const char *tag)
156      : dynax_state(mconfig, type, tag)
157      { }
154      : dynax_state(mconfig, type, tag),
155      m_dsw_sel16(*this, "dsw_sel16"),
156      m_protection1(*this, "protection1"),
157      m_protection2(*this, "protection2") { }
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
159219   DECLARE_MACHINE_START(ddenlovr);
160220   DECLARE_MACHINE_RESET(ddenlovr);
161221   DECLARE_VIDEO_START(ddenlovr);
r243203r243204
350410   DECLARE_VIDEO_START(htengoku);
351411   DECLARE_WRITE8_MEMBER(htengoku_dsw_w);
352412   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 );
353427
354428   void ddenlovr_flipscreen_w( UINT8 data );
355429   void ddenlovr_blit_flip_w( UINT8 data );
r243203r243204
368442   void mmpanic_update_leds();
369443   void mjchuuka_get_romdata();
370444   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 );
385445};
386446
387447VIDEO_START_MEMBER(ddenlovr_state,ddenlovr)
r243203r243204
19161976   AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r)                             // Video Chip
19171977
19181978   AM_RANGE(0x3002c0, 0x3002c1) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)// Sound
1919   AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
1979   AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
19201980   AM_RANGE(0x300340, 0x30035f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
19211981   AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
19221982   AM_RANGE(0x300384, 0x300385) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243203r243204
19682028   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                       // ? must be 78 on startup (not necessary in ddlover)
19692029   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
19702030   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                             // Video Chip
1971   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
2031   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
19722032   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
19732033   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
19742034   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243203r243204
20352095   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
20362096   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
20372097
2038   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
2098   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
20392099   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
20402100   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
20412101   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243203r243204
20732133   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
20742134   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
20752135
2076   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
2136   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
20772137   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
20782138   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
20792139   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243203r243204
21472207   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                           // ? must be 78 on startup (not necessary in ddlover)
21482208   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
21492209   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                                 // Video Chip
2150   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
2210   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
21512211   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
21522212   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
21532213   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243203r243204
22102270   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
22112271   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
22122272
2213   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
2273   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
22142274   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
22152275   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
22162276   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243203r243204
22662326   AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r)
22672327
22682328   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2269   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
2329   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
22702330
22712331   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
22722332   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243203r243204
23032363
23042364   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
23052365   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2306   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
2366   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
23072367
23082368   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
23092369   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243203r243204
24572517   AM_RANGE(0x02, 0x02) AM_READNOP     // read just before port 00
24582518   AM_RANGE(0x04, 0x04) AM_NOP                 // read only once at the start
24592519   AM_RANGE(0x06, 0x06) AM_WRITENOP    // almost always 1, sometimes 0
2460   AM_RANGE(0x08, 0x09) AM_DEVWRITE("ymsnd", ym2413_device, write)
2520   AM_RANGE(0x08, 0x09) AM_DEVWRITE("ym2413", ym2413_device, write)
24612521   AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd", ay8910_device, data_w)
24622522   AM_RANGE(0x0e, 0x0e) AM_DEVWRITE("aysnd", ay8910_device, address_w)
24632523ADDRESS_MAP_END
r243203r243204
27402800   AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w)
27412801   AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w)
27422802   AM_RANGE(0x96, 0x96) AM_READ(hanakanz_rand_r)
2743   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
2803   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
27442804   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
27452805   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
27462806ADDRESS_MAP_END
r243203r243204
27562816   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
27572817   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
27582818   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2759   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
2819   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
27602820   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
27612821   AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
27622822   AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w)
r243203r243204
27782838   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
27792839   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
27802840   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2781   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
2841   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
27822842   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
27832843//  AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
27842844   AM_RANGE(0xb1, 0xb1) AM_READ_PORT("KEYB0")
r243203r243204
28022862   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28032863   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28042864   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2805   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
2865   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
28062866   AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
28072867//  AM_RANGE(0x91, 0x91) AM_READ(hanakanz_keyb_r)
28082868   AM_RANGE(0x91, 0x91) AM_READ_PORT("KEYB0")
r243203r243204
28412901   AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM")
28422902   AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r)
28432903   AM_RANGE(0x97, 0x97) AM_WRITE(hanakanz_coincounter_w)
2844   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
2904   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
28452905   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
28462906   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
28472907ADDRESS_MAP_END
r243203r243204
29693029   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4")
29703030   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5")     // DSW 1-4 high bits
29713031   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2972   AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ymsnd", ym2413_device, write)
3032   AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ym2413", ym2413_device, write)
29733033   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
29743034   AM_RANGE(0xe0, 0xe1) AM_MIRROR(0xff00) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
29753035ADDRESS_MAP_END
r243203r243204
30783138   AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r)
30793139   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
30803140   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3081   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write)
3141   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write)
30823142   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
30833143   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
30843144   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243203r243204
32433303   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
32443304   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)
32453305   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
3246   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write)
3306   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write)
32473307   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
32483308   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
32493309   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243203r243204
33663426   AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w)
33673427   AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r)
33683428   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3369   AM_RANGE(0x82, 0x83) AM_DEVWRITE("ymsnd", ym2413_device, write)
3429   AM_RANGE(0x82, 0x83) AM_DEVWRITE("ym2413", ym2413_device, write)
33703430   AM_RANGE(0x84, 0x84) AM_DEVREAD("aysnd", ay8910_device, data_r)
33713431   AM_RANGE(0x86, 0x86) AM_DEVWRITE("aysnd", ay8910_device, data_w)
33723432   AM_RANGE(0x88, 0x88) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243203r243204
34093469   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)        // ? ack on RTC int
34103470   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
34113471   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3412   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write)
3472   AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write)
34133473   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
34143474   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
34153475   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243203r243204
35003560   AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r)
35013561   AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w)
35023562   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3503   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write)
3563   AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write)
35043564   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
35053565   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
35063566   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
r243203r243204
35463606   AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r)
35473607   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
35483608   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3549   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write)
3609   AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write)
35503610   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
35513611   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
35523612   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243203r243204
36463706   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
36473707   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
36483708
3649   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
3709   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
36503710   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
36513711   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
36523712   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243203r243204
37373797   AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
37383798   AM_RANGE(0x0181, 0x0181) AM_WRITENOP                        // ? int. enable
37393799   AM_RANGE(0x0184, 0x0184) AM_WRITE(mjflove_coincounter_w)
3740   AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ymsnd", ym2413_device, write)
3800   AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ym2413", ym2413_device, write)
37413801   AM_RANGE(0x0280, 0x028f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
37423802   AM_RANGE(0x0300, 0x0301) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
37433803   AM_RANGE(0x0380, 0x0380) AM_DEVREADWRITE("oki", okim6295_device, read, write)
r243203r243204
37783838   AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w)
37793839   AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w)
37803840   AM_RANGE(0x63, 0x64) AM_READ(hanakanz_gfxrom_r)
3781   AM_RANGE(0x80, 0x81) AM_DEVWRITE("ymsnd", ym2413_device, write)
3841   AM_RANGE(0x80, 0x81) AM_DEVWRITE("ym2413", ym2413_device, write)
37823842   AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
37833843   AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
37843844ADDRESS_MAP_END
r243203r243204
38413901static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, ddenlovr_state )
38423902   ADDRESS_MAP_GLOBAL_MASK(0xff)
38433903   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3844   AM_RANGE(0x02, 0x03) AM_DEVWRITE("ymsnd", ym2413_device, write)
3904   AM_RANGE(0x02, 0x03) AM_DEVWRITE("ym2413", ym2413_device, write)
38453905   AM_RANGE(0x04, 0x05) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
38463906   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(sryudens_rambank_w)    // ? ack on RTC int
38473907   AM_RANGE(0x1e, 0x1e) AM_WRITE(mjflove_rombank_w)
r243203r243204
39283988   AM_RANGE(0x70, 0x70) AM_WRITE(quizchq_oki_bank_w)
39293989   AM_RANGE(0x80, 0x80) AM_RAM
39303990   AM_RANGE(0x90, 0x90) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3931   AM_RANGE(0x92, 0x93) AM_DEVWRITE("ymsnd", ym2413_device, write)
3991   AM_RANGE(0x92, 0x93) AM_DEVWRITE("ym2413", ym2413_device, write)
39323992   AM_RANGE(0x94, 0x95) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
39333993ADDRESS_MAP_END
39343994
r243203r243204
40004060   AM_RANGE(0x38, 0x38) AM_READNOP         // ? ack or watchdog
40014061   AM_RANGE(0x40, 0x41) AM_WRITE(mjflove_blitter_w)
40024062   AM_RANGE(0x43, 0x43) AM_READ(rongrong_gfxrom_r)
4003   AM_RANGE(0x50, 0x51) AM_DEVWRITE("ymsnd", ym2413_device, write)
4063   AM_RANGE(0x50, 0x51) AM_DEVWRITE("ym2413", ym2413_device, write)
40044064   AM_RANGE(0x54, 0x54) AM_DEVREADWRITE("oki", okim6295_device, read, write)
40054065   AM_RANGE(0x58, 0x58) AM_DEVWRITE("aysnd", ay8910_device, address_w)
40064066   AM_RANGE(0x5c, 0x5c) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w)   // dsw
r243203r243204
41544214   AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    // AY8910
41554215   AM_RANGE( 0x42, 0x42 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     //
41564216   AM_RANGE( 0x44, 0x44 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   //
4157   AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
4217   AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
41584218   AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
41594219   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE(ddenlovr_palette_base_w)    // ddenlovr mixer chip
41604220   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE(ddenlovr_palette_mask_w)
r243203r243204
42264286   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(ddenlovr_state, htengoku_dsw_w))
42274287   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
42284288
4229   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
4289   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
42304290   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42314291
42324292   /* devices */
r243203r243204
43414401   AM_RANGE(0x42, 0x44) AM_READ(hanakanz_gfxrom_r)
43424402   AM_RANGE(0x8a, 0x8b) AM_READ(daimyojn_year_hack_r)  // ?
43434403   AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
4344   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write)
4404   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write)
43454405   AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("oki", okim6295_device, read, write)
43464406   AM_RANGE(0xa8, 0xa8) AM_READ_PORT("SYSTEM")
43474407   AM_RANGE(0xaa, 0xaa) AM_READ(daimyojn_keyb1_r)
r243203r243204
93019361   save_item(NAME(m_mjflove_irq_cause));
93029362   save_item(NAME(m_daimyojn_palette_sel));
93039363   save_item(NAME(m_palram));
9304
9305   save_item(NAME(m_irq_count));
93069364}
93079365
93089366MACHINE_RESET_MEMBER(ddenlovr_state,ddenlovr)
r243203r243204
93239381   m_hginga_rombank = 0;
93249382   m_mjflove_irq_cause = 0;
93259383   m_daimyojn_palette_sel = 0;
9326   m_irq_count = 0;
93279384
93289385   m_quiz365_protection[0] = 0;
93299386   m_quiz365_protection[1] = 0;
r243203r243204
94359492   /* sound hardware */
94369493   MCFG_SPEAKER_STANDARD_MONO("mono")
94379494
9438   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
9495   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
94399496   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
94409497
94419498   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 16)  // or /8 ?
r243203r243204
95539610   /* sound hardware */
95549611   MCFG_SPEAKER_STANDARD_MONO("mono")
95559612
9556   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified
9613   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified
95579614   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50)
95589615
95599616   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz/28, OKIM6295_PIN7_HIGH) // clock frequency verified 1.022MHz, pin 7 verified high
r243203r243204
96379694   /* sound hardware */
96389695   MCFG_SPEAKER_STANDARD_MONO("mono")
96399696
9640   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
9697   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
96419698   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
96429699
96439700   MCFG_SOUND_ADD("aysnd", AY8910, 3579545)
r243203r243204
97149771   /* sound hardware */
97159772   MCFG_SPEAKER_STANDARD_MONO("mono")
97169773
9717   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
9774   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
97189775   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
97199776
97209777   MCFG_OKIM6295_ADD("oki", 1022720, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r243203r243204
97609817   /* sound hardware */
97619818   MCFG_SPEAKER_STANDARD_MONO("mono")
97629819
9763   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_37516MHz / 8)
9820   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_37516MHz / 8)
97649821   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
97659822
97669823   MCFG_OKIM6295_ADD("oki", XTAL_28_37516MHz / 28, OKIM6295_PIN7_HIGH)
r243203r243204
1012910186   /* sound hardware */
1013010187   MCFG_SPEAKER_STANDARD_MONO("mono")
1013110188
10132   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
10189   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
1013310190   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1013410191
1013510192   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
r243203r243204
1017210229   /* sound hardware */
1017310230   MCFG_SPEAKER_STANDARD_MONO("mono")
1017410231
10175   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
10232   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
1017610233   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1017710234
1017810235   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243203r243204
1021910276   /* sound hardware */
1022010277   MCFG_SPEAKER_STANDARD_MONO("mono")
1022110278
10222   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
10279   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
1022310280   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1022410281
1022510282   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243203r243204
1028610343   /* sound hardware */
1028710344   MCFG_SPEAKER_STANDARD_MONO("mono")
1028810345
10289   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
10346   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
1029010347   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1029110348
1029210349   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243203r243204
1033610393   /* sound hardware */
1033710394   MCFG_SPEAKER_STANDARD_MONO("mono")
1033810395
10339   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
10396   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
1034010397   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1034110398
1034210399   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/dec0.c
r243203r243204
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
r243203r243204
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
19171909INTERRUPT_GEN_MEMBER(dec8_state::gondo_interrupt)
19181910{
19191911   if (m_nmi_enable)
r243203r243204
22542246   MCFG_SOUND_ROUTE(3, "mono", 0.20)
22552247
22562248   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2257   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
2249   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
22582250   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
22592251MACHINE_CONFIG_END
22602252
r243203r243204
24182410   MCFG_SOUND_ROUTE(3, "mono", 0.20)
24192411
24202412   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2421   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
2413   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
24222414   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
24232415MACHINE_CONFIG_END
24242416
r243203r243204
24752467   MCFG_SOUND_ROUTE(3, "mono", 0.50)
24762468
24772469   MCFG_SOUND_ADD("ym2", YM3812, 3000000)
2478   MCFG_YM3812_IRQ_HANDLER(WRITELINE(dec8_state, irqhandler))
2470   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
24792471   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
24802472MACHINE_CONFIG_END
24812473
trunk/src/mame/drivers/deniam.c
r243203r243204
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
233224void deniam_state::machine_start()
234225{
235226   save_item(NAME(m_display_enable));
r243203r243204
289280   MCFG_SPEAKER_STANDARD_MONO("mono")
290281
291282   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_25MHz/6) /* "SM64" ym3812 clone; 4.166470 measured, = 4.166666Mhz verified */
292   MCFG_YM3812_IRQ_HANDLER(WRITELINE(deniam_state, irqhandler))
283   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
293284   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
294285
295286   MCFG_OKIM6295_ADD("oki", XTAL_25MHz/24, OKIM6295_PIN7_HIGH) /* 1.041620 measured, = 1.0416666Mhz verified */
r243203r243204
322313   MCFG_SPEAKER_STANDARD_MONO("mono")
323314
324315   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))
326316   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
327317
328318   MCFG_OKIM6295_ADD("oki", XTAL_25MHz/24, OKIM6295_PIN7_HIGH)  /* 1.041620 measured, = 1.0416666Mhz verified */
trunk/src/mame/drivers/dgpix.c
r243203r243204
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);
r243203r243204
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
r243203r243204
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
305358    D2K Jumpman returns Notes
306359    =========================
307360
r243203r243204
313366    6800 and E800.
314367
315368
316Donkey Kong "Hard" Kit
317======================
369    Donkey Kong "Hard" Kit
370    ======================
318371
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.
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.
323376
324Hopefully confirmation and information will come along later which confirms
325this is a legitimate Nintendo Kit.
377    Hopefully confirmation and information will come along later which confirms
378    this is a legitimate Nintendo Kit.
326379
327380***************************************************************************/
328381
r243203r243204
18941947   ROM_LOAD( "trs01v1d.bin",    0x0300, 0x0100, BAD_DUMP CRC(1b828315) SHA1(00c9f8c5ae86b68d38c66f9071b5f1ef421c1005) ) /* character color codes on a per-column basis */
18951948ROM_END
18961949
1897ROM_START( dkong )
1950ROM_START( dkong ) /* Confirmed TKG-04 Upgrade as mentioned in Nintendo Service Department Bulletin # TKG-02 12-11-81 */
18981951   ROM_REGION( 0x10000, "maincpu", 0 )
18991952   ROM_LOAD( "c_5et_g.bin",  0x0000, 0x1000, CRC(ba70b88b) SHA1(d76ebecfea1af098d843ee7e578e480cd658ac1a) )
19001953   ROM_LOAD( "c_5ct_g.bin",  0x1000, 0x1000, CRC(5ec461ec) SHA1(acb11a8fbdbb3ab46068385fe465f681e3c824bd) )
r243203r243204
22542307   ROM_LOAD( "v-2n.bpr",  0x0200, 0x0100, CRC(dbf185bf) SHA1(2697a991a4afdf079dd0b7e732f71c7618f43b70) )   /* character color codes on a per-column basis */
22552308ROM_END
22562309
2257ROM_START( dkongjre )
2310ROM_START( dkongjre )  /* Confirmed E-Kit set mentioned in Nintendo Service Department Bulletin # DJR-03 (02-23-83) */
22582311   ROM_REGION( 0x10000, "maincpu", 0 )
22592312   ROM_LOAD( "djr1-c.5b",    0x0000, 0x1000, CRC(ffe9e1a5) SHA1(715dc79d85169b4c1faf43458592e69b434afefd) )
22602313   ROM_CONTINUE(             0x3000, 0x1000 )
r243203r243204
22912344   ROM_REGION( 0x10000, "maincpu", 0 )
22922345   ROM_LOAD( "dkjr1-c.5b-p", 0x0000, 0x1000, CRC(8d99b3e0) SHA1(311a9f353e62d9d07c678e45baa2efec575a8f3b) ) // does not match SUM16 of bulletin (see notes), definitely not from Nintendo
22932346   ROM_CONTINUE(             0x3000, 0x1000 )
2294   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) ) // "
2347   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) )
22952348   ROM_CONTINUE(             0x4800, 0x0800 )
22962349   ROM_CONTINUE(             0x1000, 0x0800 )
22972350   ROM_CONTINUE(             0x5800, 0x0800 )
trunk/src/mame/drivers/dynax.c
r243203r243204
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"
8482#include "machine/nvram.h"
8583#include "rendlay.h"
8684
r243203r243204
534532   AM_RANGE( 0x74, 0x74 ) AM_WRITE(dynax_blitter_ack_w)        // Blitter IRQ Ack
535533   AM_RANGE( 0x76, 0x76 ) AM_WRITE(dynax_blit_palbank_w)       // Layers Palettes (High Bit)
536534   AM_RANGE( 0x77, 0x77 ) AM_WRITE(hanamai_layer_half_w)       // half of the interleaved layer to write to
537   AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) // 2 x DSW
535   AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) // 2 x DSW
538536   AM_RANGE( 0x7a, 0x7b ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)   // AY8910
539537//  AM_RANGE( 0x7c, 0x7c ) AM_WRITENOP   // CRT Controller
540538//  AM_RANGE( 0x7d, 0x7d ) AM_WRITENOP   //
r243203r243204
556554   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW2")         // DSW3
557555   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
558556   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
559   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
557   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
560558   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
561559   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
562560   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
r243203r243204
640638
641639   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
642640   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
643   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
641   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
644642
645643   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
646644   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
r243203r243204
780778   AM_RANGE( 0x11, 0x17 ) AM_WRITE(dynax_blitter_rev2_w)       // Blitter
781779   AM_RANGE( 0x20, 0x20 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
782780   AM_RANGE( 0x22, 0x22 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
783   AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
781   AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
784782   AM_RANGE( 0x28, 0x28 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
785783   AM_RANGE( 0x2a, 0x2a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
786784   AM_RANGE( 0x48, 0x48 ) AM_WRITE(dynax_extra_scrollx_w)  // screen scroll X
r243203r243204
819817   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW1")         // DSW3
820818   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
821819   AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
822   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
820   AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
823821   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
824822   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
825823   AM_RANGE( 0x40, 0x40 ) AM_WRITE(dynax_blit_pen_w)       // Destination Pen
r243203r243204
847845static ADDRESS_MAP_START( sprtmtch_io_map, AS_IO, 8, dynax_state )
848846   ADDRESS_MAP_GLOBAL_MASK(0xff)
849847   AM_RANGE( 0x01, 0x07 ) AM_WRITE(dynax_blitter_rev2_w)       // Blitter
850   AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)  // 2 x DSW
848   AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write)  // 2 x DSW
851849//  AM_RANGE( 0x12, 0x12 ) AM_WRITENOP   // CRT Controller
852850//  AM_RANGE( 0x13, 0x13 ) AM_WRITENOP   // CRT Controller
853851   AM_RANGE( 0x20, 0x20 ) AM_READ_PORT("P1")               // P1
r243203r243204
893891   AM_RANGE( 0x63, 0x63 ) AM_READ(hanamai_keyboard_0_r)        // P1
894892   AM_RANGE( 0x64, 0x64 ) AM_READ_PORT("DSW0")         // DSW
895893   AM_RANGE( 0x67, 0x67 ) AM_READ_PORT("DSW1")         // DSW
896   AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
894   AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
897895//  AM_RANGE( 0x80, 0x80 ) AM_WRITENOP   // IRQ ack?
898896ADDRESS_MAP_END
899897
r243203r243204
902900   ADDRESS_MAP_GLOBAL_MASK(0xff)
903901   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
904902   AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
905   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
903   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
906904   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
907905   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
908906   AM_RANGE( 0x10, 0x10 ) AM_WRITE(hanamai_keyboard_w)     // keyboard row select
r243203r243204
10241022   AM_RANGE( 0x10, 0x10 ) AM_WRITE(jantouki_sound_vblank_ack_w)    // VBlank IRQ Ack
10251023   AM_RANGE( 0x21, 0x21 ) AM_DEVREAD("aysnd", ay8910_device, data_r)         // AY8910
10261024   AM_RANGE( 0x22, 0x23 ) AM_DEVWRITE("aysnd", ay8910_device, data_address_w)   //
1027   AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) //
1025   AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) //
10281026   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)      // MSM5205 reset
10291027   AM_RANGE( 0x40, 0x40 ) AM_WRITE(adpcm_data_w)               // MSM5205 data
10301028   AM_RANGE( 0x50, 0x50 ) AM_READ(jantouki_soundlatch_status_r)    // Soundlatch status
r243203r243204
10601058   ADDRESS_MAP_GLOBAL_MASK(0xff)
10611059   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
10621060   AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w)           // MSM5205 data
1063   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write)        //
1061   AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write)        //
10641062   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
10651063   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
10661064   AM_RANGE( 0x11, 0x12 ) AM_WRITE(mjelctrn_blitter_ack_w) //?
r243203r243204
13391337   AM_RANGE( 0x10000, 0x10000 ) AM_DEVREAD("aysnd", ay8910_device, data_r)       // AY8910
13401338   AM_RANGE( 0x10008, 0x10008 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) //
13411339   AM_RANGE( 0x10010, 0x10010 ) AM_DEVWRITE("aysnd", ay8910_device, address_w)  //
1342   AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ymsnd", ym2413_device, write)      //
1340   AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ym2413", ym2413_device, write)      //
13431341   AM_RANGE( 0x10040, 0x10040 ) AM_WRITE(dynax_blit_pen_w)     // Destination Pen
13441342   AM_RANGE( 0x10044, 0x10044 ) AM_WRITE(tenkai_blit_dest_w)       // Destination Layer
13451343   AM_RANGE( 0x10048, 0x10048 ) AM_WRITE(tenkai_blit_palette23_w)  // Layers Palettes
r243203r243204
14811479         case 0x8050:    // CRT controller
14821480         case 0x8051:    return;
14831481
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;
1482         case 0x8070:    m_ym2413->register_port_w(space, 0, data);    return;
1483         case 0x8071:    m_ym2413->data_port_w(space, 0, data);    return;
14861484
14871485         case 0x8060:    m_keyb = data;  return;
14881486
r243203r243204
39673965
39683966MACHINE_START_MEMBER(dynax_state,dynax)
39693967{
3970   m_ymsnd = machine().device("ymsnd");
3971
39723968   save_item(NAME(m_sound_irq));
39733969   save_item(NAME(m_vblank_irq));
39743970   save_item(NAME(m_blitter_irq));
r243203r243204
40934089   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
40944090   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
40954091
4096   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
4092   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
40974093   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
40984094   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
40994095   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW0"))
r243203r243204
41474143   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41484144   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41494145
4150   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
4146   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
41514147   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41524148
41534149   MCFG_SOUND_ADD("msm", MSM5205, 384000)
r243203r243204
41944190   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41954191   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41964192
4197   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz )
4193   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_3_579545MHz )
41984194   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41994195
42004196   MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz )
r243203r243204
42384234   /* sound hardware */
42394235   MCFG_SPEAKER_STANDARD_MONO("mono")
42404236
4241   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
4237   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
42424238   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
42434239   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
42444240   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1"))
r243203r243204
42834279   /* sound hardware */
42844280   MCFG_SPEAKER_STANDARD_MONO("mono")
42854281
4286   MCFG_SOUND_ADD("ymsnd", YM2413, 24000000/6)
4282   MCFG_SOUND_ADD("ym2413", YM2413, 24000000/6)
42874283   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42884284MACHINE_CONFIG_END
42894285
r243203r243204
43834379   membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000],  0x8000);
43844380   membank("bank2")->configure_entries(0, 12,   &SOUND[0x8000], 0x8000);
43854381
4386   m_top_scr = machine().device("top");
4387   m_bot_scr = machine().device("bottom");
4388
43894382   MACHINE_START_CALL_MEMBER(dynax);
43904383}
43914384
r243203r243204
44374430   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
44384431   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
44394432
4440   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
4433   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
44414434   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, jantouki_sound_callback))
44424435   MCFG_SOUND_ROUTE(0, "mono", 0.20)
44434436   MCFG_SOUND_ROUTE(1, "mono", 0.20)
r243203r243204
46164609   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46174610   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46184611
4619   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
4612   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
46204613   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46214614
46224615   /* devices */
r243203r243204
46874680   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46884681   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46894682
4690   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_24MHz / 8) // ?
4683   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_24MHz / 8) // ?
46914684   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46924685MACHINE_CONFIG_END
46934686
trunk/src/mame/drivers/eolith.c
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
186186
187187WRITE8_MEMBER(exidy_state::fax_bank_select_w)
188188{
189   UINT8 *RAM = memregion("maincpu")->base();
189   membank("bank1")->set_entry(data & 0x1f);
190190
191   membank("bank1")->set_base(&RAM[0x10000 + (0x2000 * (data & 0x1f))]);
192191   if ((data & 0x1f) > 0x17)
193      logerror("Banking to unpopulated ROM bank %02X!\n",data & 0x1f);
192      logerror("Banking to unpopulated ROM bank %02X!\n", data & 0x1f);
193
194194}
195195
196196
197
198197/*************************************
199198 *
200199 *  Main CPU memory handlers
r243203r243204
15371536
15381537DRIVER_INIT_MEMBER(exidy_state,fax)
15391538{
1540   address_space &space = m_maincpu->space(AS_PROGRAM);
1539   //address_space &space = m_maincpu->space(AS_PROGRAM);
15411540
15421541   exidy_video_config(0x04, 0x04, TRUE);
15431542
1544   /* reset the ROM bank */
1545   fax_bank_select_w(space,0,0);
1543   membank("bank1")->configure_entries(0, 32, memregion("maincpu")->base() + 0x10000, 0x2000);
15461544}
15471545
15481546
trunk/src/mame/drivers/exidyttl.c
r243203r243204
66 Attack (1977)
77 Death Race (1976)
88 Destruction Derby (1975)
9 Football (1978)
109 Old Time Basketball (1976)
1110 Spiders From Space (1976)
1211 Score (1977)
trunk/src/mame/drivers/funkball.c
r243203r243204
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; graphics ROMs
57      FLASH.U3     - Intel Strata-Flash DA28F320J5 SSOP56 contained on a plug-in daughterboard; main program
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
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
r243203r243204
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"
7981
8082
8183class funkball_state : public pcat_base_state
r243203r243204
8486   funkball_state(const machine_config &mconfig, device_type type, const char *tag)
8587      : pcat_base_state(mconfig, type, tag),
8688         m_voodoo(*this, "voodoo_0"),
87         m_unk_ram(*this, "unk_ram"){ }
89         m_unk_ram(*this, "unk_ram"),
90         m_flashbank(*this, "flashbank")
91   { }
8892
8993   UINT8 m_funkball_config_reg_sel;
9094   UINT8 m_funkball_config_regs[256];
9195   UINT32 m_cx5510_regs[256/4];
92   UINT16 m_flash_addr;
9396   UINT8 *m_bios_ram;
94   UINT8 m_flash_cmd;
95   UINT8 m_flash_data_cmd;
9697
9798   UINT32 m_biu_ctrl_reg[256/4];
9899
100   UINT32 flashbank_addr;
101
99102   // devices
100103   required_device<voodoo_1_device> m_voodoo;
101104
102105   required_shared_ptr<UINT32> m_unk_ram;
106   required_device<address_map_bank_device> m_flashbank;
103107
104108   DECLARE_READ8_MEMBER( get_slave_ack );
105   DECLARE_WRITE8_MEMBER( flash_w );
106   DECLARE_READ8_MEMBER( flash_data_r );
107   DECLARE_WRITE8_MEMBER( flash_data_w );
109   DECLARE_WRITE32_MEMBER( flash_w );
108110//  DECLARE_WRITE8_MEMBER( bios_ram_w );
109111   DECLARE_READ8_MEMBER( test_r );
110112   DECLARE_READ8_MEMBER( serial_r );
r243203r243204
272274   }
273275}
274276
275WRITE8_MEMBER( funkball_state::flash_w )
277WRITE32_MEMBER(funkball_state::flash_w)
276278{
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}
279   COMBINE_DATA(&flashbank_addr);
280   int tempbank = (flashbank_addr & 0x7fff) | ((flashbank_addr & 0x00800000) >> 8);
281   m_flashbank->set_bank(tempbank);
294282
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
283   // note, other bits get used, but ignoring to keep the virtual bank space size sane.
301284
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;
321285}
322286
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}
332287
333288READ32_MEMBER(funkball_state::biu_ctrl_r)
334289{
r243203r243204
378333static ADDRESS_MAP_START(funkball_map, AS_PROGRAM, 32, funkball_state)
379334   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
380335   AM_RANGE(0x000a0000, 0x000affff) AM_RAM
381   AM_RANGE(0x000b0000, 0x000bffff) AM_READWRITE8(flash_data_r,flash_data_w,0xffffffff)
336   AM_RANGE(0x000b0000, 0x000bffff) AM_DEVICE("flashbank", address_map_bank_device, amap32)
382337   AM_RANGE(0x000c0000, 0x000cffff) AM_RAM
383338   AM_RANGE(0x000d0000, 0x000dffff) AM_RAM
384339   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1")
r243203r243204
398353   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)    /* System BIOS */
399354ADDRESS_MAP_END
400355
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
401363static ADDRESS_MAP_START(funkball_io, AS_IO, 32, funkball_state)
402364   AM_RANGE(0x0020, 0x0023) AM_READWRITE8(io20_r, io20_w, 0xffff0000)
403365   AM_IMPORT_FROM(pcat32_io_common)
r243203r243204
409371
410372   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
411373
412   AM_RANGE(0x0360, 0x0363) AM_WRITE8(flash_w,0xffffffff)
374   AM_RANGE(0x0360, 0x0363) AM_WRITE(flash_w)
413375
414376//  AM_RANGE(0x0320, 0x0323) AM_READ(test_r)
415377   AM_RANGE(0x0360, 0x036f) AM_READ8(test_r,0xffffffff) // inputs
r243203r243204
862824   MCFG_IDE_CONTROLLER_ADD("ide", ata_devices, "hdd", NULL, true)
863825   MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir6_w))
864826
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
865834   /* video hardware */
866835   MCFG_DEVICE_ADD("voodoo_0", VOODOO_1, STD_VOODOO_1_CLOCK)
867836   MCFG_VOODOO_FBMEM(2)
r243203r243204
875844   MCFG_SCREEN_UPDATE_DRIVER(funkball_state, screen_update)
876845   MCFG_SCREEN_SIZE(1024, 1024)
877846   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")
878851MACHINE_CONFIG_END
879852
880853ROM_START( funkball )
881854   ROM_REGION32_LE(0x20000, "bios", ROMREGION_ERASEFF)
882855   ROM_LOAD( "512k-epr.u62", 0x010000, 0x010000, CRC(cced894a) SHA1(298c81716e375da4b7215f3e588a45ca3ea7e35c) )
883856
884   ROM_REGION(0x8000000, "prg_flash", ROMREGION_ERASE00)
885   ROM_LOAD16_WORD_SWAP( "flash.u3", 0x0000000, 0x400000, CRC(fb376abc) SHA1(ea4c48bb6cd2055431a33f5c426e52c7af6997eb) )
857   ROM_REGION(0x400000, "u3", ROMREGION_ERASE00) // Sound Program / Samples
858   ROM_LOAD16_WORD_SWAP( "flash.u3", 0x000000, 0x400000, CRC(fb376abc) SHA1(ea4c48bb6cd2055431a33f5c426e52c7af6997eb) )
886859
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) )
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) )
890865ROM_END
891866
892867
trunk/src/mame/drivers/fuukifg2.c
r243203r243204
381381
382382***************************************************************************/
383383
384WRITE_LINE_MEMBER(fuuki16_state::soundirq)
385{
386   m_audiocpu->set_input_line(0, state);
387}
388
389384/*
390385    - Interrupts (pbancho) -
391386
r243203r243204
475470   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.15)
476471
477472   MCFG_SOUND_ADD("ym2", YM3812, XTAL_28_64MHz / 8) /* 3.58 MHz */
478   MCFG_YM3812_IRQ_HANDLER(WRITELINE(fuuki16_state, soundirq))
473   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
479474   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
480475   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
481476
trunk/src/mame/drivers/fuukifg3.c
r243203r243204
540540}
541541
542542
543WRITE_LINE_MEMBER(fuuki32_state::irqhandler)
544{
545   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
546}
547
548543static MACHINE_CONFIG_START(fuuki32, fuuki32_state)
549544
550545   /* basic machine hardware */
r243203r243204
575570   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
576571
577572   MCFG_SOUND_ADD("ymf1", YMF278B, YMF278B_STD_CLOCK) // 33.8688MHz
578   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(fuuki32_state, irqhandler))
573   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
579574   MCFG_SOUND_ROUTE(0, "lspeaker", 0.50)
580575   MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
581576
trunk/src/mame/drivers/galaxian.c
r243203r243204
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
14861505
14871506static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state )
14881507   ADDRESS_MAP_UNMAP_HIGH
r243203r243204
51115130   MCFG_FRAGMENT_ADD(galaxian_audio)
51125131MACHINE_CONFIG_END
51135132
5133static MACHINE_CONFIG_DERIVED( spactrai, galaxian )
51145134
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
51155141static MACHINE_CONFIG_DERIVED( pacmanbl, galaxian )
51165142
51175143   /* separate tile/sprite ROMs */
r243203r243204
72567282   ROM_LOAD( "warofbug.clr", 0x0000, 0x0020, CRC(8688e64b) SHA1(ed13414257f580b98b50c9892a14159c55e7838d) )
72577283ROM_END
72587284
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) )
72597293
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
72607303/*  Galaxian hardware mods for War of the Bugs warofbug/warofbugg
72617304
72627305(WotB using daughterboard that plugs into Z80 socket - has a socketed PAL, two other 20-pin ICs,
r243203r243204
1069610739GAME( 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 )
1069710740GAME( 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 )
1069810741GAME( 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 )
1069910743GAME( 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?
1070010744GAME( 1981, redufob,     redufo,   galaxian,   redufob,    galaxian_state, nolock,     ROT90,  "bootleg", "Defend the Terra Attack on the Red UFO (bootleg)", GAME_SUPPORTS_SAVE ) // rev A?
1070110745GAME( 19??, exodus,      redufo,   galaxian,   redufo,     galaxian_state, nolock,     ROT90,  "bootleg? (Subelectro)", "Exodus (bootleg?)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/galspnbl.c
r243203r243204
204204GFXDECODE_END
205205
206206
207
208WRITE_LINE_MEMBER(galspnbl_state::irqhandler)
209{
210   m_audiocpu->set_input_line(0, state);
211}
212
213
214207void galspnbl_state::machine_start()
215208{
216209}
r243203r243204
252245   MCFG_SPEAKER_STANDARD_MONO("mono")
253246
254247   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* Use value from Super Pinball Action - NEEDS VERIFICATION!! */
255   MCFG_YM3812_IRQ_HANDLER(WRITELINE(galspnbl_state, irqhandler))
248   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
256249   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
257250
258251   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
r243203r243204
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
r243203r243204
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
r243203r243204
229229
230230static MACHINE_CONFIG_START( gumbo, gumbo_state )
231231
232   MCFG_CPU_ADD("maincpu", M68000, 14318180 /2)     // or 10mhz? ?
232   MCFG_CPU_ADD("maincpu", M68000, XTAL_14_31818MHz/2)
233233   MCFG_CPU_PROGRAM_MAP(gumbo_map)
234234   MCFG_CPU_VBLANK_INT_DRIVER("screen", gumbo_state,  irq1_line_hold) // all the same
235235
r243203r243204
248248
249249   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
250250
251   MCFG_OKIM6295_ADD("oki", 1122000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
251   MCFG_OKIM6295_ADD("oki", XTAL_14_31818MHz/16, 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
r243203r243204
152152
153153/*****************************************************************************/
154154
155WRITE_LINE_MEMBER(hcastle_state::irqhandler)
156{
157//  m_audiocpu->set_input_line(state);
158}
159
160155WRITE8_MEMBER(hcastle_state::volume_callback)
161156{
162157   m_k007232->set_volume(0, (data >> 4) * 0x11, 0);
r243203r243204
229224   MCFG_SOUND_ROUTE(1, "mono", 0.50)
230225
231226   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
232   MCFG_YM3812_IRQ_HANDLER(WRITELINE(hcastle_state, irqhandler))
227   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) /* from schematic; NMI handler is just a retn */
233228   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
234229
235230   MCFG_K051649_ADD("k051649", 3579545/2)
trunk/src/mame/drivers/hikaru.c
r243203r243204
570570   /* ic65 unpopulated */
571571   /* ic66 unpopulated */
572572
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) )
573   // 834-14149   2000     317-0294-COM   Hikaru
574   ROM_PARAMETER( ":rom_board:segam2crypt:key", "091b02c7" )
576575ROM_END
577576
578577
r243203r243204
609608   ROM_LOAD32_WORD( "mpr-23560.ic65", 0xe000000, 0x1000000, CRC(24bb7072) SHA1(dad5135c89d292e4a1f96bd0ad28be6a17154be0) )
610609   ROM_LOAD32_WORD( "mpr-23564.ic66", 0xe000002, 0x1000000, CRC(255724b6) SHA1(1b382fad165831de3f2e39352c031146759dfc69) )
611610
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) )
611   // 834-14144   2001     317-0297-COM   Hikaru
612   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0912c68a" )
615613ROM_END
616614
617615ROM_START( podrace )
r243203r243204
664662   ROM_LOAD32_WORD("mpr-23117.ic68s" , 0xf000002, 0x0800000, CRC(9d4d3529) SHA1(66008445629681ebf2f26b3f181d8524a8576d2f))
665663
666664   // current 315-5881 decryption simulation code can't produce valid output data with any of keys
667   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
665   // 834-14002   2001     317-0277-COM   Hikaru
666   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0903dad5" )
668667ROM_END
669668
670669ROM_START( braveff )
r243203r243204
708707   ROM_LOAD32_WORD( "mpr-22022.ic59s", 0xb000000, 0x800000, CRC(abd3d888) SHA1(9654c3a38feab46b4983a602831fb29cccdd0526) )
709708   ROM_LOAD32_WORD( "mpr-22023.ic60s", 0xb000002, 0x800000, CRC(07f00869) SHA1(92282d09d72d3e65a91128e06bb0d4426bb90be5) )
710709
711   // 315-5881 not populated
712   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
710   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0" ) // 315-5881 not populated
713711ROM_END
714712
715713ROM_START( sgnascar )
r243203r243204
738736   ROM_LOAD32_WORD( "mpr-23483.ic32", 0xc000002, 0x1000000, CRC(c37adebe) SHA1(e84f6d2cc364c743f7f3b73d8c8d0271952bb093) )
739737   ROM_LOAD32_WORD( "mpr-23480.ic33", 0xe000000, 0x1000000, CRC(f517b8b3) SHA1(c04740adb612473c4c9f8186e7e93d2f73d1bb1a) )
740738   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" )
741743ROM_END
742744
743745GAME( 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
r243203r243204
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 incuded all the courses from all the previous years in the Fore! series.
79        version included 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
r243203r243204
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 (defualt)" and "Off -- UNUSED --" */
1618   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" 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 ) )
r243203r243204
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 (defualt)" and "Off -- UNUSED --" */
1634   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" 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 ) )
r243203r243204
24502450   ROM_CONTINUE(                 0x08000, 0x08000 )
24512451
24522452   ROM_REGION( 0x880000, "gfx1", 0 )
2453   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2453   /* No known set specifically 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) )
r243203r243204
24852485   ROM_CONTINUE(                 0x08000, 0x08000 )
24862486
24872487   ROM_REGION( 0x880000, "gfx1", 0 )
2488   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2488   /* No known set specifically 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) )
r243203r243204
25202520   ROM_CONTINUE(                 0x08000, 0x08000 )
25212521
25222522   ROM_REGION( 0x880000, "gfx1", 0 )
2523   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2523   /* No known set specifically 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) )
r243203r243204
25552555   ROM_CONTINUE(                 0x08000, 0x08000 )
25562556
25572557   ROM_REGION( 0x880000, "gfx1", 0 )
2558   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2558   /* No known set specifically 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) )
r243203r243204
25902590   ROM_CONTINUE(                 0x08000, 0x08000 )
25912591
25922592   ROM_REGION( 0x880000, "gfx1", 0 )
2593   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2593   /* No known set specifically 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) )
r243203r243204
26252625   ROM_CONTINUE(                 0x08000, 0x08000 )
26262626
26272627   ROM_REGION( 0x880000, "gfx1", 0 )
2628   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
2628   /* No known set specifically 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) )
r243203r243204
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 specificaly checks for these roms in this format
3357   This is the only set that specifically 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) )
r243203r243204
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 Superme PCBs have been seen  */
4039   /* The Euro version has different GROM2_x compared to the standard US versions.  GT Supreme 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) )
r243203r243204
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 lastest "NR" versions.
4508        through gtclassic will use the latest "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 aditional course, Coconut Cove from GT99
4514     showing the title as GT Supreme Plus! and the Hole-In-One board shows an additional 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 specificly 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 specifically 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
r243203r243204
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}
590586
591
592
593587/*************************************
594588 *
595589 *  Machine initialization
r243203r243204
16551649
16561650   /* sound hardware */
16571651   MCFG_SOUND_ADD("ymsnd", YM2203, CLOCK_8MHz/2)
1658   MCFG_YM2203_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
1652   MCFG_YM2203_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
16591653   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(itech8_state, ym2203_portb_out))
16601654   MCFG_SOUND_ROUTE(0, "mono", 0.07)
16611655   MCFG_SOUND_ROUTE(1, "mono", 0.07)
r243203r243204
16751669
16761670   /* sound hardware */
16771671   MCFG_SOUND_ADD("ymsnd", YM2608, CLOCK_8MHz)
1678   MCFG_YM2608_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
1672   MCFG_YM2608_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
16791673   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(itech8_state, ym2203_portb_out))
16801674   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
16811675MACHINE_CONFIG_END
r243203r243204
16941688
16951689   /* sound hardware */
16961690   MCFG_SOUND_ADD("ymsnd", YM3812, CLOCK_8MHz/2)
1697   MCFG_YM3812_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
1691   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
16981692   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
16991693
17001694   MCFG_OKIM6295_ADD("oki", CLOCK_8MHz/8, OKIM6295_PIN7_HIGH) // was /128, not /132, so unsure so pin 7 not verified
r243203r243204
17101704
17111705   /* sound hardware */
17121706   MCFG_SOUND_ADD("ymsnd", YM3812, CLOCK_8MHz/2)
1713   MCFG_YM3812_IRQ_HANDLER(WRITELINE(itech8_state, generate_sound_irq))
1707   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", M6809_FIRQ_LINE))
17141708   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
17151709
17161710   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
r243203r243204
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
630625static MACHINE_CONFIG_START( lordgun, lordgun_state )
631626   MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
632627   MCFG_CPU_PROGRAM_MAP(lordgun_map)
r243203r243204
668663   MCFG_SPEAKER_STANDARD_MONO("mono")
669664
670665   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_3_579545MHz)
671   MCFG_YM3812_IRQ_HANDLER(WRITELINE(lordgun_state, soundirq))
666   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
672667   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
673668
674669   MCFG_OKIM6295_ADD("oki", XTAL_20MHz / 20, OKIM6295_PIN7_HIGH)   // ? 5MHz can't be right!
r243203r243204
718713
719714   MCFG_SOUND_ADD("ymf", YMF278B, 26000000)            // ? 26MHz matches video (decrease for faster music tempo)
720715   MCFG_DEVICE_ADDRESS_MAP(AS_0, ymf278_map)
721   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(lordgun_state, soundirq))
716   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
722717   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
723718
724719   MCFG_OKIM6295_ADD("oki", XTAL_20MHz / 20, OKIM6295_PIN7_HIGH)   // ? 5MHz can't be right
trunk/src/mame/drivers/m58.c
r243203r243204
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(yard_videoram_w) AM_SHARE("videoram")
30   AM_RANGE(0x9000, 0x9fff) AM_WRITE(yard_scroll_panel_w)
29   AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
30   AM_RANGE(0x9000, 0x9fff) AM_WRITE(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(yard_flipscreen_w)    /* + coin counters */
37   AM_RANGE(0xd001, 0xd001) AM_WRITE(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")
r243203r243204
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_yard)
206   MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update)
207207   MCFG_SCREEN_PALETTE("palette")
208208
209209   /* sound hardware */
trunk/src/mame/drivers/mappy.c
r243203r243204
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, "bootleg? (Sidam)", "Phozon (Sidam)", GAME_SUPPORTS_SAVE )
2465GAME( 1983, phozons,  phozon,   phozon,   phozon, mappy_state,   phozon,        ROT90, "Namco (Sidam license)", "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
r243203r243204
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
264258/***************************************************************************
265259
266260
r243203r243204
16081602   membank("bank1")->set_base(&RAM[bankaddress]);
16091603}
16101604
1611WRITE_LINE_MEMBER(metro_state::blzntrnd_irqhandler)
1612{
1613   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1614}
1615
16161605static ADDRESS_MAP_START( blzntrnd_sound_map, AS_PROGRAM, 8, metro_state )
16171606   AM_RANGE(0x0000, 0x7fff) AM_ROM
16181607   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
r243203r243204
36603649
36613650   MCFG_SOUND_ADD("ymf", YMF278B, YMF278B_STD_CLOCK)
36623651   MCFG_DEVICE_ADDRESS_MAP(AS_0, ymf278_map)
3663   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(metro_state, ymf278b_interrupt))
3652   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 2))
36643653   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
36653654   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
36663655MACHINE_CONFIG_END
r243203r243204
43844373   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
43854374
43864375   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_16MHz/2)
4387   MCFG_YM2610_IRQ_HANDLER(WRITELINE(metro_state, blzntrnd_irqhandler))
4376   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
43884377   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
43894378   MCFG_SOUND_ROUTE(0, "rspeaker", 0.25)
43904379   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
trunk/src/mame/drivers/midtunit.c
r243203r243204
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, 0x0160003f) AM_READ(midtunit_input_r)
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")
4750   AM_RANGE(0x01800000, 0x0187ffff) AM_RAM_WRITE(midtunit_paletteram_w) AM_SHARE("paletteram")
4851   AM_RANGE(0x01a80000, 0x01a800ff) AM_READWRITE(midtunit_dma_r, midtunit_dma_w)
4952   AM_RANGE(0x01b00000, 0x01b0001f) AM_WRITE(midtunit_control_w)
trunk/src/mame/drivers/model2.c
r243203r243204
124124#include "sound/2612intf.h"
125125#include "includes/model2.h"
126126
127
128127enum {
129128   DSP_TYPE_TGP    = 1,
130129   DSP_TYPE_SHARC  = 2,
r243203r243204
12231222
12241223/* Protection handling */
12251224
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};
12371225
1238static const UINT8 DCOPKey1326[]=
1226READ32_MEMBER(model2_state::model2_5881prot_r)
12391227{
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{
12451228   UINT32 retval = 0;
12461229
1247   if (offset == 0x10000/4)
1230   if (offset == 0x0000/4)
12481231   {
12491232      // status: bit 0 = 1 for busy, 0 for ready
1250      return 0;   // we're always ready
1233      retval = 0;   // we're always ready
12511234   }
1252   else if (offset == 0x1000e/4)
1235   else if (offset == 0x000e/4)
12531236   {
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;
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      }
12681244      else
1269         return 0xfff0;
1245      {
1246         UINT8* base;
1247         retval = m_cryptdevice->do_decrypt(base);
1248         retval = ((retval & 0xff00) >> 8) | ((retval & 0x00ff) << 8);
1249         retval <<= 16;
1250      }
12701251   }
12711252   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
12721253
1254   logerror("model2_5881prot_r %08x: %08x (%08x)\n", offset*4, retval, mem_mask);
1255
12731256   return retval;
12741257}
12751258
1276WRITE32_MEMBER(model2_state::model2_prot_w)
1259WRITE32_MEMBER(model2_state::model2_5881prot_w)
12771260{
1278   if (mem_mask == 0xffff0000)
1279   {
1280      data >>= 16;
1281   }
1261   logerror("model2_5881prot_w %08x: %08x (%08x)\n", offset*4, data, mem_mask);
12821262
1283   if (offset == 0x10008/4)
1263
1264   if (offset == 0x0008/4)
12841265   {
1285      m_protpos = data;
1286   }
1287   else if (offset == 0x1000c/4)
1288   {
1289      switch (data)
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)
12901271      {
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;
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);
13311275      }
1276      first_read = 1;
13321277   }
1333   else if (offset == 0x7ff2/4)
1278   else if (offset == 0x000c/4)
13341279   {
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      }
1280      printf("subkey %08x (%08x)\n", data, mem_mask);
1281      m_cryptdevice->set_subkey(data&0xffff);
13401282   }
1341   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
1283   else printf("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
13421284
13431285}
13441286
1287
1288
13451289/* Daytona "To The MAXX" PIC protection simulation */
13461290
13471291
r243203r243204
25342478   MCFG_SEGAM1AUDIO_ADD("m1audio")
25352479MACHINE_CONFIG_END
25362480
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
25372497READ8_MEMBER(model2_state::driveio_port_r)
25382498{
25392499   return m_driveio_comm_data;
r243203r243204
26312591   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
26322592MACHINE_CONFIG_END
26332593
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
26342606static ADDRESS_MAP_START( copro_tgpx4_map, AS_PROGRAM, 32, model2_state )
26352607   AM_RANGE(0x00000000, 0x00007fff) AM_RAM AM_SHARE("tgpx4_program")
26362608ADDRESS_MAP_END
r243203r243204
26902662   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
26912663MACHINE_CONFIG_END
26922664
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
26932671/* ROM definitions */
26942672
26952673/*
r243203r243204
27532731   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
27542732   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
27552733
2734   //             1997     317-5038-COM   Model 2
2735   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
2736
27562737   MODEL2_CPU_BOARD
27572738   MODEL2A_VID_BOARD
27582739ROM_END
r243203r243204
27852766   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
27862767   ROM_LOAD("mpr-20304.33", 0x200000, 0x200000, CRC(6decfe83) SHA1(d73adafceff2f1776c93e53bd5677d67f1c2c08f) )
27872768
2769   //             1997     317-5038-COM   Model 2
2770   ROM_PARAMETER( ":315_5881:key", "042c0d13" )
2771
27882772   MODEL2_CPU_BOARD
27892773   MODEL2A_VID_BOARD
27902774ROM_END
r243203r243204
28162800   ROM_REGION( 0x400000, "scsp", 0 ) // Samples
28172801   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
28182802   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" )
28192806ROM_END
28202807
28212808ROM_START( zerogunj ) /* Zero Gunner (Japan), Model 2B */
r243203r243204
28452832   ROM_REGION( 0x400000, "scsp", 0 ) // Samples
28462833   ROM_LOAD("mpr-20303.32", 0x000000, 0x200000, CRC(c040973f) SHA1(57a496c5dcc1a3931b6e41bf8d41e45d6dac0c31) )
28472834   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" )
28482838ROM_END
28492839
28502840ROM_START( gunblade ) /* Gunblade NY Revision A, Model 2B, Sega game ID# 833-12562 GUN BLADE, Sega ROM board ID# 834-12563 */
r243203r243204
35803570   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
35813571   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
35823572
3573   //             1998     317-0236-COM   Model 2
3574   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
3575
35833576   MODEL2_CPU_BOARD
35843577   MODEL2A_VID_BOARD
35853578ROM_END
r243203r243204
36283621   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
36293622   ROM_LOAD("mpr-20815.37", 0x600000, 0x200000, CRC(1b5aaae4) SHA1(32b4bf6c096fdccdd5d8f1ddb6c27d3389a52234) )
36303623
3624   //             1998     317-0236-COM   Model 2
3625   ROM_PARAMETER( ":315_5881:key", "0c2a4a93" )
3626
36313627   MODEL2_CPU_BOARD
36323628   MODEL2A_VID_BOARD
36333629ROM_END
r243203r243204
36753671   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) )
36763672   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
36773673   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" )
36783677ROM_END
36793678
36803679ROM_START( dyndeka2b ) /* Dynamite Deka 2 (Japan), Model 2B */
r243203r243204
37203719   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) )
37213720   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) )
37223721   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" )
37233725ROM_END
37243726
37253727ROM_START( dynamcopc ) /* Dynamite Cop (USA), Model 2C */
r243203r243204
37653767   ROM_LOAD("mpr-20813.32", 0x200000, 0x200000, CRC(1908679c) SHA1(32913385f09da2e43af0c4a4612b955527bfe759) ) /* Located at position 33 on 2C-CRX rom board */
37663768   ROM_LOAD("mpr-20814.36", 0x400000, 0x200000, CRC(e8ebc74c) SHA1(731ce721bb9e148f3a9f7fbe569522567a681c4e) ) /* Located at position 34 on 2C-CRX rom board */
37673769   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" )
37683773ROM_END
37693774
37703775ROM_START( schamp ) /* Sonic Championship, Model 2B - Sega ROM board ID# 834-12786 */
r243203r243204
43074312   ROM_LOAD("mpr-21279.sd3", 0x0400000, 0x200000, CRC(3a8dcf68) SHA1(312496b45b699051c8b4dd0e5d94e73fe5f3ad8d) )
43084313   ROM_LOAD("mpr-21280.sd4", 0x0600000, 0x200000, CRC(aa548124) SHA1(a94adfe16b5c3236746451c181ccd3e1c27432f4) )
43094314
4315   //             1998     317-5044-COM   Model 2
4316   ROM_PARAMETER( ":315_5881:key", "042e2dc1" )
4317
43104318   MODEL2_CPU_BOARD
43114319   MODEL2A_VID_BOARD
43124320ROM_END
r243203r243204
43464354   ROM_LOAD("mpr-21278.sd2", 0x0200000, 0x200000, CRC(27e18e08) SHA1(254c0ad4d6bd572ff0efc3ea80489e73716a31a7) )
43474355   ROM_LOAD("mpr-21279.sd3", 0x0400000, 0x200000, CRC(3a8dcf68) SHA1(312496b45b699051c8b4dd0e5d94e73fe5f3ad8d) )
43484356   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" )
43494360ROM_END
43504361
43514362ROM_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 */
r243203r243204
58805891
58815892DRIVER_INIT_MEMBER(model2_state,genprot)
58825893{
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;
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));
58855897}
58865898
58875899DRIVER_INIT_MEMBER(model2_state,pltkids)
58885900{
5889   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
5901   DRIVER_INIT_CALL(genprot);
58905902
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
58945903   // fix bug in program: it destroys the interrupt table and never fixes it
5904   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
58955905   ROM[0x730/4] = 0x08000004;
58965906}
58975907
58985908DRIVER_INIT_MEMBER(model2_state,zerogun)
58995909{
5900   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
5910   DRIVER_INIT_CALL(genprot);
59015911
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
59055912   // fix bug in program: it destroys the interrupt table and never fixes it
5913   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59065914   ROM[0x700/4] = 0x08000004;
59075915}
59085916
r243203r243204
59395947
59405948DRIVER_INIT_MEMBER(model2_state,sgt24h)
59415949{
5942   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
5950//  DRIVER_INIT_CALL(genprot);
59435951
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));
59455952   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));
59465953
5947   m_protstate = m_protpos = 0;
5948
5954   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59495955   ROM[0x56578/4] = 0x08000004;
59505956   //ROM[0x5b3e8/4] = 0x08000004;
59515957}
r243203r243204
59585964
59595965DRIVER_INIT_MEMBER(model2_state,doa)
59605966{
5967   m_0229crypt->install_doa_protection();
5968
59615969   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
59665970   ROM[0x630/4] = 0x08000004;
59675971   ROM[0x808/4] = 0x08000004;
59685972}
r243203r243204
59915995GAME( 1994, vcopa,        vcop, model2o, vcop,    driver_device, 0,       ROT0, "Sega",   "Virtua Cop (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
59925996
59935997// Model 2A-CRX (TGPs, SCSP sound board)
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 )
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 )
60126016
60136017// Model 2B-CRX (SHARC, SCSP sound board)
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 )
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 )
60396043
60406044// Model 2C-CRX (TGPx4, SCSP sound board)
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 )
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 )
trunk/src/mame/drivers/model3.c
r243203r243204
665665#include "includes/model3.h"
666666
667667
668
668669void model3_state::update_irq_state()
669670{
670671   if ((m_irq_enable & m_irq_state) || m_scsi_irq_state)
r243203r243204
16731674}
16741675
16751676
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};
16921677
1693static const UINT16 swt_prot_data[] =
1678READ64_MEMBER(model3_state::model3_5881prot_r)
16941679{
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};
1680   UINT64 retvalue = U64(0xffffffffffffffff);
17041681
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};
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      }
17171702
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};
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   }
17281709
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};
1710   return retvalue;
17391711
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*/
17561712
1757READ64_MEMBER(model3_state::model3_security_r)
1713}
1714
1715WRITE64_MEMBER(model3_state::model3_5881prot_w)
17581716{
1759   switch(offset)
1717   if (offset == 0x10 / 8)
17601718   {
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      }
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;
18221727   }
1823   return U64(0xffffffffffffffff);
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   }
18241739}
18251740
18261741WRITE64_MEMBER(model3_state::daytona2_rombank_w)
r243203r243204
18471762   AM_RANGE(0xf00c0000, 0xf00dffff) AM_MIRROR(0x0e000000) AM_RAM AM_SHARE("backup")    /* backup SRAM */
18481763   AM_RANGE(0xf0100000, 0xf010003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_sys_r, model3_sys_w )
18491764   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 */
18521765
18531766   AM_RANGE(0xf1000000, 0xf10f7fff) AM_READWRITE(model3_char_r, model3_char_w )    /* character RAM */
18541767   AM_RANGE(0xf10f8000, 0xf10fffff) AM_READWRITE(model3_tile_r, model3_tile_w )    /* tilemaps */
r243203r243204
34213334
34223335   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
34233336   ROM_FILL( 0x000000, 0x80000, 0 )
3337
3338   //             ????     317-0237-COM   Model 3
3339   ROM_PARAMETER( ":315_5881:key", "09234e96" )
34243340ROM_END
34253341
34263342ROM_START( vs29815 )    /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 */
r243203r243204
35713487
35723488   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
35733489   ROM_FILL( 0x000000, 0x80000, 0 )
3490
3491   //             ????     317-0245-COM   Model 3
3492   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
35743493ROM_END
35753494
35763495ROM_START( vs299b ) /* Step 2.0 */
r243203r243204
36463565
36473566   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
36483567   ROM_FILL( 0x000000, 0x80000, 0 )
3568
3569   //             ????     317-0245-COM   Model 3
3570   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
36493571ROM_END
36503572
36513573ROM_START( vs299a ) /* Step 2.0 */
r243203r243204
37213643
37223644   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
37233645   ROM_FILL( 0x000000, 0x80000, 0 )
3646
3647   //             ????     317-0245-COM   Model 3
3648   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
37243649ROM_END
37253650
37263651ROM_START( vs299 )  /* Step 2.0 */
r243203r243204
37963721
37973722   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
37983723   ROM_FILL( 0x000000, 0x80000, 0 )
3724
3725   //             ????     317-0245-COM   Model 3
3726   ROM_PARAMETER( ":315_5881:key", "09222ac8" )
37993727ROM_END
38003728
38013729ROM_START( von2 )   /* Step 2.0 */
r243203r243204
38723800
38733801   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
38743802   ROM_FILL( 0x000000, 0x80000, 0 )
3803
3804   //             ????     317-0234-COM   Model 3
3805   ROM_PARAMETER( ":315_5881:key", "092a0e97" )
38753806ROM_END
38763807
38773808ROM_START( von254g )    /* Step 2.0, Sega game ID# is 833-13789 */
r243203r243204
39483879
39493880   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
39503881   ROM_FILL( 0x000000, 0x80000, 0 )
3882
3883   //             ????     317-0234-COM   Model 3
3884   ROM_PARAMETER( ":315_5881:key", "092a0e97" )
39513885ROM_END
39523886
39533887ROM_START( skichamp )   /* Step 2.0 */
r243203r243204
40924026
40934027   ROM_REGION( 0x10000, "ffcpu", 0 )   /* force feedback controller prg */
40944028   ROM_LOAD( "epr21119.ic8",  0x00000, 0x10000, CRC(65082b14) SHA1(6c3c192dd6ef3780c6202dd63fc6086328928818) )
4029
4030   //             ????     317-0241-COM   Model 3
4031   ROM_PARAMETER( ":315_5881:key", "11272a01" )
40954032ROM_END
40964033
40974034ROM_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 */
r243203r243204
41614098
41624099   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
41634100   ROM_FILL( 0x000000, 0x80000, 0 )
4101
4102   //             ????     317-0241-COM   Model 3
4103   ROM_PARAMETER( ":315_5881:key", "11272a01" )
41644104ROM_END
41654105
41664106ROM_START( dirtdvls )   /* Step 2.1, Sega game ID# is 833-13427, ROM board ID# 834-13528 DRT */
r243203r243204
42224162
42234163   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
42244164   ROM_FILL( 0x000000, 0x80000, 0 )
4165
4166   //             ????     317-0238-COM   Model 3
4167   ROM_PARAMETER( ":315_5881:key", "09290f17" )
42254168ROM_END
42264169
42274170ROM_START( dirtdvlsa )  /* Step 2.1 */
r243203r243204
42834226
42844227   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
42854228   ROM_FILL( 0x000000, 0x80000, 0 )
4229
4230   //             ????     317-0238-COM   Model 3
4231   ROM_PARAMETER( ":315_5881:key", "09290f17" )
42864232ROM_END
42874233
42884234ROM_START( daytona2 )   /* Step 2.1, ROM board ID# 834-13428 DAYTONA USA2, Security board ID# 837-13507-COM */
r243203r243204
43634309
43644310   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
43654311   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" )
43664315ROM_END
43674316
43684317ROM_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 */
r243203r243204
44434392
44444393   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
44454394   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
44464398ROM_END
44474399
44484400ROM_START( srally2 )    /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 834-13374 SRT TWIN */
r243203r243204
47954747
47964748   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
47974749   ROM_FILL( 0x000000, 0x80000, 0 )
4750
4751   //             ????     317-0235-COM   Model 3
4752   ROM_PARAMETER( ":315_5881:key", "09260e96" )
47984753ROM_END
47994754
48004755ROM_START( spikeout )   /* Step 2.1 */
r243203r243204
48724827
48734828   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
48744829   ROM_FILL( 0x000000, 0x80000, 0 )
4830
4831   //             ????     317-0240-COM   Model 3
4832   ROM_PARAMETER( ":315_5881:key", "092f2b04" )
48754833ROM_END
48764834
48774835ROM_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 */
r243203r243204
49494907
49504908   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
49514909   ROM_FILL( 0x000000, 0x80000, 0 )
4910
4911   //             ????     317-0247-COM   Model 3
4912   ROM_PARAMETER( ":315_5881:key", "09236fc8" )
49524913ROM_END
49534914
49544915ROM_START( eca )    /* Step 2.1, ROM board ID# 834-13946-01 ECA */
r243203r243204
50174978
50184979   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
50194980   ROM_FILL( 0x000000, 0x80000, 0 )
4981
4982   //             ????     317-0265-COM   Model 3
4983   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
50204984ROM_END
50214985
50224986ROM_START( ecax )   /* Step 2.1 */
r243203r243204
50855049
50865050   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
50875051   ROM_FILL( 0x000000, 0x80000, 0 )
5052
5053   //             ????     317-0265-COM   Model 3
5054   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
50885055ROM_END
50895056
50905057ROM_START( ecap )   /* Step 2.1 - Proto or Location test - No security dongle */
r243203r243204
51565123
51575124   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
51585125   ROM_FILL( 0x000000, 0x80000, 0 )
5126
5127   //             ????     317-0265-COM   Model 3
5128   ROM_PARAMETER( ":315_5881:key", "0923aa91" )
51595129ROM_END
51605130
51615131ROM_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 */
r243203r243204
52125182
52135183   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
52145184   ROM_FILL( 0x000000, 0x80000, 0 )
5185
5186   //             ????     317-0243-COM   Model 3
5187   ROM_PARAMETER( ":315_5881:key", "09266e45" )
52155188ROM_END
52165189
52175190ROM_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) */
r243203r243204
52805253
52815254   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
52825255   ROM_FILL( 0x000000, 0x80000, 0 )
5256
5257   //             ????     317-0242-COM   Model 3
5258   ROM_PARAMETER( ":315_5881:key", "092b6a01" )
52835259ROM_END
52845260
52855261ROM_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) */
r243203r243204
53495325
53505326   ROM_REGION( 0x80000, "scsp2", 0 )   /* second SCSP's RAM */
53515327   ROM_FILL( 0x000000, 0x80000, 0 )
5328
5329   //             ????     317-0244-COM   Model 3
5330   ROM_PARAMETER( ":315_5881:key", "092a2bc5" )
53525331ROM_END
53535332
53545333/* Model 3 sound board emulation */
r243203r243204
55175496   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
55185497MACHINE_CONFIG_END
55195498
5520static MACHINE_CONFIG_START( model3_20, model3_state )
5499static MACHINE_CONFIG_START(model3_20, model3_state)
55215500   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55225501   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55235502   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243203r243204
55265505   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55275506   MCFG_CPU_PROGRAM_MAP(model3_snd)
55285507
5529   MCFG_MACHINE_START_OVERRIDE(model3_state,model3_20)
5530   MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_20)
5508   MCFG_MACHINE_START_OVERRIDE(model3_state, model3_20)
5509   MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_20)
55315510
55325511   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55335512   MCFG_NVRAM_ADD_1FILL("backup")
r243203r243204
55545533   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
55555534MACHINE_CONFIG_END
55565535
5557static MACHINE_CONFIG_START( model3_21, model3_state )
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)
55585542   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55595543   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55605544   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243203r243204
55635547   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55645548   MCFG_CPU_PROGRAM_MAP(model3_snd)
55655549
5566   MCFG_MACHINE_START_OVERRIDE(model3_state,model3_21)
5567   MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_21)
5550   MCFG_MACHINE_START_OVERRIDE(model3_state, model3_21)
5551   MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_21)
55685552
55695553   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55705554   MCFG_NVRAM_ADD_1FILL("backup")
r243203r243204
55915575   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
55925576MACHINE_CONFIG_END
55935577
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
55945599static void interleave_vroms(running_machine &machine)
55955600{
55965601   model3_state *state = machine.driver_data<model3_state>();
r243203r243204
56225627   }
56235628}
56245629
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
56255640DRIVER_INIT_MEMBER(model3_state,model3_10)
56265641{
56275642   interleave_vroms(machine());
r243203r243204
57855800DRIVER_INIT_MEMBER(model3_state,vs298)
57865801{
57875802   DRIVER_INIT_CALL(model3_20);
5803   DRIVER_INIT_CALL(genprot);
57885804}
57895805
57905806
5791DRIVER_INIT_MEMBER(model3_state,vs2v991)
5792{
5793   DRIVER_INIT_CALL(model3_20);
5794}
57955807
5796DRIVER_INIT_MEMBER(model3_state,vs299b)
5797{
5798   DRIVER_INIT_CALL(model3_20);
5799}
58005808
5801DRIVER_INIT_MEMBER(model3_state,vs299a)
5802{
5803   DRIVER_INIT_CALL(model3_20);
5804}
5805
58065809DRIVER_INIT_MEMBER(model3_state,vs299)
58075810{
58085811   DRIVER_INIT_CALL(model3_20);
5812   DRIVER_INIT_CALL(genprot);
58095813}
58105814
58115815DRIVER_INIT_MEMBER(model3_state,harley)
r243203r243204
58525856
58535857   rom[(0x043dc^4)/4] = 0x48000090;        // skip force feedback setup
58545858   rom[(0xf6e44^4)/4] = 0x60000000;
5859
5860
5861   DRIVER_INIT_CALL(genprot);
5862
58555863}
58565864
58575865DRIVER_INIT_MEMBER(model3_state,swtrilga)
58585866{
58595867   //UINT32 *rom = (UINT32*)memregion("user1")->base();
58605868   DRIVER_INIT_CALL(model3_20);
5869   DRIVER_INIT_CALL(genprot);
58615870
58625871   //rom[(0xf6dd0^4)/4] = 0x60000000;
58635872}
r243203r243204
58675876   m_step20_with_old_real3d = true;
58685877
58695878   DRIVER_INIT_CALL(model3_20);
5879   DRIVER_INIT_CALL(genprot);
58705880}
58715881
58725882DRIVER_INIT_MEMBER(model3_state,dirtdvls)
r243203r243204
58745884   m_step20_with_old_real3d = true;
58755885
58765886   DRIVER_INIT_CALL(model3_20);
5887   DRIVER_INIT_CALL(genprot);
58775888}
58785889
58795890DRIVER_INIT_MEMBER(model3_state,daytona2)
58805891{
5881   UINT32 *rom = (UINT32*)memregion("user1")->base();
5892//  UINT32 *rom = (UINT32*)memregion("user1")->base();
58825893   DRIVER_INIT_CALL(model3_20);
58835894
58845895   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
58855896   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
58865897
58875898   //rom[(0x68468c^4)/4] = 0x60000000;
5888   rom[(0x6063c4^4)/4] = 0x60000000;
5889   rom[(0x616434^4)/4] = 0x60000000;
5890   rom[(0x69f4e4^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);
58915904}
58925905
58935906DRIVER_INIT_MEMBER(model3_state,dayto2pe)
58945907{
5895   UINT32 *rom = (UINT32*)memregion("user1")->base();
5908//  UINT32 *rom = (UINT32*)memregion("user1")->base();
58965909   DRIVER_INIT_CALL(model3_20);
58975910
58985911   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
58995912   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
59005913
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
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
59045917
5905   rom[(0x64ca34^4)/4] = 0x60000000;       // dec
5918//  rom[(0x64ca34^4)/4] = 0x60000000;       // dec
5919
5920   DRIVER_INIT_CALL(genprot);
59065921}
59075922
59085923DRIVER_INIT_MEMBER(model3_state,spikeout)
r243203r243204
59125927
59135928   rom[(0x6059cc^4)/4] = 0x60000000;
59145929   rom[(0x6059ec^4)/4] = 0x60000000;
5930   DRIVER_INIT_CALL(genprot);
59155931}
59165932
59175933DRIVER_INIT_MEMBER(model3_state,spikeofe)
r243203r243204
59215937
59225938   rom[(0x6059cc^4)/4] = 0x60000000;
59235939   rom[(0x6059ec^4)/4] = 0x60000000;
5940   DRIVER_INIT_CALL(genprot);
59245941}
59255942
59265943DRIVER_INIT_MEMBER(model3_state,eca)
59275944{
59285945   DRIVER_INIT_CALL(model3_20);
5946   DRIVER_INIT_CALL(genprot);
59295947}
59305948
59315949DRIVER_INIT_MEMBER(model3_state,skichamp)
r243203r243204
59475965   DRIVER_INIT_CALL(model3_20);
59485966
59495967   rom[(0x57995c^4)/4] = 0x60000000;   // decrementer
5968
5969   DRIVER_INIT_CALL(genprot);
59505970}
59515971
59525972DRIVER_INIT_MEMBER(model3_state,magtruck)
r243203r243204
59545974   m_step20_with_old_real3d = true;
59555975
59565976   DRIVER_INIT_CALL(model3_20);
5977   DRIVER_INIT_CALL(genprot);
59575978}
59585979
59595980DRIVER_INIT_MEMBER(model3_state,lamachin)
r243203r243204
59615982   m_step20_with_old_real3d = true;
59625983
59635984   DRIVER_INIT_CALL(model3_20);
5985   DRIVER_INIT_CALL(genprot);
59645986}
59655987
59665988
r243203r243204
59856007GAME( 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 )
59866008
59876009/* Model 3 Step 2.0 */
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 )
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 )
60046026
60056027/* Model 3 Step 2.1 */
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 )
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 )
trunk/src/mame/drivers/namcos21.c
r243203r243204
311311
312312INT32 namcos21_state::read_pointrom_data(unsigned offset)
313313{
314   const INT32 *pPointData = (INT32 *)memregion( "point" )->base();
315   INT32 result = pPointData[offset];
316   return result;
314   return m_ptrom24[offset];
317315}
318316
319317READ16_MEMBER(namcos21_state::namcos21_video_enable_r)
r243203r243204
11681166
11691167READ16_MEMBER(namcos21_state::winrun_dsp_pointrom_data_r)
11701168{
1171   UINT16 *ptrom = (UINT16 *)memregion("point")->base();
1172   return ptrom[m_winrun_pointrom_addr++];
1169   return m_ptrom16[m_winrun_pointrom_addr++];
11731170}
11741171
11751172WRITE16_MEMBER(namcos21_state::winrun_dsp_complete_w)
r243203r243204
16451642   ROM_LOAD16_BYTE( "ac1-edata1-u.3c", 0x000000, 0x80000, CRC(a9547509) SHA1(1bc663cec03b60ad968896bbc2546f02efda135e) )
16461643   ROM_LOAD16_BYTE( "ac1-edata1-l.1c", 0x000001, 0x80000, CRC(a87087dd) SHA1(cd9b83a8f07886ab44e4ded68002b44338777e8c) )
16471644
1648   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
1645   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
16491646   ROM_LOAD32_BYTE( "ac1-poi-h.2f",  0x000001, 0x80000, CRC(573bbc3b) SHA1(371be12b915db6872049f18980c1b55544cfc445) ) /* most significant */
16501647   ROM_LOAD32_BYTE( "ac1-poi-lu.2k", 0x000002, 0x80000, CRC(d99084b9) SHA1(c604d60a2162af7610e5ff7c1aa4195f7df82efe) )
16511648   ROM_LOAD32_BYTE( "ac1-poi-ll.2n", 0x000003, 0x80000, CRC(abb32307) SHA1(8e936ba99479215dd33a951d81ec2b04020dfd62) ) /* least significant */
r243203r243204
17061703   ROM_LOAD16_BYTE( "ac1-edata1-u.3c", 0x000000, 0x80000, CRC(a9547509) SHA1(1bc663cec03b60ad968896bbc2546f02efda135e) )
17071704   ROM_LOAD16_BYTE( "ac1-edata1-l.1c", 0x000001, 0x80000, CRC(a87087dd) SHA1(cd9b83a8f07886ab44e4ded68002b44338777e8c) )
17081705
1709   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
1706   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
17101707   ROM_LOAD32_BYTE( "ac1-poi-h.2f",  0x000001, 0x80000, CRC(573bbc3b) SHA1(371be12b915db6872049f18980c1b55544cfc445) ) /* most significant */
17111708   ROM_LOAD32_BYTE( "ac1-poi-lu.2k", 0x000002, 0x80000, CRC(d99084b9) SHA1(c604d60a2162af7610e5ff7c1aa4195f7df82efe) )
17121709   ROM_LOAD32_BYTE( "ac1-poi-ll.2n", 0x000003, 0x80000, CRC(abb32307) SHA1(8e936ba99479215dd33a951d81ec2b04020dfd62) ) /* least significant */
r243203r243204
17671764   ROM_LOAD16_BYTE( "cy1-edata0-u.3b", 0x000000, 0x80000, CRC(77452533) SHA1(48fc199bcc1beb23c714eebd9b09b153c980170b) )
17681765   ROM_LOAD16_BYTE( "cy1-edata0-l.1b", 0x000001, 0x80000, CRC(e812e290) SHA1(719e0a026ae8ef63d0d0269b67669ea9b4d950dd) )
17691766
1770   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
1767   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
17711768   ROM_LOAD32_BYTE( "cy1-poi-h1.2f",  0x000001, 0x80000, CRC(eaf8bac3) SHA1(7a2caf6672af158b4a23ce4626342d1f17d1a4e4) )    /* most significant */
17721769   ROM_LOAD32_BYTE( "cy1-poi-lu1.2k", 0x000002, 0x80000, CRC(c544a8dc) SHA1(4cce5f2ab3519b4aa7edbdd15b2d79a7fdcade3c) )
17731770   ROM_LOAD32_BYTE( "cy1-poi-ll1.2n", 0x000003, 0x80000, CRC(30acb99b) SHA1(a28dcb3e5405f166644f6353a903c1143ee268f1) )    /* least significant */
r243203r243204
18261823   ROM_LOAD16_BYTE( "cy1-edata0-u.3b", 0x000000, 0x80000, CRC(77452533) SHA1(48fc199bcc1beb23c714eebd9b09b153c980170b) )
18271824   ROM_LOAD16_BYTE( "cy1-edata0-l.1b", 0x000001, 0x80000, CRC(e812e290) SHA1(719e0a026ae8ef63d0d0269b67669ea9b4d950dd) )
18281825
1829   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
1826   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
18301827   ROM_LOAD32_BYTE( "cy1-poi-h1.2f",  0x000001, 0x80000, CRC(eaf8bac3) SHA1(7a2caf6672af158b4a23ce4626342d1f17d1a4e4) )    /* most significant */
18311828   ROM_LOAD32_BYTE( "cy1-poi-lu1.2k", 0x000002, 0x80000, CRC(c544a8dc) SHA1(4cce5f2ab3519b4aa7edbdd15b2d79a7fdcade3c) )
18321829   ROM_LOAD32_BYTE( "cy1-poi-ll1.2n", 0x000003, 0x80000, CRC(30acb99b) SHA1(a28dcb3e5405f166644f6353a903c1143ee268f1) )    /* least significant */
r243203r243204
18871884   ROM_LOAD16_BYTE( "de1-data-u.3a",  0x00000, 0x80000, CRC(fe65d2ab) SHA1(dbe962dda7efa60357fa3a684a265aaad49df5b5) )
18881885   ROM_LOAD16_BYTE( "de1-data-l.1a",  0x00001, 0x80000, CRC(9bb37aca) SHA1(7f5dffc95cadcf12f53ff7944920afc25ed3cf68) )
18891886
1890   ROM_REGION16_BE( 0xc0000, "point", 0 ) /* 3d objects */
1887   ROM_REGION16_BE( 0xc0000, "point16", 0 ) /* 3d objects */
18911888   ROM_LOAD16_BYTE( "de1-pt0-ub.8j", 0x00000, 0x20000, CRC(3b6b746d) SHA1(40c992ef4cf5187b30aba42c5fe7ce0f8f02bee0) )
18921889   ROM_LOAD16_BYTE( "de1-pt0-lb.8d", 0x00001, 0x20000, CRC(9c5c477e) SHA1(c8ae8a663227d636d35bd5f432d23f05d6695942) )
18931890   ROM_LOAD16_BYTE( "de1-pt1-u.8l",  0x40000, 0x20000, CRC(23bc72a1) SHA1(083e2955ae2f88d1ad461517b47054d64375b46e) )
r243203r243204
19371934
19381935   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
19391936
1940   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00) /* 24bit signed point data */
1937   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00) /* 24bit signed point data */
19411938   ROM_LOAD32_BYTE( "st1-pt0-h.bin", 0x000001, 0x80000, CRC(84eb355f) SHA1(89a248b8be2e0afcee29ba4c4c9cca65d5fb246a) )
19421939   ROM_LOAD32_BYTE( "st1-pt0-u.bin", 0x000002, 0x80000, CRC(1956cd0a) SHA1(7d21b3a59f742694de472c545a1f30c3d92e3390) )
19431940   ROM_LOAD32_BYTE( "st1-pt0-l.bin", 0x000003, 0x80000, CRC(ff577049) SHA1(1e1595174094e88d5788753d05ce296c1f7eca75) )
r243203r243204
19901987
19911988   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
19921989
1993   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00) /* 24bit signed point data */
1990   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00) /* 24bit signed point data */
19941991   ROM_LOAD32_BYTE( "st1-pt0-h.bin", 0x000001, 0x80000, CRC(84eb355f) SHA1(89a248b8be2e0afcee29ba4c4c9cca65d5fb246a) )
19951992   ROM_LOAD32_BYTE( "st1-pt0-u.bin", 0x000002, 0x80000, CRC(1956cd0a) SHA1(7d21b3a59f742694de472c545a1f30c3d92e3390) )
19961993   ROM_LOAD32_BYTE( "st1-pt0-l.bin", 0x000003, 0x80000, CRC(ff577049) SHA1(1e1595174094e88d5788753d05ce296c1f7eca75) )
r243203r243204
20472044
20482045   ROM_REGION16_BE( 0x100000, "edata", ROMREGION_ERASEFF )
20492046
2050   ROM_REGION32_BE( 0x400000, "point", ROMREGION_ERASE00)       /* 24bit signed point data */
2047   ROM_REGION32_BE( 0x400000, "point24", ROMREGION_ERASE00)       /* 24bit signed point data */
20512048   ROM_LOAD32_BYTE( "sv1-pt0-h.bin", 0x000001, 0x80000, CRC(3be21115) SHA1(c9f30353c1216f64199f87cd34e787efd728e739) ) /* most significant */
20522049   ROM_LOAD32_BYTE( "sv1-pt0-u.bin", 0x000002, 0x80000, CRC(4aacfc42) SHA1(f0e179e057183b41744ca429764f44306f0ce9bf) )
20532050   ROM_LOAD32_BYTE( "sv1-pt0-l.bin", 0x000003, 0x80000, CRC(6a4dddff) SHA1(9ed182d21d328c6a684ee6658a9dfcf3f3dd8646) ) /* least significant */
r243203r243204
20952092   ROM_LOAD16_BYTE( "wr1-gd0u-2.1p",  0x00000, 0x40000, CRC(9752eef5) SHA1(d6df0faf9c2696247bdf463f53c1e474ec595dd0) )
20962093   ROM_LOAD16_BYTE( "wr1-gd0l-2.3p",  0x00001, 0x40000, CRC(349c95cc) SHA1(8898eecf5918485ec683900520f123483077df28) )
20972094
2098   ROM_REGION16_BE( 0x80000, "point", 0 ) /* 3d objects */
2095   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* 3d objects */
20992096   ROM_LOAD16_BYTE( "wr1-pt0u.8j", 0x00000, 0x20000, CRC(7ec4cf6b) SHA1(92ec92567b9f7321efb4a3724cbcdba216eb22f9) )
21002097   ROM_LOAD16_BYTE( "wr1-pt0l.8d", 0x00001, 0x20000, CRC(58c14b73) SHA1(e34a26866cd870743e166669f7fa5915a82104e9) )
21012098
r243203r243204
21632160   ROM_LOAD16_BYTE( "sg1-gd1-u.1s", 0x80000, 0x40000, CRC(271db29b) SHA1(8b35fcf273b9aec28d4c606c41c0626dded697e1) )
21642161   ROM_LOAD16_BYTE( "sg1-gd1-l.3s", 0x80001, 0x40000, CRC(a6c4da96) SHA1(377dbf21a1bede01de16708c96c112abab4417ce) )
21652162
2166   ROM_REGION16_BE( 0x80000, "point", 0 ) /* 3d objects */
2163   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* 3d objects */
21672164   ROM_LOAD16_BYTE( "sg1-pt0-u.8j", 0x00000, 0x20000, CRC(160c3634) SHA1(485d20d6cc459f17d77682201dee07bdf76bf343) )
21682165   ROM_LOAD16_BYTE( "sg1-pt0-l.8d", 0x00001, 0x20000, CRC(b5a665bf) SHA1(5af6ec492f31395c0492e14590b025b120067b8d) )
21692166   ROM_LOAD16_BYTE( "sg1-pt1-u.8l", 0x40000, 0x20000, CRC(b63d3006) SHA1(78e78619766b0fd91b1e830cfb066495d6773981) )
r243203r243204
22122209   ROM_LOAD16_BYTE( "r911-gd1u.1s", 0x80000, 0x40000, CRC(17e5a61c) SHA1(272ebd7daa56847f1887809535362331b5465dec) )
22132210   ROM_LOAD16_BYTE( "r911-gd1l.3s", 0x80001, 0x40000, CRC(64df59a2) SHA1(1e9d0945b94780bb0be16803e767466d2cda07e8) )
22142211
2215   ROM_REGION16_BE( 0x80000, "point", 0 ) /* winrun91 - 3d objects */
2212   ROM_REGION16_BE( 0x80000, "point16", 0 ) /* winrun91 - 3d objects */
22162213   ROM_LOAD16_BYTE( "r911-pt0u.8j", 0x00000, 0x20000, CRC(abf512a6) SHA1(e86288039d6c4dedfa95b11cb7e4b87637f90c09) ) /* Version on SYSTEM21B CPU only has R911 PTU @ 8W */
22172214   ROM_LOAD16_BYTE( "r911-pt0l.8d", 0x00001, 0x20000, CRC(ac8d468c) SHA1(d1b457a19a5d3259d0caf933f42b3a02b485867b) ) /* and R911 PTL @ 12W with rom type 27C020 */
22182215   ROM_LOAD16_BYTE( "r911-pt1u.8l", 0x40000, 0x20000, CRC(7e5dab74) SHA1(5bde219d5b4305d38d17b494b2e759f05d05329f) )
trunk/src/mame/drivers/naomi.c
r243203r243204
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-0074-JPN
331Mars TV                                         840-0025C    22993   15 (64Mb)   present     315-6213  317-0274-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  ?
335Puyo Puyo Da!                                   841-0006C    22206   20 (64Mb)   ?           315-6213  317-5052-COM
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
r243203r243204
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  ?
344Super Major League '99                          840-0012C    22059   21 (64Mb)   ?           315-6213  317-0259-COM
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
r243203r243204
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
352353Zombie Revenge                                  840-0003C    21707   19 (64Mb)   ?           315-6213  317-0249-COM   joystick + 3 buttons
353354
354355
r243203r243204
512513Derby Owners Club World Edition (Rev C)         840-0088C  22336C   7 (128Mb)  315-6319A  315-6213  not present
513514Derby Owners Club World Edition (Rev D)         840-0088C  22336D   7 (128Mb)  315-6319A  315-6213  not present   2 MaskROM are different from Rev C
514515Giga Wing 2                                     841-0014C  22270    5 (128Mb)  315-6319A  315-6213  317-5064-COM
515Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  ?
516Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  317-5070-COM
516517Moero Justice Gakuen / Project Justice (Rev A)  841-0015C  23548A  11 (128Mb)  315-6319A  315-6213  317-5065-COM
517518MushiKing - The King Of Beetle 2K5 1ST          840-0158C  24286    7 (128Mb)  315-6319A  315-6213  not present   requires 610-0669 barcode reader
518519Oinori-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)
r243203r243204
521522Star Horse (satellite)                          840-0056C  23627    6 (128Mb)* 315-6319   315-6213  not present   * +1 (64Mb), requires 837-13785 ARCNET&IO BD
522523Star Horse Progress (satellite) (Rev A)         840-0123C  24122A   7 (128Mb)  315-6319A  315-6213  not present   requires 837-13785 ARCNET&IO BD
523524The 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
524527Virtua 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
526528Wave Runner GP                                  840-0064C  24059    6 (128Mb)  315-6319A  315-6213  not present
527529Wild Riders                                     840-0046C  23622   10 (128Mb)  315-6319A  315-6213  317-0301-COM
528530WWF Royal Rumble                                840-0040C  22261    8 (128Mb)  315-6319   315-6213  317-0285-COM
r243203r243204
23982400   PORT_INCLUDE( naomi_mie )
23992401   PORT_INCLUDE( naomi_debug )
24002402
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 ) )
2403   PORT_START("OUTPUT")
2404   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_OUTPUT) PORT_CHANGED_MEMBER(DEVICE_SELF, naomi_state,naomi_mp_w, NULL)
24262405
2427   PORT_START("KEY1")
2428   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) //TODO: mahjong panel test & service buttons are presumably here
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 )
24292409
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 )
24302419   PORT_START("KEY2")
24312420   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
24322421   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
r243203r243204
24382427   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
24392428   PORT_START("KEY3")
24402429   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
2441   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
2430   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_BET )
24422431   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
24432432   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
24442433   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
r243203r243204
24652454   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
24662455INPUT_PORTS_END
24672456
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
24682463// Atomiswave - inputs are read as standard Dreamcast controllers.
24692464// Controller bit patterns:
24702465//
r243203r243204
26232618MACHINE_CONFIG_END
26242619
26252620static MACHINE_CONFIG_DERIVED( naomi_base, naomi_aw_base )
2626   MCFG_MIE_ADD("mie", 4000000, "maple_dc", 0, 0, 0, 0, ":MIE.3", 0, ":MIE.5", 0, 0) // Actual frequency unknown
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)
26272622   MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "mie", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT")
26282623   MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("mie_eeprom")
26292624
r243203r243204
26512646 */
26522647
26532648static MACHINE_CONFIG_DERIVED( naomim1, naomi_base )
2654   MCFG_NAOMI_M1_BOARD_ADD("rom_board", ":rom_key", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
2649   MCFG_NAOMI_M1_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
26552650MACHINE_CONFIG_END
26562651
26572652/*
r243203r243204
26592654 */
26602655
26612656static MACHINE_CONFIG_DERIVED( naomim2, naomi_base )
2662   MCFG_NAOMI_M2_BOARD_ADD("rom_board", ":rom_key", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
2657   MCFG_NAOMI_M2_BOARD_ADD("rom_board", "naomibd_eeprom", ":boardid", WRITE8(dc_state, g1_irq))
26632658MACHINE_CONFIG_END
26642659
26652660/*
r243203r243204
31023097   ROM_LOAD("mpr-23208.ic11", 0x5800000, 0x0800000, CRC(b9494f4b) SHA1(2f35b25edf5210a82d4b67e639eeae11440d065a) )
31033098   ROM_LOAD("mpr-23209.ic12s",0x6000000, 0x0800000, CRC(560188c0) SHA1(77f14c9a031c6e5414ffa854d20c40115361d715) )
31043099
3105   ROM_REGION( 4, "rom_key", 0 )
3106   ROM_LOAD( "cspike-key.bin", 0, 4, CRC(a3e9c6d0) SHA1(c098eae7aee716fbdca39f0eb1f55bd54d398394) )
3100   // 841-0012    2000     317-5060-COM   Naomi
3101   ROM_PARAMETER( "rom_board:segam2crypt:key", "000e2010" )
31073102ROM_END
31083103
31093104/*
r243203r243204
31463141   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31473142   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31483143
3149   ROM_REGION( 4, "rom_key", 0 )
3150   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
3144   // 841-0011    2000     317-5059-COM   Naomi
3145   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
31513146ROM_END
31523147
31533148// ver 000804
r243203r243204
31653160   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31663161   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31673162
3168   ROM_REGION( 4, "rom_key", 0 )
3169   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
3163   // 841-0011    2000     317-5059-COM   Naomi
3164   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
31703165ROM_END
31713166
31723167// ver 000802
r243203r243204
31843179   ROM_LOAD( "mpr-23509.ic6", 0x5800000, 0x1000000, CRC(281d633d) SHA1(d773be8e95f7bf9212ee1061f3076220d4fce9e0) )
31853180   ROM_LOAD( "mpr-23510.ic7", 0x6800000, 0x1000000, CRC(b856fef5) SHA1(0634f86740c438b40286256a0269570d24cb845a) )
31863181
3187   ROM_REGION( 4, "rom_key", 0 )
3188   ROM_LOAD( "capsnk-key.bin", 0, 4, CRC(2144df1c) SHA1(9069ca78e7450a285173431b3e52c5c25299e473) )
3182   // 841-0011    2000     317-5059-COM   Naomi
3183   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00000000" )
31893184ROM_END
31903185
31913186/*
r243203r243204
32253220   ROM_LOAD("mpr-23426.ic7",   0x3800000, 0x0800000, CRC(7f91b13f) SHA1(2d534f77291ebfedc011bf0e803a1b9243fb477f) )
32263221   ROM_LOAD("mpr-23427.ic8",   0x4000000, 0x0800000, CRC(5851d525) SHA1(1cb1073542d75a3bcc0d363ed31d49bcaf1fd494) )
32273222
3228   ROM_REGION( 4, "rom_key", 0 )
3229   ROM_LOAD( "csmash-key.bin", 0, 4, CRC(21b1cd6f) SHA1(a74eef5e3475cc6952f4ffe31579769a854b62a9) )
3223   // 840-0044    2000     317-0289-COM   Naomi
3224   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08103347" )
32303225ROM_END
32313226
32323227ROM_START( csmasho )
r243203r243204
32443239   ROM_LOAD("mpr-23426.ic7", 0x3800000, 0x0800000, CRC(7f91b13f) SHA1(2d534f77291ebfedc011bf0e803a1b9243fb477f) )
32453240   ROM_LOAD("mpr-23427.ic8", 0x4000000, 0x0800000, CRC(5851d525) SHA1(1cb1073542d75a3bcc0d363ed31d49bcaf1fd494) )
32463241
3247   ROM_REGION( 4, "rom_key", 0 )
3248   ROM_LOAD( "csmasho-key.bin", 0, 4, CRC(21b1cd6f) SHA1(a74eef5e3475cc6952f4ffe31579769a854b62a9) )
3242   // 840-0044    2000     317-0289-COM   Naomi
3243   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08103347" )
32493244ROM_END
32503245
32513246/*
r243203r243204
32743269   ROM_LOAD("mpr-23522.ic9", 0x4800000, 0x0800000, CRC(7ae6716e) SHA1(658b794ae6e3898885524582a207faa1076a65ca) )
32753270   ROM_LOAD("mpr-23523.ic10",0x5000000, 0x0800000, CRC(c91efb67) SHA1(3d79870551310da7a641858ffec3840714e9cc22) )
32763271
3277   ROM_REGION( 4, "rom_key", 0 )
3278   ROM_LOAD( "deathcox-key.bin", 0, 4, CRC(aa534c8a) SHA1(fcc45e477c646b51afe7c4168d7246964a1f23b5) )
3272   // 841-0016    2000     317-5066-COM   Naomi
3273   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b64d0" )
32793274ROM_END
32803275
32813276/*
r243203r243204
33403335   ROM_LOAD("mpr-22119.ic20s",0xa000000, 0x0800000, CRC(d608fa86) SHA1(54c8107cccec8cbb536f13cda5b220b7972190b7) )
33413336   ROM_LOAD("mpr-22120.ic21s",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) )
33423337
3343   ROM_REGION( 4, "rom_key", 0 )
3344   ROM_LOAD( "doa2-key.bin", 0, 4, CRC(43f97c96) SHA1(7d1e6fcca3ca936f33d59d57834c3e4ff74f587d) )
3338   // 841-0003    1999     317-5048-COM   Naomi
3339   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0008ad01" )
33453340
33463341   // on-cart X76F100 eeprom contents
33473342   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243203r243204
34123407   ROM_LOAD("mpr-22119.ic20s",0xa000000, 0x0800000, CRC(d608fa86) SHA1(54c8107cccec8cbb536f13cda5b220b7972190b7) )
34133408   ROM_LOAD("mpr-22120.ic21s",0xa800000, 0x0800000, CRC(a30facb4) SHA1(70415ca34095c795297486bce1f956f6a8d4817f) )
34143409
3415   ROM_REGION( 4, "rom_key", 0 )
3416   ROM_LOAD( "doa2m-key.bin", 0, 4, CRC(43f97c96) SHA1(7d1e6fcca3ca936f33d59d57834c3e4ff74f587d) )
3410   // 841-0003    1999     317-5048-COM   Naomi
3411   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0008ad01" )
34173412
34183413   // on-cart X76F100 eeprom contents
34193414   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243203r243204
34693464   ROM_LOAD("mpr-22097.ic13s", 0x6800000, 0x0800000, CRC(f1dedac5) SHA1(9d4499cbafe80dd0b36be617de7994a96e1e9a01) )
34703465   ROM_LOAD("mpr-22098.ic14s", 0x7000000, 0x0800000, CRC(f9824d2e) SHA1(f20f8cc2b1bef9077ede1cb874da8f2a335d39de) )
34713466
3472   ROM_REGION( 4, "rom_key", 0 )
3473   ROM_LOAD( "derbyoc-key.bin", 0, 4, CRC(bc568260) SHA1(6dc4923a730bc0380490519c82f1443226365c3a) )
3467   // 840-0016    1999     317-0262-JPN   Naomi
3468   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fee35" )
34743469ROM_END
34753470
34763471ROM_START( derbyocw )
r243203r243204
34873482   ROM_LOAD( "mpr-22337.ic6", 0x5800000, 0x1000000, CRC(87ca3a2f) SHA1(2ffc01597107eb60dfa7aa49d51f203b51a44334) )
34883483   ROM_LOAD( "mpr-22338.ic7", 0x6800000, 0x1000000, CRC(4bda7303) SHA1(db27d91ef811d741cfdb5c0196e61be722c2f5bd) )
34893484
3490   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3485   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
34913486ROM_END
34923487
34933488ROM_START( drbyocwc )
r243203r243204
35043499   ROM_LOAD( "mpr-22333.ic6", 0x5800000, 0x1000000, CRC(96f324aa) SHA1(bc41e2097c1841771d786ba9ad1a31df1494a856) )
35053500   ROM_LOAD( "mpr-22334.ic7", 0x6800000, 0x1000000, CRC(5389b05a) SHA1(e206e4d82d7b1a59c33043ec0812eb69be08d9b3) )
35063501
3507   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3502   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
35083503ROM_END
35093504
35103505/*
r243203r243204
35323527   ROM_LOAD( "mpr-22304.ic10", 0x9800000, 0x1000000, CRC(46c1fb1f) SHA1(6daca76a75df3501f77e473eb065d48804fcc64a) )
35333528   ROM_LOAD( "mpr-22305.ic11", 0xa800000, 0x1000000, CRC(027d0e7b) SHA1(e3c874e60cabb6f9ce686696d9055a0c0d5289ae) )
35343529
3535   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3530   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
35363531ROM_END
35373532
35383533/*
r243203r243204
36113606   ROM_LOAD("mpr-21573.ic20s", 0xa000000, 0x0800000, CRC(5d822e63) SHA1(8412980b288531c294d5cf9a6394aa0b9503d7df) )
36123607   ROM_LOAD("mpr-21574.ic21s", 0xa800000, 0x0800000, CRC(d794a42c) SHA1(a79c7818c6ec993e718494b1d5407eb270a29abe) )
36133608
3614   ROM_REGION( 4, "rom_key", 0 )
3615   ROM_LOAD( "dybbnao-key.bin", 0, 4, CRC(63c5a3d5) SHA1(e813197f84dc6bb50b436f8e710d14d77a84e0ec) )
3609   // 840-0001    1998     317-0246-JPN   Naomi
3610   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080e6ae1" )
36163611ROM_END
36173612
36183613/*
r243203r243204
36753670   ROM_LOAD("mpr-22139.ic18s", 0x9000000, 0x0800000, CRC(92faa2ca) SHA1(4953f0219c3ae62de0a89473cb7b9dd30b33fcfb) )
36763671   ROM_LOAD("mpr-22140.ic19s", 0x9800000, 0x0800000, CRC(4cb54893) SHA1(a99b39cc3c82c3cf90f794bb8c8ba60638a6f921) )
36773672
3678   ROM_REGION( 4, "rom_key", 0 )
3679   ROM_LOAD( "dybb99-key.bin", 0, 4, CRC(90263797) SHA1(83649c8b3e562bee1f08663e59c5ba8f404ed36c) )
3673   // 840-0019    1999     317-0269-JPN   Naomi
3674   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0804ae71" )
36803675ROM_END
36813676
36823677ROM_START( smlg99 )
r243203r243204
37083703   ROM_LOAD( "mpr-22057.ic20s", 0xa000000, 0x800000, CRC(a056c109) SHA1(637e80c2d605851265430b0fa771a4ad5233be8a) )
37093704   ROM_LOAD( "mpr-22058.ic21s", 0xa800000, 0x800000, CRC(f16edaa0) SHA1(e093f5594df43c592a9acd45002ecc65035c2435) )
37103705
3711   ROM_REGION( 4, "rom_key", 0 )
3712   ROM_LOAD( "smlg99-key.bin", 0, 4, CRC(90263797) SHA1(83649c8b3e562bee1f08663e59c5ba8f404ed36c) )
3706   // 840-0012    1999     317-0259-COM   Naomi
3707   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08048a01" )
37133708ROM_END
37143709
37153710/*
r243203r243204
37503745   ROM_LOAD("mpr-21900.ic20s", 0xa000000, 0x0800000, CRC(81901130) SHA1(1573b5c4360e29ba1a4b4901af49d5399fa1e635) )
37513746   ROM_LOAD("mpr-21901.ic21s", 0xa800000, 0x0800000, CRC(266a3eea) SHA1(795ecc5589a0152b9cf1e03e454ed1ea01501942) )
37523747
3753   ROM_REGION( 4, "rom_key", 0 )
3754   ROM_LOAD( "f355-key.bin", 0, 4, CRC(7d1431ab) SHA1(38958860241c600db941b47294bf3ca3273d0df5) )
3748   // 834-13842   1999     317-0254-COM   Naomi
3749   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080e8f84" )
37553750
37563751   ROM_REGION( 0x10000, "drivebd", 0 ) /* drive board ROM */
37573752   ROM_LOAD( "epr-21867.bin", 0x000000, 0x010000, CRC(4f93a2a0) SHA1(875907e7fcfc44850e2c60c12268ac61c742f217) )
r243203r243204
37853780   ROM_LOAD( "mpr-22846.ic20s", 0xa000000, 0x800000, CRC(d4148f39) SHA1(b6598ce52bcaa42805c581de326c953d27c1b2b4) )
37863781   ROM_LOAD( "mpr-22847.ic21s", 0xa800000, 0x800000, CRC(955ad42e) SHA1(e396ca02b5786557434632c4fac56af3a4a9f8ce) )
37873782
3788   ROM_REGION( 4, "rom_key", 0 )
3789   ROM_LOAD( "f355twin-key.bin", 0, 4, CRC(7d915a40) SHA1(ea441c10673b79237a4e7368948cfad31ed45a26) )
3783   // 834-13950   1999     317-0267-COM   Naomi
3784   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0806efd4" )
37903785ROM_END
37913786
37923787// There is also a development cart (171-7885A). Content is the same.
r243203r243204
38183813   ROM_LOAD( "mpr-23397.ic20s", 0xa000000, 0x800000, CRC(28d2caf6) SHA1(67a3bc19abccf7f211c3aae67e751815857bd564) )
38193814   ROM_LOAD( "mpr-23398.ic21s", 0xa800000, 0x800000, CRC(ea4d4d2a) SHA1(3dc9c7164516ae7f3b988c088ab819d8fd40d75e) )
38203815
3821   ROM_REGION( 4, "rom_key", 0 )
3822   ROM_LOAD( "f355twn2-key.bin", 0, 4, CRC(784fab7a) SHA1(5d9687876b390d35309c0b1404f5717daa533286) )
3816   // 840-0042    2001     317-0287-COM   Naomi
3817   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081666c6" )
38233818ROM_END
38243819
38253820ROM_START( alpiltdx )
r243203r243204
38403835   ROM_LOAD( "mpr-21737.ic10", 0x5000000, 0x800000, CRC(260aaa98) SHA1(d1082587afe9d79f286df8b107a553ee51c27643) )
38413836   ROM_LOAD( "mpr-21738.ic11", 0x5800000, 0x800000, CRC(95a592e8) SHA1(862dce467e8805381bab001df68262f1baf3c498) )
38423837
3843   ROM_REGION( 4, "rom_key", 0 )
3844   ROM_LOAD( "alpiltdx-key.bin", 0, 4, CRC(bb539511) SHA1(dea206e7db23fdabf7b957104ddd1499eff509ff) )
3838   // 834-?????   1999     317-0251-COM   Naomi
3839   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08070e41" )
38453840
38463841   // on-cart X76F100 eeprom contents
38473842   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
r243203r243204
38663861   ROM_LOAD( "mpr-21737.ic10", 0x5000000, 0x800000, CRC(260aaa98) SHA1(d1082587afe9d79f286df8b107a553ee51c27643) )
38673862   ROM_LOAD( "mpr-21738.ic11", 0x5800000, 0x800000, CRC(95a592e8) SHA1(862dce467e8805381bab001df68262f1baf3c498) )
38683863
3869   ROM_REGION( 4, "rom_key", 0 )
3870   ROM_LOAD( "alpilota-key.bin", 0, 4, CRC(bb539511) SHA1(dea206e7db23fdabf7b957104ddd1499eff509ff) )
3864   // 840-0005    1999     317-0251-COM   Naomi
3865   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08070e41" )
38713866ROM_END
38723867
38733868ROM_START( hotd2 )
r243203r243204
39013896   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
39023897   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
39033898
3904   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3899   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
39053900ROM_END
39063901
39073902ROM_START( hotd2o )
r243203r243204
39353930   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
39363931   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
39373932
3938   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3933   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
39393934ROM_END
39403935
39413936ROM_START( hotd2p )
r243203r243204
39693964   ROM_LOAD( "mpr-21404.ic19s", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
39703965   ROM_LOAD( "mpr-21405.ic20s", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
39713966
3972   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
3967   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
39733968ROM_END
39743969
39753970/*
r243203r243204
40043999   ROM_LOAD("mpr-21830.ic10", 0x5000000, 0x0800000, CRC(e01ceb86) SHA1(dd5703d7712cfc0053bddfff63e78dda372b6ff2) )
40054000   ROM_LOAD("mpr-21831.ic11", 0x5800000, 0x0800000, CRC(751848d0) SHA1(9c2267fd3c6f9ea5f2679bb2ca20d511a49b2845) )
40064001
4007   ROM_REGION( 4, "rom_key", 0 )
4008   ROM_LOAD( "ggram2-key.bin", 0, 4, CRC(14283fd8) SHA1(c928382e512e9fb685436020f88b8245b7c60d41) )
4002   // 840-0007    1999     317-0253-JPN   Naomi
4003   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08074a61" )
40094004ROM_END
40104005
40114006/*
r243203r243204
40724067
40734068   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
40744069
4075   ROM_REGION( 4, "rom_key", 0 )
4076   ROM_LOAD( "gram2000-key.bin", 0, 4, CRC(179314d9) SHA1(3dbbc04e9ff62800d08c4a239af3a83252a28dc0) )
4070   // 840-0039    2000
4071   ROM_PARAMETER( ":rom_board:key", "3f5c807f" )
40774072ROM_END
40784073
40794074ROM_START( tduno )
r243203r243204
40944089   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
40954090   ROM_LOAD( "x76f100.ic37", 0x000000, 0x000084, CRC(c79251d5) SHA1(3e70bbbb6d28bade7eec7e27d716463045656f98) )
40964091
4097   ROM_REGION( 4, "rom_key", 0 )
4098   ROM_LOAD( "tduno.key",    0x000000, 0x000004, CRC(217ce9d0) SHA1(39d71a84b2769cd0c1521ddf1c617c18f577020c) )
4092   // 840-0008    1999     317-0255-JPN   Naomi
4093   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08028ea5" )
40994094ROM_END
41004095
41014096ROM_START( tduno2 )
r243203r243204
41144109
41154110   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
41164111
4117   ROM_REGION( 4, "rom_key", 0 )
4118   ROM_LOAD( "tduno2.key",   0x000000, 0x000004, CRC(8e0f0f3b) SHA1(914d3db8746c806d559539cc0851169161d32c04) )
4112   // 840-0022    2000
4113   ROM_PARAMETER( ":rom_board:key", "2f6f0f8d" )
41194114ROM_END
41204115
41214116ROM_START( mtkob2 )
r243203r243204
41334128
41344129   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
41354130
4136   ROM_REGION( 4, "rom_key", 0 )
4137   ROM_LOAD( "mtkob2-key.bin", 0x000000, 0x000004, CRC(db088208) SHA1(14d65ad2555183a445abcd93907c85df4032b41d) )
4131   // 840-0150    2003
4132   ROM_PARAMETER( ":rom_board:key", "3892fb3a" )
41384133ROM_END
41394134
41404135ROM_START( mushi2k5 )
r243203r243204
41514146   ROM_LOAD( "mpr-24281.ic6",  0x5800000, 0x1000000, CRC(39133c32) SHA1(09ea8c1a98ba0fac36e18ae14ed5302feaeb89ca) )
41524147   ROM_LOAD( "mpr-24282.ic7",  0x6800000, 0x1000000, CRC(9aa4ad5a) SHA1(2d81f99a579477c5db725f71c51f18afc15abce7) )
41534148
4154   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
4149   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown // or M1?
41554150ROM_END
41564151
41574152ROM_START( crackndj )
r243203r243204
41714166   ROM_LOAD( "mpr-23533.ic9",  0x8800000, 0x1000000, CRC(fc909c00) SHA1(9cf22a97ea272c4586f3942aefdb803bd0e6ede7) )
41724167   ROM_LOAD( "mpr-23534.ic10", 0x9800000, 0x1000000, CRC(62ed85b6) SHA1(b88336bc6115c92a839981cb0c0d0a67b1f7eda5) )
41734168
4174   ROM_REGION( 4, "rom_key", 0 )
4175   ROM_LOAD( "crackndj-key.bin", 0, 4, CRC(6269265a) SHA1(e2ab31b0058eb130d8f54d30e86d569687f9a068) )
4169   // 840-0043    2000     317-0288-COM   Naomi
4170   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081c2347" )
41764171ROM_END
41774172
41784173ROM_START( crakndj2 )
r243203r243204
42054200   ROM_LOAD( "rom19.ic19s",  0x9800000, 0x800000, CRC(31f816ba) SHA1(354f8271eef20eb131f83fb9641002cfcd31c8cd) )
42064201   ROM_LOAD( "rom20.ic20s",  0xa000000, 0x800000, CRC(aabcd580) SHA1(9455e218ab381c7ad5adb2884da39ca7948169d5) )
42074202
4208   ROM_REGION( 4, "rom_key", 0 )   // 317-0311-COM
4209   ROM_LOAD( "crackndj2-key.bin", 0x000000, 0x000004, CRC(b357a848) SHA1(15b5f89583ec2bc65298387a2b8d8e60e71f1617) )
4203   // 840-0068    2001     317-0311-COM   Naomi
4204   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08428247" )
42104205ROM_END
42114206
42124207ROM_START( samba2k )
r243203r243204
42274222   ROM_LOAD( "mpr-23598.ic10", 0x09800000, 0x1000000, CRC(e06ee3dd) SHA1(21985e45e1ab5e3a79dd52492a582324a1a36d56) )
42284223   ROM_LOAD( "mpr-23599.ic11", 0x0a800000, 0x1000000, CRC(1fd2e792) SHA1(6f299e527be529f85d0e8b4ce0e7a06ac0d25fe9) )
42294224
4230   ROM_REGION( 4, "rom_key", 0 )
4231   ROM_LOAD( "samba2k-key.bin", 0, 4, CRC(01c0d74a) SHA1(4461cfd761919ba4bc6f1d1839a880f11eaf8d0f) )
4225   // 840-0047    2000     317-0295-COM   Naomi
4226   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081702cf" )
42324227ROM_END
42334228
42344229ROM_START( alienfnt )
r243203r243204
42434238   ROM_LOAD( "mpr-23584.ic4",   0x3800000, 0x1000000, CRC(8d444756) SHA1(89c480f9ed1239c8ae565c85fa0fd50324264b20) )
42444239   ROM_LOAD( "mpr-23585.ic5",   0x4800000, 0x1000000, CRC(883a6482) SHA1(e3145710df793b7fd67f02707904416210a71978) )
42454240
4246   ROM_REGION( 4, "rom_key", 0 )
4247   ROM_LOAD( "alienfnt-key.bin", 0x000000, 0x000004, CRC(0cac6605) SHA1(7a050f13e3b9a10d6cdb851a8c67006f6548c60a) )
4241   // 840-0048    2001     317-0293-COM   Naomi
4242   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08174343" )
42484243ROM_END
42494244
42504245ROM_START( alienfnta )
r243203r243204
42594254   ROM_LOAD( "mpr-23584.ic4",   0x3800000, 0x1000000, CRC(8d444756) SHA1(89c480f9ed1239c8ae565c85fa0fd50324264b20) )
42604255   ROM_LOAD( "mpr-23585.ic5",   0x4800000, 0x1000000, CRC(883a6482) SHA1(e3145710df793b7fd67f02707904416210a71978) )
42614256
4262   ROM_REGION( 4, "rom_key", 0 )
4263   ROM_LOAD( "alienfnt-key.bin", 0x000000, 0x000004, CRC(0cac6605) SHA1(7a050f13e3b9a10d6cdb851a8c67006f6548c60a) )
4257   // 840-0048    2001     317-0293-COM   Naomi
4258   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08174343" )
42644259ROM_END
42654260
42664261/*
r243203r243204
42914286   ROM_LOAD("mpr-23354.ic13s",0x6800000, 0x0800000, CRC(cea127f7) SHA1(11f12472ebfc93eb72b764c780e30afd4812dbe9) )
42924287   ROM_LOAD("mpr-23355.ic14s",0x7000000, 0x0800000, CRC(e809685f) SHA1(dc052b4eb4fdcfdc22c4807316ce34ee7a0d58a6) )
42934288
4294   ROM_REGION( 4, "rom_key", 0 )
4295   ROM_LOAD( "ggx-key.bin", 0, 4, CRC(455a831b) SHA1(1834fc714224ac990a0677e8925493e92a4b5e5e) )
4289   // 841-0013    2000     317-5063-COM   Naomi
4290   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00076110" )
42964291ROM_END
42974292
42984293/*
r243203r243204
43374332   ROM_LOAD("mpr-23714.ic10",0x5000000, 0x0800000, CRC(da462c44) SHA1(ca450b6c07f939f96eba7b44c45b4e38abd598aa) )
43384333   ROM_LOAD("mpr-23715.ic11",0x5800000, 0x0800000, CRC(c750abbd) SHA1(2a5bedc2b21cd3f991c7145ccfd8c7a9e7f647ae) )
43394334
4340   ROM_REGION( 4, "rom_key", 0 )
4341   ROM_LOAD( "hmgeo-key.bin", 0, 4, CRC(78411d2f) SHA1(9809ef35406ea48639cf78d5d366069a06a411f0) )
4335   // HMG016007   2001     317-5071-COM   Naomi
4336   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00038510" )
43424337ROM_END
43434338
43444339/*
r243203r243204
43764371   ROM_LOAD("mpr-22274.ic4", 0x3800000, 0x1000000, CRC(f8daaaf3) SHA1(8854d3f8e3d55715ede33ee918b641e251f752b4) )
43774372   ROM_LOAD("mpr-22275.ic5", 0x4800000, 0x1000000, CRC(61aa1521) SHA1(7d9f5790e72a9151d128ac7887e236526fdf72a0) )
43784373
4379   ROM_REGION( 4, "rom_key", 0 )
4380   ROM_LOAD( "gwing2-key.bin", 0, 4, CRC(433132ce) SHA1(27f6e6ba2dd28c777317ff085432c2d43b93a603) )
4374   // 841-0014    2000     317-5064-COM   Naomi
4375   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b25d0" )
43814376ROM_END
43824377
43834378/*
r243203r243204
44264421   ROM_LOAD("mpr-21992.ic13s",0x6800000, 0x0800000, CRC(599a2fb8) SHA1(2a0007064ad2ee1e1a0fda1d5676df4ff19a9f2f) )
44274422   ROM_LOAD("mpr-21993.ic14s",0x7000000, 0x0400000, CRC(fb28cf0a) SHA1(d51b1d4514a93074d1f77bd1bc5995739604cf56) )
44284423
4429   ROM_REGION( 4, "rom_key", 0 )
4430   ROM_LOAD( "suchie3-key.bin", 0, 4, CRC(592b5204) SHA1(ba18a5302ea271f58617a9793dfb85a0123080c8) )
4424   // 841-0002    1999     317-5047-JPN   Naomi
4425   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000368e1" )
44314426ROM_END
44324427
44334428/*
r243203r243204
44564451   ROM_LOAD("mpr-22071.ic11", 0x5800000, 0x0800000, CRC(1ab1f1ab) SHA1(bb8fa8d5a681115a82e9598ebe599b106f7aae9d) )
44574452   ROM_LOAD("mpr-22072.ic12s",0x6000000, 0x0800000, CRC(cb8d2634) SHA1(03ac8fb3a1acb1f8e32d9325c4da42417752f934) )
44584453
4459   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
4454   // 841-0004    1999     317-5050-JPN   Naomi     seems not used by game
4455   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0")
44604456ROM_END
44614457
44624458/*
r243203r243204
44974493
44984494   ROM_COPY( "rom_board", 0x1200000, 0x400000, 0x400000 )
44994495
4500   ROM_REGION( 4, "rom_key", 0 )
4501   ROM_LOAD( "mvsc2-key.bin", 0, 4, CRC(76f095b4) SHA1(773fd67e1eb471a989b3ee6e969a3d33bf61e779) )
4496   // 841-0007-02 2000
4497   ROM_PARAMETER( ":rom_board:key", "7c6e8bc1" )
45024498ROM_END
45034499
45044500/* toy fighter - 1999 sega */
r243203r243204
45214517   ROM_LOAD("mpr-22033.ic9", 0x4800000, 0x0800000, CRC(5fe5586e) SHA1(3ff41ae1f81469597684faadd88e62b5e0634352) )
45224518   ROM_LOAD("mpr-22034.ic10",0x5000000, 0x0800000, CRC(3aa5ce5e) SHA1(f00a906235e4522d6fc2ac771324114346875314) )
45234519
4524   ROM_REGION( 4, "rom_key", 0 )
4525   ROM_LOAD( "toyfight-key.bin", 0, 4, CRC(8e074319) SHA1(b1b88bc57b81c08853d4aa77a5da48e293da4f42) )
4520   // 840-0011    1999     317-0257-COM   Naomi
4521   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0802ca85" )
45264522ROM_END
45274523
45284524/* Crazy Taxi */
r243203r243204
45464542   ROM_LOAD( "mpr-21682.ic14s", 0x7000000, 0x800000, CRC(54c0290e) SHA1(6e07ab6e95c29a2aabed0ba1a7af0d7d605e0309) )
45474543   ROM_LOAD( "mpr-21683.ic15s", 0x7800000, 0x800000, CRC(ac8a27e0) SHA1(8e71d853a102dd6c164d5326e6d157ccfb8c7b36) )
45484544
4549   ROM_REGION( 4, "rom_key", 0 )
4550   ROM_LOAD( "crzytaxi-key.bin", 0, 4, CRC(3d36c13d) SHA1(746e82e7f1d6f4629dde00fb6b32943741b6ec70) )
4545   // 840-0002    1999     317-0248-COM   Naomi
4546   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080d2f45" )
45514547ROM_END
45524548
45534549/* Jambo! Safari */
r243203r243204
45664562   ROM_LOAD( "mpr-22824.ic7",  0x3800000, 0x800000, CRC(cc55304a) SHA1(e548d8de83469e5816c55dbbb00afbb894282fd6) )
45674563   ROM_LOAD( "mpr-22825.ic8",  0x4000000, 0x800000, CRC(85bada10) SHA1(b6e15d8f1d6bca12ffa4816ed0393c04ca500fba) )
45684564
4569   ROM_REGION( 4, "rom_key", 0 )
4570   ROM_LOAD( "jambo-key.bin", 0, 4, CRC(e78e9ac8) SHA1(677d7f21c238e12362ad65d6496f285d688fc3a9) )
4565   // 840-0013    1999     317-0264-COM   Naomi
4566   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fab95" )
45714567ROM_END
45724568
45734569/* 18 Wheeler (deluxe) (Rev A) */
r243203r243204
45984594   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
45994595   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
46004596
4601   ROM_REGION( 4, "rom_key", 0 )
4602   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
4597   // 840-0023    2000     317-0273-COM   Naomi
4598   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
46034599
46044600   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46054601   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243203r243204
46404636   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
46414637   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
46424638
4643   ROM_REGION( 4, "rom_key", 0 )
4644   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
4639   // 840-0023    2000     317-0273-COM   Naomi
4640   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
46454641
46464642   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46474643   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243203r243204
46824678   ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
46834679   ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
46844680
4685   ROM_REGION( 4, "rom_key", 0 )
4686   ROM_LOAD( "18wheelr-key.bin", 0, 4, CRC(046f97f5) SHA1(11eb5cffdd67d460718b63ddee8ff4dfa7d72314) )
4681   // 840-0023    2000     317-0273-COM   Naomi
4682   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0807cf54" )
46874683
46884684   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
46894685   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
r243203r243204
47154711   ROM_LOAD( "mpr-22991.ic14s", 0x7000000, 0x800000, CRC(0c20f313) SHA1(ac335d3015ef348c91319ae0e98b79a60e92f452) )
47164712   ROM_LOAD( "mpr-22992.ic15s", 0x7800000, 0x800000, CRC(5eb6c4c6) SHA1(5dc1bced7ebd7d7e01f74d03706ec4a96585628d) )
47174713
4718   ROM_REGION( 4, "rom_key", 0 ) // 317-0274-JPN
4719   ROM_LOAD( "marstv-key.bin", 0x000000, 0x000004, CRC(45c683ab) SHA1(1af2a582b54459eb1db56f5d3502917bb012d313) )
4714   // 840-0025    1999     317-0274-JPN   Naomi
4715   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080b8ef5" )
47204716ROM_END
47214717
47224718/* Sega Strike Fighter */
r243203r243204
47474743   ROM_LOAD( "mpr-23320.ic19s", 0x9800000, 0x800000, CRC(5ec75a45) SHA1(696e5d14678c794dec67246507bd580f7e5b5043) )
47484744   ROM_LOAD( "mpr-23321.ic20s", 0xa000000, 0x800000, CRC(018627d4) SHA1(2519f39ad046d14f602648fed39bc3719185b55e) )
47494745
4750   ROM_REGION( 4, "rom_key", 0 )
4751   ROM_LOAD( "sstrkfgt-key.bin", 0, 4, CRC(1884e4ee) SHA1(14ec026ed32825252987fed350f19f6e2565aa4d) )
4746   // 840-0035    2000     317-0281-COM   Naomi
4747   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08132303" )
47524748ROM_END
47534749
47544750// 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
r243203r243204
47794775   ROM_LOAD( "mpr-23320.ic19s", 0x9800000, 0x800000, CRC(5ec75a45) SHA1(696e5d14678c794dec67246507bd580f7e5b5043) )
47804776   ROM_LOAD( "mpr-23321.ic20s", 0xa000000, 0x800000, CRC(018627d4) SHA1(2519f39ad046d14f602648fed39bc3719185b55e) )
47814777
4782   ROM_REGION( 4, "rom_key", 0 )
4783   ROM_LOAD( "sstrkfgt-key.bin", 0, 4, CRC(1884e4ee) SHA1(14ec026ed32825252987fed350f19f6e2565aa4d) )
4778   // 840-0035    2000     317-0281-COM   Naomi
4779   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08132303" )
47844780ROM_END
47854781
47864782
r243203r243204
47994795   ROM_LOAD( "mpr-22914.ic5", 0x2800000, 0x800000, CRC(77844b60) SHA1(65d71febb8a160d00778ac7b53e082253cad9834) )
48004796   ROM_LOAD( "mpr-22915.ic6", 0x3000000, 0x800000, CRC(e48148ac) SHA1(c1273353eeaf9bb6b185f133281d7d04271bc895) )
48014797
4802   ROM_REGION( 4, "rom_key", 0 )
4803   ROM_LOAD( "sgtetris-key.bin", 0, 4, CRC(03bf7ea1) SHA1(0229c1f9a6eca65b09e3571768a1fbf3c1dad6b1) )
4798   // 840-0018    1999     317-0268-COM   Naomi
4799   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0808ae51" )
48044800ROM_END
48054801
48064802/*
r243203r243204
48564852   ROM_LOAD("mpr-23339.ic16s",0x8000000, 0x0800000, CRC(fd8c2736) SHA1(34ae1a4e35b4aac6666719fb4fc0959bd64ff3d6) )
48574853   ROM_LOAD("mpr-23340.ic17s",0x8800000, 0x0800000, CRC(001604f8) SHA1(615ec027d383d44d4aadb1175be6320e4139d7d1) )
48584854
4859   ROM_REGION( 4, "rom_key", 0 )
4860   ROM_LOAD( "slasho-key.bin", 0, 4, CRC(78e31e35) SHA1(a0b06cb7fbb0b2f1734831fc3e6a8315c0e78edd) )
4855   // 840-0041    2000     317-0286-COM   Naomi
4856   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081a66ca" )
48614857ROM_END
48624858
48634859
r243203r243204
49144910   ROM_LOAD( "mpr-23546.ic10", 0x9800000, 0x1000000, CRC(85db2248) SHA1(37845c269a2e65ee6181a8e7500c2e7dd9b2e343) )
49154911   ROM_LOAD( "mpr-23547.ic11", 0xa800000, 0x1000000, CRC(18b369c7) SHA1(b61cb3fda8cc685865684f7afc7dad0b29d93ca5) )
49164912
4917   ROM_REGION( 4, "rom_key", 0 )
4918   ROM_LOAD( "pjustic-key.bin", 0, 4, CRC(4a2bcbaa) SHA1(a9434482498f97605f76d08f749685452651a753) )
4913   // 841-0015    2000     317-5065-COM   Naomi
4914   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000725d0" )
49194915ROM_END
49204916
49214917/*
r243203r243204
49564952   ROM_LOAD("mpr-21595.ic7", 0x3800000, 0x0800000, CRC(7ab218f7) SHA1(c5c022e63f926cce09d49331647cde20e8e42ab3) )
49574953   ROM_LOAD("mpr-21596.ic8", 0x4000000, 0x0800000, CRC(f27dbdc5) SHA1(d54717d62897546968de2f049239f68bee49bdd8) )
49584954
4959   ROM_REGION( 4, "rom_key", 0 )
4960   ROM_LOAD( "pstone-key.bin", 0, 4, CRC(7386d0de) SHA1(72f6b552440e470344f707e349d100d9ba21b69d) )
4955   // 841-0001    1999     317-5046-COM   Naomi
4956   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000e69c1" )
49614957ROM_END
49624958
49634959/*
r243203r243204
49994995   ROM_LOAD("mpr-23125.ic8", 0x4000000, 0x0800000, CRC(b9938bbc) SHA1(d55d7adecb5a5a4a276a5a17c12808085d980fd9) )
50004996   ROM_LOAD("mpr-23126.ic9", 0x4800000, 0x0800000, CRC(fbb0325b) SHA1(21b965519d7508d84344641d43e8af2c3ca29ba4) )
50014997
5002   ROM_REGION( 4, "rom_key", 0 )
5003   ROM_LOAD( "pstone2-key.bin", 0, 4, CRC(3858144b) SHA1(f5fb9157b38969c986f8abbe8ed3f95e788e45c0) )
4998   // 841-0008    2000     317-5054-COM   Naomi
4999   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000b8dc0" )
50045000ROM_END
50055001
50065002
r243203r243204
50645060   ROM_LOAD("mpr-22159.ic18s",0x9000000, 0x0800000, CRC(f8b5e99d) SHA1(bb174a6a80967d0ff05c3a7512e4f0f9c921d130) )
50655061   ROM_LOAD("mpr-22160.ic19s",0x9800000, 0x0800000, CRC(579eef4e) SHA1(bfcabd57f623647053afcedcabfbc74e5736819f) )
50665062
5067   ROM_REGION( 4, "rom_key", 0 )
5068   ROM_LOAD( "otrigger-key.bin", 0, 4, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
5063   // 840-0017    1999     317-0266-COM   Naomi
5064   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
50695065ROM_END
50705066
50715067/*
r243203r243204
51025098
51035099   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
51045100
5105   ROM_REGION( 4, "rom_key", 0 )
5106   ROM_LOAD( "qmegamis-key.bin", 0, 4, CRC(b08650c0) SHA1(9e6b0fac6fb05209da9e01bb1a5437949d218078) )
5101   // 840-0030    2000
5102   ROM_PARAMETER( ":rom_board:key", "96489bcd" )
51075103ROM_END
51085104
51095105/*
r243203r243204
51575153   ROM_LOAD("mpr-22964.ic15s",0x7800000, 0x0800000, CRC(f581d5a3) SHA1(8cf769f5b0a48951246bb60e9cf58232bcee7bc8) )
51585154   ROM_LOAD("mpr-22965.ic16s",0x8000000, 0x0800000, CRC(8f7bfa8a) SHA1(19f137b1552978d232785c4408805b71835585c6) )
51595155
5160   ROM_REGION( 4, "rom_key", 0 )
5161   ROM_LOAD( "samba-key.bin", 0, 4, CRC(e17e3603) SHA1(5611615064a93cc9d957cc4edd12c716a72cd7f2) )
5156   // 840-0020    1999     317-0270-COM   Naomi
5157   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080a8b5d" )
51625158ROM_END
51635159
51645160// prototype - only works with US BIOS
r243203r243204
51855181   ROM_LOAD("mpr-22964.ic15s",0x7800000, 0x0800000, CRC(f581d5a3) SHA1(8cf769f5b0a48951246bb60e9cf58232bcee7bc8) )
51865182   ROM_LOAD("mpr-22965.ic16s",0x8000000, 0x0800000, CRC(8f7bfa8a) SHA1(19f137b1552978d232785c4408805b71835585c6) )
51875183
5188   ROM_REGION( 4, "rom_key", 0 )
5189   ROM_LOAD( "samba-key.bin", 0, 4, CRC(e17e3603) SHA1(5611615064a93cc9d957cc4edd12c716a72cd7f2) )
5184   // 840-0020    1999     317-0270-COM   Naomi
5185   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080a8b5d" )
51905186ROM_END
51915187
51925188/*
r243203r243204
52175213   ROM_LOAD("mpr-22218.ic11",  0x5800000, 0x0800000, CRC(f9ca31b8) SHA1(ea3d0f38ca1a46c896c06f038a6362ad3c9f90b2) )
52185214   ROM_LOAD("mpr-22219.ic12s", 0x6000000, 0x0800000, CRC(b3b45811) SHA1(045e7236b814f848d4c9767618ddcd4344d880ec) )
52195215
5220   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
5216   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
52215217ROM_END
52225218
52235219// Shootout Pool
r243203r243204
52345230
52355231   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52365232
5237   ROM_REGION( 4, "rom_key", 0 )
5238   ROM_LOAD( "shootopl-key.bin", 0, 4, CRC(45547e02) SHA1(4f79f478ff1eea14bc939a67ff570143cb56a4bf) )
5233   // 840-0098    2002
5234   ROM_PARAMETER( ":rom_board:key", "a77cf3a0" )
52395235ROM_END
52405236
52415237// Shootout Pool Prize
r243203r243204
52525248
52535249   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52545250
5255   ROM_REGION( 4, "rom_key", 0 )
5256   ROM_LOAD( "shootpl-key.bin", 0, 4, CRC(03c30b17) SHA1(e8e8659aa27b3d1cac2268850d3973d9afeaeba9) )
5251   // 840-0128    2002
5252   ROM_PARAMETER( ":rom_board:key", "cde98d9d" )
52575253ROM_END
52585254
52595255// Shootout Pool Prize Ver. B
r243203r243204
52705266
52715267   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
52725268
5273   ROM_REGION( 4, "rom_key", 0 )
5274   ROM_LOAD( "shootpl-key.bin", 0, 4, CRC(03c30b17) SHA1(e8e8659aa27b3d1cac2268850d3973d9afeaeba9) )
5269   // 840-0128    2002
5270   ROM_PARAMETER( ":rom_board:key", "cde98d9d" )
52755271ROM_END
52765272
52775273/* Oinori-daimyoujin Matsuri (medal) */
r243203r243204
52875283   ROM_LOAD( "mpr-24057.ic4", 0x3800000, 0x1000000, CRC(6dec3518) SHA1(3e65065df22680e2bbf2d3db22da413f347a1abe) )
52885284   ROM_LOAD( "mpr-24058.ic5", 0x4800000, 0x1000000, CRC(0eba9049) SHA1(a71ca72aeaf17180cde59d7c7b42c97a1b4259ab) )
52895285
5290   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
5286   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
52915287ROM_END
52925288
52935289/*
r243203r243204
53315327   ROM_LOAD("mpr-22975.ic9",  0x4800000, 0x0800000, CRC(0d3c70d1) SHA1(22920bc5fd1dda760b5cb17482e9181be899bc08) )
53325328   ROM_LOAD("mpr-22976.ic10", 0x5000000, 0x0800000, CRC(092d8063) SHA1(14fafd3f4c4f2b37172453d1c815fb9b8f4814f4) )
53335329
5334   ROM_REGION( 4, "rom_key", 0 )
5335   ROM_LOAD( "spawn-key.bin", 0, 4, CRC(dd211f09) SHA1(d436cd5009744c4c69fb94c84837103b4ca1c9a7) )
5330   // 841-0005    1999     317-5051-COM   Naomi
5331   ROM_PARAMETER( ":rom_board:segam2crypt:key", "00078d01" )
53365332ROM_END
53375333
53385334/*
r243203r243204
53735369   ROM_LOAD("mpr-23020.ic20s", 0xa000000, 0x0800000, CRC(b5943007) SHA1(d0e95084aec5e05027c21a6b4a3331408853781b) )
53745370   //ic21 not populated
53755371
5376   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
5372   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
53775373ROM_END
53785374
53795375/*
r243203r243204
54375433   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
54385434   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
54395435
5440   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
5436   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
54415437ROM_END
54425438
54435439ROM_START( virnbao )
r243203r243204
54685464   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
54695465   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
54705466
5471   ROM_REGION( 4, "rom_key", 0 )
5472   ROM_LOAD( "virnbao-key.bin", 0, 4, CRC(980e3be8) SHA1(234a2f8ee408144d2c51e8083d0a033eea6026e0) )
5467   // 840-0021    2000     317-0271-COM   Naomi
5468   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08068b58" )
54735469ROM_END
54745470
54755471ROM_START( virnbap )
r243203r243204
55005496   ROM_LOAD("mpr-22947.ic20s", 0xa000000, 0x0800000, CRC(5e5eb595) SHA1(401d4a11d436988d716bb014b36233f171dc576d) )
55015497   ROM_LOAD("mpr-22948.ic21s", 0xa800000, 0x0800000, CRC(1b0de917) SHA1(fd1742ea9bb2f1ce871ee3266171f26634e1c8e7) )
55025498
5503   ROM_REGION( 4, "rom_key", 0 )
5504   ROM_LOAD( "virnbao-key.bin", 0, 4, CRC(980e3be8) SHA1(234a2f8ee408144d2c51e8083d0a033eea6026e0) )
5499   // 840-0021    2000     317-0271-COM   Naomi
5500   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08068b58" )
55055501ROM_END
55065502
55075503/*
r243203r243204
55535549   ROM_LOAD("mpr-21922.ic14s",0x7000000, 0x0800000, CRC(a1901e1e) SHA1(2281f91ac696cc14886bcdf4b0685ce2f5bb8117) )
55545550   ROM_LOAD("mpr-21923.ic15s",0x7800000, 0x0400000, CRC(d127d9a5) SHA1(78c95357344ea15469b84fa8b1332e76521892cd) )
55555551
5556   ROM_REGION( 4, "rom_key", 0 )
5557   ROM_LOAD( "vs2_2k-key.bin", 0, 4, CRC(f9fb4716) SHA1(83277f61e97fc6c4d8d27b903bde0acdfb0c7dbc) )
5552   // 840-0010    1999     317-0258-COM   Naomi
5553   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08088b08" )
55585554ROM_END
55595555
55605556/*
r243203r243204
55985594   ROM_LOAD("mpr-22925.ic10",0x5000000, 0x0800000, CRC(81057e42) SHA1(d41137ae28c64dbdb50150db8cf25851bc0709c4) )
55995595   ROM_LOAD("mpr-22926.ic11",0x5800000, 0x0800000, CRC(57eec89d) SHA1(dd8f9a9155e51ee5260f559449fb0ea245077952) )
56005596
5601   ROM_REGION( 4, "rom_key", 0 )
5602   ROM_LOAD( "vtennis-key.bin", 0, 4, CRC(f355af89) SHA1(581a9b0f8c2f3606006e85e136f9cf0ea908c773) )
5597   // 840-0015    1999     317-0263-COM   Naomi
5598   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0803eb15" )
56035599ROM_END
56045600
56055601/*
r243203r243204
56245620   ROM_LOAD( "mpr-22268.ic7", 0x6800000, 0x1000000, CRC(536f5eea) SHA1(f1de8624f82595adf75693b604fb026bf3f778ee) )
56255621   ROM_LOAD( "mpr-22269.ic8", 0x7800000, 0x1000000, CRC(6c0cf740) SHA1(da10b33a6e54afbe1d7e52801216e7119b0b33b1) )
56265622
5627   ROM_REGION( 4, "rom_key", 0 )
5628   ROM_LOAD( "wwfroyal-key.bin", 0, 4, CRC(e14721b1) SHA1(1f2f447bbc4b1e0b016c5ac545d1d805abc61ebd) )
5623   // 840-0040    2000     317-0285-COM   Naomi
5624   ROM_PARAMETER( ":rom_board:segam2crypt:key", "081627c3" )
56295625ROM_END
56305626
56315627ROM_START( mushik2e )
r243203r243204
59415937   ROM_LOAD("mpr-21725.ic18s",0x9000000, 0x0800000, CRC(2202077b) SHA1(0893a85379f994277083c0bc5b178dd34508f816) )
59425938   ROM_LOAD("mpr-21726.ic19s",0x9800000, 0x0800000, CRC(429bf290) SHA1(6733e1bcf100e73ab43273f6feedc187fcaa55d4) )
59435939
5944   ROM_REGION( 4, "rom_key", 0 )
5945   ROM_LOAD( "zombrvn-key.bin", 0, 4, CRC(572d3944) SHA1(16ae634d85169851b9deae3c03b5dd4d4bf2794a) )
5940   // 840-0003    1999     317-0249-COM   Naomi
5941   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08012b41" )
59465942ROM_END
59475943
59485944ROM_START( gunsur2 )
r243203r243204
59665962   ROM_LOAD( "bhf1ma14.6m",  0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) )
59675963   ROM_LOAD( "bhf1ma15.6l",  0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) )
59685964
5969   ROM_REGION( 4, "rom_key", 0 )
5970   ROM_LOAD( "bhf1-key.bin", 0x0000000, 0x0000004, CRC(9899e931) SHA1(c0837262b9069b33d0e72b418e80b5f0da8b9251) )
5965   // 25709801    2001     317-5075-COM   Naomi
5966   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000680d0" )
59715967ROM_END
59725968
59735969ROM_START( gunsur2e )
r243203r243204
59915987   ROM_LOAD( "bhf1ma14.6m",  0xe000000, 0x1000000, CRC(d06c9bd7) SHA1(54668a2fd31059976890da92709c18f308634887) )
59925988   ROM_LOAD( "bhf1ma15.6l",  0xf000000, 0x1000000, CRC(db3c396b) SHA1(da0e125d627ce890906ca100081ab0685e11c0ef) )
59935989
5994   ROM_REGION( 4, "rom_key", 0 )
5995   ROM_LOAD( "bhf1-key.bin", 0x0000000, 0x0000004, CRC(9899e931) SHA1(c0837262b9069b33d0e72b418e80b5f0da8b9251) )
5990   // 25709801    2001     317-5075-COM   Naomi
5991   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000680d0" )
59965992ROM_END
59975993
59985994ROM_START( wldkicks )
r243203r243204
60136009   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60146010   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60156011
6016   ROM_REGION( 4, "rom_key", 0 )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6012   // 25209801    2000     317-5040-COM   Naomi
6013   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
60186014ROM_END
60196015
60206016ROM_START( wldkicksa )
r243203r243204
60356031   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60366032   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60376033
6038   ROM_REGION( 4, "rom_key", 0 )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6034   // 25209801    2000     317-5040-COM   Naomi
6035   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
60406036ROM_END
60416037
60426038ROM_START( wldkicksb )
r243203r243204
60576053   ROM_LOAD( "wk1ma9.4d",   0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) )
60586054   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60596055
6060   ROM_REGION( 4, "rom_key", 0 )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6056   // 25209801    2000     317-5040-COM   Naomi
6057   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
60626058ROM_END
60636059
60646060ROM_START( toukon4 )
r243203r243204
60846080   ROM_LOAD( "trf1ma14.6m", 0xe000000, 0x1000000, CRC(87cb31a0) SHA1(27aef9ac571a0b5e3a76e4ee22f5bc5d0ae962f2) )
60856081   ROM_LOAD( "trf1ma15.6l", 0xf000000, 0x1000000, CRC(42d318c5) SHA1(f9fe82ffbfc51fcb52333f94c55a7092e7124fb4) )
60866082
6087   ROM_REGION( 4, "rom_key", 0 )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(986a7cee) SHA1(70c3ff80f86de6a0655251658c66a156fb644995) )
6083   // 25349801    2000     317-5040-COM   Naomi
6084   ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" )
60896085ROM_END
60906086
60916087ROM_START( ninjaslt )
r243203r243204
61066102   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61076103   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61086104
6109   ROM_REGION( 4, "rom_key", 0 )
6110   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
6105   // 25469801    2000     317-5068-COM   Naomi
6106   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
61116107
61126108   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61136109   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243203r243204
61316127   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61326128   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61336129
6134   ROM_REGION( 4, "rom_key", 0 )
6135   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
6130   // 25469801    2000     317-5068-COM   Naomi
6131   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
61366132
61376133   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61386134   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243203r243204
61566152   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61576153   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61586154
6159   ROM_REGION( 4, "rom_key", 0 )
6160   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
6155   // 25469801    2000     317-5068-COM   Naomi
6156   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
61616157
61626158   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61636159   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243203r243204
61816177   ROM_LOAD( "nja1ma9.4c",      0x9000000, 0x1000000, CRC(8abed815) SHA1(5e1b208d23a17ba743d0507d963be42e7828755f) )
61826178   ROM_LOAD( "nja1ma10.4b",     0xa000000, 0x1000000, CRC(f14d2073) SHA1(b4a8cd585794be149b616119df3f75c0fb30e2f0) )
61836179
6184   ROM_REGION( 4, "rom_key", 0 )
6185   ROM_LOAD( "nja3-key.bin", 0x000000, 0x000004, CRC(e6997eb0) SHA1(c866a5069e28939be5a8fc867bc14791decac3c8) )
6180   // 25469801    2000     317-5068-COM   Naomi
6181   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000ca510" )
61866182
61876183   ROM_REGION( 0x20000, "jyu_io", 0 )  // H8/3334-based I/O board ROM, eventually should be separated out
61886184   ROM_LOAD( "jyu1_prg0a.ic3", 0x000000, 0x020000, CRC(aec4dbc1) SHA1(bddd4f345baf7f594998a39c09da18b3834f0ac2) )
r243203r243204
62036199   ROM_LOAD( "maz1ma7.4e",  0x7000000, 0x1000000, CRC(6103ad9c) SHA1(e4abbb5867cae6a9bf9067ab3a091ef7b18fa0cd) )
62046200   ROM_LOAD( "maz1ma8.4d",  0x8000000, 0x1000000, CRC(d46c9f40) SHA1(45eec7fa3d4261f12438e841254fa75d572331b3) )
62056201
6206   ROM_REGION( 4, "rom_key", 0 )
6207   ROM_LOAD( "maz1-key.bin", 0x000000, 0x000004, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
6202   // 25869812    2002     317-0266-COM   Naomi
6203   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
62086204ROM_END
62096205
62106206ROM_START( mazana )
r243203r243204
62226218   ROM_LOAD( "maz1ma7.4e",  0x7000000, 0x1000000, CRC(6103ad9c) SHA1(e4abbb5867cae6a9bf9067ab3a091ef7b18fa0cd) )
62236219   ROM_LOAD( "maz1ma8.4d",  0x8000000, 0x1000000, CRC(d46c9f40) SHA1(45eec7fa3d4261f12438e841254fa75d572331b3) )
62246220
6225   ROM_REGION( 4, "rom_key", 0 )
6226   ROM_LOAD( "maz1-key.bin", 0x000000, 0x000004, CRC(79ebd41a) SHA1(3545dacdeac66b46e8706565f0eca784291040d1) )
6221   // 25869812    2002     317-0266-COM   Naomi
6222   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080fea94" )
62276223ROM_END
62286224
62296225ROM_START( vtenis2c )
r243203r243204
62536249
62546250   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
62556251
6256   ROM_REGION( 4, "rom_key", 0 )
6257   ROM_LOAD( "vtenis2c-key.bin", 0, 4, CRC(b8c5b510) SHA1(f36d037a62a576e71211093e075f0ffa7e312c2d) )
6252   // 840-0084    2001
6253   ROM_PARAMETER( ":rom_board:key", "43472d2d" )
62586254ROM_END
62596255
62606256ROM_START( kick4csh )
r243203r243204
62836279
62846280   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
62856281
6286   ROM_REGION( 4, "rom_key", 0 )
6287   ROM_LOAD( "kick4csh-key.bin", 0, 4, CRC(889d2ea1) SHA1(daf7acf41b6bc607d443a93221a3e4554b99547f) )
6282   // 840-0140    2004
6283   ROM_PARAMETER( ":rom_board:key", "c9570882" )
62886284ROM_END
62896285
62906286ROM_START( wrungp )
r243203r243204
63006296   ROM_LOAD( "mpr-23723.ic5",  0x4800000, 0x1000000, CRC(651610eb) SHA1(4dfe4f876a5440bd1034f41a4d76e1d6bd3e0e32) )
63016297   ROM_LOAD( "mpr-23724.ic6",  0x5800000, 0x1000000, CRC(c633c45a) SHA1(23b45140f965428d33e2424b0574715c0b952d05) )
63026298
6303   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6299   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
63046300ROM_END
63056301
63066302ROM_START( gundmct )
r243203r243204
63206316   ROM_LOAD( "mpr-23636.ic9",  0x8800000, 0x1000000, CRC(57199e9f) SHA1(73a6f20ee7b3133ed4c6286e477e2ff9757106bd) )
63216317   ROM_LOAD( "mpr-23637.ic10", 0x9800000, 0x1000000, CRC(737b5dff) SHA1(0a405b711ffb096a3e6d52ececed73a5f93ebf02) )
63226318
6323   ROM_REGION( 4, "rom_key", 0 )
6324   ROM_LOAD( "gundmct-key.bin", 0, 4, CRC(0dee7a39) SHA1(24eef111ad7d8ad984e38b63101d01463b36542e) )
6319   // 841-0017    2001     317-5070-COM   Naomi
6320   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000e8010" )
63256321ROM_END
63266322
63276323ROM_START( puyoda )
r243203r243204
63516347   ROM_LOAD( "mpr-22204.ic19s", 0x9800000, 0x800000, CRC(2c5e5140) SHA1(7887fc19459dc85ca78256e0c50c762eea001e51) )
63526348   ROM_LOAD( "mpr-22205.ic20s", 0xa000000, 0x800000, CRC(7d523ae5) SHA1(7495082b7e83b6ee8f47660baba4c604d8ba2ff1) )
63536349
6354   ROM_REGION( 4, "rom_key", 0 )
6355   ROM_LOAD( "puyoda-key.bin", 0, 4, CRC(245bb259) SHA1(7ab675779ebf01ad3a78edd39cb287b71acd8bb5) )
6350   // 841-0006    1999     317-5052-COM   Naomi
6351   ROM_PARAMETER( ":rom_board:segam2crypt:key", "000acd40" )
63566352ROM_END
63576353
63586354ROM_START( zerogu2 )
r243203r243204
63676363   ROM_LOAD( "mpr-23687.ic4",  0x3800000, 0x1000000, CRC(e125439a) SHA1(07e7339f3f53aeb0ebddf7a8ac3eb6d8f3fe9de6) )
63686364   ROM_LOAD( "mpr-23688.ic5",  0x4800000, 0x1000000, CRC(38412edf) SHA1(9cae06cf46e134531f47e64deedace449664f69a) )
63696365
6370   ROM_REGION( 4, "rom_key", 0 )
6371   ROM_LOAD( "zerogu2-key.bin", 0, 4, CRC(f2460eb3) SHA1(69ec4e3933e60caa6a0ac44a855a40deed337d92) )
6366   // 841-0020    2001     317-5073-COM   Naomi
6367   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0007c010" )
63726368ROM_END
63736369
63746370ROM_START( inunoos )
r243203r243204
63956391   ROM_LOAD( "ic15s.bin", 0x7800000, 0x800000, CRC(b85e13ef) SHA1(974f6b8f24efe79d72ea9d7a2cfccf479704243d) )
63966392   ROM_LOAD( "ic16s.bin", 0x8000000, 0x800000, CRC(b8493dbe) SHA1(b641417e1bda49341e7ff86340072d74e3330665) )
63976393
6398   ROM_REGION( 4, "rom_key", 0 )
6399   ROM_LOAD( "inunoos-key.bin", 0, 4, CRC(3ce3ed17) SHA1(d5d6daac0cbcdf7dada2e01f3c458dea04805c05) )
6394   // 840-0073    2001     317-0316-JPN   Naomi
6395   ROM_PARAMETER( ":rom_board:segam2crypt:key", "094bc3e3" )
64006396ROM_END
64016397
64026398ROM_START( ringout )
r243203r243204
64166412   ROM_LOAD( "mpr-21769.ic9",  0x4800000, 0x800000, CRC(6d22d29d) SHA1(382dcd62065437b34fe101144b1c047eb261f047) )
64176413   ROM_LOAD( "mpr-21770.ic10", 0x5000000, 0x800000, CRC(c5308e61) SHA1(e51f8026351d5ffbda2a5bed39aeef543366febf) )
64186414
6419   ROM_REGION( 4, "rom_key", 0 )
6420   ROM_LOAD( "ringout-key.bin", 0, 4, CRC(8f8c4eb2) SHA1(9bc59c69d04d9ce876415af048f39095ed680a5e) )
6415   // 840-0004    1999     317-0250-COM   Naomi
6416   ROM_PARAMETER( ":rom_board:segam2crypt:key", "080b1e40" )
64216417ROM_END
64226418
64236419ROM_START( vonot )
r243203r243204
64406436   ROM_LOAD( "mpr-23193.ic12s", 0x6000000, 0x800000, CRC(c86a5b9b) SHA1(4b8dda85003289e1464e12c3abf449bb8df20e3a) )
64416437   ROM_LOAD( "mpr-23194.ic13s", 0x6800000, 0x800000, CRC(5adea0bd) SHA1(f8614ba83d5f61556c3db1a1796a02ed2c51ce2a) )
64426438
6443   ROM_REGION( 4, "rom_key", 0 )
6444   ROM_LOAD( "vonot-key.bin", 0, 4, CRC(021ac707) SHA1(af57844331226d3b1722aedca1a7aef024468b39) )
6439   // 840-0028    2000     317-0279-COM   Naomi
6440   ROM_PARAMETER( ":rom_board:segam2crypt:key", "08010715" )
64456441ROM_END
64466442
64476443ROM_START( derbyo2k )
r243203r243204
64676463   ROM_LOAD( "mpr-22237.ic15s", 0x7800000, 0x800000, CRC(718dd6bf) SHA1(6b71bb6970b582865f53d26e9579587fce86439e) )
64686464   ROM_LOAD( "mpr-22238.ic16s", 0x8000000, 0x800000, CRC(fb3e55da) SHA1(d547ee5b47e6e6fec9e447460300c828fbff8f2e) )
64696465
6470   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6466   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
64716467ROM_END
64726468
64736469ROM_START( starhrse )
r243203r243204
64816477   ROM_LOAD( "mpr-23233.ic3",  0x2800000, 0x1000000, CRC(d6451cab) SHA1(6508e27d0370b19df01150da7baf4875479c166a) )
64826478   ROM_LOAD( "mpr-23234.ic4",  0x3800000, 0x1000000, CRC(44044c14) SHA1(4934cb8d5f9b4085ffb5ddc711343f488aae4c4d) )
64836479
6484   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6480   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
64856481
64866482   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
64876483   ROM_REGION(0x84, "some_eeprom", 0)
r243203r243204
65146510   ROM_LOAD( "ic17s.bin", 0x8800000, 0x800000, CRC(b4c40606) SHA1(4f187dfe44bd89c90b6fa4b90f16222bc0a74d22) )
65156511   // .18s chip is not present but is tested for an FF fill (pull-up resistors on the PCB's data bus presumably accomplish this)
65166512
6517   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6513   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
65186514
65196515   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65206516   ROM_REGION(0x84, "some_eeprom", 0)
r243203r243204
65356531   ROM_LOAD( "mpr-23280.ic6",  0x5800000, 0x1000000, CRC(b1c8daa2) SHA1(a05fb374156ea013e35502abccc92f5117c39daa) )
65366532   ROM_LOAD( "mpr-23281.ic7",  0x6800000, 0x0800000, CRC(c0378369) SHA1(c728a181eddb01b9f8574669d4550baed559a5a4) )
65376533
6538   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6534   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
65396535
65406536   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65416537   ROM_REGION(0x84, "some_eeprom", 0)
r243203r243204
65576553   ROM_LOAD( "mpr-24128.ic6",   0x5800000, 0x1000000, CRC(bfdbb853) SHA1(bfbeb6ab634201af68d1427dea4f50163673fc2c) )
65586554   ROM_LOAD( "mpr-24129.ic7",   0x6800000, 0x1000000, CRC(c3f0f06a) SHA1(152324f2dbbde5560ae3adb1f9394a273fedbe9c) )
65596555
6560   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6556   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
65616557ROM_END
65626558
65636559/* prototype cartridges for games released on GD-ROM */
r243203r243204
65936589   ROM_COPY( "rom_board", 0x01000000, 0x400000, 0xc00000 )
65946590
65956591   // M1 board, but it doesn't appear the protection is used
6596   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
6592   ROM_PARAMETER( ":rom_board:key", "0" )
65976593
65986594   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
65996595   ROM_REGION(0x84, "some_eeprom", 0)
r243203r243204
77907786   NAOMI_DEFAULT_EEPROM
77917787
77927788   ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF)
7793   ROM_LOAD( "epr-23663c.ic22",0x0000000, 0x0400000, CRC(7007fec7) SHA1(523168f0b218d0bd5c815d65bf0caba2c8468c9d) )
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) )
77947791   ROM_LOAD( "mpr-23652.ic1",  0x0800000, 0x1000000, CRC(992758a2) SHA1(5e2a25c520c1795128e5026fc00d355c24852ded) )
77957792   ROM_LOAD( "mpr-23653.ic2",  0x1800000, 0x1000000, CRC(e210e932) SHA1(2f6f0a31c3e98b21f1ff3af1680e50b3535b130f) )
77967793   ROM_LOAD( "mpr-23654.ic3",  0x2800000, 0x1000000, CRC(91335971) SHA1(fc7599b836fb7995dd7da940e64b08b3c09cb180) )
r243203r243204
78037800   ROM_LOAD( "mpr-23661.ic10", 0x9800000, 0x1000000, CRC(7d44dc74) SHA1(cfd6253eab3c1a039629b4873946c9dbc7ed6872) )
78047801   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78057802
7806   ROM_REGION( 4, "rom_key", 0 )
7807   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
7803   // 840-0061    2001     317-0310-COM   Naomi 2
7804   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0cee834a" )
78087805ROM_END
78097806
78107807ROM_START( vstrik3cb )
r243203r243204
78257822   ROM_LOAD( "mpr-23661.ic10", 0x9800000, 0x1000000, CRC(7d44dc74) SHA1(cfd6253eab3c1a039629b4873946c9dbc7ed6872) )
78267823   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78277824
7828   ROM_REGION( 4, "rom_key", 0 )
7829   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
7825   // 840-0061    2001     317-0310-COM   Naomi 2
7826   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0cee834a" )
78307827ROM_END
78317828
78327829ROM_START( wldrider )
r243203r243204
78467843   ROM_LOAD( "mpr-23619.ic9",  0x8800000, 0x1000000, CRC(a5f4f6af) SHA1(bb89d3f0f5bbaf7c40fa43680c7e51ef93f7ed26) )
78477844   ROM_LOAD( "mpr-23620.ic10", 0x9800000, 0x1000000, CRC(67aa15a9) SHA1(42c24cbf7069c27430a71509a872cd1c4224aaeb) )
78487845
7849   ROM_REGION( 4, "rom_key", 0 )
7850   ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(f5a662ad) SHA1(a75b1e490d1f7d57cd8976115572266d1ca05202) )
7846   // 840-0046    2001     317-0301-COM   Naomi 2
7847   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7a703" )
78517848ROM_END
78527849
78537850ROM_START( vf4cart )
r243203r243204
78687865   ROM_LOAD( "mpr-23783.ic10", 0x9800000, 0x1000000, CRC(c8d4f6f9) SHA1(9e9df605c050b3780d7df34bd5041d30bc084d2d) )
78697866   ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
78707867
7871   ROM_REGION( 4, "rom_key", 0 )
7872   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(22838e16) SHA1(afee674dce3cfdd20360c30da2da5ba69f8d4682) )
7868   // 840-0080    2002     317-0324-COM   Naomi 2
7869   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0eef2f96" )
78737870ROM_END
78747871
78757872// There is also a development cart (171-7885A) with 20x 64Mb FlashROMs instead of 10x 128Mb MaskROMs. Content is the same.
r243203r243204
78907887   ROM_LOAD("mpr-23816.ic9",  0x08800000,  0x01000000, CRC(bbaf0765) SHA1(3b79a4eff504b2156bea8b86c6cdd8e41e7bf268) )
78917888   ROM_LOAD("mpr-23817.ic10", 0x09800000,  0x01000000, CRC(e179cfb6) SHA1(1120036238439f8ac1041150396e4b60e4a243bc) )
78927889
7893   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
7890   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
78947891ROM_END
78957892
78967893ROM_START( soulsurf )
r243203r243204
79227919   ROM_LOAD( "ic20s.bin", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) )
79237920   ROM_LOAD( "ic21s.bin", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) )
79247921
7925   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
7922   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0") // Unused or unknown
79267923ROM_END
79277924
79287925ROM_START( vf4evoct )
r243203r243204
79547951
79557952   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
79567953
7957   ROM_REGION( 4, "rom_key", 0 )
7958   ROM_LOAD( "vf4evoct-key.bin", 0, 4, CRC(c37dae2b) SHA1(c42dc01b5918db36e7eb2aca523e2f4df567725a) )
7954   // 840-0106    2002
7955   ROM_PARAMETER( ":rom_board:key", "cdb05b1e" )
79597956ROM_END
79607957
79617958ROM_START( hopper )
r243203r243204
79917988   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
79927989   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
79937990
7994   ROM_REGION( 4, "rom_key", 0 )
7995   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
7991   // 840-0062    2001     317-0313-COM   Naomi 2
7992   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
79967993ROM_END
79977994
79987995ROM_START( clubkrtd )
r243203r243204
80138010   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
80148011   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
80158012
8016   ROM_REGION( 4, "rom_key", 0 )
8017   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
8013   // 840-0062    2001     317-0313-COM   Naomi 2
8014   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
80188015ROM_END
80198016
80208017ROM_START( clubkrtc )
r243203r243204
80358032   ROM_LOAD( "mpr-23702.ic10", 0x9800000, 0x1000000, CRC(e302b582) SHA1(787192ed9f9a08541eecc3128855485cad802a42) )
80368033   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
80378034
8038   ROM_REGION( 4, "rom_key", 0 )
8039   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
8035   // 840-0062    2001     317-0313-COM   Naomi 2
8036   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
80408037ROM_END
80418038
80428039ROM_START( clubkprz )
r243203r243204
80688065   ROM_REGION(0x84, "some_eeprom", 0)
80698066   ROM_LOAD( "at25010.ic3s", 0x000000, 0x000084, CRC(0142d8be) SHA1(5922b6c47b12b19e1fa7bbe9aae391905038a7ff) )
80708067
8071   ROM_REGION( 4, "rom_key", 0 )   // 317-0368-COM
8072   ROM_LOAD( "clubkprz-key.bin", 0x000000, 0x000004, CRC(c9ed13c1) SHA1(2907985375cd5b04846e7214d200926be64d06fd) )
8068   // 840-0062    2001     317-0313-COM   Naomi 2
8069   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
80738070ROM_END
80748071
80758072ROM_START( clubkpzb )
r243203r243204
80978094
80988095   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
80998096
8100   ROM_REGION( 4, "rom_key", ROMREGION_ERASE00 )
8101   ROM_LOAD( "clubkprz-key.bin", 0x000000, 0x000004, CRC(c9ed13c1) SHA1(2907985375cd5b04846e7214d200926be64d06fd) )
8097   // 840-0062    2001     317-0313-COM   Naomi 2
8098   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
81028099
81038100   // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes
81048101   ROM_REGION(0x84, "some_eeprom", 0)
r243203r243204
81328129
81338130   ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 )
81348131
8135   ROM_REGION( 4, "rom_key", 0 )
8136   ROM_LOAD( "clubk2k3-key.bin", 0x000000, 0x000004, CRC(96c3b4f6) SHA1(9b85a418153c70f56aaeeb1ed0bbbbd31a1bbad7) )
8132   // 840-0062    2001     317-0313-COM   Naomi 2
8133   ROM_PARAMETER( ":rom_board:segam2crypt:key", "0ce7d742" )
81378134ROM_END
81388135
81398136// 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
r243203r243204
90349031
90359032/* 840-xxxxx (Sega Naomi 2 cart games) */
90369033/* 0046 */ GAME( 2001, wldrider, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", 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 )
9034/* 0061 */ GAME( 2001, vstrik3c, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart)", GAME_FLAGS )
90389035/* 0061 */ GAME( 2001, vstrik3cb,vstrik3c,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev B)", GAME_FLAGS )
90399036/* 0062 */ GAME( 2001, clubkrte, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS )
90409037/* 0062 */ GAME( 2001, clubkrtd, clubkrte,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS )
r243203r243204
90519048
90529049/* 841-xxxxx ("Licensed by Sega" Naomi cart games)*/
90539050/* 0001 */ GAME( 1999, pstone,   naomi, naomim2, naomi,   naomi_state, naomi,  ROT0,  "Capcom",          "Power Stone (JPN, USA, EUR, ASI, AUS)", 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 )
9051/* 0002 */ GAME( 1999, suchie3,  naomi, naomim2, suchie3, naomi_state,naomi_mp,ROT0,  "Jaleco",          "Idol Janshi Suchie-Pai 3 (JPN)", GAME_FLAGS )
90559052/* 0003 */ GAME( 1999, doa2,     naomi, naomim2, naomi,   naomi_state, naomi,  ROT0,  "Tecmo",           "Dead or Alive 2 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
90569053/* 0003 */ GAME( 2000, doa2m,    doa2,  naomim2, naomi,   naomi_state, naomi,  ROT0,  "Tecmo",           "Dead or Alive 2 Millennium (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
90579054/* 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
r243203r243204
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
14341428WRITE8_MEMBER(nemesis_state::volume_callback)
14351429{
14361430   m_k007232->set_volume(0, (data >> 4) * 0x11, 0);
r243203r243204
18211815   MCFG_SOUND_ROUTE(1, "rspeaker", 0.30)
18221816
18231817   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1824   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nemesis_state, sound_irq))
1818//  MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) ... Interrupts _are_ generated, I wonder where they go
18251819   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
18261820   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
18271821
r243203r243204
18681862   MCFG_SOUND_ROUTE(1, "rspeaker", 0.30)
18691863
18701864   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
1871   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nemesis_state, sound_irq))
1865//  MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) ... Interrupts _are_ generated, I wonder where they go
18721866   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
18731867   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
18741868
trunk/src/mame/drivers/nl_pongd.c
r243203r243204
6565 *
6666 */
6767
68// identify unknown devices in IDE
6869
70//#define NETLIST_DEVELOPMENT 1
71
6972#include "netlist/nl_dice_compat.h"
7073#include "netlist/devices/net_lib.h"
7174#include "netlist/analog/nld_twoterm.h"
trunk/src/mame/drivers/nmg5.c
r243203r243204
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);
291290};
292291
293292
r243203r243204
952951GFXDECODE_END
953952
954953
955WRITE_LINE_MEMBER(nmg5_state::soundirq)
956{
957   m_soundcpu->set_input_line(0, state);
958}
959
960954void nmg5_state::machine_start()
961955{
962956   save_item(NAME(m_gfx_bank));
r243203r243204
10111005   MCFG_SPEAKER_STANDARD_MONO("mono")
10121006
10131007   MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) /* 4MHz */
1014   MCFG_YM3812_IRQ_HANDLER(WRITELINE(nmg5_state, soundirq))
1008   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
10151009   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
10161010
10171011   MCFG_OKIM6295_ADD("oki", 1000000 , OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/oneshot.c
r243203r243204
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
335330void oneshot_state::machine_start()
336331{
337332   save_item(NAME(m_gun_x_p1));
r243203r243204
381376   MCFG_SPEAKER_STANDARD_MONO("mono")
382377
383378   MCFG_SOUND_ADD("ymsnd", YM3812, 3500000)
384   MCFG_YM3812_IRQ_HANDLER(WRITELINE(oneshot_state, irqhandler))
379   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
385380   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
386381
387382   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/onetwo.c
r243203r243204
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);
8887};
8988
9089
r243203r243204
331330   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x6_layout, 0, 2 )
332331GFXDECODE_END
333332
334/*************************************
335 *
336 *  Sound interface
337 *
338 *************************************/
339333
340WRITE_LINE_MEMBER(onetwo_state::irqhandler)
341{
342   m_audiocpu->set_input_line(0, state);
343}
344
345334/*************************************
346335 *
347336 *  Machine driver
r243203r243204
386375   MCFG_SPEAKER_STANDARD_MONO("mono")
387376
388377   MCFG_SOUND_ADD("ymsnd", YM3812, MASTER_CLOCK)
389   MCFG_YM3812_IRQ_HANDLER(WRITELINE(onetwo_state, irqhandler))
378   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
390379   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
391380
392381   MCFG_OKIM6295_ADD("oki", 1056000*2, OKIM6295_PIN7_LOW) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/overdriv.c
r243203r243204
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 )
No newline at end of file
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 )
trunk/src/mame/drivers/pacman.c
r243203r243204
66166616   membank("bank1")->set_entry(1);
66176617}
66186618
6619DRIVER_INIT_MEMBER(pacman_state, mschamp)
6620{
6621   save_item(NAME(m_counter));
6622}
6623
66196624DRIVER_INIT_MEMBER(pacman_state,woodpek)
66206625{
66216626   int i, len;
r243203r243204
68446849GAME( 1981, mspacii2, mspacman, woodpek,  mspacman, pacman_state,  mspacii,  ROT90,  "bootleg (Orca)", "Ms. Pac-Man II (Orca bootleg set 2)", GAME_SUPPORTS_SAVE )
68456850GAME( 1981, pacgal,   mspacman, woodpek,  mspacman, driver_device, 0,        ROT90,  "hack", "Pac-Gal", GAME_SUPPORTS_SAVE )
68466851GAME( 1981, mspacpls, mspacman, woodpek,  mspacpls, driver_device, 0,        ROT90,  "hack", "Ms. Pac-Man Plus", 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 )
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 )
68496854
68506855// 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.
68516856// 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
r243203r243204
678678
679679   save_item(NAME(m_palbank));
680680   save_item(NAME(m_priority));
681   save_item(NAME(irq_count));
681   save_item(NAME(m_irq_count));
682682}
683683
684684void paradise_state::machine_reset()
r243203r243204
686686   m_palbank = 0;
687687   m_priority = 0;
688688
689   irq_count = 0;
689   m_irq_count = 0;
690690
691691}
692692
693693INTERRUPT_GEN_MEMBER(paradise_state::paradise_irq)
694694{
695   if (irq_count<300)
696      irq_count++;
695   if (m_irq_count<300)
696      m_irq_count++;
697697   else
698698      m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE);
699699}
trunk/src/mame/drivers/peplus.c
r243203r243204
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 graphics */
3690   ROM_LOAD( "mbo-cg2153.u74",   0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino card backs */
36913691   ROM_LOAD( "mxo-cg2153.u75",   0x18000, 0x8000, CRC(3ae44f7e) SHA1(00d625b60bffef6ce622cb50a3aa93b92131f578) )
36923692
36933693   ROM_REGION( 0x100, "proms", 0 )
r243203r243204
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
51155157ROM_START( peps0426 ) /* Normal board : Sizzling Sevens Slots (PS0268) - Payout 90.35% */
51165158   ROM_REGION( 0x10000, "maincpu", 0 )
51175159   ROM_LOAD( "ps0426_571-a3h.u68",   0x00000, 0x10000, CRC(b53771c1) SHA1(23fccd5facb98fc83b8903946435be4f15199ff8) ) /* 3 Coins Max / 1 Lines */
r243203r243204
53935435   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
53945436
53955437   ROM_REGION( 0x020000, "gfx1", 0 )
5396   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans graphics */
5438   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans card backs */
53975439   ROM_LOAD( "mgo-cg2291.u78",  0x08000, 0x8000, CRC(17bb35f8) SHA1(ba9e8aa3ff42b17c7be6ee46c70db22d8e60e52c) ) /* Compatible with most "standard" game sets */
53985440   ROM_LOAD( "mbo-cg2291.u79",  0x10000, 0x8000, CRC(de1036e4) SHA1(774bbcda301754dc4a606974248847a2264c3827) )
53995441   ROM_LOAD( "mxo-cg2291.u80",  0x18000, 0x8000, CRC(7049403c) SHA1(3a29a00fb8dfdb30dba757c1536151827ea09068) )
r243203r243204
54185460   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54195461
54205462   ROM_REGION( 0x020000, "gfx1", 0 )
5421   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships graphics */
5463   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships card backs */
54225464   ROM_LOAD( "mgo-cg2399.u73",  0x08000, 0x8000, CRC(5848a2fa) SHA1(4173a473016b7a776d2b59bf3ded0be35bd43721) )
54235465   ROM_LOAD( "mbo-cg2399.u74",  0x10000, 0x8000, CRC(5c3e16f6) SHA1(a4aa457f239527bffa6472e0d6f9d836f796b326) )
54245466   ROM_LOAD( "mxo-cg2399.u75",  0x18000, 0x8000, CRC(bd7669d5) SHA1(4343a9764fd563e2e1cdd8558f2f53f77006b159) )
r243203r243204
54435485   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54445486
54455487   ROM_REGION( 0x020000, "gfx1", 0 )
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) )
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) )
54505492
54515493   ROM_REGION( 0x200, "proms", 0 )
5452   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
5494   ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
54535495ROM_END
54545496
54555497ROM_START( pex0055pd ) /* Superboard : Deuces Wild Poker (X000055P+XP000035) */
r243203r243204
79407982   ROM_LOAD( "x002374p.u66",   0x00000, 0x10000, CRC(fc4b6c8d) SHA1(b101f9042bd54dbfdeed4c7a3acf3798096f6857) ) /* Super Aces Poker */
79417983
79427984   ROM_REGION( 0x020000, "gfx1", 0 )
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) )
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) )
79477989
79487990   ROM_REGION( 0x200, "proms", 0 )
7949   ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
7991   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
79507992ROM_END
79517993
79527994ROM_START( pex2377p ) /* Superboard : Super Double Bonus Poker (X002377P+XP000112) */
r243203r243204
92489290GAMEL(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 )
92499291GAMEL(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 )
92509292GAMEL(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 )
92519296GAMEL(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 )
92529297GAMEL(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 )
92539298GAMEL(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 )
r243203r243204
92659310GAMEL(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 )
92669311GAMEL(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 )
92679312GAMEL(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 )
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 )
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 )
92699314GAMEL(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 )
92709315GAMEL(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 )
92719316GAMEL(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 )
r243203r243204
93639408GAMEL(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 )
93649409GAMEL(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 )
93659410GAMEL(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 )
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 )
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 )
93679412GAMEL(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 )
93689413GAMEL(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 )
93699414GAMEL(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
r243203r243204
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
200193static MACHINE_CONFIG_START( prehisle, prehisle_state )
201194
202195   /* basic machine hardware */
r243203r243204
226219   MCFG_SPEAKER_STANDARD_MONO("mono")
227220
228221   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz)  /* verified on pcb */
229   MCFG_YM3812_IRQ_HANDLER(WRITELINE(prehisle_state, irqhandler))
222   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
230223   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
231224
232225   MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
trunk/src/mame/drivers/psikyo.c
r243203r243204
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
386381READ8_MEMBER(psikyo_state::psikyo_soundlatch_r)
387382{
388383   return m_soundlatch;
r243203r243204
10611056   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
10621057
10631058   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_32MHz/4) /* verified on pcb */
1064   MCFG_YM2610_IRQ_HANDLER(WRITELINE(psikyo_state, sound_irq))
1059   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
10651060   MCFG_SOUND_ROUTE(0, "lspeaker",  1.2)
10661061   MCFG_SOUND_ROUTE(0, "rspeaker", 1.2)
10671062   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
11071102   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11081103
11091104   MCFG_SOUND_ADD("ymsnd", YM2610, 8000000)
1110   MCFG_YM2610_IRQ_HANDLER(WRITELINE(psikyo_state, sound_irq))
1105   MCFG_YM2610_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
11111106   MCFG_SOUND_ROUTE(0, "lspeaker",  1.2)
11121107   MCFG_SOUND_ROUTE(0, "rspeaker", 1.2)
11131108   MCFG_SOUND_ROUTE(1, "lspeaker",  1.0)
r243203r243204
11531148***************************************************************************/
11541149
11551150
1156WRITE_LINE_MEMBER(psikyo_state::irqhandler)
1157{
1158   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
1159}
1160
11611151static MACHINE_CONFIG_START( s1945, psikyo_state )
11621152
11631153   /* basic machine hardware */
r243203r243204
11921182   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11931183
11941184   MCFG_SOUND_ADD("ymf", YMF278B, YMF278B_STD_CLOCK)
1195   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyo_state, irqhandler))
1185   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
11961186   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
11971187   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
11981188MACHINE_CONFIG_END
r243203r243204
12311221   ROM_LOAD32_WORD_SWAP( "4-u127.bin", 0x000000, 0x040000, CRC(8c9911ca) SHA1(821ba648b9a1d495c600cbf4606f2dbddc6f9e6f) ) // 1&0
12321222   ROM_LOAD32_WORD_SWAP( "5-u126.bin", 0x000002, 0x040000, CRC(d20c3ef0) SHA1(264e5a7e45e130a9e7152468733337668dc5b65f) ) // 3&2
12331223
1234   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1224   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
12351225   ROM_LOAD( "3-u58.bin", 0x00000, 0x20000, CRC(310f5c76) SHA1(dbfd1c5a7a514bccd89fc4f7191744cf76bb745d) )
1236   ROM_RELOAD(            0x10000, 0x20000             )
12371226
12381227   ROM_REGION( 0x200000, "gfx1", 0 )   /* Sprites */
12391228   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(00a546cb) SHA1(30a8679b49928d5fcbe58b5eecc2ebd08173adf8) )
r243203r243204
12561245   ROM_LOAD32_WORD_SWAP( "1-u127.bin", 0x000000, 0x040000, CRC(6c45b2f8) SHA1(08473297e174f3a6d67043f3b16f4e6b9c68b826) ) // 1&0
12571246   ROM_LOAD32_WORD_SWAP( "2-u126.bin", 0x000002, 0x040000, CRC(845a6760) SHA1(3b8fed294e28d9d8ef5cb5ec88b9ade396146a48) ) // 3&2
12581247
1259   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1248   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
12601249   ROM_LOAD( "3-u58.bin", 0x00000, 0x20000, CRC(310f5c76) SHA1(dbfd1c5a7a514bccd89fc4f7191744cf76bb745d) )
1261   ROM_RELOAD(            0x10000, 0x20000             )
12621250
12631251   ROM_REGION( 0x200000, "gfx1", 0 )   /* Sprites */
12641252   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(00a546cb) SHA1(30a8679b49928d5fcbe58b5eecc2ebd08173adf8) )
r243203r243204
13001288   ROM_LOAD32_WORD_SWAP( "4.u46", 0x000000, 0x040000, CRC(b78ec99d) SHA1(399b79931652d9df1632cd4d7ec3d214e473a5c3) ) // 1&0
13011289   ROM_LOAD32_WORD_SWAP( "5.u39", 0x000002, 0x040000, CRC(925f095d) SHA1(301a536119a0320a756e9c6e51fb10e36b90ef16) ) // 3&2
13021290
1303   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1291   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
13041292   ROM_LOAD( "3.u71",     0x00000, 0x20000, CRC(2168e4ba) SHA1(ca7ad6acb5f806ce2528e7b52c19e8cceecb8543) )
1305   ROM_RELOAD(            0x10000, 0x20000             )
13061293
13071294   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13081295   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243203r243204
13331320   ROM_LOAD32_WORD_SWAP( "1k.u46", 0x000000, 0x080000, CRC(745cee52) SHA1(6c5bb92c92c55f882484417bc1aa580684019610) ) // 1&0
13341321   ROM_LOAD32_WORD_SWAP( "2k.u39", 0x000002, 0x080000, CRC(669632fb) SHA1(885dea42e6da35e9166a208b18dbd930642c26cd) ) // 3&2
13351322
1336   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1323   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
13371324   ROM_LOAD( "k3.u71",    0x00000, 0x20000, CRC(11994055) SHA1(619776c178361f23de37ff14e87284ec0f1f4f10) )
1338   ROM_RELOAD(            0x10000, 0x20000             )
13391325
13401326   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13411327   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243203r243204
13631349   ROM_LOAD32_WORD_SWAP( "1.u46", 0x000000, 0x040000, CRC(474abd69) SHA1(27f37333075f9c92849101aad4875e69004d747b) ) // 1&0
13641350   ROM_LOAD32_WORD_SWAP( "2.u39", 0x000002, 0x040000, CRC(3e3e661f) SHA1(b5648546f390539b0f727a9a62d1b9516254ae21) ) // 3&2
13651351
1366   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1352   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
13671353   ROM_LOAD( "3.u71",     0x00000, 0x20000, CRC(2168e4ba) SHA1(ca7ad6acb5f806ce2528e7b52c19e8cceecb8543) )
1368   ROM_RELOAD(            0x10000, 0x20000             )
13691354
13701355   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
13711356   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(7d7e8a00) SHA1(9f35f5b54ae928e9bf2aa6ad4604f669857955ec) )
r243203r243204
13941379   ROM_LOAD32_WORD_SWAP( "4-u46.bin", 0x000000, 0x040000, CRC(8a7a28b4) SHA1(f7197be673dfd0ddf46998af81792b81d8fe9fbf) ) // 1&0
13951380   ROM_LOAD32_WORD_SWAP( "5-u39.bin", 0x000002, 0x040000, CRC(933561fa) SHA1(f6f3b1e14b1cfeca26ef8260ac4771dc1531c357) ) // 3&2
13961381
1397   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1382   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
13981383   ROM_LOAD( "3-u71.bin", 0x00000, 0x20000, CRC(22411fab) SHA1(1094cb51712e40ae65d0082b408572bdec06ae8b) )
1399   ROM_RELOAD(            0x10000, 0x20000             )
14001384
14011385   ROM_REGION( 0x700000, "gfx1", 0 )   /* Sprites */
14021386   ROM_LOAD( "u14.bin",  0x000000, 0x200000, CRC(282d89c3) SHA1(3b4b17f4a37efa2f7e232488aaba7c77d10c84d2) )
r243203r243204
14431427   ROM_LOAD32_WORD_SWAP( "1-u46.bin", 0x000000, 0x080000, CRC(45fa8086) SHA1(f1753b9420596f4b828c77e877a044ba5fb01b28) ) // 1&0
14441428   ROM_LOAD32_WORD_SWAP( "2-u39.bin", 0x000002, 0x080000, CRC(0152ab8c) SHA1(2aef4cb88341b35f20bb551716f1e5ac2731e9ba) ) // 3&2
14451429
1446   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1430   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
14471431   ROM_LOAD( "3-u71.bin", 0x00000, 0x20000, CRC(e3e366bd) SHA1(1f5b5909745802e263a896265ea365df76d3eaa5) )
1448   ROM_RELOAD(            0x10000, 0x20000             )
14491432
14501433   ROM_REGION( 0x800000, "gfx1", 0 )   /* Sprites */
14511434   ROM_LOAD( "u20.bin",  0x000000, 0x200000, CRC(28a27fee) SHA1(913f3bc4d0c6fb6b776a020c8099bf96f16fd06f) )
r243203r243204
15741557   ROM_LOAD32_WORD_SWAP( "2s.u40", 0x000000, 0x040000, CRC(9b10062a) SHA1(cf963bba157422b659d8d64b4493eb7d69cd07b7) ) // 1&0
15751558   ROM_LOAD32_WORD_SWAP( "3s.u41", 0x000002, 0x040000, CRC(f87e871a) SHA1(567167c7fcfb622f78e211d74b04060c3d29d6b7) ) // 3&2
15761559
1577   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1560   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
15781561   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1579   ROM_RELOAD(            0x10000, 0x20000             )
15801562
15811563   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU? */
15821564   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
16041586   ROM_LOAD32_WORD_SWAP( "4-u40.bin", 0x000000, 0x040000, CRC(29ffc217) SHA1(12dc3cb32253c3908f4c440c627a0e1b32ee7cac) ) // 1&0
16051587   ROM_LOAD32_WORD_SWAP( "5-u41.bin", 0x000002, 0x040000, CRC(c3d3fb64) SHA1(4388586bc0a6f3d62366b3c38b8b23f8a03dbf15) ) // 3&2
16061588
1607   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1589   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
16081590   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1609   ROM_RELOAD(            0x10000, 0x20000             )
16101591
16111592   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU? */
16121593   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
16341615   ROM_LOAD32_WORD_SWAP( "1-u40.bin", 0x000000, 0x040000, CRC(c00eb012) SHA1(080dae010ca83548ebdb3324585d15e48baf0541) ) // 1&0
16351616   ROM_LOAD32_WORD_SWAP( "2-u41.bin", 0x000002, 0x040000, CRC(3f5a134b) SHA1(18bb3bb1e1adadcf522795f5cf7d4dc5a5dd1f30) ) // 3&2
16361617
1637   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1618   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
16381619   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1639   ROM_RELOAD(            0x10000, 0x20000             )
16401620
16411621   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
16421622   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
16641644   ROM_LOAD32_WORD_SWAP( "10.u40", 0x000000, 0x040000, CRC(5a32af36) SHA1(2eada37fd043c097a11bcf4e3e0bebb473bbc0df) ) // 1&0
16651645   ROM_LOAD32_WORD_SWAP( "9.u41",  0x000002, 0x040000, CRC(29cc6d7d) SHA1(aeee9e88922c25c75885483d115e064c6b71540b) ) // 3&2
16661646
1667   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1647   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
16681648   ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, CRC(42d40ae1) SHA1(530a5a3f78ac489b84a631ea6ce21010a4f4d31b) )
1669   ROM_RELOAD(            0x10000, 0x20000             )
16701649
16711650   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
16721651   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
17161695   ROM_LOAD32_WORD_SWAP( "5-u40.bin", 0x000000, 0x080000, CRC(90088195) SHA1(8ec48d581ecd14b3dad36edc65d5a273324cf3c1) ) // 1&0
17171696   ROM_LOAD32_WORD_SWAP( "4-u41.bin", 0x000002, 0x080000, CRC(0d53196c) SHA1(454bb4695b13ce44ca5dac7c6d4142a8b9afa798) ) // 3&2
17181697
1719   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1698   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
17201699   ROM_LOAD( "1-u63.bin", 0x00000, 0x20000, CRC(2025e387) SHA1(334b0eb3b416d46ccaadff3eee6f1abba63285fb) )
1721   ROM_RELOAD(            0x10000, 0x20000             )
17221700
17231701   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
17241702   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
17461724   ROM_LOAD32_WORD_SWAP( "2-u40.bin", 0x000000, 0x080000, CRC(ab6fe58a) SHA1(6687a3af192b3eab60d75ca286ebb8e0636297b5) ) // 1&0
17471725   ROM_LOAD32_WORD_SWAP( "3-u41.bin", 0x000002, 0x080000, CRC(02e42e39) SHA1(6cdb7b1cebab50c0a44cd60cd437f0e878ccac5c) ) // 3&2
17481726
1749   ROM_REGION( 0x030000, "audiocpu", 0 )       /* Sound CPU Code */
1727   ROM_REGION( 0x020000, "audiocpu", 0 )       /* Sound CPU Code */
17501728   ROM_LOAD( "1-u63.bin", 0x00000, 0x20000, CRC(2025e387) SHA1(334b0eb3b416d46ccaadff3eee6f1abba63285fb) )
1751   ROM_RELOAD(            0x10000, 0x20000             )
17521729
17531730   ROM_REGION( 0x000100, "cpu2", 0 )       /* MCU */
17541731   ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, NO_DUMP )
r243203r243204
18021779   m_ka302c_banking = 0; // SH201B doesn't have any gfx banking
18031780
18041781   /* setup audiocpu banks */
1805   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000, 0x8000);
1782   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000);
18061783
18071784   /* Enable other regions */
18081785#if 0
r243203r243204
18591836
18601837   /* setup audiocpu banks */
18611838   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1862   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1839   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
18631840}
18641841
18651842DRIVER_INIT_MEMBER(psikyo_state,gunbird)
r243203r243204
18741851
18751852   /* setup audiocpu banks */
18761853   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1877   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1854   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
18781855}
18791856
18801857
r243203r243204
18961873
18971874   /* setup audiocpu banks */
18981875   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1899   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1876   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
19001877}
19011878
19021879DRIVER_INIT_MEMBER(psikyo_state,s1945a)
r243203r243204
19171894
19181895   /* setup audiocpu banks */
19191896   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1920   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1897   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
19211898}
19221899
19231900DRIVER_INIT_MEMBER(psikyo_state,s1945j)
r243203r243204
19381915
19391916   /* setup audiocpu banks */
19401917   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1941   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1918   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
19421919}
19431920
19441921DRIVER_INIT_MEMBER(psikyo_state,s1945jn)
r243203r243204
19531930
19541931   /* setup audiocpu banks */
19551932   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1956   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1933   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x200, 0x8000);
19571934}
19581935
19591936DRIVER_INIT_MEMBER(psikyo_state,s1945bl)
trunk/src/mame/drivers/psikyo4.c
r243203r243204
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
625619void psikyo4_state::machine_start()
626620{
627621   // configure YMF ROM banks
r243203r243204
693687
694688   MCFG_SOUND_ADD("ymf", YMF278B, MASTER_CLOCK/2)
695689   MCFG_DEVICE_ADDRESS_MAP(AS_0, ps4_ymf_map)
696   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyo4_state, irqhandler))
690   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 12))
697691   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
698692   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
699693MACHINE_CONFIG_END
trunk/src/mame/drivers/psikyosh.c
r243203r243204
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
765759void psikyosh_state::machine_start()
766760{
767761   membank("gfxbank")->configure_entries(0, 0x1000, memregion("gfx1")->base(), 0x20000);
r243203r243204
784778
785779   MCFG_SCREEN_ADD("screen", RASTER)
786780   MCFG_SCREEN_REFRESH_RATE(60)
787   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
788781   MCFG_SCREEN_SIZE(64*8, 32*8)
789782   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 28*8-1)
790783   MCFG_SCREEN_UPDATE_DRIVER(psikyosh_state, screen_update_psikyosh)
r243203r243204
799792   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
800793
801794   MCFG_SOUND_ADD("ymf", YMF278B, MASTER_CLOCK/2)
802   MCFG_YMF278B_IRQ_HANDLER(WRITELINE(psikyosh_state, irqhandler))
795   MCFG_YMF278B_IRQ_HANDLER(INPUTLINE("maincpu", 12))
803796   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
804797   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
805798MACHINE_CONFIG_END
r243203r243204
819812   MCFG_CPU_MODIFY("maincpu")
820813   MCFG_CPU_PROGRAM_MAP(ps5_map)
821814
815   /* Measured Hsync 16.165 KHz, Vsync 61.68 Hz */
822816   /* 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 */
823817   MCFG_SCREEN_MODIFY("screen")
824   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 30*8-1)
818   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/8, 443, 0, 40*8, 262, 0, 30*8)
825819MACHINE_CONFIG_END
826820
827821
trunk/src/mame/drivers/psychic5.c
r243203r243204
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
r243203r243204
1010driver by Nicola Salmoria
1111
1212TODO:
13- finish spunchout protection, currently using a hacky workaround
1314- add useless driver config to choose between pink and white color proms
1415- video raw params - pixel clock is derived from 20.16mhz xtal
1516- money bag placement might not be 100% correct in Arm Wrestling
r243203r243204
227228   ret |= m_rp5h01->counter_r() ? 0x00 : 0x40;
228229   ret |= m_rp5h01->data_r() ? 0x00 : 0x80;
229230
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
230240   return ret;
231241}
232242
trunk/src/mame/drivers/segae.c
r243203r243204
956956
957957      for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ )
958958      {
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp1_ptr[x] : vdp2_ptr[x];
960//dest_ptr[x] = y1_ptr[x] ? 0xFF0000 : 0x00FF00;
959         dest_ptr[x] = ( y1_ptr[x] ) ? vdp2_ptr[x] : vdp1_ptr[x];
960         //dest_ptr[x] = y1_ptr[x] ? 0x00FF00 : 0xFF0000;
961961      }
962962   }
963963
trunk/src/mame/drivers/segajw.c
r243203r243204
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));
371377}
372378
373379
r243203r243204
438444ROM_END
439445
440446
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
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
trunk/src/mame/drivers/seta2.c
r243203r243204
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 ) )
r243203r243204
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
r243203r243204
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"),
3134         m_bg_videoram(*this, "bg_videoram"),
3235         m_fg_videoram(*this, "fg_videoram"),
33         m_spriteram(*this, "spriteram"),
34         m_sprgen(*this, "spritegen"),
35         m_maincpu(*this, "maincpu"),
36         m_gfxdecode(*this, "gfxdecode") { }
36         m_spriteram(*this, "spriteram") { }
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
3844   /* memory pointers */
3945   required_shared_ptr<UINT16> m_bg_videoram;
4046   required_shared_ptr<UINT16> m_fg_videoram;
4147   required_shared_ptr<UINT16> m_spriteram;
42   optional_device<decospr_device> m_sprgen;
4348
4449   /* video-related */
4550   tilemap_t   *m_bg_layer;
r243203r243204
114119   virtual void video_start();
115120   UINT32 screen_update_silvmil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
116121   void tumblepb_gfx1_rearrange();
117   required_device<cpu_device> m_maincpu;
118   required_device<gfxdecode_device> m_gfxdecode;
119122};
120123
121124
r243203r243204
280283
281284void silvmil_state::machine_start()
282285{
286   save_item(NAME(m_silvmil_tilebank));
287   save_item(NAME(m_whichbank));
283288}
284289
285290void silvmil_state::machine_reset()
r243203r243204
427432   tumblepb_gfx1_rearrange();
428433}
429434
430GAME( 1995, silvmil, 0, silvmil, silvmil, silvmil_state, silvmil, ROT270, "Para", "Silver Millennium", 0 )
435GAME( 1995, silvmil, 0, silvmil, silvmil, silvmil_state, silvmil, ROT270, "Para", "Silver Millennium", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/snk68.c
r243203r243204
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
579572static MACHINE_CONFIG_START( pow, snk68_state )
580573
581574   /* basic machine hardware */
r243203r243204
604597   MCFG_SPEAKER_STANDARD_MONO("mono")
605598
606599   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_8MHz/2) /* verified on pcb  */
607   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snk68_state, irqhandler))
600   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
608601   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
609602
610603   MCFG_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
trunk/src/mame/drivers/snowbros.c
r243203r243204
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
188195/* Snow Bros Memory Map */
189196
190197static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state )
r243203r243204
15351542   GFXDECODE_ENTRY( "gfx1", 0, hyperpac_tilelayout,  0, 16 )
15361543GFXDECODE_END
15371544
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
15441545MACHINE_RESET_MEMBER(snowbros_state,semiprot)
15451546{
15461547   UINT16 *PROTDATA = (UINT16*)memregion("user1")->base();
r243203r243204
15921593   MCFG_SPEAKER_STANDARD_MONO("mono")
15931594
15941595   MCFG_SOUND_ADD("ymsnd", YM3812, 3000000)
1595   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snowbros_state, irqhandler))
1596   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
15961597   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
15971598MACHINE_CONFIG_END
15981599
r243203r243204
17041705   /* sound hardware */
17051706
17061707   MCFG_SOUND_ADD("ymsnd", YM3812, 3000000)
1707   MCFG_YM3812_IRQ_HANDLER(WRITELINE(snowbros_state, irqhandler))
1708   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
17081709   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
17091710
17101711
r243203r243204
19551956   ROM_LOAD16_BYTE( "wb09.bin",     0x60001, 0x10000, CRC(9be718ca) SHA1(5c195e4f13efbdb229201d2408d018861bf389cc) )
19561957ROM_END
19571958
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
19581974/* Barko */
19591975
19601976ROM_START( honeydol )
r243203r243204
28662882
28672883
28682884
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
28692918GAME( 1990, snowbros,  0,        snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 1)", 0 )
28702919GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 2)", 0 )
28712920GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 3)", 0 )
r243203r243204
28752924GAME( 1990, wintbob,   snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg (Sakowa Project Korea)", "The Winter Bobble (bootleg of Snow Bros.)", 0 )
28762925GAME( 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
28772926
2927GAME( 1996, toto,      0,        snowbros, snowbros, snowbros_state, toto, ROT0, "SoftClub",                    "Come Back Toto", 0 ) // modified from 'snowbros' code
2928
28782929// none of the games below are on genuine SnowBros hardware, but they clone the functionality of it.
28792930
28802931// 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
r243203r243204
402402GFXDECODE_END
403403
404404
405WRITE_LINE_MEMBER(spbactn_state::irqhandler)
406{
407   m_audiocpu->set_input_line(0, state);
408}
409
410405static MACHINE_CONFIG_START( spbactn, spbactn_state )
411406
412407   /* basic machine hardware */
r243203r243204
443438   MCFG_SPEAKER_STANDARD_MONO("mono")
444439
445440   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* Was 3.579545MHz, a common clock, but no way to generate via on PCB OSCs */
446   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spbactn_state, irqhandler))
441   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
447442   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
448443
449444   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 */
r243203r243204
494489   MCFG_SPEAKER_STANDARD_MONO("mono")
495490
496491   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz)
497   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spbactn_state, irqhandler))
492   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
498493   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
499494
500495   MCFG_OKIM6295_ADD("oki", XTAL_4MHz/4, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/spdodgeb.c
r243203r243204
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
386381void spdodgeb_state::machine_reset()
387382{
388383   m_toggle = 0;
r243203r243204
421416   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
422417
423418   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_12MHz/4)
424   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spdodgeb_state, irqhandler))
419   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6809_FIRQ_LINE))
425420   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
426421   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
427422
trunk/src/mame/drivers/spy.c
r243203r243204
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}
465461
466
467462void spy_state::machine_start()
468463{
469464   UINT8 *ROM = memregion("maincpu")->base();
r243203r243204
528523   MCFG_SPEAKER_STANDARD_MONO("mono")
529524
530525   MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
531   MCFG_YM3812_IRQ_HANDLER(WRITELINE(spy_state, irqhandler))
526   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
532527   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
533528
534529   MCFG_SOUND_ADD("k007232_1", K007232, 3579545)
trunk/src/mame/drivers/st_mp200.c
r243203r243204
769769/*--------------------------------
770770/ Split Second #144
771771/-------------------------------*/
772ROM_START(splitsec)
772ROM_START(spltsecp)
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))
r243203r243204
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,  splitsec,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Split Second", 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)
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
r243203r243204
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
5133WRITE16_MEMBER(stadhero_state::stadhero_control_w)
5234{
5335   switch (offset<<1)
r243203r243204
7355   AM_RANGE(0x240000, 0x240007) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_0_w)                          /* text layer */
7456   AM_RANGE(0x240010, 0x240017) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control_1_w)
7557   AM_RANGE(0x260000, 0x261fff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_data_r, pf_data_w)
76   AM_RANGE(0x30c000, 0x30c00b) AM_READWRITE(stadhero_control_r, stadhero_control_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)
7762   AM_RANGE(0x310000, 0x3107ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
7863   AM_RANGE(0xff8000, 0xffbfff) AM_RAM /* Main ram */
7964   AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x000800) AM_RAM AM_SHARE("spriteram")
r243203r243204
210195
211196/******************************************************************************/
212197
213WRITE_LINE_MEMBER(stadhero_state::irqhandler)
214{
215   m_audiocpu->set_input_line(0, state);
216}
217
218/******************************************************************************/
219
220198static MACHINE_CONFIG_START( stadhero, stadhero_state )
221199
222200   /* basic machine hardware */
r243203r243204
260238   MCFG_SOUND_ROUTE(3, "mono", 0.40)
261239
262240   MCFG_SOUND_ADD("ym2", YM3812, XTAL_24MHz/8)
263   MCFG_YM3812_IRQ_HANDLER(WRITELINE(stadhero_state, irqhandler))
241   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
264242   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
265243
266244   MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/stv.c
r243203r243204
672672   m_maincpu->sh2drc_add_pcflush(0x60011ba);
673673   m_maincpu->sh2drc_add_pcflush(0x605b9da);
674674
675   install_astrass_protection();
675   install_common_protection();
676676
677677   DRIVER_INIT_CALL(stv);
678678}
r243203r243204
766766   m_maincpu->sh2drc_add_pcflush(0x6026398);
767767   m_slave->sh2drc_add_pcflush(0x6028cd6);
768768
769   install_sss_protection();
769   install_common_protection();
770770
771771   DRIVER_INIT_CALL(stv);
772772
r243203r243204
829829   m_slave->sh2drc_add_pcflush(0x6062bca);
830830
831831   DRIVER_INIT_CALL(stv);
832   install_twcup98_protection();
832   install_common_protection();
833833
834834   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(5);
835835}
r243203r243204
886886   m_maincpu->sh2drc_add_pcflush(0x604eac0);
887887   m_slave->sh2drc_add_pcflush(0x605340a);
888888
889   install_elandore_protection();
889   install_common_protection();
890890
891891   DRIVER_INIT_CALL(stv);
892892   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(0);
r243203r243204
897897   m_maincpu->sh2drc_add_pcflush(0x6034d04);
898898   m_slave->sh2drc_add_pcflush(0x6036152);
899899
900   install_rsgun_protection();
900   install_common_protection();
901901
902902   DRIVER_INIT_CALL(stv);
903903
r243203r243204
906906
907907DRIVER_INIT_MEMBER(stv_state,ffreveng)
908908{
909   install_ffreveng_protection();
909   install_common_protection();
910910   DRIVER_INIT_CALL(stv);
911911}
912912
913913DRIVER_INIT_MEMBER(stv_state,decathlt)
914914{
915   m_decathlt_lastcount = 0;
916   m_decathlt_prot_uploadmode = 0;
917   m_decathlt_prot_uploadoffset = 0;
918   install_decathlt_protection();
915   m_5838crypt->install_decathlt_protection();
919916   DRIVER_INIT_CALL(stv);
920917}
921918
r243203r243204
10221019   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
10231020   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
10241021
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
10291047/*
10301048    Batman Forever has an extra ADSP, used for sound.
10311049    Similar if not the same as Magic the Gathering, probably needs merging.
r243203r243204
18251843   ROM_LOAD16_WORD_SWAP( "mpr20832.8",     0x1c00000, 0x0400000, CRC(af1b0985) SHA1(d7a0e4e0a8b0556915f924bdde8c3d14e5b3423e) ) // good (was .18s)
18261844   ROM_LOAD16_WORD_SWAP( "mpr20833.9",     0x2000000, 0x0400000, CRC(cb6af231) SHA1(4a2e5d7c2fd6179c19cdefa84a03f9a34fbb9e70) ) // good (was .19s)
18271845
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) )
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" )
18321848ROM_END
18331849
18341850ROM_START( bakubaku )
r243203r243204
19731989   ROM_LOAD16_WORD_SWAP( "mpr21305.6",    0x1400000, 0x0400000, CRC(46cfc2a2) SHA1(8ca26bf8fa5ced040e815c125c13dd06d599e189) ) // good (was .16)
19741990   ROM_LOAD16_WORD_SWAP( "mpr21306.1",    0x1800000, 0x0400000, CRC(87a5929c) SHA1(b259341d7b0e1fa98959bf52d23db5c308a8efdd) ) // good (was .17)
19751991   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" )
19761995ROM_END
19771996
19781997ROM_START( ffreveng )
r243203r243204
19862005   ROM_LOAD16_WORD_SWAP( "mpr21876.5",   0x1000000, 0x0400000, CRC(bb92a7fc) SHA1(d9e0fab1104a46adeb0a0cfc0d070d4c63a28d55) ) // good (was .15)
19872006   ROM_LOAD16_WORD_SWAP( "mpr21877.6",   0x1400000, 0x0400000, CRC(c22a4a75) SHA1(3276bc0628e71b432f21ba9a4f5ff7ccc8769cd9) ) // good (was .16)
19882007   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" )
19892011ROM_END
19902012
19912013/* set system to 1 player to test rom */
r243203r243204
22422264   ROM_LOAD16_WORD_SWAP( "mpr20960.3",   0x0800000, 0x0400000, CRC(b5ab9053) SHA1(87c5d077eb1219c35fa65b4e11d5b62e826f5236) ) // good (was .13)
22432265   ROM_LOAD16_WORD_SWAP( "mpr20961.4",   0x0c00000, 0x0400000, CRC(0e06295c) SHA1(0ec2842622f3e9dc5689abd58aeddc7e5603b97a) ) // good (was .14)
22442266   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" )
22452270ROM_END
22462271
22472272ROM_START( sandor )
r243203r243204
24302455
24312456   ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player
24322457   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" )
24332461ROM_END
24342462
24352463ROM_START( suikoenb )
r243203r243204
24602488   ROM_LOAD16_WORD_SWAP( "mpr20822.3",    0x0800000, 0x0400000, CRC(8b33a5e2) SHA1(d5689ac8aad63509febe9aa4077351be09b2d8d4) ) // ic3 good (was .13)
24612489   ROM_LOAD16_WORD_SWAP( "mpr20823.4",    0x0c00000, 0x0400000, CRC(6e6d4e95) SHA1(c387d03ba27580c62ac0bf780915fdf41552df6f) ) // ic4 good (was .14)
24622490   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" )
24632494ROM_END
24642495
24652496ROM_START( vfkids )
r243203r243204
30123043
30133044//GAME YEAR, NAME,     PARENT,  MACH, INP, INIT,      MONITOR
30143045/* Playable */
3015GAME( 1998, astrass,   stvbios, stv,      stv6b, stv_state,     astrass,    ROT0,   "Sunsoft",                      "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3046GAME( 1998, astrass,   stvbios, stv_5881, stv6b, stv_state,      astrass,    ROT0,   "Sunsoft",                      "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30163047GAME( 1995, bakubaku,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Baku Baku Animal (J 950407 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30173048GAME( 1996, batmanfr,  stvbios, batmanfr, stv, stv_state,        batmanfr,   ROT0,   "Acclaim",                      "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
30183049GAME( 1996, colmns97,  stvbios, stv,      stv, stv_state,        colmns97,   ROT0,   "Sega",                         "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30193050GAME( 1997, cotton2,   stvbios, stv,      stv, stv_state,        cotton2,    ROT0,   "Success",                      "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30203051GAME( 1998, cottonbm,  stvbios, stv,      stv, stv_state,        cottonbm,   ROT0,   "Success",                      "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30213052GAME( 1995, critcrsh,  stvbios, stv,      critcrsh, stv_state,   critcrsh,   ROT0,   "Sega",                         "Critter Crusher (EA 951204 V1.000)", 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 )
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 )
30233054GAME( 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 )
30243055GAME( 1996, diehard,   stvbios, stv,      stv, stv_state,        diehard,    ROT0,   "Sega",                         "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND  )
30253056GAME( 1996, dnmtdeka,  diehard, stv,      stv, stv_state,        dnmtdeka,   ROT0,   "Sega",                         "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND  )
30263057GAME( 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 )
30273060GAME( 1995, fhboxers,  stvbios, stv,      stv, stv_state,        fhboxers,   ROT0,   "Sega",                         "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30283061GAME( 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 )
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)
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)
30303063GAME( 1998, grdforce,  stvbios, stv,      stv, stv_state,        grdforce,   ROT0,   "Success",                      "Guardian Force (JUET 980318 V0.105)", 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 )
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 )
30323065GAME( 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 )
30333066GAME( 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 )
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 )
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 )
30353068GAME( 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 )
30363069GAME( 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 )
30373070GAME( 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 )
r243203r243204
30393072GAME( 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 )
30403073GAME( 1996, prikura,   stvbios, stv,      stv, stv_state,        prikura,    ROT0,   "Atlus",                        "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30413074GAME( 1996, puyosun,   stvbios, stv,      stv, stv_state,        puyosun,    ROT0,   "Compile",                      "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
3042GAME( 1998, rsgun,     stvbios, stv,      stv, stv_state,        rsgun,      ROT0,   "Treasure",                     "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
3075GAME( 1998, rsgun,     stvbios, stv_5881, stv, stv_state,        rsgun,      ROT0,   "Treasure",                     "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
30433076GAME( 1998, sasissu,   stvbios, stv,      stv, stv_state,        sasissu,    ROT0,   "Sega",                         "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30443077GAME( 1999, sanjeon,   sasissu, stv,      stv, stv_state,        sanjeon,    ROT0,   "Sega / Deniam",                "DaeJeon! SanJeon SuJeon (AJTUE 990412 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30453078GAME( 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 )
30463079GAME( 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 )
30473080GAME( 1997, shienryu,  stvbios, stv,      stv, stv_state,        shienryu,   ROT270, "Warashi",                      "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
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 )
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 )
30493082GAME( 1995, sandor,    stvbios, stv,      stv, stv_state,        sandor,     ROT0,   "Sega",                         "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30503083GAME( 1997, thunt,     sandor,  stv,      stv, stv_state,        thunt,      ROT0,   "Sega",                         "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30513084GAME( 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 )
30523086GAME( 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 )
30533087GAME( 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 )
30543088GAME( 1996, sokyugrt,  stvbios, stv,      stv, stv_state,        sokyugrt,   ROT0,   "Raizing / Eighting",           "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
r243203r243204
30583092GAME( 1997, winterht,  stvbios, stv,      stv, stv_state,        winterht,   ROT0,   "Sega",                         "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
30593093GAME( 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 )
30603094
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
30653095/* Unemulated printer / camera devices */
30663096GAME( 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 )
30673097GAME( 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 )
r243203r243204
30803110
30813111/* Doing something.. but not enough yet */
30823112GAME( 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 )
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 )
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 )
30853115
30863116/* Gives I/O errors */
30873117GAME( 1996, magzun,    stvbios, stv,      stv, stv_state,        magzun,     ROT0,   "Sega",                         "Magical Zunou Power (J 961031 V1.000)", GAME_NOT_WORKING )
30883118GAME( 1997, techbowl,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Technical Bowling (J 971212 V1.000)", GAME_NOT_WORKING )
30893119GAME( 1999, micrombc,  stvbios, stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Microman Battle Charge (J 990326 V1.000)", GAME_NOT_WORKING )
30903120
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
30943121/* CD games */
30953122GAME( 1995, sfish2,    0,       stv,      stv, stv_state,        stv,        ROT0,   "Sega",                         "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING )
30963123GAME( 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
r243203r243204
17791779
17801780***************************************************************************/
17811781
1782WRITE_LINE_MEMBER(suna8_state::soundirq)
1783{
1784   m_audiocpu->set_input_line(0, state);
1785}
1786
17871782/* In games with only 2 CPUs, port A&B of the AY8910 are used
17881783   for sample playing. */
17891784
r243203r243204
19501945   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
19511946
19521947   MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 6)
1953   MCFG_YM3812_IRQ_HANDLER(WRITELINE(suna8_state, soundirq))
1948   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
19541949   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
19551950   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
19561951
trunk/src/mame/drivers/taitottl.c
r243203r243204
33 Taito Discrete Hardware Games
44
55
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)
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)
4154
4255***************************************************************************/
4356
r243203r243204
213226 MS06   M8  74s287      missile animated graphics
214227 MS05   11F IM5610      200pt tank R->L graphic
215228 MS05   11E IM5610      200pt tank L->R graphic
216 MS04   N7  IM5610       player missile trajectory pattern
229 MS04   N7  IM5610      player missile trajectory pattern
217230 MS03   F3  IM5610      anti-missile ack-ack graphics
218231 MS02   L12 IM5610      missile left/right position
219232 MS01   D8  IM5610      100pt tanks graphics
220
233
221234*/
222235
223236ROM_START( missilex )
224237   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
225238
226239   ROM_REGION( 0x0800, "roms", ROMREGION_ERASE00 )
227   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
240   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
228241   ROM_LOAD( "ms09.6f",      0x0000, 0x0200, CRC(80787642) SHA1(9de2419f0ba16f9c2b06e417c1ebba441fdae053) )
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) )
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) )
238251ROM_END
239252
240253
trunk/src/mame/drivers/tbowl.c
r243203r243204
423423
424424GFXDECODE_END
425425
426/*** Sound Bits
427426
428*/
429
430WRITE_LINE_MEMBER(tbowl_state::irqhandler)
431{
432   m_audiocpu->set_input_line(0, state);
433}
434
435
436427/*** Machine Driver
437428
438429there are 3 boards, each with a cpu, boards b and c contain
r243203r243204
500491   MCFG_SPEAKER_STANDARD_MONO("mono")
501492
502493   MCFG_SOUND_ADD("ym1", YM3812, 4000000)
503   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tbowl_state, irqhandler))
494   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
504495   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
505496
506497   MCFG_SOUND_ADD("ym2", YM3812, 4000000)
trunk/src/mame/drivers/tecmo.c
r243203r243204
600600GFXDECODE_END
601601
602602
603
604WRITE_LINE_MEMBER(tecmo_state::irqhandler)
605{
606   m_soundcpu->set_input_line(0, state);
607}
608
609603MACHINE_RESET_MEMBER(tecmo_state,rygar)
610604{
611605   m_adpcm_pos = 0;
r243203r243204
647641   MCFG_SPEAKER_STANDARD_MONO("mono")
648642
649643   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* verified on pcb */
650   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tecmo_state, irqhandler))
644   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
651645   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
652646
653647   MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb, even if schematics shows a 384khz resonator */
r243203r243204
710704   MCFG_SPEAKER_STANDARD_MONO("mono")
711705
712706   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_4MHz) /* verified on pcb */
713   MCFG_YM3812_IRQ_HANDLER(WRITELINE(tecmo_state, irqhandler))
707   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
714708   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
715709
716710   /* no MSM on this PCB */
trunk/src/mame/drivers/toaplan1.c
r243203r243204
17601760GFXDECODE_END
17611761
17621762
1763WRITE_LINE_MEMBER(toaplan1_state::irqhandler)
1764{
1765   m_audiocpu->set_input_line(0, state);
1766}
1767
17681763#define PIXEL_CLOCK         (XTAL_28MHz/4)
17691764
17701765// HTOTAL and VTOTAL taken from CRTC registers (toaplan1_bcu_control_w)
r243203r243204
18161811   MCFG_SPEAKER_STANDARD_MONO("mono")
18171812
18181813   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1819   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
1814   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
18201815   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18211816MACHINE_CONFIG_END
18221817
r243203r243204
18541849   MCFG_SPEAKER_STANDARD_MONO("mono")
18551850
18561851   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1857   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
1852   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
18581853   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18591854MACHINE_CONFIG_END
18601855
r243203r243204
18921887   MCFG_SPEAKER_STANDARD_MONO("mono")
18931888
18941889   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1895   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
1890   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
18961891   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
18971892MACHINE_CONFIG_END
18981893
r243203r243204
19301925   MCFG_SPEAKER_STANDARD_MONO("mono")
19311926
19321927   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1933   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
1928   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
19341929   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
19351930MACHINE_CONFIG_END
19361931
r243203r243204
19721967   MCFG_SPEAKER_STANDARD_MONO("mono")
19731968
19741969   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
1975   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
1970   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
19761971   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
19771972MACHINE_CONFIG_END
19781973
r243203r243204
20082003   MCFG_SPEAKER_STANDARD_MONO("mono")
20092004
20102005   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
2011   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
2006   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
20122007   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20132008MACHINE_CONFIG_END
20142009
r243203r243204
20462041   MCFG_SPEAKER_STANDARD_MONO("mono")
20472042
20482043   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
2049   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
2044   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
20502045   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20512046MACHINE_CONFIG_END
20522047
r243203r243204
20822077   MCFG_SPEAKER_STANDARD_MONO("mono")
20832078
20842079   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)   /* verified on pcb */
2085   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan1_state, irqhandler))
2080   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
20862081   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
20872082MACHINE_CONFIG_END
20882083
trunk/src/mame/drivers/toaplan2.c
r243203r243204
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
30583052WRITE_LINE_MEMBER(toaplan2_state::bbakraid_irqhandler)
30593053{
30603054   // Not used ???  Connected to a test pin (TP082)
r243203r243204
31003094   MCFG_SPEAKER_STANDARD_MONO("mono")
31013095
31023096   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)
3103   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
3097#ifdef USE_HD64x180
3098   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
3099#endif
31043100   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
31053101MACHINE_CONFIG_END
31063102
r243203r243204
34113407   MCFG_SPEAKER_STANDARD_MONO("mono")
34123408
34133409   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)           /* verified on pcb */
3414   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
3410   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
34153411   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
34163412MACHINE_CONFIG_END
34173413
r243203r243204
34543450   MCFG_SPEAKER_STANDARD_MONO("mono")
34553451
34563452   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_27MHz/8)
3457   MCFG_YM3812_IRQ_HANDLER(WRITELINE(toaplan2_state, irqhandler))
3453   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
34583454   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
34593455MACHINE_CONFIG_END
34603456
trunk/src/mame/drivers/tourtabl.c
r243203r243204
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
r243203r243204
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
659649static MACHINE_CONFIG_START( twincobr, twincobr_state )
660650
661651   /* basic machine hardware */
r243203r243204
702692   MCFG_SPEAKER_STANDARD_MONO("mono")
703693
704694   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_28MHz/8)
705   MCFG_YM3812_IRQ_HANDLER(WRITELINE(twincobr_state, irqhandler))
695   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
706696   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
707697MACHINE_CONFIG_END
708698
trunk/src/mame/drivers/twinkle.c
r243203r243204
254254      m_maincpu(*this, "maincpu"),
255255      m_audiocpu(*this, "audiocpu")
256256   {
257      m_spu_hle[0x200] = 0;
258      m_spu_hle[0x202] = 0;
259257   }
260258
261259   required_device<am53cf96_device> m_am53cf96;
r243203r243204
264262
265263   UINT16 m_spu_ctrl;      // SPU board control register
266264   UINT8 m_spu_shared[0x400];  // SPU/PSX shared dual-ported RAM
267   UINT8 m_spu_hle[0x400];
268265   UINT32 m_spu_ata_dma;
269266   int m_spu_ata_dmarq;
270267
r243203r243204
285282   DECLARE_WRITE16_MEMBER(twinkle_waveram_w);
286283   DECLARE_READ16_MEMBER(shared_68k_r);
287284   DECLARE_WRITE16_MEMBER(shared_68k_w);
285   DECLARE_READ16_MEMBER(unk_68k_r);
288286   DECLARE_WRITE_LINE_MEMBER(spu_ata_irq);
289287   DECLARE_WRITE_LINE_MEMBER(spu_ata_dmarq);
290288   required_device<cpu_device> m_maincpu;
r243203r243204
671669
672670WRITE8_MEMBER(twinkle_state::shared_psx_w)
673671{
674   //printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
672//  printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
675673
676674   m_spu_shared[offset] = data;
677675
678   // HLE sound board
679   m_spu_hle[offset] = data;
680
681676   if (offset == 0x03fe && data == 0xff)
682677   {
683      //printf("spu command %02x %02x\n", m_spu_hle[1], m_spu_hle[3]);
678//      printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]);
684679
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      }
680      m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE);
761681   }
762682}
763683
764684READ8_MEMBER(twinkle_state::shared_psx_r)
765685{
766   //UINT32 result = m_spu_shared[offset];
767   UINT32 result = m_spu_hle[offset];
686   UINT32 result = m_spu_shared[offset];
768687
769688   //printf("shared_psx_r: %04x, %04x, %04x\n", offset, result, mem_mask);
770689
r243203r243204
803722/*
804723    System control register (Konami always has one)
805724
806    bit 7  = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be vblank)
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)
807726    bit 8  = write 0 to ack IRQ 2, write 1 to enable (IRQ 2 appears to be DMA completion)
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?
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
811730
812731    Other bits unknown.
813732*/
r243203r243204
836755WRITE16_MEMBER(twinkle_state::spu_ata_dma_low_w)
837756{
838757   m_spu_ata_dma = (m_spu_ata_dma & ~0xffff) | data;
839
840   //printf("dma_low %08x\n", m_spu_ata_dma * 2);
841758}
842759
843760WRITE16_MEMBER(twinkle_state::spu_ata_dma_high_w)
844761{
845762   m_spu_ata_dma = (m_spu_ata_dma & 0xffff) | (data << 16);
846
847   //printf("dma_high %08x\n", m_spu_ata_dma * 2);
848763}
849764
850765WRITE_LINE_MEMBER(twinkle_state::spu_ata_dmarq)
r243203r243204
864779            //waveram[m_spu_ata_dma++] = (data >> 8) | (data << 8);
865780            // bp 4a0e ;bmiidx4 checksum
866781            // bp 4d62 ;bmiidx4 dma
867            m_waveram[m_spu_ata_dma++] = data;
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            }
868790         }
869791
870792         m_ata->write_dmack(CLEAR_LINE);
r243203r243204
886808{
887809   UINT16 result = m_spu_shared[offset];
888810
889   //printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
811//  printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
890812
891813   return result;
892814}
893815
894816WRITE16_MEMBER(twinkle_state::shared_68k_w)
895817{
896   //printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
818//  printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
897819
898820   m_spu_shared[offset] = data & 0xff;
899821}
900822
823READ16_MEMBER(twinkle_state::unk_68k_r)
824{
825   return 0xffff;  // must return 0xff for 68000 POST to complete properly
826}
827
901828static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state )
902829   AM_RANGE(0x000000, 0x07ffff) AM_ROM
903830   AM_RANGE(0x100000, 0x13ffff) AM_RAM
831   AM_RANGE(0x200000, 0x200001) AM_READ(unk_68k_r)
904832   // 220000 = LEDs?
905833   AM_RANGE(0x230000, 0x230003) AM_WRITE(twinkle_spu_ctrl_w)
906834   AM_RANGE(0x240000, 0x240003) AM_WRITE(spu_ata_dma_low_w)
r243203r243204
909837   AM_RANGE(0x280000, 0x280fff) AM_READWRITE(shared_68k_r, shared_68k_w)
910838   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs0, write_cs0)
911839   // 34000E = ???
840   AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP
912841   AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)
913   AM_RANGE(0x800000, 0xffffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )    // 8 MB window wave RAM
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?)
914844ADDRESS_MAP_END
915845
916846/* SCSI */
r243203r243204
1011941
1012942   MCFG_CPU_ADD("audiocpu", M68000, 32000000/2)    /* 16.000 MHz */
1013943   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)
1014946
1015947   MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1200)) /* check TD pin on LTC1232 */
1016948
r243203r243204
11491081   ROM_REGION32_LE( 0x080000, "audiocpu", 0 )\
11501082   ROM_LOAD16_WORD_SWAP( "863a05.2x",    0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) )\
11511083\
1152   ROM_REGION16_LE(0x1800000, "rfsnd", ROMREGION_ERASE00)
1084   ROM_REGION16_LE(0x400000, "rfsnd", ROMREGION_ERASE00)
11531085
11541086ROM_START( gq863 )
11551087   TWINKLE_BIOS
trunk/src/mame/drivers/tx1.c
r243203r243204
795795   ROM_REGION( 0x10000, "audio_cpu", 0 )
796796   ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) )
797797
798   ROM_REGION( 0x20000, "char_tiles", 0 )
798   ROM_REGION( 0x8000, "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( 0x40000, "obj_tiles", 0 )
802   ROM_REGION( 0x10000, "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( 0x40000, "gfx3", 0 )
808   ROM_REGION( 0x6000, "road", 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) )
r243203r243204
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( 0x50000, "obj_map", 0 )
819   ROM_REGION( 0x8000, "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( 0x50000, "user3", 0 )
823   ROM_REGION( 0x6000, "obj_luts", 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
r243203r243204
882882   ROM_REGION( 0x10000, "audio_cpu", 0 )
883883   ROM_LOAD( "tx1_22h.ic9", 0x00000, 0x2000, CRC(66376232) SHA1(b8a026dae47173e7760eea4f52e67e525ad1b70b) )
884884
885   ROM_REGION( 0x20000, "char_tiles", 0 )
885   ROM_REGION( 0x8000, "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( 0x40000, "obj_tiles", 0 )
889   ROM_REGION( 0x10000, "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( 0x40000, "gfx3", 0 )
895   ROM_REGION( 0x6000, "road", 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) )
r243203r243204
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( 0x50000, "obj_map", 0 )
906   ROM_REGION( 0x8000, "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( 0x50000, "user3", 0 )
910   ROM_REGION( 0x6000, "obj_luts", 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
r243203r243204
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( 0x20000, "char_tiles", 0 )
966   ROM_REGION( 0x8000, "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( 0x40000, "obj_tiles", 0 )
970   ROM_REGION( 0x10000, "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( 0x40000, "gfx3", 0 )
976   ROM_REGION( 0x6000, "road", 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) )
r243203r243204
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( 0x50000, "obj_map", 0 )
987   ROM_REGION( 0x8000, "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( 0x50000, "user3", 0 )
991   ROM_REGION( 0x6000, "obj_luts", 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
r243203r243204
10721072   ROM_LOAD( "bug25.157", 0x2c000, 0x4000, CRC(80c4e045) SHA1(be3b537d3ed3ee74fc51059aa744dca4d63431f6) )
10731073   ROM_RELOAD(            0x38000, 0x4000 )
10741074
1075   ROM_REGION( 0x40000, "road", 0 )
1075   ROM_REGION( 0x8000, "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) )
r243203r243204
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( 0x100000, "obj_map", 0 )
1089   ROM_REGION( 0x10000, "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( 0x10000, "obj_luts", 0 )
1095   ROM_REGION( 0x6000, "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
r243203r243204
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( 0x40000, "road", 0 )
1164   ROM_REGION( 0x8000, "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) )
r243203r243204
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( 0x100000, "obj_map", 0 )
1177   ROM_REGION( 0x10000, "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( 0x10000, "obj_luts", 0 )
1181   ROM_REGION( 0x6000, "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
r243203r243204
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
r243203r243204
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
r243203r243204
146146
147147   DECLARE_WRITE8_MEMBER(wardner_bank_w);
148148   DECLARE_DRIVER_INIT(wardner);
149   DECLARE_WRITE_LINE_MEMBER(irqhandler);
150149
151150protected:
152151   virtual void driver_start();
r243203r243204
337336};
338337
339338
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
347339static GFXDECODE_START( wardner )
348340   GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   1536, 32 )  /* colors 1536-1791 */
349341   GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout,   1280, 16 )  /* colors 1280-1535 */
r243203r243204
419411   MCFG_SPEAKER_STANDARD_MONO("mono")
420412
421413   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_14MHz/4)
422   MCFG_YM3812_IRQ_HANDLER(WRITELINE(wardner_state, irqhandler))
414   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
423415   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
424416MACHINE_CONFIG_END
425417
trunk/src/mame/drivers/yunsun16.c
r243203r243204
582582                                Magic Bubble
583583***************************************************************************/
584584
585WRITE_LINE_MEMBER(yunsun16_state::soundirq)
586{
587   m_audiocpu->set_input_line(0, state);
588}
589
590585static MACHINE_CONFIG_START( magicbub, yunsun16_state )
591586
592587   /* basic machine hardware */
r243203r243204
614609   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
615610
616611   MCFG_SOUND_ADD("ymsnd", YM3812, XTAL_16MHz/4)
617   MCFG_YM3812_IRQ_HANDLER(WRITELINE(yunsun16_state, soundirq))
612   MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
618613   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
619614   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
620615
trunk/src/mame/drivers/zn.c
r243203r243204
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);
8687   DECLARE_WRITE16_MEMBER(nbajamex_80_w);
8788   DECLARE_READ16_MEMBER(nbajamex_08_r);
8889   DECLARE_READ16_MEMBER(nbajamex_80_r);
r243203r243204
20342035   verboselog(0, "acpsx_00_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20352036}
20362037
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
20372076WRITE16_MEMBER(zn_state::acpsx_10_w)
20382077{
20392078   verboselog(0, "acpsx_10_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20402079}
20412080
2081// all 16 bits goes to the external soundboard's latch (see sound test menu)
20422082WRITE16_MEMBER(zn_state::nbajamex_80_w)
20432083{
20442084   verboselog(0, "nbajamex_80_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20452085   psxirq_device *psxirq = (psxirq_device *) machine().device("maincpu:irq");
20462086   psxirq->intin10(1);
2047   membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() + (data ? 0xe00000 : 0));
20482087}
20492088
20502089READ16_MEMBER(zn_state::nbajamex_08_r)
r243203r243204
20542093   return data;
20552094}
20562095
2096// possibly a readback from the external soundboard?
20572097READ16_MEMBER(zn_state::nbajamex_80_r)
20582098{
20592099   UINT32 data = 0xffffffff;
r243203r243204
20702110
20712111static ADDRESS_MAP_START(nbajamex_map, AS_PROGRAM, 32, zn_state)
20722112   AM_RANGE(0x1f000000, 0x1f1fffff) AM_ROMBANK("bankedroms")
2073   AM_RANGE(0x1f200000, 0x1f207fff) AM_RAM AM_SHARE("eeprom")
2113   AM_RANGE(0x1f200000, 0x1f7fffff) AM_ROMBANK("bankedroms2")
2114   AM_RANGE(0x1fbfff00, 0x1fbfff07) AM_WRITE16(nbajamex_bank_w, 0xffffffff)
20742115   AM_RANGE(0x1fbfff08, 0x1fbfff0b) AM_READ16(nbajamex_08_r, 0xffff)
20752116   AM_RANGE(0x1fbfff80, 0x1fbfff83) AM_READWRITE16(nbajamex_80_r, nbajamex_80_w, 0xffff)
20762117
r243203r243204
20802121MACHINE_RESET_MEMBER(zn_state,nbajamex)
20812122{
20822123   membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() );
2124   membank( "bankedroms2" )->set_base( memregion( "bankedroms" )->base() + 0x200000 );
20832125}
20842126
20852127static ADDRESS_MAP_START(jdredd_map, AS_PROGRAM, 32, zn_state)
r243203r243204
48254867/* it in every zip file */
48264868GAME( 1995, acpsx,    0,        coh1000a, zn,     driver_device, 0, ROT0, "Acclaim", "Acclaim PSX", GAME_IS_BIOS_ROOT )
48274869
4828GAME( 1996, nbajamex, acpsx,    nbajamex, zn,     driver_device, 0, ROT0, "Acclaim", "NBA Jam Extreme", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
4870GAME( 1996, nbajamex, acpsx,    nbajamex, zn,     driver_device, 0, ROT0, "Acclaim", "NBA Jam Extreme", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
48294871GAME( 1996, jdredd,   acpsx,    jdredd,   jdredd, driver_device, 0, ROT0, "Acclaim", "Judge Dredd (Rev C Dec. 17 1997)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
48304872GAME( 1996, jdreddb,  jdredd,   jdredd,   jdredd, driver_device, 0, ROT0, "Acclaim", "Judge Dredd (Rev B Nov. 26 1997)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
48314873
trunk/src/mame/includes/actfancr.h
r243203r243204
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
2926   /* misc */
3027   int            m_trio_control_select;
3128
r243203r243204
3936   DECLARE_READ8_MEMBER(triothep_control_r);
4037   DECLARE_WRITE8_MEMBER(actfancr_sound_w);
4138   DECLARE_WRITE8_MEMBER(actfancr_buffer_spriteram_w);
42   virtual void video_start();
43   DECLARE_MACHINE_START(actfancr);
44   DECLARE_MACHINE_RESET(actfancr);
4539   DECLARE_MACHINE_START(triothep);
4640   DECLARE_MACHINE_RESET(triothep);
4741   UINT32 screen_update_actfancr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48   void register_savestate(  );
49   DECLARE_WRITE_LINE_MEMBER(sound_irq);
5042};
trunk/src/mame/includes/aerofgt.h
r243203r243204
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);
127126   required_device<cpu_device> m_maincpu;
128127   optional_device<okim6295_device> m_oki;
129128   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/alpha68k.h
r243203r243204
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);
119118   required_device<cpu_device> m_maincpu;
120119   required_device<gfxdecode_device> m_gfxdecode;
121120   required_device<palette_device> m_palette;
trunk/src/mame/includes/bogeyman.h
r243203r243204
44
55*************************************************************************/
66
7#include "sound/ay8910.h"
8
79class bogeyman_state : public driver_device
810{
911public:
1012   bogeyman_state(const machine_config &mconfig, device_type type, const char *tag)
1113      : 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"),
1219      m_videoram(*this, "videoram"),
1320      m_videoram2(*this, "videoram2"),
1421      m_colorram(*this, "colorram"),
1522      m_colorram2(*this, "colorram2"),
16      m_spriteram(*this, "spriteram"),
17      m_maincpu(*this, "maincpu"),
18      m_gfxdecode(*this, "gfxdecode"),
19      m_palette(*this, "palette") { }
23      m_spriteram(*this, "spriteram")  { }
2024
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
2132   /* memory pointers */
2233   required_shared_ptr<UINT8> m_videoram;
2334   required_shared_ptr<UINT8> m_videoram2;
r243203r243204
3445   int        m_psg_latch;
3546   int        m_last_write;
3647   int        m_colbank;
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);
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
4558   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4659   TILE_GET_INFO_MEMBER(get_fg_tile_info);
60
4761   virtual void machine_start();
4862   virtual void machine_reset();
4963   virtual void video_start();
64
5065   DECLARE_PALETTE_INIT(bogeyman);
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;
66   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
5668};
trunk/src/mame/includes/calomega.h
r243203r243204
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
r243203r243204
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;
r243203r243204
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
r243203r243204
1515      m_bg_videoram(*this, "bg_videoram"),
1616      m_spriteram(*this, "spriteram"),
1717      m_sprgen(*this, "spritegen"),
18      m_audiocpu(*this, "audiocpu"),
1918      m_maincpu(*this, "maincpu"),
2019      m_gfxdecode(*this, "gfxdecode") { }
2120
r243203r243204
3231   int       m_bestri_tilebank;
3332
3433   /* devices */
35   required_device<cpu_device> m_audiocpu;
3634   DECLARE_WRITE16_MEMBER(crospang_soundlatch_w);
3735   DECLARE_WRITE16_MEMBER(bestri_tilebank_w);
3836   DECLARE_WRITE16_MEMBER(bestri_bg_scrolly_w);
r243203r243204
5351   virtual void video_start();
5452   UINT32 screen_update_crospang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5553   void tumblepb_gfx1_rearrange();
56   DECLARE_WRITE_LINE_MEMBER(irqhandler);
5754   required_device<cpu_device> m_maincpu;
5855   required_device<gfxdecode_device> m_gfxdecode;
5956};
trunk/src/mame/includes/dec0.h
r243203r243204
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;
r243203r243204
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);
r243203r243204
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);
r243203r243204
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);
r243203r243204
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 );
r243203r243204
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
r243203r243204
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);
166165   DECLARE_WRITE_LINE_MEMBER(csilver_adpcm_int);
167166
168167protected:
trunk/src/mame/includes/deniam.h
r243203r243204
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);
7372   required_device<cpu_device> m_maincpu;
7473   optional_device<cpu_device> m_audiocpu; // system 16c does not have sound CPU
7574   required_device<okim6295_device> m_oki;
trunk/src/mame/includes/dynax.h
r243203r243204
44
55***************************************************************************/
66#include "machine/msm6242.h"
7#include "sound/2413intf.h"
78#include "sound/msm5205.h"
89#include "sound/okim6295.h"
910
r243203r243204
1213public:
1314   dynax_state(const machine_config &mconfig, device_type type, const char *tag)
1415      : driver_device(mconfig, type, tag),
15         m_dsw_sel16(*this, "dsw_sel16"),
16         m_protection1(*this, "protection1"),
17         m_protection2(*this, "protection2"),
1816         m_maincpu(*this, "maincpu"),
1917         m_soundcpu(*this, "soundcpu"),
18         m_ym2413(*this, "ym2413"),
2019         m_oki(*this, "oki"),
2120         m_msm(*this, "msm"),
2221         m_screen(*this, "screen"),
r243203r243204
2423         m_rtc(*this, "rtc")
2524      { }
2625
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
2736   // up to 8 layers, 2 images per layer (interleaved on screen)
2837   UINT8 *  m_pixmap[8][2];
29   UINT8 *  m_ddenlovr_pixmap[8];
3038
3139   /* irq */
3240   typedef void (dynax_state::*irq_func)();    // some games trigger IRQ at blitter end, some don't
r243203r243204
7684   const int *m_priority_table;
7785   int m_hanamai_priority;
7886
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
11587   /* input */
11688   UINT8 m_input_sel;
11789   UINT8 m_dsw_sel;
r243203r243204
139111   UINT8 m_gekisha_rom_enable;
140112   UINT8 *m_romptr;
141113
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;
176114   DECLARE_WRITE8_MEMBER(dynax_vblank_ack_w);
177115   DECLARE_WRITE8_MEMBER(dynax_blitter_ack_w);
178116   DECLARE_WRITE8_MEMBER(jantouki_vblank_ack_w);
r243203r243204
275213   DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w);
276214   DECLARE_WRITE8_MEMBER(hanamai_priority_w);
277215   DECLARE_WRITE8_MEMBER(tenkai_priority_w);
216
278217   DECLARE_DRIVER_INIT(mjelct3);
279218   DECLARE_DRIVER_INIT(blktouch);
280219   DECLARE_DRIVER_INIT(mjelct3a);
281220   DECLARE_DRIVER_INIT(mjreach);
282221   DECLARE_DRIVER_INIT(maya);
222
283223   UINT32 screen_update_hanamai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
284224   UINT32 screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
285225   UINT32 screen_update_sprtmtch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
286226   UINT32 screen_update_mjdialq2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
287227   UINT32 screen_update_jantouki_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
288228   UINT32 screen_update_jantouki_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
229
289230   INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt);
290231   INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt);
291232   INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt);
292233   INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt);
293234   INTERRUPT_GEN_MEMBER(mjelctrn_vblank_interrupt);
235
294236   TIMER_DEVICE_CALLBACK_MEMBER(neruton_irq_scanline);
295237   TIMER_DEVICE_CALLBACK_MEMBER(majxtal7_vblank_interrupt);
296238   TIMER_DEVICE_CALLBACK_MEMBER(tenkai_interrupt);
239
297240   void tenkai_update_rombank();
298241   void gekisha_bank_postload();
242
299243   DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback);
300244   DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback);
301245   DECLARE_WRITE_LINE_MEMBER(adpcm_int);
r243203r243204
324268   DECLARE_VIDEO_START(mcnpshnt);
325269   DECLARE_PALETTE_INIT(janyuki);
326270   DECLARE_VIDEO_START(neruton);
271
327272   inline void blitter_plot_pixel( int layer, int mask, int x, int y, int pen, int wrap, int flags );
328273   int blitter_drawgfx( int layer, int mask, const char *gfx, int src, int pen, int x, int y, int wrap, int flags );
329274   void dynax_blitter_start( int flags );
trunk/src/mame/includes/eolith.h
r243203r243204
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;
r243203r243204
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
r243203r243204
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"),
3743      m_videoram(*this, "videoram"),
3844      m_sprite1_xpos(*this, "sprite1_xpos"),
3945      m_sprite1_ypos(*this, "sprite1_ypos"),
r243203r243204
4248      m_spriteno(*this, "spriteno"),
4349      m_sprite_enable(*this, "sprite_enable"),
4450      m_color_latch(*this, "color_latch"),
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") { }
51      m_characterram(*this, "characterram") { }
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
5461   required_shared_ptr<UINT8> m_videoram;
5562   required_shared_ptr<UINT8> m_sprite1_xpos;
5663   required_shared_ptr<UINT8> m_sprite1_ypos;
r243203r243204
6168   required_shared_ptr<UINT8> m_color_latch;
6269   required_shared_ptr<UINT8> m_characterram;
6370
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;
r243203r243204
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
8081   DECLARE_WRITE8_MEMBER(fax_bank_select_w);
8182   DECLARE_READ8_MEMBER(exidy_interrupt_r);
83
8284   DECLARE_CUSTOM_INPUT_MEMBER(teetert_input_r);
85
8386   DECLARE_DRIVER_INIT(fax);
8487   DECLARE_DRIVER_INIT(sidetrac);
8588   DECLARE_DRIVER_INIT(pepper2);
r243203r243204
9093   DECLARE_DRIVER_INIT(venture);
9194   DECLARE_DRIVER_INIT(spectar);
9295   DECLARE_DRIVER_INIT(phantoma);
96
9397   virtual void video_start();
9498   DECLARE_MACHINE_START(teetert);
99
95100   UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101
96102   INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt);
103
97104   void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
98105   inline void latch_condition(int collision);
99106   inline void set_1_color(int index, int which);
trunk/src/mame/includes/fuukifg2.h
r243203r243204
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);
6564   required_device<okim6295_device> m_oki;
6665   required_device<gfxdecode_device> m_gfxdecode;
6766   required_device<screen_device> m_screen;
trunk/src/mame/includes/fuukifg3.h
r243203r243204
2626      m_priority(*this, "priority"),
2727      m_tilebank(*this, "tilebank"),
2828      m_maincpu(*this, "maincpu"),
29      m_soundcpu(*this, "soundcpu"),
3029      m_gfxdecode(*this, "gfxdecode"),
3130      m_screen(*this, "screen"),
3231      m_palette(*this, "palette"),
r243203r243204
5150
5251   /* devices */
5352   required_device<cpu_device> m_maincpu;
54   required_device<cpu_device> m_soundcpu;
5553   required_device<gfxdecode_device> m_gfxdecode;
5654   required_device<screen_device> m_screen;
5755   required_device<palette_device> m_palette;
r243203r243204
8583   inline void fuuki32_vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_);
8684   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
8785   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);
8986
9087protected:
9188   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mame/includes/galspnbl.h
r243203r243204
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);
4342   required_device<cpu_device> m_maincpu;
4443   required_device<gfxdecode_device> m_gfxdecode;
4544   required_device<palette_device> m_palette;
trunk/src/mame/includes/hcastle.h
r243203r243204
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);
6968   DECLARE_WRITE8_MEMBER(volume_callback);
7069   required_device<cpu_device> m_maincpu;
7170   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/hyhoo.h
r243203r243204
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
r243203r243204
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);
126125
127126   /*----------- defined in machine/slikshot.c -----------*/
128127
trunk/src/mame/includes/lordgun.h
r243203r243204
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);
8786   required_device<cpu_device> m_maincpu;
8887   required_device<cpu_device> m_soundcpu;
8988   required_device<okim6295_device> m_oki;
trunk/src/mame/includes/m58.h
r243203r243204
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"),
126      m_maincpu(*this, "maincpu"),
137      m_gfxdecode(*this, "gfxdecode"),
148      m_screen(*this, "screen"),
15      m_palette(*this, "palette") { }
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") { }
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
1723   /* memory pointers */
1824   required_shared_ptr<UINT8> m_videoram;
1925   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;
2030
2131   /* video-related */
2232   tilemap_t*             m_bg_tilemap;
33   bitmap_ind16             m_scroll_panel_bitmap;
2334
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);
35   DECLARE_WRITE8_MEMBER(videoram_w);
36   DECLARE_WRITE8_MEMBER(scroll_panel_w);
37   DECLARE_WRITE8_MEMBER(flipscreen_w);
38
3239   DECLARE_DRIVER_INIT(yard85);
33   TILE_GET_INFO_MEMBER(yard_get_bg_tile_info);
34   TILEMAP_MAPPER_MEMBER(yard_tilemap_scan_rows);
3540   virtual void video_start();
3641   DECLARE_PALETTE_INIT(m58);
37   UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
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);
3847   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
3948   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;
4449};
trunk/src/mame/includes/mario.h
r243203r243204
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"),
r243203r243204
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
r243203r243204
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);
208206   DECLARE_READ_LINE_MEMBER(metro_rxd_r);
209207
210208protected:
trunk/src/mame/includes/midtunit.h
r243203r243204
2424      m_adpcm_sound(*this, "adpcm") ,
2525      m_generic_paletteram_16(*this, "paletteram"),
2626      m_nvram(*this, "nvram"),
27      m_gfxrom(*this, "gfxrom"),
28      m_ports(*this, tunit_ports) { }
27      m_gfxrom(*this, "gfxrom") { }
2928
3029   required_device<cpu_device> m_maincpu;
3130   required_device<palette_device> m_palette;
r243203r243204
3837
3938   required_memory_region m_gfxrom;
4039
41   required_ioport_array<4> m_ports;
42   DECLARE_IOPORT_ARRAY(tunit_ports);
43
4440   DECLARE_WRITE16_MEMBER(midtunit_cmos_enable_w);
4541   DECLARE_WRITE16_MEMBER(midtunit_cmos_w);
4642   DECLARE_READ16_MEMBER(midtunit_cmos_r);
trunk/src/mame/includes/model2.h
r243203r243204
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"
79
810struct raster_state;
911struct geo_state;
r243203r243204
3436      m_eeprom(*this, "eeprom"),
3537      m_screen(*this, "screen"),
3638      m_palette(*this, "palette"),
37      m_scsp(*this, "scsp") { }
39      m_scsp(*this, "scsp"),
40      m_cryptdevice(*this, "315_5881"),
41      m_0229crypt(*this, "317_0229")
3842
43      { }
44
3945   required_shared_ptr<UINT32> m_workram;
4046   required_shared_ptr<UINT32> m_bufferram;
4147   UINT16 *m_palram;
r243203r243204
5965   required_device<screen_device> m_screen;
6066   required_device<palette_device> m_palette;
6167   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;
6270
6371   UINT32 m_intreq;
6472   UINT32 m_intena;
r243203r243204
8896   int m_geo_iop_write_num;
8997   UINT32 m_geo_iop_data;
9098   int m_to_68k;
91   int m_protstate;
92   int m_protpos;
93   UINT8 m_protram[256];
94   int m_prot_a;
99
95100   int m_maxxstate;
96101   UINT32 m_netram[0x8000/4];
97102   int m_zflagi;
r243203r243204
154159   DECLARE_READ32_MEMBER(model2_serial_r);
155160   DECLARE_WRITE32_MEMBER(model2o_serial_w);
156161   DECLARE_WRITE32_MEMBER(model2_serial_w);
157   DECLARE_READ32_MEMBER(model2_prot_r);
158   DECLARE_WRITE32_MEMBER(model2_prot_w);
162   DECLARE_READ32_MEMBER(model2_5881prot_r);
163   DECLARE_WRITE32_MEMBER(model2_5881prot_w);
164   int first_read;
165
159166   DECLARE_READ32_MEMBER(maxx_r);
160167   DECLARE_READ32_MEMBER(network_r);
161168   DECLARE_WRITE32_MEMBER(network_w);
r243203r243204
218225   DECLARE_READ8_MEMBER(virtuacop_lightgun_r);
219226   DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r);
220227
228   UINT16 crypt_read_callback(UINT32 addr);
229
221230   bool copro_fifoin_pop(device_t *device, UINT32 *result,UINT32 offset, UINT32 mem_mask);
222231   void copro_fifoin_push(device_t *device, UINT32 data, UINT32 offset, UINT32 mem_mask);
223232   UINT32 copro_fifoout_pop(address_space &space, UINT32 offset, UINT32 mem_mask);
trunk/src/mame/includes/model3.h
r243203r243204
44#include "audio/dsbz80.h"
55#include "machine/eepromser.h"
66#include "sound/scsp.h"
7#include "machine/315-5881_crypt.h"
78
89typedef float MATRIX[4][4];
910typedef float VECTOR[4];
r243203r243204
7778      m_dsbz80(*this, DSBZ80_TAG),
7879      m_soundram(*this, "soundram"),
7980      m_gfxdecode(*this, "gfxdecode"),
80      m_palette(*this, "palette")
81      m_palette(*this, "palette"),
82      m_cryptdevice(*this, "315_5881")
8183   {
8284      m_step15_with_mpc106 = false;
8385      m_step20_with_old_real3d = false;
r243203r243204
9799
98100   required_device<gfxdecode_device> m_gfxdecode;
99101   required_device<palette_device> m_palette;
102   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
100103
101104   tilemap_t *m_layer4[4];
102105   tilemap_t *m_layer8[4];
r243203r243204
227230   DECLARE_WRITE8_MEMBER(model3_sound_w);
228231   DECLARE_READ64_MEMBER(network_r);
229232   DECLARE_WRITE64_MEMBER(network_w);
230   DECLARE_READ64_MEMBER(model3_security_r);
233
231234   DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
232235   DECLARE_WRITE16_MEMBER(model3snd_ctrl);
233236   UINT32 pci_device_get_reg();
234237   void pci_device_set_reg(UINT32 value);
238   DECLARE_DRIVER_INIT(genprot);
235239   DECLARE_DRIVER_INIT(lemans24);
236240   DECLARE_DRIVER_INIT(vs298);
237241   DECLARE_DRIVER_INIT(vs299);
r243203r243204
239243   DECLARE_DRIVER_INIT(scudplus);
240244   DECLARE_DRIVER_INIT(model3_20);
241245   DECLARE_DRIVER_INIT(bass);
242   DECLARE_DRIVER_INIT(vs2v991);
243246   DECLARE_DRIVER_INIT(vs2);
244247   DECLARE_DRIVER_INIT(daytona2);
245248   DECLARE_DRIVER_INIT(eca);
r243203r243204
256259   DECLARE_DRIVER_INIT(getbass);
257260   DECLARE_DRIVER_INIT(scudplusa);
258261   DECLARE_DRIVER_INIT(dirtdvls);
259   DECLARE_DRIVER_INIT(vs299b);
260262   DECLARE_DRIVER_INIT(vf3);
261263   DECLARE_DRIVER_INIT(von2);
262   DECLARE_DRIVER_INIT(vs299a);
263264   DECLARE_DRIVER_INIT(lostwsga);
264265   DECLARE_DRIVER_INIT(oceanhun);
265266   DECLARE_DRIVER_INIT(dayto2pe);
r243203r243204
333334   void tap_write(int tck, int tms, int tdi, int trst);
334335   void tap_reset();
335336   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
336343};
trunk/src/mame/includes/namcos21.h
r243203r243204
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"),
5254      m_dsp(*this, "dsp") { }
5355
5456   optional_shared_ptr<UINT16> m_winrun_dspbios;
r243203r243204
5860   required_shared_ptr<UINT8> m_mpDualPortRAM;
5961   optional_shared_ptr<UINT16> m_master_dsp_code;
6062
63   optional_region_ptr<INT32> m_ptrom24;
64   optional_region_ptr<UINT16> m_ptrom16;
65
6166   optional_device<cpu_device> m_dsp;
6267
6368   UINT8 *m_videoram;
trunk/src/mame/includes/naomi.h
r243203r243204
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
6569   inline int decode_reg32_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift);
6670
67   int jvsboard_type;
6871   UINT16 actel_id;
6972
7073   UINT8 aw_ctrl_type;
trunk/src/mame/includes/nb1413m3.h
r243203r243204
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
r243203r243204
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
r243203r243204
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);
125124   DECLARE_WRITE8_MEMBER(volume_callback);
126125};
trunk/src/mame/includes/oneshot.h
r243203r243204
1111      m_fg_videoram(*this, "fg_videoram"),
1212      m_scroll(*this, "scroll"),
1313      m_maincpu(*this, "maincpu"),
14      m_audiocpu(*this, "audiocpu"),
1514      m_oki(*this, "oki"),
1615      m_gfxdecode(*this, "gfxdecode"),
1716      m_palette(*this, "palette")  { }
r243203r243204
3938
4039   /* devices */
4140   required_device<cpu_device> m_maincpu;
42   required_device<cpu_device> m_audiocpu;
4341   DECLARE_READ16_MEMBER(oneshot_in0_word_r);
4442   DECLARE_READ16_MEMBER(oneshot_gun_x_p1_r);
4543   DECLARE_READ16_MEMBER(oneshot_gun_y_p1_r);
r243203r243204
5957   UINT32 screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6058   void draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect );
6159   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
62   DECLARE_WRITE_LINE_MEMBER(irqhandler);
6360   required_device<okim6295_device> m_oki;
6461   required_device<gfxdecode_device> m_gfxdecode;
6562   required_device<palette_device> m_palette;
trunk/src/mame/includes/pacman.h
r243203r243204
125125   DECLARE_DRIVER_INIT(8bpm);
126126   DECLARE_DRIVER_INIT(porky);
127127   DECLARE_DRIVER_INIT(mspacman);
128   DECLARE_DRIVER_INIT(mschamp);
128129   TILEMAP_MAPPER_MEMBER(pacman_scan_rows);
129130   TILE_GET_INFO_MEMBER(pacman_get_tile_info);
130131   TILE_GET_INFO_MEMBER(s2650_get_tile_info);
trunk/src/mame/includes/paradise.h
r243203r243204
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"),
813      m_vram_0(*this, "vram_0"),
914      m_vram_1(*this, "vram_1"),
1015      m_vram_2(*this, "vram_2"),
1116      m_videoram(*this, "videoram"),
1217      m_paletteram(*this, "paletteram"),
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") { }
18      m_spriteram(*this, "spriteram") { }
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
2027   /* memory pointers */
2128   required_shared_ptr<UINT8> m_vram_0;
2229   required_shared_ptr<UINT8> m_vram_1;
r243203r243204
2936   tilemap_t *m_tilemap_0;
3037   tilemap_t *m_tilemap_1;
3138   tilemap_t *m_tilemap_2;
39
3240   bitmap_ind16 m_tmpbitmap;
3341   UINT8 m_palbank;
3442   UINT8 m_priority;
3543   UINT8 m_pixbank;
3644   int m_sprite_inc;
45   int m_irq_count;
3746
38   int irq_count;
3947   DECLARE_WRITE8_MEMBER(paradise_rombank_w);
4048   DECLARE_WRITE8_MEMBER(torus_coin_counter_w);
4149   DECLARE_WRITE8_MEMBER(paradise_flipscreen_w);
r243203r243204
4856   DECLARE_WRITE8_MEMBER(paradise_pixmap_w);
4957   DECLARE_WRITE8_MEMBER(paradise_priority_w);
5058   DECLARE_WRITE8_MEMBER(paradise_okibank_w);
59
5160   DECLARE_DRIVER_INIT(torus);
5261   DECLARE_DRIVER_INIT(paradise);
5362   DECLARE_DRIVER_INIT(tgtball);
63
5464   TILE_GET_INFO_MEMBER(get_tile_info_0);
5565   TILE_GET_INFO_MEMBER(get_tile_info_1);
5666   TILE_GET_INFO_MEMBER(get_tile_info_2);
67
5768   virtual void machine_start();
5869   virtual void machine_reset();
5970   virtual void video_start();
71
6072   UINT32 screen_update_paradise(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6173   UINT32 screen_update_torus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6274   UINT32 screen_update_madball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75
6376   INTERRUPT_GEN_MEMBER(paradise_irq);
77
6478   void update_pix_palbank();
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;
79   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
7180};
trunk/src/mame/includes/pastelg.h
r243203r243204
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);
r243203r243204
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();
r243203r243204
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
r243203r243204
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);
4342
4443   required_device<cpu_device> m_maincpu;
4544   required_device<cpu_device> m_audiocpu;
trunk/src/mame/includes/psikyo.h
r243203r243204
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);
110108   required_device<cpu_device> m_maincpu;
111109   optional_device<okim6295_device> m_oki;
112110   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/psikyo4.h
r243203r243204
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);
7776};
trunk/src/mame/includes/psikyosh.h
r243203r243204
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);
8887};
trunk/src/mame/includes/senjyo.h
r243203r243204
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;
r243203r243204
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;
r243203r243204
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);
r243203r243204
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
r243203r243204
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);
5857   required_device<cpu_device> m_maincpu;
5958   required_device<cpu_device> m_soundcpu;
6059   required_device<upd7759_device> m_upd7759;
trunk/src/mame/includes/snowbros.h
r243203r243204
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);
5860   DECLARE_MACHINE_RESET(semiprot);
5961   DECLARE_MACHINE_RESET(finalttr);
6062   UINT32 screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r243203r243204
6769   TIMER_DEVICE_CALLBACK_MEMBER(snowbros3_irq);
6870   void sb3_play_music(int data);
6971   void sb3_play_sound (okim6295_device *oki, int data);
70   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7172};
trunk/src/mame/includes/spbactn.h
r243203r243204
7272   {
7373      return 0xffff;
7474   }
75   DECLARE_WRITE_LINE_MEMBER(irqhandler);
7675   required_device<cpu_device> m_maincpu;
7776   required_device<cpu_device> m_audiocpu;
7877   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/spdodgeb.h
r243203r243204
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);
6867   void spd_adpcm_int(msm5205_device *device, int chip);
6968   DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_1);
7069   DECLARE_WRITE_LINE_MEMBER(spd_adpcm_int_2);
trunk/src/mame/includes/spy.h
r243203r243204
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);
6362   DECLARE_WRITE8_MEMBER(volume_callback0);
6463   DECLARE_WRITE8_MEMBER(volume_callback1);
6564   K052109_CB_MEMBER(tile_callback);
trunk/src/mame/includes/stadhero.h
r243203r243204
1212      m_spritegen(*this, "spritegen"),
1313      m_gfxdecode(*this, "gfxdecode"),
1414      m_spriteram(*this, "spriteram"),
15      m_pf1_data(*this, "pf1_data"),
16      m_inputs(*this, "INPUTS"),
17      m_coin(*this, "COIN"),
18      m_dsw(*this, "DSW") { }
15      m_pf1_data(*this, "pf1_data") { }
1916
2017   required_device<cpu_device> m_maincpu;
2118   required_device<cpu_device> m_audiocpu;
2219   required_device<deco_bac06_device> m_tilegen1;
2320   required_device<deco_mxc06_device> m_spritegen;
2421   required_device<gfxdecode_device> m_gfxdecode;
25   
22
2623   required_shared_ptr<UINT16> m_spriteram;
2724   required_shared_ptr<UINT16> m_pf1_data;
28   
29   required_ioport m_inputs;
30   required_ioport m_coin;
31   required_ioport m_dsw;
3225
3326   tilemap_t *m_pf1_tilemap;
34   
35   DECLARE_READ16_MEMBER(stadhero_control_r);
27
3628   DECLARE_WRITE16_MEMBER(stadhero_control_w);
3729   DECLARE_WRITE16_MEMBER(stadhero_pf1_data_w);
38   DECLARE_WRITE_LINE_MEMBER(irqhandler);
39   
30
4031   virtual void video_start();
41   
32
4233   TILE_GET_INFO_MEMBER(get_pf1_tile_info);
4334   UINT32 screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4435};
trunk/src/mame/includes/stfight.h
r243203r243204
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
r243203r243204
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
r243203r243204
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;
r243203r243204
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);
r243203r243204
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
r243203r243204
1010#include "bus/generic/carts.h"
1111
1212#include "machine/315-5881_crypt.h"
13#include "machine/315-5838_317-0229_comp.h"
1314
1415#define MAX_FILTERS (24)
1516#define MAX_BLOCKS  (200)
r243203r243204
701702      : saturn_state(mconfig, type, tag),
702703      m_adsp(*this, "adsp"),
703704      m_adsp_pram(*this, "adsp_pram"),
704      m_cryptdevice(*this, "315_5881")
705      m_cryptdevice(*this, "315_5881"),
706      m_5838crypt(*this, "315_5838")
705707   {
706708   }
707709
r243203r243204
798800
799801   // protection specific variables and functions (see machine/stvprot.c)
800802   UINT32 m_abus_protenable;
801   UINT32 m_abus_prot_addr;
802803   UINT32 m_abus_protkey;
803804
804805   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.
808806
809   UINT32 (*m_prot_readback)(address_space&,int,UINT32);
810
811807   DECLARE_READ32_MEMBER( common_prot_r );
812808   DECLARE_WRITE32_MEMBER( common_prot_w );
813809
814810   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
823811   void stv_register_protection_savestates();
824812
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];
833813
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();
839814
840815   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
816   optional_device<sega_315_5838_comp_device> m_5838crypt;
841817   UINT16 crypt_read_callback(UINT32 addr);
818   UINT16 crypt_read_callback_ch1(UINT32 addr);
819   UINT16 crypt_read_callback_ch2(UINT32 addr);
842820};
843821
844822
trunk/src/mame/includes/suna8.h
r243203r243204
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);
161160};
trunk/src/mame/includes/tbowl.h
r243203r243204
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);
6867   void tbowl_adpcm_int(msm5205_device *device, int chip);
6968   DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_1);
7069   DECLARE_WRITE_LINE_MEMBER(tbowl_adpcm_int_2);
trunk/src/mame/includes/tecmo.h
r243203r243204
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);
6463   DECLARE_WRITE_LINE_MEMBER(tecmo_adpcm_int);
6564   required_device<cpu_device> m_maincpu;
6665   required_device<cpu_device> m_soundcpu;
trunk/src/mame/includes/toaplan1.h
r243203r243204
150150   void toaplan1_driver_savestate();
151151   void demonwld_driver_savestate();
152152   void vimana_driver_savestate();
153   DECLARE_WRITE_LINE_MEMBER(irqhandler);
154153   DECLARE_WRITE_LINE_MEMBER(toaplan1_reset_callback);
155154   required_device<m68000_device> m_maincpu;
156155   required_device<cpu_device> m_audiocpu;
trunk/src/mame/includes/toaplan2.h
r243203r243204
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);
157156   DECLARE_WRITE_LINE_MEMBER(bbakraid_irqhandler);
158157
159158   UINT8 m_pwrkick_hopper;
trunk/src/mame/includes/twincobr.h
r243203r243204
1616      m_spriteram8(*this, "spriteram8"),
1717      m_spriteram16(*this, "spriteram16"),
1818      m_maincpu(*this, "maincpu"),
19      m_audiocpu(*this, "audiocpu"),
2019      m_dsp(*this, "dsp"),
2120      m_spritegen(*this, "scu"),
2221      m_gfxdecode(*this, "gfxdecode"),
r243203r243204
119118   void toaplan0_control_w(int offset, int data);
120119   void toaplan0_coin_dsp_w(address_space &space, int offset, int data);
121120   void twincobr_driver_savestate();
122   DECLARE_WRITE_LINE_MEMBER(irqhandler);
123121   required_device<cpu_device> m_maincpu;
124   required_device<cpu_device> m_audiocpu;
125122   required_device<cpu_device> m_dsp;
126123   required_device<toaplan_scu_device> m_spritegen;
127124   required_device<gfxdecode_device> m_gfxdecode;
trunk/src/mame/includes/tx1.h
r243203r243204
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"),
110116         m_screen(*this, "screen") { }
111117
112118   required_device<cpu_device> m_maincpu;
r243203r243204
117123   required_shared_ptr<UINT16> m_objram;
118124   required_shared_ptr<UINT16> m_rcram;
119125   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
120134   required_device<screen_device> m_screen;
121135
122136   emu_timer *m_interrupt_timer;
trunk/src/mame/includes/vaportra.h
r243203r243204
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
r243203r243204
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
r243203r243204
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
3837   required_shared_ptr<UINT16> m_spriteram;
3938
4039   /* other video-related elements */
r243203r243204
5857   virtual void video_start();
5958   UINT32 screen_update_yunsun16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6059   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
61   DECLARE_WRITE_LINE_MEMBER(soundirq);
6260};
trunk/src/mame/layout/gts80a_caveman.lay
r243203r243204
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
r0r243204
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
r0r243204
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
r243203r243204
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   }
4856}
4957
5058void sega_315_5881_crypt_device::device_reset()
r243203r243204
7078   if(!enc_ready)
7179      enc_start();
7280   if(dec_header & FLAG_COMPRESSED) {
73      if(line_buffer_pos == line_buffer_size)
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
7488         line_fill();
89      }
7590      base = line_buffer + line_buffer_pos;
7691      line_buffer_pos += 2;
7792   } else {
r243203r243204
94109{
95110   prot_cur_address = (prot_cur_address & 0x0000ffff) | (data << 16);
96111   enc_ready = false;
112
113   buffer_bit = 7;
114   buffer_bit2 = 15;
97115}
98116
99117void sega_315_5881_crypt_device::set_subkey(UINT16 data)
r243203r243204
102120   enc_ready = false;
103121}
104122
105void sega_315_5881_crypt_device::set_key(UINT32 data)
106{
107   key = data;
108   enc_ready = false;
109}
110
111123/***************************************************************************
112124    DECRYPTION EMULATION
113125
r243203r243204
120132
121133The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher.
122134
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.
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.
125139
126140The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been
127141conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests
r243203r243204
134148given plaintext word, and the remaining 2 to the next plaintext word.
135149
136150The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (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).
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).
140154
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.
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.
143157
144158The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and,
145159indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident,
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.
160as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due).
149161
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
158162Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is
159163mapped to multiples of 128K.
160164
r243203r243204
164168chosen so as to make the key for CAPSNK equal to 0.
165169
166170It can be observed that a couple of sboxes have incomplete tables (a 255 value indicate an unknown value). The recovered keys
167as of december/2010 show small randomness and big correlations, making possible that some unseen bits could make the
171as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the
168172decryption need those incomplete parts.
169173
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
170205****************************************************************************************/
171206
172207const sega_315_5881_crypt_device::sbox sega_315_5881_crypt_device::fn1_sboxes[4][4] = {
r243203r243204
228263
229264      {
230265         {
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,
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,
233268         },
234         {1,2,5,6,7,-1},
269         {1,2,5,6,7,6},
235270         {2,7}
236271      },
237272
r243203r243204
335370
336371      {
337372         {
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,
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,
340375         },
341         {0,3,5,6,-1,-1},
376         {0,3,5,6,5,0},
342377         {1,2}
343378      },
344379
r243203r243204
381416
382417      {
383418         {
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,
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,
386421         },
387         {2,3,4,6,7,-1},
422         {2,3,4,6,7,2},
388423         {2,3}
389424      },
390425
r243203r243204
400435   {   // 3rd round
401436      {
402437         {
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,
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,
405440         },
406         {1,4,5,6,7,-1},
441         {1,4,5,6,7,5},
407442         {0,5}
408443      },
409444
r243203r243204
418453
419454      {
420455         {
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,
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,
422457            // unused?
423458            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,
424459         },
425         {1,2,4,7,-1,-1},
460         {1,2,4,7,2,-1},
426461         {2,4}
427462      },
428463
r243203r243204
474509   },
475510};
476511
477const int sega_315_5881_crypt_device::fn1_game_key_scheduling[38][2] = {
512const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = {
478513   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
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}
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}
483518};
484519
485const int sega_315_5881_crypt_device::fn2_game_key_scheduling[34][2] = {
520const int sega_315_5881_crypt_device::fn2_game_key_scheduling[FN2GK][2] = {
486521   {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
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}
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}
491525};
492526
493527const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
r243203r243204
533567UINT16 sega_315_5881_crypt_device::block_decrypt(UINT32 game_key, UINT16 sequence_key, UINT16 counter, UINT16 data)
534568{
535569   int j;
536   int aux,aux2;
537   int A,B;
570   int aux, aux2;
571   int A, B;
538572   int middle_result;
539573   UINT32 fn1_subkeys[4];
540574   UINT32 fn2_subkeys[4];
541575
542576   /* Game-key scheduling; this could be done just once per game at initialization time */
543   memset(fn1_subkeys,0,sizeof(UINT32)*4);
544   memset(fn2_subkeys,0,sizeof(UINT32)*4);
577   memset(fn1_subkeys, 0, sizeof(UINT32) * 4);
578   memset(fn2_subkeys, 0, sizeof(UINT32) * 4);
545579
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);
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);
551585      }
552586   }
553587
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);
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);
559593      }
560594   }
561595   /********************************************************/
562596
563597   /* Sequence-key scheduling; this could be done just once per decryption run */
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);
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);
569603      }
570604   }
571605
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);
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);
577611      }
578612   }
579613
580   // subkeys bits 10 & 41
581   fn2_subkeys[0] ^= (BIT(sequence_key,2)<<10);
582   fn2_subkeys[1] ^= (BIT(sequence_key,4)<<17);
583614   /**************************************************************/
584615
585616   // First Feistel Network
586617
587   aux = BITSWAP16(counter,5,12,14,13,9,3,6,4,    8,1,15,11,0,7,10,2);
618   aux = BITSWAP16(counter, 5, 12, 14, 13, 9, 3, 6, 4, 8, 1, 15, 11, 0, 7, 10, 2);
588619
589620   // 1st round
590621   B = aux >> 8;
591   A = (aux & 0xff) ^ feistel_function(B,fn1_sboxes[0],fn1_subkeys[0]);
622   A = (aux & 0xff) ^ feistel_function(B, fn1_sboxes[0], fn1_subkeys[0]);
592623
593624   // 2nd round
594   B = B ^ feistel_function(A,fn1_sboxes[1],fn1_subkeys[1]);
625   B ^= feistel_function(A, fn1_sboxes[1], fn1_subkeys[1]);
595626
596627   // 3rd round
597   A = A ^ feistel_function(B,fn1_sboxes[2],fn1_subkeys[2]);
628   A ^= feistel_function(B, fn1_sboxes[2], fn1_subkeys[2]);
598629
599630   // 4th round
600   B = B ^ feistel_function(A,fn1_sboxes[3],fn1_subkeys[3]);
631   B ^= feistel_function(A, fn1_sboxes[3], fn1_subkeys[3]);
601632
602   middle_result = (B<<8)|A;
633   middle_result = (B << 8) | A;
603634
604635
605636   /* Middle-result-key sheduling */
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);
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);
611642      }
612643   }
613644   /*********************/
614645
615646   // Second Feistel Network
616647
617   aux = BITSWAP16(data,14,3,8,12,13,7,15,4,    6,2,9,5,11,0,1,10);
648   aux = BITSWAP16(data, 14, 3, 8, 12, 13, 7, 15, 4, 6, 2, 9, 5, 11, 0, 1, 10);
618649
619650   // 1st round
620651   B = aux >> 8;
621   A = (aux & 0xff) ^ feistel_function(B,fn2_sboxes[0],fn2_subkeys[0]);
652   A = (aux & 0xff) ^ feistel_function(B, fn2_sboxes[0], fn2_subkeys[0]);
622653
623654   // 2nd round
624   B = B ^ feistel_function(A,fn2_sboxes[1],fn2_subkeys[1]);
655   B ^= feistel_function(A, fn2_sboxes[1], fn2_subkeys[1]);
625656
626657   // 3rd round
627   A = A ^ feistel_function(B,fn2_sboxes[2],fn2_subkeys[2]);
658   A ^= feistel_function(B, fn2_sboxes[2], fn2_subkeys[2]);
628659
629660   // 4th round
630   B = B ^ feistel_function(A,fn2_sboxes[3],fn2_subkeys[3]);
661   B ^= feistel_function(A, fn2_sboxes[3], fn2_subkeys[3]);
631662
632   aux = (B<<8)|A;
663   aux = (B << 8) | A;
633664
634   aux = BITSWAP16(aux,15,7,6,14,13,12,5,4,    3,2,11,10,9,1,0,8);
665   aux = BITSWAP16(aux, 15, 7, 6, 14, 13, 12, 5, 4, 3, 2, 11, 10, 9, 1, 0, 8);
635666
636667   return aux;
637668}
638669
670
639671UINT16 sega_315_5881_crypt_device::get_decrypted_16()
640672{
641673   UINT16 enc;
r243203r243204
647679   dec_hist = dec;
648680
649681   prot_cur_address ++;
682
683//  printf("get_decrypted_16 %04x\n", res);
684
650685   return res;
651686}
652687
688
653689void sega_315_5881_crypt_device::enc_start()
654690{
691   block_pos = 0;
692   done_compression = 0;
655693   buffer_pos = BUFFER_SIZE;
656   dec_header = get_decrypted_16() << 16;
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
657706   dec_header |= get_decrypted_16();
658707
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
659719   if(dec_header & FLAG_COMPRESSED) {
660      line_buffer_size = dec_header & FLAG_LINE_SIZE_512 ? 512 : 256;
720      line_buffer_size = blocky;
661721      line_buffer_pos = line_buffer_size;
662722      buffer_bit = 7;
723      buffer_bit2 = 15;
663724   }
725
726   printf("header %08x\n", dec_header);
664727   enc_ready = true;
665728}
666729
r243203r243204
671734      UINT16 val = get_decrypted_16();
672735      buffer[i] = val;
673736      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      }
674749   }
675750   buffer_pos = 0;
676751}
r243203r243204
749824
750825int sega_315_5881_crypt_device::get_compressed_bit()
751826{
752   if(buffer_pos == BUFFER_SIZE)
753      enc_fill();
754   int res = (buffer[buffer_pos^1] >> buffer_bit) & 1;
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;
755848   buffer_bit--;
756849   if(buffer_bit == -1) {
757850      buffer_bit = 7;
r243203r243204
759852   }
760853   return res;
761854}
762
763855void sega_315_5881_crypt_device::line_fill()
764856{
765857   assert(line_buffer_pos == line_buffer_size);
r243203r243204
769861   line_buffer_prev = lp;
770862   line_buffer_pos = 0;
771863
772   UINT32 line_buffer_mask = line_buffer_size-1;
773
774864   for(int i=0; i != line_buffer_size;) {
775865      // vlc 0: start of line
776866      // vlc 1: interior of line
r243203r243204
793883            static int offsets[4] = {0, 1, 0, -1};
794884            int offset = offsets[(tmp & 0x18) >> 3];
795885            for(int j=0; j != count; j++) {
796               lc[i^1] = lp[((i+offset) & line_buffer_mask)^1];
886               lc[i^1] = lp[((i+offset) % line_buffer_size)^1];
797887               i++;
798888            }
799889
r243203r243204
814904         }
815905      }
816906   }
907
908   block_pos++;
909   if (block_numlines == block_pos)
910   {
911      done_compression = 1;
912   }
913   else
914   {
915   }
817916}
trunk/src/mame/machine/315-5881_crypt.h
r243203r243204
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);
2726
2827   sega_m2_read_delegate m_read;
2928
r243203r243204
4039private:
4140
4241   enum {
43      BUFFER_SIZE = 32768, LINE_SIZE = 512,
44      FLAG_COMPRESSED = 0x10000, FLAG_LINE_SIZE_512 = 0x20000
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
4545   };
4646
4747   UINT32 key;
r243203r243204
5353
5454   bool enc_ready;
5555
56   int buffer_pos, line_buffer_pos, line_buffer_size, buffer_bit;
56   int buffer_pos, line_buffer_pos, line_buffer_size, buffer_bit, buffer_bit2;
57   UINT8 buffer2[2];
58   UINT16 buffer2a;
5759
60   int block_size;
61   int block_pos;
62   int block_numlines;
63   int done_compression;
64
5865   struct sbox {
5966      UINT8 table[64];
6067      int inputs[6];      // positions of the inputs bits, -1 means no input except from key
r243203r243204
6471   static const sbox fn1_sboxes[4][4];
6572   static const sbox fn2_sboxes[4][4];
6673
67   static const int fn1_game_key_scheduling[38][2];
68   static const int fn2_game_key_scheduling[34][2];
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];
6978   static const int fn1_sequence_key_scheduling[20][2];
7079   static const int fn2_sequence_key_scheduling[16];
7180   static const int fn2_middle_result_scheduling[16];
trunk/src/mame/machine/dec0.c
r243203r243204
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}
r243203r243204
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
r243203r243204
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
r243203r243204
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
147149   if(count > 1)
148150      return false;
149   jvs_outputs = vals[0] & 0x3f;
151   jvs_outputs = vals[0] & 0xfc;
150152   logerror("837-13551: output %02x\n", jvs_outputs);
151   ioport(port_tag[11])->write_safe(jvs_outputs, 0x3f);
153   ioport(port_tag[11])->write_safe(jvs_outputs, 0xfc);
152154   return true;
153155}
154156
trunk/src/mame/machine/midtunit.c
r243203r243204
7373}
7474
7575
76
7776/*************************************
7877 *
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 *
9478 *  Mortal Kombat (T-unit) protection
9579 *
9680 *************************************/
trunk/src/mame/machine/mie.c
r243203r243204
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;
106111}
107112
108113void mie_device::device_reset()
r243203r243204
164169         control |= CTRL_TFB|CTRL_EMP;
165170      }
166171   }
172   if(control & CTRL_HRES) {
173      raise_irq(maple_irqlevel);
174   }
167175}
168176
169177void mie_device::maple_w(const UINT32 *data, UINT32 in_size)
170178{
171179   memcpy(tbuf, data, in_size*4);
172180   lreg = in_size-1;
173   control &= ~(CTRL_TXB|CTRL_TFB|CTRL_RFB|CTRL_BFOV);
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);
174183   control |= CTRL_RXB;
175184
176185   timer->adjust(attotime::from_usec(20));
r243203r243204
357366
358367void mie_device::maple_reset()
359368{
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
369   control &= ~(CTRL_RXB|CTRL_TXB|CTRL_TFB|CTRL_RFB|CTRL_BFOV);
370   control |= CTRL_HRES;
371
372   timer->adjust(attotime::from_usec(20));
364373}
trunk/src/mame/machine/naomi.c
r243203r243204
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;
196195   actel_id = 0xffff;
197196
198197   create_pic_from_retdat();
r243203r243204
201200DRIVER_INIT_MEMBER(naomi_state,naomi2)
202201{
203202   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;
205203   actel_id = 0xffff;
206204
207205   create_pic_from_retdat();
208206}
209207
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
210226DRIVER_INIT_MEMBER(naomi_state,naomi_mp)
211227{
212228   //m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios
213229   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;
215230   actel_id = 0xffff;
231   m_mp_mux = 0;
216232
217233   create_pic_from_retdat();
218234}
r243203r243204
221237{
222238   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
223239   //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;
225240   actel_id = 0xffff;
226241
227242   create_pic_from_retdat();
r243203r243204
231246{
232247   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this)); // rev e bios
233248   //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;
235249   actel_id = 0xffff;
250   m_mp_mux = 0;
236251
237252   create_pic_from_retdat();
238253}
trunk/src/mame/machine/naomibd.h
r243203r243204
22#define _NAOMIBD_H_
33
44#include "machine/naomig1.h"
5#include "machine/naomicrypt.h"
65
76#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _actel_tag, _irq_cb)    \
87   MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb)                        \
trunk/src/mame/machine/naomicrypt.c
r243203r243204
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
r243203r243204
1/* naomicrypt.h */
2#define USE_NAOMICRYPT 0
3
4UINT32 get_naomi_key(running_machine &machine);
trunk/src/mame/machine/naomim1.c
r243203r243204
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;
1716}
1817
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
2518READ16_MEMBER(naomi_m1_board::actel_id_r)
2619{
2720   if (rombdid_tag && memregion(rombdid_tag) != NULL)
r243203r243204
3730{
3831   naomi_board::device_start();
3932
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
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
4642   buffer = auto_alloc_array(machine(), UINT8, BUFFER_SIZE);
4743
4844   save_pointer(NAME(buffer), BUFFER_SIZE);
trunk/src/mame/machine/naomim1.h
r243203r243204
33
44#include "naomibd.h"
55
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);
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)
98
109class naomi_m1_board : public naomi_board
1110{
1211public:
1312   naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
1413
15   static void static_set_tags(device_t &device, const char *_key_tag);
16
1714   virtual DECLARE_ADDRESS_MAP(submap, 16);
1815
1916   DECLARE_READ16_MEMBER(actel_id_r);
r243203r243204
2825
2926private:
3027   enum { BUFFER_SIZE = 32768 };
31
32   const char *key_tag;
3328   UINT32 key;
3429
3530   UINT8 *buffer;
trunk/src/mame/machine/naomim2.c
r243203r243204
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;
112111}
113112
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
120113void naomi_m2_board::device_start()
121114{
122115   naomi_board::device_start();
r243203r243204
134127   memset(ram, 0, RAM_SIZE);
135128
136129   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
144130}
145131
146132void naomi_m2_board::board_setup_address(UINT32 address, bool is_dma)
trunk/src/mame/machine/naomim2.h
r243203r243204
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);
107
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:
r243203r243204
1616   static const int RAM_SIZE = 65536;
1717   UINT8* ram;
1818
19   static void static_set_tags(device_t &device, const char *_key_tag);
2019   UINT16 read_callback(UINT32 addr);
2120
2221protected:
r243203r243204
3029   virtual void board_write(offs_t offset, UINT16 data);
3130
3231private:
33
34
35   const char *key_tag;
36
37
3832   required_device<sega_315_5881_crypt_device> m_cryptdevice;
3933};
4034
trunk/src/mame/machine/ng_memcard.h
r243203r243204
3636
3737   virtual iodevice_t image_type() const { return IO_MEMCARD; }
3838
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; }
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; }
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
r243203r243204
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
r243203r243204
1/* ST-V protection stuff */
1/* ST-V hookup for 315-5881 encryption/compression chip */
22
33/*
44
r243203r243204
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
2214*/
2315
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
9216#include "emu.h"
9317#include "includes/stv.h"
9418
9519
9620
97/************************
98*
99* Tecmo World Cup '98
100*
101************************/
10221
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 */
11222
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
56923/*************************************
57024*
57125* Common Handlers
57226*
57327*************************************/
57428
575// the naomi hookup of 315-5881 reads 16-bits at a time, here we seem to read 32?
576
57729READ32_MEMBER( stv_state::common_prot_r )
57830{
57931   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
r243203r243204
58234   {
58335      if(offset == 3)
58436      {
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);
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);
59042
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
43         return res2 | (res << 16);
59844      }
59945      return m_a_bus[offset];
60046   }
r243203r243204
60854
60955UINT16 stv_state::crypt_read_callback(UINT32 addr)
61056{
611   const UINT8 *base = m_cart_reg[0]->base() + 2*addr;
612   return base[1] | (base[0] << 8);
57   UINT16 dat= m_maincpu->space().read_word((0x02000000+2*addr));
58   return ((dat&0xff00)>>8)|((dat&0x00ff)<<8);
61359}
61460
61561WRITE32_MEMBER ( stv_state::common_prot_w )
61662{
61763   COMBINE_DATA(&m_a_bus[offset]);
618   //printf("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data);
61964
62065   if (offset == 0)
62166   {
r243203r243204
62368   }
62469   else if(offset == 2)
62570   {
626      COMBINE_DATA(&m_abus_prot_addr);
71      if (mem_mask&0xffff0000) m_cryptdevice->set_addr_low(data >> 16);
72      if (mem_mask&0x0000ffff) m_cryptdevice->set_addr_high(data&0xffff);
62773
628      m_cryptdevice->set_addr_low(m_abus_prot_addr >> 16);
629      m_cryptdevice->set_addr_high(m_abus_prot_addr&0xffff);
630
63174   }
63275   else if(offset == 3)
63376   {
63477      COMBINE_DATA(&m_abus_protkey);
63578
63679      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;
65680   }
65781}
65882
r243203r243204
66185   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));
66286}
66387
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
70488void stv_state::stv_register_protection_savestates()
70589{
70690   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));
71091}
trunk/src/mame/mame.lst
r243203r243204
209209warofbug        // (c) 1981 Armenia
210210warofbugu       // (c) 1981 Armenia
211211warofbugg       // German Version
212spactrai        //
212213redufo          // (c) Artic
213214redufob         // bootleg
214215exodus          // Subelectro - bootleg?
r243203r243204
26782679snowbrosd       // MIN16-02 (c) 1990 Toaplan + Dooyong license
26792680wintbob         // bootleg
26802681snowbroswb      //
2682toto            //
26812683// modified snowbros 'clone' hardware
26822684honeydol        // (c) 1995 Barko Corp
26832685twinadv         // (c) 1995 Barko Corp
r243203r243204
32293231sf2mdtb         // bootleg
32303232sf2b            // bootleg
32313233cworld2j        // 11/06/1992 (c) 1992 (Japan)
3234cworld2ja       // 11/06/1992 (c) 1992 (Japan)
32323235varth           // 14/07/1992 (c) 1992 (World)
32333236varthr1         // 12/06/1992 (c) 1992 (World)
32343237varthu          // 12/06/1992 (c) 1992 (USA)
r243203r243204
34113414ddsomjr1        // 06/02/1996 (c) 1996 (Japan)
34123415ddsomj          // 19/06/1996 (c) 1996 (Japan)
34133416ddsoma          // 19/06/1996 (c) 1996 (Asia)
3414ddsomar1      // 08/02/1996 (c) 1996 (Asia)
3417ddsomar1        // 08/02/1996 (c) 1996 (Asia)
34153418ddsomh          // 23/02/1996 (c) 1996 (Hispanic)
34163419ddsomb          // 23/02/1996 (c) 1996 (Brazil)
34173420sfa2            // 06/03/1996 (c) 1996 (Euro)
r243203r243204
53785381sprtjam         // 2000.11.13 Sports Jam
53795382pjustic         // 2000.12 Moero Justice Gakuen / Project Justice
53805383samba2k         // 2000.12 Samba de Amigo Ver.2000
5381shaktam           // 2000.12.28 Shakatto Tambourine (Rev B)
5384shaktam         // 2000.12.28 Shakatto Tambourine (Rev B)
53825385            // 2000.?? Boat Race Ocean Heats
53835386csmash          // 2000.?? Cosmic Smash
53845387csmasho         // 2000.?? Cosmic Smash (original)
r243203r243204
54465449starhrsp        // 2003.12.01 Star Horse Progress (satellite) (Rev A)
54475450puyofevp        // 2003.?? Puyo Puyo Fever (prototype)
54485451            // 2003.?? Dragon Treasure
5449            // 2003.?? Rabbit 2
54505452cfield          // 2004.06 Chaos Field
54515453tetkiwam        // 2004.06 Tetris Kiwamemichi (Arcade TV Game List - P.88, Right, 11 from bottom)
54525454trizeal         // 2004.09 Trizeal
r243203r243204
55135515
55145516// NAOMI 2
55155517naomi2          // 2001.?? Naomi 2 BIOS
5518vstrik3c        // 2001.04 Virtua Striker 3 (cartridge)
5519vstrik3cb       // 2001.04 Virtua Striker 3 (Rev B) (cartridge)
55165520vstrik3         // 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)
55195521wldrider        // 2001.05 Wild Riders
55205522clubkrte        // 2001.06 Club Kart: European Session
5523clubkrtc        // 2001.?? Club Kart: European Session (Rev C)
55215524clubkrtd        // 2001.06 Club Kart: European Session (Rev D)
5522clubkrtc        // 2001.?? Club Kart: European Session (Rev C)
55235525beachspi        // 2001.07 Beach Spikers
55245526vf4cart         // 2001.08.02 Virtua Fighter 4 (cartridge)
55255527vf4             // 2001.08.02 Virtua Fighter 4 (GD-ROM)
r243203r243204
67086710popn1           // GX803 (c) 1998 (Asia)
67096711//popn1j        // GX803 (c) 1998 (Japan)
67106712popn2           // GX831 (c) 1998 (Japan)
6711popn3            // GX980 (c) 1999 (Japan)
6713popn3           // GX980 (c) 1999 (Japan)
67126714//popnstex      // GX970 (c) 1999 (Japan)
67136715
67146716// Firebeat games
r243203r243204
69626964quantum1        // 136016           (c) 1982        // made by Gencomp
69636965quantump        // 136016           (c) 1982        // made by Gencomp
69646966bwidow          // 136017           (c) 1982
6965bwidowp         // (proto)         (c) 1982
6967bwidowp         // (proto)          (c) 1982
69666968starwars        // 136021           (c) 1983
69676969starwars1       // 136021           (c) 1983
69686970starwarso       // 136021           (c) 1983
r243203r243204
1121511217peps0298        // (c) 1996 IGT - International Game Technology
1121611218peps0308        // (c) 1996 IGT - International Game Technology
1121711219peps0364        // (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
1121811223peps0426        // (c) 1996 IGT - International Game Technology
1121911224peps0581        // (c) 1996 IGT - International Game Technology
1122011225peps0615        // (c) 1996 IGT - International Game Technology
r243203r243204
3114231147orbitor1
3114331148quicksil
3114431149seawitch
31145splitsec
31150spltsecp
3114631151stargzr
3114731152viperp
3114831153gamatron
trunk/src/mame/mame.mak
r243203r243204
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)/naomicrypt.o $(MACHINE)/naomim1.o $(MACHINE)/naomim2.o $(MACHINE)/naomim4.o \
1724   $(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 \
r243203r243204
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)/decathlt.o \
1750   $(DRIVERS)/stv.o $(MACHINE)/stvprot.o $(MACHINE)/315-5838_317-0229_comp.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
r243203r243204
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
2412UINT32 actfancr_state::screen_update_actfancr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
2513{
2614   /* Draw playfield */
trunk/src/mame/video/bogeyman.c
r243203r243204
3636   }
3737}
3838
39WRITE8_MEMBER(bogeyman_state::bogeyman_videoram_w)
39WRITE8_MEMBER(bogeyman_state::videoram_w)
4040{
4141   m_videoram[offset] = data;
4242   m_bg_tilemap->mark_tile_dirty(offset);
4343}
4444
45WRITE8_MEMBER(bogeyman_state::bogeyman_colorram_w)
45WRITE8_MEMBER(bogeyman_state::colorram_w)
4646{
4747   m_colorram[offset] = data;
4848   m_bg_tilemap->mark_tile_dirty(offset);
4949}
5050
51WRITE8_MEMBER(bogeyman_state::bogeyman_videoram2_w)
51WRITE8_MEMBER(bogeyman_state::videoram2_w)
5252{
5353   m_videoram2[offset] = data;
5454   m_fg_tilemap->mark_tile_dirty(offset);
5555}
5656
57WRITE8_MEMBER(bogeyman_state::bogeyman_colorram2_w)
57WRITE8_MEMBER(bogeyman_state::colorram2_w)
5858{
5959   m_colorram2[offset] = data;
6060   m_fg_tilemap->mark_tile_dirty(offset);
6161}
6262
63WRITE8_MEMBER(bogeyman_state::bogeyman_paletteram_w)
63WRITE8_MEMBER(bogeyman_state::paletteram_w)
6464{
6565   /* RGB output is inverted */
6666   m_palette->write(space, offset, UINT8(~data));
r243203r243204
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   int offs;
100
101   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
99   for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
102100   {
103101      int attr = m_spriteram[offs];
104102
r243203r243204
139137   }
140138}
141139
142UINT32 bogeyman_state::screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
140UINT32 bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
143141{
144142   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
145143   draw_sprites(bitmap, cliprect);
trunk/src/mame/video/cps1.c
r243203r243204
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
15341535   {"wof",         CPS_B_21_QS1, mapper_TK263B },
15351536   {"wofr1",       CPS_B_21_DEF, mapper_TK263B },  // patched set coming from a desuicided board?
15361537   {"wofa",        CPS_B_21_DEF, mapper_TK263B },  // patched set coming from a desuicided board?
trunk/src/mame/video/eolith.c
r243203r243204
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
r243203r243204
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
144147 It is unknown if the current solution breaks anything.  The majority of titles don't make extensive use of the
145148 priority system.
146149
147150*/
148#define GP9001_PRIMASK (0x000e)
151#define GP9001_PRIMASK (0x000f)
152#define GP9001_PRIMASK_TMAPS (0x000e)
149153
150
151154WRITE16_MEMBER( gp9001vdp_device::gp9001_bg_tmap_w )
152155{
153156   COMBINE_DATA(&m_vram_bg[offset]);
r243203r243204
171174   AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(gp9001_bg_tmap_w) AM_SHARE("vram_bg")
172175   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(gp9001_fg_tmap_w) AM_SHARE("vram_fg")
173176   AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(gp9001_top_tmap_w) AM_SHARE("vram_top")
174   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram")
175   AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
177   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") AM_MIRROR(0x0800)
178//  AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
176179ADDRESS_MAP_END
177180
178181
r243203r243204
885888         int realx = (x+scrollx)&0x1ff;
886889
887890         UINT16 pixdat = srcptr[realx];
888         UINT8 pixpri = ((pixdat & (GP9001_PRIMASK<<12))>>12);
891         UINT8 pixpri = ((pixdat & (GP9001_PRIMASK_TMAPS<<12))>>12);
889892
890893         if (pri_enable[pixpri])
891894         {
trunk/src/mame/video/m58.c
r243203r243204
102102 *
103103 *************************************/
104104
105WRITE8_MEMBER(m58_state::yard_videoram_w)
105WRITE8_MEMBER(m58_state::videoram_w)
106106{
107107   m_videoram[offset] = data;
108108   m_bg_tilemap->mark_tile_dirty(offset / 2);
109109}
110110
111111
112WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
112WRITE8_MEMBER(m58_state::scroll_panel_w)
113113{
114114   int sx,sy,i;
115115
r243203r243204
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
r243203r243204
140140 *
141141 *************************************/
142142
143TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info)
143TILE_GET_INFO_MEMBER(m58_state::get_bg_tile_info)
144144{
145145   int offs = tile_index * 2;
146146   int attr = m_videoram[offs + 1];
r243203r243204
152152}
153153
154154
155TILEMAP_MAPPER_MEMBER(m58_state::yard_tilemap_scan_rows)
155TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows)
156156{
157157   /* logical (col,row) -> memory offset */
158158   if (col >= 32)
r243203r243204
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::yard_get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::yard_tilemap_scan_rows),this),  8, 8, 64, 32);
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);
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);
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));
183185}
184186
185187
r243203r243204
190192 *
191193 *************************************/
192194
193WRITE8_MEMBER(m58_state::yard_flipscreen_w)
195WRITE8_MEMBER(m58_state::flipscreen_w)
194196{
195197   /* screen flip is handled both by software and hardware */
196198   flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01));
r243203r243204
265267
266268void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
267269{
268   if (!*m_yard_score_panel_disabled)
270   if (!*m_score_panel_disabled)
269271   {
270272      const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1);
271273      const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
r243203r243204
278280      clip.max_y += visarea.max_y + yoffs;
279281      clip &= cliprect;
280282
281      copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(),
283      copybitmap(bitmap, m_scroll_panel_bitmap, flip_screen(), flip_screen(),
282284               sx, visarea.min_y + yoffs, clip);
283285   }
284286}
r243203r243204
291293 *
292294 *************************************/
293295
294UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
296UINT32 m58_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
295297{
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);
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);
298300
299301   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
300302   draw_sprites(bitmap, cliprect);
trunk/src/mame/video/paradise.c
r243203r243204
164164   m_tilemap_2->set_transparent_pen(0xff);
165165
166166   save_item(NAME(m_tmpbitmap));
167   save_item(NAME(m_pixbank));
167168}
168169
169170
r243203r243204
179180   m_priority = data;
180181}
181182
182void paradise_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
183void paradise_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
183184{
184   UINT8 *spriteram = m_spriteram;
185   int i;
186   for (i = 0; i < m_spriteram.bytes() ; i += m_sprite_inc)
185   for (int i = 0; i < m_spriteram.bytes() ; i += m_sprite_inc)
187186   {
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];
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];
192191
193192      int flipx = 0;  // ?
194193      int flipy = 0;
trunk/src/mame/video/pastelg.c
r243203r243204
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
r243203r243204
377377
378378   UINT16 a, color;
379379   int sx, x_index;
380   int i, y, y_index, src_y_index, row_index;
380   int y_index, src_y_index, row_index;
381381
382382   int flip = 0;
383   int machine_flip = 0;   /* for  ROT 180 ? */
384383
385384   int min_x = cliprect.min_x;
386385   int max_x = cliprect.max_x;
r243203r243204
400399      y_index = 0;
401400   }
402401
403   if (!machine_flip)
404      y = min_y;
405   else
406      y = max_y;
407
408   do
402   for (int y = min_y; y <= max_y; y++)
409403   {
410404      src_y_index = y_index & 0x1ff;  /* tilemaps are 512 px up/down */
411405      row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff;
r243203r243204
419413
420414      if (flags & TILEMAP_DRAW_OPAQUE)
421415      {
422         for (i = 0; i < screen_width; i++)
416         for (int i = 0; i < screen_width; i++)
423417         {
424418            a = src16[x_index & width_mask];
425419#ifdef TOPSPEED_ROAD_COLORS
r243203r243204
431425      }
432426      else
433427      {
434         for (i = 0; i < screen_width; i++)
428         for (int i = 0; i < screen_width; i++)
435429         {
436430            if (tsrc[x_index & width_mask])
437431            {
r243203r243204
449443
450444      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
451445      y_index++;
452
453      if (!machine_flip)
454         y++;
455      else
456         y--;
457446   }
458   while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
459447}
460448
461449void 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
r243203r243204
229229         int xx1 = x1 >> TAITOAIR_FRAC_SHIFT;
230230         int xx2 = x2 >> TAITOAIR_FRAC_SHIFT;
231231         int grad_col;
232         int base_color;
232233
233234         if (xx1 <= cliprect.max_x || xx2 >= cliprect.min_x)
234235         {
r243203r243204
237238            if (xx2 > cliprect.max_x)
238239               xx2 = cliprect.max_x;
239240
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;
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            }
242254
243255            while (xx1 <= xx2)
244256            {
245               bitmap.pix16(y1, xx1) = color + grad_col;
257               bitmap.pix16(y1, xx1) = base_color + grad_col;
246258               xx1++;
247259            }
248260         }
r243203r243204
393405                  logerror("quad: unknown value %04x at %04x\n", m_line_ram[adr], adr);
394406                  break;
395407               }
396               m_q.col = ((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
408               m_q.col = m_line_ram[adr] & 0x7f;//((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
409
397410               adr--;
398411               pcount = 0;
399412               while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(m_line_ram[adr] & 0xc000))
trunk/src/mame/video/tc0080vco.c
r243203r243204
439439
440440      int sx, zoomx, zoomy;
441441      int dx, ex, dy, ey;
442      int i, y, y_index, src_y_index, row_index;
442      int 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 ? */
447446
448447      int min_x = cliprect.min_x;
449448      int max_x = cliprect.max_x;
r243203r243204
501500         y_index = ((-m_scroll_ram[3] - 2) << 16) + min_y * zoomy - (max_y + min_y) * (zoomy - 0x10000);
502501      }
503502
504      if (!machine_flip)
505         y = min_y;
506      else
507         y = max_y;
508
509      do
503      for (int y = min_y; y <= max_y; y++)
510504      {
511505         src_y_index = (y_index >> 16) & 0x3ff;  /* tilemaps are 1024 px up/down */
512506
r243203r243204
525519
526520         if (flags & TILEMAP_DRAW_OPAQUE)
527521         {
528            for (i = 0; i < screen_width; i++)
522            for (int i = 0; i < screen_width; i++)
529523            {
530524               *dst16++ = src16[(x_index >> 16) & width_mask];
531525               x_index += x_step;
r243203r243204
533527         }
534528         else
535529         {
536            for (i = 0; i < screen_width; i++)
530            for (int i = 0; i < screen_width; i++)
537531            {
538532               if (tsrc[(x_index >> 16) & width_mask])
539533                  *dst16++ = src16[(x_index >> 16) & width_mask];
r243203r243204
546540         taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1 , ROT0, screen.priority(), priority);
547541
548542         y_index += zoomy;
549
550         if (!machine_flip)
551            y++;
552         else
553            y--;
554543      }
555      while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
556544   }
557545}
558546
trunk/src/mame/video/tc0480scp.c
r243203r243204
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 i, y, y_index, src_y_index, row_index;
720      int y_index, src_y_index, row_index;
721721      int x_index, x_step;
722722
723723      UINT16 screen_width = 512; //cliprect.width();
r243203r243204
745745         y_index -= (m_y_offset - min_y) * zoomy;
746746      }
747747
748      y = min_y;
749
750      do
748      for (int y = min_y; y <= max_y; y++)
751749      {
752750         src_y_index = (y_index >> 16) & 0x1ff;
753751
r243203r243204
766764
767765         if (flags & TILEMAP_DRAW_OPAQUE)
768766         {
769            for (i = 0; i < screen_width; i++)
767            for (int i = 0; i < screen_width; i++)
770768            {
771769               *dst16++ = src16[(x_index >> 16) & width_mask];
772770               x_index += x_step;
r243203r243204
774772         }
775773         else
776774         {
777            for (i = 0; i < screen_width; i++)
775            for (int i = 0; i < screen_width; i++)
778776            {
779777               if (tsrc[(x_index >> 16) & width_mask])
780778                  *dst16++ = src16[(x_index >> 16) & width_mask];
r243203r243204
787785         taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
788786
789787         y_index += zoomy;
790         y++;
791788      }
792      while (y <= max_y);
793
794789   }
795790}
796791
r243203r243204
838833
839834   UINT16 *dst16, *src16;
840835   UINT8 *tsrc;
841   int i, y, y_index, src_y_index, row_index, row_zoom;
836   int y_index, src_y_index, row_index, row_zoom;
842837   int sx, x_index, x_step;
843838   UINT32 zoomx, zoomy;
844839   UINT16 scanline[512];
r243203r243204
876871      y_index -= (m_y_offset - min_y) * zoomy;
877872   }
878873
879      y = min_y;
880
881   do
874   for (int y = min_y; y <= max_y; y++)
882875   {
883876      if (!flipscreen)
884877         src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff;
r243203r243204
917910
918911      if (flags & TILEMAP_DRAW_OPAQUE)
919912      {
920         for (i = 0; i < screen_width; i++)
913         for (int i = 0; i < screen_width; i++)
921914         {
922915            *dst16++ = src16[(x_index >> 16) & width_mask];
923916            x_index += x_step;
r243203r243204
925918      }
926919      else
927920      {
928         for (i = 0; i < screen_width; i++)
921         for (int i = 0; i < screen_width; i++)
929922         {
930923            if (tsrc[(x_index >> 16) & width_mask])
931924               *dst16++ = src16[(x_index >> 16) & width_mask];
r243203r243204
938931      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
939932
940933      y_index += zoomy;
941      y++;
942934   }
943   while (y<=max_y);
944935}
945936
946937
trunk/src/mame/video/tia.c
r243203r243204
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
r243203r243204
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
r243203r243204
113113
114114PALETTE_INIT_MEMBER(tx1_state,tx1)
115115{
116   const UINT8 *color_prom = memregion("proms")->base();
116   const UINT8 *const color_prom = &m_proms[0];
117117   int i;
118118
119119   static const res_net_info tx1_net_info =
r243203r243204
233233   UINT16 *tx1_vram = m_vram;
234234   INT32 x, y;
235235   UINT32 scroll_x;
236   UINT8 *chars, *gfx2;
237236
238237   /* 2bpp characters */
239   chars = memregion("char_tiles")->base();
240   gfx2 = chars + 0x4000;
238   const UINT8 *const chars = &m_char_tiles[0];
239   const UINT8 *const gfx2 = &m_char_tiles[0x4000];
241240
242241   /* X scroll value is the last word in char RAM */
243242   scroll_x = tx1_vram[0xfff] & 0x3ff;
r243203r243204
414413   UINT8   pix[2][4][3];
415414
416415   /* Road slice map ROMs */
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;
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];
421419
422420   /* Pixel data */
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;
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];
428425
429426   rva9_8  = (tx1_vregs.flags & 3) << 8;
430427   rva7    = !BIT(tx1_vregs.flags, TX1_RDFLAG_RVA7) << 7;
r243203r243204
855852   UINT32 offs;
856853
857854   /* The many lookup table ROMs */
858   const UINT8 *const ic48 = memregion("user3")->base();
859   const UINT8 *const ic281 = ic48 + 0x2000;
855   const UINT8 *const ic48 = &m_obj_luts[0];
856   const UINT8 *const ic281 = &m_obj_luts[0x2000];
860857
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;
858   const UINT8 *const ic190 = &m_proms[0xc00];
859   const UINT8 *const ic162 = &m_proms[0xe00];
860   const UINT8 *const ic25  = &m_proms[0x1000];
865861
866   const UINT8 *const ic106 = memregion("obj_map")->base();
867   const UINT8 *const ic73  = ic106 + 0x4000;
862   const UINT8 *const ic106 = &m_obj_map[0];
863   const UINT8 *const ic73  = &m_obj_map[0x4000];
868864
869   const UINT8 *const pixdata_rgn = memregion("obj_tiles")->base();
865   const UINT8 *const pixdata_rgn = &m_obj_tiles[0];
870866
871867   for (offs = 0x0; offs <= 0x300; offs += 8)
872868   {
r243203r243204
995991                  dataend |= ic106_data & 0x40;
996992
997993                  /* Retrieve data for an 8x8 tile */
998                  ic73_data = ic73[rom_addr2];
994                  ic73_data = ic73[rom_addr2 & 0x3fff];
999995
1000996                  /* This is the data from the LUT pair */
1001997                  lut_data = (ic106_data << 8) | ic73_data;
r243203r243204
11301126void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen)
11311127{
11321128   int x, y;
1133   UINT8 *chr_pal = memregion("proms")->base() + 0x900;
1129   UINT8 *chr_pal = &m_proms[0x900];
11341130
11351131   int x_offset = screen * 256;
11361132
r243203r243204
12561252
12571253PALETTE_INIT_MEMBER(tx1_state,buggyboy)
12581254{
1259   const UINT8 *color_prom = memregion("proms")->base();
1255   const UINT8 *const color_prom = &m_proms[0];
12601256   int i;
12611257
12621258   for (i = 0; i < 0x100; i++)
r243203r243204
13011297   UINT16 *buggyboy_vram = m_vram;
13021298   INT32 x, y;
13031299   UINT32 scroll_x, scroll_y;
1304   UINT8 *chars, *gfx2;
13051300   UINT32 total_width;
13061301   UINT32 x_mask;
13071302
13081303   /* 2bpp characters */
1309   chars = memregion("char_tiles")->base();
1310   gfx2 = memregion("char_tiles")->base() + 0x4000;
1304   const UINT8 *const chars = &m_char_tiles[0];
1305   const UINT8 *const gfx2 = &m_char_tiles[0x4000];
13111306
13121307   /* X/Y scroll values are the last word in char RAM */
13131308   if (wide)
r243203r243204
14491444   UINT8 d1 = 0;
14501445
14511446   /* ROM/PROM lookup tables */
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;
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];
14561451
14571452   /* Latch road reverse bit */
14581453   *_rorev = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) );
r243203r243204
15431538   UINT32 rva20_6;
15441539
15451540   /* ROM/PROM lookup tables */
1546   const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500);
1547   const UINT8 *vprom   = memregion("road")->base() + 0x4600;
1541   const UINT8 *const rcols = &m_proms[0x1500];
1542   const UINT8 *const vprom = &m_road_rom[0x4600];
15481543
15491544   /* Extract constant values */
15501545   tcmd     = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6);
r243203r243204
21702165   UINT32 rva20_6;
21712166
21722167   /* ROM/PROM lookup tables */
2173   const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500);
2174   const UINT8 *vprom = memregion("road")->base() + 0x4600;
2168   const UINT8 *const rcols = &m_proms[0x1500];
2169   const UINT8 *const vprom = &m_road_rom[0x4600];
21752170
21762171   /* Extract constant values */
21772172   tcmd     = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6);
r243203r243204
25772572   UINT32 x_stride;
25782573
25792574   /* The many lookup table ROMs */
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;
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];
25832578
2584   const UINT8 *const bug16s = (UINT8*)memregion("obj_map")->base();
2585   const UINT8 *const bug17s = bug16s + 0x8000;
2579   const UINT8 *const bug16s = &m_obj_map[0];
2580   const UINT8 *const bug17s = &m_obj_map[0x8000];
25862581
2587   const UINT8 *const bb9o = (UINT8*)memregion("proms")->base() + 0x500;
2588   const UINT8 *const bb9e = bb9o + 0x800;
2582   const UINT8 *const bb9o = &m_proms[0x500];
2583   const UINT8 *const bb9e = &m_proms[0xd00];
25892584
2590   const UINT8 *const pixdata_rgn = (UINT8*)memregion("obj_tiles")->base();
2585   const UINT8 *const pixdata_rgn = &m_obj_tiles[0];
25912586
25922587   if (wide)
25932588   {
r243203r243204
29272922
29282923void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen)
29292924{
2930   UINT8 *chr_pal = memregion("proms")->base() + 0x400;
2925   UINT8 *chr_pal = &m_proms[0x400];
29312926   UINT32 bmp_stride;
29322927   UINT32 x_offset;
29332928   UINT32 y;
trunk/src/mame/video/wgp.c
r243203r243204
514514
515515   UINT16 *dst16,*src16;
516516   UINT8 *tsrc;
517   int i, y, y_index, src_y_index, row_index, row_zoom;
517   int 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 */
r243203r243204
524524   UINT16 scanline[512];
525525   UINT16 row_colbank, row_scroll;
526526   int flipscreen = 0; /* n/a */
527   int machine_flip = 0;   /* for  ROT 180 ? */
528527
529528   UINT16 screen_width = cliprect.width();
530529   UINT16 min_y = cliprect.min_y;
r243203r243204
558557      y_index = 0;
559558   }
560559
561   if (!machine_flip)
562      y = min_y;
563   else
564      y = max_y;
565
566   do
560   for (int y = min_y; y <= max_y; y++)
567561   {
568562      int a;
569563
r243203r243204
598592
599593      if (flags & TILEMAP_DRAW_OPAQUE)
600594      {
601         for (i = 0; i < screen_width; i++)
595         for (int i = 0; i < screen_width; i++)
602596         {
603597            *dst16++ = src16[(x_index >> 16) & width_mask] + row_colbank;
604598            x_index += x_step;
r243203r243204
606600      }
607601      else
608602      {
609         for (i = 0; i < screen_width; i++)
603         for (int i = 0; i < screen_width; i++)
610604         {
611605            if (tsrc[(x_index >> 16) & width_mask])
612606               *dst16++ = src16[(x_index >> 16) & width_mask] + row_colbank;
r243203r243204
619613      bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority);
620614
621615      y_index += zoomy;
622      if (!machine_flip) y++; else y--;
623616   }
624   while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
625
626617}
627618
628619
trunk/src/mess/drivers/a2600.c
r243203r243204
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
r243203r243204
112112
113113static INPUT_PORTS_START( amaztron )
114114   PORT_START("IN.0") // R0
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")
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")
120120
121121   PORT_START("IN.1") // R1
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")
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")
127127
128128   PORT_START("IN.2") // R2
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")
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")
134134
135135   PORT_START("IN.3") // R3
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")
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")
141141
142142   PORT_START("IN.4") // R4
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")
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")
148148
149149   PORT_START("IN.5") // R5
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")
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")
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
r243203r243204
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.
108
119    First revealed to the world in December 1986 issue of Electronics Today
1210    International (ETI) an Australian electronics magazine which is now defunct.
r243203r243204
936934/* Driver */
937935
938936/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   CLASS         INIT    COMPANY          FULLNAME       FLAGS */
939COMP( 1986, applix, 0,       0,     applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", GAME_NOT_WORKING )
937COMP( 1986, applix, 0,       0,     applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", 0 )
940938
941939
942940
trunk/src/mess/drivers/apricotp.c
r243203r243204
5656   m_video_ram.allocate(0x20000);
5757}
5858
59MC6845_UPDATE_ROW( fp_state::update_row )
60{
61}
5962
6063UINT32 fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6164{
r243203r243204
504507   MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_CRT_TAG, 4000000)
505508   MCFG_MC6845_SHOW_BORDER_AREA(false)
506509   MCFG_MC6845_CHAR_WIDTH(8)
510   MCFG_MC6845_UPDATE_ROW_CB(fp_state, update_row)
507511
508512   // sound hardware
509513   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mess/drivers/banctec.c
r0r243204
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
r243203r243204
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));
487491}
488492
489493void bw12_state::machine_reset()
trunk/src/mess/drivers/cat.c
r243203r243204
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
223    (needs tracing to see the VIA hookup order)
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
224228J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power
225229    through a small cable with a berg connector at the other end, to the floppy drive
226230    (5v gnd gnd 12v)
r243203r243204
232236J9: unpopulated DIL 40-pin straight connector for a ROM debug/expansion/RAM-shadow daughterboard
233237    the pins after pin 12 connect to that of the ROM-LO 27256 pinout counting pins 1,28,2,27,3,26,etc
234238    the ROM-HI rom has a different /HICE pin which is not connected to this connector
235    /LOCE is most likely !(a19|a18)&a15
236    /HICE is most likely !(a19|a18)&!a15
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
237244    pin 1 (GND) is in the lower left and the pins count low-high then to the right
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)
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)
240247Jx: 4 pin on top side, 6 pin on bottom side edge ?debug? connector (doesn't have a Jx number)
241248    (trace me!)
242249B1: a cuttable trace on the pcb. Not cut, affects one of the pins on the unpopulated J9 connector only.
r243203r243204
329336- Forth button (on the port on the back; keep in mind shift-usefront-space ALWAYS enables forth on a swyft)
330337- Multple undumped firmware revisions exist (330 and 331 are dumped)
331338
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
332431****************************************************************************/
333432
334433// Defines
r243203r243204
12651364x   x   x   x   0   0   ?   ?   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *        R   ROM-HI (/LOCE is 1, /HICE is 0)
12661365x   x   x   x   0   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   a        RW  RAM
12671366x   x   x   x   1   1  ?0? ?1?  ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   *   *   *   *        R   ? status of something? floppy?
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
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
12711370              ^               ^               ^               ^               ^
1371
12721372*/
12731373
12741374/* Swyft rom and ram notes:
r243203r243204
15781678   MCFG_VIDEO_START_OVERRIDE(cat_state,swyft)
15791679
15801680   MCFG_DEVICE_ADD("acia6850", ACIA6850, 0)
1581
1582   MCFG_DEVICE_ADD("acia_clock", CLOCK, 3579545) // guess
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
15831683   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(cat_state, write_acia_clock))
15841684
1585   MCFG_DEVICE_ADD("via6522_0", VIA6522, XTAL_15_8976MHz/16) // unknown clock, GUESSED
1685   MCFG_DEVICE_ADD("via6522_0", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008
15861686   MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via0_pa_r))
15871687   MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via0_pb_r))
15881688   MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via0_pa_w))
r243203r243204
15921692   MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via0_cb2_w))
15931693   MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via0_int_w))
15941694
1595   MCFG_DEVICE_ADD("via6522_1", VIA6522, XTAL_15_8976MHz/16) // unknown clock, GUESSED
1695   MCFG_DEVICE_ADD("via6522_1", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008
15961696   MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via1_pa_r))
15971697   MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via1_pb_r))
15981698   MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via1_pa_w))
r243203r243204
16231723    */
16241724   /* U9: Timing AMPAL16R4
16251725    *
1626    * input
1627    * 76543210
1628    * |||||||\-- ?
1629    * ||||||\--- ?
1630    * |||||\---- ?
1631    * ||||\----- ?
1632    * |||\------ ?
1633    * ||\------- ?
1634    * |\-------- ?
1635    * \--------- ?
1636    * /CK ------ 15.8976mhz crystal and transistor oscillator
1637    * /OE ------ ?
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
16381751    *
1639    * output
1640    * 76543210
1641    * |||||||\-- ?
1642    * ||||||\--- ?
1643    * |||||\-R-- ?
1644    * ||||\--R-- ?
1645    * |||\---R-- ?
1646    * ||\----R-- ?
1647    * |\-------- ?
1648    * \--------- ?
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    * \------------------< ?
16491774    */
1650   ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3))
16511775   ROM_LOAD( "decode_e.ampal16l8.u20.jed", 0x1000, 0xb08, CRC(0b1dbd76) SHA1(08c144ad7a7bbdd53eefd271b2f6813f8b3b1594))
16521776   ROM_LOAD( "video_2b.ampal16r4.u25.jed", 0x2000, 0xb08, CRC(caf91148) SHA1(3f8ddcb512a1c05395c74ad9a6ba7b87027ce4ec))
16531777   ROM_LOAD( "disk_3.5c.ampal16r4.u28.jed", 0x3000, 0xb08, CRC(fd994d02) SHA1(f910ab16587dd248d63017da1e5b37855e4c1a0c))
trunk/src/mess/drivers/cnsector.c
r243203r243204
155155
156156static INPUT_PORTS_START( cnsector )
157157   PORT_START("IN.0") // O0
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")
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")
160160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range")
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range")
162162
163163   PORT_START("IN.1") // O1
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")
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")
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_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
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
172172   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall")
173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall")
174174
175175   PORT_START("IN.3") // O3
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")
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")
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_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")
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")
184184   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship")
185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship")
186186INPUT_PORTS_END
187187
188188
trunk/src/mess/drivers/comp4.c
r243203r243204
140140
141141static INPUT_PORTS_START( comp4 )
142142   PORT_START("IN.0") // O1
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")
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")
147147
148148   PORT_START("IN.1") // O2
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")
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")
153153
154154   PORT_START("IN.2") // O3
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")
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")
159159INPUT_PORTS_END
160160
161161
trunk/src/mess/drivers/elecdet.c
r243203r243204
186186
187187static INPUT_PORTS_START( elecdet )
188188   PORT_START("IN.0") // O0 pin18
189   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
189   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) 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_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")
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")
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_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")
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")
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_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
203   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) 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_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")
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")
208208
209209   PORT_START("IN.3") // O6 pin12
210   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
210   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) 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_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")
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")
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_KEYBOARD ) 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_KEYPAD ) 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_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)
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)
223223INPUT_PORTS_END
224224
225225
r243203r243204
297297
298298ROM_START( elecdet )
299299   ROM_REGION( 0x1000, "maincpu", 0 )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(8160a081) SHA1(14cbfc0529ad83a58e0dc15fe8ba594947e49f08) )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) )
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
r243203r243204
1919
2020ToDo:
2121- Colours are approximate.
22- Disk controller, works with old wd17xx but crashes on new wd.
2322- Hardware supports 20cm and 13cm floppies, but we only support 13cm as this
2423  is the only software that exists.
2524- The schematic shows the audio counter connected to 2MHz, but this produces
r243203r243204
2928
3029****************************************************************************/
3130
32#define NEWFDC 0
31#define NEWFDC 1
3332
3433
3534#include "emu.h"
r243203r243204
252251FLOPPY_FORMATS_END
253252
254253static SLOT_INTERFACE_START( excali64_floppies )
255   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
254   SLOT_INTERFACE( "drive0", FLOPPY_525_QD )
255   SLOT_INTERFACE( "drive1", FLOPPY_525_QD )
256256SLOT_INTERFACE_END
257257#else
258258static LEGACY_FLOPPY_OPTIONS_START(excali64)
r243203r243204
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, "525dd", excali64_state::floppy_formats)
658   MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", excali64_state::floppy_formats)
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)
659659#else
660660   MCFG_DEVICE_ADD("fdc", WD2793, 0)
661661   MCFG_WD17XX_DEFAULT_DRIVE2_TAGS
r243203r243204
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)
696698
697699   ROM_REGION(0x10000, "rambank", ROMREGION_ERASE00)
698700   ROM_REGION(0xA000, "videoram", ROMREGION_ERASE00)
trunk/src/mess/drivers/gamate.c
r243203r243204
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")
r243203r243204
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;
r243203r243204
8484   required_shared_ptr<UINT8> m_bios;
8585   emu_timer *timer1;
8686   emu_timer *timer2;
87   UINT8 bank_multi; 
87   UINT8 bank_multi;
88   UINT8 *m_cart_ptr;
8889};
8990
9091WRITE8_MEMBER( gamate_state::gamate_cart_protection_w )
9192{
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 
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
9495   switch (offset) {
9596   case 0:
9697      card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0);
9798      card_protection.bit_shifter++;
9899      if (card_protection.bit_shifter>=8) {
99         card_protection.cartridge_byte=m_cart->get_rom_base()[card_protection.address++];
100         card_protection.cartridge_byte=m_cart_ptr[card_protection.address++];
100101         card_protection.bit_shifter=0;
101102      }
102103      break;
r243203r243204
104105}
105106READ8_MEMBER( gamate_state::gamate_cart_protection_r )
106107{
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 {
108   UINT8 ret=1;
109   if (card_protection.bit_shifter==7 && card_protection.unprotected) {
110   ret=m_cart_ptr[bank_multi*0x4000];
111   } else {
112112   card_protection.bit_shifter++;
113113   if (card_protection.bit_shifter==8) {
114114      card_protection.bit_shifter=0;
r243203r243204
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->get_rom_base()[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_ptr[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->get_rom_base()+0x4000*data+1);
174   bank_multi=data;
175   membank("bankmulti")->set_base(m_cart_ptr+0x4000*data+1);
176176}
177177
178178WRITE8_MEMBER( gamate_state::cart_bankswitch_w )
179179{
180   membank("bank")->set_base(m_cart->get_rom_base()+0x4000*data);
180   membank("bank")->set_base(m_cart_ptr+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
r243203r243204
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)
r243203r243204
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)
r243203r243204
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}
r243203r243204
329329
330330void gamate_state::machine_start()
331331{
332   m_cart_ptr = memregion("maincpu")->base() + 0x6000;
332333   if (m_cart->exists()) {
333//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
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();
334336      membank("bankmulti")->set_base(m_cart->get_rom_base()+1);
335337      membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset
336338   }
337//   m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
339//  m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
338340   card_protection.set=false;
339341   bank_multi=0;
340342   card_protection.unprotected=false;
r243203r243204
387389
388390#ifdef USE_GFX
389391   MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
390#endif   
392#endif
391393   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
392394   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
393395   MCFG_DEFAULT_LAYOUT(layout_lcd)
r243203r243204
405407   ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) )
406408   ROM_SYSTEM_BIOS(1, "newer", "NEWER")
407409   ROMX_LOAD("gamate_bios_9130__unknown__bit_icasc00001_9130-bs_r32261.bin", 0xf000, 0x1000, CRC(03a5f3a7) SHA1(4e9dfbfe916ca485530ef4221593ab68738e2217), ROM_BIOS(2) )
408#ifdef USE_GFX   
410#ifdef USE_GFX
409411   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
410#endif   
412#endif
411413ROM_END
412414
413415
414416/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
415417CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND)
416
417
trunk/src/mess/drivers/hp16500.c
r243203r243204
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:
r243203r243204
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
r243203r243204
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:
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
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)
r243203r243204
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)
r243203r243204
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)
r243203r243204
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)
r243203r243204
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)
r243203r243204
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)
r243203r243204
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)
r243203r243204
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) )
r243203r243204
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) )
r243203r243204
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) )
r243203r243204
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
r243203r243204
131131
132132static INPUT_PORTS_START( mathmagi )
133133   PORT_START("IN.0") // R3
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("-")
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("-")
138138
139139   PORT_START("IN.1") // R5
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("+")
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("+")
144144
145145   PORT_START("IN.2") // R6
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)
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)
150150
151151   PORT_START("IN.3") // R7
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("=")
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("=")
156156
157157   PORT_START("IN.4") // R9
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)
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)
162162
163163   PORT_START("IN.5") // R10
164164   PORT_CONFNAME( 0x01, 0x00, "Players")
trunk/src/mess/drivers/merlin.c
r243203r243204
123123
124124static INPUT_PORTS_START( merlin )
125125   PORT_START("IN.0") // O0
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")
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")
130130
131131   PORT_START("IN.1") // O1
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")
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")
136136
137137   PORT_START("IN.2") // O2
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")
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")
142142
143143   PORT_START("IN.3") // O3
144144   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
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")
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")
148148INPUT_PORTS_END
149149
150150
trunk/src/mess/drivers/nes.c
r243203r243204
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
15851static INPUT_PORTS_START( nes )
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
52   // input devices go through slot options
18553   PORT_START("CONFIG")
18654   PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines")
18755   PORT_CONFSETTING(    0x01, DEF_STR(No) )
r243203r243204
19159   PORT_CONFSETTING(    0x00, DEF_STR(Yes) )
19260INPUT_PORTS_END
19361
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
58462static INPUT_PORTS_START( famicom )
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
63   // input devices go through slot options
62864   PORT_START("CONFIG")
62965   PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines")
63066   PORT_CONFSETTING(    0x01, DEF_STR(No) )
r243203r243204
63470   PORT_CONFSETTING(    0x00, DEF_STR(Yes) )
63571
63672   PORT_START("FLIPDISK") /* fake key */
637   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Change Disk Side")
73   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Change Disk Side") PORT_CODE(KEYCODE_SPACE)
63874INPUT_PORTS_END
63975
64076
r243203r243204
674110   MCFG_NES_APU_CPU("maincpu")
675111   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
676112
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
677118   MCFG_NES_CARTRIDGE_ADD("nes_slot", nes_cart, NULL)
678119   MCFG_SOFTWARE_LIST_ADD("cart_list", "nes")
679120   MCFG_SOFTWARE_LIST_ADD("ade_list", "nes_ade")         // Camerica/Codemasters Aladdin Deck Enhancer mini-carts
r243203r243204
729170MACHINE_CONFIG_END
730171
731172static MACHINE_CONFIG_DERIVED( famicom, nes )
732   MCFG_CASSETTE_ADD( "tape" )
733   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
734   MCFG_CASSETTE_INTERFACE("fc_cass")
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)
735179
736180   MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop")
737181   MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass")
r243203r243204
769213MACHINE_START_MEMBER( nes_state, fds )
770214{
771215   m_ciram = auto_alloc_array(machine(), UINT8, 0x800);
772   setup_ioports();
773216   setup_disk(m_disk);
774   state_register();
217
218   // register saves
219   save_item(NAME(m_last_frame_flip));
220   save_pointer(NAME(m_ciram), 0x800);
775221}
776222
777223MACHINE_RESET_MEMBER( nes_state, fds )
r243203r243204
781227
782228   // the rest is the same as for nes/famicom/dendy
783229   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;
789230}
790231
791232static MACHINE_CONFIG_DERIVED( fds, famicom )
792233   MCFG_MACHINE_START_OVERRIDE( nes_state, fds )
793234   MCFG_MACHINE_RESET_OVERRIDE( nes_state, fds )
794   MCFG_DEVICE_REMOVE("tape")
795235
796236   MCFG_DEVICE_REMOVE("nes_slot")
797237   MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0)
r243203r243204
827267
828268   // the rest is the same as for nes/famicom/dendy
829269   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;
835270}
836271
837272static MACHINE_CONFIG_DERIVED( famitwin, famicom )
trunk/src/mess/drivers/ngen.c
r243203r243204
6767#include "machine/pit8253.h"
6868#include "machine/z80dart.h"
6969#include "machine/wd_fdc.h"
70#include "machine/wd2010.h"
7071#include "bus/rs232/rs232.h"
7172#include "machine/ngen_kb.h"
7273#include "machine/clock.h"
74#include "imagedev/harddriv.h"
7375
7476class ngen_state : public driver_device
7577{
r243203r243204
8991      m_fdc(*this,"fdc"),
9092      m_fd0(*this,"fdc:0"),
9193      m_fdc_timer(*this,"fdc_timer"),
92      m_hdc_timer(*this,"hdc_timer")
94      m_hdc(*this,"hdc"),
95      m_hdc_timer(*this,"hdc_timer"),
96      m_hd_buffer(*this,"hd_buffer_ram")
9397   {}
9498
9599   DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
r243203r243204
129133   DECLARE_READ8_MEMBER(irq_cb);
130134   DECLARE_WRITE8_MEMBER(hdc_control_w);
131135   DECLARE_WRITE8_MEMBER(disk_addr_ext);
136   DECLARE_READ8_MEMBER(hd_buffer_r);
137   DECLARE_WRITE8_MEMBER(hd_buffer_w);
132138
133139protected:
134140   virtual void machine_reset();
141   virtual void machine_start();
135142
136143private:
137144   required_device<i80186_cpu_device> m_maincpu;
r243203r243204
147154   optional_device<wd2797_t> m_fdc;
148155   optional_device<floppy_connector> m_fd0;
149156   optional_device<pit8253_device> m_fdc_timer;
157   optional_device<wd2010_device> m_hdc;
150158   optional_device<pit8253_device> m_hdc_timer;
159   optional_shared_ptr<UINT8> m_hd_buffer;
151160
152161   void set_dma_channel(int channel, int state);
153162
r243203r243204
397406
398407// X-bus module select
399408// The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each
400// expansion module.  The base I/O address for the currently selected module is set by writing to
409// expansion module.  The base I/O address for the currently selected module is set by writing to
401410// this register (bits 0-7 are ignored)
402411// TODO: make expansion modules slot devices
403412WRITE16_MEMBER(ngen_state::xbus_w)
r243203r243204
426435READ16_MEMBER(ngen_state::xbus_r)
427436{
428437   UINT16 ret = 0xffff;
429   
438
430439   switch(m_xbus_current)
431440   {
432441      case 0x00:
r243203r243204
470479      case 0x0a:
471480      case 0x0b:
472481         if(mem_mask & 0x00ff)
473            m_fdc_timer->write(space,offset,data & 0xff);
482            m_fdc_timer->write(space,offset-0x08,data & 0xff);
474483         break;
475484      case 0x10:
476485      case 0x11:
r243203r243204
480489      case 0x15:
481490      case 0x16:
482491      case 0x17:
492         if(mem_mask & 0x00ff)
493            m_hdc->write(space,offset-0x10,data & 0xff);
483494         logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask);
484495         break;
485496      case 0x18:
r243203r243204
487498      case 0x1a:
488499      case 0x1b:
489500         if(mem_mask & 0x00ff)
490            m_hdc_timer->write(space,offset,data & 0xff);
501            m_hdc_timer->write(space,offset-0x18,data & 0xff);
491502         break;
492503   }
493504}
r243203r243204
510521      case 0x0a:
511522      case 0x0b:
512523         if(mem_mask & 0x00ff)
513            ret = m_fdc_timer->read(space,offset);
524            ret = m_fdc_timer->read(space,offset-0x08);
514525         break;
515526      case 0x10:
516527      case 0x11:
r243203r243204
520531      case 0x15:
521532      case 0x16:
522533      case 0x17:
534         if(mem_mask & 0x00ff)
535            ret = m_hdc->read(space,offset-0x10);
523536         logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask);
524537         break;
525538      case 0x18:
r243203r243204
527540      case 0x1a:
528541      case 0x1b:
529542         if(mem_mask & 0x00ff)
530            ret = m_hdc_timer->read(space,offset);
543            ret = m_hdc_timer->read(space,offset-0x18);
531544         break;
532545   }
533546
r243203r243204
585598   m_disk_page = data & 0x7f;
586599}
587600
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
588611WRITE_LINE_MEMBER( ngen_state::dma_hrq_changed )
589612{
590613   m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r243203r243204
603626   {
604627      if(state)
605628      {
606         if(m_hdc_control & 0x04) // ROM transfer?
629         if(m_hdc_control & 0x04) // ROM transfer
607630            m_hdc_control &= ~0x04;  // switch it off when done
608631      }
609632   }
r243203r243204
624647
625648READ8_MEMBER(ngen_state::dma_3_dack_r)
626649{
627   UINT16 ret = 0xffff;
628   
650   UINT16 ret = 0xffff;
651
629652   if((m_hdc_control & 0x04) && m_disk_rom)
630653   {
631654      ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8;
r243203r243204
636659         //m_dmac->dreq3_w(0);
637660      }
638661   }
639   m_dma_high_byte = ret & 0xff00;
662   m_dma_high_byte = ret & 0xff00;
640663   return ret;
641664}
642665
r243203r243204
689712   return m_pic->acknowledge();
690713}
691714
715void ngen_state::machine_start()
716{
717   m_hd_buffer.allocate(1024*8);  // 8kB buffer RAM for HD controller
718}
719
692720void ngen_state::machine_reset()
693721{
694722   m_port00 = 0;
r243203r243204
709737
710738static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state )
711739   AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w)
712   
740
713741   // Floppy/Hard disk module
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)
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)
719747   // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated)
720//   AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
721   
748//  AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
749
722750ADDRESS_MAP_END
723751
724752static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state )
r243203r243204
823851
824852   // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board)
825853   MCFG_DEVICE_ADD("videouart", I8251, 0)  // main clock unknown, Rx/Tx clocks are 19.53kHz
826//   MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
854//  MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
827855   MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd))
828856   MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen")
829857   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd))
r243203r243204
838866   MCFG_WD_FDC_FORCE_READY
839867   MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0)
840868   MCFG_PIT8253_CLK0(XTAL_20MHz / 20)
841   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
869   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // clocked on FDC data register access
842870   MCFG_PIT8253_CLK1(XTAL_20MHz / 20)
843   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
844   MCFG_PIT8253_CLK2(XTAL_20MHz / 20)
871   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // 1MHz
872   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)
845873   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
846   // TODO: WD1010 HDC (not implemented)
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)
847883   MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0)
884   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)  // 2MHz
848885   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats)
886   MCFG_HARDDISK_ADD("hard0")
849887
850888MACHINE_CONFIG_END
851889
trunk/src/mess/drivers/pasogo.c
r243203r243204
679679void pasogo_state::machine_reset()
680680{
681681   astring region_tag;
682   m_maincpu_rom = memregion("maincpu");
682683   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
683   m_maincpu_rom = memregion("maincpu");
684   if (!m_cart_rom)    // this should never happen, since we make carts mandatory!
685      m_cart_rom = memregion("maincpu");
684686
685687   membank("bank27")->set_base(m_cart_rom->base());
686688   membank("bank28")->set_base(m_maincpu_rom->base() + 0xb8000/*?*/);
trunk/src/mess/drivers/pc9801.c
r243203r243204
36263626
36273627ROM_START( pc9821ap2 )
36283628   ROM_REGION( 0x80000, "biosrom", ROMREGION_ERASEFF )
3629   ROM_LOAD( "phd0102.rom",     0x000000, 0x80000, CRC(3036774c) SHA1(59856a348f156adf5eca06326f967aca54ff871c) )
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) )
36303634
36313635   ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) // TODO: identify ROM banks
36323636   ROM_COPY( "biosrom", 0x20000, 0x18000, 0x08000 )
trunk/src/mess/drivers/slicer.c
r0r243204
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
r243203r243204
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)
1718 - SMS Disk System (floppy disk drive expansion device) - unreleased
1819 - Rapid button of Japanese Master System
1920 - Keyboard support for Sega Mark III (sg1000m3 driver)
r243203r243204
5758- Few games of the ones with FM support need to detect the system region as
5859  Japanese to play FM sound;
5960- The Light Phaser gun doesn't work with the Japanese SMS;
60- There are reports about Light Phaser working on the second Korean console
61- There are reports about Light Phaser working on the second Korean SMS
6162  version, and a Korean advert shows support on the first version (Gam*Boy I,
6263  although based on Japanese SMS);
6364- The Korean SMS versions have Japanese-format cartridge slot, but only on the
6465  first (Gam*Boy I) the region is detected as Japanese;
6566- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through
6667  the gender adapter;
67- Some SMS ROMs don't run when are plugged-in to a Game Gear, through the
68  Master Gear 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;
6970
7071--------------------------------------------------------------------------------
7172
r243203r243204
405406INPUT_PORTS_END
406407
407408static 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.
408416   PORT_INCLUDE( sms1 )
409417
410418   PORT_START("DSW")
r243203r243204
805813
806814   MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear")
807815
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
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
811819MACHINE_CONFIG_END
812820
813821
trunk/src/mess/drivers/splitsec.c
r243203r243204
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
815
16  *: higher number indicates higher difficulty
17
18
19  TODO:
20  - MCU clock is unknown
21
922***************************************************************************/
1023
1124#include "emu.h"
r243203r243204
1427
1528#include "splitsec.lh"
1629
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)
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?
2034
35// so for now, the value below is an approximation
36#define MASTER_CLOCK (485000)
2137
38
2239class splitsec_state : public driver_device
2340{
2441public:
2542   splitsec_state(const machine_config &mconfig, device_type type, const char *tag)
2643      : driver_device(mconfig, type, tag),
2744      m_maincpu(*this, "maincpu"),
28//      m_button_matrix(*this, "IN"),
45      m_button_matrix(*this, "IN"),
2946      m_speaker(*this, "speaker")
3047   { }
3148
3249   required_device<cpu_device> m_maincpu;
33//   required_ioport_array<4> m_button_matrix;
50   required_ioport_array<2> m_button_matrix;
3451   required_device<speaker_sound_device> m_speaker;
3552
3653   UINT16 m_r;
3754   UINT16 m_o;
3855
56   UINT16 m_leds_state[0x10];
57   UINT16 m_leds_cache[0x10];
58   UINT8 m_leds_decay[0x100];
59
3960   DECLARE_READ8_MEMBER(read_k);
4061   DECLARE_WRITE16_MEMBER(write_o);
4162   DECLARE_WRITE16_MEMBER(write_r);
4263
64   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
65   void leds_update();
66
4367   virtual void machine_start();
4468};
4569
r243203r243204
4771
4872/***************************************************************************
4973
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
50150  I/O
51151
52152***************************************************************************/
53153
54154READ8_MEMBER(splitsec_state::read_k)
55155{
56   return 0;
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;
57164}
58165
59166WRITE16_MEMBER(splitsec_state::write_r)
60167{
168   // R8: speaker out
169   m_speaker->level_w(data >> 8 & 1);
170
171   // R9,R10: input mux
172   // R0-R7: led columns
61173   m_r = data;
174   leds_update();
62175}
63176
64177WRITE16_MEMBER(splitsec_state::write_o)
65178{
179   // O0-O6: led rows
180   // O7: N/C
66181   m_o = data;
182   leds_update();
67183}
68184
69185
r243203r243204
75191***************************************************************************/
76192
77193static 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 )
78205INPUT_PORTS_END
79206
80207
r243203r243204
87214
88215void splitsec_state::machine_start()
89216{
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
90222   m_r = 0;
91223   m_o = 0;
92224
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
93230   save_item(NAME(m_r));
94231   save_item(NAME(m_o));
95232}
r243203r243204
103240   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o))
104241   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r))
105242
243   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", splitsec_state, leds_decay_tick, attotime::from_msec(10))
244
106245   MCFG_DEFAULT_LAYOUT(layout_splitsec)
107246
108247   /* no video! */
r243203r243204
123262
124263ROM_START( splitsec )
125264   ROM_REGION( 0x1000, "maincpu", 0 )
126   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(0cccdf59) SHA1(06a533134a433aaf856b80f0ca239d0498b98d5f) )
265   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(e94b2098) SHA1(f0fc1f56a829252185592a2508740354c50bedf8) )
127266
128267   ROM_REGION( 867, "maincpu:mpla", 0 )
129268   ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) )
r243203r243204
132271ROM_END
133272
134273
135CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
274CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE )
trunk/src/mess/drivers/starwbc.c
r243203r243204
186186
187187static INPUT_PORTS_START( starwbc )
188188   PORT_START("IN.0") // R0
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")
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")
193193
194194   PORT_START("IN.1") // R1
195   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Start Turn")
195   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) 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_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("End Turn")
198   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) 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_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
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
203203   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
204   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up")
204   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up")
205205
206206   PORT_START("IN.3") // R5
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")
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")
211211
212212   PORT_START("IN.4") // R7
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")
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")
217217INPUT_PORTS_END
218218
219219
trunk/src/mess/drivers/stopthie.c
r243203r243204
185185
186186static INPUT_PORTS_START( stopthief )
187187   PORT_START("IN.0") // O0
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")
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")
193193
194194   PORT_START("IN.1") // O6
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")
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")
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_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)
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)
208208INPUT_PORTS_END
209209
210210
trunk/src/mess/drivers/tandy12.c
r243203r243204
130130
131131static INPUT_PORTS_START( tandy12 )
132132   PORT_START("IN.0") // R5
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")
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")
137137
138138   PORT_START("IN.1") // R6
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")
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")
143143
144144   PORT_START("IN.2") // R7
145   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2")
145   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) 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_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")
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")
155155
156156   PORT_START("IN.4") // R9
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")
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")
161161INPUT_PORTS_END
162162
163163
trunk/src/mess/drivers/tispeak.c
r243203r243204
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
r243203r243204
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-???e4-00.e71", 0x0000, 0x2000, NO_DUMP) // rom is unique to vt101
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)
762762   //e69 socket is empty/unpopulated on vt101?
763763   //e67 socket is empty/unpopulated on vt101?
764764
trunk/src/mess/includes/apricotp.h
r243203r243204
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);
9596   DECLARE_READ16_MEMBER( mem_r );
9697   DECLARE_WRITE16_MEMBER( mem_w );
9798   DECLARE_READ8_MEMBER( prtr_snd_r );
trunk/src/mess/includes/banctec.h
r0r243204
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
r243203r243204
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
r243203r243204
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"
1617#include "sound/nes_apu.h"
17#include "imagedev/cassette.h"
1818
1919/***************************************************************************
2020    CONSTANTS
r243203r243204
3030    TYPE DEFINITIONS
3131***************************************************************************/
3232
33struct nes_input
34{
35   UINT32 shift;
36   UINT32 i0, i1, i2;
37};
38
3933/*PPU fast banking constants and structures */
4034
4135#define CHRROM 0
r243203r243204
5751class nes_state : public driver_device
5852{
5953public:
60   enum
61   {
62      TIMER_ZAPPER_TICK,
63      TIMER_LIGHTGUN_TICK
64   };
65
6654   nes_state(const machine_config &mconfig, device_type type, const char *tag)
6755      : driver_device(mconfig, type, tag),
6856         m_maincpu(*this, "maincpu"),
6957         m_ppu(*this, "ppu"),
7058         m_sound(*this, "nessound"),
59         m_ctrl1(*this, "ctrl1"),
60         m_ctrl2(*this, "ctrl2"),
61         m_exp(*this, "exp"),
7162         m_cartslot(*this, "nes_slot"),
72         m_disk(*this, "disk"),
73         m_cassette(*this, "tape")
63         m_disk(*this, "disk")
7464      { }
7565
7666   /* video-related */
7767   int m_last_frame_flip;
7868
7969   /* 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;
9870   ioport_port       *m_io_disksel;
9971
10072   UINT8      *m_vram;
r243203r243204
10375   required_device<cpu_device> m_maincpu;
10476   required_device<ppu2c0x_device> m_ppu;
10577   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;
10681   optional_device<nes_cart_slot_device> m_cartslot;
10782   optional_device<nes_disksys_device> m_disk;
108   optional_device<cassette_image_device> m_cassette;
10983
11084   int nes_ppu_vidaccess(int address, int data);
11185   void ppu_nmi(int *ppu_regs);
r243203r243204
11387   DECLARE_READ8_MEMBER(nes_in0_r);
11488   DECLARE_READ8_MEMBER(nes_in1_r);
11589   DECLARE_WRITE8_MEMBER(nes_in0_w);
116   DECLARE_WRITE8_MEMBER(nes_in1_w);
11790   DECLARE_READ8_MEMBER(fc_in0_r);
11891   DECLARE_READ8_MEMBER(fc_in1_r);
11992   DECLARE_WRITE8_MEMBER(fc_in0_w);
r243203r243204
127100   DECLARE_READ8_MEMBER(psg_4015_r);
128101   DECLARE_WRITE8_MEMBER(psg_4015_w);
129102   DECLARE_WRITE8_MEMBER(psg_4017_w);
130   void state_register();
131   void setup_ioports();
103   NESCTRL_BRIGHTPIXEL_CB(bright_pixel);
132104
133105   DECLARE_DRIVER_INIT(famicom);
134106
r243203r243204
139111   DECLARE_MACHINE_RESET(famitwin);
140112   void setup_disk(nes_disksys_device *slot);
141113
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
155114private:
156115   memory_bank       *m_prg_bank_mem[5];
157116};
trunk/src/mess/includes/sms.h
r243203r243204
1919#define CONTROL1_TAG   "ctrl1"
2020#define CONTROL2_TAG   "ctrl2"
2121
22#include "bus/gamegear/gear2gear.h"
22#include "bus/gamegear/ggext.h"
2323#include "bus/sms_ctrl/smsctrl.h"
2424#include "bus/sms_exp/smsexp.h"
2525#include "bus/sega8/sega8_slot.h"
r243203r243204
3737      m_region_maincpu(*this, "maincpu"),
3838      m_port_ctrl1(*this, CONTROL1_TAG),
3939      m_port_ctrl2(*this, CONTROL2_TAG),
40      m_port_gear2gear(*this, "gear2gear"),
40      m_port_gg_ext(*this, "ext"),
4141      m_port_gg_dc(*this, "GG_PORT_DC"),
4242      m_port_pause(*this, "PAUSE"),
4343      m_port_reset(*this, "RESET"),
r243203r243204
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_gear2gear_port_device> m_port_gear2gear;
69   optional_device<gg_ext_port_device> m_port_gg_ext;
7070   optional_ioport m_port_gg_dc;
7171   optional_ioport m_port_pause;
7272   optional_ioport m_port_reset;
r243203r243204
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;
8078   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;
8879   UINT8 *m_mainram;
8980   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];
9481
95   // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
96   UINT8 m_bios_page[4];
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;
9787
9888   // for gamegear LCD persistence hack
9989   bitmap_rgb32 m_prev_bitmap;
r243203r243204
10595   // vertical scaling in the gamegear sms compatibility mode.
10696   int *m_line_buffer;
10797
108   // for 3D glass binocular hack
109   bitmap_rgb32 m_prevleft_bitmap;
110   bitmap_rgb32 m_prevright_bitmap;
111
11298   // model identifiers
11399   UINT8 m_is_gamegear;
114100   UINT8 m_is_gg_region_japan;
r243203r243204
121107   UINT8 m_has_fm;
122108   UINT8 m_has_jpn_sms_cart_slot;
123109
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;
r243203r243204
132132   UINT8 m_sscope_state;
133133   UINT8 m_frame_sscope_state;
134134
135   // slot devices
135136   sega8_cart_slot_device *m_cartslot;
136137   sega8_card_slot_device *m_cardslot;
137138   sms_expansion_slot_device *m_expslot;
138139
139140   // 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];
140143   UINT8 m_store_control;
141144   UINT8 m_store_cart_selection_data;
142   sega8_cart_slot_device *m_slots[16];
143   sega8_card_slot_device *m_cards[16];
144145   void store_post_load();
145146   void store_select_cart(UINT8 data);
146147
147   /* Cartridge slot info */
148   DECLARE_WRITE8_MEMBER(sms_fm_detect_w);
149   DECLARE_READ8_MEMBER(sms_fm_detect_r);
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);
150158   DECLARE_WRITE8_MEMBER(sms_io_control_w);
151159   DECLARE_READ8_MEMBER(sms_count_r);
152160   DECLARE_READ8_MEMBER(sms_input_port_dc_r);
153161   DECLARE_READ8_MEMBER(sms_input_port_dd_r);
154162   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);
155167   DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w);
156168   DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w);
157169   DECLARE_READ8_MEMBER(sms_sscope_r);
158170   DECLARE_WRITE8_MEMBER(sms_sscope_w);
159   DECLARE_READ8_MEMBER(sms_mapper_r);
160171
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);
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);
167177
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);
172178   DECLARE_DRIVER_INIT(sg1000m3);
173179   DECLARE_DRIVER_INIT(gamegear);
174180   DECLARE_DRIVER_INIT(gamegeaj);
r243203r243204
183189   DECLARE_VIDEO_RESET(gamegear);
184190   DECLARE_VIDEO_START(sms1);
185191   DECLARE_VIDEO_RESET(sms1);
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);
192
188193   UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
189194   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);
190197   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);
196198
197199protected:
198200   UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset);
trunk/src/mess/layout/splitsec.lay
r243203r243204
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
420   <view name="Internal Layout">
5      <bounds left="0" right="100" top="0" bottom="100" />
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>
625
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
792   </view>
893</mamelayout>
trunk/src/mess/machine/amstrad.c
r243203r243204
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;
r243203r243204
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");
30373039}
30383040
30393041
r243203r243204
30763078
30773079   astring region_tag;
30783080   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");
30793083}
30803084
30813085MACHINE_RESET_MEMBER(amstrad_state,gx4000)
trunk/src/mess/machine/macadb.c
r243203r243204
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
r243203r243204
77 ****************************************************************************/
88
99#include "emu.h"
10#include "crsshair.h"
1110#include "cpu/m6502/m6502.h"
1211#include "includes/nes.h"
13#include "imagedev/flopdrv.h"
1412
1513/***************************************************************************
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/***************************************************************************
2714    FUNCTIONS
2815***************************************************************************/
2916
r243203r243204
4431      m_cartslot->pcb_reset();
4532
4633   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;
5234}
5335
5436//-------------------------------------------------
5537//  machine_start
5638//-------------------------------------------------
5739
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
11840void nes_state::machine_start()
11941{
12042   address_space &space = m_maincpu->space(AS_PROGRAM);
r243203r243204
12648   m_ciram = auto_alloc_array(machine(), UINT8, 0x800);
12749   // other pointers got set in the loading routine, because they 'belong' to the cart itself
12850
129   setup_ioports();
51   m_io_disksel = ioport("FLIPDISK");
13052
13153   if (m_cartslot && m_cartslot->m_cart)
13254   {
r243203r243204
178100      m_cartslot->m_cart->pcb_reg_postload(machine());
179101   }
180102
181   state_register();
103   // register saves
104   save_item(NAME(m_last_frame_flip));
105   save_pointer(NAME(m_ciram), 0x800);
182106}
183107
184108
r243203r243204
188112
189113READ8_MEMBER(nes_state::nes_in0_r)
190114{
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.
195115   UINT8 ret = 0x40;
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
116   ret |= m_ctrl1->read_bit0();
117   ret |= m_ctrl1->read_bit34();
228118   return ret;
229119}
230120
231121READ8_MEMBER(nes_state::nes_in1_r)
232122{
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.
237123   UINT8 ret = 0x40;
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
124   ret |= m_ctrl2->read_bit0();
125   ret |= m_ctrl2->read_bit34();
288126   return ret;
289127}
290128
291129WRITE8_MEMBER(nes_state::nes_in0_w)
292130{
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
131   m_ctrl1->write(data);
132   m_ctrl2->write(data);
365133}
366134
367135
368WRITE8_MEMBER(nes_state::nes_in1_w)
369{
370}
371
372
373136READ8_MEMBER(nes_state::fc_in0_r)
374137{
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.
380138   UINT8 ret = 0x40;
381   ret |= (m_pad_latch[0] & 0x01);
139   // bit 0 to controller port
140   ret |= m_ctrl1->read_bit0();
382141
383   // shift
384   m_pad_latch[0] >>= 1;
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);
385147
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
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);
422154   return ret;
423155}
424156
425157READ8_MEMBER(nes_state::fc_in1_r)
426158{
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.
431159   UINT8 ret = 0x40;
432   ret |= (m_pad_latch[1] & 0x01);
160   // bit 0 to controller port
161   ret |= m_ctrl2->read_bit0();
433162
434   // shift
435   m_pad_latch[1] >>= 1;
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);
436168
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
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);
521172   return ret;
522173}
523174
524175WRITE8_MEMBER(nes_state::fc_in0_w)
525176{
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
177   m_ctrl1->write(data);
178   m_ctrl2->write(data);
179   m_exp->write(data);
658180}
659181
660182
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
706183DRIVER_INIT_MEMBER(nes_state,famicom)
707184{
708185   // setup alt input handlers for additional FC input devices
r243203r243204
711188   space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this));
712189   space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this));
713190}
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
r243203r243204
9494      data1 = m_port_gg_dc->read();
9595      m_port_dc_reg &= ~0x03f | data1;
9696
97      data2 = m_port_gear2gear->port_r();
97      data2 = m_port_gg_ext->port_r();
9898   }
9999   else
100100   {
r243203r243204
207207      if (!m_is_gamegear)
208208         m_port_ctrl2->port_w(ctrl2_port_data);
209209      else
210         m_port_gear2gear->port_w(ctrl2_port_data); // not verified
210         m_port_gg_ext->port_w(ctrl2_port_data); // not verified
211211   }
212212   // check if TH is set to input (1).
213213   if (data & 0x08)
r243203r243204
215215      if (!m_is_gamegear)
216216         ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r();
217217      else
218         ctrl2_port_data &= ~0x40 | m_port_gear2gear->port_r(); // not verified
218         ctrl2_port_data &= ~0x40 | m_port_gg_ext->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
r243203r243204
5454jaguar  // Atari Jaguar
5555jaguarcd  // Atari Jaguar CD
5656
57//BancTec
58banctec // BancTec ESeries panel
59
5760// Nintendo
5861nes       // Nintendo Entertainment System
5962nespal    // Nintendo Entertainment System PAL
r243203r243204
771774compc1  // 1984 Commodore PC-1
772775pc10iii // 1987 Commodore PC-10 III
773776pc7000  // 1985 Sharp PC-7000
774pcd     // Siemens PC-D
775777olypeopl // Olympia People PC
776778sx16    // Sanyo SX-16
777779mbc16   // Sanyo MBC-16
778780ataripc3
779781ssam88s
780782
783// Non-PC msdos
784pcd     // Siemens PC-D
785slicer  // 1983 Slicer Computers
786
781787// PC Junior
782788ibmpcjr   // 1984 IBM PC Jr
783789ibmpcjx   // 1985 IBM PC JX
trunk/src/mess/mess.mak
r243203r243204
614614BUSES += MSX_SLOT
615615BUSES += NEOGEO
616616BUSES += NES
617BUSES += NES_CTRL
617618BUSES += NUBUS
618619BUSES += O2
619620BUSES += ORICEXT
r243203r243204
678679   $(MESSOBJ)/att.a \
679680   $(MESSOBJ)/bally.a \
680681   $(MESSOBJ)/bandai.a \
682   $(MESSOBJ)/banctec.a \
681683   $(MESSOBJ)/be.a \
682684   $(MESSOBJ)/bnpo.a \
683685   $(MESSOBJ)/bondwell.a \
r243203r243204
796798   $(MESSOBJ)/siemens.a \
797799   $(MESSOBJ)/sinclair.a \
798800   $(MESSOBJ)/skeleton.a \
801   $(MESSOBJ)/slicer.a \
799802   $(MESSOBJ)/snk.a \
800803   $(MESSOBJ)/sony.a \
801804   $(MESSOBJ)/sord.a \
r243203r243204
10401043$(MESSOBJ)/bally.a:             \
10411044   $(MESS_DRIVERS)/astrocde.o  \
10421045
1046$(MESSOBJ)/banctec.a:            \
1047   $(MESS_DRIVERS)/banctec.o    \
1048
10431049$(MESSOBJ)/bandai.a:            \
10441050   $(MESS_DRIVERS)/sv8000.o    \
10451051   $(MESS_DRIVERS)/rx78.o      \
r243203r243204
16481654$(MESSOBJ)/siemens.a:           \
16491655   $(MESS_DRIVERS)/pcd.o       \
16501656
1657$(MESSOBJ)/slicer.a:           \
1658   $(MESS_DRIVERS)/slicer.o   \
1659
16511660$(MESSOBJ)/snk.a:               \
16521661   $(MESS_DRIVERS)/ng_aes.o    \
16531662   $(MESS_DRIVERS)/ngp.o $(MESS_VIDEO)/k1ge.o \
trunk/src/osd/modules/debugger/debug_module.h
r0r243204
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
r243203r243204
1010*********************************************************************/
1111
1212#include "emu.h"
13#include "debugint.h"
1413#include "ui/ui.h"
1514#include "rendfont.h"
1615#include "uiinput.h"
r243203r243204
2221#include "debug/debugcon.h"
2322#include "debug/debugcpu.h"
2423
24#include "debug_module.h"
25#include "modules/osdmodule.h"
2526
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
2651/***************************************************************************
2752    CONSTANTS
2853***************************************************************************/
2954
30const osd_debugger_type OSD_DEBUGGER_INTERNAL = &osd_debugger_creator<debugger_internal>;
31
3255#define BORDER_YTHICKNESS 1
3356#define BORDER_XTHICKNESS 1
3457#define HSB_HEIGHT 20
r243203r243204
239262    LOCAL VARIABLES
240263***************************************************************************/
241264
242static render_font *    debug_font;
265static render_font *    debug_font = NULL;
243266static int              debug_font_width;
244267static int              debug_font_height;
245268static float            debug_font_aspect;
246static DView *          list;
269static DView *          list = NULL;
247270static DView *          focus_view;
248271
249272static ui_menu *        menu;
r243203r243204
841864#endif
842865}
843866
844void debugger_internal::debugger_exit()
867void debug_internal::exit()
845868{
846869   for (DView *ndv = list; ndv != NULL; )
847870   {
r243203r243204
858881      global_free(menu);
859882}
860883
861void debugger_internal::init_debugger(running_machine &machine)
884void debug_internal::init_debugger(running_machine &machine)
862885{
863886   unicode_char ch;
864887   int chw;
r243203r243204
14101433}
14111434
14121435
1413void debugger_internal::wait_for_debugger(device_t &device, bool firststop)
1436void debug_internal::wait_for_debugger(device_t &device, bool firststop)
14141437{
14151438   if (firststop && list == NULL)
14161439   {
r243203r243204
14431466
14441467}
14451468
1446void debugger_internal::debugger_update()
1469void debug_internal::debugger_update()
14471470{
1448   if (!debug_cpu_is_stopped(*m_machine) && m_machine->phase() == MACHINE_PHASE_RUNNING)
1471   if ((m_machine != NULL) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING))
14491472   {
14501473      update_views();
14511474   }
14521475}
14531476
1454//-------------------------------------------------
1455//  debugger_internal - constructor
1456//-------------------------------------------------
1457debugger_internal::debugger_internal(const osd_interface &osd)
1458   : osd_debugger_interface(osd), m_machine(NULL)
1459{
1460}
1477MODULE_DEFINITION(DEBUG_INTERNAL, debug_internal)
trunk/src/osd/modules/debugger/debugint.h
r243203r243204
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
r243203r243204
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
388370#endif // __SDL_DEBUGOSX__
trunk/src/osd/modules/debugger/debugosx.m
r243203r243204
4242// MAMEOS headers
4343#include "debugosx.h"
4444#include "osdsdl.h"
45#include "debug_module.h"
4546
47//============================================================
48//  MODULE SUPPORT
49//============================================================
4650
51static MAMEDebugConsole *main_console = nil;
4752
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
4879//============================================================
4980//  LOCAL VARIABLES
5081//============================================================
5182
52static MAMEDebugConsole *main_console = nil;
5383
5484static BOOL waiting_for_debugger = NO;
5585
r243203r243204
6797
6898static void console_create_window(running_machine &machine);
6999
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
80100//============================================================
81101//  debugger_osx::init_debugger
82102//============================================================
r243203r243204
131151}
132152
133153//============================================================
134//  debugger_exit
135//============================================================
136
137void debugger_osx::debugger_exit()
138{
139}
140
141//============================================================
142154//  debugwin_view_update
143155//============================================================
144156
trunk/src/osd/modules/debugger/debugqt.c
r243203r243204
1111
1212#define NO_MEM_TRACKING
1313
14#include "debug_module.h"
15#include "modules/osdmodule.h"
16
17#if (USE_QTDEBUG)
18
1419#include <vector>
1520
1621#include <QtGui/QtGui>
r243203r243204
2833#include "qt/debugqtbreakpointswindow.h"
2934#include "qt/debugqtdeviceswindow.h"
3035#include "qt/debugqtdeviceinformationwindow.h"
31#include "debugqt.h"
3236
33
34osd_debugger_interface *qt_osd_debugger_creator(const osd_interface &osd)
37class debug_qt : public osd_module, public debug_module
3538{
36   return new debugger_qt(osd);
37}
38const osd_debugger_type OSD_DEBUGGER_QT = &qt_osd_debugger_creator;
39public:
40   debug_qt()
41   : osd_module(OSD_DEBUG_PROVIDER, "qt"), debug_module(),
42      m_machine(NULL)
43   {
44   }
3945
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
4059//============================================================
4160//  "Global" variables to make QT happy
4261//============================================================
r243203r243204
4766bool oneShot = true;
4867static MainWindow* mainQtWindow = NULL;
4968
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
6269//============================================================
6370//  XML configuration save/load
6471//============================================================
r243203r243204
228235bool winwindow_qt_filter(void *message);
229236#endif
230237
231void debugger_qt::init_debugger(running_machine &machine)
238void debug_qt::init_debugger(running_machine &machine)
232239{
233240   if (qApp == NULL)
234241   {
r243203r243204
269276void winwindow_update_cursor_state(running_machine &machine);
270277#endif
271278
272void debugger_qt::wait_for_debugger(device_t &device, bool firststop)
279void debug_qt::wait_for_debugger(device_t &device, bool firststop)
273280{
274281#if defined(SDLMAME_UNIX) || defined(SDLMAME_WIN32)
275282   sdl_entered_debugger = 1;
r243203r243204
344351//  Available for video.*
345352//============================================================
346353
347void debugger_qt::debugger_update()
354void debug_qt::debugger_update()
348355{
349356   qApp->processEvents(QEventLoop::AllEvents, 1);
350357}
351358
352void debugger_qt::debugger_exit()
353{
354}
359#else /* SDLMAME_UNIX */
360   MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt")
361#endif
362
363MODULE_DEFINITION(DEBUG_QT, debug_qt)
trunk/src/osd/modules/debugger/debugqt.h
r243203r243204
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
r243203r243204
66//
77//============================================================
88
9#include "debug_module.h"
10#include "modules/osdmodule.h"
11
12#if defined(OSD_WINDOWS) /*|| defined(SDLMAME_WIN32)*/
13
914// standard windows headers
1015#define WIN32_LEAN_AND_MEAN
1116#include <windows.h>
r243203r243204
3641#include "strconv.h"
3742#include "winutf8.h"
3843
39#include "debugwin.h"
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   }
4052
41const osd_debugger_type OSD_DEBUGGER_WINDOWS = &osd_debugger_creator<debugger_windows>;
53   virtual ~debugger_windows() { }
4254
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};
4365//============================================================
4466//  PARAMETERS
4567//============================================================
r243203r243204
174196//  LOCAL VARIABLES
175197//============================================================
176198
177static debugwin_info *window_list;
199static debugwin_info *window_list = NULL;
178200static debugwin_info *main_console;
179201static UINT32 main_console_regwidth;
180202
r243203r243204
239261static void image_update_menu(debugwin_info *info);
240262
241263
242//-------------------------------------------------
243//  debugger_windows - constructor
244//-------------------------------------------------
245debugger_windows::debugger_windows(const osd_interface &osd)
246   : osd_debugger_interface(osd)
247{
248}
249
250264//============================================================
251265//  wait_for_debugger
252266//============================================================
r243203r243204
453467//  debugwin_destroy_windows
454468//============================================================
455469
456void debugger_windows::debugger_exit()
470void debugger_windows::exit()
457471{
458472   // loop over windows and free them
459473   while (window_list != NULL)
r243203r243204
30793093   for (info = window_list; info != NULL; info = info->next)
30803094      smart_show_window(info->wnd, show);
30813095}
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
r243203r243204
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
r243203r243204
44//
55//============================================================
66
7#include "none.h"
7#include "debug_module.h"
8#include "modules/osdmodule.h"
9
810#include "debug/debugcpu.h"
911
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)
12class debug_none : public osd_module, public debug_module
1713{
18}
14public:
15   debug_none()
16   : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(),
17      m_machine(NULL)
18   {
19   }
1920
20void debugger_none::init_debugger(running_machine &machine)
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)
2135{
22    m_machine = &machine;
36   m_machine = &machine;
2337}
2438
25void debugger_none::wait_for_debugger(device_t &device, bool firststop)
39void debug_none::wait_for_debugger(device_t &device, bool firststop)
2640{
2741   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
2842}
2943
30void debugger_none::debugger_update()
44void debug_none::debugger_update()
3145{
3246}
3347
34void debugger_none::debugger_exit()
35{
36}
48MODULE_DEFINITION(DEBUG_NONE, debug_none)
trunk/src/osd/modules/debugger/none.h
r243203r243204
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/font/font_module.h
r0r243204
1/*
2 * font_module.h
3 *
4 */
5
6#ifndef FONT_MODULE_H_
7#define FONT_MODULE_H_
8
9#include "osdepend.h"
10#include "modules/osdmodule.h"
11
12//============================================================
13//  CONSTANTS
14//============================================================
15
16#define OSD_FONT_PROVIDER   "uifontprovider"
17
18class font_module
19{
20public:
21   virtual ~font_module() { }
22   virtual osd_font *font_alloc() = 0;
23};
24
25
26#endif /* FONT_MODULE_H_ */
trunk/src/osd/modules/font/font_none.c
r0r243204
1/*
2 * font_sdl.c
3 *
4 */
5
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9//-------------------------------------------------
10//  font_open - attempt to "open" a handle to the
11//  font with the given name
12//-------------------------------------------------
13
14class osd_font_none : public osd_font
15{
16public:
17   virtual ~osd_font_none() {};
18
19   virtual bool open(const char *font_path, const char *name, int &height);
20   virtual void close();
21   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
22private:
23};
24
25bool osd_font_none::open(const char *font_path, const char *_name, int &height)
26{
27   return false;
28}
29
30//-------------------------------------------------
31//  font_close - release resources associated with
32//  a given OSD font
33//-------------------------------------------------
34
35void osd_font_none::close()
36{
37}
38
39//-------------------------------------------------
40//  font_get_bitmap - allocate and populate a
41//  BITMAP_FORMAT_ARGB32 bitmap containing the
42//  pixel values rgb_t(0xff,0xff,0xff,0xff)
43//  or rgb_t(0x00,0xff,0xff,0xff) for each
44//  pixel of a black & white font
45//-------------------------------------------------
46
47bool osd_font_none::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
48{
49   return false;
50}
51
52class font_none : public osd_module, public font_module
53{
54public:
55   font_none()
56   : osd_module(OSD_FONT_PROVIDER, "none"), font_module()
57   {
58   }
59
60   osd_font *font_alloc()
61   {
62      return global_alloc(osd_font_none);
63   }
64};
65
66MODULE_DEFINITION(FONT_NONE, font_none)
trunk/src/osd/modules/font/font_osx.c
r0r243204
1/*
2 * font_sdl.c
3 *
4 */
5
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9#ifdef SDLMAME_MACOSX
10
11#include <Carbon/Carbon.h>
12
13#include "astring.h"
14#include "corealloc.h"
15#include "fileio.h"
16
17#define POINT_SIZE 144.0
18#define EXTRA_HEIGHT 1.0
19#define EXTRA_WIDTH 1.15
20
21//-------------------------------------------------
22//  font_open - attempt to "open" a handle to the
23//  font with the given name
24//-------------------------------------------------
25
26class osd_font_osx : public osd_font
27{
28public:
29   virtual ~osd_font_osx() {};
30
31   virtual bool open(const char *font_path, const char *name, int &height);
32   virtual void close();
33   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
34private:
35   CTFontRef m_font;
36};
37
38bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
39{
40   CFStringRef font_name = NULL;
41   CTFontRef ct_font = NULL;
42   CTFontDescriptorRef font_descriptor;
43   CGAffineTransform affine_transform = CGAffineTransformIdentity;
44
45   m_font = NULL;
46   astring name(_name);
47   printf("FONT NAME %s\n", _name);
48#if 0
49   if (name == "default")
50   {
51      name = "LucidaGrande";
52   }
53#endif
54   /* handle bdf fonts in the core */
55   if (name.len() > 4)
56      if (name.makeupper().substr(name.len()-4,4) == ".BDF" )
57         return false;
58
59   font_name = CFStringCreateWithCString( NULL, name.cstr(), kCFStringEncodingUTF8 );
60   if( font_name != NULL )
61   {
62      font_descriptor = CTFontDescriptorCreateWithNameAndSize( font_name, 0.0); //POINT_SIZE );
63
64      if( font_descriptor != NULL )
65      {
66         ct_font = CTFontCreateWithFontDescriptor( font_descriptor, POINT_SIZE, &affine_transform );
67
68         CFRelease( font_descriptor );
69      }
70   }
71
72   CFRelease( font_name );
73
74   if (!ct_font)
75   {
76      osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.cstr());
77      return false;
78   }
79
80   CFStringRef real_name = CTFontCopyPostScriptName( ct_font );
81   char real_name_c_string[255];
82   CFStringGetCString ( real_name, real_name_c_string, 255, kCFStringEncodingUTF8 );
83   osd_printf_verbose("Matching font: %s\n", real_name_c_string);
84   CFRelease( real_name );
85
86   CGFloat line_height = 0.0;
87   line_height += CTFontGetAscent(ct_font);
88   line_height += CTFontGetDescent(ct_font);
89   line_height += CTFontGetLeading(ct_font);
90   height = ceilf(line_height * EXTRA_HEIGHT);
91
92   m_font = ct_font;
93   return true;
94}
95
96//-------------------------------------------------
97//  font_close - release resources associated with
98//  a given OSD font
99//-------------------------------------------------
100
101void osd_font_osx::close()
102{
103   if( m_font != NULL )
104   {
105      CFRelease( m_font );
106   }
107}
108
109//-------------------------------------------------
110//  font_get_bitmap - allocate and populate a
111//  BITMAP_FORMAT_ARGB32 bitmap containing the
112//  pixel values rgb_t(0xff,0xff,0xff,0xff)
113//  or rgb_t(0x00,0xff,0xff,0xff) for each
114//  pixel of a black & white font
115//-------------------------------------------------
116
117bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
118{
119   UniChar uni_char;
120   CGGlyph glyph;
121   CTFontRef ct_font = m_font;
122   const CFIndex count = 1;
123   CGRect bounding_rect, success_rect;
124   CGContextRef context_ref;
125
126   if( chnum == ' ' )
127   {
128      uni_char = 'n';
129      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
130      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
131      uni_char = chnum;
132      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
133   }
134   else
135   {
136      uni_char = chnum;
137      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
138      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
139   }
140
141   if( CGRectEqualToRect( success_rect, CGRectNull ) == false )
142   {
143      size_t bitmap_width;
144      size_t bitmap_height;
145
146      bitmap_width = ceilf(bounding_rect.size.width * EXTRA_WIDTH);
147      bitmap_width = bitmap_width == 0 ? 1 : bitmap_width;
148
149      bitmap_height = ceilf( (CTFontGetAscent(ct_font) + CTFontGetDescent(ct_font) + CTFontGetLeading(ct_font)) * EXTRA_HEIGHT);
150
151      xoffs = yoffs = 0;
152      width = bitmap_width;
153
154      size_t bits_per_component;
155      CGColorSpaceRef color_space;
156      CGBitmapInfo bitmap_info = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;
157
158      color_space = CGColorSpaceCreateDeviceRGB();
159      bits_per_component = 8;
160
161      bitmap.allocate(bitmap_width, bitmap_height);
162
163      context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info );
164
165      if( context_ref != NULL )
166      {
167         CGFontRef font_ref;
168         font_ref = CTFontCopyGraphicsFont( ct_font, NULL );
169         CGContextSetTextPosition(context_ref, -bounding_rect.origin.x*EXTRA_WIDTH, CTFontGetDescent(ct_font)+CTFontGetLeading(ct_font) );
170         CGContextSetRGBFillColor(context_ref, 1.0, 1.0, 1.0, 1.0);
171         CGContextSetFont( context_ref, font_ref );
172         CGContextSetFontSize( context_ref, POINT_SIZE );
173         CGContextShowGlyphs( context_ref, &glyph, count );
174         CGFontRelease( font_ref );
175         CGContextRelease( context_ref );
176      }
177
178      CGColorSpaceRelease( color_space );
179   }
180
181   return bitmap.valid();
182}
183
184
185class font_osx : public osd_module, public font_module
186{
187public:
188   font_osx()
189   : osd_module(OSD_FONT_PROVIDER, "osx"), font_module()
190   {
191   }
192
193   osd_font *font_alloc()
194   {
195      return global_alloc(osd_font_osx);
196   }
197
198};
199#else /* SDLMAME_UNIX */
200   MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx")
201#endif
202
203MODULE_DEFINITION(FONT_OSX, font_osx)
trunk/src/osd/modules/font/font_sdl.c
r0r243204
1/*
2 * font_sdl.c
3 *
4 */
5
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9#if defined(SDLMAME_UNIX) && (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_SOLARIS)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
10
11#if (SDLMAME_SDL2)
12#include <SDL2/SDL_ttf.h>
13#else
14#include <SDL/SDL_ttf.h>
15#endif
16#ifndef SDLMAME_HAIKU
17#include <fontconfig/fontconfig.h>
18#endif
19
20
21#include "astring.h"
22#include "corealloc.h"
23#include "fileio.h"
24
25#define POINT_SIZE 144.0
26
27//-------------------------------------------------
28//  font_open - attempt to "open" a handle to the
29//  font with the given name
30//-------------------------------------------------
31
32class osd_font_sdl : public osd_font
33{
34public:
35   virtual ~osd_font_sdl() {};
36
37   virtual bool open(const char *font_path, const char *name, int &height);
38   virtual void close();
39   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
40private:
41#ifndef SDLMAME_HAIKU
42   TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles);
43#endif
44   bool BDF_Check_Magic(astring name);
45   TTF_Font * TTF_OpenFont_Magic(astring name, int fsize);
46   TTF_Font *m_font;
47};
48
49bool osd_font_sdl::open(const char *font_path, const char *_name, int &height)
50{
51   TTF_Font *font = (TTF_Font *)NULL;
52   bool bakedstyles = false;
53   int style = 0;
54
55   // accept qualifiers from the name
56   astring name(_name);
57
58   if (name == "default")
59   {
60      name = "Liberation Sans";
61   }
62
63   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
64   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
65   bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0);
66   bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0);
67
68   // first up, try it as a filename
69   font = TTF_OpenFont_Magic(name, POINT_SIZE);
70
71   // if no success, try the font path
72
73   if (!font)
74   {
75      osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH);
76      //emu_file file(options().font_path(), OPEN_FLAG_READ);
77      emu_file file(font_path, OPEN_FLAG_READ);
78      if (file.open(name) == FILERR_NONE)
79      {
80         astring full_name = file.fullpath();
81         font = TTF_OpenFont_Magic(full_name, POINT_SIZE);
82         if (font)
83            osd_printf_verbose("Found font %s\n", full_name.cstr());
84      }
85   }
86
87   // if that didn't work, crank up the FontConfig database
88#ifndef SDLMAME_HAIKU
89   if (!font)
90   {
91      font = search_font_config(name, bold, italic, underline, bakedstyles);
92   }
93#endif
94
95   if (!font)
96   {
97      if (!BDF_Check_Magic(name))
98      {
99         osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr());
100      }
101      return NULL;
102   }
103
104   // apply styles
105   if (!bakedstyles)
106   {
107      style |= bold ? TTF_STYLE_BOLD : 0;
108      style |= italic ? TTF_STYLE_ITALIC : 0;
109   }
110   style |= underline ? TTF_STYLE_UNDERLINE : 0;
111   // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH
112#if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9)
113   style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
114#else
115   if (strike)
116      osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n");
117#endif // PATCHLEVEL
118   TTF_SetFontStyle(font, style);
119
120   height = TTF_FontLineSkip(font);
121
122   m_font = font;
123   return true;
124}
125
126//-------------------------------------------------
127//  font_close - release resources associated with
128//  a given OSD font
129//-------------------------------------------------
130
131void osd_font_sdl::close()
132{
133   TTF_CloseFont(this->m_font);
134}
135
136//-------------------------------------------------
137//  font_get_bitmap - allocate and populate a
138//  BITMAP_FORMAT_ARGB32 bitmap containing the
139//  pixel values rgb_t(0xff,0xff,0xff,0xff)
140//  or rgb_t(0x00,0xff,0xff,0xff) for each
141//  pixel of a black & white font
142//-------------------------------------------------
143
144bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
145{
146   TTF_Font *ttffont;
147   SDL_Surface *drawsurf;
148   SDL_Color fcol = { 0xff, 0xff, 0xff };
149   UINT16 ustr[16];
150
151   ttffont = m_font;
152
153   memset(ustr,0,sizeof(ustr));
154   ustr[0] = (UINT16)chnum;
155   drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);
156
157   // was nothing returned?
158   if (drawsurf)
159   {
160      // allocate a MAME destination bitmap
161      bitmap.allocate(drawsurf->w, drawsurf->h);
162
163      // copy the rendered character image into it
164      for (int y = 0; y < bitmap.height(); y++)
165      {
166         UINT32 *dstrow = &bitmap.pix32(y);
167         UINT8 *srcrow = (UINT8 *)drawsurf->pixels;
168
169         srcrow += (y * drawsurf->pitch);
170
171         for (int x = 0; x < drawsurf->w; x++)
172         {
173            dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff);
174         }
175      }
176
177      // what are these?
178      xoffs = yoffs = 0;
179      width = drawsurf->w;
180
181      SDL_FreeSurface(drawsurf);
182   }
183
184   return bitmap.valid();
185}
186
187TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize)
188{
189   emu_file file(OPEN_FLAG_READ);
190   if (file.open(name) == FILERR_NONE)
191   {
192      unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
193      unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 };
194      file.read(buffer,5);
195      if (memcmp(buffer, magic, 5))
196         return NULL;
197   }
198   return TTF_OpenFont(name.cstr(), POINT_SIZE);
199}
200
201bool osd_font_sdl::BDF_Check_Magic(astring name)
202{
203   emu_file file(OPEN_FLAG_READ);
204   if (file.open(name) == FILERR_NONE)
205   {
206      unsigned char buffer[9];
207      unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' };
208      file.read(buffer, 9);
209      file.close();
210      if (!memcmp(buffer, magic, 9))
211         return true;
212   }
213
214   return false;
215}
216
217#ifndef SDLMAME_HAIKU
218TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles)
219{
220   TTF_Font *font = (TTF_Font *)NULL;
221   FcConfig *config;
222   FcPattern *pat;
223   FcObjectSet *os;
224   FcFontSet *fontset;
225   FcValue val;
226
227   config = FcConfigGetCurrent();
228   pat = FcPatternCreate();
229   os = FcObjectSetCreate();
230   FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
231
232   // try and get a font with the requested styles baked-in
233   if (bold)
234   {
235      if (italic)
236      {
237         FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic");
238      }
239      else
240      {
241         FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold");
242      }
243   }
244   else if (italic)
245   {
246      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic");
247   }
248   else
249   {
250      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular");
251   }
252
253   FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
254
255   FcObjectSetAdd(os, FC_FILE);
256   fontset = FcFontList(config, pat, os);
257
258   for (int i = 0; i < fontset->nfont; i++)
259   {
260      if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch)
261      {
262         continue;
263      }
264
265      if (val.type != FcTypeString)
266      {
267         continue;
268      }
269
270      osd_printf_verbose("Matching font: %s\n", val.u.s);
271      {
272         astring match_name((const char*)val.u.s);
273         font = TTF_OpenFont_Magic(match_name, POINT_SIZE);
274      }
275
276      if (font)
277      {
278         bakedstyles = true;
279         break;
280      }
281   }
282
283   // didn't get a font above?  try again with no baked-in styles
284   if (!font)
285   {
286      FcPatternDestroy(pat);
287      FcFontSetDestroy(fontset);
288
289      pat = FcPatternCreate();
290      FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
291      FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular");
292      FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
293      fontset = FcFontList(config, pat, os);
294
295      for (int i = 0; i < fontset->nfont; i++)
296      {
297         if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch)
298         {
299            continue;
300         }
301
302         if (val.type != FcTypeString)
303         {
304            continue;
305         }
306
307         osd_printf_verbose("Matching unstyled font: %s\n", val.u.s);
308         {
309            astring match_name((const char*)val.u.s);
310            font = TTF_OpenFont_Magic(match_name, POINT_SIZE);
311         }
312
313         if (font)
314         {
315            break;
316         }
317      }
318   }
319
320   FcPatternDestroy(pat);
321   FcObjectSetDestroy(os);
322   FcFontSetDestroy(fontset);
323   return font;
324}
325#endif
326
327
328class font_sdl : public osd_module, public font_module
329{
330public:
331   font_sdl()
332   : osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
333   {
334   }
335
336   osd_font *font_alloc()
337   {
338      return global_alloc(osd_font_sdl);
339   }
340
341   int init()
342   {
343      if (TTF_Init() == -1)
344      {
345         osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError());
346         return -1;
347      }
348      return 0;
349   }
350
351   virtual void exit()
352   {
353      TTF_Quit();
354   }
355};
356#else /* SDLMAME_UNIX */
357   MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl")
358#endif
359
360MODULE_DEFINITION(FONT_SDL, font_sdl)
trunk/src/osd/modules/font/font_windows.c
r0r243204
1/*
2 * font_sdl.c
3 *
4 */
5
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
10
11#define WIN32_LEAN_AND_MEAN
12#include <windows.h>
13#include <commctrl.h>
14#include <mmsystem.h>
15#include <tchar.h>
16#include <io.h>
17
18#include "font_module.h"
19#include "modules/osdmodule.h"
20
21#include "strconv.h"
22#include "astring.h"
23#include "corealloc.h"
24#include "fileio.h"
25
26//#define POINT_SIZE 144.0
27#define DEFAULT_FONT_HEIGHT (200)
28
29//-------------------------------------------------
30//  font_open - attempt to "open" a handle to the
31//  font with the given name
32//-------------------------------------------------
33
34class osd_font_windows : public osd_font
35{
36public:
37   virtual ~osd_font_windows() {};
38
39   virtual bool open(const char *font_path, const char *name, int &height);
40   virtual void close();
41   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
42private:
43   HGDIOBJ m_font;
44};
45
46bool osd_font_windows::open(const char *font_path, const char *_name, int &height)
47{
48   // accept qualifiers from the name
49   astring name(_name);
50   if (name == "default") name = "Tahoma";
51   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
52   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
53
54   // build a basic LOGFONT description of what we want
55   LOGFONT logfont;
56   logfont.lfHeight = DEFAULT_FONT_HEIGHT;
57   logfont.lfWidth = 0;
58   logfont.lfEscapement = 0;
59   logfont.lfOrientation = 0;
60   logfont.lfWeight = bold ? FW_BOLD : FW_MEDIUM;
61   logfont.lfItalic = italic;
62   logfont.lfUnderline = FALSE;
63   logfont.lfStrikeOut = FALSE;
64   logfont.lfCharSet = ANSI_CHARSET;
65   logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
66   logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
67   logfont.lfQuality = NONANTIALIASED_QUALITY;
68   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
69
70   // copy in the face name
71   TCHAR *face = tstring_from_utf8(name);
72   _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
73   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
74   osd_free(face);
75
76   // create the font
77   height = logfont.lfHeight;
78   m_font = CreateFontIndirect(&logfont);
79   if (m_font == NULL)
80      return false;
81
82   // select it into a temp DC and get the real font name
83   HDC dummyDC = CreateCompatibleDC(NULL);
84   HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
85   TCHAR realname[100];
86   GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname);
87   SelectObject(dummyDC, oldfont);
88   DeleteDC(dummyDC);
89
90   // if it doesn't match our request, fail
91   char *utf = utf8_from_tstring(realname);
92   int result = core_stricmp(utf, name);
93   osd_free(utf);
94
95   // if we didn't match, nuke our font and fall back
96   if (result != 0)
97   {
98      DeleteObject(m_font);
99      m_font = NULL;
100      return false;
101   }
102   return true;
103}
104
105//-------------------------------------------------
106//  font_close - release resources associated with
107//  a given OSD font
108//-------------------------------------------------
109
110void osd_font_windows::close()
111{
112   // delete the font ojbect
113   if (m_font != NULL)
114      DeleteObject(m_font);
115
116}
117
118//-------------------------------------------------
119//  font_get_bitmap - allocate and populate a
120//  BITMAP_FORMAT_ARGB32 bitmap containing the
121//  pixel values rgb_t(0xff,0xff,0xff,0xff)
122//  or rgb_t(0x00,0xff,0xff,0xff) for each
123//  pixel of a black & white font
124//-------------------------------------------------
125
126bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
127{
128   // create a dummy DC to work with
129   HDC dummyDC = CreateCompatibleDC(NULL);
130   HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
131
132   // get the text metrics
133   TEXTMETRIC metrics = { 0 };
134   GetTextMetrics(dummyDC, &metrics);
135
136   // get the width of this character
137   ABC abc;
138   if (!GetCharABCWidths(dummyDC, chnum, chnum, &abc))
139   {
140      abc.abcA = 0;
141      abc.abcC = 0;
142      GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast<LPINT>(&abc.abcB));
143   }
144   width = abc.abcA + abc.abcB + abc.abcC;
145
146   // determine desired bitmap size
147   int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31;
148   int bmheight = 50 + metrics.tmHeight + 50;
149
150   // describe the bitmap we want
151   BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER)+2 * sizeof(RGBQUAD)] = { 0 };
152   BITMAPINFO &info = *reinterpret_cast<BITMAPINFO *>(bitmapinfodata);
153   info.bmiHeader.biSize = sizeof(info.bmiHeader);
154   info.bmiHeader.biWidth = bmwidth;
155   info.bmiHeader.biHeight = -bmheight;
156   info.bmiHeader.biPlanes = 1;
157   info.bmiHeader.biBitCount = 1;
158   info.bmiHeader.biCompression = BI_RGB;
159   info.bmiHeader.biSizeImage = 0;
160   info.bmiHeader.biXPelsPerMeter = GetDeviceCaps(dummyDC, HORZRES) / GetDeviceCaps(dummyDC, HORZSIZE);
161   info.bmiHeader.biYPelsPerMeter = GetDeviceCaps(dummyDC, VERTRES) / GetDeviceCaps(dummyDC, VERTSIZE);
162   info.bmiHeader.biClrUsed = 0;
163   info.bmiHeader.biClrImportant = 0;
164   RGBQUAD col1 = info.bmiColors[0];
165   RGBQUAD col2 = info.bmiColors[1];
166   col1.rgbBlue = col1.rgbGreen = col1.rgbRed = 0x00;
167   col2.rgbBlue = col2.rgbGreen = col2.rgbRed = 0xff;
168
169   // create a DIB to render to
170   BYTE *bits;
171   HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
172   HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
173
174   // clear the bitmap
175   int rowbytes = bmwidth / 8;
176   memset(bits, 0, rowbytes * bmheight);
177
178   // now draw the character
179   WCHAR tempchar = chnum;
180   SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff));
181   SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00));
182   ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL);
183
184   // characters are expected to be full-height
185   rectangle actbounds;
186   actbounds.min_y = 50;
187   actbounds.max_y = 50 + metrics.tmHeight - 1;
188
189   // determine the actual left of the character
190   for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++)
191   {
192      BYTE *offs = bits + actbounds.min_x;
193      UINT8 summary = 0;
194      for (int y = 0; y < bmheight; y++)
195         summary |= offs[y * rowbytes];
196      if (summary != 0)
197      {
198         actbounds.min_x *= 8;
199         if (!(summary & 0x80)) actbounds.min_x++;
200         if (!(summary & 0xc0)) actbounds.min_x++;
201         if (!(summary & 0xe0)) actbounds.min_x++;
202         if (!(summary & 0xf0)) actbounds.min_x++;
203         if (!(summary & 0xf8)) actbounds.min_x++;
204         if (!(summary & 0xfc)) actbounds.min_x++;
205         if (!(summary & 0xfe)) actbounds.min_x++;
206         break;
207      }
208   }
209
210   // determine the actual right of the character
211   for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--)
212   {
213      BYTE *offs = bits + actbounds.max_x;
214      UINT8 summary = 0;
215      for (int y = 0; y < bmheight; y++)
216         summary |= offs[y * rowbytes];
217      if (summary != 0)
218      {
219         actbounds.max_x *= 8;
220         if (summary & 0x7f) actbounds.max_x++;
221         if (summary & 0x3f) actbounds.max_x++;
222         if (summary & 0x1f) actbounds.max_x++;
223         if (summary & 0x0f) actbounds.max_x++;
224         if (summary & 0x07) actbounds.max_x++;
225         if (summary & 0x03) actbounds.max_x++;
226         if (summary & 0x01) actbounds.max_x++;
227         break;
228      }
229   }
230
231   // allocate a new bitmap
232   if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y)
233   {
234      bitmap.allocate(actbounds.max_x + 1 - actbounds.min_x, actbounds.max_y + 1 - actbounds.min_y);
235
236      // copy the bits into it
237      for (int y = 0; y < bitmap.height(); y++)
238      {
239         UINT32 *dstrow = &bitmap.pix32(y);
240         UINT8 *srcrow = &bits[(y + actbounds.min_y) * rowbytes];
241         for (int x = 0; x < bitmap.width(); x++)
242         {
243            int effx = x + actbounds.min_x;
244            dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? rgb_t(0xff, 0xff, 0xff, 0xff) : rgb_t(0x00, 0xff, 0xff, 0xff);
245         }
246      }
247
248      // set the final offset values
249      xoffs = actbounds.min_x - (50 + abc.abcA);
250      yoffs = actbounds.max_y - (50 + metrics.tmAscent);
251   }
252
253   // de-select the font and release the DC
254   SelectObject(dummyDC, oldbitmap);
255   DeleteObject(dib);
256   SelectObject(dummyDC, oldfont);
257   DeleteDC(dummyDC);
258   return bitmap.valid();
259}
260
261class font_win : public osd_module, public font_module
262{
263public:
264   font_win()
265   : osd_module(OSD_FONT_PROVIDER, "win"), font_module()
266   {
267   }
268
269   osd_font *font_alloc()
270   {
271      return global_alloc(osd_font_windows);
272   }
273
274};
275#else /* SDLMAME_UNIX */
276   MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win")
277#endif
278
279MODULE_DEFINITION(FONT_WINDOWS, font_win)
trunk/src/osd/modules/lib/osdlib.h
r243203r243204
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/*-----------------------------------------------------------------------------
6350    osd_setenv: set environment variable
6451
6552    Parameters:
trunk/src/osd/modules/lib/osdlib_macosx.c
r243203r243204
1// This file is a placeholder.
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//============================================================
211
12#include <stdlib.h>
13#include <unistd.h>
14#include <sys/mman.h>
315#include <sys/types.h>
416#include <signal.h>
5#include <unistd.h>
617
718#include <mach/mach.h>
819#include <mach/mach_time.h>
r243203r243204
1829#include "sdlinc.h"
1930
2031//============================================================
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//============================================================
2150//  osd_process_kill
2251//============================================================
2352
2453void osd_process_kill(void)
2554{
26    kill(getpid(), SIGKILL);
55   kill(getpid(), SIGKILL);
2756}
2857
2958//============================================================
r243203r243204
3261
3362int osd_get_num_processors(void)
3463{
35    int processors = 1;
64   int processors = 1;
3665
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;
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;
4170
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);
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);
4978
50    return processors;
79   return processors;
5180}
5281
5382//============================================================
r243203r243204
5786void *osd_malloc(size_t size)
5887{
5988#ifndef MALLOC_DEBUG
60    return malloc(size);
89   return malloc(size);
6190#else
6291#error "MALLOC_DEBUG not yet supported"
6392#endif
r243203r243204
71100void *osd_malloc_array(size_t size)
72101{
73102#ifndef MALLOC_DEBUG
74    return malloc(size);
103   return malloc(size);
75104#else
76105#error "MALLOC_DEBUG not yet supported"
77106#endif
r243203r243204
85114void osd_free(void *ptr)
86115{
87116#ifndef MALLOC_DEBUG
88    free(ptr);
117   free(ptr);
89118#else
90119#error "MALLOC_DEBUG not yet supported"
91120#endif
92121}
93122
123
94124//============================================================
95//  osd_getenv
125//  osd_alloc_executable
126//
127//  allocates "size" bytes of executable memory.  this must take
128//  things like NX support into account.
96129//============================================================
97130
98char *osd_getenv(const char *name)
131void *osd_alloc_executable(size_t size)
99132{
100    return getenv(name);
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
101138}
102139
103140//============================================================
104//  osd_setenv
141//  osd_free_executable
142//
143//  frees memory allocated with osd_alloc_executable
105144//============================================================
106145
107int osd_setenv(const char *name, const char *value, int overwrite)
146void osd_free_executable(void *ptr, size_t size)
108147{
109    return setenv(name, value, overwrite);
148#ifdef SDLMAME_SOLARIS
149   munmap((char *)ptr, size);
150#else
151   munmap(ptr, size);
152#endif
110153}
111154
112155//============================================================
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//============================================================
113172//  PROTOTYPES
114173//============================================================
115174
r243203r243204
132191
133192static osd_ticks_t init_cycle_counter(void)
134193{
135    osd_ticks_t start, end;
136    osd_ticks_t a, b;
194   osd_ticks_t start, end;
195   osd_ticks_t a, b;
137196
138    cycle_counter = mach_cycle_counter;
139    ticks_counter = mach_cycle_counter;
197   cycle_counter = mach_cycle_counter;
198   ticks_counter = mach_cycle_counter;
140199
141    // wait for an edge on the timeGetTime call
142    a = SDL_GetTicks();
143    do
144    {
145        b = SDL_GetTicks();
146    } while (a == b);
200   // wait for an edge on the timeGetTime call
201   a = SDL_GetTicks();
202   do
203   {
204      b = SDL_GetTicks();
205   } while (a == b);
147206
148    // get the starting cycle count
149    start = (*cycle_counter)();
207   // get the starting cycle count
208   start = (*cycle_counter)();
150209
151    // now wait for 1/4 second total
152    do
153    {
154        a = SDL_GetTicks();
155    } while (a - b < 250);
210   // now wait for 1/4 second total
211   do
212   {
213      a = SDL_GetTicks();
214   } while (a - b < 250);
156215
157    // get the ending cycle count
158    end = (*cycle_counter)();
216   // get the ending cycle count
217   end = (*cycle_counter)();
159218
160    // compute ticks_per_sec
161    ticks_per_second = (end - start) * 4;
219   // compute ticks_per_sec
220   ticks_per_second = (end - start) * 4;
162221
163    // return the current cycle count
164    return (*cycle_counter)();
222   // return the current cycle count
223   return (*cycle_counter)();
165224}
166225
167226//============================================================
r243203r243204
173232//============================================================
174233static osd_ticks_t mach_cycle_counter(void)
175234{
176    return mach_absolute_time();
235   return mach_absolute_time();
177236}
178237
179238//============================================================
180//   osd_cycles
239//   osd_ticks
181240//============================================================
182241
183242osd_ticks_t osd_ticks(void)
184243{
185    return (*cycle_counter)();
244   return (*cycle_counter)();
186245}
187246
188247
r243203r243204
192251
193252osd_ticks_t osd_ticks_per_second(void)
194253{
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;
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;
201260}
202261
203262
r243203r243204
208267
209268void osd_sleep(osd_ticks_t duration)
210269{
211    UINT32 msec;
270   UINT32 msec;
212271
213    // make sure we've computed ticks_per_second
214    if (ticks_per_second == 0)
215        (void)osd_ticks();
272   // make sure we've computed ticks_per_second
273   if (ticks_per_second == 0)
274      (void)osd_ticks();
216275
217    // convert to milliseconds, rounding down
218    msec = (UINT32)(duration * 1000 / ticks_per_second);
276   // convert to milliseconds, rounding down
277   msec = (UINT32)(duration * 1000 / ticks_per_second);
219278
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    }
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   }
227286}
228
trunk/src/osd/modules/lib/osdlib_os2.c
r243203r243204
1// This file is a placeholder.
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//============================================================
211
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
324// MAME headers
25#include "osdcore.h"
426#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
r243203r243204
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
212#include <stdlib.h>
313#include <unistd.h>
r243203r243204
1828//  osd_getenv
1929//============================================================
2030
21char *osd_getenv(const char *name)
31const char *osd_getenv(const char *name)
2232{
23    return getenv(name);
33   return getenv(name);
2434}
2535
2636//============================================================
r243203r243204
2939
3040int osd_setenv(const char *name, const char *value, int overwrite)
3141{
32    return setenv(name, value, overwrite);
42   return setenv(name, value, overwrite);
3343}
3444
3545//============================================================
36//  osd_num_processors
46//  osd_process_kill
3747//============================================================
3848
39int osd_get_num_processors(void)
49void osd_process_kill(void)
4050{
41    int processors = 1;
42
43#if defined(_SC_NPROCESSORS_ONLN)
44    processors = sysconf(_SC_NPROCESSORS_ONLN);
45#endif
46    return processors;
51   kill(getpid(), SIGKILL);
4752}
4853
4954//============================================================
50//  osd_process_kill
55//  osd_num_processors
5156//============================================================
5257
53void osd_process_kill(void)
58int osd_get_num_processors(void)
5459{
55    kill(getpid(), SIGKILL);
60   int processors = 1;
61
62#if defined(_SC_NPROCESSORS_ONLN)
63   processors = sysconf(_SC_NPROCESSORS_ONLN);
64#endif
65   return processors;
5666}
5767
5868//============================================================
r243203r243204
6272void *osd_malloc(size_t size)
6373{
6474#ifndef MALLOC_DEBUG
65    return malloc(size);
75   return malloc(size);
6676#else
6777#error "MALLOC_DEBUG not yet supported"
6878#endif
r243203r243204
7686void *osd_malloc_array(size_t size)
7787{
7888#ifndef MALLOC_DEBUG
79    return malloc(size);
89   return malloc(size);
8090#else
8191#error "MALLOC_DEBUG not yet supported"
8292#endif
r243203r243204
90100void osd_free(void *ptr)
91101{
92102#ifndef MALLOC_DEBUG
93    free(ptr);
103   free(ptr);
94104#else
95105#error "MALLOC_DEBUG not yet supported"
96106#endif
97107}
98108
99109//============================================================
100//   osd_cycles
110//  osd_alloc_executable
111//
112//  allocates "size" bytes of executable memory.  this must take
113//  things like NX support into account.
101114//============================================================
102115
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
103160osd_ticks_t osd_ticks(void)
104161{
105162#ifdef SDLMAME_EMSCRIPTEN
106        return (osd_ticks_t)(emscripten_get_now() * 1000.0);
163      return (osd_ticks_t)(emscripten_get_now() * 1000.0);
107164#else
108        struct timeval    tp;
109        static osd_ticks_t start_sec = 0;
165      struct timeval    tp;
166      static osd_ticks_t start_sec = 0;
110167
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;
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;
115172#endif
116173}
117174
175
176//============================================================
177//  osd_ticks_per_second
178//============================================================
179
118180osd_ticks_t osd_ticks_per_second(void)
119181{
120    return (osd_ticks_t) 1000000;
182   return (osd_ticks_t) 1000000;
121183}
122184
123185//============================================================
r243203r243204
126188
127189void osd_sleep(osd_ticks_t duration)
128190{
129    UINT32 msec;
191   UINT32 msec;
130192
131    // convert to milliseconds, rounding down
132    msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
193   // convert to milliseconds, rounding down
194   msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
133195
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    }
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   }
141203}
trunk/src/osd/modules/lib/osdlib_win32.c
r243203r243204
11//============================================================
22//
3//  winos.c - Win32 OS specific low level code
3//  sdlos_*.c - 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//
510//============================================================
611
712#define WIN32_LEAN_AND_MEAN
r243203r243204
1823#include "osdcomm.h"
1924#include "osdcore.h"
2025
26#ifdef OSD_WINDOWS
27#include "winutf8.h"
28#endif
29
2130//============================================================
2231//  MACROS
2332//============================================================
r243203r243204
2837// align allocations to start or end of the page?
2938#define GUARD_ALIGN_START   0
3039
40
3141//============================================================
32//  osd_num_processors
42//  GLOBAL VARIABLES
3343//============================================================
3444
35int osd_get_num_processors(void)
36{
37    SYSTEM_INFO info;
45#ifdef OSD_WINDOWS
46void (*s_debugger_stack_crawler)() = NULL;
47#endif
3848
39    // otherwise, fetch the info from the system
40    GetSystemInfo(&info);
4149
42    // max out at 4 for now since scaling above that seems to do poorly
43    return MIN(info.dwNumberOfProcessors, 4);
44}
45
4650//============================================================
4751//  osd_getenv
4852//============================================================
4953
50char *osd_getenv(const char *name)
54const char *osd_getenv(const char *name)
5155{
52    return getenv(name);
56   return getenv(name);
5357}
5458
59
5560//============================================================
5661//  osd_setenv
5762//============================================================
5863
5964int osd_setenv(const char *name, const char *value, int overwrite)
6065{
61    char *buf;
62    int result;
66   char *buf;
67   int result;
6368
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);
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);
7277
73    /* will be referenced by environment
74     * Therefore it is not freed here
75     */
78   /* will be referenced by environment
79    * Therefore it is not freed here
80    */
7681
77    return result;
82   return result;
7883}
7984
8085//============================================================
r243203r243204
8388
8489void osd_process_kill(void)
8590{
86    TerminateProcess(GetCurrentProcess(), -1);
91   TerminateProcess(GetCurrentProcess(), -1);
8792}
8893
8994//============================================================
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//============================================================
90110//  osd_malloc
91111//============================================================
92112
93113void *osd_malloc(size_t size)
94114{
95115#ifndef MALLOC_DEBUG
96    return HeapAlloc(GetProcessHeap(), 0, size);
116   return HeapAlloc(GetProcessHeap(), 0, size);
97117#else
98    // add in space for the size
99    size += sizeof(size_t);
118   // add in space for the size
119   size += sizeof(size_t);
100120
101    // basic objects just come from the heap
102    void *result = HeapAlloc(GetProcessHeap(), 0, size);
121   // basic objects just come from the heap
122   void *result = HeapAlloc(GetProcessHeap(), 0, size);
103123
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);
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);
107127#endif
108128}
109129
r243203r243204
115135void *osd_malloc_array(size_t size)
116136{
117137#ifndef MALLOC_DEBUG
118    return HeapAlloc(GetProcessHeap(), 0, size);
138   return HeapAlloc(GetProcessHeap(), 0, size);
119139#else
120    // add in space for the size
121    size += sizeof(size_t);
140   // add in space for the size
141   size += sizeof(size_t);
122142
123    // round the size up to a page boundary
124    size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
143   // round the size up to a page boundary
144   size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
125145
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;
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;
130150
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;
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;
135155
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);
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);
138158
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);
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);
142162#endif
143163}
144164
r243203r243204
150170void osd_free(void *ptr)
151171{
152172#ifndef MALLOC_DEBUG
153    HeapFree(GetProcessHeap(), 0, ptr);
173   HeapFree(GetProcessHeap(), 0, ptr);
154174#else
155    size_t size = reinterpret_cast<size_t *>(ptr)[-1];
175   size_t size = reinterpret_cast<size_t *>(ptr)[-1];
156176
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));
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));
160180
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    }
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   }
167187#endif
168188}
169189
170190
171191//============================================================
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//============================================================
172240//  GLOBAL VARIABLES
173241//============================================================
174242
r243203r243204
184252
185253osd_ticks_t osd_ticks(void)
186254{
187    LARGE_INTEGER performance_count;
255   LARGE_INTEGER performance_count;
188256
189    // if we're suspended, just return that
190    if (suspend_ticks != 0)
191        return suspend_ticks;
257   // if we're suspended, just return that
258   if (suspend_ticks != 0)
259      return suspend_ticks;
192260
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        }
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      }
202270
203        // otherwise, fall back to timeGetTime
204        else
205            return (osd_ticks_t)timeGetTime() - suspend_ticks;
206    }
271      // otherwise, fall back to timeGetTime
272      else
273         return (osd_ticks_t)timeGetTime() - suspend_ticks;
274   }
207275
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;
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;
214282
215    // call ourselves to get the first value
216    return osd_ticks();
283   // call ourselves to get the first value
284   return osd_ticks();
217285}
218286
219287
r243203r243204
223291
224292osd_ticks_t osd_ticks_per_second(void)
225293{
226    if (ticks_per_second == 0)
227        osd_ticks();
228    return ticks_per_second;
294   if (ticks_per_second == 0)
295      osd_ticks();
296   return ticks_per_second;
229297}
230298
231
232299//============================================================
233300//  osd_sleep
234301//============================================================
235302
236303void osd_sleep(osd_ticks_t duration)
237304{
238    DWORD msec;
305   DWORD msec;
239306
240    // make sure we've computed ticks_per_second
241    if (ticks_per_second == 0)
242        (void)osd_ticks();
307   // make sure we've computed ticks_per_second
308   if (ticks_per_second == 0)
309      (void)osd_ticks();
243310
244    // convert to milliseconds, rounding down
245    msec = (DWORD)(duration * 1000 / ticks_per_second);
311   // convert to milliseconds, rounding down
312   msec = (DWORD)(duration * 1000 / ticks_per_second);
246313
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);
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);
252319
253        // take a couple of msecs off the top for good measure
254        msec -= 2;
320      // take a couple of msecs off the top for good measure
321      msec -= 2;
255322
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    }
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   }
262329}
trunk/src/osd/modules/lib/osdobj_common.c
r243203r243204
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"
1714#include "modules/lib/osdobj_common.h"
1815
1916extern bool g_print_verbose;
2017
2118const options_entry osd_options::s_option_entries[] =
2219{
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" },
20   { NULL,                                   NULL,       OPTION_HEADER,     "OSD FONT OPTIONS" },
21   { OSD_FONT_PROVIDER,                      "auto",     OPTION_STRING,     "provider for ui font: " },
2622
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" },
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" },
3126
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" },
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" },
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
r243203r243204
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 ); }
109110
110111void osd_common_t::register_options()
111112{
112    // Register video options and update options
113    video_options_add("none", NULL);
114    video_register();
115    update_option(OSDOPTION_VIDEO, m_video_names);
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);
116117
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);
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);
121122
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);
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);
127158}
128159
129160void osd_common_t::update_option(const char * key, dynamic_array<const char *> &values)
r243203r243204
155186   for(int i= 0; i < m_video_names.count(); ++i)
156187      osd_free(const_cast<char*>(m_video_names[i]));
157188   //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();
166189}
167190
168191
r243203r243204
243266   // is active. This gives any OSD debugger interface a chance to
244267   // create all of its structures.
245268   //
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
254269   m_debugger->init_debugger(machine());
255270}
256271
r243203r243204
276291   if (m_debugger) m_debugger->debugger_update();
277292}
278293
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}
288294
289295//-------------------------------------------------
290296//  update_audio_stream - update the stereo audio
r243203r243204
298304   // It provides an array of stereo samples in L-R order which should be
299305   // output at the configured sample_rate.
300306   //
301    if (m_sound != NULL)
302        m_sound->update_audio_stream(buffer,samples_this_frame);
307   m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
303308}
304309
305310
r243203r243204
316321   //    while (attenuation++ < 0)
317322   //       volume /= 1.122018454;      //  = (10 ^ (1/20)) = 1dB
318323   //
319    if (m_sound != NULL)
320        m_sound->set_mastervolume(attenuation);
324   if (m_sound != NULL)
325      m_sound->set_mastervolume(attenuation);
321326}
322327
323328
r243203r243204
392397
393398bool osd_common_t::execute_command(const char *command)
394399{
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    }
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   }
407412
408    return false;
413   return false;
409414
410415}
411416
r243203r243204
420425      exit(-1);
421426   }
422427
423   sound_init();
424428   input_init();
425429   // we need pause callbacks
426430   machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_common_t::input_pause), this));
r243203r243204
431435   network_init();
432436#endif
433437   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
434449}
435450
436451bool osd_common_t::video_init()
r243203r243204
443458   return true;
444459}
445460
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;
r243203r243204
467467{
468468}
469469
470void osd_common_t::sound_register()
471{
472}
473
474void osd_common_t::debugger_register()
475{
476}
477
478470bool osd_common_t::input_init()
479471{
480472   return true;
r243203r243204
501493void osd_common_t::exit_subsystems()
502494{
503495   video_exit();
504   sound_exit();
505496   input_exit();
506497   output_exit();
507498   #ifdef USE_NETWORK
508499   network_exit();
509500   #endif
510501   midi_exit();
511   debugger_exit();
512502}
513503
514504void osd_common_t::video_exit()
r243203r243204
519509{
520510}
521511
522void osd_common_t::sound_exit()
523{
524    if (m_sound != NULL)
525        global_free(m_sound);
526}
527
528512void osd_common_t::input_exit()
529513{
530514}
r243203r243204
539523
540524void osd_common_t::osd_exit()
541525{
526   m_mod_man.exit();
527
542528   exit_subsystems();
543529}
544530
r243203r243204
548534   m_video_names.append(core_strdup(name));
549535}
550536
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
563537bool osd_common_t::midi_init()
564538{
565    // this should be done on the OS_level
566    return osd_midi_init();
539   // this should be done on the OS_level
540   return osd_midi_init();
567541}
568542
569543void osd_common_t::midi_exit()
570544{
571    osd_midi_exit();
545   osd_midi_exit();
572546}
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
r243203r243204
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"
1721#include "cliopts.h"
1822
1923//============================================================
r243203r243204
5559//  TYPE DEFINITIONS
5660//============================================================
5761
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
7062class osd_options : public cli_options
7163{
7264public:
73    // construction/destruction
74    osd_options();
65   // construction/destruction
66   osd_options();
7567
76    // debugging options
77    const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
78    int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
68   // debugging options
69   const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
70   int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
7971
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); }
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); }
8476
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); }
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); }
9486
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)); }
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)); }
10496
105    // full screen options
106    bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
97   // full screen options
98   bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
10799
108    // sound options
109    const char *sound() const { return value(OSDOPTION_SOUND); }
110    int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
100   // sound options
101   const char *sound() const { return value(OSDOPTION_SOUND); }
102   int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
111103
112104private:
113    static const options_entry s_option_entries[];
105   static const options_entry s_option_entries[];
114106};
115107
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
126108// ======================> osd_interface
127109
128110// description of the currently-running machine
r243203r243204
160142   // video overridables
161143   virtual void *get_slider_list();
162144
163    // command option overrides
164    virtual bool execute_command(const char *command);
145   // command option overrides
146   virtual bool execute_command(const char *command);
165147
148   osd_font *font_alloc() { return m_font_module->font_alloc(); }
149
166150   // FIXME: everything below seems to be osd specific and not part of
167151   //        this INTERFACE but part of the osd IMPLEMENTATION
168152
169    // getters
170    running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
153   // getters
154   running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
171155
172156
173    virtual void debugger_update();
174    virtual void debugger_exit();
175    virtual void debugger_register();
157   virtual void debugger_update();
176158
177    virtual void init_subsystems();
159   virtual void init_subsystems();
178160
179    virtual bool video_init();
180    virtual void video_register();
181    virtual bool window_init();
161   virtual bool video_init();
162   virtual void video_register();
163   virtual bool window_init();
182164
183    virtual bool sound_init();
184    virtual void sound_register();
165   virtual void input_resume();
166   virtual bool output_init();
167   virtual bool network_init();
168   virtual bool midi_init();
185169
186    virtual void input_resume();
187    virtual bool output_init();
188    virtual bool network_init();
189    virtual bool midi_init();
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();
190177
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();
178   virtual void osd_exit();
199179
200    virtual void osd_exit();
180   virtual void video_options_add(const char *name, void *type);
201181
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);
182   osd_options &options() { return m_options; }
205183
206    osd_options &options() { return m_options; }
207
208184protected:
209    virtual bool input_init();
210    virtual void input_pause();
185   virtual bool input_init();
186   virtual void input_pause();
211187
212188private:
213189   // internal state
214190   running_machine *   m_machine;
215191   osd_options& m_options;
216192
193   osd_module_manager m_mod_man;
194   font_module *m_font_module;
195
217196   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   }
218210
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
219217protected:
220   osd_sound_interface* m_sound;
221   osd_debugger_interface* m_debugger;
218   sound_module* m_sound;
219   debug_module* m_debugger;
222220private:
223221   //tagmap_t<osd_video_type>  m_video_options;
224222   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;
229223};
230224
231225
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
269226// this template function creates a stub which constructs a debugger
270227template<class _DeviceClass>
271osd_debugger_interface *osd_debugger_creator(const osd_interface &osd)
228debug_module *osd_debugger_creator()
272229{
273   return global_alloc(_DeviceClass(osd));
230   return global_alloc(_DeviceClass());
274231}
275232
276233#endif  /* __OSDOBJ_COMMON_H__ */
trunk/src/osd/modules/midi/none.c
r243203r243204
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()
r243203r243204
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)
r243203r243204
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
r243203r243204
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
r0r243204
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
r0r243204
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
r243203r243204
66//
77//============================================================
88
9#include "sound_module.h"
10#include "modules/osdmodule.h"
11
12#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
13
914// standard windows headers
1015#define WIN32_LEAN_AND_MEAN
1116#include <windows.h>
r243203r243204
2126#include "osdepend.h"
2227#include "emuopts.h"
2328
24// MAMEOS headers
25#include "direct_sound.h"
26
2729#ifdef SDLMAME_WIN32
2830#include "../../sdl/osdsdl.h"
2931#if (SDLMAME_SDL2)
r243203r243204
4547
4648#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0)
4749
50class sound_direct_sound : public osd_module, public sound_module
51{
52public:
4853
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
4979//============================================================
5080//  LOCAL VARIABLES
5181//============================================================
r243203r243204
6999// buffer over/underflow counts
70100static int                  buffer_underflows;
71101static int                  buffer_overflows;
102
72103//============================================================
73104//  PROTOTYPES
74105//============================================================
75106
76const osd_sound_type OSD_SOUND_DIRECT_SOUND = &osd_sound_creator<sound_direct_sound>;
77
78107//-------------------------------------------------
79108//  sound_direct_sound - constructor
80109//-------------------------------------------------
81sound_direct_sound::sound_direct_sound(const osd_interface &osd, running_machine &machine)
82   : osd_sound_interface(osd, machine)
110
111int sound_direct_sound::init()
83112{
84113   // attempt to initialize directsound
85114   // don't make it fatal if we can't -- we'll just run without sound
86115   dsound_init();
116   return 0;
87117}
88118
89119
90sound_direct_sound::~sound_direct_sound()
120void sound_direct_sound::exit()
91121{
92122   // kill the buffers and dsound
93123   dsound_destroy_buffers();
r243203r243204
149179//  update_audio_stream
150180//============================================================
151181
152void sound_direct_sound::update_audio_stream(const INT16 *buffer, int samples_this_frame)
182void sound_direct_sound::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
153183{
154184   int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign;
155185   DWORD play_position, write_position;
r243203r243204
268298   stream_format.wBitsPerSample    = 16;
269299   stream_format.wFormatTag        = WAVE_FORMAT_PCM;
270300   stream_format.nChannels         = 2;
271   stream_format.nSamplesPerSec    = m_machine.sample_rate();
301   stream_format.nSamplesPerSec    = sample_rate();
272302   stream_format.nBlockAlign       = stream_format.wBitsPerSample * stream_format.nChannels / 8;
273303   stream_format.nAvgBytesPerSec   = stream_format.nSamplesPerSec * stream_format.nBlockAlign;
274304
275305
276306   // compute the buffer size based on the output sample rate
277307   int audio_latency;
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
308   audio_latency = m_audio_latency;
309
283310   stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * audio_latency / 10;
284311   stream_buffer_size = (stream_buffer_size / 1024) * 1024;
285312   if (stream_buffer_size < 1024)
r243203r243204
419446      IDirectSoundBuffer_Release(primary_buffer);
420447   primary_buffer = NULL;
421448}
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
r243203r243204
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
r243203r243204
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1113
12#include "js_sound.h"
14#if (defined(SDLMAME_EMSCRIPTEN))
15
1316#include "emscripten.h"
1417
15//-------------------------------------------------
16//  sound_js - constructor
17//-------------------------------------------------
18sound_js::sound_js(const osd_interface &osd)
19   : osd_sound_interface(osd)
18class sound_js : public osd_module, public sound_module
2019{
21}
20public:
2221
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}
22   sound_js()
23   : osd_module(OSD_SOUND_PROVIDER, "js"), sound_module()
24   {
25   }
26   virtual ~sound_js() { }
3027
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}
28   virtual int init();
29   virtual void exit();
3830
39const osd_sound_type OSD_SOUND_JS = &osd_sound_creator<sound_js>;
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)
trunk/src/osd/modules/sound/js_sound.h
r243203r243204
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
r243203r243204
88
99*******************************************************************c********/
1010
11#include "sound_module.h"
12#include "modules/osdmodule.h"
1113
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)
14class sound_none : public osd_module, public sound_module
1915{
20}
16public:
17   sound_none()
18   : osd_module(OSD_SOUND_PROVIDER, "none"), sound_module()
19   {
20   }
21   virtual ~sound_none() { }
2122
23   virtual int init() { return 0; }
24   virtual void exit() { }
2225
23const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;
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)
trunk/src/osd/modules/sound/none.h
r243203r243204
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
r243203r243204
99//
1010//============================================================
1111
12#include "sound_module.h"
13#include "modules/osdmodule.h"
14
15#if (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(OSD_WINDOWS))
16
1217// standard sdl header
1318#include "../../sdl/sdlinc.h"
1419
r243203r243204
1621#include "emu.h"
1722#include "emuopts.h"
1823
19#include "sdl_sound.h"
2024#include "../../sdl/osdsdl.h"
2125
2226//============================================================
r243203r243204
2630#define LOG_SOUND       0
2731
2832//============================================================
29//  PARAMETERS
33//  PROTOTYPES
3034//============================================================
3135
32// number of samples per SDL callback
33#define SDL_XFER_SAMPLES    (512)
36static void sdl_callback(void *userdata, Uint8 *stream, int len);
3437
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
4238//============================================================
43//  LOCAL VARIABLES
39//  CLASS
4440//============================================================
4541
46static int              attenuation = 0;
42class sound_sdl : public osd_module, public sound_module
43{
44public:
4745
48static int              initialized_audio = 0;
49static int              buf_locked;
46   friend void sdl_callback(void *userdata, Uint8 *stream, int len);
5047
51static INT8             *stream_buffer;
52static volatile INT32   stream_playpos;
48   // number of samples per SDL callback
49   static const int SDL_XFER_SAMPLES = 512;
5350
54static UINT32           stream_buffer_size;
55static UINT32           stream_buffer_in;
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() { }
5660
57// buffer over/underflow counts
58static int              buffer_underflows;
59static int              buffer_overflows;
61   virtual int init();
62   virtual void exit();
6063
61// debugging
62static FILE *sound_log;
64   // sound_module
6365
66   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
67   virtual void set_mastervolume(int attenuation);
6468
65// sound enable
66static int snd_enabled;
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);
6776
68//============================================================
69//  PROTOTYPES
70//============================================================
77   int sdl_xfer_samples;
78   int stream_in_initialized;
79   int stream_loop;
80   int attenuation;
7181
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);
82   int              buf_locked;
7783
78const osd_sound_type OSD_SOUND_SDL = &osd_sound_creator<sound_sdl>;
84   INT8             *stream_buffer;
85   volatile INT32   stream_playpos;
7986
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");
87   UINT32           stream_buffer_size;
88   UINT32           stream_buffer_in;
8889
89   // skip if sound disabled
90   if (m_machine.sample_rate() != 0)
91   {
92      if (initialized_audio)
93      {
94         //sound_exit();
95      }
90   // buffer over/underflow counts
91   int              buffer_underflows;
92   int              buffer_overflows;
9693
97      // attempt to initialize SDL
98      if (sdl_init(m_machine))
99         return;
10094
101      // set the startup volume
102      set_mastervolume(attenuation);
103   }
104}
95};
10596
10697
107
10898//============================================================
109//  sound_sdl - destructor
99//  PARAMETERS
110100//============================================================
111101
112sound_sdl::~sound_sdl()
113{
114   // if nothing to do, don't do it
115   if (m_machine.sample_rate() == 0)
116      return;
102// maximum audio latency
103#define MAX_AUDIO_LATENCY       5
117104
118   // kill the buffers and dsound
119   sdl_kill(m_machine);
120   sdl_destroy_buffers();
105//============================================================
106//  LOCAL VARIABLES
107//============================================================
121108
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);
109// debugging
110static FILE *sound_log;
125111
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}
112//============================================================
113//  sound_sdl - destructor
114//============================================================
132115
133116//============================================================
134117//  lock_buffer
135118//============================================================
136static int lock_buffer(running_machine &machine, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
119int sound_sdl::lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2)
137120{
138121   volatile long pstart, pend, lstart, lend;
139122
140123   if (!buf_locked)
141124   {
142      if (machine.video().throttled())
125      if (is_throttled)
143126      {
144127         pstart = stream_playpos;
145128         pend = (pstart + sdl_xfer_samples);
r243203r243204
185168//============================================================
186169//  unlock_buffer
187170//============================================================
188static void unlock_buffer(void)
171void sound_sdl::unlock_buffer(void)
189172{
190173   buf_locked--;
191174   if (!buf_locked)
r243203r243204
200183//  Apply attenuation
201184//============================================================
202185
203static void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
186void sound_sdl::att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
204187{
205188   int level= (int) (pow(10.0, (float) attenuation / 20.0) * 128.0);
206189   INT16 *d = (INT16 *) dest;
r243203r243204
216199//  copy_sample_data
217200//============================================================
218201
219static void copy_sample_data(running_machine &machine, const INT16 *data, int bytes_to_copy)
202void sound_sdl::copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy)
220203{
221204   void *buffer1, *buffer2 = (void *)NULL;
222205   long length1, length2;
223206   int cur_bytes;
224207
225208   // attempt to lock the stream buffer
226   if (lock_buffer(machine, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
209   if (lock_buffer(is_throttled, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2) < 0)
227210   {
228211      buffer_underflows++;
229212      return;
r243203r243204
264247//  update_audio_stream
265248//============================================================
266249
267void sound_sdl::update_audio_stream(const INT16 *buffer, int samples_this_frame)
250void sound_sdl::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
268251{
269252   // if nothing to do, don't do it
270   if (m_machine.sample_rate() != 0 && stream_buffer)
253   if (sample_rate() != 0 && stream_buffer)
271254   {
272255      int bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
273256      int play_position, write_position, stream_in;
r243203r243204
275258
276259      play_position = stream_playpos;
277260
278      write_position = stream_playpos + ((m_machine.sample_rate() / 50) * sizeof(INT16) * 2);
261      write_position = stream_playpos + ((sample_rate() / 50) * sizeof(INT16) * 2);
279262      orig_write = write_position;
280263
281264      if (!stream_in_initialized)
r243203r243204
336319
337320      // now we know where to copy; let's do it
338321      stream_buffer_in = stream_in;
339      copy_sample_data(m_machine, buffer, bytes_this_frame);
322      copy_sample_data(is_throttled, buffer, bytes_this_frame);
340323   }
341324}
342325
r243203r243204
371354//============================================================
372355static void sdl_callback(void *userdata, Uint8 *stream, int len)
373356{
357   sound_sdl *thiz = (sound_sdl *) userdata;
374358   int len1, len2, sb_in;
375359
376   sb_in = stream_buffer_in;
377   if (stream_loop)
378      sb_in += stream_buffer_size;
360   sb_in = thiz->stream_buffer_in;
361   if (thiz->stream_loop)
362      sb_in += thiz->stream_buffer_size;
379363
380   if (sb_in < (stream_playpos+len))
364   if (sb_in < (thiz->stream_playpos+len))
381365   {
382366      if (LOG_SOUND)
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);
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);
384368
385369      return;
386370   }
387   else if ((stream_playpos+len) > stream_buffer_size)
371   else if ((thiz->stream_playpos+len) > thiz->stream_buffer_size)
388372   {
389      len1 = stream_buffer_size - stream_playpos;
373      len1 = thiz->stream_buffer_size - thiz->stream_playpos;
390374      len2 = len - len1;
391375   }
392376   else
r243203r243204
395379      len2 = 0;
396380   }
397381
398   if (snd_enabled)
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)
399385   {
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
386      memcpy(stream+len1, thiz->stream_buffer, len2);
387      memset(thiz->stream_buffer, 0, len2); // no longer needed
408388   }
409   else
410   {
411      memset(stream, 0, len);
412   }
413389
390
414391   // move the play cursor
415   stream_playpos += len1 + len2;
416   if (stream_playpos >= stream_buffer_size)
392   thiz->stream_playpos += len1 + len2;
393   if (thiz->stream_playpos >= thiz->stream_buffer_size)
417394   {
418      stream_playpos -= stream_buffer_size;
419      stream_loop = 0;
395      thiz->stream_playpos -= thiz->stream_buffer_size;
396      thiz->stream_loop = 0;
420397
421398      if (LOG_SOUND)
422399         fprintf(sound_log, "stream_loop set to 0 (stream_playpos looped)\n");
r243203r243204
424401
425402   if (LOG_SOUND)
426403      fprintf(sound_log, "callback: xfer len1 %d len2 %d, playpos %d\n",
427            len1, len2, stream_playpos);
404            len1, len2, thiz->stream_playpos);
428405}
429406
430407
431408//============================================================
432//  sdl_init
409//  sound_sdl::init
433410//============================================================
434static int sdl_init(running_machine &machine)
411
412int sound_sdl::init()
435413{
436414   int         n_channels = 2;
437415   int         audio_latency;
438416   SDL_AudioSpec   aspec, obtained;
439417   char audio_driver[16] = "";
440418
441   if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
442      osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
443      exit(-1);
444   }
419   if (LOG_SOUND)
420      sound_log = fopen(SDLMAME_SOUND_LOG, "w");
445421
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);
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      }
453429
454   initialized_audio = 0;
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);
455437
456   sdl_xfer_samples = SDL_XFER_SAMPLES;
457   stream_in_initialized = 0;
458   stream_loop = 0;
438      sdl_xfer_samples = SDL_XFER_SAMPLES;
439      stream_in_initialized = 0;
440      stream_loop = 0;
459441
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;
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;
467449
468   if (SDL_OpenAudio(&aspec, &obtained) < 0)
469      goto cant_start_audio;
450      if (SDL_OpenAudio(&aspec, &obtained) < 0)
451         goto cant_start_audio;
470452
471   initialized_audio = 1;
472   snd_enabled = 1;
453      osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
454                     obtained.freq, obtained.channels, obtained.samples);
473455
474   osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
475                  obtained.freq, obtained.channels, obtained.samples);
456      sdl_xfer_samples = obtained.samples;
476457
477   sdl_xfer_samples = obtained.samples;
458      audio_latency = m_audio_latency;
478459
479   audio_latency = downcast<sdl_options &>(machine.options()).audio_latency();
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      }
480469
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   }
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;
490475
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;
476      // create the buffers
477      if (sdl_create_buffers())
478         goto cant_create_buffers;
496479
497   // create the buffers
498   if (sdl_create_buffers())
499      goto cant_create_buffers;
480      // set the startup volume
481      set_mastervolume(attenuation);
482      osd_printf_verbose("Audio: End initialization\n");
483      return 0;
500484
501   osd_printf_verbose("Audio: End initialization\n");
502   return 0;
485      // error handling
486   cant_create_buffers:
487   cant_start_audio:
488      osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
503489
504   // error handling
505cant_create_buffers:
506cant_start_audio:
507   osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
490      return -1;
491   }
508492
509493   return 0;
510494}
r243203r243204
515499//  sdl_kill
516500//============================================================
517501
518static void sdl_kill(running_machine &machine)
502void sound_sdl::exit()
519503{
520   if (initialized_audio)
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)
521521   {
522      osd_printf_verbose("sdl_kill: closing audio\n");
523
524      SDL_CloseAudio();
522      fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
523      fclose(sound_log);
525524   }
526   SDL_QuitSubSystem(SDL_INIT_AUDIO);
527525}
528526
529527
r243203r243204
532530//  dsound_create_buffers
533531//============================================================
534532
535static int sdl_create_buffers(void)
533int sound_sdl::sdl_create_buffers(void)
536534{
537535   osd_printf_verbose("sdl_create_buffers: creating stream buffer of %u bytes\n", stream_buffer_size);
538536
r243203r243204
542540   return 0;
543541}
544542
545
546
547543//============================================================
548544//  sdl_destroy_buffers
549545//============================================================
550546
551static void sdl_destroy_buffers(void)
547void sound_sdl::sdl_destroy_buffers(void)
552548{
553549   // release the buffer
554550   if (stream_buffer)
555551      global_free_array(stream_buffer);
556552   stream_buffer = NULL;
557553}
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
r243203r243204
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
r0r243204
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
r243203r243204
160160void osd_thread_wait_free(osd_thread *thread)
161161{
162162}
163
trunk/src/osd/modules/sync/sync_ntc.c
r243203r243204
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   {
r243203r243204
531531   pthread_join(thread->thread, NULL);
532532   free(thread);
533533}
534
trunk/src/osd/modules/sync/sync_os2.c
r243203r243204
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
r243203r243204
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   {
r243203r243204
366366   SDL_WaitThread(thread->thread, &status);
367367   free(thread);
368368}
369
trunk/src/osd/modules/sync/sync_tc.c
r243203r243204
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   {
r243203r243204
389389   pthread_join(thread->thread, NULL);
390390   free(thread);
391391}
392
trunk/src/osd/modules/sync/sync_windows.c
r243203r243204
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
r243203r243204
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
r243203r243204
173173   osd_work_queue *queue;
174174   int osdthreadnum = 0;
175175   int allocthreadnum;
176   char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
176   const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
177177
178178   // allocate a new queue
179179   queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
r243203r243204
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
r243203r243204
612612   }
613613   else
614614   {
615      char *procsoverride;
616615      int numprocs = 0;
617616
618617      // if the OSDPROCESSORS environment variable is set, use that value if valid
619618      // note that we permit more than the real number of processors for testing
620      procsoverride = osd_getenv(ENV_PROCESSORS);
619      const char *procsoverride = osd_getenv(ENV_PROCESSORS);
621620      if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
622621         return MIN(4 * physprocs, numprocs);
623622
trunk/src/osd/osdcore.c
r243203r243204
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];
r243203r243204
166166   va_end(argptr);
167167}
168168#endif
169
trunk/src/osd/osdcore.h
r243203r243204
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/*-----------------------------------------------------------------------------
199213    osd_get_physical_drive_geometry: if the given path points to a physical
200214        drive, return the geometry of that drive
201215
trunk/src/osd/osdepend.h
r243203r243204
1818#include "unicode.h"
1919#include "cliopts.h"
2020
21
2122// forward references
2223class input_type_entry;     // FIXME: including emu.h does not work because emu.h includes osdepend.h
2324
r243203r243204
2627//  TYPE DEFINITIONS
2728//============================================================
2829
29// FIXME: We can do better than this
30class osd_font;
30// ======================> osd_font interface
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
3242// ======================> osd_interface
3343
3444// description of the currently-running machine
r243203r243204
5262   // input overridables
5363   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
5464
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
6065   // video overridables
6166   virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
6267
68   // font interface
69   virtual osd_font *font_alloc() = 0;
70
6371   // command option overrides
6472   virtual bool execute_command(const char *command) = 0;
6573
trunk/src/osd/osdmini/minimisc.c
r243203r243204
8181   // can't support clipboards generically
8282   return NULL;
8383}
84
trunk/src/osd/sdl/blit13.h
r243203r243204
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++) { \
r243203r243204
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
r243203r243204
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//============================================================
r243203r243204
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;
r243203r243204
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;
r243203r243204
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
r243203r243204
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)
r243203r243204
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}
r243203r243204
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;
r243203r243204
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
r243203r243204
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
r243203r243204
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;
r243203r243204
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)
r243203r243204
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//============================================================
r243203r243204
937937
938938texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags)
939939{
940
941940   // fill in the core data
942    m_renderer = renderer;
941   m_renderer = renderer;
943942   m_hash = texture_compute_hash(texsource, flags);
944943   m_flags = flags;
945944   m_texinfo = texsource;
r243203r243204
997996
998997   if (m_sdl_access == SDL_TEXTUREACCESS_STATIC)
999998   {
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;
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;
10041003   }
10051004   m_last_access = osd_ticks();
10061005
r243203r243204
10081007
10091008texture_info::~texture_info()
10101009{
1011    if ( is_pixels_owned() && (m_pixels != NULL) )
1012        free(m_pixels);
1013    SDL_DestroyTexture(m_texture_id);
1010   if ( is_pixels_owned() && (m_pixels != NULL) )
1011      free(m_pixels);
1012   SDL_DestroyTexture(m_texture_id);
10141013}
10151014
10161015//============================================================
r243203r243204
10821081
10831082#if 0
10841083   printf("tl.u %f tl.v %f\n", texcoords->tl.u, texcoords->tl.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);
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);
10881087   /* compute start and delta U,V coordinates now */
10891088#endif
10901089
r243203r243204
11621161   if (texture == NULL && prim.texture.base != NULL)
11631162   {
11641163      texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags));
1165       /* add us to the texture list */
1164      /* add us to the texture list */
11661165      m_texlist.prepend(*texture);
11671166
11681167   }
r243203r243204
11911190   if(window->primlist)
11921191   {
11931192      window->primlist->acquire_lock();
1194        sdl->m_texlist.reset();
1195        window->primlist->release_lock();
1193      sdl->m_texlist.reset();
1194      window->primlist->release_lock();
11961195   }
11971196   else
1198        sdl->m_texlist.reset();
1197      sdl->m_texlist.reset();
11991198}
trunk/src/osd/sdl/drawogl.c
r243203r243204
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
r243203r243204
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;
r243203r243204
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
r243203r243204
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
r243203r243204
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
13//============================================================
24//
35//  main.c - Win32 main program
r243203r243204
24//
3//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
4//  Visit http://mamedev.org for licensing and usage restrictions.
5//
6//  SDLMAME by Olivier Galibert and R. Belmont
7//
85//============================================================
96
107// standard windows headers
8#ifdef OSD_SDL
119#define _WIN32_WINNT 0x0400
10#endif
1211#define WIN32_LEAN_AND_MEAN
r243203r243204
3837   int i, rc;
3938   char **utf8_argv;
4039
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
4647
4748   /* convert arguments to UTF-8 */
4849   utf8_argv = (char **) malloc(argc * sizeof(*argv));
r243203r243204
6364      osd_free(utf8_argv[i]);
6465   free(utf8_argv);
6566
67#ifdef OSD_SDL
6668#ifdef MALLOC_DEBUG
6769   {
6870      void check_unfreed_mem(void);
r243203r243204
7173   winalloc_in_main_code = FALSE;
7274}
7375#endif
76#endif
7477
7578   return rc;
7679}
trunk/src/osd/sdl/man/castool.1
r243203r243204
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH CASTOOL 1 2014-12-15 0.157 "MESS Generic cassette manipulation tool"
9.TH CASTOOL 1 2015-01-18 0.158 "MESS Generic cassette manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/chdman.1
r243203r243204
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 2014-12-15 0.157 "MAME Compressed Hunks of Data (CHD) manager"
9.TH CHDMAN 1 2015-01-18 0.158 "MAME Compressed Hunks of Data (CHD) manager"
1010.\"
1111.\" NAME chapter
1212.SH NAME
trunk/src/osd/sdl/man/floptool.1
r243203r243204
66.\" Cesare Falco <c.falco@ubuntu.com>, April 2014
77.\"
88.\"
9.TH FLOPTOOL 1 2014-12-15 0.157 "MESS Generic floppy manipulation tool"
9.TH FLOPTOOL 1 2015-01-18 0.158 "MESS Generic floppy manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/imgtool.1
r243203r243204
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH IMGTOOL 1 2014-12-15 0.157 "MESS media image manipulation tool"
9.TH IMGTOOL 1 2015-01-18 0.158 "MESS media image manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/jedutil.1
r243203r243204
88.\" References
99.\" http://aarongiles.com/?p=159
1010.\"
11.TH JEDUTIL 1 2014-12-15 0.157 "MAME JEDEC file utilities"
11.TH JEDUTIL 1 2015-01-18 0.158 "MAME JEDEC file utilities"
1212.\"
1313.\" NAME chapter
1414.SH NAME
trunk/src/osd/sdl/man/ldresample.1
r243203r243204
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 2014-12-15 0.157 "MAME laserdisc audio manipulation tool"
6.TH LDRESAMPLE 1 2015-01-18 0.158 "MAME laserdisc audio manipulation tool"
77.\"
88.\" Please adjust this date whenever revising the manpage.
99.\"
trunk/src/osd/sdl/man/ldverify.1
r243203r243204
55.\" Man page created from source and usage information by
66.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
77.\"
8.TH LDVERIFY 1 2014-12-15 0.157 "MAME laserdisc data checker"
8.TH LDVERIFY 1 2015-01-18 0.158 "MAME laserdisc data checker"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/man/mame.6
r243203r243204
1313.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
1414.\"
1515.\"
16.TH MAME 6 2014-12-15 0.157 "MAME \- The Multiple Arcade Machine Emulator"
16.TH MAME 6 2015-01-18 0.158 "MAME \- The Multiple Arcade Machine Emulator"
1717.\"
1818.\"
1919.\" NAME chapter
trunk/src/osd/sdl/man/mess.6
r243203r243204
1616.\" http://www.mess.org/
1717.\"
1818.\"
19.TH MESS 6 2014-12-15 0.157 "The Multiple Emulator Super System (MESS)"
19.TH MESS 6 2015-01-18 0.158 "The Multiple Emulator Super System (MESS)"
2020.\"
2121.\"
2222.\" NAME chapter
trunk/src/osd/sdl/man/romcmp.1
r243203r243204
99.\" References
1010.\" http://www.mame.net/mamefaq.html
1111.\"
12.TH ROMCMP 1 2014-12-15 0.157 "MAME romset checking tool"
12.TH ROMCMP 1 2015-01-18 0.158 "MAME romset checking tool"
1313.\"
1414.\" NAME chapter
1515.SH NAME
trunk/src/osd/sdl/man/testkeys.1
r243203r243204
55.\" Man page created from source and usage information
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
77.\"
8.TH TESTKEYS 1 2014-12-15 0.157 "MAME SDL keycode scanner"
8.TH TESTKEYS 1 2015-01-18 0.158 "MAME SDL keycode scanner"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/netdev_pcap.c
r243203r243204
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
919class netdev_pcap : public netdev
1020{
1121public:
r243203r243204
2434   : netdev(ifdev, rate)
2535{
2636   char errbuf[PCAP_ERRBUF_SIZE];
27   m_p = pcap_open_live(name, 65535, 1, 1, errbuf);
37   m_p = pcap_open_live_dl(name, 65535, 1, 1, errbuf);
2838   if(!m_p)
2939   {
3040      osd_printf_verbose("Unable to open %s: %s\n", name, errbuf);
3141      return;
3242   }
33   if(pcap_set_datalink(m_p, DLT_EN10MB) == -1)
43   if(pcap_set_datalink_dl(m_p, DLT_EN10MB) == -1)
3444   {
35      osd_printf_verbose("Unable to set %s to ethernet", name);
36      pcap_close(m_p);
45      osd_printf_verbose("Unable to set %s to ethernet\n", name);
46      pcap_close_dl(m_p);
3747      m_p = NULL;
3848      return;
3949   }
r243203r243204
4656   struct bpf_program fp;
4757   if(!m_p) return;
4858   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]);
49   pcap_compile(m_p, &fp, filter, 1, 0);
50   pcap_setfilter(m_p, &fp);
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   }
5165}
5266
5367int netdev_pcap::send(UINT8 *buf, int len)
5468{
5569   if(!m_p) return 0;
56   return (!pcap_sendpacket(m_p, buf, len))?len:0;
70   return (!pcap_sendpacket_dl(m_p, buf, len))?len:0;
5771}
5872
5973int netdev_pcap::recv_dev(UINT8 **buf)
6074{
6175   struct pcap_pkthdr *header;
6276   if(!m_p) return 0;
63   return (pcap_next_ex(m_p, &header, (const u_char **)buf) == 1)?header->len:0;
77   return (pcap_next_ex_dl(m_p, &header, (const u_char **)buf) == 1)?header->len:0;
6478}
6579
6680netdev_pcap::~netdev_pcap()
6781{
68   if(m_p) pcap_close(m_p);
82   if(m_p) pcap_close_dl(m_p);
6983}
7084
7185static CREATE_NETDEV(create_pcap)
r243203r243204
7892{
7993   pcap_if_t *devs;
8094   char errbuf[PCAP_ERRBUF_SIZE];
81   if(pcap_findalldevs(&devs, errbuf) == -1)
95   if(pcap_findalldevs_dl(&devs, errbuf) == -1)
8296   {
8397      osd_printf_verbose("Unable to get network devices: %s\n", errbuf);
8498      return;
8599   }
86100
87   if (devs)
101   while(devs)
88102   {
89      while(devs->next)
90      {
91         add_netdev(devs->name, devs->description, create_pcap);
92         devs = devs->next;
93      }
103      add_netdev(devs->name, devs->description, create_pcap);
104      devs = devs->next;
94105   }
95106}
96107
trunk/src/osd/sdl/netdev_pcap_osx.c
r243203r243204
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
1120struct netdev_pcap_context {
1221   UINT8 *pkt;
1322   int len;
r243203r243204
6170   : netdev(ifdev, rate)
6271{
6372   char errbuf[PCAP_ERRBUF_SIZE];
64   m_p = pcap_open_live(name, 65535, 1, 1, errbuf);
73   m_p = pcap_open_live_dl(name, 65535, 1, 1, errbuf);
6574   if(!m_p)
6675   {
6776      osd_printf_verbose("Unable to open %s: %s\n", name, errbuf);
6877      return;
6978   }
70   if(pcap_set_datalink(m_p, DLT_EN10MB) == -1)
79   if(pcap_set_datalink_dl(m_p, DLT_EN10MB) == -1)
7180   {
7281      osd_printf_verbose("Unable to set %s to ethernet\n", name);
73      pcap_close(m_p);
82      pcap_close_dl(m_p);
7483      m_p = NULL;
7584      return;
7685   }
r243203r243204
8897   struct bpf_program fp;
8998   if(!m_p) return;
9099   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]);
91   if(pcap_compile(m_p, &fp, filter, 1, 0) == -1) {
100   if(pcap_compile_dl(m_p, &fp, filter, 1, 0) == -1) {
92101      osd_printf_verbose("Error with pcap_compile\n");
93102   }
94   if(pcap_setfilter(m_p, &fp) == -1) {
103   if(pcap_setfilter_dl(m_p, &fp) == -1) {
95104      osd_printf_verbose("Error with pcap_setfilter\n");
96105   }
97106}
r243203r243204
99108int netdev_pcap::send(UINT8 *buf, int len)
100109{
101110   if(!m_p) return 0;
102   return (!pcap_sendpacket(m_p, buf, len))?len:0;
111   return (!pcap_sendpacket_dl(m_p, buf, len))?len:0;
103112}
104113
105114int netdev_pcap::recv_dev(UINT8 **buf)
r243203r243204
121130
122131netdev_pcap::~netdev_pcap()
123132{
124   if(m_p) pcap_close(m_p);
133   if(m_p) pcap_close_dl(m_p);
125134}
126135
127136static CREATE_NETDEV(create_pcap)
r243203r243204
134143{
135144   pcap_if_t *devs;
136145   char errbuf[PCAP_ERRBUF_SIZE];
137   if(pcap_findalldevs(&devs, errbuf) == -1)
146   if(pcap_findalldevs_dl(&devs, errbuf) == -1)
138147   {
139148      osd_printf_verbose("Unable to get network devices: %s\n", errbuf);
140149      return;
141150   }
142151
152#if 1
153   while(devs)
154   {
155      add_netdev(devs->name, devs->description, create_pcap);
156      devs = devs->next;
157   }
158#else
143159   if (devs)
144160   {
145161      while(devs->next)
r243203r243204
148164         devs = devs->next;
149165      }
150166   }
167#endif
151168}
152169
153170void deinit_pcap()
trunk/src/osd/sdl/osdsdl.h
r243203r243204
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"
1012
1113//============================================================
1214//  System dependent defines
r243203r243204
2830      #define SDL13_COMBINE_RESIZE (0)
2931   #endif
3032#else
31    #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
33   #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
3234   #define SDL13_COMBINE_RESIZE (0)
3335#endif
3436
r243203r243204
186188   // input overridables
187189   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
188190
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
194191   virtual void video_register();
195   virtual void sound_register();
196   virtual void debugger_register();
197192
198193   virtual bool video_init();
199194   virtual bool window_init();
r243203r243204
204199   #ifdef USE_NETWORK
205200   virtual bool network_init();
206201   #endif
207    //virtual bool midi_init();
202   //virtual bool midi_init();
208203
209204   virtual void video_exit();
210205   virtual void window_exit();
r243203r243204
213208   #ifdef USE_NETWORK
214209   virtual void network_exit();
215210   #endif
216    //virtual void midi_exit();
211   //virtual void midi_exit();
217212
218    sdl_options &options() { return m_options; }
213   sdl_options &options() { return m_options; }
219214
220215private:
221216   virtual void osd_exit();
r243203r243204
225220   // FIXME: remove machine usage
226221   void extract_video_config(running_machine &machine);
227222
223   sdl_options &m_options;
228224
229    sdl_options &m_options;
230
231225   watchdog *m_watchdog;
232226
233227};
trunk/src/osd/sdl/sdl.mak
r243203r243204
210210BASE_TARGETOS = unix
211211SYNC_IMPLEMENTATION = tc
212212SDL_NETWORK = taptun
213#SDL_NETWORK = pcap
213214
214215ifndef NO_USE_MIDI
215216INCPATH += `pkg-config --cflags alsa`
r243203r243204
245246
246247ifeq ($(TARGETOS),solaris)
247248BASE_TARGETOS = unix
248DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
249#DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
250DEFS += -DNO_AFFINITY_NP
249251SYNC_IMPLEMENTATION = tc
250252NO_USE_MIDI = 1
253NO_USE_QTDEBUG = 1
251254endif
252255
253256ifeq ($(TARGETOS),haiku)
r243203r243204
398401   $(OSDOBJ)/modules/sync \
399402   $(OSDOBJ)/modules/lib \
400403   $(OSDOBJ)/modules/midi \
404   $(OSDOBJ)/modules/font \
401405
402406#-------------------------------------------------
403407# OSD core library
r243203r243204
409413   $(SDLOBJ)/sdlfile.o     \
410414   $(SDLOBJ)/sdlptty_$(BASE_TARGETOS).o    \
411415   $(SDLOBJ)/sdlsocket.o   \
412   $(SDLOBJ)/sdlmisc_$(BASE_TARGETOS).o    \
413416   $(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
414417   $(OSDOBJ)/modules/lib/osdlib_$(SDLOS_TARGETOS).o \
415   $(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o
418   $(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
419   $(OSDOBJ)/modules/osdmodule.o \
416420
417421ifdef NOASM
418422OSDCOREOBJS += $(OSDOBJ)/modules/sync/work_mini.o
r243203r243204
426430   $(SDLMAIN) \
427431   $(SDLOBJ)/sdlmain.o \
428432   $(SDLOBJ)/input.o \
433   $(OSDOBJ)/modules/sound/js_sound.o  \
434   $(OSDOBJ)/modules/sound/direct_sound.o  \
429435   $(OSDOBJ)/modules/sound/sdl_sound.o  \
436   $(OSDOBJ)/modules/sound/none.o  \
430437   $(SDLOBJ)/video.o \
431438   $(SDLOBJ)/drawsdl.o \
432439   $(SDLOBJ)/window.o \
433440   $(SDLOBJ)/output.o \
434441   $(SDLOBJ)/watchdog.o \
435442   $(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 \
436447
437448ifdef NO_USE_MIDI
438449   OSDOBJS += $(OSDOBJ)/modules/midi/none.o
r243203r243204
597608LIBS += -lSDL_ttf
598609endif
599610
611# FIXME: should be dealt with elsewhere
600612# libs that Haiku doesn't want but are mandatory on *IX
601613ifneq ($(TARGETOS),haiku)
602BASELIBS += -lm -lutil -lpthread
603LIBS += -lm -lutil -lpthread
614BASELIBS += -lm -lpthread
615LIBS += -lm -lpthread
616ifneq ($(TARGETOS),solaris)
617BASELIBS += -lutil
618LIBS += -lutil
619else
620SUPPORTSM32M64 = 1
621BASELIBS += -lsocket -lnsl
622LIBS += -lsocket -lnsl
604623endif
624endif
605625
626
606627endif # not Mac OS X
607628
608629ifneq (,$(findstring ppc,$(UNAME)))
r243203r243204
697718   $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@
698719
699720DEBUGOBJS = \
700   $(OSDOBJ)/modules/debugger/debugqt.o \
701721   $(OSDOBJ)/modules/debugger/qt/debugqtview.o \
702722   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
703723   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
r243203r243204
716736   $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o \
717737   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.moc.o \
718738   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o
739
740DEFS += -DUSE_QTDEBUG=1
741
742else
743DEFS += -DUSE_QTDEBUG=0
719744endif
720745
721746ifeq ($(NO_DEBUGGER),1)
r243203r243204
724749OSDOBJS += $(DEBUGOBJS)
725750endif # NO_DEBUGGER
726751
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
727760#-------------------------------------------------
728761# OPENGL
729762#-------------------------------------------------
trunk/src/osd/sdl/sdldir.c
r243203r243204
152152
153153   if (tmpstr[0] == '$')
154154   {
155      char *envval;
156155      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
157156
158157      strcpy(envstr, tmpstr);
r243203r243204
165164
166165      envstr[i] = '\0';
167166
168      envval = osd_getenv(&envstr[1]);
167      const char *envval = osd_getenv(&envstr[1]);
169168      if (envval != NULL)
170169      {
171170         j = strlen(envval) + strlen(tmpstr) + 1;
trunk/src/osd/sdl/sdlfile.c
r243203r243204
176176   // does path start with an environment variable?
177177   if (tmpstr[0] == '$')
178178   {
179      char *envval;
180179      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
181180
182181      strcpy(envstr, tmpstr);
r243203r243204
189188
190189      envstr[i] = '\0';
191190
192      envval = osd_getenv(&envstr[1]);
191      const char *envval = osd_getenv(&envstr[1]);
193192      if (envval != NULL)
194193      {
195194         j = strlen(envval) + strlen(tmpstr) + 1;
r243203r243204
506505
507506osd_directory_entry *osd_stat(const char *path)
508507{
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
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
516515
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
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
522521
523    if( err == -1) return NULL;
522   if( err == -1) return NULL;
524523
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;
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;
532531
533    return result;
532   return result;
534533}
535534
536535//============================================================
r243203r243204
539538
540539file_error osd_get_full_path(char **dst, const char *path)
541540{
542    file_error err;
543    char path_buffer[512];
541   file_error err;
542   char path_buffer[512];
544543
545    err = FILERR_NONE;
544   err = FILERR_NONE;
546545
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);
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);
555554
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    }
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   }
566565
567    return err;
566   return err;
568567}
569568
570569//============================================================
r243203r243204
573572
574573const char *osd_get_volume_name(int idx)
575574{
576    if (idx!=0) return NULL;
577    return "/";
575   if (idx!=0) return NULL;
576   return "/";
578577}
579578
580579#endif
trunk/src/osd/sdl/sdlmain.c
r243203r243204
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
2015#ifndef SDLMAME_HAIKU
2116#include <fontconfig/fontconfig.h>
2217#endif
r243203r243204
3126#include <unistd.h>
3227#endif
3328
29// only for strconv.h
30#if defined(SDLMAME_WIN32)
31#define WIN32_LEAN_AND_MEAN
32#include <windows.h>
33#endif
34
35
3436#ifdef SDLMAME_OS2
3537#define INCL_DOS
3638#include <os2.h>
r243203r243204
4749#include "emu.h"
4850#include "clifront.h"
4951#include "emuopts.h"
52#include "strconv.h"
5053
5154// OSD headers
5255#include "video.h"
5356#include "input.h"
5457#include "osdsdl.h"
5558#include "modules/lib/osdlib.h"
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
59
7060// we override SDL's normal startup on Win32
7161// please see sdlprefix.h as well
7262
r243203r243204
7767
7868#include "watchdog.h"
7969
80#define DEFAULT_FONT_HEIGHT (200)
81
8270//============================================================
8371//  OPTIONS
8472//============================================================
r243203r243204
263251   set_default_value(SDLOPTION_INIPATH, ini_path.cstr());
264252}
265253
266
267254//============================================================
268255//  main
269256//============================================================
r243203r243204
295282   setvbuf(stdout, (char *) NULL, _IONBF, 0);
296283   setvbuf(stderr, (char *) NULL, _IONBF, 0);
297284
285   // FIXME: this should be done differently
286
298287   #ifdef SDLMAME_UNIX
299288   sdl_entered_debugger = 0;
300289   #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   }
305290   FcInit();
306291   #endif
307292   #endif
r243203r243204
334319#endif
335320
336321   {
337       sdl_options options;
322      sdl_options options;
338323      sdl_osd_interface osd(options);
339324      osd.register_options();
340325      cli_frontend frontend(options, osd);
r243203r243204
348333   }
349334#endif
350335
351   // already called...
352   //SDL_Quit();
353
354336   #ifdef SDLMAME_UNIX
355337   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
356   TTF_Quit();
357338   if (!sdl_entered_debugger)
358339   {
359340      FcFini();
r243203r243204
543524}
544525
545526//============================================================
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//============================================================
584527//  init
585528//============================================================
586529
530
587531void sdl_osd_interface::init(running_machine &machine)
588532{
589533   // call our parent
r243203r243204
704648#endif
705649}
706650
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
1167651#ifdef SDLMAME_WIN32
1168652
1169653//============================================================
r243203r243204
1203687   return result;
1204688}
1205689
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}
1454690#endif
1455#endif
1456
1457
trunk/src/osd/sdl/sdlmisc_os2.c
r243203r243204
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
r243203r243204
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
r243203r243204
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
r243203r243204
121121
122122   return result;
123123}
124
trunk/src/osd/sdl/sdlos_os2.c
r243203r243204
2323
2424// MAME headers
2525#include "osdcore.h"
26#include "osdlib.h"
2627
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//============================================================
24929//  osd_get_clipboard_text
25030//    - used in MESS
25131//============================================================
trunk/src/osd/sdl/sdlos_unix.c
r243203r243204
147147   return result;
148148}
149149#endif
150
151
152
trunk/src/osd/sdl/sdlos_win32.c
r243203r243204
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
r243203r243204
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
37#define _XOPEN_SOURCE
38#define _XOPEN_VERSION 4
39
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
4038#elif defined(__irix__) || defined(__sgi)
4139#define SDLMAME_IRIX 1
4240/* Large file support on IRIX needs _SGI_SOURCE */
trunk/src/osd/sdl/sdlptty_unix.c
r243203r243204
99//
1010//============================================================
1111
12#if (!defined(SDLMAME_SOLARIS) && !(defined(SDLMAME_OS2)))
13
1214#include <sys/types.h>
1315#include <sys/uio.h>
1416#include <unistd.h>
r243203r243204
101103
102104   return FILERR_NONE;
103105}
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
r243203r243204
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
13//============================================================
24//
3//  strconv.c - SDL (POSIX) string conversion
5//  strconv.c - Win32 string conversion
46//
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//
107//============================================================
118
12#ifdef SDLMAME_WIN32
9#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
1310#define WIN32_LEAN_AND_MEAN
1411#include <windows.h>
1512#endif
1613
17#include <stdlib.h>
18
1914// MAMEOS headers
2015#include "strconv.h"
2116#include "unicode.h"
2217
23#ifdef SDLMAME_WIN32
18#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
2419//============================================================
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//============================================================
2545//  utf8_from_astring
2646//============================================================
2747
r243203r243204
4565   return result;
4666}
4767
68
4869//============================================================
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//============================================================
4989//  utf8_from_wstring
5090//============================================================
5191
r243203r243204
62102
63103   return result;
64104}
65#endif
66105
67106//============================================================
68107//  osd_uchar_from_osdchar
69108//============================================================
70109
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
71128int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count)
72129{
73130   wchar_t wch;
r243203r243204
80137
81138   return count;
82139}
140
141#endif
trunk/src/osd/sdl/strconv.h
r243203r243204
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
13//============================================================
24//
3//  strconv.h - SDL string conversion
5//  strconv.h - String conversion
46//
57//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
68//  Visit http://mamedev.org for licensing and usage restrictions.
79//
810//============================================================
911
10#ifndef __SDLSTRCONV__
11#define __SDLSTRCONV__
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
1214
1315#include "osdcore.h"
1416
r243203r243204
1820//  FUNCTION PROTOTYPES
1921//============================================================
2022
21#ifdef SDLMAME_WIN32
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
2224
25#if defined(SDLMAME_WIN32)
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28#endif
2329// the result of these functions has to be released with osd_free()
2430
2531CHAR *astring_from_utf8(const char *s);
r243203r243204
3642#define utf8_from_tstring   utf8_from_astring
3743#endif // UNICODE
3844
45#if defined(SDLMAME_WIN32)
46#define _tcsncpy wcsncpy
47#endif
48
3949#endif //SDLMAME_WIN32
4050
41#endif // __SDLSTRCONV__
51
52#endif // __OSD_STRCONV__
trunk/src/osd/sdl/video.c
r243203r243204
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;
r243203r243204
227227         SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1);
228228         if (first_call==0)
229229         {
230            char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
230            const char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
231231            const SDL_VideoInfo *sdl_vi;
232232
233233            sdl_vi = SDL_GetVideoInfo();
r243203r243204
648648   stemp = options().video();
649649   if (strcmp(stemp, "auto") == 0)
650650   {
651#ifdef SDLMAME_MACOSX
651#if (defined SDLMAME_MACOSX || defined SDLMAME_WIN32)
652652      stemp = "opengl";
653653#else
654654      stemp = "soft";
trunk/src/osd/sdl/window.c
r243203r243204
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_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    };
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   };
287297
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]));
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]));
291302#endif
292303
293304   // set up the window list
r243203r243204
10071018
10081019      if (osd_event_wait(rendered_event, event_wait_ticks))
10091020      {
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          }
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         }
10181029
10191030         // ensure the target bounds are up-to-date, and then get the primitives
1020          set_target_bounds(this);
1031         set_target_bounds(this);
10211032
10221033         render_primitive_list &primlist = target->get_primitives();
10231034
trunk/src/osd/sdl/window.h
r243203r243204
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
r243203r243204
77//============================================================
88
99// standard windows headers
10#ifdef OSD_SDL
11#define _WIN32_WINNT 0x0400
12#endif
1013#define WIN32_LEAN_AND_MEAN
1114#include <windows.h>
1215#include <tchar.h>
r243203r243204
3437   int i, rc;
3538   char **utf8_argv;
3639
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
3748   /* convert arguments to UTF-8 */
3849   utf8_argv = (char **) malloc(argc * sizeof(*argv));
3950   if (utf8_argv == NULL)
r243203r243204
5364      osd_free(utf8_argv[i]);
5465   free(utf8_argv);
5566
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
5678   return rc;
5779}
trunk/src/osd/windows/netdev_pcap.h
r243203r243204
1#ifndef __NETDEV_H
2#define __NETDEV_H
1#ifndef __NETDEV_PCAP_H__
2#define __NETDEV_PCAP_H__
33
44void init_pcap();
55void deinit_pcap();
trunk/src/osd/windows/strconv.c
r243203r243204
66//
77//============================================================
88
9// standard windows headers
9#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
1010#define WIN32_LEAN_AND_MEAN
1111#include <windows.h>
12#endif
1213
1314// MAMEOS headers
1415#include "strconv.h"
1516#include "unicode.h"
1617
17
18#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
1819//============================================================
1920//  astring_from_utf8
2021//============================================================
r243203r243204
101102
102103   return result;
103104}
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
r243203r243204
22// copyright-holders:Aaron Giles
33//============================================================
44//
5//  strconv.h - Win32 string conversion
5//  strconv.h - 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//
710//============================================================
811
9#ifndef __WIN_STRCONV__
10#define __WIN_STRCONV__
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
1114
1215#include "osdcore.h"
1316
r243203r243204
1720//  FUNCTION PROTOTYPES
1821//============================================================
1922
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
2029// the result of these functions has to be released with osd_free()
2130
2231CHAR *astring_from_utf8(const char *s);
r243203r243204
3342#define utf8_from_tstring   utf8_from_astring
3443#endif // UNICODE
3544
45#if defined(SDLMAME_WIN32)
46#define _tcsncpy wcsncpy
47#endif
3648
49#endif //SDLMAME_WIN32
3750
38#endif // __WIN_STRCONV__
51
52#endif // __OSD_STRCONV__
trunk/src/osd/windows/vconv.c
r243203r243204
2525#define VS2008  0x00090000
2626#define VS2010  0x00100000
2727#define VS2012  0x00110000
28#define VS2013  0x00120000
2829
2930
3031
r243203r243204
6768   { 0,        "-fno-omit-frame-pointer",  "" },
6869   { 0,        "-fomit-frame-pointer",     "" },
6970   { 0,        "-Werror",                  "/WX" },
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" },
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" },
72107   { 0,        "-Wall",                    "/W0" },
73108   { VS7,      "-Wno-unused",              "/wd4100 /wd4101 /wd4102 /wd4505" },
74109   { 0,        "-Wno-sign-compare",        "/wd4365 /wd4389 /wd4245 /wd4388" },
trunk/src/osd/windows/windows.mak
r243203r243204
9191   $(OSDOBJ)/modules/sync \
9292   $(OSDOBJ)/modules/lib \
9393   $(OSDOBJ)/modules/midi \
94   $(OSDOBJ)/modules/font \
9495
9596ifdef USE_QTDEBUG
9697OBJDIRS += $(OSDOBJ)/modules/debugger/qt
r243203r243204
312313
313314ifeq ($(CROSS_BUILD),1)
314315   LDFLAGS += -static
315endif   
316endif
316317
317318# TODO: needs to use $(CC)
318319TEST_GCC := $(shell gcc --version)
r243203r243204
348349   $(WINOBJ)/strconv.o \
349350   $(WINOBJ)/windir.o \
350351   $(WINOBJ)/winfile.o \
351   $(WINOBJ)/winmisc.o \
352352   $(OSDOBJ)/modules/sync/sync_windows.o \
353353   $(WINOBJ)/winutf8.o \
354354   $(WINOBJ)/winutil.o \
r243203r243204
356356   $(WINOBJ)/winsocket.o \
357357   $(OSDOBJ)/modules/sync/work_osd.o \
358358   $(OSDOBJ)/modules/lib/osdlib_win32.o \
359   $(OSDOBJ)/modules/osdmodule.o \
359360   $(WINOBJ)/winptty.o \
360361
361362
r243203r243204
372373   $(WINOBJ)/drawnone.o \
373374   $(WINOBJ)/input.o \
374375   $(WINOBJ)/output.o \
375   $(OSDOBJ)/modules/sound/direct_sound.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  \
376380   $(WINOBJ)/video.o \
377381   $(WINOBJ)/window.o \
378382   $(WINOBJ)/winmenu.o \
379383   $(WINOBJ)/winmain.o \
380384   $(OSDOBJ)/modules/midi/portmidi.o \
381385   $(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 \
382390
383391ifdef USE_SDL
384392OSDOBJS += \
r243203r243204
399407
400408# add debug-specific files
401409OSDOBJS += \
402   $(OSDOBJ)/modules/debugger/debugwin.o
410   $(OSDOBJ)/modules/debugger/debugwin.o \
411   $(OSDOBJ)/modules/debugger/debugint.o \
412   $(OSDOBJ)/modules/debugger/debugqt.o \
413   $(OSDOBJ)/modules/debugger/none.o \
403414
404415# add a stub resource file
405416RESFILE = $(WINOBJ)/mame.res
r243203r243204
412423QT_LIBS := -L$(shell qmake -query QT_INSTALL_LIBS)
413424LIBS += $(QT_LIBS) -lqtmain -lQtGui4 -lQtCore4
414425INCPATH += -I$(QT_INSTALL_HEADERS)/QtCore -I$(QT_INSTALL_HEADERS)/QtGui -I$(QT_INSTALL_HEADERS)
415CFLAGS += -DUSE_QTDEBUG
416426
417427MOC = @moc
418428$(OSDOBJ)/%.moc.c: $(OSDSRC)/%.h
419429   $(MOC) $(INCPATH) $(DEFS) $< -o $@
420430
421431OSDOBJS += \
422   $(OSDOBJ)/modules/debugger/debugqt.o \
423432   $(OSDOBJ)/modules/debugger/qt/debugqtview.o \
424433   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
425434   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
trunk/src/osd/windows/winfile.c
r243203r243204
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//============================================================
403386//  create_path_recursive
404387//============================================================
405388
trunk/src/osd/windows/winmain.c
r243203r243204
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
5242#define DEBUG_SLOW_LOCKS    0
5343
54
5544//**************************************************************************
5645//  MACROS
5746//**************************************************************************
r243203r243204
541530}
542531
543532//============================================================
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//============================================================
571533//  init
572534//============================================================
573535
r243203r243204
713675   winwindow_process_events(machine(), 0, 0);
714676}
715677
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
938678//============================================================
939679//  winmain_dump_stack
940680//============================================================
trunk/src/osd/windows/winmain.h
r243203r243204
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
260255   virtual void video_register();
261   virtual void sound_register();
262   virtual void debugger_register();
263256
264257   virtual bool video_init();
265258   virtual bool window_init();
trunk/src/osd/windows/winmisc.c
r243203r243204
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
r243203r243204
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));
r243203r243204
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
r243203r243204
1818#include "netlist/nl_base.h"
1919#include "netlist/nl_setup.h"
2020#include "netlist/nl_parser.h"
21#include "netlist/nl_factory.h"
2122#include "netlist/nl_util.h"
23#include "netlist/devices/net_lib.h"
2224#include "options.h"
2325
2426/***************************************************************************
25    MAME COMPATIBILITY ...
26***************************************************************************/
27 * MAME COMPATIBILITY ...
28 *
29 * These are needed if we link without libutil
30 ***************************************************************************/
2731
2832#if 0
2933void ATTR_PRINTF(1,2) osd_printf_warning(const char *format, ...)
r243203r243204
3539   vprintf(format, argptr);
3640   va_end(argptr);
3741}
38#endif
3942
4043void *malloc_file_line(size_t size, const char *file, int line)
4144{
r243203r243204
7275         src_type.name(), dst_type.name());
7376   throw;
7477}
78#endif
7579
7680struct options_entry oplist[] =
7781{
r243203r243204
8387   { NULL }
8488};
8589
90NETLIST_START(dummy)
91   /* Standard stuff */
92
93   CLOCK(clk, 1000) // 1000 Hz
94   SOLVER(Solver, 48000)
95
96NETLIST_END()
97
8698/***************************************************************************
8799    CORE IMPLEMENTATION
88100***************************************************************************/
r243203r243204
160172      nl_util::pstring_list ll = nl_util::split(m_logs, ":");
161173      for (int i=0; i < ll.count(); i++)
162174      {
163         netlist_device_t *nc = m_setup->factory().new_device_by_classname("nld_log", *m_setup);
164175         pstring name = "log_" + ll[i];
165         m_setup->register_dev(nc, name);
176         /*netlist_device_t *nc = */ m_setup->register_dev("nld_log", name);
166177         m_setup->register_link(name + ".I", ll[i]);
167178      }
168179   }
r243203r243204
230241   nt.init();
231242   const netlist_factory_t::list_t &list = nt.setup().factory().list();
232243
244   netlist_sources_t sources;
245
246   sources.add(netlist_source_t("dummy", &netlist_dummy));
247   sources.parse(nt.setup(),"dummy");
248
233249   nt.setup().start_devices();
234250   nt.setup().resolve_inputs();
235251
trunk/src/version.c
r243203r243204
88
99***************************************************************************/
1010
11#define BARE_BUILD_VERSION "0.157"
11#define BARE_BUILD_VERSION "0.158"
1212
1313extern const char bare_build_version[];
1414extern const char build_version[];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team