diff options
710 files changed, 18611 insertions, 20595 deletions
diff --git a/3rdparty/dxsdk/Include/d3dcommon.h b/3rdparty/dxsdk/Include/d3dcommon.h index 1baa2c262c4..9305a040fc2 100644 --- a/3rdparty/dxsdk/Include/d3dcommon.h +++ b/3rdparty/dxsdk/Include/d3dcommon.h @@ -81,6 +81,21 @@ enum D3D_FEATURE_LEVEL } D3D_FEATURE_LEVEL; typedef +#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048 +#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096 +#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048 +#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096 +#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512 +#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096 +#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256 +#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2 +#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535 +#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575 +#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1 +#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4 +#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128 +#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048 +#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192 enum D3D_PRIMITIVE_TOPOLOGY { D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, diff --git a/docs/config.txt b/docs/config.txt index 68b591c5bdd..9561ee96ef5 100644 --- a/docs/config.txt +++ b/docs/config.txt @@ -159,6 +159,14 @@ Page DN [SDL ONLY] Alt+ENTER Toggles between full-screen and windowed mode. +Scroll Lock Default mapping for the uimodekey. This key allows user to + disable and enable the emulated keyboard in machines that require + it. All emulations which require emulated keyboards will start in + that mode and you can only access the internal UI (hitting TAB) by + first hitting this key. You can change the initial status of the + emulated keyboard is presented upon start by using -ui_active trigger + as detailed below. + Escape Exits emulator. @@ -332,9 +340,29 @@ of your command: in the rompath are verified; however, you can limit this list by specifying a specific softwarelistname (without .XML) after the -verifysoftlist command. + +OSD related options +------------------- + +-uimodekey [keystring] + + Key used to toggle emulated keyboard on and off. Default setting is SCRLOCK. + +-uifontprovider + + Chooses provider for UI font: win, none or auto. The Default setting is AUTO. + + +OSD CLI options +--------------- + -listmidi - Create a list of list available MIDI I/O devices for use with emulation. + Create a list of available MIDI I/O devices for use with emulation. + +-listnetwork + + Create a list of available Network Adapters for use with emulation. @@ -901,8 +929,8 @@ Core input options the coin lockout outputs were actually connected to the coin mechanisms. If this feature is enabled, then attempts to enter a coin while the lockout is active will fail and will display a popup message - in the user interface. If this feature is disabled, the coin lockout - signal will be ignored. The default is ON (-coin_lockout). + in the user interface (In debug mode). If this feature is disabled, the + coin lockout signal will be ignored. The default is ON (-coin_lockout). -ctrlr <controller> @@ -1131,6 +1159,32 @@ Debugging options (-noupdate_in_pause). +Core communication options +-------------------------- + +-comm_localhost <string> + + Local address to bind to. This can be a traditional xxx.xxx.xxx.xxx + address or a string containing a resolvable hostname. The default is + value is "0.0.0.0" + +-comm_localport <string> + + Local port to bind to. This can be any traditional communications port + as an unsigned 16-bit integer (0-65535). The default value is "15122". + +-comm_remotehost <string> + + Remote address to connect to. This can be a traditional xxx.xxx.xxx.xxx + address or a string containing a resolvable hostname. The default is + value is "0.0.0.0" + +-comm_remoteport <string> + + Remote port to connect to. This can be any traditional communications port + as an unsigned 16-bit integer (0-65535). The default value is "15122". + + Core misc options ----------------- diff --git a/docs/m6502.txt b/docs/m6502.txt index c4517a4329a..d09954719bd 100644 --- a/docs/m6502.txt +++ b/docs/m6502.txt @@ -233,8 +233,8 @@ subclass has been created. It's called memory_interface, declared in m6502_device, and provides the following accessors: - UINT8 read(UINT16 adr) - normal read -- UINT8 read_direct(UINT16 adr) - direct read -- UINT8 read_decrypted(UINT16 adr) - decrypted data read +- UINT8 read_sync(UINT16 adr) - opcode read with sync active (first byte of opcode) +- UINT8 read_arg(UINT16 adr) - opcode read with sync inactive (rest of opcode) - void write(UINT16 adr, UINT8 val) - normal write - UINT8 read_9(UINT16 adr) - special y-indexed 6509 read, defaults to read() diff --git a/hash/gamegear.xml b/hash/gamegear.xml index 2818c50119e..1caac2b5e7c 100644 --- a/hash/gamegear.xml +++ b/hash/gamegear.xml @@ -3909,7 +3909,7 @@ a certain item) --> <description>Lemmings 2 - The Tribes (Euro, Prototype)</description> <year>1994</year> <publisher>Psygnosis</publisher> - <part name="cart" interface="sms_cart"> + <part name="cart" interface="gamegear_cart"> <dataarea name="rom" size="524288"> <rom name="lemmings 2 - the tribes [proto].bin" size="524288" crc="fbc807e1" sha1="ad0ce8fc8ce9e5ef9b68b76fb7f3eced4245d5c4" offset="000000" /> </dataarea> diff --git a/hash/i7000_card.xml b/hash/i7000_card.xml index 974258b0fbd..0287af5ef80 100644 --- a/hash/i7000_card.xml +++ b/hash/i7000_card.xml @@ -78,7 +78,7 @@ cartridges data available in this softlist. </part> </software> - <software name="redelocal"> + <software name="redelocl"> <description>I-7119 REDE LOCAL v1.0 R01 (Mar 21st, 1987)</description> <year>1987</year> <publisher>Itautec</publisher> @@ -104,7 +104,7 @@ cartridges data available in this softlist. </part> </software> - <software name="redatorv12"> + <software name="redtrv12"> <description>I-71XX REDATOR v1.2 R04</description> <year>198?</year> <publisher>Itautec</publisher> @@ -130,7 +130,7 @@ cartridges data available in this softlist. </part> </software> - <software name="videotexto"> + <software name="vdeotxto"> <description>I-71XX VIDEOTEXTO</description> <year>198?</year> <publisher>Itautec</publisher> diff --git a/hash/n64.xml b/hash/n64.xml index 2485690fd23..67da077d6f2 100644 --- a/hash/n64.xml +++ b/hash/n64.xml @@ -54,6 +54,7 @@ Info on N64 chip labels (from The Cart Scan Repository) <!-- List of confirmed carts (info from pictures) --> <softwarelist name="n64" description="Nintendo 64 cartridges"> + <software name="007goldnu" cloneof="007goldn"> <description>007 - GoldenEye (USA)</description> <year>1997</year> @@ -5877,12 +5878,12 @@ patched out (+ a fix for internal checksum) <!-- Original release, in .z64 format --> <!-- rom name="mm_debug.rom" size="67108864" crc="687d8395" sha1="b38b71d2961dffb523020a67f4807a4b704e347a" offset="000000" /--> <!-- .v64 version --> - <rom name="mm_debug.bin" size="67108864" crc="ea2e7abb" sha1="c790b3de31196645034c76e326640ccf3b8c91dd" offset="000000" /> + <rom name="legend of zelda, the - majora's mask (europe) (en,fr,de,es) (debug edition).bin" size="67108864" crc="ea2e7abb" sha1="c790b3de31196645034c76e326640ccf3b8c91dd" offset="000000" /> </dataarea> </part> </software> - <software name="zeldamaju1" cloneof="zeldamaj"> + <software name="zeldamaju2" cloneof="zeldamaj"> <description>The Legend of Zelda - Majora's Mask (USA, Demo)</description> <year>2000</year> <publisher>Nintendo</publisher> @@ -11662,8 +11663,9 @@ patched out (+ a fix for internal checksum) </part> </software> - <!-- to be verified --> - <software name="zeldaootmq" cloneof="zeldaoot"> +<!-- to be verified --> + + <software name="zeldaootmqd" cloneof="zeldaoot"> <description>The Legend of Zelda - Ocarina of Time - Master Quest (USA, Debug Edition, Ripped from GC)</description> <year>2003</year> <publisher>Nintendo</publisher> @@ -11674,39 +11676,104 @@ patched out (+ a fix for internal checksum) </part> </software> - <software name="zeldaootmq1" cloneof="zeldaoot"> - <description>The Legend of Zelda - Ocarina of Time - Master Quest (Euro, Debug Edition?, Ripped from GC)</description> + <software name="zeldaootmqu" cloneof="zeldaoot"> + <description>The Legend of Zelda - Ocarina of Time - Master Quest (USA, Ripped from GC)</description> <year>2003</year> <publisher>Nintendo</publisher> <part name="cart" interface="n64_cart"> <dataarea name="rom" size="33554432"> - <rom name="legend of zelda, the - ocarina of time - master quest (2003)(nintendo)[gamecube version].bin" size="33554432" crc="177fa73a" sha1="8ebf2e29313f44f2d49e5b4191971d09919e8e48" offset="000000" /> + <rom name="legend of zelda, the - ocarina of time - master quest (usa)(2003)(nintendo)(ntsc)[gamecube version].bin" size="33554432" crc="7b89b13f" sha1="e1d070ad7b017de9f992b362164dcd9d7f820f7e" offset="000000" /> + </dataarea> + </part> + </software> + + <software name="zeldaootmq" cloneof="zeldaoot"> + <description>The Legend of Zelda - Ocarina of Time - Master Quest (Euro, Ripped from GC)</description> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="legend of zelda, the - ocarina of time - master quest (europe)(2003)(nintendo)(pal)[gamecube version].bin" size="33554432" crc="177fa73a" sha1="8ebf2e29313f44f2d49e5b4191971d09919e8e48" offset="000000" /> + </dataarea> + </part> + </software> + + <software name="zeldaootmqj" cloneof="zeldaoot"> + <description>Zelda no Densetsu - Toki no Ocarina Ura (Jpn, Ripped from GC)</description> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="zelda no densetsu - toki no ocarina ura (japan)(2003)(nintendo)(ntsc)[gamecube version].bin" size="33554432" crc="d97c20ba" sha1="06c3c098f0e14ed61811dfaf0e8e4519d7d7a826" offset="000000" /> </dataarea> </part> </software> <software name="zeldaootu3" cloneof="zeldaoot"> + <description>The Legend of Zelda - Ocarina of Time (USA, Ripped from GC)</description> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="legend of zelda, the - ocarina of time (usa)(2003)(nintendo)(ntsc)[gamecube version].bin" size="33554432" crc="84bbc39f" sha1="44c75962911e13bdfdc31b35e0b8e3be6a6a49ab" offset="000000" /> + </dataarea> + </part> + </software> + + <software name="zeldaoot2" cloneof="zeldaoot"> <description>The Legend of Zelda - Ocarina of Time (Euro, Ripped from GC)</description> <year>2003</year> <publisher>Nintendo</publisher> <part name="cart" interface="n64_cart"> <dataarea name="rom" size="33554432"> - <rom name="legend of zelda, the - ocarina of time (2003)(nintendo)(pal)[gamecube version].v64" size="33554432" crc="6e658036" sha1="580dd0bd1b6d2c51cc20a764eece84dba558964c" offset="000000" /> + <rom name="legend of zelda, the - ocarina of time (europe)(2003)(nintendo)(pal)[gamecube version].bin" size="33554432" crc="6e658036" sha1="580dd0bd1b6d2c51cc20a764eece84dba558964c" offset="000000" /> </dataarea> </part> </software> - <software name="zeldamaju2" cloneof="zeldamaj"> + <software name="zeldaootj3" cloneof="zeldaoot"> + <description>Zelda no Densetsu - Toki no Ocarina (Jpn, Ripped from GC)</description> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="zelda no densetsu - toki no ocarina (japan)(2003)(nintendo)(ntsc)[gamecube version].bin" size="33554432" crc="0ac22de8" sha1="245410280d152f28d5b1c0c0fc37f384db0020cd" offset="000000" /> + </dataarea> + </part> + </software> + + <software name="zeldamaju1" cloneof="zeldamaj"> <description>The Legend of Zelda - Majora's Mask (USA, Ripped from GC)</description> - <year>2003?</year> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="legend of zelda, the - majora's mask (2003)(nintendo)(us)[gamecube version].bin" size="33554432" crc="52245acb" sha1="8c378b87c83b3f4de20b14accf91e7590399f5dc" offset="000000" /> + </dataarea> + </part> + </software> + + <software name="zeldamaj2" cloneof="zeldamaj"> + <description>The Legend of Zelda - Majora's Mask (Euro, Ripped from GC)</description> + <year>2003</year> <publisher>Nintendo</publisher> <part name="cart" interface="n64_cart"> <dataarea name="rom" size="33554432"> - <rom name="legend of zelda, the - majora's mask (2003)(nintendo)(us)[gamecube version].v64" size="33554432" crc="52245acb" sha1="8c378b87c83b3f4de20b14accf91e7590399f5dc" offset="000000" /> + <rom name="legend of zelda, the - majora's mask (2003)(nintendo)(europe)[gamecube version].bin" size="33554432" crc="19139e89" sha1="f4b0bedafc45c78c4428882036d46d691b650d8b" offset="000000" /> </dataarea> </part> </software> + <software name="zeldamajj2" cloneof="zeldamaj"> + <description>Zelda no Densetsu - Mujura no Kamen (Jpn, Ripped from GC)</description> + <year>2003</year> + <publisher>Nintendo</publisher> + <part name="cart" interface="n64_cart"> + <dataarea name="rom" size="33554432"> + <rom name="zelda no densetsu - mujura no kamen (2003)(nintendo)(japan)[gamecube version].bin" size="33554432" crc="766ebdeb" sha1="7beadea493f24f77b5be85bf2c1dbd813481549b" offset="000000" /> + </dataarea> + </part> + </software> <!-- Non game cartridges --> @@ -11834,5 +11901,4 @@ patched out (+ a fix for internal checksum) </part> </software> - </softwarelist> @@ -89,6 +89,8 @@ # QT_HOME = /usr/lib64/qt48/ +# DRIVERS = src/mame/drivers/1942.c,src/mame/drivers/cops.c + -include useroptions.mak ########################################################################### @@ -242,6 +244,15 @@ ifndef NOASM endif endif +# Emscripten +ifeq ($(findstring emcc,$(CC)),emcc) +TARGETOS := asmjs +ARCHITECTURE := +ifndef NOASM + NOASM := 1 +endif +endif + # Autodetect BIGENDIAN # MacOSX ifndef BIGENDIAN @@ -597,6 +608,10 @@ ifdef QT_HOME PARAMS += --QT_HOME='$(QT_HOME)' endif +ifdef DRIVERS +PARAMS += --DRIVERS='$(DRIVERS)' +endif + #------------------------------------------------- # All scripts #------------------------------------------------- @@ -619,9 +634,13 @@ SCRIPTS = scripts/genie.lua \ scripts/src/netlist.lua \ scripts/toolchain.lua \ scripts/src/osd/modules.lua \ - scripts/target/$(TARGET)/$(SUBTARGET).lua \ $(wildcard src/osd/$(OSD)/$(OSD).mak) \ $(wildcard src/$(TARGET)/$(SUBTARGET).mak) + +ifndef DRIVERS +SCRIPTS += scripts/target/$(TARGET)/$(SUBTARGET).lua +endif + ifdef REGENIE SCRIPTS+= regenie endif diff --git a/nl_examples/kidniki.c b/nl_examples/kidniki.c index b5616611d6a..74312e4d27e 100644 --- a/nl_examples/kidniki.c +++ b/nl_examples/kidniki.c @@ -3,8 +3,8 @@ #include "netlist/devices/nld_system.h" #include "netlist/analog/nld_bjt.h" -#define USE_FRONTIERS 0 -#define USE_FIXED_STV 0 +#define USE_FRONTIERS 1 +#define USE_FIXED_STV 1 NETLIST_START(dummy) SOLVER(Solver, 12000) diff --git a/scripts/genie.lua b/scripts/genie.lua index bdd97f427c5..150c6d73294 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -355,6 +355,11 @@ newoption { } } +newoption { + trigger = "DRIVERS", + description = "List of drivers to compile.", +} + if _OPTIONS["SHLIB"]=="1" then LIBTYPE = "SharedLib" else @@ -488,11 +493,16 @@ msgarchiving ("Archiving $(notdir $@)...") messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" } -if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then - error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist") +if (_OPTIONS["DRIVERS"] == nil) then + if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then + error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist") + end + dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua")) +else + OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " target " .. _OPTIONS["subtarget"]) + load(OUT_STR)() + os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.c") end -dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua")) - configuration { "gmake" } flags { "SingleOutputDir", @@ -800,7 +810,7 @@ if _OPTIONS["OPTIMIZE"] then } end if _OPTIONS["LTO"]=="1" then --- -flto=4 -> 4 threads +-- -flto=4 -> 4 threads, reduce if you are low on memory (less than 8G) buildoptions { "-flto=4", } @@ -826,7 +836,8 @@ end if _OPTIONS["SSE2"]=="1" then buildoptions { - "-msse2", + "-msse", + "-msse2" } end diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 10b6a0f0d52..2a2ccd54776 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -11,7 +11,7 @@ ------------------------------------------------- -- ---@src/emu/bus/a7800/a78_slot.h,BUSES += A7800 +--@src/emu/bus/a7800/a78_slot.h,BUSES["A7800"] = true --------------------------------------------------- if (BUSES["A7800"]~=null) then @@ -33,7 +33,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/a800/a800_slot.h,BUSES += A800 +--@src/emu/bus/a800/a800_slot.h,BUSES["A800"] = true --------------------------------------------------- if (BUSES["A800"]~=null) then @@ -53,7 +53,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/a8sio/a8sio.h,BUSES += A8SIO +--@src/emu/bus/a8sio/a8sio.h,BUSES["A8SIO"] = true --------------------------------------------------- if (BUSES["A8SIO"]~=null) then @@ -68,7 +68,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/abcbus/abcbus.h,BUSES += ABCBUS +--@src/emu/bus/abcbus/abcbus.h,BUSES["ABCBUS"] = true --------------------------------------------------- if (BUSES["ABCBUS"]~=null) then @@ -107,7 +107,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/adam/exp.h,BUSES += ADAM +--@src/emu/bus/adam/exp.h,BUSES["ADAM"] = true --------------------------------------------------- if (BUSES["ADAM"]~=null) then @@ -126,7 +126,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/adamnet/adamnet.h,BUSES += ADAMNET +--@src/emu/bus/adamnet/adamnet.h,BUSES["ADAMNET"] = true --------------------------------------------------- if (BUSES["ADAMNET"]~=null) then @@ -149,7 +149,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/apf/slot.h,BUSES += APF +--@src/emu/bus/apf/slot.h,BUSES["APF"] = true --------------------------------------------------- if (BUSES["APF"]~=null) then @@ -164,7 +164,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/apricot/expansion.h,BUSES += APRICOT_EXPANSION +--@src/emu/bus/apricot/expansion.h,BUSES["APRICOT_EXPANSION"] = true --------------------------------------------------- if (BUSES["APRICOT_EXPANSION"]~=null) then @@ -181,7 +181,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/arcadia/slot.h,BUSES += ARCADIA +--@src/emu/bus/arcadia/slot.h,BUSES["ARCADIA"] = true --------------------------------------------------- if (BUSES["ARCADIA"]~=null) then @@ -196,7 +196,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/astrocde/slot.h,BUSES += ASTROCADE +--@src/emu/bus/astrocde/slot.h,BUSES["ASTROCADE"] = true --------------------------------------------------- if (BUSES["ASTROCADE"]~=null) then @@ -215,7 +215,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/bw2/exp.h,BUSES += BW2 +--@src/emu/bus/bw2/exp.h,BUSES["BW2"] = true --------------------------------------------------- if (BUSES["BW2"]~=null) then @@ -230,8 +230,8 @@ end --------------------------------------------------- -- ---@src/emu/bus/c64/exp.h,BUSES += C64 ---@src/emu/bus/c64/user.h,BUSES += C64 +--@src/emu/bus/c64/exp.h,BUSES["C64"] = true +--@src/emu/bus/c64/user.h,BUSES["C64"] = true --------------------------------------------------- if (BUSES["C64"]~=null) then @@ -384,8 +384,8 @@ end --------------------------------------------------- -- ---@src/emu/bus/cbm2/exp.h,BUSES += CBM2 ---@src/emu/bus/cbm2/user.h,BUSES += CBM2 +--@src/emu/bus/cbm2/exp.h,BUSES["CBM2"] = true +--@src/emu/bus/cbm2/user.h,BUSES["CBM2"] = true --------------------------------------------------- if (BUSES["CBM2"]~=null) then @@ -406,7 +406,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/cbmiec/cbmiec.h,BUSES += CBMIEC +--@src/emu/bus/cbmiec/cbmiec.h,BUSES["CBMIEC"] = true --------------------------------------------------- if (BUSES["CBMIEC"]~=null) then @@ -437,7 +437,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/chanf/slot.h,BUSES += CHANNELF +--@src/emu/bus/chanf/slot.h,BUSES["CHANNELF"] = true --------------------------------------------------- if (BUSES["CHANNELF"]~=null) then @@ -452,7 +452,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/comx35/exp.h,BUSES += COMX35 +--@src/emu/bus/comx35/exp.h,BUSES["COMX35"] = true --------------------------------------------------- if (BUSES["COMX35"]~=null) then @@ -481,7 +481,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/coleco/ctrl.h,BUSES += COLECO +--@src/emu/bus/coleco/ctrl.h,BUSES["COLECO"] = true --------------------------------------------------- if (BUSES["COLECO"]~=null) then @@ -502,7 +502,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/crvision/slot.h,BUSES += CRVISION +--@src/emu/bus/crvision/slot.h,BUSES["CRVISION"] = true --------------------------------------------------- if (BUSES["CRVISION"]~=null) then @@ -517,7 +517,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/dmv/dmv.h,BUSES += DMV +--@src/emu/bus/dmv/dmv.h,BUSES["DMV"] = true --------------------------------------------------- if (BUSES["DMV"]~=null) then @@ -546,7 +546,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/ecbbus/ecbbus.h,BUSES += ECBBUS +--@src/emu/bus/ecbbus/ecbbus.h,BUSES["ECBBUS"] = true --------------------------------------------------- if (BUSES["ECBBUS"]~=null) then @@ -561,7 +561,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/econet/econet.h,BUSES += ECONET +--@src/emu/bus/econet/econet.h,BUSES["ECONET"] = true --------------------------------------------------- if (BUSES["ECONET"]~=null) then @@ -576,7 +576,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/ep64/exp.h,BUSES += EP64 +--@src/emu/bus/ep64/exp.h,BUSES["EP64"] = true --------------------------------------------------- if (BUSES["EP64"]~=null) then @@ -591,7 +591,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/generic/slot.h,BUSES += GENERIC +--@src/emu/bus/generic/slot.h,BUSES["GENERIC"] = true --------------------------------------------------- if (BUSES["GENERIC"]~=null) then @@ -610,7 +610,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/ieee488/ieee488.h,BUSES += IEEE488 +--@src/emu/bus/ieee488/ieee488.h,BUSES["IEEE488"] = true --------------------------------------------------- if (BUSES["IEEE488"]~=null) then @@ -643,7 +643,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/iq151/iq151.h,BUSES += IQ151 +--@src/emu/bus/iq151/iq151.h,BUSES["IQ151"] = true --------------------------------------------------- if (BUSES["IQ151"]~=null) then @@ -672,7 +672,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/isbx/isbx.h,BUSES += IMI7000 +--@src/emu/bus/isbx/isbx.h,BUSES["IMI7000"] = true --------------------------------------------------- if (BUSES["IMI7000"]~=null) then @@ -687,7 +687,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/intv/slot.h,BUSES += INTV +--@src/emu/bus/intv/slot.h,BUSES["INTV"] = true --------------------------------------------------- if (BUSES["INTV"]~=null) then @@ -706,7 +706,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/isa/isa.h,BUSES += ISA +--@src/emu/bus/isa/isa.h,BUSES["ISA"] = true --------------------------------------------------- if (BUSES["ISA"]~=null) then @@ -818,7 +818,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/isbx/isbx.h,BUSES += ISBX +--@src/emu/bus/isbx/isbx.h,BUSES["ISBX"] = true --------------------------------------------------- if (BUSES["ISBX"]~=null) then @@ -835,7 +835,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/msx_slot/slot.h,BUSES += MSX_SLOT +--@src/emu/bus/msx_slot/slot.h,BUSES["MSX_SLOT"] = true --------------------------------------------------- if (BUSES["MSX_SLOT"]~=null) then @@ -912,7 +912,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/kc/kc.h,BUSES += KC +--@src/emu/bus/kc/kc.h,BUSES["KC"] = true --------------------------------------------------- if (BUSES["KC"]~=null) then @@ -932,7 +932,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/odyssey2/slot.h,BUSES += O2 +--@src/emu/bus/odyssey2/slot.h,BUSES["O2"] = true --------------------------------------------------- if (BUSES["O2"]~=null) then @@ -951,7 +951,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/pc_joy/pc_joy.h,BUSES += PC_JOY +--@src/emu/bus/pc_joy/pc_joy.h,BUSES["PC_JOY"] = true --------------------------------------------------- if (BUSES["PC_JOY"]~=null) then @@ -966,7 +966,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/pc_kbd/pc_kbdc.h,BUSES += PC_KBD +--@src/emu/bus/pc_kbd/pc_kbdc.h,BUSES["PC_KBD"] = true --------------------------------------------------- if (BUSES["PC_KBD"]~=null) then @@ -995,9 +995,9 @@ end --------------------------------------------------- -- ---@src/emu/bus/pet/cass.h,BUSES += PET ---@src/emu/bus/pet/exp.h,BUSES += PET ---@src/emu/bus/pet/user.h,BUSES += PET +--@src/emu/bus/pet/cass.h,BUSES["PET"] = true +--@src/emu/bus/pet/exp.h,BUSES["PET"] = true +--@src/emu/bus/pet/user.h,BUSES["PET"] = true --------------------------------------------------- if (BUSES["PET"]~=null) then @@ -1030,8 +1030,8 @@ end --------------------------------------------------- -- ---@src/emu/bus/plus4/exp.h,BUSES += PLUS4 ---@src/emu/bus/plus4/user.h,BUSES += PLUS4 +--@src/emu/bus/plus4/exp.h,BUSES["PLUS4"] = true +--@src/emu/bus/plus4/user.h,BUSES["PLUS4"] = true --------------------------------------------------- if (BUSES["PLUS4"]~=null) then @@ -1054,7 +1054,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/s100/s100.h,BUSES += S100 +--@src/emu/bus/s100/s100.h,BUSES["S100"] = true --------------------------------------------------- if (BUSES["S100"]~=null) then @@ -1079,7 +1079,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/spc1000/exp.h,BUSES += SPC1000 +--@src/emu/bus/spc1000/exp.h,BUSES["SPC1000"] = true --------------------------------------------------- if (BUSES["SPC1000"]~=null) then @@ -1096,7 +1096,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/tvc/tvc.h,BUSES += TVC +--@src/emu/bus/tvc/tvc.h,BUSES["TVC"] = true --------------------------------------------------- if (BUSES["TVC"]~=null) then @@ -1111,7 +1111,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vc4000/slot.h,BUSES += VC4000 +--@src/emu/bus/vc4000/slot.h,BUSES["VC4000"] = true --------------------------------------------------- if (BUSES["VC4000"]~=null) then @@ -1126,7 +1126,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vcs/vcs_slot.h,BUSES += VCS +--@src/emu/bus/vcs/vcs_slot.h,BUSES["VCS"] = true --------------------------------------------------- if (BUSES["VCS"]~=null) then @@ -1147,7 +1147,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vcs/ctrl.h,BUSES += VCS_CTRL +--@src/emu/bus/vcs/ctrl.h,BUSES["VCS_CTRL"] = true --------------------------------------------------- if (BUSES["VCS_CTRL"]~=null) then @@ -1172,7 +1172,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vectrex/slot.h,BUSES += VECTREX +--@src/emu/bus/vectrex/slot.h,BUSES["VECTREX"] = true --------------------------------------------------- if (BUSES["VECTREX"]~=null) then @@ -1187,7 +1187,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vic10/exp.h,BUSES += VIC10 +--@src/emu/bus/vic10/exp.h,BUSES["VIC10"] = true --------------------------------------------------- if (BUSES["VIC10"]~=null) then @@ -1202,8 +1202,8 @@ end --------------------------------------------------- -- ---@src/emu/bus/vic20/exp.h,BUSES += VIC20 ---@src/emu/bus/vic20/user.h,BUSES += VIC20 +--@src/emu/bus/vic20/exp.h,BUSES["VIC20"] = true +--@src/emu/bus/vic20/user.h,BUSES["VIC20"] = true --------------------------------------------------- if (BUSES["VIC20"]~=null) then @@ -1238,7 +1238,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vidbrain/exp.h,BUSES += VIDBRAIN +--@src/emu/bus/vidbrain/exp.h,BUSES["VIDBRAIN"] = true --------------------------------------------------- if (BUSES["VIDBRAIN"]~=null) then @@ -1257,8 +1257,8 @@ end --------------------------------------------------- -- ---@src/emu/bus/vip/byteio.h,BUSES += VIP ---@src/emu/bus/vip/exp.h,BUSES += VIP +--@src/emu/bus/vip/byteio.h,BUSES["VIP"] = true +--@src/emu/bus/vip/exp.h,BUSES["VIP"] = true --------------------------------------------------- if (BUSES["VIP"]~=null) then @@ -1289,7 +1289,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/wangpc/wangpc.h,BUSES += WANGPC +--@src/emu/bus/wangpc/wangpc.h,BUSES["WANGPC"] = true --------------------------------------------------- if (BUSES["WANGPC"]~=null) then @@ -1318,7 +1318,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/z88/z88.h,BUSES += Z88 +--@src/emu/bus/z88/z88.h,BUSES["Z88"] = true --------------------------------------------------- if (BUSES["Z88"]~=null) then @@ -1336,7 +1336,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/a2bus/a2bus.h,BUSES += A2BUS +--@src/emu/bus/a2bus/a2bus.h,BUSES["A2BUS"] = true --------------------------------------------------- if (BUSES["A2BUS"]~=null) then @@ -1426,7 +1426,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/nubus/nubus.h,BUSES += NUBUS +--@src/emu/bus/nubus/nubus.h,BUSES["NUBUS"] = true --------------------------------------------------- if (BUSES["NUBUS"]~=null) then @@ -1470,7 +1470,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/centronics/ctronics.h,BUSES += CENTRONICS +--@src/emu/bus/centronics/ctronics.h,BUSES["CENTRONICS"] = true --------------------------------------------------- if (BUSES["CENTRONICS"]~=null) then @@ -1509,7 +1509,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/rs232/rs232.h,BUSES += RS232 +--@src/emu/bus/rs232/rs232.h,BUSES["RS232"] = true --------------------------------------------------- if (BUSES["RS232"]~=null) then @@ -1535,7 +1535,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/midi/midi.h,BUSES += MIDI +--@src/emu/bus/midi/midi.h,BUSES["MIDI"] = true --------------------------------------------------- if (BUSES["MIDI"]~=null) then @@ -1551,7 +1551,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/lpci/pci.h,BUSES += LPCI +--@src/emu/bus/lpci/pci.h,BUSES["LPCI"] = true --------------------------------------------------- if (BUSES["LPCI"]~=null) then @@ -1577,7 +1577,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/nes/nes_slot.h,BUSES += NES +--@src/emu/bus/nes/nes_slot.h,BUSES["NES"] = true --------------------------------------------------- if (BUSES["NES"]~=null) then @@ -1690,7 +1690,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/nes_ctrl/ctrl.h,BUSES += NES_CTRL +--@src/emu/bus/nes_ctrl/ctrl.h,BUSES["NES_CTRL"] = true --------------------------------------------------- if (BUSES["NES_CTRL"]~=null) then @@ -1732,7 +1732,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/snes/snes_slot.h,BUSES += SNES +--@src/emu/bus/snes/snes_slot.h,BUSES["SNES"] = true --------------------------------------------------- if (BUSES["SNES"]~=null) then @@ -1768,7 +1768,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/snes_ctrl/ctrl.h,BUSES += SNES_CTRL +--@src/emu/bus/snes_ctrl/ctrl.h,BUSES["SNES_CTRL"] = true --------------------------------------------------- if (BUSES["SNES_CTRL"]~=null) then @@ -1796,7 +1796,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vboy/slot.h,BUSES += VBOY +--@src/emu/bus/vboy/slot.h,BUSES["VBOY"] = true --------------------------------------------------- if (BUSES["VBOY"]~=null) then files { @@ -1809,7 +1809,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/megadrive/md_slot.h,BUSES += MEGADRIVE +--@src/emu/bus/megadrive/md_slot.h,BUSES["MEGADRIVE"] = true --------------------------------------------------- if (BUSES["MEGADRIVE"]~=null) then @@ -1837,7 +1837,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/neogeo/neogeo_slot.h,BUSES += NEOGEO +--@src/emu/bus/neogeo/neogeo_slot.h,BUSES["NEOGEO"] = true --------------------------------------------------- if (BUSES["NEOGEO"]~=null) then @@ -1902,7 +1902,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/saturn/sat_slot.h,BUSES += SATURN +--@src/emu/bus/saturn/sat_slot.h,BUSES["SATURN"] = true --------------------------------------------------- if (BUSES["SATURN"]~=null) then @@ -1920,7 +1920,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/sega8/sega8_slot.h,BUSES += SEGA8 +--@src/emu/bus/sega8/sega8_slot.h,BUSES["SEGA8"] = true --------------------------------------------------- if (BUSES["SEGA8"]~=null) then @@ -1938,7 +1938,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/sms_ctrl/smsctrl.h,BUSES += SMS_CTRL +--@src/emu/bus/sms_ctrl/smsctrl.h,BUSES["SMS_CTRL"] = true --------------------------------------------------- if (BUSES["SMS_CTRL"]~=null) then @@ -1966,7 +1966,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/sms_exp/smsexp.h,BUSES += SMS_EXP +--@src/emu/bus/sms_exp/smsexp.h,BUSES["SMS_EXP"] = true --------------------------------------------------- if (BUSES["SMS_EXP"]~=null) then @@ -1980,7 +1980,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/ti99_peb/peribox.h,BUSES += TI99PEB +--@src/emu/bus/ti99_peb/peribox.h,BUSES["TI99PEB"] = true --------------------------------------------------- if (BUSES["TI99PEB"]~=null) then @@ -2022,7 +2022,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/gameboy/gb_slot.h,BUSES += GAMEBOY +--@src/emu/bus/gameboy/gb_slot.h,BUSES["GAMEBOY"] = true --------------------------------------------------- if (BUSES["GAMEBOY"]~=null) then @@ -2038,7 +2038,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/gamegear/ggext.h,BUSES += GAMEGEAR +--@src/emu/bus/gamegear/ggext.h,BUSES["GAMEGEAR"] = true --------------------------------------------------- if (BUSES["GAMEGEAR"]~=null) then @@ -2052,7 +2052,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/gba/gba_slot.h,BUSES += GBA +--@src/emu/bus/gba/gba_slot.h,BUSES["GBA"] = true --------------------------------------------------- if (BUSES["GBA"]~=null) then @@ -2066,7 +2066,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/bml3/bml3bus.h,BUSES += BML3 +--@src/emu/bus/bml3/bml3bus.h,BUSES["BML3"] = true --------------------------------------------------- if (BUSES["BML3"]~=null) then files { @@ -2083,7 +2083,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/coco/cococart.h,BUSES += COCO +--@src/emu/bus/coco/cococart.h,BUSES["COCO"] = true --------------------------------------------------- if (BUSES["COCO"]~=null) then files { @@ -2106,7 +2106,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/cpc/cpcexp.h,BUSES += CPC +--@src/emu/bus/cpc/cpcexp.h,BUSES["CPC"] = true --------------------------------------------------- if (BUSES["CPC"]~=null) then files { @@ -2132,12 +2132,14 @@ if (BUSES["CPC"]~=null) then MAME_DIR .. "src/emu/bus/cpc/smartwatch.h", MAME_DIR .. "src/emu/bus/cpc/brunword4.c", MAME_DIR .. "src/emu/bus/cpc/brunword4.h", + MAME_DIR .. "src/emu/bus/cpc/hd20.c", + MAME_DIR .. "src/emu/bus/cpc/hd20.h", } end --------------------------------------------------- -- ---@src/emu/bus/epson_sio/epson_sio.h,BUSES += EPSON_SIO +--@src/emu/bus/epson_sio/epson_sio.h,BUSES["EPSON_SIO"] = true --------------------------------------------------- if (BUSES["EPSON_SIO"]~=null) then files { @@ -2152,7 +2154,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/pce/pce_slot.h,BUSES += PCE +--@src/emu/bus/pce/pce_slot.h,BUSES["PCE"] = true --------------------------------------------------- if (BUSES["PCE"]~=null) then files { @@ -2165,7 +2167,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/scv/slot.h,BUSES += SCV +--@src/emu/bus/scv/slot.h,BUSES["SCV"] = true --------------------------------------------------- if (BUSES["SCV"]~=null) then files { @@ -2178,7 +2180,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/x68k/x68kexp.h,BUSES += X68K +--@src/emu/bus/x68k/x68kexp.h,BUSES["X68K"] = true --------------------------------------------------- if (BUSES["X68K"]~=null) then files { @@ -2193,7 +2195,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/abckb/abckb.h,BUSES += ABCKB +--@src/emu/bus/abckb/abckb.h,BUSES["ABCKB"] = true --------------------------------------------------- if (BUSES["ABCKB"]~=null) then files { @@ -2210,7 +2212,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/compucolor/compclr_flp.h,BUSES += COMPUCOLOR +--@src/emu/bus/compucolor/compclr_flp.h,BUSES["COMPUCOLOR"] = true --------------------------------------------------- if (BUSES["COMPUCOLOR"]~=null) then files { @@ -2221,7 +2223,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/scsi/scsi.h,BUSES += SCSI +--@src/emu/bus/scsi/scsi.h,BUSES["SCSI"] = true --------------------------------------------------- if (BUSES["SCSI"]~=null) then files { @@ -2252,7 +2254,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/macpds/macpds.h,BUSES += MACPDS +--@src/emu/bus/macpds/macpds.h,BUSES["MACPDS"] = true --------------------------------------------------- if (BUSES["MACPDS"]~=null) then files { @@ -2265,7 +2267,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/oricext/oricext.h,BUSES += ORICEXT +--@src/emu/bus/oricext/oricext.h,BUSES["ORICEXT"] = true --------------------------------------------------- if (BUSES["ORICEXT"]~=null) then files { @@ -2280,7 +2282,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/a1bus/a1bus.h,BUSES += A1BUS +--@src/emu/bus/a1bus/a1bus.h,BUSES["A1BUS"] = true --------------------------------------------------- if (BUSES["A1BUS"]~=null) then @@ -2296,7 +2298,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/amiga/zorro/zorro.h,BUSES += ZORRO +--@src/emu/bus/amiga/zorro/zorro.h,BUSES["ZORRO"] = true --------------------------------------------------- if (BUSES["ZORRO"]~=null) then @@ -2320,7 +2322,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/ql/exp.h,BUSES += QL +--@src/emu/bus/ql/exp.h,BUSES["QL"] = true --------------------------------------------------- if (BUSES["QL"]~=null) then @@ -2362,7 +2364,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vtech/memexp/memexp.h,BUSES += VTECH_MEMEXP +--@src/emu/bus/vtech/memexp/memexp.h,BUSES["VTECH_MEMEXP"] = true --------------------------------------------------- if (BUSES["VTECH_MEMEXP"]~=null) then @@ -2384,7 +2386,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/vtech/ioexp/ioexp.h,BUSES += VTECH_IOEXP +--@src/emu/bus/vtech/ioexp/ioexp.h,BUSES["VTECH_IOEXP"] = true --------------------------------------------------- if (BUSES["VTECH_IOEXP"]~=null) then @@ -2402,7 +2404,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/wswan/slot.h,BUSES += WSWAN +--@src/emu/bus/wswan/slot.h,BUSES["WSWAN"] = true --------------------------------------------------- if (BUSES["WSWAN"]~=null) then @@ -2416,7 +2418,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/psx/ctlrport.h,BUSES += PSX_CONTROLLER +--@src/emu/bus/psx/ctlrport.h,BUSES["PSX_CONTROLLER"] = true --------------------------------------------------- if (BUSES["PSX_CONTROLLER"]~=null) then @@ -2434,7 +2436,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/nasbus/nasbus.h,BUSES += NASBUS +--@src/emu/bus/nasbus/nasbus.h,BUSES["NASBUS"] = true --------------------------------------------------- if (BUSES["NASBUS"]~=null) then @@ -2452,7 +2454,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/cgenie/expansion.h,BUSES += CGENIE_EXPANSION +--@src/emu/bus/cgenie/expansion.h,BUSES["CGENIE_EXPANSION"] = true --------------------------------------------------- if (BUSES["CGENIE_EXPANSION"]~=null) then @@ -2468,7 +2470,7 @@ end --------------------------------------------------- -- ---@src/emu/bus/cgenie/parallel.h,BUSES += CGENIE_PARALLEL +--@src/emu/bus/cgenie/parallel.h,BUSES["CGENIE_PARALLEL"] = true --------------------------------------------------- if (BUSES["CGENIE_PARALLEL"]~=null) then diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index fa01ecd34ca..e7c7df256d8 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -21,7 +21,7 @@ files { -- Dynamic recompiler objects -------------------------------------------------- -if (CPUS["SH2"]~=null or CPUS["MIPS"]~=null or CPUS["POWERPC"]~=null or CPUS["RSP"]~=null) then +if (CPUS["SH2"]~=null or CPUS["MIPS"]~=null or CPUS["POWERPC"]~=null or CPUS["RSP"]~=null or CPUS["ARM7"]~=null) then files { MAME_DIR .. "src/emu/cpu/drcbec.c", MAME_DIR .. "src/emu/cpu/drcbec.h", @@ -50,7 +50,7 @@ end -------------------------------------------------- -- Signetics 8X300 / Scientific Micro Systems SMS300 ---@src/emu/cpu/8x300/8x300.h,CPUS += 8X300 +--@src/emu/cpu/8x300/8x300.h,CPUS["8X300"] = true -------------------------------------------------- if (CPUS["8X300"]~=null) then @@ -66,7 +66,7 @@ end -------------------------------------------------- -- ARCangent A4 ---@src/emu/cpu/arc/arc.h,CPUS += ARC +--@src/emu/cpu/arc/arc.h,CPUS["ARC"] = true -------------------------------------------------- if (CPUS["ARC"]~=null) then @@ -82,7 +82,7 @@ end -------------------------------------------------- -- ARcompact (ARCtangent-A5, ARC 600, ARC 700) ---@src/emu/cpu/arc/arc.h,CPUS += ARCOMPACT +--@src/emu/cpu/arc/arc.h,CPUS["ARCOMPACT"] = true -------------------------------------------------- if (CPUS["ARCOMPACT"]~=null) then @@ -111,8 +111,8 @@ end -------------------------------------------------- -- Acorn ARM series -- ----@src/emu/cpu/arm/arm.h,CPUS += ARM ----@src/emu/cpu/arm7/arm7.h,CPUS += ARM7 +--@src/emu/cpu/arm/arm.h,CPUS["ARM"] = true +--@src/emu/cpu/arm7/arm7.h,CPUS["ARM7"] = true -------------------------------------------------- if (CPUS["ARM"]~=null) then @@ -141,7 +141,7 @@ end -------------------------------------------------- -- Advanced Digital Chips SE3208 ----@src/emu/cpu/se3208/se3208.h,CPUS += SE3208 +--@src/emu/cpu/se3208/se3208.h,CPUS["SE3208"] = true -------------------------------------------------- if (CPUS["SE3208"]~=null) then @@ -157,7 +157,7 @@ end -------------------------------------------------- -- American Microsystems, Inc.(AMI) S2000 series ----@src/emu/cpu/amis2000/amis2000.h,CPUS += AMIS2000 +--@src/emu/cpu/amis2000/amis2000.h,CPUS["AMIS2000"] = true -------------------------------------------------- if (CPUS["AMIS2000"]~=null) then @@ -173,7 +173,7 @@ end -------------------------------------------------- -- Alpha 8201 ----@src/emu/cpu/alph8201/alph8201.h,CPUS += ALPHA8201 +--@src/emu/cpu/alph8201/alph8201.h,CPUS["ALPHA8201"] = true -------------------------------------------------- if (CPUS["ALPHA8201"]~=null) then @@ -189,7 +189,7 @@ end -------------------------------------------------- -- Analog Devices ADSP21xx series ----@src/emu/cpu/adsp2100/adsp2100.h,CPUS += ADSP21XX +--@src/emu/cpu/adsp2100/adsp2100.h,CPUS["ADSP21XX"] = true -------------------------------------------------- if (CPUS["ADSP21XX"]~=null) then @@ -205,7 +205,7 @@ end -------------------------------------------------- -- Analog Devices "Sharc" ADSP21062 ----@src/emu/cpu/sharc/sharc.h,CPUS += ADSP21062 +--@src/emu/cpu/sharc/sharc.h,CPUS["ADSP21062"] = true -------------------------------------------------- if (CPUS["ADSP21062"]~=null) then @@ -221,7 +221,7 @@ end -------------------------------------------------- -- APEXC ----@src/emu/cpu/apexc/apexc.h,CPUS += APEXC +--@src/emu/cpu/apexc/apexc.h,CPUS["APEXC"] = true -------------------------------------------------- if (CPUS["APEXC"]~=null) then @@ -237,7 +237,7 @@ end -------------------------------------------------- -- AT&T DSP16A ----@src/emu/cpu/dsp16/dsp16.h,CPUS += DSP16A +--@src/emu/cpu/dsp16/dsp16.h,CPUS["DSP16A"] = true -------------------------------------------------- if (CPUS["DSP16A"]~=null) then @@ -253,7 +253,7 @@ end -------------------------------------------------- -- AT&T DSP32C ----@src/emu/cpu/dsp32/dsp32.h,CPUS += DSP32C +--@src/emu/cpu/dsp32/dsp32.h,CPUS["DSP32C"] = true -------------------------------------------------- if (CPUS["DSP32C"]~=null) then @@ -269,7 +269,7 @@ end -------------------------------------------------- -- Atari custom RISC processor ----@src/emu/cpu/asap/asap.h,CPUS += ASAP +--@src/emu/cpu/asap/asap.h,CPUS["ASAP"] = true -------------------------------------------------- if (CPUS["ASAP"]~=null) then @@ -285,7 +285,7 @@ end -------------------------------------------------- -- AMD Am29000 ----@src/emu/cpu/am29000/am29000.h,CPUS += AM29000 +--@src/emu/cpu/am29000/am29000.h,CPUS["AM29000"] = true -------------------------------------------------- if (CPUS["AM29000"]~=null) then @@ -301,7 +301,7 @@ end -------------------------------------------------- -- Atari Jaguar custom DSPs ----@src/emu/cpu/jaguar/jaguar.h,CPUS += JAGUAR +--@src/emu/cpu/jaguar/jaguar.h,CPUS["JAGUAR"] = true -------------------------------------------------- if (CPUS["JAGUAR"]~=null) then @@ -317,7 +317,7 @@ end -------------------------------------------------- -- Simutrek Cube Quest bit-sliced CPUs ----@src/emu/cpu/cubeqcpu/cubeqcpu.h,CPUS += CUBEQCPU +--@src/emu/cpu/cubeqcpu/cubeqcpu.h,CPUS["CUBEQCPU"] = true -------------------------------------------------- if (CPUS["CUBEQCPU"]~=null) then @@ -333,7 +333,7 @@ end -------------------------------------------------- -- Ensoniq ES5510 ('ESP') DSP ----@src/emu/cpu/es5510/es5510.h,CPUS += ES5510 +--@src/emu/cpu/es5510/es5510.h,CPUS["ES5510"] = true -------------------------------------------------- if (CPUS["ES5510"]~=null) then @@ -345,7 +345,7 @@ end -------------------------------------------------- -- Entertainment Sciences AM29116-based RIP ----@src/emu/cpu/esrip/esrip.h,CPUS += ESRIP +--@src/emu/cpu/esrip/esrip.h,CPUS["ESRIP"] = true -------------------------------------------------- if (CPUS["ESRIP"]~=null) then @@ -361,7 +361,7 @@ end -------------------------------------------------- -- Seiko Epson E0C6200 series ----@src/emu/cpu/e0c6200/e0c6200.h,CPUS += E0C6200 +--@src/emu/cpu/e0c6200/e0c6200.h,CPUS["E0C6200"] = true -------------------------------------------------- if (CPUS["E0C6200"]~=null) then @@ -379,7 +379,7 @@ end -------------------------------------------------- -- RCA COSMAC ----@src/emu/cpu/cosmac/cosmac.h,CPUS += COSMAC +--@src/emu/cpu/cosmac/cosmac.h,CPUS["COSMAC"] = true -------------------------------------------------- if (CPUS["COSMAC"]~=null) then @@ -395,7 +395,7 @@ end -------------------------------------------------- -- National Semiconductor COP400 family ----@src/emu/cpu/cop400/cop400.h,CPUS += COP400 +--@src/emu/cpu/cop400/cop400.h,CPUS["COP400"] = true -------------------------------------------------- if (CPUS["COP400"]~=null) then @@ -413,7 +413,7 @@ end -------------------------------------------------- -- CP1610 ----@src/emu/cpu/cp1610/cp1610.h,CPUS += CP1610 +--@src/emu/cpu/cp1610/cp1610.h,CPUS["CP1610"] = true -------------------------------------------------- if (CPUS["CP1610"]~=null) then @@ -429,7 +429,7 @@ end -------------------------------------------------- -- Cinematronics vector "CPU" ----@src/emu/cpu/ccpu/ccpu.h,CPUS += CCPU +--@src/emu/cpu/ccpu/ccpu.h,CPUS["CCPU"] = true -------------------------------------------------- if (CPUS["CCPU"]~=null) then @@ -445,7 +445,7 @@ end -------------------------------------------------- -- DEC T-11 ----@src/emu/cpu/t11/t11.h,CPUS += T11 +--@src/emu/cpu/t11/t11.h,CPUS["T11"] = true -------------------------------------------------- if (CPUS["T11"]~=null) then @@ -461,7 +461,7 @@ end -------------------------------------------------- -- F8 ----@src/emu/cpu/f8/f8.h,CPUS += F8 +--@src/emu/cpu/f8/f8.h,CPUS["F8"] = true -------------------------------------------------- if (CPUS["F8"]~=null) then @@ -477,7 +477,7 @@ end -------------------------------------------------- -- G65816 ----@src/emu/cpu/g65816/g65816.h,CPUS += G65816 +--@src/emu/cpu/g65816/g65816.h,CPUS["G65816"] = true -------------------------------------------------- if (CPUS["G65816"]~=null) then @@ -498,7 +498,7 @@ end -------------------------------------------------- -- Hitachi H8 (16/32-bit H8/300, H8/300H, H8S2000 and H8S2600 series) ----@src/emu/cpu/h8/h8.h,CPUS += H8 +--@src/emu/cpu/h8/h8.h,CPUS["H8"] = true -------------------------------------------------- if (CPUS["H8"]~=null) then @@ -560,7 +560,7 @@ end -------------------------------------------------- -- Hitachi HCD62121 ----@src/emu/cpu/hcd62121/hcd62121.h,CPUS += HCD62121 +--@src/emu/cpu/hcd62121/hcd62121.h,CPUS["HCD62121"] = true -------------------------------------------------- if (CPUS["HCD62121"]~=null) then @@ -576,7 +576,7 @@ end -------------------------------------------------- -- Hitachi HMCS40 series ----@src/emu/cpu/hmcs40/hmcs40.h,CPUS += HMCS40 +--@src/emu/cpu/hmcs40/hmcs40.h,CPUS["HMCS40"] = true -------------------------------------------------- if (CPUS["HMCS40"]~=null) then @@ -592,7 +592,7 @@ end -------------------------------------------------- -- Hitachi SH1/SH2 ----@src/emu/cpu/sh2/sh2.h,CPUS += SH2 +--@src/emu/cpu/sh2/sh2.h,CPUS["SH2"] = true -------------------------------------------------- if (CPUS["SH2"]~=null) then @@ -609,7 +609,7 @@ end -------------------------------------------------- -- Hitachi SH4 ----@src/emu/cpu/sh4/sh4.h,CPUS += SH4 +--@src/emu/cpu/sh4/sh4.h,CPUS["SH4"] = true -------------------------------------------------- if (CPUS["SH4"]~=null) then @@ -633,7 +633,7 @@ end -------------------------------------------------- -- HP Hybrid processor ----@src/emu/cpu/hphybrid/hphybrid.h,CPUS += HPHYBRID +--@src/emu/cpu/hphybrid/hphybrid.h,CPUS["HPHYBRID"] = true -------------------------------------------------- if (CPUS["HPHYBRID"]~=null) then @@ -649,7 +649,7 @@ end -------------------------------------------------- -- Hudsonsoft 6280 ----@src/emu/cpu/h6280/h6280.h,CPUS += H6280 +--@src/emu/cpu/h6280/h6280.h,CPUS["H6280"] = true -------------------------------------------------- if (CPUS["H6280"]~=null) then @@ -665,7 +665,7 @@ end -------------------------------------------------- -- Hyperstone E1 series ----@src/emu/cpu/e132xs/e132xs.h,CPUS += E1 +--@src/emu/cpu/e132xs/e132xs.h,CPUS["E1"] = true -------------------------------------------------- if (CPUS["E1"]~=null) then @@ -681,7 +681,7 @@ end -------------------------------------------------- -- 15IE-00-013 CPU ("Microprogrammed Control Device") ----@src/emu/cpu/ie15/ie15.h,CPUS += IE15 +--@src/emu/cpu/ie15/ie15.h,CPUS["IE15"] = true -------------------------------------------------- if (CPUS["IE15"]~=null) then @@ -697,7 +697,7 @@ end -------------------------------------------------- -- Intel 4004 ----@src/emu/cpu/i4004/i4004.h,CPUS += I4004 +--@src/emu/cpu/i4004/i4004.h,CPUS["I4004"] = true -------------------------------------------------- if (CPUS["I4004"]~=null) then @@ -713,7 +713,7 @@ end -------------------------------------------------- -- Intel 8008 ----@src/emu/cpu/i8008/i8008.h,CPUS += I8008 +--@src/emu/cpu/i8008/i8008.h,CPUS["I8008"] = true -------------------------------------------------- if (CPUS["I8008"]~=null) then @@ -729,7 +729,7 @@ end -------------------------------------------------- -- National Semiconductor SC/MP ----@src/emu/cpu/scmp/scmp.h,CPUS += SCMP +--@src/emu/cpu/scmp/scmp.h,CPUS["SCMP"] = true -------------------------------------------------- if (CPUS["SCMP"]~=null) then @@ -745,7 +745,7 @@ end -------------------------------------------------- -- Intel 8080/8085A ----@src/emu/cpu/i8085/i8085.h,CPUS += I8085 +--@src/emu/cpu/i8085/i8085.h,CPUS["I8085"] = true -------------------------------------------------- if (CPUS["I8085"]~=null) then @@ -761,7 +761,7 @@ end -------------------------------------------------- -- Intel 8089 ----@src/emu/cpu/i8085/i8089.h,CPUS += I8089 +--@src/emu/cpu/i8089/i8089.h,CPUS["I8089"] = true -------------------------------------------------- if (CPUS["I8089"]~=null) then @@ -780,7 +780,7 @@ end -------------------------------------------------- -- Intel MCS-48 (8039 and derivatives) ----@src/emu/cpu/mcs48/mcs48.h,CPUS += MCS48 +--@src/emu/cpu/mcs48/mcs48.h,CPUS["MCS48"] = true -------------------------------------------------- if (CPUS["MCS48"]~=null) then @@ -796,7 +796,7 @@ end -------------------------------------------------- -- Intel 8051 and derivatives ----@src/emu/cpu/mcs51/mcs51.h,CPUS += MCS51 +--@src/emu/cpu/mcs51/mcs51.h,CPUS["MCS51"] = true -------------------------------------------------- if (CPUS["MCS51"]~=null) then @@ -812,7 +812,7 @@ end -------------------------------------------------- -- Intel MCS-96 ----@src/emu/cpu/mcs96/mcs96.h,CPUS += MCS96 +--@src/emu/cpu/mcs96/mcs96.h,CPUS["MCS96"] = true -------------------------------------------------- if (CPUS["MCS96"]~=null) then @@ -839,9 +839,9 @@ end -------------------------------------------------- -- Intel 80x86 series ----@src/emu/cpu/i86/i86.h,CPUS += I86 ----@src/emu/cpu/i86/i286.h,CPUS += I86 ----@src/emu/cpu/i386/i386.h,CPUS += I386 +--@src/emu/cpu/i86/i86.h,CPUS["I86"] = true +--@src/emu/cpu/i86/i286.h,CPUS["I86"] = true +--@src/emu/cpu/i386/i386.h,CPUS["I386"] = true -------------------------------------------------- if (CPUS["I86"]~=null) then @@ -872,7 +872,7 @@ end -------------------------------------------------- -- Intel i860 ----@src/emu/cpu/i860/i860.h,CPUS += I860 +--@src/emu/cpu/i860/i860.h,CPUS["I860"] = true -------------------------------------------------- if (CPUS["I860"]~=null) then @@ -888,7 +888,7 @@ end -------------------------------------------------- -- Intel i960 ----@src/emu/cpu/i960/i960.h,CPUS += I960 +--@src/emu/cpu/i960/i960.h,CPUS["I960"] = true -------------------------------------------------- if (CPUS["I960"]~=null) then @@ -904,7 +904,7 @@ end -------------------------------------------------- -- LH5801 ----@src/emu/cpu/lh5801/lh5801.h,CPUS += LH5801 +--@src/emu/cpu/lh5801/lh5801.h,CPUS["LH5801"] = true -------------------------------------------------- if (CPUS["LH5801"]~=null) then @@ -920,7 +920,7 @@ end -------- ------------------------------------------ -- Manchester Small-Scale Experimental Machine ----@src/emu/cpu/ssem/ssem.h,CPUS += SSEM +--@src/emu/cpu/ssem/ssem.h,CPUS["SSEM"] = true -------------------------------------------------- if (CPUS["SSEM"]~=null) then @@ -936,7 +936,7 @@ end -------------------------------------------------- -- Fujitsu MB88xx ----@src/emu/cpu/mb88xx/mb88xx.h,CPUS += MB88XX +--@src/emu/cpu/mb88xx/mb88xx.h,CPUS["MB88XX"] = true -------------------------------------------------- if (CPUS["MB88XX"]~=null) then @@ -952,7 +952,7 @@ end -------------------------------------------------- -- Fujitsu MB86233 ----@src/emu/cpu/mb86233/mb86233.h,CPUS += MB86233 +--@src/emu/cpu/mb86233/mb86233.h,CPUS["MB86233"] = true -------------------------------------------------- if (CPUS["MB86233"]~=null) then @@ -968,7 +968,7 @@ end -------------------------------------------------- -- Fujitsu MB86235 ----@src/emu/cpu/mb86233/mb86235.h,CPUS += MB86235 +--@src/emu/cpu/mb86233/mb86235.h,CPUS["MB86235"] = true -------------------------------------------------- if (CPUS["MB86235"]~=null) then @@ -984,7 +984,7 @@ end -------------------------------------------------- -- Microchip PIC16C5x ----@src/emu/cpu/pic16c5x/pic16c5x.h,CPUS += PIC16C5X +--@src/emu/cpu/pic16c5x/pic16c5x.h,CPUS["PIC16C5X"] = true -------------------------------------------------- if (CPUS["PIC16C5X"]~=null) then @@ -1000,7 +1000,7 @@ end -------------------------------------------------- -- Microchip PIC16C62x ----@src/emu/cpu/pic16c62x/pic16c62x.h,CPUS += PIC16C62X +--@src/emu/cpu/pic16c62x/pic16c62x.h,CPUS["PIC16C62X"] = true -------------------------------------------------- if (CPUS["PIC16C62X"]~=null) then @@ -1017,7 +1017,7 @@ end -------------------------------------------------- -- MIPS R3000 (MIPS I/II) series -- MIPS R4000 (MIPS III/IV) series ----@src/emu/cpu/mips/mips3.h,CPUS += MIPS +--@src/emu/cpu/mips/mips3.h,CPUS["MIPS"] = true -------------------------------------------------- if (CPUS["MIPS"]~=null) then @@ -1041,7 +1041,7 @@ end -------------------------------------------------- -- Sony PlayStation CPU (R3000-based + GTE) ----@src/emu/cpu/psx/psx.h,CPUS += PSX +--@src/emu/cpu/psx/psx.h,CPUS["PSX"] = true -------------------------------------------------- if (CPUS["PSX"]~=null) then @@ -1069,7 +1069,7 @@ end -------------------------------------------------- -- Mitsubishi MELPS 4 series ----@src/emu/cpu/melps4/melps4.h,CPUS += MELPS4 +--@src/emu/cpu/melps4/melps4.h,CPUS["MELPS4"] = true -------------------------------------------------- if (CPUS["MELPS4"]~=null) then @@ -1087,7 +1087,7 @@ end -------------------------------------------------- -- Mitsubishi M37702 and M37710 (based on 65C816) ----@src/emu/cpu/m37710/m37710.h,CPUS += M37710 +--@src/emu/cpu/m37710/m37710.h,CPUS["M37710"] = true -------------------------------------------------- if (CPUS["M37710"]~=null) then @@ -1107,23 +1107,23 @@ end -------------------------------------------------- -- Mostek 6502 and its many derivatives ----@src/emu/cpu/m6502/m6502.h,CPUS += M6502 ----@src/emu/cpu/m6502/deco16.h,CPUS += M6502 ----@src/emu/cpu/m6502/m4510.h,CPUS += M6502 ----@src/emu/cpu/m6502/m65ce02.h,CPUS += M6502 ----@src/emu/cpu/m6502/m65c02.h,CPUS += M6502 ----@src/emu/cpu/m6502/r65c02.h,CPUS += M6502 ----@src/emu/cpu/m6502/m65sc02.h,CPUS += M6502 ----@src/emu/cpu/m6502/m6504.h,CPUS += M6502 ----@src/emu/cpu/m6502/m6509.h,CPUS += M6502 ----@src/emu/cpu/m6502/m6510.h,CPUS += M6502 ----@src/emu/cpu/m6502/m6510t.h,CPUS += M6502 ----@src/emu/cpu/m6502/m7501.h,CPUS += M6502 ----@src/emu/cpu/m6502/m8502.h,CPUS += M6502 ----@src/emu/cpu/m6502/n2a03.h,CPUS += M6502 ----@src/emu/cpu/m6502/m740.h,CPUS += M6502 ----@src/emu/cpu/m6502/m3745x.h,CPUS += M6502 ----@src/emu/cpu/m6502/m5074x.h,CPUS += M6502 +--@src/emu/cpu/m6502/m6502.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/deco16.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m4510.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m65ce02.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m65c02.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/r65c02.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m65sc02.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m6504.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m6509.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m6510.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m6510t.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m7501.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m8502.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/n2a03.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m740.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m3745x.h,CPUS["M6502"] = true +--@src/emu/cpu/m6502/m5074x.h,CPUS["M6502"] = true -------------------------------------------------- @@ -1195,7 +1195,7 @@ end -------------------------------------------------- -- Motorola 680x ----@src/emu/cpu/m6800/m6800.h,CPUS += M6800 +--@src/emu/cpu/m6800/m6800.h,CPUS["M6800"] = true -------------------------------------------------- if (CPUS["M6800"]~=null) then @@ -1211,7 +1211,7 @@ end -------------------------------------------------- -- Motorola 6805 ----@src/emu/cpu/m6805/m6805.h,CPUS += M6805 +--@src/emu/cpu/m6805/m6805.h,CPUS["M6805"] = true -------------------------------------------------- if (CPUS["M6805"]~=null) then @@ -1227,9 +1227,9 @@ end -------------------------------------------------- -- Motorola 6809 ----@src/emu/cpu/m6809/m6809.h,CPUS += M6809 ----@src/emu/cpu/m6809/hd6309.h,CPUS += M6809 ----@src/emu/cpu/m6809/konami.h,CPUS += M6809 +--@src/emu/cpu/m6809/m6809.h,CPUS["M6809"] = true +--@src/emu/cpu/m6809/hd6309.h,CPUS["M6809"] = true +--@src/emu/cpu/m6809/konami.h,CPUS["M6809"] = true -------------------------------------------------- if (CPUS["M6809"]~=null) then @@ -1263,7 +1263,7 @@ end -------------------------------------------------- -- Motorola 68HC11 ----@src/emu/cpu/mc68hc11/mc68hc11.h,CPUS += MC68HC11 +--@src/emu/cpu/mc68hc11/mc68hc11.h,CPUS["MC68HC11"] = true -------------------------------------------------- if (CPUS["MC68HC11"]~=null) then @@ -1279,7 +1279,7 @@ end -------------------------------------------------- -- Motorola 68000 series ----@src/emu/cpu/m68000/m68000.h,CPUS += M680X0 +--@src/emu/cpu/m68000/m68000.h,CPUS["M680X0"] = true -------------------------------------------------- if (CPUS["M680X0"]~=null) then @@ -1297,7 +1297,7 @@ end -------------------------------------------------- -- Motorola/Freescale dsp56k ----@src/emu/cpu/dsp56k/dsp56k.h,CPUS += DSP56156 +--@src/emu/cpu/dsp56k/dsp56k.h,CPUS["DSP56156"] = true -------------------------------------------------- if (CPUS["DSP56156"]~=null) then @@ -1322,8 +1322,8 @@ end -------------------------------------------------- -- PDP-1 -- TX0 ----@src/emu/cpu/pdp1/pdp1.h,CPUS += PDP1 ----@src/emu/cpu/pdp1/tx0.h,CPUS += PDP1 +--@src/emu/cpu/pdp1/pdp1.h,CPUS["PDP1"] = true +--@src/emu/cpu/pdp1/tx0.h,CPUS["PDP1"] = true -------------------------------------------------- if (CPUS["PDP1"]~=null) then @@ -1342,7 +1342,7 @@ end -------------------------------------------------- -- Motorola PowerPC series ----@src/emu/cpu/powerpc/ppc.h,CPUS += POWERPC +--@src/emu/cpu/powerpc/ppc.h,CPUS["POWERPC"] = true -------------------------------------------------- if (CPUS["POWERPC"]~=null) then @@ -1361,8 +1361,8 @@ end -------------------------------------------------- -- NEC V-series Intel-compatible ----@src/emu/cpu/nec/nec.h,CPUS += NEC ----@src/emu/cpu/v30mz/v30mz.h,CPUS += V30MZ +--@src/emu/cpu/nec/nec.h,CPUS["NEC"] = true +--@src/emu/cpu/v30mz/v30mz.h,CPUS["V30MZ"] = true -------------------------------------------------- if (CPUS["NEC"]~=null) then @@ -1394,7 +1394,7 @@ end -------------------------------------------------- -- NEC V60/V70 ----@src/emu/cpu/v60/v60.h,CPUS += V60 +--@src/emu/cpu/v60/v60.h,CPUS["V60"] = true -------------------------------------------------- if (CPUS["V60"]~=null) then @@ -1410,7 +1410,7 @@ end -------------------------------------------------- -- NEC V810 (uPD70732) ----@src/emu/cpu/v810/v810.h,CPUS += V810 +--@src/emu/cpu/v810/v810.h,CPUS["V810"] = true -------------------------------------------------- if (CPUS["V810"]~=null) then @@ -1426,7 +1426,7 @@ end -------------------------------------------------- -- NEC uPD7725 ----@src/emu/cpu/upd7725/upd7725.h,CPUS += UPD7725 +--@src/emu/cpu/upd7725/upd7725.h,CPUS["UPD7725"] = true -------------------------------------------------- if (CPUS["UPD7725"]~=null) then @@ -1442,7 +1442,7 @@ end -------------------------------------------------- -- NEC uPD7810 series ----@src/emu/cpu/upd7810/upd7810.h,CPUS += UPD7810 +--@src/emu/cpu/upd7810/upd7810.h,CPUS["UPD7810"] = true -------------------------------------------------- if (CPUS["UPD7810"]~=null) then @@ -1460,7 +1460,7 @@ end -------------------------------------------------- -- NEC uCOM-4 series ----@src/emu/cpu/ucom4/ucom4.h,CPUS += UCOM4 +--@src/emu/cpu/ucom4/ucom4.h,CPUS["UCOM4"] = true -------------------------------------------------- if (CPUS["UCOM4"]~=null) then @@ -1476,7 +1476,7 @@ end -------------------------------------------------- -- Nintendo Minx ----@src/emu/cpu/minx/minx.h,CPUS += MINX +--@src/emu/cpu/minx/minx.h,CPUS["MINX"] = true -------------------------------------------------- if (CPUS["MINX"]~=null) then @@ -1492,7 +1492,7 @@ end -------------------------------------------------- -- Nintendo/SGI RSP (R3000-based + vector processing) ----@src/emu/cpu/rsp/rsp.h,CPUS += RSP +--@src/emu/cpu/rsp/rsp.h,CPUS["RSP"] = true -------------------------------------------------- if (CPUS["RSP"]~=null) then @@ -1515,7 +1515,7 @@ end -------------------------------------------------- -- Panasonic MN10200 ----@src/emu/cpu/mn10200/mn10200.h,CPUS += MN10200 +--@src/emu/cpu/mn10200/mn10200.h,CPUS["MN10200"] = true -------------------------------------------------- if (CPUS["MN10200"]~=null) then @@ -1531,7 +1531,7 @@ end -------------------------------------------------- -- Saturn ----@src/emu/cpu/saturn/saturn.h,CPUS += SATURN +--@src/emu/cpu/saturn/saturn.h,CPUS["SATURN"] = true -------------------------------------------------- if (CPUS["SATURN"]~=null) then @@ -1547,7 +1547,7 @@ end -------------------------------------------------- -- Signetics 2650 ----@src/emu/cpu/s2650/s2650.h,CPUS += S2650 +--@src/emu/cpu/s2650/s2650.h,CPUS["S2650"] = true -------------------------------------------------- if (CPUS["S2650"]~=null) then @@ -1563,7 +1563,7 @@ end -------------------------------------------------- -- SC61860 ----@src/emu/cpu/sc61860/sc61860.h,CPUS += SC61860 +--@src/emu/cpu/sc61860/sc61860.h,CPUS["SC61860"] = true -------------------------------------------------- if (CPUS["SC61860"]~=null) then @@ -1579,7 +1579,7 @@ end -------------------------------------------------- -- SM8500 ----@src/emu/cpu/sm8500/sm8500.h,CPUS += SM8500 +--@src/emu/cpu/sm8500/sm8500.h,CPUS["SM8500"] = true -------------------------------------------------- if (CPUS["SM8500"]~=null) then @@ -1595,7 +1595,7 @@ end -------------------------------------------------- -- Sony/Nintendo SPC700 ----@src/emu/cpu/spc700/spc700.h,CPUS += SPC700 +--@src/emu/cpu/spc700/spc700.h,CPUS["SPC700"] = true -------------------------------------------------- if (CPUS["SPC700"]~=null) then @@ -1611,7 +1611,7 @@ end -------------------------------------------------- -- SSP1601 ----@src/emu/cpu/ssp1601/ssp1601.h,CPUS += SSP1601 +--@src/emu/cpu/ssp1601/ssp1601.h,CPUS["SSP1601"] = true -------------------------------------------------- if (CPUS["SSP1601"]~=null) then @@ -1627,7 +1627,7 @@ end -------------------------------------------------- -- SunPlus u'nSP ----@src/emu/cpu/unsp/unsp.h,CPUS += UNSP +--@src/emu/cpu/unsp/unsp.h,CPUS["UNSP"] = true -------------------------------------------------- if (CPUS["UNSP"]~=null) then @@ -1643,7 +1643,7 @@ end -------------------------------------------------- -- Atmel 8-bit AVR ----@src/emu/cpu/avr8/avr8.h,CPUS += AVR8 +--@src/emu/cpu/avr8/avr8.h,CPUS["AVR8"] = true -------------------------------------------------- if (CPUS["AVR8"]~=null) then @@ -1659,7 +1659,7 @@ end -------------------------------------------------- -- Texas Instruments TMS0980 ----@src/emu/cpu/tms0980/tms0980.h,CPUS += TMS0980 +--@src/emu/cpu/tms0980/tms0980.h,CPUS["TMS0980"] = true -------------------------------------------------- if (CPUS["TMS0980"]~=null) then @@ -1675,7 +1675,7 @@ end -------------------------------------------------- -- Texas Instruments TMS7000 series ----@src/emu/cpu/tms7000/tms7000.h,CPUS += TMS7000 +--@src/emu/cpu/tms7000/tms7000.h,CPUS["TMS7000"] = true -------------------------------------------------- if (CPUS["TMS7000"]~=null) then @@ -1691,9 +1691,9 @@ end -------------------------------------------------- -- Texas Instruments TMS99xx series ----@src/emu/cpu/tms9900/tms9900.h,CPUS += TMS9900 ----@src/emu/cpu/tms9900/tms9980a.h,CPUS += TMS9900 ----@src/emu/cpu/tms9900/tms9995.h,CPUS += TMS9900 +--@src/emu/cpu/tms9900/tms9900.h,CPUS["TMS9900"] = true +--@src/emu/cpu/tms9900/tms9980a.h,CPUS["TMS9900"] = true +--@src/emu/cpu/tms9900/tms9995.h,CPUS["TMS9900"] = true -------------------------------------------------- @@ -1716,7 +1716,7 @@ end -------------------------------------------------- -- Texas Instruments TMS340x0 graphics controllers ----@src/emu/cpu/tms34010/tms34010.h,CPUS += TMS340X0 +--@src/emu/cpu/tms34010/tms34010.h,CPUS["TMS340X0"] = true -------------------------------------------------- if (CPUS["TMS340X0"]~=null) then @@ -1732,7 +1732,7 @@ end -------------------------------------------------- -- Texas Instruments TMS3201x DSP ----@src/emu/cpu/tms32010/tms32010.h,CPUS += TMS32010 +--@src/emu/cpu/tms32010/tms32010.h,CPUS["TMS32010"] = true -------------------------------------------------- if (CPUS["TMS32010"]~=null) then @@ -1748,7 +1748,7 @@ end -------------------------------------------------- -- Texas Instruments TMS3202x DSP ----@src/emu/cpu/tms32025/tms32025.h,CPUS += TMS32025 +--@src/emu/cpu/tms32025/tms32025.h,CPUS["TMS32025"] = true -------------------------------------------------- if (CPUS["TMS32025"]~=null) then @@ -1764,7 +1764,7 @@ end -------------------------------------------------- -- Texas Instruments TMS3203x DSP ----@src/emu/cpu/tms32031/tms32031.h,CPUS += TMS32031 +--@src/emu/cpu/tms32031/tms32031.h,CPUS["TMS32031"] = true -------------------------------------------------- if (CPUS["TMS32031"]~=null) then @@ -1780,7 +1780,7 @@ end -------------------------------------------------- -- Texas Instruments TMS3205x DSP ----@src/emu/cpu/tms32051/tms32051.h,CPUS += TMS32051 +--@src/emu/cpu/tms32051/tms32051.h,CPUS["TMS32051"] = true -------------------------------------------------- if (CPUS["TMS32051"]~=null) then @@ -1796,7 +1796,7 @@ end -------------------------------------------------- -- Texas Instruments TMS3208x DSP ----@src/emu/cpu/tms32082/tms32082.h,CPUS += TMS32082_MP +--@src/emu/cpu/tms32082/tms32082.h,CPUS["TMS32082"] = true -------------------------------------------------- if (CPUS["TMS32082"]~=null) then @@ -1814,7 +1814,7 @@ end -------------------------------------------------- -- Texas Instruments TMS57002 DSP ----@src/emu/cpu/tms57002/tms57002.h,CPUS += TMS57002 +--@src/emu/cpu/tms57002/tms57002.h,CPUS["TMS57002"] = true -------------------------------------------------- if (CPUS["TMS57002"]~=null) then @@ -1840,7 +1840,7 @@ end -------------------------------------------------- -- Toshiba TLCS-90 Series ----@src/emu/cpu/tlcs90/tlcs90.h,CPUS += TLCS90 +--@src/emu/cpu/tlcs90/tlcs90.h,CPUS["TLCS90"] = true -------------------------------------------------- if (CPUS["TLCS90"]~=null) then @@ -1852,7 +1852,7 @@ end -------------------------------------------------- -- Toshiba TLCS-900 Series ----@src/emu/cpu/tlcs900/tlcs900.h,CPUS += TLCS900 +--@src/emu/cpu/tlcs900/tlcs900.h,CPUS["TLCS900"] = true -------------------------------------------------- if (CPUS["TLCS900"]~=null) then @@ -1868,7 +1868,8 @@ end -------------------------------------------------- -- Zilog Z80 ----@src/emu/cpu/z80/z80.h,CPUS += Z80 +--@src/emu/cpu/z80/z80.h,CPUS["Z80"] = true +--@src/emu/cpu/z80/z80daisy.h,CPUS["Z80"] = true -------------------------------------------------- if (CPUS["Z80"]~=null) then @@ -1892,7 +1893,7 @@ end -------------------------------------------------- -- Sharp LR35902 (Game Boy CPU) ----@src/emu/cpu/lr35902/lr35902.h,CPUS += LR35902 +--@src/emu/cpu/lr35902/lr35902.h,CPUS["LR35902"] = true -------------------------------------------------- if (CPUS["LR35902"]~=null) then @@ -1908,7 +1909,7 @@ end -------------------------------------------------- -- Zilog Z180 ----@src/emu/cpu/z180/z180.h,CPUS += Z180 +--@src/emu/cpu/z180/z180.h,CPUS["Z180"] = true -------------------------------------------------- if (CPUS["Z180"]~=null) then @@ -1926,7 +1927,7 @@ end -------------------------------------------------- -- Zilog Z8000 ----@src/emu/cpu/z8000/z8000.h,CPUS += Z8000 +--@src/emu/cpu/z8000/z8000.h,CPUS["Z8000"] = true -------------------------------------------------- if (CPUS["Z8000"]~=null) then @@ -1942,7 +1943,7 @@ end -------------------------------------------------- -- Zilog Z8 ----@src/emu/cpu/z8/z8.h,CPUS += Z8 +--@src/emu/cpu/z8/z8.h,CPUS["Z8"] = true -------------------------------------------------- if (CPUS["Z8"]~=null) then @@ -1958,7 +1959,7 @@ end -------------------------------------------------- -- Argonaut SuperFX ----@src/emu/cpu/superfx/superfx.h,CPUS += SUPERFX +--@src/emu/cpu/superfx/superfx.h,CPUS["SUPERFX"] = true -------------------------------------------------- if (CPUS["SUPERFX"]~=null) then @@ -1974,7 +1975,7 @@ end -------------------------------------------------- -- Rockwell PPS-4 ----@src/emu/cpu/pps4/pps4.h,CPUS += PPS4 +--@src/emu/cpu/pps4/pps4.h,CPUS["PPS4"] = true -------------------------------------------------- if (CPUS["PPS4"]~=null) then @@ -1990,7 +1991,7 @@ end -------------------------------------------------- -- Hitachi HD61700 ----@src/emu/cpu/hd61700/hd61700.h,CPUS += HD61700 +--@src/emu/cpu/hd61700/hd61700.h,CPUS["HD61700"] = true -------------------------------------------------- if (CPUS["HD61700"]~=null) then @@ -2006,7 +2007,7 @@ end -------------------------------------------------- -- Sanyo LC8670 ----@src/emu/cpu/lc8670/lc8670.h,CPUS += LC8670 +--@src/emu/cpu/lc8670/lc8670.h,CPUS["LC8670"] = true -------------------------------------------------- if (CPUS["LC8670"]~=null) then @@ -2022,7 +2023,7 @@ end -------------------------------------------------- -- Sega SCU DSP ----@src/emu/cpu/scudsp/scudsp.h,CPUS += SCUDSP +--@src/emu/cpu/scudsp/scudsp.h,CPUS["SCUDSP"] = true -------------------------------------------------- if (CPUS["SCUDSP"]~=null) then @@ -2038,7 +2039,7 @@ end -------------------------------------------------- -- Sunplus Technology S+core ----@src/emu/cpu/score/score.h,CPUS += SCORE +--@src/emu/cpu/score/score.h,CPUS["SCORE"] = true -------------------------------------------------- if (CPUS["SCORE"]~=null) then @@ -2054,7 +2055,7 @@ end -------------------------------------------------- -- Xerox Alto-II ----@src/emu/cpu/alto2/alto2cpu.h,CPUS += ALTO2 +--@src/emu/cpu/alto2/alto2cpu.h,CPUS["ALTO2"] = true -------------------------------------------------- if (CPUS["ALTO2"]~=null) then diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 2cd14d3cac4..4a6d1ad6bd5 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -310,8 +310,11 @@ files { MAME_DIR .. "src/emu/video/resnet.h", MAME_DIR .. "src/emu/video/rgbutil.c", MAME_DIR .. "src/emu/video/rgbutil.h", + MAME_DIR .. "src/emu/video/rgbgen.c", MAME_DIR .. "src/emu/video/rgbgen.h", + MAME_DIR .. "src/emu/video/rgbsse.c", MAME_DIR .. "src/emu/video/rgbsse.h", + MAME_DIR .. "src/emu/video/rgbvmx.c", MAME_DIR .. "src/emu/video/rgbvmx.h", MAME_DIR .. "src/emu/video/vector.c", MAME_DIR .. "src/emu/video/vector.h", @@ -408,9 +411,7 @@ function emuProject(_target, _subtarget) dofile(path.join("src", "machine.lua")) - -- netlist now defines a project - dofile(path.join("src", "netlist.lua")) - +if (_OPTIONS["DRIVERS"] == nil) then project ("bus") uuid ("5d782c89-cf7e-4cfe-8f9f-0d4bfc16c91d") kind (LIBTYPE) @@ -448,7 +449,13 @@ function emuProject(_target, _subtarget) end dofile(path.join("src", "bus.lua")) +else + dofile(path.join("src", "bus.lua")) +end + -- netlist now defines a project + dofile(path.join("src", "netlist.lua")) + project ("dasm") uuid ("f2d28b0a-6da5-4f78-b629-d834aa00429d") diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index d081ef6665f..f5a54f0dd68 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -2,7 +2,6 @@ -- copyright-holders:MAMEdev Team project "utils" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "22489ad0-4cb2-4d91-ad81-24b0d80ca30a" kind (LIBTYPE) @@ -99,7 +98,6 @@ project "utils" project "formats" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "f69636b1-fcce-45ce-b09a-113e371a2d7a" kind (LIBTYPE) diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index a11d535b673..1fd72cf5d07 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -12,7 +12,7 @@ --------------------------------------------------- -- ---@src/emu/machine/akiko.h,MACHINES += AKIKO +--@src/emu/machine/akiko.h,MACHINES["AKIKO"] = true --------------------------------------------------- if (MACHINES["AKIKO"]~=null) then @@ -25,7 +25,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/autoconfig.h,MACHINES += AUTOCONFIG +--@src/emu/machine/autoconfig.h,MACHINES["AUTOCONFIG"] = true --------------------------------------------------- if (MACHINES["AUTOCONFIG"]~=null) then @@ -38,7 +38,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cr511b.h,MACHINES += CR511B +--@src/emu/machine/cr511b.h,MACHINES["CR511B"] = true --------------------------------------------------- if (MACHINES["CR511B"]~=null) then @@ -51,7 +51,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/dmac.h,MACHINES += DMAC +--@src/emu/machine/dmac.h,MACHINES["DMAC"] = true --------------------------------------------------- if (MACHINES["DMAC"]~=null) then @@ -64,7 +64,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/gayle.h,MACHINES += GAYLE +--@src/emu/machine/gayle.h,MACHINES["GAYLE"] = true --------------------------------------------------- if (MACHINES["GAYLE"]~=null) then @@ -77,7 +77,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/40105.h,MACHINES += CMOS40105 +--@src/emu/machine/40105.h,MACHINES["CMOS40105"] = true --------------------------------------------------- if (MACHINES["CMOS40105"]~=null) then @@ -90,7 +90,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/53c7xx.h,MACHINES += NCR53C7XX +--@src/emu/machine/53c7xx.h,MACHINES["NCR53C7XX"] = true --------------------------------------------------- if (MACHINES["NCR53C7XX"]~=null) then @@ -103,7 +103,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/53c810.h,MACHINES += LSI53C810 +--@src/emu/machine/53c810.h,MACHINES["LSI53C810"] = true --------------------------------------------------- if (MACHINES["LSI53C810"]~=null) then @@ -116,7 +116,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6522via.h,MACHINES += 6522VIA +--@src/emu/machine/6522via.h,MACHINES["6522VIA"] = true --------------------------------------------------- if (MACHINES["6522VIA"]~=null) then @@ -128,7 +128,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6525tpi.h,MACHINES += TPI6525 +--@src/emu/machine/6525tpi.h,MACHINES["TPI6525"] = true --------------------------------------------------- if (MACHINES["TPI6525"]~=null) then @@ -140,7 +140,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6532riot.h,MACHINES += RIOT6532 +--@src/emu/machine/6532riot.h,MACHINES["RIOT6532"] = true --------------------------------------------------- if (MACHINES["RIOT6532"]~=null) then @@ -152,7 +152,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6821pia.h,MACHINES += 6821PIA +--@src/emu/machine/6821pia.h,MACHINES["6821PIA"] = true --------------------------------------------------- if (MACHINES["6821PIA"]~=null) then @@ -164,7 +164,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6840ptm.h,MACHINES += 6840PTM +--@src/emu/machine/6840ptm.h,MACHINES["6840PTM"] = true --------------------------------------------------- if (MACHINES["6840PTM"]~=null) then @@ -176,7 +176,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/6850acia.h,MACHINES += ACIA6850 +--@src/emu/machine/6850acia.h,MACHINES["ACIA6850"] = true --------------------------------------------------- if (MACHINES["ACIA6850"]~=null) then @@ -188,7 +188,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/68561mpcc.h,MACHINES += 68561MPCC +--@src/emu/machine/68561mpcc.h,MACHINES["68561MPCC"] = true --------------------------------------------------- if (MACHINES["68561MPCC"]~=null) then @@ -200,7 +200,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc68681.h,MACHINES += 68681 +--@src/emu/machine/mc68681.h,MACHINES["68681"] = true --------------------------------------------------- if (MACHINES["68681"]~=null) then @@ -212,7 +212,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/7200fifo.h,MACHINES += 7200FIFO +--@src/emu/machine/7200fifo.h,MACHINES["7200FIFO"] = true --------------------------------------------------- if (MACHINES["7200FIFO"]~=null) then @@ -224,7 +224,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/74123.h,MACHINES += TTL74123 +--@src/emu/machine/74123.h,MACHINES["TTL74123"] = true --------------------------------------------------- if (MACHINES["TTL74123"]~=null) then @@ -237,7 +237,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/74145.h,MACHINES += TTL74145 +--@src/emu/machine/74145.h,MACHINES["TTL74145"] = true --------------------------------------------------- if (MACHINES["TTL74145"]~=null) then @@ -249,7 +249,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/74148.h,MACHINES += TTL74148 +--@src/emu/machine/74148.h,MACHINES["TTL74148"] = true --------------------------------------------------- if (MACHINES["TTL74148"]~=null) then @@ -261,7 +261,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/74153.h,MACHINES += TTL74153 +--@src/emu/machine/74153.h,MACHINES["TTL74153"] = true --------------------------------------------------- if (MACHINES["TTL74153"]~=null) then @@ -273,7 +273,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/74181.h,MACHINES += TTL74181 +--@src/emu/machine/74181.h,MACHINES["TTL74181"] = true --------------------------------------------------- if (MACHINES["TTL74181"]~=null) then @@ -285,7 +285,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/7474.h,MACHINES += TTL7474 +--@src/emu/machine/7474.h,MACHINES["TTL7474"] = true --------------------------------------------------- if (MACHINES["TTL7474"]~=null) then @@ -297,7 +297,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/8042kbdc.h,MACHINES += KBDC8042 +--@src/emu/machine/8042kbdc.h,MACHINES["KBDC8042"] = true --------------------------------------------------- if (MACHINES["KBDC8042"]~=null) then @@ -309,7 +309,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/8530scc.h,MACHINES += 8530SCC +--@src/emu/machine/8530scc.h,MACHINES["8530SCC"] = true --------------------------------------------------- if (MACHINES["8530SCC"]~=null) then @@ -321,7 +321,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/aakart.h,MACHINES += AAKARTDEV +--@src/emu/machine/aakart.h,MACHINES["AAKARTDEV"] = true --------------------------------------------------- if (MACHINES["AAKARTDEV"]~=null) then @@ -333,7 +333,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/adc0808.h,MACHINES += ADC0808 +--@src/emu/machine/adc0808.h,MACHINES["ADC0808"] = true --------------------------------------------------- if (MACHINES["ADC0808"]~=null) then @@ -345,7 +345,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/adc083x.h,MACHINES += ADC083X +--@src/emu/machine/adc083x.h,MACHINES["ADC083X"] = true --------------------------------------------------- if (MACHINES["ADC083X"]~=null) then @@ -357,7 +357,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/adc1038.h,MACHINES += ADC1038 +--@src/emu/machine/adc1038.h,MACHINES["ADC1038"] = true --------------------------------------------------- if (MACHINES["ADC1038"]~=null) then @@ -369,7 +369,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/adc1213x.h,MACHINES += ADC1213X +--@src/emu/machine/adc1213x.h,MACHINES["ADC1213X"] = true --------------------------------------------------- if (MACHINES["ADC1213X"]~=null) then @@ -381,7 +381,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/aicartc.h,MACHINES += AICARTC +--@src/emu/machine/aicartc.h,MACHINES["AICARTC"] = true --------------------------------------------------- if (MACHINES["AICARTC"]~=null) then @@ -393,7 +393,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/am53cf96.h,MACHINES += AM53CF96 +--@src/emu/machine/am53cf96.h,MACHINES["AM53CF96"] = true --------------------------------------------------- if (MACHINES["AM53CF96"]~=null) then @@ -405,7 +405,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/am9517a.h,MACHINES += AM9517A +--@src/emu/machine/am9517a.h,MACHINES["AM9517A"] = true --------------------------------------------------- if (MACHINES["AM9517A"]~=null) then @@ -417,7 +417,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/amigafdc.h,MACHINES += AMIGAFDC +--@src/emu/machine/amigafdc.h,MACHINES["AMIGAFDC"] = true --------------------------------------------------- if (MACHINES["AMIGAFDC"]~=null) then @@ -429,7 +429,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/at28c16.h,MACHINES += AT28C16 +--@src/emu/machine/at28c16.h,MACHINES["AT28C16"] = true --------------------------------------------------- if (MACHINES["AT28C16"]~=null) then @@ -441,7 +441,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/at29040a.h,MACHINES += AT29040 +--@src/emu/machine/at29040a.h,MACHINES["AT29040"] = true --------------------------------------------------- if (MACHINES["AT29040"]~=null) then @@ -453,7 +453,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/at45dbxx.h,MACHINES += AT45DBXX +--@src/emu/machine/at45dbxx.h,MACHINES["AT45DBXX"] = true --------------------------------------------------- if (MACHINES["AT45DBXX"]~=null) then @@ -465,7 +465,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ataflash.h,MACHINES += ATAFLASH +--@src/emu/machine/ataflash.h,MACHINES["ATAFLASH"] = true --------------------------------------------------- if (MACHINES["ATAFLASH"]~=null) then @@ -479,7 +479,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ay31015.h,MACHINES += AY31015 +--@src/emu/machine/ay31015.h,MACHINES["AY31015"] = true --------------------------------------------------- if (MACHINES["AY31015"]~=null) then @@ -491,7 +491,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/bankdev.h,MACHINES += BANKDEV +--@src/emu/machine/bankdev.h,MACHINES["BANKDEV"] = true --------------------------------------------------- if (MACHINES["BANKDEV"]~=null) then @@ -503,7 +503,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cdp1852.h,MACHINES += CDP1852 +--@src/emu/machine/cdp1852.h,MACHINES["CDP1852"] = true --------------------------------------------------- if (MACHINES["CDP1852"]~=null) then @@ -515,7 +515,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cdp1871.h,MACHINES += CDP1871 +--@src/emu/machine/cdp1871.h,MACHINES["CDP1871"] = true --------------------------------------------------- if (MACHINES["CDP1871"]~=null) then @@ -527,7 +527,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/com8116.h,MACHINES += COM8116 +--@src/emu/machine/com8116.h,MACHINES["COM8116"] = true --------------------------------------------------- if (MACHINES["COM8116"]~=null) then @@ -539,7 +539,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cr589.h,MACHINES += CR589 +--@src/emu/machine/cr589.h,MACHINES["CR589"] = true --------------------------------------------------- if (MACHINES["CR589"]~=null) then @@ -551,7 +551,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cs4031.h,MACHINES += CS4031 +--@src/emu/machine/cs4031.h,MACHINES["CS4031"] = true --------------------------------------------------- if (MACHINES["CS4031"]~=null) then @@ -563,7 +563,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/cs8221.h,MACHINES += CS8221 +--@src/emu/machine/cs8221.h,MACHINES["CS8221"] = true --------------------------------------------------- if (MACHINES["CS8221"]~=null) then @@ -575,7 +575,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds1204.h,MACHINES += DS1204 +--@src/emu/machine/ds1204.h,MACHINES["DS1204"] = true --------------------------------------------------- if (MACHINES["DS1204"]~=null) then @@ -587,7 +587,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds1302.h,MACHINES += DS1302 +--@src/emu/machine/ds1302.h,MACHINES["DS1302"] = true --------------------------------------------------- if (MACHINES["DS1302"]~=null) then @@ -599,7 +599,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds1315.h,MACHINES += DS1315 +--@src/emu/machine/ds1315.h,MACHINES["DS1315"] = true --------------------------------------------------- if (MACHINES["DS1315"]~=null) then @@ -611,7 +611,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds2401.h,MACHINES += DS2401 +--@src/emu/machine/ds2401.h,MACHINES["DS2401"] = true --------------------------------------------------- if (MACHINES["DS2401"]~=null) then @@ -623,7 +623,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds2404.h,MACHINES += DS2404 +--@src/emu/machine/ds2404.h,MACHINES["DS2404"] = true --------------------------------------------------- if (MACHINES["DS2404"]~=null) then @@ -635,7 +635,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds75160a.h,MACHINES += DS75160A +--@src/emu/machine/ds75160a.h,MACHINES["DS75160A"] = true --------------------------------------------------- if (MACHINES["DS75160A"]~=null) then @@ -647,7 +647,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ds75161a.h,MACHINES += DS75161A +--@src/emu/machine/ds75161a.h,MACHINES["DS75161A"] = true --------------------------------------------------- if (MACHINES["DS75161A"]~=null) then @@ -659,7 +659,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/e0516.h,MACHINES += E0516 +--@src/emu/machine/e0516.h,MACHINES["E0516"] = true --------------------------------------------------- if (MACHINES["E0516"]~=null) then @@ -671,7 +671,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/e05a03.h,MACHINES += E05A03 +--@src/emu/machine/e05a03.h,MACHINES["E05A03"] = true --------------------------------------------------- if (MACHINES["E05A03"]~=null) then @@ -683,7 +683,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/e05a30.h,MACHINES += E05A30 +--@src/emu/machine/e05a30.h,MACHINES["E05A30"] = true --------------------------------------------------- if (MACHINES["E05A30"]~=null) then @@ -695,9 +695,9 @@ end --------------------------------------------------- -- ---@src/emu/machine/eeprom.h,MACHINES += EEPROMDEV ---@src/emu/machine/eepromser.h,MACHINES += EEPROMDEV ---@src/emu/machine/eeprompar.h,MACHINES += EEPROMDEV +--@src/emu/machine/eeprom.h,MACHINES["EEPROMDEV"] = true +--@src/emu/machine/eepromser.h,MACHINES["EEPROMDEV"] = true +--@src/emu/machine/eeprompar.h,MACHINES["EEPROMDEV"] = true --------------------------------------------------- if (MACHINES["EEPROMDEV"]~=null) then @@ -713,7 +713,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/er2055.h,MACHINES += ER2055 +--@src/emu/machine/er2055.h,MACHINES["ER2055"] = true --------------------------------------------------- if (MACHINES["ER2055"]~=null) then @@ -725,7 +725,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/f3853.h,MACHINES += F3853 +--@src/emu/machine/f3853.h,MACHINES["F3853"] = true --------------------------------------------------- if (MACHINES["F3853"]~=null) then @@ -737,7 +737,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/hd63450.h,MACHINES += HD63450 +--@src/emu/machine/hd63450.h,MACHINES["HD63450"] = true --------------------------------------------------- if (MACHINES["HD63450"]~=null) then @@ -749,7 +749,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/hd64610.h,MACHINES += HD64610 +--@src/emu/machine/hd64610.h,MACHINES["HD64610"] = true --------------------------------------------------- if (MACHINES["HD64610"]~=null) then @@ -761,7 +761,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i2cmem.h,MACHINES += I2CMEM +--@src/emu/machine/i2cmem.h,MACHINES["I2CMEM"] = true --------------------------------------------------- if (MACHINES["I2CMEM"]~=null) then @@ -773,7 +773,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8155.h,MACHINES += I8155 +--@src/emu/machine/i8155.h,MACHINES["I8155"] = true --------------------------------------------------- if (MACHINES["I8155"]~=null) then @@ -785,7 +785,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8212.h,MACHINES += I8212 +--@src/emu/machine/i8212.h,MACHINES["I8212"] = true --------------------------------------------------- if (MACHINES["I8212"]~=null) then @@ -797,7 +797,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8214.h,MACHINES += I8214 +--@src/emu/machine/i8214.h,MACHINES["I8214"] = true --------------------------------------------------- if (MACHINES["I8214"]~=null) then @@ -809,7 +809,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8243.h,MACHINES += I8243 +--@src/emu/machine/i8243.h,MACHINES["I8243"] = true --------------------------------------------------- if (MACHINES["I8243"]~=null) then @@ -821,7 +821,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8251.h,MACHINES += I8251 +--@src/emu/machine/i8251.h,MACHINES["I8251"] = true --------------------------------------------------- if (MACHINES["I8251"]~=null) then @@ -833,7 +833,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8257.h,MACHINES += I8257 +--@src/emu/machine/i8257.h,MACHINES["I8257"] = true --------------------------------------------------- if (MACHINES["I8257"]~=null) then @@ -846,7 +846,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8271.h,MACHINES += I8271 +--@src/emu/machine/i8271.h,MACHINES["I8271"] = true --------------------------------------------------- if (MACHINES["I8271"]~=null) then @@ -858,7 +858,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8279.h,MACHINES += I8279 +--@src/emu/machine/i8279.h,MACHINES["I8279"] = true --------------------------------------------------- if (MACHINES["I8279"]~=null) then @@ -870,7 +870,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8355.h,MACHINES += I8355 +--@src/emu/machine/i8355.h,MACHINES["I8355"] = true --------------------------------------------------- if (MACHINES["I8355"]~=null) then @@ -882,7 +882,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i80130.h,MACHINES += I80130 +--@src/emu/machine/i80130.h,MACHINES["I80130"] = true --------------------------------------------------- if (MACHINES["I80130"]~=null) then @@ -894,8 +894,8 @@ end --------------------------------------------------- -- ---@src/emu/machine/atadev.h,MACHINES += IDE ---@src/emu/machine/ataintf.h,MACHINES += IDE +--@src/emu/machine/atadev.h,MACHINES["IDE"] = true +--@src/emu/machine/ataintf.h,MACHINES["IDE"] = true --------------------------------------------------- if (MACHINES["IDE"]~=null) then @@ -922,7 +922,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/im6402.h,MACHINES += IM6402 +--@src/emu/machine/im6402.h,MACHINES["IM6402"] = true --------------------------------------------------- if (MACHINES["IM6402"]~=null) then @@ -934,7 +934,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ins8154.h,MACHINES += INS8154 +--@src/emu/machine/ins8154.h,MACHINES["INS8154"] = true --------------------------------------------------- if (MACHINES["INS8154"]~=null) then @@ -946,7 +946,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ins8250.h,MACHINES += INS8250 +--@src/emu/machine/ins8250.h,MACHINES["INS8250"] = true --------------------------------------------------- if (MACHINES["INS8250"]~=null) then @@ -958,7 +958,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/intelfsh.h,MACHINES += INTELFLASH +--@src/emu/machine/intelfsh.h,MACHINES["INTELFLASH"] = true --------------------------------------------------- if (MACHINES["INTELFLASH"]~=null) then @@ -970,8 +970,8 @@ end --------------------------------------------------- -- ---@src/emu/machine/jvsdev.h,MACHINES += JVS ---@src/emu/machine/jvshost.h,MACHINES += JVS +--@src/emu/machine/jvsdev.h,MACHINES["JVS"] = true +--@src/emu/machine/jvshost.h,MACHINES["JVS"] = true --------------------------------------------------- if (MACHINES["JVS"]~=null) then @@ -985,7 +985,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/k033906.h,MACHINES += K033906 +--@src/emu/machine/k033906.h,MACHINES["K033906"] = true --------------------------------------------------- if (MACHINES["K033906"]~=null) then @@ -997,7 +997,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/k053252.h,MACHINES += K053252 +--@src/emu/machine/k053252.h,MACHINES["K053252"] = true --------------------------------------------------- if (MACHINES["K053252"]~=null) then @@ -1009,7 +1009,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/k056230.h,MACHINES += K056230 +--@src/emu/machine/k056230.h,MACHINES["K056230"] = true --------------------------------------------------- if (MACHINES["K056230"]~=null) then @@ -1021,7 +1021,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/kb3600.h,MACHINES += KB3600 +--@src/emu/machine/kb3600.h,MACHINES["KB3600"] = true --------------------------------------------------- if (MACHINES["KB3600"]~=null) then @@ -1033,7 +1033,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/kr2376.h,MACHINES += KR2376 +--@src/emu/machine/kr2376.h,MACHINES["KR2376"] = true --------------------------------------------------- if (MACHINES["KR2376"]~=null) then @@ -1045,7 +1045,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/latch8.h,MACHINES += LATCH8 +--@src/emu/machine/latch8.h,MACHINES["LATCH8"] = true --------------------------------------------------- if (MACHINES["LATCH8"]~=null) then @@ -1057,7 +1057,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/lc89510.h,MACHINES += LC89510 +--@src/emu/machine/lc89510.h,MACHINES["LC89510"] = true --------------------------------------------------- if (MACHINES["LC89510"]~=null) then @@ -1069,7 +1069,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ldpr8210.h,MACHINES += LDPR8210 +--@src/emu/machine/ldpr8210.h,MACHINES["LDPR8210"] = true --------------------------------------------------- if (MACHINES["LDPR8210"]~=null) then @@ -1081,7 +1081,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ldstub.h,MACHINES += LDSTUB +--@src/emu/machine/ldstub.h,MACHINES["LDSTUB"] = true --------------------------------------------------- if (MACHINES["LDSTUB"]~=null) then @@ -1093,7 +1093,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ldv1000.h,MACHINES += LDV1000 +--@src/emu/machine/ldv1000.h,MACHINES["LDV1000"] = true --------------------------------------------------- if (MACHINES["LDV1000"]~=null) then @@ -1107,7 +1107,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ldvp931.h,MACHINES += LDVP931 +--@src/emu/machine/ldvp931.h,MACHINES["LDVP931"] = true --------------------------------------------------- if (MACHINES["LDVP931"]~=null) then @@ -1119,7 +1119,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/lh5810.h,MACHINES += LH5810 +--@src/emu/machine/lh5810.h,MACHINES["LH5810"] = true --------------------------------------------------- if (MACHINES["LH5810"]~=null) then @@ -1131,7 +1131,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/linflash.h,MACHINES += LINFLASH +--@src/emu/machine/linflash.h,MACHINES["LINFLASH"] = true --------------------------------------------------- if (MACHINES["LINFLASH"]~=null) then @@ -1143,7 +1143,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/m6m80011ap.h,MACHINES += M6M80011AP +--@src/emu/machine/m6m80011ap.h,MACHINES["M6M80011AP"] = true --------------------------------------------------- if (MACHINES["M6M80011AP"]~=null) then @@ -1155,7 +1155,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/matsucd.h,MACHINES += MATSUCD +--@src/emu/machine/matsucd.h,MACHINES["MATSUCD"] = true --------------------------------------------------- if (MACHINES["MATSUCD"]~=null) then @@ -1167,7 +1167,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb14241.h,MACHINES += MB14241 +--@src/emu/machine/mb14241.h,MACHINES["MB14241"] = true --------------------------------------------------- if (MACHINES["MB14241"]~=null) then @@ -1179,7 +1179,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb3773.h,MACHINES += MB3773 +--@src/emu/machine/mb3773.h,MACHINES["MB3773"] = true --------------------------------------------------- if (MACHINES["MB3773"]~=null) then @@ -1191,7 +1191,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb8421.h,MACHINES += MB8421 +--@src/emu/machine/mb8421.h,MACHINES["MB8421"] = true --------------------------------------------------- if (MACHINES["MB8421"]~=null) then @@ -1203,7 +1203,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb87078.h,MACHINES += MB87078 +--@src/emu/machine/mb87078.h,MACHINES["MB87078"] = true --------------------------------------------------- if (MACHINES["MB87078"]~=null) then @@ -1215,7 +1215,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb8795.h,MACHINES += MB8795 +--@src/emu/machine/mb8795.h,MACHINES["MB8795"] = true --------------------------------------------------- if (MACHINES["MB8795"]~=null) then @@ -1227,7 +1227,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb89352.h,MACHINES += MB89352 +--@src/emu/machine/mb89352.h,MACHINES["MB89352"] = true --------------------------------------------------- if (MACHINES["MB89352"]~=null) then @@ -1239,7 +1239,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mb89371.h,MACHINES += MB89371 +--@src/emu/machine/mb89371.h,MACHINES["MB89371"] = true --------------------------------------------------- if (MACHINES["MB89371"]~=null) then @@ -1251,7 +1251,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc146818.h,MACHINES += MC146818 +--@src/emu/machine/mc146818.h,MACHINES["MC146818"] = true --------------------------------------------------- if (MACHINES["MC146818"]~=null) then @@ -1265,7 +1265,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc2661.h,MACHINES += MC2661 +--@src/emu/machine/mc2661.h,MACHINES["MC2661"] = true --------------------------------------------------- if (MACHINES["MC2661"]~=null) then @@ -1277,7 +1277,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc6843.h,MACHINES += MC6843 +--@src/emu/machine/mc6843.h,MACHINES["MC6843"] = true --------------------------------------------------- if (MACHINES["MC6843"]~=null) then @@ -1289,7 +1289,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc6846.h,MACHINES += MC6846 +--@src/emu/machine/mc6846.h,MACHINES["MC6846"] = true --------------------------------------------------- if (MACHINES["MC6846"]~=null) then @@ -1301,7 +1301,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc6852.h,MACHINES += MC6852 +--@src/emu/machine/mc6852.h,MACHINES["MC6852"] = true --------------------------------------------------- if (MACHINES["MC6852"]~=null) then @@ -1313,7 +1313,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc6854.h,MACHINES += MC6854 +--@src/emu/machine/mc6854.h,MACHINES["MC6854"] = true --------------------------------------------------- if (MACHINES["MC6854"]~=null) then @@ -1325,7 +1325,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc68328.h,MACHINES += MC68328 +--@src/emu/machine/mc68328.h,MACHINES["MC68328"] = true --------------------------------------------------- if (MACHINES["MC68328"]~=null) then @@ -1337,7 +1337,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mc68901.h,MACHINES += MC68901 +--@src/emu/machine/mc68901.h,MACHINES["MC68901"] = true --------------------------------------------------- if (MACHINES["MC68901"]~=null) then @@ -1349,7 +1349,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mccs1850.h,MACHINES += MCCS1850 +--@src/emu/machine/mccs1850.h,MACHINES["MCCS1850"] = true --------------------------------------------------- if (MACHINES["MCCS1850"]~=null) then @@ -1361,7 +1361,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/68307.h,MACHINES += M68307 +--@src/emu/machine/68307.h,MACHINES["M68307"] = true --------------------------------------------------- if (MACHINES["M68307"]~=null) then @@ -1379,7 +1379,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/68340.h,MACHINES += M68340 +--@src/emu/machine/68340.h,MACHINES["M68340"] = true --------------------------------------------------- if (MACHINES["M68340"]~=null) then @@ -1399,7 +1399,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mcf5206e.h,MACHINES += MCF5206E +--@src/emu/machine/mcf5206e.h,MACHINES["MCF5206E"] = true --------------------------------------------------- if (MACHINES["MCF5206E"]~=null) then @@ -1411,7 +1411,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/microtch.h,MACHINES += MICROTOUCH +--@src/emu/machine/microtch.h,MACHINES["MICROTOUCH"] = true --------------------------------------------------- if (MACHINES["MICROTOUCH"]~=null) then @@ -1423,7 +1423,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mm58274c.h,MACHINES += MM58274C +--@src/emu/machine/mm58274c.h,MACHINES["MM58274C"] = true --------------------------------------------------- if (MACHINES["MM58274C"]~=null) then @@ -1435,7 +1435,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mm74c922.h,MACHINES += MM74C922 +--@src/emu/machine/mm74c922.h,MACHINES["MM74C922"] = true --------------------------------------------------- if (MACHINES["MM74C922"]~=null) then @@ -1447,7 +1447,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos6526.h,MACHINES += MOS6526 +--@src/emu/machine/mos6526.h,MACHINES["MOS6526"] = true --------------------------------------------------- if (MACHINES["MOS6526"]~=null) then @@ -1459,7 +1459,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos6529.h,MACHINES += MOS6529 +--@src/emu/machine/mos6529.h,MACHINES["MOS6529"] = true --------------------------------------------------- if (MACHINES["MOS6529"]~=null) then @@ -1471,7 +1471,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos6702.h,MACHINES += MOS6702 +--@src/emu/machine/mos6702.h,MACHINES["MOS6702"] = true --------------------------------------------------- if (MACHINES["MOS6702"]~=null) then @@ -1483,7 +1483,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos8706.h,MACHINES += MOS8706 +--@src/emu/machine/mos8706.h,MACHINES["MOS8706"] = true --------------------------------------------------- if (MACHINES["MOS8706"]~=null) then @@ -1495,7 +1495,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos8722.h,MACHINES += MOS8722 +--@src/emu/machine/mos8722.h,MACHINES["MOS8722"] = true --------------------------------------------------- if (MACHINES["MOS8722"]~=null) then @@ -1507,7 +1507,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos8726.h,MACHINES += MOS8726 +--@src/emu/machine/mos8726.h,MACHINES["MOS8726"] = true --------------------------------------------------- if (MACHINES["MOS8726"]~=null) then @@ -1519,7 +1519,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos6530.h,MACHINES += MIOT6530 +--@src/emu/machine/mos6530.h,MACHINES["MIOT6530"] = true --------------------------------------------------- if (MACHINES["MIOT6530"]~=null) then @@ -1533,7 +1533,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mos6551.h,MACHINES += MOS6551 +--@src/emu/machine/mos6551.h,MACHINES["MOS6551"] = true --------------------------------------------------- if (MACHINES["MOS6551"]~=null) then @@ -1545,7 +1545,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/msm5832.h,MACHINES += MSM5832 +--@src/emu/machine/msm5832.h,MACHINES["MSM5832"] = true --------------------------------------------------- if (MACHINES["MSM5832"]~=null) then @@ -1557,7 +1557,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/msm58321.h,MACHINES += MSM58321 +--@src/emu/machine/msm58321.h,MACHINES["MSM58321"] = true --------------------------------------------------- if (MACHINES["MSM58321"]~=null) then @@ -1569,7 +1569,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/msm6242.h,MACHINES += MSM6242 +--@src/emu/machine/msm6242.h,MACHINES["MSM6242"] = true --------------------------------------------------- if (MACHINES["MSM6242"]~=null) then @@ -1581,7 +1581,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ncr539x.h,MACHINES += NCR539x +--@src/emu/machine/ncr539x.h,MACHINES["NCR539x"] = true --------------------------------------------------- if (MACHINES["NCR539x"]~=null) then @@ -1594,7 +1594,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/nmc9306.h,MACHINES += NMC9306 +--@src/emu/machine/nmc9306.h,MACHINES["NMC9306"] = true --------------------------------------------------- if (MACHINES["NMC9306"]~=null) then @@ -1606,11 +1606,11 @@ end --------------------------------------------------- -- ---@src/emu/machine/nscsi_bus.h,MACHINES += NSCSI ---@src/emu/machine/nscsi_cb.h,MACHINES += NSCSI ---@src/emu/machine/nscsi_cd.h,MACHINES += NSCSI ---@src/emu/machine/nscsi_hd.h,MACHINES += NSCSI ---@src/emu/machine/nscsi_s1410.h,MACHINES += NSCSI +--@src/emu/machine/nscsi_bus.h,MACHINES["NSCSI"] = true +--@src/emu/machine/nscsi_cb.h,MACHINES["NSCSI"] = true +--@src/emu/machine/nscsi_cd.h,MACHINES["NSCSI"] = true +--@src/emu/machine/nscsi_hd.h,MACHINES["NSCSI"] = true +--@src/emu/machine/nscsi_s1410.h,MACHINES["NSCSI"] = true --------------------------------------------------- if (MACHINES["NSCSI"]~=null) then @@ -1630,7 +1630,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pcf8593.h,MACHINES += PCF8593 +--@src/emu/machine/pcf8593.h,MACHINES["PCF8593"] = true --------------------------------------------------- if (MACHINES["PCF8593"]~=null) then @@ -1642,7 +1642,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/lpci.h,MACHINES += LPCI +--@src/emu/machine/lpci.h,MACHINES["LPCI"] = true --------------------------------------------------- if (MACHINES["LPCI"]~=null) then @@ -1654,7 +1654,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pci.h,MACHINES += PCI +--@src/emu/machine/pci.h,MACHINES["PCI"] = true --------------------------------------------------- if (MACHINES["PCI"]~=null) then @@ -1690,7 +1690,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pckeybrd.h,MACHINES += PCKEYBRD +--@src/emu/machine/pckeybrd.h,MACHINES["PCKEYBRD"] = true --------------------------------------------------- if (MACHINES["PCKEYBRD"]~=null) then @@ -1702,7 +1702,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pic8259.h,MACHINES += PIC8259 +--@src/emu/machine/pic8259.h,MACHINES["PIC8259"] = true --------------------------------------------------- if (MACHINES["PIC8259"]~=null) then @@ -1714,7 +1714,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pit8253.h,MACHINES += PIT8253 +--@src/emu/machine/pit8253.h,MACHINES["PIT8253"] = true --------------------------------------------------- if (MACHINES["PIT8253"]~=null) then @@ -1726,7 +1726,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pla.h,MACHINES += PLA +--@src/emu/machine/pla.h,MACHINES["PLA"] = true --------------------------------------------------- if (MACHINES["PLA"]~=null) then @@ -1738,7 +1738,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/r10696.h,MACHINES += R10696 +--@src/emu/machine/r10696.h,MACHINES["R10696"] = true --------------------------------------------------- if (MACHINES["R10696"]~=null) then @@ -1750,7 +1750,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/r10788.h,MACHINES += R10788 +--@src/emu/machine/r10788.h,MACHINES["R10788"] = true --------------------------------------------------- if (MACHINES["R10788"]~=null) then @@ -1762,7 +1762,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ra17xx.h,MACHINES += RA17XX +--@src/emu/machine/ra17xx.h,MACHINES["RA17XX"] = true --------------------------------------------------- if (MACHINES["RA17XX"]~=null) then @@ -1774,7 +1774,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rf5c296.h,MACHINES += RF5C296 +--@src/emu/machine/rf5c296.h,MACHINES["RF5C296"] = true --------------------------------------------------- if (MACHINES["RF5C296"]~=null) then @@ -1787,7 +1787,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/roc10937.h,MACHINES += ROC10937 +--@src/emu/machine/roc10937.h,MACHINES["ROC10937"] = true --------------------------------------------------- if (MACHINES["ROC10937"]~=null) then @@ -1799,7 +1799,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rp5c01.h,MACHINES += RP5C01 +--@src/emu/machine/rp5c01.h,MACHINES["RP5C01"] = true --------------------------------------------------- if (MACHINES["RP5C01"]~=null) then @@ -1811,7 +1811,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rp5c15.h,MACHINES += RP5C15 +--@src/emu/machine/rp5c15.h,MACHINES["RP5C15"] = true --------------------------------------------------- if (MACHINES["RP5C15"]~=null) then @@ -1823,7 +1823,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rp5h01.h,MACHINES += RP5H01 +--@src/emu/machine/rp5h01.h,MACHINES["RP5H01"] = true --------------------------------------------------- if (MACHINES["RP5H01"]~=null) then @@ -1835,7 +1835,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/64h156.h,MACHINES += R64H156 +--@src/emu/machine/64h156.h,MACHINES["R64H156"] = true --------------------------------------------------- if (MACHINES["R64H156"]~=null) then @@ -1847,7 +1847,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rtc4543.h,MACHINES += RTC4543 +--@src/emu/machine/rtc4543.h,MACHINES["RTC4543"] = true --------------------------------------------------- if (MACHINES["RTC4543"]~=null) then @@ -1859,7 +1859,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rtc65271.h,MACHINES += RTC65271 +--@src/emu/machine/rtc65271.h,MACHINES["RTC65271"] = true --------------------------------------------------- if (MACHINES["RTC65271"]~=null) then @@ -1871,7 +1871,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/rtc9701.h,MACHINES += RTC9701 +--@src/emu/machine/rtc9701.h,MACHINES["RTC9701"] = true --------------------------------------------------- if (MACHINES["RTC9701"]~=null) then @@ -1883,7 +1883,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s2636.h,MACHINES += S2636 +--@src/emu/machine/s2636.h,MACHINES["S2636"] = true --------------------------------------------------- if (MACHINES["S2636"]~=null) then @@ -1895,7 +1895,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s3520cf.h,MACHINES += S3520CF +--@src/emu/machine/s3520cf.h,MACHINES["S3520CF"] = true --------------------------------------------------- if (MACHINES["S3520CF"]~=null) then @@ -1907,7 +1907,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s3c2400.h,MACHINES += S3C2400 +--@src/emu/machine/s3c2400.h,MACHINES["S3C2400"] = true --------------------------------------------------- if (MACHINES["S3C2400"]~=null) then @@ -1920,7 +1920,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s3c2410.h,MACHINES += S3C2410 +--@src/emu/machine/s3c2410.h,MACHINES["S3C2410"] = true --------------------------------------------------- if (MACHINES["S3C2410"]~=null) then @@ -1933,7 +1933,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s3c44b0.h,MACHINES += S3C44B0 +--@src/emu/machine/s3c44b0.h,MACHINES["S3C44B0"] = true --------------------------------------------------- if (MACHINES["S3C44B0"]~=null) then @@ -1945,7 +1945,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/s3c2440.h,MACHINES += S3C2440 +--@src/emu/machine/s3c2440.h,MACHINES["S3C2440"] = true --------------------------------------------------- if (MACHINES["S3C2440"]~=null) then @@ -1958,7 +1958,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/saturn.h,MACHINES += SATURN +--@src/emu/machine/saturn.h,MACHINES["SATURN"] = true --------------------------------------------------- if (MACHINES["SATURN"]~=null) then @@ -1969,7 +1969,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/serflash.h,MACHINES += SERFLASH +--@src/emu/machine/serflash.h,MACHINES["SERFLASH"] = true --------------------------------------------------- if (MACHINES["SERFLASH"]~=null) then @@ -1981,7 +1981,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/smc91c9x.h,MACHINES += SMC91C9X +--@src/emu/machine/smc91c9x.h,MACHINES["SMC91C9X"] = true --------------------------------------------------- if (MACHINES["SMC91C9X"]~=null) then @@ -1993,7 +1993,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/smpc.h,MACHINES += SMPC +--@src/emu/machine/smpc.h,MACHINES["SMPC"] = true --------------------------------------------------- if (MACHINES["SMPC"]~=null) then @@ -2005,7 +2005,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/stvcd.h,MACHINES += STVCD +--@src/emu/machine/stvcd.h,MACHINES["STVCD"] = true --------------------------------------------------- if (MACHINES["STVCD"]~=null) then @@ -2036,7 +2036,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tc009xlvc.h,MACHINES += TC0091LVC +--@src/emu/machine/tc009xlvc.h,MACHINES["TC0091LVC"] = true --------------------------------------------------- if (MACHINES["TC0091LVC"]~=null) then @@ -2048,7 +2048,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/timekpr.h,MACHINES += TIMEKPR +--@src/emu/machine/timekpr.h,MACHINES["TIMEKPR"] = true --------------------------------------------------- if (MACHINES["TIMEKPR"]~=null) then @@ -2060,7 +2060,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tmp68301.h,MACHINES += TMP68301 +--@src/emu/machine/tmp68301.h,MACHINES["TMP68301"] = true --------------------------------------------------- if (MACHINES["TMP68301"]~=null) then @@ -2072,7 +2072,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tms1024.h,MACHINES += TMS1024 +--@src/emu/machine/tms1024.h,MACHINES["TMS1024"] = true --------------------------------------------------- if (MACHINES["TMS1024"]~=null) then @@ -2084,7 +2084,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tms5501.h,MACHINES += TMS5501 +--@src/emu/machine/tms5501.h,MACHINES["TMS5501"] = true --------------------------------------------------- if (MACHINES["TMS5501"]~=null) then @@ -2096,7 +2096,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tms6100.h,MACHINES += TMS6100 +--@src/emu/machine/tms6100.h,MACHINES["TMS6100"] = true --------------------------------------------------- if (MACHINES["TMS6100"]~=null) then @@ -2108,7 +2108,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tms9901.h,MACHINES += TMS9901 +--@src/emu/machine/tms9901.h,MACHINES["TMS9901"] = true --------------------------------------------------- if (MACHINES["TMS9901"]~=null) then @@ -2120,7 +2120,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/tms9902.h,MACHINES += TMS9902 +--@src/emu/machine/tms9902.h,MACHINES["TMS9902"] = true --------------------------------------------------- if (MACHINES["TMS9902"]~=null) then @@ -2132,7 +2132,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd1990a.h,MACHINES += UPD1990A +--@src/emu/machine/upd1990a.h,MACHINES["UPD1990A"] = true --------------------------------------------------- if (MACHINES["UPD1990A"]~=null) then @@ -2144,7 +2144,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd4992.h,MACHINES += UPD4992 +--@src/emu/machine/upd4992.h,MACHINES["UPD4992"] = true --------------------------------------------------- if (MACHINES["UPD4992"]~=null) then @@ -2157,7 +2157,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd4701.h,MACHINES += UPD4701 +--@src/emu/machine/upd4701.h,MACHINES["UPD4701"] = true --------------------------------------------------- if (MACHINES["UPD4701"]~=null) then @@ -2169,7 +2169,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd7002.h,MACHINES += UPD7002 +--@src/emu/machine/upd7002.h,MACHINES["UPD7002"] = true --------------------------------------------------- if (MACHINES["UPD7002"]~=null) then @@ -2181,7 +2181,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd71071.h,MACHINES += UPD71071 +--@src/emu/machine/upd71071.h,MACHINES["UPD71071"] = true --------------------------------------------------- if (MACHINES["UPD71071"]~=null) then @@ -2193,19 +2193,21 @@ end --------------------------------------------------- -- ---@src/emu/machine/upd765.h,MACHINES += UPD765 +--@src/emu/machine/upd765.h,MACHINES["UPD765"] = true --------------------------------------------------- if (MACHINES["UPD765"]~=null) then files { MAME_DIR .. "src/emu/machine/upd765.c", MAME_DIR .. "src/emu/machine/upd765.h", + MAME_DIR .. "src/emu/machine/fdc_pll.c", + MAME_DIR .. "src/emu/machine/fdc_pll.h", } end --------------------------------------------------- -- ---@src/emu/machine/v3021.h,MACHINES += V3021 +--@src/emu/machine/v3021.h,MACHINES["V3021"] = true --------------------------------------------------- if (MACHINES["V3021"]~=null) then @@ -2217,7 +2219,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wd_fdc.h,MACHINES += WD_FDC +--@src/emu/machine/wd_fdc.h,MACHINES["WD_FDC"] = true --------------------------------------------------- if (MACHINES["WD_FDC"]~=null) then @@ -2231,7 +2233,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wd11c00_17.h,MACHINES += WD11C00_17 +--@src/emu/machine/wd11c00_17.h,MACHINES["WD11C00_17"] = true --------------------------------------------------- if (MACHINES["WD11C00_17"]~=null) then @@ -2243,7 +2245,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wd2010.h,MACHINES += WD2010 +--@src/emu/machine/wd2010.h,MACHINES["WD2010"] = true --------------------------------------------------- if (MACHINES["WD2010"]~=null) then @@ -2255,7 +2257,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wd33c93.h,MACHINES += WD33C93 +--@src/emu/machine/wd33c93.h,MACHINES["WD33C93"] = true --------------------------------------------------- if (MACHINES["WD33C93"]~=null) then @@ -2268,7 +2270,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wd7600.h,MACHINES += WD7600 +--@src/emu/machine/wd7600.h,MACHINES["WD7600"] = true --------------------------------------------------- if (MACHINES["WD7600"]~=null) then @@ -2280,7 +2282,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/x2212.h,MACHINES += X2212 +--@src/emu/machine/x2212.h,MACHINES["X2212"] = true --------------------------------------------------- if (MACHINES["X2212"]~=null) then @@ -2292,7 +2294,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/x76f041.h,MACHINES += X76F041 +--@src/emu/machine/x76f041.h,MACHINES["X76F041"] = true --------------------------------------------------- if (MACHINES["X76F041"]~=null) then @@ -2304,7 +2306,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/x76f100.h,MACHINES += X76F100 +--@src/emu/machine/x76f100.h,MACHINES["X76F100"] = true --------------------------------------------------- if (MACHINES["X76F100"]~=null) then @@ -2316,7 +2318,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ym2148.h,MACHINES += YM2148 +--@src/emu/machine/ym2148.h,MACHINES["YM2148"] = true --------------------------------------------------- if (MACHINES["YM2148"]~=null) then @@ -2328,7 +2330,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z80ctc.h,MACHINES += Z80CTC +--@src/emu/machine/z80ctc.h,MACHINES["Z80CTC"] = true --------------------------------------------------- if (MACHINES["Z80CTC"]~=null) then @@ -2340,7 +2342,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z80dart.h,MACHINES += Z80DART +--@src/emu/machine/z80dart.h,MACHINES["Z80DART"] = true --------------------------------------------------- if (MACHINES["Z80DART"]~=null) then @@ -2352,7 +2354,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z80dma.h,MACHINES += Z80DMA +--@src/emu/machine/z80dma.h,MACHINES["Z80DMA"] = true --------------------------------------------------- if (MACHINES["Z80DMA"]~=null) then @@ -2364,7 +2366,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z80pio.h,MACHINES += Z80PIO +--@src/emu/machine/z80pio.h,MACHINES["Z80PIO"] = true --------------------------------------------------- if (MACHINES["Z80PIO"]~=null) then @@ -2376,7 +2378,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z80sti.h,MACHINES += Z80STI +--@src/emu/machine/z80sti.h,MACHINES["Z80STI"] = true --------------------------------------------------- if (MACHINES["Z80STI"]~=null) then @@ -2388,7 +2390,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/z8536.h,MACHINES += Z8536 +--@src/emu/machine/z8536.h,MACHINES["Z8536"] = true --------------------------------------------------- if (MACHINES["Z8536"]~=null) then @@ -2400,7 +2402,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pccard.h,MACHINES += PCCARD +--@src/emu/machine/pccard.h,MACHINES["PCCARD"] = true --------------------------------------------------- if (MACHINES["PCCARD"]~=null) then @@ -2412,7 +2414,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/i8255.h,MACHINES += I8255 +--@src/emu/machine/i8255.h,MACHINES["I8255"] = true --------------------------------------------------- if (MACHINES["I8255"]~=null) then @@ -2426,7 +2428,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ncr5380.h,MACHINES += NCR5380 +--@src/emu/machine/ncr5380.h,MACHINES["NCR5380"] = true --------------------------------------------------- if (MACHINES["NCR5380"]~=null) then @@ -2438,7 +2440,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ncr5380n.h,MACHINES += NCR5380N +--@src/emu/machine/ncr5380n.h,MACHINES["NCR5380N"] = true --------------------------------------------------- if (MACHINES["NCR5380N"]~=null) then @@ -2450,7 +2452,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ncr5389.h,MACHINES += NCR5390 +--@src/emu/machine/ncr5389.h,MACHINES["NCR5390"] = true --------------------------------------------------- if (MACHINES["NCR5390"]~=null) then @@ -2462,7 +2464,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mm58167.h,MACHINES += MM58167 +--@src/emu/machine/mm58167.h,MACHINES["MM58167"] = true --------------------------------------------------- if (MACHINES["MM58167"]~=null) then @@ -2475,7 +2477,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/dp8390.h,MACHINES += DP8390 +--@src/emu/machine/dp8390.h,MACHINES["DP8390"] = true --------------------------------------------------- if (MACHINES["DP8390"]~=null) then @@ -2487,7 +2489,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pc_lpt.h,MACHINES += PC_LPT +--@src/emu/machine/pc_lpt.h,MACHINES["PC_LPT"] = true --------------------------------------------------- if (MACHINES["PC_LPT"]~=null) then @@ -2499,7 +2501,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pc_fdc.h,MACHINES += PC_FDC +--@src/emu/machine/pc_fdc.h,MACHINES["PC_FDC"] = true --------------------------------------------------- if (MACHINES["PC_FDC"]~=null) then @@ -2511,7 +2513,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/mpu401.h,MACHINES += MPU401 +--@src/emu/machine/mpu401.h,MACHINES["MPU401"] = true --------------------------------------------------- if (MACHINES["MPU401"]~=null) then @@ -2523,7 +2525,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/at_keybc.h,MACHINES += AT_KEYBC +--@src/emu/machine/at_keybc.h,MACHINES["AT_KEYBC"] = true --------------------------------------------------- if (MACHINES["AT_KEYBC"]~=null) then @@ -2535,7 +2537,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/smc92x4.h,MACHINES += SMC92X4 +--@src/emu/machine/smc92x4.h,MACHINES["SMC92X4"] = true --------------------------------------------------- if (MACHINES["SMC92X4"]~=null) then @@ -2547,7 +2549,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/hdc9234.h,MACHINES += HDC9234 +--@src/emu/machine/hdc9234.h,MACHINES["HDC9234"] = true --------------------------------------------------- if (MACHINES["HDC9234"]~=null) then @@ -2559,7 +2561,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/ti99_hd.h,MACHINES += TI99_HD +--@src/emu/machine/ti99_hd.h,MACHINES["TI99_HD"] = true --------------------------------------------------- if (MACHINES["TI99_HD"]~=null) then @@ -2571,7 +2573,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/strata.h,MACHINES += STRATA +--@src/emu/machine/strata.h,MACHINES["STRATA"] = true --------------------------------------------------- if (MACHINES["STRATA"]~=null) then @@ -2583,7 +2585,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/steppers.h,MACHINES += STEPPERS +--@src/emu/machine/steppers.h,MACHINES["STEPPERS"] = true --------------------------------------------------- if (MACHINES["STEPPERS"]~=null) then @@ -2595,7 +2597,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/corvushd.h,MACHINES += CORVUSHD +--@src/emu/machine/corvushd.h,MACHINES["CORVUSHD"] = true --------------------------------------------------- if (MACHINES["CORVUSHD"]~=null) then files { @@ -2606,7 +2608,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/wozfdc.h,MACHINES += WOZFDC +--@src/emu/machine/wozfdc.h,MACHINES["WOZFDC"] = true --------------------------------------------------- if (MACHINES["WOZFDC"]~=null) then files { @@ -2617,7 +2619,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/diablo_hd.h,MACHINES += DIABLO_HD +--@src/emu/machine/diablo_hd.h,MACHINES["DIABLO_HD"] = true --------------------------------------------------- if (MACHINES["DIABLO_HD"]~=null) then files { @@ -2628,7 +2630,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/fdc37c665gt.h,MACHINES += FDC37C665GT +--@src/emu/machine/fdc37c665gt.h,MACHINES["FDC37C665GT"] = true --------------------------------------------------- if (MACHINES["FDC37C665GT"]~=null) then @@ -2640,7 +2642,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/pci9050.h,MACHINES += PCI9050 +--@src/emu/machine/pci9050.h,MACHINES["PCI9050"] = true --------------------------------------------------- if (MACHINES["PCI9050"]~=null) then @@ -2652,7 +2654,7 @@ end --------------------------------------------------- -- ---@src/emu/machine/netlist.h,MACHINES += NETLIST +--@src/emu/machine/netlist.h,MACHINES["NETLIST"] = true --------------------------------------------------- if (MACHINES["NETLIST"]~=null) then diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 6bbdc01833c..25cc1a32ca7 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -2,6 +2,7 @@ -- copyright-holders:MAMEdev Team function mainProject(_target, _subtarget) +if (_OPTIONS["DRIVERS"] == nil) then if (_target == _subtarget) then project (_target) else @@ -11,6 +12,9 @@ function mainProject(_target, _subtarget) project (_target .. _subtarget) end end +else + project (_subtarget) +end uuid (os.uuid(_target .."_" .. _subtarget)) kind "ConsoleApp" @@ -34,7 +38,7 @@ function mainProject(_target, _subtarget) flags { "Unicode", } - +if (_OPTIONS["DRIVERS"] == nil) then configuration { "x64", "Release" } targetsuffix "64" if _OPTIONS["PROFILE"] then @@ -70,7 +74,7 @@ function mainProject(_target, _subtarget) if _OPTIONS["PROFILE"] then targetsuffix "dp" end - +end configuration { "mingw*" or "vs*" } targetextension ".exe" @@ -86,17 +90,23 @@ function mainProject(_target, _subtarget) findfunction("linkProjects_" .. _OPTIONS["target"] .. "_" .. _OPTIONS["subtarget"])(_OPTIONS["target"], _OPTIONS["subtarget"]) links { "osd_" .. _OPTIONS["osd"], - "bus", + } + if (_OPTIONS["DRIVERS"] == nil) then + links { + "bus", + } + end + links { "netlist", "optional", "emu", + "formats", "dasm", "utils", "expat", "softfloat", "jpeg", "7z", - "formats", "lua", "lsqlite3", "jsoncpp", @@ -214,6 +224,8 @@ function mainProject(_target, _subtarget) MAME_DIR .. "src/version.c", GEN_DIR .. _target .. "/" .. _subtarget .."/drivlist.c", } + +if (_OPTIONS["DRIVERS"] == nil) then dependency { { "../../../../generated/mame/mame/drivlist.c", MAME_DIR .. "src/mame/mess.lst", true }, { "../../../../generated/mame/mame/drivlist.c" , MAME_DIR .. "src/mame/arcade.lst", true}, @@ -221,7 +233,13 @@ function mainProject(_target, _subtarget) custombuildtask { { MAME_DIR .. "src/".._target .."/" .. _subtarget ..".lst" , GEN_DIR .. _target .. "/" .. _subtarget .."/drivlist.c", { MAME_DIR .. "src/build/makelist.py" }, {"@echo Building driver list...", PYTHON .. " $(1) $(<) > $(@)" }}, } - +end + configuration { "gmake" } + dependency { + { ".PHONY", ".FORCE", true }, + { "$(OBJDIR)/src/version.o", ".FORCE", true }, + } + configuration { "mingw*" } custombuildtask { { MAME_DIR .. "src/version.c" , GEN_DIR .. "/resource/" .. rctarget .. "vers.rc", { MAME_DIR .. "src/build/verinfo.py" }, {"@echo Emitting " .. rctarget .. "vers.rc" .. "...", PYTHON .. " $(1) -r -b " .. rctarget .. " $(<) > $(@)" }}, diff --git a/scripts/src/netlist.lua b/scripts/src/netlist.lua index b0e3f0cab0b..1a0cca92a99 100644 --- a/scripts/src/netlist.lua +++ b/scripts/src/netlist.lua @@ -2,7 +2,6 @@ -- copyright-holders:MAMEdev Team project "netlist" - targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) uuid "665ef8ac-2a4c-4c3e-a05f-fd1e5db11de9" kind (LIBTYPE) @@ -55,18 +54,20 @@ project "netlist" MAME_DIR .. "src/emu/netlist/analog/nld_bjt.h", MAME_DIR .. "src/emu/netlist/analog/nld_fourterm.c", MAME_DIR .. "src/emu/netlist/analog/nld_fourterm.h", - MAME_DIR .. "src/emu/netlist/analog/nld_solver.c", - MAME_DIR .. "src/emu/netlist/analog/nld_solver.h", MAME_DIR .. "src/emu/netlist/analog/nld_switches.c", MAME_DIR .. "src/emu/netlist/analog/nld_switches.h", MAME_DIR .. "src/emu/netlist/analog/nld_twoterm.c", MAME_DIR .. "src/emu/netlist/analog/nld_twoterm.h", MAME_DIR .. "src/emu/netlist/analog/nld_opamps.c", MAME_DIR .. "src/emu/netlist/analog/nld_opamps.h", - MAME_DIR .. "src/emu/netlist/analog/nld_ms_direct.h", - MAME_DIR .. "src/emu/netlist/analog/nld_ms_direct1.h", - MAME_DIR .. "src/emu/netlist/analog/nld_ms_direct2.h", - MAME_DIR .. "src/emu/netlist/analog/nld_ms_gauss_seidel.h", + MAME_DIR .. "src/emu/netlist/solver/nld_solver.c", + MAME_DIR .. "src/emu/netlist/solver/nld_solver.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_direct.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_direct1.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_direct2.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_sor.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_sor_math.h", + MAME_DIR .. "src/emu/netlist/solver/nld_ms_gmres.h", MAME_DIR .. "src/emu/netlist/devices/nld_4020.c", MAME_DIR .. "src/emu/netlist/devices/nld_4020.h", MAME_DIR .. "src/emu/netlist/devices/nld_4066.c", diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua index 3ddb7e9bd13..1c94d013c21 100644 --- a/scripts/src/sound.lua +++ b/scripts/src/sound.lua @@ -12,10 +12,10 @@ --------------------------------------------------- -- DACs ---@src/emu/sound/dac.h,SOUNDS += DAC ---@src/emu/sound/dmadac.h,SOUNDS += DMADAC ---@src/emu/sound/speaker.h,SOUNDS += SPEAKER ---@src/emu/sound/beep.h,SOUNDS += BEEP +--@src/emu/sound/dac.h,SOUNDS["DAC"] = true +--@src/emu/sound/dmadac.h,SOUNDS["DMADAC"] = true +--@src/emu/sound/speaker.h,SOUNDS["SPEAKER"] = true +--@src/emu/sound/beep.h,SOUNDS["BEEP"] = true --------------------------------------------------- if (SOUNDS["DAC"]~=null) then @@ -50,7 +50,7 @@ end --------------------------------------------------- -- CD audio ---@src/emu/sound/cdda.h,SOUNDS += CDDA +--@src/emu/sound/cdda.h,SOUNDS["CDDA"] = true --------------------------------------------------- if (SOUNDS["CDDA"]~=null) then @@ -64,7 +64,7 @@ end --------------------------------------------------- -- Discrete component audio ---@src/emu/sound/discrete.h,SOUNDS += DISCRETE +--@src/emu/sound/discrete.h,SOUNDS["DISCRETE"] = true --------------------------------------------------- if (SOUNDS["DISCRETE"]~=null) then @@ -87,7 +87,7 @@ end --------------------------------------------------- -- AC97 ---@src/emu/sound/pic-ac97.h,SOUNDS += AC97 +--@src/emu/sound/pic-ac97.h,SOUNDS["AC97"] = true --------------------------------------------------- if (SOUNDS["AC97"]~=null) then @@ -101,8 +101,8 @@ end --------------------------------------------------- -- Apple custom sound chips ---@src/emu/sound/asc.h,SOUNDS += ASC ---@src/emu/sound/awacs.h,SOUNDS += AWACS +--@src/emu/sound/asc.h,SOUNDS["ASC"] = true +--@src/emu/sound/awacs.h,SOUNDS["AWACS"] = true --------------------------------------------------- if (SOUNDS["ASC"]~=null) then @@ -122,8 +122,8 @@ end --------------------------------------------------- -- Atari custom sound chips ---@src/emu/sound/pokey.h,SOUNDS += POKEY ---@src/emu/sound/tiaintf.h,SOUNDS += TIA +--@src/emu/sound/pokey.h,SOUNDS["POKEY"] = true +--@src/emu/sound/tiaintf.h,SOUNDS["TIA"] = true --------------------------------------------------- if (SOUNDS["POKEY"]~=null) then @@ -146,7 +146,7 @@ end --------------------------------------------------- -- Amiga audio hardware ---@src/emu/sound/amiga.h,SOUNDS += AMIGA +--@src/emu/sound/amiga.h,SOUNDS["AMIGA"] = true --------------------------------------------------- if (SOUNDS["AMIGA"]~=null) then @@ -160,7 +160,7 @@ end --------------------------------------------------- -- Bally Astrocade sound system ---@src/emu/sound/astrocde.h,SOUNDS += ASTROCADE +--@src/emu/sound/astrocde.h,SOUNDS["ASTROCADE"] = true --------------------------------------------------- if (SOUNDS["ASTROCADE"]~=null) then @@ -175,7 +175,7 @@ end --------------------------------------------------- --------------------------------------------------- -- AC97 ---@src/emu/sound/pic-ac97.h,SOUNDS += AC97 +--@src/emu/sound/pic-ac97.h,SOUNDS["AC97"] = true --------------------------------------------------- if (SOUNDS["AC97"]~=null) then @@ -185,7 +185,7 @@ if (SOUNDS["AC97"]~=null) then } end -- CEM 3394 analog synthesizer chip ---@src/emu/sound/cem3394.h,SOUNDS += CEM3394 +--@src/emu/sound/cem3394.h,SOUNDS["CEM3394"] = true --------------------------------------------------- if (SOUNDS["CEM3394"]~=null) then @@ -199,7 +199,7 @@ end --------------------------------------------------- -- Creative Labs SB0400 Audigy2 Value ---@src/emu/sound/sb0400.h,SOUNDS += AC97 +--@src/emu/sound/sb0400.h,SOUNDS["SB0400"] = true --------------------------------------------------- if (SOUNDS["SB0400"]~=null) then @@ -212,7 +212,7 @@ end -------------------------------------------------- -- Creative Labs Ensonic AudioPCI97 ES1373 ---@src/emu/sound/es1373.h,SOUNDS += ES1373 +--@src/emu/sound/es1373.h,SOUNDS["ES1373"] = true -------------------------------------------------- if (SOUNDS["ES1373"]~=null) then @@ -224,7 +224,7 @@ end --------------------------------------------------- -- Data East custom sound chips ---@src/emu/sound/bsmt2000.h,SOUNDS += BSMT2000 +--@src/emu/sound/bsmt2000.h,SOUNDS["BSMT2000"] = true --------------------------------------------------- if (SOUNDS["BSMT2000"]~=null) then @@ -238,7 +238,7 @@ end --------------------------------------------------- -- Ensoniq 5503 (Apple IIgs) ---@src/emu/sound/es5503.h,SOUNDS += ES5503 +--@src/emu/sound/es5503.h,SOUNDS["ES5503"] = true --------------------------------------------------- if (SOUNDS["ES5503"]~=null) then @@ -252,7 +252,7 @@ end --------------------------------------------------- -- Ensoniq 5505/5506 ---@src/emu/sound/es5506.h,SOUNDS += ES5505 +--@src/emu/sound/es5506.h,SOUNDS["ES5505"] = true --------------------------------------------------- if (SOUNDS["ES5505"]~=null or SOUNDS["ES5506"]~=null) then @@ -265,7 +265,7 @@ end --------------------------------------------------- -- Ensoniq "pump" device, interfaces 5505/5506 with 5510 ---@src/emu/sound/esqpump.h,SOUNDS += ESQPUMP +--@src/emu/sound/esqpump.h,SOUNDS["ESQPUMP"] = true --------------------------------------------------- if (SOUNDS["ESQPUMP"]~=null) then @@ -278,7 +278,7 @@ end --------------------------------------------------- -- Excellent Systems ADPCM sound chip ---@src/emu/sound/es8712.h,SOUNDS += ES8712 +--@src/emu/sound/es8712.h,SOUNDS["ES8712"] = true --------------------------------------------------- if (SOUNDS["ES8712"]~=null) then @@ -292,7 +292,7 @@ end --------------------------------------------------- -- Gaelco custom sound chips ---@src/emu/sound/gaelco.h,SOUNDS += GAELCO_CG1V +--@src/emu/sound/gaelco.h,SOUNDS["GAELCO_CG1V"] = true --------------------------------------------------- if (SOUNDS["GAELCO_CG1V"]~=null or SOUNDS["GAELCO_GAE1"]~=null) then @@ -305,7 +305,7 @@ end --------------------------------------------------- -- RCA CDP1863 ---@src/emu/sound/cdp1863.h,SOUNDS += CDP1863 +--@src/emu/sound/cdp1863.h,SOUNDS["CDP1863"] = true --------------------------------------------------- if (SOUNDS["CDP1863"]~=null) then @@ -319,7 +319,7 @@ end --------------------------------------------------- -- RCA CDP1864 ---@src/emu/sound/cdp1864.h,SOUNDS += CDP1864 +--@src/emu/sound/cdp1864.h,SOUNDS["CDP1864"] = true --------------------------------------------------- if (SOUNDS["CDP1864"]~=null) then @@ -333,7 +333,7 @@ end --------------------------------------------------- -- RCA CDP1869 ---@src/emu/sound/cdp1869.h,SOUNDS += CDP1869 +--@src/emu/sound/cdp1869.h,SOUNDS["CDP1869"] = true --------------------------------------------------- if (SOUNDS["CDP1869"]~=null) then @@ -347,7 +347,7 @@ end --------------------------------------------------- -- GI AY-8910 ---@src/emu/sound/ay8910.h,SOUNDS += AY8910 +--@src/emu/sound/ay8910.h,SOUNDS["AY8910"] = true --------------------------------------------------- if (SOUNDS["AY8910"]~=null) then @@ -361,7 +361,7 @@ end --------------------------------------------------- -- Harris HC55516 CVSD ---@src/emu/sound/hc55516.h,SOUNDS += HC55516 +--@src/emu/sound/hc55516.h,SOUNDS["HC55516"] = true --------------------------------------------------- if (SOUNDS["HC55516"]~=null) then @@ -375,7 +375,7 @@ end --------------------------------------------------- -- Hudsonsoft C6280 sound chip ---@src/emu/sound/c6280.h,SOUNDS += C6280 +--@src/emu/sound/c6280.h,SOUNDS["C6280"] = true --------------------------------------------------- if (SOUNDS["C6280"]~=null) then @@ -389,7 +389,7 @@ end --------------------------------------------------- -- ICS2115 sound chip ---@src/emu/sound/ics2115.h,SOUNDS += ICS2115 +--@src/emu/sound/ics2115.h,SOUNDS["ICS2115"] = true --------------------------------------------------- if (SOUNDS["ICS2115"]~=null) then @@ -403,7 +403,7 @@ end --------------------------------------------------- -- Imagetek I5000 sound ---@src/emu/sound/i5000.h,SOUNDS += I5000_SND +--@src/emu/sound/i5000.h,SOUNDS["I5000_SND"] = true --------------------------------------------------- if (SOUNDS["I5000_SND"]~=null) then @@ -417,7 +417,7 @@ end --------------------------------------------------- -- Irem custom sound chips ---@src/emu/sound/iremga20.h,SOUNDS += IREMGA20 +--@src/emu/sound/iremga20.h,SOUNDS["IREMGA20"] = true --------------------------------------------------- if (SOUNDS["IREMGA20"]~=null) then @@ -431,12 +431,12 @@ end --------------------------------------------------- -- Konami custom sound chips ---@src/emu/sound/k005289.h,SOUNDS += K005289 ---@src/emu/sound/k007232.h,SOUNDS += K007232 ---@src/emu/sound/k051649.h,SOUNDS += K051649 ---@src/emu/sound/k053260.h,SOUNDS += K053260 ---@src/emu/sound/k054539.h,SOUNDS += K054539 ---@src/emu/sound/k056800.h,SOUNDS += K056800 +--@src/emu/sound/k005289.h,SOUNDS["K005289"] = true +--@src/emu/sound/k007232.h,SOUNDS["K007232"] = true +--@src/emu/sound/k051649.h,SOUNDS["K051649"] = true +--@src/emu/sound/k053260.h,SOUNDS["K053260"] = true +--@src/emu/sound/k054539.h,SOUNDS["K054539"] = true +--@src/emu/sound/k056800.h,SOUNDS["K056800"] = true --------------------------------------------------- if (SOUNDS["K005289"]~=null) then @@ -484,7 +484,7 @@ end --------------------------------------------------- -- L7A1045 L6028 DSP-A ---@src/emu/sound/l7a1045_l6028_dsp_a.h,SOUNDS += L7A1045 +--@src/emu/sound/l7a1045_l6028_dsp_a.h,SOUNDS["L7A1045"] = true --------------------------------------------------- if (SOUNDS["L7A1045"]~=null) then @@ -497,7 +497,7 @@ end --------------------------------------------------- -- LMC1992 mixer chip ---@src/emu/sound/lmc1992.h,SOUNDS += LMC1992 +--@src/emu/sound/lmc1992.h,SOUNDS["LMC1992"] = true --------------------------------------------------- if (SOUNDS["LMC1992"]~=null) then @@ -511,7 +511,7 @@ end --------------------------------------------------- -- MAS 3507D MPEG 1/2 Layer 2/3 Audio Decoder ---@src/emu/sound/mas3507d.h,SOUNDS += MAS3507D +--@src/emu/sound/mas3507d.h,SOUNDS["MAS3507D"] = true --------------------------------------------------- if (SOUNDS["MAS3507D"]~=null) then @@ -525,7 +525,7 @@ end --------------------------------------------------- -- MOS 6560VIC ---@src/emu/sound/mos6560.h,SOUNDS += MOS656X +--@src/emu/sound/mos6560.h,SOUNDS["MOS656X"] = true --------------------------------------------------- if (SOUNDS["MOS656X"]~=null) then @@ -539,7 +539,7 @@ end --------------------------------------------------- -- MOS 7360 TED ---@src/emu/sound/mos7360.h,SOUNDS += MOS7360 +--@src/emu/sound/mos7360.h,SOUNDS["MOS7360"] = true --------------------------------------------------- if (SOUNDS["MOS7360"]~=null) then @@ -553,10 +553,10 @@ end --------------------------------------------------- -- Namco custom sound chips ---@src/emu/sound/namco.h,SOUNDS += NAMCO ---@src/emu/sound/n63701x.h,SOUNDS += NAMCO_63701X ---@src/emu/sound/c140.h,SOUNDS += C140 ---@src/emu/sound/c352.h,SOUNDS += C352 +--@src/emu/sound/namco.h,SOUNDS["NAMCO"] = true +--@src/emu/sound/n63701x.h,SOUNDS["NAMCO_63701X"] = true +--@src/emu/sound/c140.h,SOUNDS["C140"] = true +--@src/emu/sound/c352.h,SOUNDS["C352"] = true --------------------------------------------------- if (SOUNDS["NAMCO"]~=null or SOUNDS["NAMCO_15XX"]~=null or SOUNDS["NAMCO_CUS30"]~=null) then @@ -591,7 +591,7 @@ end --------------------------------------------------- -- National Semiconductor Digitalker ---@src/emu/sound/digitalk.h,SOUNDS += DIGITALKER +--@src/emu/sound/digitalk.h,SOUNDS["DIGITALKER"] = true --------------------------------------------------- if (SOUNDS["DIGITALKER"]~=null) then @@ -605,7 +605,7 @@ end --------------------------------------------------- -- Nintendo custom sound chips ---@src/emu/sound/nes_apu.h,SOUNDS += NES_APU +--@src/emu/sound/nes_apu.h,SOUNDS["NES_APU"] = true --------------------------------------------------- if (SOUNDS["NES_APU"]~=null) then @@ -620,7 +620,7 @@ end --------------------------------------------------- -- NEC uPD7759 ADPCM sample player ---@src/emu/sound/upd7759.h,SOUNDS += UPD7759 +--@src/emu/sound/upd7759.h,SOUNDS["UPD7759"] = true --------------------------------------------------- if (SOUNDS["UPD7759"]~=null) then @@ -634,12 +634,12 @@ end --------------------------------------------------- -- OKI ADPCM sample players ---@src/emu/sound/okim6258.h,SOUNDS += OKIM6258 ---@src/emu/sound/msm5205.h,SOUNDS += MSM5205 ---@src/emu/sound/msm5232.h,SOUNDS += MSM5232 ---@src/emu/sound/okim6376.h,SOUNDS += OKIM6376 ---@src/emu/sound/okim6295.h,SOUNDS += OKIM6295 ---@src/emu/sound/okim9810.h,SOUNDS += OKIM9810 +--@src/emu/sound/okim6258.h,SOUNDS["OKIM6258"] = true +--@src/emu/sound/msm5205.h,SOUNDS["MSM5205"] = true +--@src/emu/sound/msm5232.h,SOUNDS["MSM5232"] = true +--@src/emu/sound/okim6376.h,SOUNDS["OKIM6376"] = true +--@src/emu/sound/okim6295.h,SOUNDS["OKIM6295"] = true +--@src/emu/sound/okim9810.h,SOUNDS["OKIM9810"] = true --------------------------------------------------- if (SOUNDS["OKIM6258"]~=null or SOUNDS["OKIM6295"]~=null or SOUNDS["OKIM9810"]~=null or SOUNDS["I5000_SND"]~=null) then @@ -695,7 +695,7 @@ end --------------------------------------------------- -- Philips SAA1099 ---@src/emu/sound/saa1099.h,SOUNDS += SAA1099 +--@src/emu/sound/saa1099.h,SOUNDS["SAA1099"] = true --------------------------------------------------- if (SOUNDS["SAA1099"]~=null) then @@ -709,7 +709,7 @@ end --------------------------------------------------- -- AdMOS QS1000 ---@src/emu/sound/qs1000.h,SOUNDS += QS1000 +--@src/emu/sound/qs1000.h,SOUNDS["QS1000"] = true --------------------------------------------------- if (SOUNDS["QS1000"]~=null) then @@ -723,7 +723,7 @@ end --------------------------------------------------- -- QSound sample player ---@src/emu/sound/qsound.h,SOUNDS += QSOUND +--@src/emu/sound/qsound.h,SOUNDS["QSOUND"] = true --------------------------------------------------- if (SOUNDS["QSOUND"]~=null) then @@ -740,8 +740,8 @@ end --------------------------------------------------- -- Ricoh sample players ---@src/emu/sound/rf5c68.h,SOUNDS += RF5C68 ---@src/emu/sound/rf5c400.h,SOUNDS += RF5C400 +--@src/emu/sound/rf5c68.h,SOUNDS["RF5C68"] = true +--@src/emu/sound/rf5c400.h,SOUNDS["RF5C400"] = true --------------------------------------------------- if (SOUNDS["RF5C68"]~=null) then @@ -762,10 +762,10 @@ end --------------------------------------------------- -- Sega custom sound chips ---@src/emu/sound/segapcm.h,SOUNDS += SEGAPCM ---@src/emu/sound/multipcm.h,SOUNDS += MULTIPCM ---@src/emu/sound/scsp.h,SOUNDS += SCSP ---@src/emu/sound/aica.h,SOUNDS += AICA +--@src/emu/sound/segapcm.h,SOUNDS["SEGAPCM"] = true +--@src/emu/sound/multipcm.h,SOUNDS["MULTIPCM"] = true +--@src/emu/sound/scsp.h,SOUNDS["SCSP"] = true +--@src/emu/sound/aica.h,SOUNDS["AICA"] = true --------------------------------------------------- if (SOUNDS["SEGAPCM"]~=null) then @@ -802,9 +802,9 @@ end --------------------------------------------------- -- Seta custom sound chips ---@src/emu/sound/st0016.h,SOUNDS += ST0016 ---@src/emu/sound/nile.h,SOUNDS += NILE ---@src/emu/sound/x1_010.h,SOUNDS += X1_010 +--@src/emu/sound/st0016.h,SOUNDS["ST0016"] = true +--@src/emu/sound/nile.h,SOUNDS["NILE"] = true +--@src/emu/sound/x1_010.h,SOUNDS["X1_010"] = true --------------------------------------------------- if (SOUNDS["ST0016"]~=null) then @@ -832,7 +832,7 @@ end --------------------------------------------------- -- SID custom sound chips ---@src/emu/sound/mos6581.h,SOUNDS += SID6581 +--@src/emu/sound/mos6581.h,SOUNDS["SID6581"] = true --------------------------------------------------- if (SOUNDS["SID6581"]~=null or SOUNDS["SID8580"]~=null) then @@ -854,7 +854,7 @@ end --------------------------------------------------- -- SNK(?) custom stereo sn76489a clone ---@src/emu/sound/t6w28.h,SOUNDS += T6W28 +--@src/emu/sound/t6w28.h,SOUNDS["T6W28"] = true --------------------------------------------------- if (SOUNDS["T6W28"]~=null) then @@ -868,7 +868,7 @@ end --------------------------------------------------- -- SNK custom wave generator ---@src/emu/sound/snkwave.h,SOUNDS += SNKWAVE +--@src/emu/sound/snkwave.h,SOUNDS["SNKWAVE"] = true --------------------------------------------------- if (SOUNDS["SNKWAVE"]~=null) then @@ -882,7 +882,7 @@ end --------------------------------------------------- -- Sony custom sound chips ---@src/emu/sound/spu.h,SOUNDS += SPU +--@src/emu/sound/spu.h,SOUNDS["SPU"] = true --------------------------------------------------- if (SOUNDS["SPU"]~=null) then @@ -898,7 +898,7 @@ end --------------------------------------------------- -- SP0256 speech synthesizer ---@src/emu/sound/sp0256.h,SOUNDS += SP0256 +--@src/emu/sound/sp0256.h,SOUNDS["SP0256"] = true --------------------------------------------------- if (SOUNDS["SP0256"]~=null) then @@ -912,7 +912,7 @@ end --------------------------------------------------- -- SP0250 speech synthesizer ---@src/emu/sound/sp0250.h,SOUNDS += SP0250 +--@src/emu/sound/sp0250.h,SOUNDS["SP0250"] = true --------------------------------------------------- if (SOUNDS["SP0250"]~=null) then @@ -925,7 +925,7 @@ end --------------------------------------------------- -- S14001A speech synthesizer ---@src/emu/sound/s14001a.h,SOUNDS += S14001A +--@src/emu/sound/s14001a.h,SOUNDS["S14001A"] = true --------------------------------------------------- if (SOUNDS["S14001A"]~=null) then @@ -939,7 +939,7 @@ end --------------------------------------------------- -- Texas Instruments SN76477 analog chip ---@src/emu/sound/sn76477.h,SOUNDS += SN76477 +--@src/emu/sound/sn76477.h,SOUNDS["SN76477"] = true --------------------------------------------------- if (SOUNDS["SN76477"]~=null) then @@ -953,7 +953,7 @@ end --------------------------------------------------- -- Texas Instruments SN76496 ---@src/emu/sound/sn76496.h,SOUNDS += SN76496 +--@src/emu/sound/sn76496.h,SOUNDS["SN76496"] = true --------------------------------------------------- if (SOUNDS["SN76496"]~=null) then @@ -967,7 +967,7 @@ end --------------------------------------------------- -- Texas Instruments TMS36xx doorbell chime ---@src/emu/sound/tms36xx.h,SOUNDS += TMS36XX +--@src/emu/sound/tms36xx.h,SOUNDS["TMS36XX"] = true --------------------------------------------------- if (SOUNDS["TMS36XX"]~=null) then @@ -981,7 +981,7 @@ end --------------------------------------------------- -- Texas Instruments TMS3615 Octave Multiple Tone Synthesizer ---@src/emu/sound/tms3615.h,SOUNDS += TMS3615 +--@src/emu/sound/tms3615.h,SOUNDS["TMS3615"] = true --------------------------------------------------- if (SOUNDS["TMS3615"]~=null) then @@ -995,7 +995,7 @@ end --------------------------------------------------- -- Texas Instruments TMS5100-series speech synthesizers ---@src/emu/sound/tms5110.h,SOUNDS += TMS5110 +--@src/emu/sound/tms5110.h,SOUNDS["TMS5110"] = true --------------------------------------------------- if (SOUNDS["TMS5110"]~=null) then @@ -1008,7 +1008,7 @@ end --------------------------------------------------- -- Texas Instruments TMS5200-series speech synthesizers ---@src/emu/sound/tms5220.h,SOUNDS += TMS5220 +--@src/emu/sound/tms5220.h,SOUNDS["TMS5220"] = true --------------------------------------------------- if (SOUNDS["TMS5220"]~=null) then files { @@ -1023,7 +1023,7 @@ end --------------------------------------------------- -- Toshiba T6721A voice synthesizer ---@src/emu/sound/t6721a.h,SOUNDS += T6721A +--@src/emu/sound/t6721a.h,SOUNDS["T6721A"] = true --------------------------------------------------- if (SOUNDS["T6721A"]~=null) then @@ -1037,7 +1037,7 @@ end --------------------------------------------------- -- Toshiba TC8830F sample player/recorder ---@src/emu/sound/tc8830f.h,SOUNDS += TC8830F +--@src/emu/sound/tc8830f.h,SOUNDS["TC8830F"] = true --------------------------------------------------- if (SOUNDS["TC8830F"]~=null) then @@ -1050,7 +1050,7 @@ end --------------------------------------------------- -- NEC uPD7752 ---@src/emu/sound/upd7752.h,SOUNDS += UPD7752 +--@src/emu/sound/upd7752.h,SOUNDS["UPD7752"] = true --------------------------------------------------- if (SOUNDS["UPD7752"]~=null) then @@ -1063,7 +1063,7 @@ end --------------------------------------------------- -- VLM5030 speech synthesizer ---@src/emu/sound/vlm5030.h,SOUNDS += VLM5030 +--@src/emu/sound/vlm5030.h,SOUNDS["VLM5030"] = true --------------------------------------------------- if (SOUNDS["VLM5030"]~=null) then @@ -1076,7 +1076,7 @@ end --------------------------------------------------- -- Votrax speech synthesizer ---@src/emu/sound/votrax.h,SOUNDS += VOTRAX +--@src/emu/sound/votrax.h,SOUNDS["VOTRAX"] = true --------------------------------------------------- if (SOUNDS["VOTRAX"]~=null) then @@ -1090,7 +1090,7 @@ end --------------------------------------------------- -- VRender0 custom sound chip ---@src/emu/sound/vrender0.h,SOUNDS += VRENDER0 +--@src/emu/sound/vrender0.h,SOUNDS["VRENDER0"] = true --------------------------------------------------- if (SOUNDS["VRENDER0"]~=null) then @@ -1104,7 +1104,7 @@ end --------------------------------------------------- -- WAVE file (used for MESS cassette) ---@src/emu/sound/wave.h,SOUNDS += WAVE +--@src/emu/sound/wave.h,SOUNDS["WAVE"] = true --------------------------------------------------- if (SOUNDS["WAVE"]~=null) then @@ -1118,18 +1118,19 @@ end --------------------------------------------------- -- Yamaha FM synthesizers ---@src/emu/sound/2151intf.h,SOUNDS += YM2151 ---@src/emu/sound/2203intf.h,SOUNDS += YM2203 ---@src/emu/sound/2413intf.h,SOUNDS += YM2413 ---@src/emu/sound/2608intf.h,SOUNDS += YM2608 ---@src/emu/sound/2610intf.h,SOUNDS += YM2610 ---@src/emu/sound/2612intf.h,SOUNDS += YM2612 ---@src/emu/sound/3812intf.h,SOUNDS += YM3812 ---@src/emu/sound/3526intf.h,SOUNDS += YM3526 ---@src/emu/sound/8950intf.h,SOUNDS += Y8950 ---@src/emu/sound/ymf262.h,SOUNDS += YMF262 ---@src/emu/sound/ymf271.h,SOUNDS += YMF271 ---@src/emu/sound/ymf278b.h,SOUNDS += YMF278B +--@src/emu/sound/2151intf.h,SOUNDS["YM2151"] = true +--@src/emu/sound/2203intf.h,SOUNDS["YM2203"] = true +--@src/emu/sound/2413intf.h,SOUNDS["YM2413"] = true +--@src/emu/sound/2608intf.h,SOUNDS["YM2608"] = true +--@src/emu/sound/2610intf.h,SOUNDS["YM2610"] = true +--@src/emu/sound/2612intf.h,SOUNDS["YM2612"] = true +--@src/emu/sound/3812intf.h,SOUNDS["YM3812"] = true +--@src/emu/sound/3526intf.h,SOUNDS["YM3526"] = true +--@src/emu/sound/8950intf.h,SOUNDS["Y8950"] = true +--@src/emu/sound/ymf262.h,SOUNDS["YMF262"] = true +--@src/emu/sound/ymf271.h,SOUNDS["YMF271"] = true +--@src/emu/sound/ymf278b.h,SOUNDS["YMF278B"] = true +--@src/emu/sound/262intf.h,SOUNDS["YMF262"] = true --------------------------------------------------- if (SOUNDS["YM2151"]~=null) then @@ -1141,7 +1142,17 @@ if (SOUNDS["YM2151"]~=null) then } end -if (SOUNDS["YM2203"]~=null) then +if (SOUNDS["YM2413"]~=null) then + files { + MAME_DIR .. "src/emu/sound/2413intf.c", + MAME_DIR .. "src/emu/sound/2413intf.h", + MAME_DIR .. "src/emu/sound/ym2413.c", + MAME_DIR .. "src/emu/sound/ym2413.h", + } +end + +if (SOUNDS["YM2203"]~=null or SOUNDS["YM2608"]~=null or SOUNDS["YM2610"]~=null or SOUNDS["YM2610B"]~=null or SOUNDS["YM2612"]~=null or SOUNDS["YM3438"]~=null) then +--if (SOUNDS["YM2203"]~=null) then files { MAME_DIR .. "src/emu/sound/2203intf.c", MAME_DIR .. "src/emu/sound/2203intf.h", @@ -1150,18 +1161,10 @@ if (SOUNDS["YM2203"]~=null) then MAME_DIR .. "src/emu/sound/fm.c", MAME_DIR .. "src/emu/sound/fm.h", } -end +--end -if (SOUNDS["YM2413"]~=null) then - files { - MAME_DIR .. "src/emu/sound/2413intf.c", - MAME_DIR .. "src/emu/sound/2413intf.h", - MAME_DIR .. "src/emu/sound/ym2413.c", - MAME_DIR .. "src/emu/sound/ym2413.h", - } -end -if (SOUNDS["YM2608"]~=null) then +--if (SOUNDS["YM2608"]~=null) then files { MAME_DIR .. "src/emu/sound/2608intf.c", MAME_DIR .. "src/emu/sound/2608intf.h", @@ -1172,9 +1175,9 @@ if (SOUNDS["YM2608"]~=null) then MAME_DIR .. "src/emu/sound/ymdeltat.c", MAME_DIR .. "src/emu/sound/ymdeltat.h", } -end +--end -if (SOUNDS["YM2610"]~=null or SOUNDS["YM2610B"]~=null) then +--if (SOUNDS["YM2610"]~=null or SOUNDS["YM2610B"]~=null) then files { MAME_DIR .. "src/emu/sound/2610intf.c", MAME_DIR .. "src/emu/sound/2610intf.h", @@ -1185,9 +1188,9 @@ if (SOUNDS["YM2610"]~=null or SOUNDS["YM2610B"]~=null) then MAME_DIR .. "src/emu/sound/ymdeltat.c", MAME_DIR .. "src/emu/sound/ymdeltat.h", } -end +--end -if (SOUNDS["YM2612"]~=null or SOUNDS["YM3438"]~=null) then +--if (SOUNDS["YM2612"]~=null or SOUNDS["YM3438"]~=null) then files { MAME_DIR .. "src/emu/sound/2612intf.c", MAME_DIR .. "src/emu/sound/2612intf.h", @@ -1195,9 +1198,11 @@ if (SOUNDS["YM2612"]~=null or SOUNDS["YM3438"]~=null) then MAME_DIR .. "src/emu/sound/ay8910.h", MAME_DIR .. "src/emu/sound/fm2612.c", } +--end end -if (SOUNDS["YM3812"]~=null) then +if (SOUNDS["YM3812"]~=null or SOUNDS["YM3526"]~=null or SOUNDS["Y8950"]~=null) then +--if (SOUNDS["YM3812"]~=null) then files { MAME_DIR .. "src/emu/sound/3812intf.c", MAME_DIR .. "src/emu/sound/3812intf.h", @@ -1206,9 +1211,9 @@ if (SOUNDS["YM3812"]~=null) then MAME_DIR .. "src/emu/sound/ymdeltat.c", MAME_DIR .. "src/emu/sound/ymdeltat.h", } -end +--end -if (SOUNDS["YM3526"]~=null) then +--if (SOUNDS["YM3526"]~=null) then files { MAME_DIR .. "src/emu/sound/3526intf.c", MAME_DIR .. "src/emu/sound/3526intf.h", @@ -1217,9 +1222,9 @@ if (SOUNDS["YM3526"]~=null) then MAME_DIR .. "src/emu/sound/ymdeltat.c", MAME_DIR .. "src/emu/sound/ymdeltat.h", } -end +--end -if (SOUNDS["Y8950"]~=null) then +--if (SOUNDS["Y8950"]~=null) then files { MAME_DIR .. "src/emu/sound/8950intf.c", MAME_DIR .. "src/emu/sound/8950intf.h", @@ -1228,6 +1233,7 @@ if (SOUNDS["Y8950"]~=null) then MAME_DIR .. "src/emu/sound/ymdeltat.c", MAME_DIR .. "src/emu/sound/ymdeltat.h", } +--end end if (SOUNDS["YMF262"]~=null) then @@ -1257,7 +1263,7 @@ end --------------------------------------------------- -- Yamaha YMZ280B ADPCM ---@src/emu/sound/ymz280b.h,SOUNDS += YMZ280B +--@src/emu/sound/ymz280b.h,SOUNDS["YMZ280B"] = true --------------------------------------------------- if (SOUNDS["YMZ280B"]~=null) then @@ -1269,7 +1275,7 @@ end --------------------------------------------------- -- Yamaha YMZ770 AMM ---@src/emu/sound/ymz770.h,SOUNDS += YMZ770 +--@src/emu/sound/ymz770.h,SOUNDS["YMZ770"] = true --------------------------------------------------- if (SOUNDS["YMZ770"]~=null) then @@ -1283,7 +1289,7 @@ end --------------------------------------------------- -- ZOOM ZSG-2 ---@src/emu/sound/zsg2.h,SOUNDS += ZSG2 +--@src/emu/sound/zsg2.h,SOUNDS["ZSG2"] = true --------------------------------------------------- if (SOUNDS["ZSG2"]~=null) then @@ -1295,7 +1301,7 @@ end --------------------------------------------------- -- VRC6 ---@src/emu/sound/vrc6.h,SOUNDS += VRC6 +--@src/emu/sound/vrc6.h,SOUNDS["VRC6"] = true --------------------------------------------------- if (SOUNDS["VRC6"]~=null) then diff --git a/scripts/src/video.lua b/scripts/src/video.lua index 107def93f61..e94884a51a3 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -11,7 +11,7 @@ -------------------------------------------------- -- ---@src/emu/video/315_5124.h,VIDEOS += SEGA315_5124 +--@src/emu/video/315_5124.h,VIDEOS["SEGA315_5124"] = true -------------------------------------------------- if (VIDEOS["SEGA315_5124"]~=null) then @@ -23,7 +23,7 @@ end -------------------------------------------------- -- ---@src/emu/video/315_5313.h,VIDEOS += SEGA315_5313 +--@src/emu/video/315_5313.h,VIDEOS["SEGA315_5313"] = true -------------------------------------------------- if (VIDEOS["SEGA315_5313"]~=null) then @@ -35,7 +35,7 @@ end -------------------------------------------------- -- ---@src/emu/video/bufsprite.h,VIDEOS += BUFSPRITE +--@src/emu/video/bufsprite.h,VIDEOS["BUFSPRITE"] = true -------------------------------------------------- if (VIDEOS["BUFSPRITE"]~=null) then @@ -47,7 +47,7 @@ end -------------------------------------------------- -- ---@src/emu/video/cdp1861.h,VIDEOS += CDP1861 +--@src/emu/video/cdp1861.h,VIDEOS["CDP1861"] = true -------------------------------------------------- if (VIDEOS["CDP1861"]~=null) then @@ -59,7 +59,7 @@ end -------------------------------------------------- -- ---@src/emu/video/cdp1862.h,VIDEOS += CDP1862 +--@src/emu/video/cdp1862.h,VIDEOS["CDP1862"] = true -------------------------------------------------- if (VIDEOS["CDP1862"]~=null) then @@ -71,7 +71,7 @@ end -------------------------------------------------- -- ---@src/emu/video/crt9007.h,VIDEOS += CRT9007 +--@src/emu/video/crt9007.h,VIDEOS["CRT9007"] = true -------------------------------------------------- if (VIDEOS["CRT9007"]~=null) then @@ -83,7 +83,7 @@ end -------------------------------------------------- -- ---@src/emu/video/crt9021.h,VIDEOS += CRT9021 +--@src/emu/video/crt9021.h,VIDEOS["CRT9021"] = true -------------------------------------------------- if (VIDEOS["CRT9021"]~=null) then @@ -95,7 +95,7 @@ end -------------------------------------------------- -- ---@src/emu/video/crt9212.h,VIDEOS += CRT9212 +--@src/emu/video/crt9212.h,VIDEOS["CRT9212"] = true -------------------------------------------------- if (VIDEOS["CRT9212"]~=null) then @@ -107,7 +107,7 @@ end -------------------------------------------------- -- ---@src/emu/video/dl1416.h,VIDEOS += DL1416 +--@src/emu/video/dl1416.h,VIDEOS["DL1416"] = true -------------------------------------------------- if (VIDEOS["DL1416"]~=null) then @@ -119,7 +119,7 @@ end -------------------------------------------------- -- ---@src/emu/video/dm9368.h,VIDEOS += DM9368 +--@src/emu/video/dm9368.h,VIDEOS["DM9368"] = true -------------------------------------------------- if (VIDEOS["DM9368"]~=null) then @@ -131,7 +131,7 @@ end -------------------------------------------------- -- ---@src/emu/video/ef9340_1.h,VIDEOS += EF9340_1 +--@src/emu/video/ef9340_1.h,VIDEOS["EF9340_1"] = true -------------------------------------------------- if (VIDEOS["EF9340_1"]~=null) then @@ -144,7 +144,7 @@ end -------------------------------------------------- -- ---@src/emu/video/ef9345.h,VIDEOS += EF9345 +--@src/emu/video/ef9345.h,VIDEOS["EF9345"] = true -------------------------------------------------- if (VIDEOS["EF9345"]~=null) then @@ -155,7 +155,7 @@ if (VIDEOS["EF9345"]~=null) then end -------------------------------------------------- ---@src/emu/video/epic12.h,VIDEOS += EPIC12 +--@src/emu/video/epic12.h,VIDEOS["EPIC12"] = true -------------------------------------------------- if (VIDEOS["EPIC12"]~=null) then @@ -178,7 +178,7 @@ end -------------------------------------------------- -- ---@src/emu/video/fixfreq.h,VIDEOS += FIXFREQ +--@src/emu/video/fixfreq.h,VIDEOS["FIXFREQ"] = true -------------------------------------------------- if (VIDEOS["FIXFREQ"]~=null) then @@ -190,7 +190,7 @@ end -------------------------------------------------- -- ---@src/emu/video/gf4500.h,VIDEOS += GF4500 +--@src/emu/video/gf4500.h,VIDEOS["GF4500"] = true -------------------------------------------------- if (VIDEOS["GF4500"]~=null) then @@ -202,7 +202,7 @@ end -------------------------------------------------- -- ---@src/emu/video/gf7600gs.h,VIDEOS += GF7600GS +--@src/emu/video/gf7600gs.h,VIDEOS["GF7600GS"] = true -------------------------------------------------- if (VIDEOS["GF7600GS"]~=null) then @@ -214,7 +214,7 @@ end -------------------------------------------------- -- ---@src/emu/video/h63484.h,VIDEOS += H63484 +--@src/emu/video/h63484.h,VIDEOS["H63484"] = true -------------------------------------------------- if (VIDEOS["H63484"]~=null) then @@ -226,7 +226,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd44102.h,VIDEOS += HD44102 +--@src/emu/video/hd44102.h,VIDEOS["HD44102"] = true -------------------------------------------------- if (VIDEOS["HD44102"]~=null) then @@ -238,7 +238,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd44352.h,VIDEOS += HD44352 +--@src/emu/video/hd44352.h,VIDEOS["HD44352"] = true -------------------------------------------------- if (VIDEOS["HD44352"]~=null) then @@ -250,7 +250,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd44780.h,VIDEOS += HD44780 +--@src/emu/video/hd44780.h,VIDEOS["HD44780"] = true -------------------------------------------------- if (VIDEOS["HD44780"]~=null) then @@ -262,7 +262,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd61830.h,VIDEOS += HD61830 +--@src/emu/video/hd61830.h,VIDEOS["HD61830"] = true -------------------------------------------------- if (VIDEOS["HD61830"]~=null) then @@ -274,7 +274,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd63484.h,VIDEOS += HD63484 +--@src/emu/video/hd63484.h,VIDEOS["HD63484"] = true -------------------------------------------------- if (VIDEOS["HD63484"]~=null) then @@ -286,7 +286,7 @@ end -------------------------------------------------- -- ---@src/emu/video/hd66421.h,VIDEOS += HD66421 +--@src/emu/video/hd66421.h,VIDEOS["HD66421"] = true -------------------------------------------------- if (VIDEOS["HD66421"]~=null) then @@ -298,7 +298,7 @@ end -------------------------------------------------- -- ---@src/emu/video/huc6202.h,VIDEOS += HUC6202 +--@src/emu/video/huc6202.h,VIDEOS["HUC6202"] = true -------------------------------------------------- if (VIDEOS["HUC6202"]~=null) then @@ -310,7 +310,7 @@ end -------------------------------------------------- -- ---@src/emu/video/huc6260.h,VIDEOS += HUC6260 +--@src/emu/video/huc6260.h,VIDEOS["HUC6260"] = true -------------------------------------------------- if (VIDEOS["HUC6260"]~=null) then @@ -322,7 +322,7 @@ end -------------------------------------------------- -- ---@src/emu/video/huc6261.h,VIDEOS += HUC6261 +--@src/emu/video/huc6261.h,VIDEOS["HUC6261"] = true -------------------------------------------------- if (VIDEOS["HUC6261"]~=null) then @@ -334,7 +334,7 @@ end -------------------------------------------------- -- ---@src/emu/video/huc6270.h,VIDEOS += HUC6270 +--@src/emu/video/huc6270.h,VIDEOS["HUC6270"] = true -------------------------------------------------- if (VIDEOS["HUC6270"]~=null) then @@ -346,7 +346,7 @@ end -------------------------------------------------- -- ---@src/emu/video/huc6272.h,VIDEOS += HUC6272 +--@src/emu/video/huc6272.h,VIDEOS["HUC6272"] = true -------------------------------------------------- if (VIDEOS["HUC6272"]~=null) then @@ -358,7 +358,7 @@ end -------------------------------------------------- -- ---@src/emu/video/i8244.h,VIDEOS += I8244 +--@src/emu/video/i8244.h,VIDEOS["I8244"] = true -------------------------------------------------- if (VIDEOS["I8244"]~=null) then @@ -370,7 +370,7 @@ end -------------------------------------------------- -- ---@src/emu/video/i8275.h,VIDEOS += I8275 +--@src/emu/video/i8275.h,VIDEOS["I8275"] = true -------------------------------------------------- if (VIDEOS["I8275"]~=null) then @@ -382,7 +382,7 @@ end -------------------------------------------------- -- ---@src/emu/video/m50458.h,VIDEOS += M50458 +--@src/emu/video/m50458.h,VIDEOS["M50458"] = true -------------------------------------------------- if (VIDEOS["M50458"]~=null) then @@ -394,7 +394,7 @@ end -------------------------------------------------- -- ---@src/emu/video/mb90082.h,VIDEOS += MB90082 +--@src/emu/video/mb90082.h,VIDEOS["MB90082"] = true -------------------------------------------------- if (VIDEOS["MB90082"]~=null) then @@ -406,7 +406,7 @@ end -------------------------------------------------- -- ---@src/emu/video/mb_vcu.h,VIDEOS += MB_VCU +--@src/emu/video/mb_vcu.h,VIDEOS["MB_VCU"] = true -------------------------------------------------- if (VIDEOS["MB_VCU"]~=null) then @@ -418,7 +418,7 @@ end -------------------------------------------------- -- ---@src/emu/video/mc6845.h,VIDEOS += MC6845 +--@src/emu/video/mc6845.h,VIDEOS["MC6845"] = true -------------------------------------------------- if (VIDEOS["MC6845"]~=null) then @@ -430,7 +430,7 @@ end -------------------------------------------------- -- ---@src/emu/video/mc6847.h,VIDEOS += MC6847 +--@src/emu/video/mc6847.h,VIDEOS["MC6847"] = true -------------------------------------------------- if (VIDEOS["MC6847"]~=null) then @@ -442,7 +442,7 @@ end -------------------------------------------------- -- ---@src/emu/video/msm6222b.h,VIDEOS += MSM6222B +--@src/emu/video/msm6222b.h,VIDEOS["MSM6222B"] = true -------------------------------------------------- if (VIDEOS["MSM6222B"]~=null) then @@ -454,7 +454,7 @@ end -------------------------------------------------- -- ---@src/emu/video/msm6255.h,VIDEOS += MSM6255 +--@src/emu/video/msm6255.h,VIDEOS["MSM6255"] = true -------------------------------------------------- if (VIDEOS["MSM6255"]~=null) then @@ -466,7 +466,7 @@ end -------------------------------------------------- -- ---@src/emu/video/mos6566.h,VIDEOS += MOS6566 +--@src/emu/video/mos6566.h,VIDEOS["MOS6566"] = true -------------------------------------------------- if (VIDEOS["MOS6566"]~=null) then @@ -484,7 +484,7 @@ files { -------------------------------------------------- -- ---@src/emu/video/pc_vga.h,VIDEOS += PC_VGA +--@src/emu/video/pc_vga.h,VIDEOS["PC_VGA"] = true -------------------------------------------------- if (VIDEOS["PC_VGA"]~=null) then @@ -500,7 +500,7 @@ end -------------------------------------------------- -- ---@src/emu/video/polylgcy.h,VIDEOS += POLY +--@src/emu/video/polylgcy.h,VIDEOS["POLY"] = true -------------------------------------------------- if (VIDEOS["POLY"]~=null) then @@ -512,7 +512,7 @@ end -------------------------------------------------- -- ---@src/emu/video/psx.h,VIDEOS += PSX +--@src/emu/video/psx.h,VIDEOS["PSX"] = true -------------------------------------------------- if (VIDEOS["PSX"]~=null) then @@ -524,7 +524,7 @@ end -------------------------------------------------- -- ---@src/emu/video/ramdac.h,VIDEOS += RAMDAC +--@src/emu/video/ramdac.h,VIDEOS["RAMDAC"] = true -------------------------------------------------- if (VIDEOS["RAMDAC"]~=null) then @@ -536,7 +536,7 @@ end -------------------------------------------------- -- ---@src/emu/video/saa5050.h,VIDEOS += SAA5050 +--@src/emu/video/saa5050.h,VIDEOS["SAA5050"] = true -------------------------------------------------- if (VIDEOS["SAA5050"]~=null) then @@ -548,7 +548,7 @@ end -------------------------------------------------- -- ---@src/emu/video/sed1200.h,VIDEOS += SED1200 +--@src/emu/video/sed1200.h,VIDEOS["SED1200"] = true -------------------------------------------------- if (VIDEOS["SED1200"]~=null) then files { @@ -559,7 +559,7 @@ end -------------------------------------------------- -- ---@src/emu/video/sed1330.h,VIDEOS += SED1330 +--@src/emu/video/sed1330.h,VIDEOS["SED1330"] = true -------------------------------------------------- if (VIDEOS["SED1330"]~=null) then files { @@ -570,7 +570,7 @@ end -------------------------------------------------- -- ---@src/emu/video/sed1520.h,VIDEOS += SED1520 +--@src/emu/video/sed1520.h,VIDEOS["SED1520"] = true -------------------------------------------------- if (VIDEOS["SED1520"]~=null) then files { @@ -581,7 +581,7 @@ end -------------------------------------------------- -- ---@src/emu/video/scn2674.h,VIDEOS += SCN2674 +--@src/emu/video/scn2674.h,VIDEOS["SCN2674"] = true -------------------------------------------------- if (VIDEOS["SCN2674"]~=null) then files { @@ -592,7 +592,7 @@ end -------------------------------------------------- -- ---@src/emu/video/snes_ppu.h,VIDEOS += SNES_PPU +--@src/emu/video/snes_ppu.h,VIDEOS["SNES_PPU"] = true -------------------------------------------------- if (VIDEOS["SNES_PPU"]~=null) then files { @@ -603,8 +603,8 @@ end -------------------------------------------------- -- ---@src/emu/video/stvvdp1.h,VIDEOS += STVVDP ---@src/emu/video/stvvdp2.h,VIDEOS += STVVDP +--@src/emu/video/stvvdp1.h,VIDEOS["STVVDP"] = true +--@src/emu/video/stvvdp2.h,VIDEOS["STVVDP"] = true -------------------------------------------------- if (VIDEOS["STVVDP"]~=null) then @@ -616,7 +616,7 @@ end -------------------------------------------------- -- ---@src/emu/video/t6a04.h,VIDEOS += T6A04 +--@src/emu/video/t6a04.h,VIDEOS["T6A04"] = true -------------------------------------------------- if (VIDEOS["T6A04"]~=null) then @@ -628,7 +628,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tea1002.h,VIDEOS += TEA1002 +--@src/emu/video/tea1002.h,VIDEOS["TEA1002"] = true -------------------------------------------------- if (VIDEOS["TEA1002"]~=null) then @@ -640,7 +640,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tlc34076.h,VIDEOS += TLC34076 +--@src/emu/video/tlc34076.h,VIDEOS["TLC34076"] = true -------------------------------------------------- if (VIDEOS["TLC34076"]~=null) then @@ -652,7 +652,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tms34061.h,VIDEOS += TMS34061 +--@src/emu/video/tms34061.h,VIDEOS["TMS34061"] = true -------------------------------------------------- if (VIDEOS["TMS34061"]~=null) then @@ -664,7 +664,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tms3556.h,VIDEOS += TMS3556 +--@src/emu/video/tms3556.h,VIDEOS["TMS3556"] = true -------------------------------------------------- if (VIDEOS["TMS3556"]~=null) then @@ -676,7 +676,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tms9927.h,VIDEOS += TMS9927 +--@src/emu/video/tms9927.h,VIDEOS["TMS9927"] = true -------------------------------------------------- if (VIDEOS["TMS9927"]~=null) then @@ -688,7 +688,7 @@ end -------------------------------------------------- -- ---@src/emu/video/tms9928a.h,VIDEOS += TMS9928A +--@src/emu/video/tms9928a.h,VIDEOS["TMS9928A"] = true -------------------------------------------------- if (VIDEOS["TMS9928A"]~=null) then @@ -700,7 +700,7 @@ end -------------------------------------------------- -- ---@src/emu/video/upd3301.h,VIDEOS += UPD3301 +--@src/emu/video/upd3301.h,VIDEOS["UPD3301"] = true -------------------------------------------------- if (VIDEOS["UPD3301"]~=null) then @@ -712,7 +712,7 @@ end -------------------------------------------------- -- ---@src/emu/video/upd7220.h,VIDEOS += UPD7220 +--@src/emu/video/upd7220.h,VIDEOS["UPD7220"] = true -------------------------------------------------- if (VIDEOS["UPD7220"]~=null) then @@ -724,7 +724,7 @@ end -------------------------------------------------- -- ---@src/emu/video/upd7227.h,VIDEOS += UPD7227 +--@src/emu/video/upd7227.h,VIDEOS["UPD7227"] = true -------------------------------------------------- if (VIDEOS["UPD7227"]~=null) then @@ -736,7 +736,7 @@ end -------------------------------------------------- -- ---@src/emu/video/vic4567.h,VIDEOS += VIC4567 +--@src/emu/video/vic4567.h,VIDEOS["VIC4567"] = true -------------------------------------------------- if (VIDEOS["VIC4567"]~=null) then @@ -748,7 +748,7 @@ end -------------------------------------------------- -- ---@src/emu/video/v9938.h,VIDEOS += V9938 +--@src/emu/video/v9938.h,VIDEOS["V9938"] = true -------------------------------------------------- if (VIDEOS["V9938"]~=null) then @@ -760,7 +760,7 @@ end -------------------------------------------------- -- ---@src/emu/video/voodoo.h,VIDEOS += VOODOO +--@src/emu/video/voodoo.h,VIDEOS["VOODOO"] = true -------------------------------------------------- if (VIDEOS["VOODOO"]~=null) then @@ -773,7 +773,7 @@ end -------------------------------------------------- -- ---@src/emu/video/voodoo_pci.h,VIDEOS += VOODOO_PCI +--@src/emu/video/voodoo_pci.h,VIDEOS["VOODOO_PCI"] = true -------------------------------------------------- if (VIDEOS["VOODOO_PCI"]~=null) then @@ -785,7 +785,7 @@ end -------------------------------------------------- -- ---@src/emu/video/crtc_ega.h,VIDEOS += CRTC_EGA +--@src/emu/video/crtc_ega.h,VIDEOS["CRTC_EGA"] = true -------------------------------------------------- if (VIDEOS["CRTC_EGA"]~=null) then diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index c5a3f346b6f..81e6d7554d4 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1243,7 +1243,6 @@ files { MAME_DIR .. "src/mame/audio/astrof.c", MAME_DIR .. "src/mame/drivers/backfire.c", MAME_DIR .. "src/mame/drivers/battlera.c", - MAME_DIR .. "src/mame/video/battlera.c", MAME_DIR .. "src/mame/drivers/boogwing.c", MAME_DIR .. "src/mame/video/boogwing.c", MAME_DIR .. "src/mame/drivers/brkthru.c", @@ -2481,6 +2480,7 @@ files { MAME_DIR .. "src/mame/video/segas18.c", MAME_DIR .. "src/mame/drivers/segas24.c", MAME_DIR .. "src/mame/video/segas24.c", + MAME_DIR .. "src/mame/drivers/segam1.c", MAME_DIR .. "src/mame/drivers/segas32.c", MAME_DIR .. "src/mame/machine/segas32.c", MAME_DIR .. "src/mame/video/segas32.c", diff --git a/src/build/makedep.py b/src/build/makedep.py new file mode 100644 index 00000000000..72fe94e6d14 --- /dev/null +++ b/src/build/makedep.py @@ -0,0 +1,313 @@ +#!/usr/bin/python +## +## license:BSD-3-Clause +## copyright-holders:Miodrag Milanovic + +from __future__ import with_statement + +import sys +## to ignore include of emu.h add it always to list + +files_included = ['src/emu/emu.h'] + +include_dirs = ['src/emu/', 'src/mame/', 'src/mess/'] + +mappings = dict() + +deps_files_included = [ ] + +deps_include_dirs = ['src/mame/', 'src/mess/'] + +components = [ ] + +drivers = [ ] + +def file_exists(root, srcfile, folder, inc_dir): + includes = [ folder ] + includes.extend(inc_dir) + for line in includes: + try: + fp = open(root + line + srcfile, 'rb') + return line + srcfile + except IOError: + ignore=1 + return '' + +def add_c_if_exists(root, fullname): + try: + fp = open(root + fullname, 'rb') + deps_files_included.append(fullname) + except IOError: + ignore=1 + +def add_rest_if_exists(root, srcfile,folder): + t = srcfile.rsplit('/', 2) + if t[1]=='includes': + t[2] = t[2].replace('.h','.c') + t[1] = 'drivers' + add_c_if_exists(root,"/".join(t)) + parse_file_for_deps(root, "/".join(t), folder) + t[1] = 'machine' + add_c_if_exists(root,"/".join(t)) + parse_file_for_deps(root, "/".join(t), folder) + t[1] = 'video' + add_c_if_exists(root,"/".join(t)) + parse_file_for_deps(root, "/".join(t), folder) + t[1] = 'audio' + add_c_if_exists(root,"/".join(t)) + parse_file_for_deps(root, "/".join(t), folder) + +def parse_file_for_deps(root, srcfile, folder): + try: + fp = open(root + srcfile, 'rb') + except IOError: + return 1 + in_comment = 0 + linenum = 0 + for line in fp.readlines(): + content = '' + linenum+=1 + srcptr = 0 + while srcptr < len(line): + c = line[srcptr] + srcptr+=1 + if c==13 or c==10: + if c==13 and line[srcptr]==10: + srcptr+=1 + continue + if c==' ' or c==9: + continue + if in_comment==1 and c=='*' and line[srcptr]=='/' : + srcptr+=1 + in_comment = 0 + continue + if in_comment: + continue + if c=='/' and line[srcptr]=='*' : + srcptr+=1 + in_comment = 1 + continue + if c=='/' and line[srcptr]=='/' : + break + content += c + content = content.strip() + if len(content)>0: + if content.startswith('#include'): + name = content[8:] + name = name.replace('"','') + fullname = file_exists(root, name, folder,deps_include_dirs) + if fullname in deps_files_included: + continue + if fullname!='': + deps_files_included.append(fullname) + add_c_if_exists(root, fullname.replace('.h','.c')) + add_rest_if_exists(root, fullname,folder) + newfolder = fullname.rsplit('/', 1)[0] + '/' + parse_file_for_deps(root, fullname, newfolder) + continue + return 0 + +def parse_file(root, srcfile, folder): + try: + fp = open(root + srcfile, 'rb') + except IOError: + return 1 + in_comment = 0 + linenum = 0 + for line in fp.readlines(): + content = '' + linenum+=1 + srcptr = 0 + while srcptr < len(line): + c = line[srcptr] + srcptr+=1 + if c==13 or c==10: + if c==13 and line[srcptr]==10: + srcptr+=1 + continue + if c==' ' or c==9: + continue + if in_comment==1 and c=='*' and line[srcptr]=='/' : + srcptr+=1 + in_comment = 0 + continue + if in_comment: + continue + if c=='/' and line[srcptr]=='*' : + srcptr+=1 + in_comment = 1 + continue + if c=='/' and line[srcptr]=='/' : + break + content += c + content = content.strip() + if len(content)>0: + if content.startswith('#include'): + name = content[8:] + name = name.replace('"','') + fullname = file_exists(root, name, folder,include_dirs) + if fullname in files_included: + continue + if "src/emu/netlist/" in fullname: + continue + if fullname!='': + if fullname in mappings.keys(): + if not(mappings[fullname] in components): + components.append(mappings[fullname]) + files_included.append(fullname) + newfolder = fullname.rsplit('/', 1)[0] + '/' + parse_file(root, fullname, newfolder) + if (fullname.endswith('.h')): + parse_file(root, fullname.replace('.h','.c'), newfolder) + continue + return 0 + +def parse_file_for_drivers(root, srcfile): + try: + fp = open(root + srcfile, 'rb') + except IOError: + sys.stderr.write("Unable to open source file '%s'\n" % srcfile) + return 1 + in_comment = 0 + linenum = 0 + for line in fp.readlines(): + content = '' + linenum+=1 + srcptr = 0 + while srcptr < len(line): + c = line[srcptr] + srcptr+=1 + if c==13 or c==10: + if c==13 and line[srcptr]==10: + srcptr+=1 + continue + if c==' ' or c==9: + continue + if in_comment==1 and c=='*' and line[srcptr]=='/' : + srcptr+=1 + in_comment = 0 + continue + if in_comment: + continue + if c=='/' and line[srcptr]=='*' : + srcptr+=1 + in_comment = 1 + continue + if c=='/' and line[srcptr]=='/' : + break + content += c + content = content.strip() + if len(content)>0: + if content.startswith('COMP') or content.startswith('CONS') or content.startswith('GAME') or content.startswith('SYST') or content.startswith('GAMEL'): + name = content[4:] + drivers.append(name.rsplit(',', 14)[1]) + return 0 + +def parse_lua_file(srcfile): + try: + fp = open(srcfile, 'rb') + except IOError: + sys.stderr.write("Unable to open source file '%s'\n" % srcfile) + return 1 + in_comment = 0 + linenum = 0 + for line in fp.readlines(): + content = line.strip() + if len(content)>0: + if content.startswith('--@'): + name = content[3:] + mappings[name.rsplit(',', 1)[0]] = name.rsplit(',', 1)[1] + return 0 + +if len(sys.argv) < 5: + print('Usage:') + print(' makedep <root> <source.c> <type> <target>') + sys.exit(0) + +root = sys.argv[1] + '/' + +parse_lua_file(root +'scripts/src/bus.lua') +parse_lua_file(root +'scripts/src/cpu.lua') +parse_lua_file(root +'scripts/src/machine.lua') +parse_lua_file(root +'scripts/src/sound.lua') +parse_lua_file(root +'scripts/src/video.lua') + +for filename in sys.argv[2].rsplit(',') : + deps_files_included.append(filename.replace('\\','/')) + parse_file_for_deps(root,filename,'') + +for filename in deps_files_included: + parse_file(root,filename,'') + +for filename in sys.argv[2].rsplit(',') : + parse_file_for_drivers(root,filename) + + +# display output +if sys.argv[3]=='drivers': + # add a reference to the ___empty driver + drivers.append("___empty") + + # start with a header + print('#include "emu.h"\n') + print('#include "drivenum.h"\n') + + #output the list of externs first + for drv in sorted(drivers): + print("GAME_EXTERN(%s);" % drv) + print("") + + # then output the array + print("const game_driver * const driver_list::s_drivers_sorted[%d] =" % len(drivers)) + print("{") + for drv in sorted(drivers): + print("\t&GAME_NAME(%s)," % drv) + print("};") + print("") + + # also output a global count + print("int driver_list::s_driver_count = %d;\n" % len(drivers)) + +if sys.argv[3]=='target': + for line in components: + sys.stdout.write("%s\n" % line) + sys.stdout.write('\n'); + sys.stdout.write('function createProjects_mame_%s(_target, _subtarget)\n' % sys.argv[4]); + sys.stdout.write(' project ("mame_%s")\n' % sys.argv[4]); + sys.stdout.write(' targetsubdir(_target .."_" .. _subtarget)\n'); + sys.stdout.write(' kind (LIBTYPE)\n'); + sys.stdout.write(' uuid (os.uuid("drv-mame-%s"))\n' % sys.argv[4]); + sys.stdout.write(' \n'); + sys.stdout.write(' options {\n'); + sys.stdout.write(' "ForceCPP",\n'); + sys.stdout.write(' }\n'); + sys.stdout.write(' \n'); + sys.stdout.write(' includedirs {\n'); + sys.stdout.write(' MAME_DIR .. "src/osd",\n'); + sys.stdout.write(' MAME_DIR .. "src/emu",\n'); + sys.stdout.write(' MAME_DIR .. "src/mame",\n'); + sys.stdout.write(' MAME_DIR .. "src/mess",\n'); + sys.stdout.write(' MAME_DIR .. "src/lib",\n'); + sys.stdout.write(' MAME_DIR .. "src/lib/util",\n'); + sys.stdout.write(' MAME_DIR .. "3rdparty",\n'); + sys.stdout.write(' GEN_DIR .. "mame/layout",\n'); + sys.stdout.write(' GEN_DIR .. "mess/layout",\n'); + sys.stdout.write(' }\n'); + sys.stdout.write(' if _OPTIONS["with-bundled-zlib"] then\n'); + sys.stdout.write(' includedirs {\n'); + sys.stdout.write(' MAME_DIR .. "3rdparty/zlib",\n'); + sys.stdout.write(' }\n'); + sys.stdout.write(' end\n'); + sys.stdout.write('\n'); + sys.stdout.write(' files{\n'); + for line in deps_files_included: + sys.stdout.write(' MAME_DIR .. "%s",\n' % line); + sys.stdout.write(' }\n'); + sys.stdout.write('end\n'); + sys.stdout.write('\n'); + sys.stdout.write('function linkProjects_mame_%s(_target, _subtarget)\n' % sys.argv[4]); + sys.stdout.write(' links {\n'); + sys.stdout.write(' "mame_%s",\n' % sys.argv[4]); + sys.stdout.write(' }\n'); + sys.stdout.write('end\n'); + diff --git a/src/emu/bus/a2bus/corvfdc01.c b/src/emu/bus/a2bus/corvfdc01.c index 335774af6ae..fc1adf2e269 100644 --- a/src/emu/bus/a2bus/corvfdc01.c +++ b/src/emu/bus/a2bus/corvfdc01.c @@ -35,7 +35,7 @@ static SLOT_INTERFACE_START( corv_floppies ) SLOT_INTERFACE_END MACHINE_CONFIG_FRAGMENT( fdc01 ) - MCFG_FD1793x_ADD(FDC01_FDC_TAG, XTAL_16MHz / 8) + MCFG_FD1793_ADD(FDC01_FDC_TAG, XTAL_16MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(a2bus_corvfdc01_device, intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(a2bus_corvfdc01_device, drq_w)) MCFG_FLOPPY_DRIVE_ADD(FDC01_FDC_TAG":0", corv_floppies, "8sssd", a2bus_corvfdc01_device::corv_floppy_formats) diff --git a/src/emu/bus/abcbus/fd2.c b/src/emu/bus/abcbus/fd2.c index 73ddeba54df..7faeefb97c4 100644 --- a/src/emu/bus/abcbus/fd2.c +++ b/src/emu/bus/abcbus/fd2.c @@ -246,7 +246,7 @@ static MACHINE_CONFIG_FRAGMENT( abc_fd2 ) MCFG_Z80PIO_IN_PB_CB(READ8(abc_fd2_t, pio_pb_r)) MCFG_Z80PIO_OUT_PB_CB(WRITE8(abc_fd2_t, pio_pb_w)) - MCFG_FD1771x_ADD(FD1771_TAG, XTAL_4MHz/4) + MCFG_FD1771_ADD(FD1771_TAG, XTAL_4MHz/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80PIO_TAG, z80pio_device, pb7_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80PIO_TAG, z80pio_device, pb5_w)) MCFG_WD_FDC_HLD_CALLBACK(DEVWRITELINE(Z80PIO_TAG, z80pio_device, pb6_w)) diff --git a/src/emu/bus/abcbus/lux10828.c b/src/emu/bus/abcbus/lux10828.c index f809d8fe13d..705a9e8035b 100644 --- a/src/emu/bus/abcbus/lux10828.c +++ b/src/emu/bus/abcbus/lux10828.c @@ -338,7 +338,7 @@ static MACHINE_CONFIG_FRAGMENT( luxor_55_10828 ) MCFG_Z80PIO_IN_PB_CB(READ8(luxor_55_10828_device, pio_pb_r)) MCFG_Z80PIO_OUT_PB_CB(WRITE8(luxor_55_10828_device, pio_pb_w)) - MCFG_MB8876x_ADD(MB8876_TAG, XTAL_4MHz/2) + MCFG_MB8876_ADD(MB8876_TAG, XTAL_4MHz/2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(luxor_55_10828_device, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(luxor_55_10828_device, fdc_drq_w)) diff --git a/src/emu/bus/abcbus/lux21046.c b/src/emu/bus/abcbus/lux21046.c index e5cd3b001b6..67396d81139 100644 --- a/src/emu/bus/abcbus/lux21046.c +++ b/src/emu/bus/abcbus/lux21046.c @@ -298,7 +298,7 @@ static MACHINE_CONFIG_FRAGMENT( luxor_55_21046 ) MCFG_Z80DMA_IN_IORQ_CB(READ8(luxor_55_21046_device, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(luxor_55_21046_device, io_write_byte)) - MCFG_FD1793x_ADD(SAB1793_TAG, XTAL_16MHz/16) + MCFG_FD1793_ADD(SAB1793_TAG, XTAL_16MHz/16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(luxor_55_21046_device, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) MACHINE_CONFIG_END diff --git a/src/emu/bus/adamnet/fdc.c b/src/emu/bus/adamnet/fdc.c index f915c227f03..afe93d74a29 100644 --- a/src/emu/bus/adamnet/fdc.c +++ b/src/emu/bus/adamnet/fdc.c @@ -128,7 +128,7 @@ static MACHINE_CONFIG_FRAGMENT( adam_fdc ) MCFG_CPU_PROGRAM_MAP(adam_fdc_mem) MCFG_CPU_IO_MAP(adam_fdc_io) - MCFG_WD2793x_ADD(WD2793_TAG, XTAL_4MHz/4) + MCFG_WD2793_ADD(WD2793_TAG, XTAL_4MHz/4) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(M6801_TAG, INPUT_LINE_NMI)) MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", adam_fdc_floppies, "525ssdd", adam_fdc_device::floppy_formats) diff --git a/src/emu/bus/apricot/expansion.h b/src/emu/bus/apricot/expansion.h index 91b3e8e31c8..38687db4399 100644 --- a/src/emu/bus/apricot/expansion.h +++ b/src/emu/bus/apricot/expansion.h @@ -2,42 +2,42 @@ // copyright-holders:Dirk Best /*************************************************************************** - ACT Apricot Expansion Slot + ACT Apricot Expansion Slot A B - -12V 32 +12V - +5V 31 +5V - DB0 30 DB1 - DB2 29 DB3 - DB4 28 DB5 - DB6 27 DB7 - AB10 26 AB9 - AB11 25 AB12 - /AMWC 24 /MRDC - /DMA2 23 DT/R - /DMA1 22 /IORC - /MWTC 21 /RES - /IOWC 20 /AIOWC - GND 19 GND - /CLK5 18 DEN - /IRDY 17 /MRDY - /EXT1 16 /EXT2 - /INT3 15 /ALE - AB6 14 /INT2 - AB8 13 AB7 - DB9 12 DB8 - DB11 11 DB10 - DB13 10 DB12 - DB15 9 DB14 - AB2 8 AB1 - AB4 7 AB3 - AB0 6 AB5 - AB14 5 AB13 - AB15 4 AB16 - AB17 3 AB18 - AB19 2 /BHE - NMI 1 CLK15 + -12V 32 +12V + +5V 31 +5V + DB0 30 DB1 + DB2 29 DB3 + DB4 28 DB5 + DB6 27 DB7 + AB10 26 AB9 + AB11 25 AB12 + /AMWC 24 /MRDC + /DMA2 23 DT/R + /DMA1 22 /IORC + /MWTC 21 /RES + /IOWC 20 /AIOWC + GND 19 GND + /CLK5 18 DEN + /IRDY 17 /MRDY + /EXT1 16 /EXT2 + /INT3 15 /ALE + AB6 14 /INT2 + AB8 13 AB7 + DB9 12 DB8 + DB11 11 DB10 + DB13 10 DB12 + DB15 9 DB14 + AB2 8 AB1 + AB4 7 AB3 + AB0 6 AB5 + AB14 5 AB13 + AB15 4 AB16 + AB17 3 AB18 + AB19 2 /BHE + NMI 1 CLK15 ***************************************************************************/ diff --git a/src/emu/bus/bml3/bml3mp1802.c b/src/emu/bus/bml3/bml3mp1802.c index 860d827caa3..64db414fa21 100644 --- a/src/emu/bus/bml3/bml3mp1802.c +++ b/src/emu/bus/bml3/bml3mp1802.c @@ -43,7 +43,7 @@ ROM_START( mp1802 ) ROM_END MACHINE_CONFIG_FRAGMENT( mp1802 ) - MCFG_MB8866x_ADD("fdc", XTAL_1MHz) + MCFG_MB8866_ADD("fdc", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bml3bus_mp1802_device, bml3_wd17xx_intrq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", mp1802_floppies, "dd", floppy_image_device::default_floppy_formats) diff --git a/src/emu/bus/cbmiec/c1571.c b/src/emu/bus/cbmiec/c1571.c index 44001fd13c8..a08e88fb696 100644 --- a/src/emu/bus/cbmiec/c1571.c +++ b/src/emu/bus/cbmiec/c1571.c @@ -628,7 +628,7 @@ static MACHINE_CONFIG_FRAGMENT( c1570 ) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c1571_t, cia_pb_w)) MCFG_MOS6526_PC_CALLBACK(WRITELINE(c1571_t, cia_pc_w)) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_16MHz/2) MCFG_DEVICE_ADD(C64H156_TAG, C64H156, XTAL_16MHz) MCFG_64H156_BYTE_CALLBACK(WRITELINE(c1571_t, byte_w)) MCFG_FLOPPY_DRIVE_ADD(C64H156_TAG":0", c1571_floppies, "525qd", c1571_t::floppy_formats) @@ -679,7 +679,7 @@ static MACHINE_CONFIG_FRAGMENT( c1571 ) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c1571_t, cia_pb_w)) MCFG_MOS6526_PC_CALLBACK(WRITELINE(c1571_t, cia_pc_w)) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_16MHz/2) MCFG_DEVICE_ADD(C64H156_TAG, C64H156, XTAL_16MHz) MCFG_64H156_BYTE_CALLBACK(WRITELINE(c1571_t, byte_w)) MCFG_FLOPPY_DRIVE_ADD(C64H156_TAG":0", c1571_floppies, "525qd", c1571_t::floppy_formats) @@ -724,7 +724,7 @@ static MACHINE_CONFIG_FRAGMENT( c1571cr ) //MCFG_MOS5710_ADD(M5710_TAG, XTAL_16MHz/16, 0) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_16MHz/2) MCFG_DEVICE_ADD(C64H156_TAG, C64H156, XTAL_16MHz) MCFG_64H156_BYTE_CALLBACK(WRITELINE(c1571_t, byte_w)) MCFG_FLOPPY_DRIVE_ADD(C64H156_TAG":0", c1571_floppies, "525qd", c1571_t::floppy_formats) @@ -775,7 +775,7 @@ static MACHINE_CONFIG_FRAGMENT( mini_chief ) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c1571_t, cia_pb_w)) MCFG_MOS6526_PC_CALLBACK(WRITELINE(c1571_t, cia_pc_w)) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_16MHz/2) MCFG_DEVICE_ADD(C64H156_TAG, C64H156, XTAL_16MHz) MCFG_64H156_BYTE_CALLBACK(WRITELINE(c1571_t, byte_w)) MCFG_FLOPPY_DRIVE_ADD(C64H156_TAG":0", c1571_floppies, "525qd", c1571_t::floppy_formats) diff --git a/src/emu/bus/cbmiec/c1581.c b/src/emu/bus/cbmiec/c1581.c index ce9e661b198..33bc082241e 100644 --- a/src/emu/bus/cbmiec/c1581.c +++ b/src/emu/bus/cbmiec/c1581.c @@ -277,7 +277,7 @@ static MACHINE_CONFIG_FRAGMENT( c1581 ) MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c1581_t, cia_pb_r)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c1581_t, cia_pb_w)) - MCFG_WD1772x_ADD(WD1772_TAG, XTAL_16MHz/2) + MCFG_WD1772_ADD(WD1772_TAG, XTAL_16MHz/2) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", c1581_floppies, "35dd", c1581_t::floppy_formats) MACHINE_CONFIG_END diff --git a/src/emu/bus/cgenie/expansion/floppy.c b/src/emu/bus/cgenie/expansion/floppy.c index 3221067b874..6941ae33ad3 100644 --- a/src/emu/bus/cgenie/expansion/floppy.c +++ b/src/emu/bus/cgenie/expansion/floppy.c @@ -72,7 +72,7 @@ const rom_entry *cgenie_fdc_device::device_rom_region() const static MACHINE_CONFIG_FRAGMENT( cgenie_fdc ) MCFG_TIMER_DRIVER_ADD_PERIODIC("timer", cgenie_fdc_device, timer_callback, attotime::from_msec(25)) - MCFG_FD1793x_ADD("fd1793", XTAL_1MHz) + MCFG_FD1793_ADD("fd1793", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(cgenie_fdc_device, intrq_w)) MCFG_FLOPPY_DRIVE_ADD("fd1793:0", cgenie_floppies, "ssdd", cgenie_fdc_device::floppy_formats) diff --git a/src/emu/bus/coco/coco_fdc.c b/src/emu/bus/coco/coco_fdc.c index 9be9039516d..bf165df42f5 100644 --- a/src/emu/bus/coco/coco_fdc.c +++ b/src/emu/bus/coco/coco_fdc.c @@ -154,7 +154,7 @@ WRITE_LINE_MEMBER( coco_fdc_device::fdc_drq_w ) //************************************************************************** static MACHINE_CONFIG_FRAGMENT(coco_fdc) - MCFG_WD1773x_ADD(WD_TAG, XTAL_8MHz) + MCFG_WD1773_ADD(WD_TAG, XTAL_8MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(coco_fdc_device, fdc_drq_w)) @@ -425,7 +425,7 @@ WRITE8_MEMBER(coco_fdc_device::write) //************************************************************************** static MACHINE_CONFIG_FRAGMENT(dragon_fdc) - MCFG_WD2797x_ADD(WD2797_TAG, XTAL_1MHz) + MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", coco_fdc_floppies, "qd", coco_fdc_device::floppy_formats) diff --git a/src/emu/bus/comx35/fdc.c b/src/emu/bus/comx35/fdc.c index 0c50673cc0f..0c83d5bed29 100644 --- a/src/emu/bus/comx35/fdc.c +++ b/src/emu/bus/comx35/fdc.c @@ -95,7 +95,7 @@ SLOT_INTERFACE_END //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( comx_fd ) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_8MHz) MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", comx_fd_floppies, "525sd35t", comx_fd_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", comx_fd_floppies, NULL, comx_fd_device::floppy_formats) diff --git a/src/emu/bus/cpc/hd20.c b/src/emu/bus/cpc/hd20.c new file mode 100644 index 00000000000..6a778bf6162 --- /dev/null +++ b/src/emu/bus/cpc/hd20.c @@ -0,0 +1,128 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + Dobbertin HD20 hard disk + +*/ + +#include "emu.h" +#include "hd20.h" +#include "includes/amstrad.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type CPC_HD20 = &device_creator<cpc_hd20_device>; + +static MACHINE_CONFIG_FRAGMENT( cpc_hd20 ) + MCFG_DEVICE_ADD("hdc",ST11M_HDC,0) + MCFG_XTHDC_IRQ_HANDLER(WRITELINE(cpc_hd20_device,irq_w)) + MCFG_HARDDISK_ADD("hdc:primary") + // no pass-through (?) +MACHINE_CONFIG_END + +machine_config_constructor cpc_hd20_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cpc_hd20 ); +} + +ROM_START( cpc_hd20 ) + ROM_REGION( 0x4000, "exp_rom", 0 ) + ROM_DEFAULT_BIOS("xddos210") + + ROM_SYSTEM_BIOS( 0, "xddos210", "X-DDOS 2.10" ) + ROMX_LOAD( "xddos210.rom", 0x0000, 0x4000, CRC(5477fdb4) SHA1(2f1bd4d6e2d2e62818b01e6e7a26488362a7a8ee), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "xddos200", "X-DDOS 2.00" ) + ROMX_LOAD( "x-ddos20.rom", 0x0000, 0x4000, CRC(c2d9cc03) SHA1(8a20788be5f957e84e849c226aa97b55b2a3aab9), ROM_BIOS(2) ) +ROM_END + +const rom_entry *cpc_hd20_device::device_rom_region() const +{ + return ROM_NAME( cpc_hd20 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +cpc_hd20_device::cpc_hd20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, CPC_HD20, "Dobbertin HD20", tag, owner, clock, "cpc_hd20", __FILE__), + device_cpc_expansion_card_interface(mconfig, *this), + m_hdc(*this,"hdc") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cpc_hd20_device::device_start() +{ + device_t* cpu = machine().device("maincpu"); + address_space& space = cpu->memory().space(AS_IO); + m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner()); + + space.install_write_handler(0xfbe0,0xfbe4,0,0,write8_delegate(FUNC(cpc_hd20_device::hdc_w),this)); + space.install_read_handler(0xfbe0,0xfbe4,0,0,read8_delegate(FUNC(cpc_hd20_device::hdc_r),this)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void cpc_hd20_device::device_reset() +{ + // TODO +} + +READ8_MEMBER(cpc_hd20_device::hdc_r) +{ + UINT8 ret = 0xff; + + switch(offset) + { + case 0: + ret = m_hdc->data_r(); + break; + case 1: + ret = m_hdc->status_r(); + break; + case 2: + m_hdc->set_ready(); + ret = 0x01; + break; + } + + return ret; +} + +WRITE8_MEMBER(cpc_hd20_device::hdc_w) +{ + switch(offset) + { + case 0: + m_hdc->data_w(data); + break; + case 1: + m_hdc->reset_w(data); + break; + case 2: + m_hdc->select_w(data); + break; + case 3: + m_hdc->control_w(data); + break; + case 4: + m_hdc->reset_w(data); + break; + } +} + +WRITE_LINE_MEMBER(cpc_hd20_device::irq_w) +{ +// if(state) +// m_hdc->set_ready(); +} diff --git a/src/emu/bus/cpc/hd20.h b/src/emu/bus/cpc/hd20.h new file mode 100644 index 00000000000..0926e6bd5be --- /dev/null +++ b/src/emu/bus/cpc/hd20.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + Dobbertin HD20 hard disk + + Fixed disk interface for the Amstrad CPC + + Controller: Seagate ST11M XT HD Controller + Disk: 3.5" 20MB Seagate, Kyocera, NEC or Miniscribe (Geometry: 615 cylinders/4 heads/17 sectors) + +*/ + +#ifndef HD20_H_ +#define HD20_H_ + +#include "emu.h" +#include "cpcexp.h" +#include "bus/isa/hdc.h" + +class cpc_hd20_device : public device_t, + public device_cpc_expansion_card_interface +{ +public: + // construction/destruction + cpc_hd20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + DECLARE_READ8_MEMBER(hdc_r); + DECLARE_WRITE8_MEMBER(hdc_w); + DECLARE_WRITE_LINE_MEMBER(irq_w); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + cpc_expansion_slot_device *m_slot; + + required_device<xt_hdc_device> m_hdc; +}; + +// device type definition +extern const device_type CPC_HD20; + +#endif /* HD20_H_ */ diff --git a/src/emu/bus/cpc/mface2.c b/src/emu/bus/cpc/mface2.c index 3c8ba73c641..122f97fe46a 100644 --- a/src/emu/bus/cpc/mface2.c +++ b/src/emu/bus/cpc/mface2.c @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Barry Rodewald +// copyright-holders:Kevin Thacker, Barry Rodewald /* * mface2.c -- Romantic Robot Multiface II expansion device for the Amstrad CPC/CPC+ * diff --git a/src/emu/bus/cpc/mface2.h b/src/emu/bus/cpc/mface2.h index fae584e54ce..56eb017b208 100644 --- a/src/emu/bus/cpc/mface2.h +++ b/src/emu/bus/cpc/mface2.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Barry Rodewald +// copyright-holders:Kevin Thacker, Barry Rodewald /* * mface2.h -- Romantic Robot Multiface II expansion device for the Amstrad CPC/CPC+ * diff --git a/src/emu/bus/econet/e01.c b/src/emu/bus/econet/e01.c index 41b2483c068..bcb9b4b6bae 100644 --- a/src/emu/bus/econet/e01.c +++ b/src/emu/bus/econet/e01.c @@ -250,7 +250,7 @@ static MACHINE_CONFIG_FRAGMENT( e01 ) MCFG_DEVICE_ADD(MC6854_TAG, MC6854, 0) MCFG_MC6854_OUT_IRQ_CB(WRITELINE(e01_device, adlc_irq_w)) MCFG_MC6854_OUT_TXD_CB(WRITELINE(e01_device, econet_data_w)) - MCFG_WD2793x_ADD(WD2793_TAG, XTAL_8MHz/4) + MCFG_WD2793_ADD(WD2793_TAG, XTAL_8MHz/4) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(e01_device, fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(e01_device, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", e01_floppies, "35dd", floppy_image_device::default_floppy_formats) diff --git a/src/emu/bus/ep64/exdos.c b/src/emu/bus/ep64/exdos.c index 4cc31ed30b1..f0813ff8d7e 100644 --- a/src/emu/bus/ep64/exdos.c +++ b/src/emu/bus/ep64/exdos.c @@ -102,7 +102,7 @@ SLOT_INTERFACE_END //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( ep64_exdos ) - MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz) + MCFG_WD1770_ADD(WD1770_TAG, XTAL_8MHz) MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", ep64_exdos_floppies, "35dd", ep64_exdos_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", ep64_exdos_floppies, NULL, ep64_exdos_device::floppy_formats) diff --git a/src/emu/bus/ieee488/c8280.c b/src/emu/bus/ieee488/c8280.c index 188f7bcbb3a..1dd1c679c5d 100644 --- a/src/emu/bus/ieee488/c8280.c +++ b/src/emu/bus/ieee488/c8280.c @@ -306,7 +306,7 @@ static MACHINE_CONFIG_FRAGMENT( c8280 ) MCFG_CPU_ADD(M6502_FDC_TAG, M6502, XTAL_12MHz/8) MCFG_CPU_PROGRAM_MAP(c8280_fdc_mem) - MCFG_FD1797x_ADD(WD1797_TAG, XTAL_12MHz/6) + MCFG_FD1797_ADD(WD1797_TAG, XTAL_12MHz/6) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(M6502_FDC_TAG, M6502_IRQ_LINE)) MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE(M6502_FDC_TAG, M6502_SET_OVERFLOW)) MCFG_FLOPPY_DRIVE_ADD(WD1797_TAG ":0", c8280_floppies, "8dsdd", c8280_t::floppy_formats) diff --git a/src/emu/bus/isa/hdc.c b/src/emu/bus/isa/hdc.c index 1f54984a96f..45b6bc334dd 100644 --- a/src/emu/bus/isa/hdc.c +++ b/src/emu/bus/isa/hdc.c @@ -159,10 +159,11 @@ INPUT_PORTS_END const device_type XT_HDC = &device_creator<xt_hdc_device>; const device_type EC1841_HDC = &device_creator<ec1841_device>; +const device_type ST11M_HDC = &device_creator<st11m_device>; xt_hdc_device::xt_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, XT_HDC, "Generic PC-XT Fixed Disk Controller", tag, owner, clock, "xt_hdc", __FILE__), - m_irq_handler(*this), + m_irq_handler(*this), m_drq_handler(*this) { m_type = STANDARD; @@ -170,22 +171,30 @@ xt_hdc_device::xt_hdc_device(const machine_config &mconfig, const char *tag, dev xt_hdc_device::xt_hdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_irq_handler(*this), + m_irq_handler(*this), m_drq_handler(*this) { } ec1841_device::ec1841_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : xt_hdc_device(mconfig, EC1841_HDC, "EC1841 Fixed Disk Controller", tag, owner, clock, "ec1481", __FILE__), - m_irq_handler(*this), + m_irq_handler(*this), m_drq_handler(*this) { m_type = EC1841; } +st11m_device::st11m_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + xt_hdc_device(mconfig, EC1841_HDC, "Seagate ST11M Fixed Disk Controller", tag, owner, clock, "st11m", __FILE__), + m_irq_handler(*this), + m_drq_handler(*this) +{ + m_type = ST11M; +} + void xt_hdc_device::device_start() { - buffer.resize(17*4*512); + buffer.resize(256*512); // maximum possible transfer timer = timer_alloc(); m_irq_handler.resolve_safe(); m_drq_handler.resolve_safe(); @@ -241,7 +250,7 @@ hard_disk_file *xt_hdc_device::pc_hdc_file(int id) void xt_hdc_device::pc_hdc_result(int set_error_info) { - if ( ( hdc_control & 0x02 )) + if ( ( hdc_control & 0x02 )) { // dip switch selected IRQ 5 or 2 m_irq_handler(1); @@ -425,24 +434,25 @@ void xt_hdc_device::execute_read() int size = sector_cnt[drv] * 512; int read_ = 0; + if(sector_cnt[drv] == 0) + size = 256 * 512; + disk = pc_hdc_file(drv); if (!disk) return; + status |= STA_READY; // ready to recieve data + status &= ~STA_INPUT; + status &= ~STA_COMMAND; + hdcdma_src = hdcdma_data; hdcdma_read = read_; hdcdma_size = size; - if (no_dma()) - { - do - { - buffer[data_cnt++] = dack_r(); - } while (hdcdma_read || hdcdma_size); - } - else + if(!no_dma()) { m_drq_handler(1); + if(!hdcdma_size) pc_hdc_result(0); } } @@ -454,23 +464,22 @@ void xt_hdc_device::execute_write() int size = sector_cnt[drv] * 512; int write_ = 512; + if(sector_cnt[drv] == 0) + size = 256 * 512; + disk = pc_hdc_file(drv); if (!disk) return; + status |= STA_READY; // ready to recieve data + status |= STA_INPUT; + status &= ~STA_COMMAND; + hdcdma_dst = hdcdma_data; hdcdma_write = write_; hdcdma_size = size; - if (no_dma()) - { - do - { - dack_w(buffer[data_cnt++]); - } - while (hdcdma_write || hdcdma_size); - } - else + if (!no_dma()) { m_drq_handler(1); } @@ -484,15 +493,11 @@ void xt_hdc_device::execute_writesbuff() hdcdma_write = 512; hdcdma_size = 512; - if (no_dma()) - { - do - { - dack_ws(buffer[data_cnt++]); - } - while (hdcdma_write || hdcdma_size); - } - else + status |= STA_READY; // ready to recieve data + status |= STA_INPUT; + status &= ~STA_COMMAND; + + if (!no_dma()) { m_drq_handler(1); } @@ -535,29 +540,29 @@ void xt_hdc_device::command() { int set_error_info = 1; int old_error = error; /* Previous error data is needed for CMD_SENSE */ - UINT8 cmd; const char *command_name; csb = 0x00; error = 0; buffer_ptr = &buffer[0]; - cmd = buffer[0]; get_drive(); + data_cnt = 0; if (LOG_HDC_STATUS) { - command_name = hdc_command_names[cmd] ? hdc_command_names[cmd] : "Unknown"; + command_name = hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown"; logerror("%s pc_hdc_command(): Executing command; cmd=0x%02x (%s) drv=%d\n", - machine().describe_context(), cmd, command_name, drv); + machine().describe_context(), m_current_cmd, command_name, drv); } - switch (cmd) + switch (m_current_cmd) { case CMD_TESTREADY: set_error_info = 0; test_ready(); + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_SENSE: /* Perform error code translation. This may need to be expanded in the future. */ @@ -566,9 +571,11 @@ void xt_hdc_device::command() buffer[data_cnt++] = ((cylinder[drv] >> 2) & 0xc0) | sector[drv]; buffer[data_cnt++] = cylinder[drv] & 0xff; set_error_info = 0; + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_RECALIBRATE: get_chsn(); + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_FORMATDRV: @@ -579,6 +586,7 @@ void xt_hdc_device::command() case CMD_DRIVEDIAG: get_chsn(); test_ready(); + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_READ: @@ -593,6 +601,8 @@ void xt_hdc_device::command() if (test_ready()) execute_read(); + else + pc_hdc_result(1); set_error_info = 0; break; @@ -626,22 +636,22 @@ void xt_hdc_device::command() rwc[drv] = ((buffer[9]&3)<<8) | buffer[10]; wp[drv] = ((buffer[11]&3)<<8) | buffer[12]; ecc[drv] = buffer[13]; + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_GETECC: buffer[data_cnt++] = ecc[drv]; + if(no_dma()) pc_hdc_result(set_error_info); break; case CMD_READSBUFF: case CMD_RAMDIAG: case CMD_INTERNDIAG: + if(no_dma()) pc_hdc_result(set_error_info); break; - } - if(no_dma()) pc_hdc_result(set_error_info); } - void xt_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { command(); @@ -670,12 +680,34 @@ void xt_hdc_device::device_timer(emu_timer &timer, device_timer_id id, int param */ void xt_hdc_device::data_w(int data) { - if( data_cnt == 0 ) + if(!(status & STA_COMMAND) && m_current_cmd != CMD_SETPARAM) { if (LOG_HDC_DATA) - logerror("hdc_data_w $%02x: ", data); + logerror("hdc_data_w PIO $%02x (%i) (%s): \n", data,data_cnt,hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown"); + // PIO data transfer + buffer[data_cnt++] = data; + if(data_cnt >= hdcdma_size) + { + data_cnt = 0; + // write to disk + do + { + if(m_current_cmd == CMD_WRITESBUFF) + dack_ws(buffer[data_cnt++]); + else + dack_w(buffer[data_cnt++]); + } + while (hdcdma_size); + data_cnt = 0; + pc_hdc_result(1); + } + return; + } + if( data_cnt == 0 ) + { buffer_ptr = &buffer[0]; + m_current_cmd = data; data_cnt = 6; /* expect 6 bytes including this one */ status &= ~STA_READY; status &= ~STA_INPUT; @@ -719,14 +751,16 @@ void xt_hdc_device::data_w(int data) if (data_cnt) { if (LOG_HDC_DATA) - logerror("hdc_data_w $%02x\n", data); + logerror("hdc_data_w $%02x (%i) (%s): \n", data,data_cnt,hdc_command_names[m_current_cmd] ? hdc_command_names[m_current_cmd] : "Unknown"); *buffer_ptr++ = data; // XXX ec1841 wants this - if (buffer[0] == CMD_SETPARAM && data_cnt == 9 && (m_type == EC1841)) { + if (m_current_cmd == CMD_SETPARAM && data_cnt == 9 && (m_type == EC1841)) { status &= ~STA_READY; } else { status |= STA_READY; + if(m_current_cmd == CMD_SETPARAM && data_cnt == 9) // some controllers want geometry info as data, not as a command (true for the Seagate ST11M?) + status &= ~STA_COMMAND; } if (--data_cnt == 0) { @@ -784,6 +818,29 @@ void xt_hdc_device::control_w(int data) UINT8 xt_hdc_device::data_r() { UINT8 data = 0xff; + + if(!(status & STA_COMMAND) && (m_current_cmd == CMD_READ || m_current_cmd == CMD_READLONG || m_current_cmd == CMD_READSBUFF)) + { + // PIO data transfer + if(data_cnt == 0) + { + do + { + buffer[data_cnt++] = dack_r(); + } while (hdcdma_read); + data_cnt = 0; + } + data = buffer[data_cnt++]; + if(data_cnt >= ((sector_cnt[drv] * 512) ? (sector_cnt[drv] * 512) : (256 * 512))) + { + data_cnt = 0; + pc_hdc_result(1); + } + if (LOG_HDC_DATA) + logerror("hdc_data_r PIO $%02x (%i): \n", data,data_cnt); + return data; + } + if( data_cnt ) { data = *buffer_ptr++; @@ -795,6 +852,8 @@ UINT8 xt_hdc_device::data_r() status &= ~STA_SELECT; status |= STA_COMMAND; } + if (LOG_HDC_DATA) + logerror("hdc_data_r $%02x (%i): \n", data,data_cnt); } return data; } diff --git a/src/emu/bus/isa/hdc.h b/src/emu/bus/isa/hdc.h index 909459584ab..21a47707e69 100644 --- a/src/emu/bus/isa/hdc.h +++ b/src/emu/bus/isa/hdc.h @@ -41,7 +41,7 @@ public: void dack_w(int data); void dack_ws(int data); - void command(); + virtual void command(); void data_w(int data); void reset_w(int data); void select_w(int data); @@ -67,11 +67,19 @@ protected: void get_chsn(); int test_ready(); + dynamic_buffer buffer; /* data buffer */ + UINT8 *buffer_ptr; /* data pointer */ + int csb; /* command status byte */ + int status; /* drive status */ + int error; /* error code */ + enum { STANDARD, - EC1841 + EC1841, + ST11M }; int m_type; + UINT8 m_current_cmd; devcb_write_line m_irq_handler; devcb_write_line m_drq_handler; @@ -90,14 +98,9 @@ private: int sector_cnt[2]; /* sector count */ int control[2]; /* control */ - int csb; /* command status byte */ - int status; /* drive status */ - int error; /* error code */ emu_timer *timer; int data_cnt; /* data count */ - dynamic_buffer buffer; /* data buffer */ - UINT8 *buffer_ptr; /* data pointer */ UINT8 hdc_control; UINT8 hdcdma_data[512]; @@ -117,8 +120,19 @@ protected: devcb_write_line m_drq_handler; }; +class st11m_device : public xt_hdc_device +{ +public: + st11m_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + devcb_write_line m_irq_handler; + devcb_write_line m_drq_handler; +}; + extern const device_type XT_HDC; extern const device_type EC1841_HDC; +extern const device_type ST11M_HDC; // ======================> isa8_hdc_device diff --git a/src/emu/bus/isa/mc1502_fdc.c b/src/emu/bus/isa/mc1502_fdc.c index a24e487e43c..ada13d1d4ec 100644 --- a/src/emu/bus/isa/mc1502_fdc.c +++ b/src/emu/bus/isa/mc1502_fdc.c @@ -39,7 +39,7 @@ static SLOT_INTERFACE_START( mc1502_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( mc1502_fdc ) - MCFG_FD1793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mc1502_fdc_device, mc1502_fdc_irq_drq)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mc1502_fdc_device, mc1502_fdc_irq_drq)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", mc1502_floppies, "525qd", mc1502_fdc_device::floppy_formats) diff --git a/src/emu/bus/isa/p1_fdc.c b/src/emu/bus/isa/p1_fdc.c index 80e2ebb77c9..4ba01ed47da 100644 --- a/src/emu/bus/isa/p1_fdc.c +++ b/src/emu/bus/isa/p1_fdc.c @@ -39,7 +39,7 @@ static SLOT_INTERFACE_START( poisk1_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( fdc_b504 ) - MCFG_FD1793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(p1_fdc_device, p1_fdc_irq_drq)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(p1_fdc_device, p1_fdc_irq_drq)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", poisk1_floppies, "525qd", p1_fdc_device::floppy_formats) diff --git a/src/emu/bus/isbx/isbx.h b/src/emu/bus/isbx/isbx.h index d3f15098ee7..5124b4fde60 100644 --- a/src/emu/bus/isbx/isbx.h +++ b/src/emu/bus/isbx/isbx.h @@ -83,7 +83,9 @@ public: virtual void mcs1_w(address_space &space, offs_t offset, UINT8 data) { } virtual UINT8 mdack_r(address_space &space, offs_t offset) { return 0xff; } virtual void mdack_w(address_space &space, offs_t offset, UINT8 data) { } + virtual int opt0_r() { return 1; } virtual void opt0_w(int state) { } + virtual int opt1_r() { return 1; } virtual void opt1_w(int state) { } virtual void tdma_w(int state) { } virtual void mclk_w(int state) { } @@ -115,7 +117,9 @@ public: DECLARE_READ8_MEMBER( mdack_r ) { return m_card ? m_card->mdack_r(space, offset) : 0xff; } DECLARE_WRITE8_MEMBER( mdack_w ) { if (m_card) m_card->mdack_w(space, offset, data); } DECLARE_READ_LINE_MEMBER( mpst_r ) { return m_card == NULL; } + DECLARE_READ_LINE_MEMBER( opt0_r ) { return m_card ? m_card->opt0_r() : 1; } DECLARE_WRITE_LINE_MEMBER( opt0_w ) { if (m_card) m_card->opt0_w(state); } + DECLARE_READ_LINE_MEMBER( opt1_r ) { return m_card ? m_card->opt1_r() : 1; } DECLARE_WRITE_LINE_MEMBER( opt1_w ) { if (m_card) m_card->opt1_w(state); } DECLARE_WRITE_LINE_MEMBER( tdma_w ) { if (m_card) m_card->tdma_w(state); } DECLARE_WRITE_LINE_MEMBER( mclk_w ) { if (m_card) m_card->mclk_w(state); } diff --git a/src/emu/bus/megadrive/md_slot.c b/src/emu/bus/megadrive/md_slot.c index af40c089d5a..6caa7df817f 100644 --- a/src/emu/bus/megadrive/md_slot.c +++ b/src/emu/bus/megadrive/md_slot.c @@ -995,7 +995,7 @@ void base_md_cart_slot_device::file_logging(UINT8 *ROM8, UINT32 rom_len, UINT32 logerror("FILE DETAILS\n"); logerror("============\n"); logerror("Name: %s\n", basename()); - logerror("File Size: 0x%" I64FMT "x\n", (software_entry() == NULL) ? length() : get_software_region_length("rom")); + logerror("File Size: 0x%08x\n", (software_entry() == NULL) ? (int)length() : (int)get_software_region_length("rom")); logerror("Detected type: %s\n", md_get_slot(m_type)); logerror("ROM (Allocated) Size: 0x%X\n", rom_len); logerror("NVRAM: %s\n", nvram_len ? "Yes" : "No"); diff --git a/src/emu/bus/msx_cart/disk.c b/src/emu/bus/msx_cart/disk.c index 44c3db577b5..64bc061ba35 100644 --- a/src/emu/bus/msx_cart/disk.c +++ b/src/emu/bus/msx_cart/disk.c @@ -198,7 +198,7 @@ static MACHINE_CONFIG_FRAGMENT( vy0010 ) // HLT pulled high // SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low // READY inverted in VY-0010 cartridge and pulled low on VY-0010/VY-0011 floppy drive - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY // Single sided 3.5" floppy drive @@ -220,7 +220,7 @@ machine_config_constructor msx_cart_vy0010::device_mconfig_additions() const static MACHINE_CONFIG_FRAGMENT( fsfd1 ) - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) // Double sided 3.5" floppy drive MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk::floppy_formats) @@ -262,7 +262,7 @@ machine_config_constructor msx_cart_fsfd1a::device_mconfig_additions() const static MACHINE_CONFIG_FRAGMENT( fscf351 ) - MCFG_MB8877x_ADD("fdc", XTAL_4MHz / 4) + MCFG_MB8877_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY // Double sided 3.5" floppy drive diff --git a/src/emu/bus/nasbus/floppy.c b/src/emu/bus/nasbus/floppy.c index e47e67224c5..cf68765a0ae 100644 --- a/src/emu/bus/nasbus/floppy.c +++ b/src/emu/bus/nasbus/floppy.c @@ -39,7 +39,7 @@ SLOT_INTERFACE_END //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( nascom_fdc ) - MCFG_FD1793x_ADD("fd1793", XTAL_16MHz / 4 / 4) + MCFG_FD1793_ADD("fd1793", XTAL_16MHz / 4 / 4) MCFG_FLOPPY_DRIVE_ADD("fd1793:0", nascom_floppies, "55f", nascom_fdc_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1793:1", nascom_floppies, "55f", nascom_fdc_device::floppy_formats) diff --git a/src/emu/bus/oricext/jasmin.c b/src/emu/bus/oricext/jasmin.c index f8ddceddeec..c8fd1d81081 100644 --- a/src/emu/bus/oricext/jasmin.c +++ b/src/emu/bus/oricext/jasmin.c @@ -19,7 +19,7 @@ static SLOT_INTERFACE_START( jasmin_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( jasmin ) - MCFG_WD1770x_ADD("fdc", XTAL_8MHz) + MCFG_WD1770_ADD("fdc", XTAL_8MHz) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(oricext_device, irq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", jasmin_floppies, "3dsdd", jasmin_device::floppy_formats) diff --git a/src/emu/bus/oricext/microdisc.c b/src/emu/bus/oricext/microdisc.c index 884cfb9c271..c66adfa555a 100644 --- a/src/emu/bus/oricext/microdisc.c +++ b/src/emu/bus/oricext/microdisc.c @@ -19,7 +19,7 @@ static SLOT_INTERFACE_START( microdisc_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( microdisc ) - MCFG_FD1793x_ADD("fdc", XTAL_8MHz/8) + MCFG_FD1793_ADD("fdc", XTAL_8MHz/8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(microdisc_device, fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(microdisc_device, fdc_drq_w)) MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(microdisc_device, fdc_hld_w)) diff --git a/src/emu/bus/ql/sandy_superdisk.c b/src/emu/bus/ql/sandy_superdisk.c index 548268edfef..cf334d6db67 100644 --- a/src/emu/bus/ql/sandy_superdisk.c +++ b/src/emu/bus/ql/sandy_superdisk.c @@ -81,7 +81,7 @@ WRITE_LINE_MEMBER( sandy_super_disk_t::busy_w ) //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( sandy_super_disk ) - MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000) + MCFG_DEVICE_ADD(WD1772_TAG, WD1772, 8000000) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_super_disk_floppies, "35dd", sandy_super_disk_t::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_super_disk_floppies, NULL, sandy_super_disk_t::floppy_formats) diff --git a/src/emu/bus/ql/sandy_superqboard.c b/src/emu/bus/ql/sandy_superqboard.c index 51e338ea76c..3e5558302db 100644 --- a/src/emu/bus/ql/sandy_superqboard.c +++ b/src/emu/bus/ql/sandy_superqboard.c @@ -102,7 +102,7 @@ WRITE_LINE_MEMBER( sandy_superqboard_t::busy_w ) //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( sandy_superqboard ) - MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, XTAL_16MHz/2) + MCFG_DEVICE_ADD(WD1772_TAG, WD1772, XTAL_16MHz/2) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_superqboard_floppies, "35hd", sandy_superqboard_t::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_superqboard_floppies, NULL, sandy_superqboard_t::floppy_formats) diff --git a/src/emu/bus/ql/trumpcard.c b/src/emu/bus/ql/trumpcard.c index 08217f04950..fa77ed23d53 100644 --- a/src/emu/bus/ql/trumpcard.c +++ b/src/emu/bus/ql/trumpcard.c @@ -85,7 +85,7 @@ FLOPPY_FORMATS_END //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( ql_trump_card ) - MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000) + MCFG_DEVICE_ADD(WD1772_TAG, WD1772, 8000000) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", ql_trump_card_floppies, "35dd", ql_trump_card_t::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", ql_trump_card_floppies, NULL, ql_trump_card_t::floppy_formats) MACHINE_CONFIG_END diff --git a/src/emu/bus/s100/dj2db.c b/src/emu/bus/s100/dj2db.c index 061a0c07880..f32d32e3eb2 100644 --- a/src/emu/bus/s100/dj2db.c +++ b/src/emu/bus/s100/dj2db.c @@ -104,7 +104,7 @@ static MACHINE_CONFIG_FRAGMENT( s100_dj2db ) MCFG_DEVICE_ADD(BR1941_TAG, COM8116, XTAL_5_0688MHz) MCFG_COM8116_FR_HANDLER(WRITELINE(s100_dj2db_device, fr_w)) - MCFG_MB8866x_ADD(MB8866_TAG, XTAL_10MHz/5) + MCFG_MB8866_ADD(MB8866_TAG, XTAL_10MHz/5) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(s100_dj2db_device, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(s100_dj2db_device, fdc_drq_w)) diff --git a/src/emu/bus/sega8/sega8_slot.c b/src/emu/bus/sega8/sega8_slot.c index 92c80af2c61..ac696a0ac95 100644 --- a/src/emu/bus/sega8/sega8_slot.c +++ b/src/emu/bus/sega8/sega8_slot.c @@ -731,7 +731,7 @@ void sega8_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len, UIN logerror("FILE DETAILS\n" ); logerror("============\n" ); logerror("Name: %s\n", basename()); - logerror("File Size: 0x%" I64FMT "x\n", (software_entry() == NULL) ? length() : get_software_region_length("rom")); + logerror("File Size: 0x%08x\n", (software_entry() == NULL) ? (int)length() : (int)get_software_region_length("rom")); logerror("Detected type: %s\n", sega8_get_slot(m_type)); logerror("ROM (Allocated) Size: 0x%X\n", len); logerror("RAM: %s\n", nvram_len ? "Yes" : "No"); diff --git a/src/emu/bus/ti99_peb/bwg.c b/src/emu/bus/ti99_peb/bwg.c index 2ae171b9423..d5504ff2283 100644 --- a/src/emu/bus/ti99_peb/bwg.c +++ b/src/emu/bus/ti99_peb/bwg.c @@ -661,7 +661,7 @@ static SLOT_INTERFACE_START( bwg_floppies ) SLOT_INTERFACE_END MACHINE_CONFIG_FRAGMENT( bwg_fdc ) - MCFG_WD1773x_ADD(FDC_TAG, XTAL_8MHz) + MCFG_WD1773_ADD(FDC_TAG, XTAL_8MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_drq_w)) diff --git a/src/emu/bus/ti99_peb/ti_fdc.c b/src/emu/bus/ti99_peb/ti_fdc.c index fe9d6133108..610832e2539 100644 --- a/src/emu/bus/ti99_peb/ti_fdc.c +++ b/src/emu/bus/ti99_peb/ti_fdc.c @@ -403,7 +403,7 @@ static SLOT_INTERFACE_START( tifdc_floppies ) SLOT_INTERFACE_END MACHINE_CONFIG_FRAGMENT( ti_fdc ) - MCFG_FD1771x_ADD(FDC_TAG, XTAL_1MHz) + MCFG_FD1771_ADD(FDC_TAG, XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ti_fdc_device, fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(ti_fdc_device, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD("0", tifdc_floppies, "525dd", ti_fdc_device::floppy_formats) diff --git a/src/emu/bus/tvc/hbf.c b/src/emu/bus/tvc/hbf.c index 7d87477172e..760226a2cfb 100644 --- a/src/emu/bus/tvc/hbf.c +++ b/src/emu/bus/tvc/hbf.c @@ -23,7 +23,7 @@ static SLOT_INTERFACE_START( tvc_hbf_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT(tvc_hbf) - MCFG_FD1793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", tvc_hbf_floppies, "525qd", tvc_hbf_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", tvc_hbf_floppies, "525qd", tvc_hbf_device::floppy_formats) MACHINE_CONFIG_END diff --git a/src/emu/cheat.c b/src/emu/cheat.c index c5cce57604b..08f86957eac 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -1135,7 +1135,7 @@ void cheat_manager::reload() m_disabled = false; // load the cheat file, if it's a system that has a software list then try softlist_name/shortname.xml first, - // if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml ) + // if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml ) image_interface_iterator iter(machine().root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) if (image->exists()) @@ -1150,7 +1150,7 @@ void cheat_manager::reload() load_cheats(filename.c_str()); break; } - // else we are loading outside the software list, try to load machine_basename/crc32.xml + // else we are loading outside the software list, try to load machine_basename/crc32.xml else { UINT32 crc = image->crc(); diff --git a/src/emu/cpu/8x300/8x300.c b/src/emu/cpu/8x300/8x300.c index 0bbc7eec3d6..bf6a5148ca5 100644 --- a/src/emu/cpu/8x300/8x300.c +++ b/src/emu/cpu/8x300/8x300.c @@ -12,7 +12,7 @@ #include "debugger.h" #include "8x300.h" -#define FETCHOP(a) (m_direct->read_decrypted_word(a)) +#define FETCHOP(a) (m_direct->read_word(a)) #define CYCLES(x) do { m_icount -= (x); } while (0) #define READPORT(a) (m_io->read_byte(a)) #define WRITEPORT(a,v) (m_io->write_byte((a), (v))) diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index 3c3a5e7049c..8142a6a7a34 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -811,7 +811,7 @@ inline void adsp21xx_device::program_write(UINT32 addr, UINT32 data) inline UINT32 adsp21xx_device::opcode_read() { - return m_direct->read_decrypted_dword(m_pc << 2); + return m_direct->read_dword(m_pc << 2); } diff --git a/src/emu/cpu/alph8201/alph8201.h b/src/emu/cpu/alph8201/alph8201.h index 3431627a6ee..16555803988 100644 --- a/src/emu/cpu/alph8201/alph8201.h +++ b/src/emu/cpu/alph8201/alph8201.h @@ -72,8 +72,8 @@ protected: UINT8 M_RDMEM(UINT16 A) { return m_program->read_byte(A); } void M_WRMEM(UINT16 A,UINT8 V) { m_program->write_byte(A, V); } - UINT8 M_RDOP(UINT16 A) { return m_direct->read_decrypted_byte(A); } - UINT8 M_RDOP_ARG(UINT16 A) { return m_direct->read_raw_byte(A); } + UINT8 M_RDOP(UINT16 A) { return m_direct->read_byte(A); } + UINT8 M_RDOP_ARG(UINT16 A) { return m_direct->read_byte(A); } UINT8 RD_REG(UINT8 x) { return m_RAM[(m_regPtr<<3)+(x)]; } void WR_REG(UINT8 x, UINT8 d) { m_RAM[(m_regPtr<<3)+(x)]=(d); } diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c index ee0dd825a60..27924fa163f 100644 --- a/src/emu/cpu/am29000/am29000.c +++ b/src/emu/cpu/am29000/am29000.c @@ -479,7 +479,7 @@ UINT32 am29000_cpu_device::read_program_word(UINT32 address) { /* TODO: ROM enable? */ if (m_cps & CPS_PI || m_cps & CPS_RE) - return m_direct->read_decrypted_dword(address); + return m_direct->read_dword(address); else { fatalerror("Am29000 instruction MMU translation enabled!\n"); @@ -626,7 +626,7 @@ void am29000_cpu_device::execute_run() if (m_cfg & CFG_VF) { UINT32 vaddr = m_vab | m_exception_queue[0] * 4; - UINT32 vect = m_datadirect->read_decrypted_dword(vaddr); + UINT32 vect = m_datadirect->read_dword(vaddr); m_pc = vect & ~3; m_next_pc = m_pc; diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index 3b2b410bf58..8d9b420486d 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -345,7 +345,7 @@ void arm_cpu_device::execute_run() /* load instruction */ pc = R15; - insn = m_direct->read_decrypted_dword( pc & ADDRESS_MASK ); + insn = m_direct->read_dword( pc & ADDRESS_MASK ); switch (insn >> INSN_COND_SHIFT) { diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c index 65125f265f6..65cae0871ac 100644 --- a/src/emu/cpu/arm7/arm7.c +++ b/src/emu/cpu/arm7/arm7.c @@ -641,7 +641,7 @@ void arm7_cpu_device::execute_run() } } - insn = m_direct->read_decrypted_word(raddr); + insn = m_direct->read_word(raddr); (this->*thumb_handler[(insn & 0xffc0) >> 6])(pc, insn); } @@ -672,7 +672,7 @@ void arm7_cpu_device::execute_run() } #endif - insn = m_direct->read_decrypted_dword(raddr); + insn = m_direct->read_dword(raddr); /* process condition codes for this instruction */ switch (insn >> INSN_COND_SHIFT) diff --git a/src/emu/cpu/arm7/arm7drc.inc b/src/emu/cpu/arm7/arm7drc.inc index fc97e35da1f..c30ee7a6de4 100644 --- a/src/emu/cpu/arm7/arm7drc.inc +++ b/src/emu/cpu/arm7/arm7drc.inc @@ -1203,12 +1203,12 @@ void arm7_cpu_device::generate_checksum_block(drcuml_block *block, compiler_stat if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP)) { UINT32 sum = seqhead->opptr.l[0]; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc); + void *base = m_direct->read_ptr(seqhead->physpc); UML_LOAD(block, uml::I0, base, 0, uml::SIZE_DWORD, uml::SCALE_x4); // load i0,base,0,dword if (seqhead->delay.first() != NULL && seqhead->physpc != seqhead->delay.first()->physpc) { - base = m_direct->read_decrypted_ptr(seqhead->delay.first()->physpc); + base = m_direct->read_ptr(seqhead->delay.first()->physpc); UML_LOAD(block, uml::I1, base, 0, uml::SIZE_DWORD, uml::SCALE_x4); // load i1,base,dword UML_ADD(block, uml::I0, uml::I0, uml::I1); // add i0,i0,i1 @@ -1224,20 +1224,20 @@ void arm7_cpu_device::generate_checksum_block(drcuml_block *block, compiler_stat else { UINT32 sum = 0; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc); + void *base = m_direct->read_ptr(seqhead->physpc); UML_LOAD(block, uml::I0, base, 0, uml::SIZE_DWORD, uml::SCALE_x4); // load i0,base,0,dword sum += seqhead->opptr.l[0]; for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc); + base = m_direct->read_ptr(curdesc->physpc); UML_LOAD(block, uml::I1, base, 0, uml::SIZE_DWORD, uml::SCALE_x4); // load i1,base,dword UML_ADD(block, uml::I0, uml::I0, uml::I1); // add i0,i0,i1 sum += curdesc->opptr.l[0]; if (curdesc->delay.first() != NULL && (curdesc == seqlast || (curdesc->next() != NULL && curdesc->next()->physpc != curdesc->delay.first()->physpc))) { - base = m_direct->read_decrypted_ptr(curdesc->delay.first()->physpc); + base = m_direct->read_ptr(curdesc->delay.first()->physpc); UML_LOAD(block, uml::I1, base, 0, uml::SIZE_DWORD, uml::SCALE_x4); // load i1,base,dword UML_ADD(block, uml::I0, uml::I0, uml::I1); // add i0,i0,i1 sum += curdesc->delay.first()->opptr.l[0]; diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index 1402ef8e442..21133e46975 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -343,7 +343,7 @@ offs_t asap_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr inline UINT32 asap_device::readop(offs_t pc) { - return m_direct->read_decrypted_dword(pc); + return m_direct->read_dword(pc); } diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c index 976b2ff8856..4f45b51e0ea 100644 --- a/src/emu/cpu/avr8/avr8.c +++ b/src/emu/cpu/avr8/avr8.c @@ -869,6 +869,7 @@ void avr8_device::device_reset() m_timer_prescale_count[t] = 0; } + m_ocr2_not_reached_yet = true; m_interrupt_pending = false; m_elapsed_cycles = 0; } @@ -1553,22 +1554,26 @@ void avr8_device::timer2_tick() switch(wgm2) { case WGM02_FAST_PWM: - if(count == ocr2[reg]) - { - if (reg == 0) - { - m_r[AVR8_REGIDX_TIFR2] |= AVR8_TIFR2_TOV2_MASK; - count = 0; - increment = 0; - } - - m_r[AVR8_REGIDX_TIFR2] |= ocf2[reg]; - } - else if(count == 0) + if (reg==0) { - if (reg == 0) + if (count >= m_r[AVR8_REGIDX_OCR2A]) { - m_r[AVR8_REGIDX_TIFR2] &= ~AVR8_TIFR2_TOV2_MASK; + if (count >= 0xFF) + { + //Turn on + m_io->write_byte(AVR8_IO_PORTD, m_io->read_byte(AVR8_IO_PORTD) | (1 << 7)); + m_r[AVR8_REGIDX_TCNT2] = 0; + m_ocr2_not_reached_yet = true; + } + else + { + if (m_ocr2_not_reached_yet) + { + //Turn off + m_io->write_byte(AVR8_IO_PORTD, m_io->read_byte(AVR8_IO_PORTD) & ~(1 << 7)); + m_ocr2_not_reached_yet = false; + } + } } } break; @@ -1585,7 +1590,7 @@ void avr8_device::timer2_tick() m_r[AVR8_REGIDX_TIFR2] |= ocf2[reg]; } - else if(count == 0) + else if (count == 0) { if (reg == 0) { @@ -1616,7 +1621,7 @@ void avr8_device::timer2_tick() */ } - m_r[AVR8_REGIDX_TCNT2] = count + increment; + m_r[AVR8_REGIDX_TCNT2] += increment; update_interrupt(AVR8_INTIDX_OCF2A); update_interrupt(AVR8_INTIDX_OCF2B); diff --git a/src/emu/cpu/avr8/avr8.h b/src/emu/cpu/avr8/avr8.h index 2384c585804..5708a571023 100644 --- a/src/emu/cpu/avr8/avr8.h +++ b/src/emu/cpu/avr8/avr8.h @@ -162,6 +162,7 @@ protected: UINT8 m_timer_increment[6]; UINT16 m_timer_prescale[6]; UINT16 m_timer_prescale_count[6]; + bool m_ocr2_not_reached_yet; // SPI bool m_spi_active; diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c index a06ac8e003e..e8893580f0c 100644 --- a/src/emu/cpu/ccpu/ccpu.c +++ b/src/emu/cpu/ccpu/ccpu.c @@ -22,7 +22,7 @@ const device_type CCPU = &device_creator<ccpu_cpu_device>; MACROS ***************************************************************************/ -#define READOP(a) (m_direct->read_decrypted_byte(a)) +#define READOP(a) (m_direct->read_byte(a)) #define RDMEM(a) (m_data->read_word((a) * 2) & 0xfff) #define WRMEM(a,v) (m_data->write_word((a) * 2, (v))) diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index c52c1d18299..eca60705b2c 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -97,7 +97,7 @@ const device_type COP445 = &device_creator<cop445_cpu_device>; MACROS ***************************************************************************/ -#define ROM(a) m_direct->read_decrypted_byte(a) +#define ROM(a) m_direct->read_byte(a) #define RAM_R(a) m_data->read_byte(a) #define RAM_W(a, v) m_data->write_byte(a, v) diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index f33e5869725..f011e37a47a 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -533,7 +533,7 @@ offs_t cdp1802_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 * inline UINT8 cosmac_device::read_opcode(offs_t pc) { - return m_direct->read_decrypted_byte(pc); + return m_direct->read_byte(pc); } diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index 1279a2cdd91..fd6fd5eceb7 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -46,7 +46,7 @@ const device_type CP1610 = &device_creator<cp1610_cpu_device>; /* set sign and zero flags */ #define SET_SZ(n) \ if (n == 0) \ - m_flags |= Z; \ + m_flags |= Z; \ else \ if (n & 0x8000) \ m_flags |= S @@ -54,45 +54,32 @@ const device_type CP1610 = &device_creator<cp1610_cpu_device>; /* set sign zero, and carry flags */ #define SET_SZC(n,m) \ if (n == 0) \ - m_flags |= Z; \ + m_flags |= Z; \ else \ if (n & 0x8000) \ - m_flags |= S; \ + m_flags |= S; \ if ((n + m) & 0x10000) \ m_flags |= C /* set carry and overflow flags */ #define SET_COV(n,m,qq) \ - { unsigned int pp = n + m; \ +{ \ + unsigned int pp = n + m; \ if (pp & 0x10000) \ - m_flags |= C; \ + m_flags |= C; \ if (qq) \ { \ if ((n^pp)&(~(m^n))&0x8000) \ - m_flags |= OV; \ + m_flags |= OV; \ if (m == 0x8000) \ - m_flags ^= OV; \ + m_flags ^= OV; \ } \ else \ { \ if ((n^pp)&(~(m^n))&0x8000) \ m_flags |= OV; \ } \ - } - -#if 0 -#define SET_COV(n,m) \ - if ((n&0x7fff)+(m&0x7fff) > 0x7fff) \ - { \ - if (!(m_flags & C))\ - m_flags |= OV; \ - } \ - else \ - { \ - if (m_flags & C) \ - m_flags |= OV; \ - } -#endif +} /*********************************** * illegal opcodes @@ -368,16 +355,16 @@ void cp1610_cpu_device::cp1610_rlc_2(int r) { case 0: offset = 0; - break; + break; case OV: offset = 1; - break; + break; case C: offset = 2; - break; + break; case (C | OV): offset = 3; - break; + break; } CLR_SZOC; @@ -1098,10 +1085,6 @@ void cp1610_cpu_device::cp1610_mviat_i(int m, int d) m_r[m]++; m_r[d] = temp; m_icount -= 8; - - //m_r[d] = cp1610_readmem16(m_r[m]); - //m_r[m]++; - //m_icount -= 8; } /*************************************************** @@ -1527,13 +1510,6 @@ void cp1610_cpu_device::cp1610_xori(int d) m_icount -= 8; } - -void cp1610_cpu_device::device_reset() -{ - /* This is how we set the reset vector */ - set_input_line(CP1610_RESET, PULSE_LINE); -} - /*************************************************** * S Z C OV 0x001 1 010 mmm ddd (mmm = 0xx) * - - - - SDBD, MVI@ Rm, Rd @@ -2040,61 +2016,61 @@ void cp1610_cpu_device::cp1610_do_sdbd() case 0x260: case 0x268: case 0x270: - case 0x278: /* 1 001 xxx xxx */ cp1610_illegal(); break; - - case 0x280: /* 1 010 000 xxx */ cp1610_sdbd_mviat(0,dest); break; - case 0x288: /* 1 010 001 xxx */ cp1610_sdbd_mviat(1,dest); break; - case 0x290: /* 1 010 010 xxx */ cp1610_sdbd_mviat(2,dest); break; - case 0x298: /* 1 010 011 xxx */ cp1610_sdbd_mviat(3,dest); break; - case 0x2a0: /* 1 010 100 xxx */ cp1610_sdbd_mviat_i(4,dest); break; - case 0x2a8: /* 1 010 101 xxx */ cp1610_sdbd_mviat_i(5,dest); break; - case 0x2b0: /* 1 010 110 xxx */ cp1610_sdbd_mviat_d(6,dest); break; /* ??? */ - case 0x2b8: /* 1 010 111 xxx */ cp1610_sdbd_mvii(dest); break; - - case 0x2c0: /* 1 011 000 xxx */ cp1610_sdbd_addat(0,dest); break; - case 0x2c8: /* 1 011 001 xxx */ cp1610_sdbd_addat(1,dest); break; - case 0x2d0: /* 1 011 010 xxx */ cp1610_sdbd_addat(2,dest); break; - case 0x2d8: /* 1 011 011 xxx */ cp1610_sdbd_addat(3,dest); break; - case 0x2e0: /* 1 011 100 xxx */ cp1610_sdbd_addat_i(4,dest); break; - case 0x2e8: /* 1 011 101 xxx */ cp1610_sdbd_addat_i(5,dest); break; - case 0x2f0: /* 1 011 110 xxx */ cp1610_sdbd_addat_d(6,dest); break; /* ??? */ - case 0x2f8: /* 1 011 111 xxx */ cp1610_sdbd_addi(dest); break; - - case 0x300: /* 1 100 000 xxx */ cp1610_sdbd_subat(0,dest); break; - case 0x308: /* 1 100 001 xxx */ cp1610_sdbd_subat(1,dest); break; - case 0x310: /* 1 100 010 xxx */ cp1610_sdbd_subat(2,dest); break; - case 0x318: /* 1 100 011 xxx */ cp1610_sdbd_subat(3,dest); break; - case 0x320: /* 1 100 100 xxx */ cp1610_sdbd_subat_i(4,dest); break; - case 0x328: /* 1 100 101 xxx */ cp1610_sdbd_subat_i(5,dest); break; - case 0x330: /* 1 100 110 xxx */ cp1610_sdbd_subat_d(6,dest); break; /* ??? */ - case 0x338: /* 1 100 111 xxx */ cp1610_sdbd_subi(dest); break; - - case 0x340: /* 1 101 000 xxx */ cp1610_sdbd_cmpat(0,dest); break; - case 0x348: /* 1 101 001 xxx */ cp1610_sdbd_cmpat(1,dest); break; - case 0x350: /* 1 101 010 xxx */ cp1610_sdbd_cmpat(2,dest); break; - case 0x358: /* 1 101 011 xxx */ cp1610_sdbd_cmpat(3,dest); break; - case 0x360: /* 1 101 100 xxx */ cp1610_sdbd_cmpat_i(4,dest); break; - case 0x368: /* 1 101 101 xxx */ cp1610_sdbd_cmpat_i(5,dest); break; - case 0x370: /* 1 101 110 xxx */ cp1610_sdbd_cmpat_d(6,dest); break; /* ??? */ - case 0x378: /* 1 101 111 xxx */ cp1610_sdbd_cmpi(dest); break; - - case 0x380: /* 1 110 000 xxx */ cp1610_sdbd_andat(0,dest); break; - case 0x388: /* 1 110 001 xxx */ cp1610_sdbd_andat(1,dest); break; - case 0x390: /* 1 110 010 xxx */ cp1610_sdbd_andat(2,dest); break; - case 0x398: /* 1 110 011 xxx */ cp1610_sdbd_andat(3,dest); break; - case 0x3a0: /* 1 110 100 xxx */ cp1610_sdbd_andat_i(4,dest); break; - case 0x3a8: /* 1 110 101 xxx */ cp1610_sdbd_andat_i(5,dest); break; - case 0x3b0: /* 1 110 110 xxx */ cp1610_sdbd_andat_d(6,dest); break; /* ??? */ - case 0x3b8: /* 1 110 111 xxx */ cp1610_sdbd_andi(dest); break; - - case 0x3c0: /* 1 110 000 xxx */ cp1610_sdbd_xorat(0,dest); break; - case 0x3c8: /* 1 110 001 xxx */ cp1610_sdbd_xorat(1,dest); break; - case 0x3d0: /* 1 110 010 xxx */ cp1610_sdbd_xorat(2,dest); break; - case 0x3d8: /* 1 110 011 xxx */ cp1610_sdbd_xorat(3,dest); break; - case 0x3e0: /* 1 110 100 xxx */ cp1610_sdbd_xorat_i(4,dest); break; - case 0x3e8: /* 1 110 101 xxx */ cp1610_sdbd_xorat_i(5,dest); break; - case 0x3f0: /* 1 110 110 xxx */ cp1610_sdbd_xorat_d(6,dest); break; /* ??? */ - case 0x3f8: /* 1 110 111 xxx */ cp1610_sdbd_xori(dest); break; + case 0x278: /* 1 001 xxx xxx */ cp1610_illegal(); break; + + case 0x280: /* 1 010 000 xxx */ cp1610_sdbd_mviat(0,dest); break; + case 0x288: /* 1 010 001 xxx */ cp1610_sdbd_mviat(1,dest); break; + case 0x290: /* 1 010 010 xxx */ cp1610_sdbd_mviat(2,dest); break; + case 0x298: /* 1 010 011 xxx */ cp1610_sdbd_mviat(3,dest); break; + case 0x2a0: /* 1 010 100 xxx */ cp1610_sdbd_mviat_i(4,dest); break; + case 0x2a8: /* 1 010 101 xxx */ cp1610_sdbd_mviat_i(5,dest); break; + case 0x2b0: /* 1 010 110 xxx */ cp1610_sdbd_mviat_d(6,dest); break; /* ??? */ + case 0x2b8: /* 1 010 111 xxx */ cp1610_sdbd_mvii(dest); break; + + case 0x2c0: /* 1 011 000 xxx */ cp1610_sdbd_addat(0,dest); break; + case 0x2c8: /* 1 011 001 xxx */ cp1610_sdbd_addat(1,dest); break; + case 0x2d0: /* 1 011 010 xxx */ cp1610_sdbd_addat(2,dest); break; + case 0x2d8: /* 1 011 011 xxx */ cp1610_sdbd_addat(3,dest); break; + case 0x2e0: /* 1 011 100 xxx */ cp1610_sdbd_addat_i(4,dest); break; + case 0x2e8: /* 1 011 101 xxx */ cp1610_sdbd_addat_i(5,dest); break; + case 0x2f0: /* 1 011 110 xxx */ cp1610_sdbd_addat_d(6,dest); break; /* ??? */ + case 0x2f8: /* 1 011 111 xxx */ cp1610_sdbd_addi(dest); break; + + case 0x300: /* 1 100 000 xxx */ cp1610_sdbd_subat(0,dest); break; + case 0x308: /* 1 100 001 xxx */ cp1610_sdbd_subat(1,dest); break; + case 0x310: /* 1 100 010 xxx */ cp1610_sdbd_subat(2,dest); break; + case 0x318: /* 1 100 011 xxx */ cp1610_sdbd_subat(3,dest); break; + case 0x320: /* 1 100 100 xxx */ cp1610_sdbd_subat_i(4,dest); break; + case 0x328: /* 1 100 101 xxx */ cp1610_sdbd_subat_i(5,dest); break; + case 0x330: /* 1 100 110 xxx */ cp1610_sdbd_subat_d(6,dest); break; /* ??? */ + case 0x338: /* 1 100 111 xxx */ cp1610_sdbd_subi(dest); break; + + case 0x340: /* 1 101 000 xxx */ cp1610_sdbd_cmpat(0,dest); break; + case 0x348: /* 1 101 001 xxx */ cp1610_sdbd_cmpat(1,dest); break; + case 0x350: /* 1 101 010 xxx */ cp1610_sdbd_cmpat(2,dest); break; + case 0x358: /* 1 101 011 xxx */ cp1610_sdbd_cmpat(3,dest); break; + case 0x360: /* 1 101 100 xxx */ cp1610_sdbd_cmpat_i(4,dest); break; + case 0x368: /* 1 101 101 xxx */ cp1610_sdbd_cmpat_i(5,dest); break; + case 0x370: /* 1 101 110 xxx */ cp1610_sdbd_cmpat_d(6,dest); break; /* ??? */ + case 0x378: /* 1 101 111 xxx */ cp1610_sdbd_cmpi(dest); break; + + case 0x380: /* 1 110 000 xxx */ cp1610_sdbd_andat(0,dest); break; + case 0x388: /* 1 110 001 xxx */ cp1610_sdbd_andat(1,dest); break; + case 0x390: /* 1 110 010 xxx */ cp1610_sdbd_andat(2,dest); break; + case 0x398: /* 1 110 011 xxx */ cp1610_sdbd_andat(3,dest); break; + case 0x3a0: /* 1 110 100 xxx */ cp1610_sdbd_andat_i(4,dest); break; + case 0x3a8: /* 1 110 101 xxx */ cp1610_sdbd_andat_i(5,dest); break; + case 0x3b0: /* 1 110 110 xxx */ cp1610_sdbd_andat_d(6,dest); break; /* ??? */ + case 0x3b8: /* 1 110 111 xxx */ cp1610_sdbd_andi(dest); break; + + case 0x3c0: /* 1 110 000 xxx */ cp1610_sdbd_xorat(0,dest); break; + case 0x3c8: /* 1 110 001 xxx */ cp1610_sdbd_xorat(1,dest); break; + case 0x3d0: /* 1 110 010 xxx */ cp1610_sdbd_xorat(2,dest); break; + case 0x3d8: /* 1 110 011 xxx */ cp1610_sdbd_xorat(3,dest); break; + case 0x3e0: /* 1 110 100 xxx */ cp1610_sdbd_xorat_i(4,dest); break; + case 0x3e8: /* 1 110 101 xxx */ cp1610_sdbd_xorat_i(5,dest); break; + case 0x3f0: /* 1 110 110 xxx */ cp1610_sdbd_xorat_d(6,dest); break; /* ??? */ + case 0x3f8: /* 1 110 111 xxx */ cp1610_sdbd_xori(dest); break; default: cp1610_illegal(); break; } } @@ -2115,25 +2091,25 @@ void cp1610_cpu_device::cp1610_do_jumps() switch( jumptype ) { - case 0x000: /* 0 0xx xxx x00 */ cp1610_jsr(4,addr); break; - case 0x001: /* 0 0xx xxx x01 */ cp1610_jsre(4,addr); break; - case 0x002: /* 0 0xx xxx x10 */ cp1610_jsrd(4,addr); break; - case 0x003: /* 0 0xx xxx x11 */ cp1610_illegal(); break; - - case 0x100: /* 0 1xx xxx x00 */ cp1610_jsr(5,addr); break; - case 0x101: /* 0 1xx xxx x01 */ cp1610_jsre(5,addr); break; - case 0x102: /* 0 1xx xxx x10 */ cp1610_jsrd(5,addr); break; - case 0x103: /* 0 1xx xxx x11 */ cp1610_illegal(); break; - - case 0x200: /* 1 0xx xxx x00 */ cp1610_jsr(6,addr); break; - case 0x201: /* 1 0xx xxx x01 */ cp1610_jsre(6,addr); break; - case 0x202: /* 1 0xx xxx x10 */ cp1610_jsrd(6,addr); break; - case 0x203: /* 1 0xx xxx x11 */ cp1610_illegal(); break; - - case 0x300: /* 1 1xx xxx x00 */ cp1610_j(addr); break; - case 0x301: /* 1 1xx xxx x01 */ cp1610_je(addr); break; - case 0x302: /* 1 1xx xxx x10 */ cp1610_jd(addr); break; - case 0x303: /* 1 1xx xxx x11 */ cp1610_illegal(); break; + case 0x000: /* 0 0xx xxx x00 */ cp1610_jsr(4,addr); break; + case 0x001: /* 0 0xx xxx x01 */ cp1610_jsre(4,addr); break; + case 0x002: /* 0 0xx xxx x10 */ cp1610_jsrd(4,addr); break; + case 0x003: /* 0 0xx xxx x11 */ cp1610_illegal(); break; + + case 0x100: /* 0 1xx xxx x00 */ cp1610_jsr(5,addr); break; + case 0x101: /* 0 1xx xxx x01 */ cp1610_jsre(5,addr); break; + case 0x102: /* 0 1xx xxx x10 */ cp1610_jsrd(5,addr); break; + case 0x103: /* 0 1xx xxx x11 */ cp1610_illegal(); break; + + case 0x200: /* 1 0xx xxx x00 */ cp1610_jsr(6,addr); break; + case 0x201: /* 1 0xx xxx x01 */ cp1610_jsre(6,addr); break; + case 0x202: /* 1 0xx xxx x10 */ cp1610_jsrd(6,addr); break; + case 0x203: /* 1 0xx xxx x11 */ cp1610_illegal(); break; + + case 0x300: /* 1 1xx xxx x00 */ cp1610_j(addr); break; + case 0x301: /* 1 1xx xxx x01 */ cp1610_je(addr); break; + case 0x302: /* 1 1xx xxx x10 */ cp1610_jd(addr); break; + case 0x303: /* 1 1xx xxx x11 */ cp1610_illegal(); break; } m_icount -= 12; @@ -2166,104 +2142,104 @@ void cp1610_cpu_device::execute_run() switch( opcode ) { /* opcode bitmask */ - case 0x000: /* 0 000 000 000 */ cp1610_hlt(); break; /* TBD */ - case 0x001: /* 0 000 000 001 */ cp1610_do_sdbd(); break; - case 0x002: /* 0 000 000 010 */ cp1610_eis(); break; /* TBD */ - case 0x003: /* 0 000 000 011 */ cp1610_dis(); break; /* TBD */ - case 0x004: /* 0 000 000 100 */ cp1610_do_jumps(); break; - case 0x005: /* 0 000 000 101 */ cp1610_tci(); break; /* TBD */ - case 0x006: /* 0 000 000 110 */ cp1610_clrc(); break; - case 0x007: /* 0 000 000 111 */ cp1610_setc(); break; - - case 0x008: /* 0 000 001 000 */ cp1610_incr(0); break; - case 0x009: /* 0 000 001 001 */ cp1610_incr(1); break; - case 0x00a: /* 0 000 001 010 */ cp1610_incr(2); break; - case 0x00b: /* 0 000 001 011 */ cp1610_incr(3); break; - case 0x00c: /* 0 000 001 100 */ cp1610_incr(4); break; - case 0x00d: /* 0 000 001 101 */ cp1610_incr(5); break; - case 0x00e: /* 0 000 001 110 */ cp1610_incr(6); break; - case 0x00f: /* 0 000 001 111 */ cp1610_incr(7); break; - - case 0x010: /* 0 000 010 000 */ cp1610_decr(0); break; - case 0x011: /* 0 000 010 001 */ cp1610_decr(1); break; - case 0x012: /* 0 000 010 010 */ cp1610_decr(2); break; - case 0x013: /* 0 000 010 011 */ cp1610_decr(3); break; - case 0x014: /* 0 000 010 100 */ cp1610_decr(4); break; - case 0x015: /* 0 000 010 101 */ cp1610_decr(5); break; - case 0x016: /* 0 000 010 110 */ cp1610_decr(6); break; - case 0x017: /* 0 000 010 111 */ cp1610_decr(7); break; - - case 0x018: /* 0 000 011 000 */ cp1610_comr(0); break; - case 0x019: /* 0 000 011 001 */ cp1610_comr(1); break; - case 0x01a: /* 0 000 011 010 */ cp1610_comr(2); break; - case 0x01b: /* 0 000 011 011 */ cp1610_comr(3); break; - case 0x01c: /* 0 000 011 100 */ cp1610_comr(4); break; - case 0x01d: /* 0 000 011 101 */ cp1610_comr(5); break; - case 0x01e: /* 0 000 011 110 */ cp1610_comr(6); break; - case 0x01f: /* 0 000 011 111 */ cp1610_comr(7); break; - - case 0x020: /* 0 000 100 000 */ cp1610_negr(0); break; - case 0x021: /* 0 000 100 001 */ cp1610_negr(1); break; - case 0x022: /* 0 000 100 010 */ cp1610_negr(2); break; - case 0x023: /* 0 000 100 011 */ cp1610_negr(3); break; - case 0x024: /* 0 000 100 100 */ cp1610_negr(4); break; - case 0x025: /* 0 000 100 101 */ cp1610_negr(5); break; - case 0x026: /* 0 000 100 110 */ cp1610_negr(6); break; - case 0x027: /* 0 000 100 111 */ cp1610_negr(7); break; - - case 0x028: /* 0 000 101 000 */ cp1610_adcr(0); break; - case 0x029: /* 0 000 101 001 */ cp1610_adcr(1); break; - case 0x02a: /* 0 000 101 010 */ cp1610_adcr(2); break; - case 0x02b: /* 0 000 101 011 */ cp1610_adcr(3); break; - case 0x02c: /* 0 000 101 100 */ cp1610_adcr(4); break; - case 0x02d: /* 0 000 101 101 */ cp1610_adcr(5); break; - case 0x02e: /* 0 000 101 110 */ cp1610_adcr(6); break; - case 0x02f: /* 0 000 101 111 */ cp1610_adcr(7); break; - - case 0x030: /* 0 000 110 000 */ cp1610_gswd(0); break; - case 0x031: /* 0 000 110 001 */ cp1610_gswd(1); break; - case 0x032: /* 0 000 110 010 */ cp1610_gswd(2); break; - case 0x033: /* 0 000 110 011 */ cp1610_gswd(3); break; - case 0x034: /* 0 000 110 100 */ cp1610_nop(); break; - case 0x035: /* 0 000 110 101 */ cp1610_nop(); break; - case 0x036: /* 0 000 110 110 */ cp1610_sin(); break; /* TBD */ - case 0x037: /* 0 000 110 111 */ cp1610_sin(); break; /* TBD */ - - case 0x038: /* 0 000 111 000 */ cp1610_rswd(0); break; - case 0x039: /* 0 000 111 001 */ cp1610_rswd(1); break; - case 0x03a: /* 0 000 111 010 */ cp1610_rswd(2); break; - case 0x03b: /* 0 000 111 011 */ cp1610_rswd(3); break; - case 0x03c: /* 0 000 111 100 */ cp1610_rswd(4); break; - case 0x03d: /* 0 000 111 101 */ cp1610_rswd(5); break; - case 0x03e: /* 0 000 111 110 */ cp1610_rswd(6); break; - case 0x03f: /* 0 000 111 111 */ cp1610_rswd(7); break; - - case 0x040: /* 0 001 000 000 */ cp1610_swap(0); break; - case 0x041: /* 0 001 000 001 */ cp1610_swap(1); break; - case 0x042: /* 0 001 000 010 */ cp1610_swap(2); break; - case 0x043: /* 0 001 000 011 */ cp1610_swap(3); break; - case 0x044: /* 0 001 000 100 */ cp1610_dswap(0); break; - case 0x045: /* 0 001 000 101 */ cp1610_dswap(1); break; - case 0x046: /* 0 001 000 110 */ cp1610_dswap(2); break; - case 0x047: /* 0 001 000 111 */ cp1610_dswap(3); break; - - case 0x048: /* 0 001 001 000 */ cp1610_sll_1(0); break; - case 0x049: /* 0 001 001 001 */ cp1610_sll_1(1); break; - case 0x04a: /* 0 001 001 010 */ cp1610_sll_1(2); break; - case 0x04b: /* 0 001 001 011 */ cp1610_sll_1(3); break; - case 0x04c: /* 0 001 001 100 */ cp1610_sll_2(0); break; - case 0x04d: /* 0 001 001 101 */ cp1610_sll_2(1); break; - case 0x04e: /* 0 001 001 110 */ cp1610_sll_2(2); break; - case 0x04f: /* 0 001 001 111 */ cp1610_sll_2(3); break; - - case 0x050: /* 0 001 010 000 */ cp1610_rlc_1(0); break; - case 0x051: /* 0 001 010 001 */ cp1610_rlc_1(1); break; - case 0x052: /* 0 001 010 010 */ cp1610_rlc_1(2); break; - case 0x053: /* 0 001 010 011 */ cp1610_rlc_1(3); break; - case 0x054: /* 0 001 010 100 */ cp1610_rlc_2(0); break; - case 0x055: /* 0 001 010 101 */ cp1610_rlc_2(1); break; - case 0x056: /* 0 001 010 110 */ cp1610_rlc_2(2); break; - case 0x057: /* 0 001 010 111 */ cp1610_rlc_2(3); break; + case 0x000: /* 0 000 000 000 */ cp1610_hlt(); break; /* TBD */ + case 0x001: /* 0 000 000 001 */ cp1610_do_sdbd(); break; + case 0x002: /* 0 000 000 010 */ cp1610_eis(); break; /* TBD */ + case 0x003: /* 0 000 000 011 */ cp1610_dis(); break; /* TBD */ + case 0x004: /* 0 000 000 100 */ cp1610_do_jumps(); break; + case 0x005: /* 0 000 000 101 */ cp1610_tci(); break; /* TBD */ + case 0x006: /* 0 000 000 110 */ cp1610_clrc(); break; + case 0x007: /* 0 000 000 111 */ cp1610_setc(); break; + + case 0x008: /* 0 000 001 000 */ cp1610_incr(0); break; + case 0x009: /* 0 000 001 001 */ cp1610_incr(1); break; + case 0x00a: /* 0 000 001 010 */ cp1610_incr(2); break; + case 0x00b: /* 0 000 001 011 */ cp1610_incr(3); break; + case 0x00c: /* 0 000 001 100 */ cp1610_incr(4); break; + case 0x00d: /* 0 000 001 101 */ cp1610_incr(5); break; + case 0x00e: /* 0 000 001 110 */ cp1610_incr(6); break; + case 0x00f: /* 0 000 001 111 */ cp1610_incr(7); break; + + case 0x010: /* 0 000 010 000 */ cp1610_decr(0); break; + case 0x011: /* 0 000 010 001 */ cp1610_decr(1); break; + case 0x012: /* 0 000 010 010 */ cp1610_decr(2); break; + case 0x013: /* 0 000 010 011 */ cp1610_decr(3); break; + case 0x014: /* 0 000 010 100 */ cp1610_decr(4); break; + case 0x015: /* 0 000 010 101 */ cp1610_decr(5); break; + case 0x016: /* 0 000 010 110 */ cp1610_decr(6); break; + case 0x017: /* 0 000 010 111 */ cp1610_decr(7); break; + + case 0x018: /* 0 000 011 000 */ cp1610_comr(0); break; + case 0x019: /* 0 000 011 001 */ cp1610_comr(1); break; + case 0x01a: /* 0 000 011 010 */ cp1610_comr(2); break; + case 0x01b: /* 0 000 011 011 */ cp1610_comr(3); break; + case 0x01c: /* 0 000 011 100 */ cp1610_comr(4); break; + case 0x01d: /* 0 000 011 101 */ cp1610_comr(5); break; + case 0x01e: /* 0 000 011 110 */ cp1610_comr(6); break; + case 0x01f: /* 0 000 011 111 */ cp1610_comr(7); break; + + case 0x020: /* 0 000 100 000 */ cp1610_negr(0); break; + case 0x021: /* 0 000 100 001 */ cp1610_negr(1); break; + case 0x022: /* 0 000 100 010 */ cp1610_negr(2); break; + case 0x023: /* 0 000 100 011 */ cp1610_negr(3); break; + case 0x024: /* 0 000 100 100 */ cp1610_negr(4); break; + case 0x025: /* 0 000 100 101 */ cp1610_negr(5); break; + case 0x026: /* 0 000 100 110 */ cp1610_negr(6); break; + case 0x027: /* 0 000 100 111 */ cp1610_negr(7); break; + + case 0x028: /* 0 000 101 000 */ cp1610_adcr(0); break; + case 0x029: /* 0 000 101 001 */ cp1610_adcr(1); break; + case 0x02a: /* 0 000 101 010 */ cp1610_adcr(2); break; + case 0x02b: /* 0 000 101 011 */ cp1610_adcr(3); break; + case 0x02c: /* 0 000 101 100 */ cp1610_adcr(4); break; + case 0x02d: /* 0 000 101 101 */ cp1610_adcr(5); break; + case 0x02e: /* 0 000 101 110 */ cp1610_adcr(6); break; + case 0x02f: /* 0 000 101 111 */ cp1610_adcr(7); break; + + case 0x030: /* 0 000 110 000 */ cp1610_gswd(0); break; + case 0x031: /* 0 000 110 001 */ cp1610_gswd(1); break; + case 0x032: /* 0 000 110 010 */ cp1610_gswd(2); break; + case 0x033: /* 0 000 110 011 */ cp1610_gswd(3); break; + case 0x034: /* 0 000 110 100 */ cp1610_nop(); break; + case 0x035: /* 0 000 110 101 */ cp1610_nop(); break; + case 0x036: /* 0 000 110 110 */ cp1610_sin(); break; /* TBD */ + case 0x037: /* 0 000 110 111 */ cp1610_sin(); break; /* TBD */ + + case 0x038: /* 0 000 111 000 */ cp1610_rswd(0); break; + case 0x039: /* 0 000 111 001 */ cp1610_rswd(1); break; + case 0x03a: /* 0 000 111 010 */ cp1610_rswd(2); break; + case 0x03b: /* 0 000 111 011 */ cp1610_rswd(3); break; + case 0x03c: /* 0 000 111 100 */ cp1610_rswd(4); break; + case 0x03d: /* 0 000 111 101 */ cp1610_rswd(5); break; + case 0x03e: /* 0 000 111 110 */ cp1610_rswd(6); break; + case 0x03f: /* 0 000 111 111 */ cp1610_rswd(7); break; + + case 0x040: /* 0 001 000 000 */ cp1610_swap(0); break; + case 0x041: /* 0 001 000 001 */ cp1610_swap(1); break; + case 0x042: /* 0 001 000 010 */ cp1610_swap(2); break; + case 0x043: /* 0 001 000 011 */ cp1610_swap(3); break; + case 0x044: /* 0 001 000 100 */ cp1610_dswap(0); break; + case 0x045: /* 0 001 000 101 */ cp1610_dswap(1); break; + case 0x046: /* 0 001 000 110 */ cp1610_dswap(2); break; + case 0x047: /* 0 001 000 111 */ cp1610_dswap(3); break; + + case 0x048: /* 0 001 001 000 */ cp1610_sll_1(0); break; + case 0x049: /* 0 001 001 001 */ cp1610_sll_1(1); break; + case 0x04a: /* 0 001 001 010 */ cp1610_sll_1(2); break; + case 0x04b: /* 0 001 001 011 */ cp1610_sll_1(3); break; + case 0x04c: /* 0 001 001 100 */ cp1610_sll_2(0); break; + case 0x04d: /* 0 001 001 101 */ cp1610_sll_2(1); break; + case 0x04e: /* 0 001 001 110 */ cp1610_sll_2(2); break; + case 0x04f: /* 0 001 001 111 */ cp1610_sll_2(3); break; + + case 0x050: /* 0 001 010 000 */ cp1610_rlc_1(0); break; + case 0x051: /* 0 001 010 001 */ cp1610_rlc_1(1); break; + case 0x052: /* 0 001 010 010 */ cp1610_rlc_1(2); break; + case 0x053: /* 0 001 010 011 */ cp1610_rlc_1(3); break; + case 0x054: /* 0 001 010 100 */ cp1610_rlc_2(0); break; + case 0x055: /* 0 001 010 101 */ cp1610_rlc_2(1); break; + case 0x056: /* 0 001 010 110 */ cp1610_rlc_2(2); break; + case 0x057: /* 0 001 010 111 */ cp1610_rlc_2(3); break; case 0x058: /* 0 001 011 000 */ cp1610_sllc_1(0); break; case 0x059: /* 0 001 011 001 */ cp1610_sllc_1(1); break; @@ -2274,32 +2250,32 @@ void cp1610_cpu_device::execute_run() case 0x05e: /* 0 001 011 110 */ cp1610_sllc_2(2); break; case 0x05f: /* 0 001 011 111 */ cp1610_sllc_2(3); break; - case 0x060: /* 0 001 100 000 */ cp1610_slr_1(0); break; - case 0x061: /* 0 001 100 001 */ cp1610_slr_1(1); break; - case 0x062: /* 0 001 100 010 */ cp1610_slr_1(2); break; - case 0x063: /* 0 001 100 011 */ cp1610_slr_1(3); break; - case 0x064: /* 0 001 100 100 */ cp1610_slr_2(0); break; - case 0x065: /* 0 001 100 101 */ cp1610_slr_2(1); break; - case 0x066: /* 0 001 100 110 */ cp1610_slr_2(2); break; - case 0x067: /* 0 001 100 111 */ cp1610_slr_2(3); break; - - case 0x068: /* 0 001 101 000 */ cp1610_sar_1(0); break; - case 0x069: /* 0 001 101 001 */ cp1610_sar_1(1); break; - case 0x06a: /* 0 001 101 010 */ cp1610_sar_1(2); break; - case 0x06b: /* 0 001 101 011 */ cp1610_sar_1(3); break; - case 0x06c: /* 0 001 101 100 */ cp1610_sar_2(0); break; - case 0x06d: /* 0 001 101 101 */ cp1610_sar_2(1); break; - case 0x06e: /* 0 001 101 110 */ cp1610_sar_2(2); break; - case 0x06f: /* 0 001 101 111 */ cp1610_sar_2(3); break; - - case 0x070: /* 0 001 110 000 */ cp1610_rrc_1(0); break; - case 0x071: /* 0 001 110 001 */ cp1610_rrc_1(1); break; - case 0x072: /* 0 001 110 010 */ cp1610_rrc_1(2); break; - case 0x073: /* 0 001 110 011 */ cp1610_rrc_1(3); break; - case 0x074: /* 0 001 110 100 */ cp1610_rrc_2(0); break; - case 0x075: /* 0 001 110 101 */ cp1610_rrc_2(1); break; - case 0x076: /* 0 001 110 110 */ cp1610_rrc_2(2); break; - case 0x077: /* 0 001 110 111 */ cp1610_rrc_2(3); break; + case 0x060: /* 0 001 100 000 */ cp1610_slr_1(0); break; + case 0x061: /* 0 001 100 001 */ cp1610_slr_1(1); break; + case 0x062: /* 0 001 100 010 */ cp1610_slr_1(2); break; + case 0x063: /* 0 001 100 011 */ cp1610_slr_1(3); break; + case 0x064: /* 0 001 100 100 */ cp1610_slr_2(0); break; + case 0x065: /* 0 001 100 101 */ cp1610_slr_2(1); break; + case 0x066: /* 0 001 100 110 */ cp1610_slr_2(2); break; + case 0x067: /* 0 001 100 111 */ cp1610_slr_2(3); break; + + case 0x068: /* 0 001 101 000 */ cp1610_sar_1(0); break; + case 0x069: /* 0 001 101 001 */ cp1610_sar_1(1); break; + case 0x06a: /* 0 001 101 010 */ cp1610_sar_1(2); break; + case 0x06b: /* 0 001 101 011 */ cp1610_sar_1(3); break; + case 0x06c: /* 0 001 101 100 */ cp1610_sar_2(0); break; + case 0x06d: /* 0 001 101 101 */ cp1610_sar_2(1); break; + case 0x06e: /* 0 001 101 110 */ cp1610_sar_2(2); break; + case 0x06f: /* 0 001 101 111 */ cp1610_sar_2(3); break; + + case 0x070: /* 0 001 110 000 */ cp1610_rrc_1(0); break; + case 0x071: /* 0 001 110 001 */ cp1610_rrc_1(1); break; + case 0x072: /* 0 001 110 010 */ cp1610_rrc_1(2); break; + case 0x073: /* 0 001 110 011 */ cp1610_rrc_1(3); break; + case 0x074: /* 0 001 110 100 */ cp1610_rrc_2(0); break; + case 0x075: /* 0 001 110 101 */ cp1610_rrc_2(1); break; + case 0x076: /* 0 001 110 110 */ cp1610_rrc_2(2); break; + case 0x077: /* 0 001 110 111 */ cp1610_rrc_2(3); break; case 0x078: /* 0 001 111 000 */ cp1610_sarc_1(0); break; case 0x079: /* 0 001 111 001 */ cp1610_sarc_1(1); break; @@ -2310,7 +2286,7 @@ void cp1610_cpu_device::execute_run() case 0x07e: /* 0 001 111 110 */ cp1610_sarc_2(2); break; case 0x07f: /* 0 001 111 111 */ cp1610_sarc_2(3); break; - case 0x080: /* 0 010 000 000 */ cp1610_tstr(0); break; + case 0x080: /* 0 010 000 000 */ cp1610_tstr(0); break; case 0x081: /* 0 010 000 001 */ cp1610_movr(0,1); break; case 0x082: /* 0 010 000 010 */ cp1610_movr(0,2); break; case 0x083: /* 0 010 000 011 */ cp1610_movr(0,3); break; @@ -2320,7 +2296,7 @@ void cp1610_cpu_device::execute_run() case 0x087: /* 0 010 000 111 */ cp1610_movr(0,7); break; /* jr */ case 0x088: /* 0 010 001 000 */ cp1610_movr(1,0); break; - case 0x089: /* 0 010 001 001 */ cp1610_tstr(1); break; + case 0x089: /* 0 010 001 001 */ cp1610_tstr(1); break; case 0x08a: /* 0 010 001 010 */ cp1610_movr(1,2); break; case 0x08b: /* 0 010 001 011 */ cp1610_movr(1,3); break; case 0x08c: /* 0 010 001 100 */ cp1610_movr(1,4); break; @@ -2330,7 +2306,7 @@ void cp1610_cpu_device::execute_run() case 0x090: /* 0 010 010 000 */ cp1610_movr(2,0); break; case 0x091: /* 0 010 010 001 */ cp1610_movr(2,1); break; - case 0x092: /* 0 010 010 010 */ cp1610_tstr(2); break; + case 0x092: /* 0 010 010 010 */ cp1610_tstr(2); break; case 0x093: /* 0 010 010 011 */ cp1610_movr(2,3); break; case 0x094: /* 0 010 010 100 */ cp1610_movr(2,4); break; case 0x095: /* 0 010 010 101 */ cp1610_movr(2,5); break; @@ -2340,7 +2316,7 @@ void cp1610_cpu_device::execute_run() case 0x098: /* 0 010 011 000 */ cp1610_movr(3,0); break; case 0x099: /* 0 010 011 001 */ cp1610_movr(3,1); break; case 0x09a: /* 0 010 011 010 */ cp1610_movr(3,2); break; - case 0x09b: /* 0 010 011 011 */ cp1610_tstr(3); break; + case 0x09b: /* 0 010 011 011 */ cp1610_tstr(3); break; case 0x09c: /* 0 010 011 100 */ cp1610_movr(3,4); break; case 0x09d: /* 0 010 011 101 */ cp1610_movr(3,5); break; case 0x09e: /* 0 010 011 110 */ cp1610_movr(3,6); break; @@ -2350,7 +2326,7 @@ void cp1610_cpu_device::execute_run() case 0x0a1: /* 0 010 100 001 */ cp1610_movr(4,1); break; case 0x0a2: /* 0 010 100 010 */ cp1610_movr(4,2); break; case 0x0a3: /* 0 010 100 011 */ cp1610_movr(4,3); break; - case 0x0a4: /* 0 010 100 100 */ cp1610_tstr(4); break; + case 0x0a4: /* 0 010 100 100 */ cp1610_tstr(4); break; case 0x0a5: /* 0 010 100 101 */ cp1610_movr(4,5); break; case 0x0a6: /* 0 010 100 110 */ cp1610_movr(4,6); break; case 0x0a7: /* 0 010 100 111 */ cp1610_movr(4,7); break; /* jr */ @@ -2360,7 +2336,7 @@ void cp1610_cpu_device::execute_run() case 0x0aa: /* 0 010 101 010 */ cp1610_movr(5,2); break; case 0x0ab: /* 0 010 101 011 */ cp1610_movr(5,3); break; case 0x0ac: /* 0 010 101 100 */ cp1610_movr(5,4); break; - case 0x0ad: /* 0 010 101 101 */ cp1610_tstr(5); break; + case 0x0ad: /* 0 010 101 101 */ cp1610_tstr(5); break; case 0x0ae: /* 0 010 101 110 */ cp1610_movr(5,6); break; case 0x0af: /* 0 010 101 111 */ cp1610_movr(5,7); break; /* jr */ @@ -2370,7 +2346,7 @@ void cp1610_cpu_device::execute_run() case 0x0b3: /* 0 010 110 011 */ cp1610_movr(6,3); break; case 0x0b4: /* 0 010 110 100 */ cp1610_movr(6,4); break; case 0x0b5: /* 0 010 110 101 */ cp1610_movr(6,5); break; - case 0x0b6: /* 0 010 110 110 */ cp1610_tstr(6); break; + case 0x0b6: /* 0 010 110 110 */ cp1610_tstr(6); break; case 0x0b7: /* 0 010 110 111 */ cp1610_movr(6,7); break; /* jr */ case 0x0b8: /* 0 010 111 000 */ cp1610_movr(7,0); break; @@ -2380,7 +2356,7 @@ void cp1610_cpu_device::execute_run() case 0x0bc: /* 0 010 111 100 */ cp1610_movr(7,4); break; case 0x0bd: /* 0 010 111 101 */ cp1610_movr(7,5); break; case 0x0be: /* 0 010 111 110 */ cp1610_movr(7,6); break; - case 0x0bf: /* 0 010 111 111 */ cp1610_tstr(7); break; + case 0x0bf: /* 0 010 111 111 */ cp1610_tstr(7); break; case 0x0c0: /* 0 011 000 000 */ cp1610_addr(0,0); break; case 0x0c1: /* 0 011 000 001 */ cp1610_addr(0,1); break; @@ -2670,7 +2646,7 @@ void cp1610_cpu_device::execute_run() case 0x1be: /* 0 110 111 110 */ cp1610_andr(7,6); break; case 0x1bf: /* 0 110 111 111 */ cp1610_andr(7,7); break; - case 0x1c0: /* 0 111 000 000 */ cp1610_clrr(0); break; + case 0x1c0: /* 0 111 000 000 */ cp1610_clrr(0); break; case 0x1c1: /* 0 111 000 001 */ cp1610_xorr(0,1); break; case 0x1c2: /* 0 111 000 010 */ cp1610_xorr(0,2); break; case 0x1c3: /* 0 111 000 011 */ cp1610_xorr(0,3); break; @@ -2680,7 +2656,7 @@ void cp1610_cpu_device::execute_run() case 0x1c7: /* 0 111 000 111 */ cp1610_xorr(0,7); break; case 0x1c8: /* 0 111 001 000 */ cp1610_xorr(1,0); break; - case 0x1c9: /* 0 111 001 001 */ cp1610_clrr(1); break; + case 0x1c9: /* 0 111 001 001 */ cp1610_clrr(1); break; case 0x1ca: /* 0 111 001 010 */ cp1610_xorr(1,2); break; case 0x1cb: /* 0 111 001 011 */ cp1610_xorr(1,3); break; case 0x1cc: /* 0 111 001 100 */ cp1610_xorr(1,4); break; @@ -2690,7 +2666,7 @@ void cp1610_cpu_device::execute_run() case 0x1d0: /* 0 111 010 000 */ cp1610_xorr(2,0); break; case 0x1d1: /* 0 111 010 001 */ cp1610_xorr(2,1); break; - case 0x1d2: /* 0 111 010 010 */ cp1610_clrr(2); break; + case 0x1d2: /* 0 111 010 010 */ cp1610_clrr(2); break; case 0x1d3: /* 0 111 010 011 */ cp1610_xorr(2,3); break; case 0x1d4: /* 0 111 010 100 */ cp1610_xorr(2,4); break; case 0x1d5: /* 0 111 010 101 */ cp1610_xorr(2,5); break; @@ -2700,7 +2676,7 @@ void cp1610_cpu_device::execute_run() case 0x1d8: /* 0 111 011 000 */ cp1610_xorr(3,0); break; case 0x1d9: /* 0 111 011 001 */ cp1610_xorr(3,1); break; case 0x1da: /* 0 111 011 010 */ cp1610_xorr(3,2); break; - case 0x1db: /* 0 111 011 011 */ cp1610_clrr(3); break; + case 0x1db: /* 0 111 011 011 */ cp1610_clrr(3); break; case 0x1dc: /* 0 111 011 100 */ cp1610_xorr(3,4); break; case 0x1dd: /* 0 111 011 101 */ cp1610_xorr(3,5); break; case 0x1de: /* 0 111 011 110 */ cp1610_xorr(3,6); break; @@ -2710,7 +2686,7 @@ void cp1610_cpu_device::execute_run() case 0x1e1: /* 0 111 100 001 */ cp1610_xorr(4,1); break; case 0x1e2: /* 0 111 100 010 */ cp1610_xorr(4,2); break; case 0x1e3: /* 0 111 100 011 */ cp1610_xorr(4,3); break; - case 0x1e4: /* 0 111 100 100 */ cp1610_clrr(4); break; + case 0x1e4: /* 0 111 100 100 */ cp1610_clrr(4); break; case 0x1e5: /* 0 111 100 101 */ cp1610_xorr(4,5); break; case 0x1e6: /* 0 111 100 110 */ cp1610_xorr(4,6); break; case 0x1e7: /* 0 111 100 111 */ cp1610_xorr(4,7); break; @@ -2720,7 +2696,7 @@ void cp1610_cpu_device::execute_run() case 0x1ea: /* 0 111 101 010 */ cp1610_xorr(5,2); break; case 0x1eb: /* 0 111 101 011 */ cp1610_xorr(5,3); break; case 0x1ec: /* 0 111 101 100 */ cp1610_xorr(5,4); break; - case 0x1ed: /* 0 111 101 101 */ cp1610_clrr(5); break; + case 0x1ed: /* 0 111 101 101 */ cp1610_clrr(5); break; case 0x1ee: /* 0 111 101 110 */ cp1610_xorr(5,6); break; case 0x1ef: /* 0 111 101 111 */ cp1610_xorr(5,7); break; @@ -2730,7 +2706,7 @@ void cp1610_cpu_device::execute_run() case 0x1f3: /* 0 111 110 011 */ cp1610_xorr(6,3); break; case 0x1f4: /* 0 111 110 100 */ cp1610_xorr(6,4); break; case 0x1f5: /* 0 111 110 101 */ cp1610_xorr(6,5); break; - case 0x1f6: /* 0 111 110 110 */ cp1610_clrr(6); break; + case 0x1f6: /* 0 111 110 110 */ cp1610_clrr(6); break; case 0x1f7: /* 0 111 110 111 */ cp1610_xorr(6,7); break; case 0x1f8: /* 0 111 111 000 */ cp1610_xorr(7,0); break; @@ -2740,25 +2716,25 @@ void cp1610_cpu_device::execute_run() case 0x1fc: /* 0 111 111 100 */ cp1610_xorr(7,4); break; case 0x1fd: /* 0 111 111 101 */ cp1610_xorr(7,5); break; case 0x1fe: /* 0 111 111 110 */ cp1610_xorr(7,6); break; - case 0x1ff: /* 0 110 111 111 */ cp1610_clrr(7); break; - - case 0x200: /* 1 000 000 000 */ cp1610_b(0); break; - case 0x201: /* 1 000 000 001 */ cp1610_bc(0); break; /* aka BLGE */ - case 0x202: /* 1 000 000 010 */ cp1610_bov(0); break; - case 0x203: /* 1 000 000 011 */ cp1610_bpl(0); break; - case 0x204: /* 1 000 000 100 */ cp1610_bze(0); break; /* aka BEQ */ - case 0x205: /* 1 000 000 101 */ cp1610_blt(0); break; - case 0x206: /* 1 000 000 110 */ cp1610_ble(0); break; - case 0x207: /* 1 000 000 111 */ cp1610_busc(0); break; - - case 0x208: /* 1 000 001 000 */ cp1610_nopp(0); break; - case 0x209: /* 1 000 001 001 */ cp1610_bnc(0); break; /* aka BLLT */ - case 0x20a: /* 1 000 001 010 */ cp1610_bnov(0); break; - case 0x20b: /* 1 000 001 011 */ cp1610_bmi(0); break; - case 0x20c: /* 1 000 001 100 */ cp1610_bnze(0); break; /* aka BNEQ */ - case 0x20d: /* 1 000 001 101 */ cp1610_bge(0); break; - case 0x20e: /* 1 000 001 110 */ cp1610_bgt(0); break; - case 0x20f: /* 1 000 001 111 */ cp1610_besc(0); break; + case 0x1ff: /* 0 110 111 111 */ cp1610_clrr(7); break; + + case 0x200: /* 1 000 000 000 */ cp1610_b(0); break; + case 0x201: /* 1 000 000 001 */ cp1610_bc(0); break; /* aka BLGE */ + case 0x202: /* 1 000 000 010 */ cp1610_bov(0); break; + case 0x203: /* 1 000 000 011 */ cp1610_bpl(0); break; + case 0x204: /* 1 000 000 100 */ cp1610_bze(0); break; /* aka BEQ */ + case 0x205: /* 1 000 000 101 */ cp1610_blt(0); break; + case 0x206: /* 1 000 000 110 */ cp1610_ble(0); break; + case 0x207: /* 1 000 000 111 */ cp1610_busc(0); break; + + case 0x208: /* 1 000 001 000 */ cp1610_nopp(0); break; + case 0x209: /* 1 000 001 001 */ cp1610_bnc(0); break; /* aka BLLT */ + case 0x20a: /* 1 000 001 010 */ cp1610_bnov(0); break; + case 0x20b: /* 1 000 001 011 */ cp1610_bmi(0); break; + case 0x20c: /* 1 000 001 100 */ cp1610_bnze(0); break; /* aka BNEQ */ + case 0x20d: /* 1 000 001 101 */ cp1610_bge(0); break; + case 0x20e: /* 1 000 001 110 */ cp1610_bgt(0); break; + case 0x20f: /* 1 000 001 111 */ cp1610_besc(0); break; case 0x210: /* 1 000 010 000 */ cp1610_bext(0,0); break; case 0x211: /* 1 000 010 001 */ cp1610_bext(1,0); break; @@ -2771,552 +2747,552 @@ void cp1610_cpu_device::execute_run() case 0x218: /* 1 000 011 000 */ cp1610_bext(8,0); break; case 0x219: /* 1 000 011 001 */ cp1610_bext(9,0); break; - case 0x21a: /* 1 000 011 010 */ cp1610_bext(10,0); break; - case 0x21b: /* 1 000 011 011 */ cp1610_bext(11,0); break; - case 0x21c: /* 1 000 011 100 */ cp1610_bext(12,0); break; - case 0x21d: /* 1 000 011 101 */ cp1610_bext(13,0); break; - case 0x21e: /* 1 000 011 110 */ cp1610_bext(14,0); break; - case 0x21f: /* 1 000 011 111 */ cp1610_bext(15,0); break; - - case 0x220: /* 1 000 100 000 */ cp1610_b(0xffff); break; - case 0x221: /* 1 000 100 001 */ cp1610_bc(0xffff); break; /* aka BLGE */ - case 0x222: /* 1 000 100 010 */ cp1610_bov(0xffff); break; - case 0x223: /* 1 000 100 011 */ cp1610_bpl(0xffff); break; - case 0x224: /* 1 000 100 100 */ cp1610_bze(0xffff); break; /* aka BEQ */ - case 0x225: /* 1 000 100 101 */ cp1610_blt(0xffff); break; - case 0x226: /* 1 000 100 110 */ cp1610_ble(0xffff); break; - case 0x227: /* 1 000 100 111 */ cp1610_busc(0xffff); break; - - case 0x228: /* 1 000 101 000 */ cp1610_nopp(0xffff); break; - case 0x229: /* 1 000 101 001 */ cp1610_bnc(0xffff); break; /* aka BLLT */ - case 0x22a: /* 1 000 101 010 */ cp1610_bnov(0xffff); break; - case 0x22b: /* 1 000 101 011 */ cp1610_bmi(0xffff); break; - case 0x22c: /* 1 000 101 100 */ cp1610_bnze(0xffff); break; /* aka BNEQ */ - case 0x22d: /* 1 000 101 101 */ cp1610_bge(0xffff); break; - case 0x22e: /* 1 000 101 110 */ cp1610_bgt(0xffff); break; - case 0x22f: /* 1 000 101 111 */ cp1610_besc(0xffff); break; - - case 0x230: /* 1 000 110 000 */ cp1610_bext(0,0xffff); break; - case 0x231: /* 1 000 110 001 */ cp1610_bext(1,0xffff); break; - case 0x232: /* 1 000 110 010 */ cp1610_bext(2,0xffff); break; - case 0x233: /* 1 000 110 011 */ cp1610_bext(3,0xffff); break; - case 0x234: /* 1 000 110 100 */ cp1610_bext(4,0xffff); break; - case 0x235: /* 1 000 110 101 */ cp1610_bext(5,0xffff); break; - case 0x236: /* 1 000 110 110 */ cp1610_bext(6,0xffff); break; - case 0x237: /* 1 000 110 111 */ cp1610_bext(7,0xffff); break; - - case 0x238: /* 1 000 111 000 */ cp1610_bext(8,0xffff); break; - case 0x239: /* 1 000 111 001 */ cp1610_bext(9,0xffff); break; - case 0x23a: /* 1 000 111 010 */ cp1610_bext(10,0xffff); break; - case 0x23b: /* 1 000 111 011 */ cp1610_bext(11,0xffff); break; - case 0x23c: /* 1 000 111 100 */ cp1610_bext(12,0xffff); break; - case 0x23d: /* 1 000 111 101 */ cp1610_bext(13,0xffff); break; - case 0x23e: /* 1 000 111 110 */ cp1610_bext(14,0xffff); break; - case 0x23f: /* 1 000 111 111 */ cp1610_bext(15,0xffff); break; - - case 0x240: /* 1 001 000 000 */ cp1610_mvo(0); break; - case 0x241: /* 1 001 000 001 */ cp1610_mvo(1); break; - case 0x242: /* 1 001 000 010 */ cp1610_mvo(2); break; - case 0x243: /* 1 001 000 011 */ cp1610_mvo(3); break; - case 0x244: /* 1 001 000 100 */ cp1610_mvo(4); break; - case 0x245: /* 1 001 000 101 */ cp1610_mvo(5); break; - case 0x246: /* 1 001 000 110 */ cp1610_mvo(6); break; - case 0x247: /* 1 001 000 111 */ cp1610_mvo(7); break; - - case 0x248: /* 1 001 001 000 */ cp1610_mvoat(0,1); break; - case 0x249: /* 1 001 001 001 */ cp1610_mvoat(1,1); break; - case 0x24a: /* 1 001 001 010 */ cp1610_mvoat(2,1); break; - case 0x24b: /* 1 001 001 011 */ cp1610_mvoat(3,1); break; - case 0x24c: /* 1 001 001 100 */ cp1610_mvoat(4,1); break; - case 0x24d: /* 1 001 001 101 */ cp1610_mvoat(5,1); break; - case 0x24e: /* 1 001 001 110 */ cp1610_mvoat(6,1); break; - case 0x24f: /* 1 001 001 111 */ cp1610_mvoat(7,1); break; - - case 0x250: /* 1 001 010 000 */ cp1610_mvoat(0,2); break; - case 0x251: /* 1 001 010 001 */ cp1610_mvoat(1,2); break; - case 0x252: /* 1 001 010 010 */ cp1610_mvoat(2,2); break; - case 0x253: /* 1 001 010 011 */ cp1610_mvoat(3,2); break; - case 0x254: /* 1 001 010 100 */ cp1610_mvoat(4,2); break; - case 0x255: /* 1 001 010 101 */ cp1610_mvoat(5,2); break; - case 0x256: /* 1 001 010 110 */ cp1610_mvoat(6,2); break; - case 0x257: /* 1 001 010 111 */ cp1610_mvoat(7,2); break; - - case 0x258: /* 1 001 011 000 */ cp1610_mvoat(0,3); break; - case 0x259: /* 1 001 011 001 */ cp1610_mvoat(1,3); break; - case 0x25a: /* 1 001 011 010 */ cp1610_mvoat(2,3); break; - case 0x25b: /* 1 001 011 011 */ cp1610_mvoat(3,3); break; - case 0x25c: /* 1 001 011 100 */ cp1610_mvoat(4,3); break; - case 0x25d: /* 1 001 011 101 */ cp1610_mvoat(5,3); break; - case 0x25e: /* 1 001 011 110 */ cp1610_mvoat(6,3); break; - case 0x25f: /* 1 001 011 111 */ cp1610_mvoat(7,3); break; - - case 0x260: /* 1 001 100 000 */ cp1610_mvoat_i(0,4); break; - case 0x261: /* 1 001 100 001 */ cp1610_mvoat_i(1,4); break; - case 0x262: /* 1 001 100 010 */ cp1610_mvoat_i(2,4); break; - case 0x263: /* 1 001 100 011 */ cp1610_mvoat_i(3,4); break; - case 0x264: /* 1 001 100 100 */ cp1610_mvoat_i(4,4); break; - case 0x265: /* 1 001 100 101 */ cp1610_mvoat_i(5,4); break; - case 0x266: /* 1 001 100 110 */ cp1610_mvoat_i(6,4); break; - case 0x267: /* 1 001 100 111 */ cp1610_mvoat_i(7,4); break; - - case 0x268: /* 1 001 101 000 */ cp1610_mvoat_i(0,5); break; - case 0x269: /* 1 001 101 001 */ cp1610_mvoat_i(1,5); break; - case 0x26a: /* 1 001 101 010 */ cp1610_mvoat_i(2,5); break; - case 0x26b: /* 1 001 101 011 */ cp1610_mvoat_i(3,5); break; - case 0x26c: /* 1 001 101 100 */ cp1610_mvoat_i(4,5); break; - case 0x26d: /* 1 001 101 101 */ cp1610_mvoat_i(5,5); break; - case 0x26e: /* 1 001 101 110 */ cp1610_mvoat_i(6,5); break; - case 0x26f: /* 1 001 101 111 */ cp1610_mvoat_i(7,5); break; - - case 0x270: /* 1 001 110 000 */ cp1610_mvoat_i(0,6); break; /* pshr */ - case 0x271: /* 1 001 110 001 */ cp1610_mvoat_i(1,6); break; /* pshr */ - case 0x272: /* 1 001 110 010 */ cp1610_mvoat_i(2,6); break; /* pshr */ - case 0x273: /* 1 001 110 011 */ cp1610_mvoat_i(3,6); break; /* pshr */ - case 0x274: /* 1 001 110 100 */ cp1610_mvoat_i(4,6); break; /* pshr */ - case 0x275: /* 1 001 110 101 */ cp1610_mvoat_i(5,6); break; /* pshr */ - case 0x276: /* 1 001 110 110 */ cp1610_mvoat_i(6,6); break; /* pshr */ - case 0x277: /* 1 001 110 111 */ cp1610_mvoat_i(7,6); break; /* pshr */ - - case 0x278: /* 1 001 111 000 */ cp1610_mvoi(0); break; - case 0x279: /* 1 001 111 001 */ cp1610_mvoi(1); break; - case 0x27a: /* 1 001 111 010 */ cp1610_mvoi(2); break; - case 0x27b: /* 1 001 111 011 */ cp1610_mvoi(3); break; - case 0x27c: /* 1 001 111 100 */ cp1610_mvoi(4); break; - case 0x27d: /* 1 001 111 101 */ cp1610_mvoi(5); break; - case 0x27e: /* 1 001 111 110 */ cp1610_mvoi(6); break; - case 0x27f: /* 1 001 111 111 */ cp1610_mvoi(7); break; - - case 0x280: /* 1 010 000 000 */ cp1610_mvi(0); break; - case 0x281: /* 1 010 000 001 */ cp1610_mvi(1); break; - case 0x282: /* 1 010 000 010 */ cp1610_mvi(2); break; - case 0x283: /* 1 010 000 011 */ cp1610_mvi(3); break; - case 0x284: /* 1 010 000 100 */ cp1610_mvi(4); break; - case 0x285: /* 1 010 000 101 */ cp1610_mvi(5); break; - case 0x286: /* 1 010 000 110 */ cp1610_mvi(6); break; - case 0x287: /* 1 010 000 111 */ cp1610_mvi(7); break; - - case 0x288: /* 1 010 001 000 */ cp1610_mviat(1,0); break; - case 0x289: /* 1 010 001 001 */ cp1610_mviat(1,1); break; - case 0x28a: /* 1 010 001 010 */ cp1610_mviat(1,2); break; - case 0x28b: /* 1 010 001 011 */ cp1610_mviat(1,3); break; - case 0x28c: /* 1 010 001 100 */ cp1610_mviat(1,4); break; - case 0x28d: /* 1 010 001 101 */ cp1610_mviat(1,5); break; - case 0x28e: /* 1 010 001 110 */ cp1610_mviat(1,6); break; - case 0x28f: /* 1 010 001 111 */ cp1610_mviat(1,7); break; - - case 0x290: /* 1 010 010 000 */ cp1610_mviat(2,0); break; - case 0x291: /* 1 010 010 001 */ cp1610_mviat(2,1); break; - case 0x292: /* 1 010 010 010 */ cp1610_mviat(2,2); break; - case 0x293: /* 1 010 010 011 */ cp1610_mviat(2,3); break; - case 0x294: /* 1 010 010 100 */ cp1610_mviat(2,4); break; - case 0x295: /* 1 010 010 101 */ cp1610_mviat(2,5); break; - case 0x296: /* 1 010 010 110 */ cp1610_mviat(2,6); break; - case 0x297: /* 1 010 010 111 */ cp1610_mviat(2,7); break; - - case 0x298: /* 1 010 011 000 */ cp1610_mviat(3,0); break; - case 0x299: /* 1 010 011 001 */ cp1610_mviat(3,1); break; - case 0x29a: /* 1 010 011 010 */ cp1610_mviat(3,2); break; - case 0x29b: /* 1 010 011 011 */ cp1610_mviat(3,3); break; - case 0x29c: /* 1 010 011 100 */ cp1610_mviat(3,4); break; - case 0x29d: /* 1 010 011 101 */ cp1610_mviat(3,5); break; - case 0x29e: /* 1 010 011 110 */ cp1610_mviat(3,6); break; - case 0x29f: /* 1 010 011 111 */ cp1610_mviat(3,7); break; - - case 0x2a0: /* 1 010 100 000 */ cp1610_mviat_i(4,0); break; - case 0x2a1: /* 1 010 100 001 */ cp1610_mviat_i(4,1); break; - case 0x2a2: /* 1 010 100 010 */ cp1610_mviat_i(4,2); break; - case 0x2a3: /* 1 010 100 011 */ cp1610_mviat_i(4,3); break; - case 0x2a4: /* 1 010 100 100 */ cp1610_mviat_i(4,4); break; - case 0x2a5: /* 1 010 100 101 */ cp1610_mviat_i(4,5); break; - case 0x2a6: /* 1 010 100 110 */ cp1610_mviat_i(4,6); break; - case 0x2a7: /* 1 010 100 111 */ cp1610_mviat_i(4,7); break; - - case 0x2a8: /* 1 010 101 000 */ cp1610_mviat_i(5,0); break; - case 0x2a9: /* 1 010 101 001 */ cp1610_mviat_i(5,1); break; - case 0x2aa: /* 1 010 101 010 */ cp1610_mviat_i(5,2); break; - case 0x2ab: /* 1 010 101 011 */ cp1610_mviat_i(5,3); break; - case 0x2ac: /* 1 010 101 100 */ cp1610_mviat_i(5,4); break; - case 0x2ad: /* 1 010 101 101 */ cp1610_mviat_i(5,5); break; - case 0x2ae: /* 1 010 101 110 */ cp1610_mviat_i(5,6); break; - case 0x2af: /* 1 010 101 111 */ cp1610_mviat_i(5,7); break; - - case 0x2b0: /* 1 010 110 000 */ cp1610_pulr(0); break; - case 0x2b1: /* 1 010 110 001 */ cp1610_pulr(1); break; - case 0x2b2: /* 1 010 110 010 */ cp1610_pulr(2); break; - case 0x2b3: /* 1 010 110 011 */ cp1610_pulr(3); break; - case 0x2b4: /* 1 010 110 100 */ cp1610_pulr(4); break; - case 0x2b5: /* 1 010 110 101 */ cp1610_pulr(5); break; - case 0x2b6: /* 1 010 110 110 */ cp1610_pulr(6); break; - case 0x2b7: /* 1 010 110 111 */ cp1610_pulr(7); break; - - case 0x2b8: /* 1 010 111 000 */ cp1610_mvii(0); break; - case 0x2b9: /* 1 010 111 001 */ cp1610_mvii(1); break; - case 0x2ba: /* 1 010 111 010 */ cp1610_mvii(2); break; - case 0x2bb: /* 1 010 111 011 */ cp1610_mvii(3); break; - case 0x2bc: /* 1 010 111 100 */ cp1610_mvii(4); break; - case 0x2bd: /* 1 010 111 101 */ cp1610_mvii(5); break; - case 0x2be: /* 1 010 111 110 */ cp1610_mvii(6); break; - case 0x2bf: /* 1 010 111 111 */ cp1610_mvii(7); break; - - case 0x2c0: /* 1 011 000 000 */ cp1610_add(0); break; - case 0x2c1: /* 1 011 000 001 */ cp1610_add(1); break; - case 0x2c2: /* 1 011 000 010 */ cp1610_add(2); break; - case 0x2c3: /* 1 011 000 011 */ cp1610_add(3); break; - case 0x2c4: /* 1 011 000 100 */ cp1610_add(4); break; - case 0x2c5: /* 1 011 000 101 */ cp1610_add(5); break; - case 0x2c6: /* 1 011 000 110 */ cp1610_add(6); break; - case 0x2c7: /* 1 011 000 111 */ cp1610_add(7); break; - - case 0x2c8: /* 1 011 001 000 */ cp1610_addat(1,0); break; - case 0x2c9: /* 1 011 001 001 */ cp1610_addat(1,1); break; - case 0x2ca: /* 1 011 001 010 */ cp1610_addat(1,2); break; - case 0x2cb: /* 1 011 001 011 */ cp1610_addat(1,3); break; - case 0x2cc: /* 1 011 001 100 */ cp1610_addat(1,4); break; - case 0x2cd: /* 1 011 001 101 */ cp1610_addat(1,5); break; - case 0x2ce: /* 1 011 001 110 */ cp1610_addat(1,6); break; - case 0x2cf: /* 1 011 001 111 */ cp1610_addat(1,7); break; - - case 0x2d0: /* 1 011 010 000 */ cp1610_addat(2,0); break; - case 0x2d1: /* 1 011 010 001 */ cp1610_addat(2,1); break; - case 0x2d2: /* 1 011 010 010 */ cp1610_addat(2,2); break; - case 0x2d3: /* 1 011 010 011 */ cp1610_addat(2,3); break; - case 0x2d4: /* 1 011 010 100 */ cp1610_addat(2,4); break; - case 0x2d5: /* 1 011 010 101 */ cp1610_addat(2,5); break; - case 0x2d6: /* 1 011 010 110 */ cp1610_addat(2,6); break; - case 0x2d7: /* 1 011 010 111 */ cp1610_addat(2,7); break; - - case 0x2d8: /* 1 011 011 000 */ cp1610_addat(3,0); break; - case 0x2d9: /* 1 011 011 001 */ cp1610_addat(3,1); break; - case 0x2da: /* 1 011 011 010 */ cp1610_addat(3,2); break; - case 0x2db: /* 1 011 011 011 */ cp1610_addat(3,3); break; - case 0x2dc: /* 1 011 011 100 */ cp1610_addat(3,4); break; - case 0x2dd: /* 1 011 011 101 */ cp1610_addat(3,5); break; - case 0x2de: /* 1 011 011 110 */ cp1610_addat(3,6); break; - case 0x2df: /* 1 011 011 111 */ cp1610_addat(3,7); break; - - case 0x2e0: /* 1 011 100 000 */ cp1610_addat_i(4,0); break; - case 0x2e1: /* 1 011 100 001 */ cp1610_addat_i(4,1); break; - case 0x2e2: /* 1 011 100 010 */ cp1610_addat_i(4,2); break; - case 0x2e3: /* 1 011 100 011 */ cp1610_addat_i(4,3); break; - case 0x2e4: /* 1 011 100 100 */ cp1610_addat_i(4,4); break; - case 0x2e5: /* 1 011 100 101 */ cp1610_addat_i(4,5); break; - case 0x2e6: /* 1 011 100 110 */ cp1610_addat_i(4,6); break; - case 0x2e7: /* 1 011 100 111 */ cp1610_addat_i(4,7); break; - - case 0x2e8: /* 1 011 101 000 */ cp1610_addat_i(5,0); break; - case 0x2e9: /* 1 011 101 001 */ cp1610_addat_i(5,1); break; - case 0x2ea: /* 1 011 101 010 */ cp1610_addat_i(5,2); break; - case 0x2eb: /* 1 011 101 011 */ cp1610_addat_i(5,3); break; - case 0x2ec: /* 1 011 101 100 */ cp1610_addat_i(5,4); break; - case 0x2ed: /* 1 011 101 101 */ cp1610_addat_i(5,5); break; - case 0x2ee: /* 1 011 101 110 */ cp1610_addat_i(5,6); break; - case 0x2ef: /* 1 011 101 111 */ cp1610_addat_i(5,7); break; - - case 0x2f0: /* 1 011 110 000 */ cp1610_addat_d(6,0); break; - case 0x2f1: /* 1 011 110 001 */ cp1610_addat_d(6,1); break; - case 0x2f2: /* 1 011 110 010 */ cp1610_addat_d(6,2); break; - case 0x2f3: /* 1 011 110 011 */ cp1610_addat_d(6,3); break; - case 0x2f4: /* 1 011 110 100 */ cp1610_addat_d(6,4); break; - case 0x2f5: /* 1 011 110 101 */ cp1610_addat_d(6,5); break; - case 0x2f6: /* 1 011 110 110 */ cp1610_addat_d(6,6); break; - case 0x2f7: /* 1 011 110 111 */ cp1610_addat_d(6,7); break; - - case 0x2f8: /* 1 011 111 000 */ cp1610_addi(0); break; - case 0x2f9: /* 1 011 111 001 */ cp1610_addi(1); break; - case 0x2fa: /* 1 011 111 010 */ cp1610_addi(2); break; - case 0x2fb: /* 1 011 111 011 */ cp1610_addi(3); break; - case 0x2fc: /* 1 011 111 100 */ cp1610_addi(4); break; - case 0x2fd: /* 1 011 111 101 */ cp1610_addi(5); break; - case 0x2fe: /* 1 011 111 110 */ cp1610_addi(6); break; - case 0x2ff: /* 1 011 111 111 */ cp1610_addi(7); break; - - case 0x300: /* 1 100 000 000 */ cp1610_sub(0); break; - case 0x301: /* 1 100 000 001 */ cp1610_sub(1); break; - case 0x302: /* 1 100 000 010 */ cp1610_sub(2); break; - case 0x303: /* 1 100 000 011 */ cp1610_sub(3); break; - case 0x304: /* 1 100 000 100 */ cp1610_sub(4); break; - case 0x305: /* 1 100 000 101 */ cp1610_sub(5); break; - case 0x306: /* 1 100 000 110 */ cp1610_sub(6); break; - case 0x307: /* 1 100 000 111 */ cp1610_sub(7); break; - - case 0x308: /* 1 100 001 000 */ cp1610_subat(1,0); break; - case 0x309: /* 1 100 001 001 */ cp1610_subat(1,1); break; - case 0x30a: /* 1 100 001 010 */ cp1610_subat(1,2); break; - case 0x30b: /* 1 100 001 011 */ cp1610_subat(1,3); break; - case 0x30c: /* 1 100 001 100 */ cp1610_subat(1,4); break; - case 0x30d: /* 1 100 001 101 */ cp1610_subat(1,5); break; - case 0x30e: /* 1 100 001 110 */ cp1610_subat(1,6); break; - case 0x30f: /* 1 100 001 111 */ cp1610_subat(1,7); break; - - case 0x310: /* 1 100 010 000 */ cp1610_subat(2,0); break; - case 0x311: /* 1 100 010 001 */ cp1610_subat(2,1); break; - case 0x312: /* 1 100 010 010 */ cp1610_subat(2,2); break; - case 0x313: /* 1 100 010 011 */ cp1610_subat(2,3); break; - case 0x314: /* 1 100 010 100 */ cp1610_subat(2,4); break; - case 0x315: /* 1 100 010 101 */ cp1610_subat(2,5); break; - case 0x316: /* 1 100 010 110 */ cp1610_subat(2,6); break; - case 0x317: /* 1 100 010 111 */ cp1610_subat(2,7); break; - - case 0x318: /* 1 100 011 000 */ cp1610_subat(3,0); break; - case 0x319: /* 1 100 011 001 */ cp1610_subat(3,1); break; - case 0x31a: /* 1 100 011 010 */ cp1610_subat(3,2); break; - case 0x31b: /* 1 100 011 011 */ cp1610_subat(3,3); break; - case 0x31c: /* 1 100 011 100 */ cp1610_subat(3,4); break; - case 0x31d: /* 1 100 011 101 */ cp1610_subat(3,5); break; - case 0x31e: /* 1 100 011 110 */ cp1610_subat(3,6); break; - case 0x31f: /* 1 100 011 111 */ cp1610_subat(3,7); break; - - case 0x320: /* 1 100 100 000 */ cp1610_subat_i(4,0); break; - case 0x321: /* 1 100 100 001 */ cp1610_subat_i(4,1); break; - case 0x322: /* 1 100 100 010 */ cp1610_subat_i(4,2); break; - case 0x323: /* 1 100 100 011 */ cp1610_subat_i(4,3); break; - case 0x324: /* 1 100 100 100 */ cp1610_subat_i(4,4); break; - case 0x325: /* 1 100 100 101 */ cp1610_subat_i(4,5); break; - case 0x326: /* 1 100 100 110 */ cp1610_subat_i(4,6); break; - case 0x327: /* 1 100 100 111 */ cp1610_subat_i(4,7); break; - - case 0x328: /* 1 100 101 000 */ cp1610_subat_i(5,0); break; - case 0x329: /* 1 100 101 001 */ cp1610_subat_i(5,1); break; - case 0x32a: /* 1 100 101 010 */ cp1610_subat_i(5,2); break; - case 0x32b: /* 1 100 101 011 */ cp1610_subat_i(5,3); break; - case 0x32c: /* 1 100 101 100 */ cp1610_subat_i(5,4); break; - case 0x32d: /* 1 100 101 101 */ cp1610_subat_i(5,5); break; - case 0x32e: /* 1 100 101 110 */ cp1610_subat_i(5,6); break; - case 0x32f: /* 1 100 101 111 */ cp1610_subat_i(5,7); break; - - case 0x330: /* 1 100 110 000 */ cp1610_subat_d(6,0); break; - case 0x331: /* 1 100 110 001 */ cp1610_subat_d(6,1); break; - case 0x332: /* 1 100 110 010 */ cp1610_subat_d(6,2); break; - case 0x333: /* 1 100 110 011 */ cp1610_subat_d(6,3); break; - case 0x334: /* 1 100 110 100 */ cp1610_subat_d(6,4); break; - case 0x335: /* 1 100 110 101 */ cp1610_subat_d(6,5); break; - case 0x336: /* 1 100 110 110 */ cp1610_subat_d(6,6); break; - case 0x337: /* 1 100 110 111 */ cp1610_subat_d(6,7); break; - - case 0x338: /* 1 100 111 000 */ cp1610_subi(0); break; - case 0x339: /* 1 100 111 001 */ cp1610_subi(1); break; - case 0x33a: /* 1 100 111 010 */ cp1610_subi(2); break; - case 0x33b: /* 1 100 111 011 */ cp1610_subi(3); break; - case 0x33c: /* 1 100 111 100 */ cp1610_subi(4); break; - case 0x33d: /* 1 100 111 101 */ cp1610_subi(5); break; - case 0x33e: /* 1 100 111 110 */ cp1610_subi(6); break; - case 0x33f: /* 1 100 111 111 */ cp1610_subi(7); break; - - case 0x340: /* 1 101 000 000 */ cp1610_cmp(0); break; - case 0x341: /* 1 101 000 001 */ cp1610_cmp(1); break; - case 0x342: /* 1 101 000 010 */ cp1610_cmp(2); break; - case 0x343: /* 1 101 000 011 */ cp1610_cmp(3); break; - case 0x344: /* 1 101 000 100 */ cp1610_cmp(4); break; - case 0x345: /* 1 101 000 101 */ cp1610_cmp(5); break; - case 0x346: /* 1 101 000 110 */ cp1610_cmp(6); break; - case 0x347: /* 1 101 000 111 */ cp1610_cmp(7); break; - - case 0x348: /* 1 101 001 000 */ cp1610_cmpat(1,0); break; - case 0x349: /* 1 101 001 001 */ cp1610_cmpat(1,1); break; - case 0x34a: /* 1 101 001 010 */ cp1610_cmpat(1,2); break; - case 0x34b: /* 1 101 001 011 */ cp1610_cmpat(1,3); break; - case 0x34c: /* 1 101 001 100 */ cp1610_cmpat(1,4); break; - case 0x34d: /* 1 101 001 101 */ cp1610_cmpat(1,5); break; - case 0x34e: /* 1 101 001 110 */ cp1610_cmpat(1,6); break; - case 0x34f: /* 1 101 001 111 */ cp1610_cmpat(1,7); break; - - case 0x350: /* 1 101 010 000 */ cp1610_cmpat(2,0); break; - case 0x351: /* 1 101 010 001 */ cp1610_cmpat(2,1); break; - case 0x352: /* 1 101 010 010 */ cp1610_cmpat(2,2); break; - case 0x353: /* 1 101 010 011 */ cp1610_cmpat(2,3); break; - case 0x354: /* 1 101 010 100 */ cp1610_cmpat(2,4); break; - case 0x355: /* 1 101 010 101 */ cp1610_cmpat(2,5); break; - case 0x356: /* 1 101 010 110 */ cp1610_cmpat(2,6); break; - case 0x357: /* 1 101 010 111 */ cp1610_cmpat(2,7); break; - - case 0x358: /* 1 101 011 000 */ cp1610_cmpat(3,0); break; - case 0x359: /* 1 101 011 001 */ cp1610_cmpat(3,1); break; - case 0x35a: /* 1 101 011 010 */ cp1610_cmpat(3,2); break; - case 0x35b: /* 1 101 011 011 */ cp1610_cmpat(3,3); break; - case 0x35c: /* 1 101 011 100 */ cp1610_cmpat(3,4); break; - case 0x35d: /* 1 101 011 101 */ cp1610_cmpat(3,5); break; - case 0x35e: /* 1 101 011 110 */ cp1610_cmpat(3,6); break; - case 0x35f: /* 1 101 011 111 */ cp1610_cmpat(3,7); break; - - case 0x360: /* 1 101 100 000 */ cp1610_cmpat_i(4,0); break; - case 0x361: /* 1 101 100 001 */ cp1610_cmpat_i(4,1); break; - case 0x362: /* 1 101 100 010 */ cp1610_cmpat_i(4,2); break; - case 0x363: /* 1 101 100 011 */ cp1610_cmpat_i(4,3); break; - case 0x364: /* 1 101 100 100 */ cp1610_cmpat_i(4,4); break; - case 0x365: /* 1 101 100 101 */ cp1610_cmpat_i(4,5); break; - case 0x366: /* 1 101 100 110 */ cp1610_cmpat_i(4,6); break; - case 0x367: /* 1 101 100 111 */ cp1610_cmpat_i(4,7); break; - - case 0x368: /* 1 101 101 000 */ cp1610_cmpat_i(5,0); break; - case 0x369: /* 1 101 101 001 */ cp1610_cmpat_i(5,1); break; - case 0x36a: /* 1 101 101 010 */ cp1610_cmpat_i(5,2); break; - case 0x36b: /* 1 101 101 011 */ cp1610_cmpat_i(5,3); break; - case 0x36c: /* 1 101 101 100 */ cp1610_cmpat_i(5,4); break; - case 0x36d: /* 1 101 101 101 */ cp1610_cmpat_i(5,5); break; - case 0x36e: /* 1 101 101 110 */ cp1610_cmpat_i(5,6); break; - case 0x36f: /* 1 101 101 111 */ cp1610_cmpat_i(5,7); break; - - case 0x370: /* 1 101 110 000 */ cp1610_cmpat_d(6,0); break; - case 0x371: /* 1 101 110 001 */ cp1610_cmpat_d(6,1); break; - case 0x372: /* 1 101 110 010 */ cp1610_cmpat_d(6,2); break; - case 0x373: /* 1 101 110 011 */ cp1610_cmpat_d(6,3); break; - case 0x374: /* 1 101 110 100 */ cp1610_cmpat_d(6,4); break; - case 0x375: /* 1 101 110 101 */ cp1610_cmpat_d(6,5); break; - case 0x376: /* 1 101 110 110 */ cp1610_cmpat_d(6,6); break; - case 0x377: /* 1 101 110 111 */ cp1610_cmpat_d(6,7); break; - - case 0x378: /* 1 101 111 000 */ cp1610_cmpi(0); break; - case 0x379: /* 1 101 111 001 */ cp1610_cmpi(1); break; - case 0x37a: /* 1 101 111 010 */ cp1610_cmpi(2); break; - case 0x37b: /* 1 101 111 011 */ cp1610_cmpi(3); break; - case 0x37c: /* 1 101 111 100 */ cp1610_cmpi(4); break; - case 0x37d: /* 1 101 111 101 */ cp1610_cmpi(5); break; - case 0x37e: /* 1 101 111 110 */ cp1610_cmpi(6); break; - case 0x37f: /* 1 101 111 111 */ cp1610_cmpi(7); break; - - case 0x380: /* 1 110 000 000 */ cp1610_and(0); break; - case 0x381: /* 1 110 000 001 */ cp1610_and(1); break; - case 0x382: /* 1 110 000 010 */ cp1610_and(2); break; - case 0x383: /* 1 110 000 011 */ cp1610_and(3); break; - case 0x384: /* 1 110 000 100 */ cp1610_and(4); break; - case 0x385: /* 1 110 000 101 */ cp1610_and(5); break; - case 0x386: /* 1 110 000 110 */ cp1610_and(6); break; - case 0x387: /* 1 110 000 111 */ cp1610_and(7); break; - - case 0x388: /* 1 110 001 000 */ cp1610_andat(1,0); break; - case 0x389: /* 1 110 001 001 */ cp1610_andat(1,1); break; - case 0x38a: /* 1 110 001 010 */ cp1610_andat(1,2); break; - case 0x38b: /* 1 110 001 011 */ cp1610_andat(1,3); break; - case 0x38c: /* 1 110 001 100 */ cp1610_andat(1,4); break; - case 0x38d: /* 1 110 001 101 */ cp1610_andat(1,5); break; - case 0x38e: /* 1 110 001 110 */ cp1610_andat(1,6); break; - case 0x38f: /* 1 110 001 111 */ cp1610_andat(1,7); break; - - case 0x390: /* 1 110 010 000 */ cp1610_andat(2,0); break; - case 0x391: /* 1 110 010 001 */ cp1610_andat(2,1); break; - case 0x392: /* 1 110 010 010 */ cp1610_andat(2,2); break; - case 0x393: /* 1 110 010 011 */ cp1610_andat(2,3); break; - case 0x394: /* 1 110 010 100 */ cp1610_andat(2,4); break; - case 0x395: /* 1 110 010 101 */ cp1610_andat(2,5); break; - case 0x396: /* 1 110 010 110 */ cp1610_andat(2,6); break; - case 0x397: /* 1 110 010 111 */ cp1610_andat(2,7); break; - - case 0x398: /* 1 110 011 000 */ cp1610_andat(3,0); break; - case 0x399: /* 1 110 011 001 */ cp1610_andat(3,1); break; - case 0x39a: /* 1 110 011 010 */ cp1610_andat(3,2); break; - case 0x39b: /* 1 110 011 011 */ cp1610_andat(3,3); break; - case 0x39c: /* 1 110 011 100 */ cp1610_andat(3,4); break; - case 0x39d: /* 1 110 011 101 */ cp1610_andat(3,5); break; - case 0x39e: /* 1 110 011 110 */ cp1610_andat(3,6); break; - case 0x39f: /* 1 110 011 111 */ cp1610_andat(3,7); break; - - case 0x3a0: /* 1 110 100 000 */ cp1610_andat_i(4,0); break; - case 0x3a1: /* 1 110 100 001 */ cp1610_andat_i(4,1); break; - case 0x3a2: /* 1 110 100 010 */ cp1610_andat_i(4,2); break; - case 0x3a3: /* 1 110 100 011 */ cp1610_andat_i(4,3); break; - case 0x3a4: /* 1 110 100 100 */ cp1610_andat_i(4,4); break; - case 0x3a5: /* 1 110 100 101 */ cp1610_andat_i(4,5); break; - case 0x3a6: /* 1 110 100 110 */ cp1610_andat_i(4,6); break; - case 0x3a7: /* 1 110 100 111 */ cp1610_andat_i(4,7); break; - - case 0x3a8: /* 1 110 101 000 */ cp1610_andat_i(5,0); break; - case 0x3a9: /* 1 110 101 001 */ cp1610_andat_i(5,1); break; - case 0x3aa: /* 1 110 101 010 */ cp1610_andat_i(5,2); break; - case 0x3ab: /* 1 110 101 011 */ cp1610_andat_i(5,3); break; - case 0x3ac: /* 1 110 101 100 */ cp1610_andat_i(5,4); break; - case 0x3ad: /* 1 110 101 101 */ cp1610_andat_i(5,5); break; - case 0x3ae: /* 1 110 101 110 */ cp1610_andat_i(5,6); break; - case 0x3af: /* 1 110 101 111 */ cp1610_andat_i(5,7); break; - - case 0x3b0: /* 1 110 110 000 */ cp1610_andat_d(6,0); break; - case 0x3b1: /* 1 110 110 001 */ cp1610_andat_d(6,1); break; - case 0x3b2: /* 1 110 110 010 */ cp1610_andat_d(6,2); break; - case 0x3b3: /* 1 110 110 011 */ cp1610_andat_d(6,3); break; - case 0x3b4: /* 1 110 110 100 */ cp1610_andat_d(6,4); break; - case 0x3b5: /* 1 110 110 101 */ cp1610_andat_d(6,5); break; - case 0x3b6: /* 1 110 110 110 */ cp1610_andat_d(6,6); break; - case 0x3b7: /* 1 110 110 111 */ cp1610_andat_d(6,7); break; - - case 0x3b8: /* 1 110 111 000 */ cp1610_andi(0); break; - case 0x3b9: /* 1 110 111 001 */ cp1610_andi(1); break; - case 0x3ba: /* 1 110 111 010 */ cp1610_andi(2); break; - case 0x3bb: /* 1 110 111 011 */ cp1610_andi(3); break; - case 0x3bc: /* 1 110 111 100 */ cp1610_andi(4); break; - case 0x3bd: /* 1 110 111 101 */ cp1610_andi(5); break; - case 0x3be: /* 1 110 111 110 */ cp1610_andi(6); break; - case 0x3bf: /* 1 110 111 111 */ cp1610_andi(7); break; - - case 0x3c0: /* 1 111 000 000 */ cp1610_xor(0); break; - case 0x3c1: /* 1 111 000 001 */ cp1610_xor(1); break; - case 0x3c2: /* 1 111 000 010 */ cp1610_xor(2); break; - case 0x3c3: /* 1 111 000 011 */ cp1610_xor(3); break; - case 0x3c4: /* 1 111 000 100 */ cp1610_xor(4); break; - case 0x3c5: /* 1 111 000 101 */ cp1610_xor(5); break; - case 0x3c6: /* 1 111 000 110 */ cp1610_xor(6); break; - case 0x3c7: /* 1 111 000 111 */ cp1610_xor(7); break; - - case 0x3c8: /* 1 111 001 000 */ cp1610_xorat(1,0); break; - case 0x3c9: /* 1 111 001 001 */ cp1610_xorat(1,1); break; - case 0x3ca: /* 1 111 001 010 */ cp1610_xorat(1,2); break; - case 0x3cb: /* 1 111 001 011 */ cp1610_xorat(1,3); break; - case 0x3cc: /* 1 111 001 100 */ cp1610_xorat(1,4); break; - case 0x3cd: /* 1 111 001 101 */ cp1610_xorat(1,5); break; - case 0x3ce: /* 1 111 001 110 */ cp1610_xorat(1,6); break; - case 0x3cf: /* 1 111 001 111 */ cp1610_xorat(1,7); break; - - case 0x3d0: /* 1 111 010 000 */ cp1610_xorat(2,0); break; - case 0x3d1: /* 1 111 010 001 */ cp1610_xorat(2,1); break; - case 0x3d2: /* 1 111 010 010 */ cp1610_xorat(2,2); break; - case 0x3d3: /* 1 111 010 011 */ cp1610_xorat(2,3); break; - case 0x3d4: /* 1 111 010 100 */ cp1610_xorat(2,4); break; - case 0x3d5: /* 1 111 010 101 */ cp1610_xorat(2,5); break; - case 0x3d6: /* 1 111 010 110 */ cp1610_xorat(2,6); break; - case 0x3d7: /* 1 111 010 111 */ cp1610_xorat(2,7); break; - - case 0x3d8: /* 1 111 011 000 */ cp1610_xorat(3,0); break; - case 0x3d9: /* 1 111 011 001 */ cp1610_xorat(3,1); break; - case 0x3da: /* 1 111 011 010 */ cp1610_xorat(3,2); break; - case 0x3db: /* 1 111 011 011 */ cp1610_xorat(3,3); break; - case 0x3dc: /* 1 111 011 100 */ cp1610_xorat(3,4); break; - case 0x3dd: /* 1 111 011 101 */ cp1610_xorat(3,5); break; - case 0x3de: /* 1 111 011 110 */ cp1610_xorat(3,6); break; - case 0x3df: /* 1 111 011 111 */ cp1610_xorat(3,7); break; - - case 0x3e0: /* 1 111 100 000 */ cp1610_xorat_i(4,0); break; - case 0x3e1: /* 1 111 100 001 */ cp1610_xorat_i(4,1); break; - case 0x3e2: /* 1 111 100 010 */ cp1610_xorat_i(4,2); break; - case 0x3e3: /* 1 111 100 011 */ cp1610_xorat_i(4,3); break; - case 0x3e4: /* 1 111 100 100 */ cp1610_xorat_i(4,4); break; - case 0x3e5: /* 1 111 100 101 */ cp1610_xorat_i(4,5); break; - case 0x3e6: /* 1 111 100 110 */ cp1610_xorat_i(4,6); break; - case 0x3e7: /* 1 111 100 111 */ cp1610_xorat_i(4,7); break; - - case 0x3e8: /* 1 111 101 000 */ cp1610_xorat_i(5,0); break; - case 0x3e9: /* 1 111 101 001 */ cp1610_xorat_i(5,1); break; - case 0x3ea: /* 1 111 101 010 */ cp1610_xorat_i(5,2); break; - case 0x3eb: /* 1 111 101 011 */ cp1610_xorat_i(5,3); break; - case 0x3ec: /* 1 111 101 100 */ cp1610_xorat_i(5,4); break; - case 0x3ed: /* 1 111 101 101 */ cp1610_xorat_i(5,5); break; - case 0x3ee: /* 1 111 101 110 */ cp1610_xorat_i(5,6); break; - case 0x3ef: /* 1 111 101 111 */ cp1610_xorat_i(5,7); break; - - case 0x3f0: /* 1 111 110 000 */ cp1610_xorat_d(6,0); break; - case 0x3f1: /* 1 111 110 001 */ cp1610_xorat_d(6,1); break; - case 0x3f2: /* 1 111 110 010 */ cp1610_xorat_d(6,2); break; - case 0x3f3: /* 1 111 110 011 */ cp1610_xorat_d(6,3); break; - case 0x3f4: /* 1 111 110 100 */ cp1610_xorat_d(6,4); break; - case 0x3f5: /* 1 111 110 101 */ cp1610_xorat_d(6,5); break; - case 0x3f6: /* 1 111 110 110 */ cp1610_xorat_d(6,6); break; - case 0x3f7: /* 1 111 110 111 */ cp1610_xorat_d(6,7); break; - - case 0x3f8: /* 1 111 111 000 */ cp1610_xori(0); break; - case 0x3f9: /* 1 111 111 001 */ cp1610_xori(1); break; - case 0x3fa: /* 1 111 111 010 */ cp1610_xori(2); break; - case 0x3fb: /* 1 111 111 011 */ cp1610_xori(3); break; - case 0x3fc: /* 1 111 111 100 */ cp1610_xori(4); break; - case 0x3fd: /* 1 111 111 101 */ cp1610_xori(5); break; - case 0x3fe: /* 1 111 111 110 */ cp1610_xori(6); break; - case 0x3ff: /* 1 111 111 111 */ cp1610_xori(7); break; + case 0x21a: /* 1 000 011 010 */ cp1610_bext(10,0); break; + case 0x21b: /* 1 000 011 011 */ cp1610_bext(11,0); break; + case 0x21c: /* 1 000 011 100 */ cp1610_bext(12,0); break; + case 0x21d: /* 1 000 011 101 */ cp1610_bext(13,0); break; + case 0x21e: /* 1 000 011 110 */ cp1610_bext(14,0); break; + case 0x21f: /* 1 000 011 111 */ cp1610_bext(15,0); break; + + case 0x220: /* 1 000 100 000 */ cp1610_b(0xffff); break; + case 0x221: /* 1 000 100 001 */ cp1610_bc(0xffff); break; /* aka BLGE */ + case 0x222: /* 1 000 100 010 */ cp1610_bov(0xffff); break; + case 0x223: /* 1 000 100 011 */ cp1610_bpl(0xffff); break; + case 0x224: /* 1 000 100 100 */ cp1610_bze(0xffff); break; /* aka BEQ */ + case 0x225: /* 1 000 100 101 */ cp1610_blt(0xffff); break; + case 0x226: /* 1 000 100 110 */ cp1610_ble(0xffff); break; + case 0x227: /* 1 000 100 111 */ cp1610_busc(0xffff); break; + + case 0x228: /* 1 000 101 000 */ cp1610_nopp(0xffff); break; + case 0x229: /* 1 000 101 001 */ cp1610_bnc(0xffff); break; /* aka BLLT */ + case 0x22a: /* 1 000 101 010 */ cp1610_bnov(0xffff); break; + case 0x22b: /* 1 000 101 011 */ cp1610_bmi(0xffff); break; + case 0x22c: /* 1 000 101 100 */ cp1610_bnze(0xffff); break; /* aka BNEQ */ + case 0x22d: /* 1 000 101 101 */ cp1610_bge(0xffff); break; + case 0x22e: /* 1 000 101 110 */ cp1610_bgt(0xffff); break; + case 0x22f: /* 1 000 101 111 */ cp1610_besc(0xffff); break; + + case 0x230: /* 1 000 110 000 */ cp1610_bext(0,0xffff); break; + case 0x231: /* 1 000 110 001 */ cp1610_bext(1,0xffff); break; + case 0x232: /* 1 000 110 010 */ cp1610_bext(2,0xffff); break; + case 0x233: /* 1 000 110 011 */ cp1610_bext(3,0xffff); break; + case 0x234: /* 1 000 110 100 */ cp1610_bext(4,0xffff); break; + case 0x235: /* 1 000 110 101 */ cp1610_bext(5,0xffff); break; + case 0x236: /* 1 000 110 110 */ cp1610_bext(6,0xffff); break; + case 0x237: /* 1 000 110 111 */ cp1610_bext(7,0xffff); break; + + case 0x238: /* 1 000 111 000 */ cp1610_bext(8,0xffff); break; + case 0x239: /* 1 000 111 001 */ cp1610_bext(9,0xffff); break; + case 0x23a: /* 1 000 111 010 */ cp1610_bext(10,0xffff); break; + case 0x23b: /* 1 000 111 011 */ cp1610_bext(11,0xffff); break; + case 0x23c: /* 1 000 111 100 */ cp1610_bext(12,0xffff); break; + case 0x23d: /* 1 000 111 101 */ cp1610_bext(13,0xffff); break; + case 0x23e: /* 1 000 111 110 */ cp1610_bext(14,0xffff); break; + case 0x23f: /* 1 000 111 111 */ cp1610_bext(15,0xffff); break; + + case 0x240: /* 1 001 000 000 */ cp1610_mvo(0); break; + case 0x241: /* 1 001 000 001 */ cp1610_mvo(1); break; + case 0x242: /* 1 001 000 010 */ cp1610_mvo(2); break; + case 0x243: /* 1 001 000 011 */ cp1610_mvo(3); break; + case 0x244: /* 1 001 000 100 */ cp1610_mvo(4); break; + case 0x245: /* 1 001 000 101 */ cp1610_mvo(5); break; + case 0x246: /* 1 001 000 110 */ cp1610_mvo(6); break; + case 0x247: /* 1 001 000 111 */ cp1610_mvo(7); break; + + case 0x248: /* 1 001 001 000 */ cp1610_mvoat(0,1); break; + case 0x249: /* 1 001 001 001 */ cp1610_mvoat(1,1); break; + case 0x24a: /* 1 001 001 010 */ cp1610_mvoat(2,1); break; + case 0x24b: /* 1 001 001 011 */ cp1610_mvoat(3,1); break; + case 0x24c: /* 1 001 001 100 */ cp1610_mvoat(4,1); break; + case 0x24d: /* 1 001 001 101 */ cp1610_mvoat(5,1); break; + case 0x24e: /* 1 001 001 110 */ cp1610_mvoat(6,1); break; + case 0x24f: /* 1 001 001 111 */ cp1610_mvoat(7,1); break; + + case 0x250: /* 1 001 010 000 */ cp1610_mvoat(0,2); break; + case 0x251: /* 1 001 010 001 */ cp1610_mvoat(1,2); break; + case 0x252: /* 1 001 010 010 */ cp1610_mvoat(2,2); break; + case 0x253: /* 1 001 010 011 */ cp1610_mvoat(3,2); break; + case 0x254: /* 1 001 010 100 */ cp1610_mvoat(4,2); break; + case 0x255: /* 1 001 010 101 */ cp1610_mvoat(5,2); break; + case 0x256: /* 1 001 010 110 */ cp1610_mvoat(6,2); break; + case 0x257: /* 1 001 010 111 */ cp1610_mvoat(7,2); break; + + case 0x258: /* 1 001 011 000 */ cp1610_mvoat(0,3); break; + case 0x259: /* 1 001 011 001 */ cp1610_mvoat(1,3); break; + case 0x25a: /* 1 001 011 010 */ cp1610_mvoat(2,3); break; + case 0x25b: /* 1 001 011 011 */ cp1610_mvoat(3,3); break; + case 0x25c: /* 1 001 011 100 */ cp1610_mvoat(4,3); break; + case 0x25d: /* 1 001 011 101 */ cp1610_mvoat(5,3); break; + case 0x25e: /* 1 001 011 110 */ cp1610_mvoat(6,3); break; + case 0x25f: /* 1 001 011 111 */ cp1610_mvoat(7,3); break; + + case 0x260: /* 1 001 100 000 */ cp1610_mvoat_i(0,4); break; + case 0x261: /* 1 001 100 001 */ cp1610_mvoat_i(1,4); break; + case 0x262: /* 1 001 100 010 */ cp1610_mvoat_i(2,4); break; + case 0x263: /* 1 001 100 011 */ cp1610_mvoat_i(3,4); break; + case 0x264: /* 1 001 100 100 */ cp1610_mvoat_i(4,4); break; + case 0x265: /* 1 001 100 101 */ cp1610_mvoat_i(5,4); break; + case 0x266: /* 1 001 100 110 */ cp1610_mvoat_i(6,4); break; + case 0x267: /* 1 001 100 111 */ cp1610_mvoat_i(7,4); break; + + case 0x268: /* 1 001 101 000 */ cp1610_mvoat_i(0,5); break; + case 0x269: /* 1 001 101 001 */ cp1610_mvoat_i(1,5); break; + case 0x26a: /* 1 001 101 010 */ cp1610_mvoat_i(2,5); break; + case 0x26b: /* 1 001 101 011 */ cp1610_mvoat_i(3,5); break; + case 0x26c: /* 1 001 101 100 */ cp1610_mvoat_i(4,5); break; + case 0x26d: /* 1 001 101 101 */ cp1610_mvoat_i(5,5); break; + case 0x26e: /* 1 001 101 110 */ cp1610_mvoat_i(6,5); break; + case 0x26f: /* 1 001 101 111 */ cp1610_mvoat_i(7,5); break; + + case 0x270: /* 1 001 110 000 */ cp1610_mvoat_i(0,6); break; /* pshr */ + case 0x271: /* 1 001 110 001 */ cp1610_mvoat_i(1,6); break; /* pshr */ + case 0x272: /* 1 001 110 010 */ cp1610_mvoat_i(2,6); break; /* pshr */ + case 0x273: /* 1 001 110 011 */ cp1610_mvoat_i(3,6); break; /* pshr */ + case 0x274: /* 1 001 110 100 */ cp1610_mvoat_i(4,6); break; /* pshr */ + case 0x275: /* 1 001 110 101 */ cp1610_mvoat_i(5,6); break; /* pshr */ + case 0x276: /* 1 001 110 110 */ cp1610_mvoat_i(6,6); break; /* pshr */ + case 0x277: /* 1 001 110 111 */ cp1610_mvoat_i(7,6); break; /* pshr */ + + case 0x278: /* 1 001 111 000 */ cp1610_mvoi(0); break; + case 0x279: /* 1 001 111 001 */ cp1610_mvoi(1); break; + case 0x27a: /* 1 001 111 010 */ cp1610_mvoi(2); break; + case 0x27b: /* 1 001 111 011 */ cp1610_mvoi(3); break; + case 0x27c: /* 1 001 111 100 */ cp1610_mvoi(4); break; + case 0x27d: /* 1 001 111 101 */ cp1610_mvoi(5); break; + case 0x27e: /* 1 001 111 110 */ cp1610_mvoi(6); break; + case 0x27f: /* 1 001 111 111 */ cp1610_mvoi(7); break; + + case 0x280: /* 1 010 000 000 */ cp1610_mvi(0); break; + case 0x281: /* 1 010 000 001 */ cp1610_mvi(1); break; + case 0x282: /* 1 010 000 010 */ cp1610_mvi(2); break; + case 0x283: /* 1 010 000 011 */ cp1610_mvi(3); break; + case 0x284: /* 1 010 000 100 */ cp1610_mvi(4); break; + case 0x285: /* 1 010 000 101 */ cp1610_mvi(5); break; + case 0x286: /* 1 010 000 110 */ cp1610_mvi(6); break; + case 0x287: /* 1 010 000 111 */ cp1610_mvi(7); break; + + case 0x288: /* 1 010 001 000 */ cp1610_mviat(1,0); break; + case 0x289: /* 1 010 001 001 */ cp1610_mviat(1,1); break; + case 0x28a: /* 1 010 001 010 */ cp1610_mviat(1,2); break; + case 0x28b: /* 1 010 001 011 */ cp1610_mviat(1,3); break; + case 0x28c: /* 1 010 001 100 */ cp1610_mviat(1,4); break; + case 0x28d: /* 1 010 001 101 */ cp1610_mviat(1,5); break; + case 0x28e: /* 1 010 001 110 */ cp1610_mviat(1,6); break; + case 0x28f: /* 1 010 001 111 */ cp1610_mviat(1,7); break; + + case 0x290: /* 1 010 010 000 */ cp1610_mviat(2,0); break; + case 0x291: /* 1 010 010 001 */ cp1610_mviat(2,1); break; + case 0x292: /* 1 010 010 010 */ cp1610_mviat(2,2); break; + case 0x293: /* 1 010 010 011 */ cp1610_mviat(2,3); break; + case 0x294: /* 1 010 010 100 */ cp1610_mviat(2,4); break; + case 0x295: /* 1 010 010 101 */ cp1610_mviat(2,5); break; + case 0x296: /* 1 010 010 110 */ cp1610_mviat(2,6); break; + case 0x297: /* 1 010 010 111 */ cp1610_mviat(2,7); break; + + case 0x298: /* 1 010 011 000 */ cp1610_mviat(3,0); break; + case 0x299: /* 1 010 011 001 */ cp1610_mviat(3,1); break; + case 0x29a: /* 1 010 011 010 */ cp1610_mviat(3,2); break; + case 0x29b: /* 1 010 011 011 */ cp1610_mviat(3,3); break; + case 0x29c: /* 1 010 011 100 */ cp1610_mviat(3,4); break; + case 0x29d: /* 1 010 011 101 */ cp1610_mviat(3,5); break; + case 0x29e: /* 1 010 011 110 */ cp1610_mviat(3,6); break; + case 0x29f: /* 1 010 011 111 */ cp1610_mviat(3,7); break; + + case 0x2a0: /* 1 010 100 000 */ cp1610_mviat_i(4,0); break; + case 0x2a1: /* 1 010 100 001 */ cp1610_mviat_i(4,1); break; + case 0x2a2: /* 1 010 100 010 */ cp1610_mviat_i(4,2); break; + case 0x2a3: /* 1 010 100 011 */ cp1610_mviat_i(4,3); break; + case 0x2a4: /* 1 010 100 100 */ cp1610_mviat_i(4,4); break; + case 0x2a5: /* 1 010 100 101 */ cp1610_mviat_i(4,5); break; + case 0x2a6: /* 1 010 100 110 */ cp1610_mviat_i(4,6); break; + case 0x2a7: /* 1 010 100 111 */ cp1610_mviat_i(4,7); break; + + case 0x2a8: /* 1 010 101 000 */ cp1610_mviat_i(5,0); break; + case 0x2a9: /* 1 010 101 001 */ cp1610_mviat_i(5,1); break; + case 0x2aa: /* 1 010 101 010 */ cp1610_mviat_i(5,2); break; + case 0x2ab: /* 1 010 101 011 */ cp1610_mviat_i(5,3); break; + case 0x2ac: /* 1 010 101 100 */ cp1610_mviat_i(5,4); break; + case 0x2ad: /* 1 010 101 101 */ cp1610_mviat_i(5,5); break; + case 0x2ae: /* 1 010 101 110 */ cp1610_mviat_i(5,6); break; + case 0x2af: /* 1 010 101 111 */ cp1610_mviat_i(5,7); break; + + case 0x2b0: /* 1 010 110 000 */ cp1610_pulr(0); break; + case 0x2b1: /* 1 010 110 001 */ cp1610_pulr(1); break; + case 0x2b2: /* 1 010 110 010 */ cp1610_pulr(2); break; + case 0x2b3: /* 1 010 110 011 */ cp1610_pulr(3); break; + case 0x2b4: /* 1 010 110 100 */ cp1610_pulr(4); break; + case 0x2b5: /* 1 010 110 101 */ cp1610_pulr(5); break; + case 0x2b6: /* 1 010 110 110 */ cp1610_pulr(6); break; + case 0x2b7: /* 1 010 110 111 */ cp1610_pulr(7); break; + + case 0x2b8: /* 1 010 111 000 */ cp1610_mvii(0); break; + case 0x2b9: /* 1 010 111 001 */ cp1610_mvii(1); break; + case 0x2ba: /* 1 010 111 010 */ cp1610_mvii(2); break; + case 0x2bb: /* 1 010 111 011 */ cp1610_mvii(3); break; + case 0x2bc: /* 1 010 111 100 */ cp1610_mvii(4); break; + case 0x2bd: /* 1 010 111 101 */ cp1610_mvii(5); break; + case 0x2be: /* 1 010 111 110 */ cp1610_mvii(6); break; + case 0x2bf: /* 1 010 111 111 */ cp1610_mvii(7); break; + + case 0x2c0: /* 1 011 000 000 */ cp1610_add(0); break; + case 0x2c1: /* 1 011 000 001 */ cp1610_add(1); break; + case 0x2c2: /* 1 011 000 010 */ cp1610_add(2); break; + case 0x2c3: /* 1 011 000 011 */ cp1610_add(3); break; + case 0x2c4: /* 1 011 000 100 */ cp1610_add(4); break; + case 0x2c5: /* 1 011 000 101 */ cp1610_add(5); break; + case 0x2c6: /* 1 011 000 110 */ cp1610_add(6); break; + case 0x2c7: /* 1 011 000 111 */ cp1610_add(7); break; + + case 0x2c8: /* 1 011 001 000 */ cp1610_addat(1,0); break; + case 0x2c9: /* 1 011 001 001 */ cp1610_addat(1,1); break; + case 0x2ca: /* 1 011 001 010 */ cp1610_addat(1,2); break; + case 0x2cb: /* 1 011 001 011 */ cp1610_addat(1,3); break; + case 0x2cc: /* 1 011 001 100 */ cp1610_addat(1,4); break; + case 0x2cd: /* 1 011 001 101 */ cp1610_addat(1,5); break; + case 0x2ce: /* 1 011 001 110 */ cp1610_addat(1,6); break; + case 0x2cf: /* 1 011 001 111 */ cp1610_addat(1,7); break; + + case 0x2d0: /* 1 011 010 000 */ cp1610_addat(2,0); break; + case 0x2d1: /* 1 011 010 001 */ cp1610_addat(2,1); break; + case 0x2d2: /* 1 011 010 010 */ cp1610_addat(2,2); break; + case 0x2d3: /* 1 011 010 011 */ cp1610_addat(2,3); break; + case 0x2d4: /* 1 011 010 100 */ cp1610_addat(2,4); break; + case 0x2d5: /* 1 011 010 101 */ cp1610_addat(2,5); break; + case 0x2d6: /* 1 011 010 110 */ cp1610_addat(2,6); break; + case 0x2d7: /* 1 011 010 111 */ cp1610_addat(2,7); break; + + case 0x2d8: /* 1 011 011 000 */ cp1610_addat(3,0); break; + case 0x2d9: /* 1 011 011 001 */ cp1610_addat(3,1); break; + case 0x2da: /* 1 011 011 010 */ cp1610_addat(3,2); break; + case 0x2db: /* 1 011 011 011 */ cp1610_addat(3,3); break; + case 0x2dc: /* 1 011 011 100 */ cp1610_addat(3,4); break; + case 0x2dd: /* 1 011 011 101 */ cp1610_addat(3,5); break; + case 0x2de: /* 1 011 011 110 */ cp1610_addat(3,6); break; + case 0x2df: /* 1 011 011 111 */ cp1610_addat(3,7); break; + + case 0x2e0: /* 1 011 100 000 */ cp1610_addat_i(4,0); break; + case 0x2e1: /* 1 011 100 001 */ cp1610_addat_i(4,1); break; + case 0x2e2: /* 1 011 100 010 */ cp1610_addat_i(4,2); break; + case 0x2e3: /* 1 011 100 011 */ cp1610_addat_i(4,3); break; + case 0x2e4: /* 1 011 100 100 */ cp1610_addat_i(4,4); break; + case 0x2e5: /* 1 011 100 101 */ cp1610_addat_i(4,5); break; + case 0x2e6: /* 1 011 100 110 */ cp1610_addat_i(4,6); break; + case 0x2e7: /* 1 011 100 111 */ cp1610_addat_i(4,7); break; + + case 0x2e8: /* 1 011 101 000 */ cp1610_addat_i(5,0); break; + case 0x2e9: /* 1 011 101 001 */ cp1610_addat_i(5,1); break; + case 0x2ea: /* 1 011 101 010 */ cp1610_addat_i(5,2); break; + case 0x2eb: /* 1 011 101 011 */ cp1610_addat_i(5,3); break; + case 0x2ec: /* 1 011 101 100 */ cp1610_addat_i(5,4); break; + case 0x2ed: /* 1 011 101 101 */ cp1610_addat_i(5,5); break; + case 0x2ee: /* 1 011 101 110 */ cp1610_addat_i(5,6); break; + case 0x2ef: /* 1 011 101 111 */ cp1610_addat_i(5,7); break; + + case 0x2f0: /* 1 011 110 000 */ cp1610_addat_d(6,0); break; + case 0x2f1: /* 1 011 110 001 */ cp1610_addat_d(6,1); break; + case 0x2f2: /* 1 011 110 010 */ cp1610_addat_d(6,2); break; + case 0x2f3: /* 1 011 110 011 */ cp1610_addat_d(6,3); break; + case 0x2f4: /* 1 011 110 100 */ cp1610_addat_d(6,4); break; + case 0x2f5: /* 1 011 110 101 */ cp1610_addat_d(6,5); break; + case 0x2f6: /* 1 011 110 110 */ cp1610_addat_d(6,6); break; + case 0x2f7: /* 1 011 110 111 */ cp1610_addat_d(6,7); break; + + case 0x2f8: /* 1 011 111 000 */ cp1610_addi(0); break; + case 0x2f9: /* 1 011 111 001 */ cp1610_addi(1); break; + case 0x2fa: /* 1 011 111 010 */ cp1610_addi(2); break; + case 0x2fb: /* 1 011 111 011 */ cp1610_addi(3); break; + case 0x2fc: /* 1 011 111 100 */ cp1610_addi(4); break; + case 0x2fd: /* 1 011 111 101 */ cp1610_addi(5); break; + case 0x2fe: /* 1 011 111 110 */ cp1610_addi(6); break; + case 0x2ff: /* 1 011 111 111 */ cp1610_addi(7); break; + + case 0x300: /* 1 100 000 000 */ cp1610_sub(0); break; + case 0x301: /* 1 100 000 001 */ cp1610_sub(1); break; + case 0x302: /* 1 100 000 010 */ cp1610_sub(2); break; + case 0x303: /* 1 100 000 011 */ cp1610_sub(3); break; + case 0x304: /* 1 100 000 100 */ cp1610_sub(4); break; + case 0x305: /* 1 100 000 101 */ cp1610_sub(5); break; + case 0x306: /* 1 100 000 110 */ cp1610_sub(6); break; + case 0x307: /* 1 100 000 111 */ cp1610_sub(7); break; + + case 0x308: /* 1 100 001 000 */ cp1610_subat(1,0); break; + case 0x309: /* 1 100 001 001 */ cp1610_subat(1,1); break; + case 0x30a: /* 1 100 001 010 */ cp1610_subat(1,2); break; + case 0x30b: /* 1 100 001 011 */ cp1610_subat(1,3); break; + case 0x30c: /* 1 100 001 100 */ cp1610_subat(1,4); break; + case 0x30d: /* 1 100 001 101 */ cp1610_subat(1,5); break; + case 0x30e: /* 1 100 001 110 */ cp1610_subat(1,6); break; + case 0x30f: /* 1 100 001 111 */ cp1610_subat(1,7); break; + + case 0x310: /* 1 100 010 000 */ cp1610_subat(2,0); break; + case 0x311: /* 1 100 010 001 */ cp1610_subat(2,1); break; + case 0x312: /* 1 100 010 010 */ cp1610_subat(2,2); break; + case 0x313: /* 1 100 010 011 */ cp1610_subat(2,3); break; + case 0x314: /* 1 100 010 100 */ cp1610_subat(2,4); break; + case 0x315: /* 1 100 010 101 */ cp1610_subat(2,5); break; + case 0x316: /* 1 100 010 110 */ cp1610_subat(2,6); break; + case 0x317: /* 1 100 010 111 */ cp1610_subat(2,7); break; + + case 0x318: /* 1 100 011 000 */ cp1610_subat(3,0); break; + case 0x319: /* 1 100 011 001 */ cp1610_subat(3,1); break; + case 0x31a: /* 1 100 011 010 */ cp1610_subat(3,2); break; + case 0x31b: /* 1 100 011 011 */ cp1610_subat(3,3); break; + case 0x31c: /* 1 100 011 100 */ cp1610_subat(3,4); break; + case 0x31d: /* 1 100 011 101 */ cp1610_subat(3,5); break; + case 0x31e: /* 1 100 011 110 */ cp1610_subat(3,6); break; + case 0x31f: /* 1 100 011 111 */ cp1610_subat(3,7); break; + + case 0x320: /* 1 100 100 000 */ cp1610_subat_i(4,0); break; + case 0x321: /* 1 100 100 001 */ cp1610_subat_i(4,1); break; + case 0x322: /* 1 100 100 010 */ cp1610_subat_i(4,2); break; + case 0x323: /* 1 100 100 011 */ cp1610_subat_i(4,3); break; + case 0x324: /* 1 100 100 100 */ cp1610_subat_i(4,4); break; + case 0x325: /* 1 100 100 101 */ cp1610_subat_i(4,5); break; + case 0x326: /* 1 100 100 110 */ cp1610_subat_i(4,6); break; + case 0x327: /* 1 100 100 111 */ cp1610_subat_i(4,7); break; + + case 0x328: /* 1 100 101 000 */ cp1610_subat_i(5,0); break; + case 0x329: /* 1 100 101 001 */ cp1610_subat_i(5,1); break; + case 0x32a: /* 1 100 101 010 */ cp1610_subat_i(5,2); break; + case 0x32b: /* 1 100 101 011 */ cp1610_subat_i(5,3); break; + case 0x32c: /* 1 100 101 100 */ cp1610_subat_i(5,4); break; + case 0x32d: /* 1 100 101 101 */ cp1610_subat_i(5,5); break; + case 0x32e: /* 1 100 101 110 */ cp1610_subat_i(5,6); break; + case 0x32f: /* 1 100 101 111 */ cp1610_subat_i(5,7); break; + + case 0x330: /* 1 100 110 000 */ cp1610_subat_d(6,0); break; + case 0x331: /* 1 100 110 001 */ cp1610_subat_d(6,1); break; + case 0x332: /* 1 100 110 010 */ cp1610_subat_d(6,2); break; + case 0x333: /* 1 100 110 011 */ cp1610_subat_d(6,3); break; + case 0x334: /* 1 100 110 100 */ cp1610_subat_d(6,4); break; + case 0x335: /* 1 100 110 101 */ cp1610_subat_d(6,5); break; + case 0x336: /* 1 100 110 110 */ cp1610_subat_d(6,6); break; + case 0x337: /* 1 100 110 111 */ cp1610_subat_d(6,7); break; + + case 0x338: /* 1 100 111 000 */ cp1610_subi(0); break; + case 0x339: /* 1 100 111 001 */ cp1610_subi(1); break; + case 0x33a: /* 1 100 111 010 */ cp1610_subi(2); break; + case 0x33b: /* 1 100 111 011 */ cp1610_subi(3); break; + case 0x33c: /* 1 100 111 100 */ cp1610_subi(4); break; + case 0x33d: /* 1 100 111 101 */ cp1610_subi(5); break; + case 0x33e: /* 1 100 111 110 */ cp1610_subi(6); break; + case 0x33f: /* 1 100 111 111 */ cp1610_subi(7); break; + + case 0x340: /* 1 101 000 000 */ cp1610_cmp(0); break; + case 0x341: /* 1 101 000 001 */ cp1610_cmp(1); break; + case 0x342: /* 1 101 000 010 */ cp1610_cmp(2); break; + case 0x343: /* 1 101 000 011 */ cp1610_cmp(3); break; + case 0x344: /* 1 101 000 100 */ cp1610_cmp(4); break; + case 0x345: /* 1 101 000 101 */ cp1610_cmp(5); break; + case 0x346: /* 1 101 000 110 */ cp1610_cmp(6); break; + case 0x347: /* 1 101 000 111 */ cp1610_cmp(7); break; + + case 0x348: /* 1 101 001 000 */ cp1610_cmpat(1,0); break; + case 0x349: /* 1 101 001 001 */ cp1610_cmpat(1,1); break; + case 0x34a: /* 1 101 001 010 */ cp1610_cmpat(1,2); break; + case 0x34b: /* 1 101 001 011 */ cp1610_cmpat(1,3); break; + case 0x34c: /* 1 101 001 100 */ cp1610_cmpat(1,4); break; + case 0x34d: /* 1 101 001 101 */ cp1610_cmpat(1,5); break; + case 0x34e: /* 1 101 001 110 */ cp1610_cmpat(1,6); break; + case 0x34f: /* 1 101 001 111 */ cp1610_cmpat(1,7); break; + + case 0x350: /* 1 101 010 000 */ cp1610_cmpat(2,0); break; + case 0x351: /* 1 101 010 001 */ cp1610_cmpat(2,1); break; + case 0x352: /* 1 101 010 010 */ cp1610_cmpat(2,2); break; + case 0x353: /* 1 101 010 011 */ cp1610_cmpat(2,3); break; + case 0x354: /* 1 101 010 100 */ cp1610_cmpat(2,4); break; + case 0x355: /* 1 101 010 101 */ cp1610_cmpat(2,5); break; + case 0x356: /* 1 101 010 110 */ cp1610_cmpat(2,6); break; + case 0x357: /* 1 101 010 111 */ cp1610_cmpat(2,7); break; + + case 0x358: /* 1 101 011 000 */ cp1610_cmpat(3,0); break; + case 0x359: /* 1 101 011 001 */ cp1610_cmpat(3,1); break; + case 0x35a: /* 1 101 011 010 */ cp1610_cmpat(3,2); break; + case 0x35b: /* 1 101 011 011 */ cp1610_cmpat(3,3); break; + case 0x35c: /* 1 101 011 100 */ cp1610_cmpat(3,4); break; + case 0x35d: /* 1 101 011 101 */ cp1610_cmpat(3,5); break; + case 0x35e: /* 1 101 011 110 */ cp1610_cmpat(3,6); break; + case 0x35f: /* 1 101 011 111 */ cp1610_cmpat(3,7); break; + + case 0x360: /* 1 101 100 000 */ cp1610_cmpat_i(4,0); break; + case 0x361: /* 1 101 100 001 */ cp1610_cmpat_i(4,1); break; + case 0x362: /* 1 101 100 010 */ cp1610_cmpat_i(4,2); break; + case 0x363: /* 1 101 100 011 */ cp1610_cmpat_i(4,3); break; + case 0x364: /* 1 101 100 100 */ cp1610_cmpat_i(4,4); break; + case 0x365: /* 1 101 100 101 */ cp1610_cmpat_i(4,5); break; + case 0x366: /* 1 101 100 110 */ cp1610_cmpat_i(4,6); break; + case 0x367: /* 1 101 100 111 */ cp1610_cmpat_i(4,7); break; + + case 0x368: /* 1 101 101 000 */ cp1610_cmpat_i(5,0); break; + case 0x369: /* 1 101 101 001 */ cp1610_cmpat_i(5,1); break; + case 0x36a: /* 1 101 101 010 */ cp1610_cmpat_i(5,2); break; + case 0x36b: /* 1 101 101 011 */ cp1610_cmpat_i(5,3); break; + case 0x36c: /* 1 101 101 100 */ cp1610_cmpat_i(5,4); break; + case 0x36d: /* 1 101 101 101 */ cp1610_cmpat_i(5,5); break; + case 0x36e: /* 1 101 101 110 */ cp1610_cmpat_i(5,6); break; + case 0x36f: /* 1 101 101 111 */ cp1610_cmpat_i(5,7); break; + + case 0x370: /* 1 101 110 000 */ cp1610_cmpat_d(6,0); break; + case 0x371: /* 1 101 110 001 */ cp1610_cmpat_d(6,1); break; + case 0x372: /* 1 101 110 010 */ cp1610_cmpat_d(6,2); break; + case 0x373: /* 1 101 110 011 */ cp1610_cmpat_d(6,3); break; + case 0x374: /* 1 101 110 100 */ cp1610_cmpat_d(6,4); break; + case 0x375: /* 1 101 110 101 */ cp1610_cmpat_d(6,5); break; + case 0x376: /* 1 101 110 110 */ cp1610_cmpat_d(6,6); break; + case 0x377: /* 1 101 110 111 */ cp1610_cmpat_d(6,7); break; + + case 0x378: /* 1 101 111 000 */ cp1610_cmpi(0); break; + case 0x379: /* 1 101 111 001 */ cp1610_cmpi(1); break; + case 0x37a: /* 1 101 111 010 */ cp1610_cmpi(2); break; + case 0x37b: /* 1 101 111 011 */ cp1610_cmpi(3); break; + case 0x37c: /* 1 101 111 100 */ cp1610_cmpi(4); break; + case 0x37d: /* 1 101 111 101 */ cp1610_cmpi(5); break; + case 0x37e: /* 1 101 111 110 */ cp1610_cmpi(6); break; + case 0x37f: /* 1 101 111 111 */ cp1610_cmpi(7); break; + + case 0x380: /* 1 110 000 000 */ cp1610_and(0); break; + case 0x381: /* 1 110 000 001 */ cp1610_and(1); break; + case 0x382: /* 1 110 000 010 */ cp1610_and(2); break; + case 0x383: /* 1 110 000 011 */ cp1610_and(3); break; + case 0x384: /* 1 110 000 100 */ cp1610_and(4); break; + case 0x385: /* 1 110 000 101 */ cp1610_and(5); break; + case 0x386: /* 1 110 000 110 */ cp1610_and(6); break; + case 0x387: /* 1 110 000 111 */ cp1610_and(7); break; + + case 0x388: /* 1 110 001 000 */ cp1610_andat(1,0); break; + case 0x389: /* 1 110 001 001 */ cp1610_andat(1,1); break; + case 0x38a: /* 1 110 001 010 */ cp1610_andat(1,2); break; + case 0x38b: /* 1 110 001 011 */ cp1610_andat(1,3); break; + case 0x38c: /* 1 110 001 100 */ cp1610_andat(1,4); break; + case 0x38d: /* 1 110 001 101 */ cp1610_andat(1,5); break; + case 0x38e: /* 1 110 001 110 */ cp1610_andat(1,6); break; + case 0x38f: /* 1 110 001 111 */ cp1610_andat(1,7); break; + + case 0x390: /* 1 110 010 000 */ cp1610_andat(2,0); break; + case 0x391: /* 1 110 010 001 */ cp1610_andat(2,1); break; + case 0x392: /* 1 110 010 010 */ cp1610_andat(2,2); break; + case 0x393: /* 1 110 010 011 */ cp1610_andat(2,3); break; + case 0x394: /* 1 110 010 100 */ cp1610_andat(2,4); break; + case 0x395: /* 1 110 010 101 */ cp1610_andat(2,5); break; + case 0x396: /* 1 110 010 110 */ cp1610_andat(2,6); break; + case 0x397: /* 1 110 010 111 */ cp1610_andat(2,7); break; + + case 0x398: /* 1 110 011 000 */ cp1610_andat(3,0); break; + case 0x399: /* 1 110 011 001 */ cp1610_andat(3,1); break; + case 0x39a: /* 1 110 011 010 */ cp1610_andat(3,2); break; + case 0x39b: /* 1 110 011 011 */ cp1610_andat(3,3); break; + case 0x39c: /* 1 110 011 100 */ cp1610_andat(3,4); break; + case 0x39d: /* 1 110 011 101 */ cp1610_andat(3,5); break; + case 0x39e: /* 1 110 011 110 */ cp1610_andat(3,6); break; + case 0x39f: /* 1 110 011 111 */ cp1610_andat(3,7); break; + + case 0x3a0: /* 1 110 100 000 */ cp1610_andat_i(4,0); break; + case 0x3a1: /* 1 110 100 001 */ cp1610_andat_i(4,1); break; + case 0x3a2: /* 1 110 100 010 */ cp1610_andat_i(4,2); break; + case 0x3a3: /* 1 110 100 011 */ cp1610_andat_i(4,3); break; + case 0x3a4: /* 1 110 100 100 */ cp1610_andat_i(4,4); break; + case 0x3a5: /* 1 110 100 101 */ cp1610_andat_i(4,5); break; + case 0x3a6: /* 1 110 100 110 */ cp1610_andat_i(4,6); break; + case 0x3a7: /* 1 110 100 111 */ cp1610_andat_i(4,7); break; + + case 0x3a8: /* 1 110 101 000 */ cp1610_andat_i(5,0); break; + case 0x3a9: /* 1 110 101 001 */ cp1610_andat_i(5,1); break; + case 0x3aa: /* 1 110 101 010 */ cp1610_andat_i(5,2); break; + case 0x3ab: /* 1 110 101 011 */ cp1610_andat_i(5,3); break; + case 0x3ac: /* 1 110 101 100 */ cp1610_andat_i(5,4); break; + case 0x3ad: /* 1 110 101 101 */ cp1610_andat_i(5,5); break; + case 0x3ae: /* 1 110 101 110 */ cp1610_andat_i(5,6); break; + case 0x3af: /* 1 110 101 111 */ cp1610_andat_i(5,7); break; + + case 0x3b0: /* 1 110 110 000 */ cp1610_andat_d(6,0); break; + case 0x3b1: /* 1 110 110 001 */ cp1610_andat_d(6,1); break; + case 0x3b2: /* 1 110 110 010 */ cp1610_andat_d(6,2); break; + case 0x3b3: /* 1 110 110 011 */ cp1610_andat_d(6,3); break; + case 0x3b4: /* 1 110 110 100 */ cp1610_andat_d(6,4); break; + case 0x3b5: /* 1 110 110 101 */ cp1610_andat_d(6,5); break; + case 0x3b6: /* 1 110 110 110 */ cp1610_andat_d(6,6); break; + case 0x3b7: /* 1 110 110 111 */ cp1610_andat_d(6,7); break; + + case 0x3b8: /* 1 110 111 000 */ cp1610_andi(0); break; + case 0x3b9: /* 1 110 111 001 */ cp1610_andi(1); break; + case 0x3ba: /* 1 110 111 010 */ cp1610_andi(2); break; + case 0x3bb: /* 1 110 111 011 */ cp1610_andi(3); break; + case 0x3bc: /* 1 110 111 100 */ cp1610_andi(4); break; + case 0x3bd: /* 1 110 111 101 */ cp1610_andi(5); break; + case 0x3be: /* 1 110 111 110 */ cp1610_andi(6); break; + case 0x3bf: /* 1 110 111 111 */ cp1610_andi(7); break; + + case 0x3c0: /* 1 111 000 000 */ cp1610_xor(0); break; + case 0x3c1: /* 1 111 000 001 */ cp1610_xor(1); break; + case 0x3c2: /* 1 111 000 010 */ cp1610_xor(2); break; + case 0x3c3: /* 1 111 000 011 */ cp1610_xor(3); break; + case 0x3c4: /* 1 111 000 100 */ cp1610_xor(4); break; + case 0x3c5: /* 1 111 000 101 */ cp1610_xor(5); break; + case 0x3c6: /* 1 111 000 110 */ cp1610_xor(6); break; + case 0x3c7: /* 1 111 000 111 */ cp1610_xor(7); break; + + case 0x3c8: /* 1 111 001 000 */ cp1610_xorat(1,0); break; + case 0x3c9: /* 1 111 001 001 */ cp1610_xorat(1,1); break; + case 0x3ca: /* 1 111 001 010 */ cp1610_xorat(1,2); break; + case 0x3cb: /* 1 111 001 011 */ cp1610_xorat(1,3); break; + case 0x3cc: /* 1 111 001 100 */ cp1610_xorat(1,4); break; + case 0x3cd: /* 1 111 001 101 */ cp1610_xorat(1,5); break; + case 0x3ce: /* 1 111 001 110 */ cp1610_xorat(1,6); break; + case 0x3cf: /* 1 111 001 111 */ cp1610_xorat(1,7); break; + + case 0x3d0: /* 1 111 010 000 */ cp1610_xorat(2,0); break; + case 0x3d1: /* 1 111 010 001 */ cp1610_xorat(2,1); break; + case 0x3d2: /* 1 111 010 010 */ cp1610_xorat(2,2); break; + case 0x3d3: /* 1 111 010 011 */ cp1610_xorat(2,3); break; + case 0x3d4: /* 1 111 010 100 */ cp1610_xorat(2,4); break; + case 0x3d5: /* 1 111 010 101 */ cp1610_xorat(2,5); break; + case 0x3d6: /* 1 111 010 110 */ cp1610_xorat(2,6); break; + case 0x3d7: /* 1 111 010 111 */ cp1610_xorat(2,7); break; + + case 0x3d8: /* 1 111 011 000 */ cp1610_xorat(3,0); break; + case 0x3d9: /* 1 111 011 001 */ cp1610_xorat(3,1); break; + case 0x3da: /* 1 111 011 010 */ cp1610_xorat(3,2); break; + case 0x3db: /* 1 111 011 011 */ cp1610_xorat(3,3); break; + case 0x3dc: /* 1 111 011 100 */ cp1610_xorat(3,4); break; + case 0x3dd: /* 1 111 011 101 */ cp1610_xorat(3,5); break; + case 0x3de: /* 1 111 011 110 */ cp1610_xorat(3,6); break; + case 0x3df: /* 1 111 011 111 */ cp1610_xorat(3,7); break; + + case 0x3e0: /* 1 111 100 000 */ cp1610_xorat_i(4,0); break; + case 0x3e1: /* 1 111 100 001 */ cp1610_xorat_i(4,1); break; + case 0x3e2: /* 1 111 100 010 */ cp1610_xorat_i(4,2); break; + case 0x3e3: /* 1 111 100 011 */ cp1610_xorat_i(4,3); break; + case 0x3e4: /* 1 111 100 100 */ cp1610_xorat_i(4,4); break; + case 0x3e5: /* 1 111 100 101 */ cp1610_xorat_i(4,5); break; + case 0x3e6: /* 1 111 100 110 */ cp1610_xorat_i(4,6); break; + case 0x3e7: /* 1 111 100 111 */ cp1610_xorat_i(4,7); break; + + case 0x3e8: /* 1 111 101 000 */ cp1610_xorat_i(5,0); break; + case 0x3e9: /* 1 111 101 001 */ cp1610_xorat_i(5,1); break; + case 0x3ea: /* 1 111 101 010 */ cp1610_xorat_i(5,2); break; + case 0x3eb: /* 1 111 101 011 */ cp1610_xorat_i(5,3); break; + case 0x3ec: /* 1 111 101 100 */ cp1610_xorat_i(5,4); break; + case 0x3ed: /* 1 111 101 101 */ cp1610_xorat_i(5,5); break; + case 0x3ee: /* 1 111 101 110 */ cp1610_xorat_i(5,6); break; + case 0x3ef: /* 1 111 101 111 */ cp1610_xorat_i(5,7); break; + + case 0x3f0: /* 1 111 110 000 */ cp1610_xorat_d(6,0); break; + case 0x3f1: /* 1 111 110 001 */ cp1610_xorat_d(6,1); break; + case 0x3f2: /* 1 111 110 010 */ cp1610_xorat_d(6,2); break; + case 0x3f3: /* 1 111 110 011 */ cp1610_xorat_d(6,3); break; + case 0x3f4: /* 1 111 110 100 */ cp1610_xorat_d(6,4); break; + case 0x3f5: /* 1 111 110 101 */ cp1610_xorat_d(6,5); break; + case 0x3f6: /* 1 111 110 110 */ cp1610_xorat_d(6,6); break; + case 0x3f7: /* 1 111 110 111 */ cp1610_xorat_d(6,7); break; + + case 0x3f8: /* 1 111 111 000 */ cp1610_xori(0); break; + case 0x3f9: /* 1 111 111 001 */ cp1610_xori(1); break; + case 0x3fa: /* 1 111 111 010 */ cp1610_xori(2); break; + case 0x3fb: /* 1 111 111 011 */ cp1610_xori(3); break; + case 0x3fc: /* 1 111 111 100 */ cp1610_xori(4); break; + case 0x3fd: /* 1 111 111 101 */ cp1610_xori(5); break; + case 0x3fe: /* 1 111 111 110 */ cp1610_xori(6); break; + case 0x3ff: /* 1 111 111 111 */ cp1610_xori(7); break; } if (m_mask_interrupts == 0) @@ -3389,6 +3365,12 @@ void cp1610_cpu_device::device_start() m_icountptr = &m_icount; } +void cp1610_cpu_device::device_reset() +{ + /* This is how we set the reset vector */ + set_input_line(CP1610_RESET, PULSE_LINE); +} + void cp1610_cpu_device::execute_set_input(int irqline, int state) { switch(irqline) diff --git a/src/emu/cpu/cp1610/cp1610.h b/src/emu/cpu/cp1610/cp1610.h index 670fb0deac8..d3d7c9a78a4 100644 --- a/src/emu/cpu/cp1610/cp1610.h +++ b/src/emu/cpu/cp1610/cp1610.h @@ -205,7 +205,6 @@ private: void cp1610_jd(UINT16 addr); void cp1610_do_sdbd(); void cp1610_do_jumps(); - }; diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index 7b79940c998..2e263b6bac4 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -520,7 +520,7 @@ void cquestsnd_cpu_device::execute_run() do { /* Decode the instruction */ - UINT64 inst = m_direct->read_decrypted_qword(SND_PC << 3); + UINT64 inst = m_direct->read_qword(SND_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -776,7 +776,7 @@ void cquestrot_cpu_device::execute_run() do { /* Decode the instruction */ - UINT64 inst = m_direct->read_decrypted_qword(ROT_PC << 3); + UINT64 inst = m_direct->read_qword(ROT_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; @@ -1196,7 +1196,7 @@ void cquestlin_cpu_device::execute_run() int prog = (m_clkcnt & 3) ? BACKGROUND : FOREGROUND; m_curpc = LINE_PC; - UINT64 inst = m_direct->read_decrypted_qword(LINE_PC << 3); + UINT64 inst = m_direct->read_qword(LINE_PC << 3); UINT32 inslow = inst & 0xffffffff; UINT32 inshig = inst >> 32; diff --git a/src/emu/cpu/dsp16/dsp16.c b/src/emu/cpu/dsp16/dsp16.c index 565377eb714..9f1de0c79f6 100644 --- a/src/emu/cpu/dsp16/dsp16.c +++ b/src/emu/cpu/dsp16/dsp16.c @@ -373,7 +373,7 @@ inline void dsp16_device::data_write(const UINT16& addr, const UINT16& data) inline UINT32 dsp16_device::opcode_read(const UINT8 pcOffset) { const UINT16 readPC = m_pc + pcOffset; - return m_direct->read_decrypted_dword(readPC << 1); + return m_direct->read_dword(readPC << 1); } diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index 2de5e6f50d6..21de1f18a74 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -437,7 +437,7 @@ offs_t dsp32c_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o inline UINT32 dsp32c_device::ROPCODE(offs_t pc) { - return m_direct->read_decrypted_dword(pc); + return m_direct->read_dword(pc); } inline UINT8 dsp32c_device::RBYTE(offs_t addr) diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index 408521ea8fc..9e151019c7e 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -108,7 +108,7 @@ const device_type DSP56156 = &device_creator<dsp56k_device>; * Internal Memory Maps ****************************************************************************/ static ADDRESS_MAP_START( dsp56156_program_map, AS_PROGRAM, 16, dsp56k_device ) - AM_RANGE(0x0000,0x07ff) AM_READWRITE(program_r, program_w) /* 1-5 */ + AM_RANGE(0x0000,0x07ff) AM_RAM AM_SHARE("dsk56k_program_ram") /* 1-5 */ // AM_RANGE(0x2f00,0x2fff) AM_ROM /* 1-5 PROM reserved memory. Is this the right spot for it? */ ADDRESS_MAP_END @@ -122,29 +122,14 @@ dsp56k_device::dsp56k_device(const machine_config &mconfig, const char *tag, dev : cpu_device(mconfig, DSP56156, "DSP56156", tag, owner, clock, "dsp56156", __FILE__) , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, -1, ADDRESS_MAP_NAME(dsp56156_program_map)) , m_data_config("data", ENDIANNESS_LITTLE, 16, 16, -1, ADDRESS_MAP_NAME(dsp56156_x_data_map)) + , m_program_ram(*this, "dsk56k_program_ram") { } - -/*************************************************************************** - Direct Update Handler -***************************************************************************/ -DIRECT_UPDATE_MEMBER( dsp56k_device::dsp56k_direct_handler ) -{ - if (address <= (0x07ff<<1)) - { - direct.explicit_configure(0x0000<<1, 0x07ff<<1, (0x07ff<<1) | 1, m_dsp56k_core.program_ram); - return ~0; - } - - return address; -} - - /*************************************************************************** MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) cpustate->direct->read_decrypted_word(pc) +#define ROPCODE(pc) cpustate->direct->read_word(pc) /*************************************************************************** @@ -255,6 +240,7 @@ void dsp56k_device::device_start() memset(&m_dsp56k_core, 0, sizeof(m_dsp56k_core)); m_dsp56k_core.device = this; + m_dsp56k_core.program_ram = m_program_ram; /* Call specific module inits */ pcu_init(&m_dsp56k_core, this); @@ -292,16 +278,11 @@ void dsp56k_device::device_start() save_item(NAME(m_dsp56k_core.HI.bootstrap_offset)); save_item(NAME(m_dsp56k_core.peripheral_ram)); - save_item(NAME(m_dsp56k_core.program_ram)); m_dsp56k_core.program = &space(AS_PROGRAM); m_dsp56k_core.direct = &m_dsp56k_core.program->direct(); m_dsp56k_core.data = &space(AS_DATA); - /* Setup the direct memory handler for this CPU */ - /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */ - m_dsp56k_core.program->set_direct_update_handler(direct_update_delegate(FUNC(dsp56k_device::dsp56k_direct_handler), this)); - state_add(DSP56K_PC, "PC", m_dsp56k_core.PCU.pc).formatstr("%04X"); state_add(DSP56K_SR, "SR", m_dsp56k_core.PCU.sr).formatstr("%04X"); state_add(DSP56K_LC, "LC", m_dsp56k_core.PCU.lc).formatstr("%04X"); diff --git a/src/emu/cpu/dsp56k/dsp56k.h b/src/emu/cpu/dsp56k/dsp56k.h index c8d8c948a90..fc461dbcb16 100644 --- a/src/emu/cpu/dsp56k/dsp56k.h +++ b/src/emu/cpu/dsp56k/dsp56k.h @@ -195,7 +195,7 @@ struct dsp56k_core address_space *data; UINT16 peripheral_ram[0x40]; - UINT16 program_ram[0x800]; + UINT16 *program_ram; }; @@ -204,7 +204,6 @@ class dsp56k_device : public cpu_device public: dsp56k_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock); - DECLARE_DIRECT_UPDATE_MEMBER(dsp56k_direct_handler); DECLARE_READ16_MEMBER( program_r ); DECLARE_WRITE16_MEMBER( program_w ); DECLARE_READ16_MEMBER( peripheral_register_r ); @@ -244,6 +243,7 @@ protected: private: address_space_config m_program_config; address_space_config m_data_config; + required_shared_ptr<UINT16> m_program_ram; dsp56k_core m_dsp56k_core; diff --git a/src/emu/cpu/dsp56k/dsp56mem.c b/src/emu/cpu/dsp56k/dsp56mem.c index a6c4c61b9fe..6ec2251df64 100644 --- a/src/emu/cpu/dsp56k/dsp56mem.c +++ b/src/emu/cpu/dsp56k/dsp56mem.c @@ -488,16 +488,6 @@ void dsp56k_io_reset(dsp56k_core* cpustate) } // namespace DSP56K -READ16_MEMBER( dsp56k_device::program_r ) -{ - return m_dsp56k_core.program_ram[offset]; -} - -WRITE16_MEMBER( dsp56k_device::program_w ) -{ - m_dsp56k_core.program_ram[offset] = data; -} - /* Work */ READ16_MEMBER( dsp56k_device::peripheral_register_r ) { diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h index f10c9983d50..c8f43641ff5 100644 --- a/src/emu/cpu/e132xs/e132xs.h +++ b/src/emu/cpu/e132xs/e132xs.h @@ -199,7 +199,7 @@ extern unsigned dasm_hyperstone(char *buffer, unsigned pc, const UINT8 *oprom, u #define IO_WRITE_W(addr, data) m_io->write_dword(((addr) >> 11) & 0x7ffc, data) -#define READ_OP(addr) m_direct->read_decrypted_word((addr), m_opcodexor) +#define READ_OP(addr) m_direct->read_word((addr), m_opcodexor) //************************************************************************** // TYPE DEFINITIONS diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index 22570346fc8..482a1ddec8d 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -1901,7 +1901,7 @@ void esrip_device::execute_run() m_pl7 = m_l7; /* Latch instruction */ - inst = m_direct->read_decrypted_qword(RIP_PC << 3); + inst = m_direct->read_qword(RIP_PC << 3); in_h = inst >> 32; in_l = inst & 0xffffffff; diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 0199c54b743..182638543d7 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -96,7 +96,7 @@ void f8_cpu_device::ROMC_00(int insttim) /* SKR - added parameter to tell if */ * of PC0. */ - m_dbus = m_direct->read_decrypted_byte(m_pc0); + m_dbus = m_direct->read_byte(m_pc0); m_pc0 += 1; m_icount -= insttim; /* SKR - ROMC00 is usually short, not short+long, */ /* but DS is long */ @@ -110,7 +110,7 @@ void f8_cpu_device::ROMC_01() * location addressed by PC0; then all devices add the 8-bit value * on the data bus as signed binary number to PC0. */ - m_dbus = m_direct->read_raw_byte(m_pc0); + m_dbus = m_direct->read_byte(m_pc0); m_pc0 += (INT8)m_dbus; m_icount -= cL; } @@ -134,7 +134,7 @@ void f8_cpu_device::ROMC_03(int insttim) /* SKR - added parameter to tell if */ * Similiar to 0x00, except that it is used for immediate operands * fetches (using PC0) instead of instruction fetches. */ - m_dbus = m_io = m_direct->read_raw_byte(m_pc0); + m_dbus = m_io = m_direct->read_byte(m_pc0); m_pc0 += 1; m_icount -= insttim; } @@ -228,7 +228,7 @@ void f8_cpu_device::ROMC_0C() * by PC0 into the data bus; then all devices move the value that * has just been placed on the data bus into the low order byte of PC0. */ - m_dbus = m_direct->read_raw_byte(m_pc0); + m_dbus = m_direct->read_byte(m_pc0); m_pc0 = (m_pc0 & 0xff00) | m_dbus; m_icount -= cL; } @@ -251,7 +251,7 @@ void f8_cpu_device::ROMC_0E() * The value on the data bus is then moved to the low order byte * of DC0 by all devices. */ - m_dbus = m_direct->read_raw_byte(m_pc0); + m_dbus = m_direct->read_byte(m_pc0); m_dc0 = (m_dc0 & 0xff00) | m_dbus; m_icount -= cL; } @@ -289,7 +289,7 @@ void f8_cpu_device::ROMC_11() * data bus. All devices must then move the contents of the * data bus to the upper byte of DC0. */ - m_dbus = m_direct->read_raw_byte(m_pc0); + m_dbus = m_direct->read_byte(m_pc0); m_dc0 = (m_dc0 & 0x00ff) | (m_dbus << 8); m_icount -= cL; } diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c index 0740ba7e8ad..f92e0520a12 100644 --- a/src/emu/cpu/h6280/h6280.c +++ b/src/emu/cpu/h6280/h6280.c @@ -2388,7 +2388,7 @@ void h6280_device::pull(UINT8 &value) ***************************************************************/ UINT8 h6280_device::read_opcode() { - return m_direct->read_decrypted_byte(translated(PCW)); + return m_direct->read_byte(translated(PCW)); } /*************************************************************** @@ -2396,7 +2396,7 @@ UINT8 h6280_device::read_opcode() ***************************************************************/ UINT8 h6280_device::read_opcode_arg() { - return m_direct->read_raw_byte(translated(PCW)); + return m_direct->read_byte(translated(PCW)); } diff --git a/src/emu/cpu/h8/h8.c b/src/emu/cpu/h8/h8.c index fb6b9875fd0..9084c0b76fa 100644 --- a/src/emu/cpu/h8/h8.c +++ b/src/emu/cpu/h8/h8.c @@ -511,7 +511,7 @@ offs_t h8_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom UINT16 h8_device::read16i(UINT32 adr) { icount--; - return direct->read_decrypted_word(adr & ~1); + return direct->read_word(adr & ~1); } UINT16 h8_device::fetch() diff --git a/src/emu/cpu/hmcs40/hmcs40.c b/src/emu/cpu/hmcs40/hmcs40.c index dabc9740004..fdcaa430189 100644 --- a/src/emu/cpu/hmcs40/hmcs40.c +++ b/src/emu/cpu/hmcs40/hmcs40.c @@ -493,11 +493,11 @@ void hmcs40_cpu_device::execute_set_input(int line, int state) } else m_timer->adjust(m_timer_halted_remain); - + m_halt = state; return; } - + if (line != 0 && line != 1) return; @@ -577,7 +577,7 @@ void hmcs40_cpu_device::execute_run() m_icount = 0; return; } - + while (m_icount > 0) { // LPU is handled 1 cycle later diff --git a/src/emu/cpu/hphybrid/hphybrid.c b/src/emu/cpu/hphybrid/hphybrid.c index 8a50c78368d..dad427a5f0c 100644 --- a/src/emu/cpu/hphybrid/hphybrid.c +++ b/src/emu/cpu/hphybrid/hphybrid.c @@ -9,39 +9,39 @@ #include "hphybrid.h" enum { - HPHYBRID_A, - HPHYBRID_B, - HPHYBRID_C, - HPHYBRID_D, - HPHYBRID_P, - HPHYBRID_R, - HPHYBRID_IV, - HPHYBRID_PA, - HPHYBRID_DMAPA, - HPHYBRID_DMAMA, - HPHYBRID_DMAC, - HPHYBRID_I + HPHYBRID_A, + HPHYBRID_B, + HPHYBRID_C, + HPHYBRID_D, + HPHYBRID_P, + HPHYBRID_R, + HPHYBRID_IV, + HPHYBRID_PA, + HPHYBRID_DMAPA, + HPHYBRID_DMAMA, + HPHYBRID_DMAC, + HPHYBRID_I }; -#define BIT_MASK(n) (1U << (n)) +#define BIT_MASK(n) (1U << (n)) // Macros to clear/set single bits -#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) -#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) +#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) +#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) // Bits in m_flags -#define HPHYBRID_C_BIT 0 // Carry/extend -#define HPHYBRID_O_BIT 1 // Overflow -#define HPHYBRID_CB_BIT 2 // Cb -#define HPHYBRID_DB_BIT 3 // Db -#define HPHYBRID_INTEN_BIT 4 // Interrupt enable -#define HPHYBRID_DMAEN_BIT 5 // DMA enable -#define HPHYBRID_DMADIR_BIT 6 // DMA direction (1 = OUT) -#define HPHYBRID_HALT_BIT 7 // Halt flag -#define HPHYBRID_IRH_BIT 8 // IRH requested -#define HPHYBRID_IRL_BIT 9 // IRL requested -#define HPHYBRID_IRH_SVC_BIT 10 // IRH in service -#define HPHYBRID_IRL_SVC_BIT 11 // IRL in service +#define HPHYBRID_C_BIT 0 // Carry/extend +#define HPHYBRID_O_BIT 1 // Overflow +#define HPHYBRID_CB_BIT 2 // Cb +#define HPHYBRID_DB_BIT 3 // Db +#define HPHYBRID_INTEN_BIT 4 // Interrupt enable +#define HPHYBRID_DMAEN_BIT 5 // DMA enable +#define HPHYBRID_DMADIR_BIT 6 // DMA direction (1 = OUT) +#define HPHYBRID_HALT_BIT 7 // Halt flag +#define HPHYBRID_IRH_BIT 8 // IRH requested +#define HPHYBRID_IRL_BIT 9 // IRL requested +#define HPHYBRID_IRH_SVC_BIT 10 // IRH in service +#define HPHYBRID_IRL_SVC_BIT 11 // IRL in service #define HPHYBRID_IV_MASK 0xfff0 // IV mask @@ -53,99 +53,99 @@ const device_type HP_5061_3011 = &device_creator<hp_5061_3011_cpu_device>; hp_hybrid_cpu_device::hp_hybrid_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, __FILE__), - m_program_config("program", ENDIANNESS_BIG, 16, 16, -1), - m_io_config("io", ENDIANNESS_BIG, 16, 6, -1) + m_program_config("program", ENDIANNESS_BIG, 16, 16, -1), + m_io_config("io", ENDIANNESS_BIG, 16, 6, -1) { } void hp_hybrid_cpu_device::device_start() { - m_reg_A = 0; - m_reg_B = 0; - m_reg_P = HP_RESET_ADDR; - m_reg_R = 0; - m_reg_C = 0; - m_reg_D = 0; - m_reg_IV = 0; - m_reg_PA[ 0 ] = 0; - m_reg_PA[ 1 ] = 0; - m_reg_PA[ 2 ] = 0; - m_flags = 0; - m_dmapa = 0; - m_dmama = 0; - m_dmac = 0; - m_reg_I = 0; - - { - state_add(HPHYBRID_A, "A", m_reg_A); - state_add(HPHYBRID_B, "B", m_reg_B); - state_add(HPHYBRID_C, "C", m_reg_C); - state_add(HPHYBRID_D, "D", m_reg_D); - state_add(HPHYBRID_P, "P", m_reg_P); - state_add(STATE_GENPC, "GENPC", m_reg_P).noshow(); - state_add(HPHYBRID_R, "R", m_reg_R); - state_add(STATE_GENSP, "GENSP", m_reg_R).noshow(); - state_add(HPHYBRID_IV, "IV", m_reg_IV); - state_add(HPHYBRID_PA, "PA", m_reg_PA[ 0 ]); - state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%9s"); - state_add(HPHYBRID_DMAPA , "DMAPA" , m_dmapa).noshow(); - state_add(HPHYBRID_DMAMA , "DMAMA" , m_dmama).noshow(); - state_add(HPHYBRID_DMAC , "DMAC" , m_dmac).noshow(); - state_add(HPHYBRID_I , "I" , m_reg_I).noshow(); - } - - m_program = &space(AS_PROGRAM); - m_direct = &m_program->direct(); - m_io = &space(AS_IO); - - save_item(NAME(m_reg_A)); - save_item(NAME(m_reg_B)); - save_item(NAME(m_reg_C)); - save_item(NAME(m_reg_D)); - save_item(NAME(m_reg_P)); - save_item(NAME(m_reg_R)); - save_item(NAME(m_reg_IV)); - save_item(NAME(m_reg_PA[0])); - save_item(NAME(m_reg_PA[1])); - save_item(NAME(m_reg_PA[2])); - save_item(NAME(m_flags)); - save_item(NAME(m_dmapa)); - save_item(NAME(m_dmama)); - save_item(NAME(m_dmac)); - save_item(NAME(m_reg_I)); - - m_icountptr = &m_icount; + m_reg_A = 0; + m_reg_B = 0; + m_reg_P = HP_RESET_ADDR; + m_reg_R = 0; + m_reg_C = 0; + m_reg_D = 0; + m_reg_IV = 0; + m_reg_PA[ 0 ] = 0; + m_reg_PA[ 1 ] = 0; + m_reg_PA[ 2 ] = 0; + m_flags = 0; + m_dmapa = 0; + m_dmama = 0; + m_dmac = 0; + m_reg_I = 0; + + { + state_add(HPHYBRID_A, "A", m_reg_A); + state_add(HPHYBRID_B, "B", m_reg_B); + state_add(HPHYBRID_C, "C", m_reg_C); + state_add(HPHYBRID_D, "D", m_reg_D); + state_add(HPHYBRID_P, "P", m_reg_P); + state_add(STATE_GENPC, "GENPC", m_reg_P).noshow(); + state_add(HPHYBRID_R, "R", m_reg_R); + state_add(STATE_GENSP, "GENSP", m_reg_R).noshow(); + state_add(HPHYBRID_IV, "IV", m_reg_IV); + state_add(HPHYBRID_PA, "PA", m_reg_PA[ 0 ]); + state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%9s"); + state_add(HPHYBRID_DMAPA , "DMAPA" , m_dmapa).noshow(); + state_add(HPHYBRID_DMAMA , "DMAMA" , m_dmama).noshow(); + state_add(HPHYBRID_DMAC , "DMAC" , m_dmac).noshow(); + state_add(HPHYBRID_I , "I" , m_reg_I).noshow(); + } + + m_program = &space(AS_PROGRAM); + m_direct = &m_program->direct(); + m_io = &space(AS_IO); + + save_item(NAME(m_reg_A)); + save_item(NAME(m_reg_B)); + save_item(NAME(m_reg_C)); + save_item(NAME(m_reg_D)); + save_item(NAME(m_reg_P)); + save_item(NAME(m_reg_R)); + save_item(NAME(m_reg_IV)); + save_item(NAME(m_reg_PA[0])); + save_item(NAME(m_reg_PA[1])); + save_item(NAME(m_reg_PA[2])); + save_item(NAME(m_flags)); + save_item(NAME(m_dmapa)); + save_item(NAME(m_dmama)); + save_item(NAME(m_dmac)); + save_item(NAME(m_reg_I)); + + m_icountptr = &m_icount; } void hp_hybrid_cpu_device::device_reset() { - m_reg_P = HP_RESET_ADDR; - m_reg_I = RM(m_reg_P); - m_flags = 0; + m_reg_P = HP_RESET_ADDR; + m_reg_I = RM(m_reg_P); + m_flags = 0; } void hp_hybrid_cpu_device::execute_run() { - do { - debugger_instruction_hook(this, m_reg_P); + do { + debugger_instruction_hook(this, m_reg_P); - // Check for interrupts - check_for_interrupts(); + // Check for interrupts + check_for_interrupts(); - // TODO: check dma - m_reg_I = execute_one(m_reg_I); - } while (m_icount > 0); + // TODO: check dma + m_reg_I = execute_one(m_reg_I); + } while (m_icount > 0); } void hp_hybrid_cpu_device::execute_set_input(int inputnum, int state) { - if (inputnum < HPHYBRID_INT_LVLS) { - if (state) { - BIT_SET(m_flags , HPHYBRID_IRH_BIT + inputnum); - } else { - BIT_CLR(m_flags , HPHYBRID_IRH_BIT + inputnum); - } - } + if (inputnum < HPHYBRID_INT_LVLS) { + if (state) { + BIT_SET(m_flags , HPHYBRID_IRH_BIT + inputnum); + } else { + BIT_CLR(m_flags , HPHYBRID_IRH_BIT + inputnum); + } + } } /** @@ -157,14 +157,14 @@ void hp_hybrid_cpu_device::execute_set_input(int inputnum, int state) */ UINT16 hp_hybrid_cpu_device::execute_one(UINT16 opcode) { - if ((opcode & 0x7fe0) == 0x7000) { - // EXE - m_icount -= 8; - return RM(opcode & 0x1f); - } else { - m_reg_P = execute_one_sub(opcode); - return RM(m_reg_P); - } + if ((opcode & 0x7fe0) == 0x7000) { + // EXE + m_icount -= 8; + return RM(opcode & 0x1f); + } else { + m_reg_P = execute_one_sub(opcode); + return RM(m_reg_P); + } } /** @@ -176,747 +176,747 @@ UINT16 hp_hybrid_cpu_device::execute_one(UINT16 opcode) */ UINT16 hp_hybrid_cpu_device::execute_one_sub(UINT16 opcode) { - UINT16 ea; - UINT16 tmp; - - switch (opcode & 0x7800) { - case 0x0000: - // LDA - m_icount -= 13; - m_reg_A = RM(get_ea(opcode)); - break; - - case 0x0800: - // LDB - m_icount -= 13; - m_reg_B = RM(get_ea(opcode)); - break; - - case 0x1000: - // CPA - m_icount -= 16; - if (m_reg_A != RM(get_ea(opcode))) { - // Skip next instruction - return m_reg_P + 2; - } - break; - - case 0x1800: - // CPB - m_icount -= 16; - if (m_reg_B != RM(get_ea(opcode))) { - // Skip next instruction - return m_reg_P + 2; - } - break; - - case 0x2000: - // ADA - m_icount -= 13; - do_add(m_reg_A , RM(get_ea(opcode))); - break; - - case 0x2800: - // ADB - m_icount -= 13; - do_add(m_reg_B , RM(get_ea(opcode))); - break; - - case 0x3000: - // STA - m_icount -= 13; - WM(get_ea(opcode) , m_reg_A); - break; - - case 0x3800: - // STB - m_icount -= 13; - WM(get_ea(opcode) , m_reg_B); - break; - - case 0x4000: - // JSM - m_icount -= 17; - WM(++m_reg_R , m_reg_P); - return get_ea(opcode); - - case 0x4800: - // ISZ - m_icount -= 19; - ea = get_ea(opcode); - tmp = RM(ea) + 1; - WM(ea , tmp); - if (tmp == 0) { - // Skip next instruction - return m_reg_P + 2; - } - break; - - case 0x5000: - // AND - m_icount -= 13; - m_reg_A &= RM(get_ea(opcode)); - break; - - case 0x5800: - // DSZ - m_icount -= 19; - ea = get_ea(opcode); - tmp = RM(ea) - 1; - WM(ea , tmp); - if (tmp == 0) { - // Skip next instruction - return m_reg_P + 2; - } - break; - - case 0x6000: - // IOR - m_icount -= 13; - m_reg_A |= RM(get_ea(opcode)); - break; - - case 0x6800: - // JMP - m_icount -= 8; - return get_ea(opcode); - - default: - switch (opcode & 0xfec0) { - case 0x7400: - // RZA - // SZA - m_icount -= 14; - return get_skip_addr(opcode , m_reg_A == 0); - - case 0x7440: - // RIA - // SIA - m_icount -= 14; - return get_skip_addr(opcode , m_reg_A++ == 0); - - case 0x7480: - // SFS - // SFC - m_icount -= 14; - // TODO: read flag bit - return get_skip_addr(opcode , true); - - case 0x7C00: - // RZB - // SZB - m_icount -= 14; - return get_skip_addr(opcode , m_reg_B == 0); - - case 0x7C40: - // RIB - // SIB - m_icount -= 14; - return get_skip_addr(opcode , m_reg_B++ == 0); - - case 0x7c80: - // SSS - // SSC - m_icount -= 14; - // TODO: read status bit - return get_skip_addr(opcode , true); - - case 0x7cc0: - // SHS - // SHC - m_icount -= 14; - return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_HALT_BIT)); - - default: - switch (opcode & 0xfe00) { - case 0x7600: - // SLA - // RLA - m_icount -= 14; - return get_skip_addr_sc(opcode , m_reg_A , 0); - - case 0x7e00: - // SLB - // RLB - m_icount -= 14; - return get_skip_addr_sc(opcode , m_reg_B , 0); - - case 0xf400: - // SAP - // SAM - m_icount -= 14; - return get_skip_addr_sc(opcode , m_reg_A , 15); - - case 0xf600: - // SOC - // SOS - m_icount -= 14; - return get_skip_addr_sc(opcode , m_flags , HPHYBRID_O_BIT); - - case 0xfc00: - // SBP - // SBM - m_icount -= 14; - return get_skip_addr_sc(opcode , m_reg_B , 15); - - case 0xfe00: - // SEC - // SES - m_icount -= 14; - return get_skip_addr_sc(opcode , m_flags , HPHYBRID_C_BIT); - - default: - switch (opcode & 0xfff0) { - case 0xf100: - // AAR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - // A shift by 16 positions is equivalent to a shift by 15 - tmp = tmp > 15 ? 15 : tmp; - m_reg_A = ((m_reg_A ^ 0x8000) >> tmp) - (0x8000 >> tmp); - break; - - case 0xf900: - // ABR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - tmp = tmp > 15 ? 15 : tmp; - m_reg_B = ((m_reg_B ^ 0x8000) >> tmp) - (0x8000 >> tmp); - break; - - case 0xf140: - // SAR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_A >>= tmp; - break; - - case 0xf940: - // SBR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_B >>= tmp; - break; - - case 0xf180: - // SAL - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_A <<= tmp; - break; - - case 0xf980: - // SBL - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_B <<= tmp; - break; - - case 0xf1c0: - // RAR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_A = (m_reg_A >> tmp) | (m_reg_A << (16 - tmp)); - break; - - case 0xf9c0: - // RBR - tmp = (opcode & 0xf) + 1; - m_icount -= (9 + tmp); - m_reg_B = (m_reg_B >> tmp) | (m_reg_B << (16 - tmp)); - break; - - default: - if ((opcode & 0xf760) == 0x7160) { - // Place/withdraw instructions - m_icount -= 23; - do_pw(opcode); - } else if ((opcode & 0xff80) == 0xf080) { - // RET - m_icount -= 16; - if (BIT(opcode , 6)) { - // Pop PA stack - if (BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) { - BIT_CLR(m_flags , HPHYBRID_IRH_SVC_BIT); - memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS); - } else if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { - BIT_CLR(m_flags , HPHYBRID_IRL_SVC_BIT); - memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS); - } - } - tmp = RM(m_reg_R--) + (opcode & 0x1f); - return BIT(opcode , 5) ? tmp - 0x20 : tmp; - } else { - switch (opcode) { - case 0x7100: - // SDO - m_icount -= 12; - BIT_SET(m_flags , HPHYBRID_DMADIR_BIT); - break; - - case 0x7108: - // SDI - m_icount -= 12; - BIT_CLR(m_flags , HPHYBRID_DMADIR_BIT); - break; - - case 0x7110: - // EIR - m_icount -= 12; - BIT_SET(m_flags , HPHYBRID_INTEN_BIT); - break; - - case 0x7118: - // DIR - m_icount -= 12; - BIT_CLR(m_flags , HPHYBRID_INTEN_BIT); - break; - - case 0x7120: - // DMA - m_icount -= 12; - BIT_SET(m_flags , HPHYBRID_DMAEN_BIT); - break; - - case 0x7138: - // DDR - m_icount -= 12; - BIT_CLR(m_flags , HPHYBRID_DMAEN_BIT); - break; - - case 0x7140: - // DBL - m_icount -= 12; - BIT_CLR(m_flags , HPHYBRID_DB_BIT); - break; - - case 0x7148: - // CBL - m_icount -= 12; - BIT_CLR(m_flags , HPHYBRID_CB_BIT); - break; - - case 0x7150: - // DBU - m_icount -= 12; - BIT_SET(m_flags , HPHYBRID_DB_BIT); - break; - - case 0x7158: - // CBU - m_icount -= 12; - BIT_SET(m_flags , HPHYBRID_CB_BIT); - break; - - case 0xf020: - // TCA - m_icount -= 9; - m_reg_A = ~m_reg_A; - do_add(m_reg_A , 1); - break; - - case 0xf060: - // CMA - m_icount -= 9; - m_reg_A = ~m_reg_A; - break; - - case 0xf820: - // TCB - m_icount -= 9; - m_reg_B = ~m_reg_B; - do_add(m_reg_B , 1); - break; - - case 0xf860: - // CMB - m_icount -= 9; - m_reg_B = ~m_reg_B; - break; - - default: - // Unrecognized instructions: NOP - // Execution time is fictional - m_icount -= 6; - } - } - } - } - } - } - - return m_reg_P + 1; + UINT16 ea; + UINT16 tmp; + + switch (opcode & 0x7800) { + case 0x0000: + // LDA + m_icount -= 13; + m_reg_A = RM(get_ea(opcode)); + break; + + case 0x0800: + // LDB + m_icount -= 13; + m_reg_B = RM(get_ea(opcode)); + break; + + case 0x1000: + // CPA + m_icount -= 16; + if (m_reg_A != RM(get_ea(opcode))) { + // Skip next instruction + return m_reg_P + 2; + } + break; + + case 0x1800: + // CPB + m_icount -= 16; + if (m_reg_B != RM(get_ea(opcode))) { + // Skip next instruction + return m_reg_P + 2; + } + break; + + case 0x2000: + // ADA + m_icount -= 13; + do_add(m_reg_A , RM(get_ea(opcode))); + break; + + case 0x2800: + // ADB + m_icount -= 13; + do_add(m_reg_B , RM(get_ea(opcode))); + break; + + case 0x3000: + // STA + m_icount -= 13; + WM(get_ea(opcode) , m_reg_A); + break; + + case 0x3800: + // STB + m_icount -= 13; + WM(get_ea(opcode) , m_reg_B); + break; + + case 0x4000: + // JSM + m_icount -= 17; + WM(++m_reg_R , m_reg_P); + return get_ea(opcode); + + case 0x4800: + // ISZ + m_icount -= 19; + ea = get_ea(opcode); + tmp = RM(ea) + 1; + WM(ea , tmp); + if (tmp == 0) { + // Skip next instruction + return m_reg_P + 2; + } + break; + + case 0x5000: + // AND + m_icount -= 13; + m_reg_A &= RM(get_ea(opcode)); + break; + + case 0x5800: + // DSZ + m_icount -= 19; + ea = get_ea(opcode); + tmp = RM(ea) - 1; + WM(ea , tmp); + if (tmp == 0) { + // Skip next instruction + return m_reg_P + 2; + } + break; + + case 0x6000: + // IOR + m_icount -= 13; + m_reg_A |= RM(get_ea(opcode)); + break; + + case 0x6800: + // JMP + m_icount -= 8; + return get_ea(opcode); + + default: + switch (opcode & 0xfec0) { + case 0x7400: + // RZA + // SZA + m_icount -= 14; + return get_skip_addr(opcode , m_reg_A == 0); + + case 0x7440: + // RIA + // SIA + m_icount -= 14; + return get_skip_addr(opcode , m_reg_A++ == 0); + + case 0x7480: + // SFS + // SFC + m_icount -= 14; + // TODO: read flag bit + return get_skip_addr(opcode , true); + + case 0x7C00: + // RZB + // SZB + m_icount -= 14; + return get_skip_addr(opcode , m_reg_B == 0); + + case 0x7C40: + // RIB + // SIB + m_icount -= 14; + return get_skip_addr(opcode , m_reg_B++ == 0); + + case 0x7c80: + // SSS + // SSC + m_icount -= 14; + // TODO: read status bit + return get_skip_addr(opcode , true); + + case 0x7cc0: + // SHS + // SHC + m_icount -= 14; + return get_skip_addr(opcode , !BIT(m_flags , HPHYBRID_HALT_BIT)); + + default: + switch (opcode & 0xfe00) { + case 0x7600: + // SLA + // RLA + m_icount -= 14; + return get_skip_addr_sc(opcode , m_reg_A , 0); + + case 0x7e00: + // SLB + // RLB + m_icount -= 14; + return get_skip_addr_sc(opcode , m_reg_B , 0); + + case 0xf400: + // SAP + // SAM + m_icount -= 14; + return get_skip_addr_sc(opcode , m_reg_A , 15); + + case 0xf600: + // SOC + // SOS + m_icount -= 14; + return get_skip_addr_sc(opcode , m_flags , HPHYBRID_O_BIT); + + case 0xfc00: + // SBP + // SBM + m_icount -= 14; + return get_skip_addr_sc(opcode , m_reg_B , 15); + + case 0xfe00: + // SEC + // SES + m_icount -= 14; + return get_skip_addr_sc(opcode , m_flags , HPHYBRID_C_BIT); + + default: + switch (opcode & 0xfff0) { + case 0xf100: + // AAR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + // A shift by 16 positions is equivalent to a shift by 15 + tmp = tmp > 15 ? 15 : tmp; + m_reg_A = ((m_reg_A ^ 0x8000) >> tmp) - (0x8000 >> tmp); + break; + + case 0xf900: + // ABR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + tmp = tmp > 15 ? 15 : tmp; + m_reg_B = ((m_reg_B ^ 0x8000) >> tmp) - (0x8000 >> tmp); + break; + + case 0xf140: + // SAR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_A >>= tmp; + break; + + case 0xf940: + // SBR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_B >>= tmp; + break; + + case 0xf180: + // SAL + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_A <<= tmp; + break; + + case 0xf980: + // SBL + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_B <<= tmp; + break; + + case 0xf1c0: + // RAR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_A = (m_reg_A >> tmp) | (m_reg_A << (16 - tmp)); + break; + + case 0xf9c0: + // RBR + tmp = (opcode & 0xf) + 1; + m_icount -= (9 + tmp); + m_reg_B = (m_reg_B >> tmp) | (m_reg_B << (16 - tmp)); + break; + + default: + if ((opcode & 0xf760) == 0x7160) { + // Place/withdraw instructions + m_icount -= 23; + do_pw(opcode); + } else if ((opcode & 0xff80) == 0xf080) { + // RET + m_icount -= 16; + if (BIT(opcode , 6)) { + // Pop PA stack + if (BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) { + BIT_CLR(m_flags , HPHYBRID_IRH_SVC_BIT); + memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS); + } else if (BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { + BIT_CLR(m_flags , HPHYBRID_IRL_SVC_BIT); + memmove(&m_reg_PA[ 0 ] , &m_reg_PA[ 1 ] , HPHYBRID_INT_LVLS); + } + } + tmp = RM(m_reg_R--) + (opcode & 0x1f); + return BIT(opcode , 5) ? tmp - 0x20 : tmp; + } else { + switch (opcode) { + case 0x7100: + // SDO + m_icount -= 12; + BIT_SET(m_flags , HPHYBRID_DMADIR_BIT); + break; + + case 0x7108: + // SDI + m_icount -= 12; + BIT_CLR(m_flags , HPHYBRID_DMADIR_BIT); + break; + + case 0x7110: + // EIR + m_icount -= 12; + BIT_SET(m_flags , HPHYBRID_INTEN_BIT); + break; + + case 0x7118: + // DIR + m_icount -= 12; + BIT_CLR(m_flags , HPHYBRID_INTEN_BIT); + break; + + case 0x7120: + // DMA + m_icount -= 12; + BIT_SET(m_flags , HPHYBRID_DMAEN_BIT); + break; + + case 0x7138: + // DDR + m_icount -= 12; + BIT_CLR(m_flags , HPHYBRID_DMAEN_BIT); + break; + + case 0x7140: + // DBL + m_icount -= 12; + BIT_CLR(m_flags , HPHYBRID_DB_BIT); + break; + + case 0x7148: + // CBL + m_icount -= 12; + BIT_CLR(m_flags , HPHYBRID_CB_BIT); + break; + + case 0x7150: + // DBU + m_icount -= 12; + BIT_SET(m_flags , HPHYBRID_DB_BIT); + break; + + case 0x7158: + // CBU + m_icount -= 12; + BIT_SET(m_flags , HPHYBRID_CB_BIT); + break; + + case 0xf020: + // TCA + m_icount -= 9; + m_reg_A = ~m_reg_A; + do_add(m_reg_A , 1); + break; + + case 0xf060: + // CMA + m_icount -= 9; + m_reg_A = ~m_reg_A; + break; + + case 0xf820: + // TCB + m_icount -= 9; + m_reg_B = ~m_reg_B; + do_add(m_reg_B , 1); + break; + + case 0xf860: + // CMB + m_icount -= 9; + m_reg_B = ~m_reg_B; + break; + + default: + // Unrecognized instructions: NOP + // Execution time is fictional + m_icount -= 6; + } + } + } + } + } + } + + return m_reg_P + 1; } void hp_hybrid_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { - if (entry.index() == STATE_GENFLAGS) { - strprintf(str, "%s %s %c %c", - BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..", - BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..", - BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.', - BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.'); - } + if (entry.index() == STATE_GENFLAGS) { + strprintf(str, "%s %s %c %c", + BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..", + BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..", + BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.', + BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.'); + } } offs_t hp_hybrid_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { - extern CPU_DISASSEMBLE(hp_hybrid); - return CPU_DISASSEMBLE_NAME(hp_hybrid)(this, buffer, pc, oprom, opram, options); + extern CPU_DISASSEMBLE(hp_hybrid); + return CPU_DISASSEMBLE_NAME(hp_hybrid)(this, buffer, pc, oprom, opram, options); } UINT16 hp_hybrid_cpu_device::get_ea(UINT16 opcode) { - UINT16 base; - UINT16 off; - - if (BIT(opcode , 10)) { - // Current page - base = m_reg_P; - } else { - // Base page - base = 0; - } - - off = opcode & 0x3ff; - if (off & 0x200) { - off -= 0x400; - } - - base += off; - - if (BIT(opcode , 15)) { - // Indirect addressing - m_icount -= 6; - return RM(base); - } else { - // Direct addressing - return base; - } + UINT16 base; + UINT16 off; + + if (BIT(opcode , 10)) { + // Current page + base = m_reg_P; + } else { + // Base page + base = 0; + } + + off = opcode & 0x3ff; + if (off & 0x200) { + off -= 0x400; + } + + base += off; + + if (BIT(opcode , 15)) { + // Indirect addressing + m_icount -= 6; + return RM(base); + } else { + // Direct addressing + return base; + } } void hp_hybrid_cpu_device::do_add(UINT16& addend1 , UINT16 addend2) { - UINT32 tmp = addend1 + addend2; + UINT32 tmp = addend1 + addend2; - if (BIT(tmp , 16)) { - // Carry - BIT_SET(m_flags , HPHYBRID_C_BIT); - } + if (BIT(tmp , 16)) { + // Carry + BIT_SET(m_flags , HPHYBRID_C_BIT); + } - if (BIT((tmp ^ addend1) & (tmp ^ addend2) , 15)) { - // Overflow - BIT_SET(m_flags , HPHYBRID_O_BIT); - } + if (BIT((tmp ^ addend1) & (tmp ^ addend2) , 15)) { + // Overflow + BIT_SET(m_flags , HPHYBRID_O_BIT); + } - addend1 = (UINT16)tmp; + addend1 = (UINT16)tmp; } UINT16 hp_hybrid_cpu_device::get_skip_addr(UINT16 opcode , bool condition) const { - bool skip_val = BIT(opcode , 8) != 0; - - if (condition == skip_val) { - UINT16 off = opcode & 0x1f; - - if (BIT(opcode , 5)) { - off -= 0x20; - } - return m_reg_P + off; - } else { - return m_reg_P + 1; - } + bool skip_val = BIT(opcode , 8) != 0; + + if (condition == skip_val) { + UINT16 off = opcode & 0x1f; + + if (BIT(opcode , 5)) { + off -= 0x20; + } + return m_reg_P + off; + } else { + return m_reg_P + 1; + } } UINT16 hp_hybrid_cpu_device::get_skip_addr_sc(UINT16 opcode , UINT16& v , unsigned n) { - bool val = BIT(v , n); + bool val = BIT(v , n); - if (BIT(opcode , 7)) { - if (BIT(opcode , 6)) { - BIT_SET(v , n); - } else { - BIT_CLR(v , n); - } - } + if (BIT(opcode , 7)) { + if (BIT(opcode , 6)) { + BIT_SET(v , n); + } else { + BIT_CLR(v , n); + } + } - return get_skip_addr(opcode , val); + return get_skip_addr(opcode , val); } void hp_hybrid_cpu_device::do_pw(UINT16 opcode) { - UINT16 tmp; - UINT16 reg_addr = opcode & 7; - UINT16 *ptr_reg; - UINT16 b_mask; - - if (BIT(opcode , 3)) { - ptr_reg = &m_reg_D; - b_mask = BIT_MASK(HPHYBRID_DB_BIT); - } else { - ptr_reg = &m_reg_C; - b_mask = BIT_MASK(HPHYBRID_CB_BIT); - } - - if (BIT(opcode , 4)) { - // Withdraw - if (BIT(opcode , 11)) { - // Byte - UINT32 tmp_addr = (UINT32)(*ptr_reg); - if (m_flags & b_mask) { - tmp_addr |= 0x10000; - } - tmp = RM((UINT16)(tmp_addr >> 1)); - if (BIT(tmp_addr , 0)) { - tmp &= 0xff; - } else { - tmp >>= 8; - } - } else { - // Word - tmp = RM(*ptr_reg); - } - WM(reg_addr , tmp); - - if (BIT(opcode , 7)) { - // Post-decrement - if ((*ptr_reg)-- == 0) { - m_flags ^= b_mask; - } - } else { - // Post-increment - if (++(*ptr_reg) == 0) { - m_flags ^= b_mask; - } - } - } else { - // Place - if (BIT(opcode , 7)) { - // Pre-decrement - if ((*ptr_reg)-- == 0) { - m_flags ^= b_mask; - } - } else { - // Pre-increment - if (++(*ptr_reg) == 0) { - m_flags ^= b_mask; - } - } - tmp = RM(reg_addr); - if (BIT(opcode , 11)) { - // Byte - UINT32 tmp_addr = (UINT32)(*ptr_reg); - if (m_flags & b_mask) { - tmp_addr |= 0x10000; - } - WMB(tmp_addr , (UINT8)tmp); - } else { - // Word - WM(*ptr_reg , tmp); - } - } + UINT16 tmp; + UINT16 reg_addr = opcode & 7; + UINT16 *ptr_reg; + UINT16 b_mask; + + if (BIT(opcode , 3)) { + ptr_reg = &m_reg_D; + b_mask = BIT_MASK(HPHYBRID_DB_BIT); + } else { + ptr_reg = &m_reg_C; + b_mask = BIT_MASK(HPHYBRID_CB_BIT); + } + + if (BIT(opcode , 4)) { + // Withdraw + if (BIT(opcode , 11)) { + // Byte + UINT32 tmp_addr = (UINT32)(*ptr_reg); + if (m_flags & b_mask) { + tmp_addr |= 0x10000; + } + tmp = RM((UINT16)(tmp_addr >> 1)); + if (BIT(tmp_addr , 0)) { + tmp &= 0xff; + } else { + tmp >>= 8; + } + } else { + // Word + tmp = RM(*ptr_reg); + } + WM(reg_addr , tmp); + + if (BIT(opcode , 7)) { + // Post-decrement + if ((*ptr_reg)-- == 0) { + m_flags ^= b_mask; + } + } else { + // Post-increment + if (++(*ptr_reg) == 0) { + m_flags ^= b_mask; + } + } + } else { + // Place + if (BIT(opcode , 7)) { + // Pre-decrement + if ((*ptr_reg)-- == 0) { + m_flags ^= b_mask; + } + } else { + // Pre-increment + if (++(*ptr_reg) == 0) { + m_flags ^= b_mask; + } + } + tmp = RM(reg_addr); + if (BIT(opcode , 11)) { + // Byte + UINT32 tmp_addr = (UINT32)(*ptr_reg); + if (m_flags & b_mask) { + tmp_addr |= 0x10000; + } + WMB(tmp_addr , (UINT8)tmp); + } else { + // Word + WM(*ptr_reg , tmp); + } + } } void hp_hybrid_cpu_device::check_for_interrupts(void) { - if (!BIT(m_flags , HPHYBRID_INTEN_BIT) || BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) { - return; - } - - int irqline; - - if (BIT(m_flags , HPHYBRID_IRH_BIT)) { - // Service high-level interrupt - BIT_SET(m_flags , HPHYBRID_IRH_SVC_BIT); - irqline = HPHYBRID_IRH; - } else if (BIT(m_flags , HPHYBRID_IRL_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { - // Service low-level interrupt - BIT_SET(m_flags , HPHYBRID_IRL_SVC_BIT); - irqline = HPHYBRID_IRL; - } else { - return; - } - - // Get interrupt vector in low byte - UINT8 vector = (UINT8)standard_irq_callback(irqline); - UINT8 new_PA; - - // Get highest numbered 1 - // Don't know what happens if vector is 0, here we assume bit 7 = 1 - if (vector == 0) { - new_PA = 7; - } else { - for (new_PA = 7; new_PA && !BIT(vector , 7); new_PA--, vector <<= 1) { - } - } - if (irqline == HPHYBRID_IRH) { - BIT_SET(new_PA , 3); - } - - // Push PA stack - memmove(&m_reg_PA[ 1 ] , &m_reg_PA[ 0 ] , HPHYBRID_INT_LVLS); - - CURRENT_PA = new_PA; - - // Is this correct? Patent @ pg 210 suggests that the whole interrupt recognition sequence - // lasts for 32 cycles (6 are already accounted for in get_ea for one indirection) - m_icount -= 26; - - // Do a double-indirect JSM IV,I instruction - WM(++m_reg_R , m_reg_P); - m_reg_P = RM(get_ea(0xc008)); - m_reg_I = RM(m_reg_P); + if (!BIT(m_flags , HPHYBRID_INTEN_BIT) || BIT(m_flags , HPHYBRID_IRH_SVC_BIT)) { + return; + } + + int irqline; + + if (BIT(m_flags , HPHYBRID_IRH_BIT)) { + // Service high-level interrupt + BIT_SET(m_flags , HPHYBRID_IRH_SVC_BIT); + irqline = HPHYBRID_IRH; + } else if (BIT(m_flags , HPHYBRID_IRL_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { + // Service low-level interrupt + BIT_SET(m_flags , HPHYBRID_IRL_SVC_BIT); + irqline = HPHYBRID_IRL; + } else { + return; + } + + // Get interrupt vector in low byte + UINT8 vector = (UINT8)standard_irq_callback(irqline); + UINT8 new_PA; + + // Get highest numbered 1 + // Don't know what happens if vector is 0, here we assume bit 7 = 1 + if (vector == 0) { + new_PA = 7; + } else { + for (new_PA = 7; new_PA && !BIT(vector , 7); new_PA--, vector <<= 1) { + } + } + if (irqline == HPHYBRID_IRH) { + BIT_SET(new_PA , 3); + } + + // Push PA stack + memmove(&m_reg_PA[ 1 ] , &m_reg_PA[ 0 ] , HPHYBRID_INT_LVLS); + + CURRENT_PA = new_PA; + + // Is this correct? Patent @ pg 210 suggests that the whole interrupt recognition sequence + // lasts for 32 cycles (6 are already accounted for in get_ea for one indirection) + m_icount -= 26; + + // Do a double-indirect JSM IV,I instruction + WM(++m_reg_R , m_reg_P); + m_reg_P = RM(get_ea(0xc008)); + m_reg_I = RM(m_reg_P); } UINT16 hp_hybrid_cpu_device::RM(UINT16 addr) { - UINT16 tmp; - - if (addr <= HP_REG_LAST_ADDR) { - // Memory mapped registers - switch (addr) { - case HP_REG_A_ADDR: - return m_reg_A; - - case HP_REG_B_ADDR: - return m_reg_B; - - case HP_REG_P_ADDR: - return m_reg_P; - - case HP_REG_R_ADDR: - return m_reg_R; - - case HP_REG_R4_ADDR: - case HP_REG_R5_ADDR: - case HP_REG_R6_ADDR: - case HP_REG_R7_ADDR: - return RIO(CURRENT_PA , addr - HP_REG_R4_ADDR); - - case HP_REG_IV_ADDR: - // Correct? - if (!BIT(m_flags , HPHYBRID_IRH_SVC_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { - return m_reg_IV; - } else { - return m_reg_IV | CURRENT_PA; - } - - case HP_REG_PA_ADDR: - return CURRENT_PA; - - case HP_REG_DMAPA_ADDR: - tmp = m_dmapa & HP_REG_PA_MASK; - if (BIT(m_flags , HPHYBRID_CB_BIT)) { - BIT_SET(tmp , 15); - } - if (BIT(m_flags , HPHYBRID_DB_BIT)) { - BIT_SET(tmp , 14); - } - return tmp; - - case HP_REG_DMAMA_ADDR: - return m_dmama; - - case HP_REG_DMAC_ADDR: - return m_dmac; - - case HP_REG_C_ADDR: - return m_reg_C; - - case HP_REG_D_ADDR: - return m_reg_D; - - default: - // Unknown registers are returned as 0 - return 0; - } - } else { - return m_direct->read_decrypted_word((offs_t)addr << 1); - } + UINT16 tmp; + + if (addr <= HP_REG_LAST_ADDR) { + // Memory mapped registers + switch (addr) { + case HP_REG_A_ADDR: + return m_reg_A; + + case HP_REG_B_ADDR: + return m_reg_B; + + case HP_REG_P_ADDR: + return m_reg_P; + + case HP_REG_R_ADDR: + return m_reg_R; + + case HP_REG_R4_ADDR: + case HP_REG_R5_ADDR: + case HP_REG_R6_ADDR: + case HP_REG_R7_ADDR: + return RIO(CURRENT_PA , addr - HP_REG_R4_ADDR); + + case HP_REG_IV_ADDR: + // Correct? + if (!BIT(m_flags , HPHYBRID_IRH_SVC_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { + return m_reg_IV; + } else { + return m_reg_IV | CURRENT_PA; + } + + case HP_REG_PA_ADDR: + return CURRENT_PA; + + case HP_REG_DMAPA_ADDR: + tmp = m_dmapa & HP_REG_PA_MASK; + if (BIT(m_flags , HPHYBRID_CB_BIT)) { + BIT_SET(tmp , 15); + } + if (BIT(m_flags , HPHYBRID_DB_BIT)) { + BIT_SET(tmp , 14); + } + return tmp; + + case HP_REG_DMAMA_ADDR: + return m_dmama; + + case HP_REG_DMAC_ADDR: + return m_dmac; + + case HP_REG_C_ADDR: + return m_reg_C; + + case HP_REG_D_ADDR: + return m_reg_D; + + default: + // Unknown registers are returned as 0 + return 0; + } + } else { + return m_direct->read_word((offs_t)addr << 1); + } } void hp_hybrid_cpu_device::WM(UINT16 addr , UINT16 v) { - if (addr <= HP_REG_LAST_ADDR) { - // Memory mapped registers - switch (addr) { - case HP_REG_A_ADDR: - m_reg_A = v; - break; - - case HP_REG_B_ADDR: - m_reg_B = v; - break; - - case HP_REG_P_ADDR: - m_reg_P = v; - break; - - case HP_REG_R_ADDR: - m_reg_R = v; - break; - - case HP_REG_R4_ADDR: - case HP_REG_R5_ADDR: - case HP_REG_R6_ADDR: - case HP_REG_R7_ADDR: - WIO(CURRENT_PA , addr - HP_REG_R4_ADDR , v); - break; - - case HP_REG_IV_ADDR: - m_reg_IV = v & HP_REG_IV_MASK; - break; - - case HP_REG_PA_ADDR: - CURRENT_PA = v & HP_REG_PA_MASK; - break; - - case HP_REG_DMAPA_ADDR: - m_dmapa = v & HP_REG_PA_MASK; - break; - - case HP_REG_DMAMA_ADDR: - m_dmama = v; - break; - - case HP_REG_DMAC_ADDR: - m_dmac = v; - break; - - case HP_REG_C_ADDR: - m_reg_C = v; - break; - - case HP_REG_D_ADDR: - m_reg_D = v; - break; - - default: - // Unknown registers are silently discarded - break; - } - } else { - m_program->write_word((offs_t)addr << 1 , v); - } + if (addr <= HP_REG_LAST_ADDR) { + // Memory mapped registers + switch (addr) { + case HP_REG_A_ADDR: + m_reg_A = v; + break; + + case HP_REG_B_ADDR: + m_reg_B = v; + break; + + case HP_REG_P_ADDR: + m_reg_P = v; + break; + + case HP_REG_R_ADDR: + m_reg_R = v; + break; + + case HP_REG_R4_ADDR: + case HP_REG_R5_ADDR: + case HP_REG_R6_ADDR: + case HP_REG_R7_ADDR: + WIO(CURRENT_PA , addr - HP_REG_R4_ADDR , v); + break; + + case HP_REG_IV_ADDR: + m_reg_IV = v & HP_REG_IV_MASK; + break; + + case HP_REG_PA_ADDR: + CURRENT_PA = v & HP_REG_PA_MASK; + break; + + case HP_REG_DMAPA_ADDR: + m_dmapa = v & HP_REG_PA_MASK; + break; + + case HP_REG_DMAMA_ADDR: + m_dmama = v; + break; + + case HP_REG_DMAC_ADDR: + m_dmac = v; + break; + + case HP_REG_C_ADDR: + m_reg_C = v; + break; + + case HP_REG_D_ADDR: + m_reg_D = v; + break; + + default: + // Unknown registers are silently discarded + break; + } + } else { + m_program->write_word((offs_t)addr << 1 , v); + } } void hp_hybrid_cpu_device::WMB(UINT32 addr , UINT8 v) { - if (addr <= (HP_REG_LAST_ADDR * 2 + 1)) { - // Cannot write bytes to registers - } else { - m_program->write_byte(addr , v); - } + if (addr <= (HP_REG_LAST_ADDR * 2 + 1)) { + // Cannot write bytes to registers + } else { + m_program->write_byte(addr , v); + } } UINT16 hp_hybrid_cpu_device::RIO(UINT8 pa , UINT8 ic) { - return m_io->read_word(HP_MAKE_IOADDR(pa, ic) << 1); + return m_io->read_word(HP_MAKE_IOADDR(pa, ic) << 1); } void hp_hybrid_cpu_device::WIO(UINT8 pa , UINT8 ic , UINT16 v) { - m_io->write_word(HP_MAKE_IOADDR(pa, ic) << 1 , v); + m_io->write_word(HP_MAKE_IOADDR(pa, ic) << 1 , v); } hp_5061_3011_cpu_device::hp_5061_3011_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/emu/cpu/hphybrid/hphybrid.h b/src/emu/cpu/hphybrid/hphybrid.h index 1d24a1cfd14..a4f7d3a1c79 100644 --- a/src/emu/cpu/hphybrid/hphybrid.h +++ b/src/emu/cpu/hphybrid/hphybrid.h @@ -24,7 +24,7 @@ // Input lines #define HPHYBRID_IRH 0 // High-level interrupt #define HPHYBRID_IRL 1 // Low-level interrupt -#define HPHYBRID_INT_LVLS 2 // Levels of interrupt +#define HPHYBRID_INT_LVLS 2 // Levels of interrupt #define HPHYBRID_DMAR 2 // DMA request #define HPHYBRID_HALT 3 // "Halt" input @@ -66,76 +66,76 @@ class hp_hybrid_cpu_device : public cpu_device { public: protected: - hp_hybrid_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_execute_interface overrides - virtual UINT32 execute_min_cycles() const { return 6; } - virtual UINT32 execute_max_cycles() const { return 25; } - virtual UINT32 execute_input_lines() const { return 2; } - virtual UINT32 execute_default_irq_vector() const { return 0xffff; } - virtual void execute_run(); - virtual void execute_set_input(int inputnum, int state); - - UINT16 execute_one(UINT16 opcode); - UINT16 execute_one_sub(UINT16 opcode); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } - - // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str); - - // device_disasm_interface overrides - virtual UINT32 disasm_min_opcode_bytes() const { return 2; } - virtual UINT32 disasm_max_opcode_bytes() const { return 2; } - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + hp_hybrid_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_execute_interface overrides + virtual UINT32 execute_min_cycles() const { return 6; } + virtual UINT32 execute_max_cycles() const { return 25; } + virtual UINT32 execute_input_lines() const { return 2; } + virtual UINT32 execute_default_irq_vector() const { return 0xffff; } + virtual void execute_run(); + virtual void execute_set_input(int inputnum, int state); + + UINT16 execute_one(UINT16 opcode); + UINT16 execute_one_sub(UINT16 opcode); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } + + // device_state_interface overrides + void state_string_export(const device_state_entry &entry, std::string &str); + + // device_disasm_interface overrides + virtual UINT32 disasm_min_opcode_bytes() const { return 2; } + virtual UINT32 disasm_max_opcode_bytes() const { return 2; } + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); private: - address_space_config m_program_config; - address_space_config m_io_config; - - address_space *m_program; - direct_read_data *m_direct; - address_space *m_io; - int m_icount; - - // State of processor - UINT16 m_reg_A; // Register A - UINT16 m_reg_B; // Register B - UINT16 m_reg_P; // Register P - UINT16 m_reg_R; // Register R - UINT16 m_reg_C; // Register C - UINT16 m_reg_D; // Register D - UINT16 m_reg_IV; // Register IV - UINT8 m_reg_PA[ HPHYBRID_INT_LVLS + 1 ]; // Stack of register PA (4 bit-long) - UINT16 m_flags; // Flags (carry, overflow, cb, db, int en, dma en, dma dir) - UINT8 m_dmapa; // DMA peripheral address (4 bits) - UINT16 m_dmama; // DMA address - UINT16 m_dmac; // DMA counter - UINT16 m_reg_I; // Instruction register - - UINT16 get_ea(UINT16 opcode); - void do_add(UINT16& addend1 , UINT16 addend2); - UINT16 get_skip_addr(UINT16 opcode , bool condition) const; - UINT16 get_skip_addr_sc(UINT16 opcode , UINT16& v , unsigned n); - void do_pw(UINT16 opcode); - void check_for_interrupts(void); - - UINT16 RM(UINT16 addr); - void WM(UINT16 addr , UINT16 v); - void WMB(UINT32 addr , UINT8 v); - UINT16 RIO(UINT8 pa , UINT8 ic); - void WIO(UINT8 pa , UINT8 ic , UINT16 v); + address_space_config m_program_config; + address_space_config m_io_config; + + address_space *m_program; + direct_read_data *m_direct; + address_space *m_io; + int m_icount; + + // State of processor + UINT16 m_reg_A; // Register A + UINT16 m_reg_B; // Register B + UINT16 m_reg_P; // Register P + UINT16 m_reg_R; // Register R + UINT16 m_reg_C; // Register C + UINT16 m_reg_D; // Register D + UINT16 m_reg_IV; // Register IV + UINT8 m_reg_PA[ HPHYBRID_INT_LVLS + 1 ]; // Stack of register PA (4 bit-long) + UINT16 m_flags; // Flags (carry, overflow, cb, db, int en, dma en, dma dir) + UINT8 m_dmapa; // DMA peripheral address (4 bits) + UINT16 m_dmama; // DMA address + UINT16 m_dmac; // DMA counter + UINT16 m_reg_I; // Instruction register + + UINT16 get_ea(UINT16 opcode); + void do_add(UINT16& addend1 , UINT16 addend2); + UINT16 get_skip_addr(UINT16 opcode , bool condition) const; + UINT16 get_skip_addr_sc(UINT16 opcode , UINT16& v , unsigned n); + void do_pw(UINT16 opcode); + void check_for_interrupts(void); + + UINT16 RM(UINT16 addr); + void WM(UINT16 addr , UINT16 v); + void WMB(UINT32 addr , UINT8 v); + UINT16 RIO(UINT8 pa , UINT8 ic); + void WIO(UINT8 pa , UINT8 ic , UINT16 v); }; class hp_5061_3011_cpu_device : public hp_hybrid_cpu_device { public: - hp_5061_3011_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + hp_5061_3011_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; extern const device_type HP_5061_3011; diff --git a/src/emu/cpu/hphybrid/hphybrid_dasm.c b/src/emu/cpu/hphybrid/hphybrid_dasm.c index a74fb69963f..e9eddf49a96 100644 --- a/src/emu/cpu/hphybrid/hphybrid_dasm.c +++ b/src/emu/cpu/hphybrid/hphybrid_dasm.c @@ -11,84 +11,84 @@ typedef void (*fn_dis_param)(char *buffer , offs_t pc , UINT16 opcode); typedef struct { - UINT16 m_op_mask; - UINT16 m_opcode; - const char *m_mnemonic; - fn_dis_param m_param_fn; - UINT32 m_dasm_flags; + UINT16 m_op_mask; + UINT16 m_opcode; + const char *m_mnemonic; + fn_dis_param m_param_fn; + UINT32 m_dasm_flags; } dis_entry_t; static void addr_2_str(char *buffer , UINT16 addr , bool indirect) { - char *s = buffer + strlen(buffer); + char *s = buffer + strlen(buffer); - s += sprintf(s , "$%04x" , addr); + s += sprintf(s , "$%04x" , addr); - switch (addr) { - case HP_REG_A_ADDR: - strcpy(s , "(A)"); - break; + switch (addr) { + case HP_REG_A_ADDR: + strcpy(s , "(A)"); + break; - case HP_REG_B_ADDR: - strcpy(s , "(B)"); - break; + case HP_REG_B_ADDR: + strcpy(s , "(B)"); + break; - case HP_REG_P_ADDR: - strcpy(s , "(P)"); - break; + case HP_REG_P_ADDR: + strcpy(s , "(P)"); + break; - case HP_REG_R_ADDR: - strcpy(s , "(R)"); - break; + case HP_REG_R_ADDR: + strcpy(s , "(R)"); + break; - case HP_REG_R4_ADDR: - strcpy(s , "(R4)"); - break; + case HP_REG_R4_ADDR: + strcpy(s , "(R4)"); + break; - case HP_REG_R5_ADDR: - strcpy(s , "(R5)"); - break; + case HP_REG_R5_ADDR: + strcpy(s , "(R5)"); + break; - case HP_REG_R6_ADDR: - strcpy(s , "(R6)"); - break; + case HP_REG_R6_ADDR: + strcpy(s , "(R6)"); + break; - case HP_REG_R7_ADDR: - strcpy(s , "(R7)"); - break; + case HP_REG_R7_ADDR: + strcpy(s , "(R7)"); + break; - case HP_REG_IV_ADDR: - strcpy(s , "(IV)"); - break; + case HP_REG_IV_ADDR: + strcpy(s , "(IV)"); + break; - case HP_REG_PA_ADDR: - strcpy(s , "(PA)"); - break; + case HP_REG_PA_ADDR: + strcpy(s , "(PA)"); + break; - case HP_REG_DMAPA_ADDR: - strcpy(s , "(DMAPA)"); - break; + case HP_REG_DMAPA_ADDR: + strcpy(s , "(DMAPA)"); + break; - case HP_REG_DMAMA_ADDR: - strcpy(s , "(DMAMA)"); - break; + case HP_REG_DMAMA_ADDR: + strcpy(s , "(DMAMA)"); + break; - case HP_REG_DMAC_ADDR: - strcpy(s , "(DMAC)"); - break; + case HP_REG_DMAC_ADDR: + strcpy(s , "(DMAC)"); + break; - case HP_REG_C_ADDR: - strcpy(s , "(C)"); - break; + case HP_REG_C_ADDR: + strcpy(s , "(C)"); + break; - case HP_REG_D_ADDR: - strcpy(s , "(D)"); - break; - } + case HP_REG_D_ADDR: + strcpy(s , "(D)"); + break; + } - if (indirect) { - strcat(s , ",I"); - } + if (indirect) { + strcat(s , ",I"); + } } static void param_none(char *buffer , offs_t pc , UINT16 opcode) @@ -97,185 +97,185 @@ static void param_none(char *buffer , offs_t pc , UINT16 opcode) static void param_loc(char *buffer , offs_t pc , UINT16 opcode) { - UINT16 base; - UINT16 off; - - if (opcode & 0x0400) { - // Current page - base = pc; - } else { - // Base page - base = 0; - } - - off = opcode & 0x3ff; - if (off & 0x200) { - off -= 0x400; - } - - addr_2_str(buffer , base + off , (opcode & 0x8000) != 0); + UINT16 base; + UINT16 off; + + if (opcode & 0x0400) { + // Current page + base = pc; + } else { + // Base page + base = 0; + } + + off = opcode & 0x3ff; + if (off & 0x200) { + off -= 0x400; + } + + addr_2_str(buffer , base + off , (opcode & 0x8000) != 0); } static void param_addr32(char *buffer , offs_t pc , UINT16 opcode) { - addr_2_str(buffer , opcode & 0x1f , (opcode & 0x8000) != 0); + addr_2_str(buffer , opcode & 0x1f , (opcode & 0x8000) != 0); } static void param_skip(char *buffer , offs_t pc , UINT16 opcode) { - UINT16 off = opcode & 0x3f; - if (off & 0x20) { - off -= 0x40; - } - addr_2_str(buffer , pc + off , false); + UINT16 off = opcode & 0x3f; + if (off & 0x20) { + off -= 0x40; + } + addr_2_str(buffer , pc + off , false); } static void param_skip_sc(char *buffer , offs_t pc , UINT16 opcode) { - param_skip(buffer, pc, opcode); - - if (opcode & 0x80) { - if (opcode & 0x40) { - strcat(buffer , ",S"); - } else { - strcat(buffer , ",C"); - } - } + param_skip(buffer, pc, opcode); + + if (opcode & 0x80) { + if (opcode & 0x40) { + strcat(buffer , ",S"); + } else { + strcat(buffer , ",C"); + } + } } static void param_ret(char *buffer , offs_t pc , UINT16 opcode) { - char *s = buffer + strlen(buffer); + char *s = buffer + strlen(buffer); - int off = opcode & 0x3f; + int off = opcode & 0x3f; - if (off & 0x20) { - off -= 0x40; - } + if (off & 0x20) { + off -= 0x40; + } - s += sprintf(s , "%d" , off); - if (opcode & 0x40) { - strcpy(s , ",P"); - } + s += sprintf(s , "%d" , off); + if (opcode & 0x40) { + strcpy(s , ",P"); + } } static void param_n16(char *buffer , offs_t pc , UINT16 opcode) { - char *s = buffer + strlen(buffer); + char *s = buffer + strlen(buffer); - sprintf(s , "%u" , (opcode & 0xf) + 1); + sprintf(s , "%u" , (opcode & 0xf) + 1); } static void param_reg_id(char *buffer , offs_t pc , UINT16 opcode) { - addr_2_str(buffer, opcode & 7, false); + addr_2_str(buffer, opcode & 7, false); - if (opcode & 0x80) { - strcat(buffer , ",D"); - } else { - strcat(buffer , ",I"); - } + if (opcode & 0x80) { + strcat(buffer , ",D"); + } else { + strcat(buffer , ",I"); + } } static const dis_entry_t dis_table[] = { - // *** BPC Instructions *** - {0xffff , 0x0000 , "NOP" , param_none , 0 }, - {0x7800 , 0x0000 , "LDA" , param_loc , 0 }, - {0x7800 , 0x0800 , "LDB" , param_loc , 0 }, - {0x7800 , 0x1000 , "CPA" , param_loc , 0 }, - {0x7800 , 0x1800 , "CPB" , param_loc , 0 }, - {0x7800 , 0x2000 , "ADA" , param_loc , 0 }, - {0x7800 , 0x2800 , "ADB" , param_loc , 0 }, - {0x7800 , 0x3000 , "STA" , param_loc , 0 }, - {0x7800 , 0x3800 , "STB" , param_loc , 0 }, - {0x7800 , 0x4000 , "JSM" , param_loc , DASMFLAG_STEP_OVER }, - {0x7800 , 0x4800 , "ISZ" , param_loc , 0 }, - {0x7800 , 0x5000 , "AND" , param_loc , 0 }, - {0x7800 , 0x5800 , "DSZ" , param_loc , 0 }, - {0x7800 , 0x6000 , "IOR" , param_loc , 0 }, - {0x7800 , 0x6800 , "JMP" , param_loc , 0 }, - {0x7fe0 , 0x7000 , "EXE" , param_addr32 , 0 }, - {0xffc0 , 0x7400 , "RZA" , param_skip , 0 }, - {0xffc0 , 0x7C00 , "RZB" , param_skip , 0 }, - {0xffc0 , 0x7440 , "RIA" , param_skip , 0 }, - {0xffc0 , 0x7C40 , "RIB" , param_skip , 0 }, - {0xffc0 , 0x7500 , "SZA" , param_skip , 0 }, - {0xffc0 , 0x7D00 , "SZB" , param_skip , 0 }, - {0xffc0 , 0x7540 , "SIA" , param_skip , 0 }, - {0xffc0 , 0x7D40 , "SIB" , param_skip , 0 }, - {0xffc0 , 0x7480 , "SFS" , param_skip , 0 }, - {0xffc0 , 0x7580 , "SFC" , param_skip , 0 }, - {0xffc0 , 0x7c80 , "SSS" , param_skip , 0 }, - {0xffc0 , 0x7d80 , "SSC" , param_skip , 0 }, - {0xffc0 , 0x7cc0 , "SHS" , param_skip , 0 }, - {0xffc0 , 0x7dc0 , "SHC" , param_skip , 0 }, - {0xff00 , 0x7600 , "SLA" , param_skip_sc , 0 }, - {0xff00 , 0x7e00 , "SLB" , param_skip_sc , 0 }, - {0xff00 , 0x7700 , "RLA" , param_skip_sc , 0 }, - {0xff00 , 0x7f00 , "RLB" , param_skip_sc , 0 }, - {0xff00 , 0xf400 , "SAP" , param_skip_sc , 0 }, - {0xff00 , 0xfc00 , "SBP" , param_skip_sc , 0 }, - {0xff00 , 0xf500 , "SAM" , param_skip_sc , 0 }, - {0xff00 , 0xfd00 , "SBM" , param_skip_sc , 0 }, - {0xff00 , 0xf600 , "SOC" , param_skip_sc , 0 }, - {0xff00 , 0xf700 , "SOS" , param_skip_sc , 0 }, - {0xff00 , 0xfe00 , "SEC" , param_skip_sc , 0 }, - {0xff00 , 0xff00 , "SES" , param_skip_sc , 0 }, - {0xffff , 0xf020 , "TCA" , param_none , 0 }, - {0xffff , 0xf820 , "TCB" , param_none , 0 }, - {0xffff , 0xf060 , "CMA" , param_none , 0 }, - {0xffff , 0xf860 , "CMB" , param_none , 0 }, - {0xff80 , 0xf080 , "RET" , param_ret , DASMFLAG_STEP_OUT }, - {0xfff0 , 0xf100 , "AAR" , param_n16 , 0 }, - {0xfff0 , 0xf900 , "ABR" , param_n16 , 0 }, - {0xffff , 0xf14f , "CLA" , param_none , 0 }, - {0xfff0 , 0xf140 , "SAR" , param_n16 , 0 }, - {0xffff , 0xf94f , "CLB" , param_none , 0 }, - {0xfff0 , 0xf940 , "SBR" , param_n16 , 0 }, - {0xfff0 , 0xf180 , "SAL" , param_n16 , 0 }, - {0xfff0 , 0xf980 , "SBL" , param_n16 , 0 }, - {0xfff0 , 0xf1c0 , "RAR" , param_n16 , 0 }, - {0xfff0 , 0xf9c0 , "RBR" , param_n16 , 0 }, - // *** IOC Instructions *** - {0xffff , 0x7100 , "SDO" , param_none , 0 }, - {0xffff , 0x7108 , "SDI" , param_none , 0 }, - {0xffff , 0x7110 , "EIR" , param_none , 0 }, - {0xffff , 0x7118 , "DIR" , param_none , 0 }, - {0xffff , 0x7120 , "DMA" , param_none , 0 }, - {0xffff , 0x7128 , "PCM" , param_none , 0 }, - {0xffff , 0x7138 , "DDR" , param_none , 0 }, - {0xffff , 0x7140 , "DBL" , param_none , 0 }, - {0xffff , 0x7148 , "CBL" , param_none , 0 }, - {0xffff , 0x7150 , "DBU" , param_none , 0 }, - {0xffff , 0x7158 , "CBU" , param_none , 0 }, - {0xff78 , 0x7160 , "PWC" , param_reg_id , 0 }, - {0xff78 , 0x7168 , "PWD" , param_reg_id , 0 }, - {0xff78 , 0x7960 , "PBC" , param_reg_id , 0 }, - {0xff78 , 0x7968 , "PBD" , param_reg_id , 0 }, - {0xff78 , 0x7170 , "WWC" , param_reg_id , 0 }, - {0xff78 , 0x7178 , "WWD" , param_reg_id , 0 }, - {0xff78 , 0x7970 , "WBC" , param_reg_id , 0 }, - {0xff78 , 0x7978 , "WBD" , param_reg_id , 0 }, - // *** END *** - {0 , 0 , NULL , NULL , 0 } + // *** BPC Instructions *** + {0xffff , 0x0000 , "NOP" , param_none , 0 }, + {0x7800 , 0x0000 , "LDA" , param_loc , 0 }, + {0x7800 , 0x0800 , "LDB" , param_loc , 0 }, + {0x7800 , 0x1000 , "CPA" , param_loc , 0 }, + {0x7800 , 0x1800 , "CPB" , param_loc , 0 }, + {0x7800 , 0x2000 , "ADA" , param_loc , 0 }, + {0x7800 , 0x2800 , "ADB" , param_loc , 0 }, + {0x7800 , 0x3000 , "STA" , param_loc , 0 }, + {0x7800 , 0x3800 , "STB" , param_loc , 0 }, + {0x7800 , 0x4000 , "JSM" , param_loc , DASMFLAG_STEP_OVER }, + {0x7800 , 0x4800 , "ISZ" , param_loc , 0 }, + {0x7800 , 0x5000 , "AND" , param_loc , 0 }, + {0x7800 , 0x5800 , "DSZ" , param_loc , 0 }, + {0x7800 , 0x6000 , "IOR" , param_loc , 0 }, + {0x7800 , 0x6800 , "JMP" , param_loc , 0 }, + {0x7fe0 , 0x7000 , "EXE" , param_addr32 , 0 }, + {0xffc0 , 0x7400 , "RZA" , param_skip , 0 }, + {0xffc0 , 0x7C00 , "RZB" , param_skip , 0 }, + {0xffc0 , 0x7440 , "RIA" , param_skip , 0 }, + {0xffc0 , 0x7C40 , "RIB" , param_skip , 0 }, + {0xffc0 , 0x7500 , "SZA" , param_skip , 0 }, + {0xffc0 , 0x7D00 , "SZB" , param_skip , 0 }, + {0xffc0 , 0x7540 , "SIA" , param_skip , 0 }, + {0xffc0 , 0x7D40 , "SIB" , param_skip , 0 }, + {0xffc0 , 0x7480 , "SFS" , param_skip , 0 }, + {0xffc0 , 0x7580 , "SFC" , param_skip , 0 }, + {0xffc0 , 0x7c80 , "SSS" , param_skip , 0 }, + {0xffc0 , 0x7d80 , "SSC" , param_skip , 0 }, + {0xffc0 , 0x7cc0 , "SHS" , param_skip , 0 }, + {0xffc0 , 0x7dc0 , "SHC" , param_skip , 0 }, + {0xff00 , 0x7600 , "SLA" , param_skip_sc , 0 }, + {0xff00 , 0x7e00 , "SLB" , param_skip_sc , 0 }, + {0xff00 , 0x7700 , "RLA" , param_skip_sc , 0 }, + {0xff00 , 0x7f00 , "RLB" , param_skip_sc , 0 }, + {0xff00 , 0xf400 , "SAP" , param_skip_sc , 0 }, + {0xff00 , 0xfc00 , "SBP" , param_skip_sc , 0 }, + {0xff00 , 0xf500 , "SAM" , param_skip_sc , 0 }, + {0xff00 , 0xfd00 , "SBM" , param_skip_sc , 0 }, + {0xff00 , 0xf600 , "SOC" , param_skip_sc , 0 }, + {0xff00 , 0xf700 , "SOS" , param_skip_sc , 0 }, + {0xff00 , 0xfe00 , "SEC" , param_skip_sc , 0 }, + {0xff00 , 0xff00 , "SES" , param_skip_sc , 0 }, + {0xffff , 0xf020 , "TCA" , param_none , 0 }, + {0xffff , 0xf820 , "TCB" , param_none , 0 }, + {0xffff , 0xf060 , "CMA" , param_none , 0 }, + {0xffff , 0xf860 , "CMB" , param_none , 0 }, + {0xff80 , 0xf080 , "RET" , param_ret , DASMFLAG_STEP_OUT }, + {0xfff0 , 0xf100 , "AAR" , param_n16 , 0 }, + {0xfff0 , 0xf900 , "ABR" , param_n16 , 0 }, + {0xffff , 0xf14f , "CLA" , param_none , 0 }, + {0xfff0 , 0xf140 , "SAR" , param_n16 , 0 }, + {0xffff , 0xf94f , "CLB" , param_none , 0 }, + {0xfff0 , 0xf940 , "SBR" , param_n16 , 0 }, + {0xfff0 , 0xf180 , "SAL" , param_n16 , 0 }, + {0xfff0 , 0xf980 , "SBL" , param_n16 , 0 }, + {0xfff0 , 0xf1c0 , "RAR" , param_n16 , 0 }, + {0xfff0 , 0xf9c0 , "RBR" , param_n16 , 0 }, + // *** IOC Instructions *** + {0xffff , 0x7100 , "SDO" , param_none , 0 }, + {0xffff , 0x7108 , "SDI" , param_none , 0 }, + {0xffff , 0x7110 , "EIR" , param_none , 0 }, + {0xffff , 0x7118 , "DIR" , param_none , 0 }, + {0xffff , 0x7120 , "DMA" , param_none , 0 }, + {0xffff , 0x7128 , "PCM" , param_none , 0 }, + {0xffff , 0x7138 , "DDR" , param_none , 0 }, + {0xffff , 0x7140 , "DBL" , param_none , 0 }, + {0xffff , 0x7148 , "CBL" , param_none , 0 }, + {0xffff , 0x7150 , "DBU" , param_none , 0 }, + {0xffff , 0x7158 , "CBU" , param_none , 0 }, + {0xff78 , 0x7160 , "PWC" , param_reg_id , 0 }, + {0xff78 , 0x7168 , "PWD" , param_reg_id , 0 }, + {0xff78 , 0x7960 , "PBC" , param_reg_id , 0 }, + {0xff78 , 0x7968 , "PBD" , param_reg_id , 0 }, + {0xff78 , 0x7170 , "WWC" , param_reg_id , 0 }, + {0xff78 , 0x7178 , "WWD" , param_reg_id , 0 }, + {0xff78 , 0x7970 , "WBC" , param_reg_id , 0 }, + {0xff78 , 0x7978 , "WBD" , param_reg_id , 0 }, + // *** END *** + {0 , 0 , NULL , NULL , 0 } }; CPU_DISASSEMBLE(hp_hybrid) { - UINT16 opcode = ((UINT16)oprom[ 0 ] << 8) | oprom[ 1 ]; - const dis_entry_t *p; - - for (p = dis_table; p->m_op_mask; p++) { - if ((opcode & p->m_op_mask) == p->m_opcode) { - strcpy(buffer , p->m_mnemonic); - strcat(buffer , " "); - p->m_param_fn(buffer , pc , opcode); - return 1 | p->m_dasm_flags | DASMFLAG_SUPPORTED; - } - } - - // Unknown opcode - strcpy(buffer , "???"); - - return 1 | DASMFLAG_SUPPORTED; + UINT16 opcode = ((UINT16)oprom[ 0 ] << 8) | oprom[ 1 ]; + const dis_entry_t *p; + + for (p = dis_table; p->m_op_mask; p++) { + if ((opcode & p->m_op_mask) == p->m_opcode) { + strcpy(buffer , p->m_mnemonic); + strcat(buffer , " "); + p->m_param_fn(buffer , pc , opcode); + return 1 | p->m_dasm_flags | DASMFLAG_SUPPORTED; + } + } + + // Unknown opcode + strcpy(buffer , "???"); + + return 1 | DASMFLAG_SUPPORTED; } diff --git a/src/emu/cpu/i386/i386priv.h b/src/emu/cpu/i386/i386priv.h index c7bb5d6ffb5..138079a5fae 100644 --- a/src/emu/cpu/i386/i386priv.h +++ b/src/emu/cpu/i386/i386priv.h @@ -543,7 +543,7 @@ UINT8 i386_device::FETCH() if(!translate_address(m_CPL,TRANSLATE_FETCH,&address,&error)) PF_THROW(error); - value = m_direct->read_decrypted_byte(address & m_a20_mask); + value = m_direct->read_byte(address & m_a20_mask); #ifdef DEBUG_MISSING_OPCODE m_opcode_bytes[m_opcode_bytes_length] = value; m_opcode_bytes_length = (m_opcode_bytes_length + 1) & 15; @@ -564,7 +564,7 @@ UINT16 i386_device::FETCH16() if(!translate_address(m_CPL,TRANSLATE_FETCH,&address,&error)) PF_THROW(error); address &= m_a20_mask; - value = m_direct->read_decrypted_word(address); + value = m_direct->read_word(address); m_eip += 2; m_pc += 2; } @@ -585,7 +585,7 @@ UINT32 i386_device::FETCH32() PF_THROW(error); address &= m_a20_mask; - value = m_direct->read_decrypted_dword(address); + value = m_direct->read_dword(address); m_eip += 4; m_pc += 4; } diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c index 23b1721df3a..c6e65cb27ee 100644 --- a/src/emu/cpu/i4004/i4004.c +++ b/src/emu/cpu/i4004/i4004.c @@ -36,7 +36,7 @@ i4004_cpu_device::i4004_cpu_device(const machine_config &mconfig, const char *ta UINT8 i4004_cpu_device::ROP() { - UINT8 retVal = m_direct->read_decrypted_byte(GET_PC.w.l); + UINT8 retVal = m_direct->read_byte(GET_PC.w.l); GET_PC.w.l = (GET_PC.w.l + 1) & 0x0fff; m_PC = GET_PC; return retVal; @@ -44,7 +44,7 @@ UINT8 i4004_cpu_device::ROP() UINT8 i4004_cpu_device::READ_ROM() { - return m_direct->read_decrypted_byte((GET_PC.w.l & 0x0f00) | m_R[0]); + return m_direct->read_byte((GET_PC.w.l & 0x0f00) | m_R[0]); } void i4004_cpu_device::WPM() @@ -56,7 +56,7 @@ void i4004_cpu_device::WPM() UINT8 i4004_cpu_device::ARG() { - UINT8 retVal = m_direct->read_raw_byte(GET_PC.w.l); + UINT8 retVal = m_direct->read_byte(GET_PC.w.l); GET_PC.w.l = (GET_PC.w.l + 1) & 0x0fff; m_PC = GET_PC; return retVal; diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c index 2bb5b9cf4b7..551c2d09006 100644 --- a/src/emu/cpu/i8008/i8008.c +++ b/src/emu/cpu/i8008/i8008.c @@ -620,7 +620,7 @@ inline void i8008_device::pop_stack() inline UINT8 i8008_device::rop() { - UINT8 retVal = m_direct->read_decrypted_byte(GET_PC.w.l); + UINT8 retVal = m_direct->read_byte(GET_PC.w.l); GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff; m_PC = GET_PC; return retVal; @@ -658,7 +658,7 @@ inline void i8008_device::set_reg(UINT8 reg, UINT8 val) inline UINT8 i8008_device::arg() { - UINT8 retVal = m_direct->read_raw_byte(GET_PC.w.l); + UINT8 retVal = m_direct->read_byte(GET_PC.w.l); GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff; m_PC = GET_PC; return retVal; diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index 904c4d3771d..3e278f64d6c 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -293,20 +293,20 @@ void i8085a_cpu_device::break_halt_for_interrupt() UINT8 i8085a_cpu_device::ROP() { set_status(0xa2); // instruction fetch - return m_direct->read_decrypted_byte(m_PC.w.l++); + return m_direct->read_byte(m_PC.w.l++); } UINT8 i8085a_cpu_device::ARG() { - return m_direct->read_raw_byte(m_PC.w.l++); + return m_direct->read_byte(m_PC.w.l++); } UINT16 i8085a_cpu_device::ARG16() { UINT16 w; - w = m_direct->read_raw_byte(m_PC.d); + w = m_direct->read_byte(m_PC.d); m_PC.w.l++; - w += m_direct->read_raw_byte(m_PC.d) << 8; + w += m_direct->read_byte(m_PC.d) << 8; m_PC.w.l++; return w; } diff --git a/src/emu/cpu/i86/i186.c b/src/emu/cpu/i86/i186.c index 9bc8c222fa5..072d70a95bb 100644 --- a/src/emu/cpu/i86/i186.c +++ b/src/emu/cpu/i86/i186.c @@ -155,14 +155,14 @@ i80186_cpu_device::i80186_cpu_device(const machine_config &mconfig, device_type UINT8 i80186_cpu_device::fetch_op() { - UINT8 data = m_direct->read_decrypted_byte(pc(), m_fetch_xor); + UINT8 data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; } UINT8 i80186_cpu_device::fetch() { - UINT8 data = m_direct->read_raw_byte(pc(), m_fetch_xor); + UINT8 data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; } diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c index 0c45370255b..e6314b9cf83 100644 --- a/src/emu/cpu/i86/i286.c +++ b/src/emu/cpu/i86/i286.c @@ -965,7 +965,7 @@ UINT8 i80286_cpu_device::fetch_op() if(m_ip > m_limit[CS]) throw TRAP(FAULT_GP, 0); - data = m_direct->read_decrypted_byte( pc() & m_amask, m_fetch_xor ); + data = m_direct->read_byte( pc() & m_amask, m_fetch_xor ); m_ip++; return data; } @@ -976,7 +976,7 @@ UINT8 i80286_cpu_device::fetch() if(m_ip > m_limit[CS]) throw TRAP(FAULT_GP, 0); - data = m_direct->read_raw_byte( pc() & m_amask, m_fetch_xor ); + data = m_direct->read_byte( pc() & m_amask, m_fetch_xor ); m_ip++; return data; } diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c index 299d85b1f59..9c8d5a75465 100644 --- a/src/emu/cpu/i86/i86.c +++ b/src/emu/cpu/i86/i86.c @@ -116,7 +116,7 @@ i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, device_type ty UINT8 i8086_cpu_device::fetch_op() { UINT8 data; - data = m_direct->read_decrypted_byte(pc(), m_fetch_xor); + data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; } @@ -124,7 +124,7 @@ UINT8 i8086_cpu_device::fetch_op() UINT8 i8086_cpu_device::fetch() { UINT8 data; - data = m_direct->read_raw_byte(pc(), m_fetch_xor); + data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; } @@ -1915,9 +1915,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op) break; case 0xe4: // i_inal - if (m_lock) m_lock_handler(1); + if (m_lock) m_lock_handler(1); m_regs.b[AL] = read_port_byte( fetch() ); - if (m_lock) { m_lock_handler(0); m_lock = false; } + if (m_lock) { m_lock_handler(0); m_lock = false; } CLK(IN_IMM8); break; diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c index 4dd29e45940..8b00a58d4c6 100644 --- a/src/emu/cpu/i960/i960.c +++ b/src/emu/cpu/i960/i960.c @@ -109,22 +109,22 @@ UINT32 i960_cpu_device::get_ea(UINT32 opcode) return m_r[abase] + (m_r[index] << scale); case 0xc: - ret = m_direct->read_decrypted_dword(m_IP); + ret = m_direct->read_dword(m_IP); m_IP += 4; return ret; case 0xd: - ret = m_direct->read_decrypted_dword(m_IP) + m_r[abase]; + ret = m_direct->read_dword(m_IP) + m_r[abase]; m_IP += 4; return ret; case 0xe: - ret = m_direct->read_decrypted_dword(m_IP) + (m_r[index] << scale); + ret = m_direct->read_dword(m_IP) + (m_r[index] << scale); m_IP += 4; return ret; case 0xf: - ret = m_direct->read_decrypted_dword(m_IP) + m_r[abase] + (m_r[index] << scale); + ret = m_direct->read_dword(m_IP) + m_r[abase] + (m_r[index] << scale); m_IP += 4; return ret; @@ -1932,7 +1932,7 @@ void i960_cpu_device::execute_run() m_bursting = 0; - opcode = m_direct->read_decrypted_dword(m_IP); + opcode = m_direct->read_dword(m_IP); m_IP += 4; execute_op(opcode); diff --git a/src/emu/cpu/ie15/ie15.c b/src/emu/cpu/ie15/ie15.c index c2e3356432b..7843eb428a5 100644 --- a/src/emu/cpu/ie15/ie15.c +++ b/src/emu/cpu/ie15/ie15.c @@ -414,14 +414,14 @@ inline void ie15_device::execute_one(int opcode) inline UINT8 ie15_device::rop() { - UINT8 retVal = m_direct->read_decrypted_byte(m_PC.w.l); + UINT8 retVal = m_direct->read_byte(m_PC.w.l); m_PC.w.l = (m_PC.w.l + 1) & 0x0fff; return retVal; } inline UINT8 ie15_device::arg() { - UINT8 retVal = m_direct->read_raw_byte(m_PC.w.l); + UINT8 retVal = m_direct->read_byte(m_PC.w.l); return retVal; } diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index 6c1dd97b821..976ab4f5983 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -137,7 +137,7 @@ const jaguar_cpu_device::op_func jaguar_cpu_device::dsp_op_table[64] = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) (m_direct->read_decrypted_word(pc, WORD_XOR_BE(0))) +#define ROPCODE(pc) (m_direct->read_word(pc, WORD_XOR_BE(0))) const device_type JAGUARGPU = &device_creator<jaguargpu_cpu_device>; diff --git a/src/emu/cpu/lc8670/lc8670.c b/src/emu/cpu/lc8670/lc8670.c index ac1fd1960d1..96bcfaa0348 100644 --- a/src/emu/cpu/lc8670/lc8670.c +++ b/src/emu/cpu/lc8670/lc8670.c @@ -1071,7 +1071,7 @@ WRITE8_MEMBER(lc8670_cpu_device::regs_w) inline UINT8 lc8670_cpu_device::fetch() { - UINT8 data = m_direct->read_decrypted_byte(m_pc); + UINT8 data = m_direct->read_byte(m_pc); set_pc(m_pc + 1); diff --git a/src/emu/cpu/lh5801/5801tbl.inc b/src/emu/cpu/lh5801/5801tbl.inc index 352e0d64d05..98a8d7b1d02 100644 --- a/src/emu/cpu/lh5801/5801tbl.inc +++ b/src/emu/cpu/lh5801/5801tbl.inc @@ -26,8 +26,8 @@ UINT8 lh5801_cpu_device::lh5801_add_generic(int left, int right, int carry) UINT16 lh5801_cpu_device::lh5801_readop_word() { UINT16 r; - r=m_direct->read_decrypted_byte(P++)<<8; - r|=m_direct->read_decrypted_byte(P++); + r=m_direct->read_byte(P++)<<8; + r|=m_direct->read_byte(P++); return r; } @@ -221,7 +221,7 @@ void lh5801_cpu_device::lh5801_jmp(UINT16 adr) void lh5801_cpu_device::lh5801_branch_plus(int doit) { - UINT8 t=m_direct->read_decrypted_byte(P++); + UINT8 t=m_direct->read_byte(P++); if (doit) { m_icount-=3; P+=t; @@ -230,7 +230,7 @@ void lh5801_cpu_device::lh5801_branch_plus(int doit) void lh5801_cpu_device::lh5801_branch_minus(int doit) { - UINT8 t=m_direct->read_decrypted_byte(P++); + UINT8 t=m_direct->read_byte(P++); if (doit) { m_icount-=3; P-=t; @@ -239,7 +239,7 @@ void lh5801_cpu_device::lh5801_branch_minus(int doit) void lh5801_cpu_device::lh5801_lop() { - UINT8 t=m_direct->read_decrypted_byte(P++); + UINT8 t=m_direct->read_byte(P++); m_icount-=8; if (UL--) { m_icount-=3; @@ -355,7 +355,7 @@ void lh5801_cpu_device::lh5801_instruction_fd() int oper; int adr; - oper=m_direct->read_decrypted_byte(P++); + oper=m_direct->read_byte(P++); switch (oper) { case 0x01: lh5801_sbc(m_io->read_byte(X)); m_icount-=11;break; case 0x03: lh5801_adc(m_io->read_byte(X)); m_icount-=11;break; @@ -396,29 +396,29 @@ void lh5801_cpu_device::lh5801_instruction_fd() case 0x40: lh5801_inc(&XH);m_icount-=9;break; case 0x42: lh5801_dec(&XH);m_icount-=9;break; case 0x48: X=S;m_icount-=11;break; - case 0x49: lh5801_and_mem(*m_io, X, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x49: lh5801_and_mem(*m_io, X, m_direct->read_byte(P++)); m_icount-=17;break; case 0x4a: X=X;m_icount-=11;break; //!!! - case 0x4b: lh5801_ora_mem(*m_io, X, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x4b: lh5801_ora_mem(*m_io, X, m_direct->read_byte(P++)); m_icount-=17;break; case 0x4c: m_bf=0;/*off !*/ m_icount-=8;break; - case 0x4d: lh5801_bit(m_io->read_byte(X), m_direct->read_decrypted_byte(P++));m_icount-=14;break; + case 0x4d: lh5801_bit(m_io->read_byte(X), m_direct->read_byte(P++));m_icount-=14;break; case 0x4e: S=X;m_icount-=11;break; - case 0x4f: lh5801_add_mem(*m_io, X, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x4f: lh5801_add_mem(*m_io, X, m_direct->read_byte(P++)); m_icount-=17;break; case 0x50: lh5801_inc(&YH);m_icount-=9;break; case 0x52: lh5801_dec(&YH);m_icount-=9;break; case 0x58: X=P;m_icount-=11;break; - case 0x59: lh5801_and_mem(*m_io, Y, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x59: lh5801_and_mem(*m_io, Y, m_direct->read_byte(P++)); m_icount-=17;break; case 0x5a: Y=X;m_icount-=11;break; - case 0x5b: lh5801_ora_mem(*m_io, Y, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; - case 0x5d: lh5801_bit(m_io->read_byte(Y), m_direct->read_decrypted_byte(P++));m_icount-=14;break; + case 0x5b: lh5801_ora_mem(*m_io, Y, m_direct->read_byte(P++)); m_icount-=17;break; + case 0x5d: lh5801_bit(m_io->read_byte(Y), m_direct->read_byte(P++));m_icount-=14;break; case 0x5e: lh5801_jmp(X);m_icount-=11;break; // P=X - case 0x5f: lh5801_add_mem(*m_io, Y, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x5f: lh5801_add_mem(*m_io, Y, m_direct->read_byte(P++)); m_icount-=17;break; case 0x60: lh5801_inc(&UH);m_icount-=9;break; case 0x62: lh5801_dec(&UH);m_icount-=9;break; - case 0x69: lh5801_and_mem(*m_io, U, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x69: lh5801_and_mem(*m_io, U, m_direct->read_byte(P++)); m_icount-=17;break; case 0x6a: U=X;m_icount-=11;break; - case 0x6b: lh5801_ora_mem(*m_io, U, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; - case 0x6d: lh5801_bit(m_io->read_byte(X), m_direct->read_decrypted_byte(P++));m_icount-=14;break; - case 0x6f: lh5801_add_mem(*m_io, U, m_direct->read_decrypted_byte(P++)); m_icount-=17;break; + case 0x6b: lh5801_ora_mem(*m_io, U, m_direct->read_byte(P++)); m_icount-=17;break; + case 0x6d: lh5801_bit(m_io->read_byte(X), m_direct->read_byte(P++));m_icount-=14;break; + case 0x6f: lh5801_add_mem(*m_io, U, m_direct->read_byte(P++)); m_icount-=17;break; case 0x81: m_t|=IE; /*sie !*/m_icount-=8;break; case 0x88: lh5801_push_word(X); m_icount-=14;break; case 0x8a: lh5801_pop(); m_icount-=12; break; @@ -454,20 +454,20 @@ void lh5801_cpu_device::lh5801_instruction_fd() case 0xea: lh5801_adr(&m_u);m_icount-=11;break; case 0xe9: adr=lh5801_readop_word(); - lh5801_and_mem(*m_io, adr, m_direct->read_decrypted_byte(P++)); m_icount-=23; + lh5801_and_mem(*m_io, adr, m_direct->read_byte(P++)); m_icount-=23; break; case 0xeb: adr=lh5801_readop_word(); - lh5801_ora_mem(*m_io, adr, m_direct->read_decrypted_byte(P++)); m_icount-=23; + lh5801_ora_mem(*m_io, adr, m_direct->read_byte(P++)); m_icount-=23; break; case 0xec: m_t=m_a; m_icount-=9;break; case 0xed: adr=lh5801_readop_word(); - lh5801_bit(m_io->read_byte(adr), m_direct->read_decrypted_byte(P++)); + lh5801_bit(m_io->read_byte(adr), m_direct->read_byte(P++)); m_icount-=20;break; case 0xef: adr=lh5801_readop_word(); - lh5801_add_mem(*m_io, adr, m_direct->read_decrypted_byte(P++)); m_icount-=23; + lh5801_add_mem(*m_io, adr, m_direct->read_byte(P++)); m_icount-=23; break; default: @@ -480,7 +480,7 @@ void lh5801_cpu_device::lh5801_instruction() int oper; int adr; - oper=m_direct->read_decrypted_byte(P++); + oper=m_direct->read_byte(P++); switch (oper) { case 0x00: lh5801_sbc(XL); m_icount-=6;break; case 0x01: lh5801_sbc(m_program->read_byte(X)); m_icount-=7;break; @@ -539,14 +539,14 @@ void lh5801_cpu_device::lh5801_instruction() case 0x45: lh5801_lin(&m_x);m_icount-=6;break; case 0x46: X--;m_icount-=5;break; case 0x47: lh5801_lde(&m_x);m_icount-=6;break; - case 0x48: XH=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x49: lh5801_and_mem(*m_program, X, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x4a: XL=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x4b: lh5801_ora_mem(*m_program, X, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x4c: lh5801_cpa(XH, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x4d: lh5801_bit(m_program->read_byte(X), m_direct->read_decrypted_byte(P++));m_icount-=10;break; - case 0x4e: lh5801_cpa(XL, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x4f: lh5801_add_mem(*m_program, X, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; + case 0x48: XH=m_direct->read_byte(P++);m_icount-=6;break; + case 0x49: lh5801_and_mem(*m_program, X, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x4a: XL=m_direct->read_byte(P++);m_icount-=6;break; + case 0x4b: lh5801_ora_mem(*m_program, X, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x4c: lh5801_cpa(XH, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x4d: lh5801_bit(m_program->read_byte(X), m_direct->read_byte(P++));m_icount-=10;break; + case 0x4e: lh5801_cpa(XL, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x4f: lh5801_add_mem(*m_program, X, m_direct->read_byte(P++)); m_icount-=13;break; case 0x50: lh5801_inc(&YL);m_icount-=5;break; case 0x51: lh5801_sin(&m_y); m_icount-=6;break; case 0x52: lh5801_dec(&YL);m_icount-=5;break; @@ -555,14 +555,14 @@ void lh5801_cpu_device::lh5801_instruction() case 0x55: lh5801_lin(&m_y);m_icount-=6;break; case 0x56: Y--;m_icount-=5;break; case 0x57: lh5801_lde(&m_y);m_icount-=6;break; - case 0x58: YH=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x59: lh5801_and_mem(*m_program, Y, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x5a: YL=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x5b: lh5801_ora_mem(*m_program, Y, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x5c: lh5801_cpa(YH, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x5d: lh5801_bit(m_program->read_byte(Y), m_direct->read_decrypted_byte(P++));m_icount-=10;break; - case 0x5e: lh5801_cpa(YL, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x5f: lh5801_add_mem(*m_program, Y, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; + case 0x58: YH=m_direct->read_byte(P++);m_icount-=6;break; + case 0x59: lh5801_and_mem(*m_program, Y, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x5a: YL=m_direct->read_byte(P++);m_icount-=6;break; + case 0x5b: lh5801_ora_mem(*m_program, Y, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x5c: lh5801_cpa(YH, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x5d: lh5801_bit(m_program->read_byte(Y), m_direct->read_byte(P++));m_icount-=10;break; + case 0x5e: lh5801_cpa(YL, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x5f: lh5801_add_mem(*m_program, Y, m_direct->read_byte(P++)); m_icount-=13;break; case 0x60: lh5801_inc(&UL);m_icount-=5;break; case 0x61: lh5801_sin(&m_u); m_icount-=6;break; case 0x62: lh5801_dec(&UL);m_icount-=5;break; @@ -571,14 +571,14 @@ void lh5801_cpu_device::lh5801_instruction() case 0x65: lh5801_lin(&m_u);m_icount-=6;break; case 0x66: U--;m_icount-=5;break; case 0x67: lh5801_lde(&m_u);m_icount-=6;break; - case 0x68: UH=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x69: lh5801_and_mem(*m_program, U, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x6a: UL=m_direct->read_decrypted_byte(P++);m_icount-=6;break; - case 0x6b: lh5801_ora_mem(*m_program, U, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; - case 0x6c: lh5801_cpa(UH, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x6d: lh5801_bit(m_program->read_byte(U), m_direct->read_decrypted_byte(P++));m_icount-=10;break; - case 0x6e: lh5801_cpa(UL, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0x6f: lh5801_add_mem(*m_program, U, m_direct->read_decrypted_byte(P++)); m_icount-=13;break; + case 0x68: UH=m_direct->read_byte(P++);m_icount-=6;break; + case 0x69: lh5801_and_mem(*m_program, U, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x6a: UL=m_direct->read_byte(P++);m_icount-=6;break; + case 0x6b: lh5801_ora_mem(*m_program, U, m_direct->read_byte(P++)); m_icount-=13;break; + case 0x6c: lh5801_cpa(UH, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x6d: lh5801_bit(m_program->read_byte(U), m_direct->read_byte(P++));m_icount-=10;break; + case 0x6e: lh5801_cpa(UL, m_direct->read_byte(P++)); m_icount-=7;break; + case 0x6f: lh5801_add_mem(*m_program, U, m_direct->read_byte(P++)); m_icount-=13;break; case 0x80: lh5801_sbc(XH); m_icount-=6;break; case 0x81: lh5801_branch_plus(!(m_t&C)); m_icount-=8; break; case 0x82: lh5801_adc(XH); m_icount-=6;break; @@ -626,25 +626,25 @@ void lh5801_cpu_device::lh5801_instruction() case 0xad: lh5801_eor(m_program->read_byte(lh5801_readop_word())); m_icount-=13;break; case 0xae: m_program->write_byte(lh5801_readop_word(),m_a); m_icount-=12;break; case 0xaf: lh5801_bit(m_program->read_byte(lh5801_readop_word()),m_a); m_icount-=13;break; - case 0xb1: lh5801_sbc(m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0xb3: lh5801_adc(m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0xb5: lh5801_lda(m_direct->read_decrypted_byte(P++)); m_icount-=6;break; - case 0xb7: lh5801_cpa(m_a, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; + case 0xb1: lh5801_sbc(m_direct->read_byte(P++)); m_icount-=7;break; + case 0xb3: lh5801_adc(m_direct->read_byte(P++)); m_icount-=7;break; + case 0xb5: lh5801_lda(m_direct->read_byte(P++)); m_icount-=6;break; + case 0xb7: lh5801_cpa(m_a, m_direct->read_byte(P++)); m_icount-=7;break; case 0xb8: m_pv=0;/*rpv!*/ m_icount-=4; break; - case 0xb9: lh5801_and(m_direct->read_decrypted_byte(P++)); m_icount-=7;break; + case 0xb9: lh5801_and(m_direct->read_byte(P++)); m_icount-=7;break; case 0xba: lh5801_jmp(lh5801_readop_word()); m_icount-=12;break; - case 0xbb: lh5801_ora(m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0xbd: lh5801_eor(m_direct->read_decrypted_byte(P++)); m_icount-=7;break; + case 0xbb: lh5801_ora(m_direct->read_byte(P++)); m_icount-=7;break; + case 0xbd: lh5801_eor(m_direct->read_byte(P++)); m_icount-=7;break; case 0xbe: lh5801_sjp(); m_icount-=19; break; - case 0xbf: lh5801_bit(m_a, m_direct->read_decrypted_byte(P++));m_icount-=7;break; - case 0xc1: lh5801_vector(!(m_t&C), m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xc3: lh5801_vector(m_t&C, m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xc5: lh5801_vector(!(m_t&H), m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xc7: lh5801_vector(m_t&H, m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xc9: lh5801_vector(!(m_t&Z), m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xcb: lh5801_vector(m_t&Z, m_direct->read_decrypted_byte(P++)); m_icount-=8;break; - case 0xcd: lh5801_vector(1, m_direct->read_decrypted_byte(P++)); m_icount-=7;break; - case 0xcf: lh5801_vector(m_t&V, m_direct->read_decrypted_byte(P++)); m_icount-=8;break; + case 0xbf: lh5801_bit(m_a, m_direct->read_byte(P++));m_icount-=7;break; + case 0xc1: lh5801_vector(!(m_t&C), m_direct->read_byte(P++)); m_icount-=8;break; + case 0xc3: lh5801_vector(m_t&C, m_direct->read_byte(P++)); m_icount-=8;break; + case 0xc5: lh5801_vector(!(m_t&H), m_direct->read_byte(P++)); m_icount-=8;break; + case 0xc7: lh5801_vector(m_t&H, m_direct->read_byte(P++)); m_icount-=8;break; + case 0xc9: lh5801_vector(!(m_t&Z), m_direct->read_byte(P++)); m_icount-=8;break; + case 0xcb: lh5801_vector(m_t&Z, m_direct->read_byte(P++)); m_icount-=8;break; + case 0xcd: lh5801_vector(1, m_direct->read_byte(P++)); m_icount-=7;break; + case 0xcf: lh5801_vector(m_t&V, m_direct->read_byte(P++)); m_icount-=8;break; case 0xd1: lh5801_ror(); m_icount-=6; break; case 0xd3: lh5801_drr(*m_program, X); m_icount-=12; break; case 0xd5: lh5801_shr(); m_icount-=6; break; @@ -656,17 +656,17 @@ void lh5801_cpu_device::lh5801_instruction() case 0xe1: m_pu=1;/*spu!*/ m_icount-=4; break; case 0xe3: m_pu=0;/*rpu!*/ m_icount-=4; break; case 0xe9: - adr=lh5801_readop_word();lh5801_and_mem(*m_program, adr, m_direct->read_decrypted_byte(P++)); + adr=lh5801_readop_word();lh5801_and_mem(*m_program, adr, m_direct->read_byte(P++)); m_icount-=19;break; case 0xeb: - adr=lh5801_readop_word();lh5801_ora_mem(*m_program, adr, m_direct->read_decrypted_byte(P++)); + adr=lh5801_readop_word();lh5801_ora_mem(*m_program, adr, m_direct->read_byte(P++)); m_icount-=19;break; case 0xed: - adr=lh5801_readop_word();lh5801_bit(m_program->read_byte(adr), m_direct->read_decrypted_byte(P++)); + adr=lh5801_readop_word();lh5801_bit(m_program->read_byte(adr), m_direct->read_byte(P++)); m_icount-=16;break; case 0xef: adr=lh5801_readop_word(); - lh5801_add_mem(*m_program, adr, m_direct->read_decrypted_byte(P++)); m_icount-=19; + lh5801_add_mem(*m_program, adr, m_direct->read_byte(P++)); m_icount-=19; break; case 0xf1: lh5801_aex(); m_icount-=6; break; case 0xf5: m_program->write_byte(Y++, m_program->read_byte(X++)); m_icount-=7; break; //tin diff --git a/src/emu/cpu/m37710/m37710cm.h b/src/emu/cpu/m37710/m37710cm.h index 8c784b9ca05..aa691b2e9aa 100644 --- a/src/emu/cpu/m37710/m37710cm.h +++ b/src/emu/cpu/m37710/m37710cm.h @@ -23,10 +23,10 @@ #define M37710_CALL_DEBUGGER(x) debugger_instruction_hook(this, x) #define m37710_read_8(addr) m_program->read_byte(addr) #define m37710_write_8(addr,data) m_program->write_byte(addr,data) -#define m37710_read_8_immediate(A) m_direct->read_decrypted_byte(A, BYTE_XOR_LE(0)) +#define m37710_read_8_immediate(A) m_direct->read_byte(A, BYTE_XOR_LE(0)) #define m37710_read_16(addr) m_program->read_word_unaligned(addr) #define m37710_write_16(addr,data) m_program->write_word_unaligned(addr,data) -#define m37710_read_16_immediate(A) m_direct->read_decrypted_word(A) +#define m37710_read_16_immediate(A) m_direct->read_word(A) /* ======================================================================== */ diff --git a/src/emu/cpu/m6502/deco16.c b/src/emu/cpu/m6502/deco16.c index 681ae5dcc42..a500b287d7a 100644 --- a/src/emu/cpu/m6502/deco16.c +++ b/src/emu/cpu/m6502/deco16.c @@ -41,7 +41,13 @@ void deco16_device::device_start() const address_space_config *deco16_device::memory_space_config(address_spacenum spacenum) const { - return spacenum == AS_PROGRAM ? &program_config : spacenum == AS_IO ? &io_config : NULL; + switch(spacenum) + { + case AS_PROGRAM: return &program_config; + case AS_IO: return &io_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &sprogram_config : NULL; + default: return NULL; + } } #include "cpu/m6502/deco16.inc" diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c index 329734f692e..2a7eb10ee1e 100644 --- a/src/emu/cpu/m6502/m4510.c +++ b/src/emu/cpu/m6502/m4510.c @@ -19,6 +19,9 @@ m4510_device::m4510_device(const machine_config &mconfig, const char *tag, devic program_config.m_addrbus_width = 20; program_config.m_logaddr_width = 16; program_config.m_page_shift = 13; + sprogram_config.m_addrbus_width = 20; + sprogram_config.m_logaddr_width = 16; + sprogram_config.m_page_shift = 13; } offs_t m4510_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) @@ -71,14 +74,14 @@ UINT8 m4510_device::mi_4510_normal::read(UINT16 adr) return program->read_byte(base->map(adr)); } -UINT8 m4510_device::mi_4510_normal::read_direct(UINT16 adr) +UINT8 m4510_device::mi_4510_normal::read_sync(UINT16 adr) { - return direct->read_raw_byte(base->map(adr)); + return sdirect->read_byte(base->map(adr)); } -UINT8 m4510_device::mi_4510_normal::read_decrypted(UINT16 adr) +UINT8 m4510_device::mi_4510_normal::read_arg(UINT16 adr) { - return direct->read_decrypted_byte(base->map(adr)); + return direct->read_byte(base->map(adr)); } void m4510_device::mi_4510_normal::write(UINT16 adr, UINT8 val) @@ -90,14 +93,14 @@ m4510_device::mi_4510_nd::mi_4510_nd(m4510_device *_base) : mi_4510_normal(_base { } -UINT8 m4510_device::mi_4510_nd::read_direct(UINT16 adr) +UINT8 m4510_device::mi_4510_nd::read_sync(UINT16 adr) { - return read(adr); + return sprogram->read_byte(base->map(adr)); } -UINT8 m4510_device::mi_4510_nd::read_decrypted(UINT16 adr) +UINT8 m4510_device::mi_4510_nd::read_arg(UINT16 adr) { - return read(adr); + return program->read_byte(base->map(adr)); } #include "cpu/m6502/m4510.inc" diff --git a/src/emu/cpu/m6502/m4510.h b/src/emu/cpu/m6502/m4510.h index 46a95a1eb72..90bba4d0262 100644 --- a/src/emu/cpu/m6502/m4510.h +++ b/src/emu/cpu/m6502/m4510.h @@ -37,8 +37,8 @@ protected: mi_4510_normal(m4510_device *base); virtual ~mi_4510_normal() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; @@ -46,8 +46,8 @@ protected: public: mi_4510_nd(m4510_device *base); virtual ~mi_4510_nd() {} - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); }; virtual void device_start(); diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index c1a84b2fd9c..01b2b8f0f98 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -17,7 +17,8 @@ const device_type M6502 = &device_creator<m6502_device>; m6502_device::m6502_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, M6502, "M6502", tag, owner, clock, "m6502", __FILE__), sync_w(*this), - program_config("program", ENDIANNESS_LITTLE, 8, 16) + program_config("program", ENDIANNESS_LITTLE, 8, 16), + sprogram_config("decrypted_opcodes", ENDIANNESS_LITTLE, 8, 16) { direct_disabled = false; } @@ -25,7 +26,8 @@ m6502_device::m6502_device(const machine_config &mconfig, const char *tag, devic m6502_device::m6502_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) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), sync_w(*this), - program_config("program", ENDIANNESS_LITTLE, 8, 16) + program_config("program", ENDIANNESS_LITTLE, 8, 16), + sprogram_config("decrypted_opcodes", ENDIANNESS_LITTLE, 8, 16) { direct_disabled = false; } @@ -42,8 +44,11 @@ void m6502_device::device_start() void m6502_device::init() { - mintf->program = &space(AS_PROGRAM); - mintf->direct = &mintf->program->direct(); + mintf->program = &space(AS_PROGRAM); + mintf->sprogram = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : mintf->program; + + mintf->direct = &mintf->program->direct(); + mintf->sdirect = &mintf->sprogram->direct(); sync_w.resolve_safe(); @@ -402,7 +407,12 @@ void m6502_device::execute_set_input(int inputnum, int state) const address_space_config *m6502_device::memory_space_config(address_spacenum spacenum) const { - return (spacenum == AS_PROGRAM) ? &program_config : NULL; + switch(spacenum) + { + case AS_PROGRAM: return &program_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &sprogram_config : NULL; + default: return NULL; + } } @@ -621,7 +631,7 @@ void m6502_device::prefetch() sync = true; sync_w(ASSERT_LINE); NPC = PC; - IR = mintf->read_decrypted(PC); + IR = mintf->read_sync(PC); sync = false; sync_w(CLEAR_LINE); @@ -637,7 +647,7 @@ void m6502_device::prefetch_noirq() sync = true; sync_w(ASSERT_LINE); NPC = PC; - IR = mintf->read_decrypted(PC); + IR = mintf->read_sync(PC); sync = false; sync_w(CLEAR_LINE); PC++; @@ -674,31 +684,33 @@ UINT8 m6502_device::mi_default_normal::read(UINT16 adr) return program->read_byte(adr); } -UINT8 m6502_device::mi_default_normal::read_direct(UINT16 adr) +UINT8 m6502_device::mi_default_normal::read_sync(UINT16 adr) { - return direct->read_raw_byte(adr); + return sdirect->read_byte(adr); } -UINT8 m6502_device::mi_default_normal::read_decrypted(UINT16 adr) +UINT8 m6502_device::mi_default_normal::read_arg(UINT16 adr) { - return direct->read_decrypted_byte(adr); + return direct->read_byte(adr); } + void m6502_device::mi_default_normal::write(UINT16 adr, UINT8 val) { program->write_byte(adr, val); } -UINT8 m6502_device::mi_default_nd::read_direct(UINT16 adr) +UINT8 m6502_device::mi_default_nd::read_sync(UINT16 adr) { - return read(adr); + return sprogram->read_byte(adr); } -UINT8 m6502_device::mi_default_nd::read_decrypted(UINT16 adr) +UINT8 m6502_device::mi_default_nd::read_arg(UINT16 adr) { - return read(adr); + return program->read_byte(adr); } + WRITE_LINE_MEMBER( m6502_device::irq_line ) { set_input_line( M6502_IRQ_LINE, state ); diff --git a/src/emu/cpu/m6502/m6502.h b/src/emu/cpu/m6502/m6502.h index 240509f21ea..1dbed7710de 100644 --- a/src/emu/cpu/m6502/m6502.h +++ b/src/emu/cpu/m6502/m6502.h @@ -42,14 +42,14 @@ public: protected: class memory_interface { public: - address_space *program; - direct_read_data *direct; + address_space *program, *sprogram; + direct_read_data *direct, *sdirect; virtual ~memory_interface() {} virtual UINT8 read(UINT16 adr) = 0; virtual UINT8 read_9(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr) = 0; - virtual UINT8 read_decrypted(UINT16 adr) = 0; + virtual UINT8 read_sync(UINT16 adr) = 0; + virtual UINT8 read_arg(UINT16 adr) = 0; virtual void write(UINT16 adr, UINT8 val) = 0; virtual void write_9(UINT16 adr, UINT8 val); }; @@ -58,16 +58,16 @@ protected: public: virtual ~mi_default_normal() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; class mi_default_nd : public mi_default_normal { public: virtual ~mi_default_nd() {} - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); }; struct disasm_entry { @@ -151,7 +151,7 @@ protected: virtual UINT32 disasm_max_opcode_bytes() const; virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - address_space_config program_config; + address_space_config program_config, sprogram_config; UINT16 PPC; /* previous program counter */ UINT16 NPC; /* next start-of-instruction program counter */ @@ -179,9 +179,9 @@ protected: UINT8 read_9(UINT16 adr) { return mintf->read_9(adr); } void write(UINT16 adr, UINT8 val) { mintf->write(adr, val); } void write_9(UINT16 adr, UINT8 val) { mintf->write_9(adr, val); } - UINT8 read_direct(UINT16 adr) { return mintf->read_direct(adr); } - UINT8 read_pc() { return mintf->read_direct(PC++); } - UINT8 read_pc_noinc() { return mintf->read_direct(PC); } + UINT8 read_arg(UINT16 adr) { return mintf->read_arg(adr); } + UINT8 read_pc() { return mintf->read_arg(PC++); } + UINT8 read_pc_noinc() { return mintf->read_arg(PC); } void prefetch(); void prefetch_noirq(); void set_nz(UINT8 v); diff --git a/src/emu/cpu/m6502/m6502make.py b/src/emu/cpu/m6502/m6502make.py index 514af0e8fb8..591d01268ca 100755 --- a/src/emu/cpu/m6502/m6502make.py +++ b/src/emu/cpu/m6502/m6502make.py @@ -68,7 +68,7 @@ FULL_EAT_ALL="""\ """ FULL_MEMORY="""\ -\tif(icount <= 0) { inst_substate = %(substate)s; return; } +\tif(icount == 0) { inst_substate = %(substate)s; return; } %(ins)s \ticount--; """ @@ -97,7 +97,7 @@ case %(substate)s:; """ PARTIAL_MEMORY="""\ -\tif(icount <= 0) { inst_substate = %(substate)s; return; } +\tif(icount == 0) { inst_substate = %(substate)s; return; } case %(substate)s: %(ins)s \ticount--; diff --git a/src/emu/cpu/m6502/m6504.c b/src/emu/cpu/m6502/m6504.c index 383d0f1fecd..f2ae2c4b6d9 100644 --- a/src/emu/cpu/m6502/m6504.c +++ b/src/emu/cpu/m6502/m6504.c @@ -17,6 +17,7 @@ m6504_device::m6504_device(const machine_config &mconfig, const char *tag, devic m6502_device(mconfig, M6504, "M6504", tag, owner, clock, "m6504", __FILE__) { program_config.m_addrbus_width = 13; + sprogram_config.m_addrbus_width = 13; } void m6504_device::device_start() @@ -34,14 +35,14 @@ UINT8 m6504_device::mi_6504_normal::read(UINT16 adr) return program->read_byte(adr & 0x1fff); } -UINT8 m6504_device::mi_6504_normal::read_direct(UINT16 adr) +UINT8 m6504_device::mi_6504_normal::read_sync(UINT16 adr) { - return direct->read_raw_byte(adr & 0x1fff); + return sdirect->read_byte(adr & 0x1fff); } -UINT8 m6504_device::mi_6504_normal::read_decrypted(UINT16 adr) +UINT8 m6504_device::mi_6504_normal::read_arg(UINT16 adr) { - return direct->read_decrypted_byte(adr & 0x1fff); + return direct->read_byte(adr & 0x1fff); } void m6504_device::mi_6504_normal::write(UINT16 adr, UINT8 val) @@ -49,12 +50,12 @@ void m6504_device::mi_6504_normal::write(UINT16 adr, UINT8 val) program->write_byte(adr & 0x1fff, val); } -UINT8 m6504_device::mi_6504_nd::read_direct(UINT16 adr) +UINT8 m6504_device::mi_6504_nd::read_sync(UINT16 adr) { - return read(adr); + return sprogram->read_byte(adr & 0x1fff); } -UINT8 m6504_device::mi_6504_nd::read_decrypted(UINT16 adr) +UINT8 m6504_device::mi_6504_nd::read_arg(UINT16 adr) { - return read(adr); + return program->read_byte(adr & 0x1fff); } diff --git a/src/emu/cpu/m6502/m6504.h b/src/emu/cpu/m6502/m6504.h index e325240d8e9..de6ca847b25 100644 --- a/src/emu/cpu/m6502/m6504.h +++ b/src/emu/cpu/m6502/m6504.h @@ -22,16 +22,16 @@ protected: public: virtual ~mi_6504_normal() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; class mi_6504_nd : public mi_6504_normal { public: virtual ~mi_6504_nd() {} - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); }; virtual void device_start(); diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c index 3c8c3436e25..77af9e8f1f7 100644 --- a/src/emu/cpu/m6502/m6509.c +++ b/src/emu/cpu/m6502/m6509.c @@ -18,6 +18,8 @@ m6509_device::m6509_device(const machine_config &mconfig, const char *tag, devic { program_config.m_addrbus_width = 20; program_config.m_logaddr_width = 20; + sprogram_config.m_addrbus_width = 20; + sprogram_config.m_logaddr_width = 20; } void m6509_device::device_start() @@ -71,9 +73,9 @@ UINT8 m6509_device::mi_6509_normal::read(UINT16 adr) return res; } -UINT8 m6509_device::mi_6509_normal::read_direct(UINT16 adr) +UINT8 m6509_device::mi_6509_normal::read_sync(UINT16 adr) { - UINT8 res = direct->read_raw_byte(base->adr_in_bank_i(adr)); + UINT8 res = sdirect->read_byte(base->adr_in_bank_i(adr)); if(adr == 0x0000) res = base->bank_i_r(); else if(adr == 0x0001) @@ -81,9 +83,9 @@ UINT8 m6509_device::mi_6509_normal::read_direct(UINT16 adr) return res; } -UINT8 m6509_device::mi_6509_normal::read_decrypted(UINT16 adr) +UINT8 m6509_device::mi_6509_normal::read_arg(UINT16 adr) { - UINT8 res = direct->read_decrypted_byte(base->adr_in_bank_i(adr)); + UINT8 res = direct->read_byte(base->adr_in_bank_i(adr)); if(adr == 0x0000) res = base->bank_i_r(); else if(adr == 0x0001) @@ -123,9 +125,9 @@ m6509_device::mi_6509_nd::mi_6509_nd(m6509_device *_base) : mi_6509_normal(_base { } -UINT8 m6509_device::mi_6509_nd::read_direct(UINT16 adr) +UINT8 m6509_device::mi_6509_nd::read_sync(UINT16 adr) { - UINT8 res = program->read_byte(base->adr_in_bank_i(adr)); + UINT8 res = sprogram->read_byte(base->adr_in_bank_i(adr)); if(adr == 0x0000) res = base->bank_i_r(); else if(adr == 0x0001) @@ -133,7 +135,7 @@ UINT8 m6509_device::mi_6509_nd::read_direct(UINT16 adr) return res; } -UINT8 m6509_device::mi_6509_nd::read_decrypted(UINT16 adr) +UINT8 m6509_device::mi_6509_nd::read_arg(UINT16 adr) { UINT8 res = program->read_byte(base->adr_in_bank_i(adr)); if(adr == 0x0000) diff --git a/src/emu/cpu/m6502/m6509.h b/src/emu/cpu/m6502/m6509.h index 561a31449a4..27f7411b80f 100644 --- a/src/emu/cpu/m6502/m6509.h +++ b/src/emu/cpu/m6502/m6509.h @@ -32,8 +32,8 @@ protected: virtual ~mi_6509_normal() {} virtual UINT8 read(UINT16 adr); virtual UINT8 read_9(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); virtual void write_9(UINT16 adr, UINT8 val); }; @@ -42,8 +42,8 @@ protected: public: mi_6509_nd(m6509_device *base); virtual ~mi_6509_nd() {} - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); }; virtual void device_start(); diff --git a/src/emu/cpu/m6502/m6510.c b/src/emu/cpu/m6502/m6510.c index dfab818bd60..10e57fb27b8 100644 --- a/src/emu/cpu/m6502/m6510.c +++ b/src/emu/cpu/m6502/m6510.c @@ -119,9 +119,9 @@ UINT8 m6510_device::mi_6510_normal::read(UINT16 adr) return res; } -UINT8 m6510_device::mi_6510_normal::read_direct(UINT16 adr) +UINT8 m6510_device::mi_6510_normal::read_sync(UINT16 adr) { - UINT8 res = direct->read_raw_byte(adr); + UINT8 res = sdirect->read_byte(adr); if(adr == 0x0000) res = base->dir_r(); else if(adr == 0x0001) @@ -129,9 +129,9 @@ UINT8 m6510_device::mi_6510_normal::read_direct(UINT16 adr) return res; } -UINT8 m6510_device::mi_6510_normal::read_decrypted(UINT16 adr) +UINT8 m6510_device::mi_6510_normal::read_arg(UINT16 adr) { - UINT8 res = direct->read_decrypted_byte(adr); + UINT8 res = direct->read_byte(adr); if(adr == 0x0000) res = base->dir_r(); else if(adr == 0x0001) @@ -152,14 +152,24 @@ m6510_device::mi_6510_nd::mi_6510_nd(m6510_device *_base) : mi_6510_normal(_base { } -UINT8 m6510_device::mi_6510_nd::read_direct(UINT16 adr) +UINT8 m6510_device::mi_6510_nd::read_sync(UINT16 adr) { - return read(adr); + UINT8 res = sprogram->read_byte(adr); + if(adr == 0x0000) + res = base->dir_r(); + else if(adr == 0x0001) + res = base->port_r(); + return res; } -UINT8 m6510_device::mi_6510_nd::read_decrypted(UINT16 adr) +UINT8 m6510_device::mi_6510_nd::read_arg(UINT16 adr) { - return read(adr); + UINT8 res = program->read_byte(adr); + if(adr == 0x0000) + res = base->dir_r(); + else if(adr == 0x0001) + res = base->port_r(); + return res; } #include "cpu/m6502/m6510.inc" diff --git a/src/emu/cpu/m6502/m6510.h b/src/emu/cpu/m6502/m6510.h index 76b8a405f30..2dbd7e4138e 100644 --- a/src/emu/cpu/m6502/m6510.h +++ b/src/emu/cpu/m6502/m6510.h @@ -47,8 +47,8 @@ protected: mi_6510_normal(m6510_device *base); virtual ~mi_6510_normal() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; @@ -56,8 +56,8 @@ protected: public: mi_6510_nd(m6510_device *base); virtual ~mi_6510_nd() {} - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); }; devcb_read8 read_port; diff --git a/src/emu/cpu/m6502/n2a03.c b/src/emu/cpu/m6502/n2a03.c index dd29182f53c..b3b2cb31808 100644 --- a/src/emu/cpu/m6502/n2a03.c +++ b/src/emu/cpu/m6502/n2a03.c @@ -38,14 +38,14 @@ UINT8 n2a03_device::mi_2a03_normal::read(UINT16 adr) return program->read_byte(adr); } -UINT8 n2a03_device::mi_2a03_normal::read_direct(UINT16 adr) +UINT8 n2a03_device::mi_2a03_normal::read_sync(UINT16 adr) { - return direct->read_raw_byte(adr); + return sdirect->read_byte(adr); } -UINT8 n2a03_device::mi_2a03_normal::read_decrypted(UINT16 adr) +UINT8 n2a03_device::mi_2a03_normal::read_arg(UINT16 adr) { - return direct->read_decrypted_byte(adr); + return direct->read_byte(adr); } void n2a03_device::mi_2a03_normal::write(UINT16 adr, UINT8 val) @@ -58,12 +58,12 @@ UINT8 n2a03_device::mi_2a03_nd::read(UINT16 adr) return program->read_byte(adr); } -UINT8 n2a03_device::mi_2a03_nd::read_direct(UINT16 adr) +UINT8 n2a03_device::mi_2a03_nd::read_sync(UINT16 adr) { - return program->read_byte(adr); + return sprogram->read_byte(adr); } -UINT8 n2a03_device::mi_2a03_nd::read_decrypted(UINT16 adr) +UINT8 n2a03_device::mi_2a03_nd::read_arg(UINT16 adr) { return program->read_byte(adr); } diff --git a/src/emu/cpu/m6502/n2a03.h b/src/emu/cpu/m6502/n2a03.h index c2f8a7f511b..a046ef71ad3 100644 --- a/src/emu/cpu/m6502/n2a03.h +++ b/src/emu/cpu/m6502/n2a03.h @@ -28,8 +28,8 @@ protected: public: virtual ~mi_2a03_normal() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; @@ -37,8 +37,8 @@ protected: public: virtual ~mi_2a03_nd() {} virtual UINT8 read(UINT16 adr); - virtual UINT8 read_direct(UINT16 adr); - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; diff --git a/src/emu/cpu/m6502/odeco16.lst b/src/emu/cpu/m6502/odeco16.lst index cf8b75455d6..6cea2fa7282 100644 --- a/src/emu/cpu/m6502/odeco16.lst +++ b/src/emu/cpu/m6502/odeco16.lst @@ -13,13 +13,13 @@ brk_16_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_state) { - PC = read_direct(0xfff7); - PC = set_h(PC, read_direct(0xfff6)); + PC = read_arg(0xfff7); + PC = set_h(PC, read_arg(0xfff6)); nmi_state = false; standard_irq_callback(NMI_LINE); } else { - PC = read_direct(0xfff3); - PC = set_h(PC, read_direct(0xfff2)); + PC = read_arg(0xfff3); + PC = set_h(PC, read_arg(0xfff2)); if(irq_taken) standard_irq_callback(IRQ_LINE); } @@ -95,7 +95,7 @@ vbl_zpg # exceptions reset_16 - PC = read_direct(0xfff1); - PC = set_h(PC, read_direct(0xfff0)); + PC = read_arg(0xfff1); + PC = set_h(PC, read_arg(0xfff0)); prefetch(); inst_state = -1; diff --git a/src/emu/cpu/m6502/om6502.lst b/src/emu/cpu/m6502/om6502.lst index f76884b554f..24c560c02fa 100644 --- a/src/emu/cpu/m6502/om6502.lst +++ b/src/emu/cpu/m6502/om6502.lst @@ -184,7 +184,7 @@ bcc_rel if(!(P & F_C)) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -195,7 +195,7 @@ bcs_rel if(P & F_C) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -206,7 +206,7 @@ beq_rel if(P & F_Z) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -228,7 +228,7 @@ bmi_rel if(P & F_N) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -239,7 +239,7 @@ bne_rel if(!(P & F_Z)) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -250,7 +250,7 @@ bpl_rel if(!(P & F_N)) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -270,13 +270,13 @@ brk_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_state) { - PC = read_direct(0xfffa); - PC = set_h(PC, read_direct(0xfffb)); + PC = read_arg(0xfffa); + PC = set_h(PC, read_arg(0xfffb)); nmi_state = false; standard_irq_callback(NMI_LINE); } else { - PC = read_direct(0xfffe); - PC = set_h(PC, read_direct(0xffff)); + PC = read_arg(0xfffe); + PC = set_h(PC, read_arg(0xffff)); if(irq_taken) standard_irq_callback(IRQ_LINE); } @@ -290,7 +290,7 @@ bvc_rel if(!(P & F_V)) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -301,7 +301,7 @@ bvs_rel if(P & F_V) { read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); } @@ -1216,8 +1216,8 @@ tya_imp # exceptions reset - PC = read_direct(0xfffc); - PC = set_h(PC, read_direct(0xfffd)); + PC = read_arg(0xfffc); + PC = set_h(PC, read_arg(0xfffd)); prefetch(); inst_state = -1; diff --git a/src/emu/cpu/m6502/om65c02.lst b/src/emu/cpu/m6502/om65c02.lst index 21bc1d4e726..d64ddcdc409 100644 --- a/src/emu/cpu/m6502/om65c02.lst +++ b/src/emu/cpu/m6502/om65c02.lst @@ -181,7 +181,7 @@ bra_rel TMP = read_pc(); read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); prefetch(); @@ -199,13 +199,13 @@ brk_c_imp write(SP, irq_taken || nmi_state ? P & ~F_B : P); dec_SP(); if(irq_taken && nmi_state) { - PC = read_direct(0xfffa); - PC = set_h(PC, read_direct(0xfffb)); + PC = read_arg(0xfffa); + PC = set_h(PC, read_arg(0xfffb)); nmi_state = false; standard_irq_callback(NMI_LINE); } else { - PC = read_direct(0xfffe); - PC = set_h(PC, read_direct(0xffff)); + PC = read_arg(0xfffe); + PC = set_h(PC, read_arg(0xffff)); if(irq_taken) standard_irq_callback(IRQ_LINE); } diff --git a/src/emu/cpu/m6502/om65ce02.lst b/src/emu/cpu/m6502/om65ce02.lst index 6fdf244a8b1..049097fded8 100644 --- a/src/emu/cpu/m6502/om65ce02.lst +++ b/src/emu/cpu/m6502/om65ce02.lst @@ -360,12 +360,12 @@ brk_ce_imp write(SP, irq_taken || nmi_state ? P & ~F_B : P); dec_SP_ce(); if(nmi_state) { - PC = read_direct(0xfffa); - PC = set_h(PC, read_direct(0xfffb)); + PC = read_arg(0xfffa); + PC = set_h(PC, read_arg(0xfffb)); nmi_state = false; } else { - PC = read_direct(0xfffe); - PC = set_h(PC, read_direct(0xffff)); + PC = read_arg(0xfffe); + PC = set_h(PC, read_arg(0xffff)); } irq_taken = false; P = (P | F_I) & ~F_D; // Do *not* move after the prefetch diff --git a/src/emu/cpu/m6502/om740.lst b/src/emu/cpu/m6502/om740.lst index d944a0cbcb5..9f17dc639bf 100644 --- a/src/emu/cpu/m6502/om740.lst +++ b/src/emu/cpu/m6502/om740.lst @@ -99,7 +99,7 @@ bra_rel TMP = read_pc(); read_pc_noinc(); if(page_changing(PC, INT8(TMP))) { - read_direct(set_l(PC, PC+INT8(TMP))); + read_arg(set_l(PC, PC+INT8(TMP))); } PC += INT8(TMP); prefetch(); @@ -112,8 +112,8 @@ jmp_zpi prefetch(); reset740 - PC = read_direct(0xfffe); - PC = set_h(PC, read_direct(0xffff)); + PC = read_arg(0xfffe); + PC = set_h(PC, read_arg(0xffff)); prefetch(); inst_state = -1; @@ -131,13 +131,13 @@ brk740_imp write(SP, irq_taken ? P & ~F_B : P); dec_SP(); if(nmi_state) { - PC = read_direct(0xfffa); - PC = set_h(PC, read_direct(0xfffb)); + PC = read_arg(0xfffa); + PC = set_h(PC, read_arg(0xfffb)); nmi_state = false; standard_irq_callback(NMI_LINE); } else { - PC = read_direct(m_irq_vector); - PC = set_h(PC, read_direct(m_irq_vector+1)); + PC = read_arg(m_irq_vector); + PC = set_h(PC, read_arg(m_irq_vector+1)); if(irq_taken) standard_irq_callback(IRQ_LINE); } diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 3cb68924929..46a7cc4a99a 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -160,14 +160,14 @@ static UINT32 timer_next; /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define M_RDOP(Addr) ((unsigned)m_direct->read_decrypted_byte(Addr)) +#define M_RDOP(Addr) ((unsigned)m_decrypted_opcodes_direct->read_byte(Addr)) /****************************************************************************/ /* M6800_RDOP_ARG() is identical to M6800_RDOP() but it's used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define M_RDOP_ARG(Addr) ((unsigned)m_direct->read_raw_byte(Addr)) +#define M_RDOP_ARG(Addr) ((unsigned)m_direct->read_byte(Addr)) /* macros to access memory */ #define IMMBYTE(b) b = M_RDOP_ARG(PCD); PC++ @@ -535,6 +535,7 @@ const device_type HD6303Y = &device_creator<hd6303y_cpu_device>; m6800_cpu_device::m6800_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, M6800, "M6800", tag, owner, clock, "m6800", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0) + , m_decrypted_opcodes_config("program", ENDIANNESS_BIG, 8, 16, 0) , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0) , m_has_io(false) , m_out_sc2_func(*this) @@ -548,6 +549,7 @@ m6800_cpu_device::m6800_cpu_device(const machine_config &mconfig, const char *ta m6800_cpu_device::m6800_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, bool has_io, int clock_divider, const op_func *insn, const UINT8 *cycles, address_map_constructor internal) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal) + , m_decrypted_opcodes_config("program", ENDIANNESS_BIG, 8, 16, 0) , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0) , m_has_io(has_io) , m_out_sc2_func(*this) @@ -625,6 +627,17 @@ hd6303y_cpu_device::hd6303y_cpu_device(const machine_config &mconfig, const char { } +const address_space_config *m6800_cpu_device::memory_space_config(address_spacenum spacenum) const +{ + switch(spacenum) + { + case AS_PROGRAM: return &m_program_config; + case AS_IO: return m_has_io ? &m_io_config : NULL; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_decrypted_opcodes_config : NULL; + default: return NULL; + } +} + UINT32 m6800_cpu_device::RM16(UINT32 Addr ) { @@ -1039,6 +1052,8 @@ void m6800_cpu_device::device_start() { m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); + m_decrypted_opcodes = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : m_program; + m_decrypted_opcodes_direct = &m_decrypted_opcodes->direct(); if ( m_has_io ) m_io = &space(AS_IO); diff --git a/src/emu/cpu/m6800/m6800.h b/src/emu/cpu/m6800/m6800.h index 1f7d668861b..af02be492d8 100644 --- a/src/emu/cpu/m6800/m6800.h +++ b/src/emu/cpu/m6800/m6800.h @@ -84,7 +84,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO && m_has_io) ? &m_io_config : NULL ); } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; // device_state_interface overrides void state_string_export(const device_state_entry &entry, std::string &str); @@ -95,6 +95,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); address_space_config m_program_config; + address_space_config m_decrypted_opcodes_config; address_space_config m_io_config; bool m_has_io; @@ -115,8 +116,8 @@ protected: int m_sc1_state; /* Memory spaces */ - address_space *m_program; - direct_read_data *m_direct; + address_space *m_program, *m_decrypted_opcodes; + direct_read_data *m_direct, *m_decrypted_opcodes_direct; address_space *m_io; const op_func *m_insn; diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index d5ab6b16b84..5279ad655ec 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -166,7 +166,7 @@ public: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; // address spaces - const address_space_config m_program_config; + const address_space_config m_program_config, m_oprogram_config; void define_state(void); @@ -175,7 +175,6 @@ public: void set_rte_callback(write_line_delegate callback); void set_tas_write_callback(write8_delegate callback); UINT16 get_fc(); - void set_encrypted_opcode_range(offs_t start, offs_t end); void set_hmmu_enable(int enable); void set_instruction_hook(read32_delegate ihook); void set_buserror_details(UINT32 fault_addr, UINT8 rw, UINT8 fc); @@ -263,7 +262,7 @@ public: allowing writeback to be disabled globally or selectively or other side effects to be implemented */ - address_space *program; + address_space *program, *oprogram; /* Redirect memory calls */ @@ -278,11 +277,11 @@ public: // class m68k_memory_interface // { public: - void init8(address_space &space); - void init16(address_space &space); - void init32(address_space &space); - void init32mmu(address_space &space); - void init32hmmu(address_space &space); + void init8(address_space &space, address_space &ospace); + void init16(address_space &space, address_space &ospace); + void init32(address_space &space, address_space &ospace); + void init32mmu(address_space &space, address_space &ospace); + void init32hmmu(address_space &space, address_space &ospace); offs_t opcode_xor; // Address Calculation m68k_readimm16_delegate readimm16; // Immediate read 16 bit @@ -322,11 +321,8 @@ public: public: // m68k_memory_interface memory; - address_space *m_space; - direct_read_data *m_direct; - - offs_t encrypted_start; - offs_t encrypted_end; + address_space *m_space, *m_ospace; + direct_read_data *m_direct, *m_odirect; UINT32 iotemp; diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 62e14a0cf79..bb83abade83 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -956,6 +956,7 @@ void m68000_base_device::init_cpu_common(void) //this = device;//deviceparam; program = &space(AS_PROGRAM); + oprogram = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : program; int_ack_callback = device_irq_acknowledge_delegate(FUNC(m68000_base_device::standard_irq_callback_member), this); /* disable all MMUs */ @@ -1230,12 +1231,6 @@ void m68000_base_device::state_string_export(const device_state_entry &entry, st /* global access */ -void m68000_base_device::set_encrypted_opcode_range(offs_t start, offs_t end) -{ - encrypted_start = start; - encrypted_end = end; -} - void m68000_base_device::set_hmmu_enable(int enable) { hmmu_enabled = enable; @@ -1252,13 +1247,15 @@ void m68000_base_device::set_instruction_hook(read32_delegate ihook) UINT16 m68000_base_device::m68008_read_immediate_16(offs_t address) { - return (m_direct->read_decrypted_byte(address) << 8) | (m_direct->read_decrypted_byte(address + 1)); + return (m_odirect->read_byte(address) << 8) | (m_odirect->read_byte(address + 1)); } -void m68000_base_device::init8(address_space &space) +void m68000_base_device::init8(address_space &space, address_space &ospace) { m_space = &space; m_direct = &space.direct(); + m_ospace = &ospace; + m_odirect = &ospace.direct(); // m_cpustate = this; opcode_xor = 0; @@ -1277,12 +1274,12 @@ void m68000_base_device::init8(address_space &space) UINT16 m68000_base_device::read_immediate_16(offs_t address) { - return m_direct->read_decrypted_word((address), opcode_xor); + return m_odirect->read_word((address), opcode_xor); } UINT16 m68000_base_device::simple_read_immediate_16(offs_t address) { - return m_direct->read_decrypted_word(address); + return m_odirect->read_word(address); } void m68000_base_device::m68000_write_byte(offs_t address, UINT8 data) @@ -1292,10 +1289,13 @@ void m68000_base_device::m68000_write_byte(offs_t address, UINT8 data) m_space->write_word(address & ~1, data | (data << 8), masks[address & 1]); } -void m68000_base_device::init16(address_space &space) +void m68000_base_device::init16(address_space &space, address_space &ospace) { m_space = &space; m_direct = &space.direct(); + m_ospace = &ospace; + m_odirect = &ospace.direct(); + opcode_xor = 0; readimm16 = m68k_readimm16_delegate(FUNC(m68000_base_device::simple_read_immediate_16), this); @@ -1316,10 +1316,12 @@ void m68000_base_device::init16(address_space &space) ****************************************************************************/ /* interface for 32-bit data bus (68EC020, 68020) */ -void m68000_base_device::init32(address_space &space) +void m68000_base_device::init32(address_space &space, address_space &ospace) { m_space = &space; m_direct = &space.direct(); + m_ospace = &ospace; + m_odirect = &ospace.direct(); opcode_xor = WORD_XOR_BE(0); readimm16 = m68k_readimm16_delegate(FUNC(m68000_base_device::read_immediate_16), this); @@ -1368,7 +1370,7 @@ UINT16 m68000_base_device::read_immediate_16_mmu(offs_t address) } } - return m_direct->read_decrypted_word((address), opcode_xor); + return m_odirect->read_word((address), opcode_xor); } /* potentially misaligned 16-bit reads with a 32-bit data bus (and 24-bit address bus) */ @@ -1533,10 +1535,12 @@ void m68000_base_device::writelong_d32_mmu(offs_t address, UINT32 data) m_space->write_byte(address + 3, data); } -void m68000_base_device::init32mmu(address_space &space) +void m68000_base_device::init32mmu(address_space &space, address_space &ospace) { m_space = &space; m_direct = &space.direct(); + m_ospace = &ospace; + m_odirect = &ospace.direct(); opcode_xor = WORD_XOR_BE(0); readimm16 = m68k_readimm16_delegate(FUNC(m68000_base_device::read_immediate_16_mmu), this); @@ -1577,7 +1581,7 @@ UINT16 m68000_base_device::read_immediate_16_hmmu(offs_t address) address = hmmu_translate_addr(this, address); } - return m_direct->read_decrypted_word((address), opcode_xor); + return m_odirect->read_word((address), opcode_xor); } /* potentially misaligned 16-bit reads with a 32-bit data bus (and 24-bit address bus) */ @@ -1659,10 +1663,12 @@ void m68000_base_device::writelong_d32_hmmu(offs_t address, UINT32 data) m_space->write_byte(address + 3, data); } -void m68000_base_device::init32hmmu(address_space &space) +void m68000_base_device::init32hmmu(address_space &space, address_space &ospace) { m_space = &space; m_direct = &space.direct(); + m_ospace = &ospace; + m_odirect = &ospace.direct(); opcode_xor = WORD_XOR_BE(0); readimm16 = m68k_readimm16_delegate(FUNC(m68000_base_device::read_immediate_16_hmmu), this); @@ -1780,7 +1786,7 @@ void m68000_base_device::init_cpu_m68000(void) cpu_type = CPU_TYPE_000; // dasm_type = M68K_CPU_TYPE_68000; - init16(*program); + init16(*program, *oprogram); sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[0]; cyc_instruction = m68ki_cycles[0]; @@ -1810,7 +1816,7 @@ void m68000_base_device::init_cpu_m68008(void) cpu_type = CPU_TYPE_008; // dasm_type = M68K_CPU_TYPE_68008; - init8(*program); + init8(*program, *oprogram); sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[0]; cyc_instruction = m68ki_cycles[0]; @@ -1838,7 +1844,7 @@ void m68000_base_device::init_cpu_m68010(void) cpu_type = CPU_TYPE_010; // dasm_type = M68K_CPU_TYPE_68010; - init16(*program); + init16(*program, *oprogram); sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[1]; cyc_instruction = m68ki_cycles[1]; @@ -1865,7 +1871,7 @@ void m68000_base_device::init_cpu_m68020(void) cpu_type = CPU_TYPE_020; // dasm_type = M68K_CPU_TYPE_68020; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[2]; cyc_instruction = m68ki_cycles[2]; @@ -1898,7 +1904,7 @@ void m68000_base_device::init_cpu_m68020pmmu(void) has_fpu = 1; - init32mmu(*program); + init32mmu(*program, *oprogram); } @@ -1911,7 +1917,7 @@ void m68000_base_device::init_cpu_m68020hmmu(void) has_fpu = 1; - init32hmmu(*program); + init32hmmu(*program, *oprogram); } void m68000_base_device::init_cpu_m68ec020(void) @@ -1922,7 +1928,7 @@ void m68000_base_device::init_cpu_m68ec020(void) // dasm_type = M68K_CPU_TYPE_68EC020; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[2]; cyc_instruction = m68ki_cycles[2]; @@ -1951,7 +1957,7 @@ void m68000_base_device::init_cpu_m68030(void) // dasm_type = M68K_CPU_TYPE_68030; - init32mmu(*program); + init32mmu(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[3]; cyc_instruction = m68ki_cycles[3]; @@ -1981,7 +1987,7 @@ void m68000_base_device::init_cpu_m68ec030(void) // dasm_type = M68K_CPU_TYPE_68EC030; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[3]; cyc_instruction = m68ki_cycles[3]; @@ -2011,7 +2017,7 @@ void m68000_base_device::init_cpu_m68040(void) // dasm_type = M68K_CPU_TYPE_68040; - init32mmu(*program); + init32mmu(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[4]; cyc_instruction = m68ki_cycles[4]; @@ -2040,7 +2046,7 @@ void m68000_base_device::init_cpu_m68ec040(void) // dasm_type = M68K_CPU_TYPE_68EC040; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[4]; cyc_instruction = m68ki_cycles[4]; @@ -2069,7 +2075,7 @@ void m68000_base_device::init_cpu_m68lc040(void) // dasm_type = M68K_CPU_TYPE_68LC040; - init32mmu(*program); + init32mmu(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[4]; cyc_instruction = m68ki_cycles[4]; @@ -2105,7 +2111,7 @@ void m68000_base_device::init_cpu_fscpu32(void) // dasm_type = M68K_CPU_TYPE_FSCPU32; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[5]; cyc_instruction = m68ki_cycles[5]; @@ -2133,7 +2139,7 @@ void m68000_base_device::init_cpu_coldfire(void) // dasm_type = M68K_CPU_TYPE_COLDFIRE; - init32(*program); + init32(*program, *oprogram); sr_mask = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ jump_table = m68ki_instruction_jump_table[6]; cyc_instruction = m68ki_cycles[6]; @@ -2330,7 +2336,8 @@ const device_type M68K = &device_creator<m68000_base_device>; m68000_base_device::m68000_base_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, M68K, "M68K", tag, owner, clock, "m68k", __FILE__), - m_program_config("program", ENDIANNESS_BIG, 16, 24) + m_program_config("program", ENDIANNESS_BIG, 16, 24), + m_oprogram_config("decrypted_opcodes", ENDIANNESS_BIG, 16, 24) { clear_all(); } @@ -2341,7 +2348,8 @@ m68000_base_device::m68000_base_device(const machine_config &mconfig, const char m68000_base_device::m68000_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 prg_data_width, UINT32 prg_address_bits, address_map_constructor internal_map, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), - m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, internal_map) + m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, internal_map), + m_oprogram_config("decrypted_opcodes", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, internal_map) { clear_all(); } @@ -2350,7 +2358,8 @@ m68000_base_device::m68000_base_device(const machine_config &mconfig, const char m68000_base_device::m68000_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 prg_data_width, UINT32 prg_address_bits, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), - m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits) + m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits), + m_oprogram_config("decrypted_opcodes", ENDIANNESS_BIG, prg_data_width, prg_address_bits) { clear_all(); } @@ -2443,9 +2452,6 @@ void m68000_base_device::clear_all() m_direct = 0; - encrypted_start = 0; - encrypted_end = 0; - iotemp = 0; save_sr = 0; @@ -2536,12 +2542,12 @@ void m68000_base_device::execute_set_input(int inputnum, int state) const address_space_config *m68000_base_device::memory_space_config(address_spacenum spacenum) const { - if (spacenum == AS_PROGRAM) + switch(spacenum) { - return &m_program_config; + case AS_PROGRAM: return &m_program_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_oprogram_config : NULL; + default: return NULL; } - - return NULL; } diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h index 03909114628..831fb024a88 100644 --- a/src/emu/cpu/m68000/m68kcpu.h +++ b/src/emu/cpu/m68000/m68kcpu.h @@ -626,26 +626,17 @@ INLINE unsigned int m68k_read_immediate_32(m68000_base_device *m68k, unsigned in INLINE unsigned int m68k_read_pcrelative_8(m68000_base_device *m68k, unsigned int address) { - if (address >= m68k->encrypted_start && address < m68k->encrypted_end) - return ((m68k->/*memory.*/readimm16(address&~1)>>(8*(1-(address & 1))))&0xff); - - return m68k->/*memory.*/read8(address); + return ((m68k->/*memory.*/readimm16(address&~1)>>(8*(1-(address & 1))))&0xff); } INLINE unsigned int m68k_read_pcrelative_16(m68000_base_device *m68k, unsigned int address) { - if (address >= m68k->encrypted_start && address < m68k->encrypted_end) - return m68k->/*memory.*/readimm16(address); - - return m68k->/*memory.*/read16(address); + return m68k->/*memory.*/readimm16(address); } INLINE unsigned int m68k_read_pcrelative_32(m68000_base_device *m68k, unsigned int address) { - if (address >= m68k->encrypted_start && address < m68k->encrypted_end) - return m68k_read_immediate_32(m68k, address); - - return m68k->/*memory.*/read32(address); + return m68k_read_immediate_32(m68k, address); } diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c index 8df8c9416ac..b7fc47c8dfc 100644 --- a/src/emu/cpu/m6805/m6805.c +++ b/src/emu/cpu/m6805/m6805.c @@ -53,14 +53,14 @@ /* opcodes. In case of system with memory mapped I/O, this function can be */ /* used to greatly speed up emulation */ /****************************************************************************/ -#define M6805_RDOP(addr) ((unsigned)m_direct->read_decrypted_byte(addr)) +#define M6805_RDOP(addr) ((unsigned)m_direct->read_byte(addr)) /****************************************************************************/ /* M6805_RDOP_ARG() is identical to M6805_RDOP() but it's used for reading */ /* opcode arguments. This difference can be used to support systems that */ /* use different encoding mechanisms for opcodes and opcode arguments */ /****************************************************************************/ -#define M6805_RDOP_ARG(addr) ((unsigned)m_direct->read_raw_byte(addr)) +#define M6805_RDOP_ARG(addr) ((unsigned)m_direct->read_byte(addr)) #define SP_MASK m_sp_mask /* stack pointer mask */ #define SP_LOW m_sp_low /* stack pointer low water mark */ diff --git a/src/emu/cpu/m6809/hd6309.ops b/src/emu/cpu/m6809/hd6309.ops index cddde7318d4..6da3a904d2b 100644 --- a/src/emu/cpu/m6809/hd6309.ops +++ b/src/emu/cpu/m6809/hd6309.ops @@ -14,9 +14,6 @@ MAIN: // opcode fetch @m_opcode = read_opcode(); - // burn delay loops - burn_any_delay_loops(); - // dispatch opcode switch(m_opcode) { diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index 1b7b0e1e777..d69b0417453 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -113,8 +113,10 @@ m6809_base_device::m6809_base_device(const machine_config &mconfig, const char * : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), m_lic_func(*this), m_program_config("program", ENDIANNESS_BIG, 8, 16), + m_sprogram_config("decrypted_opcodes", ENDIANNESS_BIG, 8, 16), m_clock_divider(divider) { + m_mintf = NULL; } @@ -124,7 +126,14 @@ m6809_base_device::m6809_base_device(const machine_config &mconfig, const char * void m6809_base_device::device_start() { - m_direct = &m_addrspace[AS_PROGRAM]->direct(); + if (!m_mintf) + m_mintf = new mi_default; + + m_mintf->m_program = &space(AS_PROGRAM); + m_mintf->m_sprogram = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : m_mintf->m_program; + + m_mintf->m_direct = &m_mintf->m_program->direct(); + m_mintf->m_sdirect = &m_mintf->m_sprogram->direct(); m_lic_func.resolve_safe(); @@ -280,11 +289,12 @@ void m6809_base_device::device_post_load() const address_space_config *m6809_base_device::memory_space_config(address_spacenum spacenum) const { - if (spacenum == AS_PROGRAM) + switch(spacenum) { - return &m_program_config; + case AS_PROGRAM: return &m_program_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_sprogram_config : NULL; + default: return NULL; } - return NULL; } @@ -539,6 +549,28 @@ void m6809_base_device::execute_run() } +UINT8 m6809_base_device::mi_default::read(UINT16 adr) +{ + return m_program->read_byte(adr); +} + +UINT8 m6809_base_device::mi_default::read_opcode(UINT16 adr) +{ + return m_sdirect->read_byte(adr); +} + +UINT8 m6809_base_device::mi_default::read_opcode_arg(UINT16 adr) +{ + return m_direct->read_byte(adr); +} + + +void m6809_base_device::mi_default::write(UINT16 adr, UINT8 val) +{ + m_program->write_byte(adr, val); +} + + //------------------------------------------------- // m6809_device diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index 7b14a6882e5..595585cd098 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -39,6 +39,27 @@ public: DECLARE_WRITE_LINE_MEMBER( nmi_line ); protected: + class memory_interface { + public: + address_space *m_program, *m_sprogram; + direct_read_data *m_direct, *m_sdirect; + + virtual ~memory_interface() {} + virtual UINT8 read(UINT16 adr) = 0; + virtual UINT8 read_opcode(UINT16 adr) = 0; + virtual UINT8 read_opcode_arg(UINT16 adr) = 0; + virtual void write(UINT16 adr, UINT8 val) = 0; + }; + + class mi_default : public memory_interface { + public: + virtual ~mi_default() {} + virtual UINT8 read(UINT16 adr); + virtual UINT8 read_opcode(UINT16 adr); + virtual UINT8 read_opcode_arg(UINT16 adr); + virtual void write(UINT16 adr, UINT8 val); + }; + // device-level overrides virtual void device_start(); virtual void device_reset(); @@ -119,6 +140,9 @@ protected: VECTOR_RESET_FFFE = 0xFFFE }; + // Memory interface + memory_interface * m_mintf; + // CPU registers PAIR16 m_pc; // program counter PAIR16 m_ppc; // previous program counter @@ -151,19 +175,19 @@ protected: void eat_remaining(); // read a byte from given memory location - inline UINT8 read_memory(UINT16 address) { eat(1); return m_addrspace[AS_PROGRAM]->read_byte(address); } + inline UINT8 read_memory(UINT16 address) { eat(1); return m_mintf->read(address); } // write a byte to given memory location - inline void write_memory(UINT16 address, UINT8 data) { eat(1); m_addrspace[AS_PROGRAM]->write_byte(address, data); } + inline void write_memory(UINT16 address, UINT8 data) { eat(1); m_mintf->write(address, data); } // read_opcode() is like read_memory() except it is used for reading opcodes. In the case of a system // with memory mapped I/O, this function can be used to greatly speed up emulation. - inline UINT8 read_opcode(UINT16 address) { eat(1); return m_direct->read_decrypted_byte(address); } + inline UINT8 read_opcode(UINT16 address) { eat(1); return m_mintf->read_opcode(address); } // read_opcode_arg() is identical to read_opcode() except it is used for reading opcode arguments. This // difference can be used to support systems that use different encoding mechanisms for opcodes // and opcode arguments. - inline UINT8 read_opcode_arg(UINT16 address) { eat(1); return m_direct->read_raw_byte(address); } + inline UINT8 read_opcode_arg(UINT16 address) { eat(1); return m_mintf->read_opcode_arg(address); } // read_opcode() and bump the program counter inline UINT8 read_opcode() { return read_opcode(m_pc.w++); } @@ -187,10 +211,6 @@ protected: void write_operand(UINT8 data); void write_operand(int ordinal, UINT8 data); - // delay loops - bool match_target_bytes(UINT16 address, const UINT8 *bytes, int length); - void burn_any_delay_loops(); - // instructions void daa(); void mul(); @@ -245,7 +265,7 @@ protected: private: // address spaces const address_space_config m_program_config; - direct_read_data * m_direct; + const address_space_config m_sprogram_config; // other state UINT32 m_state; diff --git a/src/emu/cpu/m6809/m6809.ops b/src/emu/cpu/m6809/m6809.ops index 49fe45644b9..96b9f6c11a7 100644 --- a/src/emu/cpu/m6809/m6809.ops +++ b/src/emu/cpu/m6809/m6809.ops @@ -16,9 +16,6 @@ MAIN: @m_opcode = read_opcode(); m_lic_func(CLEAR_LINE); - // burn delay loops - burn_any_delay_loops(); - // dispatch opcode switch(m_opcode) { diff --git a/src/emu/cpu/m6809/m6809inl.h b/src/emu/cpu/m6809/m6809inl.h index 4959bcb7fda..8fd1cfe330d 100644 --- a/src/emu/cpu/m6809/m6809inl.h +++ b/src/emu/cpu/m6809/m6809inl.h @@ -126,48 +126,6 @@ inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, UINT //------------------------------------------------- -// match_target_bytes -//------------------------------------------------- - -inline ATTR_FORCE_INLINE bool m6809_base_device::match_target_bytes(UINT16 address, const UINT8 *bytes, int length) -{ - UINT8 *start_raw = (UINT8 *) m_direct->read_raw_ptr(address); - UINT8 *start_decrypted = (UINT8 *) m_direct->read_decrypted_ptr(address); - UINT8 *end_raw = (UINT8 *) m_direct->read_raw_ptr(address + length - 1); - UINT8 *end_decrypted = (UINT8 *) m_direct->read_decrypted_ptr(address + length - 1); - - return (start_raw != NULL) - && (end_raw != NULL) - && (start_raw == start_decrypted) - && (end_raw == end_decrypted) - && (start_raw + length - 1 == end_raw) - && !memcmp(start_raw, bytes, length); -} - - -//------------------------------------------------- -// burn_any_delay_loops - optimization for delay -// loops -//------------------------------------------------- - -inline ATTR_FORCE_INLINE void m6809_base_device::burn_any_delay_loops() -{ - static const UINT8 target_bytes[] = { 0x30, 0x1F, 0x26, 0xFC }; - - if ((m_opcode == 0x26) - && !(m_cc & CC_Z) - && !(machine().debug_flags & DEBUG_FLAG_CALL_HOOK) - && match_target_bytes(m_pc.w - 3, target_bytes, ARRAY_LENGTH(target_bytes))) - { - // LEAX -1,X ; BNE * - UINT16 burned_loops = MIN((int) m_x.w - 1, m_icount / 8); - m_x.w -= burned_loops; - eat(burned_loops * 8); - } -} - - -//------------------------------------------------- // daa - decimal arithmetic adjustment instruction //------------------------------------------------- diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index c9ccd6e31ad..0ad34296064 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -69,7 +69,7 @@ offs_t mb86233_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN #define GETBRAM() m_BRAM #define GETREPCNT() m_repcnt -#define ROPCODE(a) m_direct->read_decrypted_dword(a<<2) +#define ROPCODE(a) m_direct->read_dword(a<<2) #define RDMEM(a) m_program->read_dword((a<<2)) #define WRMEM(a,v) m_program->write_dword((a<<2), v) diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index 2bd49a6374d..0508bfad1d4 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -47,7 +47,7 @@ const device_type MB8844 = &device_creator<mb8844_cpu_device>; MACROS ***************************************************************************/ -#define READOP(a) (m_direct->read_decrypted_byte(a)) +#define READOP(a) (m_direct->read_byte(a)) #define RDMEM(a) (m_data->read_byte(a)) #define WRMEM(a,v) (m_data->write_byte((a), (v))) diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 1ead2b94fdf..f05d9126334 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -300,13 +300,13 @@ void mc68hc11_cpu_device::hc11_regs_w(UINT32 address, UINT8 value) UINT8 mc68hc11_cpu_device::FETCH() { - return m_direct->read_decrypted_byte(m_pc++); + return m_direct->read_byte(m_pc++); } UINT16 mc68hc11_cpu_device::FETCH16() { UINT16 w; - w = (m_direct->read_decrypted_byte(m_pc) << 8) | (m_direct->read_decrypted_byte(m_pc+1)); + w = (m_direct->read_byte(m_pc) << 8) | (m_direct->read_byte(m_pc+1)); m_pc += 2; return w; } diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index 6025ffe07cd..a24cf72f0d6 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -348,7 +348,7 @@ offs_t upi41_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 UINT8 mcs48_cpu_device::opcode_fetch() { - return m_direct->read_decrypted_byte(m_pc++); + return m_direct->read_byte(m_pc++); } @@ -359,7 +359,7 @@ UINT8 mcs48_cpu_device::opcode_fetch() UINT8 mcs48_cpu_device::argument_fetch() { - return m_direct->read_raw_byte(m_pc++); + return m_direct->read_byte(m_pc++); } diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c index d3c73ecf0c6..3e262b68c8c 100644 --- a/src/emu/cpu/mcs51/mcs51.c +++ b/src/emu/cpu/mcs51/mcs51.c @@ -379,8 +379,8 @@ ds5002fp_device::ds5002fp_device(const machine_config &mconfig, const char *tag, ***************************************************************************/ /* Read Opcode/Opcode Arguments from Program Code */ -#define ROP(pc) m_direct->read_decrypted_byte(pc) -#define ROP_ARG(pc) m_direct->read_raw_byte(pc) +#define ROP(pc) m_direct->read_byte(pc) +#define ROP_ARG(pc) m_direct->read_byte(pc) /* Read a byte from External Code Memory (Usually Program Rom(s) Space) */ #define CODEMEM_R(a) (UINT8)m_program->read_byte(a) @@ -1996,7 +1996,7 @@ void mcs51_cpu_device::execute_run() /* Read next opcode */ PPC = PC; debugger_instruction_hook(this, PC); - op = m_direct->read_decrypted_byte(PC++); + op = m_direct->read_byte(PC++); /* process opcode and count cycles */ m_inst_cycles = mcs51_cycles[op]; diff --git a/src/emu/cpu/mcs96/mcs96.h b/src/emu/cpu/mcs96/mcs96.h index 3f91c0b64ea..d121a31e546 100644 --- a/src/emu/cpu/mcs96/mcs96.h +++ b/src/emu/cpu/mcs96/mcs96.h @@ -119,7 +119,7 @@ protected: inline void next(int cycles) { icount -= cycles_scaling*cycles; inst_state = STATE_FETCH; } inline void next_noirq(int cycles) { icount -= cycles_scaling*cycles; inst_state = STATE_FETCH_NOIRQ; } void check_irq(); - inline UINT8 read_pc() { return direct->read_decrypted_byte(PC++); } + inline UINT8 read_pc() { return direct->read_byte(PC++); } void reg_w8(UINT8 adr, UINT8 data); void reg_w16(UINT8 adr, UINT16 data); diff --git a/src/emu/cpu/melps4/m58846.c b/src/emu/cpu/melps4/m58846.c index ac14baf797d..4d892d38307 100644 --- a/src/emu/cpu/melps4/m58846.c +++ b/src/emu/cpu/melps4/m58846.c @@ -4,14 +4,9 @@ Mitsubishi M58846 MCU - TODO: - - o hai - */ #include "m58846.h" -#include "debugger.h" - const device_type M58846 = &device_creator<m58846_device>; @@ -50,6 +45,7 @@ offs_t m58846_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o void m58846_device::device_start() { melps4_cpu_device::device_start(); + m_timer = timer_alloc(0); } @@ -61,6 +57,58 @@ void m58846_device::device_start() void m58846_device::device_reset() { melps4_cpu_device::device_reset(); + reset_timer(); +} + + + +//------------------------------------------------- +// timers +//------------------------------------------------- + +void m58846_device::reset_timer() +{ + attotime base = attotime::from_ticks(6, unscaled_clock()); + m_timer->adjust(base); +} + +void m58846_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id != 0) + return; + + // timer 1: 7-bit fixed counter (manual specifically says 127) + if (++m_tmr_count[0] == 127) + { + m_tmr_count[0] = 0; + m_irqflag[1] = true; + m_possible_irq = true; + } + + // timer 2: 8-bit user defined counter with auto-reload + if (m_v & 8 && ++m_tmr_count[1] == 0) + { + m_tmr_count[1] = m_tmr_reload; + m_irqflag[2] = true; + m_possible_irq = true; + m_port_t ^= 1; + m_write_t(m_port_t); + } + + // schedule next timeout + reset_timer(); +} + +void m58846_device::write_v(UINT8 data) +{ + // d0: enable timer 1 irq + // d1: enable timer 2 irq? (TODO) + // d2: ? + // d3: timer 2 enable + m_tmr_irq_enabled[0] = (data & 1) ? true : false; + m_possible_irq = true; + + m_v = data; } @@ -72,7 +120,7 @@ void m58846_device::device_reset() void m58846_device::execute_one() { // handle one opcode - switch (m_op & 0xf0) + switch (m_op & 0x1f0) { case 0x30: op_sey(); break; case 0x70: op_sp(); break; @@ -82,7 +130,7 @@ void m58846_device::execute_one() case 0xc0: case 0xd0: case 0xe0: case 0xf0: op_lxy(); break; default: - switch (m_op & 0xfc) + switch (m_op & 0x1fc) { case 0x20: op_szb(); break; case 0x4c: op_sb(); break; @@ -107,11 +155,11 @@ void m58846_device::execute_one() case 0x03: op_dey(); break; case 0x04: op_di(); break; case 0x05: op_ei(); break; + case 0x09: op_tabe(); break; // undocumented case 0x0a: op_am(); break; case 0x0b: op_ose(); break; case 0x0c: op_tya(); break; case 0x0f: op_cma(); break; - // 0x18 RAR undocumented? case 0x10: op_cls(); break; case 0x11: op_clds(); break; @@ -120,6 +168,8 @@ void m58846_device::execute_one() case 0x15: op_sd(); break; case 0x16: op_tepa(); break; case 0x17: op_ospa(); break; + case 0x18: op_rl(); break; // undocumented + case 0x19: op_rr(); break; // undocumented case 0x1a: op_teab(); break; case 0x1b: op_osab(); break; case 0x1c: op_tba(); break; @@ -154,10 +204,10 @@ void m58846_device::execute_one() break; } - break; // 0xff + break; // 0x1ff } - break; // 0xfc + break; // 0x1fc } // big switch } diff --git a/src/emu/cpu/melps4/m58846.h b/src/emu/cpu/melps4/m58846.h index 7ee094df568..25d850b455e 100644 --- a/src/emu/cpu/melps4/m58846.h +++ b/src/emu/cpu/melps4/m58846.h @@ -29,6 +29,13 @@ protected: // device_disasm_interface overrides virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + + // timers + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void write_v(UINT8 data); + + emu_timer *m_timer; + void reset_timer(); }; diff --git a/src/emu/cpu/melps4/melps4.c b/src/emu/cpu/melps4/melps4.c index 5fdd2b1cab6..9986407aad4 100644 --- a/src/emu/cpu/melps4/melps4.c +++ b/src/emu/cpu/melps4/melps4.c @@ -31,6 +31,10 @@ - 1980 and 1982 Mitsubishi LSI Data Books - M34550Mx-XXXFP datasheet (this one is MELPS 720 family) + TODO: + - need more drivers that use this, to be sure that emulation is accurate + - add output PLA + */ #include "melps4.h" @@ -46,12 +50,15 @@ void melps4_cpu_device::state_string_export(const device_state_entry &entry, std { // obviously not from a single flags register, letters are made up case STATE_GENFLAGS: - strprintf(str, "%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c %c%c%c", m_intp ? 'P':'p', m_inte ? 'I':'i', m_sm ? 'S':'s', m_cps ? 'D':'d', - m_cy ? 'C':'c' + m_cy ? 'C':'c', + m_irqflag[0] ? 'X':'.', // exf + m_irqflag[1] ? '1':'.', // 1f + m_irqflag[2] ? '2':'.' // 2f ); break; @@ -78,7 +85,7 @@ void melps4_cpu_device::device_start() m_prgmask = (1 << m_prgwidth) - 1; m_datamask = (1 << m_datawidth) - 1; m_d_mask = (1 << m_d_pins) - 1; - + // resolve callbacks m_read_k.resolve_safe(0); m_read_d.resolve_safe(0); @@ -99,10 +106,11 @@ void melps4_cpu_device::device_start() m_op = 0; m_prev_op = 0; m_bitmask = 0; - + m_port_d = 0; m_port_s = 0; m_port_f = 0; + m_port_t = 0; m_sm = m_sms = false; m_ba_flag = false; @@ -111,7 +119,15 @@ void melps4_cpu_device::device_start() m_skip = false; m_inte = 0; m_intp = 1; + m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; + m_int_state = 0; + m_t_in_state = 0; m_prohibit_irq = false; + m_possible_irq = false; + + memset(m_tmr_count, 0, sizeof(m_tmr_count)); + m_tmr_reload = 0; + m_tmr_irq_enabled[0] = m_tmr_irq_enabled[1] = false; m_a = 0; m_b = 0; @@ -138,6 +154,7 @@ void melps4_cpu_device::device_start() save_item(NAME(m_port_d)); save_item(NAME(m_port_s)); save_item(NAME(m_port_f)); + save_item(NAME(m_port_t)); save_item(NAME(m_sm)); save_item(NAME(m_sms)); @@ -147,7 +164,15 @@ void melps4_cpu_device::device_start() save_item(NAME(m_skip)); save_item(NAME(m_inte)); save_item(NAME(m_intp)); + save_item(NAME(m_irqflag)); + save_item(NAME(m_int_state)); + save_item(NAME(m_t_in_state)); save_item(NAME(m_prohibit_irq)); + save_item(NAME(m_possible_irq)); + + save_item(NAME(m_tmr_count)); + save_item(NAME(m_tmr_reload)); + save_item(NAME(m_tmr_irq_enabled)); save_item(NAME(m_a)); save_item(NAME(m_b)); @@ -165,7 +190,7 @@ void melps4_cpu_device::device_start() // register state for debugger state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow(); - state_add(STATE_GENFLAGS, "GENFLAGS", m_cy).formatstr("%5s").noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_cy).formatstr("%9s").noshow(); state_add(MELPS4_PC, "PC", m_pc).formatstr("%04X"); state_add(MELPS4_A, "A", m_a).formatstr("%2d"); // show in decimal @@ -194,25 +219,27 @@ void melps4_cpu_device::device_reset() { m_sm = m_sms = false; m_ba_flag = false; - m_prohibit_irq = false; - m_skip = false; m_op = m_prev_op = 0; m_pc = m_prev_pc = 0; + op_lcps(); // CPS=0 + + // clear interrupts m_inte = 0; m_intp = 1; - op_lcps(); // CPS=0 + write_v(0); + write_w(0); + m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; + m_prohibit_irq = false; + m_possible_irq = false; - m_v = 0; - m_w = 0; - // clear ports write_d_pin(MELPS4_PORTD_CLR, 0); write_gen_port(MELPS4_PORTS, 0); write_gen_port(MELPS4_PORTF, 0); write_gen_port(MELPS4_PORTG, 0); write_gen_port(MELPS4_PORTU, 0); - m_write_t(0); + m_write_t(0); m_port_t = 0; } @@ -230,7 +257,7 @@ UINT8 melps4_cpu_device::read_gen_port(int port) return m_port_s | m_read_s(port, 0xff); case MELPS4_PORTF: return m_port_f | (m_read_f(port, 0xff) & 0xf); - + default: break; } @@ -257,7 +284,7 @@ void melps4_cpu_device::write_gen_port(int port, UINT8 data) case MELPS4_PORTU: m_write_u(port, data & 1, 0xff); break; - + default: break; } @@ -279,7 +306,7 @@ void melps4_cpu_device::write_d_pin(int bit, int state) m_port_d = 0; m_write_d(bit, 0, 0xffff); } - + // set/reset one port D pin else { @@ -292,6 +319,74 @@ void melps4_cpu_device::write_d_pin(int bit, int state) //------------------------------------------------- +// interrupts +//------------------------------------------------- + +void melps4_cpu_device::execute_set_input(int line, int state) +{ + state = (state) ? 1 : 0; + + switch (line) + { + // external interrupt + case MELPS4_INPUT_LINE_INT: + // irq on rising/falling edge + if (state != m_int_state && state == m_intp) + { + m_irqflag[0] = true; + m_possible_irq = true; + } + m_int_state = state; + break; + + // timer input pin + case MELPS4_INPUT_LINE_T: + write_t_in(state); + break; + + default: + break; + } +} + +void melps4_cpu_device::do_interrupt(int which) +{ + m_inte = 0; + m_irqflag[which] = false; + + m_icount--; + push_pc(); + m_sms = m_sm; + m_sm = false; + m_op = 0; // fake nop + m_pc = m_int_page << 7 | (which * 2); + + standard_irq_callback(which); +} + +void melps4_cpu_device::check_interrupt() +{ + if (!m_inte) + return; + + int which = 0; + + // assume that lower irq vectors have higher priority + if (m_irqflag[0]) + which = 0; + else if (m_irqflag[1] && m_tmr_irq_enabled[0]) + which = 1; + else if (m_irqflag[2] && m_tmr_irq_enabled[1]) + which = 2; + else + return; + + do_interrupt(which); +} + + + +//------------------------------------------------- // execute //------------------------------------------------- @@ -313,9 +408,15 @@ void melps4_cpu_device::execute_run() // remember previous state m_prev_op = m_op; m_prev_pc = m_pc; - - // irq is not accepted during skip or LXY, LA, EI, DI, RT/RTS/RTI or any branch - //.. + + // Interrupts are not accepted during skips or LXY, LA, EI, DI, RT/RTS/RTI or any branch. + // Documentation is conflicting here: older docs say that it is allowed during skips, + // newer docs specifically say when interrupts are prohibited. + if (m_possible_irq && !m_prohibit_irq && !m_skip) + { + m_possible_irq = false; + check_interrupt(); + } m_prohibit_irq = false; // fetch next opcode @@ -330,7 +431,10 @@ void melps4_cpu_device::execute_run() { // if it's a long jump, skip next one as well if (m_op != m_ba_op && (m_op & ~0xf) != m_sp_mask) + { m_skip = false; + m_op = 0; // fake nop + } } else execute_one(); diff --git a/src/emu/cpu/melps4/melps4.h b/src/emu/cpu/melps4/melps4.h index 023b0b9ba02..329ea035b13 100644 --- a/src/emu/cpu/melps4/melps4.h +++ b/src/emu/cpu/melps4/melps4.h @@ -60,6 +60,12 @@ enum MELPS4_PORTU }; +enum +{ + MELPS4_INPUT_LINE_INT = 0, + MELPS4_INPUT_LINE_T +}; + // pinout reference @@ -142,8 +148,9 @@ protected: virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 6 - 1) / 6; } // 6 t-states per machine cycle virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 6); } // " virtual UINT32 execute_min_cycles() const { return 1; } - virtual UINT32 execute_max_cycles() const { return 1; } + virtual UINT32 execute_max_cycles() const { return 1+1; } // max opcode cycles + interrupt duration virtual UINT32 execute_input_lines() const { return 3; } // up to 3 (some internal) + virtual void execute_set_input(int line, int state); virtual void execute_run(); virtual void execute_one(); @@ -184,19 +191,28 @@ protected: UINT16 m_op; UINT16 m_prev_op; UINT8 m_bitmask; // opcode bit argument - + UINT16 m_port_d; // last written port data UINT8 m_port_s; // " UINT8 m_port_f; // " + UINT8 m_port_t; // " - bool m_sm, m_sms; // subroutine mode flag + stack + bool m_sm, m_sms; // subroutine mode flag + irq stack bool m_ba_flag; // temp flag indicates BA opcode was executed UINT8 m_sp_param; // temp register holding SP opcode parameter UINT8 m_cps; // DP,CY or DP',CY' selected bool m_skip; // skip next opcode UINT8 m_inte; // interrupt enable flag - UINT8 m_intp; // external interrupt polarity ('40 to '44) + int m_intp; // external interrupt polarity ('40 to '44) + bool m_irqflag[3]; // irq flags: exf, 1f, 2f (external, timer 1, timer 2) + int m_int_state; // INT pin state + int m_t_in_state; // T input pin state bool m_prohibit_irq; // interrupt is prohibited during certain opcodes + bool m_possible_irq; // indicate that irq needs to be rechecked + + UINT8 m_tmr_count[2]; // timer active count + UINT8 m_tmr_reload; // timer(2) auto reload + bool m_tmr_irq_enabled[2]; // work registers (unless specified, each is 4-bit) UINT8 m_a; // accumulator @@ -226,6 +242,12 @@ protected: devcb_write8 m_write_u; devcb_write_line m_write_t; + virtual void write_t_in(int state) { m_t_in_state = state; } + virtual void write_v(UINT8 data) { m_v = data; } + virtual void write_w(UINT8 data) { m_w = data; } + virtual void do_interrupt(int which); + virtual void check_interrupt(); + UINT8 read_gen_port(int port); void write_gen_port(int port, UINT8 data); int read_d_pin(int bit); @@ -243,6 +265,7 @@ protected: void op_tay(); void op_tya(); void op_teab(); + void op_tabe(); void op_tepa(); void op_txa(); void op_tax(); @@ -268,6 +291,8 @@ protected: void op_rc(); void op_szc(); void op_cma(); + void op_rl(); + void op_rr(); void op_sb(); void op_rb(); diff --git a/src/emu/cpu/melps4/melps4d.c b/src/emu/cpu/melps4/melps4d.c index 01d9b51f5ce..4c2ca2fd9d4 100644 --- a/src/emu/cpu/melps4/melps4d.c +++ b/src/emu/cpu/melps4/melps4d.c @@ -18,10 +18,10 @@ enum e_mnemonics { em_ILL, - em_TAB, em_TBA, em_TAY, em_TYA, em_TEAB, em_TEPA, em_TXA, em_TAX, + em_TAB, em_TBA, em_TAY, em_TYA, em_TEAB, em_TABE, em_TEPA, em_TXA, em_TAX, em_LXY, em_LZ, em_INY, em_DEY, em_LCPS, em_SADR, em_TAM, em_XAM, em_XAMD, em_XAMI, - em_LA, em_AM, em_AMC, em_AMCS, em_A, em_SC, em_RC, em_SZC, em_CMA, + em_LA, em_AM, em_AMC, em_AMCS, em_A, em_SC, em_RC, em_SZC, em_CMA, em_RL, em_RR, em_SB, em_RB, em_SZB, em_SEAM, em_SEY, em_TLA, em_THA, em_TAJ, em_XAL, em_XAH, em_LC7, em_DEC, em_SHL, em_RHL, em_CPA, em_CPAS, em_CPAE, em_SZJ, em_T1AB, em_TRAB, em_T2AB, em_TAB1, em_TABR, em_TAB2, em_TVA, em_TWA, em_SNZ1, em_SNZ2, @@ -33,10 +33,10 @@ enum e_mnemonics static const char *const em_name[] = { "?", - "TAB", "TBA", "TAY", "TYA", "TEAB", "TEPA", "TXA", "TAX", + "TAB", "TBA", "TAY", "TYA", "TEAB", "TABE", "TEPA", "TXA", "TAX", "LXY", "LZ", "INY", "DEY", "LCPS", "SADR", "TAM", "XAM", "XAMD", "XAMI", - "LA", "AM", "AMC", "AMCS", "A", "SC", "RC", "SZC", "CMA", + "LA", "AM", "AMC", "AMCS", "A", "SC", "RC", "SZC", "CMA", "RL", "RR", "SB", "RB", "SZB", "SEAM", "SEY", "TLA", "THA", "TAJ", "XAL", "XAH", "LC7", "DEC", "SHL", "RHL", "CPA", "CPAS", "CPAE", "SZJ", "T1AB", "TRAB", "T2AB", "TAB1", "TABR", "TAB2", "TVA", "TWA", "SNZ1", "SNZ2", @@ -49,10 +49,10 @@ static const char *const em_name[] = static const UINT8 em_bits[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 1, 2, 2, 2, 2, 2, - 4, 0, 0, 0, 4, 0, 0, 0, 0, + 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -67,10 +67,10 @@ static const UINT8 em_bits[] = static const UINT32 em_flags[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -86,8 +86,8 @@ static const UINT32 em_flags[] = static const UINT8 m58846_opmap[0xc0] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F - em_NOP, em_BA, em_INY, em_DEY, em_DI, em_EI, em_RU, em_SU, 0, 0, em_AM, em_OSE, em_TYA, 0, 0, em_CMA, // 0x - em_CLS, em_CLDS, 0, em_CLD, em_RD, em_SD, em_TEPA, em_OSPA, 0, 0, em_TEAB, em_OSAB, em_TBA, em_TAY, em_TAB, 0, // 1x + em_NOP, em_BA, em_INY, em_DEY, em_DI, em_EI, em_RU, em_SU, 0, em_TABE, em_AM, em_OSE, em_TYA, 0, 0, em_CMA, // 0x + em_CLS, em_CLDS, 0, em_CLD, em_RD, em_SD, em_TEPA, em_OSPA, em_RL, em_RR, em_TEAB, em_OSAB, em_TBA, em_TAY, em_TAB, 0, // 1x em_SZB, em_SZB, em_SZB, em_SZB, 0, 0, em_SEAM, 0, 0, 0, 0, em_SZD, 0, 0, 0, em_SZC, // 2x em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, // 3x em_LCPS, em_LCPS, 0, em_AMC, em_RT, em_RTS, em_RTI, 0, em_RC, em_SC, em_LZ, em_LZ, em_SB, em_SB, em_SB, em_SB, // 4x diff --git a/src/emu/cpu/melps4/melps4op.inc b/src/emu/cpu/melps4/melps4op.inc index 476de900e93..f9afc5eda91 100644 --- a/src/emu/cpu/melps4/melps4op.inc +++ b/src/emu/cpu/melps4/melps4op.inc @@ -64,6 +64,13 @@ void melps4_cpu_device::op_teab() m_e = m_b << 4 | m_a; } +void melps4_cpu_device::op_tabe() +{ + // TABE(undocumented): transfer E to A and B + m_a = m_e & 0xf; + m_b = m_e >> 4; +} + void melps4_cpu_device::op_tepa() { // TEPA: decode A by PLA and transfer to E @@ -169,14 +176,14 @@ void melps4_cpu_device::op_xam() void melps4_cpu_device::op_xamd() { - // XAMD j: XAM J, DEY + // XAMD j: XAM j, DEY op_xam(); op_dey(); } void melps4_cpu_device::op_xami() { - // XAMI j: XAM J, skip next on Y mask(default 0xf), increment Y + // XAMI j: XAM j, skip next on Y mask(default 0xf), increment Y op_xam(); m_skip = ((m_y & m_xami_mask) == m_xami_mask); m_y = (m_y + 1) & 0xf; @@ -247,6 +254,22 @@ void melps4_cpu_device::op_cma() m_a ^= 0xf; } +void melps4_cpu_device::op_rl() +{ + // RL(undocumented): rotate A left through carry + UINT8 c = m_a >> 3 & 1; + m_a = (m_a << 1 | m_cy) & 0xf; + m_cy = c; +} + +void melps4_cpu_device::op_rr() +{ + // RR(undocumented): rotate A right through carry + UINT8 c = m_a & 1; + m_a = m_a >> 1 | m_cy << 3; + m_cy = c; +} + // Bit operations @@ -383,61 +406,66 @@ void melps4_cpu_device::op_szj() void melps4_cpu_device::op_t1ab() { // T1AB: transfer A and B to timer 1 - op_illegal(); + m_tmr_count[0] = m_b << 4 | m_a; } void melps4_cpu_device::op_trab() { // TRAB: transfer A and B to timer 2 reload - op_illegal(); + m_tmr_reload = m_b << 4 | m_a; } void melps4_cpu_device::op_t2ab() { // T2AB: transfer A and B to timer 2 and timer 2 reload - op_illegal(); + m_tmr_reload = m_tmr_count[1] = m_b << 4 | m_a; } void melps4_cpu_device::op_tab1() { // TAB1: transfer timer 1 to A and B - op_illegal(); + m_a = m_tmr_count[0] & 0xf; + m_b = m_tmr_count[0] >> 4; } void melps4_cpu_device::op_tabr() { // TABR: transfer timer 2 reload to A and B - op_illegal(); + m_a = m_tmr_reload & 0xf; + m_b = m_tmr_reload >> 4; } void melps4_cpu_device::op_tab2() { // TAB2: transfer timer 2 to A and B - op_illegal(); + m_a = m_tmr_count[1] & 0xf; + m_b = m_tmr_count[1] >> 4; } void melps4_cpu_device::op_tva() { // TVA: transfer A to timer control V - m_v = m_a; + write_v(m_a); } void melps4_cpu_device::op_twa() { // TWA: transfer A to timer control W - m_w = m_a; + write_w(m_a); } void melps4_cpu_device::op_snz1() { // SNZ1: skip next on flag 1F - op_illegal(); + m_skip = m_irqflag[1]; + m_irqflag[1] = false; } void melps4_cpu_device::op_snz2() { // SNZ2: skip next on flag 2F - op_illegal(); + m_skip = m_irqflag[2]; + m_irqflag[2] = false; } @@ -462,7 +490,7 @@ void melps4_cpu_device::op_b() { // B xy: branch m_prohibit_irq = true; - + // determine new page: // - short call: subroutine page // - short jump: current page, or sub. page + 1 when in sub. mode @@ -475,9 +503,9 @@ void melps4_cpu_device::op_b() } else if (m_sm) page = m_sm_page | (m_op >> 7 & 1); - + m_pc = page << 7 | (m_op & 0x7f); - + // if BA opcode was executed, set PC low 4 bits to A if (m_ba_flag) { @@ -631,6 +659,7 @@ void melps4_cpu_device::op_ei() { // EI: enable interrupt flag m_prohibit_irq = true; + m_possible_irq = true; m_inte = 1; } diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index 3b377dfa64f..5ceff4b5462 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -101,7 +101,7 @@ static const UINT8 fpmode_source[4] = MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) direct->read_decrypted_dword(pc) +#define ROPCODE(pc) direct->read_dword(pc) const device_type VR4300BE = &device_creator<vr4300be_device>; diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index 70c31df2220..b454d10f74a 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -1095,12 +1095,12 @@ void mips3_device::generate_checksum_block(drcuml_block *block, compiler_state * if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP)) { UINT32 sum = seqhead->opptr.l[0]; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc); + void *base = m_direct->read_ptr(seqhead->physpc); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword if (seqhead->delay.first() != NULL && seqhead->physpc != seqhead->delay.first()->physpc) { - base = m_direct->read_decrypted_ptr(seqhead->delay.first()->physpc); + base = m_direct->read_ptr(seqhead->delay.first()->physpc); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 @@ -1120,20 +1120,20 @@ void mips3_device::generate_checksum_block(drcuml_block *block, compiler_state * for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - void *base = m_direct->read_decrypted_ptr(seqhead->physpc); + void *base = m_direct->read_ptr(seqhead->physpc); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword UML_CMP(block, I0, curdesc->opptr.l[0]); // cmp i0,opptr[0] UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc } #else UINT32 sum = 0; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc); + void *base = m_direct->read_ptr(seqhead->physpc); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword sum += seqhead->opptr.l[0]; for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc); + base = m_direct->read_ptr(curdesc->physpc); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 @@ -1141,7 +1141,7 @@ void mips3_device::generate_checksum_block(drcuml_block *block, compiler_state * if (curdesc->delay.first() != NULL && (curdesc == seqlast || (curdesc->next() != NULL && curdesc->next()->physpc != curdesc->delay.first()->physpc))) { - base = m_direct->read_decrypted_ptr(curdesc->delay.first()->physpc); + base = m_direct->read_ptr(curdesc->delay.first()->physpc); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 diff --git a/src/emu/cpu/mips/mips3fe.c b/src/emu/cpu/mips/mips3fe.c index 7d031c32407..42055c39e24 100644 --- a/src/emu/cpu/mips/mips3fe.c +++ b/src/emu/cpu/mips/mips3fe.c @@ -49,7 +49,7 @@ bool mips3_frontend::describe(opcode_desc &desc, const opcode_desc *prev) // fetch the opcode assert((desc.physpc & 3) == 0); - op = desc.opptr.l[0] = m_mips3->m_direct->read_decrypted_dword(desc.physpc); + op = desc.opptr.l[0] = m_mips3->m_direct->read_dword(desc.physpc); // all instructions are 4 bytes and default to a single cycle each desc.length = 4; diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 5e6fa280884..1b64e05799c 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -498,7 +498,7 @@ offs_t r3000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op inline UINT32 r3000_device::readop(offs_t pc) { - return m_direct->read_decrypted_dword(pc); + return m_direct->read_dword(pc); } UINT8 r3000_device::readmem(offs_t offset) diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c index 0fdb1edd946..bf00be5b984 100644 --- a/src/emu/cpu/mn10200/mn10200.c +++ b/src/emu/cpu/mn10200/mn10200.c @@ -539,7 +539,6 @@ void mn10200_device::execute_run() { while (m_cycles > 0) { - // internal peripheral, external pin, or prev instruction may have changed irq state while (m_possible_irq) { diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index 173e18fdebd..6c53cfa677a 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -210,7 +210,7 @@ void nec_common_device::do_prefetch(int previous_ICount) UINT8 nec_common_device::fetch() { prefetch(); - return m_direct->read_raw_byte((Sreg(PS)<<4)+m_ip++, m_fetch_xor); + return m_direct->read_byte((Sreg(PS)<<4)+m_ip++, m_fetch_xor); } UINT16 nec_common_device::fetchword() @@ -230,7 +230,7 @@ static UINT8 parity_table[256]; UINT8 nec_common_device::fetchop() { prefetch(); - return m_direct->read_decrypted_byte(( Sreg(PS)<<4)+m_ip++, m_fetch_xor); + return m_direct->read_byte(( Sreg(PS)<<4)+m_ip++, m_fetch_xor); } diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c index bf4ee0ab6ed..384043c8f9c 100644 --- a/src/emu/cpu/nec/v25.c +++ b/src/emu/cpu/nec/v25.c @@ -122,7 +122,7 @@ void v25_common_device::do_prefetch(int previous_ICount) UINT8 v25_common_device::fetch() { prefetch(); - return m_direct->read_raw_byte((Sreg(PS)<<4)+m_ip++, m_fetch_xor); + return m_direct->read_byte((Sreg(PS)<<4)+m_ip++, m_fetch_xor); } UINT16 v25_common_device::fetchword() @@ -146,7 +146,7 @@ UINT8 v25_common_device::fetchop() UINT8 ret; prefetch(); - ret = m_direct->read_decrypted_byte(( Sreg(PS)<<4)+m_ip++, m_fetch_xor); + ret = m_direct->read_byte(( Sreg(PS)<<4)+m_ip++, m_fetch_xor); if (m_MF == 0) if (m_v25v35_decryptiontable) diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c index 0c78f34eebd..3acd46944f7 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.c +++ b/src/emu/cpu/pic16c5x/pic16c5x.c @@ -167,7 +167,7 @@ void pic16c5x_device::update_internalram_ptr() -#define PIC16C5x_RDOP(A) (m_direct->read_decrypted_word((A)<<1)) +#define PIC16C5x_RDOP(A) (m_direct->read_word((A)<<1)) #define PIC16C5x_RAM_RDMEM(A) ((UINT8)m_data->read_byte(A)) #define PIC16C5x_RAM_WRMEM(A,V) (m_data->write_byte(A,V)) diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c index 1d2dae52b95..2a38bcd5f93 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.c +++ b/src/emu/cpu/pic16c62x/pic16c62x.c @@ -170,7 +170,7 @@ void pic16c62x_device::update_internalram_ptr() m_internalram = (UINT8 *)m_data->get_write_ptr(0x00); } -#define PIC16C62x_RDOP(A) (m_direct->read_decrypted_word((A)<<1)) +#define PIC16C62x_RDOP(A) (m_direct->read_word((A)<<1)) #define PIC16C62x_RAM_RDMEM(A) ((UINT8)m_data->read_byte(A)) #define PIC16C62x_RAM_WRMEM(A,V) (m_data->write_byte(A,V)) #define PIC16C62x_In(Port) ((UINT8)m_io->read_byte((Port))) diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 561dec685bf..088eab855aa 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -1595,7 +1595,7 @@ void ppc_device::generate_checksum_block(drcuml_block *block, compiler_state *co { if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP)) { - void *base = m_direct->read_decrypted_ptr(seqhead->physpc, m_codexor); + void *base = m_direct->read_ptr(seqhead->physpc, m_codexor); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,dword UML_CMP(block, I0, seqhead->opptr.l[0]); // cmp i0,*opptr UML_EXHc(block, COND_NE, *m_nocode, seqhead->pc); // exne nocode,seqhead->pc @@ -1609,20 +1609,20 @@ void ppc_device::generate_checksum_block(drcuml_block *block, compiler_state *co for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - void *base = m_direct->read_decrypted_ptr(seqhead->physpc, m_codexor); + void *base = m_direct->read_ptr(seqhead->physpc, m_codexor); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,dword UML_CMP(block, I0, curdesc->opptr.l[0]); // cmp i0,*opptr UML_EXHc(block, COND_NE, *m_nocode, seqhead->pc); // exne nocode,seqhead->pc } #else UINT32 sum = 0; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc, m_codexor); + void *base = m_direct->read_ptr(seqhead->physpc, m_codexor); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,dword sum += seqhead->opptr.l[0]; for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc, m_codexor); + base = m_direct->read_ptr(curdesc->physpc, m_codexor); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 sum += curdesc->opptr.l[0]; diff --git a/src/emu/cpu/powerpc/ppcfe.c b/src/emu/cpu/powerpc/ppcfe.c index 94037f7e137..8ba5a90eb4e 100644 --- a/src/emu/cpu/powerpc/ppcfe.c +++ b/src/emu/cpu/powerpc/ppcfe.c @@ -83,7 +83,7 @@ bool ppc_frontend::describe(opcode_desc &desc, const opcode_desc *prev) } // fetch the opcode - op = desc.opptr.l[0] = m_ppc->m_direct->read_decrypted_dword(desc.physpc, m_ppc->m_codexor); + op = desc.opptr.l[0] = m_ppc->m_direct->read_dword(desc.physpc, m_ppc->m_codexor); // all instructions are 4 bytes and default to a single cycle each desc.length = 4; diff --git a/src/emu/cpu/pps4/pps4.c b/src/emu/cpu/pps4/pps4.c index bd04a900030..5be986f2c3d 100644 --- a/src/emu/cpu/pps4/pps4.c +++ b/src/emu/cpu/pps4/pps4.c @@ -115,7 +115,7 @@ offs_t pps4_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr */ inline UINT8 pps4_device::ROP() { - const UINT8 op = m_direct->read_decrypted_byte(m_P & 0xFFF); + const UINT8 op = m_direct->read_byte(m_P & 0xFFF); m_Ip = m_I1; // save previous opcode m_P = (m_P + 1) & 0xFFF; m_icount -= 1; @@ -131,7 +131,7 @@ inline UINT8 pps4_device::ROP() */ inline UINT8 pps4_device::ARG() { - const UINT8 arg = m_direct->read_raw_byte(m_P & 0xFFF); + const UINT8 arg = m_direct->read_byte(m_P & 0xFFF); m_P = (m_P + 1) & 0xFFF; m_icount -= 1; return arg; diff --git a/src/emu/cpu/psx/psx.c b/src/emu/cpu/psx/psx.c index 271c419c479..a60a1204b9f 100644 --- a/src/emu/cpu/psx/psx.c +++ b/src/emu/cpu/psx/psx.c @@ -1437,7 +1437,7 @@ void psxcpu_device::update_cop0( int reg ) ( m_cp0r[ CP0_SR ] & SR_IEC ) != 0 && ( m_cp0r[ CP0_SR ] & m_cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 ) { - m_op = m_direct->read_decrypted_dword( m_pc ); + m_op = m_direct->read_dword( m_pc ); execute_unstoppable_instructions( 1 ); exception( EXC_INT ); } @@ -1470,11 +1470,11 @@ void psxcpu_device::fetch_next_op() { UINT32 safepc = m_delayv & ~m_bad_word_address_mask; - m_op = m_direct->read_decrypted_dword( safepc ); + m_op = m_direct->read_dword( safepc ); } else { - m_op = m_direct->read_decrypted_dword( m_pc + 4 ); + m_op = m_direct->read_dword( m_pc + 4 ); } } @@ -2289,7 +2289,7 @@ void psxcpu_device::execute_run() if( LOG_BIOSCALL ) log_bioscall(); debugger_instruction_hook( this, m_pc ); - m_op = m_direct->read_decrypted_dword( m_pc ); + m_op = m_direct->read_dword( m_pc ); if( m_berr ) { diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index 564f1652109..34d53f2eb61 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -133,7 +133,6 @@ class rsp_device : public cpu_device friend class rsp_frontend; friend class rsp_cop2; friend class rsp_cop2_drc; - friend class rsp_cop2_simd; public: // construction/destruction diff --git a/src/emu/cpu/rsp/rspcp2.h b/src/emu/cpu/rsp/rspcp2.h index 18e9d59fbff..babfab2d873 100644 --- a/src/emu/cpu/rsp/rspcp2.h +++ b/src/emu/cpu/rsp/rspcp2.h @@ -16,9 +16,6 @@ #include "cpu/drcuml.h" #include "rsp.h" -#define USE_SIMD (0) -#define SIMUL_SIMD (0) - union VECTOR_REG { UINT64 d[2]; diff --git a/src/emu/cpu/rsp/rspcp2s.c b/src/emu/cpu/rsp/rspcp2s.c deleted file mode 100644 index 4f2c2b18fa9..00000000000 --- a/src/emu/cpu/rsp/rspcp2s.c +++ /dev/null @@ -1,3630 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - rspcp2s.c - - Universal machine language-based Nintendo/SGI RSP COP2 emulator, with - SSSE3 SIMD optimizations. - Written by Harmony of the MESS team. - -***************************************************************************/ - -#include "emu.h" -#include "rsp.h" -#include "rspdiv.h" -#include "rspcp2.h" -#include "cpu/drcfe.h" -#include "cpu/drcuml.h" -#include "cpu/drcumlsh.h" - -using namespace uml; - -/*************************************************************************** - Helpful Defines -***************************************************************************/ - -#define VDREG ((op >> 6) & 0x1f) -#define VS1REG ((op >> 11) & 0x1f) -#define VS2REG ((op >> 16) & 0x1f) -#define EL ((op >> 21) & 0xf) - -#define RSVAL (m_rsp.m_rsp_state->r[RSREG]) -#define RTVAL (m_rsp.m_rsp_state->r[RTREG]) -#define RDVAL (m_rsp.m_rsp_state->r[RDREG]) - -#define EXTRACT16(reg, value, element) \ - switch((element) & 7) \ - { \ - case 0: value = _mm_extract_epi16(reg, 0); break; \ - case 1: value = _mm_extract_epi16(reg, 1); break; \ - case 2: value = _mm_extract_epi16(reg, 2); break; \ - case 3: value = _mm_extract_epi16(reg, 3); break; \ - case 4: value = _mm_extract_epi16(reg, 4); break; \ - case 5: value = _mm_extract_epi16(reg, 5); break; \ - case 6: value = _mm_extract_epi16(reg, 6); break; \ - case 7: value = _mm_extract_epi16(reg, 7); break; \ - } - - -#define INSERT16(reg, value, element) \ - switch((element) & 7) \ - { \ - case 0: reg = _mm_insert_epi16(reg, value, 0); break; \ - case 1: reg = _mm_insert_epi16(reg, value, 1); break; \ - case 2: reg = _mm_insert_epi16(reg, value, 2); break; \ - case 3: reg = _mm_insert_epi16(reg, value, 3); break; \ - case 4: reg = _mm_insert_epi16(reg, value, 4); break; \ - case 5: reg = _mm_insert_epi16(reg, value, 5); break; \ - case 6: reg = _mm_insert_epi16(reg, value, 6); break; \ - case 7: reg = _mm_insert_epi16(reg, value, 7); break; \ - } - - -#define VREG_B(reg, offset) m_v[(reg)].b[(offset)^1] -#define W_VREG_S(reg, offset) m_v[(reg)].s[(offset)] -#define VREG_S(reg, offset) (INT16)m_v[(reg)].s[(offset)] - -#define VEC_EL_2(x,z) (vector_elements_2[(x)][(z)]) - -#define ACCUM(x) m_accum[x].q - -#define CARRY 0 -#define COMPARE 1 -#define CLIP1 2 -#define ZERO 3 -#define CLIP2 4 - -static void cfunc_mfc2(void *param); -static void cfunc_cfc2(void *param); -static void cfunc_mtc2(void *param); -static void cfunc_ctc2(void *param); - -inline UINT16 rsp_cop2_simd::ACCUM_H(int x) -{ - UINT16 out; - EXTRACT16(m_accum_h, out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::ACCUM_M(int x) -{ - UINT16 out; - EXTRACT16(m_accum_m, out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::ACCUM_L(int x) -{ - UINT16 out; - EXTRACT16(m_accum_l, out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::ACCUM_LL(int x) -{ - UINT16 out; - EXTRACT16(m_accum_ll, out, x); - return out; -} - -#define SET_ACCUM_H(v, x) INSERT16(m_accum_h, v, x); -#define SET_ACCUM_M(v, x) INSERT16(m_>accum_m, v, x); -#define SET_ACCUM_L(v, x) INSERT16(m_accum_l, v, x); -#define SET_ACCUM_LL(v, x) INSERT16(m_accum_ll, v, x); - -#define GET_VS1(out, i) EXTRACT16(m_xv[VS1REG], out, i); -#define GET_VS2(out, i) EXTRACT16(m_xv[VS2REG], out, VEC_EL_2(EL, i)); - -inline UINT16 rsp_cop2_simd::CARRY_FLAG(const int x) -{ - UINT16 out; - EXTRACT16(m_xvflag[CARRY], out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::COMPARE_FLAG(const int x) -{ - UINT16 out; - EXTRACT16(m_xvflag[COMPARE], out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::CLIP1_FLAG(const int x) -{ - UINT16 out; - EXTRACT16(m_xvflag[CLIP1], out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::ZERO_FLAG(const int x) -{ - UINT16 out; - EXTRACT16(m_xvflag[ZERO], out, x); - return out; -} - -inline UINT16 rsp_cop2_simd::CLIP2_FLAG(const int x) -{ - UINT16 out; - EXTRACT16(m_xvflag[CLIP2], out, x); - return out; -} - -#define CLEAR_CARRY_FLAGS() { m_xvflag[CARRY] = _mm_setzero_si128(); } -#define CLEAR_COMPARE_FLAGS() { m_xvflag[COMPARE] = _mm_setzero_si128(); } -#define CLEAR_CLIP1_FLAGS() { m_xvflag[CLIP1] = _mm_setzero_si128(); } -#define CLEAR_ZERO_FLAGS() { m_xvflag[ZERO] = _mm_setzero_si128(); } -#define CLEAR_CLIP2_FLAGS() { m_xvflag[CLIP2] = _mm_setzero_si128(); } - -#define SET_CARRY_FLAG(x) { INSERT16(m_xvflag[CARRY], 0xffff, x); } -#define SET_COMPARE_FLAG(x) { INSERT16(m_xvflag[COMPARE], 0xffff, x); } -#define SET_CLIP1_FLAG(x) { INSERT16(m_xvflag[CLIP1], 0xffff, x); } -#define SET_ZERO_FLAG(x) { INSERT16(m_xvflag[ZERO], 0xffff, x); } -#define SET_CLIP2_FLAG(x) { INSERT16(m_xvflag[CLIP2], 0xffff, x); } - -#define CLEAR_CARRY_FLAG(x) { INSERT16(m_xvflag[CARRY], 0, x); } -#define CLEAR_COMPARE_FLAG(x) { INSERT16(m_xvflag[COMPARE], 0, x); } -#define CLEAR_CLIP1_FLAG(x) { INSERT16(m_xvflag[CLIP1], 0, x); } -#define CLEAR_ZERO_FLAG(x) { INSERT16(m_xvflag[ZERO], 0, x); } -#define CLEAR_CLIP2_FLAG(x) { INSERT16(m_xvflag[CLIP2], 0, x); } - -#define WRITEBACK_RESULT() { \ - INSERT16(m_xv[VDREG], m_vres[0], 0); \ - INSERT16(m_xv[VDREG], m_vres[1], 1); \ - INSERT16(m_xv[VDREG], m_vres[2], 2); \ - INSERT16(m_xv[VDREG], m_vres[3], 3); \ - INSERT16(m_xv[VDREG], m_vres[4], 4); \ - INSERT16(m_xv[VDREG], m_vres[5], 5); \ - INSERT16(m_xv[VDREG], m_vres[6], 6); \ - INSERT16(m_xv[VDREG], m_vres[7], 7); \ -} -#endif - -static const int vector_elements_2[16][8] = -{ - { 0, 1, 2, 3, 4, 5, 6, 7 }, // none - { 0, 1, 2, 3, 4, 5, 6, 7 }, // ??? - { 0, 0, 2, 2, 4, 4, 6, 6 }, // 0q - { 1, 1, 3, 3, 5, 5, 7, 7 }, // 1q - { 0, 0, 0, 0, 4, 4, 4, 4 }, // 0h - { 1, 1, 1, 1, 5, 5, 5, 5 }, // 1h - { 2, 2, 2, 2, 6, 6, 6, 6 }, // 2h - { 3, 3, 3, 3, 7, 7, 7, 7 }, // 3h - { 0, 0, 0, 0, 0, 0, 0, 0 }, // 0 - { 1, 1, 1, 1, 1, 1, 1, 1 }, // 1 - { 2, 2, 2, 2, 2, 2, 2, 2 }, // 2 - { 3, 3, 3, 3, 3, 3, 3, 3 }, // 3 - { 4, 4, 4, 4, 4, 4, 4, 4 }, // 4 - { 5, 5, 5, 5, 5, 5, 5, 5 }, // 5 - { 6, 6, 6, 6, 6, 6, 6, 6 }, // 6 - { 7, 7, 7, 7, 7, 7, 7, 7 }, // 7 -}; - -static __m128i vec_himask; -static __m128i vec_lomask; -static __m128i vec_hibit; -static __m128i vec_lobit; -static __m128i vec_n32768; -static __m128i vec_32767; -static __m128i vec_flagmask; -static __m128i vec_shiftmask2; -static __m128i vec_shiftmask4; -static __m128i vec_flag_reverse; -static __m128i vec_neg1; -static __m128i vec_zero; -static __m128i vec_shuf[16]; -static __m128i vec_shuf_inverse[16]; - -rsp_cop2_simd::rsp_cop2_simd(rsp_device &rsp, running_machine &machine) : rsp_cop2(rsp, machine) - : m_accum_h(0) - , m_accum_m(0) - , m_accum_l(0) - , m_accum_ll(0) -#if SIMUL_SIMD - , m_old_reciprocal_res(0) - , m_old_reciprocal_high(0) - , m_old_dp_allowed(0) - , m_scalar_reciprocal_res(0) - , m_scalar_reciprocal_high(0) - , m_scalar_dp_allowed(0) - , m_simd_reciprocal_res(0) - , m_simd_reciprocal_high(0) - , m_simd_dp_allowed(0) -#endif -{ -#if SIMUL_SIMD - memset(m_old_r, 0, sizeof(m_old_r)); - memset(m_old_dmem, 0, sizeof(m_old_dmem)); - memset(m_scalar_r, 0, sizeof(m_scalar_r)); - memset(m_scalar_dmem, 0, sizeof(m_scalar_dmem)); -#endif - memset(m_xv, 0, sizeof(m_xv)); - memset(m_xvflag, 0, sizeof(m_xvflag)); - - vec_shuf_inverse[ 0] = _mm_set_epi16(0x0f0e, 0x0d0c, 0x0b0a, 0x0908, 0x0706, 0x0504, 0x0302, 0x0100); // none - vec_shuf_inverse[ 1] = _mm_set_epi16(0x0f0e, 0x0d0c, 0x0b0a, 0x0908, 0x0706, 0x0504, 0x0302, 0x0100); // ??? - vec_shuf_inverse[ 2] = _mm_set_epi16(0x0d0c, 0x0d0c, 0x0908, 0x0908, 0x0504, 0x0504, 0x0100, 0x0100); // 0q - vec_shuf_inverse[ 3] = _mm_set_epi16(0x0f0e, 0x0f0e, 0x0b0a, 0x0b0a, 0x0706, 0x0706, 0x0302, 0x0302); // 1q - vec_shuf_inverse[ 4] = _mm_set_epi16(0x0908, 0x0908, 0x0908, 0x0908, 0x0100, 0x0100, 0x0100, 0x0100); // 0h - vec_shuf_inverse[ 5] = _mm_set_epi16(0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0302, 0x0302, 0x0302, 0x0302); // 1h - vec_shuf_inverse[ 6] = _mm_set_epi16(0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0504, 0x0504, 0x0504, 0x0504); // 2h - vec_shuf_inverse[ 7] = _mm_set_epi16(0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0706, 0x0706, 0x0706, 0x0706); // 3h - vec_shuf_inverse[ 8] = _mm_set_epi16(0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100); // 0 - vec_shuf_inverse[ 9] = _mm_set_epi16(0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302); // 1 - vec_shuf_inverse[10] = _mm_set_epi16(0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504); // 2 - vec_shuf_inverse[11] = _mm_set_epi16(0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706); // 3 - vec_shuf_inverse[12] = _mm_set_epi16(0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908); // 4 - vec_shuf_inverse[13] = _mm_set_epi16(0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a); // 5 - vec_shuf_inverse[14] = _mm_set_epi16(0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c); // 6 - vec_shuf_inverse[15] = _mm_set_epi16(0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e); // 7 - - vec_shuf[ 0] = _mm_set_epi16(0x0100, 0x0302, 0x0504, 0x0706, 0x0908, 0x0b0a, 0x0d0c, 0x0f0e); // none - vec_shuf[ 1] = _mm_set_epi16(0x0100, 0x0302, 0x0504, 0x0706, 0x0908, 0x0b0a, 0x0d0c, 0x0f0e); // ??? - vec_shuf[ 2] = _mm_set_epi16(0x0302, 0x0302, 0x0706, 0x0706, 0x0b0a, 0x0b0a, 0x0f0e, 0x0f0e); // 0q - vec_shuf[ 3] = _mm_set_epi16(0x0100, 0x0100, 0x0504, 0x0706, 0x0908, 0x0908, 0x0d0c, 0x0d0c); // 1q - vec_shuf[ 4] = _mm_set_epi16(0x0706, 0x0706, 0x0706, 0x0706, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e); // 0q - vec_shuf[ 5] = _mm_set_epi16(0x0504, 0x0504, 0x0504, 0x0504, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c); // 1q - vec_shuf[ 6] = _mm_set_epi16(0x0302, 0x0302, 0x0302, 0x0302, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a); // 2q - vec_shuf[ 7] = _mm_set_epi16(0x0100, 0x0100, 0x0100, 0x0100, 0x0908, 0x0908, 0x0908, 0x0908); // 3q - vec_shuf[ 8] = _mm_set_epi16(0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e, 0x0f0e); // 0 - vec_shuf[ 9] = _mm_set_epi16(0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c, 0x0d0c); // 1 - vec_shuf[10] = _mm_set_epi16(0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a, 0x0b0a); // 2 - vec_shuf[11] = _mm_set_epi16(0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908, 0x0908); // 3 - vec_shuf[12] = _mm_set_epi16(0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706, 0x0706); // 4 - vec_shuf[13] = _mm_set_epi16(0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504, 0x0504); // 5 - vec_shuf[14] = _mm_set_epi16(0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302, 0x0302); // 6 - vec_shuf[15] = _mm_set_epi16(0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100); // 7 - m_accum_h = _mm_setzero_si128(); - m_accum_m = _mm_setzero_si128(); - m_accum_l = _mm_setzero_si128(); - m_accum_ll = _mm_setzero_si128(); - vec_neg1 = _mm_set_epi64x(0xffffffffffffffffL, 0xffffffffffffffffL); - vec_zero = _mm_setzero_si128(); - vec_himask = _mm_set_epi64x(0xffff0000ffff0000L, 0xffff0000ffff0000L); - vec_lomask = _mm_set_epi64x(0x0000ffff0000ffffL, 0x0000ffff0000ffffL); - vec_hibit = _mm_set_epi64x(0x0001000000010000L, 0x0001000000010000L); - vec_lobit = _mm_set_epi64x(0x0000000100000001L, 0x0000000100000001L); - vec_32767 = _mm_set_epi64x(0x7fff7fff7fff7fffL, 0x7fff7fff7fff7fffL); - vec_n32768 = _mm_set_epi64x(0x8000800080008000L, 0x8000800080008000L); - vec_flagmask = _mm_set_epi64x(0x0001000100010001L, 0x0001000100010001L); - vec_shiftmask2 = _mm_set_epi64x(0x0000000300000003L, 0x0000000300000003L); - vec_shiftmask4 = _mm_set_epi64x(0x000000000000000fL, 0x000000000000000fL); - vec_flag_reverse = _mm_set_epi16(0x0100, 0x0302, 0x0504, 0x0706, 0x0908, 0x0b0a, 0x0d0c, 0x0f0e); -} - -void rsp_cop2_simd::state_string_export(const int index, std::string &str) -{ - switch (index) - { - case RSP_V0: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 0], 7), (UINT16)_mm_extract_epi16(m_xv[ 0], 6), (UINT16)_mm_extract_epi16(m_xv[ 0], 5), (UINT16)_mm_extract_epi16(m_xv[ 0], 4), (UINT16)_mm_extract_epi16(m_xv[ 0], 3), (UINT16)_mm_extract_epi16(m_xv[ 0], 2), (UINT16)_mm_extract_epi16(m_xv[ 0], 1), (UINT16)_mm_extract_epi16(m_xv[ 0], 0)); - break; - case RSP_V1: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 1], 7), (UINT16)_mm_extract_epi16(m_xv[ 1], 6), (UINT16)_mm_extract_epi16(m_xv[ 1], 5), (UINT16)_mm_extract_epi16(m_xv[ 1], 4), (UINT16)_mm_extract_epi16(m_xv[ 1], 3), (UINT16)_mm_extract_epi16(m_xv[ 1], 2), (UINT16)_mm_extract_epi16(m_xv[ 1], 1), (UINT16)_mm_extract_epi16(m_xv[ 1], 0)); - break; - case RSP_V2: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 2], 7), (UINT16)_mm_extract_epi16(m_xv[ 2], 6), (UINT16)_mm_extract_epi16(m_xv[ 2], 5), (UINT16)_mm_extract_epi16(m_xv[ 2], 4), (UINT16)_mm_extract_epi16(m_xv[ 2], 3), (UINT16)_mm_extract_epi16(m_xv[ 2], 2), (UINT16)_mm_extract_epi16(m_xv[ 2], 1), (UINT16)_mm_extract_epi16(m_xv[ 2], 0)); - break; - case RSP_V3: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 3], 7), (UINT16)_mm_extract_epi16(m_xv[ 3], 6), (UINT16)_mm_extract_epi16(m_xv[ 3], 5), (UINT16)_mm_extract_epi16(m_xv[ 3], 4), (UINT16)_mm_extract_epi16(m_xv[ 3], 3), (UINT16)_mm_extract_epi16(m_xv[ 3], 2), (UINT16)_mm_extract_epi16(m_xv[ 3], 1), (UINT16)_mm_extract_epi16(m_xv[ 3], 0)); - break; - case RSP_V4: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 4], 7), (UINT16)_mm_extract_epi16(m_xv[ 4], 6), (UINT16)_mm_extract_epi16(m_xv[ 4], 5), (UINT16)_mm_extract_epi16(m_xv[ 4], 4), (UINT16)_mm_extract_epi16(m_xv[ 4], 3), (UINT16)_mm_extract_epi16(m_xv[ 4], 2), (UINT16)_mm_extract_epi16(m_xv[ 4], 1), (UINT16)_mm_extract_epi16(m_xv[ 4], 0)); - break; - case RSP_V5: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 5], 7), (UINT16)_mm_extract_epi16(m_xv[ 5], 6), (UINT16)_mm_extract_epi16(m_xv[ 5], 5), (UINT16)_mm_extract_epi16(m_xv[ 5], 4), (UINT16)_mm_extract_epi16(m_xv[ 5], 3), (UINT16)_mm_extract_epi16(m_xv[ 5], 2), (UINT16)_mm_extract_epi16(m_xv[ 5], 1), (UINT16)_mm_extract_epi16(m_xv[ 5], 0)); - break; - case RSP_V6: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 6], 7), (UINT16)_mm_extract_epi16(m_xv[ 6], 6), (UINT16)_mm_extract_epi16(m_xv[ 6], 5), (UINT16)_mm_extract_epi16(m_xv[ 6], 4), (UINT16)_mm_extract_epi16(m_xv[ 6], 3), (UINT16)_mm_extract_epi16(m_xv[ 6], 2), (UINT16)_mm_extract_epi16(m_xv[ 6], 1), (UINT16)_mm_extract_epi16(m_xv[ 6], 0)); - break; - case RSP_V7: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 7], 7), (UINT16)_mm_extract_epi16(m_xv[ 7], 6), (UINT16)_mm_extract_epi16(m_xv[ 7], 5), (UINT16)_mm_extract_epi16(m_xv[ 7], 4), (UINT16)_mm_extract_epi16(m_xv[ 7], 3), (UINT16)_mm_extract_epi16(m_xv[ 7], 2), (UINT16)_mm_extract_epi16(m_xv[ 7], 1), (UINT16)_mm_extract_epi16(m_xv[ 7], 0)); - break; - case RSP_V8: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 8], 7), (UINT16)_mm_extract_epi16(m_xv[ 8], 6), (UINT16)_mm_extract_epi16(m_xv[ 8], 5), (UINT16)_mm_extract_epi16(m_xv[ 8], 4), (UINT16)_mm_extract_epi16(m_xv[ 8], 3), (UINT16)_mm_extract_epi16(m_xv[ 8], 2), (UINT16)_mm_extract_epi16(m_xv[ 8], 1), (UINT16)_mm_extract_epi16(m_xv[ 8], 0)); - break; - case RSP_V9: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[ 9], 7), (UINT16)_mm_extract_epi16(m_xv[ 9], 6), (UINT16)_mm_extract_epi16(m_xv[ 9], 5), (UINT16)_mm_extract_epi16(m_xv[ 9], 4), (UINT16)_mm_extract_epi16(m_xv[ 9], 3), (UINT16)_mm_extract_epi16(m_xv[ 9], 2), (UINT16)_mm_extract_epi16(m_xv[ 9], 1), (UINT16)_mm_extract_epi16(m_xv[ 9], 0)); - break; - case RSP_V10: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[10], 7), (UINT16)_mm_extract_epi16(m_xv[10], 6), (UINT16)_mm_extract_epi16(m_xv[10], 5), (UINT16)_mm_extract_epi16(m_xv[10], 4), (UINT16)_mm_extract_epi16(m_xv[10], 3), (UINT16)_mm_extract_epi16(m_xv[10], 2), (UINT16)_mm_extract_epi16(m_xv[10], 1), (UINT16)_mm_extract_epi16(m_xv[10], 0)); - break; - case RSP_V11: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[11], 7), (UINT16)_mm_extract_epi16(m_xv[11], 6), (UINT16)_mm_extract_epi16(m_xv[11], 5), (UINT16)_mm_extract_epi16(m_xv[11], 4), (UINT16)_mm_extract_epi16(m_xv[11], 3), (UINT16)_mm_extract_epi16(m_xv[11], 2), (UINT16)_mm_extract_epi16(m_xv[11], 1), (UINT16)_mm_extract_epi16(m_xv[11], 0)); - break; - case RSP_V12: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[12], 7), (UINT16)_mm_extract_epi16(m_xv[12], 6), (UINT16)_mm_extract_epi16(m_xv[12], 5), (UINT16)_mm_extract_epi16(m_xv[12], 4), (UINT16)_mm_extract_epi16(m_xv[12], 3), (UINT16)_mm_extract_epi16(m_xv[12], 2), (UINT16)_mm_extract_epi16(m_xv[12], 1), (UINT16)_mm_extract_epi16(m_xv[12], 0)); - break; - case RSP_V13: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[13], 7), (UINT16)_mm_extract_epi16(m_xv[13], 6), (UINT16)_mm_extract_epi16(m_xv[13], 5), (UINT16)_mm_extract_epi16(m_xv[13], 4), (UINT16)_mm_extract_epi16(m_xv[13], 3), (UINT16)_mm_extract_epi16(m_xv[13], 2), (UINT16)_mm_extract_epi16(m_xv[13], 1), (UINT16)_mm_extract_epi16(m_xv[13], 0)); - break; - case RSP_V14: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[14], 7), (UINT16)_mm_extract_epi16(m_xv[14], 6), (UINT16)_mm_extract_epi16(m_xv[14], 5), (UINT16)_mm_extract_epi16(m_xv[14], 4), (UINT16)_mm_extract_epi16(m_xv[14], 3), (UINT16)_mm_extract_epi16(m_xv[14], 2), (UINT16)_mm_extract_epi16(m_xv[14], 1), (UINT16)_mm_extract_epi16(m_xv[14], 0)); - break; - case RSP_V15: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[15], 7), (UINT16)_mm_extract_epi16(m_xv[15], 6), (UINT16)_mm_extract_epi16(m_xv[15], 5), (UINT16)_mm_extract_epi16(m_xv[15], 4), (UINT16)_mm_extract_epi16(m_xv[15], 3), (UINT16)_mm_extract_epi16(m_xv[15], 2), (UINT16)_mm_extract_epi16(m_xv[15], 1), (UINT16)_mm_extract_epi16(m_xv[15], 0)); - break; - case RSP_V16: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[16], 7), (UINT16)_mm_extract_epi16(m_xv[16], 6), (UINT16)_mm_extract_epi16(m_xv[16], 5), (UINT16)_mm_extract_epi16(m_xv[16], 4), (UINT16)_mm_extract_epi16(m_xv[16], 3), (UINT16)_mm_extract_epi16(m_xv[16], 2), (UINT16)_mm_extract_epi16(m_xv[16], 1), (UINT16)_mm_extract_epi16(m_xv[16], 0)); - break; - case RSP_V17: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[17], 7), (UINT16)_mm_extract_epi16(m_xv[17], 6), (UINT16)_mm_extract_epi16(m_xv[17], 5), (UINT16)_mm_extract_epi16(m_xv[17], 4), (UINT16)_mm_extract_epi16(m_xv[17], 3), (UINT16)_mm_extract_epi16(m_xv[17], 2), (UINT16)_mm_extract_epi16(m_xv[17], 1), (UINT16)_mm_extract_epi16(m_xv[17], 0)); - break; - case RSP_V18: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[18], 7), (UINT16)_mm_extract_epi16(m_xv[18], 6), (UINT16)_mm_extract_epi16(m_xv[18], 5), (UINT16)_mm_extract_epi16(m_xv[18], 4), (UINT16)_mm_extract_epi16(m_xv[18], 3), (UINT16)_mm_extract_epi16(m_xv[18], 2), (UINT16)_mm_extract_epi16(m_xv[18], 1), (UINT16)_mm_extract_epi16(m_xv[18], 0)); - break; - case RSP_V19: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[19], 7), (UINT16)_mm_extract_epi16(m_xv[19], 6), (UINT16)_mm_extract_epi16(m_xv[19], 5), (UINT16)_mm_extract_epi16(m_xv[19], 4), (UINT16)_mm_extract_epi16(m_xv[19], 3), (UINT16)_mm_extract_epi16(m_xv[19], 2), (UINT16)_mm_extract_epi16(m_xv[19], 1), (UINT16)_mm_extract_epi16(m_xv[19], 0)); - break; - case RSP_V20: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[20], 7), (UINT16)_mm_extract_epi16(m_xv[20], 6), (UINT16)_mm_extract_epi16(m_xv[20], 5), (UINT16)_mm_extract_epi16(m_xv[20], 4), (UINT16)_mm_extract_epi16(m_xv[20], 3), (UINT16)_mm_extract_epi16(m_xv[20], 2), (UINT16)_mm_extract_epi16(m_xv[20], 1), (UINT16)_mm_extract_epi16(m_xv[20], 0)); - break; - case RSP_V21: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[21], 7), (UINT16)_mm_extract_epi16(m_xv[21], 6), (UINT16)_mm_extract_epi16(m_xv[21], 5), (UINT16)_mm_extract_epi16(m_xv[21], 4), (UINT16)_mm_extract_epi16(m_xv[21], 3), (UINT16)_mm_extract_epi16(m_xv[21], 2), (UINT16)_mm_extract_epi16(m_xv[21], 1), (UINT16)_mm_extract_epi16(m_xv[21], 0)); - break; - case RSP_V22: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[22], 7), (UINT16)_mm_extract_epi16(m_xv[22], 6), (UINT16)_mm_extract_epi16(m_xv[22], 5), (UINT16)_mm_extract_epi16(m_xv[22], 4), (UINT16)_mm_extract_epi16(m_xv[22], 3), (UINT16)_mm_extract_epi16(m_xv[22], 2), (UINT16)_mm_extract_epi16(m_xv[22], 1), (UINT16)_mm_extract_epi16(m_xv[22], 0)); - break; - case RSP_V23: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[23], 7), (UINT16)_mm_extract_epi16(m_xv[23], 6), (UINT16)_mm_extract_epi16(m_xv[23], 5), (UINT16)_mm_extract_epi16(m_xv[23], 4), (UINT16)_mm_extract_epi16(m_xv[23], 3), (UINT16)_mm_extract_epi16(m_xv[23], 2), (UINT16)_mm_extract_epi16(m_xv[23], 1), (UINT16)_mm_extract_epi16(m_xv[23], 0)); - break; - case RSP_V24: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[24], 7), (UINT16)_mm_extract_epi16(m_xv[24], 6), (UINT16)_mm_extract_epi16(m_xv[24], 5), (UINT16)_mm_extract_epi16(m_xv[24], 4), (UINT16)_mm_extract_epi16(m_xv[24], 3), (UINT16)_mm_extract_epi16(m_xv[24], 2), (UINT16)_mm_extract_epi16(m_xv[24], 1), (UINT16)_mm_extract_epi16(m_xv[24], 0)); - break; - case RSP_V25: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[25], 7), (UINT16)_mm_extract_epi16(m_xv[25], 6), (UINT16)_mm_extract_epi16(m_xv[25], 5), (UINT16)_mm_extract_epi16(m_xv[25], 4), (UINT16)_mm_extract_epi16(m_xv[25], 3), (UINT16)_mm_extract_epi16(m_xv[25], 2), (UINT16)_mm_extract_epi16(m_xv[25], 1), (UINT16)_mm_extract_epi16(m_xv[25], 0)); - break; - case RSP_V26: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[26], 7), (UINT16)_mm_extract_epi16(m_xv[26], 6), (UINT16)_mm_extract_epi16(m_xv[26], 5), (UINT16)_mm_extract_epi16(m_xv[26], 4), (UINT16)_mm_extract_epi16(m_xv[26], 3), (UINT16)_mm_extract_epi16(m_xv[26], 2), (UINT16)_mm_extract_epi16(m_xv[26], 1), (UINT16)_mm_extract_epi16(m_xv[26], 0)); - break; - case RSP_V27: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[27], 7), (UINT16)_mm_extract_epi16(m_xv[27], 6), (UINT16)_mm_extract_epi16(m_xv[27], 5), (UINT16)_mm_extract_epi16(m_xv[27], 4), (UINT16)_mm_extract_epi16(m_xv[27], 3), (UINT16)_mm_extract_epi16(m_xv[27], 2), (UINT16)_mm_extract_epi16(m_xv[27], 1), (UINT16)_mm_extract_epi16(m_xv[27], 0)); - break; - case RSP_V28: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[28], 7), (UINT16)_mm_extract_epi16(m_xv[28], 6), (UINT16)_mm_extract_epi16(m_xv[28], 5), (UINT16)_mm_extract_epi16(m_xv[28], 4), (UINT16)_mm_extract_epi16(m_xv[28], 3), (UINT16)_mm_extract_epi16(m_xv[28], 2), (UINT16)_mm_extract_epi16(m_xv[28], 1), (UINT16)_mm_extract_epi16(m_xv[28], 0)); - break; - case RSP_V29: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[29], 7), (UINT16)_mm_extract_epi16(m_xv[29], 6), (UINT16)_mm_extract_epi16(m_xv[29], 5), (UINT16)_mm_extract_epi16(m_xv[29], 4), (UINT16)_mm_extract_epi16(m_xv[29], 3), (UINT16)_mm_extract_epi16(m_xv[29], 2), (UINT16)_mm_extract_epi16(m_xv[29], 1), (UINT16)_mm_extract_epi16(m_xv[29], 0)); - break; - case RSP_V30: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[30], 7), (UINT16)_mm_extract_epi16(m_xv[30], 6), (UINT16)_mm_extract_epi16(m_xv[30], 5), (UINT16)_mm_extract_epi16(m_xv[30], 4), (UINT16)_mm_extract_epi16(m_xv[30], 3), (UINT16)_mm_extract_epi16(m_xv[30], 2), (UINT16)_mm_extract_epi16(m_xv[30], 1), (UINT16)_mm_extract_epi16(m_xv[30], 0)); - break; - case RSP_V31: - string.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)_mm_extract_epi16(m_xv[31], 7), (UINT16)_mm_extract_epi16(m_xv[31], 6), (UINT16)_mm_extract_epi16(m_xv[31], 5), (UINT16)_mm_extract_epi16(m_xv[31], 4), (UINT16)_mm_extract_epi16(m_xv[31], 3), (UINT16)_mm_extract_epi16(m_xv[31], 2), (UINT16)_mm_extract_epi16(m_xv[31], 1), (UINT16)_mm_extract_epi16(m_xv[31], 0)); - break; - } -} - -/*************************************************************************** - Vector Load Instructions -***************************************************************************/ - -// LBV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00000 | IIII | Offset | -// -------------------------------------------------- -// -// Load 1 byte to vector byte index - -inline void rsp_cop2_simd::lbv() -{ - UINT32 op = m_op; - - UINT32 ea = 0; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - ea = (base) ? m_rsp.m_rsp_state->r[base] + offset : offset; - - UINT16 element; - EXTRACT16(m_xv[dest], element, (index >> 1)); - element &= 0xff00 >> ((1-(index & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1-(index & 1)) * 8); - INSERT16(m_xv[dest], element, (index >> 1)); -} - -static void cfunc_lbv(void *param) -{ - ((rsp_cop2 *)param)->lbv(); -} - - -// LSV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00001 | IIII | Offset | -// -------------------------------------------------- -// -// Loads 2 bytes starting from vector byte index - -inline void rsp_cop2_simd::lsv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xe; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 2) : (offset * 2); - int end = index + 2; - for (int i = index; i < end; i++) - { - UINT16 element; - EXTRACT16(m_xv[dest], element, (i >> 1)); - element &= 0xff00 >> ((1 - (i & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1 - (i & 1)) * 8); - INSERT16(m_xv[dest], element, (i >> 1)); - ea++; - } -} - -static void cfunc_lsv(void *param) -{ - ((rsp_cop2 *)param)->lsv(); -} - - -// LLV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00010 | IIII | Offset | -// -------------------------------------------------- -// -// Loads 4 bytes starting from vector byte index - -inline void rsp_cop2_simd::llv() -{ - UINT32 op = m_op; - UINT32 ea = 0; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xc; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 4) : (offset * 4); - - int end = index + 4; - - for (int i = index; i < end; i++) - { - UINT16 element; - EXTRACT16(m_xv[dest], element, (i >> 1)); - element &= 0xff00 >> ((1 - (i & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1 - (i & 1)) * 8); - INSERT16(m_xv[dest], element, (i >> 1)); - ea++; - } -} - -static void cfunc_llv(void *param) -{ - ((rsp_cop2 *)param)->llv(); -} -#endif - - -// LDV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00011 | IIII | Offset | -// -------------------------------------------------- -// -// Loads 8 bytes starting from vector byte index - -inline void rsp_cop2_simd::ldv() -{ - UINT32 op = m_op; - UINT32 ea = 0; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0x8; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - - int end = index + 8; - - for (int i = index; i < end; i++) - { - UINT16 element; - EXTRACT16(m_xv[dest], element, (i >> 1)); - element &= 0xff00 >> ((1 - (i & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1 - (i & 1)) * 8); - INSERT16(m_xv[dest], element, (i >> 1)); - ea++; - } -} - -static void cfunc_ldv(void *param) -{ - ((rsp_cop2 *)param)->ldv(); -} -#endif - - -// LQV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00100 | IIII | Offset | -// -------------------------------------------------- -// -// Loads up to 16 bytes starting from vector byte index - -inline void rsp_cop2_simd::lqv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - int end = 16 - (ea & 0xf); - if (end > 16) end = 16; - - for (int i = 0; i < end; i++) - { - UINT16 element; - EXTRACT16(m_xv[dest], element, (i >> 1)); - element &= 0xff00 >> ((1 - (i & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1 - (i & 1)) * 8); - INSERT16(m_xv[dest], element, (i >> 1)); - ea++; - } -} - -static void cfunc_lqv(void *param) -{ - ((rsp_cop2 *)param)->lqv(); -} - - -// LRV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00101 | IIII | Offset | -// -------------------------------------------------- -// -// Stores up to 16 bytes starting from right side until 16-byte boundary - -inline void rsp_cop2_simd::lrv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - index = 16 - ((ea & 0xf) - index); - ea &= ~0xf; - - for (int i = index; i < 16; i++) - { - UINT16 element; - EXTRACT16(m_xv[dest], element, (i >> 1)); - element &= 0xff00 >> ((1-(i & 1)) * 8); - element |= m_rsp.DM_READ8(ea) << ((1-(i & 1)) * 8); - INSERT16(m_xv[dest], element, (i >> 1)); - ea++; - } -} - -static void cfunc_lrv(void *param) -{ - ((rsp_cop2 *)param)->lrv(); -} - - -// LPV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00110 | IIII | Offset | -// -------------------------------------------------- -// -// Loads a byte as the upper 8 bits of each element - -inline void rsp_cop2_simd::lpv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - - for (int i = 0; i < 8; i++) - { - INSERT16(m_xv[dest], m_rsp.DM_READ8(ea + (((16-index) + i) & 0xf)) << 8, i); - } -} - -static void cfunc_lpv(void *param) -{ - ((rsp_cop2 *)param)->lpv(); -} - - -// LUV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 00111 | IIII | Offset | -// -------------------------------------------------- -// -// Loads a byte as the bits 14-7 of each element - -inline void rsp_cop2_simd::luv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - - for (int i = 0; i < 8; i++) - { - INSERT16(m_xv[dest], m_rsp.DM_READ8(ea + (((16-index) + i) & 0xf)) << 7, i); - } -} - -static void cfunc_luv(void *param) -{ - ((rsp_cop2 *)param)->luv(); -} - - -// LHV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 01000 | IIII | Offset | -// -------------------------------------------------- -// -// Loads a byte as the bits 14-7 of each element, with 2-byte stride - -inline void rsp_cop2_simd::lhv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - for (int i = 0; i < 8; i++) - { - INSERT16(m_xv[dest], m_rsp.DM_READ8(ea + (((16-index) + (i<<1)) & 0xf)) << 7, i); - } -} - -static void cfunc_lhv(void *param) -{ - ((rsp_cop2 *)param)->lhv(); -} - - -// LFV -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 01001 | IIII | Offset | -// -------------------------------------------------- -// -// Loads a byte as the bits 14-7 of upper or lower quad, with 4-byte stride - -inline void rsp_cop2_simd::lfv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - // not sure what happens if 16-byte boundary is crossed... - - int end = (index >> 1) + 4; - - for (int i = index >> 1; i < end; i++) - { - INSERT16(m_xv[dest], m_rsp.DM_READ8(ea) << 7, i); - ea += 4; - } -} - -static void cfunc_lfv(void *param) -{ - ((rsp_cop2 *)param)->lfv(); -} - - -// LWV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 01010 | IIII | Offset | -// -------------------------------------------------- -// -// Loads the full 128-bit vector starting from vector byte index and wrapping to index 0 -// after byte index 15 - -inline void rsp_cop2_simd::lwv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - int end = (16 - index) + 16; - - UINT8 val[16]; - for (int i = (16 - index); i < end; i++) - { - val[i & 0xf] = m_rsp.DM_READ8(ea); - ea += 4; - } - - m_xv[dest] = _mm_set_epi8(val[15], val[14], val[13], val[12], val[11], val[10], val[ 9], val[ 8], - val[ 7], val[ 6], val[ 5], val[ 4], val[ 3], val[ 2], val[ 1], val[ 0]); -} - -static void cfunc_lwv(void *param) -{ - ((rsp_cop2 *)param)->lwv(); -} - - -// LTV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 110010 | BBBBB | TTTTT | 01011 | IIII | Offset | -// -------------------------------------------------- -// -// Loads one element to maximum of 8 vectors, while incrementing element index - -inline void rsp_cop2_simd::ltv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - - // FIXME: has a small problem with odd indices - - int vs = dest; - int ve = dest + 8; - if (ve > 32) - { - ve = 32; - } - - int element = 7 - (index >> 1); - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - ea = ((ea + 8) & ~0xf) + (index & 1); - for (int i = vs; i < ve; i++) - { - element = (8 - (index >> 1) + (i - vs)) << 1; - UINT16 value = (m_rsp.DM_READ8(ea) << 8) | m_rsp.DM_READ8(ea + 1); - INSERT16(m_xv[i], value, (element >> 1)); - ea += 2; - } -} - -static void cfunc_ltv(void *param) -{ - ((rsp_cop2 *)param)->ltv(); -} - - -/*************************************************************************** - Vector Store Instructions -***************************************************************************/ - -// SBV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00000 | IIII | Offset | -// -------------------------------------------------- -// -// Stores 1 byte from vector byte index - -inline void rsp_cop2_simd::sbv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + offset : offset; - UINT16 value; - EXTRACT16(m_xv[dest], value, (index >> 1)); - value >>= (1-(index & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); -} - -static void cfunc_sbv(void *param) -{ - ((rsp_cop2 *)param)->sbv(); -} - - -// SSV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00001 | IIII | Offset | -// -------------------------------------------------- -// -// Stores 2 bytes starting from vector byte index - -inline void rsp_cop2_simd::ssv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 2) : (offset * 2); - - int end = index + 2; - for (int i = index; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, (i >> 1)); - value >>= (1 - (i & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); - ea++; - } -} - -static void cfunc_ssv(void *param) -{ - ((rsp_cop2 *)param)->ssv(); -} - - -// SLV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00010 | IIII | Offset | -// -------------------------------------------------- -// -// Stores 4 bytes starting from vector byte index - -inline void rsp_cop2_simd::slv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 4) : (offset * 4); - - int end = index + 4; - for (int i = index; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, (i >> 1)); - value >>= (1 - (i & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); - ea++; - } -} - -static void cfunc_slv(void *param) -{ - ((rsp_cop2 *)param)->slv(); -} - - -// SDV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00011 | IIII | Offset | -// -------------------------------------------------- -// -// Stores 8 bytes starting from vector byte index - -inline void rsp_cop2_simd::sdv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0x8; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - - int end = index + 8; - for (int i = index; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, (i >> 1)); - value >>= (1 - (i & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); - ea++; - } -} - -static void cfunc_sdv(void *param) -{ - ((rsp_cop2 *)param)->sdv(); -} - - -// SQV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00100 | IIII | Offset | -// -------------------------------------------------- -// -// Stores up to 16 bytes starting from vector byte index until 16-byte boundary - -inline void rsp_cop2_simd::sqv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - int end = index + (16 - (ea & 0xf)); - for (int i=index; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, (i >> 1)); - value >>= (1-(i & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); - ea++; - } -} - -static void cfunc_sqv(void *param) -{ - ((rsp_cop2 *)param)->sqv(); -} - - -// SRV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00101 | IIII | Offset | -// -------------------------------------------------- -// -// Stores up to 16 bytes starting from right side until 16-byte boundary - -inline void rsp_cop2_simd::srv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - - int end = index + (ea & 0xf); - int o = (16 - (ea & 0xf)) & 0xf; - ea &= ~0xf; - - for (int i = index; i < end; i++) - { - UINT32 bi = (i + o) & 0xf; - UINT16 value; - EXTRACT16(m_xv[dest], value, (bi >> 1)); - value >>= (1-(bi & 1)) * 8; - m_rsp.DM_WRITE8(ea, (UINT8)value); - ea++; - } -} - -static void cfunc_srv(void *param) -{ - ((rsp_cop2 *)param)->srv(); -} - - -// SPV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00110 | IIII | Offset | -// -------------------------------------------------- -// -// Stores upper 8 bits of each element - -inline void rsp_cop2_simd::spv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - int end = index + 8; - for (int i=index; i < end; i++) - { - if ((i & 0xf) < 8) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i); - m_rsp.DM_WRITE8(ea, (UINT8)(value >> 8)); - } - else - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i); - m_rsp.DM_WRITE8(ea, (UINT8)(value >> 7)); - } - ea++; - } -} - -static void cfunc_spv(void *param) -{ - ((rsp_cop2 *)param)->spv(); -} - - -// SUV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 00111 | IIII | Offset | -// -------------------------------------------------- -// -// Stores bits 14-7 of each element - -inline void rsp_cop2_simd::suv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 8) : (offset * 8); - int end = index + 8; - for (int i=index; i < end; i++) - { - if ((i & 0xf) < 8) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i); - m_rsp.DM_WRITE8(ea, (UINT8)(value >> 7)); - } - else - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i); - m_rsp.DM_WRITE8(ea, (UINT8)(value >> 8)); - } - ea++; - } -} - -static void cfunc_suv(void *param) -{ - ((rsp_cop2 *)param)->suv(); -} - - -// SHV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 01000 | IIII | Offset | -// -------------------------------------------------- -// -// Stores bits 14-7 of each element, with 2-byte stride - -inline void rsp_cop2_simd::shv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - for (int i=0; i < 8; i++) - { - int element = index + (i << 1); - UINT16 value; - EXTRACT16(m_xv[dest], value, element >> 1); - m_rsp.DM_WRITE8(ea, (value >> 7) & 0x00ff); - ea += 2; - } -} - -static void cfunc_shv(void *param) -{ - ((rsp_cop2 *)param)->shv(); -} - - -// SFV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 01001 | IIII | Offset | -// -------------------------------------------------- -// -// Stores bits 14-7 of upper or lower quad, with 4-byte stride - -inline void rsp_cop2_simd::sfv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - int eaoffset = ea & 0xf; - ea &= ~0xf; - - int end = (index >> 1) + 4; - - for (int i = index>>1; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i); - m_rsp.DM_WRITE8(ea + (eaoffset & 0xf), (value >> 7) & 0x00ff); - eaoffset += 4; - } -} - -static void cfunc_sfv(void *param) -{ - ((rsp_cop2 *)param)->sfv(); -} - - -// SWV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 01010 | IIII | Offset | -// -------------------------------------------------- -// -// Stores the full 128-bit vector starting from vector byte index and wrapping to index 0 -// after byte index 15 - -inline void rsp_cop2_simd::swv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - int eaoffset = ea & 0xf; - ea &= ~0xf; - - int end = index + 16; - for (int i = index; i < end; i++) - { - UINT16 value; - EXTRACT16(m_xv[dest], value, i >> 1); - m_rsp.DM_WRITE8(ea + (eaoffset & 0xf), (value >> ((1-(i & 1)) * 8)) & 0xff); - eaoffset++; - } -} - -static void cfunc_swv(void *param) -{ - ((rsp_cop2 *)param)->swv(); -} - - -// STV -// -// 31 25 20 15 10 6 0 -// -------------------------------------------------- -// | 111010 | BBBBB | TTTTT | 01011 | IIII | Offset | -// -------------------------------------------------- -// -// Stores one element from maximum of 8 vectors, while incrementing element index - -inline void rsp_cop2_simd::stv() -{ - UINT32 op = m_op; - int dest = (op >> 16) & 0x1f; - int base = (op >> 21) & 0x1f; - int index = (op >> 7) & 0xf; - int offset = (op & 0x7f); - - if (offset & 0x40) - { - offset |= 0xffffffc0; - } - - int vs = dest; - int ve = dest + 8; - if (ve > 32) - { - ve = 32; - } - - int element = 8 - (index >> 1); - - UINT32 ea = (base) ? m_rsp.m_rsp_state->r[base] + (offset * 16) : (offset * 16); - int eaoffset = (ea & 0xf) + (element * 2); - ea &= ~0xf; - - for (int i = vs; i < ve; i++) - { - UINT16 value; - EXTRACT16(m_xv[i], value, element); - m_rsp.DM_WRITE16(ea + (eaoffset & 0xf), value); - eaoffset += 2; - element++; - } -} - -static void cfunc_stv(void *param) -{ - ((rsp_cop2 *)param)->stv(); -} - - -/*************************************************************************** - SIMD Accelerators -***************************************************************************/ - -/* ============================================================================ -* RSPPackLo32to16: Pack LSBs of 32-bit vectors to 16-bits without saturation. -* TODO: 5 SSE2 operations is kind of expensive just to truncate values? -* ========================================================================= */ -INLINE __m128i RSPPackLo32to16(__m128i vectorLow, __m128i vectorHigh) -{ - vectorLow = _mm_slli_epi32(vectorLow, 16); - vectorHigh = _mm_slli_epi32(vectorHigh, 16); - vectorLow = _mm_srai_epi32(vectorLow, 16); - vectorHigh = _mm_srai_epi32(vectorHigh, 16); - return _mm_packs_epi32(vectorLow, vectorHigh); -} - -/* ============================================================================ -* RSPPackHi32to16: Pack MSBs of 32-bit vectors to 16-bits without saturation. -* ========================================================================= */ -INLINE __m128i RSPPackHi32to16(__m128i vectorLow, __m128i vectorHigh) -{ - vectorLow = _mm_srai_epi32(vectorLow, 16); - vectorHigh = _mm_srai_epi32(vectorHigh, 16); - return _mm_packs_epi32(vectorLow, vectorHigh); -} - -/* ============================================================================ -* RSPSignExtend16to32: Sign-extend 16-bit slices to 32-bit slices. -* ========================================================================= */ -INLINE void RSPSignExtend16to32(__m128i source, __m128i *vectorLow, __m128i *vectorHigh) -{ - __m128i vMask = _mm_srai_epi16(source, 15); - *vectorHigh = _mm_unpackhi_epi16(source, vMask); - *vectorLow = _mm_unpacklo_epi16(source, vMask); -} - -/* ============================================================================ -* RSPZeroExtend16to32: Zero-extend 16-bit slices to 32-bit slices. -* ========================================================================= */ -INLINE void RSPZeroExtend16to32(__m128i source, __m128i *vectorLow, __m128i *vectorHigh) -{ - *vectorHigh = _mm_unpackhi_epi16(source, _mm_setzero_si128()); - *vectorLow = _mm_unpacklo_epi16(source, _mm_setzero_si128()); -} - -/* ============================================================================ -* _mm_mullo_epi32: SSE2 lacks _mm_mullo_epi32, define it manually. -* TODO/WARNING/DISCLAIMER: Assumes one argument is positive. -* ========================================================================= */ -INLINE __m128i _mm_mullo_epi32(__m128i a, __m128i b) -{ - __m128i a4 = _mm_srli_si128(a, 4); - __m128i b4 = _mm_srli_si128(b, 4); - __m128i ba = _mm_mul_epu32(b, a); - __m128i b4a4 = _mm_mul_epu32(b4, a4); - - __m128i mask = _mm_setr_epi32(~0, 0, ~0, 0); - __m128i baMask = _mm_and_si128(ba, mask); - __m128i b4a4Mask = _mm_and_si128(b4a4, mask); - __m128i b4a4MaskShift = _mm_slli_si128(b4a4Mask, 4); - - return _mm_or_si128(baMask, b4a4MaskShift); -} - -/* ============================================================================ -* RSPClampLowToVal: Clamps the low word of the accumulator. -* ========================================================================= */ -INLINE __m128i RSPClampLowToVal(__m128i vaccLow, __m128i vaccMid, __m128i vaccHigh) -{ - __m128i setMask = _mm_cmpeq_epi16(_mm_setzero_si128(), _mm_setzero_si128()); - __m128i negCheck, useValMask, negVal, posVal; - - /* Compute some common values ahead of time. */ - negCheck = _mm_cmplt_epi16(vaccHigh, _mm_setzero_si128()); - - /* If accmulator < 0, clamp to val if val != TMin. */ - useValMask = _mm_and_si128(vaccHigh, _mm_srai_epi16(vaccMid, 15)); - useValMask = _mm_cmpeq_epi16(useValMask, setMask); - negVal = _mm_and_si128(useValMask, vaccLow); - - /* Otherwise, clamp to ~0 if any high bits are set. */ - useValMask = _mm_or_si128(vaccHigh, _mm_srai_epi16(vaccMid, 15)); - useValMask = _mm_cmpeq_epi16(useValMask, _mm_setzero_si128()); - posVal = _mm_and_si128(useValMask, vaccLow); - - negVal = _mm_and_si128(negCheck, negVal); - posVal = _mm_andnot_si128(negCheck, posVal); - return _mm_or_si128(negVal, posVal); -} - - -/*************************************************************************** - Vector Opcodes -***************************************************************************/ - -// VMULF -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 000000 | -// ------------------------------------------------------ -// -// Multiplies signed integer by signed integer * 2 - -inline void rsp_cop2_simd::vmulf() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - INT32 s1 = (INT32)(INT16)w1; - INT32 s2 = (INT32)(INT16)w2; - - if (s1 == -32768 && s2 == -32768) - { - // overflow - SET_ACCUM_H(0, i); - SET_ACCUM_M(-32768, i); - SET_ACCUM_L(-32768, i); - m_vres[i] = 0x7fff; - } - else - { - INT64 r = s1 * s2 * 2; - r += 0x8000; // rounding ? - SET_ACCUM_H((r < 0) ? 0xffff : 0, i); - SET_ACCUM_M((INT16)(r >> 16), i); - SET_ACCUM_L((UINT16)(r), i); - m_vres[i] = ACCUM_M(i); - } - } - WRITEBACK_RESULT(); -} - -static void cfunc_vmulf(void *param) -{ - ((rsp_cop2 *)param)->vmulf(); -} - - -// VMULU -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 000001 | -// ------------------------------------------------------ -// - -inline void rsp_cop2_simd::vmulu() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - INT32 s1 = (INT32)(INT16)w1; - INT32 s2 = (INT32)(INT16)w2; - - INT64 r = s1 * s2 * 2; - r += 0x8000; // rounding ? - - SET_ACCUM_H((UINT16)(r >> 32), i); - SET_ACCUM_M((UINT16)(r >> 16), i); - SET_ACCUM_L((UINT16)(r), i); - - if (r < 0) - { - m_vres[i] = 0; - } - else if (((INT16)(ACCUM_H(i)) ^ (INT16)(ACCUM_M(i))) < 0) - { - m_vres[i] = -1; - } - else - { - m_vres[i] = ACCUM_M(i); - } - } - WRITEBACK_RESULT(); -} - -static void cfunc_vmulu(void *param) -{ - ((rsp_cop2 *)param)->vmulu(); -} - - -// VMUDL -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001101 | -// ------------------------------------------------------ -// -// Multiplies signed integer by unsigned fraction -// The result is added into accumulator -// The middle slice of accumulator is stored into destination element - -inline void rsp_cop2_simd::vmudl() -{ - int op = m_op; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Unpack to obtain for 32-bit precision. */ - __m128i unpackLo = _mm_mullo_epi16(vsReg, vtReg); - __m128i unpackHi = _mm_mulhi_epu16(vsReg, vtReg); - __m128i loProduct = _mm_unpacklo_epi16(unpackLo, unpackHi); - __m128i hiProduct = _mm_unpackhi_epi16(unpackLo, unpackHi); - - m_xv[VDREG] = m_accum_l = RSPPackHi32to16(loProduct, hiProduct); - - m_accum_m = _mm_setzero_si128(); - m_accum_h = _mm_setzero_si128(); -} - -static void cfunc_vmudl(void *param) -{ - ((rsp_cop2 *)param)->vmudl(); -} - - -// VMUDM -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 000101 | -// ------------------------------------------------------ -// -// Multiplies signed integer by unsigned fraction -// The result is stored into accumulator -// The middle slice of accumulator is stored into destination element - -inline void rsp_cop2_simd::vmudm() -{ - int op = m_op; - - __m128i vsRegLo, vsRegHi, vtRegLo, vtRegHi; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Unpack to obtain for 32-bit precision. */ - RSPSignExtend16to32(vsReg, &vsRegLo, &vsRegHi); - RSPZeroExtend16to32(vtReg, &vtRegLo, &vtRegHi); - - /* Begin accumulating the products. */ - __m128i loProduct = _mm_mullo_epi32(vsRegLo, vtRegLo); - __m128i hiProduct = _mm_mullo_epi32(vsRegHi, vtRegHi); - m_accum_l = RSPPackLo32to16(loProduct, hiProduct); - m_accum_m = m_xv[VDREG] = RSPPackHi32to16(loProduct, hiProduct); - - loProduct = _mm_cmplt_epi32(loProduct, _mm_setzero_si128()); - hiProduct = _mm_cmplt_epi32(hiProduct, _mm_setzero_si128()); - m_accum_h = _mm_packs_epi32(loProduct, hiProduct); -} - -static void cfunc_vmudm(void *param) -{ - ((rsp_cop2 *)param)->vmudm(); -} - - -// VMUDN -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 000110 | -// ------------------------------------------------------ -// -// Multiplies unsigned fraction by signed integer -// The result is stored into accumulator -// The low slice of accumulator is stored into destination element - -inline void rsp_cop2_simd::vmudn() -{ - int op = m_op; - - __m128i vsRegLo, vsRegHi, vtRegLo, vtRegHi; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Unpack to obtain for 32-bit precision. */ - RSPZeroExtend16to32(vsReg, &vsRegLo, &vsRegHi); - RSPSignExtend16to32(vtReg, &vtRegLo, &vtRegHi); - - /* Begin accumulating the products. */ - __m128i loProduct = _mm_mullo_epi32(vsRegLo, vtRegLo); - __m128i hiProduct = _mm_mullo_epi32(vsRegHi, vtRegHi); - m_xv[VDREG] = m_accum_l = RSPPackLo32to16(loProduct, hiProduct); - m_accum_m = RSPPackHi32to16(loProduct, hiProduct); - m_accum_h = _mm_cmplt_epi16(m_accum_m, _mm_setzero_si128()); -} - -static void cfunc_vmudn(void *param) -{ - ((rsp_cop2 *)param)->vmudn(); -} - - -// VMUDH -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 000111 | -// ------------------------------------------------------ -// -// Multiplies signed integer by signed integer -// The result is stored into highest 32 bits of accumulator, the low slice is zero -// The highest 32 bits of accumulator is saturated into destination element - -inline void rsp_cop2_simd::vmudh() -{ - int op = m_op; - - __m128i vaccLow, vaccHigh; - __m128i unpackLo, unpackHi; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Multiply the sources, accumulate the product. */ - unpackLo = _mm_mullo_epi16(vsReg, vtReg); - unpackHi = _mm_mulhi_epi16(vsReg, vtReg); - vaccHigh = _mm_unpackhi_epi16(unpackLo, unpackHi); - vaccLow = _mm_unpacklo_epi16(unpackLo, unpackHi); - - /* Pack the accumulator and result back up. */ - m_xv[VDREG] = _mm_packs_epi32(vaccLow, vaccHigh); - m_accum_l = _mm_setzero_si128(); - m_accum_m = RSPPackLo32to16(vaccLow, vaccHigh); - m_accum_h = RSPPackHi32to16(vaccLow, vaccHigh); -} - -static void cfunc_vmudh(void *param) -{ - ((rsp_cop2 *)param)->vmudh(); -} - - -// VMACF -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001000 | -// ------------------------------------------------------ -// - -inline void rsp_cop2_simd::vmacf() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - INT32 s1 = (INT32)(INT16)w1; - INT32 s2 = (INT32)(INT16)w2; - - INT32 r = s1 * s2; - - UINT64 q = (UINT64)(UINT16)ACCUM_LL(i); - q |= (((UINT64)(UINT16)ACCUM_L(i)) << 16); - q |= (((UINT64)(UINT16)ACCUM_M(i)) << 32); - q |= (((UINT64)(UINT16)ACCUM_H(i)) << 48); - - q += (INT64)(r) << 17; - SET_ACCUM_LL((UINT16)q, i); - SET_ACCUM_L((UINT16)(q >> 16), i); - SET_ACCUM_M((UINT16)(q >> 32), i); - SET_ACCUM_H((UINT16)(q >> 48), i); - - m_vres[i] = SATURATE_ACCUM(i, 1, 0x8000, 0x7fff); - } - WRITEBACK_RESULT(); -} - -static void cfunc_vmacf(void *param) -{ - ((rsp_cop2 *)param)->vmacf(); -} - - -// VMACU -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001001 | -// ------------------------------------------------------ -// - -inline void rsp_cop2_simd::vmacu() -{ - int op = m_op; - - __m128i loProduct, hiProduct, unpackLo, unpackHi; - __m128i vaccHigh; - __m128i vdReg, vdRegLo, vdRegHi; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - __m128i vaccLow = m_accum_l; - - /* Unpack to obtain for 32-bit precision. */ - RSPZeroExtend16to32(vaccLow, &vaccLow, &vaccHigh); - - /* Begin accumulating the products. */ - unpackLo = _mm_mullo_epi16(vsReg, vtReg); - unpackHi = _mm_mulhi_epi16(vsReg, vtReg); - loProduct = _mm_unpacklo_epi16(unpackLo, unpackHi); - hiProduct = _mm_unpackhi_epi16(unpackLo, unpackHi); - loProduct = _mm_slli_epi32(loProduct, 1); - hiProduct = _mm_slli_epi32(hiProduct, 1); - - vdRegLo = _mm_srli_epi32(loProduct, 16); - vdRegHi = _mm_srli_epi32(hiProduct, 16); - vdRegLo = _mm_slli_epi32(vdRegLo, 16); - vdRegHi = _mm_slli_epi32(vdRegHi, 16); - vdRegLo = _mm_xor_si128(vdRegLo, loProduct); - vdRegHi = _mm_xor_si128(vdRegHi, hiProduct); - - vaccLow = _mm_add_epi32(vaccLow, vdRegLo); - vaccHigh = _mm_add_epi32(vaccHigh, vdRegHi); - - m_accum_l = vdReg = RSPPackLo32to16(vaccLow, vaccHigh); - - /* Multiply the MSB of sources, accumulate the product. */ - vdRegLo = _mm_unpacklo_epi16(m_accum_m, m_accum_h); - vdRegHi = _mm_unpackhi_epi16(m_accum_m, m_accum_h); - - loProduct = _mm_srai_epi32(loProduct, 16); - hiProduct = _mm_srai_epi32(hiProduct, 16); - vaccLow = _mm_srai_epi32(vaccLow, 16); - vaccHigh = _mm_srai_epi32(vaccHigh, 16); - - vaccLow = _mm_add_epi32(loProduct, vaccLow); - vaccHigh = _mm_add_epi32(hiProduct, vaccHigh); - vaccLow = _mm_add_epi32(vdRegLo, vaccLow); - vaccHigh = _mm_add_epi32(vdRegHi, vaccHigh); - - /* Clamp the accumulator and write it all out. */ - m_accum_m = RSPPackLo32to16(vaccLow, vaccHigh); - m_accum_h = RSPPackHi32to16(vaccLow, vaccHigh); -} - -static void cfunc_vmacu(void *param) -{ - ((rsp_cop2 *)param)->vmacu(); -} - - -// VMADL -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001100 | -// ------------------------------------------------------ -// -// Multiplies unsigned fraction by unsigned fraction -// Adds the higher 16 bits of the 32-bit result to accumulator -// The low slice of accumulator is stored into destination element - -inline void rsp_cop2_simd::vmadl() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - UINT32 s1 = w1; - UINT32 s2 = w2; - - UINT32 r1 = s1 * s2; - UINT32 r2 = (UINT16)ACCUM_L(i) + (r1 >> 16); - UINT32 r3 = (UINT16)ACCUM_M(i) + (r2 >> 16); - - SET_ACCUM_L((UINT16)r2, i); - SET_ACCUM_M((UINT16)r3, i); - SET_ACCUM_H(ACCUM_H(i) + (INT16)(r3 >> 16), i); - - m_vres[i] = SATURATE_ACCUM(i, 0, 0x0000, 0xffff); - } - WRITEBACK_RESULT(); -} - -static void cfunc_vmadl(void *param) -{ - ((rsp_cop2 *)param)->vmadl(); -} - - -// VMADM -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001101 | -// ------------------------------------------------------ -// -// Multiplies signed fraction by unsigned fraction -// Adds the higher 16 bits of the 32-bit result to accumulator -// The medium slice of accumulator is stored into destination element - -inline void rsp_cop2_simd::vmadm() -{ - int op = m_op; - - __m128i vaccLow, vaccHigh, loProduct, hiProduct; - __m128i vsRegLo, vsRegHi, vtRegLo, vtRegHi, vdRegLo, vdRegHi; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Unpack to obtain for 32-bit precision. */ - RSPSignExtend16to32(vsReg, &vsRegLo, &vsRegHi); - RSPZeroExtend16to32(vtReg, &vtRegLo, &vtRegHi); - RSPZeroExtend16to32(m_accum_l, &vaccLow, &vaccHigh); - - /* Begin accumulating the products. */ - loProduct = _mm_mullo_epi32(vsRegLo, vtRegLo); - hiProduct = _mm_mullo_epi32(vsRegHi, vtRegHi); - - vdRegLo = _mm_srli_epi32(loProduct, 16); - vdRegHi = _mm_srli_epi32(hiProduct, 16); - vdRegLo = _mm_slli_epi32(vdRegLo, 16); - vdRegHi = _mm_slli_epi32(vdRegHi, 16); - vdRegLo = _mm_xor_si128(vdRegLo, loProduct); - vdRegHi = _mm_xor_si128(vdRegHi, hiProduct); - vaccLow = _mm_add_epi32(vaccLow, vdRegLo); - vaccHigh = _mm_add_epi32(vaccHigh, vdRegHi); - - m_accum_l = m_xv[VDREG] = RSPPackLo32to16(vaccLow, vaccHigh); - - /* Multiply the MSB of sources, accumulate the product. */ - vdRegLo = _mm_unpacklo_epi16(m_accum_m, m_accum_h); - vdRegHi = _mm_unpackhi_epi16(m_accum_m, m_accum_h); - - loProduct = _mm_srai_epi32(loProduct, 16); - hiProduct = _mm_srai_epi32(hiProduct, 16); - vaccLow = _mm_srai_epi32(vaccLow, 16); - vaccHigh = _mm_srai_epi32(vaccHigh, 16); - - vaccLow = _mm_add_epi32(loProduct, vaccLow); - vaccHigh = _mm_add_epi32(hiProduct, vaccHigh); - vaccLow = _mm_add_epi32(vdRegLo, vaccLow); - vaccHigh = _mm_add_epi32(vdRegHi, vaccHigh); - - /* Clamp the accumulator and write it all out. */ - m_xv[VDREG] = _mm_packs_epi32(vaccLow, vaccHigh); - m_accum_m = RSPPackLo32to16(vaccLow, vaccHigh); - m_accum_h = RSPPackHi32to16(vaccLow, vaccHigh); -} - -static void cfunc_vmadm(void *param) -{ - ((rsp_cop2 *)param)->vmadm(); -} - - -// VMADN -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001110 | -// ------------------------------------------------------ -// -// Multiplies unsigned fraction by signed fraction -// Adds the 32-bit result to the medium and high slices of the accumulator -// The low slice of accumulator is saturated into destination element - -inline void rsp_cop2_simd::vmadn() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - INT32 s1 = (UINT16)w1; - INT32 s2 = (INT32)(INT16)w2; - - UINT64 q = (UINT64)ACCUM_LL(i); - q |= (((UINT64)ACCUM_L(i)) << 16); - q |= (((UINT64)ACCUM_M(i)) << 32); - q |= (((UINT64)ACCUM_H(i)) << 48); - q += (INT64)(s1*s2) << 16; - - SET_ACCUM_LL((UINT16)q, i); - SET_ACCUM_L((UINT16)(q >> 16), i); - SET_ACCUM_M((UINT16)(q >> 32), i); - SET_ACCUM_H((UINT16)(q >> 48), i); - - m_vres[i] = SATURATE_ACCUM(i, 0, 0x0000, 0xffff); - } - WRITEBACK_RESULT(); -} - -static void cfunc_vmadn(void *param) -{ - ((rsp_cop2 *)param)->vmadn(); -} - - -// VMADH -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 001111 | -// ------------------------------------------------------ -// -// Multiplies signed integer by signed integer -// The result is added into highest 32 bits of accumulator, the low slice is zero -// The highest 32 bits of accumulator is saturated into destination element - -inline void rsp_cop2_simd::vmadh() -{ - int op = m_op; - - __m128i vsReg = m_xv[VS1REG]; - __m128i vtReg = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - /* Unpack to obtain for 32-bit precision. */ - __m128i vaccLow = _mm_unpacklo_epi16(m_accum_m, m_accum_h); - __m128i vaccHigh = _mm_unpackhi_epi16(m_accum_m, m_accum_h); - - /* Multiply the sources, accumulate the product. */ - __m128i unpackLo = _mm_mullo_epi16(vsReg, vtReg); - __m128i unpackHi = _mm_mulhi_epi16(vsReg, vtReg); - __m128i loProduct = _mm_unpacklo_epi16(unpackLo, unpackHi); - __m128i hiProduct = _mm_unpackhi_epi16(unpackLo, unpackHi); - vaccLow = _mm_add_epi32(vaccLow, loProduct); - vaccHigh = _mm_add_epi32(vaccHigh, hiProduct); - - /* Pack the accumulator and result back up. */ - m_xv[VDREG] = _mm_packs_epi32(vaccLow, vaccHigh); - m_accum_m = RSPPackLo32to16(vaccLow, vaccHigh); - m_accum_h = RSPPackHi32to16(vaccLow, vaccHigh); -} - -static void cfunc_vmadh(void *param) -{ - ((rsp_cop2 *)param)->vmadh(); -} - - -// VADD -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010000 | -// ------------------------------------------------------ -// -// Adds two vector registers and carry flag, the result is saturated to 32767 - -inline void rsp_cop2_simd::vadd() -{ - int op = m_op; - - __m128i shuffled = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i carry = _mm_and_si128(m_xvflag[CARRY], vec_flagmask); - m_accum_l = _mm_add_epi16(_mm_add_epi16(m_xv[VS1REG], shuffled), carry); - - __m128i addvec = _mm_adds_epi16(m_xv[VS1REG], shuffled); - - carry = _mm_and_si128(carry, _mm_xor_si128(_mm_cmpeq_epi16(addvec, vec_32767), vec_neg1)); - carry = _mm_and_si128(carry, _mm_xor_si128(_mm_cmpeq_epi16(addvec, vec_n32768), vec_neg1)); - - m_xv[VDREG] = _mm_add_epi16(addvec, carry); - - m_xvflag[ZERO] = vec_zero; - m_xvflag[CARRY] = vec_zero; -} - -static void cfunc_vadd(void *param) -{ - ((rsp_cop2 *)param)->vadd(); -} - - -// VSUB -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010001 | -// ------------------------------------------------------ -// -// Subtracts two vector registers and carry flag, the result is saturated to -32768 -// TODO: check VS2REG == VDREG - -inline void rsp_cop2_simd::vsub() -{ - int op = m_op; - - __m128i shuffled = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i carry = _mm_and_si128(m_xvflag[CARRY], vec_flagmask); - __m128i unsat = _mm_sub_epi16(m_xv[VS1REG], shuffled); - - __m128i vs2neg = _mm_cmplt_epi16(shuffled, vec_zero); - __m128i vs2pos = _mm_cmpeq_epi16(vs2neg, vec_zero); - - __m128i saturated = _mm_subs_epi16(m_xv[VS1REG], shuffled); - __m128i carry_mask = _mm_cmpeq_epi16(unsat, saturated); - carry_mask = _mm_and_si128(vs2neg, carry_mask); - - vs2neg = _mm_and_si128(carry_mask, carry); - vs2pos = _mm_and_si128(vs2pos, carry); - __m128i dest_carry = _mm_or_si128(vs2neg, vs2pos); - m_xv[VDREG] = _mm_subs_epi16(saturated, dest_carry); - - m_accum_l = _mm_sub_epi16(unsat, carry); - - m_xvflag[ZERO] = _mm_setzero_si128(); - m_xvflag[CARRY] = _mm_setzero_si128(); -} - -static void cfunc_vsub(void *param) -{ - ((rsp_cop2 *)param)->vsub(); -} - - -// VABS -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010011 | -// ------------------------------------------------------ -// -// Changes the sign of source register 2 if source register 1 is negative and stores the result to destination register - -inline void rsp_cop2_simd::vabs() -{ - int op = m_op; - - __m128i shuf2 = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i negs2 = _mm_sub_epi16(_mm_setzero_si128(), shuf2); - __m128i s2_n32768 = _mm_cmpeq_epi16(shuf2, vec_n32768); - __m128i s1_lz = _mm_cmplt_epi16(m_xv[VS1REG], _mm_setzero_si128()); - - __m128i result_gz = _mm_and_si128(shuf2, _mm_cmpgt_epi16(m_xv[VS1REG], _mm_setzero_si128())); - __m128i result_n32768 = _mm_and_si128(s1_lz, _mm_and_si128(vec_32767, s2_n32768)); - __m128i result_negs2 = _mm_and_si128(s1_lz, _mm_and_si128(negs2, _mm_xor_si128(s2_n32768, vec_neg1))); - m_xv[VDREG] = m_accum_l = _mm_or_si128(result_gz, _mm_or_si128(result_n32768, result_negs2)); -} - -static void cfunc_vabs(void *param) -{ - ((rsp_cop2 *)param)->vabs(); -} - - -// VADDC -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010100 | -// ------------------------------------------------------ -// -// Adds two vector registers, the carry out is stored into carry register -// TODO: check VS2REG = VDREG - -inline void rsp_cop2_simd::vaddc() -{ - int op = m_op; - - CLEAR_ZERO_FLAGS(); - CLEAR_CARRY_FLAGS(); - - __m128i shuf2 = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i vec7531 = _mm_and_si128(m_xv[VS1REG], vec_lomask); - __m128i vec6420 = _mm_srli_epi32(m_xv[VS1REG], 16); - __m128i shuf7531 = _mm_and_si128(shuf2, vec_lomask); - __m128i shuf6420 = _mm_srli_epi32(shuf2, 16); - __m128i sum7531 = _mm_add_epi32(vec7531, shuf7531); - __m128i sum6420 = _mm_add_epi32(vec6420, shuf6420); - - __m128i over7531 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum7531, _mm_setzero_si128()), vec_neg1), vec_himask); - __m128i over6420 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum6420, _mm_setzero_si128()), vec_neg1), vec_himask); - - sum7531 = _mm_and_si128(sum7531, vec_lomask); - sum6420 = _mm_and_si128(sum6420, vec_lomask); - - m_xvflag[CARRY] = _mm_or_si128(over6420, _mm_srli_epi32(over7531, 16)); - m_accum_l = m_xv[VDREG] = _mm_or_si128(_mm_slli_epi32(sum6420, 16), sum7531); -} - -static void cfunc_vaddc(void *param) -{ - ((rsp_cop2 *)param)->vaddc(); -} - - -// VSUBC -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010101 | -// ------------------------------------------------------ -// -// Subtracts two vector registers, the carry out is stored into carry register -// TODO: check VS2REG = VDREG - -inline void rsp_cop2_simd::vsubc() -{ - int op = m_op; - - CLEAR_ZERO_FLAGS(); - CLEAR_CARRY_FLAGS(); - - __m128i shuf2 = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i vec7531 = _mm_and_si128(m_xv[VS1REG], vec_lomask); - __m128i vec6420 = _mm_srli_epi32(m_xv[VS1REG], 16); - __m128i shuf7531 = _mm_and_si128(shuf2, vec_lomask); - __m128i shuf6420 = _mm_srli_epi32(shuf2, 16); - __m128i sum7531 = _mm_sub_epi32(vec7531, shuf7531); - __m128i sum6420 = _mm_sub_epi32(vec6420, shuf6420); - - __m128i over7531 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum7531, _mm_setzero_si128()), vec_neg1), vec_himask); - __m128i over6420 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum6420, _mm_setzero_si128()), vec_neg1), vec_himask); - sum7531 = _mm_and_si128(sum7531, vec_lomask); - sum6420 = _mm_and_si128(sum6420, vec_lomask); - __m128i zero7531 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum7531, _mm_setzero_si128()), vec_neg1), vec_lomask); - __m128i zero6420 = _mm_and_si128(_mm_xor_si128(_mm_cmpeq_epi16(sum6420, _mm_setzero_si128()), vec_neg1), vec_lomask); - - m_xvflag[CARRY] = _mm_or_si128(over6420, _mm_srli_epi32(over7531, 16)); - m_xvflag[ZERO] = _mm_or_si128(_mm_slli_epi32(zero6420, 16), zero7531); - - m_accum_l = m_xv[VDREG] = _mm_or_si128(_mm_slli_epi32(sum6420, 16), sum7531); -} - -static void cfunc_vsubc(void *param) -{ - ((rsp_cop2 *)param)->vsubc(); -} - - -// VADDB -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010110 | -// ------------------------------------------------------ -// -// Adds two vector registers bytewise with rounding -inline void rsp_cop2_simd::vaddb() -{ - const int op = m_op; - const int round = (EL == 0) ? 0 : (1 << (EL - 1)); - - for (int i = 0; i < 8; i++) - { - UINT16 w1, w2; - GET_VS1(w1, i); - GET_VS2(w2, i); - - UINT8 hb1 = w1 >> 8; - UINT8 lb1 = w1 & 0xff; - UINT8 hb2 = w2 >> 8; - UINT8 lb2 = w2 & 0xff; - - UINT16 hs = hb1 + hb2 + round; - UINT16 ls = lb1 + lb2 + round; - - SET_ACCUM_L((hs << 8) | ls, i); - - hs >>= EL; - if (hs > 255) - { - hs = 255; - } - - ls >>= EL; - if (ls > 255) - { - ls = 255; - } - - m_vres[i] = 0; // VD writeback disabled on production hardware - // m_vres[i] = (hs << 8) | ls; - } - WRITEBACK_RESULT(); -} - -static void cfunc_vaddb(void *param) -{ - ((rsp_cop2 *)param)->vaddb(); -} - - -// VSAW -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 011101 | -// ------------------------------------------------------ -// -// Stores high, middle or low slice of accumulator to destination vector - -inline void rsp_cop2_simd::vsaw() -{ - int op = m_op; - - switch (EL) - { - case 0x08: // VSAWH - { - m_xv[VDREG] = m_accum_h; - break; - } - case 0x09: // VSAWM - { - m_xv[VDREG] = m_accum_m; - break; - } - case 0x0a: // VSAWL - { - m_xv[VDREG] = m_accum_l; - break; - } - default: // Unsupported, writes 0 to VD - { - } - } -} - -static void cfunc_vsaw(void *param) -{ - ((rsp_cop2 *)param)->vsaw(); -} - - -// VLT -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100000 | -// ------------------------------------------------------ -// -// Sets compare flags if elements in VS1 are less than VS2 -// Moves the element in VS2 to destination vector - -inline void rsp_cop2_simd::vlt() -{ - int op = m_op; - - m_xvflag[COMPARE] = m_xvflag[CLIP2] = _mm_setzero_si128(); - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i zc_mask = _mm_and_si128(m_xvflag[ZERO], m_xvflag[CARRY]); - __m128i lt_mask = _mm_cmplt_epi16(m_xv[VS1REG], shuf); - __m128i eq_mask = _mm_and_si128(_mm_cmpeq_epi16(m_xv[VS1REG], shuf), zc_mask); - - m_xvflag[COMPARE] = _mm_or_si128(lt_mask, eq_mask); - - __m128i result = _mm_and_si128(m_xv[VS1REG], m_xvflag[COMPARE]); - m_accum_l = m_xv[VDREG] = _mm_or_si128(result, _mm_and_si128(shuf, _mm_xor_si128(m_xvflag[COMPARE], vec_neg1))); - - m_xvflag[ZERO] = m_xvflag[CARRY] = _mm_setzero_si128(); -} - -static void cfunc_void vlt(void *param) -{ - ((rsp_cop2 *)param)->vlt(); -} - - -// VEQ -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100001 | -// ------------------------------------------------------ -// -// Sets compare flags if elements in VS1 are equal with VS2 -// Moves the element in VS2 to destination vector - -inline void rsp_cop2_simd::veq() -{ - int op = m_op; - - m_xvflag[COMPARE] = m_xvflag[CLIP2] = _mm_setzero_si128(); - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i zero_mask = _mm_cmpeq_epi16(m_xvflag[ZERO], _mm_setzero_si128()); - __m128i eq_mask = _mm_cmpeq_epi16(m_xv[VS1REG], shuf); - - m_xvflag[COMPARE] = _mm_and_si128(zero_mask, eq_mask); - - __m128i result = _mm_and_si128(m_xv[VS1REG], m_xvflag[COMPARE]); - m_accum_l = m_xv[VDREG] = _mm_or_si128(result, _mm_and_si128(shuf, _mm_xor_si128(m_xvflag[COMPARE], vec_neg1))); - - m_xvflag[ZERO] = m_xvflag[CARRY] = _mm_setzero_si128(); -} - -static void cfunc_veq(void *param) -{ - ((rsp_cop2 *)param)->veq(); -} - - -// VNE -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100010 | -// ------------------------------------------------------ -// -// Sets compare flags if elements in VS1 are not equal with VS2 -// Moves the element in VS2 to destination vector - -inline void rsp_cop2_simd::vne() -{ - int op = m_op; - - m_xvflag[COMPARE] = m_xvflag[CLIP2] = _mm_setzero_si128(); - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i neq_mask = _mm_xor_si128(_mm_cmpeq_epi16(m_xv[VS1REG], shuf), vec_neg1); - - m_xvflag[COMPARE] = _mm_or_si128(m_xvflag[ZERO], neq_mask); - - __m128i result = _mm_and_si128(m_xv[VS1REG], m_xvflag[COMPARE]); - m_accum_l = m_xv[VDREG] = _mm_or_si128(result, _mm_and_si128(shuf, _mm_xor_si128(m_xvflag[COMPARE], vec_neg1))); - - m_xvflag[ZERO] = m_xvflag[CARRY] = _mm_setzero_si128(); -} - -static void cfunc_vne(void *param) -{ - ((rsp_cop2 *)param)->vne(); -} - - -// VGE -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100011 | -// ------------------------------------------------------ -// -// Sets compare flags if elements in VS1 are greater or equal with VS2 -// Moves the element in VS2 to destination vector - -inline void rsp_cop2_simd::vge() -{ - int op = m_op; - - m_xvflag[COMPARE] = m_xvflag[CLIP2] = _mm_setzero_si128(); - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i zero_mask = _mm_cmpeq_epi16(m_xvflag[ZERO], _mm_setzero_si128()); - __m128i carry_mask = _mm_cmpeq_epi16(m_xvflag[CARRY], _mm_setzero_si128()); - __m128i flag_mask = _mm_or_si128(zero_mask, carry_mask); - __m128i eq_mask = _mm_and_si128(_mm_cmpeq_epi16(m_xv[VS1REG], shuf), flag_mask); - __m128i gt_mask = _mm_cmpgt_epi16(m_xv[VS1REG], shuf); - m_xvflag[COMPARE] = _mm_or_si128(eq_mask, gt_mask); - - __m128i result = _mm_and_si128(m_xv[VS1REG], m_xvflag[COMPARE]); - m_accum_l = m_xv[VDREG] = _mm_or_si128(result, _mm_and_si128(shuf, _mm_xor_si128(m_xvflag[COMPARE], vec_neg1))); - - m_xvflag[ZERO] = m_xvflag[CARRY] = _mm_setzero_si128(); -} - -static void cfunc_vge(void *param) -{ - ((rsp_cop2 *)param)->vge(); -} - - -// VCL -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100100 | -// ------------------------------------------------------ -// -// Vector clip low - -inline void rsp_cop2_simd::vcl() -{ - int op = m_op; - - for (int i = 0; i < 8; i++) - { - INT16 s1, s2; - GET_VS1(s1, i); - GET_VS2(s2, i); - - if (CARRY_FLAG(i) != 0) - { - if (ZERO_FLAG(i) != 0) - { - if (COMPARE_FLAG(i) != 0) - { - SET_ACCUM_L(-(UINT16)s2, i); - } - else - { - SET_ACCUM_L(s1, i); - } - } - else - { - if (CLIP1_FLAG(i) != 0) - { - if (((UINT32)(UINT16)(s1) + (UINT32)(UINT16)(s2)) > 0x10000) - { - SET_ACCUM_L(s1, i); - CLEAR_COMPARE_FLAG(i); - } - else - { - SET_ACCUM_L(-((UINT16)s2), i); - SET_COMPARE_FLAG(i); - } - } - else - { - if (((UINT32)(UINT16)(s1) + (UINT32)(UINT16)(s2)) != 0) - { - SET_ACCUM_L(s1, i); - CLEAR_COMPARE_FLAG(i); - } - else - { - SET_ACCUM_L(-((UINT16)s2), i); - SET_COMPARE_FLAG(i); - } - } - } - } - else - { - if (ZERO_FLAG(i) != 0) - { - if (CLIP2_FLAG(i) != 0) - { - SET_ACCUM_L(s2, i); - } - else - { - SET_ACCUM_L(s1, i); - } - } - else - { - if (((INT32)(UINT16)s1 - (INT32)(UINT16)s2) >= 0) - { - SET_ACCUM_L(s2, i); - SET_CLIP2_FLAG(i); - } - else - { - SET_ACCUM_L(s1, i); - CLEAR_CLIP2_FLAG(i); - } - } - } - m_vres[i] = ACCUM_L(i); - } - CLEAR_ZERO_FLAGS(); - CLEAR_CARRY_FLAGS(); - CLEAR_CLIP1_FLAGS(); - WRITEBACK_RESULT(); -} - -static void cfunc_vcl(void *param) -{ - ((rsp_cop2 *)param)->vcl(); -} - - -// VCH -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100101 | -// ------------------------------------------------------ -// -// Vector clip high - -inline void rsp_cop2_simd::vch() -{ - int op = m_op; - - CLEAR_CARRY_FLAGS(); - CLEAR_COMPARE_FLAGS(); - CLEAR_CLIP1_FLAGS(); - CLEAR_ZERO_FLAGS(); - CLEAR_CLIP2_FLAGS(); - - UINT32 vce = 0; - for (int i = 0; i < 8; i++) - { - INT16 s1, s2; - GET_VS1(s1, i); - GET_VS2(s2, i); - - if ((s1 ^ s2) < 0) - { - vce = (s1 + s2 == -1); - SET_CARRY_FLAG(i); - if (s2 < 0) - { - SET_CLIP2_FLAG(i); - } - - if ((s1 + s2) <= 0) - { - SET_COMPARE_FLAG(i); - m_vres[i] = -((UINT16)s2); - } - else - { - m_vres[i] = s1; - } - - if ((s1 + s2) != 0 && s1 != ~s2) - { - SET_ZERO_FLAG(i); - } - }//sign - else - { - vce = 0; - if (s2 < 0) - { - SET_COMPARE_FLAG(i); - } - if ((s1 - s2) >= 0) - { - SET_CLIP2_FLAG(i); - m_vres[i] = s2; - } - else - { - m_vres[i] = s1; - } - - if ((s1 - s2) != 0 && s1 != ~s2) - { - SET_ZERO_FLAG(i); - } - } - if (vce) - { - SET_CLIP1_FLAG(i); - } - SET_ACCUM_L(m_vres[i], i); - } - WRITEBACK_RESULT(); -} - -static void cfunc_vch(void *param) -{ - ((rsp_cop2 *)param)->vch(); -} - - -// VCR -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100110 | -// ------------------------------------------------------ -// -// Vector clip reverse - -inline void rsp_cop2_simd::vcr() -{ - int op = m_op; - - CLEAR_CARRY_FLAGS(); - CLEAR_COMPARE_FLAGS(); - CLEAR_CLIP1_FLAGS(); - CLEAR_ZERO_FLAGS(); - CLEAR_CLIP2_FLAGS(); - - for (int i = 0; i < 8; i++) - { - INT16 s1, s2; - GET_VS1(s1, i); - GET_VS2(s2, i); - - if ((INT16)(s1 ^ s2) < 0) - { - if (s2 < 0) - { - SET_CLIP2_FLAG(i); - } - if ((s1 + s2) <= 0) - { - SET_ACCUM_L(~((UINT16)s2), i); - SET_COMPARE_FLAG(i); - } - else - { - SET_ACCUM_L(s1, i); - } - } - else - { - if (s2 < 0) - { - SET_COMPARE_FLAG(i); - } - if ((s1 - s2) >= 0) - { - SET_ACCUM_L(s2, i); - SET_CLIP2_FLAG(i); - } - else - { - SET_ACCUM_L(s1, i); - } - } - - m_vres[i] = ACCUM_L(i); - } - WRITEBACK_RESULT(); -} - -static void cfunc_vcr(void *param) -{ - ((rsp_cop2 *)param)->vcr(); -} - - -// VMRG -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 100111 | -// ------------------------------------------------------ -// -// Merges two vectors according to compare flags - -inline void rsp_cop2_simd::vmrg() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - __m128i s2mask = _mm_cmpeq_epi16(m_xvflag[COMPARE], _mm_setzero_si128()); - __m128i s1mask = _mm_xor_si128(s2mask, vec_neg1); - __m128i result = _mm_and_si128(m_xv[VS1REG], s1mask); - m_xv[VDREG] = _mm_or_si128(result, _mm_and_si128(shuf, s2mask)); - m_accum_l = m_xv[VDREG]; -} - -static void cfunc_vmrg(void *param) -{ - ((rsp_cop2 *)param)->vmrg(); -} - - -// VAND -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101000 | -// ------------------------------------------------------ -// -// Bitwise AND of two vector registers - -inline void rsp_cop2_simd::vand() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_and_si128(m_xv[VS1REG], shuf); -} - -static void cfunc_vand(void *param) -{ - ((rsp_cop2 *)param)->vand(); -} - - -// VNAND -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101001 | -// ------------------------------------------------------ -// -// Bitwise NOT AND of two vector registers - -inline void rsp_cop2_simd::vnand() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_xor_si128(_mm_and_si128(m_xv[VS1REG], shuf), vec_neg1); -} - -static void cfunc_vnand(void *param) -{ - ((rsp_cop2 *)param)->vnand(); -} - - -// VOR -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101010 | -// ------------------------------------------------------ -// -// Bitwise OR of two vector registers - -inline void rsp_cop2_simd::vor() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_or_si128(m_xv[VS1REG], shuf); -} - -static void cfunc_vor_simd(void *param) -{ - ((rsp_cop2 *)param)->vor(); -} - - -// VNOR -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101011 | -// ------------------------------------------------------ -// -// Bitwise NOT OR of two vector registers - -inline void rsp_cop2_simd::vnor() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_xor_si128(_mm_or_si128(m_xv[VS1REG], shuf), vec_neg1); -} - -static void cfunc_vnor(void *param) -{ - ((rsp_cop2 *)param)->vnor(); -} - - -// VXOR -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101100 | -// ------------------------------------------------------ -// -// Bitwise XOR of two vector registers - -inline void rsp_cop2_simd::vxor() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_xor_si128(m_xv[VS1REG], shuf); -} - -static void cfunc_vxor(void *param) -{ - ((rsp_cop2 *)param)->vxor(); -} - - -// VNXOR -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 101101 | -// ------------------------------------------------------ -// -// Bitwise NOT XOR of two vector registers - -inline void rsp_cop2_simd::vnxor() -{ - int op = m_op; - - __m128i shuf = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - m_accum_l = m_xv[VDREG] = _mm_xor_si128(_mm_xor_si128(m_xv[VS1REG], shuf), vec_neg1); -} - -static void cfunc_vnxor(void *param) -{ - ((rsp_cop2 *)param)->vnxor(); -} - - -// VRCP -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110000 | -// ------------------------------------------------------ -// -// Calculates reciprocal - -inline void rsp_cop2_simd::vrcp() -{ - int op = m_op; - - INT32 shifter = 0; - UINT16 urec; - INT32 rec; - EXTRACT16(m_xv[VS2REG], urec, EL); - rec = (INT16)urec; - INT32 datainput = (rec < 0) ? (-rec) : rec; - if (datainput) - { - for (int i = 0; i < 32; i++) - { - if (datainput & (1 << ((~i) & 0x1f))) - { - shifter = i; - break; - } - } - } - else - { - shifter = 0x10; - } - - INT32 address = ((datainput << shifter) & 0x7fc00000) >> 22; - INT32 fetchval = rsp_divtable[address]; - INT32 temp = (0x40000000 | (fetchval << 14)) >> ((~shifter) & 0x1f); - if (rec < 0) - { - temp = ~temp; - } - if (!rec) - { - temp = 0x7fffffff; - } - else if (rec == 0xffff8000) - { - temp = 0xffff0000; - } - rec = temp; - - m_reciprocal_res = rec; - m_dp_allowed = 0; - - INSERT16(m_xv[VDREG], (UINT16)rec, VS1REG); - m_accum_l = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); -} - -static void cfunc_vrcp(void *param) -{ - ((rsp_cop2 *)param)->vrcp(); -} - - -// VRCPL -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110001 | -// ------------------------------------------------------ -// -// Calculates reciprocal low part - -inline void rsp_cop2_simd::vrcpl() -{ - int op = m_op; - -#if SIMUL_SIMD - m_old_reciprocal_res = m_reciprocal_res; - m_old_reciprocal_high = m_reciprocal_high; - m_old_dp_allowed = m_dp_allowed; -#endif - - INT32 shifter = 0; - - UINT16 urec; - EXTRACT16(m_xv[VS2REG], urec, EL); - INT32 rec = (INT16)urec; - INT32 datainput = rec; - - if (m_dp_allowed) - { - rec = (rec & 0x0000ffff) | m_reciprocal_high; - datainput = rec; - - if (rec < 0) - { - if (rec < -32768) - { - datainput = ~datainput; - } - else - { - datainput = -datainput; - } - } - } - else if (datainput < 0) - { - datainput = -datainput; - - shifter = 0x10; - } - - if (datainput) - { - for (int i = 0; i < 32; i++) - { - if (datainput & (1 << ((~i) & 0x1f))) - { - shifter = i; - break; - } - } - } - - INT32 address = ((datainput << shifter) & 0x7fc00000) >> 22; - INT32 fetchval = rsp_divtable[address]; - INT32 temp = (0x40000000 | (fetchval << 14)) >> ((~shifter) & 0x1f); - temp ^= rec >> 31; - - if (!rec) - { - temp = 0x7fffffff; - } - else if (rec == 0xffff8000) - { - temp = 0xffff0000; - } - rec = temp; - - m_reciprocal_res = rec; - m_dp_allowed = 0; - - INSERT16(m_xv[VDREG], (UINT16)rec, VS1REG); - - for (int i = 0; i < 8; i++) - { - INT16 val; - EXTRACT16(m_xv[VS2REG], val, VEC_EL_2(EL, i)); - SET_ACCUM_L(val, i); - } -} - -static void cfunc_vrcpl(void *param) -{ - ((rsp_cop2 *)param)->vrcpl(); -} - - -// VRCPH -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110010 | -// ------------------------------------------------------ -// -// Calculates reciprocal high part - -inline void rsp_cop2_simd::vrcph() -{ - int op = m_op; - -#if SIMUL_SIMD - m_old_reciprocal_res = m_reciprocal_res; - m_old_reciprocal_high = m_reciprocal_high; - m_old_dp_allowed = m_dp_allowed; -#endif - - UINT16 rcph; - EXTRACT16(m_xv[VS2REG], rcph, EL); - m_reciprocal_high = rcph << 16; - m_dp_allowed = 1; - - m_accum_l = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - INSERT16(m_xv[VDREG], (INT16)(m_reciprocal_res >> 16), VS1REG); -} - -static void cfunc_vrcph(void *param) -{ - ((rsp_cop2 *)param)->vrcph(); -} - - -// VMOV -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110011 | -// ------------------------------------------------------ -// -// Moves element from vector to destination vector - -inline void rsp_cop2_simd::vmov() -{ - int op = m_op; - - INT16 val; - EXTRACT16(m_xv[VS2REG], val, EL); - INSERT16(m_xv[VDREG], val, VS1REG); - m_accum_l = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); -} - -static void cfunc_vmov(void *param) -{ - ((rsp_cop2 *)param)->vmov(); -} - - -// VRSQ -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110100 | -// ------------------------------------------------------ -// -// Calculates reciprocal square-root - -inline void rsp_cop2_simd::vrsq() -{ - int op = m_op; - - INT32 shifter = 0; - INT32 rec = (INT16)VREG_S(VS2REG, EL & 7); - INT32 datainput = (rec < 0) ? (-rec) : (rec); - - if (rec < 0) - { - if (rec < -32768) - { - datainput = ~datainput; - } - else - { - datainput = -datainput; - } - } - - if (datainput) - { - for (int i = 0; i < 32; i++) - { - if (datainput & (1 << ((~i) & 0x1f))) - { - shifter = i; - break; - } - } - } - else - { - shifter = 0; - } - - INT32 address = ((datainput << shifter) & 0x7fc00000) >> 22; - address = ((address | 0x200) & 0x3fe) | (shifter & 1); - - INT32 fetchval = rsp_divtable[address]; - INT32 temp = (0x40000000 | (fetchval << 14)) >> (((~shifter) & 0x1f) >> 1); - if (rec < 0) - { - temp = ~temp; - } - if (!rec) - { - temp = 0x7fffffff; - } - else if (rec == 0xffff8000) - { - temp = 0xffff0000; - } - rec = temp; - - if (rec < 0) - { - if (m_dp_allowed) - { - if (rec < -32768) - { - datainput = ~datainput; - } - else - { - datainput = -datainput; - } - } - else - { - datainput = -datainput; - } - } - - if (datainput) - { - for (int i = 0; i < 32; i++) - { - if (datainput & (1 << ((~i) & 0x1f))) - { - shifter = i; - break; - } - } - } - else - { - shifter = 0; - } - - address = ((datainput << shifter) & 0x7fc00000) >> 22; - address = ((address | 0x200) & 0x3fe) | (shifter & 1); - - fetchval = rsp_divtable[address]; - temp = (0x40000000 | (fetchval << 14)) >> (((~shifter) & 0x1f) >> 1); - if (rec < 0) - { - temp = ~temp; - } - if (!rec) - { - temp = 0x7fff; - } - else if (rec == 0xffff8000) - { - temp = 0x0000; - } - rec = temp; - - W_VREG_S(VDREG, VS1REG & 7) = (UINT16)rec; - for (int i = 0; i < 8; i++) - { - SET_ACCUM_L(VREG_S(VS2REG, VEC_EL_2(EL, i)), i); - } -} - -static void cfunc_vrsq(void *param) -{ - ((rsp_cop2 *)param)->vrsq(); -} - - -// VRSQL -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110101 | -// ------------------------------------------------------ -// -// Calculates reciprocal square-root low part - -inline void rsp_cop2_simd::vrsql() -{ - int op = m_op; - -#if SIMUL_SIMD - m_old_reciprocal_res = m_reciprocal_res; - m_old_reciprocal_high = m_reciprocal_high; - m_old_dp_allowed = m_dp_allowed; -#endif - - INT32 shifter = 0; - UINT16 val; - EXTRACT16(m_xv[VS2REG], val, EL); - INT32 rec = (INT16)val; - INT32 datainput = rec; - - if (m_dp_allowed) - { - rec = (rec & 0x0000ffff) | m_reciprocal_high; - datainput = rec; - - if (rec < 0) - { - if (rec < -32768) - { - datainput = ~datainput; - } - else - { - datainput = -datainput; - } - } - } - else if (datainput < 0) - { - datainput = -datainput; - - shifter = 0x10; - } - - if (datainput) - { - for (int i = 0; i < 32; i++) - { - if (datainput & (1 << ((~i) & 0x1f))) - { - shifter = i; - break; - } - } - } - - INT32 address = ((datainput << shifter) & 0x7fc00000) >> 22; - address = ((address | 0x200) & 0x3fe) | (shifter & 1); - - INT32 fetchval = rsp_divtable[address]; - INT32 temp = (0x40000000 | (fetchval << 14)) >> (((~shifter) & 0x1f) >> 1); - temp ^= rec >> 31; - - if (!rec) - { - temp = 0x7fffffff; - } - else if (rec == 0xffff8000) - { - temp = 0xffff0000; - } - rec = temp; - - m_reciprocal_res = rec; - m_dp_allowed = 0; - - INSERT16(m_xv[VDREG], (UINT16)rec, VS1REG); - m_accum_l = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); -} - -static void cfunc_vrsql(void *param) -{ - ((rsp_cop2 *)param)->vrsql(); -} - - -// VRSQH -// -// 31 25 24 20 15 10 5 0 -// ------------------------------------------------------ -// | 010010 | 1 | EEEE | SSSSS | ?FFFF | DDDDD | 110110 | -// ------------------------------------------------------ -// -// Calculates reciprocal square-root high part - -inline void rsp_cop2_simd::vrsqh() -{ - int op = m_op; - -#if SIMUL_SIMD - m_old_reciprocal_res = m_reciprocal_res; - m_old_reciprocal_high = m_reciprocal_high; - m_old_dp_allowed = m_dp_allowed; -#endif - - UINT16 val; - EXTRACT16(m_xv[VS2REG], val, EL); - m_reciprocal_high = val << 16; - m_dp_allowed = 1; - - m_accum_l = _mm_shuffle_epi8(m_xv[VS2REG], vec_shuf_inverse[EL]); - - INSERT16(m_xv[VDREG], (INT16)(m_reciprocal_res >> 16), VS1REG); // store high part -} - -static void cfunc_vrsqh(void *param) -{ - ((rsp_cop2 *)param)->vrsqh(); -} - - -/*************************************************************************** - Vector Flag Reading/Writing -***************************************************************************/ - -inline void rsp_cop2_simd::mfc2() -{ - UINT32 op = m_op; - int el = (op >> 7) & 0xf; - - UINT16 out; - EXTRACT16(m_xv[VS1REG], out, (el >> 1)); - out >>= (1 - (el & 1)) * 8; - out &= 0x00ff; - - el++; - - UINT16 temp; - EXTRACT16(m_xv[VS1REG], temp, (el >> 1)); - temp >>= (1 - (el & 1)) * 8; - temp &= 0x00ff; - - m_rsp.m_rsp_state->r[RTREG] = (INT32)(INT16)((out << 8) | temp); -} - -static void cfunc_mfc2(void *param) -{ - ((rsp_cop2 *)param)->mfc2(); -} - - -inline void rsp_cop2_simd::cfc2() -{ - UINT32 op = m_op; - if (RTREG) - { - switch(RDREG) - { - case 0: - RTVAL = ((CARRY_FLAG(0) & 1) << 0) | - ((CARRY_FLAG(1) & 1) << 1) | - ((CARRY_FLAG(2) & 1) << 2) | - ((CARRY_FLAG(3) & 1) << 3) | - ((CARRY_FLAG(4) & 1) << 4) | - ((CARRY_FLAG(5) & 1) << 5) | - ((CARRY_FLAG(6) & 1) << 6) | - ((CARRY_FLAG(7) & 1) << 7) | - ((ZERO_FLAG(0) & 1) << 8) | - ((ZERO_FLAG(1) & 1) << 9) | - ((ZERO_FLAG(2) & 1) << 10) | - ((ZERO_FLAG(3) & 1) << 11) | - ((ZERO_FLAG(4) & 1) << 12) | - ((ZERO_FLAG(5) & 1) << 13) | - ((ZERO_FLAG(6) & 1) << 14) | - ((ZERO_FLAG(7) & 1) << 15); - if (RTVAL & 0x8000) RTVAL |= 0xffff0000; - break; - case 1: - RTVAL = ((COMPARE_FLAG(0) & 1) << 0) | - ((COMPARE_FLAG(1) & 1) << 1) | - ((COMPARE_FLAG(2) & 1) << 2) | - ((COMPARE_FLAG(3) & 1) << 3) | - ((COMPARE_FLAG(4) & 1) << 4) | - ((COMPARE_FLAG(5) & 1) << 5) | - ((COMPARE_FLAG(6) & 1) << 6) | - ((COMPARE_FLAG(7) & 1) << 7) | - ((CLIP2_FLAG(0) & 1) << 8) | - ((CLIP2_FLAG(1) & 1) << 9) | - ((CLIP2_FLAG(2) & 1) << 10) | - ((CLIP2_FLAG(3) & 1) << 11) | - ((CLIP2_FLAG(4) & 1) << 12) | - ((CLIP2_FLAG(5) & 1) << 13) | - ((CLIP2_FLAG(6) & 1) << 14) | - ((CLIP2_FLAG(7) & 1) << 15); - if (RTVAL & 0x8000) RTVAL |= 0xffff0000; - break; - case 2: - RTVAL = ((CLIP1_FLAG(0) & 1) << 0) | - ((CLIP1_FLAG(1) & 1) << 1) | - ((CLIP1_FLAG(2) & 1) << 2) | - ((CLIP1_FLAG(3) & 1) << 3) | - ((CLIP1_FLAG(4) & 1) << 4) | - ((CLIP1_FLAG(5) & 1) << 5) | - ((CLIP1_FLAG(6) & 1) << 6) | - ((CLIP1_FLAG(7) & 1) << 7); - break; - } - } -} - -static void cfunc_cfc2(void *param) -{ - ((rsp_cop2 *)param)->cfc2(); -} - - -inline void rsp_cop2_simd::mtc2() -{ - UINT32 op = m_op; - int el = (op >> 7) & 0xf; - INSERT16(m_xv[VS1REG], RTVAL, el >> 1); -} - -static void cfunc_mtc2(void *param) -{ - ((rsp_cop2 *)param)->mtc2(); -} - - -inline void rsp_cop2_simd::ctc2() -{ - UINT32 op = m_op; - switch(RDREG) - { - case 0: - CLEAR_CARRY_FLAGS(); - CLEAR_ZERO_FLAGS(); - m_vflag[0][0] = ((RTVAL >> 0) & 1) ? 0xffff : 0; - m_vflag[0][1] = ((RTVAL >> 1) & 1) ? 0xffff : 0; - m_vflag[0][2] = ((RTVAL >> 2) & 1) ? 0xffff : 0; - m_vflag[0][3] = ((RTVAL >> 3) & 1) ? 0xffff : 0; - m_vflag[0][4] = ((RTVAL >> 4) & 1) ? 0xffff : 0; - m_vflag[0][5] = ((RTVAL >> 5) & 1) ? 0xffff : 0; - m_vflag[0][6] = ((RTVAL >> 6) & 1) ? 0xffff : 0; - m_vflag[0][7] = ((RTVAL >> 7) & 1) ? 0xffff : 0; - if (RTVAL & (1 << 0)) { SET_CARRY_FLAG(0); } - if (RTVAL & (1 << 1)) { SET_CARRY_FLAG(1); } - if (RTVAL & (1 << 2)) { SET_CARRY_FLAG(2); } - if (RTVAL & (1 << 3)) { SET_CARRY_FLAG(3); } - if (RTVAL & (1 << 4)) { SET_CARRY_FLAG(4); } - if (RTVAL & (1 << 5)) { SET_CARRY_FLAG(5); } - if (RTVAL & (1 << 6)) { SET_CARRY_FLAG(6); } - if (RTVAL & (1 << 7)) { SET_CARRY_FLAG(7); } - m_vflag[3][0] = ((RTVAL >> 8) & 1) ? 0xffff : 0; - m_vflag[3][1] = ((RTVAL >> 9) & 1) ? 0xffff : 0; - m_vflag[3][2] = ((RTVAL >> 10) & 1) ? 0xffff : 0; - m_vflag[3][3] = ((RTVAL >> 11) & 1) ? 0xffff : 0; - m_vflag[3][4] = ((RTVAL >> 12) & 1) ? 0xffff : 0; - m_vflag[3][5] = ((RTVAL >> 13) & 1) ? 0xffff : 0; - m_vflag[3][6] = ((RTVAL >> 14) & 1) ? 0xffff : 0; - m_vflag[3][7] = ((RTVAL >> 15) & 1) ? 0xffff : 0; - if (RTVAL & (1 << 8)) { SET_ZERO_FLAG(0); } - if (RTVAL & (1 << 9)) { SET_ZERO_FLAG(1); } - if (RTVAL & (1 << 10)) { SET_ZERO_FLAG(2); } - if (RTVAL & (1 << 11)) { SET_ZERO_FLAG(3); } - if (RTVAL & (1 << 12)) { SET_ZERO_FLAG(4); } - if (RTVAL & (1 << 13)) { SET_ZERO_FLAG(5); } - if (RTVAL & (1 << 14)) { SET_ZERO_FLAG(6); } - if (RTVAL & (1 << 15)) { SET_ZERO_FLAG(7); } - break; - case 1: - CLEAR_COMPARE_FLAGS(); - CLEAR_CLIP2_FLAGS(); - m_vflag[1][0] = ((RTVAL >> 0) & 1) ? 0xffff : 0; - m_vflag[1][1] = ((RTVAL >> 1) & 1) ? 0xffff : 0; - m_vflag[1][2] = ((RTVAL >> 2) & 1) ? 0xffff : 0; - m_vflag[1][3] = ((RTVAL >> 3) & 1) ? 0xffff : 0; - m_vflag[1][4] = ((RTVAL >> 4) & 1) ? 0xffff : 0; - m_vflag[1][5] = ((RTVAL >> 5) & 1) ? 0xffff : 0; - m_vflag[1][6] = ((RTVAL >> 6) & 1) ? 0xffff : 0; - m_vflag[1][7] = ((RTVAL >> 7) & 1) ? 0xffff : 0; - if (RTVAL & (1 << 0)) { SET_COMPARE_FLAG(0); } - if (RTVAL & (1 << 1)) { SET_COMPARE_FLAG(1); } - if (RTVAL & (1 << 2)) { SET_COMPARE_FLAG(2); } - if (RTVAL & (1 << 3)) { SET_COMPARE_FLAG(3); } - if (RTVAL & (1 << 4)) { SET_COMPARE_FLAG(4); } - if (RTVAL & (1 << 5)) { SET_COMPARE_FLAG(5); } - if (RTVAL & (1 << 6)) { SET_COMPARE_FLAG(6); } - if (RTVAL & (1 << 7)) { SET_COMPARE_FLAG(7); } - m_vflag[4][0] = ((RTVAL >> 8) & 1) ? 0xffff : 0; - m_vflag[4][1] = ((RTVAL >> 9) & 1) ? 0xffff : 0; - m_vflag[4][2] = ((RTVAL >> 10) & 1) ? 0xffff : 0; - m_vflag[4][3] = ((RTVAL >> 11) & 1) ? 0xffff : 0; - m_vflag[4][4] = ((RTVAL >> 12) & 1) ? 0xffff : 0; - m_vflag[4][5] = ((RTVAL >> 13) & 1) ? 0xffff : 0; - m_vflag[4][6] = ((RTVAL >> 14) & 1) ? 0xffff : 0; - m_vflag[4][7] = ((RTVAL >> 15) & 1) ? 0xffff : 0; - if (RTVAL & (1 << 8)) { SET_CLIP2_FLAG(0); } - if (RTVAL & (1 << 9)) { SET_CLIP2_FLAG(1); } - if (RTVAL & (1 << 10)) { SET_CLIP2_FLAG(2); } - if (RTVAL & (1 << 11)) { SET_CLIP2_FLAG(3); } - if (RTVAL & (1 << 12)) { SET_CLIP2_FLAG(4); } - if (RTVAL & (1 << 13)) { SET_CLIP2_FLAG(5); } - if (RTVAL & (1 << 14)) { SET_CLIP2_FLAG(6); } - if (RTVAL & (1 << 15)) { SET_CLIP2_FLAG(7); } - break; - case 2: - CLEAR_CLIP1_FLAGS(); - m_vflag[2][0] = ((RTVAL >> 0) & 1) ? 0xffff : 0; - m_vflag[2][1] = ((RTVAL >> 1) & 1) ? 0xffff : 0; - m_vflag[2][2] = ((RTVAL >> 2) & 1) ? 0xffff : 0; - m_vflag[2][3] = ((RTVAL >> 3) & 1) ? 0xffff : 0; - m_vflag[2][4] = ((RTVAL >> 4) & 1) ? 0xffff : 0; - m_vflag[2][5] = ((RTVAL >> 5) & 1) ? 0xffff : 0; - m_vflag[2][6] = ((RTVAL >> 6) & 1) ? 0xffff : 0; - m_vflag[2][7] = ((RTVAL >> 7) & 1) ? 0xffff : 0; - if (RTVAL & (1 << 0)) { SET_CLIP1_FLAG(0); } - if (RTVAL & (1 << 1)) { SET_CLIP1_FLAG(1); } - if (RTVAL & (1 << 2)) { SET_CLIP1_FLAG(2); } - if (RTVAL & (1 << 3)) { SET_CLIP1_FLAG(3); } - if (RTVAL & (1 << 4)) { SET_CLIP1_FLAG(4); } - if (RTVAL & (1 << 5)) { SET_CLIP1_FLAG(5); } - if (RTVAL & (1 << 6)) { SET_CLIP1_FLAG(6); } - if (RTVAL & (1 << 7)) { SET_CLIP1_FLAG(7); } - break; - } -} - -static void cfunc_ctc2(void *param) -{ - ((rsp_cop2 *)param)->ctc2(); -} - - -/*************************************************************************** - COP2 Opcode Compilation -***************************************************************************/ - -int rsp_cop2_simd::generate_cop2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) -{ - UINT32 op = desc->opptr.l[0]; - UINT8 opswitch = RSREG; - - switch (opswitch) - { - case 0x00: /* MFCz */ - if (RTREG != 0) - { - UML_MOV(block, mem(&m_op), desc->opptr.l[0]); // mov [arg0],desc->opptr.l - UML_CALLC(block, cfunc_mfc2, this); // callc mfc2 - } - return TRUE; - - case 0x02: /* CFCz */ - if (RTREG != 0) - { - UML_MOV(block, mem(&m_op), desc->opptr.l[0]); // mov [arg0],desc->opptr.l - UML_CALLC(block, cfunc_cfc2, this); // callc cfc2 - } - return TRUE; - - case 0x04: /* MTCz */ - UML_MOV(block, mem(&m_op), desc->opptr.l[0]); // mov [arg0],desc->opptr.l - UML_CALLC(block, cfunc_mtc2, this); // callc mtc2 - return TRUE; - - case 0x06: /* CTCz */ - UML_MOV(block, mem(&m_op), desc->opptr.l[0]); // mov [arg0],desc->opptr.l - UML_CALLC(block, cfunc_ctc2, this); // callc ctc2 - return TRUE; - - case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: - return generate_vector_opcode(block, compiler, desc); - } - return FALSE; -} diff --git a/src/emu/cpu/rsp/rspcp2s.h b/src/emu/cpu/rsp/rspcp2s.h deleted file mode 100644 index b9ad85fbf54..00000000000 --- a/src/emu/cpu/rsp/rspcp2s.h +++ /dev/null @@ -1,156 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - rspcp2s.h - - Interface file for Reality Signal Processor (RSP) vector extensions - using SSSE3 SIMD acceleration. - -***************************************************************************/ - -#pragma once - -#ifndef __RSPCP2S_H__ -#define __RSPCP2S_H__ - -#include "cpu/drcuml.h" -#include "rsp.h" -#include "rspcp2.h" - -#include <tmmintrin.h> - -class rsp_cop2_simd : public rsp_cop2_drc -{ - friend class rsp_device; - - rsp_cop2_simd(rsp_device &rsp, running_machine &machine); - - virtual int generate_cop2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - - virtual void state_string_export(const int index, std::string &str); - -public: - virtual void lbv(); - virtual void lsv(); - virtual void llv(); - virtual void ldv(); - virtual void lqv(); - virtual void lrv(); - virtual void lpv(); - virtual void luv(); - virtual void lhv(); - virtual void lfv(); - virtual void lwv(); - virtual void ltv(); - virtual void sbv(); - virtual void ssv(); - virtual void slv(); - virtual void sdv(); - virtual void sqv(); - virtual void srv(); - virtual void spv(); - virtual void suv(); - virtual void shv(); - virtual void sfv(); - virtual void swv(); - virtual void stv(); - virtual void vmulf(); - virtual void vmulu(); - virtual void vmudl(); - virtual void vmudm(); - virtual void vmudn(); - virtual void vmudh(); - virtual void vmacf(); - virtual void vmacu(); - virtual void vmadl(); - virtual void vmadm(); - virtual void vmadn(); - virtual void vmadh(); - virtual void vadd(); - virtual void vsub(); - virtual void vabs(); - virtual void vaddc(); - virtual void vsubc(); - virtual void vaddb(); - virtual void vsaw(); - virtual void vlt(); - virtual void veq(); - virtual void vne(); - virtual void vge(); - virtual void vcl(); - virtual void vch(); - virtual void vcr(); - virtual void vmrg(); - virtual void vand(); - virtual void vnand(); - virtual void vor(); - virtual void vnor(); - virtual void vxor(); - virtual void vnxor(); - virtual void vrcp(); - virtual void vrcpl(); - virtual void vrcph(); - virtual void vmov(); - virtual void vrsql(); - virtual void vrsqh(); - virtual void vrsq(); - virtual void mfc2(); - virtual void cfc2(); - virtual void mtc2(); - virtual void ctc2(); - -#if SIMUL_SIMD - void backup_regs(); - void restore_regs(); - void verify_regs(); -#endif - -private: - virtual int generate_vector_opcode(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - - UINT16 ACCUM_H(int x); - UINT16 ACCUM_M(int x); - UINT16 ACCUM_L(int x); - UINT16 ACCUM_LL(int x); - UINT16 CARRY_FLAG(const int x); - UINT16 COMPARE_FLAG(const int x); - UINT16 CLIP1_FLAG(const int x); - UINT16 ZERO_FLAG(const int x); - UINT16 CLIP2_FLAG(const int x); - UINT16 SATURATE_ACCUM(int accum, int slice, UINT16 negative, UINT16 positive); - - __m128i m_accum_h; - __m128i m_accum_m; - __m128i m_accum_l; - __m128i m_accum_ll; - - // Mirror of v[] for now, to be used in parallel as - // more vector ops are transitioned over - __m128i m_xv[32]; - __m128i m_xvflag[6]; - -#if SIMUL_SIMD - UINT32 m_old_r[35]; - UINT8 m_old_dmem[4096]; - - UINT32 m_scalar_r[35]; - UINT8 m_scalar_dmem[4096]; - - INT32 m_old_reciprocal_res; - UINT32 m_old_reciprocal_high; - INT32 m_old_dp_allowed; - - INT32 m_scalar_reciprocal_res; - UINT32 m_scalar_reciprocal_high; - INT32 m_scalar_dp_allowed; - - INT32 m_simd_reciprocal_res; - UINT32 m_simd_reciprocal_high; - INT32 m_simd_dp_allowed; -#endif -}; - -#endif /* __RSPCP2S_H__ */ diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c index e30bad904ec..a1fabc19638 100644 --- a/src/emu/cpu/rsp/rspdrc.c +++ b/src/emu/cpu/rsp/rspdrc.c @@ -669,12 +669,12 @@ void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *co if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP)) { UINT32 sum = seqhead->opptr.l[0]; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc | 0x1000); + void *base = m_direct->read_ptr(seqhead->physpc | 0x1000); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword if (seqhead->delay.first() != NULL && seqhead->physpc != seqhead->delay.first()->physpc) { - base = m_direct->read_decrypted_ptr(seqhead->delay.first()->physpc | 0x1000); + base = m_direct->read_ptr(seqhead->delay.first()->physpc | 0x1000); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 @@ -691,13 +691,13 @@ void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *co else { UINT32 sum = 0; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc | 0x1000); + void *base = m_direct->read_ptr(seqhead->physpc | 0x1000); UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword sum += seqhead->opptr.l[0]; for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc | 0x1000); + base = m_direct->read_ptr(curdesc->physpc | 0x1000); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 @@ -705,7 +705,7 @@ void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *co if (curdesc->delay.first() != NULL && (curdesc == seqlast || (curdesc->next() != NULL && curdesc->next()->physpc != curdesc->delay.first()->physpc))) { - base = m_direct->read_decrypted_ptr(curdesc->delay.first()->physpc | 0x1000); + base = m_direct->read_ptr(curdesc->delay.first()->physpc | 0x1000); assert(base != NULL); UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_ADD(block, I0, I0, I1); // add i0,i0,i1 diff --git a/src/emu/cpu/rsp/rspfe.c b/src/emu/cpu/rsp/rspfe.c index 96291bd0d65..7a80fb6347b 100644 --- a/src/emu/cpu/rsp/rspfe.c +++ b/src/emu/cpu/rsp/rspfe.c @@ -37,7 +37,7 @@ bool rsp_frontend::describe(opcode_desc &desc, const opcode_desc *prev) UINT32 op, opswitch; // fetch the opcode - op = desc.opptr.l[0] = m_rsp.m_direct->read_decrypted_dword(desc.physpc | 0x1000); + op = desc.opptr.l[0] = m_rsp.m_direct->read_dword(desc.physpc | 0x1000); // all instructions are 4 bytes and default to a single cycle each desc.length = 4; diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index abdbe04a1c5..a67bc2ce5fe 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -229,7 +229,7 @@ inline int s2650_device::check_irq_line() ***************************************************************/ inline UINT8 s2650_device::ROP() { - UINT8 result = m_direct->read_decrypted_byte(m_page + m_iar); + UINT8 result = m_direct->read_byte(m_page + m_iar); m_iar = (m_iar + 1) & PMSK; return result; } @@ -240,7 +240,7 @@ inline UINT8 s2650_device::ROP() ***************************************************************/ inline UINT8 s2650_device::ARG() { - UINT8 result = m_direct->read_raw_byte(m_page + m_iar); + UINT8 result = m_direct->read_byte(m_page + m_iar); m_iar = (m_iar + 1) & PMSK; return result; } diff --git a/src/emu/cpu/saturn/satops.inc b/src/emu/cpu/saturn/satops.inc index 35befaaa55f..8f7420584e3 100644 --- a/src/emu/cpu/saturn/satops.inc +++ b/src/emu/cpu/saturn/satops.inc @@ -9,7 +9,7 @@ int saturn_device::READ_OP() { UINT8 data; m_icount-=3; - data=m_direct->read_decrypted_byte(m_pc); + data=m_direct->read_byte(m_pc); saturn_assert(data<0x10); m_pc=(m_pc+1)&0xfffff; return data; @@ -19,7 +19,7 @@ int saturn_device::READ_OP_ARG() { UINT8 data; m_icount-=3; - data=m_direct->read_raw_byte(m_pc); + data=m_direct->read_byte(m_pc); saturn_assert(data<0x10); m_pc=(m_pc+1)&0xfffff; return data; diff --git a/src/emu/cpu/sc61860/scops.inc b/src/emu/cpu/sc61860/scops.inc index bde6edd53e1..7bc5b05c987 100644 --- a/src/emu/cpu/sc61860/scops.inc +++ b/src/emu/cpu/sc61860/scops.inc @@ -18,18 +18,18 @@ UINT8 sc61860_device::READ_OP() { - return m_direct->read_decrypted_byte(m_pc++); + return m_direct->read_byte(m_pc++); } UINT8 sc61860_device::READ_OP_ARG() { - return m_direct->read_raw_byte(m_pc++); + return m_direct->read_byte(m_pc++); } UINT16 sc61860_device::READ_OP_ARG_WORD() { - UINT16 t=m_direct->read_decrypted_byte(m_pc++)<<8; - t|=m_direct->read_decrypted_byte(m_pc++); + UINT16 t=m_direct->read_byte(m_pc++)<<8; + t|=m_direct->read_byte(m_pc++); return t; } diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c index cbfaf6a82c2..edd8502c1c5 100644 --- a/src/emu/cpu/scmp/scmp.c +++ b/src/emu/cpu/scmp/scmp.c @@ -69,14 +69,14 @@ UINT8 scmp_device::ROP() { UINT16 pc = m_PC.w.l; m_PC.w.l = ADD12(m_PC.w.l,1); - return m_direct->read_decrypted_byte( pc); + return m_direct->read_byte( pc); } UINT8 scmp_device::ARG() { UINT16 pc = m_PC.w.l; m_PC.w.l = ADD12(m_PC.w.l,1); - return m_direct->read_raw_byte(pc); + return m_direct->read_byte(pc); } UINT8 scmp_device::RM(UINT32 a) diff --git a/src/emu/cpu/score/score.c b/src/emu/cpu/score/score.c index 3ecbbe6fb4c..a8e3dd210fc 100644 --- a/src/emu/cpu/score/score.c +++ b/src/emu/cpu/score/score.c @@ -283,7 +283,7 @@ INT32 score7_cpu_device::sign_extend(UINT32 data, UINT8 len) UINT32 score7_cpu_device::fetch() { - return m_direct->read_decrypted_dword(m_pc & ~3); + return m_direct->read_dword(m_pc & ~3); } UINT8 score7_cpu_device::read_byte(offs_t offset) diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index 31cbdfe73a2..98a87335d33 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -1738,7 +1738,7 @@ void se3208_device::execute_run() { do { - UINT16 Opcode=m_direct->read_decrypted_word(m_PC, WORD_XOR_LE(0)); + UINT16 Opcode=m_direct->read_word(m_PC, WORD_XOR_LE(0)); debugger_instruction_hook(this, m_PC); diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 9e7c5a467a1..179cc533dc3 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -150,6 +150,7 @@ ADDRESS_MAP_END sh2_device::sh2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, SH2, "SH-2", tag, owner, clock, "sh2", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 32, 32, 0, ADDRESS_MAP_NAME(sh2_internal_map)) + , m_decrypted_program_config("decrypted_opcodes", ENDIANNESS_BIG, 32, 32, 0) , m_is_slave(0) , m_cpu_type(CPU_TYPE_SH2) , m_cache(CACHE_SIZE + sizeof(internal_sh2_state)) @@ -187,6 +188,7 @@ void sh2_device::device_stop() sh2_device::sh2_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int cpu_type) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 32, 32, 0, ADDRESS_MAP_NAME(sh2_internal_map)) + , m_decrypted_program_config("decrypted_opcodes", ENDIANNESS_BIG, 32, 32, 0) , m_is_slave(0) , m_cpu_type(cpu_type) , m_cache(CACHE_SIZE + sizeof(internal_sh2_state)) @@ -214,6 +216,15 @@ sh1_device::sh1_device(const machine_config &mconfig, const char *tag, device_t { } +const address_space_config *sh2_device::memory_space_config(address_spacenum spacenum) const +{ + switch(spacenum) + { + case AS_PROGRAM: return &m_program_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_decrypted_program_config : NULL; + default: return NULL; + } +} offs_t sh2_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { @@ -2397,7 +2408,8 @@ void sh2_device::device_start() m_ftcsr_read_cb.bind_relative_to(*owner()); m_program = &space(AS_PROGRAM); - m_direct = &m_program->direct(); + m_decrypted_program = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : &space(AS_PROGRAM); + m_direct = &m_decrypted_program->direct(); m_internal = &space(AS_PROGRAM); save_item(NAME(m_sh2_state->pc)); diff --git a/src/emu/cpu/sh2/sh2.h b/src/emu/cpu/sh2/sh2.h index a91ac1e781d..c981dfe3c9b 100644 --- a/src/emu/cpu/sh2/sh2.h +++ b/src/emu/cpu/sh2/sh2.h @@ -138,7 +138,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; // device_state_interface overrides virtual void state_import(const device_state_entry &entry); @@ -151,7 +151,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); private: - address_space_config m_program_config; + address_space_config m_program_config, m_decrypted_program_config; // Data that needs to be stored close to the generated DRC code struct internal_sh2_state @@ -195,7 +195,7 @@ private: UINT32 m_pcflushes[16]; // pcflush entries INT8 m_irq_line_state[17]; - address_space *m_program; + address_space *m_program, *m_decrypted_program; protected: direct_read_data *m_direct; private: diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index 42c2cde9434..9c636f6cf84 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -1309,7 +1309,7 @@ void sh2_device::generate_checksum_block(drcuml_block *block, compiler_state *co { if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP)) { - void *base = m_direct->read_decrypted_ptr(seqhead->physpc, SH2_CODE_XOR(0)); + void *base = m_direct->read_ptr(seqhead->physpc, SH2_CODE_XOR(0)); UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x2); // load i0,base,word UML_CMP(block, I0, seqhead->opptr.w[0]); // cmp i0,*opptr UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc @@ -1323,20 +1323,20 @@ void sh2_device::generate_checksum_block(drcuml_block *block, compiler_state *co for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc, SH2_CODE_XOR(0)); + base = m_direct->read_ptr(curdesc->physpc, SH2_CODE_XOR(0)); UML_LOAD(block, I0, curdesc->opptr.w, 0, SIZE_WORD, SCALE_x2); // load i0,*opptr,0,word UML_CMP(block, I0, curdesc->opptr.w[0]); // cmp i0,*opptr UML_EXHc(block, COND_NE, *m_nocode, epc(seqhead)); // exne nocode,seqhead->pc } #else UINT32 sum = 0; - void *base = m_direct->read_decrypted_ptr(seqhead->physpc, SH2_CODE_XOR(0)); + void *base = m_direct->read_ptr(seqhead->physpc, SH2_CODE_XOR(0)); UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x4); // load i0,base,word sum += seqhead->opptr.w[0]; for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next()) if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP)) { - base = m_direct->read_decrypted_ptr(curdesc->physpc, SH2_CODE_XOR(0)); + base = m_direct->read_ptr(curdesc->physpc, SH2_CODE_XOR(0)); UML_LOAD(block, I1, base, 0, SIZE_WORD, SCALE_x2); // load i1,*opptr,word UML_ADD(block, I0, I0, I1); // add i0,i0,i1 sum += curdesc->opptr.w[0]; diff --git a/src/emu/cpu/sh2/sh2fe.c b/src/emu/cpu/sh2/sh2fe.c index 9cc2be5c048..8ea8ccb82d3 100644 --- a/src/emu/cpu/sh2/sh2fe.c +++ b/src/emu/cpu/sh2/sh2fe.c @@ -34,7 +34,7 @@ bool sh2_frontend::describe(opcode_desc &desc, const opcode_desc *prev) UINT16 opcode; /* fetch the opcode */ - opcode = desc.opptr.w[0] = m_sh2->m_direct->read_decrypted_word(desc.physpc, SH2_CODE_XOR(0)); + opcode = desc.opptr.w[0] = m_sh2->m_direct->read_word(desc.physpc, SH2_CODE_XOR(0)); /* all instructions are 2 bytes and most are a single cycle */ desc.length = 2; diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 889fe12eb5c..c5107b6e26f 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -3948,7 +3948,7 @@ void sh34_base_device::execute_run() { if (m_delay) { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_delay & AM), WORD2_XOR_LE(0)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_delay & AM), WORD2_XOR_LE(0)); debugger_instruction_hook(this, (m_pc-2) & AM); @@ -3964,7 +3964,7 @@ void sh34_base_device::execute_run() } else { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_pc & AM), WORD2_XOR_LE(0)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_pc & AM), WORD2_XOR_LE(0)); debugger_instruction_hook(this, m_pc & AM); @@ -3995,7 +3995,7 @@ void sh3be_device::execute_run() { if (m_delay) { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_delay & AM), WORD_XOR_LE(6)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_delay & AM), WORD_XOR_LE(6)); debugger_instruction_hook(this, m_delay & AM); @@ -4014,7 +4014,7 @@ void sh3be_device::execute_run() } else { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_pc & AM), WORD_XOR_LE(6)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_pc & AM), WORD_XOR_LE(6)); debugger_instruction_hook(this, m_pc & AM); @@ -4045,7 +4045,7 @@ void sh4be_device::execute_run() { if (m_delay) { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_delay & AM), WORD_XOR_LE(6)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_delay & AM), WORD_XOR_LE(6)); debugger_instruction_hook(this, m_delay & AM); @@ -4064,7 +4064,7 @@ void sh4be_device::execute_run() } else { - const UINT16 opcode = m_direct->read_decrypted_word((UINT32)(m_pc & AM), WORD_XOR_LE(6)); + const UINT16 opcode = m_direct->read_word((UINT32)(m_pc & AM), WORD_XOR_LE(6)); debugger_instruction_hook(this, m_pc & AM); diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c index 94720fd7e73..66c3e0baf3d 100644 --- a/src/emu/cpu/ssp1601/ssp1601.c +++ b/src/emu/cpu/ssp1601/ssp1601.c @@ -43,7 +43,7 @@ #define PPC m_ppc.w.h -#define FETCH() m_direct->read_decrypted_word(rPC++ << 1) +#define FETCH() m_direct->read_word(rPC++ << 1) #define PROGRAM_WORD(a) m_program->read_word((a) << 1) #define GET_PPC_OFFS() PPC diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c index 46f82f9a627..211bbd1f071 100644 --- a/src/emu/cpu/t11/t11.c +++ b/src/emu/cpu/t11/t11.c @@ -58,7 +58,7 @@ t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t int t11_device::ROPCODE() { PC &= 0xfffe; - int val = m_direct->read_decrypted_word(PC); + int val = m_direct->read_word(PC); PC += 2; return val; } diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c index a90a697f58b..e6264d3f1dd 100644 --- a/src/emu/cpu/tms32010/tms32010.c +++ b/src/emu/cpu/tms32010/tms32010.c @@ -219,7 +219,7 @@ offs_t tms32010_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 * used to greatly speed up emulation */ -#define TMS32010_RDOP(A) (m_direct->read_decrypted_word((A)<<1)) +#define TMS32010_RDOP(A) (m_direct->read_word((A)<<1)) /**************************************************************************** @@ -228,7 +228,7 @@ offs_t tms32010_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 * that use different encoding mechanisms for opcodes and opcode arguments */ -#define TMS32010_RDOP_ARG(A) (m_direct->read_raw_word((A)<<1)) +#define TMS32010_RDOP_ARG(A) (m_direct->read_word((A)<<1)) /************************************************************************ diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 91fa0423e1c..9acc4a31f8c 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -134,8 +134,8 @@ Table 3-2. TMS32025/26 Memory Blocks #define S_IN(A) (m_io->read_word((A)<<1)) #define S_OUT(A,V) (m_io->write_word(((A)<<1),(V))) -#define M_RDOP(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_decrypted_word((A)<<1)) -#define M_RDOP_ARG(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_decrypted_word((A)<<1)) +#define M_RDOP(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_word((A)<<1)) +#define M_RDOP_ARG(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_word((A)<<1)) /************************** Memory mapped registers ****************/ diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index df1f389e4c5..1d8096ce959 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -339,7 +339,7 @@ const rom_entry *tms3203x_device::device_rom_region() const inline UINT32 tms3203x_device::ROPCODE(offs_t pc) { - return m_direct->read_decrypted_dword(pc << 2); + return m_direct->read_dword(pc << 2); } diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c index c4ddc7de55e..7e77cc01398 100644 --- a/src/emu/cpu/tms32051/tms32051.c +++ b/src/emu/cpu/tms32051/tms32051.c @@ -78,7 +78,7 @@ offs_t tms32051_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 #define CYCLES(x) (m_icount -= x) -#define ROPCODE() m_direct->read_decrypted_word((m_pc++) << 1) +#define ROPCODE() m_direct->read_word((m_pc++) << 1) void tms32051_device::CHANGE_PC(UINT16 new_pc) { diff --git a/src/emu/cpu/tms32082/tms32082.c b/src/emu/cpu/tms32082/tms32082.c index f7833e7898c..56d97713b45 100644 --- a/src/emu/cpu/tms32082/tms32082.c +++ b/src/emu/cpu/tms32082/tms32082.c @@ -426,7 +426,7 @@ void tms32082_mp_device::execute_set_input(int inputnum, int state) UINT32 tms32082_mp_device::fetch() { - UINT32 w = m_direct->read_decrypted_dword(m_fetchpc); + UINT32 w = m_direct->read_dword(m_fetchpc); m_fetchpc += 4; return w; } diff --git a/src/emu/cpu/tms34010/34010ops.c b/src/emu/cpu/tms34010/34010ops.c index 1e0866478fc..6674d7a1faa 100644 --- a/src/emu/cpu/tms34010/34010ops.c +++ b/src/emu/cpu/tms34010/34010ops.c @@ -80,13 +80,13 @@ void tms340x0_device::unimpl(UINT16 op) { /* kludge for Super High Impact -- this doesn't seem to cause */ /* an illegal opcode exception */ - if (m_direct->read_decrypted_word(TOBYTE(m_pc - 0x10)) == 0x0007) + if (m_direct->read_word(TOBYTE(m_pc - 0x10)) == 0x0007) return; /* 9 Ball Shootout calls to FFDF7468, expecting it */ /* to execute the next instruction from FFDF7470 */ /* but the instruction at FFDF7460 is an 0x0001 */ - if (m_direct->read_decrypted_word(TOBYTE(m_pc - 0x10)) == 0x0001) + if (m_direct->read_word(TOBYTE(m_pc - 0x10)) == 0x0001) return; PUSH(m_pc); @@ -96,7 +96,7 @@ void tms340x0_device::unimpl(UINT16 op) COUNT_UNKNOWN_CYCLES(16); /* extra check to prevent bad things */ - if (m_pc == 0 || s_opcode_table[m_direct->read_decrypted_word(TOBYTE(m_pc)) >> 4] == &tms34010_device::unimpl) + if (m_pc == 0 || s_opcode_table[m_direct->read_word(TOBYTE(m_pc)) >> 4] == &tms34010_device::unimpl) { set_input_line(INPUT_LINE_HALT, ASSERT_LINE); debugger_break(machine()); diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 524fa8bd917..4faf2967bc8 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -174,32 +174,32 @@ inline UINT32 tms340x0_device::ROPCODE() { UINT32 pc = TOBYTE(m_pc); m_pc += 2 << 3; - return m_direct->read_decrypted_word(pc); + return m_direct->read_word(pc); } inline INT16 tms340x0_device::PARAM_WORD() { UINT32 pc = TOBYTE(m_pc); m_pc += 2 << 3; - return m_direct->read_raw_word(pc); + return m_direct->read_word(pc); } inline INT32 tms340x0_device::PARAM_LONG() { UINT32 pc = TOBYTE(m_pc); m_pc += 4 << 3; - return (UINT16)m_direct->read_raw_word(pc) | (m_direct->read_raw_word(pc + 2) << 16); + return (UINT16)m_direct->read_word(pc) | (m_direct->read_word(pc + 2) << 16); } inline INT16 tms340x0_device::PARAM_WORD_NO_INC() { - return m_direct->read_raw_word(TOBYTE(m_pc)); + return m_direct->read_word(TOBYTE(m_pc)); } inline INT32 tms340x0_device::PARAM_LONG_NO_INC() { UINT32 pc = TOBYTE(m_pc); - return (UINT16)m_direct->read_raw_word(pc) | (m_direct->read_raw_word(pc + 2) << 16); + return (UINT16)m_direct->read_word(pc) | (m_direct->read_word(pc + 2) << 16); } /* read memory byte */ diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c index acc81731c1b..99451e30d6b 100644 --- a/src/emu/cpu/tms7000/tms7000.c +++ b/src/emu/cpu/tms7000/tms7000.c @@ -631,7 +631,7 @@ void tms7000_device::execute_run() { debugger_instruction_hook(this, m_pc); - m_op = m_direct->read_decrypted_byte(m_pc++); + m_op = m_direct->read_byte(m_pc++); execute_one(m_op); } while (m_icount > 0); } diff --git a/src/emu/cpu/tms7000/tms7000.h b/src/emu/cpu/tms7000/tms7000.h index 4b5f14ebe89..92effc0d079 100644 --- a/src/emu/cpu/tms7000/tms7000.h +++ b/src/emu/cpu/tms7000/tms7000.h @@ -143,8 +143,8 @@ protected: inline UINT16 read_mem16(UINT16 address) { return m_program->read_byte(address) << 8 | m_program->read_byte((address + 1) & 0xffff); } inline void write_mem16(UINT16 address, UINT16 data) { m_program->write_byte(address, data >> 8 & 0xff); m_program->write_byte((address + 1) & 0xffff, data & 0xff); } - inline UINT8 imm8() { return m_direct->read_raw_byte(m_pc++); } - inline UINT16 imm16() { UINT16 ret = m_direct->read_raw_byte(m_pc++) << 8; return ret | m_direct->read_raw_byte(m_pc++); } + inline UINT8 imm8() { return m_direct->read_byte(m_pc++); } + inline UINT16 imm16() { UINT16 ret = m_direct->read_byte(m_pc++) << 8; return ret | m_direct->read_byte(m_pc++); } inline UINT8 pull8() { return m_program->read_byte(m_sp--); } inline void push8(UINT8 data) { m_program->write_byte(++m_sp, data); } diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c index 78e248eb7bf..d422eae21b0 100644 --- a/src/emu/cpu/upd7725/upd7725.c +++ b/src/emu/cpu/upd7725/upd7725.c @@ -326,7 +326,7 @@ void necdsp_device::execute_run() debugger_instruction_hook(this, regs.pc); } - opcode = m_direct->read_decrypted_dword(regs.pc<<2)>>8; + opcode = m_direct->read_dword(regs.pc<<2)>>8; regs.pc++; switch(opcode >> 22) { diff --git a/src/emu/cpu/upd7810/upd7810_macros.h b/src/emu/cpu/upd7810/upd7810_macros.h index b6172e816ba..27783fb5d9a 100644 --- a/src/emu/cpu/upd7810/upd7810_macros.h +++ b/src/emu/cpu/upd7810/upd7810_macros.h @@ -104,8 +104,8 @@ // MEMORY/OPCODE READ/WRITE //************************************************************************** -#define RDOP(O) O = m_direct->read_decrypted_byte(PCD); PC++ -#define RDOPARG(A) A = m_direct->read_raw_byte(PCD); PC++ +#define RDOP(O) O = m_direct->read_byte(PCD); PC++ +#define RDOPARG(A) A = m_direct->read_byte(PCD); PC++ #define RM(A) m_program->read_byte(A) #define WM(A,V) m_program->write_byte(A,V) diff --git a/src/emu/cpu/v30mz/v30mz.c b/src/emu/cpu/v30mz/v30mz.c index 62f3dc94132..3bc7c28236a 100644 --- a/src/emu/cpu/v30mz/v30mz.c +++ b/src/emu/cpu/v30mz/v30mz.c @@ -308,7 +308,7 @@ inline void v30mz_cpu_device::write_port(UINT16 port, UINT8 data) inline UINT8 v30mz_cpu_device::fetch_op() { - UINT8 data = m_direct->read_decrypted_byte( pc() ); + UINT8 data = m_direct->read_byte( pc() ); m_ip++; return data; } @@ -316,7 +316,7 @@ inline UINT8 v30mz_cpu_device::fetch_op() inline UINT8 v30mz_cpu_device::fetch() { - UINT8 data = m_direct->read_raw_byte( pc() ); + UINT8 data = m_direct->read_byte( pc() ); m_ip++; return data; } diff --git a/src/emu/cpu/v60/v60.c b/src/emu/cpu/v60/v60.c index 3f2df66199c..38b17139fb7 100644 --- a/src/emu/cpu/v60/v60.c +++ b/src/emu/cpu/v60/v60.c @@ -63,17 +63,17 @@ offs_t v70_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opro // memory accessors #if defined(LSB_FIRST) && !defined(ALIGN_INTS) -#define OpRead8(a) (m_direct->read_decrypted_byte(a)) -#define OpRead16(a) (m_direct->read_decrypted_word(a)) -#define OpRead32(a) (m_direct->read_decrypted_dword(a)) +#define OpRead8(a) (m_direct->read_byte(a)) +#define OpRead16(a) (m_direct->read_word(a)) +#define OpRead32(a) (m_direct->read_dword(a)) #else -#define OpRead8(a) (m_direct->read_decrypted_byte((a), m_fetch_xor)) -#define OpRead16(a) ((m_direct->read_decrypted_byte(((a)+0), m_fetch_xor) << 0) | \ - (m_direct->read_decrypted_byte(((a)+1), m_fetch_xor) << 8)) -#define OpRead32(a) ((m_direct->read_decrypted_byte(((a)+0), m_fetch_xor) << 0) | \ - (m_direct->read_decrypted_byte(((a)+1), m_fetch_xor) << 8) | \ - (m_direct->read_decrypted_byte(((a)+2), m_fetch_xor) << 16) | \ - (m_direct->read_decrypted_byte(((a)+3), m_fetch_xor) << 24)) +#define OpRead8(a) (m_direct->read_byte((a), m_fetch_xor)) +#define OpRead16(a) ((m_direct->read_byte(((a)+0), m_fetch_xor) << 0) | \ + (m_direct->read_byte(((a)+1), m_fetch_xor) << 8)) +#define OpRead32(a) ((m_direct->read_byte(((a)+0), m_fetch_xor) << 0) | \ + (m_direct->read_byte(((a)+1), m_fetch_xor) << 8) | \ + (m_direct->read_byte(((a)+2), m_fetch_xor) << 16) | \ + (m_direct->read_byte(((a)+3), m_fetch_xor) << 24)) #endif diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index c665053af7a..9e6db000949 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -137,7 +137,7 @@ offs_t v810_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr #define WIO_H(addr, val) (m_io->write_word(addr,val)) #define WIO_W(addr, val) (m_io->write_dword(addr,val)) -#define R_OP(addr) (m_direct->read_decrypted_word(addr)) +#define R_OP(addr) (m_direct->read_word(addr)) #define GET1 (op&0x1f) #define GET2 ((op>>5)&0x1f) diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 60fea4491c6..134e67dfb72 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -85,6 +85,7 @@ z180_device::z180_device(const machine_config &mconfig, const char *tag, device_ : cpu_device(mconfig, Z180, "Z180", tag, owner, clock, "z180", __FILE__) , m_program_config("program", ENDIANNESS_LITTLE, 8, 20, 0) , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) + , m_decrypted_opcodes_config("program", ENDIANNESS_LITTLE, 8, 20, 0) { } @@ -767,6 +768,18 @@ static UINT8 *SZHVC_sub; #include "z180ed.inc" #include "z180op.inc" + +const address_space_config *z180_device::memory_space_config(address_spacenum spacenum) const +{ + switch(spacenum) + { + case AS_PROGRAM: return &m_program_config; + case AS_IO: return &m_io_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_decrypted_opcodes_config : NULL; + default: return NULL; + } +} + UINT8 z180_device::z180_readcontrol(offs_t port) { /* normal external readport */ @@ -1956,6 +1969,8 @@ void z180_device::device_start() m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); + m_oprogram = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : m_program; + m_odirect = &m_oprogram->direct(); m_iospace = &space(AS_IO); /* set up the state table */ diff --git a/src/emu/cpu/z180/z180.h b/src/emu/cpu/z180/z180.h index a3d50852bf3..7529280b95a 100644 --- a/src/emu/cpu/z180/z180.h +++ b/src/emu/cpu/z180/z180.h @@ -153,7 +153,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address); // device_state_interface overrides @@ -169,6 +169,7 @@ protected: private: address_space_config m_program_config; address_space_config m_io_config; + address_space_config m_decrypted_opcodes_config; PAIR m_PREPC,m_PC,m_SP,m_AF,m_BC,m_DE,m_HL,m_IX,m_IY; PAIR m_AF2,m_BC2,m_DE2,m_HL2; @@ -193,6 +194,8 @@ private: z80_daisy_chain m_daisy; address_space *m_program; direct_read_data *m_direct; + address_space *m_oprogram; + direct_read_data *m_odirect; address_space *m_iospace; UINT8 m_rtemp; UINT32 m_ioltemp; diff --git a/src/emu/cpu/z180/z180dd.inc b/src/emu/cpu/z180/z180dd.inc index 99557547757..bd2a9fc7137 100644 --- a/src/emu/cpu/z180/z180dd.inc +++ b/src/emu/cpu/z180/z180dd.inc @@ -2,7 +2,7 @@ // copyright-holders:Juergen Buchmueller OP(illegal,1) { logerror("Z180 '%s' ill. opcode $%02x $%02x\n", - tag(), m_direct->read_decrypted_byte((_PCD-1)&0xffff), m_direct->read_decrypted_byte(_PCD)); + tag(), m_odirect->read_byte((_PCD-1)&0xffff), m_odirect->read_byte(_PCD)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180ed.inc b/src/emu/cpu/z180/z180ed.inc index 83dcee1afdb..91520228f87 100644 --- a/src/emu/cpu/z180/z180ed.inc +++ b/src/emu/cpu/z180/z180ed.inc @@ -3,7 +3,7 @@ OP(illegal,2) { logerror("Z180 '%s' ill. opcode $ed $%02x\n", - tag(), m_direct->read_decrypted_byte((_PCD-1)&0xffff)); + tag(), m_odirect->read_byte((_PCD-1)&0xffff)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180ops.h b/src/emu/cpu/z180/z180ops.h index 66de64871ba..36f06a6847f 100644 --- a/src/emu/cpu/z180/z180ops.h +++ b/src/emu/cpu/z180/z180ops.h @@ -102,7 +102,7 @@ UINT8 z180_device::ROP() { offs_t addr = _PCD; _PC++; - return m_direct->read_decrypted_byte(MMU_REMAP_ADDR(addr)); + return m_odirect->read_byte(MMU_REMAP_ADDR(addr)); } /**************************************************************** @@ -115,14 +115,14 @@ UINT8 z180_device::ARG() { offs_t addr = _PCD; _PC++; - return m_direct->read_raw_byte(MMU_REMAP_ADDR(addr)); + return m_direct->read_byte(MMU_REMAP_ADDR(addr)); } UINT32 z180_device::ARG16() { offs_t addr = _PCD; _PC += 2; - return m_direct->read_raw_byte(MMU_REMAP_ADDR(addr)) | (m_direct->read_raw_byte(MMU_REMAP_ADDR(addr+1)) << 8); + return m_direct->read_byte(MMU_REMAP_ADDR(addr)) | (m_direct->read_byte(MMU_REMAP_ADDR(addr+1)) << 8); } /*************************************************************** diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c index bcff4b44145..7db38eaf500 100644 --- a/src/emu/cpu/z8/z8.c +++ b/src/emu/cpu/z8/z8.c @@ -210,7 +210,7 @@ offs_t z8_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom UINT8 z8_device::fetch() { - UINT8 data = m_direct->read_decrypted_byte(m_pc); + UINT8 data = m_direct->read_byte(m_pc); m_pc++; diff --git a/src/emu/cpu/z8/z8ops.inc b/src/emu/cpu/z8/z8ops.inc index 79621ed1512..4c522791b8e 100644 --- a/src/emu/cpu/z8/z8ops.inc +++ b/src/emu/cpu/z8/z8ops.inc @@ -146,7 +146,7 @@ void z8_device::load_from_memory(address_space *space) UINT8 src = get_working_register(operands & 0x0f); UINT16 address = register_pair_read(src); - UINT8 data = m_direct->read_decrypted_byte(address); + UINT8 data = m_direct->read_byte(address); register_write(dst, data); } @@ -171,7 +171,7 @@ void z8_device::load_from_memory_autoinc(address_space *space) UINT8 src = get_working_register(operands & 0x0f); UINT16 address = register_pair_read(src); - UINT8 data = m_direct->read_decrypted_byte(address); + UINT8 data = m_direct->read_byte(address); register_write(real_dst, data); diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c index df11378ffac..2b5e2e877f7 100644 --- a/src/emu/cpu/z80/z80.c +++ b/src/emu/cpu/z80/z80.c @@ -473,7 +473,7 @@ inline UINT8 z80_device::rop() { unsigned pc = PCD; PC++; - return m_direct->read_decrypted_byte(pc); + return m_decrypted_opcodes_direct->read_byte(pc); } /**************************************************************** @@ -486,14 +486,14 @@ inline UINT8 z80_device::arg() { unsigned pc = PCD; PC++; - return m_direct->read_raw_byte(pc); + return m_direct->read_byte(pc); } inline UINT16 z80_device::arg16() { unsigned pc = PCD; PC += 2; - return m_direct->read_raw_byte(pc) | (m_direct->read_raw_byte((pc+1)&0xffff) << 8); + return m_direct->read_byte(pc) | (m_direct->read_byte((pc+1)&0xffff) << 8); } /*************************************************************** @@ -1945,7 +1945,7 @@ OP(xycb,ff) { A = set(7, rm(m_ea)); wm(m_ea, A); } /* SET 7,A=(XY+o) */ OP(illegal,1) { logerror("Z80 '%s' ill. opcode $%02x $%02x\n", - tag(), m_direct->read_decrypted_byte((PCD-1)&0xffff), m_direct->read_decrypted_byte(PCD)); + tag(), m_decrypted_opcodes_direct->read_byte((PCD-1)&0xffff), m_decrypted_opcodes_direct->read_byte(PCD)); } /********************************************************** @@ -2533,7 +2533,7 @@ OP(fd,ff) { illegal_1(); op_ff(); } /* DB FD OP(illegal,2) { logerror("Z80 '%s' ill. opcode $ed $%02x\n", - tag(), m_direct->read_decrypted_byte((PCD-1)&0xffff)); + tag(), m_decrypted_opcodes_direct->read_byte((PCD-1)&0xffff)); } /********************************************************** @@ -3375,7 +3375,9 @@ void z80_device::device_start() m_ea = 0; m_program = &space(AS_PROGRAM); + m_decrypted_opcodes = has_space(AS_DECRYPTED_OPCODES) ? &space(AS_DECRYPTED_OPCODES) : m_program; m_direct = &m_program->direct(); + m_decrypted_opcodes_direct = &m_decrypted_opcodes->direct(); m_io = &space(AS_IO); if (static_config() != NULL) @@ -3702,6 +3704,7 @@ void z80_device::z80_set_cycle_tables(const UINT8 *op, const UINT8 *cb, const UI z80_device::z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, Z80, "Z80", tag, owner, clock, "z80", __FILE__), m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0), + m_decrypted_opcodes_config("decrypted_opcodes", ENDIANNESS_LITTLE, 8, 16, 0), m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) { } @@ -3709,10 +3712,22 @@ z80_device::z80_device(const machine_config &mconfig, const char *tag, device_t z80_device::z80_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) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0), + m_decrypted_opcodes_config("decrypted_opcodes", ENDIANNESS_LITTLE, 8, 16, 0), m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) { } +const address_space_config *z80_device::memory_space_config(address_spacenum spacenum) const +{ + switch(spacenum) + { + case AS_PROGRAM: return &m_program_config; + case AS_IO: return &m_io_config; + case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &m_decrypted_opcodes_config : NULL; + default: return NULL; + } +} + const device_type Z80 = &device_creator<z80_device>; nsc800_device::nsc800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/emu/cpu/z80/z80.h b/src/emu/cpu/z80/z80.h index be04708b3a2..f32686ac479 100644 --- a/src/emu/cpu/z80/z80.h +++ b/src/emu/cpu/z80/z80.h @@ -55,7 +55,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; // device_state_interface overrides virtual void state_import(const device_state_entry &entry); @@ -233,10 +233,13 @@ protected: // address spaces const address_space_config m_program_config; + const address_space_config m_decrypted_opcodes_config; const address_space_config m_io_config; address_space *m_program; - address_space *m_io; + address_space *m_decrypted_opcodes; + address_space *m_io; direct_read_data *m_direct; + direct_read_data *m_decrypted_opcodes_direct; PAIR m_prvpc; PAIR m_pc; diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 8e76f3b3b2b..d7e5f48f79c 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -2453,7 +2453,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch { UINT64 offset, length, bytes = 1; int minbytes, maxbytes, byteswidth; - address_space *space; + address_space *space, *decrypted_space; FILE *f = NULL; int j; @@ -2466,6 +2466,8 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch return; if (!debug_command_parameter_cpu_space(machine, (params > 4) ? param[4] : NULL, AS_PROGRAM, space)) return; + if (!debug_command_parameter_cpu_space(machine, (params > 4) ? param[4] : NULL, AS_DECRYPTED_OPCODES, decrypted_space)) + decrypted_space = space; /* determine the width of the bytes */ cpu_device *cpudevice = downcast<cpu_device *>(&space->device()); @@ -2508,8 +2510,8 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch /* fetch the bytes up to the maximum */ for (numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1, FALSE); - argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1, TRUE); + opbuf[numbytes] = debug_read_opcode(*decrypted_space, pcbyte + numbytes, 1); + argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1); } /* disassemble the result */ @@ -2522,7 +2524,7 @@ static void execute_dasm(running_machine &machine, int ref, int params, const ch int startdex = outdex; numbytes = space->address_to_byte(numbytes); for (j = 0; j < numbytes; j += minbytes) - outdex += sprintf(&output[outdex], "%s ", core_i64_hex_format(debug_read_opcode(*space, pcbyte + j, minbytes, FALSE), minbytes * 2)); + outdex += sprintf(&output[outdex], "%s ", core_i64_hex_format(debug_read_opcode(*decrypted_space, pcbyte + j, minbytes), minbytes * 2)); if (outdex - startdex < byteswidth) outdex += sprintf(&output[outdex], "%*s", byteswidth - (outdex - startdex), ""); outdex += sprintf(&output[outdex], " "); @@ -2647,9 +2649,11 @@ static void execute_traceflush(running_machine &machine, int ref, int params, co static void execute_history(running_machine &machine, int ref, int params, const char *param[]) { /* validate parameters */ - address_space *space; + address_space *space, *decrypted_space; if (!debug_command_parameter_cpu_space(machine, (params > 0) ? param[0] : NULL, AS_PROGRAM, space)) return; + if (!debug_command_parameter_cpu_space(machine, (params > 0) ? param[0] : NULL, AS_DECRYPTED_OPCODES, decrypted_space)) + decrypted_space = space; UINT64 count = device_debug::HISTORY_SIZE; if (!debug_command_parameter_number(machine, param[1], &count)) @@ -2672,8 +2676,8 @@ static void execute_history(running_machine &machine, int ref, int params, const UINT8 opbuf[64], argbuf[64]; for (int numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1, false); - argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1, true); + opbuf[numbytes] = debug_read_opcode(*decrypted_space, pcbyte + numbytes, 1); + argbuf[numbytes] = debug_read_opcode(*space, pcbyte + numbytes, 1); } char buffer[200]; diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 9e3d8121344..2eeb2e1af72 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -860,7 +860,7 @@ void debug_write_memory(address_space &space, offs_t address, UINT64 data, int s the given offset from opcode space -------------------------------------------------*/ -UINT64 debug_read_opcode(address_space &space, offs_t address, int size, int arg) +UINT64 debug_read_opcode(address_space &space, offs_t address, int size) { UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2; debugcpu_private *global = space.machine().debugcpu_data; @@ -881,8 +881,8 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size, int arg if (size > space.data_width() / 8) { int halfsize = size / 2; - UINT64 r0 = debug_read_opcode(space, address + 0, halfsize, arg); - UINT64 r1 = debug_read_opcode(space, address + halfsize, halfsize, arg); + UINT64 r0 = debug_read_opcode(space, address + 0, halfsize); + UINT64 r1 = debug_read_opcode(space, address + halfsize, halfsize); if (space.endianness() == ENDIANNESS_LITTLE) return r0 | (r1 << (8 * halfsize)); @@ -957,14 +957,14 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size, int arg switch (size) { case 1: - result = (arg) ? space.direct().read_raw_byte(address, addrxor) : space.direct().read_decrypted_byte(address, addrxor); + result = space.direct().read_byte(address, addrxor); break; case 2: - result = (arg) ? space.direct().read_raw_word(address & ~1, addrxor) : space.direct().read_decrypted_word(address & ~1, addrxor); + result = space.direct().read_word(address & ~1, addrxor); if ((address & 1) != 0) { - result2 = (arg) ? space.direct().read_raw_word((address & ~1) + 2, addrxor) : space.direct().read_decrypted_word((address & ~1) + 2, addrxor); + result2 = space.direct().read_word((address & ~1) + 2, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) result = (result >> (8 * (address & 1))) | (result2 << (16 - 8 * (address & 1))); else @@ -974,10 +974,10 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size, int arg break; case 4: - result = (arg) ? space.direct().read_raw_dword(address & ~3, addrxor) : space.direct().read_decrypted_dword(address & ~3, addrxor); + result = space.direct().read_dword(address & ~3, addrxor); if ((address & 3) != 0) { - result2 = (arg) ? space.direct().read_raw_dword((address & ~3) + 4, addrxor) : space.direct().read_decrypted_dword((address & ~3) + 4, addrxor); + result2 = space.direct().read_dword((address & ~3) + 4, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) result = (result >> (8 * (address & 3))) | (result2 << (32 - 8 * (address & 3))); else @@ -987,10 +987,10 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size, int arg break; case 8: - result = (arg) ? space.direct().read_raw_qword(address & ~7, addrxor) : space.direct().read_decrypted_qword(address & ~7, addrxor); + result = space.direct().read_qword(address & ~7, addrxor); if ((address & 7) != 0) { - result2 = (arg) ? space.direct().read_raw_qword((address & ~7) + 8, addrxor) : space.direct().read_decrypted_qword((address & ~7) + 8, addrxor); + result2 = space.direct().read_qword((address & ~7) + 8, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) result = (result >> (8 * (address & 7))) | (result2 << (64 - 8 * (address & 7))); else @@ -1219,10 +1219,7 @@ static UINT64 expression_read_program_direct(address_space &space, int opcode, o offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - if (opcode & 1) - base = (UINT8 *)space.direct().read_decrypted_ptr(address & ~lowmask); - else - base = (UINT8 *)space.get_read_ptr(address & ~lowmask); + base = (UINT8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (base != NULL) @@ -1394,10 +1391,7 @@ static void expression_write_program_direct(address_space &space, int opcode, of offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - if (opcode & 1) - base = (UINT8 *)space.direct().read_decrypted_ptr(address & ~lowmask); - else - base = (UINT8 *)space.get_read_ptr(address & ~lowmask); + base = (UINT8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, write the appropriate byte */ if (base != NULL) @@ -2733,6 +2727,7 @@ UINT32 device_debug::compute_opcode_crc32(offs_t pc) const assert(m_memory != NULL); // determine the adjusted PC + address_space &decrypted_space = m_memory->has_space(AS_DECRYPTED_OPCODES) ? m_memory->space(AS_DECRYPTED_OPCODES) : m_memory->space(AS_PROGRAM); address_space &space = m_memory->space(AS_PROGRAM); offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); @@ -2741,8 +2736,8 @@ UINT32 device_debug::compute_opcode_crc32(offs_t pc) const int maxbytes = max_opcode_bytes(); for (int numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, false); - argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, true); + opbuf[numbytes] = debug_read_opcode(decrypted_space, pcbyte + numbytes, 1); + argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1); } // disassemble to our buffer @@ -3128,6 +3123,7 @@ UINT32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) assert(m_memory != NULL && m_disasm != NULL); // determine the adjusted PC + address_space &decrypted_space = m_memory->has_space(AS_DECRYPTED_OPCODES) ? m_memory->space(AS_DECRYPTED_OPCODES) : m_memory->space(AS_PROGRAM); address_space &space = m_memory->space(AS_PROGRAM); offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); @@ -3136,8 +3132,8 @@ UINT32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) int maxbytes = max_opcode_bytes(); for (int numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, false); - argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, true); + opbuf[numbytes] = debug_read_opcode(decrypted_space, pcbyte + numbytes, 1); + argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1); } // disassemble to our buffer diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 2f1f90c4ef7..d337a7103f7 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -549,7 +549,7 @@ void debug_write_qword(address_space &space, offs_t address, UINT64 data, int ap void debug_write_memory(address_space &space, offs_t address, UINT64 data, int size, int apply_translation); /* read 1,2,4 or 8 bytes at the given offset from opcode space */ -UINT64 debug_read_opcode(address_space &space, offs_t offset, int size, int arg); +UINT64 debug_read_opcode(address_space &space, offs_t offset, int size); #endif diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index d29ab590fd4..afcd40dd0ef 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -27,7 +27,8 @@ debug_view_disasm_source::debug_view_disasm_source(const char *name, device_t &d : debug_view_source(name, &device), m_device(device), m_disasmintf(dynamic_cast<device_disasm_interface *>(&device)), - m_space(device.memory().space(AS_PROGRAM)) + m_space(device.memory().space(AS_PROGRAM)), + m_decrypted_space(device.memory().has_space(AS_DECRYPTED_OPCODES) ? device.memory().space(AS_DECRYPTED_OPCODES) : device.memory().space(AS_PROGRAM)) { } @@ -251,8 +252,8 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) while (curpcbyte < fillpcbyte) { fillpcbyte--; - opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, FALSE); - argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, TRUE); + opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_decrypted_space, fillpcbyte, 1); + argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1); } // loop until we get past the target instruction @@ -310,12 +311,12 @@ void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes // output the first value int offset = 0; if (maxchars >= char_num * minbytes) - offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal())); + offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.is_octal())); // output subsequent values int byte; for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes) - offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal())); + offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.is_octal())); // if we ran out of room, indicate more string[maxchars - 1] = 0; @@ -394,8 +395,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // fetch the bytes up to the maximum for (numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, FALSE); - argbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, TRUE); + opbuf[numbytes] = debug_read_opcode(source.m_decrypted_space, pcbyte + numbytes, 1); + argbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1); } // disassemble the result @@ -429,8 +430,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) } // update opcode base information - m_last_direct_decrypted = source.m_space.direct().decrypted(); - m_last_direct_raw = source.m_space.direct().raw(); + m_last_direct_decrypted = source.m_decrypted_space.direct().ptr(); + m_last_direct_raw = source.m_space.direct().ptr(); m_last_change_count = source.m_device.debug()->comment_change_count(); // no longer need to recompute @@ -478,7 +479,7 @@ void debug_view_disasm::view_update() } // if the opcode base has changed, rework things - if (source.m_space.direct().decrypted() != m_last_direct_decrypted || source.m_space.direct().raw() != m_last_direct_raw) + if (source.m_decrypted_space.direct().ptr() != m_last_direct_decrypted || source.m_space.direct().ptr() != m_last_direct_raw) m_recompute = true; // if the comments have changed, redo it diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h index 6f1c911aaeb..202ffbe4d8c 100644 --- a/src/emu/debug/dvdisasm.h +++ b/src/emu/debug/dvdisasm.h @@ -51,6 +51,7 @@ private: device_t & m_device; // underlying device device_disasm_interface *m_disasmintf; // disassembly interface address_space & m_space; // address space to display + address_space & m_decrypted_space; // address space to display for decrypted opcodes }; diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index eff1a8e8d6f..20cf21f25f0 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -68,6 +68,7 @@ enum #define MCFG_CPU_PROGRAM_MAP MCFG_DEVICE_PROGRAM_MAP #define MCFG_CPU_DATA_MAP MCFG_DEVICE_DATA_MAP #define MCFG_CPU_IO_MAP MCFG_DEVICE_IO_MAP +#define MCFG_CPU_DECRYPTED_OPCODES_MAP MCFG_DEVICE_DECRYPTED_OPCODES_MAP #define MCFG_CPU_VBLANK_INT_DRIVER MCFG_DEVICE_VBLANK_INT_DRIVER #define MCFG_CPU_PERIODIC_INT_DRIVER MCFG_DEVICE_PERIODIC_INT_DRIVER diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index 330dfb806e3..5255aadb3da 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -46,6 +46,9 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK); #define MCFG_DEVICE_ADDRESS_MAP(_space, _map) \ device_memory_interface::static_set_addrmap(*device, _space, ADDRESS_MAP_NAME(_map)); +#define MCFG_DEVICE_REMOVE_ADDRESS_MAP(_space) \ + device_memory_interface::static_set_addrmap(*device, _space, NULL); + #define MCFG_DEVICE_PROGRAM_MAP(_map) \ MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _map) @@ -55,6 +58,9 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK); #define MCFG_DEVICE_IO_MAP(_map) \ MCFG_DEVICE_ADDRESS_MAP(AS_IO, _map) +#define MCFG_DEVICE_DECRYPTED_OPCODES_MAP(_map) \ + MCFG_DEVICE_ADDRESS_MAP(AS_DECRYPTED_OPCODES, _map) + //************************************************************************** @@ -82,6 +88,8 @@ public: // basic information getters bool has_space(int index = 0) const { return (m_addrspace[index] != NULL); } bool has_space(address_spacenum index) const { return (m_addrspace[int(index)] != NULL); } + bool has_configured_map(int index = 0) const { return (m_address_map[index] != NULL); } + bool has_configured_map(address_spacenum index) const { return (m_address_map[int(index)] != NULL); } address_space &space(int index = 0) const { assert(m_addrspace[index] != NULL); return *m_addrspace[index]; } address_space &space(address_spacenum index) const { assert(m_addrspace[int(index)] != NULL); return *m_addrspace[int(index)]; } diff --git a/src/emu/drivers/testcpu.c b/src/emu/drivers/testcpu.c index f5fdaa7dd93..b76bbe23d06 100644 --- a/src/emu/drivers/testcpu.c +++ b/src/emu/drivers/testcpu.c @@ -151,14 +151,14 @@ public: { UINT64 fulloffs = offset; UINT64 result = fulloffs + (fulloffs << 8) + (fulloffs << 16) + (fulloffs << 24) + (fulloffs << 32); - printf("Read from %08X & %016" I64FMT "X = %016" I64FMT "X\n", offset * 8, mem_mask, result); + printf("Read from %08X & %08X%08X = %08X%08X\n", offset * 8, (int)((mem_mask&0xffffffff00000000LL) >> 32) , (int)(mem_mask&0xffffffff), (int)((result&0xffffffff00000000LL) >> 32), (int)(result&0xffffffff)); return result; } // report writes to anywhere WRITE64_MEMBER( general_w ) { - printf("Write to %08X & %016" I64FMT "X = %016" I64FMT "X\n", offset * 8, mem_mask, data); + printf("Write to %08X & %08X%08X = %08X%08X\n", offset * 8, (int)((mem_mask&0xffffffff00000000LL) >> 32) , (int)(mem_mask&0xffffffff), (int)((data&0xffffffff00000000LL) >> 32), (int)(data&0xffffffff)); } private: diff --git a/src/emu/info.c b/src/emu/info.c index 4b5adfab3b1..d87cc529bb0 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -374,6 +374,12 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) // output_devices - print the XML info for devices // with roms and for devices that can be mounted // in slots +// The current solution works to some extent, but +// it is limited by the fact that devices are only +// acknowledged when attached to a driver (so that +// for instance sub-sub-devices could never appear +// in the xml input if they are not also attached +// directly to a driver as device or sub-device) //------------------------------------------------- typedef tagmap_t<FPTR> slot_map; @@ -415,6 +421,17 @@ void info_xml_creator::output_devices() if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE) output_one_device(*dev, temptag.c_str()); + // also, check for subdevices with ROMs (a few devices are missed otherwise, e.g. MPU401) + device_iterator deviter2(*dev); + for (device_t *device = deviter2.first(); device != NULL; device = deviter2.next()) + { + if (device->owner() == dev && device->shortname()!= NULL && strlen(device->shortname())!=0) + { + if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE) + output_one_device(*device, device->tag()); + } + } + const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.c_str()); } } diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 937c66db6f3..98bb8c2dacc 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -480,4 +480,4 @@ void riot6532_device::device_timer(emu_timer &timer, device_timer_id id, int par default: assert_always(FALSE, "Unknown id in riot6532_device::device_timer"); } -}
\ No newline at end of file +} diff --git a/src/emu/machine/6532riot.h b/src/emu/machine/6532riot.h index 75b3653489a..2825f31dc9d 100644 --- a/src/emu/machine/6532riot.h +++ b/src/emu/machine/6532riot.h @@ -113,7 +113,7 @@ private: UINT8 m_timershift; UINT8 m_timerstate; emu_timer * m_timer; - + enum { TIMER_END_CB diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index 93c6244f144..3fbf6477fa9 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -14,7 +14,7 @@ // MACROS //************************************************************************** -#define VERBOSE 0 +#define VERBOSE 1 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) diff --git a/src/emu/machine/68307.c b/src/emu/machine/68307.c index 08116ca0e18..320c701acc7 100644 --- a/src/emu/machine/68307.c +++ b/src/emu/machine/68307.c @@ -114,7 +114,7 @@ int m68307_calc_cs(m68307cpu_device *m68k, offs_t address) UINT16 m68307cpu_device::simple_read_immediate_16_m68307(offs_t address) { // m68307_currentcs = m68307_calc_cs(this, address); - return m_direct->read_decrypted_word(address); + return m_direct->read_word(address); } UINT8 m68307cpu_device::read_byte_m68307(offs_t address) diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c index baeeac465dc..355199a8328 100644 --- a/src/emu/machine/netlist.c +++ b/src/emu/machine/netlist.c @@ -63,8 +63,8 @@ void netlist_mame_analog_input_t::static_set_name(device_t &device, const char * void netlist_mame_analog_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::netlist_param_t *p = this->nl_owner().setup().find_param(m_param_name); - m_param = dynamic_cast<netlist::netlist_param_double_t *>(p); + netlist::param_t *p = this->nl_owner().setup().find_param(m_param_name); + m_param = dynamic_cast<netlist::param_double_t *>(p); if (m_param == NULL) { fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.cstr()); @@ -95,7 +95,7 @@ void netlist_mame_analog_output_t::static_set_params(device_t &device, const cha netlist.m_delegate = adelegate; } -void netlist_mame_analog_output_t::custom_netlist_additions(netlist::netlist_setup_t &setup) +void netlist_mame_analog_output_t::custom_netlist_additions(netlist::setup_t &setup) { pstring dname = "OUT_" + m_in; m_delegate.bind_relative_to(owner()->machine().root_device()); @@ -137,8 +137,8 @@ void netlist_mame_logic_input_t::static_set_params(device_t &device, const char void netlist_mame_logic_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::netlist_param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name); - m_param = dynamic_cast<netlist::netlist_param_int_t *>(p); + netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name); + m_param = dynamic_cast<netlist::param_int_t *>(p); if (m_param == NULL) { fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.cstr()); @@ -169,7 +169,7 @@ void netlist_mame_stream_input_t::device_start() LOG_DEV_CALLS(("start %s\n", tag())); } -void netlist_mame_stream_input_t::custom_netlist_additions(netlist::netlist_setup_t &setup) +void netlist_mame_stream_input_t::custom_netlist_additions(netlist::setup_t &setup) { NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device<NETLIB_NAME(sound_in)>(); if (snd_in == NULL) @@ -207,7 +207,7 @@ void netlist_mame_stream_output_t::device_start() LOG_DEV_CALLS(("start %s\n", tag())); } -void netlist_mame_stream_output_t::custom_netlist_additions(netlist::netlist_setup_t &setup) +void netlist_mame_stream_output_t::custom_netlist_additions(netlist::setup_t &setup) { //NETLIB_NAME(sound_out) *snd_out; pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel); @@ -257,7 +257,7 @@ netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, cons m_icount(0), m_div(0), m_rem(0), - m_old(netlist_time::zero), + m_old(netlist::netlist_time::zero), m_netlist(NULL), m_setup(NULL), m_setup_func(NULL) @@ -269,14 +269,14 @@ netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, devi m_icount(0), m_div(0), m_rem(0), - m_old(netlist_time::zero), + m_old(netlist::netlist_time::zero), m_netlist(NULL), m_setup(NULL), m_setup_func(NULL) { } -void netlist_mame_device_t::static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)) +void netlist_mame_device_t::static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)) { LOG_DEV_CALLS(("static_set_constructor\n")); netlist_mame_device_t &netlist = downcast<netlist_mame_device_t &>(device); @@ -294,8 +294,8 @@ void netlist_mame_device_t::device_start() //printf("clock is %d\n", clock()); - m_netlist = global_alloc_clear(netlist_mame_t(*this)); - m_setup = global_alloc_clear(netlist::netlist_setup_t(m_netlist)); + m_netlist = global_alloc(netlist_mame_t(*this)); + m_setup = global_alloc(netlist::setup_t(m_netlist)); netlist().init_object(*m_netlist, "netlist"); m_setup->init(); @@ -325,7 +325,7 @@ void netlist_mame_device_t::device_start() save_state(); - m_old = netlist_time::zero; + m_old = netlist::netlist_time::zero; m_rem = 0; } @@ -333,7 +333,7 @@ void netlist_mame_device_t::device_start() void netlist_mame_device_t::device_clock_changed() { //printf("device_clock_changed\n"); - m_div = netlist_time::from_hz(clock()).as_raw(); + m_div = netlist::netlist_time::from_hz(clock()).as_raw(); //m_rem = 0; //NL_VERBOSE_OUT(("Setting clock %" I64FMT "d and divisor %d\n", clock(), m_div)); NL_VERBOSE_OUT(("Setting clock %d and divisor %d\n", clock(), m_div)); @@ -344,7 +344,7 @@ void netlist_mame_device_t::device_clock_changed() void netlist_mame_device_t::device_reset() { LOG_DEV_CALLS(("device_reset\n")); - m_old = netlist_time::zero; + m_old = netlist::netlist_time::zero; m_rem = 0; netlist().do_reset(); } @@ -383,7 +383,7 @@ void netlist_mame_device_t::device_timer(emu_timer &timer, device_timer_id id, i ATTR_HOT ATTR_ALIGN void netlist_mame_device_t::update_time_x() { - const netlist_time delta = netlist().time() - m_old + netlist_time::from_raw(m_rem); + const netlist::netlist_time delta = netlist().time() - m_old + netlist::netlist_time::from_raw(m_rem); m_old = netlist().time(); m_icount -= divu_64x32_rem(delta.as_raw(), m_div, &m_rem); } @@ -459,7 +459,7 @@ void netlist_mame_cpu_device_t::device_start() { netlist_mame_device_t::device_start(); - LOG_DEV_CALLS(("device_start %s\n", tag())); + LOG_DEV_CALLS(("cpu device_start %s\n", tag())); // State support @@ -529,13 +529,13 @@ ATTR_HOT void netlist_mame_cpu_device_t::execute_run() m_genPC++; m_genPC &= 255; debugger_instruction_hook(this, m_genPC); - netlist().process_queue(netlist_time::from_raw(m_div)); + netlist().process_queue(netlist::netlist_time::from_raw(m_div)); update_time_x(); } } else { - netlist().process_queue(netlist_time::from_raw(m_div) * m_icount); + netlist().process_queue(netlist::netlist_time::from_raw(m_div) * m_icount); update_time_x(); } } @@ -550,12 +550,11 @@ netlist_mame_sound_device_t::netlist_mame_sound_device_t(const machine_config &m { } - void netlist_mame_sound_device_t::device_start() { netlist_mame_device_t::device_start(); - LOG_DEV_CALLS(("device_start %s\n", tag())); + LOG_DEV_CALLS(("sound device_start %s\n", tag())); // Configure outputs @@ -576,7 +575,7 @@ void netlist_mame_sound_device_t::device_start() if (chan < 0 || chan >= MAX_OUT || chan >= outdevs.size()) fatalerror("illegal channel number"); m_out[chan] = outdevs[i]; - m_out[chan]->m_sample = netlist_time::from_hz(clock()); + m_out[chan]->m_sample = netlist::netlist_time::from_hz(clock()); m_out[chan]->m_buffer = NULL; } @@ -592,7 +591,7 @@ void netlist_mame_sound_device_t::device_start() { m_in = indevs[0]; m_num_inputs = m_in->resolve(); - m_in->m_inc = netlist_time::from_hz(clock()); + m_in->m_inc = netlist::netlist_time::from_hz(clock()); } /* initialize the stream(s) */ @@ -622,11 +621,11 @@ void netlist_mame_sound_device_t::sound_stream_update(sound_stream &stream, stre m_in->m_buffer[i] = inputs[i]; } - netlist_time cur = netlist().time(); + netlist::netlist_time cur = netlist().time(); - netlist().process_queue(netlist_time::from_raw(m_div) * samples); + netlist().process_queue(netlist::netlist_time::from_raw(m_div) * samples); - cur += (netlist_time::from_raw(m_div) * samples); + cur += (netlist::netlist_time::from_raw(m_div) * samples); for (int i=0; i < m_num_outputs; i++) { @@ -639,9 +638,9 @@ void netlist_mame_sound_device_t::sound_stream_update(sound_stream &stream, stre // memregion source support // ---------------------------------------------------------------------------------------- -bool netlist_source_memregion_t::parse(netlist::netlist_setup_t *setup, const pstring name) +bool netlist_source_memregion_t::parse(netlist::setup_t *setup, const pstring name) { const char *mem = (const char *)downcast<netlist_mame_t &>(setup->netlist()).machine().root_device().memregion(m_name.cstr())->base(); - netlist::netlist_parser p(*setup); + netlist::parser_t p(*setup); return p.parse(mem, name); } diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index 02aa323dc9b..191caca87ca 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -28,7 +28,7 @@ netlist_mame_analog_input_t::static_set_name(*device, _name); #define MCFG_NETLIST_ANALOG_MULT_OFFSET(_mult, _offset) \ - netlist_mame_analog_input_t::static_set_mult_offset(*device, _mult, _offset); + netlist_mame_sub_interface::static_set_mult_offset(*device, _mult, _offset); #define MCFG_NETLIST_ANALOG_OUTPUT(_basetag, _tag, _IN, _class, _member, _class_tag) \ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_OUTPUT, 0) \ @@ -60,20 +60,20 @@ // Extensions to interface netlist with MAME code .... // ---------------------------------------------------------------------------------------- -class netlist_source_memregion_t : public netlist::netlist_setup_t::source_t +class netlist_source_memregion_t : public netlist::setup_t::source_t { public: netlist_source_memregion_t(pstring name) - : netlist::netlist_setup_t::source_t(), m_name(name) + : netlist::setup_t::source_t(), m_name(name) { } - bool parse(netlist::netlist_setup_t *setup, const pstring name); + bool parse(netlist::setup_t *setup, const pstring name); private: pstring m_name; }; -#define MEMREGION_SOURCE(_name) \ +#define MEMREGION_SOURCE(_name) \ setup.register_source(palloc(netlist_source_memregion_t, _name)); #define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \ @@ -116,12 +116,12 @@ public: netlist_mame_device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *file); virtual ~netlist_mame_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)); - ATTR_HOT inline netlist::netlist_setup_t &setup() { return *m_setup; } + ATTR_HOT inline netlist::setup_t &setup() { return *m_setup; } ATTR_HOT inline netlist_mame_t &netlist() { return *m_netlist; } - ATTR_HOT inline netlist_time last_time_update() { return m_old; } + ATTR_HOT inline netlist::netlist_time last_time_update() { return m_old; } ATTR_HOT void update_time_x(); ATTR_HOT void check_mame_abort_slice(); @@ -150,12 +150,12 @@ private: /* timing support here - so sound can hijack it ... */ UINT32 m_rem; - netlist_time m_old; + netlist::netlist_time m_old; netlist_mame_t * m_netlist; - netlist::netlist_setup_t * m_setup; + netlist::setup_t * m_setup; - void (*m_setup_func)(netlist::netlist_setup_t &); + void (*m_setup_func)(netlist::setup_t &); }; inline running_machine &netlist_mame_t::machine() @@ -179,7 +179,7 @@ public: netlist_mame_cpu_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~netlist_mame_cpu_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)); protected: // netlist_mame_device_t @@ -256,7 +256,7 @@ public: netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~netlist_mame_sound_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)); inline sound_stream *get_stream() { return m_stream; } @@ -306,7 +306,7 @@ public: } virtual ~netlist_mame_sub_interface() { } - virtual void custom_netlist_additions(netlist::netlist_setup_t &setup) { } + virtual void custom_netlist_additions(netlist::setup_t &setup) { } inline netlist_mame_device_t &nl_owner() const { return *m_owner; } @@ -375,7 +375,7 @@ protected: virtual void device_start(); private: - netlist::netlist_param_double_t *m_param; + netlist::param_double_t *m_param; bool m_auto_port; pstring m_param_name; }; @@ -400,7 +400,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::setup_t &setup); private: pstring m_in; @@ -425,16 +425,9 @@ public: inline void write(const UINT32 val) { - if (is_sound_device()) - { - update_to_current_time(); - m_param->setTo((val >> m_shift) & m_mask); - } - else - { - // FIXME: use device timer .... - m_param->setTo((val >> m_shift) & m_mask); - } + const UINT32 v = (val >> m_shift) & m_mask; + if (v != m_param->Value()) + synchronize(0, v); } inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); } @@ -447,9 +440,15 @@ public: protected: // device-level overrides virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) + { + if (is_sound_device()) + update_to_current_time(); + m_param->setTo(param); + } private: - netlist::netlist_param_int_t *m_param; + netlist::param_int_t *m_param; UINT32 m_mask; UINT32 m_shift; pstring m_param_name; @@ -473,7 +472,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::setup_t &setup); private: UINT32 m_channel; pstring m_param_name; @@ -497,7 +496,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::setup_t &setup); private: UINT32 m_channel; pstring m_out_name; @@ -569,52 +568,60 @@ public: register_param("CHAN", m_channel, 0); register_param("MULT", m_mult, 1000.0); register_param("OFFSET", m_offset, 0.0); - m_sample = netlist_time::from_hz(1); //sufficiently big enough + m_sample = netlist::netlist_time::from_hz(1); //sufficiently big enough save(NAME(m_last_buffer)); } ATTR_COLD void reset() { - m_cur = 0; + m_cur = 0.0; m_last_pos = 0; - m_last_buffer = netlist_time::zero; + m_last_buffer = netlist::netlist_time::zero; } - ATTR_HOT void sound_update(const netlist_time upto) + ATTR_HOT void sound_update(const netlist::netlist_time upto) { int pos = (upto - m_last_buffer) / m_sample; if (pos >= BUFSIZE) netlist().error("sound %s: exceeded BUFSIZE\n", name().cstr()); while (m_last_pos < pos ) { - m_buffer[m_last_pos++] = m_cur; + m_buffer[m_last_pos++] = (stream_sample_t) m_cur; } } ATTR_HOT void update() { - nl_double val = INPANALOG(m_in); + nl_double val = INPANALOG(m_in) * m_mult.Value() + m_offset.Value(); sound_update(netlist().time()); - m_cur = (stream_sample_t) (val * m_mult.Value() + m_offset.Value()); + /* ignore spikes */ + if (std::abs(val) < 32767.0) + m_cur = val; + else if (val > 0.0) + m_cur = 32767.0; + else + m_cur = -32767.0; + } - ATTR_HOT void buffer_reset(netlist_time upto) + ATTR_HOT void buffer_reset(netlist::netlist_time upto) { m_last_pos = 0; m_last_buffer = upto; + m_cur = 0.0; } - netlist::netlist_param_int_t m_channel; - netlist::netlist_param_double_t m_mult; - netlist::netlist_param_double_t m_offset; + netlist::param_int_t m_channel; + netlist::param_double_t m_mult; + netlist::param_double_t m_offset; stream_sample_t *m_buffer; - netlist_time m_sample; + netlist::netlist_time m_sample; private: netlist::analog_input_t m_in; - stream_sample_t m_cur; + double m_cur; int m_last_pos; - netlist_time m_last_buffer; + netlist::netlist_time m_last_buffer; }; // ---------------------------------------------------------------------------------------- @@ -636,7 +643,7 @@ public: register_input("FB", m_feedback); connect(m_feedback, m_Q); - m_inc = netlist_time::from_nsec(1); + m_inc = netlist::netlist_time::from_nsec(1); for (int i = 0; i < MAX_INPUT_CHANNELS; i++) @@ -665,7 +672,7 @@ public: if (i != m_num_channel) netlist().error("sound input numbering has to be sequential!"); m_num_channel++; - m_param[i] = dynamic_cast<netlist::netlist_param_double_t *>(setup().find_param(m_param_name[i].Value(), true)); + m_param[i] = dynamic_cast<netlist::param_double_t *>(setup().find_param(m_param_name[i].Value(), true)); } } return m_num_channel; @@ -677,7 +684,7 @@ public: { if (m_buffer[i] == NULL) break; // stop, called outside of stream_update - nl_double v = m_buffer[i][m_pos]; + const nl_double v = m_buffer[i][m_pos]; m_param[i]->setTo(v * m_param_mult[i].Value() + m_param_offset[i].Value()); } m_pos++; @@ -689,12 +696,12 @@ public: m_pos = 0; } - netlist::netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS]; - netlist::netlist_param_double_t *m_param[MAX_INPUT_CHANNELS]; + netlist::param_str_t m_param_name[MAX_INPUT_CHANNELS]; + netlist::param_double_t *m_param[MAX_INPUT_CHANNELS]; stream_sample_t *m_buffer[MAX_INPUT_CHANNELS]; - netlist::netlist_param_double_t m_param_mult[MAX_INPUT_CHANNELS]; - netlist::netlist_param_double_t m_param_offset[MAX_INPUT_CHANNELS]; - netlist_time m_inc; + netlist::param_double_t m_param_mult[MAX_INPUT_CHANNELS]; + netlist::param_double_t m_param_offset[MAX_INPUT_CHANNELS]; + netlist::netlist_time m_inc; private: netlist::logic_input_t m_feedback; diff --git a/src/emu/machine/tms1024.c b/src/emu/machine/tms1024.c index d728f7dfd28..f362349ef16 100644 --- a/src/emu/machine/tms1024.c +++ b/src/emu/machine/tms1024.c @@ -3,10 +3,10 @@ /* Texas Instruments TMS1024/TMS1025 I/O expander - + No documentation was available, just a pinout. Other than more port pins, TMS1025 is assumed to be same as TMS1024. - + TODO: - writes to port 0 - what's the MS pin? @@ -99,13 +99,13 @@ WRITE8_MEMBER(tms1024_device::write_s) WRITE_LINE_MEMBER(tms1024_device::write_std) { state = (state) ? 1 : 0; - + // output on rising edge if (state && !m_std) { if (m_s != 0) (*m_write_port[m_s-1])((offs_t)(m_s-1), m_h); } - + m_std = state; } diff --git a/src/emu/machine/tms1024.h b/src/emu/machine/tms1024.h index e91c0ca5a2d..a7bdb4539bf 100644 --- a/src/emu/machine/tms1024.h +++ b/src/emu/machine/tms1024.h @@ -88,7 +88,7 @@ protected: UINT8 m_h; // 4-bit data latch UINT8 m_s; // 3-bit port select UINT8 m_std; // strobe pin - + // callbacks devcb_write8 m_write_port1, m_write_port2, m_write_port3, m_write_port4, m_write_port5, m_write_port6, m_write_port7; devcb_write8 *m_write_port[7]; diff --git a/src/emu/machine/upd765.c b/src/emu/machine/upd765.c index 83171d8d55d..5a40d63aad3 100644 --- a/src/emu/machine/upd765.c +++ b/src/emu/machine/upd765.c @@ -2465,21 +2465,21 @@ pc_fdc_superio_device::pc_fdc_superio_device(const machine_config &mconfig, cons select_connected = true; } -dp8473_device::dp8473_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "PC FDC SUPERIO", tag, owner, clock, "dp8473", __FILE__) +dp8473_device::dp8473_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "DP8473", tag, owner, clock, "dp8473", __FILE__) { ready_polled = false; ready_connected = false; select_connected = true; } -pc8477a_device::pc8477a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "PC FDC SUPERIO", tag, owner, clock, "pc8477a", __FILE__) +pc8477a_device::pc8477a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "PC8477A", tag, owner, clock, "pc8477a", __FILE__) { ready_polled = true; ready_connected = false; select_connected = true; } -wd37c65c_device::wd37c65c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "PC FDC SUPERIO", tag, owner, clock, "wd37c65c", __FILE__) +wd37c65c_device::wd37c65c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : upd765_family_device(mconfig, PC_FDC_SUPERIO, "WD37C65C", tag, owner, clock, "wd37c65c", __FILE__) { ready_polled = true; ready_connected = false; diff --git a/src/emu/machine/vrc4373.c b/src/emu/machine/vrc4373.c index 234880b0b8e..860b7ff601a 100644 --- a/src/emu/machine/vrc4373.c +++ b/src/emu/machine/vrc4373.c @@ -269,22 +269,39 @@ void vrc4373_device::dma_transfer(int which) if (LOG_NILE) logerror("%08X:nile Start dma PCI: %08X MEM: %08X Words: %X\n", m_cpu->space(AS_PROGRAM).device().safe_pc(), m_cpu_regs[NREG_DMA_CPAR], m_cpu_regs[NREG_DMA_CMAR], m_cpu_regs[NREG_DMA_REM]); int pciSel = (m_cpu_regs[NREG_DMACR1+which*0xC] & DMA_MIO) ? AS_DATA : AS_IO; - UINT32 mem_mask = 0xffffffff; - while (m_cpu_regs[NREG_DMA_REM]>0) { - if (0 && LOG_NILE) - logerror("dma_transfer PCI: %08X Mem: %08X Words Remaining: %X\n", m_cpu_regs[NREG_DMA_CPAR], m_cpu_regs[NREG_DMA_CMAR], m_cpu_regs[NREG_DMA_REM]); - if (m_cpu_regs[NREG_DMACR1+which*0xC]&DMA_RW) { - // Read data from PCI and write to local - m_cpu->space(AS_PROGRAM).write_dword(m_cpu_regs[NREG_DMA_CMAR], this->space(pciSel).read_dword(m_cpu_regs[NREG_DMA_CPAR], mem_mask), mem_mask); - } else { - // Read data from local and write to PCI - this->space(pciSel).write_dword(m_cpu_regs[NREG_DMA_CPAR], m_cpu->space(AS_PROGRAM).read_dword(m_cpu_regs[NREG_DMA_CMAR], mem_mask), mem_mask); - } - m_cpu_regs[NREG_DMA_CMAR] += 0x4; - m_cpu_regs[NREG_DMA_CPAR] += 0x4; - m_cpu_regs[NREG_DMA_REM]--; + address_space *src, *dst; + UINT32 srcAddr, dstAddr; + + if (m_cpu_regs[NREG_DMACR1+which*0xC]&DMA_RW) { + // Read data from PCI and write to cpu + src = &this->space(pciSel); + dst = &m_cpu->space(AS_PROGRAM); + srcAddr = m_cpu_regs[NREG_DMA_CPAR]; + dstAddr = m_cpu_regs[NREG_DMA_CMAR]; + } else { + // Read data from cpu and write to PCI + src = &m_cpu->space(AS_PROGRAM); + dst = &this->space(pciSel); + srcAddr = m_cpu_regs[NREG_DMA_CMAR]; + dstAddr = m_cpu_regs[NREG_DMA_CPAR]; } + int count = m_cpu_regs[NREG_DMA_REM]; + while (count>0) { + dst->write_dword(dstAddr, src->read_dword(srcAddr)); + dstAddr += 0x4; + srcAddr += 0x4; + --count; + } + if (m_cpu_regs[NREG_DMACR1+which*0xC]&DMA_RW) { + m_cpu_regs[NREG_DMA_CPAR] = srcAddr; + m_cpu_regs[NREG_DMA_CMAR] = dstAddr; + } else { + m_cpu_regs[NREG_DMA_CMAR] = srcAddr; + m_cpu_regs[NREG_DMA_CPAR] = dstAddr; + } + m_cpu_regs[NREG_DMA_REM] = 0; } + // CPU I/F READ32_MEMBER (vrc4373_device::cpu_if_r) { diff --git a/src/emu/machine/wd_fdc.c b/src/emu/machine/wd_fdc.c index 9052c033bef..06d6df35f92 100644 --- a/src/emu/machine/wd_fdc.c +++ b/src/emu/machine/wd_fdc.c @@ -4,29 +4,29 @@ #include "debugger.h" -const device_type FD1771x = &device_creator<fd1771_t>; -const device_type FD1781x = &device_creator<fd1781_t>; -const device_type FD1791x = &device_creator<fd1791_t>; -const device_type FD1792x = &device_creator<fd1792_t>; -const device_type FD1793x = &device_creator<fd1793_t>; -const device_type KR1818VG93x = &device_creator<kr1818vg93_t>; -const device_type FD1794x = &device_creator<fd1794_t>; -const device_type FD1795x = &device_creator<fd1795_t>; -const device_type FD1797x = &device_creator<fd1797_t>; -const device_type MB8866x = &device_creator<mb8866_t>; -const device_type MB8876x = &device_creator<mb8876_t>; -const device_type MB8877x = &device_creator<mb8877_t>; -const device_type FD1761x = &device_creator<fd1761_t>; -const device_type FD1763x = &device_creator<fd1763_t>; -const device_type FD1765x = &device_creator<fd1765_t>; -const device_type FD1767x = &device_creator<fd1767_t>; -const device_type WD2791x = &device_creator<wd2791_t>; -const device_type WD2793x = &device_creator<wd2793_t>; -const device_type WD2795x = &device_creator<wd2795_t>; -const device_type WD2797x = &device_creator<wd2797_t>; -const device_type WD1770x = &device_creator<wd1770_t>; -const device_type WD1772x = &device_creator<wd1772_t>; -const device_type WD1773x = &device_creator<wd1773_t>; +const device_type FD1771 = &device_creator<fd1771_t>; +const device_type FD1781 = &device_creator<fd1781_t>; +const device_type FD1791 = &device_creator<fd1791_t>; +const device_type FD1792 = &device_creator<fd1792_t>; +const device_type FD1793 = &device_creator<fd1793_t>; +const device_type KR1818VG93 = &device_creator<kr1818vg93_t>; +const device_type FD1794 = &device_creator<fd1794_t>; +const device_type FD1795 = &device_creator<fd1795_t>; +const device_type FD1797 = &device_creator<fd1797_t>; +const device_type MB8866 = &device_creator<mb8866_t>; +const device_type MB8876 = &device_creator<mb8876_t>; +const device_type MB8877 = &device_creator<mb8877_t>; +const device_type FD1761 = &device_creator<fd1761_t>; +const device_type FD1763 = &device_creator<fd1763_t>; +const device_type FD1765 = &device_creator<fd1765_t>; +const device_type FD1767 = &device_creator<fd1767_t>; +const device_type WD2791 = &device_creator<wd2791_t>; +const device_type WD2793 = &device_creator<wd2793_t>; +const device_type WD2795 = &device_creator<wd2795_t>; +const device_type WD2797 = &device_creator<wd2797_t>; +const device_type WD1770 = &device_creator<wd1770_t>; +const device_type WD1772 = &device_creator<wd1772_t>; +const device_type WD1773 = &device_creator<wd1773_t>; /* Debugging flags. Set to 0 or 1. @@ -2386,7 +2386,7 @@ void wd_fdc_digital_t::digital_pll_t::commit(floppy_image_device *floppy, const write_position = 0; } -fd1771_t::fd1771_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1771x, "FD1771", tag, owner, clock, "fd1771", __FILE__) +fd1771_t::fd1771_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1771, "FD1771", tag, owner, clock, "fd1771", __FILE__) { const static int fd1771_step_times[4] = { 12000, 12000, 20000, 40000 }; @@ -2411,7 +2411,7 @@ int fd1771_t::calc_sector_size(UINT8 size, UINT8 command) const return size ? size << 4 : 4096; } -fd1781_t::fd1781_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1781x, "FD1781", tag, owner, clock, "fd1781", __FILE__) +fd1781_t::fd1781_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1781, "FD1781", tag, owner, clock, "fd1781", __FILE__) { const static int fd1781_step_times[4] = { 6000, 12000, 20000, 40000 }; @@ -2439,7 +2439,7 @@ int fd1781_t::calc_sector_size(UINT8 size, UINT8 command) const const int wd_fdc_t::fd179x_step_times[4] = { 6000, 12000, 20000, 30000 }; const int wd_fdc_t::fd176x_step_times[4] = { 12000, 24000, 40000, 60000 }; -fd1791_t::fd1791_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1791x, "FD1791", tag, owner, clock, "fd1791", __FILE__) +fd1791_t::fd1791_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1791, "FD1791", tag, owner, clock, "fd1791", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2455,7 +2455,7 @@ fd1791_t::fd1791_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1792_t::fd1792_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1792x, "FD1792", tag, owner, clock, "fd1792", __FILE__) +fd1792_t::fd1792_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1792, "FD1792", tag, owner, clock, "fd1792", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2471,7 +2471,7 @@ fd1792_t::fd1792_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1793_t::fd1793_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1793x, "FD1793", tag, owner, clock, "fd1793", __FILE__) +fd1793_t::fd1793_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1793, "FD1793", tag, owner, clock, "fd1793", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2487,7 +2487,7 @@ fd1793_t::fd1793_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -kr1818vg93_t::kr1818vg93_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, KR1818VG93x, "KR1818VG93", tag, owner, clock, "kr1818vg93", __FILE__) +kr1818vg93_t::kr1818vg93_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, KR1818VG93, "KR1818VG93", tag, owner, clock, "kr1818vg93", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2503,7 +2503,7 @@ kr1818vg93_t::kr1818vg93_t(const machine_config &mconfig, const char *tag, devic nonsticky_immint = true; } -fd1794_t::fd1794_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1794x, "FD1794", tag, owner, clock, "fd1794", __FILE__) +fd1794_t::fd1794_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1794, "FD1794", tag, owner, clock, "fd1794", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2519,7 +2519,7 @@ fd1794_t::fd1794_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1795_t::fd1795_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1795x, "FD1795", tag, owner, clock, "fd1795", __FILE__) +fd1795_t::fd1795_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1795, "FD1795", tag, owner, clock, "fd1795", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2543,7 +2543,7 @@ int fd1795_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -fd1797_t::fd1797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1797x, "FD1797", tag, owner, clock, "fd1797", __FILE__) +fd1797_t::fd1797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1797, "FD1797", tag, owner, clock, "fd1797", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2567,7 +2567,7 @@ int fd1797_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -mb8866_t::mb8866_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8866x, "MB8866", tag, owner, clock, "mb8866", __FILE__) +mb8866_t::mb8866_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8866, "MB8866", tag, owner, clock, "mb8866", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2583,7 +2583,7 @@ mb8866_t::mb8866_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -mb8876_t::mb8876_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8876x, "MB8876", tag, owner, clock, "mb8876", __FILE__) +mb8876_t::mb8876_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8876, "MB8876", tag, owner, clock, "mb8876", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2599,7 +2599,7 @@ mb8876_t::mb8876_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -mb8877_t::mb8877_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8877x, "MB8877", tag, owner, clock, "mb8877", __FILE__) +mb8877_t::mb8877_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, MB8877, "MB8877", tag, owner, clock, "mb8877", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 4; @@ -2615,7 +2615,7 @@ mb8877_t::mb8877_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1761_t::fd1761_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1761x, "FD1761", tag, owner, clock, "fd1761", __FILE__) +fd1761_t::fd1761_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1761, "FD1761", tag, owner, clock, "fd1761", __FILE__) { step_times = fd176x_step_times; delay_register_commit = 16; @@ -2631,7 +2631,7 @@ fd1761_t::fd1761_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1763_t::fd1763_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1763x, "FD1763", tag, owner, clock, "fd1763", __FILE__) +fd1763_t::fd1763_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1763, "FD1763", tag, owner, clock, "fd1763", __FILE__) { step_times = fd176x_step_times; delay_register_commit = 16; @@ -2647,7 +2647,7 @@ fd1763_t::fd1763_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -fd1765_t::fd1765_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1765x, "FD1765", tag, owner, clock, "fd1765", __FILE__) +fd1765_t::fd1765_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1765, "FD1765", tag, owner, clock, "fd1765", __FILE__) { step_times = fd176x_step_times; delay_register_commit = 16; @@ -2671,7 +2671,7 @@ int fd1765_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -fd1767_t::fd1767_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1767x, "FD1767", tag, owner, clock, "fd1767", __FILE__) +fd1767_t::fd1767_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, FD1767, "FD1767", tag, owner, clock, "fd1767", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 16; @@ -2695,7 +2695,7 @@ int fd1767_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -wd2791_t::wd2791_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2791x, "WD2791", tag, owner, clock, "wd2791", __FILE__) +wd2791_t::wd2791_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2791, "WD2791", tag, owner, clock, "wd2791", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 16; @@ -2711,7 +2711,7 @@ wd2791_t::wd2791_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -wd2793_t::wd2793_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2793x, "WD2793", tag, owner, clock, "wd2793", __FILE__) +wd2793_t::wd2793_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2793, "WD2793", tag, owner, clock, "wd2793", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 16; @@ -2727,7 +2727,7 @@ wd2793_t::wd2793_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -wd2795_t::wd2795_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2795x, "WD2795", tag, owner, clock, "wd2795", __FILE__) +wd2795_t::wd2795_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2795, "WD2795", tag, owner, clock, "wd2795", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 16; @@ -2751,7 +2751,7 @@ int wd2795_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -wd2797_t::wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2797x, "WD2797", tag, owner, clock, "wd2797", __FILE__) +wd2797_t::wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_analog_t(mconfig, WD2797, "WD2797", tag, owner, clock, "wd2797", __FILE__) { step_times = fd179x_step_times; delay_register_commit = 16; @@ -2775,7 +2775,7 @@ int wd2797_t::calc_sector_size(UINT8 size, UINT8 command) const return 128 << ((size + 1) & 3); } -wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1770x, "WD1770", tag, owner, clock, "wd1770", __FILE__) +wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1770, "WD1770", tag, owner, clock, "wd1770", __FILE__) { step_times = wd_digital_step_times; delay_register_commit = 32; @@ -2791,7 +2791,7 @@ wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *own nonsticky_immint = false; } -wd1772_t::wd1772_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1772x, "WD1772", tag, owner, clock, "wd1772", __FILE__) +wd1772_t::wd1772_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1772, "WD1772", tag, owner, clock, "wd1772", __FILE__) { const static int wd1772_step_times[4] = { 12000, 24000, 4000, 6000 }; @@ -2814,7 +2814,7 @@ int wd1772_t::settle_time() const return 30000; } -wd1773_t::wd1773_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1773x, "WD1773", tag, owner, clock, "wd1773", __FILE__) +wd1773_t::wd1773_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd_fdc_digital_t(mconfig, WD1773, "WD1773", tag, owner, clock, "wd1773", __FILE__) { step_times = wd_digital_step_times; delay_register_commit = 32; diff --git a/src/emu/machine/wd_fdc.h b/src/emu/machine/wd_fdc.h index 8077ec2ec21..100d473f2ac 100644 --- a/src/emu/machine/wd_fdc.h +++ b/src/emu/machine/wd_fdc.h @@ -44,74 +44,74 @@ */ -#define MCFG_FD1771x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1771x, _clock) +#define MCFG_FD1771_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1771, _clock) -#define MCFG_FD1781x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1781x, _clock) +#define MCFG_FD1781_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1781, _clock) -#define MCFG_FD1791x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1791x, _clock) +#define MCFG_FD1791_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1791, _clock) -#define MCFG_FD1792x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1792x, _clock) +#define MCFG_FD1792_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1792, _clock) -#define MCFG_FD1793x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1793x, _clock) +#define MCFG_FD1793_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1793, _clock) -#define MCFG_KR1818VG93x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, KR1818VG93x, _clock) +#define MCFG_KR1818VG93_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, KR1818VG93, _clock) -#define MCFG_FD1794x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1794x, _clock) +#define MCFG_FD1794_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1794, _clock) -#define MCFG_FD1795x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1795x, _clock) +#define MCFG_FD1795_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1795, _clock) -#define MCFG_FD1797x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1797x, _clock) +#define MCFG_FD1797_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1797, _clock) -#define MCFG_MB8866x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, MB8866x, _clock) +#define MCFG_MB8866_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, MB8866, _clock) -#define MCFG_MB8876x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, MB8876x, _clock) +#define MCFG_MB8876_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, MB8876, _clock) -#define MCFG_MB8877x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, MB8877x, _clock) +#define MCFG_MB8877_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, MB8877, _clock) -#define MCFG_FD1761x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1761x, _clock) +#define MCFG_FD1761_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1761, _clock) -#define MCFG_FD1763x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1763x, _clock) +#define MCFG_FD1763_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1763, _clock) -#define MCFG_FD1765x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1765x, _clock) +#define MCFG_FD1765_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1765, _clock) -#define MCFG_FD1767x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, FD1767x, _clock) +#define MCFG_FD1767_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, FD1767, _clock) -#define MCFG_WD2791x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD2791x, _clock) +#define MCFG_WD2791_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD2791, _clock) -#define MCFG_WD2793x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD2793x, _clock) +#define MCFG_WD2793_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD2793, _clock) -#define MCFG_WD2795x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD2795x, _clock) +#define MCFG_WD2795_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD2795, _clock) -#define MCFG_WD2797x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD2797x, _clock) +#define MCFG_WD2797_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD2797, _clock) -#define MCFG_WD1770x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD1770x, _clock) +#define MCFG_WD1770_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD1770, _clock) -#define MCFG_WD1772x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD1772x, _clock) +#define MCFG_WD1772_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD1772, _clock) -#define MCFG_WD1773x_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, WD1773x, _clock) +#define MCFG_WD1773_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, WD1773, _clock) #define MCFG_WD_FDC_FORCE_READY \ downcast<wd_fdc_t *>(device)->set_force_ready(true); @@ -649,33 +649,34 @@ public: wd1773_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; -extern const device_type FD1771x; +extern const device_type FD1771; -extern const device_type FD1781x; +extern const device_type FD1781; -extern const device_type FD1791x; -extern const device_type FD1792x; -extern const device_type FD1793x; -extern const device_type KR1818VG93x; -extern const device_type FD1795x; -extern const device_type FD1797x; +extern const device_type FD1791; +extern const device_type FD1792; +extern const device_type FD1793; +extern const device_type FD1794; +extern const device_type KR1818VG93; +extern const device_type FD1795; +extern const device_type FD1797; -extern const device_type MB8866x; -extern const device_type MB8876x; -extern const device_type MB8877x; +extern const device_type MB8866; +extern const device_type MB8876; +extern const device_type MB8877; -extern const device_type FD1761x; -extern const device_type FD1763x; -extern const device_type FD1765x; -extern const device_type FD1767x; +extern const device_type FD1761; +extern const device_type FD1763; +extern const device_type FD1765; +extern const device_type FD1767; -extern const device_type WD2791x; -extern const device_type WD2793x; -extern const device_type WD2795x; -extern const device_type WD2797x; +extern const device_type WD2791; +extern const device_type WD2793; +extern const device_type WD2795; +extern const device_type WD2797; -extern const device_type WD1770x; -extern const device_type WD1772x; -extern const device_type WD1773x; +extern const device_type WD1770; +extern const device_type WD1772; +extern const device_type WD1773; #endif diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 053890f73e6..a96367ccced 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -22,9 +22,8 @@ // CONSTANTS //************************************************************************** -// by convention, tags should all lowercase and between 1-15 characters +// by convention, tags should all be lowercase #define MIN_TAG_LENGTH 1 -#define MAX_TAG_LENGTH 15 //************************************************************************** // TYPE DEFINITIONS diff --git a/src/emu/memory.c b/src/emu/memory.c index fe38d0595b6..c7742085b0a 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -1510,7 +1510,6 @@ memory_manager::memory_manager(running_machine &machine) m_banknext(STATIC_BANK1) { memset(m_bank_ptr, 0, sizeof(m_bank_ptr)); - memset(m_bankd_ptr, 0, sizeof(m_bankd_ptr)); } @@ -2099,41 +2098,6 @@ void address_space::locate_memory() } -//------------------------------------------------- -// set_decrypted_region - registers an address -// range as having a decrypted data pointer -//------------------------------------------------- - -void address_space::set_decrypted_region(offs_t addrstart, offs_t addrend, void *base) -{ - offs_t bytestart = address_to_byte(addrstart); - offs_t byteend = address_to_byte_end(addrend); - bool found = false; - - // loop over banks looking for a match - for (memory_bank *bank = manager().m_banklist.first(); bank != NULL; bank = bank->next()) - { - // consider this bank if it is used for reading and matches the address space - if (bank->references_space(*this, ROW_READ)) - { - // verify that the provided range fully covers this bank - if (bank->is_covered_by(bytestart, byteend)) - { - // set the decrypted pointer for the corresponding memory bank - bank->set_base_decrypted(reinterpret_cast<UINT8 *>(base) + bank->bytestart() - bytestart); - found = true; - } - - // fatal error if the decrypted region straddles the bank - else if (bank->straddles(bytestart, byteend)) - throw emu_fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for device '%s'", bytestart, byteend, m_device.tag()); - } - } - - // fatal error as well if we didn't find any relevant memory banks - if (!found) - throw emu_fatalerror("memory_set_decrypted_region unable to find matching region %08X-%08X for device '%s'", bytestart, byteend, m_device.tag()); -} //------------------------------------------------- @@ -3666,8 +3630,7 @@ handler_entry &address_table_write::handler(UINT32 index) const direct_read_data::direct_read_data(address_space &space) : m_space(space), - m_raw(NULL), - m_decrypted(NULL), + m_ptr(NULL), m_bytemask(space.bytemask()), m_bytestart(1), m_byteend(0), @@ -3718,17 +3681,12 @@ bool direct_read_data::set_direct_region(offs_t &byteaddress) return false; } - // if no decrypted opcodes, point to the same base - UINT8 *base = *m_space.manager().bank_pointer_addr(m_entry, false); - UINT8 *based = *m_space.manager().bank_pointer_addr(m_entry, true); - if (based == NULL) - based = base; + UINT8 *base = *m_space.manager().bank_pointer_addr(m_entry); // compute the adjusted base const handler_entry_read &handler = m_space.read().handler_read(m_entry); m_bytemask = handler.bytemask(); - m_raw = base - (handler.bytestart() & m_bytemask); - m_decrypted = based - (handler.bytestart() & m_bytemask); + m_ptr = base - (handler.bytestart() & m_bytemask); m_bytestart = maskedbits | range->m_bytestart; m_byteend = maskedbits | range->m_byteend; return true; @@ -3811,15 +3769,12 @@ direct_update_delegate direct_read_data::set_direct_update(direct_update_delegat // within a custom callback //------------------------------------------------- -void direct_read_data::explicit_configure(offs_t bytestart, offs_t byteend, offs_t bytemask, void *raw, void *decrypted) +void direct_read_data::explicit_configure(offs_t bytestart, offs_t byteend, offs_t bytemask, void *ptr) { m_bytestart = bytestart; m_byteend = byteend; m_bytemask = bytemask; - m_raw = reinterpret_cast<UINT8 *>(raw); - m_decrypted = reinterpret_cast<UINT8 *>((decrypted == NULL) ? raw : decrypted); - m_raw -= bytestart & bytemask; - m_decrypted -= bytestart & bytemask; + m_ptr = reinterpret_cast<UINT8 *>(ptr) - (bytestart & bytemask); } @@ -3901,8 +3856,7 @@ memory_block::~memory_block() memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag) : m_next(NULL), m_machine(space.machine()), - m_baseptr(space.manager().bank_pointer_addr(index, false)), - m_basedptr(space.manager().bank_pointer_addr(index, true)), + m_baseptr(space.manager().bank_pointer_addr(index)), m_index(index), m_anonymous(tag == NULL), m_bytestart(bytestart), @@ -3994,23 +3948,6 @@ void memory_bank::set_base(void *base) //------------------------------------------------- -// set_base_decrypted - set the decrypted base -// explicitly -//------------------------------------------------- - -void memory_bank::set_base_decrypted(void *base) -{ - // NULL is not an option - if (base == NULL) - throw emu_fatalerror("memory_bank::set_base_decrypted called NULL base"); - - // set the base and invalidate any referencing spaces - *m_basedptr = reinterpret_cast<UINT8 *>(base); - invalidate_references(); -} - - -//------------------------------------------------- // set_entry - set the base to a pre-configured // entry //------------------------------------------------- @@ -4022,13 +3959,11 @@ void memory_bank::set_entry(int entrynum) throw emu_fatalerror("memory_bank::set_entry called for anonymous bank"); if (entrynum < 0 || entrynum >= int(m_entry.size())) throw emu_fatalerror("memory_bank::set_entry called with out-of-range entry %d", entrynum); - if (m_entry[entrynum].m_raw == NULL) + if (m_entry[entrynum].m_ptr == NULL) throw emu_fatalerror("memory_bank::set_entry called for bank '%s' with invalid bank entry %d", m_tag.c_str(), entrynum); - // set both raw and decrypted values m_curentry = entrynum; - *m_baseptr = m_entry[entrynum].m_raw; - *m_basedptr = m_entry[entrynum].m_decrypted; + *m_baseptr = m_entry[entrynum].m_ptr; // invalidate referencing spaces invalidate_references(); @@ -4064,11 +3999,11 @@ void memory_bank::configure_entry(int entrynum, void *base) expand_entries(entrynum); // set the entry - m_entry[entrynum].m_raw = reinterpret_cast<UINT8 *>(base); + m_entry[entrynum].m_ptr = reinterpret_cast<UINT8 *>(base); // if the bank base is not configured, and we're the first entry, set us up if (*m_baseptr == NULL && entrynum == 0) - *m_baseptr = m_entry[entrynum].m_raw; + *m_baseptr = m_entry[entrynum].m_ptr; } @@ -4084,43 +4019,6 @@ void memory_bank::configure_entries(int startentry, int numentries, void *base, } -//------------------------------------------------- -// configure_decrypted_entry - configure a -// decrypted entry -//------------------------------------------------- - -void memory_bank::configure_decrypted_entry(int entrynum, void *base) -{ - // must be positive - if (entrynum < 0) - throw emu_fatalerror("memory_bank::configure_decrypted_entry called with out-of-range entry %d", entrynum); - - // if we haven't allocated this many entries yet, expand our array - if (entrynum >= int(m_entry.size())) - expand_entries(entrynum); - - // set the entry - m_entry[entrynum].m_decrypted = reinterpret_cast<UINT8 *>(base); - - // if the bank base is not configured, and we're the first entry, set us up - if (*m_basedptr == NULL && entrynum == 0) - *m_basedptr = m_entry[entrynum].m_decrypted; -} - - -//------------------------------------------------- -// configure_decrypted_entries - configure -// multiple decrypted entries -//------------------------------------------------- - -void memory_bank::configure_decrypted_entries(int startentry, int numentries, void *base, offs_t stride) -{ - // fill in the requested bank entries (backwards to improve allocation) - for (int entrynum = startentry + numentries - 1; entrynum >= startentry; entrynum--) - configure_decrypted_entry(entrynum, reinterpret_cast<UINT8 *>(base) + (entrynum - startentry) * stride); -} - - //************************************************************************** // MEMORY REGIONS //************************************************************************** diff --git a/src/emu/memory.h b/src/emu/memory.h index da91f4c0baf..739bf72baa7 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -37,7 +37,8 @@ enum address_spacenum // alternate address space names for common use AS_PROGRAM = AS_0, // program address space AS_DATA = AS_1, // data address space - AS_IO = AS_2 // I/O address space + AS_IO = AS_2, // I/O address space + AS_DECRYPTED_OPCODES = AS_3 // decrypted opcodes, when separate from data accesses }; DECLARE_ENUM_OPERATORS(address_spacenum); @@ -166,8 +167,7 @@ public: // getters address_space &space() const { return m_space; } - UINT8 *raw() const { return m_raw; } - UINT8 *decrypted() const { return m_decrypted; } + UINT8 *ptr() const { return m_ptr; } // see if an address is within bounds, or attempt to update it if not bool address_is_valid(offs_t byteaddress) { return EXPECTED(byteaddress >= m_bytestart && byteaddress <= m_byteend) || set_direct_region(byteaddress); } @@ -178,21 +178,14 @@ public: // custom update callbacks and configuration direct_update_delegate set_direct_update(direct_update_delegate function); - void explicit_configure(offs_t bytestart, offs_t byteend, offs_t bytemask, void *raw, void *decrypted = NULL); - - // accessor methods for reading raw data - void *read_raw_ptr(offs_t byteaddress, offs_t directxor = 0); - UINT8 read_raw_byte(offs_t byteaddress, offs_t directxor = 0); - UINT16 read_raw_word(offs_t byteaddress, offs_t directxor = 0); - UINT32 read_raw_dword(offs_t byteaddress, offs_t directxor = 0); - UINT64 read_raw_qword(offs_t byteaddress, offs_t directxor = 0); - - // accessor methods for reading decrypted data - void *read_decrypted_ptr(offs_t byteaddress, offs_t directxor = 0); - UINT8 read_decrypted_byte(offs_t byteaddress, offs_t directxor = 0); - UINT16 read_decrypted_word(offs_t byteaddress, offs_t directxor = 0); - UINT32 read_decrypted_dword(offs_t byteaddress, offs_t directxor = 0); - UINT64 read_decrypted_qword(offs_t byteaddress, offs_t directxor = 0); + void explicit_configure(offs_t bytestart, offs_t byteend, offs_t bytemask, void *raw); + + // accessor methods + void *read_ptr(offs_t byteaddress, offs_t directxor = 0); + UINT8 read_byte(offs_t byteaddress, offs_t directxor = 0); + UINT16 read_word(offs_t byteaddress, offs_t directxor = 0); + UINT32 read_dword(offs_t byteaddress, offs_t directxor = 0); + UINT64 read_qword(offs_t byteaddress, offs_t directxor = 0); private: // internal helpers @@ -202,8 +195,7 @@ private: // internal state address_space & m_space; - UINT8 * m_raw; // direct access data pointer (raw) - UINT8 * m_decrypted; // direct access data pointer (decrypted) + UINT8 * m_ptr; // direct access data pointer offs_t m_bytemask; // byte address mask offs_t m_bytestart; // minimum valid byte address offs_t m_byteend; // maximum valid byte address @@ -355,9 +347,6 @@ public: offs_t byte_to_address(offs_t address) const { return m_config.byte2addr(address); } offs_t byte_to_address_end(offs_t address) const { return m_config.byte2addr_end(address); } - // decryption - void set_decrypted_region(offs_t addrstart, offs_t addrend, void *base); - // direct access direct_update_delegate set_direct_update_handler(direct_update_delegate function) { return m_direct->set_direct_update(function); } bool set_direct_region(offs_t &byteaddress); @@ -566,11 +555,10 @@ class memory_bank read_or_write m_readorwrite; // used for read or write? }; - // a bank_entry contains a raw and decrypted pointer + // a bank_entry contains a pointer struct bank_entry { - UINT8 * m_raw; - UINT8 * m_decrypted; + UINT8 * m_ptr; }; public: @@ -586,7 +574,6 @@ public: bool anonymous() const { return m_anonymous; } offs_t bytestart() const { return m_bytestart; } void *base() const { return *m_baseptr; } - void *base_decrypted() const { return *m_basedptr; } const char *tag() const { return m_tag.c_str(); } const char *name() const { return m_name.c_str(); } @@ -602,13 +589,10 @@ public: // set the base explicitly void set_base(void *base); - void set_base_decrypted(void *base); // configure and set entries void configure_entry(int entrynum, void *base); void configure_entries(int startentry, int numentries, void *base, offs_t stride); - void configure_decrypted_entry(int entrynum, void *base); - void configure_decrypted_entries(int startentry, int numentries, void *base, offs_t stride); void set_entry(int entrynum); private: @@ -620,7 +604,6 @@ private: memory_bank * m_next; // next bank in sequence running_machine & m_machine; // need the machine to free our memory UINT8 ** m_baseptr; // pointer to our base pointer in the global array - UINT8 ** m_basedptr; // same for the decrypted base pointer UINT16 m_index; // array index for this handler bool m_anonymous; // are we anonymous or explicit? offs_t m_bytestart; // byte-adjusted start offset @@ -747,7 +730,7 @@ public: void dump(FILE *file); // pointers to a bank pointer (internal usage only) - UINT8 **bank_pointer_addr(UINT8 index, bool decrypted = false) { return decrypted ? &m_bankd_ptr[index] : &m_bank_ptr[index]; } + UINT8 **bank_pointer_addr(UINT8 index) { return &m_bank_ptr[index]; } // regions memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian); @@ -766,7 +749,6 @@ private: bool m_initialized; // have we completed initialization? UINT8 * m_bank_ptr[TOTAL_MEMORY_BANKS]; // array of bank pointers - UINT8 * m_bankd_ptr[TOTAL_MEMORY_BANKS]; // array of decrypted bank pointers simple_list<address_space> m_spacelist; // list of address spaces simple_list<memory_block> m_blocklist; // head of the list of memory blocks @@ -887,102 +869,67 @@ private: //************************************************************************** //------------------------------------------------- -// read_raw_ptr - return a pointer to valid RAM +// read_ptr - return a pointer to valid RAM // referenced by the address, or NULL if no RAM // backing that address //------------------------------------------------- -inline void *direct_read_data::read_raw_ptr(offs_t byteaddress, offs_t directxor) -{ - if (address_is_valid(byteaddress)) - return &m_raw[(byteaddress ^ directxor) & m_bytemask]; - return NULL; -} - -inline void *direct_read_data::read_decrypted_ptr(offs_t byteaddress, offs_t directxor) +inline void *direct_read_data::read_ptr(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return &m_decrypted[(byteaddress ^ directxor) & m_bytemask]; + return &m_ptr[(byteaddress ^ directxor) & m_bytemask]; return NULL; } //------------------------------------------------- -// read_raw_byte - read a byte via the +// read_byte - read a byte via the // direct_read_data class //------------------------------------------------- -inline UINT8 direct_read_data::read_raw_byte(offs_t byteaddress, offs_t directxor) +inline UINT8 direct_read_data::read_byte(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return m_raw[(byteaddress ^ directxor) & m_bytemask]; - return m_space.read_byte(byteaddress); -} - -inline UINT8 direct_read_data::read_decrypted_byte(offs_t byteaddress, offs_t directxor) -{ - if (address_is_valid(byteaddress)) - return m_decrypted[(byteaddress ^ directxor) & m_bytemask]; + return m_ptr[(byteaddress ^ directxor) & m_bytemask]; return m_space.read_byte(byteaddress); } //------------------------------------------------- -// read_raw_word - read a word via the +// read_word - read a word via the // direct_read_data class //------------------------------------------------- -inline UINT16 direct_read_data::read_raw_word(offs_t byteaddress, offs_t directxor) +inline UINT16 direct_read_data::read_word(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT16 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]); - return m_space.read_word(byteaddress); -} - -inline UINT16 direct_read_data::read_decrypted_word(offs_t byteaddress, offs_t directxor) -{ - if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT16 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast<UINT16 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_word(byteaddress); } //------------------------------------------------- -// read_raw_dword - read a dword via the +// read_dword - read a dword via the // direct_read_data class //------------------------------------------------- -inline UINT32 direct_read_data::read_raw_dword(offs_t byteaddress, offs_t directxor) +inline UINT32 direct_read_data::read_dword(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT32 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]); - return m_space.read_dword(byteaddress); -} - -inline UINT32 direct_read_data::read_decrypted_dword(offs_t byteaddress, offs_t directxor) -{ - if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT32 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast<UINT32 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_dword(byteaddress); } //------------------------------------------------- -// read_raw_qword - read a qword via the +// read_qword - read a qword via the // direct_read_data class //------------------------------------------------- -inline UINT64 direct_read_data::read_raw_qword(offs_t byteaddress, offs_t directxor) -{ - if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT64 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]); - return m_space.read_qword(byteaddress); -} - -inline UINT64 direct_read_data::read_decrypted_qword(offs_t byteaddress, offs_t directxor) +inline UINT64 direct_read_data::read_qword(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast<UINT64 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast<UINT64 *>(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_qword(byteaddress); } diff --git a/src/emu/netlist/analog/mgmres.cpp b/src/emu/netlist/analog/mgmres.cpp deleted file mode 100644 index 06d64eaeb26..00000000000 --- a/src/emu/netlist/analog/mgmres.cpp +++ /dev/null @@ -1,912 +0,0 @@ -# include <cstdlib> -# include <iostream> -# include <fstream> -# include <iomanip> -# include <cmath> -# include <ctime> -# include <cstdio> - -using namespace std; - -#include "mgmres.hpp" - -//****************************************************************************80 -// http://people.sc.fsu.edu/~jburkardt/cpp_src/mgmres/mgmres.html -//****************************************************************************80 - -void gmres_t::ax_cr(const int * RESTRICT ia, const int * RESTRICT ja, const double * RESTRICT a, - const double * RESTRICT x, double * RESTRICT w) - -//****************************************************************************80 -// -// Purpose: -// -// AX_CR computes A*x for a matrix stored in sparse compressed row form. -// -// Discussion: -// -// The Sparse Compressed Row storage format is used. -// -// The matrix A is assumed to be sparse. To save on storage, only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// For this version of MGMRES, the row and column indices are assumed -// to use the C/C++ convention, in which indexing begins at 0. -// -// If your index vectors IA and JA are set up so that indexing is based -// at 1, then each use of those vectors should be shifted down by 1. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 18 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Reference: -// -// Richard Barrett, Michael Berry, Tony Chan, James Demmel, -// June Donato, Jack Dongarra, Victor Eijkhout, Roidan Pozo, -// Charles Romine, Henk van der Vorst, -// Templates for the Solution of Linear Systems: -// Building Blocks for Iterative Methods, -// SIAM, 1994, -// ISBN: 0898714710, -// LC: QA297.8.T45. -// -// Tim Kelley, -// Iterative Methods for Linear and Nonlinear Equations, -// SIAM, 2004, -// ISBN: 0898713528, -// LC: QA297.8.K45. -// -// Yousef Saad, -// Iterative Methods for Sparse Linear Systems, -// Second Edition, -// SIAM, 2003, -// ISBN: 0898715342, -// LC: QA188.S17. -// -// Parameters: -// -// Input, int N, the order of the system. -// -// Input, int NZ_NUM, the number of nonzeros. -// -// Input, int IA[N+1], JA[NZ_NUM], the row and column indices -// of the matrix values. The row vector has been compressed. -// -// Input, double A[NZ_NUM], the matrix values. -// -// Input, double X[N], the vector to be multiplied by A. -// -// Output, double W[N], the value of A*X. -// -{ - const int n = m_n; - for ( int i = 0; i < n; i++ ) - { - double tmp = 0.0; - int k1 = ia[i]; - int k2 = ia[i+1]; - - for (int k = k1; k < k2; k++ ) - { - tmp += a[k] * x[ja[k]]; - } - w[i] = tmp; - } - return; -} - -//****************************************************************************80 - -void gmres_t::diagonal_pointer_cr (const int nz_num, const int ia[], const int ja[]) - -//****************************************************************************80 -// -// Purpose: -// -// DIAGONAL_POINTER_CR finds diagonal entries in a sparse compressed row matrix. -// -// Discussion: -// -// The matrix A is assumed to be stored in compressed row format. Only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// The array UA can be used to locate the diagonal elements of the matrix. -// -// It is assumed that every row of the matrix includes a diagonal element, -// and that the elements of each row have been ascending sorted. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 18 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Parameters: -// -// Input, int N, the order of the system. -// -// Input, int NZ_NUM, the number of nonzeros. -// -// Input, int IA[N+1], JA[NZ_NUM], the row and column indices -// of the matrix values. The row vector has been compressed. On output, -// the order of the entries of JA may have changed because of the sorting. -// -// Output, int UA[N], the index of the diagonal element of each row. -// -{ - const int n = m_n; - - for (int i = 0; i < n; i++) - { - m_ua[i] = -1; - const int j1 = ia[i]; - const int j2 = ia[i + 1]; - - for (int j = j1; j < j2; j++) - { - if (ja[j] == i) - { - m_ua[i] = j; - } - } - - } - return; -} -//****************************************************************************80 - -void gmres_t::ilu_cr (const int nz_num, const int ia[], const int ja[], const double a[]) - -//****************************************************************************80 -// -// Purpose: -// -// ILU_CR computes the incomplete LU factorization of a matrix. -// -// Discussion: -// -// The matrix A is assumed to be stored in compressed row format. Only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 25 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Parameters: -// -// Input, int N, the order of the system. -// -// Input, int NZ_NUM, the number of nonzeros. -// -// Input, int IA[N+1], JA[NZ_NUM], the row and column indices -// of the matrix values. The row vector has been compressed. -// -// Input, double A[NZ_NUM], the matrix values. -// -// Input, int UA[N], the index of the diagonal element of each row. -// -// Output, double L[NZ_NUM], the ILU factorization of A. -// -{ - int *iw; - int i; - int j; - int jj; - int jrow; - int jw; - int k; - double tl; - - const int n = m_n; - - iw = new int[n]; -// -// Copy A. -// - for (k = 0; k < nz_num; k++) - { - m_l[k] = a[k]; - } - - for (i = 0; i < n; i++) - { -// -// IW points to the nonzero entries in row I. -// - for (j = 0; j < n; j++) - { - iw[j] = -1; - } - - for (k = ia[i]; k <= ia[i + 1] - 1; k++) - { - iw[ja[k]] = k; - } - - j = ia[i]; - do - { - jrow = ja[j]; - if (i <= jrow) - { - break; - } - tl = m_l[j] * m_l[m_ua[jrow]]; - m_l[j] = tl; - for (jj = m_ua[jrow] + 1; jj <= ia[jrow + 1] - 1; jj++) - { - jw = iw[ja[jj]]; - if (jw != -1) - { - m_l[jw] = m_l[jw] - tl * m_l[jj]; - } - } - j = j + 1; - } while (j <= ia[i + 1] - 1); - - m_ua[i] = j; - - if (jrow != i) - { - cout << "\n"; - cout << "ILU_CR - Fatal error!\n"; - cout << " JROW != I\n"; - cout << " JROW = " << jrow << "\n"; - cout << " I = " << i << "\n"; - exit(1); - } - - if (m_l[j] == 0.0) - { - cout << "\n"; - cout << "ILU_CR - Fatal error!\n"; - cout << " Zero pivot on step I = " << i << "\n"; - cout << " L[" << j << "] = 0.0\n"; - exit(1); - } - - m_l[j] = 1.0 / m_l[j]; - } - - for (k = 0; k < n; k++) - { - m_l[m_ua[k]] = 1.0 / m_l[m_ua[k]]; - } - - delete[] iw; -} -//****************************************************************************80 - -void gmres_t::lus_cr (const int * RESTRICT ia, const int * RESTRICT ja, double * RESTRICT r) - -//****************************************************************************80 -// -// Purpose: -// -// LUS_CR applies the incomplete LU preconditioner. -// -// Discussion: -// -// The linear system M * Z = R is solved for Z. M is the incomplete -// LU preconditioner matrix, and R is a vector supplied by the user. -// So essentially, we're solving L * U * Z = R. -// -// The matrix A is assumed to be stored in compressed row format. Only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 18 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Parameters: -// -// Input, int N, the order of the system. -// -// Input, int NZ_NUM, the number of nonzeros. -// -// Input, int IA[N+1], JA[NZ_NUM], the row and column indices -// of the matrix values. The row vector has been compressed. -// -// Input, double L[NZ_NUM], the matrix values. -// -// Input, int UA[N], the index of the diagonal element of each row. -// -// Input, double R[N], the right hand side. -// -// Output, double Z[N], the solution of the system M * Z = R. -// -{ - const int n = m_n; -// -// Solve L * w = w where L is unit lower triangular. -// - for (int i = 1; i < n; i++ ) - { - double tmp = 0.0; - for (int j = ia[i]; j < m_ua[i]; j++ ) - { - tmp += m_l[j] * r[ja[j]]; - } - r[i] -= tmp; - } -// -// Solve U * w = w, where U is upper triangular. -// - for (int i = n - 1; 0 <= i; i-- ) - { - double tmp = 0.0; - for (int j = m_ua[i] + 1; j < ia[i+1]; j++ ) - { - tmp += m_l[j] * r[ja[j]]; - } - r[i] = (r[i] - tmp) / m_l[m_ua[i]]; - } - - return; -} -//****************************************************************************80 - -static inline void mult_givens ( const double c, const double s, const int k, double g[] ) - -//****************************************************************************80 -// -// Purpose: -// -// MULT_GIVENS applies a Givens rotation to two successive entries of a vector. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 08 August 2006 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Reference: -// -// Richard Barrett, Michael Berry, Tony Chan, James Demmel, -// June Donato, Jack Dongarra, Victor Eijkhout, Roidan Pozo, -// Charles Romine, Henk van der Vorst, -// Templates for the Solution of Linear Systems: -// Building Blocks for Iterative Methods, -// SIAM, 1994, -// ISBN: 0898714710, -// LC: QA297.8.T45. -// -// Tim Kelley, -// Iterative Methods for Linear and Nonlinear Equations, -// SIAM, 2004, -// ISBN: 0898713528, -// LC: QA297.8.K45. -// -// Yousef Saad, -// Iterative Methods for Sparse Linear Systems, -// Second Edition, -// SIAM, 2003, -// ISBN: 0898715342, -// LC: QA188.S17. -// -// Parameters: -// -// Input, double C, S, the cosine and sine of a Givens -// rotation. -// -// Input, int K, indicates the location of the first vector entry. -// -// Input/output, double G[K+2], the vector to be modified. On output, -// the Givens rotation has been applied to entries G(K) and G(K+1). -// -{ - - double g1; - double g2; - - g1 = c * g[k] - s * g[k+1]; - g2 = s * g[k] + c * g[k+1]; - - g[k] = g1; - g[k+1] = g2; - - return; -} -//****************************************************************************80 - - -gmres_t::gmres_t(const int n) -: m_n(n) -{ - int mr=n; /* FIXME: maximum iterations locked in here */ - - m_c = new double[mr+1]; - m_g = new double[mr+1]; - m_h = new double *[mr]; - for (int i = 0; i < mr; i++) - m_h[i] = new double[mr+1]; - /* This is using too much memory, but we are interested in speed for now*/ - m_l = new double[n*n]; //[ia[n]+1]; - m_r = new double[n]; - m_s = new double[mr+1]; - m_ua = new int[n]; - m_v = new double *[n]; - for (int i = 0; i < n; i++) - m_v[i] = new double[mr+1]; - m_y = new double[mr+1]; -} - -gmres_t::~gmres_t() -{ - delete [] m_c; - delete [] m_g; - delete [] m_h; - delete [] m_l; - delete [] m_r; - delete [] m_s; - delete [] m_ua; - delete [] m_v; - delete [] m_y; -} - -int gmres_t::pmgmres_ilu_cr (const int nz_num, int ia[], int ja[], double a[], - double x[], const double rhs[], const int itr_max, const int mr, const double tol_abs, - const double tol_rel ) - -//****************************************************************************80 -// -// Purpose: -// -// PMGMRES_ILU_CR applies the preconditioned restarted GMRES algorithm. -// -// Discussion: -// -// The matrix A is assumed to be stored in compressed row format. Only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// This routine uses the incomplete LU decomposition for the -// preconditioning. This preconditioner requires that the sparse -// matrix data structure supplies a storage position for each diagonal -// element of the matrix A, and that each diagonal element of the -// matrix A is not zero. -// -// Thanks to Jesus Pueblas Sanchez-Guerra for supplying two -// corrections to the code on 31 May 2007. -// -// -// This implementation of the code stores the doubly-dimensioned arrays -// H and V as vectors. However, it follows the C convention of storing -// them by rows, rather than my own preference for storing them by -// columns. I may come back and change this some time. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 26 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Reference: -// -// Richard Barrett, Michael Berry, Tony Chan, James Demmel, -// June Donato, Jack Dongarra, Victor Eijkhout, Roidan Pozo, -// Charles Romine, Henk van der Vorst, -// Templates for the Solution of Linear Systems: -// Building Blocks for Iterative Methods, -// SIAM, 1994. -// ISBN: 0898714710, -// LC: QA297.8.T45. -// -// Tim Kelley, -// Iterative Methods for Linear and Nonlinear Equations, -// SIAM, 2004, -// ISBN: 0898713528, -// LC: QA297.8.K45. -// -// Yousef Saad, -// Iterative Methods for Sparse Linear Systems, -// Second Edition, -// SIAM, 2003, -// ISBN: 0898715342, -// LC: QA188.S17. -// -// Parameters: -// -// Input, int N, the order of the linear system. -// -// Input, int NZ_NUM, the number of nonzero matrix values. -// -// Input, int IA[N+1], JA[NZ_NUM], the row and column indices -// of the matrix values. The row vector has been compressed. -// -// Input, double A[NZ_NUM], the matrix values. -// -// Input/output, double X[N]; on input, an approximation to -// the solution. On output, an improved approximation. -// -// Input, double RHS[N], the right hand side of the linear system. -// -// Input, int ITR_MAX, the maximum number of (outer) iterations to take. -// -// Input, int MR, the maximum number of (inner) iterations to take. -// MR must be less than N. -// -// Input, double TOL_ABS, an absolute tolerance applied to the -// current residual. -// -// Input, double TOL_REL, a relative tolerance comparing the -// current residual to the initial residual. -// -{ - double av; - double delta = 1.0e-03; - double htmp; - int itr; - int itr_used = 0; - int k_copy = 0; - double mu; - double rho; - double rho_tol = 0; - const int verbose = 0; - const bool pre_ilu = true; - - const int n = m_n; - - rearrange_cr(nz_num, ia, ja, a); - - if (pre_ilu) - { - diagonal_pointer_cr(nz_num, ia, ja); - ilu_cr(nz_num, ia, ja, a); - } - - if (verbose) - { - cout << "\n"; - cout << "PMGMRES_ILU_CR\n"; - cout << " Number of unknowns = " << n << "\n"; - } - - for (itr = 0; itr < itr_max; itr++) - { - ax_cr(ia, ja, a, x, m_r); - - for (int i = 0; i < n; i++) - m_r[i] = rhs[i] - m_r[i]; - - if (pre_ilu) - lus_cr(ia, ja, m_r); - - rho = sqrt(r8vec_dot2(m_r)); - - if (verbose) - cout << " ITR = " << itr << " Residual = " << rho << "\n"; - - if (itr == 0) - rho_tol = rho * tol_rel; - - double rhoq = 1.0 / rho; - - for (int i = 0; i < n; i++) - m_v[0][i] = m_r[i] * rhoq; - - for (int i = 0; i < mr + 1; i++) - m_g[i] = 0.0; - - m_g[0] = rho; - - for (int i = 0; i < mr; i++) - for (int j = 0; j < mr + 1; j++) - m_h[i][j] = 0.0; - - for (int k = 0; k < mr; k++) - { - k_copy = k; - - ax_cr(ia, ja, a, m_v[k], m_v[k + 1]); - - if (pre_ilu) - lus_cr(ia, ja, m_v[k + 1]); - - av = sqrt(r8vec_dot2(m_v[k + 1])); - - for (int j = 0; j <= k; j++) - { - m_h[j][k] = r8vec_dot(m_v[k + 1], m_v[j]); - for (int i = 0; i < n; i++) - { - m_v[k + 1][i] = m_v[k + 1][i] - - m_h[j][k] * m_v[j][i]; - } - } - m_h[k + 1][k] = sqrt(r8vec_dot2(m_v[k + 1])); - - if ((av + delta * m_h[k + 1][k]) == av) - { - for (int j = 0; j < k + 1; j++) - { - htmp = r8vec_dot(m_v[k + 1], m_v[j]); - m_h[j][k] = m_h[j][k] + htmp; - for (int i = 0; i < n; i++) - { - m_v[k + 1][i] = m_v[k + 1][i] - htmp * m_v[j][i]; - } - } - m_h[k + 1][k] = sqrt(r8vec_dot2(m_v[k + 1])); - } - - if (m_h[k + 1][k] != 0.0) - { - for (int i = 0; i < n; i++) - { - m_v[k + 1][i] = m_v[k + 1][i] - / m_h[k + 1][k]; - } - } - - if (0 < k) - { - for (int i = 0; i < k + 2; i++) - { - m_y[i] = m_h[i][k]; - } - for (int j = 0; j < k; j++) - { - mult_givens(m_c[j], m_s[j], j, m_y); - } - for (int i = 0; i < k + 2; i++) - { - m_h[i][k] = m_y[i]; - } - } - mu = sqrt( - m_h[k][k] * m_h[k][k] - + m_h[k + 1][k] * m_h[k + 1][k]); - m_c[k] = m_h[k][k] / mu; - m_s[k] = -m_h[k + 1][k] / mu; - m_h[k][k] = m_c[k] * m_h[k][k] - - m_s[k] * m_h[k + 1][k]; - m_h[k + 1][k] = 0.0; - mult_givens(m_c[k], m_s[k], k, m_g); - - rho = std::abs(m_g[k + 1]); - - itr_used = itr_used + 1; - - if (verbose) - { - cout << " K = " << k << " Residual = " << rho << "\n"; - } - - if (rho <= rho_tol && rho <= tol_abs) - { - break; - } - } - - m_y[k_copy] = m_g[k_copy] / m_h[k_copy][k_copy]; - for (int i = k_copy - 1; 0 <= i; i--) - { - double tmp = m_g[i]; - for (int j = i + 1; j < k_copy + 1; j++) - { - tmp -= m_h[i][j] * m_y[j]; - } - m_y[i] = tmp / m_h[i][i]; - } - double cerr = 0; - for (int i = 0; i < n; i++) - { - double tmp = 0.0; - for (int j = 0; j < k_copy + 1; j++) - { - tmp += m_v[j][i] * m_y[j]; - } - cerr = std::max(std::abs(tmp), cerr); - x[i] += tmp; - } -#if 0 - if (cerr < 1e-8) - return 1; //break; -#else - if (rho <= rho_tol && rho <= tol_abs) - { - break; - } -#endif - } - - if (verbose) - { - cout << "\n"; - ; - cout << "PMGMRES_ILU_CR:\n"; - cout << " Iterations = " << itr_used << "\n"; - cout << " Final residual = " << rho << "\n"; - } - - //if ( rho >= tol_abs ) -// printf("missed!\n"); - - return (itr_used - 1) * mr + k_copy; -} -//****************************************************************************80 - -double gmres_t::r8vec_dot (const double a1[], const double a2[] ) -{ - const int n = m_n; - double value = 0.0; - - for ( int i = 0; i < n; i++ ) - value = value + a1[i] * a2[i]; - return value; -} - -double gmres_t::r8vec_dot2 (const double a1[]) -{ - const int n = m_n; - double value = 0.0; - - for ( int i = 0; i < n; i++ ) - value = value + a1[i] * a1[i]; - return value; -} - - -//****************************************************************************80 - -//****************************************************************************80 - -void gmres_t::rearrange_cr (const int nz_num, int ia[], int ja[], double a[] ) - -//****************************************************************************80 -// -// Purpose: -// -// REARRANGE_CR sorts a sparse compressed row matrix. -// -// Discussion: -// -// This routine guarantees that the entries in the CR matrix -// are properly sorted. -// -// After the sorting, the entries of the matrix are rearranged in such -// a way that the entries of each column are listed in ascending order -// of their column values. -// -// The matrix A is assumed to be stored in compressed row format. Only -// the nonzero entries of A are stored. The vector JA stores the -// column index of the nonzero value. The nonzero values are sorted -// by row, and the compressed row vector IA then has the property that -// the entries in A and JA that correspond to row I occur in indices -// IA[I] through IA[I+1]-1. -// -// Licensing: -// -// This code is distributed under the GNU LGPL license. -// -// Modified: -// -// 18 July 2007 -// -// Author: -// -// Original C version by Lili Ju. -// C++ version by John Burkardt. -// -// Parameters: -// -// Input, int N, the order of the system. -// -// Input, int NZ_NUM, the number of nonzeros. -// -// Input, int IA[N+1], the compressed row index. -// -// Input/output, int JA[NZ_NUM], the column indices. On output, -// the order of the entries of JA may have changed because of the sorting. -// -// Input/output, double A[NZ_NUM], the matrix values. On output, the -// order of the entries may have changed because of the sorting. -// -{ - double dtemp; - int i; - int is; - int itemp; - int j; - int j1; - int j2; - int k; - - const int n = m_n; - - for ( i = 0; i < n; i++ ) - { - j1 = ia[i]; - j2 = ia[i+1]; - is = j2 - j1; - - for ( k = 1; k < is; k++ ) - { - for ( j = j1; j < j2 - k; j++ ) - { - if ( ja[j+1] < ja[j] ) - { - itemp = ja[j+1]; - ja[j+1] = ja[j]; - ja[j] = itemp; - - dtemp = a[j+1]; - a[j+1] = a[j]; - a[j] = dtemp; - } - } - } - } - return; -} -//****************************************************************************80 - diff --git a/src/emu/netlist/analog/mgmres.hpp b/src/emu/netlist/analog/mgmres.hpp deleted file mode 100644 index c6efe60a8a1..00000000000 --- a/src/emu/netlist/analog/mgmres.hpp +++ /dev/null @@ -1,43 +0,0 @@ - -#ifndef __MGMRES -#define __MGMRES - -class gmres_t -{ -public: - gmres_t(const int n); - ~gmres_t(); - - int pmgmres_ilu_cr (const int nz_num, int ia[], int ja[], double a[], - double x[], const double rhs[], const int itr_max, const int mr, const double tol_abs, - const double tol_rel ); - -private: - - void diagonal_pointer_cr(const int nz_num, const int ia[], const int ja[]); - void rearrange_cr (const int nz_num, int ia[], int ja[], double a[] ); - inline double r8vec_dot (const double a1[], const double a2[] ); - inline double r8vec_dot2 (const double a1[]); - - void ax_cr(const int * RESTRICT ia, const int * RESTRICT ja, const double * RESTRICT a, - const double * RESTRICT x, double * RESTRICT w); - - void lus_cr (const int * RESTRICT ia, const int * RESTRICT ja, double * RESTRICT r); - - void ilu_cr (const int nz_num, const int ia[], const int ja[], const double a[]); - - const int m_n; - - - double * RESTRICT m_c; - double * RESTRICT m_g; - double ** RESTRICT m_h; - double * RESTRICT m_l; - double * RESTRICT m_r; - double * RESTRICT m_s; - double ** RESTRICT m_v; - int * RESTRICT m_ua; - double * RESTRICT m_y; -}; - -#endif diff --git a/src/emu/netlist/analog/nld_bjt.c b/src/emu/netlist/analog/nld_bjt.c index 99e778ae107..b8b711cf92b 100644 --- a/src/emu/netlist/analog/nld_bjt.c +++ b/src/emu/netlist/analog/nld_bjt.c @@ -5,9 +5,9 @@ * */ +#include <solver/nld_solver.h> #include "nld_bjt.h" #include "../nl_setup.h" -#include "nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/analog/nld_bjt.h b/src/emu/netlist/analog/nld_bjt.h index 610d541beb7..9b66da8c319 100644 --- a/src/emu/netlist/analog/nld_bjt.h +++ b/src/emu/netlist/analog/nld_bjt.h @@ -51,7 +51,7 @@ protected: virtual void reset(); ATTR_HOT void update(); - netlist_param_model_t m_model; + param_model_t m_model; private: q_type m_qtype; }; @@ -151,8 +151,8 @@ protected: ATTR_HOT void virtual update(); NETLIB_UPDATE_TERMINALSI(); - netlist_generic_diode m_gD_BC; - netlist_generic_diode m_gD_BE; + generic_diode m_gD_BC; + generic_diode m_gD_BE; nld_twoterm m_D_CB; // gcc, gce - gcc, gec - gcc, gcc - gce | Ic nld_twoterm m_D_EB; // gee, gec - gee, gce - gee, gee - gec | Ie diff --git a/src/emu/netlist/analog/nld_fourterm.c b/src/emu/netlist/analog/nld_fourterm.c index 9e735f1f25f..35038a88cd6 100644 --- a/src/emu/netlist/analog/nld_fourterm.c +++ b/src/emu/netlist/analog/nld_fourterm.c @@ -5,9 +5,9 @@ * */ +#include <solver/nld_solver.h> #include "nld_fourterm.h" #include "../nl_setup.h" -#include "nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/analog/nld_fourterm.h b/src/emu/netlist/analog/nld_fourterm.h index 7452f0ecbb4..8b5f84100fd 100644 --- a/src/emu/netlist/analog/nld_fourterm.h +++ b/src/emu/netlist/analog/nld_fourterm.h @@ -74,8 +74,8 @@ protected: terminal_t m_OP1; terminal_t m_ON1; - netlist_param_double_t m_G; - netlist_param_double_t m_RI; + param_double_t m_G; + param_double_t m_RI; nl_double m_gfac; }; @@ -110,8 +110,6 @@ class NETLIB_NAME(CCCS) : public NETLIB_NAME(VCCS) public: ATTR_COLD NETLIB_NAME(CCCS)() : NETLIB_NAME(VCCS)(CCCS), m_gfac(1.0) { } - //ATTR_COLD NETLIB_NAME(CCCS)(const family_t afamily) - //: netlist_device_t(afamily), m_gfac(1.0) { } protected: virtual void start(); @@ -166,7 +164,7 @@ protected: terminal_t m_OP2; terminal_t m_ON2; - netlist_param_double_t m_RO; + param_double_t m_RO; }; NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_ms_gmres.h b/src/emu/netlist/analog/nld_ms_gmres.h deleted file mode 100644 index 6520738ec00..00000000000 --- a/src/emu/netlist/analog/nld_ms_gmres.h +++ /dev/null @@ -1,205 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Couriersud -/* - * nld_ms_sor.h - * - * Generic successive over relaxation solver. - * - * Fow w==1 we will do the classic Gauss-Seidel approach - * - */ - -#ifndef NLD_MS_GMRES_H_ -#define NLD_MS_GMRES_H_ - -#include <algorithm> - -#include "nld_solver.h" -#include "nld_ms_direct.h" - -#include "mgmres.hpp" - -NETLIB_NAMESPACE_DEVICES_START() - -template <unsigned m_N, unsigned _storage_N> -class netlist_matrix_solver_GMRES_t: public netlist_matrix_solver_direct_t<m_N, _storage_N> -{ -public: - - netlist_matrix_solver_GMRES_t(const netlist_solver_parameters_t *params, int size) - : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) - , m_gmres(m_N ? m_N : size) - , m_gs_fail(0) - , m_gs_total(0) - { - } - - virtual ~netlist_matrix_solver_GMRES_t() {} - - virtual void log_stats(); - - virtual void vsetup(analog_net_t::list_t &nets); - ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve(); - -private: - gmres_t m_gmres; - int m_gs_fail; - int m_gs_total; -}; - -// ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Gauss - Seidel -// ---------------------------------------------------------------------------------------- - -template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_GMRES_t<m_N, _storage_N>::log_stats() -{ - if (this->m_stat_calculations != 0 && this->m_params.m_log_stats) - { - this->netlist().log("=============================================="); - this->netlist().log("Solver %s", this->name().cstr()); - this->netlist().log(" ==> %d nets", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); - this->netlist().log(" has %s elements", this->is_dynamic() ? "dynamic" : "no dynamic"); - this->netlist().log(" has %s elements", this->is_timestep() ? "timestep" : "no timestep"); - this->netlist().log(" %6.3f average newton raphson loops", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls); - this->netlist().log(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average", - this->m_stat_calculations, - this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), - this->m_gs_fail, - 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations, - (double) this->m_gs_total / (double) this->m_stat_calculations); - } -} - -template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_GMRES_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) -{ - netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); - this->save(NLNAME(m_gs_fail)); - this->save(NLNAME(m_gs_total)); -} - -template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_GMRES_t<m_N, _storage_N>::vsolve() -{ - this->solve_base(this); - return this->compute_next_timestep(); -} - -template <unsigned m_N, unsigned _storage_N> -ATTR_HOT inline int netlist_matrix_solver_GMRES_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) -{ - const int iN = this->N(); - - /* ideally, we could get an estimate for the spectral radius of - * Inv(D - L) * U - * - * and estimate using - * - * omega = 2.0 / (1.0 + nl_math::sqrt(1-rho)) - */ - - int nz_num = 0; - int ia[_storage_N + 1]; - int ja[_storage_N * _storage_N]; - double a[_storage_N * _storage_N]; - ATTR_ALIGN nl_double RHS[_storage_N]; - ATTR_ALIGN nl_double new_V[_storage_N]; - ATTR_ALIGN nl_double l_V[_storage_N]; - - for (int k = 0; k < iN; k++) - { - nl_double gtot_t = 0.0; - nl_double RHS_t = 0.0; - - const int term_count = this->m_terms[k]->count(); - const int railstart = this->m_terms[k]->m_railstart; - const nl_double * const RESTRICT gt = this->m_terms[k]->gt(); - const nl_double * const RESTRICT go = this->m_terms[k]->go(); - const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); - const nl_double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); - const int * RESTRICT net_other = this->m_terms[k]->net_other(); - - ia[k] = nz_num; - l_V[k] = new_V[k] = this->m_nets[k]->m_cur_Analog; - for (unsigned i = 0; i < term_count; i++) - { - gtot_t = gtot_t + gt[i]; - RHS_t = RHS_t + Idr[i]; - } - for (int i = this->m_terms[k]->m_railstart; i < term_count; i++) - RHS_t = RHS_t + go[i] * *other_cur_analog[i]; - - RHS[k] = RHS_t; - // add diagonal element - a[nz_num] = gtot_t; - ja[nz_num] = k; - nz_num++; - - int n=0; - - for (int i = 0; i < railstart; i++) - { - int j; - for (j = 0; j < n; j++) - { - if (net_other[i] == ja[nz_num+j]) - { - a[nz_num+j] -= go[i]; - break; - } - } - if (j>=n) - { - a[nz_num+n] = -go[i]; - ja[nz_num+n] = net_other[i]; - n++; - } - } - nz_num += n; - } - ia[iN] = nz_num; - - const nl_double accuracy = this->m_params.m_accuracy; - - int gsl = m_gmres.pmgmres_ilu_cr(nz_num, ia, ja, a, new_V, RHS, 1, std::min(iN-1,20), accuracy * (double) (iN), 1e6); - - m_gs_total += gsl; - this->m_stat_calculations++; - - if (gsl>=19) - { - for (int k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog = new_V[k]; - // Fallback to direct solver ... - this->m_gs_fail++; - return netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(newton_raphson); - } - - if (newton_raphson) - { - double err = 0; - for (int k = 0; k < iN; k++) - err = std::max(nl_math::abs(l_V[k] - new_V[k]), err); - - //printf("here %s\n", this->name().cstr()); - for (int k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog += 1.0 * (new_V[k] - this->m_nets[k]->m_cur_Analog); - if (err > accuracy) - return 2; - else - return 1; - } - else - { - for (int k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog = new_V[k]; - return 1; - } -} - -NETLIB_NAMESPACE_DEVICES_END() - -#endif /* NLD_MS_GMRES_H_ */ diff --git a/src/emu/netlist/analog/nld_switches.h b/src/emu/netlist/analog/nld_switches.h index 485100b3706..cb346f64af1 100644 --- a/src/emu/netlist/analog/nld_switches.h +++ b/src/emu/netlist/analog/nld_switches.h @@ -32,13 +32,13 @@ NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE_WITH_PARAMS(switch1, NETLIB_NAME(R_base) m_R; - netlist_param_int_t m_POS; + param_int_t m_POS; ); NETLIB_DEVICE_WITH_PARAMS(switch2, NETLIB_NAME(R_base) m_R[2]; - netlist_param_int_t m_POS; + param_int_t m_POS; ); NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_twoterm.c b/src/emu/netlist/analog/nld_twoterm.c index 11c12ae0377..1cb1a70caf6 100644 --- a/src/emu/netlist/analog/nld_twoterm.c +++ b/src/emu/netlist/analog/nld_twoterm.c @@ -5,24 +5,24 @@ * */ +#include <solver/nld_solver.h> #include <algorithm> #include "nld_twoterm.h" -#include "nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() // ---------------------------------------------------------------------------------------- -// netlist_generic_diode +// generic_diode // ---------------------------------------------------------------------------------------- -ATTR_COLD netlist_generic_diode::netlist_generic_diode() +ATTR_COLD generic_diode::generic_diode() { m_Vd = 0.7; set_param(1e-15, 1, 1e-15); } -ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin) +ATTR_COLD void generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin) { static const double csqrt2 = nl_math::sqrt(2.0); m_Is = Is; @@ -35,7 +35,7 @@ ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_dou m_VtInv = 1.0 / m_Vt; } -ATTR_COLD void netlist_generic_diode::save(pstring name, object_t &parent) +ATTR_COLD void generic_diode::save(pstring name, object_t &parent) { parent.save(m_Vd, name + ".m_Vd"); parent.save(m_Id, name + ".m_Id"); diff --git a/src/emu/netlist/analog/nld_twoterm.h b/src/emu/netlist/analog/nld_twoterm.h index 3bf409c00ff..6cea4408ff6 100644 --- a/src/emu/netlist/analog/nld_twoterm.h +++ b/src/emu/netlist/analog/nld_twoterm.h @@ -68,7 +68,8 @@ #ifdef RES_R -#warning "Do not include rescap.h in a netlist environment" +// FIXME: avoid compile fails +// #warning "Do not include rescap.h in a netlist environment" #endif #define RES_R(res) ((double)(res)) @@ -152,7 +153,7 @@ protected: }; NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base, - netlist_param_double_t m_R; + param_double_t m_R; ); // ---------------------------------------------------------------------------------------- @@ -163,18 +164,18 @@ NETLIB_DEVICE_WITH_PARAMS(POT, NETLIB_NAME(R_base) m_R1; NETLIB_NAME(R_base) m_R2; - netlist_param_double_t m_R; - netlist_param_double_t m_Dial; - netlist_param_logic_t m_DialIsLog; + param_double_t m_R; + param_double_t m_Dial; + param_logic_t m_DialIsLog; ); NETLIB_DEVICE_WITH_PARAMS(POT2, NETLIB_NAME(R_base) m_R1; - netlist_param_double_t m_R; - netlist_param_double_t m_Dial; - netlist_param_logic_t m_DialIsLog; - netlist_param_logic_t m_Reverse; + param_double_t m_R; + param_double_t m_Dial; + param_logic_t m_DialIsLog; + param_logic_t m_Reverse; ); @@ -200,7 +201,7 @@ protected: virtual void update_param(); ATTR_HOT void update(); - netlist_param_double_t m_C; + param_double_t m_C; }; @@ -209,10 +210,10 @@ protected: // A generic diode model to be used in other devices (Diode, BJT ...) // ---------------------------------------------------------------------------------------- -class netlist_generic_diode +class generic_diode { public: - ATTR_COLD netlist_generic_diode(); + ATTR_COLD generic_diode(); ATTR_HOT inline void update_diode(const nl_double nVd) { @@ -288,9 +289,9 @@ protected: virtual void update_param(); ATTR_HOT void update(); - netlist_param_model_t m_model; + param_model_t m_model; - netlist_generic_diode m_D; + generic_diode m_D; }; diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c index a98004bb079..75acd004a85 100644 --- a/src/emu/netlist/devices/net_lib.c +++ b/src/emu/netlist/devices/net_lib.c @@ -54,7 +54,7 @@ void initialize_factory(factory_list_t &factory) ENTRY(VCCS, VCCS, "-") ENTRY(CCCS, CCCS, "-") ENTRY(dummy_input, DUMMY_INPUT, "-") - ENTRY(frontier, FRONTIER_DEV, "+I,G,Q") // not intended to be used directly + ENTRY(frontier, FRONTIER_DEV, "+I,G,Q") // not intended to be used directly ENTRY(QBJT_EB, QBJT_EB, "model") ENTRY(QBJT_switch, QBJT_SW, "model") ENTRY(ttl_input, TTL_INPUT, "IN") diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h index 9c0664ecc3e..4b7e7a4ebec 100644 --- a/src/emu/netlist/devices/net_lib.h +++ b/src/emu/netlist/devices/net_lib.h @@ -57,10 +57,10 @@ #include "../analog/nld_bjt.h" #include "../analog/nld_fourterm.h" -#include "../analog/nld_solver.h" #include "../analog/nld_switches.h" #include "../analog/nld_twoterm.h" #include "../analog/nld_opamps.h" +#include "../solver/nld_solver.h" #include "nld_legacy.h" diff --git a/src/emu/netlist/devices/nld_7404.h b/src/emu/netlist/devices/nld_7404.h index 9b88306fc29..7cf3a1acb98 100644 --- a/src/emu/netlist/devices/nld_7404.h +++ b/src/emu/netlist/devices/nld_7404.h @@ -38,7 +38,7 @@ NET_CONNECT(_name, A, _A) #define TTL_7404_DIP(_name) \ - NET_REGISTER_DEV(7402_dip, _name) + NET_REGISTER_DEV(7404_dip, _name) NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_74123.h b/src/emu/netlist/devices/nld_74123.h index 59a6a6dc205..3b443590090 100644 --- a/src/emu/netlist/devices/nld_74123.h +++ b/src/emu/netlist/devices/nld_74123.h @@ -64,8 +64,8 @@ public: UINT8 m_state; double m_KP; - netlist_param_double_t m_K; - netlist_param_double_t m_RI; + param_double_t m_K; + param_double_t m_RI; int m_dev_type; ); diff --git a/src/emu/netlist/devices/nld_74ls629.h b/src/emu/netlist/devices/nld_74ls629.h index d1300d5cf47..1e3e9b42220 100644 --- a/src/emu/netlist/devices/nld_74ls629.h +++ b/src/emu/netlist/devices/nld_74ls629.h @@ -56,7 +56,7 @@ public: analog_input_t m_RNG; analog_input_t m_FC; - netlist_param_double_t m_CAP; + param_double_t m_CAP; ); #define SN74LS629_DIP(_name, _cap1, _cap2) \ diff --git a/src/emu/netlist/devices/nld_legacy.h b/src/emu/netlist/devices/nld_legacy.h index 64896136bc8..08c8b6b4f05 100644 --- a/src/emu/netlist/devices/nld_legacy.h +++ b/src/emu/netlist/devices/nld_legacy.h @@ -45,8 +45,8 @@ NETLIB_DEVICE_WITH_PARAMS(nicDelay, logic_output_t m_Q; - netlist_param_int_t m_L_to_H; - netlist_param_int_t m_H_to_L; + param_int_t m_L_to_H; + param_int_t m_H_to_L; UINT8 m_last; ); diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c index c33422012f8..3c5e288a806 100644 --- a/src/emu/netlist/devices/nld_ne555.c +++ b/src/emu/netlist/devices/nld_ne555.c @@ -5,9 +5,9 @@ * */ +#include <solver/nld_solver.h> #include "nld_ne555.h" #include "../nl_setup.h" -#include "../analog/nld_solver.h" #define R_OFF (1E20) #define R_ON (25) // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2 diff --git a/src/emu/netlist/devices/nld_ne555.h b/src/emu/netlist/devices/nld_ne555.h index 44893963e30..c1a6091d2f8 100644 --- a/src/emu/netlist/devices/nld_ne555.h +++ b/src/emu/netlist/devices/nld_ne555.h @@ -36,7 +36,7 @@ NETLIB_DEVICE(NE555, logic_input_t m_RESET; analog_input_t m_THRES; analog_input_t m_TRIG; - netlist_analog_output_t m_OUT; + analog_output_t m_OUT; bool m_last_out; bool m_ff; diff --git a/src/emu/netlist/devices/nld_r2r_dac.h b/src/emu/netlist/devices/nld_r2r_dac.h index ac9d7247dee..8578deb2099 100644 --- a/src/emu/netlist/devices/nld_r2r_dac.h +++ b/src/emu/netlist/devices/nld_r2r_dac.h @@ -58,10 +58,10 @@ NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE_WITH_PARAMS_DERIVED(r2r_dac, twoterm, - netlist_param_double_t m_VIN; - netlist_param_double_t m_R; - netlist_param_int_t m_num; - netlist_param_int_t m_val; + param_double_t m_VIN; + param_double_t m_R; + param_int_t m_num; + param_int_t m_val; ); NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_system.c b/src/emu/netlist/devices/nld_system.c index ef87b7a94c7..478c4d0f0aa 100644 --- a/src/emu/netlist/devices/nld_system.c +++ b/src/emu/netlist/devices/nld_system.c @@ -5,8 +5,8 @@ * */ +#include <solver/nld_solver.h> #include "nld_system.h" -#include "../analog/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() @@ -191,15 +191,17 @@ void nld_d_to_a_proxy::start() register_subalias("Q", m_RV.m_P); connect(m_RV.m_N, m_Q); - m_Q.initial(0.0); save(NLNAME(m_last_state)); } void nld_d_to_a_proxy::reset() { + m_Q.initial(0.0); + m_last_state = -1; m_RV.do_reset(); m_is_timestep = m_RV.m_P.net().as_analog().solver()->is_timestep(); + m_RV.set(NL_FCONST(1.0) / logic_family().m_R_low, logic_family().m_low_V, 0.0); } ATTR_HOT void nld_d_to_a_proxy::update() diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index 9ef8087fb08..eb547c847e0 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -51,7 +51,7 @@ NET_C(_G, _name.G) \ NET_C(_OUT, _name.Q) -#define OPTIMIZE_FRONTIER(_attach, _r_in, _r_out) \ +#define OPTIMIZE_FRONTIER(_attach, _r_in, _r_out) \ setup.register_frontier(# _attach, _r_in, _r_out); #define RES_SWITCH(_name, _IN, _P1, _P2) \ @@ -72,7 +72,7 @@ NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE_WITH_PARAMS(netlistparams, public: - netlist_param_logic_t m_use_deactivate; + param_logic_t m_use_deactivate; ); // ----------------------------------------------------------------------------- @@ -83,7 +83,7 @@ NETLIB_DEVICE_WITH_PARAMS(mainclock, public: logic_output_t m_Q; - netlist_param_double_t m_freq; + param_double_t m_freq; netlist_time m_inc; ATTR_HOT inline static void mc_update(logic_net_t &net); @@ -97,7 +97,7 @@ NETLIB_DEVICE_WITH_PARAMS(clock, logic_input_t m_feedback; logic_output_t m_Q; - netlist_param_double_t m_freq; + param_double_t m_freq; netlist_time m_inc; ); @@ -109,9 +109,9 @@ NETLIB_DEVICE_WITH_PARAMS(extclock, logic_input_t m_feedback; logic_output_t m_Q; - netlist_param_double_t m_freq; - netlist_param_str_t m_pattern; - netlist_param_double_t m_offset; + param_double_t m_freq; + param_str_t m_pattern; + param_double_t m_offset; UINT8 m_cnt; UINT8 m_size; @@ -126,13 +126,13 @@ NETLIB_DEVICE_WITH_PARAMS(extclock, NETLIB_DEVICE_WITH_PARAMS(ttl_input, logic_output_t m_Q; - netlist_param_logic_t m_IN; + param_logic_t m_IN; ); NETLIB_DEVICE_WITH_PARAMS(analog_input, - netlist_analog_output_t m_Q; + analog_output_t m_Q; - netlist_param_double_t m_IN; + param_double_t m_IN; ); // ----------------------------------------------------------------------------- @@ -164,7 +164,7 @@ protected: } private: - netlist_analog_output_t m_Q; + analog_output_t m_Q; }; @@ -245,10 +245,10 @@ private: NETLIB_NAME(twoterm) m_RIN; NETLIB_NAME(twoterm) m_ROUT; analog_input_t m_I; - netlist_analog_output_t m_Q; + analog_output_t m_Q; - netlist_param_double_t m_p_RIN; - netlist_param_double_t m_p_ROUT; + param_double_t m_p_RIN; + param_double_t m_p_ROUT; }; // ----------------------------------------------------------------------------- @@ -263,8 +263,8 @@ public: virtual ~NETLIB_NAME(res_sw)() {} - netlist_param_double_t m_RON; - netlist_param_double_t m_ROFF; + param_double_t m_RON; + param_double_t m_ROFF; logic_input_t m_I; NETLIB_NAME(R) m_R; @@ -342,6 +342,7 @@ protected: ATTR_HOT void update() { + //printf("%s: %f\n", name().cstr(), m_I.Q_Analog()); if (m_I.Q_Analog() > logic_family().m_high_thresh_V) OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1)); else if (m_I.Q_Analog() < logic_family().m_low_thresh_V) @@ -402,7 +403,7 @@ protected: ATTR_HOT void update(); private: - netlist_analog_output_t m_Q; + analog_output_t m_Q; nld_twoterm m_RV; int m_last_state; bool m_is_timestep; diff --git a/src/emu/netlist/devices/nld_truthtable.c b/src/emu/netlist/devices/nld_truthtable.c index c4030e8bff3..a5185c1fed1 100644 --- a/src/emu/netlist/devices/nld_truthtable.c +++ b/src/emu/netlist/devices/nld_truthtable.c @@ -238,11 +238,11 @@ void truthtable_desc_t::setup(const pstring_list_t &truthtable, UINT32 disabled_ } -#define ENTRYX(_n,_m,_h) case (_n * 1000 + _m * 10 + _h): \ +#define ENTRYX(_n,_m,_h) case (_n * 1000 + _m * 10 + _h): \ { typedef netlist_factory_truthtable_t<_n,_m,_h> xtype; \ - return palloc(xtype,name,classname,def_param); } break + return palloc(xtype,name,classname,def_param); } break -#define ENTRYY(_n,_m) ENTRYX(_n,_m,0); ENTRYX(_n,_m,1) +#define ENTRYY(_n,_m) ENTRYX(_n,_m,0); ENTRYX(_n,_m,1) #define ENTRY(_n) ENTRYY(_n, 1); ENTRYY(_n, 2); ENTRYY(_n, 3); ENTRYY(_n, 4); ENTRYY(_n, 5); ENTRYY(_n, 6) diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index 2cd80d29a7b..e5edec072ce 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -35,6 +35,9 @@ #define TT_LINE(_x) \ ttd->m_desc.add(_x); +#define TT_FAMILY(_x) \ + ttd->m_family = netlist::logic_family_desc_t::from_model(_x); + #define TRUTHTABLE_END() \ setup.factory().register_device(ttd); \ } @@ -294,9 +297,17 @@ class netlist_base_factory_truthtable_t : public base_factory_t public: netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname, const pstring &def_param) - : base_factory_t(name, classname, def_param) + : base_factory_t(name, classname, def_param), m_family(&netlist_family_TTL) {} + + virtual ~netlist_base_factory_truthtable_t() + { + if (!m_family->m_is_static) + pfree(m_family); + } + pstring_list_t m_desc; + const logic_family_desc_t * m_family; }; @@ -313,6 +324,7 @@ public: { typedef nld_truthtable_t<m_NI, m_NO, has_state> tt_type; device_t *r = palloc(tt_type, &m_ttbl, m_desc); + r->set_logic_family(m_family); //r->init(setup, name); return r; } diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index 51c5d435af3..545d42e0210 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -5,6 +5,7 @@ * */ +#include <solver/nld_solver.h> #include <cstring> #include <algorithm> #include <cstdio> @@ -13,10 +14,9 @@ #include "nl_base.h" #include "devices/nld_system.h" -#include "analog/nld_solver.h" #include "nl_util.h" -const netlist_time netlist_time::zero = netlist_time::from_raw(0); +const netlist::netlist_time netlist::netlist_time::zero = netlist::netlist_time::from_raw(0); namespace netlist { @@ -40,13 +40,13 @@ fatalerror_e::fatalerror_e(const char *format, va_list ap) } // ---------------------------------------------------------------------------------------- -// netlist_logic_family_ttl_t +// logic_family_ttl_t // ---------------------------------------------------------------------------------------- -class netlist_logic_family_ttl_t : public logic_family_desc_t +class logic_family_ttl_t : public logic_family_desc_t { public: - netlist_logic_family_ttl_t() + logic_family_ttl_t() : logic_family_desc_t() { m_low_thresh_V = 0.8; m_high_thresh_V = 2.0; @@ -55,6 +55,7 @@ public: m_high_V = 4.0; m_R_low = 1.0; m_R_high = 130.0; + m_is_static = true; } virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const { @@ -63,18 +64,19 @@ public: }; //FIXME: set to proper values -class netlist_logic_family_cd4000_t : public logic_family_desc_t +class logic_family_cd4000_t : public logic_family_desc_t { public: - netlist_logic_family_cd4000_t() + logic_family_cd4000_t() : logic_family_desc_t() { m_low_thresh_V = 0.8; m_high_thresh_V = 2.0; // m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications. - m_low_V = 0.1; - m_high_V = 4.0; - m_R_low = 1.0; - m_R_high = 130.0; + m_low_V = 0.05; + m_high_V = 4.95; + m_R_low = 10.0; + m_R_high = 10.0; + m_is_static = true; } virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const { @@ -82,15 +84,46 @@ public: } }; -const logic_family_desc_t &netlist_family_TTL = netlist_logic_family_ttl_t(); -const logic_family_desc_t &netlist_family_CD4000 = netlist_logic_family_cd4000_t(); +const logic_family_desc_t &netlist_family_TTL = logic_family_ttl_t(); +const logic_family_desc_t &netlist_family_CD4000 = logic_family_cd4000_t(); + +class logic_family_std_proxy_t : public logic_family_desc_t +{ +public: + logic_family_std_proxy_t() { } + virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const + { + return palloc(devices::nld_d_to_a_proxy , proxied); + } +}; + +const logic_family_desc_t *logic_family_desc_t::from_model(const pstring &model) +{ + if (setup_t::model_value_str(model, "TYPE", "") == "TTL") + return &netlist_family_TTL; + if (setup_t::model_value_str(model, "TYPE", "") == "CD4000") + return &netlist_family_CD4000; + + /* FIXME: Memory leak */ + logic_family_std_proxy_t *ret = palloc(logic_family_std_proxy_t); + + ret->m_low_thresh_V = setup_t::model_value(model, "IVL", 0.8); + ret->m_high_thresh_V = setup_t::model_value(model, "IVH", 2.0); + ret->m_low_V = setup_t::model_value(model, "OVL", 0.1); + ret->m_high_V = setup_t::model_value(model, "OVH", 4.0); + ret->m_R_low = setup_t::model_value(model, "ORL", 1.0); + ret->m_R_high = setup_t::model_value(model, "ORH", 130.0); + + return ret; +} + // ---------------------------------------------------------------------------------------- // netlist_queue_t // ---------------------------------------------------------------------------------------- queue_t::queue_t(netlist_t &nl) - : netlist_timed_queue<net_t *, netlist_time>(512) + : timed_queue<net_t *, netlist_time>(512) , object_t(QUEUE, GENERIC) , pstate_callback_t() , m_qsize(0) @@ -424,7 +457,8 @@ ATTR_COLD core_device_t::core_device_t(const family_t afamily) ATTR_COLD void core_device_t::init(netlist_t &anetlist, const pstring &name) { - set_logic_family(this->default_logic_family()); + if (logic_family() == NULL) + set_logic_family(this->default_logic_family()); init_object(anetlist, name); #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) @@ -492,7 +526,7 @@ device_t::~device_t() //NL_VERBOSE_OUT(("~net_device_t\n"); } -ATTR_COLD netlist_setup_t &device_t::setup() +ATTR_COLD setup_t &device_t::setup() { return netlist().setup(); } @@ -535,7 +569,7 @@ ATTR_COLD void device_t::register_output(const pstring &name, logic_output_t &po setup().register_object(*this, name, port); } -ATTR_COLD void device_t::register_output(const pstring &name, netlist_analog_output_t &port) +ATTR_COLD void device_t::register_output(const pstring &name, analog_output_t &port) { //port.set_logic_family(this->logic_family()); setup().register_object(*this, name, port); @@ -572,13 +606,13 @@ ATTR_COLD void device_t::register_param(const pstring &sname, C ¶m, const T setup().register_object(*this, fullname, param); } -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_double_t ¶m, const double initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_double_t ¶m, const float initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_int_t ¶m, const int initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_logic_t ¶m, const int initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_str_t ¶m, const char * const initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_str_t ¶m, const pstring &initialVal); -template ATTR_COLD void device_t::register_param(const pstring &sname, netlist_param_model_t ¶m, const char * const initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_double_t ¶m, const double initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_double_t ¶m, const float initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_int_t ¶m, const int initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_logic_t ¶m, const int initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_str_t ¶m, const char * const initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_str_t ¶m, const pstring &initialVal); +template ATTR_COLD void device_t::register_param(const pstring &sname, param_model_t ¶m, const char * const initialVal); // ---------------------------------------------------------------------------------------- @@ -981,23 +1015,23 @@ ATTR_COLD void logic_output_t::initial(const netlist_sig_t val) // netlist_analog_output_t // ---------------------------------------------------------------------------------------- -ATTR_COLD netlist_analog_output_t::netlist_analog_output_t() +ATTR_COLD analog_output_t::analog_output_t() : netlist_analog_t(OUTPUT), m_proxied_net(NULL) { this->set_net(m_my_net); set_state(STATE_OUT); - net().as_analog().m_cur_Analog = 0.98; + net().as_analog().m_cur_Analog = NL_FCONST(0.99); } -ATTR_COLD void netlist_analog_output_t::init_object(core_device_t &dev, const pstring &aname) +ATTR_COLD void analog_output_t::init_object(core_device_t &dev, const pstring &aname) { core_terminal_t::init_object(dev, aname); net().init_object(dev.netlist(), aname + ".net"); net().register_railterminal(*this); } -ATTR_COLD void netlist_analog_output_t::initial(const nl_double val) +ATTR_COLD void analog_output_t::initial(const nl_double val) { // FIXME: Really necessary? net().as_analog().m_cur_Analog = val * NL_FCONST(0.99); @@ -1007,42 +1041,13 @@ ATTR_COLD void netlist_analog_output_t::initial(const nl_double val) // netlist_param_t & friends // ---------------------------------------------------------------------------------------- -ATTR_COLD netlist_param_t::netlist_param_t(const param_type_t atype) +ATTR_COLD param_t::param_t(const param_type_t atype) : owned_object_t(PARAM, ANALOG) , m_param_type(atype) { } -ATTR_COLD netlist_param_double_t::netlist_param_double_t() - : netlist_param_t(DOUBLE) - , m_param(0.0) -{ -} - -ATTR_COLD netlist_param_int_t::netlist_param_int_t() - : netlist_param_t(INTEGER) - , m_param(0) -{ -} - -ATTR_COLD netlist_param_logic_t::netlist_param_logic_t() - : netlist_param_int_t() -{ -} - -ATTR_COLD netlist_param_str_t::netlist_param_str_t() - : netlist_param_t(STRING) - , m_param("") -{ -} - -ATTR_COLD netlist_param_model_t::netlist_param_model_t() - : netlist_param_t(MODEL) - , m_param("") -{ -} - -ATTR_COLD const pstring netlist_param_model_t::model_type() const +ATTR_COLD const pstring param_model_t::model_type() const { pstring tmp = this->Value(); // .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) @@ -1055,44 +1060,18 @@ ATTR_COLD const pstring netlist_param_model_t::model_type() const } -ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const +ATTR_COLD const pstring param_model_t::model_value_str(const pstring &entity, const pstring defval) const { - pstring tmp = this->Value(); - // .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) - int p = tmp.ucase().find(entity.ucase() + "="); - if (p>=0) - { - int pblank = tmp.find(" ", p); - if (pblank < 0) pblank = tmp.len() + 1; - tmp = tmp.substr(p, pblank - p); - int pequal = tmp.find("=", 0); - if (pequal < 0) - netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr()); - tmp = tmp.substr(pequal+1); - nl_double factor = NL_FCONST(1.0); - switch (*(tmp.right(1).cstr())) - { - case 'm': factor = 1e-3; break; - case 'u': factor = 1e-6; break; - case 'n': factor = 1e-9; break; - case 'p': factor = 1e-12; break; - case 'f': factor = 1e-15; break; - case 'a': factor = 1e-18; break; - - } - if (factor != NL_FCONST(1.0)) - tmp = tmp.left(tmp.len() - 1); - return tmp.as_double() * factor; - } - else - { - netlist().log("Entity %s not found in model %s\n", entity.cstr(), tmp.cstr()); - return defval; - } + return setup_t::model_value_str(this->Value(), entity, defval); } +ATTR_COLD nl_double param_model_t::model_value(const pstring &entity, const nl_double defval) const +{ + return setup_t::model_value(this->Value(), entity, defval); } +} // namespace + NETLIB_NAMESPACE_DEVICES_START() // ---------------------------------------------------------------------------------------- diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 206d7950490..ecbf4ccb160 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -164,17 +164,14 @@ // Type definitions // ---------------------------------------------------------------------------------------- -//typedef UINT8 netlist_sig_t; - -#define netlist_sig_t UINT8 +typedef UINT8 netlist_sig_t; //============================================================ // MACROS / netlist devices //============================================================ -#define NETLIB_NAMESPACE_DEVICES_START() namespace netlist { namespace devices { - -#define NETLIB_NAMESPACE_DEVICES_END() }} +#define NETLIB_NAMESPACE_DEVICES_START() namespace netlist { namespace devices { +#define NETLIB_NAMESPACE_DEVICES_END() }} #define NETLIB_NAME(_chip) nld_ ## _chip @@ -274,7 +271,7 @@ namespace netlist { namespace devices { - class netlist_matrix_solver_t; + class matrix_solver_t; class NETLIB_NAME(gnd); class NETLIB_NAME(solver); class NETLIB_NAME(mainclock); @@ -294,7 +291,7 @@ namespace netlist fatalerror_e(const char *format, va_list ap); virtual ~fatalerror_e() throw() {} - const pstring &text() { return m_text; } + const pstring &text() { return m_text; } private: pstring m_text; }; @@ -303,9 +300,10 @@ namespace netlist class analog_net_t; class logic_net_t; class net_t; - class netlist_setup_t; + class setup_t; class netlist_t; class core_device_t; + class param_model_t; // ----------------------------------------------------------------------------- // netlist_output_family_t @@ -314,6 +312,7 @@ namespace netlist class logic_family_desc_t { public: + logic_family_desc_t() : m_is_static(false) {} virtual ~logic_family_desc_t() {} virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(logic_output_t *proxied) const = 0; @@ -323,6 +322,10 @@ namespace netlist nl_double m_high_V; nl_double m_R_low; nl_double m_R_high; + + bool m_is_static; + + static const logic_family_desc_t *from_model(const pstring &model); }; class logic_family_t @@ -428,7 +431,7 @@ namespace netlist // ----------------------------------------------------------------------------- // netlist_owned_object_t // ----------------------------------------------------------------------------- - + class owned_object_t : public object_t { NETLIST_PREVENT_COPYING(owned_object_t) @@ -810,7 +813,7 @@ namespace netlist return m_cur_Analog; } - ATTR_HOT devices::netlist_matrix_solver_t *solver() { return m_solver; } + ATTR_HOT devices::matrix_solver_t *solver() { return m_solver; } ATTR_COLD bool already_processed(list_t *groups, int cur_group); ATTR_COLD void process_net(list_t *groups, int &cur_group); @@ -828,7 +831,7 @@ namespace netlist nl_double m_h_n_m_1; //FIXME: needed by current solver code - devices::netlist_matrix_solver_t *m_solver; + devices::matrix_solver_t *m_solver; }; // ----------------------------------------------------------------------------- @@ -859,12 +862,12 @@ namespace netlist logic_net_t m_my_net; }; - class netlist_analog_output_t : public netlist_analog_t + class analog_output_t : public netlist_analog_t { - NETLIST_PREVENT_COPYING(netlist_analog_output_t) + NETLIST_PREVENT_COPYING(analog_output_t) public: - ATTR_COLD netlist_analog_output_t(); + ATTR_COLD analog_output_t(); ATTR_COLD void init_object(core_device_t &dev, const pstring &aname); virtual void reset() @@ -886,9 +889,9 @@ namespace netlist // net_param_t // ----------------------------------------------------------------------------- - class netlist_param_t : public owned_object_t + class param_t : public owned_object_t { - NETLIST_PREVENT_COPYING(netlist_param_t) + NETLIST_PREVENT_COPYING(param_t) public: enum param_type_t { @@ -899,7 +902,7 @@ namespace netlist LOGIC }; - ATTR_COLD netlist_param_t(const param_type_t atype); + ATTR_COLD param_t(const param_type_t atype); ATTR_HOT param_type_t param_type() const { return m_param_type; } @@ -911,87 +914,57 @@ namespace netlist const param_type_t m_param_type; }; - class netlist_param_double_t : public netlist_param_t + template <class C, param_t::param_type_t T> + class param_template_t : public param_t { - NETLIST_PREVENT_COPYING(netlist_param_double_t) + NETLIST_PREVENT_COPYING(param_template_t) public: - ATTR_COLD netlist_param_double_t(); - - ATTR_HOT void setTo(const nl_double param); - ATTR_COLD void initial(const nl_double val) { m_param = val; } - ATTR_HOT nl_double Value() const { return m_param; } - - protected: - virtual void save_register() + ATTR_COLD param_template_t() + : param_t(T) + , m_param(C(0)) { - save(NLNAME(m_param)); - netlist_param_t::save_register(); } - private: - nl_double m_param; - }; - - class netlist_param_int_t : public netlist_param_t - { - NETLIST_PREVENT_COPYING(netlist_param_int_t) - public: - ATTR_COLD netlist_param_int_t(); - - ATTR_HOT void setTo(const int param); - ATTR_COLD void initial(const int val) { m_param = val; } + operator const C() const { return Value(); } - ATTR_HOT int Value() const { return m_param; } + ATTR_HOT void setTo(const C ¶m); + ATTR_COLD void initial(const C &val) { m_param = val; } + ATTR_HOT C Value() const { return m_param; } protected: virtual void save_register() { - save(NLNAME(m_param)); - netlist_param_t::save_register(); + /* pstrings not yet supported, these need special logic */ + if (T != param_t::STRING && T != param_t::MODEL) + save(NLNAME(m_param)); + param_t::save_register(); } + C m_param; private: - int m_param; }; - class netlist_param_logic_t : public netlist_param_int_t - { - NETLIST_PREVENT_COPYING(netlist_param_logic_t) - public: - ATTR_COLD netlist_param_logic_t(); - }; + typedef param_template_t<nl_double, param_t::DOUBLE> param_double_t; + typedef param_template_t<int, param_t::INTEGER> param_int_t; + typedef param_template_t<pstring, param_t::STRING> param_str_t; - class netlist_param_str_t : public netlist_param_t + class param_logic_t : public param_int_t { - NETLIST_PREVENT_COPYING(netlist_param_str_t) + NETLIST_PREVENT_COPYING(param_logic_t) public: - ATTR_COLD netlist_param_str_t(); - - ATTR_HOT void setTo(const pstring ¶m); - ATTR_COLD void initial(const pstring &val) { m_param = val; } - - ATTR_HOT const pstring &Value() const { return m_param; } - - private: - pstring m_param; + ATTR_COLD param_logic_t() : param_int_t() { }; }; - class netlist_param_model_t : public netlist_param_t + class param_model_t : public param_template_t<pstring, param_t::MODEL> { - NETLIST_PREVENT_COPYING(netlist_param_model_t) + NETLIST_PREVENT_COPYING(param_model_t) public: - ATTR_COLD netlist_param_model_t(); - - ATTR_COLD void initial(const pstring &val) { m_param = val; } - - ATTR_HOT const pstring &Value() const { return m_param; } + ATTR_COLD param_model_t() : param_template_t<pstring, param_t::MODEL>() { } /* these should be cached! */ ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const; + ATTR_COLD const pstring model_value_str(const pstring &entity, const pstring defval = "") const; ATTR_COLD const pstring model_type() const; - - private: - pstring m_param; }; // ----------------------------------------------------------------------------- @@ -1047,7 +1020,7 @@ namespace netlist ATTR_HOT nl_double TERMANALOG(const terminal_t &term) const { return term.net().as_analog().Q_Analog(); } - ATTR_HOT void OUTANALOG(netlist_analog_output_t &out, const nl_double val) + ATTR_HOT void OUTANALOG(analog_output_t &out, const nl_double val) { out.set_Q(val); } @@ -1102,12 +1075,12 @@ namespace netlist virtual void init(netlist_t &anetlist, const pstring &name); - ATTR_COLD netlist_setup_t &setup(); + ATTR_COLD setup_t &setup(); ATTR_COLD void register_sub(const pstring &name, device_t &dev); ATTR_COLD void register_subalias(const pstring &name, core_terminal_t &term); ATTR_COLD void register_terminal(const pstring &name, terminal_t &port); - ATTR_COLD void register_output(const pstring &name, netlist_analog_output_t &out); + ATTR_COLD void register_output(const pstring &name, analog_output_t &out); ATTR_COLD void register_output(const pstring &name, logic_output_t &out); ATTR_COLD void register_input(const pstring &name, analog_input_t &in); ATTR_COLD void register_input(const pstring &name, logic_input_t &in); @@ -1133,7 +1106,7 @@ namespace netlist // netlist_queue_t // ----------------------------------------------------------------------------- - class queue_t : public netlist_timed_queue<net_t *, netlist_time>, + class queue_t : public timed_queue<net_t *, netlist_time>, public object_t, public pstate_callback_t { @@ -1187,8 +1160,8 @@ namespace netlist ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */ - ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; } - ATTR_COLD netlist_setup_t &setup() { return *m_setup; } + ATTR_COLD void set_setup(setup_t *asetup) { m_setup = asetup; } + ATTR_COLD setup_t &setup() { return *m_setup; } ATTR_COLD net_t *find_net(const pstring &name); @@ -1283,7 +1256,7 @@ namespace netlist devices::NETLIB_NAME(netlistparams) *m_params; - netlist_setup_t *m_setup; + setup_t *m_setup; }; // ----------------------------------------------------------------------------- @@ -1292,22 +1265,8 @@ namespace netlist PSTATE_INTERFACE(object_t, m_netlist, name()) - ATTR_HOT inline void netlist_param_str_t::setTo(const pstring ¶m) - { - m_param = param; - netdev().update_param(); - } - - ATTR_HOT inline void netlist_param_int_t::setTo(const int param) - { - if (m_param != param) - { - m_param = param; - netdev().update_param(); - } - } - - ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param) + template <class C, param_t::param_type_t T> + ATTR_HOT inline void param_template_t<C, T>::setTo(const C ¶m) { if (m_param != param) { @@ -1416,7 +1375,7 @@ namespace netlist return net().as_analog().Q_Analog(); } - ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ) + ATTR_HOT inline void analog_output_t::set_Q(const nl_double newQ) { if (newQ != net().as_analog().m_cur_Analog) { diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h index 439e779b1ce..debddd8b97c 100644 --- a/src/emu/netlist/nl_config.h +++ b/src/emu/netlist/nl_config.h @@ -17,42 +17,42 @@ /* * The following options determine how object::update is called. * NL_PMF_TYPE_VIRTUAL - * Use stock virtual call + * Use stock virtual call * * NL_PMF_TYPE_GNUC_PMF - * Use standard pointer to member function syntax + * Use standard pointer to member function syntax * - * NL_PMF_TYPE_GNUC_PMF_CONV - * Use gnu extension and convert the pmf to a function pointer. - * This is not standard compliant and needs - * -Wno-pmf-conversions to compile. + * NL_PMF_TYPE_GNUC_PMF_CONV + * Use gnu extension and convert the pmf to a function pointer. + * This is not standard compliant and needs + * -Wno-pmf-conversions to compile. * - * NL_PMF_TYPE_INTERNAL - * Use the same approach as MAME for deriving the function pointer. - * This is compiler-dependant as well + * NL_PMF_TYPE_INTERNAL + * Use the same approach as MAME for deriving the function pointer. + * This is compiler-dependant as well * - * Benchmarks for ./nltool -c run -f src/mame/drivers/nl_pong.c -t 10 -n pong_fast + * Benchmarks for ./nltool -c run -f src/mame/drivers/nl_pong.c -t 10 -n pong_fast * - * NL_PMF_TYPE_INTERNAL: 215% - * NL_PMF_TYPE_GNUC_PMF: 163% - * NL_PMF_TYPE_GNUC_PMF_CONV: 215% - * NL_PMF_TYPE_VIRTUAL: 213% + * NL_PMF_TYPE_INTERNAL: 215% + * NL_PMF_TYPE_GNUC_PMF: 163% + * NL_PMF_TYPE_GNUC_PMF_CONV: 215% + * NL_PMF_TYPE_VIRTUAL: 213% * - * The whole exercise was done to avoid virtual calls. In prior versions of - * netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement. - * Since than, ATTR_COLD was removed from functions declared as virtual. - * This may explain that the recent benchmarks show no difference at all. + * The whole exercise was done to avoid virtual calls. In prior versions of + * netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement. + * Since than, ATTR_COLD was removed from functions declared as virtual. + * This may explain that the recent benchmarks show no difference at all. * - * Disappointing is the GNUC_PMF performance. + * Disappointing is the GNUC_PMF performance. */ // This will be autodetected //#define NL_PMF_TYPE 3 -#define NL_PMF_TYPE_VIRTUAL 0 -#define NL_PMF_TYPE_GNUC_PMF 1 -#define NL_PMF_TYPE_GNUC_PMF_CONV 2 -#define NL_PMF_TYPE_INTERNAL 3 +#define NL_PMF_TYPE_VIRTUAL 0 +#define NL_PMF_TYPE_GNUC_PMF 1 +#define NL_PMF_TYPE_GNUC_PMF_CONV 2 +#define NL_PMF_TYPE_INTERNAL 3 #ifndef NL_PMF_TYPE #if PHAS_PMF_INTERNAL diff --git a/src/emu/netlist/nl_factory.c b/src/emu/netlist/nl_factory.c index 5bee96357b5..a62c889baed 100644 --- a/src/emu/netlist/nl_factory.c +++ b/src/emu/netlist/nl_factory.c @@ -13,7 +13,6 @@ namespace netlist { - // ---------------------------------------------------------------------------------------- // net_device_t_base_factory // ---------------------------------------------------------------------------------------- @@ -64,13 +63,13 @@ device_t *factory_list_t::new_device_by_classname(const pstring &classname) cons return NULL; // appease code analysis } -device_t *factory_list_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const +device_t *factory_list_t::new_device_by_name(const pstring &name, setup_t &setup) const { base_factory_t *f = factory_by_name(name, setup); return f->Create(); } -base_factory_t * factory_list_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const +base_factory_t * factory_list_t::factory_by_name(const pstring &name, setup_t &setup) const { for (std::size_t i=0; i < m_list.size(); i++) { diff --git a/src/emu/netlist/nl_factory.h b/src/emu/netlist/nl_factory.h index 4ee9b245055..2b29efca61f 100644 --- a/src/emu/netlist/nl_factory.h +++ b/src/emu/netlist/nl_factory.h @@ -16,7 +16,6 @@ namespace netlist { - // ----------------------------------------------------------------------------- // net_dev class factory // ----------------------------------------------------------------------------- @@ -84,8 +83,8 @@ namespace netlist } ATTR_COLD device_t *new_device_by_classname(const pstring &classname) const; - ATTR_COLD device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const; - ATTR_COLD base_factory_t * factory_by_name(const pstring &name, netlist_setup_t &setup) const; + ATTR_COLD device_t *new_device_by_name(const pstring &name, setup_t &setup) const; + ATTR_COLD base_factory_t * factory_by_name(const pstring &name, setup_t &setup) const; const list_t &list() { return m_list; } diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h index bb47c3137f6..bea7508a7d8 100644 --- a/src/emu/netlist/nl_lists.h +++ b/src/emu/netlist/nl_lists.h @@ -17,138 +17,142 @@ // timed queue // ---------------------------------------------------------------------------------------- -template <class _Element, class _Time> -class netlist_timed_queue +namespace netlist { - NETLIST_PREVENT_COPYING(netlist_timed_queue) -public: - - class entry_t + template <class _Element, class _Time> + class timed_queue { + NETLIST_PREVENT_COPYING(timed_queue) public: - ATTR_HOT entry_t() - : m_exec_time(), m_object() {} - ATTR_HOT entry_t(const _Time &atime, const _Element &elem) : m_exec_time(atime), m_object(elem) {} - ATTR_HOT const _Time &exec_time() const { return m_exec_time; } - ATTR_HOT const _Element &object() const { return m_object; } - - ATTR_HOT entry_t &operator=(const entry_t &right) { - m_exec_time = right.m_exec_time; - m_object = right.m_object; - return *this; - } - private: - _Time m_exec_time; - _Element m_object; - }; + class entry_t + { + public: + ATTR_HOT entry_t() + : m_exec_time(), m_object() {} + ATTR_HOT entry_t(const _Time &atime, const _Element &elem) : m_exec_time(atime), m_object(elem) {} + ATTR_HOT const _Time &exec_time() const { return m_exec_time; } + ATTR_HOT const _Element &object() const { return m_object; } + + ATTR_HOT entry_t &operator=(const entry_t &right) { + m_exec_time = right.m_exec_time; + m_object = right.m_object; + return *this; + } - netlist_timed_queue(unsigned list_size) - : m_list(list_size) - { -#if HAS_OPENMP && USE_OPENMP - m_lock = 0; -#endif - clear(); - } + private: + _Time m_exec_time; + _Element m_object; + }; - ATTR_HOT std::size_t capacity() const { return m_list.size(); } - ATTR_HOT bool is_empty() const { return (m_end == &m_list[1]); } - ATTR_HOT bool is_not_empty() const { return (m_end > &m_list[1]); } + timed_queue(unsigned list_size) + : m_list(list_size) + { + #if HAS_OPENMP && USE_OPENMP + m_lock = 0; + #endif + clear(); + } - ATTR_HOT void push(const entry_t &e) - { -#if HAS_OPENMP && USE_OPENMP - /* Lock */ - while (atomic_exchange32(&m_lock, 1)) { } -#endif - const _Time t = e.exec_time(); - entry_t * i = m_end++; - while (t > (i - 1)->exec_time()) + ATTR_HOT std::size_t capacity() const { return m_list.size(); } + ATTR_HOT bool is_empty() const { return (m_end == &m_list[1]); } + ATTR_HOT bool is_not_empty() const { return (m_end > &m_list[1]); } + + ATTR_HOT void push(const entry_t &e) { - *(i) = *(i-1); - i--; - inc_stat(m_prof_sortmove); + #if HAS_OPENMP && USE_OPENMP + /* Lock */ + while (atomic_exchange32(&m_lock, 1)) { } + #endif + const _Time t = e.exec_time(); + entry_t * i = m_end++; + while (t > (i - 1)->exec_time()) + { + *(i) = *(i-1); + i--; + inc_stat(m_prof_sortmove); + } + *i = e; + inc_stat(m_prof_call); + #if HAS_OPENMP && USE_OPENMP + m_lock = 0; + #endif + //nl_assert(m_end - m_list < _Size); } - *i = e; - inc_stat(m_prof_call); -#if HAS_OPENMP && USE_OPENMP - m_lock = 0; -#endif - //nl_assert(m_end - m_list < _Size); - } - - ATTR_HOT const entry_t *pop() - { - return --m_end; - } - ATTR_HOT const entry_t *peek() const - { - return (m_end-1); - } + ATTR_HOT const entry_t *pop() + { + return --m_end; + } - ATTR_HOT void remove(const _Element &elem) - { - /* Lock */ -#if HAS_OPENMP && USE_OPENMP - while (atomic_exchange32(&m_lock, 1)) { } -#endif - entry_t * i = m_end - 1; - while (i > &m_list[0]) + ATTR_HOT const entry_t *peek() const + { + return (m_end-1); + } + + ATTR_HOT void remove(const _Element &elem) { - if (i->object() == elem) + /* Lock */ + #if HAS_OPENMP && USE_OPENMP + while (atomic_exchange32(&m_lock, 1)) { } + #endif + entry_t * i = m_end - 1; + while (i > &m_list[0]) { - m_end--; - while (i < m_end) + if (i->object() == elem) { - *i = *(i+1); - i++; + m_end--; + while (i < m_end) + { + *i = *(i+1); + i++; + } + #if HAS_OPENMP && USE_OPENMP + m_lock = 0; + #endif + return; } -#if HAS_OPENMP && USE_OPENMP - m_lock = 0; -#endif - return; + i--; } - i--; + #if HAS_OPENMP && USE_OPENMP + m_lock = 0; + #endif } -#if HAS_OPENMP && USE_OPENMP - m_lock = 0; -#endif - } - ATTR_COLD void clear() - { - m_end = &m_list[0]; - /* put an empty element with maximum time into the queue. - * the insert algo above will run into this element and doesn't - * need a comparison with queue start. - */ - m_list[0] = entry_t(_Time::from_raw(~0), _Element(0)); - m_end++; - } - - // save state support & mame disasm - - ATTR_COLD const entry_t *listptr() const { return &m_list[1]; } - ATTR_HOT int count() const { return m_end - &m_list[1]; } - ATTR_HOT const entry_t & operator[](const int & index) const { return m_list[1+index]; } - -#if (NL_KEEP_STATISTICS) - // profiling - INT32 m_prof_sortmove; - INT32 m_prof_call; -#endif - -private: - -#if HAS_OPENMP && USE_OPENMP - volatile INT32 m_lock; -#endif - entry_t * m_end; - //entry_t m_list[_Size]; - parray_t<entry_t> m_list; - -}; + ATTR_COLD void clear() + { + m_end = &m_list[0]; + /* put an empty element with maximum time into the queue. + * the insert algo above will run into this element and doesn't + * need a comparison with queue start. + */ + m_list[0] = entry_t(_Time::from_raw(~0), _Element(0)); + m_end++; + } + + // save state support & mame disasm + + ATTR_COLD const entry_t *listptr() const { return &m_list[1]; } + ATTR_HOT int count() const { return m_end - &m_list[1]; } + ATTR_HOT const entry_t & operator[](const int & index) const { return m_list[1+index]; } + + #if (NL_KEEP_STATISTICS) + // profiling + INT32 m_prof_sortmove; + INT32 m_prof_call; + #endif + + private: + + #if HAS_OPENMP && USE_OPENMP + volatile INT32 m_lock; + #endif + entry_t * m_end; + //entry_t m_list[_Size]; + parray_t<entry_t> m_list; + + }; + +} #endif /* NLLISTS_H_ */ diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c index a81d68ad732..7edcec684c1 100644 --- a/src/emu/netlist/nl_parser.c +++ b/src/emu/netlist/nl_parser.c @@ -18,7 +18,7 @@ namespace netlist // A netlist parser // ---------------------------------------------------------------------------------------- -ATTR_COLD void netlist_parser::verror(pstring msg, int line_num, pstring line) +ATTR_COLD void parser_t::verror(pstring msg, int line_num, pstring line) { m_setup.netlist().error("line %d: error: %s\n\t\t%s\n", line_num, msg.cstr(), line.cstr()); @@ -27,7 +27,7 @@ ATTR_COLD void netlist_parser::verror(pstring msg, int line_num, pstring line) } -bool netlist_parser::parse(const char *buf, const pstring nlname) +bool parser_t::parse(const char *buf, const pstring nlname) { ppreprocessor prepro; @@ -104,7 +104,7 @@ bool netlist_parser::parse(const char *buf, const pstring nlname) } } -void netlist_parser::parse_netlist(ATTR_UNUSED const pstring &nlname) +void parser_t::parse_netlist(ATTR_UNUSED const pstring &nlname) { while (true) { @@ -144,7 +144,7 @@ void netlist_parser::parse_netlist(ATTR_UNUSED const pstring &nlname) } } -void netlist_parser::net_truthtable_start() +void parser_t::net_truthtable_start() { pstring name = get_identifier(); require_token(m_tok_comma); @@ -188,20 +188,20 @@ void netlist_parser::net_truthtable_start() } -void netlist_parser::netdev_netlist_start() +void parser_t::netdev_netlist_start() { // don't do much token_t name = get_token(); require_token(m_tok_param_right); } -void netlist_parser::netdev_netlist_end() +void parser_t::netdev_netlist_end() { // don't do much require_token(m_tok_param_right); } -void netlist_parser::net_model() +void parser_t::net_model() { // don't do much pstring model = get_string(); @@ -209,7 +209,7 @@ void netlist_parser::net_model() require_token(m_tok_param_right); } -void netlist_parser::net_submodel() +void parser_t::net_submodel() { // don't do much pstring model = get_identifier(); @@ -222,7 +222,7 @@ void netlist_parser::net_submodel() m_setup.namespace_pop(); } -void netlist_parser::frontier() +void parser_t::frontier() { // don't do much pstring attachat = get_identifier(); @@ -235,7 +235,7 @@ void netlist_parser::frontier() m_setup.register_frontier(attachat, r_IN, r_OUT); } -void netlist_parser::net_include() +void parser_t::net_include() { // don't do much pstring name = get_identifier(); @@ -244,7 +244,7 @@ void netlist_parser::net_include() m_setup.include(name); } -void netlist_parser::net_local_source() +void parser_t::net_local_source() { // This directive is only for hardcoded netlists. Ignore it here. pstring name = get_identifier(); @@ -252,7 +252,7 @@ void netlist_parser::net_local_source() } -void netlist_parser::net_alias() +void parser_t::net_alias() { pstring alias = get_identifier_or_number(); @@ -266,7 +266,7 @@ void netlist_parser::net_alias() m_setup.register_alias(alias, out); } -void netlist_parser::net_c() +void parser_t::net_c() { pstring first = get_identifier(); require_token(m_tok_comma); @@ -285,7 +285,7 @@ void netlist_parser::net_c() } -void netlist_parser::netdev_param() +void parser_t::netdev_param() { pstring param; nl_double val; @@ -297,7 +297,7 @@ void netlist_parser::netdev_param() require_token(m_tok_param_right); } -void netlist_parser::device(const pstring &dev_type) +void parser_t::device(const pstring &dev_type) { pstring devname; base_factory_t *f = m_setup.factory().factory_by_name(dev_type, m_setup); @@ -356,7 +356,7 @@ void netlist_parser::device(const pstring &dev_type) // ---------------------------------------------------------------------------------------- -nl_double netlist_parser::eval_param(const token_t tok) +nl_double parser_t::eval_param(const token_t tok) { static const char *macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"}; static nl_double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12}; diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h index f5f58fd140f..44074b8b9ca 100644 --- a/src/emu/netlist/nl_parser.h +++ b/src/emu/netlist/nl_parser.h @@ -14,61 +14,60 @@ namespace netlist { + class parser_t : public ptokenizer + { + NETLIST_PREVENT_COPYING(parser_t) + public: + parser_t(setup_t &setup) + : ptokenizer(), m_setup(setup), m_buf(NULL) {} -class netlist_parser : public ptokenizer -{ - NETLIST_PREVENT_COPYING(netlist_parser) -public: - netlist_parser(netlist_setup_t &setup) - : ptokenizer(), m_setup(setup), m_buf(NULL) {} - - bool parse(const char *buf, const pstring nlname = ""); + bool parse(const char *buf, const pstring nlname = ""); - void parse_netlist(const pstring &nlname); - void net_alias(); - void netdev_param(); - void net_c(); - void frontier(); - void device(const pstring &dev_type); - void netdev_netlist_start(); - void netdev_netlist_end(); - void net_model(); - void net_submodel(); - void net_include(); - void net_local_source(); - void net_truthtable_start(); + void parse_netlist(const pstring &nlname); + void net_alias(); + void netdev_param(); + void net_c(); + void frontier(); + void device(const pstring &dev_type); + void netdev_netlist_start(); + void netdev_netlist_end(); + void net_model(); + void net_submodel(); + void net_include(); + void net_local_source(); + void net_truthtable_start(); -protected: - /* for debugging messages */ - netlist_t &netlist() { return m_setup.netlist(); } + protected: + /* for debugging messages */ + netlist_t &netlist() { return m_setup.netlist(); } - virtual void verror(pstring msg, int line_num, pstring line); -private: + virtual void verror(pstring msg, int line_num, pstring line); + private: - nl_double eval_param(const token_t tok); + nl_double eval_param(const token_t tok); - token_id_t m_tok_param_left; - token_id_t m_tok_param_right; - token_id_t m_tok_comma; - token_id_t m_tok_ALIAS; - token_id_t m_tok_NET_C; - token_id_t m_tok_FRONTIER; - token_id_t m_tok_PARAM; - token_id_t m_tok_NET_MODEL; - token_id_t m_tok_NETLIST_START; - token_id_t m_tok_NETLIST_END; - token_id_t m_tok_SUBMODEL; - token_id_t m_tok_INCLUDE; - token_id_t m_tok_LOCAL_SOURCE; - token_id_t m_tok_TRUTHTABLE_START; - token_id_t m_tok_TRUTHTABLE_END; - token_id_t m_tok_TT_HEAD; - token_id_t m_tok_TT_LINE; + token_id_t m_tok_param_left; + token_id_t m_tok_param_right; + token_id_t m_tok_comma; + token_id_t m_tok_ALIAS; + token_id_t m_tok_NET_C; + token_id_t m_tok_FRONTIER; + token_id_t m_tok_PARAM; + token_id_t m_tok_NET_MODEL; + token_id_t m_tok_NETLIST_START; + token_id_t m_tok_NETLIST_END; + token_id_t m_tok_SUBMODEL; + token_id_t m_tok_INCLUDE; + token_id_t m_tok_LOCAL_SOURCE; + token_id_t m_tok_TRUTHTABLE_START; + token_id_t m_tok_TRUTHTABLE_END; + token_id_t m_tok_TT_HEAD; + token_id_t m_tok_TT_LINE; - netlist_setup_t &m_setup; + setup_t &m_setup; - const char *m_buf; -}; + const char *m_buf; + }; } diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index 6cc46e8b39f..a135caf5598 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -5,6 +5,7 @@ * */ +#include <solver/nld_solver.h> #include <cstdio> #include "plib/palloc.h" @@ -15,7 +16,6 @@ #include "nl_factory.h" #include "devices/net_lib.h" #include "devices/nld_system.h" -#include "analog/nld_solver.h" #include "analog/nld_twoterm.h" static NETLIST_START(base) @@ -34,13 +34,12 @@ NETLIST_END() // ---------------------------------------------------------------------------------------- -// netlist_setup_t +// setup_t // ---------------------------------------------------------------------------------------- namespace netlist { - -netlist_setup_t::netlist_setup_t(netlist_t *netlist) +setup_t::setup_t(netlist_t *netlist) : m_netlist(netlist) , m_proxy_cnt(0) { @@ -48,14 +47,14 @@ netlist_setup_t::netlist_setup_t(netlist_t *netlist) m_factory = palloc(factory_list_t); } -void netlist_setup_t::init() +void setup_t::init() { initialize_factory(factory()); NETLIST_NAME(base)(*this); } -netlist_setup_t::~netlist_setup_t() +setup_t::~setup_t() { m_links.clear(); m_alias.clear(); @@ -70,7 +69,7 @@ netlist_setup_t::~netlist_setup_t() pstring::resetmem(); } -ATTR_COLD pstring netlist_setup_t::build_fqn(const pstring &obj_name) const +ATTR_COLD pstring setup_t::build_fqn(const pstring &obj_name) const { if (m_stack.empty()) return netlist().name() + "." + obj_name; @@ -78,7 +77,7 @@ ATTR_COLD pstring netlist_setup_t::build_fqn(const pstring &obj_name) const return m_stack.peek() + "." + obj_name; } -void netlist_setup_t::namespace_push(const pstring &aname) +void setup_t::namespace_push(const pstring &aname) { if (m_stack.empty()) m_stack.push(netlist().name() + "." + aname); @@ -86,13 +85,13 @@ void netlist_setup_t::namespace_push(const pstring &aname) m_stack.push(m_stack.peek() + "." + aname); } -void netlist_setup_t::namespace_pop() +void setup_t::namespace_pop() { m_stack.pop(); } -device_t *netlist_setup_t::register_dev(device_t *dev, const pstring &name) +device_t *setup_t::register_dev(device_t *dev, const pstring &name) { pstring fqn = build_fqn(name); @@ -103,7 +102,7 @@ device_t *netlist_setup_t::register_dev(device_t *dev, const pstring &name) return dev; } -device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring &name) +device_t *setup_t::register_dev(const pstring &classname, const pstring &name) { device_t *dev = factory().new_device_by_classname(classname); if (dev == NULL) @@ -111,7 +110,7 @@ device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring return register_dev(dev, name); } -void netlist_setup_t::remove_dev(const pstring &name) +void setup_t::remove_dev(const pstring &name) { device_t *dev = netlist().m_devices.find_by_name(name); pstring temp = name + "."; @@ -132,25 +131,25 @@ void netlist_setup_t::remove_dev(const pstring &name) netlist().m_devices.remove_by_name(name); } -void netlist_setup_t::register_model(const pstring &model) +void setup_t::register_model(const pstring &model) { m_models.add(model); } -void netlist_setup_t::register_alias_nofqn(const pstring &alias, const pstring &out) +void setup_t::register_alias_nofqn(const pstring &alias, const pstring &out) { if (!(m_alias.add(link_t(alias, out), false)==true)) netlist().error("Error adding alias %s to alias list\n", alias.cstr()); } -void netlist_setup_t::register_alias(const pstring &alias, const pstring &out) +void setup_t::register_alias(const pstring &alias, const pstring &out) { pstring alias_fqn = build_fqn(alias); pstring out_fqn = build_fqn(out); register_alias_nofqn(alias_fqn, out_fqn); } -pstring netlist_setup_t::objtype_as_astr(object_t &in) const +pstring setup_t::objtype_as_astr(object_t &in) const { switch (in.type()) { @@ -176,7 +175,7 @@ pstring netlist_setup_t::objtype_as_astr(object_t &in) const return "Error"; } -void netlist_setup_t::register_object(device_t &dev, const pstring &name, object_t &obj) +void setup_t::register_object(device_t &dev, const pstring &name, object_t &obj) { switch (obj.type()) { @@ -190,7 +189,7 @@ void netlist_setup_t::register_object(device_t &dev, const pstring &name, object if (obj.isFamily(terminal_t::LOGIC)) dynamic_cast<logic_output_t &>(term).init_object(dev, dev.name() + "." + name); else if (obj.isFamily(terminal_t::ANALOG)) - dynamic_cast<netlist_analog_output_t &>(term).init_object(dev, dev.name() + "." + name); + dynamic_cast<analog_output_t &>(term).init_object(dev, dev.name() + "." + name); else netlist().error("Error adding %s %s to terminal list, neither LOGIC nor ANALOG\n", objtype_as_astr(term).cstr(), term.name().cstr()); } @@ -206,38 +205,38 @@ void netlist_setup_t::register_object(device_t &dev, const pstring &name, object break; case terminal_t::PARAM: { - netlist_param_t ¶m = dynamic_cast<netlist_param_t &>(obj); + param_t ¶m = dynamic_cast<param_t &>(obj); //printf("name: %s\n", name.cstr()); const pstring val = m_params_temp.find_by_name(name).e2; if (val != "") { switch (param.param_type()) { - case netlist_param_t::DOUBLE: + case param_t::DOUBLE: { NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val.cstr())); double vald = 0; if (std::sscanf(val.cstr(), "%lf", &vald) != 1) netlist().error("Invalid number conversion %s : %s\n", name.cstr(), val.cstr()); - dynamic_cast<netlist_param_double_t &>(param).initial(vald); + dynamic_cast<param_double_t &>(param).initial(vald); } break; - case netlist_param_t::INTEGER: - case netlist_param_t::LOGIC: + case param_t::INTEGER: + case param_t::LOGIC: { NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val.cstr())); double vald = 0; if (std::sscanf(val.cstr(), "%lf", &vald) != 1) netlist().error("Invalid number conversion %s : %s\n", name.cstr(), val.cstr()); - dynamic_cast<netlist_param_int_t &>(param).initial((int) vald); + dynamic_cast<param_int_t &>(param).initial((int) vald); } break; - case netlist_param_t::STRING: + case param_t::STRING: { - dynamic_cast<netlist_param_str_t &>(param).initial(val); + dynamic_cast<param_str_t &>(param).initial(val); } break; - case netlist_param_t::MODEL: + case param_t::MODEL: { pstring search = (".model " + val + " ").ucase(); bool found = false; @@ -248,7 +247,7 @@ void netlist_setup_t::register_object(device_t &dev, const pstring &name, object //int pl=m_models[i].find("("); //int pr=m_models[i].find(")"); //dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i].substr(pl+1,pr-pl-1)); - dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i]); + dynamic_cast<param_model_t &>(param).initial(m_models[i]); found = true; break; } @@ -277,7 +276,7 @@ void netlist_setup_t::register_object(device_t &dev, const pstring &name, object } } -void netlist_setup_t::register_link_arr(const pstring &terms) +void setup_t::register_link_arr(const pstring &terms) { pstring_list_t list(terms,", "); if (list.size() < 2) @@ -289,7 +288,7 @@ void netlist_setup_t::register_link_arr(const pstring &terms) } -void netlist_setup_t::register_link(const pstring &sin, const pstring &sout) +void setup_t::register_link(const pstring &sin, const pstring &sout) { link_t temp = link_t(build_fqn(sin), build_fqn(sout)); NL_VERBOSE_OUT(("link %s <== %s\n", sin.cstr(), sout.cstr())); @@ -298,7 +297,7 @@ void netlist_setup_t::register_link(const pstring &sin, const pstring &sout) // fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr()); } -void netlist_setup_t::remove_connections(const pstring pin) +void setup_t::remove_connections(const pstring pin) { pstring pinfn = build_fqn(pin); bool found = false; @@ -316,7 +315,7 @@ void netlist_setup_t::remove_connections(const pstring pin) } -void netlist_setup_t::register_frontier(const pstring attach, const double r_IN, const double r_OUT) +void setup_t::register_frontier(const pstring attach, const double r_IN, const double r_OUT) { static int frontier_cnt = 0; pstring frontier_name = pstring::sprintf("frontier_%d", frontier_cnt); @@ -346,13 +345,13 @@ void netlist_setup_t::register_frontier(const pstring attach, const double r_IN, } -void netlist_setup_t::register_param(const pstring ¶m, const double value) +void setup_t::register_param(const pstring ¶m, const double value) { // FIXME: there should be a better way register_param(param, pstring::sprintf("%.9e", value)); } -void netlist_setup_t::register_param(const pstring ¶m, const pstring &value) +void setup_t::register_param(const pstring ¶m, const pstring &value) { pstring fqn = build_fqn(param); @@ -360,7 +359,7 @@ void netlist_setup_t::register_param(const pstring ¶m, const pstring &value) netlist().error("Error adding parameter %s to parameter list\n", param.cstr()); } -const pstring netlist_setup_t::resolve_alias(const pstring &name) const +const pstring setup_t::resolve_alias(const pstring &name) const { pstring temp = name; pstring ret; @@ -375,7 +374,7 @@ const pstring netlist_setup_t::resolve_alias(const pstring &name) const return ret; } -core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, bool required) +core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, bool required) { const pstring &tname = resolve_alias(terminal_in); core_terminal_t *ret; @@ -395,7 +394,7 @@ core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, bool return ret; } -core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, object_t::type_t atype, bool required) +core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, object_t::type_t atype, bool required) { const pstring &tname = resolve_alias(terminal_in); core_terminal_t *ret; @@ -422,12 +421,12 @@ core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, obje return ret; } -netlist_param_t *netlist_setup_t::find_param(const pstring ¶m_in, bool required) +param_t *setup_t::find_param(const pstring ¶m_in, bool required) { const pstring param_in_fqn = build_fqn(param_in); const pstring &outname = resolve_alias(param_in_fqn); - netlist_param_t *ret; + param_t *ret; ret = m_params.find_by_name(outname); if (ret == NULL && required) @@ -438,7 +437,7 @@ netlist_param_t *netlist_setup_t::find_param(const pstring ¶m_in, bool requi } // FIXME avoid dynamic cast here -devices::nld_base_proxy *netlist_setup_t::get_d_a_proxy(core_terminal_t &out) +devices::nld_base_proxy *setup_t::get_d_a_proxy(core_terminal_t &out) { nl_assert(out.isFamily(terminal_t::LOGIC)); @@ -475,7 +474,7 @@ devices::nld_base_proxy *netlist_setup_t::get_d_a_proxy(core_terminal_t &out) return proxy; } -void netlist_setup_t::connect_input_output(core_terminal_t &in, core_terminal_t &out) +void setup_t::connect_input_output(core_terminal_t &in, core_terminal_t &out) { if (out.isFamily(terminal_t::ANALOG) && in.isFamily(terminal_t::LOGIC)) { @@ -509,7 +508,7 @@ void netlist_setup_t::connect_input_output(core_terminal_t &in, core_terminal_t } -void netlist_setup_t::connect_terminal_input(terminal_t &term, core_terminal_t &inp) +void setup_t::connect_terminal_input(terminal_t &term, core_terminal_t &inp) { if (inp.isFamily(terminal_t::ANALOG)) { @@ -541,7 +540,7 @@ void netlist_setup_t::connect_terminal_input(terminal_t &term, core_terminal_t & } } -void netlist_setup_t::connect_terminal_output(terminal_t &in, core_terminal_t &out) +void setup_t::connect_terminal_output(terminal_t &in, core_terminal_t &out) { if (out.isFamily(terminal_t::ANALOG)) { @@ -565,7 +564,7 @@ void netlist_setup_t::connect_terminal_output(terminal_t &in, core_terminal_t &o } } -void netlist_setup_t::connect_terminals(core_terminal_t &t1, core_terminal_t &t2) +void setup_t::connect_terminals(core_terminal_t &t1, core_terminal_t &t2) { //nl_assert(in.isType(netlist_terminal_t::TERMINAL)); //nl_assert(out.isType(netlist_terminal_t::TERMINAL)); @@ -609,7 +608,7 @@ static core_terminal_t &resolve_proxy(core_terminal_t &term) return term; } -bool netlist_setup_t::connect_input_input(core_terminal_t &t1, core_terminal_t &t2) +bool setup_t::connect_input_input(core_terminal_t &t1, core_terminal_t &t2) { bool ret = false; if (t1.has_net()) @@ -653,7 +652,7 @@ bool netlist_setup_t::connect_input_input(core_terminal_t &t1, core_terminal_t & -bool netlist_setup_t::connect(core_terminal_t &t1_in, core_terminal_t &t2_in) +bool setup_t::connect(core_terminal_t &t1_in, core_terminal_t &t2_in) { NL_VERBOSE_OUT(("Connecting %s to %s\n", t1_in.name().cstr(), t2_in.name().cstr())); core_terminal_t &t1 = resolve_proxy(t1_in); @@ -702,7 +701,7 @@ bool netlist_setup_t::connect(core_terminal_t &t1_in, core_terminal_t &t2_in) return ret; } -void netlist_setup_t::resolve_inputs() +void setup_t::resolve_inputs() { bool has_twoterms = false; @@ -810,7 +809,7 @@ void netlist_setup_t::resolve_inputs() } -void netlist_setup_t::start_devices() +void setup_t::start_devices() { pstring env = nl_util::environment("NL_LOGS"); @@ -832,26 +831,84 @@ void netlist_setup_t::start_devices() netlist().start(); } -void netlist_setup_t::print_stats() const +void setup_t::print_stats() const { #if (NL_KEEP_STATISTICS) { for (std::size_t i = 0; i < netlist().m_started_devices.size(); i++) { - netlist_core_device_t *entry = netlist().m_started_devices[i]; + core_device_t *entry = netlist().m_started_devices[i]; printf("Device %20s : %12d %12d %15ld\n", entry->name().cstr(), entry->stat_call_count, entry->stat_update_count, (long int) entry->stat_total_time / (entry->stat_update_count + 1)); } - printf("Queue Pushes %15d\n", m_netlist.queue().m_prof_call); - printf("Queue Moves %15d\n", m_netlist.queue().m_prof_sortmove); + printf("Queue Pushes %15d\n", netlist().queue().m_prof_call); + printf("Queue Moves %15d\n", netlist().queue().m_prof_sortmove); } #endif } // ---------------------------------------------------------------------------------------- +// Static +// ---------------------------------------------------------------------------------------- + +const pstring setup_t::model_value_str(const pstring &model_str, const pstring &entity, const pstring defval) +{ + pstring tmp = model_str; + // .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) + int p = tmp.ucase().find(entity.ucase() + "="); + if (p>=0) + { + int pblank = tmp.find(" ", p); + if (pblank < 0) pblank = tmp.len() + 1; + tmp = tmp.substr(p, pblank - p); + int pequal = tmp.find("=", 0); + if (pequal < 0) + fatalerror_e("parameter %s misformat in model %s temp %s\n", entity.cstr(), model_str.cstr(), tmp.cstr()); + tmp = tmp.substr(pequal+1); + return tmp; + } + else + { + //netlist().log("Entity %s not found in model %s\n", entity.cstr(), tmp.cstr()); + return defval; + } +} + +nl_double setup_t::model_value(const pstring &model_str, const pstring &entity, const nl_double defval) +{ + pstring tmp = model_value_str(model_str, entity, "NOTFOUND"); + + nl_double factor = NL_FCONST(1.0); + if (tmp != "NOTFOUND") + { + char numfac = *(tmp.right(1).cstr()); + switch (numfac) + { + case 'm': factor = 1e-3; break; + case 'u': factor = 1e-6; break; + case 'n': factor = 1e-9; break; + case 'p': factor = 1e-12; break; + case 'f': factor = 1e-15; break; + case 'a': factor = 1e-18; break; + default: + if (numfac < '0' || numfac > '9') + fatalerror_e("Unknown number factor <%c> in: %s", numfac, entity.cstr()); + } + if (factor != NL_FCONST(1.0)) + tmp = tmp.left(tmp.len() - 1); + return tmp.as_double() * factor; + } + else + { + //netlist().log("Entity %s not found in model %s\n", entity.cstr(), tmp.cstr()); + return defval; + } +} + +// ---------------------------------------------------------------------------------------- // Sources // ---------------------------------------------------------------------------------------- -void netlist_setup_t::include(const pstring &netlist_name) +void setup_t::include(const pstring &netlist_name) { for (std::size_t i=0; i < m_sources.size(); i++) { @@ -865,15 +922,15 @@ void netlist_setup_t::include(const pstring &netlist_name) // base sources // ---------------------------------------------------------------------------------------- -bool netlist_source_string_t::parse(netlist_setup_t *setup, const pstring name) +bool netlist_source_string_t::parse(setup_t *setup, const pstring name) { - netlist_parser p(*setup); + parser_t p(*setup); return p.parse(m_str, name); } -bool netlist_source_mem_t::parse(netlist_setup_t *setup, const pstring name) +bool netlist_source_mem_t::parse(setup_t *setup, const pstring name) { - netlist_parser p(*setup); + parser_t p(*setup); return p.parse(m_str, name); } diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h index c6e1180d19d..ddc26ba8390 100644 --- a/src/emu/netlist/nl_setup.h +++ b/src/emu/netlist/nl_setup.h @@ -50,15 +50,15 @@ #define NETLIST_NAME(_name) netlist ## _ ## _name #define NETLIST_EXTERNAL(_name) \ -ATTR_COLD void NETLIST_NAME(_name)(netlist::netlist_setup_t &setup) + ATTR_COLD void NETLIST_NAME(_name)(netlist::setup_t &setup); #define NETLIST_START(_name) \ -ATTR_COLD void NETLIST_NAME(_name)(netlist::netlist_setup_t &setup) \ +ATTR_COLD void NETLIST_NAME(_name)(netlist::setup_t &setup) \ { #define NETLIST_END() } -#define LOCAL_SOURCE(_name) \ - setup.register_source(palloc(netlist::netlist_source_proc_t, # _name, &NETLIST_NAME(_name))); +#define LOCAL_SOURCE(_name) \ + setup.register_source(palloc(netlist::source_proc_t, # _name, &NETLIST_NAME(_name))); #define INCLUDE(_name) \ setup.include(# _name); @@ -74,227 +74,231 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist::netlist_setup_t &setup) namespace netlist { + // Forward definition so we keep nl_factory.h out of the public + class factory_list_t; -// Forward definition so we keep nl_factory.h out of the public -class factory_list_t; - -class netlist_setup_t -{ - NETLIST_PREVENT_COPYING(netlist_setup_t) -public: - - // ---------------------------------------------------------------------------------------- - // A Generic netlist sources implementation - // ---------------------------------------------------------------------------------------- - - class source_t + class setup_t { + NETLIST_PREVENT_COPYING(setup_t) public: - typedef plist_t<source_t *> list_t; - source_t() - {} + // ---------------------------------------------------------------------------------------- + // A Generic netlist sources implementation + // ---------------------------------------------------------------------------------------- - virtual ~source_t() { } + class source_t + { + public: + typedef plist_t<source_t *> list_t; - virtual bool parse(netlist_setup_t *setup, const pstring name) = 0; - private: - }; + source_t() + {} - struct link_t - { - link_t() { } - link_t(void *) { } - // Copy constructor - link_t(const link_t &from) - { - e1 = from.e1; - e2 = from.e2; - } + virtual ~source_t() { } + + virtual bool parse(setup_t *setup, const pstring name) = 0; + private: + }; - link_t(const pstring &ae1, const pstring &ae2) + struct link_t { - e1 = ae1; - e2 = ae2; - } - pstring e1; - pstring e2; + link_t() { } + link_t(void *) { } + // Copy constructor + link_t(const link_t &from) + { + e1 = from.e1; + e2 = from.e2; + } - bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); } - link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; } + link_t(const pstring &ae1, const pstring &ae2) + { + e1 = ae1; + e2 = ae2; + } + pstring e1; + pstring e2; - const pstring &name() const { return e1; } - }; + bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); } + link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; } - typedef pnamedlist_t<link_t> tagmap_nstring_t; - typedef pnamedlist_t<netlist_param_t *> tagmap_param_t; - typedef pnamedlist_t<core_terminal_t *> tagmap_terminal_t; - typedef plist_t<link_t> tagmap_link_t; + const pstring &name() const { return e1; } + }; - netlist_setup_t(netlist_t *netlist); - ~netlist_setup_t(); + typedef pnamedlist_t<link_t> tagmap_nstring_t; + typedef pnamedlist_t<param_t *> tagmap_param_t; + typedef pnamedlist_t<core_terminal_t *> tagmap_terminal_t; + typedef plist_t<link_t> tagmap_link_t; - void init(); + setup_t(netlist_t *netlist); + ~setup_t(); - netlist_t &netlist() { return *m_netlist; } - const netlist_t &netlist() const { return *m_netlist; } + void init(); - pstring build_fqn(const pstring &obj_name) const; + netlist_t &netlist() { return *m_netlist; } + const netlist_t &netlist() const { return *m_netlist; } - device_t *register_dev(device_t *dev, const pstring &name); - device_t *register_dev(const pstring &classname, const pstring &name); - void remove_dev(const pstring &name); + pstring build_fqn(const pstring &obj_name) const; - void register_model(const pstring &model); - void register_alias(const pstring &alias, const pstring &out); - void register_alias_nofqn(const pstring &alias, const pstring &out); - void register_link_arr(const pstring &terms); - void register_link(const pstring &sin, const pstring &sout); - void register_param(const pstring ¶m, const pstring &value); - void register_param(const pstring ¶m, const double value); + device_t *register_dev(device_t *dev, const pstring &name); + device_t *register_dev(const pstring &classname, const pstring &name); + void remove_dev(const pstring &name); - void register_frontier(const pstring attach, const double r_IN, const double r_OUT); - void remove_connections(const pstring attach); + void register_model(const pstring &model); + void register_alias(const pstring &alias, const pstring &out); + void register_alias_nofqn(const pstring &alias, const pstring &out); + void register_link_arr(const pstring &terms); + void register_link(const pstring &sin, const pstring &sout); + void register_param(const pstring ¶m, const pstring &value); + void register_param(const pstring ¶m, const double value); - void register_object(device_t &dev, const pstring &name, object_t &obj); - bool connect(core_terminal_t &t1, core_terminal_t &t2); + void register_frontier(const pstring attach, const double r_IN, const double r_OUT); + void remove_connections(const pstring attach); - core_terminal_t *find_terminal(const pstring &outname_in, bool required = true); - core_terminal_t *find_terminal(const pstring &outname_in, object_t::type_t atype, bool required = true); + void register_object(device_t &dev, const pstring &name, object_t &obj); + bool connect(core_terminal_t &t1, core_terminal_t &t2); - netlist_param_t *find_param(const pstring ¶m_in, bool required = true); + core_terminal_t *find_terminal(const pstring &outname_in, bool required = true); + core_terminal_t *find_terminal(const pstring &outname_in, object_t::type_t atype, bool required = true); - void start_devices(); - void resolve_inputs(); + param_t *find_param(const pstring ¶m_in, bool required = true); - /* handle namespace */ + void start_devices(); + void resolve_inputs(); - void namespace_push(const pstring &aname); - void namespace_pop(); + /* handle namespace */ - /* parse a source */ + void namespace_push(const pstring &aname); + void namespace_pop(); - void include(const pstring &netlist_name); + /* parse a source */ - /* register a source */ + void include(const pstring &netlist_name); - void register_source(source_t *src) { m_sources.add(src); } + /* register a source */ - factory_list_t &factory() { return *m_factory; } - const factory_list_t &factory() const { return *m_factory; } + void register_source(source_t *src) { m_sources.add(src); } - /* not ideal, but needed for save_state */ - tagmap_terminal_t m_terminals; + factory_list_t &factory() { return *m_factory; } + const factory_list_t &factory() const { return *m_factory; } - void print_stats() const; + /* not ideal, but needed for save_state */ + tagmap_terminal_t m_terminals; -protected: + void print_stats() const; -private: + /* static support functions */ - netlist_t *m_netlist; + static const pstring model_value_str(const pstring &model_str, const pstring &entity, const pstring defval); + static nl_double model_value(const pstring &model_str, const pstring &entity, const nl_double defval); - tagmap_nstring_t m_alias; - tagmap_param_t m_params; - tagmap_link_t m_links; - tagmap_nstring_t m_params_temp; + protected: - factory_list_t *m_factory; + private: - plist_t<pstring> m_models; + netlist_t *m_netlist; - int m_proxy_cnt; + tagmap_nstring_t m_alias; + tagmap_param_t m_params; + tagmap_link_t m_links; + tagmap_nstring_t m_params_temp; - pstack_t<pstring> m_stack; - source_t::list_t m_sources; + factory_list_t *m_factory; + plist_t<pstring> m_models; - void connect_terminals(core_terminal_t &in, core_terminal_t &out); - void connect_input_output(core_terminal_t &in, core_terminal_t &out); - void connect_terminal_output(terminal_t &in, core_terminal_t &out); - void connect_terminal_input(terminal_t &term, core_terminal_t &inp); - bool connect_input_input(core_terminal_t &t1, core_terminal_t &t2); + int m_proxy_cnt; - // helpers - pstring objtype_as_astr(object_t &in) const; + pstack_t<pstring> m_stack; + source_t::list_t m_sources; - const pstring resolve_alias(const pstring &name) const; - devices::nld_base_proxy *get_d_a_proxy(core_terminal_t &out); - template <class T> - void remove_start_with(T &hm, pstring &sw) - { - for (std::size_t i = hm.size() - 1; i >= 0; i--) + void connect_terminals(core_terminal_t &in, core_terminal_t &out); + void connect_input_output(core_terminal_t &in, core_terminal_t &out); + void connect_terminal_output(terminal_t &in, core_terminal_t &out); + void connect_terminal_input(terminal_t &term, core_terminal_t &inp); + bool connect_input_input(core_terminal_t &t1, core_terminal_t &t2); + + // helpers + pstring objtype_as_astr(object_t &in) const; + + const pstring resolve_alias(const pstring &name) const; + devices::nld_base_proxy *get_d_a_proxy(core_terminal_t &out); + + template <class T> + void remove_start_with(T &hm, pstring &sw) { - pstring x = hm[i]->name(); - if (sw.equals(x.substr(0, sw.len()))) + for (std::size_t i = hm.size() - 1; i >= 0; i--) { - NL_VERBOSE_OUT(("removing %s\n", hm[i]->name().cstr())); - hm.remove(hm[i]); + pstring x = hm[i]->name(); + if (sw.equals(x.substr(0, sw.len()))) + { + NL_VERBOSE_OUT(("removing %s\n", hm[i]->name().cstr())); + hm.remove(hm[i]); + } } } - } -}; - -// ---------------------------------------------------------------------------------------- -// base sources -// ---------------------------------------------------------------------------------------- + }; + // ---------------------------------------------------------------------------------------- + // base sources + // ---------------------------------------------------------------------------------------- -class netlist_source_string_t : public netlist_setup_t::source_t -{ -public: - netlist_source_string_t(pstring source) - : netlist_setup_t::source_t(), m_str(source) + class netlist_source_string_t : public setup_t::source_t { - } + public: - bool parse(netlist_setup_t *setup, const pstring name); + netlist_source_string_t(pstring source) + : setup_t::source_t(), m_str(source) + { + } + + bool parse(setup_t *setup, const pstring name); -private: - pstring m_str; -}; + private: + pstring m_str; + }; -class netlist_source_mem_t : public netlist_setup_t::source_t -{ -public: - netlist_source_mem_t(const char *mem) - : netlist_setup_t::source_t(), m_str(mem) + class netlist_source_mem_t : public setup_t::source_t { - } + public: + netlist_source_mem_t(const char *mem) + : setup_t::source_t(), m_str(mem) + { + } - bool parse(netlist_setup_t *setup, const pstring name); -private: - pstring m_str; -}; + bool parse(setup_t *setup, const pstring name); + private: + pstring m_str; + }; -class netlist_source_proc_t : public netlist_setup_t::source_t -{ -public: - netlist_source_proc_t(pstring name, void (*setup_func)(netlist_setup_t &)) - : netlist_setup_t::source_t(), - m_setup_func(setup_func), - m_setup_func_name(name) + class source_proc_t : public setup_t::source_t { - } + public: + source_proc_t(pstring name, void (*setup_func)(setup_t &)) + : setup_t::source_t(), + m_setup_func(setup_func), + m_setup_func_name(name) + { + } - bool parse(netlist_setup_t *setup, const pstring name) - { - if (name == m_setup_func_name) + bool parse(setup_t *setup, const pstring name) { - m_setup_func(*setup); - return true; + if (name == m_setup_func_name) + { + m_setup_func(*setup); + return true; + } + else + return false; } - else - return false; - } -private: - void (*m_setup_func)(netlist_setup_t &); - pstring m_setup_func_name; -}; + private: + void (*m_setup_func)(setup_t &); + pstring m_setup_func_name; + }; } diff --git a/src/emu/netlist/nl_time.h b/src/emu/netlist/nl_time.h index f5005af40fd..4473b67d2c8 100644 --- a/src/emu/netlist/nl_time.h +++ b/src/emu/netlist/nl_time.h @@ -25,105 +25,110 @@ #define RESOLUTION NETLIST_INTERNAL_RES -struct netlist_time +namespace netlist { -public: + struct netlist_time + { + public: - typedef UINT64 INTERNALTYPE; + typedef UINT64 INTERNALTYPE; - ATTR_HOT /* inline */ netlist_time() : m_time(0) {} + ATTR_HOT /* inline */ netlist_time() : m_time(0) {} - ATTR_HOT friend /* inline */ const netlist_time operator-(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ const netlist_time operator+(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ const netlist_time operator*(const netlist_time &left, const UINT32 factor); - ATTR_HOT friend /* inline */ UINT32 operator/(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator>(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator<(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator>=(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator<=(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator!=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ const netlist_time operator-(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ const netlist_time operator+(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ const netlist_time operator*(const netlist_time &left, const UINT32 factor); + ATTR_HOT friend /* inline */ UINT32 operator/(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ bool operator>(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ bool operator<(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ bool operator>=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ bool operator<=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend /* inline */ bool operator!=(const netlist_time &left, const netlist_time &right); - ATTR_HOT /* inline */ const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; } - ATTR_HOT /* inline */ const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; } + ATTR_HOT /* inline */ const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; } + ATTR_HOT /* inline */ const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; } - // issues with ISO C++ standard - //ATTR_HOT /* inline */ operator double() const { return as_double(); } + // issues with ISO C++ standard + //ATTR_HOT /* inline */ operator double() const { return as_double(); } - ATTR_HOT /* inline */ const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; } + ATTR_HOT /* inline */ const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; } - ATTR_HOT /* inline */ INTERNALTYPE as_raw() const { return m_time; } - ATTR_HOT /* inline */ double as_double() const { return (double) m_time / (double) RESOLUTION; } + ATTR_HOT /* inline */ INTERNALTYPE as_raw() const { return m_time; } + ATTR_HOT /* inline */ double as_double() const { return (double) m_time / (double) RESOLUTION; } - // for save states .... - ATTR_HOT /* inline */ INTERNALTYPE *get_internaltype_ptr() { return &m_time; } + // for save states .... + ATTR_HOT /* inline */ INTERNALTYPE *get_internaltype_ptr() { return &m_time; } - ATTR_HOT static /* inline */ const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); } - ATTR_HOT static /* inline */ const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); } - ATTR_HOT static /* inline */ const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); } - ATTR_HOT static /* inline */ const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); } - ATTR_HOT static /* inline */ const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); } - ATTR_HOT static /* inline */ const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); } + ATTR_HOT static /* inline */ const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); } + ATTR_HOT static /* inline */ const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); } + ATTR_HOT static /* inline */ const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); } + ATTR_HOT static /* inline */ const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); } + ATTR_HOT static /* inline */ const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); } + ATTR_HOT static /* inline */ const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); } - static const netlist_time zero; + static const netlist_time zero; -protected: + protected: - ATTR_HOT /* inline */ netlist_time(const INTERNALTYPE val) : m_time(val) {} + ATTR_HOT /* inline */ netlist_time(const INTERNALTYPE val) : m_time(val) {} -private: - INTERNALTYPE m_time; -}; + private: + INTERNALTYPE m_time; + }; -#undef RESOLUTION + #undef RESOLUTION -template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname) -{ - save_state_ptr(stname, DT_INT64, owner, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr(), false); -} + ATTR_HOT inline const netlist_time operator-(const netlist_time &left, const netlist_time &right) + { + return netlist_time::from_raw(left.m_time - right.m_time); + } -ATTR_HOT inline const netlist_time operator-(const netlist_time &left, const netlist_time &right) -{ - return netlist_time::from_raw(left.m_time - right.m_time); -} + ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT32 factor) + { + return netlist_time::from_raw(left.m_time * factor); + } -ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT32 factor) -{ - return netlist_time::from_raw(left.m_time * factor); -} + ATTR_HOT inline UINT32 operator/(const netlist_time &left, const netlist_time &right) + { + return left.m_time / right.m_time; + } -ATTR_HOT inline UINT32 operator/(const netlist_time &left, const netlist_time &right) -{ - return left.m_time / right.m_time; -} + ATTR_HOT inline const netlist_time operator+(const netlist_time &left, const netlist_time &right) + { + return netlist_time::from_raw(left.m_time + right.m_time); + } -ATTR_HOT inline const netlist_time operator+(const netlist_time &left, const netlist_time &right) -{ - return netlist_time::from_raw(left.m_time + right.m_time); -} + ATTR_HOT inline bool operator<(const netlist_time &left, const netlist_time &right) + { + return (left.m_time < right.m_time); + } -ATTR_HOT inline bool operator<(const netlist_time &left, const netlist_time &right) -{ - return (left.m_time < right.m_time); -} + ATTR_HOT inline bool operator>(const netlist_time &left, const netlist_time &right) + { + return (left.m_time > right.m_time); + } -ATTR_HOT inline bool operator>(const netlist_time &left, const netlist_time &right) -{ - return (left.m_time > right.m_time); -} + ATTR_HOT inline bool operator<=(const netlist_time &left, const netlist_time &right) + { + return (left.m_time <= right.m_time); + } -ATTR_HOT inline bool operator<=(const netlist_time &left, const netlist_time &right) -{ - return (left.m_time <= right.m_time); -} + ATTR_HOT inline bool operator>=(const netlist_time &left, const netlist_time &right) + { + return (left.m_time >= right.m_time); + } + + ATTR_HOT inline bool operator!=(const netlist_time &left, const netlist_time &right) + { + return (left.m_time != right.m_time); + } -ATTR_HOT inline bool operator>=(const netlist_time &left, const netlist_time &right) -{ - return (left.m_time >= right.m_time); } -ATTR_HOT inline bool operator!=(const netlist_time &left, const netlist_time &right) +template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist::netlist_time &nlt, const void *owner, const pstring &stname) { - return (left.m_time != right.m_time); + save_state_ptr(stname, DT_INT64, owner, sizeof(netlist::netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr(), false); } + #endif /* NLTIME_H_ */ diff --git a/src/emu/netlist/plib/pconfig.h b/src/emu/netlist/plib/pconfig.h index cfb4fe8fb60..1918ec61fb6 100644 --- a/src/emu/netlist/plib/pconfig.h +++ b/src/emu/netlist/plib/pconfig.h @@ -145,10 +145,10 @@ public: // construct from any member function pointer class generic_class; typedef void (*generic_function)(); - + #if (PSTANDALONE) typedef std::size_t FPTR; - #endif + #endif template<typename _MemberFunctionType> pmfp(_MemberFunctionType mfp) diff --git a/src/emu/netlist/plib/plists.h b/src/emu/netlist/plib/plists.h index fbc839b3757..0f71a35c9e4 100644 --- a/src/emu/netlist/plib/plists.h +++ b/src/emu/netlist/plib/plists.h @@ -97,7 +97,7 @@ public: plist_t() : std::vector<_ListClass>() {} plist_t(const int numElements) : std::vector<_ListClass>(numElements) {} - void add(const _ListClass &elem) { this->push_back(elem); } + void add(const _ListClass &elem) { this->push_back(elem); } void clear_and_free() { for (_ListClass *i = this->data(); i < this->data() + this->size(); i++) @@ -106,7 +106,7 @@ public: } this->clear(); } - bool contains(const _ListClass &elem) const + bool contains(const _ListClass &elem) const { for (const _ListClass *i = this->data(); i < this->data() + this->size(); i++) { @@ -116,7 +116,7 @@ public: return false; } - void remove(const _ListClass &elem) + void remove(const _ListClass &elem) { for (int i = 0; i < this->size(); i++) { @@ -127,12 +127,12 @@ public: } } } - void remove_at(const int pos) + void remove_at(const int pos) { this->erase(this->begin() + pos); } - int indexof(const _ListClass &elem) const + int indexof(const _ListClass &elem) const { for (int i = 0; i < this->size(); i++) { @@ -218,6 +218,20 @@ public: m_list[m_count++] = elem; } + ATTR_HOT void insert_at(const _ListClass &elem, const std::size_t index) + { + if (m_count >= m_capacity){ + std::size_t new_size = m_capacity * 2; + if (new_size < 32) + new_size = 32; + set_capacity(new_size); + } + for (std::size_t i = m_count; i>index; i--) + m_list[i] = m_list[i-1]; + m_list[index] = elem; + m_count++; + } + ATTR_HOT void remove(const _ListClass &elem) { for (std::size_t i = 0; i < m_count; i++) @@ -525,7 +539,6 @@ public: pstring_list_t(const pstring &str, const pstring &onstr, bool ignore_empty = false) : plist_t<pstring>() { - int p = 0; int pn; @@ -593,9 +606,9 @@ static inline void psort_list(Class &sl) { for(int i = 0; i < (int) sl.size() - 1; i++) { - for(int j = i + 1; j < sl.size(); j++) - if(sl[i] > sl[j]) - std::swap(sl[i], sl[j]); + for(int j = i + 1; j < sl.size(); j++) + if(sl[i] > sl[j]) + std::swap(sl[i], sl[j]); } } diff --git a/src/emu/netlist/plib/pstate.h b/src/emu/netlist/plib/pstate.h index 27e0ea08ebb..6e745b7de91 100644 --- a/src/emu/netlist/plib/pstate.h +++ b/src/emu/netlist/plib/pstate.h @@ -37,7 +37,7 @@ enum pstate_data_type_e { DT_INT8, DT_INT, DT_BOOLEAN, - DT_FLOAT + DT_FLOAT, }; template<typename _ItemType> struct nl_datatype @@ -70,7 +70,6 @@ NETLIST_SAVE_TYPE(UINT32, DT_INT); NETLIST_SAVE_TYPE(INT32, DT_INT); NETLIST_SAVE_TYPE(UINT16, DT_INT16); NETLIST_SAVE_TYPE(INT16, DT_INT16); -//NETLIST_SAVE_TYPE(netlist_time::INTERNALTYPE, DT_INT64); //NETLIST_SAVE_TYPE(std::size_t, DT_INT64); class pstate_manager_t; diff --git a/src/emu/netlist/solver/mat_cr.h b/src/emu/netlist/solver/mat_cr.h new file mode 100644 index 00000000000..b4836f4c893 --- /dev/null +++ b/src/emu/netlist/solver/mat_cr.h @@ -0,0 +1,135 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * mat_cr.h + * + * Compressed row format matrices + * + */ + +#ifndef MAT_CR_H_ +#define MAT_CR_H_ + +#include <algorithm> +#include "../plib/pconfig.h" + +template<int _storage_N> +struct mat_cr_t +{ + unsigned nz_num; + unsigned ia[_storage_N + 1]; + unsigned ja[_storage_N * _storage_N]; + unsigned diag[_storage_N]; /* n */ + + void mult_vec(const double * RESTRICT A, const double * RESTRICT x, double * RESTRICT res) + { + /* + * res = A * x + */ + + unsigned i = 0; + unsigned k = 0; + const unsigned oe = nz_num; + + while (k < oe) + { + double tmp = 0.0; + const unsigned e = ia[i+1]; + for (; k < e; k++) + tmp += A[k] * x[ja[k]]; + res[i++] = tmp; + } + } + + void incomplete_LU_factorization(const double * RESTRICT A, double * RESTRICT LU) + { + /* + * incomplete LU Factorization according to http://de.wikipedia.org/wiki/ILU-Zerlegung + * + * Result is stored in matrix LU + * + */ + + const unsigned lnz = nz_num; + + for (unsigned k = 0; k < lnz; k++) + LU[k] = A[k]; + + for (unsigned i = 1; ia[i] < lnz; i++) // row i + { + const unsigned iai1 = ia[i + 1]; + for (unsigned pk = ia[i]; pk < diag[i]; pk++) // all columns left of diag in row i + { + // pk == (i, k) + const unsigned k = ja[pk]; + const unsigned iak1 = ia[k + 1]; + const double LUpk = LU[pk] = LU[pk] / LU[diag[k]]; + + unsigned pt = ia[k]; + + for (unsigned pj = pk + 1; pj < iai1; pj++) // pj = (i, j) + { + // we can assume that within a row ja increases continuously */ + const unsigned ej = ja[pj]; + while (ja[pt] < ej && pt < iak1) + pt++; + if (pt < iak1 && ja[pt] == ej) + LU[pj] = LU[pj] - LUpk * LU[pt]; + } + } + } + } + + void solveLUx (const double * RESTRICT LU, double * RESTRICT r) + { + /* + * Solve a linear equation Ax = r + * where + * A = L*U + * + * L unit lower triangular + * U upper triangular + * + * ==> LUx = r + * + * ==> Ux = L⁻¹r = w + * + * ==> r = Lw + * + * This can be solved for w using backwards elimination in L. + * + * Now Ux = w + * + * This can be solved for x using backwards elimination in U. + * + */ + + unsigned i; + + for (i = 1; ia[i] < nz_num; i++ ) + { + double tmp = 0.0; + const unsigned j1 = ia[i]; + const unsigned j2 = diag[i]; + + for (unsigned j = j1; j < j2; j++ ) + tmp += LU[j] * r[ja[j]]; + + r[i] -= tmp; + } + // i now is equal to n; + for (; 0 < i; i-- ) + { + const unsigned im1 = i - 1; + double tmp = 0.0; + const unsigned j1 = diag[im1] + 1; + const unsigned j2 = ia[im1+1]; + for (int j = j1; j < j2; j++ ) + tmp += LU[j] * r[ja[j]]; + r[im1] = (r[im1] - tmp) / LU[diag[im1]]; + } + } + +}; + +#endif /* MAT_CR_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/solver/nld_ms_direct.h index 80a4c1f8781..e9acd1d2415 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/solver/nld_ms_direct.h @@ -10,22 +10,22 @@ #include <algorithm> -#include "nld_solver.h" +#include "../solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() template <unsigned m_N, unsigned _storage_N> -class netlist_matrix_solver_direct_t: public netlist_matrix_solver_t +class matrix_solver_direct_t: public matrix_solver_t { public: - netlist_matrix_solver_direct_t(const netlist_solver_parameters_t *params, const int size); - netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t *params, const int size); + matrix_solver_direct_t(const solver_parameters_t *params, const int size); + matrix_solver_direct_t(const eSolverType type, const solver_parameters_t *params, const int size); - virtual ~netlist_matrix_solver_direct_t(); + virtual ~matrix_solver_direct_t(); virtual void vsetup(analog_net_t::list_t &nets); - virtual void reset() { netlist_matrix_solver_t::reset(); } + virtual void reset() { matrix_solver_t::reset(); } ATTR_HOT inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } @@ -65,11 +65,11 @@ private: }; // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver_direct +// matrix_solver_direct // ---------------------------------------------------------------------------------------- template <unsigned m_N, unsigned _storage_N> -netlist_matrix_solver_direct_t<m_N, _storage_N>::~netlist_matrix_solver_direct_t() +matrix_solver_direct_t<m_N, _storage_N>::~matrix_solver_direct_t() { for (unsigned k = 0; k < N(); k++) { @@ -80,7 +80,7 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::~netlist_matrix_solver_direct_t } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep() +ATTR_HOT nl_double matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep() { nl_double new_solver_timestep = m_params.m_max_timestep; @@ -119,24 +119,24 @@ ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next } template <unsigned m_N, unsigned _storage_N> -ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::add_term(int k, terminal_t *term) +ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::add_term(int k, terminal_t *term) { if (term->m_otherterm->net().isRailNet()) { - m_rails_temp[k].add(term, -1); + m_rails_temp[k].add(term, -1, false); } else { int ot = get_net_idx(&term->m_otherterm->net()); if (ot>=0) { - m_terms[k]->add(term, ot); + m_terms[k]->add(term, ot, true); SOLVER_VERBOSE_OUT(("Net %d Term %s %f %f\n", k, terms[i]->name().cstr(), terms[i]->m_gt, terms[i]->m_go)); } /* Should this be allowed ? */ else // if (ot<0) { - m_rails_temp[k].add(term, ot); + m_rails_temp[k].add(term, ot, true); netlist().error("found term with missing othernet %s\n", term->name().cstr()); } } @@ -144,7 +144,7 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::add_term(int k, template <unsigned m_N, unsigned _storage_N> -ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) +ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) { if (m_dim < nets.size()) netlist().error("Dimension %d less than %" SIZETFMT, m_dim, nets.size()); @@ -155,13 +155,13 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_ne m_rails_temp[k].clear(); } - netlist_matrix_solver_t::setup(nets); + matrix_solver_t::setup(nets); for (unsigned k = 0; k < N(); k++) { m_terms[k]->m_railstart = m_terms[k]->count(); for (unsigned i = 0; i < m_rails_temp[k].count(); i++) - this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i]); + this->m_terms[k]->add(m_rails_temp[k].terms()[i], m_rails_temp[k].net_other()[i], false); m_rails_temp[k].clear(); // no longer needed m_terms[k]->set_pointers(); @@ -250,7 +250,7 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_ne } psort_list(t->m_nzrd); - t->m_nz.add(k); // add diagonal + t->m_nz.add(k); // add diagonal psort_list(t->m_nz); } @@ -283,7 +283,7 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_ne template <unsigned m_N, unsigned _storage_N> -ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE_A() +ATTR_HOT void matrix_solver_direct_t<m_N, _storage_N>::build_LE_A() { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -309,7 +309,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE_A() } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE_RHS(nl_double * RESTRICT rhs) +ATTR_HOT void matrix_solver_direct_t<m_N, _storage_N>::build_LE_RHS(nl_double * RESTRICT rhs) { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -334,7 +334,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE_RHS(nl_d } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_solve() +ATTR_HOT void matrix_solver_direct_t<m_N, _storage_N>::LE_solve() { #if 0 for (int i = 0; i < N(); i++) @@ -388,8 +388,8 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_solve() /* The code below is 30% faster than the original * implementation which is given here for reference. * - * for (unsigned k = i + 1; k < kN; k++) - * m_A[j][k] = m_A[j][k] + m_A[i][k] * f1; + * for (unsigned k = i + 1; k < kN; k++) + * m_A[j][k] = m_A[j][k] + m_A[i][k] * f1; */ double * RESTRICT d = &m_A[j][i+1]; const double * RESTRICT s = &m_A[i][i+1]; @@ -411,7 +411,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_solve() } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst( +ATTR_HOT void matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst( nl_double * RESTRICT x) { const unsigned kN = N(); @@ -459,7 +459,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst( } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta( +ATTR_HOT nl_double matrix_solver_direct_t<m_N, _storage_N>::delta( const nl_double * RESTRICT V) { /* FIXME: Ideally we should also include currents (RHS) here. This would @@ -475,7 +475,7 @@ ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta( } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store( +ATTR_HOT void matrix_solver_direct_t<m_N, _storage_N>::store( const nl_double * RESTRICT V) { for (unsigned i = 0, iN=N(); i < iN; i++) @@ -485,7 +485,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store( } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve() +ATTR_HOT nl_double matrix_solver_direct_t<m_N, _storage_N>::vsolve() { this->solve_base(this); return this->compute_next_timestep(); @@ -493,7 +493,7 @@ ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve() template <unsigned m_N, unsigned _storage_N> -ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +ATTR_HOT int matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { nl_double new_v[_storage_N]; // = { 0.0 }; @@ -515,7 +515,7 @@ ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic( } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT inline int netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) +ATTR_HOT inline int matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) { this->build_LE_A(); this->build_LE_RHS(m_last_RHS); @@ -529,8 +529,8 @@ ATTR_HOT inline int netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_ } template <unsigned m_N, unsigned _storage_N> -netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t(const netlist_solver_parameters_t *params, const int size) -: netlist_matrix_solver_t(GAUSSIAN_ELIMINATION, params) +matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const solver_parameters_t *params, const int size) +: matrix_solver_t(GAUSSIAN_ELIMINATION, params) , m_dim(size) , m_lp_fact(0) { @@ -546,8 +546,8 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( } template <unsigned m_N, unsigned _storage_N> -netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t *params, const int size) -: netlist_matrix_solver_t(type, params) +matrix_solver_direct_t<m_N, _storage_N>::matrix_solver_direct_t(const eSolverType type, const solver_parameters_t *params, const int size) +: matrix_solver_t(type, params) , m_dim(size) , m_lp_fact(0) { diff --git a/src/emu/netlist/analog/nld_ms_direct1.h b/src/emu/netlist/solver/nld_ms_direct1.h index d122f1d63a6..d2009846053 100644 --- a/src/emu/netlist/analog/nld_ms_direct1.h +++ b/src/emu/netlist/solver/nld_ms_direct1.h @@ -8,17 +8,17 @@ #ifndef NLD_MS_DIRECT1_H_ #define NLD_MS_DIRECT1_H_ -#include "nld_solver.h" -#include "nld_ms_direct.h" +#include "../solver/nld_ms_direct.h" +#include "../solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() -class netlist_matrix_solver_direct1_t: public netlist_matrix_solver_direct_t<1,1> +class matrix_solver_direct1_t: public matrix_solver_direct_t<1,1> { public: - netlist_matrix_solver_direct1_t(const netlist_solver_parameters_t *params) - : netlist_matrix_solver_direct_t<1, 1>(params, 1) + matrix_solver_direct1_t(const solver_parameters_t *params) + : matrix_solver_direct_t<1, 1>(params, 1) {} ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); protected: @@ -27,16 +27,16 @@ private: }; // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Direct1 +// matrix_solver - Direct1 // ---------------------------------------------------------------------------------------- -ATTR_HOT nl_double netlist_matrix_solver_direct1_t::vsolve() +ATTR_HOT nl_double matrix_solver_direct1_t::vsolve() { - solve_base<netlist_matrix_solver_direct1_t>(this); + solve_base<matrix_solver_direct1_t>(this); return this->compute_next_timestep(); } -ATTR_HOT inline int netlist_matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +ATTR_HOT inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { analog_net_t *net = m_nets[0]; this->build_LE_A(); diff --git a/src/emu/netlist/analog/nld_ms_direct2.h b/src/emu/netlist/solver/nld_ms_direct2.h index 6a5d452523a..79f9e55d908 100644 --- a/src/emu/netlist/analog/nld_ms_direct2.h +++ b/src/emu/netlist/solver/nld_ms_direct2.h @@ -8,17 +8,17 @@ #ifndef NLD_MS_DIRECT2_H_ #define NLD_MS_DIRECT2_H_ -#include "nld_solver.h" -#include "nld_ms_direct.h" +#include "../solver/nld_ms_direct.h" +#include "../solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() -class netlist_matrix_solver_direct2_t: public netlist_matrix_solver_direct_t<2,2> +class matrix_solver_direct2_t: public matrix_solver_direct_t<2,2> { public: - netlist_matrix_solver_direct2_t(const netlist_solver_parameters_t *params) - : netlist_matrix_solver_direct_t<2, 2>(params, 2) + matrix_solver_direct2_t(const solver_parameters_t *params) + : matrix_solver_direct_t<2, 2>(params, 2) {} ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); protected: @@ -27,16 +27,16 @@ private: }; // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Direct2 +// matrix_solver - Direct2 // ---------------------------------------------------------------------------------------- -ATTR_HOT nl_double netlist_matrix_solver_direct2_t::vsolve() +ATTR_HOT nl_double matrix_solver_direct2_t::vsolve() { - solve_base<netlist_matrix_solver_direct2_t>(this); + solve_base<matrix_solver_direct2_t>(this); return this->compute_next_timestep(); } -ATTR_HOT inline int netlist_matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +ATTR_HOT inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { build_LE_A(); build_LE_RHS(m_RHS); diff --git a/src/emu/netlist/solver/nld_ms_gmres.h b/src/emu/netlist/solver/nld_ms_gmres.h new file mode 100644 index 00000000000..bc35f0a50ce --- /dev/null +++ b/src/emu/netlist/solver/nld_ms_gmres.h @@ -0,0 +1,426 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_ms_sor.h + * + * Generic successive over relaxation solver. + * + * Fow w==1 we will do the classic Gauss-Seidel approach + * + */ + +#ifndef NLD_MS_GMRES_H_ +#define NLD_MS_GMRES_H_ + +#include <algorithm> + +#include "../solver/mat_cr.h" +#include "../solver/nld_ms_direct.h" +#include "../solver/nld_solver.h" +#include "../solver/vector_base.h" + +NETLIB_NAMESPACE_DEVICES_START() + +template <unsigned m_N, unsigned _storage_N> +class matrix_solver_GMRES_t: public matrix_solver_direct_t<m_N, _storage_N> +{ +public: + + matrix_solver_GMRES_t(const solver_parameters_t *params, int size) + : matrix_solver_direct_t<m_N, _storage_N>(matrix_solver_t::GAUSS_SEIDEL, params, size) + , m_use_iLU_preconditioning(true) + , m_use_more_precise_stop_condition(false) + , m_accuracy_mult(1.0) + { + int mr=this->N(); /* FIXME: maximum iterations locked in here */ + + for (int i = 0; i < mr; i++) + m_ht[i] = new double[mr + 1]; + + for (int i = 0; i < this->N(); i++) + m_v[i] = new double[_storage_N]; + + } + + virtual ~matrix_solver_GMRES_t() + { + int mr=this->N(); /* FIXME: maximum iterations locked in here */ + + for (int i = 0; i < mr; i++) + delete[] m_ht[i]; + + for (int i = 0; i < this->N(); i++) + delete[] m_v[i]; + } + + virtual void vsetup(analog_net_t::list_t &nets); + ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson); +protected: + ATTR_HOT virtual nl_double vsolve(); + +private: + + int solve_ilu_gmres(double * RESTRICT x, double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, double accuracy); + + plist_t<int> m_term_cr[_storage_N]; + + bool m_use_iLU_preconditioning; + bool m_use_more_precise_stop_condition; + + mat_cr_t<_storage_N> mat; + + double m_A[_storage_N * _storage_N]; + double m_LU[_storage_N * _storage_N]; + + double m_c[_storage_N + 1]; /* mr + 1 */ + double m_g[_storage_N + 1]; /* mr + 1 */ + double * RESTRICT m_ht[_storage_N]; /* mr, (mr + 1) */ + double m_s[_storage_N]; /* mr + 1 */ + double * RESTRICT m_v[_storage_N + 1]; /*(mr + 1), n */ + //double m_y[_storage_N]; /* mr + 1 */ + + double m_accuracy_mult; // FXIME: Save state +}; + +// ---------------------------------------------------------------------------------------- +// matrix_solver - GMRES +// ---------------------------------------------------------------------------------------- + +template <unsigned m_N, unsigned _storage_N> +void matrix_solver_GMRES_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) +{ + matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); + + int nz = 0; + const int iN = this->N(); + + for (unsigned k=0; k<iN; k++) + { + terms_t * RESTRICT row = this->m_terms[k]; + mat.ia[k] = nz; + + for (unsigned j=0; j<row->m_nz.size(); j++) + { + mat.ja[nz] = row->m_nz[j]; + if (row->m_nz[j] == k) + mat.diag[k] = nz; + nz++; + } + + /* build pointers into the compressed row format matrix for each terminal */ + + for (int j=0; j< this->m_terms[k]->m_railstart;j++) + { + for (int i = mat.ia[k]; i<nz; i++) + if (this->m_terms[k]->net_other()[j] == mat.ja[i]) + { + m_term_cr[k].add(i); + break; + } + nl_assert(m_term_cr[k].size() == this->m_terms[k]->m_railstart); + } + } + + mat.ia[iN] = nz; + mat.nz_num = nz; +} + +template <unsigned m_N, unsigned _storage_N> +ATTR_HOT nl_double matrix_solver_GMRES_t<m_N, _storage_N>::vsolve() +{ + this->solve_base(this); + return this->compute_next_timestep(); +} + +template <unsigned m_N, unsigned _storage_N> +ATTR_HOT inline int matrix_solver_GMRES_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) +{ + const int iN = this->N(); + + /* ideally, we could get an estimate for the spectral radius of + * Inv(D - L) * U + * + * and estimate using + * + * omega = 2.0 / (1.0 + nl_math::sqrt(1-rho)) + */ + + //nz_num = 0; + ATTR_ALIGN nl_double RHS[_storage_N]; + ATTR_ALIGN nl_double new_V[_storage_N]; + ATTR_ALIGN nl_double l_V[_storage_N]; + + for (int i=0, e=mat.nz_num; i<e; i++) + m_A[i] = 0.0; + + for (int k = 0; k < iN; k++) + { + nl_double gtot_t = 0.0; + nl_double RHS_t = 0.0; + + const int term_count = this->m_terms[k]->count(); + const int railstart = this->m_terms[k]->m_railstart; + const nl_double * const RESTRICT gt = this->m_terms[k]->gt(); + const nl_double * const RESTRICT go = this->m_terms[k]->go(); + const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); + const nl_double * const * RESTRICT other_cur_analog = this->m_terms[k]->other_curanalog(); + + l_V[k] = new_V[k] = this->m_nets[k]->m_cur_Analog; + for (unsigned i = 0; i < term_count; i++) + { + gtot_t = gtot_t + gt[i]; + RHS_t = RHS_t + Idr[i]; + } + + for (unsigned i = railstart; i < term_count; i++) + RHS_t = RHS_t + go[i] * *other_cur_analog[i]; + + RHS[k] = RHS_t; + + // add diagonal element + m_A[mat.diag[k]] = gtot_t; + + for (unsigned i = 0; i < railstart; i++) + { + const unsigned pi = m_term_cr[k][i]; + m_A[pi] -= go[i]; + } + } + mat.ia[iN] = mat.nz_num; + + const nl_double accuracy = this->m_params.m_accuracy; +#if 1 + int mr = std::min(iN-1,(int) sqrt(iN)); + mr = std::min(mr, this->m_params.m_gs_loops); + int iter = 4; + int gsl = solve_ilu_gmres(new_V, RHS, iter, mr, accuracy); + int failed = mr * iter; +#else + int failed = 6; + //int gsl = tt_ilu_cr(new_V, RHS, failed, accuracy); + int gsl = tt_gs_cr(new_V, RHS, failed, accuracy); +#endif + this->m_iterative_total += gsl; + this->m_stat_calculations++; + + if (gsl>=failed) + { + //for (int k = 0; k < iN; k++) + // this->m_nets[k]->m_cur_Analog = new_V[k]; + // Fallback to direct solver ... + this->m_iterative_fail++; + return matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(newton_raphson); + } + + if (newton_raphson) + { + double err = 0; + for (unsigned k = 0; k < iN; k++) + err = std::max(nl_math::abs(l_V[k] - new_V[k]), err); + + //printf("here %s\n", this->name().cstr()); + for (unsigned k = 0; k < iN; k++) + this->m_nets[k]->m_cur_Analog += 1.0 * (new_V[k] - this->m_nets[k]->m_cur_Analog); + if (err > accuracy) + return 2; + else + return 1; + } + else + { + for (int k = 0; k < iN; k++) + this->m_nets[k]->m_cur_Analog = new_V[k]; + return 1; + } +} + +static inline void givens_mult( const double c, const double s, double * RESTRICT g0, double * RESTRICT g1 ) +{ + const double tg0 = c * *g0 - s * *g1; + const double tg1 = s * *g0 + c * *g1; + + *g0 = tg0; + *g1 = tg1; +} + +template <unsigned m_N, unsigned _storage_N> +int matrix_solver_GMRES_t<m_N, _storage_N>::solve_ilu_gmres (double * RESTRICT x, double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, double accuracy) +{ + /*------------------------------------------------------------------------- + * The code below was inspired by code published by John Burkardt under + * the LPGL here: + * + * http://people.sc.fsu.edu/~jburkardt/cpp_src/mgmres/mgmres.html + * + * The code below was completely written from scratch based on the pseudo code + * found here: + * + * http://de.wikipedia.org/wiki/GMRES-Verfahren + * + * The Algorithm itself is described in + * + * Yousef Saad, + * Iterative Methods for Sparse Linear Systems, + * Second Edition, + * SIAM, 20003, + * ISBN: 0898715342, + * LC: QA188.S17. + * + *------------------------------------------------------------------------*/ + + unsigned itr_used = 0; + double rho_delta = 0.0; + + const unsigned n = this->N(); + + if (m_use_iLU_preconditioning) + mat.incomplete_LU_factorization(m_A, m_LU); + + if (m_use_more_precise_stop_condition) + { + /* derive residual for a given delta x + * + * LU y = A dx + * + * ==> rho / accuracy = sqrt(y * y) + * + * This approach will approximate the iterative stop condition + * based |xnew - xold| pretty precisely. But it is slow, or expressed + * differently: The invest doesn't pay off. + * Therefore we use the approach in the else part. + */ + double t[_storage_N]; + double Ax[_storage_N]; + vec_set(n, accuracy, t); + mat.mult_vec(m_A, t, Ax); + mat.solveLUx(m_LU, Ax); + + const double rho_to_accuracy = std::sqrt(vecmult2(n, Ax)) / accuracy; + + //printf("rho/accuracy = %f\n", rho_to_accuracy); + + rho_delta = accuracy * rho_to_accuracy; + } + else + rho_delta = accuracy * std::sqrt((double) n) * m_accuracy_mult; + + for (unsigned itr = 0; itr < restart_max; itr++) + { + unsigned last_k = mr; + double mu; + double rho; + + double Ax[_storage_N]; + double residual[_storage_N]; + + mat.mult_vec(m_A, x, Ax); + + vec_sub(n, rhs, Ax, residual); + + if (m_use_iLU_preconditioning) + { + mat.solveLUx(m_LU, residual); + } + + rho = std::sqrt(vecmult2(n, residual)); + + vec_mult_scalar(n, residual, 1.0 / rho, m_v[0]); + + vec_set(mr+1, 0.0, m_g); + m_g[0] = rho; + + for (unsigned i = 0; i < mr; i++) + vec_set(mr + 1, 0.0, m_ht[i]); + + for (unsigned k = 0; k < mr; k++) + { + const unsigned k1 = k + 1; + + mat.mult_vec(m_A, m_v[k], m_v[k1]); + + if (m_use_iLU_preconditioning) + mat.solveLUx(m_LU, m_v[k1]); + + for (unsigned j = 0; j <= k; j++) + { + m_ht[j][k] = vecmult(n, m_v[k1], m_v[j]); + vec_add_mult_scalar(n, m_v[j], -m_ht[j][k], m_v[k1]); + } + m_ht[k1][k] = std::sqrt(vecmult2(n, m_v[k1])); + + if (m_ht[k1][k] != 0.0) + vec_scale(n, m_v[k1], 1.0 / m_ht[k1][k]); + + for (unsigned j = 0; j < k; j++) + givens_mult(m_c[j], m_s[j], &m_ht[j][k], &m_ht[j+1][k]); + + mu = std::sqrt(std::pow(m_ht[k][k], 2) + std::pow(m_ht[k1][k], 2)); + + m_c[k] = m_ht[k][k] / mu; + m_s[k] = -m_ht[k1][k] / mu; + m_ht[k][k] = m_c[k] * m_ht[k][k] - m_s[k] * m_ht[k1][k]; + m_ht[k1][k] = 0.0; + + givens_mult(m_c[k], m_s[k], &m_g[k], &m_g[k1]); + + rho = std::abs(m_g[k1]); + + itr_used = itr_used + 1; + + if (rho <= rho_delta) + { + last_k = k; + break; + } + } + + if (last_k >= mr) + /* didn't converge within accuracy */ + last_k = mr - 1; + + double m_y[_storage_N]; + + /* Solve the system H * y = g */ + /* x += m_v[j] * m_y[j] */ + for (int i = last_k; i >= 0; i--) + { + double tmp = m_g[i]; + for (unsigned j = i + 1; j <= last_k; j++) + { + tmp -= m_ht[i][j] * m_y[j]; + } + m_y[i] = tmp / m_ht[i][i]; + } + + for (unsigned i = 0; i <= last_k; i++) + vec_add_mult_scalar(n, m_v[i], m_y[i], x); + +#if 1 + if (rho <= rho_delta) + { + break; + } +#else + /* we try to approximate the x difference between to steps using m_v[last_k] */ + + double xdelta = m_y[last_k] * vec_maxabs(n, m_v[last_k]); + if (xdelta < accuracy) + { + if (m_accuracy_mult < 16384.0) + m_accuracy_mult = m_accuracy_mult * 2.0; + break; + } + else + m_accuracy_mult = m_accuracy_mult / 2.0; + +#endif + } + + return itr_used; +} + + + +NETLIB_NAMESPACE_DEVICES_END() + +#endif /* NLD_MS_GMRES_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_sor.h b/src/emu/netlist/solver/nld_ms_sor.h index 4f3fb1fc122..d2749b836af 100644 --- a/src/emu/netlist/analog/nld_ms_sor.h +++ b/src/emu/netlist/solver/nld_ms_sor.h @@ -14,27 +14,23 @@ #include <algorithm> -#include "nld_solver.h" -#include "nld_ms_direct.h" +#include "../solver/nld_ms_direct.h" +#include "../solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() template <unsigned m_N, unsigned _storage_N> -class netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t<m_N, _storage_N> +class matrix_solver_SOR_t: public matrix_solver_direct_t<m_N, _storage_N> { public: - netlist_matrix_solver_SOR_t(const netlist_solver_parameters_t *params, int size) - : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) + matrix_solver_SOR_t(const solver_parameters_t *params, int size) + : matrix_solver_direct_t<m_N, _storage_N>(matrix_solver_t::GAUSS_SEIDEL, params, size) , m_lp_fact(0) - , m_gs_fail(0) - , m_gs_total(0) { } - virtual ~netlist_matrix_solver_SOR_t() {} - - virtual void log_stats(); + virtual ~matrix_solver_SOR_t() {} virtual void vsetup(analog_net_t::list_t &nets); ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson); @@ -43,52 +39,29 @@ protected: private: nl_double m_lp_fact; - int m_gs_fail; - int m_gs_total; }; // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Gauss - Seidel +// matrix_solver - Gauss - Seidel // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_SOR_t<m_N, _storage_N>::log_stats() -{ - if (this->m_stat_calculations != 0 && this->m_params.m_log_stats) - { - this->netlist().log("=============================================="); - this->netlist().log("Solver %s", this->name().cstr()); - this->netlist().log(" ==> %d nets", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); - this->netlist().log(" has %s elements", this->is_dynamic() ? "dynamic" : "no dynamic"); - this->netlist().log(" has %s elements", this->is_timestep() ? "timestep" : "no timestep"); - this->netlist().log(" %6.3f average newton raphson loops", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls); - this->netlist().log(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average", - this->m_stat_calculations, - this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), - this->m_gs_fail, - 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations, - (double) this->m_gs_total / (double) this->m_stat_calculations); - } -} template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_SOR_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) +void matrix_solver_SOR_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) { - netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); + matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); this->save(NLNAME(m_lp_fact)); - this->save(NLNAME(m_gs_fail)); - this->save(NLNAME(m_gs_total)); } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_SOR_t<m_N, _storage_N>::vsolve() +ATTR_HOT nl_double matrix_solver_SOR_t<m_N, _storage_N>::vsolve() { this->solve_base(this); return this->compute_next_timestep(); } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT inline int netlist_matrix_solver_SOR_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) +ATTR_HOT inline int matrix_solver_SOR_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) { const int iN = this->N(); bool resched = false; @@ -194,14 +167,14 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_t<m_N, _storage_N>::vsolve_non_dyn //} while (resched && (resched_cnt < this->m_params.m_gs_loops)); } while (resched && ((!interleaved_dynamic_updates && resched_cnt < this->m_params.m_gs_loops) || (interleaved_dynamic_updates && resched_cnt < 5 ))); - this->m_gs_total += resched_cnt; + this->m_iterative_total += resched_cnt; this->m_stat_calculations++; if (resched && !interleaved_dynamic_updates) { // Fallback to direct solver ... - this->m_gs_fail++; - return netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(newton_raphson); + this->m_iterative_fail++; + return matrix_solver_direct_t<m_N, _storage_N>::vsolve_non_dynamic(newton_raphson); } if (interleaved_dynamic_updates) diff --git a/src/emu/netlist/analog/nld_ms_sor_mat.h b/src/emu/netlist/solver/nld_ms_sor_mat.h index 4d94ea614de..8498633c4d9 100644 --- a/src/emu/netlist/analog/nld_ms_sor_mat.h +++ b/src/emu/netlist/solver/nld_ms_sor_mat.h @@ -14,18 +14,18 @@ #include <algorithm> -#include "nld_solver.h" -#include "nld_ms_direct.h" +#include "../solver/nld_ms_direct.h" +#include "../solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() template <unsigned m_N, unsigned _storage_N> -class netlist_matrix_solver_SOR_mat_t: public netlist_matrix_solver_direct_t<m_N, _storage_N> +class matrix_solver_SOR_mat_t: public matrix_solver_direct_t<m_N, _storage_N> { public: - netlist_matrix_solver_SOR_mat_t(const netlist_solver_parameters_t *params, int size) - : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) + matrix_solver_SOR_mat_t(const solver_parameters_t *params, int size) + : matrix_solver_direct_t<m_N, _storage_N>(matrix_solver_t::GAUSS_SEIDEL, params, size) , m_omega(params->m_sor) , m_lp_fact(0) , m_gs_fail(0) @@ -33,7 +33,7 @@ public: { } - virtual ~netlist_matrix_solver_SOR_mat_t() {} + virtual ~matrix_solver_SOR_mat_t() {} virtual void log_stats(); virtual void vsetup(analog_net_t::list_t &nets); @@ -52,11 +52,11 @@ private: }; // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Gauss - Seidel +// matrix_solver - Gauss - Seidel // ---------------------------------------------------------------------------------------- template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::log_stats() +void matrix_solver_SOR_mat_t<m_N, _storage_N>::log_stats() { if (this->m_stat_calculations != 0 && this->m_params.m_log_stats) { @@ -76,9 +76,9 @@ void netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::log_stats() } template <unsigned m_N, unsigned _storage_N> -void netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) +void matrix_solver_SOR_mat_t<m_N, _storage_N>::vsetup(analog_net_t::list_t &nets) { - netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); + matrix_solver_direct_t<m_N, _storage_N>::vsetup(nets); this->save(NLNAME(m_omega)); this->save(NLNAME(m_lp_fact)); this->save(NLNAME(m_gs_fail)); @@ -88,7 +88,7 @@ void netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsetup(analog_net_t::list template <unsigned m_N, unsigned _storage_N> -ATTR_HOT nl_double netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve() +ATTR_HOT nl_double matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve() { /* * enable linear prediction on first newton pass @@ -134,7 +134,7 @@ ATTR_HOT nl_double netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve() } template <unsigned m_N, unsigned _storage_N> -ATTR_HOT inline int netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) +ATTR_HOT inline int matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non_dynamic(const bool newton_raphson) { /* The matrix based code looks a lot nicer but actually is 30% slower than * the optimized code which works directly on the data structures. @@ -175,7 +175,7 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non s = s + nl_math::abs(this->m_A[k][i]); akk = s / akk - 1.0; if ( akk > lambdaN) - lambdaN = akk; + lambdaN = akk; if (akk < lambda1) lambda1 = akk; #endif @@ -227,7 +227,7 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_mat_t<m_N, _storage_N>::vsolve_non this->m_gs_fail++; this->LE_solve(); - return netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(newton_raphson); + return matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic(newton_raphson); } else { this->store(new_v); diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/solver/nld_solver.c index f3cb5ca3c76..074a46a5c98 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/solver/nld_solver.c @@ -9,6 +9,7 @@ * the vectorizations fast-math enables pretty expensive */ +//#pragma GCC optimize "-ffast-math" #if 0 #pragma GCC optimize "-ffast-math" //#pragma GCC optimize "-ftree-parallelize-loops=4" @@ -25,6 +26,7 @@ #pragma GCC optimize "-fivopts" #endif +#include <iostream> #include <algorithm> #include "nld_solver.h" #include "nld_ms_direct.h" @@ -33,7 +35,7 @@ #include "nld_ms_sor.h" #include "nld_ms_sor_mat.h" #include "nld_ms_gmres.h" -#include "nld_twoterm.h" +//#include "nld_twoterm.h" #include "../nl_lists.h" #if HAS_OPENMP @@ -42,8 +44,22 @@ NETLIB_NAMESPACE_DEVICES_START() -ATTR_COLD void terms_t::add(terminal_t *term, int net_other) +ATTR_COLD void terms_t::add(terminal_t *term, int net_other, bool sorted) { + if (sorted) + for (unsigned i=0; i < m_net_other.size(); i++) + { + if (m_net_other[i] > net_other) + { + m_term.insert_at(term, i); + m_net_other.insert_at(net_other, i); + m_gt.insert_at(0.0, i); + m_go.insert_at(0.0, i); + m_Idr.insert_at(0.0, i); + m_other_curanalog.insert_at(NULL, i); + return; + } + } m_term.add(term); m_net_other.add(net_other); m_gt.add(0.0); @@ -64,25 +80,27 @@ ATTR_COLD void terms_t::set_pointers() } // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver +// matrix_solver // ---------------------------------------------------------------------------------------- -ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t *params) +ATTR_COLD matrix_solver_t::matrix_solver_t(const eSolverType type, const solver_parameters_t *params) : m_stat_calculations(0), m_stat_newton_raphson(0), m_stat_vsolver_calls(0), + m_iterative_fail(0), + m_iterative_total(0), m_params(*params), m_cur_ts(0), m_type(type) { } -ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t() +ATTR_COLD matrix_solver_t::~matrix_solver_t() { m_inps.clear_and_free(); } -ATTR_COLD void netlist_matrix_solver_t::setup(analog_net_t::list_t &nets) +ATTR_COLD void matrix_solver_t::setup(analog_net_t::list_t &nets) { NL_VERBOSE_OUT(("New solver setup\n")); @@ -116,7 +134,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(analog_net_t::list_t &nets) break; case device_t::BJT_EB: case device_t::DIODE: - //case netlist_device_t::VCVS: + //case device_t::VCVS: case device_t::BJT_SWITCH: NL_VERBOSE_OUT(("found BJT/Diode\n")); if (!m_dynamic_devices.contains(&p->netdev())) @@ -133,7 +151,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(analog_net_t::list_t &nets) break; case terminal_t::INPUT: { - netlist_analog_output_t *net_proxy_output = NULL; + analog_output_t *net_proxy_output = NULL; for (std::size_t i = 0; i < m_inps.size(); i++) if (m_inps[i]->m_proxied_net == &p->net().as_analog()) { @@ -143,7 +161,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(analog_net_t::list_t &nets) if (net_proxy_output == NULL) { - net_proxy_output = palloc(netlist_analog_output_t); + net_proxy_output = palloc(analog_output_t); net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%" SIZETFMT, m_inps.size())); m_inps.add(net_proxy_output); net_proxy_output->m_proxied_net = &p->net().as_analog(); @@ -161,10 +179,11 @@ ATTR_COLD void netlist_matrix_solver_t::setup(analog_net_t::list_t &nets) } NL_VERBOSE_OUT(("added net with %" SIZETFMT " populated connections\n", net->m_core_terms.size())); } + } -ATTR_HOT void netlist_matrix_solver_t::update_inputs() +ATTR_HOT void matrix_solver_t::update_inputs() { // avoid recursive calls. Inputs are updated outside this call for (std::size_t i=0; i<m_inps.size(); i++) @@ -172,14 +191,14 @@ ATTR_HOT void netlist_matrix_solver_t::update_inputs() } -ATTR_HOT void netlist_matrix_solver_t::update_dynamic() +ATTR_HOT void matrix_solver_t::update_dynamic() { /* update all non-linear devices */ for (std::size_t i=0; i < m_dynamic_devices.size(); i++) m_dynamic_devices[i]->update_terminals(); } -ATTR_COLD void netlist_matrix_solver_t::start() +ATTR_COLD void matrix_solver_t::start() { register_output("Q_sync", m_Q_sync); register_input("FB_sync", m_fb_sync); @@ -187,15 +206,20 @@ ATTR_COLD void netlist_matrix_solver_t::start() save(NLNAME(m_last_step)); save(NLNAME(m_cur_ts)); + save(NLNAME(m_stat_calculations)); + save(NLNAME(m_stat_newton_raphson)); + save(NLNAME(m_stat_vsolver_calls)); + save(NLNAME(m_iterative_fail)); + save(NLNAME(m_iterative_total)); } -ATTR_COLD void netlist_matrix_solver_t::reset() +ATTR_COLD void matrix_solver_t::reset() { m_last_step = netlist_time::zero; } -ATTR_COLD void netlist_matrix_solver_t::update() +ATTR_COLD void matrix_solver_t::update() { const nl_double new_timestep = solve(); @@ -203,7 +227,7 @@ ATTR_COLD void netlist_matrix_solver_t::update() m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep)); } -ATTR_COLD void netlist_matrix_solver_t::update_forced() +ATTR_COLD void matrix_solver_t::update_forced() { ATTR_UNUSED const nl_double new_timestep = solve(); @@ -211,7 +235,7 @@ ATTR_COLD void netlist_matrix_solver_t::update_forced() m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep)); } -ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta) +ATTR_HOT void matrix_solver_t::step(const netlist_time delta) { const nl_double dd = delta.as_double(); for (std::size_t k=0; k < m_step_devices.size(); k++) @@ -219,7 +243,7 @@ ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta) } template<class C > -void netlist_matrix_solver_t::solve_base(C *p) +void matrix_solver_t::solve_base(C *p) { m_stat_vsolver_calls++; if (is_dynamic()) @@ -248,14 +272,14 @@ void netlist_matrix_solver_t::solve_base(C *p) } } -ATTR_HOT nl_double netlist_matrix_solver_t::solve() +ATTR_HOT nl_double matrix_solver_t::solve() { - netlist_time now = netlist().time(); - netlist_time delta = now - m_last_step; + const netlist_time now = netlist().time(); + const netlist_time delta = now - m_last_step; // We are already up to date. Avoid oscillations. // FIXME: Make this a parameter! - if (delta < netlist_time::from_nsec(1)) + if (delta < netlist_time::from_nsec(1)) // 20000 return -1.0; /* update all terminals for new time step */ @@ -272,10 +296,10 @@ ATTR_HOT nl_double netlist_matrix_solver_t::solve() // ---------------------------------------------------------------------------------------- -// netlist_matrix_solver - Direct base +// matrix_solver - Direct base // ---------------------------------------------------------------------------------------- -ATTR_COLD int netlist_matrix_solver_t::get_net_idx(net_t *net) +ATTR_COLD int matrix_solver_t::get_net_idx(net_t *net) { for (std::size_t k = 0; k < m_nets.size(); k++) if (m_nets[k] == net) @@ -303,6 +327,8 @@ NETLIB_START(solver) register_param("FREQ", m_freq, 48000.0); + register_param("ITERATIVE", m_iterative_solver, "SOR"); + register_param("ACCURACY", m_accuracy, 1e-7); register_param("GS_LOOPS", m_gs_loops, 9); // Gauss-Seidel loops register_param("GS_THRESHOLD", m_gs_threshold, 6); // below this value, gaussian elimination is used @@ -332,7 +358,7 @@ NETLIB_RESET(solver) NETLIB_UPDATE_PARAM(solver) { - //m_inc = netlist_time::from_hz(m_freq.Value()); + //m_inc = time::from_hz(m_freq.Value()); } NETLIB_STOP(solver) @@ -395,31 +421,40 @@ NETLIB_UPDATE(solver) } template <int m_N, int _storage_N> -netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific) +matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const bool use_specific) { if (use_specific && m_N == 1) - return palloc(netlist_matrix_solver_direct1_t, &m_params); + return palloc(matrix_solver_direct1_t, &m_params); else if (use_specific && m_N == 2) - return palloc(netlist_matrix_solver_direct2_t, &m_params); + return palloc(matrix_solver_direct2_t, &m_params); else { - if (size >= gs_threshold) + if (size >= m_gs_threshold) { - if (USE_MATRIX_GS) + if (pstring("SOR_MAT").equals(m_iterative_solver)) { - typedef netlist_matrix_solver_SOR_mat_t<m_N,_storage_N> solver_mat; + typedef matrix_solver_SOR_mat_t<m_N,_storage_N> solver_mat; return palloc(solver_mat, &m_params, size); } - else + else if (pstring("SOR").equals(m_iterative_solver)) { - typedef netlist_matrix_solver_SOR_t<m_N,_storage_N> solver_GS; - //typedef netlist_matrix_solver_GMRES_t<m_N,_storage_N> solver_GS; + typedef matrix_solver_SOR_t<m_N,_storage_N> solver_GS; return palloc(solver_GS, &m_params, size); } + else if (pstring("GMRES").equals(m_iterative_solver)) + { + typedef matrix_solver_GMRES_t<m_N,_storage_N> solver_GMRES; + return palloc(solver_GMRES, &m_params, size); + } + else + { + netlist().error("Unknown solver type: %s\n", m_iterative_solver.Value().cstr()); + return NULL; + } } else { - typedef netlist_matrix_solver_direct_t<m_N,_storage_N> solver_D; + typedef matrix_solver_direct_t<m_N,_storage_N> solver_D; return palloc(solver_D, &m_params, size); } } @@ -429,7 +464,6 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() { analog_net_t::list_t groups[256]; int cur_group = -1; - const int gs_threshold = m_gs_threshold.Value(); const bool use_specific = true; m_params.m_accuracy = m_accuracy.Value(); @@ -480,57 +514,58 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() netlist().log("Found %d net groups in %" SIZETFMT " nets\n", cur_group + 1, netlist().m_nets.size()); for (int i = 0; i <= cur_group; i++) { - netlist_matrix_solver_t *ms; + matrix_solver_t *ms; std::size_t net_count = groups[i].size(); switch (net_count) { case 1: - ms = create_solver<1,1>(1, gs_threshold, use_specific); + ms = create_solver<1,1>(1, use_specific); break; case 2: - ms = create_solver<2,2>(2, gs_threshold, use_specific); + ms = create_solver<2,2>(2, use_specific); break; case 3: - ms = create_solver<3,3>(3, gs_threshold, use_specific); + ms = create_solver<3,3>(3, use_specific); break; case 4: - ms = create_solver<4,4>(4, gs_threshold, use_specific); + ms = create_solver<4,4>(4, use_specific); break; case 5: - ms = create_solver<5,5>(5, gs_threshold, use_specific); + ms = create_solver<5,5>(5, use_specific); break; case 6: - ms = create_solver<6,6>(6, gs_threshold, use_specific); + ms = create_solver<6,6>(6, use_specific); break; case 7: - ms = create_solver<7,7>(7, gs_threshold, use_specific); + ms = create_solver<7,7>(7, use_specific); break; case 8: - ms = create_solver<8,8>(8, gs_threshold, use_specific); + ms = create_solver<8,8>(8, use_specific); break; case 12: - ms = create_solver<12,12>(12, gs_threshold, use_specific); + ms = create_solver<12,12>(12, use_specific); break; case 87: - ms = create_solver<87,87>(87, gs_threshold, use_specific); + ms = create_solver<87,87>(87, use_specific); break; default: if (net_count <= 16) { - ms = create_solver<0,16>(net_count, gs_threshold, use_specific); + ms = create_solver<0,16>(net_count, use_specific); } else if (net_count <= 32) { - ms = create_solver<0,32>(net_count, gs_threshold, use_specific); + ms = create_solver<0,32>(net_count, use_specific); } else if (net_count <= 64) { - ms = create_solver<0,64>(net_count, gs_threshold, use_specific); + ms = create_solver<0,64>(net_count, use_specific); } - else if (net_count <= 128) + else + if (net_count <= 128) { - ms = create_solver<0,128>(net_count, gs_threshold, use_specific); + ms = create_solver<0,128>(net_count, use_specific); } else { @@ -565,5 +600,3 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() } NETLIB_NAMESPACE_DEVICES_END() - -#include "mgmres.cpp" diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/solver/nld_solver.h index 0c6cb605eb4..f7e72089cd8 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/solver/nld_solver.h @@ -35,7 +35,7 @@ class NETLIB_NAME(solver); /* FIXME: these should become proper devices */ -struct netlist_solver_parameters_t +struct solver_parameters_t { nl_double m_accuracy; nl_double m_lte; @@ -68,7 +68,7 @@ class terms_t m_other_curanalog.clear(); } - ATTR_COLD void add(terminal_t *term, int net_other); + ATTR_COLD void add(terminal_t *term, int net_other, bool sorted); ATTR_HOT inline unsigned count() { return m_term.size(); } @@ -94,10 +94,10 @@ private: plist_t<nl_double *> m_other_curanalog; }; -class netlist_matrix_solver_t : public device_t +class matrix_solver_t : public device_t { public: - typedef plist_t<netlist_matrix_solver_t *> list_t; + typedef plist_t<matrix_solver_t *> list_t; typedef core_device_t::list_t dev_list_t; enum eSolverType @@ -106,8 +106,8 @@ public: GAUSS_SEIDEL }; - ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t *params); - virtual ~netlist_matrix_solver_t(); + ATTR_COLD matrix_solver_t(const eSolverType type, const solver_parameters_t *params); + virtual ~matrix_solver_t(); virtual void vsetup(analog_net_t::list_t &nets) = 0; @@ -131,10 +131,29 @@ public: virtual void reset(); ATTR_COLD int get_net_idx(net_t *net); - virtual void log_stats() {}; inline eSolverType type() const { return m_type; } + virtual void log_stats() + { + if (this->m_stat_calculations != 0 && this->m_params.m_log_stats) + { + this->netlist().log("=============================================="); + this->netlist().log("Solver %s", this->name().cstr()); + this->netlist().log(" ==> %d nets", (unsigned) this->m_nets.size()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); + this->netlist().log(" has %s elements", this->is_dynamic() ? "dynamic" : "no dynamic"); + this->netlist().log(" has %s elements", this->is_timestep() ? "timestep" : "no timestep"); + this->netlist().log(" %6.3f average newton raphson loops", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls); + this->netlist().log(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average", + this->m_stat_calculations, + this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), + this->m_iterative_fail, + 100.0 * (double) this->m_iterative_fail / (double) this->m_stat_calculations, + (double) this->m_iterative_total / (double) this->m_stat_calculations); + } + } + + protected: ATTR_COLD void setup(analog_net_t::list_t &nets); @@ -146,13 +165,15 @@ protected: virtual void add_term(int net_idx, terminal_t *term) = 0; plist_t<analog_net_t *> m_nets; - plist_t<netlist_analog_output_t *> m_inps; + plist_t<analog_output_t *> m_inps; int m_stat_calculations; int m_stat_newton_raphson; int m_stat_vsolver_calls; + int m_iterative_fail; + int m_iterative_total; - const netlist_solver_parameters_t &m_params; + const solver_parameters_t &m_params; ATTR_HOT inline nl_double current_timestep() { return m_cur_ts; } private: @@ -196,29 +217,30 @@ protected: logic_input_t m_fb_step; logic_output_t m_Q_step; - netlist_param_double_t m_freq; - netlist_param_double_t m_sync_delay; - netlist_param_double_t m_accuracy; - netlist_param_double_t m_gmin; - netlist_param_double_t m_lte; - netlist_param_double_t m_sor; - netlist_param_logic_t m_dynamic; - netlist_param_double_t m_min_timestep; + param_double_t m_freq; + param_double_t m_sync_delay; + param_double_t m_accuracy; + param_double_t m_gmin; + param_double_t m_lte; + param_double_t m_sor; + param_logic_t m_dynamic; + param_double_t m_min_timestep; - netlist_param_int_t m_nr_loops; - netlist_param_int_t m_gs_loops; - netlist_param_int_t m_gs_threshold; - netlist_param_int_t m_parallel; + param_str_t m_iterative_solver; + param_int_t m_nr_loops; + param_int_t m_gs_loops; + param_int_t m_gs_threshold; + param_int_t m_parallel; - netlist_param_logic_t m_log_stats; + param_logic_t m_log_stats; - netlist_matrix_solver_t::list_t m_mat_solvers; + matrix_solver_t::list_t m_mat_solvers; private: - netlist_solver_parameters_t m_params; + solver_parameters_t m_params; template <int m_N, int _storage_N> - netlist_matrix_solver_t *create_solver(int size, int gs_threshold, bool use_specific); + matrix_solver_t *create_solver(int size, bool use_specific); }; NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/solver/vector_base.h b/src/emu/netlist/solver/vector_base.h new file mode 100644 index 00000000000..e0ad8139296 --- /dev/null +++ b/src/emu/netlist/solver/vector_base.h @@ -0,0 +1,104 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * vector_base.h + * + * Base vector operations + * + */ + +#ifndef VECTOR_BASE_H_ +#define VECTOR_BASE_H_ + +#include <algorithm> +#include "../plib/pconfig.h" + +#if 0 +template <unsigned _storage_N> +struct pvector +{ + pvector(unsigned size) + : m_N(size) { } + + unsigned size() { + if (_storage_N) + } + + double m_V[_storage_N]; +private: + unsigned m_N; +}; +#endif + +inline void vec_set (const unsigned n, const double &scalar, double * RESTRICT result) +{ + for ( unsigned i = 0; i < n; i++ ) + result[i] = scalar; +} + +inline double vecmult (const unsigned n, const double * RESTRICT a1, const double * RESTRICT a2 ) +{ + double value = 0.0; + + for ( unsigned i = 0; i < n; i++ ) + value = value + a1[i] * a2[i]; + return value; +} + + +inline double vecmult2 (const unsigned n, const double *a1) +{ + double value = 0.0; + + for ( unsigned i = 0; i < n; i++ ) + { + const double temp = a1[i]; + value = value + temp * temp; + } + return value; +} + +inline void vec_mult_scalar (const int n, const double * RESTRICT v, const double scalar, double * RESTRICT result) +{ + for ( unsigned i = 0; i < n; i++ ) + { + result[i] = scalar * v[i]; + } +} + +inline void vec_add_mult_scalar (const int n, const double * RESTRICT v, const double scalar, double * RESTRICT result) +{ + for ( unsigned i = 0; i < n; i++ ) + result[i] += scalar * v[i]; +} + +inline void vec_add_ip(const int n, const double * RESTRICT v, double * RESTRICT result) +{ + for ( unsigned i = 0; i < n; i++ ) + result[i] += v[i]; +} + +inline void vec_sub(const int n, const double * RESTRICT v1, const double * RESTRICT v2, double * RESTRICT result) +{ + for ( unsigned i = 0; i < n; i++ ) + result[i] = v1[i] - v2[i]; +} + +inline void vec_scale (const int n, double * RESTRICT v, const double scalar) +{ + for ( unsigned i = 0; i < n; i++ ) + v[i] = scalar * v[i]; +} + +inline double vec_maxabs(const int n, const double * RESTRICT v) +{ + double ret = 0.0; + for ( unsigned i = 0; i < n; i++ ) + ret = std::max(ret, std::abs(v[i])); + + return ret; +} + + + +#endif /* MAT_CR_H_ */ diff --git a/src/emu/netlist/tools/nl_convert.c b/src/emu/netlist/tools/nl_convert.c index 698bb6a5a4d..b25fc4711de 100644 --- a/src/emu/netlist/tools/nl_convert.c +++ b/src/emu/netlist/tools/nl_convert.c @@ -17,15 +17,15 @@ static plist_t<int> bubble(const pnamedlist_t<Class *> &sl) ret[i] = i; for(int i=0; i < sl.size()-1;i++) - { - for(int j=i+1; j < sl.size(); j++) - { - if(sl[ret[i]]->name() > sl[ret[j]]->name()) - { - std::swap(ret[i], ret[j]); - } - } - } + { + for(int j=i+1; j < sl.size(); j++) + { + if(sl[ret[i]]->name() > sl[ret[j]]->name()) + { + std::swap(ret[i], ret[j]); + } + } + } return ret; } @@ -179,7 +179,7 @@ nl_convert_base_t::unit_t nl_convert_base_t::m_units[] = { {"M", "CAP_M(%g)", 1.0e-3 }, {"u", "CAP_U(%g)", 1.0e-6 }, /* eagle */ {"U", "CAP_U(%g)", 1.0e-6 }, - {"µ", "CAP_U(%g)", 1.0e-6 }, + {"μ", "CAP_U(%g)", 1.0e-6 }, {"N", "CAP_N(%g)", 1.0e-9 }, {"P", "CAP_P(%g)", 1.0e-12}, {"F", "%ge-15", 1.0e-15}, @@ -444,7 +444,7 @@ void nl_convert_eagle_t::convert(const pstring &contents) pstring devname = token.str(); pstring pin = tok.get_string(); add_term(netname, devname + "." + pin); - token = tok.get_token(); } + token = tok.get_token(); } } else { @@ -454,5 +454,3 @@ void nl_convert_eagle_t::convert(const pstring &contents) } } - - diff --git a/src/emu/netlist/tools/nl_convert.h b/src/emu/netlist/tools/nl_convert.h index 4a0efd020a7..d2e2d238718 100644 --- a/src/emu/netlist/tools/nl_convert.h +++ b/src/emu/netlist/tools/nl_convert.h @@ -164,7 +164,6 @@ public: class eagle_tokenizer : public ptokenizer { - public: eagle_tokenizer(nl_convert_eagle_t &convert) : ptokenizer(), m_convert(convert) diff --git a/src/emu/rendersw.inc b/src/emu/rendersw.inc index aefe09183a1..3ab326a5459 100644 --- a/src/emu/rendersw.inc +++ b/src/emu/rendersw.inc @@ -149,7 +149,7 @@ private: UINT32 pix01 = palbase[texbase[u1]]; UINT32 pix10 = palbase[texbase[v1]]; UINT32 pix11 = palbase[texbase[u1 + v1]]; - return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); } else { @@ -181,11 +181,7 @@ private: const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - UINT32 pix00 = palbase[texbase[0]]; - UINT32 pix01 = palbase[texbase[u1]]; - UINT32 pix10 = palbase[texbase[v1]]; - UINT32 pix11 = palbase[texbase[u1 + v1]]; - return rgba_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8); } else { @@ -247,7 +243,7 @@ private: else pix11 = pix10; } - return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); } else { @@ -278,11 +274,7 @@ private: const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - UINT32 pix00 = texbase[0]; - UINT32 pix01 = texbase[u1]; - UINT32 pix10 = texbase[v1]; - UINT32 pix11 = texbase[u1 + v1]; - return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { @@ -313,11 +305,7 @@ private: const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - UINT32 pix00 = texbase[0]; - UINT32 pix01 = texbase[u1]; - UINT32 pix10 = texbase[v1]; - UINT32 pix11 = texbase[u1 + v1]; - return rgba_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { diff --git a/src/emu/softlist.c b/src/emu/softlist.c index b9719d29a33..fdfd980aeea 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -557,13 +557,13 @@ void software_list_device::internal_validity_check(validity_checker &valid) break; } - // Did we lost the software parts? - if (swinfo->num_parts() == 0) - { - osd_printf_error("%s: %s has no part\n", filename(), swinfo->shortname()); - break; - } - + // Did we lost the software parts? + if (swinfo->num_parts() == 0) + { + osd_printf_error("%s: %s has no part\n", filename(), swinfo->shortname()); + break; + } + // Second, since the xml is fine, run additional checks: // check for duplicate names diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index 9decdb85c08..9e8d397ff7a 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -1004,6 +1004,12 @@ int ay8910_device::ay8910_read_ym() /* even if the port is set as output, we still need to return the external data. Some games, like kidniki, need this to work. + + FIXME: The io ports are designed as open collector outputs. Bits 7 and 8 of AY_ENABLE + only enable (low) or disable (high) the pull up resistors. The YM2149 datasheet + specifies those pull up resistors as 60k to 600k (min / max). + We do need a callback for those two flags. Kid Niki (Irem m62) is one such + case were it makes a difference in comparison to a standard TTL output. */ if (!m_port_a_read_cb.isnull()) m_regs[AY_PORTA] = m_port_a_read_cb(0); diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index 80802d5f60e..0b1dea55354 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -296,7 +296,7 @@ READ16_MEMBER( bsmt2000_device::tms_data_r ) READ16_MEMBER( bsmt2000_device::tms_rom_r ) { // underlying logic assumes this is a sign-extended value - return (INT8)m_direct->read_raw_byte((m_rom_bank << 16) + m_rom_address); + return (INT8)m_direct->read_byte((m_rom_bank << 16) + m_rom_address); } diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index c164bc53413..b4172e43aa0 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -124,8 +124,8 @@ void c352_device::mix_one_channel(unsigned long ch, long sample_count) return; } - sample = (char)m_direct->read_raw_byte(pos); - nextsample = (char)m_direct->read_raw_byte(pos+cnt); + sample = (char)m_direct->read_byte(pos); + nextsample = (char)m_direct->read_byte(pos+cnt); // sample is muLaw, not 8-bit linear (Fighting Layer uses this extensively) if (flag & C352_FLG_MULAW) @@ -489,7 +489,7 @@ void c352_device::device_start() divider=332; break; } - + m_sample_rate_base = clock() / divider; m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base); diff --git a/src/emu/sound/c352.h b/src/emu/sound/c352.h index 0717fd133df..75a00bbab71 100644 --- a/src/emu/sound/c352.h +++ b/src/emu/sound/c352.h @@ -26,7 +26,7 @@ enum #define MCFG_C352_DIVIDER(_setting) \ c352_device::static_set_divider(*device, _setting); - + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -43,7 +43,7 @@ public: // inline configuration helpers static void static_set_divider(device_t &device, int setting); - + DECLARE_READ16_MEMBER(read); DECLARE_WRITE16_MEMBER(write); @@ -108,7 +108,7 @@ private: c352_ch_t m_c352_ch[32]; int m_sample_rate_base; int m_divider; - + long m_channel_l[2048*2]; long m_channel_r[2048*2]; long m_channel_l2[2048*2]; diff --git a/src/emu/sound/disc_sys.inc b/src/emu/sound/disc_sys.inc index b3c89188cad..4192e832d93 100644 --- a/src/emu/sound/disc_sys.inc +++ b/src/emu/sound/disc_sys.inc @@ -27,11 +27,6 @@ * *************************************/ -// FIXME -//#undef I64FMT -//#define I64FMT "ll" - - DISCRETE_START( dso_csvlog ) { int log_num, node_num; diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index 61f3ea35242..5270f37ebb9 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -39,7 +39,8 @@ #include "wavwrite.h" #include "discrete.h" - +/* for_each collides with c++ standard libraries - include it here */ +#define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++) // device type definition const device_type DISCRETE = &device_creator<discrete_sound_device>; diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index a7dff7c7ff7..d3dfd2c4e85 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -3747,8 +3747,6 @@ enum * *************************************/ -#define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++) - /* * add and delete may be slow - the focus is on access! */ diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index 9364aa8065d..b1881412da2 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -184,9 +184,9 @@ void es5503_device::sound_stream_update(sound_stream &stream, stream_sample_t ** // channel strobe is always valid when reading; this allows potentially banking per voice m_channel_strobe = (ctrl>>4) & 0xf; - data = (INT32)m_direct->read_raw_byte(ramptr + wtptr) ^ 0x80; + data = (INT32)m_direct->read_byte(ramptr + wtptr) ^ 0x80; - if (m_direct->read_raw_byte(ramptr + wtptr) == 0x00) + if (m_direct->read_byte(ramptr + wtptr) == 0x00) { halt_osc(osc, 1, &acc, resshift); } diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index 5f984ffeadb..69c164bad2c 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -534,7 +534,7 @@ void multipcm_device::device_start() for (int j = 0; j < 12; j++) { - ptSample[j] = (UINT8)m_direct->read_raw_byte((i*12) + j); + ptSample[j] = (UINT8)m_direct->read_byte((i*12) + j); } m_Samples[i].Start=(ptSample[0]<<16)|(ptSample[1]<<8)|(ptSample[2]<<0); @@ -616,7 +616,7 @@ void multipcm_device::sound_stream_update(sound_stream &stream, stream_sample_t unsigned int adr=slot->offset>>SHIFT; signed int sample; unsigned int step=slot->step; - signed int csample=(signed short) (m_direct->read_raw_byte(slot->Base+adr)<<8); + signed int csample=(signed short) (m_direct->read_byte(slot->Base+adr)<<8); signed int fpart=slot->offset&((1<<SHIFT)-1); sample=(csample*fpart+slot->Prev*((1<<SHIFT)-fpart))>>SHIFT; diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c index db90445f0cf..a1308c36713 100644 --- a/src/emu/sound/n63701x.c +++ b/src/emu/sound/n63701x.c @@ -47,7 +47,7 @@ namco_63701x_device::namco_63701x_device(const machine_config &mconfig, const ch void namco_63701x_device::device_start() { m_stream = stream_alloc(0, 2, clock()/1000); - + for (int i = 0; i < 2; i++) { save_item(NAME(m_voices[i].select), i); diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index 2e59809199d..fc9f35e3a58 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -303,14 +303,14 @@ void okim6295_device::write_command(UINT8 command) // determine the start/stop positions offs_t base = m_command * 8; - offs_t start = m_direct->read_raw_byte(base + 0) << 16; - start |= m_direct->read_raw_byte(base + 1) << 8; - start |= m_direct->read_raw_byte(base + 2) << 0; + offs_t start = m_direct->read_byte(base + 0) << 16; + start |= m_direct->read_byte(base + 1) << 8; + start |= m_direct->read_byte(base + 2) << 0; start &= 0x3ffff; - offs_t stop = m_direct->read_raw_byte(base + 3) << 16; - stop |= m_direct->read_raw_byte(base + 4) << 8; - stop |= m_direct->read_raw_byte(base + 5) << 0; + offs_t stop = m_direct->read_byte(base + 3) << 16; + stop |= m_direct->read_byte(base + 4) << 8; + stop |= m_direct->read_byte(base + 5) << 0; stop &= 0x3ffff; if (start < stop) @@ -405,7 +405,7 @@ void okim6295_device::okim_voice::generate_adpcm(direct_read_data &direct, strea while (samples-- != 0) { // fetch the next sample byte - int nibble = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); + int nibble = direct.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); // output to the buffer, scaling by the volume // signal in range -2048..2047, volume in range 2..32 => signal * volume / 2 in range -32768..32767 diff --git a/src/emu/sound/okim9810.c b/src/emu/sound/okim9810.c index 54e53fe55d0..e134e646ddb 100644 --- a/src/emu/sound/okim9810.c +++ b/src/emu/sound/okim9810.c @@ -313,31 +313,31 @@ void okim9810_device::write_command(UINT8 data) const offs_t base = m_TMP_register * 8; offs_t startAddr; - UINT8 startFlags = m_direct->read_raw_byte(base + 0); - startAddr = m_direct->read_raw_byte(base + 1) << 16; - startAddr |= m_direct->read_raw_byte(base + 2) << 8; - startAddr |= m_direct->read_raw_byte(base + 3) << 0; + UINT8 startFlags = m_direct->read_byte(base + 0); + startAddr = m_direct->read_byte(base + 1) << 16; + startAddr |= m_direct->read_byte(base + 2) << 8; + startAddr |= m_direct->read_byte(base + 3) << 0; offs_t endAddr; - UINT8 endFlags = m_direct->read_raw_byte(base + 4); - endAddr = m_direct->read_raw_byte(base + 5) << 16; - endAddr |= m_direct->read_raw_byte(base + 6) << 8; - endAddr |= m_direct->read_raw_byte(base + 7) << 0; + UINT8 endFlags = m_direct->read_byte(base + 4); + endAddr = m_direct->read_byte(base + 5) << 16; + endAddr |= m_direct->read_byte(base + 6) << 8; + endAddr |= m_direct->read_byte(base + 7) << 0; // Sub-table if (startFlags & 0x80) { offs_t subTable = startAddr; // TODO: New startFlags &= 0x80. Are there further subtables? - startFlags = m_direct->read_raw_byte(subTable + 0); - startAddr = m_direct->read_raw_byte(subTable + 1) << 16; - startAddr |= m_direct->read_raw_byte(subTable + 2) << 8; - startAddr |= m_direct->read_raw_byte(subTable + 3) << 0; + startFlags = m_direct->read_byte(subTable + 0); + startAddr = m_direct->read_byte(subTable + 1) << 16; + startAddr |= m_direct->read_byte(subTable + 2) << 8; + startAddr |= m_direct->read_byte(subTable + 3) << 0; // TODO: What does byte (subTable + 4) refer to? - endAddr = m_direct->read_raw_byte(subTable + 5) << 16; - endAddr |= m_direct->read_raw_byte(subTable + 6) << 8; - endAddr |= m_direct->read_raw_byte(subTable + 7) << 0; + endAddr = m_direct->read_byte(subTable + 5) << 16; + endAddr |= m_direct->read_byte(subTable + 6) << 8; + endAddr |= m_direct->read_byte(subTable + 7) << 0; } m_voice[channel].m_sample = 0; @@ -478,7 +478,7 @@ void okim9810_device::okim_voice::generate_audio(direct_read_data &direct, if (m_sample == 0) { // fetch the first sample nibble - int nibble0 = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); + int nibble0 = direct.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4); switch (m_playbackAlgo) { case OKIM9810_ADPCM_PLAYBACK: @@ -504,7 +504,7 @@ void okim9810_device::okim_voice::generate_audio(direct_read_data &direct, } // And fetch the second sample nibble - int nibble1 = direct.read_raw_byte(m_base_offset + (m_sample+1) / 2) >> ((((m_sample+1) & 1) << 2) ^ 4); + int nibble1 = direct.read_byte(m_base_offset + (m_sample+1) / 2) >> ((((m_sample+1) & 1) << 2) ^ 4); switch (m_playbackAlgo) { case OKIM9810_ADPCM_PLAYBACK: diff --git a/src/emu/sound/qs1000.c b/src/emu/sound/qs1000.c index 18872b99e1f..3100800acbc 100644 --- a/src/emu/sound/qs1000.c +++ b/src/emu/sound/qs1000.c @@ -523,7 +523,7 @@ void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t ** if (chan.m_start + chan.m_adpcm_addr >= chan.m_loop_end) chan.m_adpcm_addr = chan.m_loop_start - chan.m_start; - UINT8 data = m_direct->read_raw_byte(chan.m_start + (chan.m_adpcm_addr >> 1)); + UINT8 data = m_direct->read_byte(chan.m_start + (chan.m_adpcm_addr >> 1)); UINT8 nibble = (chan.m_adpcm_addr & 1 ? data : data >> 4) & 0xf; chan.m_adpcm_signal = chan.m_adpcm.clock(nibble); } @@ -556,7 +556,7 @@ void qs1000_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } } - INT8 result = m_direct->read_raw_byte(chan.m_addr) - 128; + INT8 result = m_direct->read_byte(chan.m_addr) - 128; chan.m_acc += chan.m_freq; chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK; @@ -576,9 +576,9 @@ void qs1000_device::start_voice(int ch) UINT32 table_addr = (m_channels[ch].m_regs[0x01] << 16) | (m_channels[ch].m_regs[0x02] << 8) | m_channels[ch].m_regs[0x03]; // Fetch the sound information - UINT16 freq = (m_direct->read_raw_byte(table_addr + 0) << 8) | m_direct->read_raw_byte(table_addr + 1); - UINT16 word1 = (m_direct->read_raw_byte(table_addr + 2) << 8) | m_direct->read_raw_byte(table_addr + 3); - UINT16 base = (m_direct->read_raw_byte(table_addr + 4) << 8) | m_direct->read_raw_byte(table_addr + 5); + UINT16 freq = (m_direct->read_byte(table_addr + 0) << 8) | m_direct->read_byte(table_addr + 1); + UINT16 word1 = (m_direct->read_byte(table_addr + 2) << 8) | m_direct->read_byte(table_addr + 3); + UINT16 base = (m_direct->read_byte(table_addr + 4) << 8) | m_direct->read_byte(table_addr + 5); if (LOGGING_ENABLED) printf("[%.6x] Freq:%.4x ????:%.4x Addr:%.4x\n", table_addr, freq, word1, base); @@ -588,42 +588,42 @@ void qs1000_device::start_voice(int ch) return; // Fetch the sample pointers and flags - UINT8 byte0 = m_direct->read_raw_byte(base); + UINT8 byte0 = m_direct->read_byte(base); UINT32 start_addr; start_addr = byte0 << 16; - start_addr |= m_direct->read_raw_byte(base + 1) << 8; - start_addr |= m_direct->read_raw_byte(base + 2) << 0; + start_addr |= m_direct->read_byte(base + 1) << 8; + start_addr |= m_direct->read_byte(base + 2) << 0; start_addr &= QS1000_ADDRESS_MASK; UINT32 loop_start; loop_start = (byte0 & 0xf0) << 16; - loop_start |= m_direct->read_raw_byte(base + 3) << 12; - loop_start |= m_direct->read_raw_byte(base + 4) << 4; - loop_start |= m_direct->read_raw_byte(base + 5) >> 4; + loop_start |= m_direct->read_byte(base + 3) << 12; + loop_start |= m_direct->read_byte(base + 4) << 4; + loop_start |= m_direct->read_byte(base + 5) >> 4; loop_start &= QS1000_ADDRESS_MASK; UINT32 loop_end; loop_end = (byte0 & 0xf0) << 16; - loop_end |= (m_direct->read_raw_byte(base + 5) & 0xf) << 16; - loop_end |= m_direct->read_raw_byte(base + 6) << 8; - loop_end |= m_direct->read_raw_byte(base + 7); + loop_end |= (m_direct->read_byte(base + 5) & 0xf) << 16; + loop_end |= m_direct->read_byte(base + 6) << 8; + loop_end |= m_direct->read_byte(base + 7); loop_end &= QS1000_ADDRESS_MASK; - UINT8 byte8 = m_direct->read_raw_byte(base + 8); + UINT8 byte8 = m_direct->read_byte(base + 8); if (LOGGING_ENABLED) { - UINT8 byte9 = m_direct->read_raw_byte(base + 9); - UINT8 byte10 = m_direct->read_raw_byte(base + 10); - UINT8 byte11 = m_direct->read_raw_byte(base + 11); - UINT8 byte12 = m_direct->read_raw_byte(base + 12); - UINT8 byte13 = m_direct->read_raw_byte(base + 13); - UINT8 byte14 = m_direct->read_raw_byte(base + 14); - UINT8 byte15 = m_direct->read_raw_byte(base + 15); + UINT8 byte9 = m_direct->read_byte(base + 9); + UINT8 byte10 = m_direct->read_byte(base + 10); + UINT8 byte11 = m_direct->read_byte(base + 11); + UINT8 byte12 = m_direct->read_byte(base + 12); + UINT8 byte13 = m_direct->read_byte(base + 13); + UINT8 byte14 = m_direct->read_byte(base + 14); + UINT8 byte15 = m_direct->read_byte(base + 15); printf("[%.6x] Sample Start:%.6x Loop Start:%.6x Loop End:%.6x Params: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", base, start_addr, loop_start, loop_end, byte8, byte9, byte10, byte11, byte12, byte13, byte14, byte15); } diff --git a/src/emu/sound/sn76496.h b/src/emu/sound/sn76496.h index 3d1c5f4592b..bedee2de532 100644 --- a/src/emu/sound/sn76496.h +++ b/src/emu/sound/sn76496.h @@ -33,6 +33,7 @@ public: DECLARE_WRITE8_MEMBER( stereo_w ); void write(UINT8 data); DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ_LINE_MEMBER( ready_r ) { return m_ready_state ? 1 : 0; } protected: virtual void device_start(); diff --git a/src/emu/sound/st0016.c b/src/emu/sound/st0016.c index d62332496cb..99328a93b4d 100644 --- a/src/emu/sound/st0016.c +++ b/src/emu/sound/st0016.c @@ -45,7 +45,7 @@ void st0016_device::device_start() { m_stream = stream_alloc(0, 2, 44100); m_ram_read_cb.resolve_safe(0); - + save_item(NAME(m_vpos)); save_item(NAME(m_frac)); save_item(NAME(m_lponce)); diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 0df81b1d56d..c5861e2d7c6 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -497,21 +497,17 @@ void tms5110_device::process(INT16 *buffer, unsigned int size) } else { - /* generate voiced samples here */ + // generate voiced samples here /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp * function has a chirp/peak and then a long chain of zeroes. - * The last entry of the chirp rom is at address 0b110011 (50d), the 51st sample, + * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample, * and if the address reaches that point the ADDRESS incrementer is - * disabled, forcing all samples beyond 50d to be == 50d - * (address 50d holds zeroes) + * disabled, forcing all samples beyond 51d to be == 51d */ - - /*if (m_coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/ - - if (m_pitch_count > 50) - current_val = m_coeff->chirptable[50]; - else - current_val = m_coeff->chirptable[m_pitch_count]; + if (m_pitch_count >= 51) + current_val = (INT8)m_coeff->chirptable[51]; + else /*m_pitch_count < 51*/ + current_val = (INT8)m_coeff->chirptable[m_pitch_count]; } /* Update LFSR *20* times every sample, like patent shows */ diff --git a/src/emu/sound/tms5110r.inc b/src/emu/sound/tms5110r.inc index 3148e9089bb..41abe5caea4 100644 --- a/src/emu/sound/tms5110r.inc +++ b/src/emu/sound/tms5110r.inc @@ -39,19 +39,19 @@ */ /* Chip types based on die marks from decap: - chip type - |||||| rom number - |||||| ||||| - VVVVVV VVVVV - T0280A 0281 = 1978 speak & spell, unknown difference to below, assumed same? uses old chirp - T0280B 0281A = 1979 speak & spell, also == TMS5100, uses old chirp - ?????? ????? (no decap; likely 'T0280D 0281D') = 1980 speak & spell, 1981 speak & spell compact, changed energy table, otherwise same as above, uses old chirp - T0280F 2801A = 1980 speak & math, 1980 speak and read, uses old chirp - ?????? ????? (no decap; likely 'T0280F 2802') = touch and tell, language translator; uses a unique chirp rom. - ?????? ????? = TMS5110 - T0280F 5110A = TMS5110AN2L - - + chip type + |||||| rom number + |||||| ||||| + VVVVVV VVVVV + T0280A 0281 = 1978 speak & spell, unknown difference to below, assumed same? uses old chirp + T0280B 0281A = 1979 speak & spell, also == TMS5100, uses old chirp + ?????? ????? (no decap; likely 'T0280D 0281D') = 1980 speak & spell, 1981 speak & spell compact, changed energy table, otherwise same as above, uses old chirp + T0280F 2801A = 1980 speak & math, 1980 speak and read, uses old chirp + ?????? ????? (no decap; likely 'T0280F 2802') = touch and tell, language translator; uses a unique chirp rom. + ?????? ????? = TMS5110 + T0280F 5110A = TMS5110AN2L + + */ /* chip rom contents defines */ @@ -111,9 +111,9 @@ struct tms5100_coeffs #define TI_0280_2801_PATENT_PITCH \ /* P */\ { 0, 41, 43, 45, 47, 49, 51, 53, \ - 55, 58, 60, 63, 66, 70, 73, 76, \ - 79, 83, 87, 90, 94, 99, 103, 107, \ - 112, 118, 123, 129, 134, 140, 147, 153 }, + 55, 58, 60, 63, 66, 70, 73, 76, \ + 79, 83, 87, 90, 94, 99, 103, 107, \ + 112, 118, 123, 129, 134, 140, 147, 153 }, #define TI_2802_PITCH \ /* P */\ @@ -155,14 +155,14 @@ struct tms5100_coeffs #define TI_0280_PATENT_LPC \ /* K1 */\ { -501, -497, -493, -488, -480, -471, -460, -446,\ - -427, -405, -378, -344, -305, -259, -206, -148,\ - -86, -21, 45, 110, 171, 227, 277, 320,\ - 357, 388, 413, 434, 451, 464, 474, 498 },\ + -427, -405, -378, -344, -305, -259, -206, -148,\ + -86, -21, 45, 110, 171, 227, 277, 320,\ + 357, 388, 413, 434, 451, 464, 474, 498 },\ /* K2 */\ { -349, -328, -305, -280, -252, -223, -192, -158,\ - -124, -88, -51, -14, 23, 60, 97, 133,\ - 167, 199, 230, 259, 286, 310, 333, 354,\ - 372, 389, 404, 417, 429, 439, 449, 506 },\ + -124, -88, -51, -14, 23, 60, 97, 133,\ + 167, 199, 230, 259, 286, 310, 333, 354,\ + 372, 389, 404, 417, 429, 439, 449, 506 },\ /* K3 */\ { -397, -365, -327, -282, -229, -170, -104, -36,\ 35, 104, 169, 228, 281, 326, 364, 396 },\ @@ -188,17 +188,17 @@ struct tms5100_coeffs #define TI_2801_2501E_LPC \ /* K1 */\ { -501, -498, -495, -490, -485, -478, -469, -459,\ - -446, -431, -412, -389, -362, -331, -295, -253,\ - -207, -156, -102, -45, 13, 70, 126, 179,\ - 228, 272, 311, 345, 374, 399, 420, 437 },\ + -446, -431, -412, -389, -362, -331, -295, -253,\ + -207, -156, -102, -45, 13, 70, 126, 179,\ + 228, 272, 311, 345, 374, 399, 420, 437 },\ /* K2 */\ { -376, -357, -335, -312, -286, -258, -227, -195,\ - -161, -124, -87, -49, -10, 29, 68, 106,\ - 143, 178, 212, 243, 272, 299, 324, 346,\ - 366, 384, 400, 414, 427, 438, 448, 506 },\ + -161, -124, -87, -49, -10, 29, 68, 106,\ + 143, 178, 212, 243, 272, 299, 324, 346,\ + 366, 384, 400, 414, 427, 438, 448, 506 },\ /* K3 */\ { -407, -381, -349, -311, -268, -218, -162, -102,\ - -39, 25, 89, 149, 206, 257, 302, 341 },\ + -39, 25, 89, 149, 206, 257, 302, 341 },\ /* K4 */\ { -290, -252, -209, -163, -114, -62, -9, 44,\ 97, 147, 194, 238, 278, 313, 344, 371 },\ @@ -207,14 +207,14 @@ struct tms5100_coeffs 49, 101, 150, 196, 239, 278, 313, 344 },\ /* K6 */\ { -193, -152, -109, -65, -20, 26, 71, 115,\ - 158, 198, 235, 270, 301, 330, 355, 377 },\ + 158, 198, 235, 270, 301, 330, 355, 377 },\ /* K7 */\ { -254, -218, -180, -140, -97, -53, -8, 36,\ 81, 124, 165, 204, 240, 274, 304, 332 },\ /* K8 */\ { -205, -112, -10, 92, 187, 269, 336, 387 },\ /* K9 */\ - { -249, -183, -110, -32, 48, 126, 198, 261 }, /* on patents 4,403,965 and 4,946,391 the 4th entry is -19 which is wrong! should be -32*/\ + { -249, -183, -110, -32, 48, 126, 198, 261 }, /* on patents 4,403,965 and 4,946,391 the 4th entry is 0x3ED (-19) which is a typo of the correct value of 0x3E0 (-32)*/\ /* K10 */\ { -190, -133, -73, -10, 53, 115, 173, 227 }, @@ -222,26 +222,26 @@ struct tms5100_coeffs #define TI_2802_LPC \ /* K1 */\ { -501, -498, -495, -490, -485, -478, -469, -459,\ - -446, -431, -412, -389, -362, -331, -295, -253,\ - -207, -156, -102, -45, 13, 70, 126, 179,\ - 228, 272, 311, 345, 374, 399, 420, 437},\ + -446, -431, -412, -389, -362, -331, -295, -253,\ + -207, -156, -102, -45, 13, 70, 126, 179,\ + 228, 272, 311, 345, 374, 399, 420, 437},\ /* K2 */\ { -376, -357, -335, -312, -286, -258, -227, -195,\ - -161, -124, -87, -49, -10, 29, 68, 106,\ - 143, 178, 212, 243, 272, 299, 324, 346,\ - 366, 384, 400, 414, 427, 438, 448, 506},\ + -161, -124, -87, -49, -10, 29, 68, 106,\ + 143, 178, 212, 243, 272, 299, 324, 346,\ + 366, 384, 400, 414, 427, 438, 448, 506},\ /* K3 */\ { -407, -381, -349, -311, -268, -218, -162, -102,\ - -39, 25, 89, 149, 206, 257, 302, 341},\ + -39, 25, 89, 149, 206, 257, 302, 341},\ /* K4 */\ { -289, -248, -202, -152, -98, -43, 14, 71,\ - 125, 177, 225, 269, 307, 341, 371, 506},\ + 125, 177, 225, 269, 307, 341, 371, 506},\ /* K5 */\ { -318, -283, -245, -202, -156, -107, -56, -3,\ 49, 101, 150, 196, 239, 278, 313, 344},\ /* K6 */\ { -193, -152, -109, -65, -20, 26, 71, 115,\ - 158, 198, 235, 270, 301, 330, 355, 377},\ + 158, 198, 235, 270, 301, 330, 355, 377},\ /* K7 */\ { -254, -218, -180, -140, -97, -53, -8, 36,\ 81, 124, 165, 204, 240, 274, 304, 332},\ @@ -255,20 +255,20 @@ struct tms5100_coeffs #define TI_5110_5220_LPC \ /* K1 */\ { -501, -498, -497, -495, -493, -491, -488, -482,\ - -478, -474, -469, -464, -459, -452, -445, -437,\ - -412, -380, -339, -288, -227, -158, -81, -1,\ + -478, -474, -469, -464, -459, -452, -445, -437,\ + -412, -380, -339, -288, -227, -158, -81, -1,\ 80, 157, 226, 287, 337, 379, 411, 436 },\ /* K2 */\ { -328, -303, -274, -244, -211, -175, -138, -99,\ - -59, -18, 24, 64, 105, 143, 180, 215,\ - 248, 278, 306, 331, 354, 374, 392, 408,\ - 422, 435, 445, 455, 463, 470, 476, 506 },\ + -59, -18, 24, 64, 105, 143, 180, 215,\ + 248, 278, 306, 331, 354, 374, 392, 408,\ + 422, 435, 445, 455, 463, 470, 476, 506 },\ /* K3 */\ { -441, -387, -333, -279, -225, -171, -117, -63,\ -9, 45, 98, 152, 206, 260, 314, 368 },\ /* K4 */\ { -328, -273, -217, -161, -106, -50, 5, 61,\ - 116, 172, 228, 283, 339, 394, 450, 506 },\ + 116, 172, 228, 283, 339, 394, 450, 506 },\ /* K5 */\ { -328, -282, -235, -189, -142, -96, -50, -3,\ 43, 90, 136, 182, 229, 275, 322, 368 },\ @@ -288,34 +288,45 @@ struct tms5100_coeffs /* chirp */ #define TI_0280_PATENT_CHIRP \ /* Chirp table */\ - { 0, 42, -44, 50, -78, 18, 37, 20,\ - 2, -31, -59, 2, 95, 90, 5, 15,\ - 38, -4, -91,-91, -42,-35,-36, -4,\ - 37, 43, 34, 33, 15, -1, -8,-18,\ - -19,-17, -9,-10, -6, 0, 3, 2,\ - 1, 0, 0, 0, 0, 0, 0, 0,\ - 0, 0, 0, 0 }, + { 0x00, 0x2a, 0xd4, 0x32, 0xb2, 0x12, 0x25, 0x14,\ + 0x02, 0xe1, 0xc5, 0x02, 0x5f, 0x5a, 0x05, 0x0f,\ + 0x26, 0xfc, 0xa5, 0xa5, 0xd6, 0xdd, 0xdc, 0xfc,\ + 0x25, 0x2b, 0x22, 0x21, 0x0f, 0xff, 0xf8, 0xee,\ + 0xed, 0xef, 0xf7, 0xf6, 0xfa, 0x00, 0x03, 0x02,\ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00 }, + +// almost, but not exactly the same as the patent chirp above (25 bits differ) +#define TI_2801_CHIRP \ + /* Chirp table */\ + { 0x00, 0x2b, 0xd4, 0x33, 0xb3, 0x12, 0x25, 0x14,\ + 0x02, 0xe2, 0xc6, 0x03, 0x60, 0x5b, 0x05, 0x0f,\ + 0x26, 0xfc, 0xa6, 0xa5, 0xd6, 0xdd, 0xdd, 0xfd,\ + 0x25, 0x2b, 0x23, 0x22, 0x0f, 0xff, 0xf8, 0xef,\ + 0xed, 0xef, 0xf7, 0xf7, 0xfa, 0x01, 0x04, 0x03,\ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00 }, //TODO: Fix me! below is INACCURATE, no decap of 2802 yet! #define TI_2802_CHIRP \ /* Chirp table */\ - { 0, 42, -44, 50, -78, 18, 37, 20,\ - 2, -31, -59, 2, 95, 90, 5, 15,\ - 38, -4, -91,-91, -42,-35,-36, -4,\ - 37, 43, 34, 33, 15, -1, -8,-18,\ - -19,-17, -9,-10, -6, 0, 3, 2,\ - 1, 0, 0, 0, 0, 0, 0, 0,\ - 0, 0, 0, 0 }, + { 0x00, 0xa3, 0xbe, 0xee, 0x38, 0x78, 0x7f, 0x3e,\ + 0xe2, 0xe0, 0x26, 0x19, 0xce, 0x06, 0x1e, 0xd0,\ + 0x12, 0xcd, 0xea, 0xde, 0xda, 0x02, 0xff, 0x06,\ + 0xfe, 0x00, 0xfe, 0xfb, 0xfd, 0xfd, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00 }, #define TI_LATER_CHIRP \ /* Chirp table */\ - { 0x00, 0x03, 0x0F, 0x28, 0x4C, 0x6C, 0x71, 0x50,\ - 0x25, 0x26, 0x4C, 0x44, 0x1A, 0x32, 0x3B, 0x13,\ - 0x37, 0x1A, 0x25, 0x1F, 0x1D, 0x00, 0x00, 0x00,\ - 0, 0, 0, 0, 0, 0, 0, 0,\ - 0, 0, 0, 0, 0, 0, 0, 0,\ - 0, 0, 0, 0, 0, 0, 0, 0,\ - 0, 0, 0, 0 }, + { 0x00, 0x03, 0x0f, 0x28, 0x4c, 0x6c, 0x71, 0x50,\ + 0x25, 0x26, 0x4c, 0x44, 0x1a, 0x32, 0x3b, 0x13,\ + 0x37, 0x1a, 0x25, 0x1f, 0x1d, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00 }, /* TMS5100/TMC0281: (Die revs A, B; 1977?-1981?) @@ -379,11 +390,18 @@ static const struct tms5100_coeffs T0280D_0281D_coeff = Used in the Speak & Math, Speak & Read, and Language Translator Decapped by Digshadow in 2014 http://siliconpr0n.org/map/ti/tmc0280fnl/ Digitally dumped via PROMOUT by PlgDavid in 2014 - The coefficients are exactly the same as the TMS5200 - The coefficients also come from US Patents 4,403,965 and 4,946,391 (with one error in the patent); -The Mitsubishi M58817 also seems to work best with these coefficients, so its possible the engineers of that chip copied them from the TI patents, see next entry - ***TODO: there are 2 versions of this chip, and the interpolation behavior between the two differs slightly: - * TMC0280NLP // CD2801 with datecodes around 1980 has the same interpolation inhibit behavior as 5100/TMC0281 on unvoiced->silent transition + The coefficients are exactly the same as the TMS5200. + The coefficients also come from US Patents 4,403,965 and 4,946,391 (with + one typo in the patent). + The chirp table is very slightly different from the 4,209,836 patent one, + but matches the table in the 4,403,965 and 4,946,391 patents. + The Mitsubishi M58817 also seems to work best with these coefficients, so + it is possible the engineers of that chip copied them from the TI patents. + ***TODO: there are 2 versions of this chip, and the interpolation + behavior between the two differs slightly: + * TMC0280NLP // CD2801 with datecodes around 1980 has the same + interpolation inhibit behavior as 5100/TMC0281 on unvoiced->silent + transition. * CD2801A-NL with datecodes around 1982 have the 'alternate behavior' */ static const struct tms5100_coeffs T0280F_2801A_coeff = @@ -399,13 +417,16 @@ static const struct tms5100_coeffs T0280F_2801A_coeff = { TI_2801_2501E_LPC }, - TI_0280_PATENT_CHIRP + TI_2801_CHIRP /* interpolation coefficients */ { 3, 3, 3, 2, 2, 1, 1, 0 } }; /* Mitsubishi M58817 -The Mitsubishi M58817 seems to have (partly?) copied the coefficients from the TMC0280/CD2801 above, but has some slight differences to it within the chip: the main accumulator seems to have 1 extra bit and the digital values are tapped 1 bit higher than on the TI chips. This is emulated within tms5110.c +The Mitsubishi M58817 seems to have (partly?) copied the coefficients from the +TMC0280/CD2801 above, but has some slight differences to it within the chip: +the main accumulator seems to have 1 extra bit and the digital values are +tapped 1 bit higher than on the TI chips. This is emulated within tms5110.c */ static const struct tms5100_coeffs M58817_coeff = { @@ -420,7 +441,7 @@ static const struct tms5100_coeffs M58817_coeff = { TI_2801_2501E_LPC }, - TI_0280_PATENT_CHIRP + TI_2801_CHIRP /* interpolation coefficients */ { 3, 3, 3, 2, 2, 1, 1, 0 } }; @@ -448,7 +469,7 @@ static const struct tms5100_coeffs T0280F_2802_coeff = /* interpolation coefficients */ { 3, 3, 3, 2, 2, 1, 1, 0 } }; - + /* TMS5110A: (1984-90 era? early chips may be called TMS5110C; later chips past 1988 or so may be called TSP5110A) The TMS5110A LPC coefficients were originally read from an actual TMS5110A @@ -549,16 +570,17 @@ Note that the K coefficients are VERY different from the coefficients given in the US 4,335,277 patent, which may have been for some sort of prototype or otherwise intentionally scrambled. The energy and pitch tables, however, are identical to that patent. -Also note, that the K coefficients are ALMOST identical to the coefficients from the CD2802. -The interpolation coefficients still come from the patents pending verification - of the interpolation counter circuit from the chip decap image. +Also note, that the K coefficients are identical to the coefficients from the + CD2801 (which itself is almost identical to the CD2802). NOTE FROM DECAP: immediately to the left of each of the K1,2,3,4,5,and 6 coefficients in the LPC rom are extra columns containing the constants -510, -502, 313, 318, or in hex 0x202, 0x20A, 0x139, 0x13E. Those EXACT constants DO appear (rather nonsensically) on the lpc table in US patent 4,335,277. They are likely related to the multiplicative interpolator described in us patent 4,419,540; whether the 5200/2501E and the 5220 or 5220C - actually implement this interpolator or not is unclear. + actually implement this interpolator or not is unclear. This interpolator + seems intended for chips with variable frame rate, so it may only exist + on the TMS/TSP5220C and CD2501ECD. */ static const struct tms5100_coeffs T0285_2501E_coeff = diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index 004925d031f..d71344a01e8 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -920,9 +920,9 @@ void tms5220_device::process(INT16 *buffer, unsigned int size) * disabled, forcing all samples beyond 51d to be == 51d */ if (m_pitch_count >= 51) - m_excitation_data = m_coeff->chirptable[51]; + m_excitation_data = (INT8)m_coeff->chirptable[51]; else /*m_pitch_count < 51*/ - m_excitation_data = m_coeff->chirptable[m_pitch_count]; + m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; } // Update LFSR *20* times every sample (once per T cycle), like patent shows diff --git a/src/emu/sound/x1_010.c b/src/emu/sound/x1_010.c index 0d2abed892a..5d8377569bb 100644 --- a/src/emu/sound/x1_010.c +++ b/src/emu/sound/x1_010.c @@ -22,7 +22,7 @@ Registers: Reg: Bits: Meaning: 0 7--- ---- Frequency divider flag (only downtown seems to set this) - -654 3--- + -654 3--- ---- -2-- PCM/Waveform repeat flag (0:Ones 1:Repeat) (*1) ---- --1- Sound out select (0:PCM 1:Waveform) ---- ---0 Key on / off diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index 7e323f3d525..401bf2441f0 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -250,23 +250,23 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t * { // 8 bit case 0: - sample = m_direct->read_raw_byte(slot->startaddr + (slot->stepptr>>16))<<8; + sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>16))<<8; break; // 12 bit case 1: if (slot->stepptr & 0x10000) - sample = m_direct->read_raw_byte(slot->startaddr + (slot->stepptr>>17)*3+2)<<8 | - (m_direct->read_raw_byte(slot->startaddr + (slot->stepptr>>17)*3+1) << 4 & 0xf0); + sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+2)<<8 | + (m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) << 4 & 0xf0); else - sample = m_direct->read_raw_byte(slot->startaddr + (slot->stepptr>>17)*3)<<8 | - (m_direct->read_raw_byte(slot->startaddr + (slot->stepptr>>17)*3+1) & 0xf0); + sample = m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3)<<8 | + (m_direct->read_byte(slot->startaddr + (slot->stepptr>>17)*3+1) & 0xf0); break; // 16 bit case 2: - sample = m_direct->read_raw_byte(slot->startaddr + ((slot->stepptr>>16)*2))<<8 | - m_direct->read_raw_byte(slot->startaddr + ((slot->stepptr>>16)*2)+1); + sample = m_direct->read_byte(slot->startaddr + ((slot->stepptr>>16)*2))<<8 | + m_direct->read_byte(slot->startaddr + ((slot->stepptr>>16)*2)+1); break; // ?? bit, effect is unknown, datasheet says it's prohibited @@ -480,7 +480,7 @@ void ymf278b_device::C_w(UINT8 reg, UINT8 data) else offset = m_wavetblhdr*0x80000 + (slot->wave - 384) * 12; for (i = 0; i < 12; i++) - p[i] = m_direct->read_raw_byte(offset+i); + p[i] = m_direct->read_byte(offset+i); slot->bits = (p[0]&0xc0)>>6; slot->startaddr = (p[2] | (p[1]<<8) | ((p[0]&0x3f)<<16)); @@ -752,7 +752,7 @@ READ8_MEMBER( ymf278b_device::read ) ret = (m_pcmregs[m_port_C] & 0x1f) | 0x20; // device ID in upper bits break; case 6: - ret = m_direct->read_raw_byte(m_memadr); + ret = m_direct->read_byte(m_memadr); m_memadr = (m_memadr + 1) & 0x3fffff; break; diff --git a/src/emu/validity.c b/src/emu/validity.c index 8ed4f1e7fe2..14f46661888 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -109,8 +109,6 @@ void validity_checker::validate_tag(const char *tag) // too short/too long = bad if (strlen(begin) < MIN_TAG_LENGTH) osd_printf_error("Tag '%s' is too short (must be at least %d characters)\n", tag, MIN_TAG_LENGTH); - if (strlen(begin) > MAX_TAG_LENGTH) - osd_printf_error("Tag '%s' is too long (must be less than %d characters)\n", tag, MAX_TAG_LENGTH); } diff --git a/src/emu/video/clgd542x.c b/src/emu/video/clgd542x.c index aee97491ef1..854611d1c80 100644 --- a/src/emu/video/clgd542x.c +++ b/src/emu/video/clgd542x.c @@ -296,7 +296,7 @@ void cirrus_gd5428_device::start_bitblt() else { UINT8 pixel = (vga.memory[m_blt_source_current % vga.svga_intf.vram_size] >> (7-(x % 8)) & 0x01) ? vga.gc.enable_set_reset : vga.gc.set_reset; // use GR0/1/10/11 background/foreground regs - + copy_pixel(pixel, vga.memory[m_blt_dest_current % vga.svga_intf.vram_size]); if((x % 8) == 7 && !(m_blt_mode & 0x40)) // don't increment if a pattern (it's only 8 bits) m_blt_source_current++; @@ -1403,7 +1403,7 @@ WRITE8_MEMBER(cirrus_gd5428_device::mem_w) if(svga.rgb8_en) { if(data & (0x01 << (7-i))) - vga.memory[((addr+offset)*8+i) % vga.svga_intf.vram_size] = vga.gc.enable_set_reset; + vga.memory[((addr+offset)*8+i) % vga.svga_intf.vram_size] = vga.gc.enable_set_reset; } else if(svga.rgb15_en || svga.rgb16_en) { diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 7b9f0b1fc1f..60f98535aa0 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -92,6 +92,7 @@ mc6845_device::mc6845_device(const machine_config &mconfig, device_type type, co : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_video_interface(mconfig, *this, false), m_show_border_area(true), + m_interlace_adjust(0), m_visarea_adjust_min_x(0), m_visarea_adjust_max_x(0), m_visarea_adjust_min_y(0), @@ -108,6 +109,7 @@ mc6845_device::mc6845_device(const machine_config &mconfig, const char *tag, dev : device_t(mconfig, MC6845, "MC6845 CRTC", tag, owner, clock, "mc6845", __FILE__), device_video_interface(mconfig, *this, false), m_show_border_area(true), + m_interlace_adjust(0), m_visarea_adjust_min_x(0), m_visarea_adjust_max_x(0), m_visarea_adjust_min_y(0), @@ -218,7 +220,7 @@ WRITE8_MEMBER( mc6845_device::register_w ) case 0x06: m_vert_disp = data & 0x7f; break; case 0x07: m_vert_sync_pos = data & 0x7f; break; case 0x08: m_mode_control = data & 0xff; break; - case 0x09: m_max_ras_addr = data & 0x1f; break; + case 0x09: m_max_ras_addr = data & 0x1f; if (MODE_INTERLACE_AND_VIDEO) m_max_ras_addr += m_interlace_adjust; break; case 0x0a: m_cursor_start_ras = data & 0x7f; break; case 0x0b: m_cursor_end_ras = data & 0x1f; break; case 0x0c: m_disp_start_addr = ((data & 0x3f) << 8) | (m_disp_start_addr & 0x00ff); break; @@ -454,10 +456,6 @@ void mc6845_device::recompute_parameters(bool postload) { UINT16 hsync_on_pos, hsync_off_pos, vsync_on_pos, vsync_off_pos; - // needed for the apricot, correct? - if (MODE_INTERLACE_AND_VIDEO) - m_max_ras_addr |= 1; - UINT16 video_char_height = m_max_ras_addr + 1; // fix garbage at the bottom of the screen (eg victor9k) // Would be useful for 'interlace and video' mode support... // UINT16 frame_char_height = (MODE_INTERLACE_AND_VIDEO ? m_max_ras_addr / 2 : m_max_ras_addr) + 1; diff --git a/src/emu/video/mc6845.h b/src/emu/video/mc6845.h index db7e80f84a5..053c2b9491e 100644 --- a/src/emu/video/mc6845.h +++ b/src/emu/video/mc6845.h @@ -30,6 +30,9 @@ #define MCFG_MC6845_SHOW_BORDER_AREA(_show) \ mc6845_device::set_show_border_area(*device, _show); +#define MCFG_MC6845_INTERLACE_ADJUST(_value) \ + mc6845_device::set_interlace_adjust(*device, _value); + #define MCFG_MC6845_VISAREA_ADJUST(_minx, _maxx, _miny, _maxy) \ mc6845_device::set_visarea_adjust(*device, _minx, _maxx, _miny, _maxy); @@ -96,6 +99,7 @@ public: mc6845_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); static void set_show_border_area(device_t &device, bool show) { downcast<mc6845_device &>(device).m_show_border_area = show; } + static void set_interlace_adjust(device_t &device, int value) { downcast<mc6845_device &>(device).m_interlace_adjust = value; } static void set_visarea_adjust(device_t &device, int min_x, int max_x, int min_y, int max_y) { mc6845_device &dev = downcast<mc6845_device &>(device); @@ -272,6 +276,7 @@ protected: ************************/ bool m_show_border_area; /* visible screen area (false) active display (true) active display + blanking */ + int m_interlace_adjust; /* adjust max ras in interlace mode */ /* visible screen area adjustment */ int m_visarea_adjust_min_x; diff --git a/src/emu/video/rgbgen.c b/src/emu/video/rgbgen.c new file mode 100644 index 00000000000..934219108f2 --- /dev/null +++ b/src/emu/video/rgbgen.c @@ -0,0 +1,112 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, Ryan Holtz +/*************************************************************************** + + rgbgen.c + + General RGB utilities. + +***************************************************************************/ + +#if !defined(__ALTIVEC__) + +#include "emu.h" +#include "rgbgen.h" + +/*************************************************************************** + HIGHER LEVEL OPERATIONS +***************************************************************************/ + +/*------------------------------------------------- + rgbaint_blend - blend two colors by the given + scale factor +-------------------------------------------------*/ + +void rgbaint_t::blend(const rgbaint_t& color2, UINT8 color1scale) +{ + INT32 scale1 = (INT32)color1scale; + INT32 scale2 = 256 - scale1; + + m_a = (m_a * scale1 + color2.m_a * scale2) >> 8; + m_r = (m_r * scale1 + color2.m_r * scale2) >> 8; + m_g = (m_g * scale1 + color2.m_g * scale2) >> 8; + m_b = (m_b * scale1 + color2.m_b * scale2) >> 8; +} + + +/*------------------------------------------------- + rgbaint_scale_and_clamp - scale the given + color by an 8.8 scale factor, immediate or + per channel, and clamp to byte values +-------------------------------------------------*/ + +void rgbaint_t::scale_imm_and_clamp(INT32 scale) +{ + m_a = (m_a * scale) >> 8; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale) >> 8; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale) >> 8; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale) >> 8; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) +{ + m_a = (m_a * scale.m_a) >> 8; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r) >> 8; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g) >> 8; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b) >> 8; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + + +void rgbaint_t::scale_imm_add_and_clamp(INT32 scale, const rgbaint_t& other) +{ + m_a = (m_a * scale) >> 8; + m_a += other.m_a; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale) >> 8; + m_r += other.m_r; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale) >> 8; + m_g += other.m_g; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale) >> 8; + m_b += other.m_b; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) +{ + m_a = (m_a * scale.m_a) >> 8; + m_a += other.m_a; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r) >> 8; + m_r += other.m_r; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g) >> 8; + m_g += other.m_g; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b) >> 8; + m_b += other.m_b; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) +{ + m_a = (m_a * scale.m_a + other.m_a * scale2.m_a) >> 8; + if ((UINT16)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r + other.m_r * scale2.m_r) >> 8; + if ((UINT16)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g + other.m_g * scale2.m_g) >> 8; + if ((UINT16)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b + other.m_b * scale2.m_b) >> 8; + if ((UINT16)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +#endif // !defined(__ALTIVEC__) diff --git a/src/emu/video/rgbgen.h b/src/emu/video/rgbgen.h index db88f65b4a0..743896db92f 100644 --- a/src/emu/video/rgbgen.h +++ b/src/emu/video/rgbgen.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbgen.h @@ -16,511 +16,441 @@ TYPE DEFINITIONS ***************************************************************************/ -/* intermediate RGB values are stored in a struct */ -struct rgbint { INT16 dummy, r, g, b; }; - -/* intermediate RGB values are stored in a struct */ -struct rgbaint { INT16 a, r, g, b; }; - - - -/*************************************************************************** - BASIC CONVERSIONS -***************************************************************************/ - -/*------------------------------------------------- - rgb_comp_to_rgbint - converts a trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b) -{ - rgb->r = r; - rgb->g = g; - rgb->b = b; -} - - -/*------------------------------------------------- - rgba_comp_to_rgbint - converts a quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b) -{ - rgb->a = a; - rgb->r = r; - rgb->g = g; - rgb->b = b; -} - - -/*------------------------------------------------- - rgb_to_rgbint - converts a packed trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color) -{ - rgb->r = color.r(); - rgb->g = color.g(); - rgb->b = color.b(); -} - - -/*------------------------------------------------- - rgba_to_rgbaint - converts a packed quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color) -{ - rgb->a = color.a(); - rgb->r = color.r(); - rgb->g = color.g(); - rgb->b = color.b(); -} - - -/*------------------------------------------------- - rgbint_to_rgb - converts an rgbint back to - a packed trio of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb(const rgbint *color) -{ - return rgb_t(color->r, color->g, color->b); -} - - -/*------------------------------------------------- - rgbaint_to_rgba - converts an rgbint back to - a packed quad of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) -{ - return rgb_t(color->a, color->r, color->g, color->b); -} - - -/*------------------------------------------------- - rgbint_to_rgb_clamp - converts an rgbint back - to a packed trio of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) -{ - UINT8 r = (color->r < 0) ? 0 : (color->r > 255) ? 255 : color->r; - UINT8 g = (color->g < 0) ? 0 : (color->g > 255) ? 255 : color->g; - UINT8 b = (color->b < 0) ? 0 : (color->b > 255) ? 255 : color->b; - return rgb_t(r, g, b); -} - - -/*------------------------------------------------- - rgbaint_to_rgba_clamp - converts an rgbint back - to a packed quad of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) -{ - UINT8 a = (color->a < 0) ? 0 : (color->a > 255) ? 255 : color->a; - UINT8 r = (color->r < 0) ? 0 : (color->r > 255) ? 255 : color->r; - UINT8 g = (color->g < 0) ? 0 : (color->g > 255) ? 255 : color->g; - UINT8 b = (color->b < 0) ? 0 : (color->b > 255) ? 255 : color->b; - return rgb_t(a, r, g, b); -} - - - -/*************************************************************************** - CORE MATH -***************************************************************************/ - -/*------------------------------------------------- - rgbint_add - add two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_add(rgbint *color1, const rgbint *color2) -{ - color1->r += color2->r; - color1->g += color2->g; - color1->b += color2->b; -} - - -/*------------------------------------------------- - rgbaint_add - add two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2) -{ - color1->a += color2->a; - color1->r += color2->r; - color1->g += color2->g; - color1->b += color2->b; -} - -/*------------------------------------------------- - rgbaint_add_imm - add immediate INT16 to rgbaint value --------------------------------------------------*/ - -INLINE void rgbaint_add_imm(rgbaint *color1, const INT16 imm) -{ - color1->a += imm; - color1->r += imm; - color1->g += imm; - color1->b += imm; -} - - -/*------------------------------------------------- - rgbint_sub - subtract two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_sub(rgbint *color1, const rgbint *color2) -{ - color1->r -= color2->r; - color1->g -= color2->g; - color1->b -= color2->b; -} - - -/*------------------------------------------------- - rgbaint_sub - subtract two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2) -{ - color1->a -= color2->a; - color1->r -= color2->r; - color1->g -= color2->g; - color1->b -= color2->b; -} - - -/*------------------------------------------------- - rgbint_subr - reverse subtract two rgbint - values --------------------------------------------------*/ - -INLINE void rgbint_subr(rgbint *color1, const rgbint *color2) -{ - color1->r = color2->r - color1->r; - color1->g = color2->g - color1->g; - color1->b = color2->b - color1->b; -} - - -/*------------------------------------------------- - rgbaint_subr - reverse subtract two rgbaint - values --------------------------------------------------*/ - -INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2) -{ - color1->a = color2->a - color1->a; - color1->r = color2->r - color1->r; - color1->g = color2->g - color1->g; - color1->b = color2->b - color1->b; -} - - -/*------------------------------------------------- - rgbint_shl - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shl(rgbint *color, UINT8 shift) -{ - color->r <<= shift; - color->g <<= shift; - color->b <<= shift; -} - - -/*------------------------------------------------- - rgbaint_shl - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shl(rgbaint *color, UINT8 shift) -{ - color->r <<= shift; - color->g <<= shift; - color->b <<= shift; - color->a <<= shift; -} - - -/*------------------------------------------------- - rgbint_shr - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shr(rgbint *color, UINT8 shift) -{ - color->r >>= shift; - color->g >>= shift; - color->b >>= shift; -} - - -/*------------------------------------------------- - rgbaint_shr - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shr(rgbaint *color, UINT8 shift) -{ - color->r >>= shift; - color->g >>= shift; - color->b >>= shift; - color->a >>= shift; -} - - - -/*************************************************************************** - HIGHER LEVEL OPERATIONS -***************************************************************************/ - -/*------------------------------------------------- - rgbint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) -{ - int scale1 = (int)color1scale; - int scale2 = 256 - scale1; - - color1->r = (color1->r * scale1 + color2->r * scale2) >> 8; - color1->g = (color1->g * scale1 + color2->g * scale2) >> 8; - color1->b = (color1->b * scale1 + color2->b * scale2) >> 8; -} - - -/*------------------------------------------------- - rgbaint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) -{ - int scale1 = (int)color1scale; - int scale2 = 256 - scale1; - - color1->a = (color1->a * scale1 + color2->a * scale2) >> 8; - color1->r = (color1->r * scale1 + color2->r * scale2) >> 8; - color1->g = (color1->g * scale1 + color2->g * scale2) >> 8; - color1->b = (color1->b * scale1 + color2->b * scale2) >> 8; -} - -/*------------------------------------------------- - rgbint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbint_scale_immediate_and_clamp(rgbint *color, INT16 colorscale) -{ - color->r = (color->r * colorscale) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbint_scale_channel_and_clamp(rgbint *color, const rgbint *colorscale) -{ - color->r = (color->r * colorscale->r) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale->g) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale->b) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - - -/*------------------------------------------------- - rgbaint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbaint_scale_immediate_and_clamp(rgbaint *color, INT16 colorscale) -{ - color->a = (color->a * colorscale) >> 8; - if ((UINT16)color->a > 255) { color->a = (color->a < 0) ? 0 : 255; } - color->r = (color->r * colorscale) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_and_clamp(rgbaint *color, const rgbaint *colorscale) -{ - color->a = (color->a * colorscale->a) >> 8; - if ((UINT16)color->a > 255) { color->a = (color->a < 0) ? 0 : 255; } - color->r = (color->r * colorscale->r) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale->g) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale->b) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_immediate_add_and_clamp(rgbaint *color1, INT16 colorscale, const rgbaint *color2) -{ - color1->a = (color1->a * colorscale) >> 8; - color1->a += color2->a; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale) >> 8; - color1->r += color2->r; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale) >> 8; - color1->g += color2->g; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale) >> 8; - color1->b += color2->b; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale, const rgbaint *color2) -{ - color1->a = (color1->a * colorscale->a) >> 8; - color1->a += color2->a; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale->r) >> 8; - color1->r += color2->r; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale->g) >> 8; - color1->g += color2->g; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale->b) >> 8; - color1->b += color2->b; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale1, const rgbaint *color2, const rgbaint *colorscale2) -{ - color1->a = (color1->a * colorscale1->a + color2->a * colorscale2->a) >> 8; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale1->r + color2->r * colorscale2->r) >> 8; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale1->g + color2->g * colorscale2->g) >> 8; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale1->b + color2->b * colorscale2->b) >> 8; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - - -/*------------------------------------------------- - rgb_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE UINT32 rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8); - ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8); - - return (ag0 & 0x0000ff00) | (rb0 & 0x00ff00ff); -} - - -/*------------------------------------------------- - rgba_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE UINT32 rgba_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - rgb00 = rgb00 >> 8; - rgb01 = rgb01 >> 8; - rgb10 = rgb10 >> 8; - rgb11 = rgb11 >> 8; - ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - - return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); -} - - -/*------------------------------------------------- - rgbint_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE void rgbint_bilinear_filter(rgbint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8); - ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8); - - color->r = rb0 >> 16; - color->g = ag0 >> 8; - color->b = rb0; -} - - -/*------------------------------------------------- - rgbaint_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE void rgbaint_bilinear_filter(rgbaint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - rgb00 = rgb00 >> 8; - rgb01 = rgb01 >> 8; - rgb10 = rgb10 >> 8; - rgb11 = rgb11 >> 8; - ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - - color->a = ag0 >> 16; - color->r = rb0 >> 16; - color->g = ag0; - color->b = rb0; -} - - -#endif /* __RGBUTIL__ */ +class rgbaint_t +{ +public: + inline rgbaint_t() { } + inline rgbaint_t(UINT32 rgba) { set(rgba); } + inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); } + inline rgbaint_t(rgb_t& rgba) { set(rgba); } + + inline void set(rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); } + inline void set(UINT32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } + inline void set(UINT32 a, UINT32 r, UINT32 g, UINT32 b) + { + m_a = a; + m_r = r; + m_g = g; + m_b = b; + } + inline void set(rgb_t& rgba) { set(rgba.a(), rgba.r(), rgba.g(), rgba.b()); } + + inline rgb_t to_rgba() + { + return rgb_t(m_a, m_r, m_g, m_b); + } + + inline rgb_t to_rgba_clamp() + { + UINT8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + UINT8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + UINT8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + UINT8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + return rgb_t(a, r, g, b); + } + + inline void add(const rgbaint_t& color) + { + add_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void add_imm(const UINT32 imm) + { + add_imm_rgba(imm, imm, imm, imm); + } + + inline void add_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a += a; + m_r += r; + m_g += g; + m_b += b; + } + + inline void sub(const rgbaint_t& color) + { + sub_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void sub_imm(const UINT32 imm) + { + sub_imm_rgba(imm, imm, imm, imm); + } + + inline void sub_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a -= a; + m_r -= r; + m_g -= g; + m_b -= b; + } + + inline void subr(rgbaint_t& color) + { + subr_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void subr_imm(const UINT32 imm) + { + subr_imm_rgba(imm, imm, imm, imm); + } + + inline void subr_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a = a - m_a; + m_r = r - m_r; + m_g = g - m_g; + m_b = b - m_b; + } + + inline void set_a(const UINT32 value) + { + m_r = value; + } + + inline void set_r(const UINT32 value) + { + m_r = value; + } + + inline void set_g(const UINT32 value) + { + m_g = value; + } + + inline void set_b(const UINT32 value) + { + m_b = value; + } + + inline UINT8 get_a() + { + return m_r; + } + + inline UINT8 get_r() + { + return m_r; + } + + inline UINT8 get_g() + { + return m_g; + } + + inline UINT8 get_b() + { + return m_b; + } + + inline UINT32 get_a32() + { + return m_a; + } + + inline UINT32 get_r32() + { + return m_r; + } + + inline UINT32 get_g32() + { + return m_g; + } + + inline UINT32 get_b32() + { + return m_b; + } + + inline void mul(rgbaint_t& color) + { + mul_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void mul_imm(const UINT32 imm) + { + mul_imm_rgba(imm, imm, imm, imm); + } + + inline void mul_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a *= a; + m_r *= r; + m_g *= g; + m_b *= b; + } + + inline void shl(const rgbaint_t& shift) + { + m_a <<= shift.m_a; + m_r <<= shift.m_r; + m_g <<= shift.m_g; + m_b <<= shift.m_b; + } + + inline void shl_imm(const UINT8 shift) + { + if (shift == 0) + return; + + m_a <<= shift; + m_r <<= shift; + m_g <<= shift; + m_b <<= shift; + } + + inline void shr(const rgbaint_t& shift) + { + m_a >>= shift.m_a; + m_r >>= shift.m_r; + m_g >>= shift.m_g; + m_b >>= shift.m_b; + } + + inline void shr_imm(const UINT8 shift) + { + if (shift == 0) + return; + + m_a >>= shift; + m_r >>= shift; + m_g >>= shift; + m_b >>= shift; + } + + inline void sra(const rgbaint_t& shift) + { + m_a >>= shift.m_a; + if (m_a & (1 << (31 - shift.m_a))) + m_a |= ~0 << (32 - shift.m_a); + + m_r >>= shift.m_r; + if (m_r & (1 << (31 - shift.m_r))) + m_r |= ~0 << (32 - shift.m_r); + + m_g >>= shift.m_g; + if (m_g & (1 << (31 - shift.m_g))) + m_g |= ~0 << (32 - shift.m_g); + + m_b >>= shift.m_b; + if (m_b & (1 << (31 - shift.m_b))) + m_b |= ~0 << (32 - shift.m_b); + } + + inline void sra_imm(const UINT8 shift) + { + const UINT32 high_bit = 1 << (31 - shift); + const UINT32 high_mask = ~0 << (32 - shift); + + m_a >>= shift; + if (m_a & high_bit) + m_a |= high_mask; + + m_r >>= shift; + if (m_r & high_bit) + m_r |= high_mask; + + m_g >>= shift; + if (m_g & high_bit) + m_g |= high_mask; + + m_b >>= shift; + if (m_b & high_bit) + m_b |= high_mask; + } + + inline void or_reg(const rgbaint_t& color) + { + or_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void or_imm(const UINT32 imm) + { + or_imm_rgba(imm, imm, imm, imm); + } + + inline void or_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a |= a; + m_r |= r; + m_g |= g; + m_b |= b; + } + + inline void and_reg(const rgbaint_t& color) + { + and_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void and_imm(const UINT32 imm) + { + and_imm_rgba(imm, imm, imm, imm); + } + + inline void and_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a &= a; + m_r &= r; + m_g &= g; + m_b &= b; + } + + inline void xor_reg(const rgbaint_t& color) + { + xor_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void xor_imm(const UINT32 imm) + { + xor_imm_rgba(imm, imm, imm, imm); + } + + inline void xor_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a ^= a; + m_r ^= r; + m_g ^= g; + m_b ^= b; + } + + inline void clamp_and_clear(const UINT32 sign) + { + if (m_a & sign) + m_a = 0; + + if (m_r & sign) + m_r = 0; + + if (m_g & sign) + m_g = 0; + + if (m_b & sign) + m_b = 0; + + m_a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + m_r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + m_g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + m_b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + } + + inline void sign_extend(const UINT32 compare, const UINT32 sign) + { + if ((m_a & compare) == compare) + m_a |= sign; + + if ((m_r & compare) == compare) + m_r |= sign; + + if ((m_g & compare) == compare) + m_g |= sign; + + if ((m_b & compare) == compare) + m_b |= sign; + } + + inline void min(const UINT32 value) + { + m_a = (m_a > value) ? value : m_a; + m_r = (m_r > value) ? value : m_r; + m_g = (m_g > value) ? value : m_g; + m_b = (m_b > value) ? value : m_b; + } + + void blend(const rgbaint_t& other, UINT8 factor); + + void scale_and_clamp(const rgbaint_t& scale); + void scale_imm_and_clamp(const INT32 scale); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other); + + inline void cmpeq(const rgbaint_t& value) + { + m_a = (m_a == value.m_a) ? 0xffffffff : 0; + m_r = (m_r == value.m_r) ? 0xffffffff : 0; + m_g = (m_g == value.m_g) ? 0xffffffff : 0; + m_b = (m_b == value.m_b) ? 0xffffffff : 0; + } + + inline void cmpeq_imm(const UINT32 value) + { + m_a = (m_a == value) ? 0xffffffff : 0; + m_r = (m_r == value) ? 0xffffffff : 0; + m_g = (m_g == value) ? 0xffffffff : 0; + m_b = (m_b == value) ? 0xffffffff : 0; + } + + inline void cmpgt(const rgbaint_t& value) + { + m_a = (m_a > value.m_a) ? 0xffffffff : 0; + m_r = (m_r > value.m_r) ? 0xffffffff : 0; + m_g = (m_g > value.m_g) ? 0xffffffff : 0; + m_b = (m_b > value.m_b) ? 0xffffffff : 0; + } + + inline void cmpgt_imm(const UINT32 value) + { + m_a = (m_a > value) ? 0xffffffff : 0; + m_r = (m_r > value) ? 0xffffffff : 0; + m_g = (m_g > value) ? 0xffffffff : 0; + m_b = (m_b > value) ? 0xffffffff : 0; + } + + inline void cmplt(const rgbaint_t& value) + { + m_a = (m_a < value.m_a) ? 0xffffffff : 0; + m_r = (m_r < value.m_r) ? 0xffffffff : 0; + m_g = (m_g < value.m_g) ? 0xffffffff : 0; + m_b = (m_b < value.m_b) ? 0xffffffff : 0; + } + + inline void cmplt_imm(const UINT32 value) + { + m_a = (m_a < value) ? 0xffffffff : 0; + m_r = (m_r < value) ? 0xffffffff : 0; + m_g = (m_g < value) ? 0xffffffff : 0; + m_b = (m_b < value) ? 0xffffffff : 0; + } + + inline void merge_alpha(rgbaint_t& alpha) + { + m_a = alpha.m_a; + } + + inline rgbaint_t operator=(const rgbaint_t& other) + { + m_a = other.m_a; + m_r = other.m_r; + m_g = other.m_g; + m_b = other.m_b; + return *this; + } + + static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) + { + UINT32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + UINT32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + + rgb00 >>= 8; + rgb01 >>= 8; + rgb10 >>= 8; + rgb11 >>= 8; + + UINT32 ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + UINT32 ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + + rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); + ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); + + return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); + } + +protected: + UINT32 m_a; + UINT32 m_r; + UINT32 m_g; + UINT32 m_b; +}; + +#endif /* __RGBGEN__ */ diff --git a/src/emu/video/rgbsse.c b/src/emu/video/rgbsse.c new file mode 100644 index 00000000000..b4e3701a187 --- /dev/null +++ b/src/emu/video/rgbsse.c @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, Ryan Holtz +/*************************************************************************** + + rgbsse.c + + SSE optimized RGB utilities. + + WARNING: This code assumes SSE2 or greater capability. + +***************************************************************************/ + +#if defined(__SSE2__) || defined(_MSC_VER) + +#include "emu.h" +#include <emmintrin.h> +#include "rgbsse.h" + +/*************************************************************************** + HIGHER LEVEL OPERATIONS +***************************************************************************/ + +void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor) +{ + m_value = _mm_unpacklo_epi16(m_value, other.m_value); + m_value = _mm_madd_epi16(m_value, *(__m128i *)&rgbsse_statics.scale_table[factor][0]); + m_value = _mm_srli_epi32(m_value, 8); +} + +void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) +{ + mul(scale); + shr(8); + min(255); + max(0); +} + +void rgbaint_t::scale_imm_and_clamp(const INT32 scale) +{ + mul_imm(scale); + shr(8); + min(255); + max(0); +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) +{ + rgbaint_t color2(other); + color2.mul(scale2); + + mul(scale); + add(color2); + shr(8); + min(255); + max(0); +} + +void rgbaint_t::scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other) +{ + mul_imm(scale); + add(other); + shr(8); + min(255); + max(0); +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) +{ + mul(scale); + add(other); + shr(8); + min(255); + max(0); +} + +#endif // defined(__SSE2__) || defined(_MSC_VER) diff --git a/src/emu/video/rgbsse.h b/src/emu/video/rgbsse.h index 88a345f316c..6482330d29f 100644 --- a/src/emu/video/rgbsse.h +++ b/src/emu/video/rgbsse.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbsse.h @@ -15,238 +15,6 @@ #include <emmintrin.h> - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -/* intermediate RGB values are stored in an __m128i */ -typedef __m128i rgbint; - -/* intermediate RGB values are stored in an __m128i */ -typedef __m128i rgbaint; - - - -/*************************************************************************** - BASIC CONVERSIONS -***************************************************************************/ - -/*------------------------------------------------- - rgb_comp_to_rgbint - converts a trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b) -{ - *rgb = _mm_set_epi16(0, 0, 0, 0, 0, r, g, b); -} - - -/*------------------------------------------------- - rgba_comp_to_rgbint - converts a quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b) -{ - *rgb = _mm_set_epi16(0, 0, 0, 0, a, r, g, b); -} - - -/*------------------------------------------------- - rgb_to_rgbint - converts a packed trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color) -{ - *rgb = _mm_unpacklo_epi8(_mm_cvtsi32_si128(color), _mm_setzero_si128()); -} - - -/*------------------------------------------------- - rgba_to_rgbaint - converts a packed quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color) -{ - *rgb = _mm_unpacklo_epi8(_mm_cvtsi32_si128(color), _mm_setzero_si128()); -} - - -/*------------------------------------------------- - rgbint_to_rgb - converts an rgbint back to - a packed trio of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb(const rgbint *color) -{ - return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); -} - - -/*------------------------------------------------- - rgbaint_to_rgba - converts an rgbint back to - a packed quad of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) -{ - return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); -} - - -/*------------------------------------------------- - rgbint_to_rgb_clamp - converts an rgbint back - to a packed trio of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) -{ - return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); -} - - -/*------------------------------------------------- - rgbaint_to_rgba_clamp - converts an rgbint back - to a packed quad of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) -{ - return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); -} - - - -/*************************************************************************** - CORE MATH -***************************************************************************/ - -/*------------------------------------------------- - rgbint_add - add two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_add(rgbint *color1, const rgbint *color2) -{ - *color1 = _mm_add_epi16(*color1, *color2); -} - - -/*------------------------------------------------- - rgbaint_add - add two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2) -{ - *color1 = _mm_add_epi16(*color1, *color2); -} - -/*------------------------------------------------- - rgbaint_add_imm - add immediate INT16 to rgbaint value --------------------------------------------------*/ -INLINE void rgbaint_add_imm(rgbaint *color1, const INT16 imm) -{ - __m128i temp = _mm_set_epi16(0, 0, 0, 0, imm, imm, imm, imm); - *color1 = _mm_add_epi16(*color1, temp); -} - - -/*------------------------------------------------- - rgbint_sub - subtract two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_sub(rgbint *color1, const rgbint *color2) -{ - *color1 = _mm_sub_epi16(*color1, *color2); -} - - -/*------------------------------------------------- - rgbaint_sub - subtract two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2) -{ - *color1 = _mm_sub_epi16(*color1, *color2); -} - - -/*------------------------------------------------- - rgbint_subr - reverse subtract two rgbint - values --------------------------------------------------*/ - -INLINE void rgbint_subr(rgbint *color1, const rgbint *color2) -{ - __m128i temp = *color1; - *color1 = *color2; - *color1 = _mm_sub_epi16(*color1, temp); -} - - -/*------------------------------------------------- - rgbaint_subr - reverse subtract two rgbaint - values --------------------------------------------------*/ - -INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2) -{ - __m128i temp = *color1; - *color1 = *color2; - *color1 = _mm_sub_epi16(*color1, temp); -} - - -/*------------------------------------------------- - rgbint_shl - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shl(rgbint *color, UINT8 shift) -{ - *color = _mm_slli_epi16(*color, shift); -} - - -/*------------------------------------------------- - rgbaint_shl - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shl(rgbaint *color, UINT8 shift) -{ - *color = _mm_slli_epi16(*color, shift); -} - - -/*------------------------------------------------- - rgbint_shr - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shr(rgbint *color, UINT8 shift) -{ - *color = _mm_srli_epi16(*color, shift); -} - - -/*------------------------------------------------- - rgbaint_shr - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shr(rgbaint *color, UINT8 shift) -{ - *color = _mm_srli_epi16(*color, shift); -} - - - /*************************************************************************** TABLES ***************************************************************************/ @@ -255,194 +23,408 @@ extern const struct _rgbsse_statics { __m128 dummy_for_alignment; INT16 maxbyte[8]; + INT16 alpha_mask[8]; + INT16 red_mask[8]; + INT16 green_mask[8]; + INT16 blue_mask[8]; INT16 scale_table[256][8]; } rgbsse_statics; - - /*************************************************************************** - HIGHER LEVEL OPERATIONS + TYPE DEFINITIONS ***************************************************************************/ -/*------------------------------------------------- - rgbint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) -{ - *color1 = _mm_unpacklo_epi16(*color1, *color2); - *color1 = _mm_madd_epi16(*color1, *(__m128i *)&rgbsse_statics.scale_table[color1scale][0]); - *color1 = _mm_srli_epi32(*color1, 8); - *color1 = _mm_packs_epi32(*color1, *color1); -} - - -/*------------------------------------------------- - rgbaint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) -{ - rgbint_blend(color1, color2, color1scale); -} - - -/*------------------------------------------------- - rgbint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbint_scale_immediate_and_clamp(rgbint *color, INT16 colorscale) -{ - __m128i mscale = _mm_set1_epi16(colorscale); - *color = _mm_unpacklo_epi16(*color, _mm_setzero_si128()); - *color = _mm_madd_epi16(*color, mscale); - *color = _mm_srli_epi32(*color, 8); - *color = _mm_packs_epi32(*color, *color); - *color = _mm_min_epi16(*color, *(__m128i *)&rgbsse_statics.maxbyte); -} - -INLINE void rgbint_scale_channel_and_clamp(rgbint *color, const rgbint *colorscale) -{ - __m128i mscale = _mm_unpacklo_epi16(*colorscale, _mm_setzero_si128()); - *color = _mm_unpacklo_epi16(*color, _mm_setzero_si128()); - *color = _mm_madd_epi16(*color, mscale); - *color = _mm_srli_epi32(*color, 8); - *color = _mm_packs_epi32(*color, *color); - *color = _mm_min_epi16(*color, *(__m128i *)&rgbsse_statics.maxbyte); -} - -INLINE void rgbaint_scale_immediate_add_and_clamp(rgbaint *color1, INT16 colorscale, const rgbaint *color2) -{ - // color2 will get mutiplied by 2^8 (256) and then divided by 2^8 by the shift by 8 - __m128i mscale = _mm_unpacklo_epi16(_mm_set1_epi16(colorscale), _mm_set_epi16(0, 0, 0, 0, 256, 256, 256, 256)); - *color1 = _mm_unpacklo_epi16(*color1, *color2); - *color1 = _mm_madd_epi16(*color1, mscale); - *color1 = _mm_srli_epi32(*color1, 8); - *color1 = _mm_packs_epi32(*color1, *color1); - *color1 = _mm_min_epi16(*color1, *(__m128i *)&rgbsse_statics.maxbyte); -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale, const rgbaint *color2) -{ - // color2 will get mutiplied by 2^8 (256) and then divided by 2^8 by the shift by 8 - __m128i mscale = _mm_unpacklo_epi16(*colorscale, _mm_set_epi16(0, 0, 0, 0, 256, 256, 256, 256)); - *color1 = _mm_unpacklo_epi16(*color1, *color2); - *color1 = _mm_madd_epi16(*color1, mscale); - *color1 = _mm_srli_epi32(*color1, 8); - *color1 = _mm_packs_epi32(*color1, *color1); - *color1 = _mm_min_epi16(*color1, *(__m128i *)&rgbsse_statics.maxbyte); -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale1, const rgbaint *color2, const rgbaint *colorscale2) - -{ - __m128i mscale = _mm_unpacklo_epi16(*colorscale1, *colorscale2); - *color1 = _mm_unpacklo_epi16(*color1, *color2); - *color1 = _mm_madd_epi16(*color1, mscale); - *color1 = _mm_srli_epi32(*color1, 8); - *color1 = _mm_packs_epi32(*color1, *color1); - *color1 = _mm_min_epi16(*color1, *(__m128i *)&rgbsse_statics.maxbyte); -} - -/*------------------------------------------------- - rgbaint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbaint_scale_immediate_and_clamp(rgbaint *color, INT16 colorscale) -{ - rgbint_scale_immediate_and_clamp(color, colorscale); -} - -INLINE void rgbaint_scale_channel_and_clamp(rgbaint *color, const rgbint *colorscale) -{ - rgbint_scale_channel_and_clamp(color, color); -} - - -/*------------------------------------------------- - rgb_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE UINT32 rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - __m128i color00 = _mm_cvtsi32_si128(rgb00); - __m128i color01 = _mm_cvtsi32_si128(rgb01); - __m128i color10 = _mm_cvtsi32_si128(rgb10); - __m128i color11 = _mm_cvtsi32_si128(rgb11); - - /* interleave color01 and color00 at the byte level */ - color01 = _mm_unpacklo_epi8(color01, color00); - color11 = _mm_unpacklo_epi8(color11, color10); - color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128()); - color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128()); - color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]); - color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]); - color01 = _mm_slli_epi32(color01, 15); - color11 = _mm_srli_epi32(color11, 1); - color01 = _mm_max_epi16(color01, color11); - color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]); - color01 = _mm_srli_epi32(color01, 15); - color01 = _mm_packs_epi32(color01, color01); - color01 = _mm_packus_epi16(color01, color01); - return _mm_cvtsi128_si32(color01); -} - - -/*------------------------------------------------- - rgba_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE UINT32 rgba_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - return rgb_bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); -} - - -/*------------------------------------------------- - rgbint_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE void rgbint_bilinear_filter(rgbint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - __m128i color00 = _mm_cvtsi32_si128(rgb00); - __m128i color01 = _mm_cvtsi32_si128(rgb01); - __m128i color10 = _mm_cvtsi32_si128(rgb10); - __m128i color11 = _mm_cvtsi32_si128(rgb11); - - /* interleave color01 and color00 at the byte level */ - color01 = _mm_unpacklo_epi8(color01, color00); - color11 = _mm_unpacklo_epi8(color11, color10); - color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128()); - color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128()); - color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]); - color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]); - color01 = _mm_slli_epi32(color01, 15); - color11 = _mm_srli_epi32(color11, 1); - color01 = _mm_max_epi16(color01, color11); - color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]); - color01 = _mm_srli_epi32(color01, 15); - *color = _mm_packs_epi32(color01, color01); -} - - -/*------------------------------------------------- - rgbaint_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE void rgbaint_bilinear_filter(rgbaint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - rgbint_bilinear_filter(color, rgb00, rgb01, rgb10, rgb11, u, v); -} - +class rgbaint_t +{ +public: + inline rgbaint_t() { } + inline rgbaint_t(UINT32 rgba) { set(rgba); } + inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); } + inline rgbaint_t(rgb_t& rgb) { set(rgb); } + + inline void set(rgbaint_t& other) { m_value = other.m_value; } + inline void set(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } + inline void set(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { m_value = _mm_set_epi32(a, r, g, b); } + inline void set(rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); } + + inline rgb_t to_rgba() + { + return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, _mm_setzero_si128()), _mm_setzero_si128())); + } + + inline UINT32 to_argb8() + { + return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, _mm_setzero_si128()), _mm_setzero_si128())); + } + + inline rgb_t to_rgba_clamp() + { + return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, m_value), _mm_setzero_si128())); + } + + inline void add(const rgbaint_t& color2) + { + m_value = _mm_add_epi32(m_value, color2.m_value); + } + + inline void add_imm(const UINT32 imm) + { + m_value = _mm_add_epi32(m_value, _mm_set1_epi32(imm)); + } + + inline void add_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_add_epi32(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void sub(const rgbaint_t& color2) + { + m_value = _mm_sub_epi32(m_value, color2.m_value); + } + + inline void sub_imm(const UINT32 imm) + { + m_value = _mm_sub_epi32(m_value, _mm_set1_epi32(imm)); + } + + inline void sub_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_sub_epi32(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void subr(rgbaint_t& color2) + { + m_value = _mm_sub_epi32(color2.m_value, m_value); + } + + inline void subr_imm(const UINT32 imm) + { + m_value = _mm_sub_epi32(_mm_set1_epi32(imm), m_value); + } + + inline void subr_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_sub_epi32(_mm_set_epi32(a, r, g, b), m_value); + } + + inline void set_a(const UINT32 value) + { + m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.alpha_mask), _mm_set_epi32(value, 0, 0, 0)); + } + + inline void set_r(const UINT32 value) + { + m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.red_mask), _mm_set_epi32(0, value, 0, 0)); + } + + inline void set_g(const UINT32 value) + { + m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.green_mask), _mm_set_epi32(0, 0, value, 0)); + } + + inline void set_b(const UINT32 value) + { + m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.blue_mask), _mm_set_epi32(0, 0, 0, value)); + } + + inline UINT8 get_a() + { + return _mm_extract_epi16(m_value, 6); + } + + inline UINT8 get_r() + { + return _mm_extract_epi16(m_value, 4); + } + + inline UINT8 get_g() + { + return _mm_extract_epi16(m_value, 2); + } + + inline UINT8 get_b() + { + return _mm_extract_epi16(m_value, 0); + } + + inline UINT32 get_a32() + { + return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); + } + + inline UINT32 get_r32() + { + return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); + } + + inline UINT32 get_g32() + { + return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); + } + + inline UINT32 get_b32() + { + return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); + } + + inline void mul(const rgbaint_t& color) + { + __m128i tmp1 = _mm_mul_epu32(m_value, color.m_value); + __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(color.m_value, 4)); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); + } + + inline void mul_imm(const UINT32 imm) + { + __m128i immv = _mm_set1_epi32(imm); + __m128i tmp1 = _mm_mul_epu32(m_value, immv); + __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); + } + + inline void mul_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + __m128i immv = _mm_set_epi32(a, r, g, b); + __m128i tmp1 = _mm_mul_epu32(m_value, immv); + __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); + } + + inline void shl(const rgbaint_t& shift) + { + m_value = _mm_sll_epi32(m_value, shift.m_value); + } + + inline void shl_imm(const UINT8 shift) + { + m_value = _mm_slli_epi32(m_value, shift); + } + + inline void shr(const rgbaint_t& shift) + { + m_value = _mm_srl_epi32(m_value, shift.m_value); + } + + inline void shr_imm(const UINT8 shift) + { + m_value = _mm_srli_epi32(m_value, shift); + } + + inline void sra(const rgbaint_t& shift) + { + m_value = _mm_sra_epi32(m_value, shift.m_value); + } + + inline void sra_imm(const UINT8 shift) + { + m_value = _mm_srai_epi32(m_value, shift); + } + + inline void or_reg(const rgbaint_t& color2) + { + m_value = _mm_or_si128(m_value, color2.m_value); + } + + inline void or_imm(const UINT32 value) + { + m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); + } + + inline void or_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void and_reg(const rgbaint_t& color) + { + m_value = _mm_and_si128(m_value, color.m_value); + } + + inline void and_imm(const UINT32 value) + { + m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); + } + + inline void and_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void xor_reg(const rgbaint_t& color2) + { + m_value = _mm_xor_si128(m_value, color2.m_value); + } + + inline void xor_imm(const INT32 value) + { + m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); + } + + inline void xor_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void clamp_and_clear(const UINT32 sign) + { + __m128i vsign = _mm_set1_epi32(sign); + m_value = _mm_and_si128(m_value, _mm_cmpeq_epi32(_mm_and_si128(m_value, vsign), _mm_setzero_si128())); + vsign = _mm_srai_epi32(vsign, 1); + vsign = _mm_xor_si128(vsign, _mm_set1_epi32(0xffffffff)); + __m128i mask = _mm_cmpgt_epi32(m_value, vsign); + m_value = _mm_or_si128(_mm_and_si128(vsign, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); + } + + inline void sign_extend(const UINT32 compare, const UINT32 sign) + { + __m128i compare_vec = _mm_set1_epi32(compare); + __m128i compare_mask = _mm_cmpeq_epi32(_mm_and_si128(m_value, compare_vec), compare_vec); + __m128i compared = _mm_and_si128(_mm_set1_epi32(sign), compare_mask); + m_value = _mm_or_si128(m_value, compared); + } + + inline void min(const UINT32 value) + { + __m128i val = _mm_set1_epi32(value); + __m128i mask = _mm_cmpgt_epi32(m_value, val); + m_value = _mm_or_si128(_mm_and_si128(val, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); + } + + inline void max(const UINT32 value) + { + __m128i val = _mm_set1_epi32(value); + __m128i mask = _mm_cmplt_epi32(m_value, val); + m_value = _mm_or_si128(_mm_and_si128(val, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); + } + + void blend(const rgbaint_t& other, UINT8 factor); + + void scale_and_clamp(const rgbaint_t& scale); + void scale_imm_and_clamp(const INT32 scale); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other); + + inline void cmpeq(const rgbaint_t& value) + { + m_value = _mm_cmpeq_epi32(m_value, value.m_value); + } + + inline void cmpeq_imm(const UINT32 value) + { + m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); + } + + inline void cmpeq_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void cmpgt(const rgbaint_t& value) + { + m_value = _mm_cmpgt_epi32(m_value, value.m_value); + } + + inline void cmpgt_imm(const UINT32 value) + { + m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); + } + + inline void cmpgt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void cmplt(const rgbaint_t& value) + { + m_value = _mm_cmplt_epi32(m_value, value.m_value); + } + + inline void cmplt_imm(const UINT32 value) + { + m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); + } + + inline void cmplt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline rgbaint_t operator=(const rgbaint_t& other) + { + m_value = other.m_value; + return *this; + } + + inline rgbaint_t& operator+=(const rgbaint_t& other) + { + m_value = _mm_add_epi32(m_value, other.m_value); + return *this; + } + + inline rgbaint_t& operator+=(const INT32 other) + { + m_value = _mm_add_epi32(m_value, _mm_set1_epi32(other)); + return *this; + } + + inline rgbaint_t& operator-=(const rgbaint_t& other) + { + m_value = _mm_sub_epi32(m_value, other.m_value); + return *this; + } + + inline rgbaint_t& operator*=(const rgbaint_t& other) + { + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, other.m_value), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(other.m_value, 4)), _MM_SHUFFLE(0, 0, 2, 0))); + return *this; + } + + inline rgbaint_t& operator*=(const INT32 other) + { + const __m128i immv = _mm_set1_epi32(other); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, immv), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)), _MM_SHUFFLE(0, 0, 2, 0))); + return *this; + } + + inline rgbaint_t& operator>>=(const INT32 shift) + { + m_value = _mm_srai_epi32(m_value, shift); + return *this; + } + + inline void merge_alpha(const rgbaint_t& alpha) + { + m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 7), 7); + m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 6), 6); + } + + static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) + { + __m128i color00 = _mm_cvtsi32_si128(rgb00); + __m128i color01 = _mm_cvtsi32_si128(rgb01); + __m128i color10 = _mm_cvtsi32_si128(rgb10); + __m128i color11 = _mm_cvtsi32_si128(rgb11); + + /* interleave color01 and color00 at the byte level */ + color01 = _mm_unpacklo_epi8(color01, color00); + color11 = _mm_unpacklo_epi8(color11, color10); + color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128()); + color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128()); + color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]); + color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]); + color01 = _mm_slli_epi32(color01, 15); + color11 = _mm_srli_epi32(color11, 1); + color01 = _mm_max_epi16(color01, color11); + color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]); + color01 = _mm_srli_epi32(color01, 15); + color01 = _mm_packs_epi32(color01, _mm_setzero_si128()); + color01 = _mm_packus_epi16(color01, _mm_setzero_si128()); + return _mm_cvtsi128_si32(color01); + } + +protected: + __m128i m_value; +}; #endif /* __RGBSSE__ */ diff --git a/src/emu/video/rgbutil.c b/src/emu/video/rgbutil.c index b0815c754c8..9dfc4f02e2f 100644 --- a/src/emu/video/rgbutil.c +++ b/src/emu/video/rgbutil.c @@ -22,6 +22,10 @@ const struct _rgbsse_statics rgbsse_statics = { { 0 }, { 255, 255, 255, 255, 255, 255, 255, 255 }, + { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000 }, + { 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff }, + { 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff }, + { 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }, { { 0, 256, 0, 256, 0, 256, 0, 256 }, { 1, 255, 1, 255, 1, 255, 1, 255 }, { 2, 254, 2, 254, 2, 254, 2, 254 }, { 3, 253, 3, 253, 3, 253, 3, 253 }, @@ -154,147 +158,3 @@ const struct _rgbsse_statics rgbsse_statics = } }; #endif // defined(__SSE2__) - - - -/*************************************************************************** - VMX/ALTIVEC TABLES -***************************************************************************/ - -#if defined(__ALTIVEC__) -#include <altivec.h> -const struct _rgbvmx_statics rgbvmx_statics = -{ - { 255, 255, 255, 255, 255, 255, 255, 255 }, - { - { 0, 256, 0, 256, 0, 256, 0, 256 }, { 1, 255, 1, 255, 1, 255, 1, 255 }, - { 2, 254, 2, 254, 2, 254, 2, 254 }, { 3, 253, 3, 253, 3, 253, 3, 253 }, - { 4, 252, 4, 252, 4, 252, 4, 252 }, { 5, 251, 5, 251, 5, 251, 5, 251 }, - { 6, 250, 6, 250, 6, 250, 6, 250 }, { 7, 249, 7, 249, 7, 249, 7, 249 }, - { 8, 248, 8, 248, 8, 248, 8, 248 }, { 9, 247, 9, 247, 9, 247, 9, 247 }, - { 10, 246, 10, 246, 10, 246, 10, 246 }, { 11, 245, 11, 245, 11, 245, 11, 245 }, - { 12, 244, 12, 244, 12, 244, 12, 244 }, { 13, 243, 13, 243, 13, 243, 13, 243 }, - { 14, 242, 14, 242, 14, 242, 14, 242 }, { 15, 241, 15, 241, 15, 241, 15, 241 }, - { 16, 240, 16, 240, 16, 240, 16, 240 }, { 17, 239, 17, 239, 17, 239, 17, 239 }, - { 18, 238, 18, 238, 18, 238, 18, 238 }, { 19, 237, 19, 237, 19, 237, 19, 237 }, - { 20, 236, 20, 236, 20, 236, 20, 236 }, { 21, 235, 21, 235, 21, 235, 21, 235 }, - { 22, 234, 22, 234, 22, 234, 22, 234 }, { 23, 233, 23, 233, 23, 233, 23, 233 }, - { 24, 232, 24, 232, 24, 232, 24, 232 }, { 25, 231, 25, 231, 25, 231, 25, 231 }, - { 26, 230, 26, 230, 26, 230, 26, 230 }, { 27, 229, 27, 229, 27, 229, 27, 229 }, - { 28, 228, 28, 228, 28, 228, 28, 228 }, { 29, 227, 29, 227, 29, 227, 29, 227 }, - { 30, 226, 30, 226, 30, 226, 30, 226 }, { 31, 225, 31, 225, 31, 225, 31, 225 }, - { 32, 224, 32, 224, 32, 224, 32, 224 }, { 33, 223, 33, 223, 33, 223, 33, 223 }, - { 34, 222, 34, 222, 34, 222, 34, 222 }, { 35, 221, 35, 221, 35, 221, 35, 221 }, - { 36, 220, 36, 220, 36, 220, 36, 220 }, { 37, 219, 37, 219, 37, 219, 37, 219 }, - { 38, 218, 38, 218, 38, 218, 38, 218 }, { 39, 217, 39, 217, 39, 217, 39, 217 }, - { 40, 216, 40, 216, 40, 216, 40, 216 }, { 41, 215, 41, 215, 41, 215, 41, 215 }, - { 42, 214, 42, 214, 42, 214, 42, 214 }, { 43, 213, 43, 213, 43, 213, 43, 213 }, - { 44, 212, 44, 212, 44, 212, 44, 212 }, { 45, 211, 45, 211, 45, 211, 45, 211 }, - { 46, 210, 46, 210, 46, 210, 46, 210 }, { 47, 209, 47, 209, 47, 209, 47, 209 }, - { 48, 208, 48, 208, 48, 208, 48, 208 }, { 49, 207, 49, 207, 49, 207, 49, 207 }, - { 50, 206, 50, 206, 50, 206, 50, 206 }, { 51, 205, 51, 205, 51, 205, 51, 205 }, - { 52, 204, 52, 204, 52, 204, 52, 204 }, { 53, 203, 53, 203, 53, 203, 53, 203 }, - { 54, 202, 54, 202, 54, 202, 54, 202 }, { 55, 201, 55, 201, 55, 201, 55, 201 }, - { 56, 200, 56, 200, 56, 200, 56, 200 }, { 57, 199, 57, 199, 57, 199, 57, 199 }, - { 58, 198, 58, 198, 58, 198, 58, 198 }, { 59, 197, 59, 197, 59, 197, 59, 197 }, - { 60, 196, 60, 196, 60, 196, 60, 196 }, { 61, 195, 61, 195, 61, 195, 61, 195 }, - { 62, 194, 62, 194, 62, 194, 62, 194 }, { 63, 193, 63, 193, 63, 193, 63, 193 }, - { 64, 192, 64, 192, 64, 192, 64, 192 }, { 65, 191, 65, 191, 65, 191, 65, 191 }, - { 66, 190, 66, 190, 66, 190, 66, 190 }, { 67, 189, 67, 189, 67, 189, 67, 189 }, - { 68, 188, 68, 188, 68, 188, 68, 188 }, { 69, 187, 69, 187, 69, 187, 69, 187 }, - { 70, 186, 70, 186, 70, 186, 70, 186 }, { 71, 185, 71, 185, 71, 185, 71, 185 }, - { 72, 184, 72, 184, 72, 184, 72, 184 }, { 73, 183, 73, 183, 73, 183, 73, 183 }, - { 74, 182, 74, 182, 74, 182, 74, 182 }, { 75, 181, 75, 181, 75, 181, 75, 181 }, - { 76, 180, 76, 180, 76, 180, 76, 180 }, { 77, 179, 77, 179, 77, 179, 77, 179 }, - { 78, 178, 78, 178, 78, 178, 78, 178 }, { 79, 177, 79, 177, 79, 177, 79, 177 }, - { 80, 176, 80, 176, 80, 176, 80, 176 }, { 81, 175, 81, 175, 81, 175, 81, 175 }, - { 82, 174, 82, 174, 82, 174, 82, 174 }, { 83, 173, 83, 173, 83, 173, 83, 173 }, - { 84, 172, 84, 172, 84, 172, 84, 172 }, { 85, 171, 85, 171, 85, 171, 85, 171 }, - { 86, 170, 86, 170, 86, 170, 86, 170 }, { 87, 169, 87, 169, 87, 169, 87, 169 }, - { 88, 168, 88, 168, 88, 168, 88, 168 }, { 89, 167, 89, 167, 89, 167, 89, 167 }, - { 90, 166, 90, 166, 90, 166, 90, 166 }, { 91, 165, 91, 165, 91, 165, 91, 165 }, - { 92, 164, 92, 164, 92, 164, 92, 164 }, { 93, 163, 93, 163, 93, 163, 93, 163 }, - { 94, 162, 94, 162, 94, 162, 94, 162 }, { 95, 161, 95, 161, 95, 161, 95, 161 }, - { 96, 160, 96, 160, 96, 160, 96, 160 }, { 97, 159, 97, 159, 97, 159, 97, 159 }, - { 98, 158, 98, 158, 98, 158, 98, 158 }, { 99, 157, 99, 157, 99, 157, 99, 157 }, - { 100, 156, 100, 156, 100, 156, 100, 156 }, { 101, 155, 101, 155, 101, 155, 101, 155 }, - { 102, 154, 102, 154, 102, 154, 102, 154 }, { 103, 153, 103, 153, 103, 153, 103, 153 }, - { 104, 152, 104, 152, 104, 152, 104, 152 }, { 105, 151, 105, 151, 105, 151, 105, 151 }, - { 106, 150, 106, 150, 106, 150, 106, 150 }, { 107, 149, 107, 149, 107, 149, 107, 149 }, - { 108, 148, 108, 148, 108, 148, 108, 148 }, { 109, 147, 109, 147, 109, 147, 109, 147 }, - { 110, 146, 110, 146, 110, 146, 110, 146 }, { 111, 145, 111, 145, 111, 145, 111, 145 }, - { 112, 144, 112, 144, 112, 144, 112, 144 }, { 113, 143, 113, 143, 113, 143, 113, 143 }, - { 114, 142, 114, 142, 114, 142, 114, 142 }, { 115, 141, 115, 141, 115, 141, 115, 141 }, - { 116, 140, 116, 140, 116, 140, 116, 140 }, { 117, 139, 117, 139, 117, 139, 117, 139 }, - { 118, 138, 118, 138, 118, 138, 118, 138 }, { 119, 137, 119, 137, 119, 137, 119, 137 }, - { 120, 136, 120, 136, 120, 136, 120, 136 }, { 121, 135, 121, 135, 121, 135, 121, 135 }, - { 122, 134, 122, 134, 122, 134, 122, 134 }, { 123, 133, 123, 133, 123, 133, 123, 133 }, - { 124, 132, 124, 132, 124, 132, 124, 132 }, { 125, 131, 125, 131, 125, 131, 125, 131 }, - { 126, 130, 126, 130, 126, 130, 126, 130 }, { 127, 129, 127, 129, 127, 129, 127, 129 }, - { 128, 128, 128, 128, 128, 128, 128, 128 }, { 129, 127, 129, 127, 129, 127, 129, 127 }, - { 130, 126, 130, 126, 130, 126, 130, 126 }, { 131, 125, 131, 125, 131, 125, 131, 125 }, - { 132, 124, 132, 124, 132, 124, 132, 124 }, { 133, 123, 133, 123, 133, 123, 133, 123 }, - { 134, 122, 134, 122, 134, 122, 134, 122 }, { 135, 121, 135, 121, 135, 121, 135, 121 }, - { 136, 120, 136, 120, 136, 120, 136, 120 }, { 137, 119, 137, 119, 137, 119, 137, 119 }, - { 138, 118, 138, 118, 138, 118, 138, 118 }, { 139, 117, 139, 117, 139, 117, 139, 117 }, - { 140, 116, 140, 116, 140, 116, 140, 116 }, { 141, 115, 141, 115, 141, 115, 141, 115 }, - { 142, 114, 142, 114, 142, 114, 142, 114 }, { 143, 113, 143, 113, 143, 113, 143, 113 }, - { 144, 112, 144, 112, 144, 112, 144, 112 }, { 145, 111, 145, 111, 145, 111, 145, 111 }, - { 146, 110, 146, 110, 146, 110, 146, 110 }, { 147, 109, 147, 109, 147, 109, 147, 109 }, - { 148, 108, 148, 108, 148, 108, 148, 108 }, { 149, 107, 149, 107, 149, 107, 149, 107 }, - { 150, 106, 150, 106, 150, 106, 150, 106 }, { 151, 105, 151, 105, 151, 105, 151, 105 }, - { 152, 104, 152, 104, 152, 104, 152, 104 }, { 153, 103, 153, 103, 153, 103, 153, 103 }, - { 154, 102, 154, 102, 154, 102, 154, 102 }, { 155, 101, 155, 101, 155, 101, 155, 101 }, - { 156, 100, 156, 100, 156, 100, 156, 100 }, { 157, 99, 157, 99, 157, 99, 157, 99 }, - { 158, 98, 158, 98, 158, 98, 158, 98 }, { 159, 97, 159, 97, 159, 97, 159, 97 }, - { 160, 96, 160, 96, 160, 96, 160, 96 }, { 161, 95, 161, 95, 161, 95, 161, 95 }, - { 162, 94, 162, 94, 162, 94, 162, 94 }, { 163, 93, 163, 93, 163, 93, 163, 93 }, - { 164, 92, 164, 92, 164, 92, 164, 92 }, { 165, 91, 165, 91, 165, 91, 165, 91 }, - { 166, 90, 166, 90, 166, 90, 166, 90 }, { 167, 89, 167, 89, 167, 89, 167, 89 }, - { 168, 88, 168, 88, 168, 88, 168, 88 }, { 169, 87, 169, 87, 169, 87, 169, 87 }, - { 170, 86, 170, 86, 170, 86, 170, 86 }, { 171, 85, 171, 85, 171, 85, 171, 85 }, - { 172, 84, 172, 84, 172, 84, 172, 84 }, { 173, 83, 173, 83, 173, 83, 173, 83 }, - { 174, 82, 174, 82, 174, 82, 174, 82 }, { 175, 81, 175, 81, 175, 81, 175, 81 }, - { 176, 80, 176, 80, 176, 80, 176, 80 }, { 177, 79, 177, 79, 177, 79, 177, 79 }, - { 178, 78, 178, 78, 178, 78, 178, 78 }, { 179, 77, 179, 77, 179, 77, 179, 77 }, - { 180, 76, 180, 76, 180, 76, 180, 76 }, { 181, 75, 181, 75, 181, 75, 181, 75 }, - { 182, 74, 182, 74, 182, 74, 182, 74 }, { 183, 73, 183, 73, 183, 73, 183, 73 }, - { 184, 72, 184, 72, 184, 72, 184, 72 }, { 185, 71, 185, 71, 185, 71, 185, 71 }, - { 186, 70, 186, 70, 186, 70, 186, 70 }, { 187, 69, 187, 69, 187, 69, 187, 69 }, - { 188, 68, 188, 68, 188, 68, 188, 68 }, { 189, 67, 189, 67, 189, 67, 189, 67 }, - { 190, 66, 190, 66, 190, 66, 190, 66 }, { 191, 65, 191, 65, 191, 65, 191, 65 }, - { 192, 64, 192, 64, 192, 64, 192, 64 }, { 193, 63, 193, 63, 193, 63, 193, 63 }, - { 194, 62, 194, 62, 194, 62, 194, 62 }, { 195, 61, 195, 61, 195, 61, 195, 61 }, - { 196, 60, 196, 60, 196, 60, 196, 60 }, { 197, 59, 197, 59, 197, 59, 197, 59 }, - { 198, 58, 198, 58, 198, 58, 198, 58 }, { 199, 57, 199, 57, 199, 57, 199, 57 }, - { 200, 56, 200, 56, 200, 56, 200, 56 }, { 201, 55, 201, 55, 201, 55, 201, 55 }, - { 202, 54, 202, 54, 202, 54, 202, 54 }, { 203, 53, 203, 53, 203, 53, 203, 53 }, - { 204, 52, 204, 52, 204, 52, 204, 52 }, { 205, 51, 205, 51, 205, 51, 205, 51 }, - { 206, 50, 206, 50, 206, 50, 206, 50 }, { 207, 49, 207, 49, 207, 49, 207, 49 }, - { 208, 48, 208, 48, 208, 48, 208, 48 }, { 209, 47, 209, 47, 209, 47, 209, 47 }, - { 210, 46, 210, 46, 210, 46, 210, 46 }, { 211, 45, 211, 45, 211, 45, 211, 45 }, - { 212, 44, 212, 44, 212, 44, 212, 44 }, { 213, 43, 213, 43, 213, 43, 213, 43 }, - { 214, 42, 214, 42, 214, 42, 214, 42 }, { 215, 41, 215, 41, 215, 41, 215, 41 }, - { 216, 40, 216, 40, 216, 40, 216, 40 }, { 217, 39, 217, 39, 217, 39, 217, 39 }, - { 218, 38, 218, 38, 218, 38, 218, 38 }, { 219, 37, 219, 37, 219, 37, 219, 37 }, - { 220, 36, 220, 36, 220, 36, 220, 36 }, { 221, 35, 221, 35, 221, 35, 221, 35 }, - { 222, 34, 222, 34, 222, 34, 222, 34 }, { 223, 33, 223, 33, 223, 33, 223, 33 }, - { 224, 32, 224, 32, 224, 32, 224, 32 }, { 225, 31, 225, 31, 225, 31, 225, 31 }, - { 226, 30, 226, 30, 226, 30, 226, 30 }, { 227, 29, 227, 29, 227, 29, 227, 29 }, - { 228, 28, 228, 28, 228, 28, 228, 28 }, { 229, 27, 229, 27, 229, 27, 229, 27 }, - { 230, 26, 230, 26, 230, 26, 230, 26 }, { 231, 25, 231, 25, 231, 25, 231, 25 }, - { 232, 24, 232, 24, 232, 24, 232, 24 }, { 233, 23, 233, 23, 233, 23, 233, 23 }, - { 234, 22, 234, 22, 234, 22, 234, 22 }, { 235, 21, 235, 21, 235, 21, 235, 21 }, - { 236, 20, 236, 20, 236, 20, 236, 20 }, { 237, 19, 237, 19, 237, 19, 237, 19 }, - { 238, 18, 238, 18, 238, 18, 238, 18 }, { 239, 17, 239, 17, 239, 17, 239, 17 }, - { 240, 16, 240, 16, 240, 16, 240, 16 }, { 241, 15, 241, 15, 241, 15, 241, 15 }, - { 242, 14, 242, 14, 242, 14, 242, 14 }, { 243, 13, 243, 13, 243, 13, 243, 13 }, - { 244, 12, 244, 12, 244, 12, 244, 12 }, { 245, 11, 245, 11, 245, 11, 245, 11 }, - { 246, 10, 246, 10, 246, 10, 246, 10 }, { 247, 9, 247, 9, 247, 9, 247, 9 }, - { 248, 8, 248, 8, 248, 8, 248, 8 }, { 249, 7, 249, 7, 249, 7, 249, 7 }, - { 250, 6, 250, 6, 250, 6, 250, 6 }, { 251, 5, 251, 5, 251, 5, 251, 5 }, - { 252, 4, 252, 4, 252, 4, 252, 4 }, { 253, 3, 253, 3, 253, 3, 253, 3 }, - { 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 } - } -}; -#endif // defined(__ALTIVEC__) diff --git a/src/emu/video/rgbvmx.c b/src/emu/video/rgbvmx.c new file mode 100644 index 00000000000..146632aa2de --- /dev/null +++ b/src/emu/video/rgbvmx.c @@ -0,0 +1,212 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, Ryan Holtz +/*************************************************************************** + + rgbsse.c + + VMX/Altivec optimised RGB utilities. + +***************************************************************************/ + +#if defined(__ALTIVEC__) + +#include "emu.h" +#include "rgbutil.h" + +/*************************************************************************** + TABLES +***************************************************************************/ + +const rgbaint_t::VECU8 rgbaint_t::alpha_perm = { 16, 17, 18, 19, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +const rgbaint_t::VECU8 rgbaint_t::red_perm = { 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 12, 13, 14, 15 }; +const rgbaint_t::VECU8 rgbaint_t::green_perm = { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 12, 13, 14, 15 }; +const rgbaint_t::VECU8 rgbaint_t::blue_perm = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19 }; +const rgbaint_t::VECS16 rgbaint_t::scale_table[256] = { + { 0, 256, 0, 256, 0, 256, 0, 256 }, { 1, 255, 1, 255, 1, 255, 1, 255 }, + { 2, 254, 2, 254, 2, 254, 2, 254 }, { 3, 253, 3, 253, 3, 253, 3, 253 }, + { 4, 252, 4, 252, 4, 252, 4, 252 }, { 5, 251, 5, 251, 5, 251, 5, 251 }, + { 6, 250, 6, 250, 6, 250, 6, 250 }, { 7, 249, 7, 249, 7, 249, 7, 249 }, + { 8, 248, 8, 248, 8, 248, 8, 248 }, { 9, 247, 9, 247, 9, 247, 9, 247 }, + { 10, 246, 10, 246, 10, 246, 10, 246 }, { 11, 245, 11, 245, 11, 245, 11, 245 }, + { 12, 244, 12, 244, 12, 244, 12, 244 }, { 13, 243, 13, 243, 13, 243, 13, 243 }, + { 14, 242, 14, 242, 14, 242, 14, 242 }, { 15, 241, 15, 241, 15, 241, 15, 241 }, + { 16, 240, 16, 240, 16, 240, 16, 240 }, { 17, 239, 17, 239, 17, 239, 17, 239 }, + { 18, 238, 18, 238, 18, 238, 18, 238 }, { 19, 237, 19, 237, 19, 237, 19, 237 }, + { 20, 236, 20, 236, 20, 236, 20, 236 }, { 21, 235, 21, 235, 21, 235, 21, 235 }, + { 22, 234, 22, 234, 22, 234, 22, 234 }, { 23, 233, 23, 233, 23, 233, 23, 233 }, + { 24, 232, 24, 232, 24, 232, 24, 232 }, { 25, 231, 25, 231, 25, 231, 25, 231 }, + { 26, 230, 26, 230, 26, 230, 26, 230 }, { 27, 229, 27, 229, 27, 229, 27, 229 }, + { 28, 228, 28, 228, 28, 228, 28, 228 }, { 29, 227, 29, 227, 29, 227, 29, 227 }, + { 30, 226, 30, 226, 30, 226, 30, 226 }, { 31, 225, 31, 225, 31, 225, 31, 225 }, + { 32, 224, 32, 224, 32, 224, 32, 224 }, { 33, 223, 33, 223, 33, 223, 33, 223 }, + { 34, 222, 34, 222, 34, 222, 34, 222 }, { 35, 221, 35, 221, 35, 221, 35, 221 }, + { 36, 220, 36, 220, 36, 220, 36, 220 }, { 37, 219, 37, 219, 37, 219, 37, 219 }, + { 38, 218, 38, 218, 38, 218, 38, 218 }, { 39, 217, 39, 217, 39, 217, 39, 217 }, + { 40, 216, 40, 216, 40, 216, 40, 216 }, { 41, 215, 41, 215, 41, 215, 41, 215 }, + { 42, 214, 42, 214, 42, 214, 42, 214 }, { 43, 213, 43, 213, 43, 213, 43, 213 }, + { 44, 212, 44, 212, 44, 212, 44, 212 }, { 45, 211, 45, 211, 45, 211, 45, 211 }, + { 46, 210, 46, 210, 46, 210, 46, 210 }, { 47, 209, 47, 209, 47, 209, 47, 209 }, + { 48, 208, 48, 208, 48, 208, 48, 208 }, { 49, 207, 49, 207, 49, 207, 49, 207 }, + { 50, 206, 50, 206, 50, 206, 50, 206 }, { 51, 205, 51, 205, 51, 205, 51, 205 }, + { 52, 204, 52, 204, 52, 204, 52, 204 }, { 53, 203, 53, 203, 53, 203, 53, 203 }, + { 54, 202, 54, 202, 54, 202, 54, 202 }, { 55, 201, 55, 201, 55, 201, 55, 201 }, + { 56, 200, 56, 200, 56, 200, 56, 200 }, { 57, 199, 57, 199, 57, 199, 57, 199 }, + { 58, 198, 58, 198, 58, 198, 58, 198 }, { 59, 197, 59, 197, 59, 197, 59, 197 }, + { 60, 196, 60, 196, 60, 196, 60, 196 }, { 61, 195, 61, 195, 61, 195, 61, 195 }, + { 62, 194, 62, 194, 62, 194, 62, 194 }, { 63, 193, 63, 193, 63, 193, 63, 193 }, + { 64, 192, 64, 192, 64, 192, 64, 192 }, { 65, 191, 65, 191, 65, 191, 65, 191 }, + { 66, 190, 66, 190, 66, 190, 66, 190 }, { 67, 189, 67, 189, 67, 189, 67, 189 }, + { 68, 188, 68, 188, 68, 188, 68, 188 }, { 69, 187, 69, 187, 69, 187, 69, 187 }, + { 70, 186, 70, 186, 70, 186, 70, 186 }, { 71, 185, 71, 185, 71, 185, 71, 185 }, + { 72, 184, 72, 184, 72, 184, 72, 184 }, { 73, 183, 73, 183, 73, 183, 73, 183 }, + { 74, 182, 74, 182, 74, 182, 74, 182 }, { 75, 181, 75, 181, 75, 181, 75, 181 }, + { 76, 180, 76, 180, 76, 180, 76, 180 }, { 77, 179, 77, 179, 77, 179, 77, 179 }, + { 78, 178, 78, 178, 78, 178, 78, 178 }, { 79, 177, 79, 177, 79, 177, 79, 177 }, + { 80, 176, 80, 176, 80, 176, 80, 176 }, { 81, 175, 81, 175, 81, 175, 81, 175 }, + { 82, 174, 82, 174, 82, 174, 82, 174 }, { 83, 173, 83, 173, 83, 173, 83, 173 }, + { 84, 172, 84, 172, 84, 172, 84, 172 }, { 85, 171, 85, 171, 85, 171, 85, 171 }, + { 86, 170, 86, 170, 86, 170, 86, 170 }, { 87, 169, 87, 169, 87, 169, 87, 169 }, + { 88, 168, 88, 168, 88, 168, 88, 168 }, { 89, 167, 89, 167, 89, 167, 89, 167 }, + { 90, 166, 90, 166, 90, 166, 90, 166 }, { 91, 165, 91, 165, 91, 165, 91, 165 }, + { 92, 164, 92, 164, 92, 164, 92, 164 }, { 93, 163, 93, 163, 93, 163, 93, 163 }, + { 94, 162, 94, 162, 94, 162, 94, 162 }, { 95, 161, 95, 161, 95, 161, 95, 161 }, + { 96, 160, 96, 160, 96, 160, 96, 160 }, { 97, 159, 97, 159, 97, 159, 97, 159 }, + { 98, 158, 98, 158, 98, 158, 98, 158 }, { 99, 157, 99, 157, 99, 157, 99, 157 }, + { 100, 156, 100, 156, 100, 156, 100, 156 }, { 101, 155, 101, 155, 101, 155, 101, 155 }, + { 102, 154, 102, 154, 102, 154, 102, 154 }, { 103, 153, 103, 153, 103, 153, 103, 153 }, + { 104, 152, 104, 152, 104, 152, 104, 152 }, { 105, 151, 105, 151, 105, 151, 105, 151 }, + { 106, 150, 106, 150, 106, 150, 106, 150 }, { 107, 149, 107, 149, 107, 149, 107, 149 }, + { 108, 148, 108, 148, 108, 148, 108, 148 }, { 109, 147, 109, 147, 109, 147, 109, 147 }, + { 110, 146, 110, 146, 110, 146, 110, 146 }, { 111, 145, 111, 145, 111, 145, 111, 145 }, + { 112, 144, 112, 144, 112, 144, 112, 144 }, { 113, 143, 113, 143, 113, 143, 113, 143 }, + { 114, 142, 114, 142, 114, 142, 114, 142 }, { 115, 141, 115, 141, 115, 141, 115, 141 }, + { 116, 140, 116, 140, 116, 140, 116, 140 }, { 117, 139, 117, 139, 117, 139, 117, 139 }, + { 118, 138, 118, 138, 118, 138, 118, 138 }, { 119, 137, 119, 137, 119, 137, 119, 137 }, + { 120, 136, 120, 136, 120, 136, 120, 136 }, { 121, 135, 121, 135, 121, 135, 121, 135 }, + { 122, 134, 122, 134, 122, 134, 122, 134 }, { 123, 133, 123, 133, 123, 133, 123, 133 }, + { 124, 132, 124, 132, 124, 132, 124, 132 }, { 125, 131, 125, 131, 125, 131, 125, 131 }, + { 126, 130, 126, 130, 126, 130, 126, 130 }, { 127, 129, 127, 129, 127, 129, 127, 129 }, + { 128, 128, 128, 128, 128, 128, 128, 128 }, { 129, 127, 129, 127, 129, 127, 129, 127 }, + { 130, 126, 130, 126, 130, 126, 130, 126 }, { 131, 125, 131, 125, 131, 125, 131, 125 }, + { 132, 124, 132, 124, 132, 124, 132, 124 }, { 133, 123, 133, 123, 133, 123, 133, 123 }, + { 134, 122, 134, 122, 134, 122, 134, 122 }, { 135, 121, 135, 121, 135, 121, 135, 121 }, + { 136, 120, 136, 120, 136, 120, 136, 120 }, { 137, 119, 137, 119, 137, 119, 137, 119 }, + { 138, 118, 138, 118, 138, 118, 138, 118 }, { 139, 117, 139, 117, 139, 117, 139, 117 }, + { 140, 116, 140, 116, 140, 116, 140, 116 }, { 141, 115, 141, 115, 141, 115, 141, 115 }, + { 142, 114, 142, 114, 142, 114, 142, 114 }, { 143, 113, 143, 113, 143, 113, 143, 113 }, + { 144, 112, 144, 112, 144, 112, 144, 112 }, { 145, 111, 145, 111, 145, 111, 145, 111 }, + { 146, 110, 146, 110, 146, 110, 146, 110 }, { 147, 109, 147, 109, 147, 109, 147, 109 }, + { 148, 108, 148, 108, 148, 108, 148, 108 }, { 149, 107, 149, 107, 149, 107, 149, 107 }, + { 150, 106, 150, 106, 150, 106, 150, 106 }, { 151, 105, 151, 105, 151, 105, 151, 105 }, + { 152, 104, 152, 104, 152, 104, 152, 104 }, { 153, 103, 153, 103, 153, 103, 153, 103 }, + { 154, 102, 154, 102, 154, 102, 154, 102 }, { 155, 101, 155, 101, 155, 101, 155, 101 }, + { 156, 100, 156, 100, 156, 100, 156, 100 }, { 157, 99, 157, 99, 157, 99, 157, 99 }, + { 158, 98, 158, 98, 158, 98, 158, 98 }, { 159, 97, 159, 97, 159, 97, 159, 97 }, + { 160, 96, 160, 96, 160, 96, 160, 96 }, { 161, 95, 161, 95, 161, 95, 161, 95 }, + { 162, 94, 162, 94, 162, 94, 162, 94 }, { 163, 93, 163, 93, 163, 93, 163, 93 }, + { 164, 92, 164, 92, 164, 92, 164, 92 }, { 165, 91, 165, 91, 165, 91, 165, 91 }, + { 166, 90, 166, 90, 166, 90, 166, 90 }, { 167, 89, 167, 89, 167, 89, 167, 89 }, + { 168, 88, 168, 88, 168, 88, 168, 88 }, { 169, 87, 169, 87, 169, 87, 169, 87 }, + { 170, 86, 170, 86, 170, 86, 170, 86 }, { 171, 85, 171, 85, 171, 85, 171, 85 }, + { 172, 84, 172, 84, 172, 84, 172, 84 }, { 173, 83, 173, 83, 173, 83, 173, 83 }, + { 174, 82, 174, 82, 174, 82, 174, 82 }, { 175, 81, 175, 81, 175, 81, 175, 81 }, + { 176, 80, 176, 80, 176, 80, 176, 80 }, { 177, 79, 177, 79, 177, 79, 177, 79 }, + { 178, 78, 178, 78, 178, 78, 178, 78 }, { 179, 77, 179, 77, 179, 77, 179, 77 }, + { 180, 76, 180, 76, 180, 76, 180, 76 }, { 181, 75, 181, 75, 181, 75, 181, 75 }, + { 182, 74, 182, 74, 182, 74, 182, 74 }, { 183, 73, 183, 73, 183, 73, 183, 73 }, + { 184, 72, 184, 72, 184, 72, 184, 72 }, { 185, 71, 185, 71, 185, 71, 185, 71 }, + { 186, 70, 186, 70, 186, 70, 186, 70 }, { 187, 69, 187, 69, 187, 69, 187, 69 }, + { 188, 68, 188, 68, 188, 68, 188, 68 }, { 189, 67, 189, 67, 189, 67, 189, 67 }, + { 190, 66, 190, 66, 190, 66, 190, 66 }, { 191, 65, 191, 65, 191, 65, 191, 65 }, + { 192, 64, 192, 64, 192, 64, 192, 64 }, { 193, 63, 193, 63, 193, 63, 193, 63 }, + { 194, 62, 194, 62, 194, 62, 194, 62 }, { 195, 61, 195, 61, 195, 61, 195, 61 }, + { 196, 60, 196, 60, 196, 60, 196, 60 }, { 197, 59, 197, 59, 197, 59, 197, 59 }, + { 198, 58, 198, 58, 198, 58, 198, 58 }, { 199, 57, 199, 57, 199, 57, 199, 57 }, + { 200, 56, 200, 56, 200, 56, 200, 56 }, { 201, 55, 201, 55, 201, 55, 201, 55 }, + { 202, 54, 202, 54, 202, 54, 202, 54 }, { 203, 53, 203, 53, 203, 53, 203, 53 }, + { 204, 52, 204, 52, 204, 52, 204, 52 }, { 205, 51, 205, 51, 205, 51, 205, 51 }, + { 206, 50, 206, 50, 206, 50, 206, 50 }, { 207, 49, 207, 49, 207, 49, 207, 49 }, + { 208, 48, 208, 48, 208, 48, 208, 48 }, { 209, 47, 209, 47, 209, 47, 209, 47 }, + { 210, 46, 210, 46, 210, 46, 210, 46 }, { 211, 45, 211, 45, 211, 45, 211, 45 }, + { 212, 44, 212, 44, 212, 44, 212, 44 }, { 213, 43, 213, 43, 213, 43, 213, 43 }, + { 214, 42, 214, 42, 214, 42, 214, 42 }, { 215, 41, 215, 41, 215, 41, 215, 41 }, + { 216, 40, 216, 40, 216, 40, 216, 40 }, { 217, 39, 217, 39, 217, 39, 217, 39 }, + { 218, 38, 218, 38, 218, 38, 218, 38 }, { 219, 37, 219, 37, 219, 37, 219, 37 }, + { 220, 36, 220, 36, 220, 36, 220, 36 }, { 221, 35, 221, 35, 221, 35, 221, 35 }, + { 222, 34, 222, 34, 222, 34, 222, 34 }, { 223, 33, 223, 33, 223, 33, 223, 33 }, + { 224, 32, 224, 32, 224, 32, 224, 32 }, { 225, 31, 225, 31, 225, 31, 225, 31 }, + { 226, 30, 226, 30, 226, 30, 226, 30 }, { 227, 29, 227, 29, 227, 29, 227, 29 }, + { 228, 28, 228, 28, 228, 28, 228, 28 }, { 229, 27, 229, 27, 229, 27, 229, 27 }, + { 230, 26, 230, 26, 230, 26, 230, 26 }, { 231, 25, 231, 25, 231, 25, 231, 25 }, + { 232, 24, 232, 24, 232, 24, 232, 24 }, { 233, 23, 233, 23, 233, 23, 233, 23 }, + { 234, 22, 234, 22, 234, 22, 234, 22 }, { 235, 21, 235, 21, 235, 21, 235, 21 }, + { 236, 20, 236, 20, 236, 20, 236, 20 }, { 237, 19, 237, 19, 237, 19, 237, 19 }, + { 238, 18, 238, 18, 238, 18, 238, 18 }, { 239, 17, 239, 17, 239, 17, 239, 17 }, + { 240, 16, 240, 16, 240, 16, 240, 16 }, { 241, 15, 241, 15, 241, 15, 241, 15 }, + { 242, 14, 242, 14, 242, 14, 242, 14 }, { 243, 13, 243, 13, 243, 13, 243, 13 }, + { 244, 12, 244, 12, 244, 12, 244, 12 }, { 245, 11, 245, 11, 245, 11, 245, 11 }, + { 246, 10, 246, 10, 246, 10, 246, 10 }, { 247, 9, 247, 9, 247, 9, 247, 9 }, + { 248, 8, 248, 8, 248, 8, 248, 8 }, { 249, 7, 249, 7, 249, 7, 249, 7 }, + { 250, 6, 250, 6, 250, 6, 250, 6 }, { 251, 5, 251, 5, 251, 5, 251, 5 }, + { 252, 4, 252, 4, 252, 4, 252, 4 }, { 253, 3, 253, 3, 253, 3, 253, 3 }, + { 254, 2, 254, 2, 254, 2, 254, 2 }, { 255, 1, 255, 1, 255, 1, 255, 1 } +}; + +extern const struct _rgbvmx_statics +{ +} rgbvmx_statics; + +/*************************************************************************** + HIGHER LEVEL OPERATIONS +***************************************************************************/ + +void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor) +{ + m_value = vec_mergeh(m_value, other.m_value); + m_value = vec_msum((VECS16)m_value, scale_table[factor], vec_splat_s32(0)); + m_value = vec_sr(m_value, vec_splat_u32(8)); +} + +void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) +{ + mul(scale); + shr(8); + min(255); +} + +void rgbaint_t::scale_imm_and_clamp(const INT32 scale) +{ + mul_imm(scale); + shr(8); + min(255); +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) +{ + mul(scale); + rgbaint_t color2(other); + color2.mul(scale2); + + mul(scale); + add(color2); + shr(8); + min(255); +} + +void rgbaint_t::scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other) +{ + mul_imm(scale); + add(other); + shr(8); + min(255); +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) +{ + mul(scale); + add(other); + shr(8); + min(255); +} + +#endif // defined(__ALTIVEC__) diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index a0f40eee330..39ded2b7903 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbvmx.h @@ -11,425 +11,484 @@ #ifndef __RGBVMX__ #define __RGBVMX__ -#if defined(__ALTIVEC__) #include <altivec.h> -#endif - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ -/* intermediate RGB values are stored in a vector */ -typedef vector signed short rgbint; - -/* intermediate RGB values are stored in a vector */ -typedef vector signed short rgbaint; - - - -/*************************************************************************** - BASIC CONVERSIONS -***************************************************************************/ - -/*------------------------------------------------- - rgb_comp_to_rgbint - converts a trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b) +class rgbaint_t { - rgbint result = { 0, r, g, b, 0, 0, 0, 0 }; - *rgb = result; -} +public: + inline rgbaint_t() { } + inline rgbaint_t(UINT32 rgba) { set(rgba); } + inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); } + inline rgbaint_t(rgb_t& rgb) { set(rgb); } + + inline void set(rgbaint_t& other) { m_value = other.m_value; } + + inline void set(UINT32 rgba) + { + const vector unsigned int zero = vec_splat_u32(0); + const vector unsigned char temp = vec_perm(vec_lde(0, &rgba), zero, vec_lvsl(0, &rgba)); + m_value = vec_mergeh((vector unsigned short)zero, (vector unsigned short)vec_mergeh((vector unsigned char)zero, temp)); + } + + inline void set(UINT32 a, UINT32 r, UINT32 g, UINT32 b) + { + vector unsigned int result = { a, r, g, b }; + m_value = result; + } + + inline void set(rgb_t& rgb) + { + const vector unsigned int zero = vec_splat_u32(0); + const vector unsigned char temp = vec_perm(vec_lde(0, rgb.ptr()), zero, vec_lvsl(0, rgb.ptr())); + m_value = vec_mergeh((vector unsigned short)zero, (vector unsigned short)vec_mergeh((vector unsigned char)zero, temp)); + } + + inline rgb_t to_rgba() + { + const vector unsigned int temp = vec_splat((vector unsigned int)vec_pack(vec_pack(m_value, m_value), vec_splat_u16(0)), 0); + UINT32 result; + vec_ste(temp, 0, &result); + return result; + } + + inline rgb_t to_rgba_clamp() + { + const vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(vec_packsu(m_value, m_value), vec_splat_u16(0)), 0); + UINT32 result; + vec_ste(temp, 0, &result); + return result; + } + + inline void add(const rgbaint_t& color2) + { + m_value = vec_add(m_value, color2.m_value); + } + + inline void add_imm(const UINT32 imm) + { + const vector unsigned int temp = { imm, imm, imm, imm }; + m_value = vec_add(m_value, temp); + } + + inline void add_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_add(m_value, temp); + } + + inline void sub(const rgbaint_t& color2) + { + m_value = vec_sub(m_value, color2.m_value); + } + + inline void sub_imm(const UINT32 imm) + { + const vector unsigned int temp = { imm, imm, imm, imm }; + m_value = vec_sub(m_value, temp); + } + + inline void sub_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_sub(m_value, temp); + } + + inline void subr(rgbaint_t& color2) + { + m_value = vec_sub(color2.m_value, m_value); + } + + inline void subr_imm(const UINT32 imm) + { + const vector unsigned int temp = { imm, imm, imm, imm }; + m_value = vec_sub(temp, m_value); + } + + inline void subr_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_sub(temp, m_value); + } + + inline void set_a(const UINT32 value) + { + const vector unsigned int temp = { value, 0, 0, 0 }; + m_value = vec_perm(m_value, temp, alpha_perm); + } + + inline void set_r(const UINT32 value) + { + const vector unsigned int temp = { value, 0, 0, 0 }; + m_value = vec_perm(m_value, temp, red_perm); + } + + inline void set_g(const UINT32 value) + { + const vector unsigned int temp = { value, 0, 0, 0 }; + m_value = vec_perm(m_value, temp, green_perm); + } + + inline void set_b(const UINT32 value) + { + const vector unsigned int temp = { value, 0, 0, 0 }; + m_value = vec_perm(m_value, temp, blue_perm); + } + + inline UINT8 get_a() + { + UINT8 result; + vec_ste(vec_splat((vector unsigned char)m_value, 3), 0, &result); + return result; + } + + inline UINT8 get_r() + { + UINT8 result; + vec_ste(vec_splat((vector unsigned char)m_value, 7), 0, &result); + return result; + } + + inline UINT8 get_g() + { + UINT8 result; + vec_ste(vec_splat((vector unsigned char)m_value, 11), 0, &result); + return result; + } + + inline UINT8 get_b() + { + UINT8 result; + vec_ste(vec_splat((vector unsigned char)m_value, 15), 0, &result); + return result; + } + + inline UINT32 get_a32() + { + UINT32 result; + vec_ste(vec_splat(m_value, 0), 0, &result); + return result; + } + + inline UINT32 get_r32() + { + UINT32 result; + vec_ste(vec_splat(m_value, 1), 0, &result); + return result; + } + + inline UINT32 get_g32() + { + UINT32 result; + vec_ste(vec_splat(m_value, 2), 0, &result); + return result; + } + + inline UINT32 get_b32() + { + UINT32 result; + vec_ste(vec_splat(m_value, 3), 0, &result); + return result; + } + + inline void mul(const rgbaint_t& color) + { + const vector unsigned int shift = vec_splat_u32(-16); + const vector unsigned int temp = vec_add(vec_mule((vector unsigned short)m_value, (vector unsigned short)vec_sl(color.m_value, shift)), vec_mule((vector unsigned short)vec_sl(m_value, shift), (vector unsigned short)color.m_value)); + m_value = vec_add(vec_sl(temp, shift), vec_mulo((vector unsigned short)m_value, (vector unsigned short)color.m_value)); + } + + inline void mul_imm(const UINT32 imm) + { + const vector unsigned int value = { imm, imm, imm, imm }; + const vector unsigned int shift = vec_splat_u32(-16); + const vector unsigned int temp = vec_add(vec_mule((vector unsigned short)m_value, (vector unsigned short)vec_sl(value, shift)), vec_mule((vector unsigned short)vec_sl(m_value, shift), (vector unsigned short)value)); + m_value = vec_add(vec_sl(temp, shift), vec_mulo((vector unsigned short)m_value, (vector unsigned short)value)); + } + + inline void mul_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int value = { a, r, g, b }; + const vector unsigned int shift = vec_splat_u32(-16); + const vector unsigned int temp = vec_add(vec_mule((vector unsigned short)m_value, (vector unsigned short)vec_sl(value, shift)), vec_mule((vector unsigned short)vec_sl(m_value, shift), (vector unsigned short)value)); + m_value = vec_add(vec_sl(temp, shift), vec_mulo((vector unsigned short)m_value, (vector unsigned short)value)); + } + + inline void shl(const rgbaint_t& shift) + { + const vector unsigned int limit = { 32, 32, 32, 32 }; + const vector unsigned int temp = vec_splat(shift.m_value, 3); + m_value = vec_and(vec_sl(m_value, temp), vec_cmpgt(limit, temp)); + } + + inline void shl_imm(const UINT8 shift) + { + const vector unsigned int temp = { shift, shift, shift, shift }; + m_value = vec_sl(m_value, temp); + } + + inline void shr(const rgbaint_t& shift) + { + const vector unsigned int limit = { 32, 32, 32, 32 }; + const vector unsigned int temp = vec_splat(shift.m_value, 3); + m_value = vec_and(vec_sr(m_value, temp), vec_cmpgt(limit, temp)); + } + + inline void shr_imm(const UINT8 shift) + { + const vector unsigned int temp = { shift, shift, shift, shift }; + m_value = vec_sr(m_value, temp); + } + + inline void sra(const rgbaint_t& shift) + { + const vector unsigned int limit = { 31, 31, 31, 31 }; + m_value = vec_sra(m_value, vec_min(vec_splat(shift.m_value, 3), limit)); + } + + inline void sra_imm(const UINT8 shift) + { + const vector unsigned int temp = { shift, shift, shift, shift }; + m_value = vec_sra(m_value, temp); + } + + inline void or_reg(const rgbaint_t& color2) + { + m_value = vec_or(m_value, color2.m_value); + } + + inline void or_imm(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_or(m_value, temp); + } + + inline void or_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_or(m_value, temp); + } + + inline void and_reg(const rgbaint_t& color) + { + m_value = vec_and(m_value, color.m_value); + } + + inline void and_imm(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_and(m_value, temp); + } + + inline void and_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_and(m_value, temp); + } + + inline void xor_reg(const rgbaint_t& color2) + { + m_value = vec_xor(m_value, color2.m_value); + } + + inline void xor_imm(const INT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_xor(m_value, temp); + } + + inline void xor_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_xor(m_value, temp); + } + + inline void clamp_and_clear(const UINT32 sign) + { + const vector unsigned int vzero = vec_splat_u32(0); + vector unsigned int vsign = { sign, sign, sign, sign }; + m_value = vec_and(m_value, vec_cmpeq(vec_and(m_value, vsign), vzero)); + vsign = vec_nor(vec_sra(vsign, vec_splat_u32(1)), vzero); + const vector unsigned int mask = vec_cmpgt(m_value, vsign); + m_value = vec_or(vec_and(vsign, mask), vec_and(m_value, vec_nor(mask, vzero))); + } + + inline void sign_extend(const UINT32 compare, const UINT32 sign) + { + const vector unsigned int compare_vec = { compare, compare, compare, compare }; + const vector unsigned int compare_mask = vec_cmpeq(vec_and(m_value, compare_vec), compare_vec); + const vector unsigned int sign_vec = { sign, sign, sign, sign }; + m_value = vec_or(m_value, vec_and(sign_vec, compare_mask)); + } + + inline void min(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_min(m_value, temp); + } + + void blend(const rgbaint_t& other, UINT8 factor); + + void scale_and_clamp(const rgbaint_t& scale); + void scale_imm_and_clamp(const INT32 scale); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other); + + inline void cmpeq(const rgbaint_t& value) + { + m_value = vec_cmpeq(m_value, value.m_value); + } + + inline void cmpeq_imm(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_cmpeq(m_value, temp); + } + + inline void cmpeq_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_cmpeq(m_value, temp); + } + + inline void cmpgt(const rgbaint_t& value) + { + m_value = vec_cmpgt(m_value, value.m_value); + } + + inline void cmpgt_imm(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_cmpgt(m_value, temp); + } + + inline void cmpgt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_cmpgt(m_value, temp); + } + + inline void cmplt(const rgbaint_t& value) + { + m_value = vec_cmplt(m_value, value.m_value); + } + + inline void cmplt_imm(const UINT32 value) + { + const vector unsigned int temp = { value, value, value, value }; + m_value = vec_cmplt(m_value, temp); + } + + inline void cmplt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + const vector unsigned int temp = { a, r, g, b }; + m_value = vec_cmplt(m_value, temp); + } + + inline rgbaint_t operator=(const rgbaint_t& other) + { + m_value = other.m_value; + return *this; + } + + inline rgbaint_t& operator+=(const rgbaint_t& other) + { + m_value = vec_add(m_value, other.m_value); + return *this; + } + + inline rgbaint_t& operator+=(const INT32 other) + { + const vector unsigned int temp = { other, other, other, other }; + m_value = vec_add(m_value, temp); + return *this; + } + + inline rgbaint_t& operator-=(const rgbaint_t& other) + { + m_value = vec_sub(m_value, other.m_value); + return *this; + } + + inline rgbaint_t& operator*=(const rgbaint_t& other) + { + const vector unsigned int shift = vec_splat_u32(-16); + const vector unsigned int temp = vec_add(vec_mule((vector unsigned short)m_value, (vector unsigned short)vec_sl(other.m_value, shift)), vec_mule((vector unsigned short)vec_sl(m_value, shift), (vector unsigned short)other.m_value)); + m_value = vec_add(vec_sl(temp, shift), vec_mulo((vector unsigned short)m_value, (vector unsigned short)other.m_value)); + return *this; + } + + inline rgbaint_t& operator*=(const INT32 other) + { + const vector unsigned int value = { other, other, other, other }; + const vector unsigned int shift = vec_splat_u32(-16); + const vector unsigned int temp = vec_add(vec_mule((vector unsigned short)m_value, (vector unsigned short)vec_sl(value, shift)), vec_mule((vector unsigned short)vec_sl(m_value, shift), (vector unsigned short)value)); + m_value = vec_add(vec_sl(temp, shift), vec_mulo((vector unsigned short)m_value, (vector unsigned short)value)); + return *this; + } + + inline rgbaint_t& operator>>=(const INT32 shift) + { + const vector unsigned int temp = { shift, shift, shift, shift }; + m_value = vec_sra(m_value, temp); + return *this; + } + + inline void merge_alpha(const rgbaint_t& alpha) + { + m_value = vec_perm(m_value, alpha.m_value, alpha_perm); + } + + static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) + { + const VECS32 zero = vec_splat_s32(0); + + VECS32 color00 = vec_perm((VECS32)vec_lde(0, &rgb00), zero, vec_lvsl(0, &rgb00)); + VECS32 color01 = vec_perm((VECS32)vec_lde(0, &rgb01), zero, vec_lvsl(0, &rgb01)); + VECS32 color10 = vec_perm((VECS32)vec_lde(0, &rgb10), zero, vec_lvsl(0, &rgb10)); + VECS32 color11 = vec_perm((VECS32)vec_lde(0, &rgb11), zero, vec_lvsl(0, &rgb11)); + + /* interleave color01 and color00 at the byte level */ + color01 = vec_mergeh((VECU8)color01, (VECU8)color00); + color11 = vec_mergeh((VECU8)color11, (VECU8)color10); + color01 = vec_mergeh((VECU8)zero, (VECU8)color01); + color11 = vec_mergeh((VECU8)zero, (VECU8)color11); + color01 = vec_msum((VECS16)color01, scale_table[u], zero); + color11 = vec_msum((VECS16)color11, scale_table[u], zero); + color01 = vec_sl(color01, vec_splat_u32(15)); + color11 = vec_sr(color11, vec_splat_u32(1)); + color01 = vec_max((VECS16)color01, (VECS16)color11); + color01 = vec_msum((VECS16)color01, scale_table[v], zero); + color01 = vec_sr(color01, vec_splat_u32(15)); + color01 = vec_packs(color01, color01); + color01 = vec_packsu((VECS16)color01, (VECS16)color01); + + UINT32 result; + vec_ste((VECU32)color01, 0, &result); + return result; + } + +protected: + typedef vector unsigned char VECU8; + typedef vector signed short VECS16; + typedef vector unsigned short VECU16; + typedef vector signed int VECS32; + typedef vector unsigned int VECU32; + + vector VECU32 m_value; + + static const VECU8 alpha_perm; + static const VECU8 red_perm; + static const VECU8 green_perm; + static const VECU8 blue_perm; + static const VECS16 scale_table[256]; +}; -/*------------------------------------------------- - rgba_comp_to_rgbint - converts a quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b) -{ - rgbaint result = { a, r, g, b, 0, 0, 0, 0 }; - *rgb = result; -} - - -/*------------------------------------------------- - rgb_to_rgbint - converts a packed trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t const &color) -{ - vector signed char temp = (vector signed char)vec_perm((vector signed int)vec_lde(0, color.ptr()), vec_splat_s32(0), vec_lvsl(0, color.ptr())); - *rgb = (rgbint)vec_mergeh((vector signed char)vec_splat_s32(0), temp); -} - - -/*------------------------------------------------- - rgba_to_rgbaint - converts a packed quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t const &color) -{ - vector signed char temp = (vector signed char)vec_perm((vector signed int)vec_lde(0, color.ptr()), vec_splat_s32(0), vec_lvsl(0, color.ptr())); - *rgb = (rgbaint)vec_mergeh((vector signed char)vec_splat_s32(0), temp); -} - - -/*------------------------------------------------- - rgbint_to_rgb - converts an rgbint back to - a packed trio of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb(const rgbint *color) -{ - vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); - UINT32 result; - vec_ste(temp, 0, &result); - return result; -} - - -/*------------------------------------------------- - rgbaint_to_rgba - converts an rgbint back to - a packed quad of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) -{ - vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); - UINT32 result; - vec_ste(temp, 0, &result); - return result; -} - - -/*------------------------------------------------- - rgbint_to_rgb_clamp - converts an rgbint back - to a packed trio of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) -{ - vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); - UINT32 result; - vec_ste(temp, 0, &result); - return result; -} - - -/*------------------------------------------------- - rgbaint_to_rgba_clamp - converts an rgbint back - to a packed quad of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) -{ - vector unsigned int temp = vec_splat((vector unsigned int)vec_packsu(*color, *color), 0); - UINT32 result; - vec_ste(temp, 0, &result); - return result; -} - - - -/*************************************************************************** - CORE MATH -***************************************************************************/ - -/*------------------------------------------------- - rgbint_add - add two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_add(rgbint *color1, const rgbint *color2) -{ - *color1 = vec_add(*color1, *color2); -} - - -/*------------------------------------------------- - rgbaint_add - add two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2) -{ - *color1 = vec_add(*color1, *color2); -} - - -/*------------------------------------------------- - rgbint_sub - subtract two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_sub(rgbint *color1, const rgbint *color2) -{ - *color1 = vec_sub(*color1, *color2); -} - - -/*------------------------------------------------- - rgbaint_sub - subtract two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2) -{ - *color1 = vec_sub(*color1, *color2); -} - - -/*------------------------------------------------- - rgbint_subr - reverse subtract two rgbint - values --------------------------------------------------*/ - -INLINE void rgbint_subr(rgbint *color1, const rgbint *color2) -{ - *color1 = vec_sub(*color2, *color1); -} - - -/*------------------------------------------------- - rgbaint_subr - reverse subtract two rgbaint - values --------------------------------------------------*/ - -INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2) -{ - *color1 = vec_sub(*color2, *color1); -} - - - -/*************************************************************************** - TABLES -***************************************************************************/ - -extern const struct _rgbvmx_statics -{ - rgbaint maxbyte; - rgbaint scale_table[256]; -} rgbvmx_statics; - - - -/*************************************************************************** - HIGHER LEVEL OPERATIONS -***************************************************************************/ - -/*------------------------------------------------- - rgbint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) -{ - vector signed int temp; - *color1 = vec_mergeh(*color1, *color2); - temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color1 = vec_packs(temp, temp); -} - - -/*------------------------------------------------- - rgbaint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) -{ - vector signed int temp; - *color1 = vec_mergeh(*color1, *color2); - temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color1 = vec_packs(temp, temp); -} - - -/*------------------------------------------------- - rgbint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbint_scale_immediate_and_clamp(rgbint *color, INT16 colorscale) -{ - rgbint splatmap = vec_splat((rgbint)vec_lvsl(0, &colorscale), 0); - rgbint vecscale = vec_lde(0, &colorscale); - vector signed int temp; - vecscale = (rgbint)vec_perm(vecscale, vecscale, (vector unsigned char)splatmap); - *color = (rgbint)vec_mergeh(*color, (rgbint)vec_splat_s32(0)); - temp = vec_msum(*color, vecscale, vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); -} - -INLINE void rgbint_scale_channel_and_clamp(rgbint *color, const rgbint *colorscale) -{ - rgbint vecscale = (rgbint)vec_mergeh(*colorscale, (rgbint)vec_splat_s32(0)); - vector signed int temp; - *color = (rgbint)vec_mergeh(*color, (rgbint)vec_splat_s32(0)); - temp = vec_msum(*color, vecscale, vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); -} - - -/*------------------------------------------------- - rgbaint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbaint_scale_immediate_and_clamp(rgbaint *color, INT16 colorscale) -{ - rgbaint splatmap = vec_splat((rgbaint)vec_lvsl(0, &colorscale), 0); - rgbaint vecscale = vec_lde(0, &colorscale); - vector signed int temp; - vecscale = (rgbaint)vec_perm(vecscale, vecscale, (vector unsigned char)splatmap); - *color = (rgbaint)vec_mergeh(*color, (rgbaint)vec_splat_s32(0)); - temp = vec_msum(*color, vecscale, vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); -} - -INLINE void rgbaint_scale_channel_and_clamp(rgbaint *color, const rgbint *colorscale) -{ - rgbaint vecscale = (rgbaint)vec_mergeh(*color, (rgbaint)vec_splat_s32(0)); - vector signed int temp; - *color = (rgbaint)vec_mergeh(*color, (rgbaint)vec_splat_s32(0)); - temp = vec_msum(*color, vecscale, vec_splat_s32(0)); - temp = (vector signed int)vec_sr(temp, vec_splat_u32(8)); - *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte); -} - - -/*------------------------------------------------- - rgb_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE rgb_t rgb_bilinear_filter(rgb_t const &rgb00, rgb_t const &rgb01, rgb_t const &rgb10, rgb_t const &rgb11, UINT8 u, UINT8 v) -{ - rgbint color00 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb00.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb00.ptr())); - rgbint color01 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb01.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb01.ptr())); - rgbint color10 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb10.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb10.ptr())); - rgbint color11 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb11.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb11.ptr())); - - /* interleave color01 and color00 at the byte level */ - color01 = (rgbint)vec_mergeh((vector signed char)color01, (vector signed char)color00); - color11 = (rgbint)vec_mergeh((vector signed char)color11, (vector signed char)color10); - color01 = (rgbint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01); - color11 = (rgbint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); - color01 = (rgbint)vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color11 = (rgbint)vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(1)); - color11 = (rgbint)vec_sl((vector signed int)color11, vec_splat_u32(15)); - color01 = vec_max(color01, color11); - color01 = (rgbint)vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); - color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(15)); - color01 = vec_packs((vector signed int)color01, (vector signed int)color01); - color01 = (rgbint)vec_packsu(color01, color01); - - UINT32 result; - vec_ste((vector unsigned int)color01, 0, &result); - return result; -} - - -/*------------------------------------------------- - rgba_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE rgb_t rgba_bilinear_filter(rgb_t const &rgb00, rgb_t const &rgb01, rgb_t const &rgb10, rgb_t const &rgb11, UINT8 u, UINT8 v) -{ - rgbaint color00 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb00.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb00.ptr())); - rgbaint color01 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb01.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb01.ptr())); - rgbaint color10 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb10.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb10.ptr())); - rgbaint color11 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb11.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb11.ptr())); - - /* interleave color01 and color00 at the byte level */ - color01 = (rgbaint)vec_mergeh((vector signed char)color01, (vector signed char)color00); - color11 = (rgbaint)vec_mergeh((vector signed char)color11, (vector signed char)color10); - color01 = (rgbaint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01); - color11 = (rgbaint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); - color01 = (rgbaint)vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color11 = (rgbaint)vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(1)); - color11 = (rgbaint)vec_sl((vector signed int)color11, vec_splat_u32(15)); - color01 = vec_max(color01, color11); - color01 = (rgbaint)vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); - color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(15)); - color01 = vec_packs((vector signed int)color01, (vector signed int)color01); - color01 = (rgbaint)vec_packsu(color01, color01); - - UINT32 result; - vec_ste((vector unsigned int)color01, 0, &result); - return result; -} - - -/*------------------------------------------------- - rgbint_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE void rgbint_bilinear_filter(rgbint *color, rgb_t const &rgb00, rgb_t const &rgb01, rgb_t const &rgb10, rgb_t const &rgb11, UINT8 u, UINT8 v) -{ - rgbint color00 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb00.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb00.ptr())); - rgbint color01 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb01.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb01.ptr())); - rgbint color10 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb10.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb10.ptr())); - rgbint color11 = (rgbint)vec_perm((vector signed int)vec_lde(0, rgb11.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb11.ptr())); - - /* interleave color01 and color00 at the byte level */ - color01 = (rgbint)vec_mergeh((vector signed char)color01, (vector signed char)color00); - color11 = (rgbint)vec_mergeh((vector signed char)color11, (vector signed char)color10); - color01 = (rgbint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01); - color11 = (rgbint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); - color01 = (rgbint)vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color11 = (rgbint)vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(1)); - color11 = (rgbint)vec_sl((vector signed int)color11, vec_splat_u32(15)); - color01 = vec_max(color01, color11); - color01 = (rgbint)vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); - color01 = (rgbint)vec_sr((vector signed int)color01, vec_splat_u32(15)); - *color = vec_packs((vector signed int)color01, (vector signed int)color01); -} - - -/*------------------------------------------------- - rgbaint_bilinear_filter - bilinear filter between - four pixel values --------------------------------------------------*/ - -INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t const &rgb00, rgb_t const &rgb01, rgb_t const &rgb10, rgb_t const &rgb11, UINT8 u, UINT8 v) -{ - rgbaint color00 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb00.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb00.ptr())); - rgbaint color01 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb01.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb01.ptr())); - rgbaint color10 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb10.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb10.ptr())); - rgbaint color11 = (rgbaint)vec_perm((vector signed int)vec_lde(0, rgb11.ptr()), vec_splat_s32(0), vec_lvsl(0, rgb11.ptr())); - - /* interleave color01 and color00 at the byte level */ - color01 = (rgbaint)vec_mergeh((vector signed char)color01, (vector signed char)color00); - color11 = (rgbaint)vec_mergeh((vector signed char)color11, (vector signed char)color10); - color01 = (rgbaint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01); - color11 = (rgbaint)vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11); - color01 = (rgbaint)vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color11 = (rgbaint)vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0)); - color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(1)); - color11 = (rgbaint)vec_sl((vector signed int)color11, vec_splat_u32(15)); - color01 = vec_max(color01, color11); - color01 = (rgbaint)vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0)); - color01 = (rgbaint)vec_sr((vector signed int)color01, vec_splat_u32(15)); - *color = vec_packs((vector signed int)color01, (vector signed int)color01); -} // altivec.h somehow redefines "bool" in a bad way on PowerPC Mac OS X. really. #ifdef OSX_PPC diff --git a/src/emu/video/vooddefs.h b/src/emu/video/vooddefs.h index 437b3c84459..ff6b39bf478 100644 --- a/src/emu/video/vooddefs.h +++ b/src/emu/video/vooddefs.h @@ -1,4 +1,4 @@ -// license:BSD-3-Clause + // license:BSD-3-Clause // copyright-holders:Aaron Giles /*************************************************************************** @@ -24,7 +24,7 @@ enum }; // Use old macro style or newer SSE2 optimized functions -#define USE_OLD_RASTER 1 +#define USE_OLD_RASTER 0 /* maximum number of TMUs */ #define MAX_TMU 2 @@ -2199,46 +2199,45 @@ while (0) /* use SSE on 64-bit implementations, where it can be assumed */ #if (!defined(MAME_DEBUG) || defined(__OPTIMIZE__)) && (defined(__SSE2__) || defined(_MSC_VER)) && defined(PTR64) -ATTR_FORCE_INLINE UINT32 clampARGB(INT32 iterr, INT32 iterg, INT32 iterb, INT32 itera, UINT32 FBZCP) +// NB: This code should no longer be SSE2-specific now that it uses rgbaint_t, consider removing the #define and the #else case. +INLINE UINT32 clampARGB(INT32 iterr, INT32 iterg, INT32 iterb, INT32 itera, UINT32 FBZCP) { rgb_t result; - rgbaint colorint; - rgba_comp_to_rgbaint(&colorint, (INT16) (itera>>12), (INT16) (iterr>>12), (INT16) (iterg>>12), (INT16) (iterb>>12)); + rgbaint_t colorint((INT32) (itera>>12), (INT32) (iterr>>12), (INT32) (iterg>>12), (INT32) (iterb>>12)); if (FBZCP_RGBZW_CLAMP(FBZCP) == 0) { //r &= 0xfff; - __m128i temp = _mm_set1_epi16(0xfff); - colorint = _mm_and_si128(*(__m128i *)&colorint, *(__m128i *)&temp); + colorint.and_imm(0xfff); //if (r == 0xfff) - temp = _mm_cmpeq_epi16(*(__m128i *)&colorint, *(__m128i *)&temp); - // result.rgb.r = 0; - colorint = _mm_andnot_si128(*(__m128i *)&temp, *(__m128i *)&colorint); + rgbaint_t temp(colorint); + temp.cmpeq_imm(0xfff); + // result.rgb.r = 0; + temp.xor_imm(0xffffffff); + colorint.and_reg(temp); //else if (r == 0x100) - temp = _mm_set1_epi16(0x100); - temp = _mm_cmpeq_epi16(*(__m128i *)&colorint, *(__m128i *)&temp); - // result.rgb.r = 0xff; - colorint = _mm_or_si128(*(__m128i *)&colorint, *(__m128i *)&temp); - - result = rgbaint_to_rgba(&colorint); + temp.set(colorint); + temp.cmpeq_imm(0x100); + // result.rgb.r = 0xff; + colorint.or_reg(temp); + return colorint.to_rgba(); } else { - result = rgbaint_to_rgba_clamp(&colorint); + return colorint.to_rgba_clamp(); } - return result; } #else -ATTR_FORCE_INLINE UINT32 clampARGB(INT32 iterr, INT32 iterg, INT32 iterb, INT32 itera, UINT32 FBZCP) +INLINE UINT32 clampARGB(INT32 iterr, INT32 iterg, INT32 iterb, INT32 itera, UINT32 FBZCP) { rgb_union result; INT16 r, g, b, a; - r = (INT16)(iterr >> 12); \ - g = (INT16)(iterg >> 12); \ - b = (INT16)(iterb >> 12); \ - a = (INT16)(itera >> 12); \ + r = (INT16)(iterr >> 12); + g = (INT16)(iterg >> 12); + b = (INT16)(iterb >> 12); + a = (INT16)(itera >> 12); if (FBZCP_RGBZW_CLAMP(FBZCP) == 0) { @@ -2400,7 +2399,7 @@ do } \ while (0) -ATTR_FORCE_INLINE bool chromaKeyTest(voodoo_state *v, stats_block *stats, UINT32 fbzModeReg, rgb_union color) +INLINE bool chromaKeyTest(voodoo_state *v, stats_block *stats, UINT32 fbzModeReg, rgb_union color) { if (FBZMODE_ENABLE_CHROMAKEY(fbzModeReg)) { @@ -2487,7 +2486,7 @@ do } \ while (0) -ATTR_FORCE_INLINE bool alphaMaskTest(stats_block *stats, UINT32 fbzModeReg, UINT8 alpha) +INLINE bool alphaMaskTest(stats_block *stats, UINT32 fbzModeReg, UINT8 alpha) { if (FBZMODE_ENABLE_ALPHA_MASK(fbzModeReg)) { @@ -2573,7 +2572,7 @@ do } \ while (0) -ATTR_FORCE_INLINE bool alphaTest(voodoo_state *v, stats_block *stats, UINT32 alphaModeReg, UINT8 alpha) +INLINE bool alphaTest(voodoo_state *v, stats_block *stats, UINT32 alphaModeReg, UINT8 alpha) { if (ALPHAMODE_ALPHATEST(alphaModeReg)) { @@ -2802,14 +2801,14 @@ do } \ while (0) -ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, int dpix, int depthX, rgb_union preFog, rgb_union &color) +INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *dither, int dpix, UINT16 *depth, rgb_union preFog, rgb_union &color) { if (ALPHAMODE_ALPHABLEND(ALPHAMODE)) { //int dpix = dest[XX]; int dr, dg, db; EXTRACT_565_TO_888(dpix, dr, dg, db); - int da = FBZMODE_ENABLE_ALPHA_PLANES(FBZMODE) ? depthX : 0xff; + int da = FBZMODE_ENABLE_ALPHA_PLANES(FBZMODE) ? depth[x] : 0xff; //int sr = (RR); //int sg = (GG); //int sb = (BB); @@ -2817,7 +2816,7 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, int sa = color.rgb.a; int ta; int srcAlphaScale, destAlphaScale; - rgbaint srcScale, destScale; + rgbaint_t srcScale, destScale; /* apply dither subtraction */ if (FBZMODE_ALPHA_DITHER_SUBTRACT(FBZMODE)) @@ -2826,9 +2825,9 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, //int dith = DITHER[(XX) & 3]; /* subtract the dither value */ - dr += (15 - ditherX) >> 1; - dg += (15 - ditherX) >> 2; - db += (15 - ditherX) >> 1; + dr += (15 - dither[x&3]) >> 1; + dg += (15 - dither[x&3]) >> 2; + db += (15 - dither[x&3]) >> 1; } /* blend the source alpha */ @@ -2842,20 +2841,20 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, { default: /* reserved */ case 0: /* AZERO */ - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, 0, 0, 0); + srcScale.set(srcAlphaScale, 0, 0, 0); //(RR) = (GG) = (BB) = 0; break; case 1: /* ASRC_ALPHA */ - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, sa, sa, sa); + srcScale.set(srcAlphaScale, sa, sa, sa); //(RR) = (sr * (sa + 1)) >> 8; //(GG) = (sg * (sa + 1)) >> 8; //(BB) = (sb * (sa + 1)) >> 8; break; case 2: /* A_COLOR */ - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale-1, dr, dg, db); - rgbaint_add_imm(&srcScale, 1); + srcScale.set(srcAlphaScale-1, dr, dg, db); + srcScale.add_imm(1); //(RR) = (sr * (dr + 1)) >> 8; //(GG) = (sg * (dg + 1)) >> 8; //(BB) = (sb * (db + 1)) >> 8; @@ -2863,26 +2862,26 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 3: /* ADST_ALPHA */ ta = da + 1; - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (da + 1)) >> 8; //(GG) = (sg * (da + 1)) >> 8; //(BB) = (sb * (da + 1)) >> 8; break; case 4: /* AONE */ - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, 256, 256, 256); + srcScale.set(srcAlphaScale, 256, 256, 256); break; case 5: /* AOMSRC_ALPHA */ ta = (0x100 - sa); - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (0x100 - sa)) >> 8; //(GG) = (sg * (0x100 - sa)) >> 8; //(BB) = (sb * (0x100 - sa)) >> 8; break; case 6: /* AOM_COLOR */ - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, (0x100 - dr), (0x100 - dg), (0x100 - db)); + srcScale.set(srcAlphaScale, (0x100 - dr), (0x100 - dg), (0x100 - db)); //(RR) = (sr * (0x100 - dr)) >> 8; //(GG) = (sg * (0x100 - dg)) >> 8; //(BB) = (sb * (0x100 - db)) >> 8; @@ -2890,7 +2889,7 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 7: /* AOMDST_ALPHA */ ta = (0x100 - da); - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (0x100 - da)) >> 8; //(GG) = (sg * (0x100 - da)) >> 8; //(BB) = (sb * (0x100 - da)) >> 8; @@ -2898,7 +2897,7 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 15: /* ASATURATE */ ta = (sa < (0x100 - da)) ? sa : (0x100 - da); - rgba_comp_to_rgbaint(&srcScale, srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (ta + 1)) >> 8; //(GG) = (sg * (ta + 1)) >> 8; //(BB) = (sb * (ta + 1)) >> 8; @@ -2916,20 +2915,20 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, { default: /* reserved */ case 0: /* AZERO */ - rgba_comp_to_rgbaint(&destScale, destAlphaScale, 0, 0, 0); + destScale.set(destAlphaScale, 0, 0, 0); break; case 1: /* ASRC_ALPHA */ - rgba_comp_to_rgbaint(&destScale, destAlphaScale, sa, sa, sa); - rgbaint_add_imm(&destScale, 1); + destScale.set(destAlphaScale, sa, sa, sa); + destScale.add_imm(1); //(RR) += (dr * (sa + 1)) >> 8; //(GG) += (dg * (sa + 1)) >> 8; //(BB) += (db * (sa + 1)) >> 8; break; case 2: /* A_COLOR */ - rgba_to_rgbaint(&destScale, (rgb_t) (((destAlphaScale-1)<<24) | (color.u & 0x00ffffff))); - rgbaint_add_imm(&destScale, 1); + destScale.set((rgb_t) (((destAlphaScale-1)<<24) | (color.u & 0x00ffffff))); + destScale.add_imm(1); //(RR) += (dr * (sr + 1)) >> 8; //(GG) += (dg * (sg + 1)) >> 8; //(BB) += (db * (sb + 1)) >> 8; @@ -2937,14 +2936,14 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 3: /* ADST_ALPHA */ ta = da + 1; - rgba_comp_to_rgbaint(&destScale, destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (da + 1)) >> 8; //(GG) += (dg * (da + 1)) >> 8; //(BB) += (db * (da + 1)) >> 8; break; case 4: /* AONE */ - rgba_comp_to_rgbaint(&destScale, destAlphaScale, 256, 256, 256); + destScale.set(destAlphaScale, 256, 256, 256); //(RR) += dr; //(GG) += dg; //(BB) += db; @@ -2952,14 +2951,14 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 5: /* AOMSRC_ALPHA */ ta = (0x100 - sa); - rgba_comp_to_rgbaint(&destScale, destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (0x100 - sa)) >> 8; //(GG) += (dg * (0x100 - sa)) >> 8; //(BB) += (db * (0x100 - sa)) >> 8; break; case 6: /* AOM_COLOR */ - rgba_comp_to_rgbaint(&destScale, destAlphaScale, (0x100 - color.rgb.r), (0x100 - color.rgb.g), (0x100 - color.rgb.b)); + destScale.set(destAlphaScale, (0x100 - color.rgb.r), (0x100 - color.rgb.g), (0x100 - color.rgb.b)); //(RR) += (dr * (0x100 - sr)) >> 8; //(GG) += (dg * (0x100 - sg)) >> 8; //(BB) += (db * (0x100 - sb)) >> 8; @@ -2967,28 +2966,26 @@ ATTR_FORCE_INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, int ditherX, case 7: /* AOMDST_ALPHA */ ta = (0x100 - da); - rgba_comp_to_rgbaint(&destScale, destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (0x100 - da)) >> 8; //(GG) += (dg * (0x100 - da)) >> 8; //(BB) += (db * (0x100 - da)) >> 8; break; case 15: /* A_COLORBEFOREFOG */ - rgba_to_rgbaint(&destScale, (rgb_t) (((destAlphaScale-1)<<24) | (preFog.u & 0x00ffffff))); - rgbaint_add_imm(&destScale, 1); + destScale.set((rgb_t) (((destAlphaScale-1)<<24) | (preFog.u & 0x00ffffff))); + destScale.add_imm(1); //(RR) += (dr * (prefogr + 1)) >> 8; //(GG) += (dg * (prefogg + 1)) >> 8; //(BB) += (db * (prefogb + 1)) >> 8; break; } // Main blend - rgbaint srcColor; - rgbaint destColor; + rgbaint_t srcColor((rgb_t) color.u); + rgbaint_t destColor(da, dr, dg, db); - rgba_to_rgbaint(&srcColor, (rgb_t) color.u); - rgba_comp_to_rgbaint(&destColor, da, dr, dg, db); - rgbaint_scale_channel_add_and_clamp(&srcColor, &srcScale, &destColor, &destScale); - color.u = rgbaint_to_rgba(&srcColor); + srcColor.scale_add_and_clamp(srcScale, destColor, destScale); + color.u = srcColor.to_rgba(); /* clamp */ //CLAMP((RR), 0x00, 0xff); //CLAMP((GG), 0x00, 0xff); @@ -3115,25 +3112,23 @@ do } \ while (0) -ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 fbzCpReg, const UINT8 ditherX, INT32 fogDepth, rgb_union &color, INT32 iterz, INT64 iterw, rgb_union iterargb) +INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 fbzCpReg, INT32 x, const UINT8 *dither4, INT32 fogDepth, rgb_union &color, INT32 iterz, INT64 iterw, rgb_union iterargb) { if (FOGMODE_ENABLE_FOG(fogModeReg)) { UINT32 color_alpha = color.u & 0xff000000; - rgbaint tmpA, tmpB; - - //INT32 fr, fg, fb; + rgbaint_t tmpA; /* constant fog bypasses everything else */ rgb_union fogColorLocal = v->reg[fogColor]; - rgba_to_rgbaint(&tmpB, (rgb_t) color.u); + rgbaint_t tmpB((rgb_t) color.u); if (FOGMODE_FOG_CONSTANT(fogModeReg)) { - rgba_to_rgbaint(&tmpA, (rgb_t) fogColorLocal.u); + tmpA.set((rgb_t) fogColorLocal.u); /* if fog_mult is 0, we add this to the original color */ if (FOGMODE_FOG_MULT(fogModeReg) == 0) { - rgbaint_add(&tmpA, &tmpB); + tmpA.add(tmpB); //color += fog; } @@ -3142,7 +3137,7 @@ ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 f //{ //color = fog; //} - color.u = rgbaint_to_rgba_clamp(&tmpA); + color.u = tmpA.to_rgba_clamp(); } /* non-constant fog comes from several sources */ else @@ -3154,12 +3149,12 @@ ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 f fogColorLocal.u = 0; //fr = fg = fb = 0; - rgba_to_rgbaint(&tmpA, (rgb_t) fogColorLocal.u); + tmpA.set((rgb_t) fogColorLocal.u); /* if fog_mult is zero, we subtract the incoming color */ if (!FOGMODE_FOG_MULT(fogModeReg)) { - rgbaint_sub(&tmpA, &tmpB); + tmpA.sub(tmpB); //fog.rgb -= color.rgb; //fr -= (RR); //fg -= (GG); @@ -3185,7 +3180,7 @@ ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 f /* apply dither */ if (FOGMODE_FOG_DITHER(fogModeReg)) - deltaval += ditherX; + deltaval += dither4[x&3]; deltaval >>= 4; /* add to the blending factor */ @@ -3216,7 +3211,7 @@ ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 f /* if fog_mult is 0, we add this to the original color */ if (FOGMODE_FOG_MULT(fogModeReg) == 0) { - rgbaint_scale_immediate_add_and_clamp(&tmpA, (INT16) fogblend, &tmpB); + tmpA.scale_imm_add_and_clamp((INT16) fogblend, tmpB); //color += fog; //(RR) += fr; //(GG) += fg; @@ -3226,13 +3221,13 @@ ATTR_FORCE_INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 f /* otherwise this just becomes the new color */ else { - rgbaint_scale_immediate_and_clamp(&tmpA, fogblend); + tmpA.scale_imm_and_clamp(fogblend); //color = fog; //(RR) = fr; //(GG) = fg; //(BB) = fb; } - color.u = rgbaint_to_rgba(&tmpA); + color.u = tmpA.to_rgba(); } @@ -3422,7 +3417,7 @@ do } \ \ /* weigh in each texel */ \ - c_local.u = rgba_bilinear_filter(texel0, texel1, texel2, texel3, sfrac, tfrac);\ + c_local.u = rgbaint_t::bilinear_filter(texel0, texel1, texel2, texel3, sfrac, tfrac); \ } \ \ /* select zero/other for RGB */ \ @@ -3758,7 +3753,7 @@ do } \ while (0) -ATTR_FORCE_INLINE bool depthTest(UINT16 zaColorReg, stats_block *stats, INT32 destDepth, UINT32 fbzModeReg, INT32 biasdepth) +INLINE bool depthTest(UINT16 zaColorReg, stats_block *stats, INT32 destDepth, UINT32 fbzModeReg, INT32 biasdepth) { /* handle depth buffer testing */ if (FBZMODE_ENABLE_DEPTHBUF(fbzModeReg)) @@ -3847,15 +3842,15 @@ ATTR_FORCE_INLINE bool depthTest(UINT16 zaColorReg, stats_block *stats, INT32 de \ /* perform alpha blending */ \ APPLY_ALPHA_BLEND(FBZMODE, ALPHAMODE, XX, DITHER, r, g, b, a); \ - } else { \ + } else { \ /* perform fogging */ \ rgb_union preFog; \ preFog.u = color.u; \ - applyFogging(VV, FOGMODE, FBZCOLORPATH, DITHER4[XX&3], fogdepth, color, ITERZ, ITERW, ITERAXXX); \ + applyFogging(VV, FOGMODE, FBZCOLORPATH, XX, DITHER4, fogdepth, color, ITERZ, ITERW, ITERAXXX); \ /* perform alpha blending */ \ - alphaBlend(FBZMODE, ALPHAMODE, DITHER[XX&3], dest[XX], depth[XX], preFog, color); \ - a = color.rgb.a; r = color.rgb.r; g = color.rgb.g; b = color.rgb.b; \ - } \ + alphaBlend(FBZMODE, ALPHAMODE, XX, DITHER, dest[XX], depth, preFog, color); \ + a = color.rgb.a; r = color.rgb.r; g = color.rgb.g; b = color.rgb.b; \ + } \ /* modify the pixel for debugging purposes */ \ MODIFY_PIXEL(VV); \ \ @@ -4183,7 +4178,7 @@ do } \ while (0) -ATTR_FORCE_INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPATH, UINT32 FBZMODE, UINT32 ALPHAMODE, +INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPATH, UINT32 FBZMODE, UINT32 ALPHAMODE, rgb_union TEXELARGB, INT32 ITERZ, INT64 ITERW, rgb_union ITERARGB, rgb_union &color) { rgb_union c_other; @@ -4289,7 +4284,7 @@ ATTR_FORCE_INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 UINT8 a_local = c_local.rgb.a; UINT8 tmp; rgb_union add_val = c_local; - rgbaint tmpA, tmpB, tmpC; + rgbaint_t tmpA, tmpB, tmpC; /* select zero or c_other */ @@ -4301,7 +4296,7 @@ ATTR_FORCE_INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 if (FBZCP_CCA_ZERO_OTHER(FBZCOLORPATH)) c_other.u &= 0x00ffffff; - rgba_to_rgbaint(&tmpA, (rgb_t) c_other.u); + tmpA.set((rgb_t) c_other.u); /* subtract a/c_local */ if (FBZCP_CC_SUB_CLOCAL(FBZCOLORPATH) || (FBZCP_CCA_SUB_CLOCAL(FBZCOLORPATH))) @@ -4314,8 +4309,8 @@ ATTR_FORCE_INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 if (!FBZCP_CCA_SUB_CLOCAL(FBZCOLORPATH)) sub_val.u &= 0x00ffffff; - rgba_to_rgbaint(&tmpB, (rgb_t) sub_val.u); - rgbaint_sub(&tmpA, &tmpB); + tmpB.set((rgb_t) sub_val.u); + tmpA.sub(tmpB); } /* blend RGB */ @@ -4409,11 +4404,11 @@ ATTR_FORCE_INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 //CLAMP(color.rgb.r, 0x00, 0xff); //CLAMP(color.rgb.g, 0x00, 0xff); //CLAMP(color.rgb.b, 0x00, 0xff); - rgba_to_rgbaint(&tmpB, (rgb_t) c_local.u); - rgbaint_add_imm(&tmpB, 1); - rgba_to_rgbaint(&tmpC, (rgb_t) add_val.u); - rgbaint_scale_channel_add_and_clamp(&tmpA, &tmpB, &tmpC); - color.u = rgbaint_to_rgba(&tmpA); + tmpB.set((rgb_t) c_local.u); + tmpB.add_imm(1); + tmpC.set((rgb_t) add_val.u); + tmpA.scale_add_and_clamp(tmpB, tmpC); + color.u = tmpA.to_rgba(); /* invert */ if (FBZCP_CCA_INVERT_OUTPUT(FBZCOLORPATH)) @@ -4570,7 +4565,7 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co if (TMUS >= 2 && v->tmu[1].lodmin < (8 << 8)) { \ INT32 tmp; \ const rgb_union texelZero = {0}; \ - texel.u = genTexture(&v->tmu[1], dither4[x&3], TEXMODE1, v->tmu[1].lookup, extra->lodbase1, \ + texel.u = genTexture(&v->tmu[1], x, dither4, TEXMODE1, v->tmu[1].lookup, extra->lodbase1, \ iters1, itert1, iterw1, tmp); \ texel.u = combineTexture(&v->tmu[1], TEXMODE1, texel, texelZero, tmp); \ } \ @@ -4583,7 +4578,7 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co if (!v->send_config) \ { \ INT32 lod0; \ - texelT0.u = genTexture(&v->tmu[0], dither4[x&3], TEXMODE0, v->tmu[0].lookup, extra->lodbase0, \ + texelT0.u = genTexture(&v->tmu[0], x, dither4, TEXMODE0, v->tmu[0].lookup, extra->lodbase0, \ iters0, itert0, iterw0, lod0); \ texel.u = combineTexture(&v->tmu[0], TEXMODE0, texelT0, texel, lod0); \ } \ @@ -4594,7 +4589,7 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co } \ \ /* colorpath pipeline selects source colors and does blending */ \ - iterargb.u = clampARGB(iterr, iterg, iterb, itera, FBZCOLORPATH); \ + iterargb.u = clampARGB(iterr, iterg, iterb, itera, FBZCOLORPATH); \ if (!combineColor(v, stats, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel, iterz, iterw, iterargb, color)) \ goto skipdrawdepth; \ } \ @@ -4626,24 +4621,17 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co } \ } -ATTR_FORCE_INLINE UINT32 genTexture(tmu_state *TT, const UINT8 ditherX, const UINT32 TEXMODE, rgb_t *LOOKUP, INT32 LODBASE, INT64 ITERS, INT64 ITERT, INT64 ITERW, INT32 &lod) +INLINE UINT32 genTexture(tmu_state *TT, INT32 x, const UINT8 *dither4, const UINT32 TEXMODE, rgb_t *LOOKUP, INT32 LODBASE, INT64 ITERS, INT64 ITERT, INT64 ITERW, INT32 &lod) { UINT32 result; - INT32 oow, s, t, ilod; - INT32 smax, tmax; - UINT32 texbase; + INT32 s, t, ilod; /* determine the S/T/LOD values for this texture */ lod = (LODBASE); - /* clamp W */ - if (TEXMODE_CLAMP_NEG_W(TEXMODE) && (ITERW) < 0) - { - s = t = 0; - } - else if (TEXMODE_ENABLE_PERSPECTIVE(TEXMODE)) + if (TEXMODE_ENABLE_PERSPECTIVE(TEXMODE)) { INT32 wLog; - oow = fast_reciplog((ITERW), &wLog); + const INT32 oow = fast_reciplog((ITERW), &wLog); lod += wLog; s = ((INT64)oow * (ITERS)) >> 29; t = ((INT64)oow * (ITERT)) >> 29; @@ -4654,11 +4642,16 @@ ATTR_FORCE_INLINE UINT32 genTexture(tmu_state *TT, const UINT8 ditherX, const UI t = (ITERT) >> 14; } + /* clamp W */ + if (TEXMODE_CLAMP_NEG_W(TEXMODE) && (ITERW) < 0) + { + s = t = 0; + } /* clamp the LOD */ lod += (TT)->lodbias; if (TEXMODE_ENABLE_LOD_DITHER(TEXMODE)) - lod += ditherX << 4; + lod += dither4[x&3] << 4; if (lod < (TT)->lodmin) lod = (TT)->lodmin; else if (lod > (TT)->lodmax) @@ -4670,11 +4663,11 @@ ATTR_FORCE_INLINE UINT32 genTexture(tmu_state *TT, const UINT8 ditherX, const UI ilod++; /* fetch the texture base */ - texbase = (TT)->lodoffset[ilod]; + UINT32 texbase = (TT)->lodoffset[ilod]; /* compute the maximum s and t values at this LOD */ - smax = (TT)->wmask >> ilod; - tmax = (TT)->hmask >> ilod; + INT32 smax = (TT)->wmask >> ilod; + INT32 tmax = (TT)->hmask >> ilod; /* determine whether we are point-sampled or bilinear */ if ((lod == (TT)->lodmin && !TEXMODE_MAGNIFICATION_FILTER(TEXMODE)) || @@ -4809,12 +4802,13 @@ ATTR_FORCE_INLINE UINT32 genTexture(tmu_state *TT, const UINT8 ditherX, const UI } /* weigh in each texel */ - result = rgba_bilinear_filter(texel0, texel1, texel2, texel3, sfrac, tfrac); + + result = rgbaint_t::bilinear_filter(texel0, texel1, texel2, texel3, sfrac, tfrac); } return result; } -ATTR_FORCE_INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb_union c_local, rgb_union c_other, INT32 lod) +INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb_union c_local, rgb_union c_other, INT32 lod) { UINT32 result; //INT32 blendr, blendg, blendb, blenda; @@ -4823,7 +4817,7 @@ ATTR_FORCE_INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb UINT8 a_local = c_local.rgb.a; rgb_union add_val = c_local; UINT8 tmp; - rgbaint tmpA, tmpB, tmpC; + rgbaint_t tmpA, tmpB, tmpC; /* select zero/other for RGB */ if (TEXMODE_TC_ZERO_OTHER(TEXMODE)) @@ -4833,7 +4827,7 @@ ATTR_FORCE_INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb if (TEXMODE_TCA_ZERO_OTHER(TEXMODE)) c_other.u &= 0x00ffffff; - rgba_to_rgbaint(&tmpA, (rgb_t) c_other.u); + tmpA.set((rgb_t) c_other.u); if (TEXMODE_TC_SUB_CLOCAL(TEXMODE) || TEXMODE_TCA_SUB_CLOCAL(TEXMODE)) { @@ -4846,8 +4840,8 @@ ATTR_FORCE_INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb if (!TEXMODE_TCA_SUB_CLOCAL(TEXMODE)) sub_val.u &= 0x00ffffff; - rgba_to_rgbaint(&tmpB, (rgb_t) sub_val.u); - rgbaint_sub(&tmpA, &tmpB); + tmpB.set((rgb_t) sub_val.u); + tmpA.sub(tmpB); } /* blend RGB */ @@ -4967,11 +4961,11 @@ ATTR_FORCE_INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb //result.rgb.g = (tg < 0) ? 0 : (tg > 0xff) ? 0xff : tg; //result.rgb.b = (tb < 0) ? 0 : (tb > 0xff) ? 0xff : tb; //result.rgb.a = (ta < 0) ? 0 : (ta > 0xff) ? 0xff : ta; - rgba_to_rgbaint(&tmpB, (rgb_t) c_local.u); - rgbaint_add_imm(&tmpB, 1); - rgba_to_rgbaint(&tmpC, (rgb_t) add_val.u); - rgbaint_scale_channel_add_and_clamp(&tmpA, &tmpB, &tmpC); - result = rgbaint_to_rgba(&tmpA); + tmpB.set((rgb_t) c_local.u); + tmpB.add_imm(1); + tmpC.set((rgb_t) add_val.u); + tmpA.scale_add_and_clamp(tmpB, tmpC); + result = tmpA.to_rgba(); /* invert */ if (TEXMODE_TC_INVERT_OUTPUT(TEXMODE)) diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 73c421b90d0..ff98657a672 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -211,7 +211,8 @@ static TIMER_CALLBACK( stall_cpu_callback ); static void stall_cpu(voodoo_state *v, int state, attotime current_time); static TIMER_CALLBACK( vblank_callback ); static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data); -static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, bool lfb_3d); +static INT32 lfb_direct_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask); +static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask); static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data); static INT32 banshee_2d_w(voodoo_state *v, offs_t offset, UINT32 data); @@ -1943,7 +1944,7 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) /* loop over words */ for (i = 0; i < count; i++) - cycles += lfb_w(v, target++, *src++, 0xffffffff, true); + cycles += lfb_w(v, target++, *src++, 0xffffffff); break; } @@ -2931,8 +2932,52 @@ default_case: * Voodoo LFB writes * *************************************/ +static INT32 lfb_direct_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) +{ + UINT16 *dest; + UINT32 destmax; + int x, y; + UINT32 bufoffs; + + /* statistics */ + v->stats.lfb_writes++; -static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, bool lfb_3d) + /* byte swizzling */ + if (LFBMODE_BYTE_SWIZZLE_WRITES(v->reg[lfbMode].u)) + { + data = FLIPENDIAN_INT32(data); + mem_mask = FLIPENDIAN_INT32(mem_mask); + } + + /* word swapping */ + if (LFBMODE_WORD_SWAP_WRITES(v->reg[lfbMode].u)) + { + data = (data << 16) | (data >> 16); + mem_mask = (mem_mask << 16) | (mem_mask >> 16); + } + + // TODO: This direct write is not verified. + // For direct lfb access just write the data + /* compute X,Y */ + offset <<= 1; + x = offset & ((1 << v->fbi.lfb_stride) - 1); + y = (offset >> v->fbi.lfb_stride); + dest = (UINT16 *)(v->fbi.ram + v->fbi.lfb_base*4); + destmax = (v->fbi.mask + 1 - v->fbi.lfb_base*4) / 2; + bufoffs = y * v->fbi.rowpixels + x; + if (bufoffs >= destmax) { + logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (UINT32) bufoffs, data); + return 0; + } + if (ACCESSING_BITS_0_15) + dest[bufoffs + 0] = data&0xffff; + if (ACCESSING_BITS_16_31) + dest[bufoffs + 1] = data>>16; + if (LOG_LFB) logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", v->index, x, y, data, mem_mask); + return 0; +} + +static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) { UINT16 *dest, *depth; UINT32 destmax, depthmax; @@ -2943,29 +2988,6 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, /* statistics */ v->stats.lfb_writes++; - // TODO: This direct write is not verified. - // For direct lfb access just write the data - if (!lfb_3d) { - UINT32 bufoffs; - /* compute X,Y */ - offset <<= 1; - x = offset & ((1 << v->fbi.lfb_stride) - 1); - y = (offset >> v->fbi.lfb_stride); - dest = (UINT16 *)(v->fbi.ram + v->fbi.lfb_base*4); - destmax = (v->fbi.mask + 1 - v->fbi.lfb_base*4) / 2; - bufoffs = y * v->fbi.rowpixels + x; - if (bufoffs >= destmax) { - logerror("LFB_W: Buffer offset out of bounds x=%i y=%i lfb_3d=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, lfb_3d, offset, (UINT32) bufoffs, data); - return 0; - } - if (ACCESSING_BITS_0_15) - dest[bufoffs + 0] = data&0xffff; - if (ACCESSING_BITS_16_31) - dest[bufoffs + 1] = data>>16; - if (LOG_LFB) logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", v->index, x, y, data, mem_mask); - return 0; - } - /* byte swizzling */ if (LFBMODE_BYTE_SWIZZLE_WRITES(v->reg[lfbMode].u)) { @@ -3187,9 +3209,6 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, depth = (UINT16 *)(v->fbi.ram + v->fbi.auxoffs); depthmax = (v->fbi.mask + 1 - v->fbi.auxoffs) / 2; - /* wait for any outstanding work to finish */ - poly_wait(v->poly, "LFB Write"); - /* simple case: no pipeline */ if (!LFBMODE_ENABLE_PIXEL_PIPELINE(v->reg[lfbMode].u)) { @@ -3209,6 +3228,9 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, /* compute dithering */ COMPUTE_DITHER_POINTERS_NO_DITHER_VAR(v->reg[fbzMode].u, y); + /* wait for any outstanding work to finish */ + poly_wait(v->poly, "LFB Write"); + /* loop over up to two pixels */ for (pix = 0; mask; pix++) { @@ -3349,7 +3371,7 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, if (USE_OLD_RASTER) { /* Perform depth testing */ DEPTH_TEST(v, stats, x, v->reg[fbzMode].u); - + /* apply chroma key, alpha mask, and alpha testing */ APPLY_CHROMAKEY(v, stats, v->reg[fbzMode].u, color); APPLY_ALPHAMASK(v, stats, v->reg[fbzMode].u, color.rgb.a); @@ -3358,7 +3380,7 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, /* Perform depth testing */ if (!depthTest((UINT16) v->reg[zaColor].u, stats, depth[x], v->reg[fbzMode].u, biasdepth)) goto nextpixel; - + /* handle chroma key */ if (!chromaKeyTest(v, stats, v->reg[fbzMode].u, color)) goto nextpixel; @@ -3370,6 +3392,9 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask, goto nextpixel; } + /* wait for any outstanding work to finish */ + poly_wait(v->poly, "LFB Write"); + /* pixel pipeline part 2 handles color combine, fog, alpha, and final output */ PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, @@ -3606,7 +3631,7 @@ static void flush_fifos(voodoo_state *v, attotime current_time) mem_mask &= 0xffff0000; address &= 0xffffff; - cycles = lfb_w(v, address, data, mem_mask, true); + cycles = lfb_w(v, address, data, mem_mask); } } @@ -3732,7 +3757,7 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) else if (offset & (0x800000/4)) cycles = texture_w(v, offset, data); else - cycles = lfb_w(v, offset, data, mem_mask, true); + cycles = lfb_w(v, offset, data, mem_mask); /* if we ended up with cycles, mark the operation pending */ if (cycles) @@ -4769,7 +4794,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", machine().describe_context(), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x2000000/4) { - lfb_w(v, offset & 0xffffff/4, data, mem_mask, true); + lfb_w(v, offset & 0xffffff/4, data, mem_mask); } else { logerror("%s:banshee_w Address out of range %08X = %08X & %08X\n", machine().describe_context(), (offset*4), data, mem_mask); } @@ -4803,7 +4828,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_fb_w ) } } else - lfb_w(v, offset - v->fbi.lfb_base, data, mem_mask, false); + lfb_direct_w(v, offset - v->fbi.lfb_base, data, mem_mask); } diff --git a/src/lib/formats/flopimg.c b/src/lib/formats/flopimg.c index 116edca5b1f..e2ee5122b2c 100644 --- a/src/lib/formats/flopimg.c +++ b/src/lib/formats/flopimg.c @@ -2565,7 +2565,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bi } // f8, f9, fa, fb if(shift_reg == 0xf56a || shift_reg == 0xf56b || - shift_reg == 0xf56e || shift_reg == 0xf56f) { // data mark + shift_reg == 0xf56e || shift_reg == 0xf56f) { // data mark if(dblk_count < 100) dblk[dblk_count++] = i+1; } diff --git a/src/lib/formats/jvc_dsk.c b/src/lib/formats/jvc_dsk.c index 20ee3508ee9..30ec8287f22 100644 --- a/src/lib/formats/jvc_dsk.c +++ b/src/lib/formats/jvc_dsk.c @@ -55,7 +55,7 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int switch (header_size) { - case 5: emu_fatalerror("jvc_format: sector attribute flag unsupported\n"); + case 5: emu_fatalerror("jvc_format: sector attribute flag unsupported\n"); break; case 4: base_sector_id = header[3]; // no break diff --git a/src/lib/formats/svi_dsk.c b/src/lib/formats/svi_dsk.c index 0c76aace591..aaa6a45e709 100644 --- a/src/lib/formats/svi_dsk.c +++ b/src/lib/formats/svi_dsk.c @@ -118,7 +118,7 @@ bool svi_format::save(io_generic *io, floppy_image *image) for (int head = 0; head < head_count; head++) { // skip track 0, head 0 - if (track == 0) { if (head_count == 1) break; else head++; } + if (track == 0) { if (head_count == 1) break; else head++; } generate_bitstream_from_track(track, head, 2000, bitstream, track_size, image); extract_sectors_from_bitstream_mfm_pc(bitstream, track_size, sectors, sector_data, sizeof(sector_data)); @@ -140,4 +140,3 @@ bool svi_format::supports_save() const } const floppy_format_type FLOPPY_SVI_FORMAT = &floppy_image_format_creator<svi_format>; - diff --git a/src/lib/formats/trs80_dsk.c b/src/lib/formats/trs80_dsk.c index acd122144d1..4a0a2bf5e49 100644 --- a/src/lib/formats/trs80_dsk.c +++ b/src/lib/formats/trs80_dsk.c @@ -8,8 +8,8 @@ Used by Jeff Vavasour's TRS-80 Emulators - TODO: - - Gap sizes unverified + TODO: + - Gap sizes unverified ***************************************************************************/ diff --git a/src/lib/formats/vdk_dsk.c b/src/lib/formats/vdk_dsk.c index 518d48ddd90..896815c26ad 100644 --- a/src/lib/formats/vdk_dsk.c +++ b/src/lib/formats/vdk_dsk.c @@ -102,7 +102,7 @@ bool vdk_format::save(io_generic *io, floppy_image *image) header[0] = 'd'; header[1] = 'k'; header[2] = sizeof(header) % 0x100; - header[3] = sizeof(header) / 0x100; + header[3] = sizeof(header) / 0x100; header[4] = 0x10; header[5] = 0x10; header[6] = 'M'; diff --git a/src/lib/formats/wd177x_dsk.c b/src/lib/formats/wd177x_dsk.c index 839b03b0dce..69458af0335 100644 --- a/src/lib/formats/wd177x_dsk.c +++ b/src/lib/formats/wd177x_dsk.c @@ -204,7 +204,6 @@ bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image for(int track=0; track < f.track_count; track++) for(int head=0; head < f.head_count; head++) { - if (f.encoding == floppy_image::FM) desc[14].p1 = get_track_dam_fm(f, head, track); else diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c index cb00ab23336..d9fdecb46cc 100644 --- a/src/lib/util/avhuff.c +++ b/src/lib/util/avhuff.c @@ -174,11 +174,11 @@ inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf) //************************************************************************** /** - * @fn avhuff_encoder::avhuff_encoder() + * @fn avhuff_encoder::avhuff_encoder() * - * @brief ------------------------------------------------- - * avhuff_encoder - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * avhuff_encoder - constructor + * -------------------------------------------------. */ avhuff_encoder::avhuff_encoder() @@ -189,17 +189,17 @@ m_flac_encoder.set_strip_metadata(true); } /** - * @fn avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) + * @fn avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) * - * @brief ------------------------------------------------- - * encode_data - encode a block of data into a compressed data stream - * -------------------------------------------------. + * @brief ------------------------------------------------- + * encode_data - encode a block of data into a compressed data stream + * -------------------------------------------------. * - * @param source Source for the. - * @param [in,out] dest If non-null, destination for the. - * @param [in,out] complength The complength. + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) @@ -278,15 +278,15 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3 } /** - * @fn UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) + * @fn UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) * - * @brief ------------------------------------------------- - * raw_data_size - return the raw data size of a raw stream based on the header - * -------------------------------------------------. + * @brief ------------------------------------------------- + * raw_data_size - return the raw data size of a raw stream based on the header + * -------------------------------------------------. * - * @param data The data. + * @param data The data. * - * @return An UINT32. + * @return An UINT32. */ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) @@ -308,21 +308,21 @@ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) } /** - * @fn avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) + * @fn avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) * - * @brief ------------------------------------------------- - * assemble_data - assemble a datastream from raw bits - * -------------------------------------------------. + * @brief ------------------------------------------------- + * assemble_data - assemble a datastream from raw bits + * -------------------------------------------------. * - * @param [in,out] buffer The buffer. - * @param [in,out] bitmap The bitmap. - * @param channels The channels. - * @param numsamples The numsamples. - * @param [in,out] samples If non-null, the samples. - * @param [in,out] metadata If non-null, the metadata. - * @param metadatasize The metadatasize. + * @param [in,out] buffer The buffer. + * @param [in,out] bitmap The bitmap. + * @param channels The channels. + * @param numsamples The numsamples. + * @param [in,out] samples If non-null, the samples. + * @param [in,out] metadata If non-null, the metadata. + * @param metadatasize The metadatasize. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) @@ -378,19 +378,19 @@ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 } /** - * @fn avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) + * @fn avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) * - * @brief ------------------------------------------------- - * encode_audio - encode raw audio data to the destination - * -------------------------------------------------. + * @brief ------------------------------------------------- + * encode_audio - encode raw audio data to the destination + * -------------------------------------------------. * - * @param source Source for the. - * @param channels The channels. - * @param samples The samples. - * @param [in,out] dest If non-null, destination for the. - * @param [in,out] sizes If non-null, the sizes. + * @param source Source for the. + * @param channels The channels. + * @param samples The samples. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] sizes If non-null, the sizes. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) @@ -511,19 +511,19 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int } /** - * @fn avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * @fn avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) * - * @brief ------------------------------------------------- - * encode_video - encode raw video data to the destination - * -------------------------------------------------. + * @brief ------------------------------------------------- + * encode_video - encode raw video data to the destination + * -------------------------------------------------. * - * @param source Source for the. - * @param width The width. - * @param height The height. - * @param [in,out] dest If non-null, destination for the. - * @param [in,out] complength The complength. + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) @@ -533,20 +533,20 @@ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int he } /** - * @fn avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * @fn avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) * - * @brief ------------------------------------------------- - * encode_video_lossless - do a lossless video encoding using deltas and huffman - * encoding - * -------------------------------------------------. + * @brief ------------------------------------------------- + * encode_video_lossless - do a lossless video encoding using deltas and huffman + * encoding + * -------------------------------------------------. * - * @param source Source for the. - * @param width The width. - * @param height The height. - * @param [in,out] dest If non-null, destination for the. - * @param [in,out] complength The complength. + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) @@ -601,18 +601,18 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt //************************************************************************** /** - * @fn UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) + * @fn UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) * - * @brief ------------------------------------------------- - * rle_and_histo_bitmap - RLE compress and histogram a bitmap's worth of data - * -------------------------------------------------. + * @brief ------------------------------------------------- + * rle_and_histo_bitmap - RLE compress and histogram a bitmap's worth of data + * -------------------------------------------------. * - * @param source Source for the. - * @param items_per_row The items per row. - * @param item_advance The item advance. - * @param row_count Number of rows. + * @param source Source for the. + * @param items_per_row The items per row. + * @param item_advance The item advance. + * @param row_count Number of rows. * - * @return null if it fails, else an UINT16*. + * @return null if it fails, else an UINT16*. */ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) @@ -679,11 +679,11 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour //************************************************************************** /** - * @fn avhuff_decoder::avhuff_decoder() + * @fn avhuff_decoder::avhuff_decoder() * - * @brief ------------------------------------------------- - * avhuff_decoder - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * avhuff_decoder - constructor + * -------------------------------------------------. */ avhuff_decoder::avhuff_decoder() @@ -691,13 +691,13 @@ avhuff_decoder::avhuff_decoder() } /** - * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) * - * @brief ------------------------------------------------- - * configure - configure decompression parameters - * -------------------------------------------------. + * @brief ------------------------------------------------- + * configure - configure decompression parameters + * -------------------------------------------------. * - * @param config The configuration. + * @param config The configuration. */ void avhuff_decoder::configure(const avhuff_decompress_config &config) @@ -712,17 +712,17 @@ void avhuff_decoder::configure(const avhuff_decompress_config &config) } /** - * @fn avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) + * @fn avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) * - * @brief ------------------------------------------------- - * decode_data - decode both audio and video from a raw data stream - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decode_data - decode both audio and video from a raw data stream + * -------------------------------------------------. * - * @param source Source for the. - * @param complength The complength. - * @param [in,out] dest If non-null, destination for the. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) @@ -853,23 +853,23 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, } /** - * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) + * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) * - * @brief ------------------------------------------------- - * decode_audio - decode audio from a compressed data stream - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decode_audio - decode audio from a compressed data stream + * -------------------------------------------------. * - * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error - * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. * - * @param channels The channels. - * @param samples The samples. - * @param source Source for the. - * @param [in,out] dest If non-null, destination for the. - * @param dxor The dxor. - * @param sizes The sizes. + * @param channels The channels. + * @param samples The samples. + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param dxor The dxor. + * @param sizes The sizes. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) @@ -991,21 +991,21 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 } /** - * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) * - * @brief ------------------------------------------------- - * decode_video - decode video from a compressed data stream - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decode_video - decode video from a compressed data stream + * -------------------------------------------------. * - * @param width The width. - * @param height The height. - * @param source Source for the. - * @param complength The complength. - * @param [in,out] dest If non-null, destination for the. - * @param dstride The dstride. - * @param dxor The dxor. + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) @@ -1018,22 +1018,22 @@ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *so } /** - * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) * - * @brief ------------------------------------------------- - * decode_video_lossless - do a lossless video decoding using deltas and huffman - * encoding - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decode_video_lossless - do a lossless video decoding using deltas and huffman + * encoding + * -------------------------------------------------. * - * @param width The width. - * @param height The height. - * @param source Source for the. - * @param complength The complength. - * @param [in,out] dest If non-null, destination for the. - * @param dstride The dstride. - * @param dxor The dxor. + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. * - * @return An avhuff_error. + * @return An avhuff_error. */ avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) diff --git a/src/lib/util/aviio.c b/src/lib/util/aviio.c index dcc14428716..06b603e0e31 100644 --- a/src/lib/util/aviio.c +++ b/src/lib/util/aviio.c @@ -19,136 +19,136 @@ ***************************************************************************/ /** - * @def FILETYPE_READ + * @def FILETYPE_READ * - * @brief A macro that defines filetype read. + * @brief A macro that defines filetype read. */ #define FILETYPE_READ 1 /** - * @def FILETYPE_CREATE + * @def FILETYPE_CREATE * - * @brief A macro that defines filetype create. + * @brief A macro that defines filetype create. */ #define FILETYPE_CREATE 2 -/** @brief Size of the maximum riff. */ +/** @brief Size of the maximum riff. */ #define MAX_RIFF_SIZE (2UL * 1024 * 1024 * 1024 - 1024) /* just under 2GB */ -/** @brief The maximum avi size in gigabytes. */ +/** @brief The maximum avi size in gigabytes. */ #define MAX_AVI_SIZE_IN_GB (256) /** - * @def FOUR_GB + * @def FOUR_GB * - * @brief A macro that defines four gigabytes. + * @brief A macro that defines four gigabytes. */ #define FOUR_GB ((UINT64)1 << 32) /** - * @def MAX_SOUND_CHANNELS + * @def MAX_SOUND_CHANNELS * - * @brief A macro that defines maximum sound channels. + * @brief A macro that defines maximum sound channels. */ #define MAX_SOUND_CHANNELS 2 /** - * @def SOUND_BUFFER_MSEC + * @def SOUND_BUFFER_MSEC * - * @brief A macro that defines sound buffer msec. + * @brief A macro that defines sound buffer msec. */ #define SOUND_BUFFER_MSEC 2000 /* milliseconds of sound buffering */ -/** @brief The chunktype riff. */ +/** @brief The chunktype riff. */ #define CHUNKTYPE_RIFF AVI_FOURCC('R','I','F','F') -/** @brief List of chunktypes. */ +/** @brief List of chunktypes. */ #define CHUNKTYPE_LIST AVI_FOURCC('L','I','S','T') -/** @brief The chunktype junk. */ +/** @brief The chunktype junk. */ #define CHUNKTYPE_JUNK AVI_FOURCC('J','U','N','K') -/** @brief The chunktype avih. */ +/** @brief The chunktype avih. */ #define CHUNKTYPE_AVIH AVI_FOURCC('a','v','i','h') -/** @brief The chunktype strh. */ +/** @brief The chunktype strh. */ #define CHUNKTYPE_STRH AVI_FOURCC('s','t','r','h') -/** @brief The chunktype strf. */ +/** @brief The chunktype strf. */ #define CHUNKTYPE_STRF AVI_FOURCC('s','t','r','f') -/** @brief The first chunktype index. */ +/** @brief The first chunktype index. */ #define CHUNKTYPE_IDX1 AVI_FOURCC('i','d','x','1') -/** @brief The chunktype indx. */ +/** @brief The chunktype indx. */ #define CHUNKTYPE_INDX AVI_FOURCC('i','n','d','x') -/** @brief The chunktype xxdb. */ +/** @brief The chunktype xxdb. */ #define CHUNKTYPE_XXDB AVI_FOURCC(0x00,0x00,'d','b') -/** @brief The chunktype xxdc. */ +/** @brief The chunktype xxdc. */ #define CHUNKTYPE_XXDC AVI_FOURCC(0x00,0x00,'d','c') -/** @brief The chunktype xxwb. */ +/** @brief The chunktype xxwb. */ #define CHUNKTYPE_XXWB AVI_FOURCC(0x00,0x00,'w','b') -/** @brief The chunktype ixxx. */ +/** @brief The chunktype ixxx. */ #define CHUNKTYPE_IXXX AVI_FOURCC('i','x',0x00,0x00) -/** @brief The chunktype xx mask. */ +/** @brief The chunktype xx mask. */ #define CHUNKTYPE_XX_MASK AVI_FOURCC(0x00,0x00,0xff,0xff) -/** @brief The listtype avi. */ +/** @brief The listtype avi. */ #define LISTTYPE_AVI AVI_FOURCC('A','V','I',' ') -/** @brief The listtype avix. */ +/** @brief The listtype avix. */ #define LISTTYPE_AVIX AVI_FOURCC('A','V','I','X') -/** @brief The listtype hdrl. */ +/** @brief The listtype hdrl. */ #define LISTTYPE_HDRL AVI_FOURCC('h','d','r','l') -/** @brief The listtype strl. */ +/** @brief The listtype strl. */ #define LISTTYPE_STRL AVI_FOURCC('s','t','r','l') -/** @brief The listtype movi. */ +/** @brief The listtype movi. */ #define LISTTYPE_MOVI AVI_FOURCC('m','o','v','i') -/** @brief The streamtype vids. */ +/** @brief The streamtype vids. */ #define STREAMTYPE_VIDS AVI_FOURCC('v','i','d','s') -/** @brief The streamtype auds. */ +/** @brief The streamtype auds. */ #define STREAMTYPE_AUDS AVI_FOURCC('a','u','d','s') -/** @brief The handler bitmap. */ +/** @brief The handler bitmap. */ #define HANDLER_DIB AVI_FOURCC('D','I','B',' ') -/** @brief The handler hfyu. */ +/** @brief The handler hfyu. */ #define HANDLER_HFYU AVI_FOURCC('h','f','y','u') /* main AVI header files */ /** - * @def AVIF_HASINDEX + * @def AVIF_HASINDEX * - * @brief A macro that defines avif hasindex. + * @brief A macro that defines avif hasindex. */ #define AVIF_HASINDEX 0x00000010 /** - * @def AVIF_MUSTUSEINDEX + * @def AVIF_MUSTUSEINDEX * - * @brief A macro that defines avif mustuseindex. + * @brief A macro that defines avif mustuseindex. */ #define AVIF_MUSTUSEINDEX 0x00000020 /** - * @def AVIF_ISINTERLEAVED + * @def AVIF_ISINTERLEAVED * - * @brief A macro that defines avif isinterleaved. + * @brief A macro that defines avif isinterleaved. */ #define AVIF_ISINTERLEAVED 0x00000100 /** - * @def AVIF_COPYRIGHTED + * @def AVIF_COPYRIGHTED * - * @brief A macro that defines avif copyrighted. + * @brief A macro that defines avif copyrighted. */ #define AVIF_COPYRIGHTED 0x00010000 /** - * @def AVIF_WASCAPTUREFILE + * @def AVIF_WASCAPTUREFILE * - * @brief A macro that defines avif wascapturefile. + * @brief A macro that defines avif wascapturefile. */ #define AVIF_WASCAPTUREFILE 0x00020000 @@ -156,33 +156,33 @@ /* index definitions */ /** - * @def AVI_INDEX_OF_INDEXES + * @def AVI_INDEX_OF_INDEXES * - * @brief A macro that defines avi index of indexes. + * @brief A macro that defines avi index of indexes. */ #define AVI_INDEX_OF_INDEXES 0x00 /** - * @def AVI_INDEX_OF_CHUNKS + * @def AVI_INDEX_OF_CHUNKS * - * @brief A macro that defines avi index of chunks. + * @brief A macro that defines avi index of chunks. */ #define AVI_INDEX_OF_CHUNKS 0x01 /** - * @def AVI_INDEX_IS_DATA + * @def AVI_INDEX_IS_DATA * - * @brief A macro that defines avi index is data. + * @brief A macro that defines avi index is data. */ #define AVI_INDEX_IS_DATA 0x80 /** - * @def AVI_INDEX_2FIELD + * @def AVI_INDEX_2FIELD * - * @brief A macro that defines avi index 2 field. + * @brief A macro that defines avi index 2 field. */ #define AVI_INDEX_2FIELD 0x01 @@ -190,33 +190,33 @@ /* HuffYUV definitions */ /** - * @def HUFFYUV_PREDICT_LEFT + * @def HUFFYUV_PREDICT_LEFT * - * @brief A macro that defines huffyuv predict left. + * @brief A macro that defines huffyuv predict left. */ #define HUFFYUV_PREDICT_LEFT 0 /** - * @def HUFFYUV_PREDICT_GRADIENT + * @def HUFFYUV_PREDICT_GRADIENT * - * @brief A macro that defines huffyuv predict gradient. + * @brief A macro that defines huffyuv predict gradient. */ #define HUFFYUV_PREDICT_GRADIENT 1 /** - * @def HUFFYUV_PREDICT_MEDIAN + * @def HUFFYUV_PREDICT_MEDIAN * - * @brief A macro that defines huffyuv predict median. + * @brief A macro that defines huffyuv predict median. */ #define HUFFYUV_PREDICT_MEDIAN 2 /** - * @def HUFFYUV_PREDICT_DECORR + * @def HUFFYUV_PREDICT_DECORR * - * @brief A macro that defines huffyuv predict decorr. + * @brief A macro that defines huffyuv predict decorr. */ #define HUFFYUV_PREDICT_DECORR 0x40 @@ -228,176 +228,176 @@ ***************************************************************************/ /** - * @struct avi_chunk + * @struct avi_chunk * - * @brief An avi chunk. + * @brief An avi chunk. */ struct avi_chunk { - /** @brief The offset. */ + /** @brief The offset. */ UINT64 offset; /* file offset of chunk header */ - /** @brief The size. */ + /** @brief The size. */ UINT64 size; /* size of this chunk */ - /** @brief The type. */ + /** @brief The type. */ UINT32 type; /* type of this chunk */ - /** @brief The listtype. */ + /** @brief The listtype. */ UINT32 listtype; /* type of this list (if we are a list) */ }; /** - * @struct avi_chunk_list + * @struct avi_chunk_list * - * @brief List of avi chunks. + * @brief List of avi chunks. */ struct avi_chunk_list { - /** @brief The offset. */ + /** @brief The offset. */ UINT64 offset; /* offset in the file of header */ - /** @brief The length. */ + /** @brief The length. */ UINT32 length; /* length of the chunk including header */ }; /** - * @struct huffyuv_table + * @struct huffyuv_table * - * @brief A huffyuv table. + * @brief A huffyuv table. */ struct huffyuv_table { - /** @brief The shift[ 256]. */ + /** @brief The shift[ 256]. */ UINT8 shift[256]; /* bit shift amounts */ - /** @brief The bits[ 256]. */ + /** @brief The bits[ 256]. */ UINT32 bits[256]; /* bit match values */ - /** @brief The mask[ 256]. */ + /** @brief The mask[ 256]. */ UINT32 mask[256]; /* bit mask values */ - /** @brief The baselookup[ 65536]. */ + /** @brief The baselookup[ 65536]. */ UINT16 baselookup[65536]; /* base lookup table */ - /** @brief The extralookup. */ + /** @brief The extralookup. */ UINT16 * extralookup; /* extra lookup tables */ }; /** - * @struct huffyuv_data + * @struct huffyuv_data * - * @brief A huffyuv data. + * @brief A huffyuv data. */ struct huffyuv_data { - /** @brief The predictor. */ + /** @brief The predictor. */ UINT8 predictor; /* predictor */ - /** @brief The table[ 3]. */ + /** @brief The table[ 3]. */ huffyuv_table table[3]; /* array of tables */ }; /** - * @struct avi_stream + * @struct avi_stream * - * @brief An avi stream. + * @brief An avi stream. */ struct avi_stream { - /** @brief The type. */ + /** @brief The type. */ UINT32 type; /* subtype of stream */ - /** @brief Describes the format to use. */ + /** @brief Describes the format to use. */ UINT32 format; /* format of stream data */ - /** @brief The rate. */ + /** @brief The rate. */ UINT32 rate; /* timescale for stream */ - /** @brief The scale. */ + /** @brief The scale. */ UINT32 scale; /* duration of one sample in the stream */ - /** @brief The samples. */ + /** @brief The samples. */ UINT32 samples; /* number of samples */ - /** @brief The chunk. */ + /** @brief The chunk. */ avi_chunk_list * chunk; /* list of chunks */ - /** @brief The chunks. */ + /** @brief The chunks. */ UINT32 chunks; /* chunks currently known */ - /** @brief The chunksalloc. */ + /** @brief The chunksalloc. */ UINT32 chunksalloc; /* number of chunks allocated */ - /** @brief The width. */ + /** @brief The width. */ UINT32 width; /* width of video */ - /** @brief The height. */ + /** @brief The height. */ UINT32 height; /* height of video */ - /** @brief The depth. */ + /** @brief The depth. */ UINT32 depth; /* depth of video */ - /** @brief The interlace. */ + /** @brief The interlace. */ UINT8 interlace; /* interlace parameters */ - /** @brief The huffyuv. */ + /** @brief The huffyuv. */ huffyuv_data * huffyuv; /* huffyuv decompression data */ - /** @brief The channels. */ + /** @brief The channels. */ UINT16 channels; /* audio channels */ - /** @brief The samplebits. */ + /** @brief The samplebits. */ UINT16 samplebits; /* audio bits per sample */ - /** @brief The samplerate. */ + /** @brief The samplerate. */ UINT32 samplerate; /* audio sample rate */ /* only used when creating */ - /** @brief The saved strh offset. */ + /** @brief The saved strh offset. */ UINT64 saved_strh_offset; /* writeoffset of strh chunk */ - /** @brief The saved indx offset. */ + /** @brief The saved indx offset. */ UINT64 saved_indx_offset; /* writeoffset of indx chunk */ }; /** - * @struct avi_file + * @struct avi_file * - * @brief An avi file. + * @brief An avi file. */ struct avi_file { /* shared data */ - /** @brief The file. */ + /** @brief The file. */ osd_file * file; /* pointer to open file */ - /** @brief The type. */ + /** @brief The type. */ int type; /* type of access (read/create) */ - /** @brief The information. */ + /** @brief The information. */ avi_movie_info info; /* movie info structure */ - /** @brief The tempbuffer. */ + /** @brief The tempbuffer. */ UINT8 * tempbuffer; /* temporary buffer */ - /** @brief The tempbuffersize. */ + /** @brief The tempbuffersize. */ UINT32 tempbuffersize; /* size of the temporary buffer */ /* only used when reading */ - /** @brief The streams. */ + /** @brief The streams. */ int streams; /* number of streams */ - /** @brief The stream. */ + /** @brief The stream. */ avi_stream * stream; /* allocated array of stream information */ - /** @brief The rootchunk. */ + /** @brief The rootchunk. */ avi_chunk rootchunk; /* dummy root chunk that wraps the whole file */ /* only used when creating */ - /** @brief The writeoffs. */ + /** @brief The writeoffs. */ UINT64 writeoffs; /* current file write offset */ - /** @brief The riffbase. */ + /** @brief The riffbase. */ UINT64 riffbase; /* base of the current RIFF */ - /** @brief The chunkstack[ 8]. */ + /** @brief The chunkstack[ 8]. */ avi_chunk chunkstack[8]; /* stack of chunks we are writing */ - /** @brief The chunksp. */ + /** @brief The chunksp. */ int chunksp; /* stack pointer for the current chunk */ - /** @brief The saved movi offset. */ + /** @brief The saved movi offset. */ UINT64 saved_movi_offset; /* writeoffset of movi list */ - /** @brief The saved avih offset. */ + /** @brief The saved avih offset. */ UINT64 saved_avih_offset; /* writeoffset of avih chunk */ - /** @brief The soundbuf. */ + /** @brief The soundbuf. */ INT16 * soundbuf; /* buffer for sound data */ - /** @brief The soundbuf samples. */ + /** @brief The soundbuf samples. */ UINT32 soundbuf_samples; /* length of sound buffer in samples */ - /** @brief The soundbuf chansamples[ maximum sound channels]. */ + /** @brief The soundbuf chansamples[ maximum sound channels]. */ UINT32 soundbuf_chansamples[MAX_SOUND_CHANNELS]; /* samples in buffer for each channel */ - /** @brief The soundbuf chunks. */ + /** @brief The soundbuf chunks. */ UINT32 soundbuf_chunks; /* number of chunks completed so far */ - /** @brief The soundbuf frames. */ + /** @brief The soundbuf frames. */ UINT32 soundbuf_frames; /* number of frames ahead of the video */ }; @@ -471,13 +471,13 @@ static void printf_chunk_recursive(avi_file *file, avi_chunk *chunk, int indent) -------------------------------------------------*/ /** - * @fn INLINE UINT16 fetch_16bits(const UINT8 *data) + * @fn INLINE UINT16 fetch_16bits(const UINT8 *data) * - * @brief Fetches the 16bits. + * @brief Fetches the 16bits. * - * @param data The data. + * @param data The data. * - * @return The 16bits. + * @return The 16bits. */ INLINE UINT16 fetch_16bits(const UINT8 *data) @@ -492,13 +492,13 @@ INLINE UINT16 fetch_16bits(const UINT8 *data) -------------------------------------------------*/ /** - * @fn INLINE UINT32 fetch_32bits(const UINT8 *data) + * @fn INLINE UINT32 fetch_32bits(const UINT8 *data) * - * @brief Fetches the 32bits. + * @brief Fetches the 32bits. * - * @param data The data. + * @param data The data. * - * @return The 32bits. + * @return The 32bits. */ INLINE UINT32 fetch_32bits(const UINT8 *data) @@ -513,13 +513,13 @@ INLINE UINT32 fetch_32bits(const UINT8 *data) -------------------------------------------------*/ /** - * @fn INLINE UINT64 fetch_64bits(const UINT8 *data) + * @fn INLINE UINT64 fetch_64bits(const UINT8 *data) * - * @brief Fetches the 64bits. + * @brief Fetches the 64bits. * - * @param data The data. + * @param data The data. * - * @return The 64bits. + * @return The 64bits. */ INLINE UINT64 fetch_64bits(const UINT8 *data) @@ -537,12 +537,12 @@ INLINE UINT64 fetch_64bits(const UINT8 *data) -------------------------------------------------*/ /** - * @fn INLINE void put_16bits(UINT8 *data, UINT16 value) + * @fn INLINE void put_16bits(UINT8 *data, UINT16 value) * - * @brief Puts the 16bits. + * @brief Puts the 16bits. * - * @param [in,out] data If non-null, the data. - * @param value The value. + * @param [in,out] data If non-null, the data. + * @param value The value. */ INLINE void put_16bits(UINT8 *data, UINT16 value) @@ -558,12 +558,12 @@ INLINE void put_16bits(UINT8 *data, UINT16 value) -------------------------------------------------*/ /** - * @fn INLINE void put_32bits(UINT8 *data, UINT32 value) + * @fn INLINE void put_32bits(UINT8 *data, UINT32 value) * - * @brief Puts the 32bits. + * @brief Puts the 32bits. * - * @param [in,out] data If non-null, the data. - * @param value The value. + * @param [in,out] data If non-null, the data. + * @param value The value. */ INLINE void put_32bits(UINT8 *data, UINT32 value) @@ -581,12 +581,12 @@ INLINE void put_32bits(UINT8 *data, UINT32 value) -------------------------------------------------*/ /** - * @fn INLINE void put_64bits(UINT8 *data, UINT64 value) + * @fn INLINE void put_64bits(UINT8 *data, UINT64 value) * - * @brief Puts the 64bits. + * @brief Puts the 64bits. * - * @param [in,out] data If non-null, the data. - * @param value The value. + * @param [in,out] data If non-null, the data. + * @param value The value. */ INLINE void put_64bits(UINT8 *data, UINT64 value) @@ -608,13 +608,13 @@ INLINE void put_64bits(UINT8 *data, UINT64 value) -------------------------------------------------*/ /** - * @fn INLINE avi_stream *get_video_stream(avi_file *file) + * @fn INLINE avi_stream *get_video_stream(avi_file *file) * - * @brief Gets video stream. + * @brief Gets video stream. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return null if it fails, else the video stream. + * @return null if it fails, else the video stream. */ INLINE avi_stream *get_video_stream(avi_file *file) @@ -636,15 +636,15 @@ INLINE avi_stream *get_video_stream(avi_file *file) -------------------------------------------------*/ /** - * @fn INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) + * @fn INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) * - * @brief Gets audio stream. + * @brief Gets audio stream. * - * @param [in,out] file If non-null, the file. - * @param channel The channel. - * @param [in,out] offset If non-null, the offset. + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param [in,out] offset If non-null, the offset. * - * @return null if it fails, else the audio stream. + * @return null if it fails, else the audio stream. */ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) @@ -674,16 +674,16 @@ INLINE avi_stream *get_audio_stream(avi_file *file, int channel, int *offset) -------------------------------------------------*/ /** - * @fn INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length) + * @fn INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length) * - * @brief Sets stream chunk information. + * @brief Sets stream chunk information. * - * @param [in,out] stream If non-null, the stream. - * @param index Zero-based index of the. - * @param offset The offset. - * @param length The length. + * @param [in,out] stream If non-null, the stream. + * @param index Zero-based index of the. + * @param offset The offset. + * @param length The length. * - * @return An avi_error. + * @return An avi_error. */ INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 offset, UINT32 length) @@ -720,13 +720,13 @@ INLINE avi_error set_stream_chunk_info(avi_stream *stream, UINT32 index, UINT64 -------------------------------------------------*/ /** - * @fn INLINE UINT32 compute_idx1_size(avi_file *file) + * @fn INLINE UINT32 compute_idx1_size(avi_file *file) * - * @brief Calculates the index 1 size. + * @brief Calculates the index 1 size. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return The calculated index 1 size. + * @return The calculated index 1 size. */ INLINE UINT32 compute_idx1_size(avi_file *file) @@ -748,14 +748,14 @@ INLINE UINT32 compute_idx1_size(avi_file *file) -------------------------------------------------*/ /** - * @fn INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) + * @fn INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) * - * @brief Gets chunkid for stream. + * @brief Gets chunkid for stream. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. * - * @return The chunkid for stream. + * @return The chunkid for stream. */ INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) @@ -778,14 +778,14 @@ INLINE UINT32 get_chunkid_for_stream(avi_file *file, avi_stream *stream) -------------------------------------------------*/ /** - * @fn INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) + * @fn INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) * - * @brief Framenum to samplenum. + * @brief Framenum to samplenum. * - * @param [in,out] file If non-null, the file. - * @param framenum The framenum. + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. * - * @return An UINT32. + * @return An UINT32. */ INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) @@ -801,14 +801,14 @@ INLINE UINT32 framenum_to_samplenum(avi_file *file, UINT32 framenum) -------------------------------------------------*/ /** - * @fn INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) + * @fn INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) * - * @brief Expand tempbuffer. + * @brief Expand tempbuffer. * - * @param [in,out] file If non-null, the file. - * @param length The length. + * @param [in,out] file If non-null, the file. + * @param length The length. * - * @return An avi_error. + * @return An avi_error. */ INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) @@ -838,14 +838,14 @@ INLINE avi_error expand_tempbuffer(avi_file *file, UINT32 length) -------------------------------------------------*/ /** - * @fn avi_error avi_open(const char *filename, avi_file **file) + * @fn avi_error avi_open(const char *filename, avi_file **file) * - * @brief Queries if a given avi open. + * @brief Queries if a given avi open. * - * @param filename Filename of the file. - * @param [in,out] file If non-null, the file. + * @param filename Filename of the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_open(const char *filename, avi_file **file) @@ -901,15 +901,15 @@ error: -------------------------------------------------*/ /** - * @fn avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file) + * @fn avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file) * - * @brief Avi create. + * @brief Avi create. * - * @param filename Filename of the file. - * @param info The information. - * @param [in,out] file If non-null, the file. + * @param filename Filename of the file. + * @param info The information. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_create(const char *filename, const avi_movie_info *info, avi_file **file) @@ -1020,13 +1020,13 @@ error: -------------------------------------------------*/ /** - * @fn avi_error avi_close(avi_file *file) + * @fn avi_error avi_close(avi_file *file) * - * @brief Avi close. + * @brief Avi close. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_close(avi_file *file) @@ -1104,11 +1104,11 @@ avi_error avi_close(avi_file *file) -------------------------------------------------*/ /** - * @fn void avi_printf_chunks(avi_file *file) + * @fn void avi_printf_chunks(avi_file *file) * - * @brief Avi printf chunks. + * @brief Avi printf chunks. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. */ void avi_printf_chunks(avi_file *file) @@ -1123,13 +1123,13 @@ void avi_printf_chunks(avi_file *file) -------------------------------------------------*/ /** - * @fn const char *avi_error_string(avi_error err) + * @fn const char *avi_error_string(avi_error err) * - * @brief Avi error string. + * @brief Avi error string. * - * @param err The error. + * @param err The error. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *avi_error_string(avi_error err) @@ -1164,13 +1164,13 @@ const char *avi_error_string(avi_error err) -------------------------------------------------*/ /** - * @fn const avi_movie_info *avi_get_movie_info(avi_file *file) + * @fn const avi_movie_info *avi_get_movie_info(avi_file *file) * - * @brief Avi get movie information. + * @brief Avi get movie information. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return null if it fails, else an avi_movie_info*. + * @return null if it fails, else an avi_movie_info*. */ const avi_movie_info *avi_get_movie_info(avi_file *file) @@ -1185,14 +1185,14 @@ const avi_movie_info *avi_get_movie_info(avi_file *file) -------------------------------------------------*/ /** - * @fn UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) + * @fn UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) * - * @brief Avi first sample in frame. + * @brief Avi first sample in frame. * - * @param [in,out] file If non-null, the file. - * @param framenum The framenum. + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. * - * @return An UINT32. + * @return An UINT32. */ UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) @@ -1208,15 +1208,15 @@ UINT32 avi_first_sample_in_frame(avi_file *file, UINT32 framenum) -------------------------------------------------*/ /** - * @fn avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bitmap) + * @fn avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bitmap) * - * @brief Avi read video frame. + * @brief Avi read video frame. * - * @param [in,out] file If non-null, the file. - * @param framenum The framenum. - * @param [in,out] bitmap The bitmap. + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. + * @param [in,out] bitmap The bitmap. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bitmap) @@ -1278,17 +1278,17 @@ avi_error avi_read_video_frame(avi_file *file, UINT32 framenum, bitmap_yuy16 &bi -------------------------------------------------*/ /** - * @fn avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample, UINT32 numsamples, INT16 *output) + * @fn avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample, UINT32 numsamples, INT16 *output) * - * @brief Avi read sound samples. + * @brief Avi read sound samples. * - * @param [in,out] file If non-null, the file. - * @param channel The channel. - * @param firstsample The firstsample. - * @param numsamples The numsamples. - * @param [in,out] output If non-null, the output. + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param firstsample The firstsample. + * @param numsamples The numsamples. + * @param [in,out] output If non-null, the output. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample, UINT32 numsamples, INT16 *output) @@ -1398,14 +1398,14 @@ avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample -------------------------------------------------*/ /** - * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) + * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) * - * @brief Avi append video frame. + * @brief Avi append video frame. * - * @param [in,out] file If non-null, the file. - * @param [in,out] bitmap The bitmap. + * @param [in,out] file If non-null, the file. + * @param [in,out] bitmap The bitmap. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) @@ -1456,14 +1456,14 @@ avi_error avi_append_video_frame(avi_file *file, bitmap_yuy16 &bitmap) -------------------------------------------------*/ /** - * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) + * @fn avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) * - * @brief Avi append video frame. + * @brief Avi append video frame. * - * @param [in,out] file If non-null, the file. - * @param [in,out] bitmap The bitmap. + * @param [in,out] file If non-null, the file. + * @param [in,out] bitmap The bitmap. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) @@ -1518,17 +1518,17 @@ avi_error avi_append_video_frame(avi_file *file, bitmap_rgb32 &bitmap) -------------------------------------------------*/ /** - * @fn avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *samples, UINT32 numsamples, UINT32 sampleskip) + * @fn avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *samples, UINT32 numsamples, UINT32 sampleskip) * - * @brief Avi append sound samples. + * @brief Avi append sound samples. * - * @param [in,out] file If non-null, the file. - * @param channel The channel. - * @param samples The samples. - * @param numsamples The numsamples. - * @param sampleskip The sampleskip. + * @param [in,out] file If non-null, the file. + * @param channel The channel. + * @param samples The samples. + * @param numsamples The numsamples. + * @param sampleskip The sampleskip. * - * @return An avi_error. + * @return An avi_error. */ avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *samples, UINT32 numsamples, UINT32 sampleskip) @@ -1561,15 +1561,15 @@ avi_error avi_append_sound_samples(avi_file *file, int channel, const INT16 *sam -------------------------------------------------*/ /** - * @fn static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 **buffer) + * @fn static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 **buffer) * - * @brief Reads chunk data. + * @brief Reads chunk data. * - * @param [in,out] file If non-null, the file. - * @param chunk The chunk. - * @param [in,out] buffer If non-null, the buffer. + * @param [in,out] file If non-null, the file. + * @param chunk The chunk. + * @param [in,out] buffer If non-null, the buffer. * - * @return The chunk data. + * @return The chunk data. */ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 **buffer) @@ -1601,15 +1601,15 @@ static avi_error read_chunk_data(avi_file *file, const avi_chunk *chunk, UINT8 * -------------------------------------------------*/ /** - * @fn static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) + * @fn static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) * - * @brief Gets the first chunk. + * @brief Gets the first chunk. * - * @param [in,out] file If non-null, the file. - * @param parent The parent. - * @param [in,out] newchunk If non-null, the newchunk. + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. * - * @return The first chunk. + * @return The first chunk. */ static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) @@ -1627,15 +1627,15 @@ static avi_error get_first_chunk(avi_file *file, const avi_chunk *parent, avi_ch -------------------------------------------------*/ /** - * @fn static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) + * @fn static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) * - * @brief Gets the next chunk. + * @brief Gets the next chunk. * - * @param [in,out] file If non-null, the file. - * @param parent The parent. - * @param [in,out] newchunk If non-null, the newchunk. + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. * - * @return The next chunk. + * @return The next chunk. */ static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk) @@ -1651,16 +1651,16 @@ static avi_error get_next_chunk(avi_file *file, const avi_chunk *parent, avi_chu -------------------------------------------------*/ /** - * @fn static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * @fn static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) * - * @brief Searches for the first chunk. + * @brief Searches for the first chunk. * - * @param [in,out] file If non-null, the file. - * @param findme The findme. - * @param container The container. - * @param [out] result If non-null, the result. + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. * - * @return The found chunk. + * @return The found chunk. */ static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) @@ -1681,16 +1681,16 @@ static avi_error find_first_chunk(avi_file *file, UINT32 findme, const avi_chunk -------------------------------------------------*/ /** - * @fn static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * @fn static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) * - * @brief Searches for the next chunk. + * @brief Searches for the next chunk. * - * @param [in,out] file If non-null, the file. - * @param findme The findme. - * @param container The container. - * @param [out] result If non-null, the result. + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. * - * @return The found chunk. + * @return The found chunk. */ static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) @@ -1711,16 +1711,16 @@ static avi_error find_next_chunk(avi_file *file, UINT32 findme, const avi_chunk -------------------------------------------------*/ /** - * @fn static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * @fn static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) * - * @brief Searches for the first list. + * @brief Searches for the first list. * - * @param [in,out] file If non-null, the file. - * @param findme The findme. - * @param container The container. - * @param [out] result If non-null, the result. + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. * - * @return The found list. + * @return The found list. */ static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) @@ -1741,16 +1741,16 @@ static avi_error find_first_list(avi_file *file, UINT32 findme, const avi_chunk -------------------------------------------------*/ /** - * @fn static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) + * @fn static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) * - * @brief Searches for the next list. + * @brief Searches for the next list. * - * @param [in,out] file If non-null, the file. - * @param findme The findme. - * @param container The container. - * @param [out] result If non-null, the result. + * @param [in,out] file If non-null, the file. + * @param findme The findme. + * @param container The container. + * @param [out] result If non-null, the result. * - * @return The found list. + * @return The found list. */ static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk *container, avi_chunk *result) @@ -1771,16 +1771,16 @@ static avi_error find_next_list(avi_file *file, UINT32 findme, const avi_chunk * -------------------------------------------------*/ /** - * @fn static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk, UINT64 offset) + * @fn static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk, UINT64 offset) * - * @brief Gets the next chunk internal. + * @brief Gets the next chunk internal. * - * @param [in,out] file If non-null, the file. - * @param parent The parent. - * @param [in,out] newchunk If non-null, the newchunk. - * @param offset The offset. + * @param [in,out] file If non-null, the file. + * @param parent The parent. + * @param [in,out] newchunk If non-null, the newchunk. + * @param offset The offset. * - * @return The next chunk internal. + * @return The next chunk internal. */ static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent, avi_chunk *newchunk, UINT64 offset) @@ -1827,13 +1827,13 @@ static avi_error get_next_chunk_internal(avi_file *file, const avi_chunk *parent -------------------------------------------------*/ /** - * @fn static avi_error read_movie_data(avi_file *file) + * @fn static avi_error read_movie_data(avi_file *file) * - * @brief Reads movie data. + * @brief Reads movie data. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return The movie data. + * @return The movie data. */ static avi_error read_movie_data(avi_file *file) @@ -1938,13 +1938,13 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error extract_movie_info(avi_file *file) + * @fn static avi_error extract_movie_info(avi_file *file) * - * @brief Extracts the movie information described by file. + * @brief Extracts the movie information described by file. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return The extracted movie information. + * @return The extracted movie information. */ static avi_error extract_movie_info(avi_file *file) @@ -2009,14 +2009,14 @@ static avi_error extract_movie_info(avi_file *file) -------------------------------------------------*/ /** - * @fn static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih) + * @fn static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih) * - * @brief Parse avih chunk. + * @brief Parse avih chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] avih If non-null, the avih. + * @param [in,out] file If non-null, the file. + * @param [in,out] avih If non-null, the avih. * - * @return An avi_error. + * @return An avi_error. */ static avi_error parse_avih_chunk(avi_file *file, avi_chunk *avih) @@ -2051,15 +2051,15 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh) + * @fn static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh) * - * @brief Parse strh chunk. + * @brief Parse strh chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. - * @param [in,out] strh If non-null, the strh. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strh If non-null, the strh. * - * @return An avi_error. + * @return An avi_error. */ static avi_error parse_strh_chunk(avi_file *file, avi_stream *stream, avi_chunk *strh) @@ -2091,15 +2091,15 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) + * @fn static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) * - * @brief Parse strf chunk. + * @brief Parse strf chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. - * @param [in,out] strf If non-null, the strf. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strf If non-null, the strf. * - * @return An avi_error. + * @return An avi_error. */ static avi_error parse_strf_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) @@ -2147,15 +2147,15 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) + * @fn static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) * - * @brief Parse indx chunk. + * @brief Parse indx chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. - * @param [in,out] strf If non-null, the strf. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param [in,out] strf If non-null, the strf. * - * @return An avi_error. + * @return An avi_error. */ static avi_error parse_indx_chunk(avi_file *file, avi_stream *stream, avi_chunk *strf) @@ -2249,15 +2249,15 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1) + * @fn static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1) * - * @brief Parse index 1 chunk. + * @brief Parse index 1 chunk. * - * @param [in,out] file If non-null, the file. - * @param baseoffset The baseoffset. - * @param [in,out] idx1 If non-null, the first index. + * @param [in,out] file If non-null, the file. + * @param baseoffset The baseoffset. + * @param [in,out] idx1 If non-null, the first index. * - * @return An avi_error. + * @return An avi_error. */ static avi_error parse_idx1_chunk(avi_file *file, UINT64 baseoffset, avi_chunk *idx1) @@ -2311,16 +2311,16 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 estlength) + * @fn static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 estlength) * - * @brief Queries if a given chunk open. + * @brief Queries if a given chunk open. * - * @param [in,out] file If non-null, the file. - * @param type The type. - * @param listtype The listtype. - * @param estlength The estlength. + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param listtype The listtype. + * @param estlength The estlength. * - * @return An avi_error. + * @return An avi_error. */ static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 estlength) @@ -2382,13 +2382,13 @@ static avi_error chunk_open(avi_file *file, UINT32 type, UINT32 listtype, UINT32 -------------------------------------------------*/ /** - * @fn static avi_error chunk_close(avi_file *file) + * @fn static avi_error chunk_close(avi_file *file) * - * @brief Chunk close. + * @brief Chunk close. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ static avi_error chunk_close(avi_file *file) @@ -2425,16 +2425,16 @@ static avi_error chunk_close(avi_file *file) -------------------------------------------------*/ /** - * @fn static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT32 length) + * @fn static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT32 length) * - * @brief Chunk write. + * @brief Chunk write. * - * @param [in,out] file If non-null, the file. - * @param type The type. - * @param data The data. - * @param length The length. + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param data The data. + * @param length The length. * - * @return An avi_error. + * @return An avi_error. */ static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT32 length) @@ -2509,18 +2509,18 @@ static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT -------------------------------------------------*/ /** - * @fn static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, UINT32 length, UINT64 *offset, int initial_write) + * @fn static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, UINT32 length, UINT64 *offset, int initial_write) * - * @brief Chunk overwrite. + * @brief Chunk overwrite. * - * @param [in,out] file If non-null, the file. - * @param type The type. - * @param data The data. - * @param length The length. - * @param [in,out] offset If non-null, the offset. - * @param initial_write The initial write. + * @param [in,out] file If non-null, the file. + * @param type The type. + * @param data The data. + * @param length The length. + * @param [in,out] offset If non-null, the offset. + * @param initial_write The initial write. * - * @return An avi_error. + * @return An avi_error. */ static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, UINT32 length, UINT64 *offset, int initial_write) @@ -2556,13 +2556,13 @@ static avi_error chunk_overwrite(avi_file *file, UINT32 type, const void *data, -------------------------------------------------*/ /** - * @fn static avi_error write_initial_headers(avi_file *file) + * @fn static avi_error write_initial_headers(avi_file *file) * - * @brief Writes an initial headers. + * @brief Writes an initial headers. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_initial_headers(avi_file *file) @@ -2638,14 +2638,14 @@ static avi_error write_initial_headers(avi_file *file) -------------------------------------------------*/ /** - * @fn static avi_error write_avih_chunk(avi_file *file, int initial_write) + * @fn static avi_error write_avih_chunk(avi_file *file, int initial_write) * - * @brief Writes an avih chunk. + * @brief Writes an avih chunk. * - * @param [in,out] file If non-null, the file. - * @param initial_write The initial write. + * @param [in,out] file If non-null, the file. + * @param initial_write The initial write. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_avih_chunk(avi_file *file, int initial_write) @@ -2674,15 +2674,15 @@ static avi_error write_avih_chunk(avi_file *file, int initial_write) -------------------------------------------------*/ /** - * @fn static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initial_write) + * @fn static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initial_write) * - * @brief Writes a strh chunk. + * @brief Writes a strh chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. - * @param initial_write The initial write. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param initial_write The initial write. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initial_write) @@ -2729,14 +2729,14 @@ static avi_error write_strh_chunk(avi_file *file, avi_stream *stream, int initia -------------------------------------------------*/ /** - * @fn static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) + * @fn static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) * - * @brief Writes a strf chunk. + * @brief Writes a strf chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) @@ -2793,15 +2793,15 @@ static avi_error write_strf_chunk(avi_file *file, avi_stream *stream) -------------------------------------------------*/ /** - * @fn static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initial_write) + * @fn static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initial_write) * - * @brief Writes an indx chunk. + * @brief Writes an indx chunk. * - * @param [in,out] file If non-null, the file. - * @param [in,out] stream If non-null, the stream. - * @param initial_write The initial write. + * @param [in,out] file If non-null, the file. + * @param [in,out] stream If non-null, the stream. + * @param initial_write The initial write. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initial_write) @@ -2901,13 +2901,13 @@ static avi_error write_indx_chunk(avi_file *file, avi_stream *stream, int initia -------------------------------------------------*/ /** - * @fn static avi_error write_idx1_chunk(avi_file *file) + * @fn static avi_error write_idx1_chunk(avi_file *file) * - * @brief Writes an index 1 chunk. + * @brief Writes an index 1 chunk. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ static avi_error write_idx1_chunk(avi_file *file) @@ -2960,13 +2960,13 @@ static avi_error write_idx1_chunk(avi_file *file) -------------------------------------------------*/ /** - * @fn static avi_error soundbuf_initialize(avi_file *file) + * @fn static avi_error soundbuf_initialize(avi_file *file) * - * @brief Soundbuf initialize. + * @brief Soundbuf initialize. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An avi_error. + * @return An avi_error. */ static avi_error soundbuf_initialize(avi_file *file) @@ -3003,14 +3003,14 @@ static avi_error soundbuf_initialize(avi_file *file) -------------------------------------------------*/ /** - * @fn static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) + * @fn static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) * - * @brief Soundbuf write chunk. + * @brief Soundbuf write chunk. * - * @param [in,out] file If non-null, the file. - * @param framenum The framenum. + * @param [in,out] file If non-null, the file. + * @param framenum The framenum. * - * @return An avi_error. + * @return An avi_error. */ static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) @@ -3046,14 +3046,14 @@ static avi_error soundbuf_write_chunk(avi_file *file, UINT32 framenum) -------------------------------------------------*/ /** - * @fn static avi_error soundbuf_flush(avi_file *file, int only_flush_full) + * @fn static avi_error soundbuf_flush(avi_file *file, int only_flush_full) * - * @brief Soundbuf flush. + * @brief Soundbuf flush. * - * @param [in,out] file If non-null, the file. - * @param only_flush_full The only flush full. + * @param [in,out] file If non-null, the file. + * @param only_flush_full The only flush full. * - * @return An avi_error. + * @return An avi_error. */ static avi_error soundbuf_flush(avi_file *file, int only_flush_full) @@ -3150,16 +3150,16 @@ static avi_error soundbuf_flush(avi_file *file, int only_flush_full) -------------------------------------------------*/ /** - * @fn static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &bitmap, UINT8 *data, UINT32 numbytes) + * @fn static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &bitmap, UINT8 *data, UINT32 numbytes) * - * @brief RGB 32 compress to RGB. + * @brief RGB 32 compress to RGB. * - * @param [in,out] stream If non-null, the stream. - * @param bitmap The bitmap. - * @param [in,out] data If non-null, the data. - * @param numbytes The numbytes. + * @param [in,out] stream If non-null, the stream. + * @param bitmap The bitmap. + * @param [in,out] data If non-null, the data. + * @param numbytes The numbytes. * - * @return An avi_error. + * @return An avi_error. */ static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &bitmap, UINT8 *data, UINT32 numbytes) @@ -3214,16 +3214,16 @@ static avi_error rgb32_compress_to_rgb(avi_stream *stream, const bitmap_rgb32 &b -------------------------------------------------*/ /** - * @fn static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) + * @fn static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) * - * @brief Yuv decompress to yuy 16. + * @brief Yuv decompress to yuy 16. * - * @param [in,out] stream If non-null, the stream. - * @param data The data. - * @param numbytes The numbytes. - * @param [in,out] bitmap The bitmap. + * @param [in,out] stream If non-null, the stream. + * @param data The data. + * @param numbytes The numbytes. + * @param [in,out] bitmap The bitmap. * - * @return An avi_error. + * @return An avi_error. */ static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) @@ -3266,16 +3266,16 @@ static avi_error yuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, -------------------------------------------------*/ /** - * @fn static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &bitmap, UINT8 *data, UINT32 numbytes) + * @fn static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &bitmap, UINT8 *data, UINT32 numbytes) * - * @brief Yuy 16 compress to yuy. + * @brief Yuy 16 compress to yuy. * - * @param [in,out] stream If non-null, the stream. - * @param bitmap The bitmap. - * @param [in,out] data If non-null, the data. - * @param numbytes The numbytes. + * @param [in,out] stream If non-null, the stream. + * @param bitmap The bitmap. + * @param [in,out] data If non-null, the data. + * @param numbytes The numbytes. * - * @return An avi_error. + * @return An avi_error. */ static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &bitmap, UINT8 *data, UINT32 numbytes) @@ -3318,15 +3318,15 @@ static avi_error yuy16_compress_to_yuy(avi_stream *stream, const bitmap_yuy16 &b -------------------------------------------------*/ /** - * @fn static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkdata, UINT32 size) + * @fn static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkdata, UINT32 size) * - * @brief Huffyuv extract tables. + * @brief Huffyuv extract tables. * - * @param [in,out] stream If non-null, the stream. - * @param chunkdata The chunkdata. - * @param size The size. + * @param [in,out] stream If non-null, the stream. + * @param chunkdata The chunkdata. + * @param size The size. * - * @return An avi_error. + * @return An avi_error. */ static avi_error huffyuv_extract_tables(avi_stream *stream, const UINT8 *chunkdata, UINT32 size) @@ -3469,16 +3469,16 @@ error: -------------------------------------------------*/ /** - * @fn static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) + * @fn static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) * - * @brief Huffyuv decompress to yuy 16. + * @brief Huffyuv decompress to yuy 16. * - * @param [in,out] stream If non-null, the stream. - * @param data The data. - * @param numbytes The numbytes. - * @param [in,out] bitmap The bitmap. + * @param [in,out] stream If non-null, the stream. + * @param data The data. + * @param numbytes The numbytes. + * @param [in,out] bitmap The bitmap. * - * @return An avi_error. + * @return An avi_error. */ static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *data, UINT32 numbytes, bitmap_yuy16 &bitmap) @@ -3685,12 +3685,12 @@ static avi_error huffyuv_decompress_to_yuy16(avi_stream *stream, const UINT8 *da } /** - * @fn static void u64toa(UINT64 val, char *output) + * @fn static void u64toa(UINT64 val, char *output) * - * @brief 64toas. + * @brief 64toas. * - * @param val The value. - * @param [in,out] output If non-null, the output. + * @param val The value. + * @param [in,out] output If non-null, the output. */ static void u64toa(UINT64 val, char *output) @@ -3710,13 +3710,13 @@ static void u64toa(UINT64 val, char *output) -------------------------------------------------*/ /** - * @fn static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int indent) + * @fn static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int indent) * - * @brief Printf chunk recursive. + * @brief Printf chunk recursive. * - * @param [in,out] file If non-null, the file. - * @param [in,out] container If non-null, the container. - * @param indent The indent. + * @param [in,out] file If non-null, the file. + * @param [in,out] container If non-null, the container. + * @param indent The indent. */ static void printf_chunk_recursive(avi_file *file, avi_chunk *container, int indent) diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c index e9e941f3fc5..aeb9852ca1c 100644 --- a/src/lib/util/bitmap.c +++ b/src/lib/util/bitmap.c @@ -20,9 +20,9 @@ // CONSTANTS //************************************************************************** -/** @brief alignment values; 128 bytes is the largest cache line on typical architectures today. */ +/** @brief alignment values; 128 bytes is the largest cache line on typical architectures today. */ const UINT32 BITMAP_OVERALL_ALIGN = 128; -/** @brief The bitmap rowbytes align. */ +/** @brief The bitmap rowbytes align. */ const UINT32 BITMAP_ROWBYTES_ALIGN = 128; @@ -62,18 +62,18 @@ inline void bitmap_t::compute_base(int xslop, int yslop) //************************************************************************** /** - * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop) + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop) * - * @brief ------------------------------------------------- - * bitmap_t - basic constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * bitmap_t - basic constructor + * -------------------------------------------------. * - * @param format Describes the format to use. - * @param bpp The bits per pixel. - * @param width The width. - * @param height The height. - * @param xslop The xslop. - * @param yslop The yslop. + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. */ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop) @@ -88,16 +88,16 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl } /** - * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels) + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels) * - * @brief Constructor. + * @brief Constructor. * - * @param format Describes the format to use. - * @param bpp The bits per pixel. - * @param [in,out] base If non-null, the base. - * @param width The width. - * @param height The height. - * @param rowpixels The rowpixels. + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param [in,out] base If non-null, the base. + * @param width The width. + * @param height The height. + * @param rowpixels The rowpixels. */ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels) @@ -115,14 +115,14 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei } /** - * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect) + * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect) * - * @brief Constructor. + * @brief Constructor. * - * @param format Describes the format to use. - * @param bpp The bits per pixel. - * @param [in,out] source Source for the. - * @param subrect The subrect. + * @param format Describes the format to use. + * @param bpp The bits per pixel. + * @param [in,out] source Source for the. + * @param subrect The subrect. */ bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect) @@ -143,11 +143,11 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectan } /** - * @fn bitmap_t::~bitmap_t() + * @fn bitmap_t::~bitmap_t() * - * @brief ------------------------------------------------- - * ~bitmap_t - basic destructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ~bitmap_t - basic destructor + * -------------------------------------------------. */ bitmap_t::~bitmap_t() @@ -157,17 +157,17 @@ bitmap_t::~bitmap_t() } /** - * @fn void bitmap_t::allocate(int width, int height, int xslop, int yslop) + * @fn void bitmap_t::allocate(int width, int height, int xslop, int yslop) * - * @brief ------------------------------------------------- - * allocate -- (re)allocate memory for the bitmap at the given size, destroying - * anything that already exists - * -------------------------------------------------. + * @brief ------------------------------------------------- + * allocate -- (re)allocate memory for the bitmap at the given size, destroying + * anything that already exists + * -------------------------------------------------. * - * @param width The width. - * @param height The height. - * @param xslop The xslop. - * @param yslop The yslop. + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. */ void bitmap_t::allocate(int width, int height, int xslop, int yslop) @@ -201,17 +201,17 @@ void bitmap_t::allocate(int width, int height, int xslop, int yslop) } /** - * @fn void bitmap_t::resize(int width, int height, int xslop, int yslop) + * @fn void bitmap_t::resize(int width, int height, int xslop, int yslop) * - * @brief ------------------------------------------------- - * resize -- resize a bitmap, reusing existing memory if the new size is smaller than - * the current size - * -------------------------------------------------. + * @brief ------------------------------------------------- + * resize -- resize a bitmap, reusing existing memory if the new size is smaller than + * the current size + * -------------------------------------------------. * - * @param width The width. - * @param height The height. - * @param xslop The xslop. - * @param yslop The yslop. + * @param width The width. + * @param height The height. + * @param xslop The xslop. + * @param yslop The yslop. */ void bitmap_t::resize(int width, int height, int xslop, int yslop) @@ -248,11 +248,11 @@ void bitmap_t::resize(int width, int height, int xslop, int yslop) } /** - * @fn void bitmap_t::reset() + * @fn void bitmap_t::reset() * - * @brief ------------------------------------------------- - * reset -- reset to an invalid bitmap, deleting all allocated stuff - * -------------------------------------------------. + * @brief ------------------------------------------------- + * reset -- reset to an invalid bitmap, deleting all allocated stuff + * -------------------------------------------------. */ void bitmap_t::reset() @@ -271,16 +271,16 @@ void bitmap_t::reset() } /** - * @fn void bitmap_t::wrap(void *base, int width, int height, int rowpixels) + * @fn void bitmap_t::wrap(void *base, int width, int height, int rowpixels) * - * @brief ------------------------------------------------- - * wrap -- wrap an array of memory; the target bitmap does not own the memory - * -------------------------------------------------. + * @brief ------------------------------------------------- + * wrap -- wrap an array of memory; the target bitmap does not own the memory + * -------------------------------------------------. * - * @param [in,out] base If non-null, the base. - * @param width The width. - * @param height The height. - * @param rowpixels The rowpixels. + * @param [in,out] base If non-null, the base. + * @param width The width. + * @param height The height. + * @param rowpixels The rowpixels. */ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) @@ -297,15 +297,15 @@ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) } /** - * @fn void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) + * @fn void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) * - * @brief ------------------------------------------------- - * wrap -- wrap a subrectangle of an existing bitmap by copying its fields; the target - * bitmap does not own the memory - * -------------------------------------------------. + * @brief ------------------------------------------------- + * wrap -- wrap a subrectangle of an existing bitmap by copying its fields; the target + * bitmap does not own the memory + * -------------------------------------------------. * - * @param source Source for the. - * @param subrect The subrect. + * @param source Source for the. + * @param subrect The subrect. */ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) @@ -327,13 +327,13 @@ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) } /** - * @fn void bitmap_t::set_palette(palette_t *palette) + * @fn void bitmap_t::set_palette(palette_t *palette) * - * @brief ------------------------------------------------- - * set_palette -- associate a palette with a bitmap - * -------------------------------------------------. + * @brief ------------------------------------------------- + * set_palette -- associate a palette with a bitmap + * -------------------------------------------------. * - * @param [in,out] palette If non-null, the palette. + * @param [in,out] palette If non-null, the palette. */ void bitmap_t::set_palette(palette_t *palette) @@ -354,14 +354,14 @@ void bitmap_t::set_palette(palette_t *palette) } /** - * @fn void bitmap_t::fill(UINT32 color, const rectangle &cliprect) + * @fn void bitmap_t::fill(UINT32 color, const rectangle &cliprect) * - * @brief ------------------------------------------------- - * fill -- fill a bitmap with a solid color - * -------------------------------------------------. + * @brief ------------------------------------------------- + * fill -- fill a bitmap with a solid color + * -------------------------------------------------. * - * @param color The color. - * @param cliprect The cliprect. + * @param color The color. + * @param cliprect The cliprect. */ void bitmap_t::fill(UINT32 color, const rectangle &cliprect) diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c index 40f3caf4190..e3cb14e8f0c 100644 --- a/src/lib/util/cdrom.c +++ b/src/lib/util/cdrom.c @@ -28,39 +28,39 @@ DEBUGGING ***************************************************************************/ -/** @brief The verbose. */ +/** @brief The verbose. */ #define VERBOSE (0) #if VERBOSE /** - * @def LOG(x) do + * @def LOG(x) do * - * @brief A macro that defines log. + * @brief A macro that defines log. * - * @param x The void to process. + * @param x The void to process. */ #define LOG(x) do { if (VERBOSE) logerror x; } while (0) /** - * @fn void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); + * @fn void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); * - * @brief Logerrors the given text. + * @brief Logerrors the given text. * - * @param text The text. + * @param text The text. * - * @return A CLIB_DECL. + * @return A CLIB_DECL. */ void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); #else /** - * @def LOG(x); + * @def LOG(x); * - * @brief A macro that defines log. + * @brief A macro that defines log. * - * @param x The void to process. + * @param x The void to process. */ #define LOG(x) @@ -72,26 +72,26 @@ void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); CONSTANTS ***************************************************************************/ -/** @brief offset within sector. */ +/** @brief offset within sector. */ const int SYNC_OFFSET = 0x000; -/** @brief 12 bytes. */ +/** @brief 12 bytes. */ const int SYNC_NUM_BYTES = 12; -/** @brief offset within sector. */ +/** @brief offset within sector. */ const int MODE_OFFSET = 0x00f; -/** @brief offset within sector. */ +/** @brief offset within sector. */ const int ECC_P_OFFSET = 0x81c; -/** @brief 2 lots of 86. */ +/** @brief 2 lots of 86. */ const int ECC_P_NUM_BYTES = 86; -/** @brief 24 bytes each. */ +/** @brief 24 bytes each. */ const int ECC_P_COMP = 24; -/** @brief The ECC q offset. */ +/** @brief The ECC q offset. */ const int ECC_Q_OFFSET = ECC_P_OFFSET + 2 * ECC_P_NUM_BYTES; -/** @brief 2 lots of 52. */ +/** @brief 2 lots of 52. */ const int ECC_Q_NUM_BYTES = 52; -/** @brief 43 bytes each. */ +/** @brief 43 bytes each. */ const int ECC_Q_COMP = 43; @@ -101,20 +101,20 @@ const int ECC_Q_COMP = 43; ***************************************************************************/ /** - * @struct cdrom_file + * @struct cdrom_file * - * @brief A cdrom file. + * @brief A cdrom file. */ struct cdrom_file { - /** @brief The chd. */ + /** @brief The chd. */ chd_file * chd; /* CHD file */ - /** @brief The cdtoc. */ + /** @brief The cdtoc. */ cdrom_toc cdtoc; /* TOC for the CD */ - /** @brief Information describing the track. */ + /** @brief Information describing the track. */ chdcd_track_input_info track_info; /* track info */ - /** @brief The fhandle[ CD maximum tracks]. */ + /** @brief The fhandle[ CD maximum tracks]. */ core_file * fhandle[CD_MAX_TRACKS];/* file handle */ }; @@ -130,15 +130,15 @@ struct cdrom_file -------------------------------------------------*/ /** - * @fn INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum) + * @fn INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum) * - * @brief Physical to chd lba. + * @brief Physical to chd lba. * - * @param [in,out] file If non-null, the file. - * @param physlba The physlba. - * @param [in,out] tracknum The tracknum. + * @param [in,out] file If non-null, the file. + * @param physlba The physlba. + * @param [in,out] tracknum The tracknum. * - * @return An UINT32. + * @return An UINT32. */ INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &tracknum) @@ -164,15 +164,15 @@ INLINE UINT32 physical_to_chd_lba(cdrom_file *file, UINT32 physlba, UINT32 &trac -------------------------------------------------*/ /** - * @fn INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum) + * @fn INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum) * - * @brief Logical to chd lba. + * @brief Logical to chd lba. * - * @param [in,out] file If non-null, the file. - * @param loglba The loglba. - * @param [in,out] tracknum The tracknum. + * @param [in,out] file If non-null, the file. + * @param loglba The loglba. + * @param [in,out] tracknum The tracknum. * - * @return An UINT32. + * @return An UINT32. */ INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &tracknum) @@ -208,13 +208,13 @@ INLINE UINT32 logical_to_chd_lba(cdrom_file *file, UINT32 loglba, UINT32 &trackn ***************************************************************************/ /** - * @fn cdrom_file *cdrom_open(const char *inputfile) + * @fn cdrom_file *cdrom_open(const char *inputfile) * - * @brief Queries if a given cdrom open. + * @brief Queries if a given cdrom open. * - * @param inputfile The inputfile. + * @param inputfile The inputfile. * - * @return null if it fails, else a cdrom_file*. + * @return null if it fails, else a cdrom_file*. */ cdrom_file *cdrom_open(const char *inputfile) @@ -304,13 +304,13 @@ cdrom_file *cdrom_open(const char *inputfile) -------------------------------------------------*/ /** - * @fn cdrom_file *cdrom_open(chd_file *chd) + * @fn cdrom_file *cdrom_open(chd_file *chd) * - * @brief Queries if a given cdrom open. + * @brief Queries if a given cdrom open. * - * @param [in,out] chd If non-null, the chd. + * @param [in,out] chd If non-null, the chd. * - * @return null if it fails, else a cdrom_file*. + * @return null if it fails, else a cdrom_file*. */ cdrom_file *cdrom_open(chd_file *chd) @@ -402,11 +402,11 @@ cdrom_file *cdrom_open(chd_file *chd) -------------------------------------------------*/ /** - * @fn void cdrom_close(cdrom_file *file) + * @fn void cdrom_close(cdrom_file *file) * - * @brief Cdrom close. + * @brief Cdrom close. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. */ void cdrom_close(cdrom_file *file) @@ -432,19 +432,19 @@ void cdrom_close(cdrom_file *file) ***************************************************************************/ /** - * @fn chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length) + * @fn chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length) * - * @brief Reads partial sector. + * @brief Reads partial sector. * - * @param [in,out] file If non-null, the file. - * @param [in,out] dest If non-null, destination for the. - * @param lbasector The lbasector. - * @param chdsector The chdsector. - * @param tracknum The tracknum. - * @param startoffs The startoffs. - * @param length The length. + * @param [in,out] file If non-null, the file. + * @param [in,out] dest If non-null, destination for the. + * @param lbasector The lbasector. + * @param chdsector The chdsector. + * @param tracknum The tracknum. + * @param startoffs The startoffs. + * @param length The length. * - * @return The partial sector. + * @return The partial sector. */ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UINT32 chdsector, UINT32 tracknum, UINT32 startoffs, UINT32 length) @@ -506,17 +506,17 @@ chd_error read_partial_sector(cdrom_file *file, void *dest, UINT32 lbasector, UI -------------------------------------------------*/ /** - * @fn UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys) + * @fn UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys) * - * @brief Cdrom read data. + * @brief Cdrom read data. * - * @param [in,out] file If non-null, the file. - * @param lbasector The lbasector. - * @param [in,out] buffer If non-null, the buffer. - * @param datatype The datatype. - * @param phys true to physical. + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. + * @param datatype The datatype. + * @param phys true to physical. * - * @return An UINT32. + * @return An UINT32. */ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype, bool phys) @@ -592,16 +592,16 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 -------------------------------------------------*/ /** - * @fn UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys) + * @fn UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys) * - * @brief Cdrom read subcode. + * @brief Cdrom read subcode. * - * @param [in,out] file If non-null, the file. - * @param lbasector The lbasector. - * @param [in,out] buffer If non-null, the buffer. - * @param phys true to physical. + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. + * @param phys true to physical. * - * @return An UINT32. + * @return An UINT32. */ UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool phys) @@ -642,14 +642,14 @@ UINT32 cdrom_read_subcode(cdrom_file *file, UINT32 lbasector, void *buffer, bool -------------------------------------------------*/ /** - * @fn UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) + * @fn UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) * - * @brief Cdrom get track. + * @brief Cdrom get track. * - * @param [in,out] file If non-null, the file. - * @param frame The frame. + * @param [in,out] file If non-null, the file. + * @param frame The frame. * - * @return An UINT32. + * @return An UINT32. */ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) @@ -672,14 +672,14 @@ UINT32 cdrom_get_track(cdrom_file *file, UINT32 frame) -------------------------------------------------*/ /** - * @fn UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) + * @fn UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) * - * @brief Cdrom get track start. + * @brief Cdrom get track start. * - * @param [in,out] file If non-null, the file. - * @param track The track. + * @param [in,out] file If non-null, the file. + * @param track The track. * - * @return An UINT32. + * @return An UINT32. */ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) @@ -700,14 +700,14 @@ UINT32 cdrom_get_track_start(cdrom_file *file, UINT32 track) -------------------------------------------------*/ /** - * @fn UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) + * @fn UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) * - * @brief Cdrom get track start physical. + * @brief Cdrom get track start physical. * - * @param [in,out] file If non-null, the file. - * @param track The track. + * @param [in,out] file If non-null, the file. + * @param track The track. * - * @return An UINT32. + * @return An UINT32. */ UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) @@ -732,13 +732,13 @@ UINT32 cdrom_get_track_start_phys(cdrom_file *file, UINT32 track) -------------------------------------------------*/ /** - * @fn int cdrom_get_last_track(cdrom_file *file) + * @fn int cdrom_get_last_track(cdrom_file *file) * - * @brief Cdrom get last track. + * @brief Cdrom get last track. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return An int. + * @return An int. */ int cdrom_get_last_track(cdrom_file *file) @@ -756,14 +756,14 @@ int cdrom_get_last_track(cdrom_file *file) -------------------------------------------------*/ /** - * @fn int cdrom_get_adr_control(cdrom_file *file, int track) + * @fn int cdrom_get_adr_control(cdrom_file *file, int track) * - * @brief Cdrom get address control. + * @brief Cdrom get address control. * - * @param [in,out] file If non-null, the file. - * @param track The track. + * @param [in,out] file If non-null, the file. + * @param track The track. * - * @return An int. + * @return An int. */ int cdrom_get_adr_control(cdrom_file *file, int track) @@ -785,14 +785,14 @@ int cdrom_get_adr_control(cdrom_file *file, int track) -------------------------------------------------*/ /** - * @fn int cdrom_get_track_type(cdrom_file *file, int track) + * @fn int cdrom_get_track_type(cdrom_file *file, int track) * - * @brief Cdrom get track type. + * @brief Cdrom get track type. * - * @param [in,out] file If non-null, the file. - * @param track The track. + * @param [in,out] file If non-null, the file. + * @param track The track. * - * @return An int. + * @return An int. */ int cdrom_get_track_type(cdrom_file *file, int track) @@ -810,13 +810,13 @@ int cdrom_get_track_type(cdrom_file *file, int track) -------------------------------------------------*/ /** - * @fn const cdrom_toc *cdrom_get_toc(cdrom_file *file) + * @fn const cdrom_toc *cdrom_get_toc(cdrom_file *file) * - * @brief Cdrom get TOC. + * @brief Cdrom get TOC. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return null if it fails, else a cdrom_toc*. + * @return null if it fails, else a cdrom_toc*. */ const cdrom_toc *cdrom_get_toc(cdrom_file *file) @@ -840,13 +840,13 @@ const cdrom_toc *cdrom_get_toc(cdrom_file *file) -------------------------------------------------*/ /** - * @fn static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize) + * @fn static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize) * - * @brief Cdrom get information from type string. + * @brief Cdrom get information from type string. * - * @param typestring The typestring. - * @param [in,out] trktype If non-null, the trktype. - * @param [in,out] datasize If non-null, the datasize. + * @param typestring The typestring. + * @param [in,out] trktype If non-null, the trktype. + * @param [in,out] datasize If non-null, the datasize. */ static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize) @@ -935,12 +935,12 @@ static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trkt -------------------------------------------------*/ /** - * @fn void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track_info *info) + * @fn void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track_info *info) * - * @brief Cdrom convert type string to track information. + * @brief Cdrom convert type string to track information. * - * @param typestring The typestring. - * @param [in,out] info If non-null, the information. + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. */ void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track_info *info) @@ -955,12 +955,12 @@ void cdrom_convert_type_string_to_track_info(const char *typestring, cdrom_track -------------------------------------------------*/ /** - * @fn void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info) + * @fn void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info) * - * @brief Cdrom convert type string to pregap information. + * @brief Cdrom convert type string to pregap information. * - * @param typestring The typestring. - * @param [in,out] info If non-null, the information. + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. */ void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_track_info *info) @@ -975,12 +975,12 @@ void cdrom_convert_type_string_to_pregap_info(const char *typestring, cdrom_trac -------------------------------------------------*/ /** - * @fn void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info) + * @fn void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info) * - * @brief Cdrom convert subtype string to track information. + * @brief Cdrom convert subtype string to track information. * - * @param typestring The typestring. - * @param [in,out] info If non-null, the information. + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. */ void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_track_info *info) @@ -1004,12 +1004,12 @@ void cdrom_convert_subtype_string_to_track_info(const char *typestring, cdrom_tr -------------------------------------------------*/ /** - * @fn void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info) + * @fn void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info) * - * @brief Cdrom convert subtype string to pregap information. + * @brief Cdrom convert subtype string to pregap information. * - * @param typestring The typestring. - * @param [in,out] info If non-null, the information. + * @param typestring The typestring. + * @param [in,out] info If non-null, the information. */ void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info) @@ -1032,13 +1032,13 @@ void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_t -------------------------------------------------*/ /** - * @fn const char *cdrom_get_type_string(UINT32 trktype) + * @fn const char *cdrom_get_type_string(UINT32 trktype) * - * @brief Cdrom get type string. + * @brief Cdrom get type string. * - * @param trktype The trktype. + * @param trktype The trktype. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *cdrom_get_type_string(UINT32 trktype) @@ -1064,13 +1064,13 @@ const char *cdrom_get_type_string(UINT32 trktype) -------------------------------------------------*/ /** - * @fn const char *cdrom_get_subtype_string(UINT32 subtype) + * @fn const char *cdrom_get_subtype_string(UINT32 subtype) * - * @brief Cdrom get subtype string. + * @brief Cdrom get subtype string. * - * @param subtype The subtype. + * @param subtype The subtype. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *cdrom_get_subtype_string(UINT32 subtype) @@ -1095,14 +1095,14 @@ const char *cdrom_get_subtype_string(UINT32 subtype) -------------------------------------------------*/ /** - * @fn chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) + * @fn chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) * - * @brief Cdrom parse metadata. + * @brief Cdrom parse metadata. * - * @param [in,out] chd If non-null, the chd. - * @param [in,out] toc If non-null, the TOC. + * @param [in,out] chd If non-null, the chd. + * @param [in,out] toc If non-null, the TOC. * - * @return A chd_error. + * @return A chd_error. */ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) @@ -1272,14 +1272,14 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) -------------------------------------------------*/ /** - * @fn chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) + * @fn chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) * - * @brief Cdrom write metadata. + * @brief Cdrom write metadata. * - * @param [in,out] chd If non-null, the chd. - * @param toc The TOC. + * @param [in,out] chd If non-null, the chd. + * @param toc The TOC. * - * @return A chd_error. + * @return A chd_error. */ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) @@ -1327,9 +1327,9 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) } /** - * @brief ------------------------------------------------- - * ECC lookup tables pre-calculated tables for ECC data calcs - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ECC lookup tables pre-calculated tables for ECC data calcs + * -------------------------------------------------. */ static const UINT8 ecclow[256] = @@ -1352,7 +1352,7 @@ static const UINT8 ecclow[256] = 0xfd, 0xff, 0xf9, 0xfb, 0xf5, 0xf7, 0xf1, 0xf3, 0xed, 0xef, 0xe9, 0xeb, 0xe5, 0xe7, 0xe1, 0xe3 }; -/** @brief The ecchigh[ 256]. */ +/** @brief The ecchigh[ 256]. */ static const UINT8 ecchigh[256] = { 0x00, 0xf4, 0xf5, 0x01, 0xf7, 0x03, 0x02, 0xf6, 0xf3, 0x07, 0x06, 0xf2, 0x04, 0xf0, 0xf1, 0x05, @@ -1374,10 +1374,10 @@ static const UINT8 ecchigh[256] = }; /** - * @brief ------------------------------------------------- - * poffsets - each row represents the addresses used to calculate a byte of the ECC P - * data 86 (*2) ECC P bytes, 24 values represented by each - * -------------------------------------------------. + * @brief ------------------------------------------------- + * poffsets - each row represents the addresses used to calculate a byte of the ECC P + * data 86 (*2) ECC P bytes, 24 values represented by each + * -------------------------------------------------. */ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] = @@ -1471,10 +1471,10 @@ static const UINT16 poffsets[ECC_P_NUM_BYTES][ECC_P_COMP] = }; /** - * @brief ------------------------------------------------- - * qoffsets - each row represents the addresses used to calculate a byte of the ECC Q - * data 52 (*2) ECC Q bytes, 43 values represented by each - * -------------------------------------------------. + * @brief ------------------------------------------------- + * qoffsets - each row represents the addresses used to calculate a byte of the ECC Q + * data 52 (*2) ECC Q bytes, 43 values represented by each + * -------------------------------------------------. */ static const UINT16 qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] = @@ -1547,17 +1547,17 @@ inline UINT8 ecc_source_byte(const UINT8 *sector, UINT32 offset) } /** - * @fn void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2) + * @fn void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2) * - * @brief ------------------------------------------------- - * ecc_compute_bytes - calculate an ECC value (P or Q) - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ecc_compute_bytes - calculate an ECC value (P or Q) + * -------------------------------------------------. * - * @param sector The sector. - * @param row The row. - * @param rowlen The rowlen. - * @param [in,out] val1 The first value. - * @param [in,out] val2 The second value. + * @param sector The sector. + * @param row The row. + * @param rowlen The rowlen. + * @param [in,out] val1 The first value. + * @param [in,out] val2 The second value. */ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 &val1, UINT8 &val2) @@ -1574,15 +1574,15 @@ void ecc_compute_bytes(const UINT8 *sector, const UINT16 *row, int rowlen, UINT8 } /** - * @fn bool ecc_verify(const UINT8 *sector) + * @fn bool ecc_verify(const UINT8 *sector) * - * @brief ------------------------------------------------- - * ecc_verify - verify the P and Q ECC codes in a sector - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ecc_verify - verify the P and Q ECC codes in a sector + * -------------------------------------------------. * - * @param sector The sector. + * @param sector The sector. * - * @return true if it succeeds, false if it fails. + * @return true if it succeeds, false if it fails. */ bool ecc_verify(const UINT8 *sector) @@ -1608,14 +1608,14 @@ bool ecc_verify(const UINT8 *sector) } /** - * @fn void ecc_generate(UINT8 *sector) + * @fn void ecc_generate(UINT8 *sector) * - * @brief ------------------------------------------------- - * ecc_generate - generate the P and Q ECC codes for a sector, overwriting any - * existing codes - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ecc_generate - generate the P and Q ECC codes for a sector, overwriting any + * existing codes + * -------------------------------------------------. * - * @param [in,out] sector If non-null, the sector. + * @param [in,out] sector If non-null, the sector. */ void ecc_generate(UINT8 *sector) @@ -1630,13 +1630,13 @@ void ecc_generate(UINT8 *sector) } /** - * @fn void ecc_clear(UINT8 *sector) + * @fn void ecc_clear(UINT8 *sector) * - * @brief ------------------------------------------------- - * ecc_clear - erase the ECC P and Q cods to 0 within a sector - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ecc_clear - erase the ECC P and Q cods to 0 within a sector + * -------------------------------------------------. * - * @param [in,out] sector If non-null, the sector. + * @param [in,out] sector If non-null, the sector. */ void ecc_clear(UINT8 *sector) diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index f9bdf179f8a..07e98d03b85 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -280,11 +280,11 @@ inline UINT8 chd_file::bits_for_value(UINT64 value) //************************************************************************** /** - * @fn chd_file::chd_file() + * @fn chd_file::chd_file() * - * @brief ------------------------------------------------- - * chd_file - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * chd_file - constructor + * -------------------------------------------------. */ chd_file::chd_file() @@ -297,11 +297,11 @@ chd_file::chd_file() } /** - * @fn chd_file::~chd_file() + * @fn chd_file::~chd_file() * - * @brief ------------------------------------------------- - * ~chd_file - destructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ~chd_file - destructor + * -------------------------------------------------. */ chd_file::~chd_file() @@ -311,13 +311,13 @@ chd_file::~chd_file() } /** - * @fn sha1_t chd_file::sha1() + * @fn sha1_t chd_file::sha1() * - * @brief ------------------------------------------------- - * sha1 - return our SHA1 value - * -------------------------------------------------. + * @brief ------------------------------------------------- + * sha1 - return our SHA1 value + * -------------------------------------------------. * - * @return A sha1_t. + * @return A sha1_t. */ sha1_t chd_file::sha1() @@ -337,16 +337,16 @@ sha1_t chd_file::sha1() } /** - * @fn sha1_t chd_file::raw_sha1() + * @fn sha1_t chd_file::raw_sha1() * - * @brief ------------------------------------------------- - * raw_sha1 - return our raw SHA1 value - * -------------------------------------------------. + * @brief ------------------------------------------------- + * raw_sha1 - return our raw SHA1 value + * -------------------------------------------------. * - * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error - * condition occurs. + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. * - * @return A sha1_t. + * @return A sha1_t. */ sha1_t chd_file::raw_sha1() @@ -370,16 +370,16 @@ sha1_t chd_file::raw_sha1() } /** - * @fn sha1_t chd_file::parent_sha1() + * @fn sha1_t chd_file::parent_sha1() * - * @brief ------------------------------------------------- - * parent_sha1 - return our parent's SHA1 value - * -------------------------------------------------. + * @brief ------------------------------------------------- + * parent_sha1 - return our parent's SHA1 value + * -------------------------------------------------. * - * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error - * condition occurs. + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. * - * @return A sha1_t. + * @return A sha1_t. */ sha1_t chd_file::parent_sha1() @@ -403,17 +403,17 @@ sha1_t chd_file::parent_sha1() } /** - * @fn chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes) + * @fn chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes) * - * @brief ------------------------------------------------- - * hunk_info - return information about this hunk - * -------------------------------------------------. + * @brief ------------------------------------------------- + * hunk_info - return information about this hunk + * -------------------------------------------------. * - * @param hunknum The hunknum. - * @param [in,out] compressor The compressor. - * @param [in,out] compbytes The compbytes. + * @param hunknum The hunknum. + * @param [in,out] compressor The compressor. + * @param [in,out] compbytes The compbytes. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 &compbytes) @@ -514,13 +514,13 @@ chd_error chd_file::hunk_info(UINT32 hunknum, chd_codec_type &compressor, UINT32 } /** - * @fn void chd_file::set_raw_sha1(sha1_t rawdata) + * @fn void chd_file::set_raw_sha1(sha1_t rawdata) * - * @brief ------------------------------------------------- - * set_raw_sha1 - set our SHA1 values - * -------------------------------------------------. + * @brief ------------------------------------------------- + * set_raw_sha1 - set our SHA1 values + * -------------------------------------------------. * - * @param rawdata The rawdata. + * @param rawdata The rawdata. */ void chd_file::set_raw_sha1(sha1_t rawdata) @@ -540,15 +540,15 @@ void chd_file::set_raw_sha1(sha1_t rawdata) } /** - * @fn void chd_file::set_parent_sha1(sha1_t parent) + * @fn void chd_file::set_parent_sha1(sha1_t parent) * - * @brief ------------------------------------------------- - * set_parent_sha1 - set the parent SHA1 value - * -------------------------------------------------. + * @brief ------------------------------------------------- + * set_parent_sha1 - set the parent SHA1 value + * -------------------------------------------------. * - * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. * - * @param parent The parent. + * @param parent The parent. */ void chd_file::set_parent_sha1(sha1_t parent) @@ -567,19 +567,19 @@ void chd_file::set_parent_sha1(sha1_t parent) } /** - * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) + * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) * - * @brief ------------------------------------------------- - * create - create a new file with no parent using an existing opened file handle - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create - create a new file with no parent using an existing opened file handle + * -------------------------------------------------. * - * @param [in,out] file The file. - * @param logicalbytes The logicalbytes. - * @param hunkbytes The hunkbytes. - * @param unitbytes The unitbytes. - * @param compression The compression. + * @param [in,out] file The file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param unitbytes The unitbytes. + * @param compression The compression. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) @@ -602,19 +602,19 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte } /** - * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) + * @fn chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) * - * @brief ------------------------------------------------- - * create - create a new file with a parent using an existing opened file handle - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create - create a new file with a parent using an existing opened file handle + * -------------------------------------------------. * - * @param [in,out] file The file. - * @param logicalbytes The logicalbytes. - * @param hunkbytes The hunkbytes. - * @param compression The compression. - * @param [in,out] parent The parent. + * @param [in,out] file The file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param compression The compression. + * @param [in,out] parent The parent. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) @@ -637,19 +637,19 @@ chd_error chd_file::create(core_file &file, UINT64 logicalbytes, UINT32 hunkbyte } /** - * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) + * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) * - * @brief ------------------------------------------------- - * create - create a new file with no parent using a filename - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create - create a new file with no parent using a filename + * -------------------------------------------------. * - * @param filename Filename of the file. - * @param logicalbytes The logicalbytes. - * @param hunkbytes The hunkbytes. - * @param unitbytes The unitbytes. - * @param compression The compression. + * @param filename Filename of the file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param unitbytes The unitbytes. + * @param compression The compression. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 unitbytes, chd_codec_type compression[4]) @@ -678,19 +678,19 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun } /** - * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) + * @fn chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) * - * @brief ------------------------------------------------- - * create - create a new file with a parent using a filename - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create - create a new file with a parent using a filename + * -------------------------------------------------. * - * @param filename Filename of the file. - * @param logicalbytes The logicalbytes. - * @param hunkbytes The hunkbytes. - * @param compression The compression. - * @param [in,out] parent The parent. + * @param filename Filename of the file. + * @param logicalbytes The logicalbytes. + * @param hunkbytes The hunkbytes. + * @param compression The compression. + * @param [in,out] parent The parent. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, chd_codec_type compression[4], chd_file &parent) @@ -719,17 +719,17 @@ chd_error chd_file::create(const char *filename, UINT64 logicalbytes, UINT32 hun } /** - * @fn chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) + * @fn chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) * - * @brief ------------------------------------------------- - * open - open an existing file for read or read/write - * -------------------------------------------------. + * @brief ------------------------------------------------- + * open - open an existing file for read or read/write + * -------------------------------------------------. * - * @param filename Filename of the file. - * @param writeable true if writeable. - * @param [in,out] parent If non-null, the parent. + * @param filename Filename of the file. + * @param writeable true if writeable. + * @param [in,out] parent If non-null, the parent. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) @@ -759,17 +759,17 @@ chd_error chd_file::open(const char *filename, bool writeable, chd_file *parent) } /** - * @fn chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) + * @fn chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) * - * @brief ------------------------------------------------- - * open - open an existing file for read or read/write - * -------------------------------------------------. + * @brief ------------------------------------------------- + * open - open an existing file for read or read/write + * -------------------------------------------------. * - * @param [in,out] file The file. - * @param writeable true if writeable. - * @param [in,out] parent If non-null, the parent. + * @param [in,out] file The file. + * @param writeable true if writeable. + * @param [in,out] parent If non-null, the parent. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) @@ -786,11 +786,11 @@ chd_error chd_file::open(core_file &file, bool writeable, chd_file *parent) } /** - * @fn void chd_file::close() + * @fn void chd_file::close() * - * @brief ------------------------------------------------- - * close - close a CHD file for access - * -------------------------------------------------. + * @brief ------------------------------------------------- + * close - close a CHD file for access + * -------------------------------------------------. */ void chd_file::close() @@ -841,26 +841,26 @@ void chd_file::close() } /** - * @fn chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) - * - * @brief ------------------------------------------------- - * read - read a single hunk from the CHD file - * -------------------------------------------------. - * - * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. - * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error - * condition occurs. - * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error - * condition occurs. - * @exception CHDERR_REQUIRES_PARENT Thrown when a chderr requires parent error condition - * occurs. - * @exception CHDERR_READ_ERROR Thrown when a chderr read error error condition - * occurs. - * - * @param hunknum The hunknum. - * @param [in,out] buffer If non-null, the buffer. - * - * @return The hunk. + * @fn chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) + * + * @brief ------------------------------------------------- + * read - read a single hunk from the CHD file + * -------------------------------------------------. + * + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * @exception CHDERR_REQUIRES_PARENT Thrown when a chderr requires parent error condition + * occurs. + * @exception CHDERR_READ_ERROR Thrown when a chderr read error error condition + * occurs. + * + * @param hunknum The hunknum. + * @param [in,out] buffer If non-null, the buffer. + * + * @return The hunk. */ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) @@ -990,22 +990,22 @@ chd_error chd_file::read_hunk(UINT32 hunknum, void *buffer) } /** - * @fn chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) + * @fn chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) * - * @brief ------------------------------------------------- - * write - write a single hunk to the CHD file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * write - write a single hunk to the CHD file + * -------------------------------------------------. * - * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. - * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error - * condition occurs. - * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error - * condition occurs. + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. * - * @param hunknum The hunknum. - * @param buffer The buffer. + * @param hunknum The hunknum. + * @param buffer The buffer. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) @@ -1076,17 +1076,17 @@ chd_error chd_file::write_hunk(UINT32 hunknum, const void *buffer) } /** - * @fn chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) + * @fn chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) * - * @brief ------------------------------------------------- - * read_units - read the given number of units from the CHD - * -------------------------------------------------. + * @brief ------------------------------------------------- + * read_units - read the given number of units from the CHD + * -------------------------------------------------. * - * @param unitnum The unitnum. - * @param [in,out] buffer If non-null, the buffer. - * @param count Number of. + * @param unitnum The unitnum. + * @param [in,out] buffer If non-null, the buffer. + * @param count Number of. * - * @return The units. + * @return The units. */ chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) @@ -1095,17 +1095,17 @@ chd_error chd_file::read_units(UINT64 unitnum, void *buffer, UINT32 count) } /** - * @fn chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count) + * @fn chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count) * - * @brief ------------------------------------------------- - * write_units - write the given number of units to the CHD - * -------------------------------------------------. + * @brief ------------------------------------------------- + * write_units - write the given number of units to the CHD + * -------------------------------------------------. * - * @param unitnum The unitnum. - * @param buffer The buffer. - * @param count Number of. + * @param unitnum The unitnum. + * @param buffer The buffer. + * @param count Number of. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count) @@ -1114,18 +1114,18 @@ chd_error chd_file::write_units(UINT64 unitnum, const void *buffer, UINT32 count } /** - * @fn chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) + * @fn chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) * - * @brief ------------------------------------------------- - * read_bytes - read from the CHD at a byte level, using the cache to handle partial - * hunks - * -------------------------------------------------. + * @brief ------------------------------------------------- + * read_bytes - read from the CHD at a byte level, using the cache to handle partial + * hunks + * -------------------------------------------------. * - * @param offset The offset. - * @param [in,out] buffer If non-null, the buffer. - * @param bytes The bytes. + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param bytes The bytes. * - * @return The bytes. + * @return The bytes. */ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) @@ -1167,18 +1167,18 @@ chd_error chd_file::read_bytes(UINT64 offset, void *buffer, UINT32 bytes) } /** - * @fn chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) + * @fn chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) * - * @brief ------------------------------------------------- - * write_bytes - write to the CHD at a byte level, using the cache to handle partial - * hunks - * -------------------------------------------------. + * @brief ------------------------------------------------- + * write_bytes - write to the CHD at a byte level, using the cache to handle partial + * hunks + * -------------------------------------------------. * - * @param offset The offset. - * @param buffer The buffer. - * @param bytes The bytes. + * @param offset The offset. + * @param buffer The buffer. + * @param bytes The bytes. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) @@ -1221,20 +1221,20 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) } /** - * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) * - * @brief ------------------------------------------------- - * read_metadata - read the indexed metadata of the given type - * -------------------------------------------------. + * @brief ------------------------------------------------- + * read_metadata - read the indexed metadata of the given type + * -------------------------------------------------. * - * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error - * condition occurs. + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. * - * @param searchtag The searchtag. - * @param searchindex The searchindex. - * @param [in,out] output The output. + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. * - * @return The metadata. + * @return The metadata. */ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) @@ -1265,18 +1265,18 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } /** - * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output) + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output) * - * @brief Reads a metadata. + * @brief Reads a metadata. * - * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error - * condition occurs. + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. * - * @param searchtag The searchtag. - * @param searchindex The searchindex. - * @param [in,out] output The output. + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. * - * @return The metadata. + * @return The metadata. */ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output) @@ -1303,20 +1303,20 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } /** - * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen) + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen) * - * @brief Reads a metadata. + * @brief Reads a metadata. * - * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error - * condition occurs. + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. * - * @param searchtag The searchtag. - * @param searchindex The searchindex. - * @param [in,out] output If non-null, the output. - * @param outputlen The outputlen. - * @param [in,out] resultlen The resultlen. + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output If non-null, the output. + * @param outputlen The outputlen. + * @param [in,out] resultlen The resultlen. * - * @return The metadata. + * @return The metadata. */ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen) @@ -1343,20 +1343,20 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } /** - * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags) + * @fn chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags) * - * @brief Reads a metadata. + * @brief Reads a metadata. * - * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error - * condition occurs. + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. * - * @param searchtag The searchtag. - * @param searchindex The searchindex. - * @param [in,out] output The output. - * @param [in,out] resulttag The resulttag. - * @param [in,out] resultflags The resultflags. + * @param searchtag The searchtag. + * @param searchindex The searchindex. + * @param [in,out] output The output. + * @param [in,out] resulttag The resulttag. + * @param [in,out] resultflags The resultflags. * - * @return The metadata. + * @return The metadata. */ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags) @@ -1385,19 +1385,19 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex } /** - * @fn chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags) + * @fn chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags) * - * @brief ------------------------------------------------- - * write_metadata - write the indexed metadata of the given type - * -------------------------------------------------. + * @brief ------------------------------------------------- + * write_metadata - write the indexed metadata of the given type + * -------------------------------------------------. * - * @param metatag The metatag. - * @param metaindex The metaindex. - * @param inputbuf The inputbuf. - * @param inputlen The inputlen. - * @param flags The flags. + * @param metatag The metatag. + * @param metaindex The metaindex. + * @param inputbuf The inputbuf. + * @param inputlen The inputlen. + * @param flags The flags. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags) @@ -1467,19 +1467,19 @@ chd_error chd_file::write_metadata(chd_metadata_tag metatag, UINT32 metaindex, c } /** - * @fn chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) + * @fn chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) * - * @brief ------------------------------------------------- - * delete_metadata - remove the given metadata from the list - * -------------------------------------------------. + * @brief ------------------------------------------------- + * delete_metadata - remove the given metadata from the list + * -------------------------------------------------. * - * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error - * condition occurs. + * @exception CHDERR_METADATA_NOT_FOUND Thrown when a chderr metadata not found error + * condition occurs. * - * @param metatag The metatag. - * @param metaindex The metaindex. + * @param metatag The metatag. + * @param metaindex The metaindex. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) @@ -1505,17 +1505,17 @@ chd_error chd_file::delete_metadata(chd_metadata_tag metatag, UINT32 metaindex) } /** - * @fn chd_error chd_file::clone_all_metadata(chd_file &source) + * @fn chd_error chd_file::clone_all_metadata(chd_file &source) * - * @brief ------------------------------------------------- - * clone_all_metadata - clone the metadata from one CHD to a second - * -------------------------------------------------. + * @brief ------------------------------------------------- + * clone_all_metadata - clone the metadata from one CHD to a second + * -------------------------------------------------. * - * @exception err Thrown when an error error condition occurs. + * @exception err Thrown when an error error condition occurs. * - * @param [in,out] source Another instance to copy. + * @param [in,out] source Another instance to copy. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::clone_all_metadata(chd_file &source) @@ -1552,16 +1552,16 @@ chd_error chd_file::clone_all_metadata(chd_file &source) } /** - * @fn sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) + * @fn sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) * - * @brief ------------------------------------------------- - * compute_overall_sha1 - iterate through the metadata and compute the overall hash of - * the CHD file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * compute_overall_sha1 - iterate through the metadata and compute the overall hash of + * the CHD file + * -------------------------------------------------. * - * @param rawsha1 The first rawsha. + * @param rawsha1 The first rawsha. * - * @return The calculated overall sha 1. + * @return The calculated overall sha 1. */ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) @@ -1604,17 +1604,17 @@ sha1_t chd_file::compute_overall_sha1(sha1_t rawsha1) } /** - * @fn chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *config) + * @fn chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *config) * - * @brief ------------------------------------------------- - * codec_config - set internal codec parameters - * -------------------------------------------------. + * @brief ------------------------------------------------- + * codec_config - set internal codec parameters + * -------------------------------------------------. * - * @param codec The codec. - * @param param The parameter. - * @param [in,out] config If non-null, the configuration. + * @param codec The codec. + * @param param The parameter. + * @param [in,out] config If non-null, the configuration. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *config) @@ -1640,15 +1640,15 @@ chd_error chd_file::codec_configure(chd_codec_type codec, int param, void *confi } /** - * @fn const char *chd_file::error_string(chd_error err) + * @fn const char *chd_file::error_string(chd_error err) * - * @brief ------------------------------------------------- - * error_string - return an error string for the given CHD error - * -------------------------------------------------. + * @brief ------------------------------------------------- + * error_string - return an error string for the given CHD error + * -------------------------------------------------. * - * @param err The error. + * @param err The error. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *chd_file::error_string(chd_error err) @@ -1698,14 +1698,14 @@ const char *chd_file::error_string(chd_error err) //************************************************************************** /** - * @fn UINT32 chd_file::guess_unitbytes() + * @fn UINT32 chd_file::guess_unitbytes() * - * @brief ------------------------------------------------- - * guess_unitbytes - for older CHD formats, take a guess at the bytes/unit based on - * metadata - * -------------------------------------------------. + * @brief ------------------------------------------------- + * guess_unitbytes - for older CHD formats, take a guess at the bytes/unit based on + * metadata + * -------------------------------------------------. * - * @return An UINT32. + * @return An UINT32. */ UINT32 chd_file::guess_unitbytes() @@ -1729,19 +1729,19 @@ UINT32 chd_file::guess_unitbytes() } /** - * @fn void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) + * @fn void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) * - * @brief ------------------------------------------------- - * parse_v3_header - parse the header from a v3 file and configure core parameters - * -------------------------------------------------. + * @brief ------------------------------------------------- + * parse_v3_header - parse the header from a v3 file and configure core parameters + * -------------------------------------------------. * - * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition - * occurs. - * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error - * condition occurs. + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. * - * @param [in,out] rawheader If non-null, the rawheader. - * @param [in,out] parentsha1 The first parentsha. + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. */ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) @@ -1792,19 +1792,19 @@ void chd_file::parse_v3_header(UINT8 *rawheader, sha1_t &parentsha1) } /** - * @fn void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) + * @fn void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) * - * @brief ------------------------------------------------- - * parse_v4_header - parse the header from a v4 file and configure core parameters - * -------------------------------------------------. + * @brief ------------------------------------------------- + * parse_v4_header - parse the header from a v4 file and configure core parameters + * -------------------------------------------------. * - * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition - * occurs. - * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error - * condition occurs. + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. * - * @param [in,out] rawheader If non-null, the rawheader. - * @param [in,out] parentsha1 The first parentsha. + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. */ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) @@ -1855,16 +1855,16 @@ void chd_file::parse_v4_header(UINT8 *rawheader, sha1_t &parentsha1) } /** - * @fn void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) + * @fn void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) * - * @brief ------------------------------------------------- - * parse_v5_header - read the header from a v5 file and configure core parameters - * -------------------------------------------------. + * @brief ------------------------------------------------- + * parse_v5_header - read the header from a v5 file and configure core parameters + * -------------------------------------------------. * - * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition occurs. * - * @param [in,out] rawheader If non-null, the rawheader. - * @param [in,out] parentsha1 The first parentsha. + * @param [in,out] rawheader If non-null, the rawheader. + * @param [in,out] parentsha1 The first parentsha. */ void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) @@ -1905,16 +1905,16 @@ void chd_file::parse_v5_header(UINT8 *rawheader, sha1_t &parentsha1) } /** - * @fn chd_error chd_file::compress_v5_map() + * @fn chd_error chd_file::compress_v5_map() * - * @brief ------------------------------------------------- - * compress_v5_map - compress the v5 map and write it to the end of the file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * compress_v5_map - compress the v5 map and write it to the end of the file + * -------------------------------------------------. * - * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error - * condition occurs. + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file::compress_v5_map() @@ -2119,14 +2119,14 @@ chd_error chd_file::compress_v5_map() } /** - * @fn void chd_file::decompress_v5_map() + * @fn void chd_file::decompress_v5_map() * - * @brief ------------------------------------------------- - * decompress_v5_map - decompress the v5 map - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decompress_v5_map - decompress the v5 map + * -------------------------------------------------. * - * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error - * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. */ void chd_file::decompress_v5_map() @@ -2243,20 +2243,20 @@ void chd_file::decompress_v5_map() } /** - * @fn chd_error chd_file::create_common() + * @fn chd_error chd_file::create_common() * - * @brief ------------------------------------------------- - * create_common - command path when creating a new CHD file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create_common - command path when creating a new CHD file + * -------------------------------------------------. * - * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error - * condition occurs. - * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error - * condition occurs. - * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error - * condition occurs. + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. * - * @return The new common. + * @return The new common. */ chd_error chd_file::create_common() @@ -2353,26 +2353,26 @@ chd_error chd_file::create_common() } /** - * @fn chd_error chd_file::open_common(bool writeable) - * - * @brief ------------------------------------------------- - * open_common - common path when opening an existing CHD file for input - * -------------------------------------------------. - * - * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition - * occurs. - * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error - * condition occurs. - * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error - * condition occurs. - * @exception CHDERR_INVALID_PARENT Thrown when a chderr invalid parent error condition - * occurs. - * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error - * condition occurs. - * - * @param writeable true if writeable. - * - * @return A chd_error. + * @fn chd_error chd_file::open_common(bool writeable) + * + * @brief ------------------------------------------------- + * open_common - common path when opening an existing CHD file for input + * -------------------------------------------------. + * + * @exception CHDERR_INVALID_FILE Thrown when a chderr invalid file error condition + * occurs. + * @exception CHDERR_UNSUPPORTED_VERSION Thrown when a chderr unsupported version error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. + * @exception CHDERR_INVALID_PARENT Thrown when a chderr invalid parent error condition + * occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. + * + * @param writeable true if writeable. + * + * @return A chd_error. */ chd_error chd_file::open_common(bool writeable) @@ -2434,14 +2434,14 @@ chd_error chd_file::open_common(bool writeable) } /** - * @fn void chd_file::create_open_common() + * @fn void chd_file::create_open_common() * - * @brief ------------------------------------------------- - * create_open_common - common code for handling creation and opening of a file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * create_open_common - common code for handling creation and opening of a file + * -------------------------------------------------. * - * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error - * condition occurs. + * @exception CHDERR_UNKNOWN_COMPRESSION Thrown when a chderr unknown compression error + * condition occurs. */ void chd_file::create_open_common() @@ -2467,22 +2467,22 @@ void chd_file::create_open_common() } /** - * @fn void chd_file::verify_proper_compression_append(UINT32 hunknum) - * - * @brief ------------------------------------------------- - * verify_proper_compression_append - verify that the given hunk is a proper candidate - * for appending to a compressed CHD - * -------------------------------------------------. - * - * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. - * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error - * condition occurs. - * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error - * condition occurs. - * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error - * condition occurs. - * - * @param hunknum The hunknum. + * @fn void chd_file::verify_proper_compression_append(UINT32 hunknum) + * + * @brief ------------------------------------------------- + * verify_proper_compression_append - verify that the given hunk is a proper candidate + * for appending to a compressed CHD + * -------------------------------------------------. + * + * @exception CHDERR_NOT_OPEN Thrown when a chderr not open error condition occurs. + * @exception CHDERR_HUNK_OUT_OF_RANGE Thrown when a chderr hunk out of range error + * condition occurs. + * @exception CHDERR_FILE_NOT_WRITEABLE Thrown when a chderr file not writeable error + * condition occurs. + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. + * + * @param hunknum The hunknum. */ void chd_file::verify_proper_compression_append(UINT32 hunknum) @@ -2515,18 +2515,18 @@ void chd_file::verify_proper_compression_append(UINT32 hunknum) } /** - * @fn void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16) - * - * @brief ------------------------------------------------- - * hunk_write_compressed - write a hunk to a compressed CHD, discovering the best - * technique - * -------------------------------------------------. - * - * @param hunknum The hunknum. - * @param compression The compression. - * @param compressed The compressed. - * @param complength The complength. - * @param crc16 The CRC 16. + * @fn void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16) + * + * @brief ------------------------------------------------- + * hunk_write_compressed - write a hunk to a compressed CHD, discovering the best + * technique + * -------------------------------------------------. + * + * @param hunknum The hunknum. + * @param compression The compression. + * @param compressed The compressed. + * @param complength The complength. + * @param crc16 The CRC 16. */ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UINT8 *compressed, UINT32 complength, crc16_t crc16) @@ -2546,17 +2546,17 @@ void chd_file::hunk_write_compressed(UINT32 hunknum, INT8 compression, const UIN } /** - * @fn void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) + * @fn void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) * - * @brief ------------------------------------------------- - * hunk_copy_from_self - mark a hunk as being a copy of another hunk in the same CHD - * -------------------------------------------------. + * @brief ------------------------------------------------- + * hunk_copy_from_self - mark a hunk as being a copy of another hunk in the same CHD + * -------------------------------------------------. * - * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error - * condition occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. * - * @param hunknum The hunknum. - * @param otherhunk The otherhunk. + * @param hunknum The hunknum. + * @param otherhunk The otherhunk. */ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) @@ -2577,14 +2577,14 @@ void chd_file::hunk_copy_from_self(UINT32 hunknum, UINT32 otherhunk) } /** - * @fn void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) + * @fn void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) * - * @brief ------------------------------------------------- - * hunk_copy_from_parent - mark a hunk as being a copy of a hunk from a parent CHD - * -------------------------------------------------. + * @brief ------------------------------------------------- + * hunk_copy_from_parent - mark a hunk as being a copy of a hunk from a parent CHD + * -------------------------------------------------. * - * @param hunknum The hunknum. - * @param parentunit The parentunit. + * @param hunknum The hunknum. + * @param parentunit The parentunit. */ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) @@ -2601,18 +2601,18 @@ void chd_file::hunk_copy_from_parent(UINT32 hunknum, UINT64 parentunit) } /** - * @fn bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume) + * @fn bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume) * - * @brief ------------------------------------------------- - * metadata_find - find a metadata entry - * -------------------------------------------------. + * @brief ------------------------------------------------- + * metadata_find - find a metadata entry + * -------------------------------------------------. * - * @param metatag The metatag. - * @param metaindex The metaindex. - * @param [in,out] metaentry The metaentry. - * @param resume true to resume. + * @param metatag The metatag. + * @param metaindex The metaindex. + * @param [in,out] metaentry The metaentry. + * @param resume true to resume. * - * @return true if it succeeds, false if it fails. + * @return true if it succeeds, false if it fails. */ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata_entry &metaentry, bool resume) @@ -2657,14 +2657,14 @@ bool chd_file::metadata_find(chd_metadata_tag metatag, INT32 metaindex, metadata } /** - * @fn void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) + * @fn void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) * - * @brief ------------------------------------------------- - * metadata_set_previous_next - set the 'next' offset of a piece of metadata - * -------------------------------------------------. + * @brief ------------------------------------------------- + * metadata_set_previous_next - set the 'next' offset of a piece of metadata + * -------------------------------------------------. * - * @param prevoffset The prevoffset. - * @param nextoffset The nextoffset. + * @param prevoffset The prevoffset. + * @param nextoffset The nextoffset. */ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) @@ -2691,11 +2691,11 @@ void chd_file::metadata_set_previous_next(UINT64 prevoffset, UINT64 nextoffset) } /** - * @fn void chd_file::metadata_update_hash() + * @fn void chd_file::metadata_update_hash() * - * @brief ------------------------------------------------- - * metadata_update_hash - compute the SHA1 hash of all metadata that requests it - * -------------------------------------------------. + * @brief ------------------------------------------------- + * metadata_update_hash - compute the SHA1 hash of all metadata that requests it + * -------------------------------------------------. */ void chd_file::metadata_update_hash() @@ -2716,16 +2716,16 @@ void chd_file::metadata_update_hash() } /** - * @fn int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *elem2) + * @fn int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *elem2) * - * @brief ------------------------------------------------- - * metadata_hash_compare - compare two hash entries - * -------------------------------------------------. + * @brief ------------------------------------------------- + * metadata_hash_compare - compare two hash entries + * -------------------------------------------------. * - * @param elem1 The first element. - * @param elem2 The second element. + * @param elem1 The first element. + * @param elem2 The second element. * - * @return A CLIB_DECL. + * @return A CLIB_DECL. */ int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *elem2) @@ -2740,11 +2740,11 @@ int CLIB_DECL chd_file::metadata_hash_compare(const void *elem1, const void *ele //************************************************************************** /** - * @fn chd_file_compressor::chd_file_compressor() + * @fn chd_file_compressor::chd_file_compressor() * - * @brief ------------------------------------------------- - * chd_file_compressor - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * chd_file_compressor - constructor + * -------------------------------------------------. */ chd_file_compressor::chd_file_compressor() @@ -2767,11 +2767,11 @@ chd_file_compressor::chd_file_compressor() } /** - * @fn chd_file_compressor::~chd_file_compressor() + * @fn chd_file_compressor::~chd_file_compressor() * - * @brief ------------------------------------------------- - * ~chd_file_compressor - destructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ~chd_file_compressor - destructor + * -------------------------------------------------. */ chd_file_compressor::~chd_file_compressor() @@ -2786,11 +2786,11 @@ chd_file_compressor::~chd_file_compressor() } /** - * @fn void chd_file_compressor::compress_begin() + * @fn void chd_file_compressor::compress_begin() * - * @brief ------------------------------------------------- - * compress_begin - initiate compression - * -------------------------------------------------. + * @brief ------------------------------------------------- + * compress_begin - initiate compression + * -------------------------------------------------. */ void chd_file_compressor::compress_begin() @@ -2835,16 +2835,16 @@ void chd_file_compressor::compress_begin() } /** - * @fn chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) + * @fn chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) * - * @brief ------------------------------------------------- - * compress_continue - continue compression - * -------------------------------------------------. + * @brief ------------------------------------------------- + * compress_continue - continue compression + * -------------------------------------------------. * - * @param [in,out] progress The progress. - * @param [in,out] ratio The ratio. + * @param [in,out] progress The progress. + * @param [in,out] ratio The ratio. * - * @return A chd_error. + * @return A chd_error. */ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) @@ -2989,16 +2989,16 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio } /** - * @fn void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) + * @fn void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) * - * @brief ------------------------------------------------- - * async_walk_parent - handle asynchronous parent walking operations - * -------------------------------------------------. + * @brief ------------------------------------------------- + * async_walk_parent - handle asynchronous parent walking operations + * -------------------------------------------------. * - * @param [in,out] param If non-null, the parameter. - * @param threadid The threadid. + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. * - * @return null if it fails, else a void*. + * @return null if it fails, else a void*. */ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) @@ -3009,11 +3009,11 @@ void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) } /** - * @fn void chd_file_compressor::async_walk_parent(work_item &item) + * @fn void chd_file_compressor::async_walk_parent(work_item &item) * - * @brief Asynchronous walk parent. + * @brief Asynchronous walk parent. * - * @param [in,out] item The item. + * @param [in,out] item The item. */ void chd_file_compressor::async_walk_parent(work_item &item) @@ -3031,16 +3031,16 @@ void chd_file_compressor::async_walk_parent(work_item &item) } /** - * @fn void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) + * @fn void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) * - * @brief ------------------------------------------------- - * async_compress_hunk - handle asynchronous hunk compression - * -------------------------------------------------. + * @brief ------------------------------------------------- + * async_compress_hunk - handle asynchronous hunk compression + * -------------------------------------------------. * - * @param [in,out] param If non-null, the parameter. - * @param threadid The threadid. + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. * - * @return null if it fails, else a void*. + * @return null if it fails, else a void*. */ void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) @@ -3051,12 +3051,12 @@ void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) } /** - * @fn void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) + * @fn void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) * - * @brief Asynchronous compress hunk. + * @brief Asynchronous compress hunk. * - * @param [in,out] item The item. - * @param threadid The threadid. + * @param [in,out] item The item. + * @param threadid The threadid. */ void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) @@ -3081,16 +3081,16 @@ void chd_file_compressor::async_compress_hunk(work_item &item, int threadid) } /** - * @fn void *chd_file_compressor::async_read_static(void *param, int threadid) + * @fn void *chd_file_compressor::async_read_static(void *param, int threadid) * - * @brief ------------------------------------------------- - * async_read - handle asynchronous source file reading - * -------------------------------------------------. + * @brief ------------------------------------------------- + * async_read - handle asynchronous source file reading + * -------------------------------------------------. * - * @param [in,out] param If non-null, the parameter. - * @param threadid The threadid. + * @param [in,out] param If non-null, the parameter. + * @param threadid The threadid. * - * @return null if it fails, else a void*. + * @return null if it fails, else a void*. */ void *chd_file_compressor::async_read_static(void *param, int threadid) @@ -3100,9 +3100,9 @@ void *chd_file_compressor::async_read_static(void *param, int threadid) } /** - * @fn void chd_file_compressor::async_read() + * @fn void chd_file_compressor::async_read() * - * @brief Asynchronous read. + * @brief Asynchronous read. */ void chd_file_compressor::async_read() @@ -3181,11 +3181,11 @@ void chd_file_compressor::async_read() //************************************************************************** /** - * @fn chd_file_compressor::hashmap::hashmap() + * @fn chd_file_compressor::hashmap::hashmap() * - * @brief ------------------------------------------------- - * hashmap - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * hashmap - constructor + * -------------------------------------------------. */ chd_file_compressor::hashmap::hashmap() @@ -3196,11 +3196,11 @@ chd_file_compressor::hashmap::hashmap() } /** - * @fn chd_file_compressor::hashmap::~hashmap() + * @fn chd_file_compressor::hashmap::~hashmap() * - * @brief ------------------------------------------------- - * ~hashmap - destructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ~hashmap - destructor + * -------------------------------------------------. */ chd_file_compressor::hashmap::~hashmap() @@ -3210,11 +3210,11 @@ chd_file_compressor::hashmap::~hashmap() } /** - * @fn void chd_file_compressor::hashmap::reset() + * @fn void chd_file_compressor::hashmap::reset() * - * @brief ------------------------------------------------- - * reset - reset the state of the map - * -------------------------------------------------. + * @brief ------------------------------------------------- + * reset - reset the state of the map + * -------------------------------------------------. */ void chd_file_compressor::hashmap::reset() @@ -3233,16 +3233,16 @@ void chd_file_compressor::hashmap::reset() } /** - * @fn UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) + * @fn UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) * - * @brief ------------------------------------------------- - * find - find an item in the CRC map - * -------------------------------------------------. + * @brief ------------------------------------------------- + * find - find an item in the CRC map + * -------------------------------------------------. * - * @param crc16 The CRC 16. - * @param sha1 The first sha. + * @param crc16 The CRC 16. + * @param sha1 The first sha. * - * @return An UINT64. + * @return An UINT64. */ UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) @@ -3255,15 +3255,15 @@ UINT64 chd_file_compressor::hashmap::find(crc16_t crc16, sha1_t sha1) } /** - * @fn void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1) + * @fn void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1) * - * @brief ------------------------------------------------- - * add - add an item to the CRC map - * -------------------------------------------------. + * @brief ------------------------------------------------- + * add - add an item to the CRC map + * -------------------------------------------------. * - * @param itemnum The itemnum. - * @param crc16 The CRC 16. - * @param sha1 The first sha. + * @param itemnum The itemnum. + * @param crc16 The CRC 16. + * @param sha1 The first sha. */ void chd_file_compressor::hashmap::add(UINT64 itemnum, crc16_t crc16, sha1_t sha1) diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c index d55b83f5a82..e267c613d1d 100644 --- a/src/lib/util/chdcd.c +++ b/src/lib/util/chdcd.c @@ -22,15 +22,15 @@ ***************************************************************************/ /** - * @def TOKENIZE(); + * @def TOKENIZE(); * - * @brief A macro that defines tokenize. + * @brief A macro that defines tokenize. * - * @param linebuffer The linebuffer. - * @param i Zero-based index of the. - * @param sizeof(linebuffer) The sizeof(linebuffer) - * @param token The token. - * @param sizeof(token) The sizeof(token) + * @param linebuffer The linebuffer. + * @param i Zero-based index of the. + * @param sizeof(linebuffer) The sizeof(linebuffer) + * @param token The token. + * @param sizeof(token) The sizeof(token) */ #define TOKENIZE i = tokenize( linebuffer, i, sizeof(linebuffer), token, sizeof(token) ); @@ -41,7 +41,7 @@ GLOBAL VARIABLES ***************************************************************************/ -/** @brief The linebuffer[ 512]. */ +/** @brief The linebuffer[ 512]. */ static char linebuffer[512]; @@ -51,13 +51,13 @@ static char linebuffer[512]; ***************************************************************************/ /** - * @fn static std::string get_file_path(std::string &path) + * @fn static std::string get_file_path(std::string &path) * - * @brief Gets file path. + * @brief Gets file path. * - * @param [in,out] path Full pathname of the file. + * @param [in,out] path Full pathname of the file. * - * @return The file path. + * @return The file path. */ static std::string get_file_path(std::string &path) @@ -76,13 +76,13 @@ static std::string get_file_path(std::string &path) -------------------------------------------------*/ /** - * @fn static UINT64 get_file_size(const char *filename) + * @fn static UINT64 get_file_size(const char *filename) * - * @brief Gets file size. + * @brief Gets file size. * - * @param filename Filename of the file. + * @param filename Filename of the file. * - * @return The file size. + * @return The file size. */ static UINT64 get_file_size(const char *filename) @@ -104,17 +104,17 @@ static UINT64 get_file_size(const char *filename) -------------------------------------------------*/ /** - * @fn static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) + * @fn static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) * - * @brief Tokenizes. + * @brief Tokenizes. * - * @param linebuffer The linebuffer. - * @param i Zero-based index of the. - * @param linebuffersize The linebuffersize. - * @param [in,out] token If non-null, the token. - * @param tokensize The tokensize. + * @param linebuffer The linebuffer. + * @param i Zero-based index of the. + * @param linebuffersize The linebuffersize. + * @param [in,out] token If non-null, the token. + * @param tokensize The tokensize. * - * @return An int. + * @return An int. */ static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) @@ -162,13 +162,13 @@ static int tokenize( const char *linebuffer, int i, int linebuffersize, char *to -------------------------------------------------*/ /** - * @fn static int msf_to_frames( char *token ) + * @fn static int msf_to_frames( char *token ) * - * @brief Msf to frames. + * @brief Msf to frames. * - * @param [in,out] token If non-null, the token. + * @param [in,out] token If non-null, the token. * - * @return An int. + * @return An int. */ static int msf_to_frames( char *token ) @@ -199,14 +199,14 @@ static int msf_to_frames( char *token ) -------------------------------------------------*/ /** - * @fn static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) + * @fn static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) * - * @brief Parse WAV sample. + * @brief Parse WAV sample. * - * @param filename Filename of the file. - * @param [in,out] dataoffs If non-null, the dataoffs. + * @param filename Filename of the file. + * @param [in,out] dataoffs If non-null, the dataoffs. * - * @return An UINT32. + * @return An UINT32. */ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) @@ -378,13 +378,13 @@ static UINT32 parse_wav_sample(const char *filename, UINT32 *dataoffs) } /** - * @fn UINT16 read_uint16(FILE *infile) + * @fn UINT16 read_uint16(FILE *infile) * - * @brief Reads uint 16. + * @brief Reads uint 16. * - * @param [in,out] infile If non-null, the infile. + * @param [in,out] infile If non-null, the infile. * - * @return The uint 16. + * @return The uint 16. */ UINT16 read_uint16(FILE *infile) @@ -400,13 +400,13 @@ UINT16 read_uint16(FILE *infile) } /** - * @fn UINT32 read_uint32(FILE *infile) + * @fn UINT32 read_uint32(FILE *infile) * - * @brief Reads uint 32. + * @brief Reads uint 32. * - * @param [in,out] infile If non-null, the infile. + * @param [in,out] infile If non-null, the infile. * - * @return The uint 32. + * @return The uint 32. */ UINT32 read_uint32(FILE *infile) @@ -422,13 +422,13 @@ UINT32 read_uint32(FILE *infile) } /** - * @fn UINT64 read_uint64(FILE *infile) + * @fn UINT64 read_uint64(FILE *infile) * - * @brief Reads uint 64. + * @brief Reads uint 64. * - * @param [in,out] infile If non-null, the infile. + * @param [in,out] infile If non-null, the infile. * - * @return The uint 64. + * @return The uint 64. */ UINT64 read_uint64(FILE *infile) @@ -452,15 +452,15 @@ UINT64 read_uint64(FILE *infile) -------------------------------------------------*/ /** - * @fn chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * @fn chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) * - * @brief Chdcd parse nero. + * @brief Chdcd parse nero. * - * @param tocfname The tocfname. - * @param [in,out] outtoc The outtoc. - * @param [in,out] outinfo The outinfo. + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. * - * @return A chd_error. + * @return A chd_error. */ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) @@ -638,15 +638,15 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_ -------------------------------------------------*/ /** - * @fn chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * @fn chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) * - * @brief Chdcd parse ISO. + * @brief Chdcd parse ISO. * - * @param tocfname The tocfname. - * @param [in,out] outtoc The outtoc. - * @param [in,out] outinfo The outinfo. + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. * - * @return A chd_error. + * @return A chd_error. */ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) @@ -715,15 +715,15 @@ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i -------------------------------------------------*/ /** - * @fn static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * @fn static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) * - * @brief Chdcd parse GDI. + * @brief Chdcd parse GDI. * - * @param tocfname The tocfname. - * @param [in,out] outtoc The outtoc. - * @param [in,out] outinfo The outinfo. + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. * - * @return A chd_error. + * @return A chd_error. */ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) @@ -847,15 +847,15 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ -------------------------------------------------*/ /** - * @fn chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * @fn chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) * - * @brief Chdcd parse cue. + * @brief Chdcd parse cue. * - * @param tocfname The tocfname. - * @param [in,out] outtoc The outtoc. - * @param [in,out] outinfo The outinfo. + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. * - * @return A chd_error. + * @return A chd_error. */ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) @@ -1142,15 +1142,15 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i -------------------------------------------------*/ /** - * @fn chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) + * @fn chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) * - * @brief Chdcd parse TOC. + * @brief Chdcd parse TOC. * - * @param tocfname The tocfname. - * @param [in,out] outtoc The outtoc. - * @param [in,out] outinfo The outinfo. + * @param tocfname The tocfname. + * @param [in,out] outtoc The outtoc. + * @param [in,out] outinfo The outinfo. * - * @return A chd_error. + * @return A chd_error. */ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c index 753ce852dd3..9f013609133 100644 --- a/src/lib/util/chdcodec.c +++ b/src/lib/util/chdcodec.c @@ -1454,15 +1454,15 @@ UINT32 chd_cd_flac_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 * } /** - * @fn UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) + * @fn UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) * - * @brief ------------------------------------------------- - * blocksize - return the optimal block size - * -------------------------------------------------. + * @brief ------------------------------------------------- + * blocksize - return the optimal block size + * -------------------------------------------------. * - * @param bytes The bytes. + * @param bytes The bytes. * - * @return An UINT32. + * @return An UINT32. */ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) @@ -1481,17 +1481,17 @@ UINT32 chd_cd_flac_compressor::blocksize(UINT32 bytes) //************************************************************************** /** - * @fn chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * @fn chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) * - * @brief ------------------------------------------------- - * chd_cd_flac_decompressor - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * chd_cd_flac_decompressor - constructor + * -------------------------------------------------. * - * @exception CHDERR_CODEC_ERROR Thrown when a chderr codec error error condition occurs. + * @exception CHDERR_CODEC_ERROR Thrown when a chderr codec error error condition occurs. * - * @param [in,out] chd The chd. - * @param hunkbytes The hunkbytes. - * @param lossy true to lossy. + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. */ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) @@ -1521,11 +1521,11 @@ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, UINT32 hunkbyt } /** - * @fn chd_cd_flac_decompressor::~chd_cd_flac_decompressor() + * @fn chd_cd_flac_decompressor::~chd_cd_flac_decompressor() * - * @brief ------------------------------------------------- - * ~chd_cd_flac_decompressor - destructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * ~chd_cd_flac_decompressor - destructor + * -------------------------------------------------. */ chd_cd_flac_decompressor::~chd_cd_flac_decompressor() @@ -1534,19 +1534,19 @@ chd_cd_flac_decompressor::~chd_cd_flac_decompressor() } /** - * @fn void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) + * @fn void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) * - * @brief ------------------------------------------------- - * decompress - decompress data using the FLAC codec - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decompress - decompress data using the FLAC codec + * -------------------------------------------------. * - * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error - * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. * - * @param src Source for the. - * @param complen The complen. - * @param [in,out] dest If non-null, destination for the. - * @param destlen The destlen. + * @param src Source for the. + * @param complen The complen. + * @param [in,out] dest If non-null, destination for the. + * @param destlen The destlen. */ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) @@ -1593,15 +1593,15 @@ void chd_cd_flac_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT //************************************************************************** /** - * @fn chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * @fn chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) * - * @brief ------------------------------------------------- - * chd_avhuff_compressor - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * chd_avhuff_compressor - constructor + * -------------------------------------------------. * - * @param [in,out] chd The chd. - * @param hunkbytes The hunkbytes. - * @param lossy true to lossy. + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. */ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bool lossy) @@ -1620,22 +1620,22 @@ chd_avhuff_compressor::chd_avhuff_compressor(chd_file &chd, UINT32 hunkbytes, bo } /** - * @fn UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) + * @fn UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) * - * @brief ------------------------------------------------- - * compress - compress data using the A/V codec - * -------------------------------------------------. + * @brief ------------------------------------------------- + * compress - compress data using the A/V codec + * -------------------------------------------------. * - * @exception CHDERR_INVALID_DATA Thrown when a chderr invalid data error condition - * occurs. - * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error - * condition occurs. + * @exception CHDERR_INVALID_DATA Thrown when a chderr invalid data error condition + * occurs. + * @exception CHDERR_COMPRESSION_ERROR Thrown when a chderr compression error error + * condition occurs. * - * @param src Source for the. - * @param srclen The srclen. - * @param [in,out] dest If non-null, destination for the. + * @param src Source for the. + * @param srclen The srclen. + * @param [in,out] dest If non-null, destination for the. * - * @return An UINT32. + * @return An UINT32. */ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *dest) @@ -1662,16 +1662,16 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d } /** - * @fn void chd_avhuff_compressor::postinit() + * @fn void chd_avhuff_compressor::postinit() * - * @brief ------------------------------------------------- - * postinit - actual initialization of avhuff happens here, on the first attempt to - * compress or decompress data - * -------------------------------------------------. + * @brief ------------------------------------------------- + * postinit - actual initialization of avhuff happens here, on the first attempt to + * compress or decompress data + * -------------------------------------------------. * - * @exception err Thrown when an error error condition occurs. - * @exception CHDERR_INVALID_METADATA Thrown when a chderr invalid metadata error condition - * occurs. + * @exception err Thrown when an error error condition occurs. + * @exception CHDERR_INVALID_METADATA Thrown when a chderr invalid metadata error condition + * occurs. */ void chd_avhuff_compressor::postinit() @@ -1705,15 +1705,15 @@ void chd_avhuff_compressor::postinit() //************************************************************************** /** - * @fn chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) + * @fn chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) * - * @brief ------------------------------------------------- - * chd_avhuff_decompressor - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * chd_avhuff_decompressor - constructor + * -------------------------------------------------. * - * @param [in,out] chd The chd. - * @param hunkbytes The hunkbytes. - * @param lossy true to lossy. + * @param [in,out] chd The chd. + * @param hunkbytes The hunkbytes. + * @param lossy true to lossy. */ chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes, bool lossy) @@ -1722,19 +1722,19 @@ chd_avhuff_decompressor::chd_avhuff_decompressor(chd_file &chd, UINT32 hunkbytes } /** - * @fn void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) + * @fn void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) * - * @brief ------------------------------------------------- - * decompress - decompress data using the A/V codec - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decompress - decompress data using the A/V codec + * -------------------------------------------------. * - * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error - * condition occurs. + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. * - * @param src Source for the. - * @param complen The complen. - * @param [in,out] dest If non-null, destination for the. - * @param destlen The destlen. + * @param src Source for the. + * @param complen The complen. + * @param [in,out] dest If non-null, destination for the. + * @param destlen The destlen. */ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 *dest, UINT32 destlen) @@ -1754,17 +1754,17 @@ void chd_avhuff_decompressor::decompress(const UINT8 *src, UINT32 complen, UINT8 } /** - * @fn void chd_avhuff_decompressor::configure(int param, void *config) + * @fn void chd_avhuff_decompressor::configure(int param, void *config) * - * @brief ------------------------------------------------- - * config - codec-specific configuration for the A/V codec - * -------------------------------------------------. + * @brief ------------------------------------------------- + * config - codec-specific configuration for the A/V codec + * -------------------------------------------------. * - * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error - * condition occurs. + * @exception CHDERR_INVALID_PARAMETER Thrown when a chderr invalid parameter error + * condition occurs. * - * @param param The parameter. - * @param [in,out] config If non-null, the configuration. + * @param param The parameter. + * @param [in,out] config If non-null, the configuration. */ void chd_avhuff_decompressor::configure(int param, void *config) diff --git a/src/lib/util/corealloc.c b/src/lib/util/corealloc.c index 40d7456546a..a635803e463 100644 --- a/src/lib/util/corealloc.c +++ b/src/lib/util/corealloc.c @@ -395,13 +395,13 @@ void memory_entry::release(memory_entry *entry, const char *file, int line) } /** - * @fn void memory_entry::report_unfreed(UINT64 start) + * @fn void memory_entry::report_unfreed(UINT64 start) * - * @brief ------------------------------------------------- - * report_unfreed - print a list of unfreed memory to the target file - * -------------------------------------------------. + * @brief ------------------------------------------------- + * report_unfreed - print a list of unfreed memory to the target file + * -------------------------------------------------. * - * @param start The start. + * @param start The start. */ void memory_entry::report_unfreed(UINT64 start) diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c index 30639615a58..797805ac768 100644 --- a/src/lib/util/corefile.c +++ b/src/lib/util/corefile.c @@ -1029,17 +1029,17 @@ static file_error osd_or_zlib_read(core_file *file, void *buffer, UINT64 offset, -------------------------------------------------*/ /** - * @fn static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual) + * @fn static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual) * - * @brief OSD or zlib write. + * @brief OSD or zlib write. * - * @param [in,out] file If non-null, the file. - * @param buffer The buffer. - * @param offset The offset. - * @param length The length. - * @param [in,out] actual If non-null, the actual. + * @param [in,out] file If non-null, the file. + * @param buffer The buffer. + * @param offset The offset. + * @param length The length. + * @param [in,out] actual If non-null, the actual. * - * @return A file_error. + * @return A file_error. */ static file_error osd_or_zlib_write(core_file *file, const void *buffer, UINT64 offset, UINT32 length, UINT32 *actual) diff --git a/src/lib/util/corestr.c b/src/lib/util/corestr.c index eb6f76ac4b4..b4a75a3bc48 100644 --- a/src/lib/util/corestr.c +++ b/src/lib/util/corestr.c @@ -295,13 +295,13 @@ std::string strmakeupper(std::string& str) } /** - * @fn std::string strmakelower(std::string& str) + * @fn std::string strmakelower(std::string& str) * - * @brief Strmakelowers the given string. + * @brief Strmakelowers the given string. * - * @param [in,out] str The string. + * @param [in,out] str The string. * - * @return A std::string. + * @return A std::string. */ std::string strmakelower(std::string& str) @@ -311,15 +311,15 @@ std::string strmakelower(std::string& str) } /** - * @fn int strreplace(std::string &str, const std::string& search, const std::string& replace) + * @fn int strreplace(std::string &str, const std::string& search, const std::string& replace) * - * @brief Strreplaces. + * @brief Strreplaces. * - * @param [in,out] str The string. - * @param search The search. - * @param replace The replace. + * @param [in,out] str The string. + * @param search The search. + * @param replace The replace. * - * @return An int. + * @return An int. */ int strreplace(std::string &str, const std::string& search, const std::string& replace) diff --git a/src/lib/util/coreutil.c b/src/lib/util/coreutil.c index 2a2a27d712e..a7c2ccb0f22 100644 --- a/src/lib/util/coreutil.c +++ b/src/lib/util/coreutil.c @@ -69,14 +69,14 @@ int gregorian_is_leap_year(int year) /* months are one counted */ /** - * @fn int gregorian_days_in_month(int month, int year) + * @fn int gregorian_days_in_month(int month, int year) * - * @brief Gregorian days in month. + * @brief Gregorian days in month. * - * @param month The month. - * @param year The year. + * @param month The month. + * @param year The year. * - * @return An int. + * @return An int. */ int gregorian_days_in_month(int month, int year) @@ -95,12 +95,12 @@ int gregorian_days_in_month(int month, int year) ***************************************************************************/ /** - * @fn void rand_memory(void *memory, size_t length) + * @fn void rand_memory(void *memory, size_t length) * - * @brief Random memory. + * @brief Random memory. * - * @param [in,out] memory If non-null, the memory. - * @param length The length. + * @param [in,out] memory If non-null, the memory. + * @param length The length. */ void rand_memory(void *memory, size_t length) diff --git a/src/lib/util/cstrpool.c b/src/lib/util/cstrpool.c index 36c5ff694bb..dfb41e25232 100644 --- a/src/lib/util/cstrpool.c +++ b/src/lib/util/cstrpool.c @@ -71,11 +71,11 @@ bool const_string_pool::contains(const char *string) } /** - * @fn const_string_pool::pool_chunk::pool_chunk() + * @fn const_string_pool::pool_chunk::pool_chunk() * - * @brief ------------------------------------------------- - * pool_chunk - constructor - * -------------------------------------------------. + * @brief ------------------------------------------------- + * pool_chunk - constructor + * -------------------------------------------------. */ const_string_pool::pool_chunk::pool_chunk() @@ -85,15 +85,15 @@ const_string_pool::pool_chunk::pool_chunk() } /** - * @fn const char *const_string_pool::pool_chunk::add(const char *string) + * @fn const char *const_string_pool::pool_chunk::add(const char *string) * - * @brief ------------------------------------------------- - * add - add a string to this pool - * -------------------------------------------------. + * @brief ------------------------------------------------- + * add - add a string to this pool + * -------------------------------------------------. * - * @param string The string to add. + * @param string The string to add. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *const_string_pool::pool_chunk::add(const char *string) diff --git a/src/lib/util/delegate.c b/src/lib/util/delegate.c index 5abf04b3a32..2245cf14bcb 100644 --- a/src/lib/util/delegate.c +++ b/src/lib/util/delegate.c @@ -33,16 +33,16 @@ delegate_mfp::raw_mfp_data delegate_mfp::s_null_mfp = { 0 }; #if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL) /** - * @fn delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const + * @fn delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const * - * @brief ------------------------------------------------- - * delegate_convert_raw - given an object and an raw function, adjust the object base - * and return the actual final code pointer - * -------------------------------------------------. + * @brief ------------------------------------------------- + * delegate_convert_raw - given an object and an raw function, adjust the object base + * and return the actual final code pointer + * -------------------------------------------------. * - * @param [in,out] object [in,out] If non-null, the object. + * @param [in,out] object [in,out] If non-null, the object. * - * @return The given data converted to a generic. + * @return The given data converted to a generic. */ delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h index 3b02f91b976..848e56480c9 100644 --- a/src/lib/util/delegate.h +++ b/src/lib/util/delegate.h @@ -659,8 +659,7 @@ public: if (is_mfp() && (HAS_DIFFERENT_ABI)) \ return (*reinterpret_cast<generic_member_func>(m_function)) x; \ else \ - return (*m_function) x; \ - + return (*m_function) x; //return MEMBER_ABI (*reinpertret_cast<generic_member_func>(m_function)) x; // call the function diff --git a/src/lib/util/flac.c b/src/lib/util/flac.c index 2e1e999977d..49fc667a184 100644 --- a/src/lib/util/flac.c +++ b/src/lib/util/flac.c @@ -609,15 +609,15 @@ FLAC__StreamDecoderWriteStatus flac_decoder::write_callback(const ::FLAC__Frame } /** - * @fn void flac_decoder::error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) + * @fn void flac_decoder::error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) * - * @brief ------------------------------------------------- - * error_callback - handle errors (ignore them) - * -------------------------------------------------. + * @brief ------------------------------------------------- + * error_callback - handle errors (ignore them) + * -------------------------------------------------. * - * @param decoder The decoder. - * @param status The status. - * @param [in,out] client_data If non-null, information describing the client. + * @param decoder The decoder. + * @param status The status. + * @param [in,out] client_data If non-null, information describing the client. */ void flac_decoder::error_callback_static(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) diff --git a/src/lib/util/harddisk.c b/src/lib/util/harddisk.c index 4b041cf29a8..b1082f3234f 100644 --- a/src/lib/util/harddisk.c +++ b/src/lib/util/harddisk.c @@ -98,13 +98,13 @@ chd_file *hard_disk_get_chd(hard_disk_file *file) -------------------------------------------------*/ /** - * @fn hard_disk_info *hard_disk_get_info(hard_disk_file *file) + * @fn hard_disk_info *hard_disk_get_info(hard_disk_file *file) * - * @brief Hard disk get information. + * @brief Hard disk get information. * - * @param [in,out] file If non-null, the file. + * @param [in,out] file If non-null, the file. * - * @return null if it fails, else a hard_disk_info*. + * @return null if it fails, else a hard_disk_info*. */ hard_disk_info *hard_disk_get_info(hard_disk_file *file) @@ -119,15 +119,15 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file) -------------------------------------------------*/ /** - * @fn UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) + * @fn UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) * - * @brief Hard disk read. + * @brief Hard disk read. * - * @param [in,out] file If non-null, the file. - * @param lbasector The lbasector. - * @param [in,out] buffer If non-null, the buffer. + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param [in,out] buffer If non-null, the buffer. * - * @return An UINT32. + * @return An UINT32. */ UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) @@ -143,15 +143,15 @@ UINT32 hard_disk_read(hard_disk_file *file, UINT32 lbasector, void *buffer) -------------------------------------------------*/ /** - * @fn UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer) + * @fn UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer) * - * @brief Hard disk write. + * @brief Hard disk write. * - * @param [in,out] file If non-null, the file. - * @param lbasector The lbasector. - * @param buffer The buffer. + * @param [in,out] file If non-null, the file. + * @param lbasector The lbasector. + * @param buffer The buffer. * - * @return An UINT32. + * @return An UINT32. */ UINT32 hard_disk_write(hard_disk_file *file, UINT32 lbasector, const void *buffer) diff --git a/src/lib/util/hashing.c b/src/lib/util/hashing.c index d7244d4edcf..e7f315ecc53 100644 --- a/src/lib/util/hashing.c +++ b/src/lib/util/hashing.c @@ -215,15 +215,15 @@ bool crc16_t::from_string(const char *string, int length) } /** - * @fn const char *crc16_t::as_string(std::string &buffer) const + * @fn const char *crc16_t::as_string(std::string &buffer) const * - * @brief ------------------------------------------------- - * as_string - convert to a string - * -------------------------------------------------. + * @brief ------------------------------------------------- + * as_string - convert to a string + * -------------------------------------------------. * - * @param [in,out] buffer The buffer. + * @param [in,out] buffer The buffer. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *crc16_t::as_string(std::string &buffer) const @@ -233,14 +233,14 @@ const char *crc16_t::as_string(std::string &buffer) const } /** - * @fn void crc16_creator::append(const void *data, UINT32 length) + * @fn void crc16_creator::append(const void *data, UINT32 length) * - * @brief ------------------------------------------------- - * append - hash a block of data, appending to the currently-accumulated value - * -------------------------------------------------. + * @brief ------------------------------------------------- + * append - hash a block of data, appending to the currently-accumulated value + * -------------------------------------------------. * - * @param data The data. - * @param length The length. + * @param data The data. + * @param length The length. */ void crc16_creator::append(const void *data, UINT32 length) diff --git a/src/lib/util/huffman.c b/src/lib/util/huffman.c index 7f804aec222..9205264f9eb 100644 --- a/src/lib/util/huffman.c +++ b/src/lib/util/huffman.c @@ -731,18 +731,18 @@ huffman_8bit_decoder::huffman_8bit_decoder() } /** - * @fn huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength) + * @fn huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength) * - * @brief ------------------------------------------------- - * decode - decode a full buffer - * -------------------------------------------------. + * @brief ------------------------------------------------- + * decode - decode a full buffer + * -------------------------------------------------. * - * @param source Source for the. - * @param slength The slength. - * @param [in,out] dest If non-null, destination for the. - * @param dlength The dlength. + * @param source Source for the. + * @param slength The slength. + * @param [in,out] dest If non-null, destination for the. + * @param dlength The dlength. * - * @return A huffman_error. + * @return A huffman_error. */ huffman_error huffman_8bit_decoder::decode(const UINT8 *source, UINT32 slength, UINT8 *dest, UINT32 dlength) diff --git a/src/lib/util/jedparse.c b/src/lib/util/jedparse.c index 37bee01fa85..9bed1164303 100644 --- a/src/lib/util/jedparse.c +++ b/src/lib/util/jedparse.c @@ -411,15 +411,15 @@ int jedbin_parse(const void *data, size_t length, jed_data *result) -------------------------------------------------*/ /** - * @fn size_t jedbin_output(const jed_data *data, void *result, size_t length) + * @fn size_t jedbin_output(const jed_data *data, void *result, size_t length) * - * @brief Jedbin output. + * @brief Jedbin output. * - * @param data The data. - * @param [out] result If non-null, the result. - * @param length The length. + * @param data The data. + * @param [out] result If non-null, the result. + * @param length The length. * - * @return A size_t. + * @return A size_t. */ size_t jedbin_output(const jed_data *data, void *result, size_t length) diff --git a/src/lib/util/md5.c b/src/lib/util/md5.c index 7c571d9442e..3c0abb33b30 100644 --- a/src/lib/util/md5.c +++ b/src/lib/util/md5.c @@ -155,12 +155,12 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) */ /** - * @fn void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) + * @fn void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) * - * @brief Md 5 transform. + * @brief Md 5 transform. * - * @param buf The buffer. - * @param in The in. + * @param buf The buffer. + * @param in The in. */ void diff --git a/src/lib/util/opresolv.c b/src/lib/util/opresolv.c index 0dd9252d7b6..91c6f1a9cbd 100644 --- a/src/lib/util/opresolv.c +++ b/src/lib/util/opresolv.c @@ -537,14 +537,14 @@ optreserr_t option_resolution_isvalidvalue(const char *specification, int option } /** - * @fn int option_resolution_contains(const char *specification, int option_char) + * @fn int option_resolution_contains(const char *specification, int option_char) * - * @brief Option resolution contains. + * @brief Option resolution contains. * - * @param specification The specification. - * @param option_char The option character. + * @param specification The specification. + * @param option_char The option character. * - * @return An int. + * @return An int. */ int option_resolution_contains(const char *specification, int option_char) @@ -553,13 +553,13 @@ int option_resolution_contains(const char *specification, int option_char) } /** - * @fn const char *option_resolution_error_string(optreserr_t err) + * @fn const char *option_resolution_error_string(optreserr_t err) * - * @brief Option resolution error string. + * @brief Option resolution error string. * - * @param err The error. + * @param err The error. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *option_resolution_error_string(optreserr_t err) diff --git a/src/lib/util/options.c b/src/lib/util/options.c index b365c1dd0ff..69e7189f50b 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -710,13 +710,13 @@ void core_options::remove_entry(core_options::entry &delentry) } /** - * @fn void core_options::copyfrom(const core_options &src) + * @fn void core_options::copyfrom(const core_options &src) * - * @brief ------------------------------------------------- - * copyfrom - copy options from another set - * -------------------------------------------------. + * @brief ------------------------------------------------- + * copyfrom - copy options from another set + * -------------------------------------------------. * - * @param src Source for the. + * @param src Source for the. */ void core_options::copyfrom(const core_options &src) @@ -730,19 +730,19 @@ void core_options::copyfrom(const core_options &src) } /** - * @fn bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) + * @fn bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) * - * @brief ------------------------------------------------- - * validate_and_set_data - make sure the data is of the appropriate type and within - * range, then set it - * -------------------------------------------------. + * @brief ------------------------------------------------- + * validate_and_set_data - make sure the data is of the appropriate type and within + * range, then set it + * -------------------------------------------------. * - * @param [in,out] curentry The curentry. - * @param newdata The newdata. - * @param priority The priority. - * @param [in,out] error_string The error string. + * @param [in,out] curentry The curentry. + * @param newdata The newdata. + * @param priority The priority. + * @param [in,out] error_string The error string. * - * @return true if it succeeds, false if it fails. + * @return true if it succeeds, false if it fails. */ bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c index 7e20e7e9cb7..f2252a24319 100644 --- a/src/lib/util/palette.c +++ b/src/lib/util/palette.c @@ -468,14 +468,14 @@ void palette_t::normalize_range(UINT32 start, UINT32 end, int lum_min, int lum_m } /** - * @fn void palette_t::update_adjusted_color(UINT32 group, UINT32 index) + * @fn void palette_t::update_adjusted_color(UINT32 group, UINT32 index) * - * @brief ------------------------------------------------- - * update_adjusted_color - update a color index by group and index pair - * -------------------------------------------------. + * @brief ------------------------------------------------- + * update_adjusted_color - update a color index by group and index pair + * -------------------------------------------------. * - * @param group The group. - * @param index Zero-based index of the. + * @param group The group. + * @param index Zero-based index of the. */ void palette_t::update_adjusted_color(UINT32 group, UINT32 index) diff --git a/src/lib/util/plaparse.c b/src/lib/util/plaparse.c index f6228d2cbe9..74bc8edcc69 100644 --- a/src/lib/util/plaparse.c +++ b/src/lib/util/plaparse.c @@ -295,15 +295,15 @@ static bool process_field(jed_data *data, const UINT8 **src, const UINT8 *srcend -------------------------------------------------*/ /** - * @fn int pla_parse(const void *data, size_t length, jed_data *result) + * @fn int pla_parse(const void *data, size_t length, jed_data *result) * - * @brief Pla parse. + * @brief Pla parse. * - * @param data The data. - * @param length The length. - * @param [out] result If non-null, the result. + * @param data The data. + * @param length The length. + * @param [out] result If non-null, the result. * - * @return An int. + * @return An int. */ int pla_parse(const void *data, size_t length, jed_data *result) diff --git a/src/lib/util/png.c b/src/lib/util/png.c index 224cdf8d3dc..706dfb5e50f 100644 --- a/src/lib/util/png.c +++ b/src/lib/util/png.c @@ -1097,15 +1097,15 @@ png_error png_write_bitmap(core_file *fp, png_info *info, bitmap_t &bitmap, int ********************************************************************************/ /** - * @fn png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) + * @fn png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) * - * @brief Mng capture start. + * @brief Mng capture start. * - * @param [in,out] fp If non-null, the fp. - * @param [in,out] bitmap The bitmap. - * @param rate The rate. + * @param [in,out] fp If non-null, the fp. + * @param [in,out] bitmap The bitmap. + * @param rate The rate. * - * @return A png_error. + * @return A png_error. */ png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) @@ -1131,17 +1131,17 @@ png_error mng_capture_start(core_file *fp, bitmap_t &bitmap, double rate) } /** - * @fn png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) + * @fn png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) * - * @brief Mng capture frame. + * @brief Mng capture frame. * - * @param [in,out] fp If non-null, the fp. - * @param [in,out] info If non-null, the information. - * @param [in,out] bitmap The bitmap. - * @param palette_length Length of the palette. - * @param palette The palette. + * @param [in,out] fp If non-null, the fp. + * @param [in,out] info If non-null, the information. + * @param [in,out] bitmap The bitmap. + * @param palette_length Length of the palette. + * @param palette The palette. * - * @return A png_error. + * @return A png_error. */ png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) @@ -1150,13 +1150,13 @@ png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t &bitmap, int } /** - * @fn png_error mng_capture_stop(core_file *fp) + * @fn png_error mng_capture_stop(core_file *fp) * - * @brief Mng capture stop. + * @brief Mng capture stop. * - * @param [in,out] fp If non-null, the fp. + * @param [in,out] fp If non-null, the fp. * - * @return A png_error. + * @return A png_error. */ png_error mng_capture_stop(core_file *fp) diff --git a/src/lib/util/pool.c b/src/lib/util/pool.c index 0ca2be3deaa..ab62f47c6aa 100644 --- a/src/lib/util/pool.c +++ b/src/lib/util/pool.c @@ -571,11 +571,11 @@ static void memory_error(const char *message) -------------------------------------------------*/ /** - * @fn int test_memory_pools(void) + * @fn int test_memory_pools(void) * - * @brief Tests memory pools. + * @brief Tests memory pools. * - * @return An int. + * @return An int. */ int test_memory_pools(void) diff --git a/src/lib/util/sha1.c b/src/lib/util/sha1.c index 732828d9ccf..32247510190 100644 --- a/src/lib/util/sha1.c +++ b/src/lib/util/sha1.c @@ -122,11 +122,11 @@ static void WRITE_UINT32(unsigned char* data, UINT32 val) /* Initialize the SHA values */ /** - * @fn void sha1_init(struct sha1_ctx *ctx) + * @fn void sha1_init(struct sha1_ctx *ctx) * - * @brief Sha 1 initialise. + * @brief Sha 1 initialise. * - * @param [in,out] ctx If non-null, the context. + * @param [in,out] ctx If non-null, the context. */ void @@ -154,12 +154,12 @@ sha1_init(struct sha1_ctx *ctx) Note that this function destroys the data area */ /** - * @fn static void sha1_transform(UINT32 *state, UINT32 *data) + * @fn static void sha1_transform(UINT32 *state, UINT32 *data) * - * @brief Sha 1 transform. + * @brief Sha 1 transform. * - * @param [in,out] state If non-null, the state. - * @param [in,out] data If non-null, the data. + * @param [in,out] state If non-null, the state. + * @param [in,out] data If non-null, the data. */ static void @@ -268,12 +268,12 @@ sha1_transform(UINT32 *state, UINT32 *data) } /** - * @fn static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block) + * @fn static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block) * - * @brief Sha 1 block. + * @brief Sha 1 block. * - * @param [in,out] ctx If non-null, the context. - * @param block The block. + * @param [in,out] ctx If non-null, the context. + * @param block The block. */ static void @@ -294,13 +294,13 @@ sha1_block(struct sha1_ctx *ctx, const UINT8 *block) } /** - * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer) + * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer) * - * @brief Sha 1 update. + * @brief Sha 1 update. * - * @param [in,out] ctx If non-null, the context. - * @param length The length. - * @param buffer The buffer. + * @param [in,out] ctx If non-null, the context. + * @param length The length. + * @param buffer The buffer. */ void @@ -340,11 +340,11 @@ sha1_update(struct sha1_ctx *ctx, 1 0* (64-bit count of bits processed, MSB-first) */ /** - * @fn void sha1_final(struct sha1_ctx *ctx) + * @fn void sha1_final(struct sha1_ctx *ctx) * - * @brief Sha 1 final. + * @brief Sha 1 final. * - * @param [in,out] ctx If non-null, the context. + * @param [in,out] ctx If non-null, the context. */ void @@ -391,13 +391,13 @@ sha1_final(struct sha1_ctx *ctx) } /** - * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, UINT8 *digest) + * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, UINT8 *digest) * - * @brief Sha 1 digest. + * @brief Sha 1 digest. * - * @param ctx The context. - * @param length The length. - * @param [in,out] digest If non-null, the digest. + * @param ctx The context. + * @param length The length. + * @param [in,out] digest If non-null, the digest. */ void diff --git a/src/lib/util/tagmap.c b/src/lib/util/tagmap.c index 95b0ec4fabf..7995b578314 100644 --- a/src/lib/util/tagmap.c +++ b/src/lib/util/tagmap.c @@ -13,8 +13,8 @@ #include "tagmap.h" #ifdef MAME_DEBUG -/** @brief The tagmap finds. */ +/** @brief The tagmap finds. */ INT32 g_tagmap_finds = 0; -/** @brief true to enable, false to disable the tagmap counter. */ +/** @brief true to enable, false to disable the tagmap counter. */ bool g_tagmap_counter_enabled = false; #endif diff --git a/src/lib/util/un7z.c b/src/lib/util/un7z.c index 57c7eeb0890..bbae440e0ff 100644 --- a/src/lib/util/un7z.c +++ b/src/lib/util/un7z.c @@ -468,11 +468,11 @@ _7z_error _7z_file_decompress(_7z_file *new_7z, void *buffer, UINT32 length) -------------------------------------------------*/ /** - * @fn static void free__7z_file(_7z_file *_7z) + * @fn static void free__7z_file(_7z_file *_7z) * - * @brief Free 7z file. + * @brief Free 7z file. * - * @param [in,out] _7z If non-null, the 7z. + * @param [in,out] _7z If non-null, the 7z. */ static void free__7z_file(_7z_file *_7z) diff --git a/src/lib/util/unicode.c b/src/lib/util/unicode.c index 7f264bc1fb6..5f375337b34 100644 --- a/src/lib/util/unicode.c +++ b/src/lib/util/unicode.c @@ -309,13 +309,13 @@ int utf16f_from_uchar(utf16_char *utf16string, size_t count, unicode_char uchar) -------------------------------------------------*/ /** - * @fn const char *utf8_previous_char(const char *utf8string) + * @fn const char *utf8_previous_char(const char *utf8string) * - * @brief UTF 8 previous character. + * @brief UTF 8 previous character. * - * @param utf8string The UTF 8string. + * @param utf8string The UTF 8string. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *utf8_previous_char(const char *utf8string) @@ -333,13 +333,13 @@ const char *utf8_previous_char(const char *utf8string) -------------------------------------------------*/ /** - * @fn int utf8_is_valid_string(const char *utf8string) + * @fn int utf8_is_valid_string(const char *utf8string) * - * @brief UTF 8 is valid string. + * @brief UTF 8 is valid string. * - * @param utf8string The UTF 8string. + * @param utf8string The UTF 8string. * - * @return An int. + * @return An int. */ int utf8_is_valid_string(const char *utf8string) diff --git a/src/lib/util/unzip.c b/src/lib/util/unzip.c index 072e29c130d..21e137b9f24 100644 --- a/src/lib/util/unzip.c +++ b/src/lib/util/unzip.c @@ -69,25 +69,25 @@ #define ZIPUNCMP 0x16 /** - * @def ZIPFNLN + * @def ZIPFNLN * - * @brief A macro that defines zipfnln. + * @brief A macro that defines zipfnln. */ #define ZIPFNLN 0x1a /** - * @def ZIPXTRALN + * @def ZIPXTRALN * - * @brief A macro that defines zipxtraln. + * @brief A macro that defines zipxtraln. */ #define ZIPXTRALN 0x1c /** - * @def ZIPNAME + * @def ZIPNAME * - * @brief A macro that defines zipname. + * @brief A macro that defines zipname. */ #define ZIPNAME 0x1e @@ -99,13 +99,13 @@ ***************************************************************************/ /** - * @fn INLINE UINT16 read_word(UINT8 *buf) + * @fn INLINE UINT16 read_word(UINT8 *buf) * - * @brief Reads a word. + * @brief Reads a word. * - * @param [in,out] buf If non-null, the buffer. + * @param [in,out] buf If non-null, the buffer. * - * @return The word. + * @return The word. */ INLINE UINT16 read_word(UINT8 *buf) @@ -114,13 +114,13 @@ INLINE UINT16 read_word(UINT8 *buf) } /** - * @fn INLINE UINT32 read_dword(UINT8 *buf) + * @fn INLINE UINT32 read_dword(UINT8 *buf) * - * @brief Reads a double word. + * @brief Reads a double word. * - * @param [in,out] buf If non-null, the buffer. + * @param [in,out] buf If non-null, the buffer. * - * @return The double word. + * @return The double word. */ INLINE UINT32 read_dword(UINT8 *buf) @@ -134,7 +134,7 @@ INLINE UINT32 read_dword(UINT8 *buf) GLOBAL VARIABLES ***************************************************************************/ -/** @brief The zip cache[ zip cache size]. */ +/** @brief The zip cache[ zip cache size]. */ static zip_file *zip_cache[ZIP_CACHE_SIZE]; @@ -165,14 +165,14 @@ static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buff -------------------------------------------------*/ /** - * @fn zip_error zip_file_open(const char *filename, zip_file **zip) + * @fn zip_error zip_file_open(const char *filename, zip_file **zip) * - * @brief Queries if a given zip file open. + * @brief Queries if a given zip file open. * - * @param filename Filename of the file. - * @param [in,out] zip If non-null, the zip. + * @param filename Filename of the file. + * @param [in,out] zip If non-null, the zip. * - * @return A zip_error. + * @return A zip_error. */ zip_error zip_file_open(const char *filename, zip_file **zip) @@ -267,11 +267,11 @@ error: -------------------------------------------------*/ /** - * @fn void zip_file_close(zip_file *zip) + * @fn void zip_file_close(zip_file *zip) * - * @brief Zip file close. + * @brief Zip file close. * - * @param [in,out] zip If non-null, the zip. + * @param [in,out] zip If non-null, the zip. */ void zip_file_close(zip_file *zip) @@ -305,9 +305,9 @@ void zip_file_close(zip_file *zip) -------------------------------------------------*/ /** - * @fn void zip_file_cache_clear(void) + * @fn void zip_file_cache_clear(void) * - * @brief Zip file cache clear. + * @brief Zip file cache clear. */ void zip_file_cache_clear(void) @@ -335,13 +335,13 @@ void zip_file_cache_clear(void) -------------------------------------------------*/ /** - * @fn const zip_file_header *zip_file_first_file(zip_file *zip) + * @fn const zip_file_header *zip_file_first_file(zip_file *zip) * - * @brief Zip file first file. + * @brief Zip file first file. * - * @param [in,out] zip If non-null, the zip. + * @param [in,out] zip If non-null, the zip. * - * @return null if it fails, else a zip_file_header*. + * @return null if it fails, else a zip_file_header*. */ const zip_file_header *zip_file_first_file(zip_file *zip) @@ -358,13 +358,13 @@ const zip_file_header *zip_file_first_file(zip_file *zip) -------------------------------------------------*/ /** - * @fn const zip_file_header *zip_file_next_file(zip_file *zip) + * @fn const zip_file_header *zip_file_next_file(zip_file *zip) * - * @brief Zip file next file. + * @brief Zip file next file. * - * @param [in,out] zip If non-null, the zip. + * @param [in,out] zip If non-null, the zip. * - * @return null if it fails, else a zip_file_header*. + * @return null if it fails, else a zip_file_header*. */ const zip_file_header *zip_file_next_file(zip_file *zip) @@ -425,15 +425,15 @@ const zip_file_header *zip_file_next_file(zip_file *zip) -------------------------------------------------*/ /** - * @fn zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) + * @fn zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) * - * @brief Zip file decompress. + * @brief Zip file decompress. * - * @param [in,out] zip If non-null, the zip. - * @param [in,out] buffer If non-null, the buffer. - * @param length The length. + * @param [in,out] zip If non-null, the zip. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. * - * @return A zip_error. + * @return A zip_error. */ zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) @@ -484,11 +484,11 @@ zip_error zip_file_decompress(zip_file *zip, void *buffer, UINT32 length) -------------------------------------------------*/ /** - * @fn static void free_zip_file(zip_file *zip) + * @fn static void free_zip_file(zip_file *zip) * - * @brief Free zip file. + * @brief Free zip file. * - * @param [in,out] zip If non-null, the zip. + * @param [in,out] zip If non-null, the zip. */ static void free_zip_file(zip_file *zip) @@ -518,13 +518,13 @@ static void free_zip_file(zip_file *zip) -------------------------------------------------*/ /** - * @fn static zip_error read_ecd(zip_file *zip) + * @fn static zip_error read_ecd(zip_file *zip) * - * @brief Reads an ecd. + * @brief Reads an ecd. * - * @param [in,out] zip If non-null, the zip. + * @param [in,out] zip If non-null, the zip. * - * @return The ecd. + * @return The ecd. */ static zip_error read_ecd(zip_file *zip) @@ -602,14 +602,14 @@ static zip_error read_ecd(zip_file *zip) -------------------------------------------------*/ /** - * @fn static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) + * @fn static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) * - * @brief Gets compressed data offset. + * @brief Gets compressed data offset. * - * @param [in,out] zip If non-null, the zip. - * @param [in,out] offset If non-null, the offset. + * @param [in,out] zip If non-null, the zip. + * @param [in,out] offset If non-null, the offset. * - * @return The compressed data offset. + * @return The compressed data offset. */ static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) @@ -650,16 +650,16 @@ static zip_error get_compressed_data_offset(zip_file *zip, UINT64 *offset) -------------------------------------------------*/ /** - * @fn static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) + * @fn static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) * - * @brief Decompress the data type 0. + * @brief Decompress the data type 0. * - * @param [in,out] zip If non-null, the zip. - * @param offset The offset. - * @param [in,out] buffer If non-null, the buffer. - * @param length The length. + * @param [in,out] zip If non-null, the zip. + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. * - * @return A zip_error. + * @return A zip_error. */ static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) @@ -684,16 +684,16 @@ static zip_error decompress_data_type_0(zip_file *zip, UINT64 offset, void *buff -------------------------------------------------*/ /** - * @fn static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) + * @fn static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) * - * @brief Decompress the data type 8. + * @brief Decompress the data type 8. * - * @param [in,out] zip If non-null, the zip. - * @param offset The offset. - * @param [in,out] buffer If non-null, the buffer. - * @param length The length. + * @param [in,out] zip If non-null, the zip. + * @param offset The offset. + * @param [in,out] buffer If non-null, the buffer. + * @param length The length. * - * @return A zip_error. + * @return A zip_error. */ static zip_error decompress_data_type_8(zip_file *zip, UINT64 offset, void *buffer, UINT32 length) diff --git a/src/lib/util/vbiparse.c b/src/lib/util/vbiparse.c index 43cfb57c158..9c6c39fc4ea 100644 --- a/src/lib/util/vbiparse.c +++ b/src/lib/util/vbiparse.c @@ -277,15 +277,15 @@ int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift) -------------------------------------------------*/ /** - * @fn void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi) + * @fn void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi) * - * @brief Vbi parse all. + * @brief Vbi parse all. * - * @param source Source for the. - * @param sourcerowpixels The sourcerowpixels. - * @param sourcewidth The sourcewidth. - * @param sourceshift The sourceshift. - * @param [in,out] vbi If non-null, the vbi. + * @param source Source for the. + * @param sourcerowpixels The sourcerowpixels. + * @param sourcewidth The sourcewidth. + * @param sourceshift The sourceshift. + * @param [in,out] vbi If non-null, the vbi. */ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, int sourceshift, vbi_metadata *vbi) @@ -351,13 +351,13 @@ void vbi_parse_all(const UINT16 *source, int sourcerowpixels, int sourcewidth, i -------------------------------------------------*/ /** - * @fn void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) + * @fn void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) * - * @brief Vbi metadata pack. + * @brief Vbi metadata pack. * - * @param [in,out] dest If non-null, destination for the. - * @param framenum The framenum. - * @param vbi The vbi. + * @param [in,out] dest If non-null, destination for the. + * @param framenum The framenum. + * @param vbi The vbi. */ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) @@ -387,13 +387,13 @@ void vbi_metadata_pack(UINT8 *dest, UINT32 framenum, const vbi_metadata *vbi) -------------------------------------------------*/ /** - * @fn void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source) + * @fn void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source) * - * @brief Vbi metadata unpack. + * @brief Vbi metadata unpack. * - * @param [in,out] vbi If non-null, the vbi. - * @param [in,out] framenum If non-null, the framenum. - * @param source Source for the. + * @param [in,out] vbi If non-null, the vbi. + * @param [in,out] framenum If non-null, the framenum. + * @param source Source for the. */ void vbi_metadata_unpack(vbi_metadata *vbi, UINT32 *framenum, const UINT8 *source) diff --git a/src/lib/util/xmlfile.c b/src/lib/util/xmlfile.c index 193717b30aa..2e11f03418b 100644 --- a/src/lib/util/xmlfile.c +++ b/src/lib/util/xmlfile.c @@ -452,15 +452,15 @@ int xml_get_attribute_int_format(xml_data_node *node, const char *attribute) -------------------------------------------------*/ /** - * @fn float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue) + * @fn float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue) * - * @brief XML get attribute float. + * @brief XML get attribute float. * - * @param [in,out] node If non-null, the node. - * @param attribute The attribute. - * @param defvalue The defvalue. + * @param [in,out] node If non-null, the node. + * @param attribute The attribute. + * @param defvalue The defvalue. * - * @return A float. + * @return A float. */ float xml_get_attribute_float(xml_data_node *node, const char *attribute, float defvalue) @@ -480,15 +480,15 @@ float xml_get_attribute_float(xml_data_node *node, const char *attribute, float -------------------------------------------------*/ /** - * @fn xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, const char *value) + * @fn xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, const char *value) * - * @brief XML set attribute. + * @brief XML set attribute. * - * @param [in,out] node If non-null, the node. - * @param name The name. - * @param value The value. + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. * - * @return null if it fails, else an xml_attribute_node*. + * @return null if it fails, else an xml_attribute_node*. */ xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, const char *value) @@ -520,15 +520,15 @@ xml_attribute_node *xml_set_attribute(xml_data_node *node, const char *name, con -------------------------------------------------*/ /** - * @fn xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, int value) + * @fn xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, int value) * - * @brief XML set attribute int. + * @brief XML set attribute int. * - * @param [in,out] node If non-null, the node. - * @param name The name. - * @param value The value. + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. * - * @return null if it fails, else an xml_attribute_node*. + * @return null if it fails, else an xml_attribute_node*. */ xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, int value) @@ -545,15 +545,15 @@ xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, -------------------------------------------------*/ /** - * @fn xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) + * @fn xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) * - * @brief XML set attribute float. + * @brief XML set attribute float. * - * @param [in,out] node If non-null, the node. - * @param name The name. - * @param value The value. + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. * - * @return null if it fails, else an xml_attribute_node*. + * @return null if it fails, else an xml_attribute_node*. */ xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) @@ -575,13 +575,13 @@ xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *nam -------------------------------------------------*/ /** - * @fn const char *xml_normalize_string(const char *string) + * @fn const char *xml_normalize_string(const char *string) * - * @brief XML normalize string. + * @brief XML normalize string. * - * @param string The string. + * @param string The string. * - * @return null if it fails, else a char*. + * @return null if it fails, else a char*. */ const char *xml_normalize_string(const char *string) @@ -623,13 +623,13 @@ const char *xml_normalize_string(const char *string) -------------------------------------------------*/ /** - * @fn static void *expat_malloc(size_t size) + * @fn static void *expat_malloc(size_t size) * - * @brief Expat malloc. + * @brief Expat malloc. * - * @param size The size. + * @param size The size. * - * @return null if it fails, else a void*. + * @return null if it fails, else a void*. */ static void *expat_malloc(size_t size) @@ -640,11 +640,11 @@ static void *expat_malloc(size_t size) } /** - * @fn static void expat_free(void *ptr) + * @fn static void expat_free(void *ptr) * - * @brief Expat free. + * @brief Expat free. * - * @param [in,out] ptr If non-null, the pointer. + * @param [in,out] ptr If non-null, the pointer. */ static void expat_free(void *ptr) @@ -654,14 +654,14 @@ static void expat_free(void *ptr) } /** - * @fn static void *expat_realloc(void *ptr, size_t size) + * @fn static void *expat_realloc(void *ptr, size_t size) * - * @brief Expat realloc. + * @brief Expat realloc. * - * @param [in,out] ptr If non-null, the pointer. - * @param size The size. + * @param [in,out] ptr If non-null, the pointer. + * @param size The size. * - * @return null if it fails, else a void*. + * @return null if it fails, else a void*. */ static void *expat_realloc(void *ptr, size_t size) @@ -684,14 +684,14 @@ static void *expat_realloc(void *ptr, size_t size) -------------------------------------------------*/ /** - * @fn static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) + * @fn static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) * - * @brief Expat setup parser. + * @brief Expat setup parser. * - * @param [in,out] parse_info If non-null, information describing the parse. - * @param [in,out] opts If non-null, options for controlling the operation. + * @param [in,out] parse_info If non-null, information describing the parse. + * @param [in,out] opts If non-null, options for controlling the operation. * - * @return An int. + * @return An int. */ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opts) @@ -746,13 +746,13 @@ static int expat_setup_parser(xml_parse_info *parse_info, xml_parse_options *opt -------------------------------------------------*/ /** - * @fn static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) + * @fn static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) * - * @brief Expat element start. + * @brief Expat element start. * - * @param [in,out] data If non-null, the data. - * @param name The name. - * @param attributes The attributes. + * @param [in,out] data If non-null, the data. + * @param name The name. + * @param attributes The attributes. */ static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) @@ -785,13 +785,13 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char -------------------------------------------------*/ /** - * @fn static void expat_data(void *data, const XML_Char *s, int len) + * @fn static void expat_data(void *data, const XML_Char *s, int len) * - * @brief Expat data. + * @brief Expat data. * - * @param [in,out] data If non-null, the data. - * @param s The const XML_Char * to process. - * @param len The length. + * @param [in,out] data If non-null, the data. + * @param s The const XML_Char * to process. + * @param len The length. */ static void expat_data(void *data, const XML_Char *s, int len) @@ -833,12 +833,12 @@ static void expat_data(void *data, const XML_Char *s, int len) -------------------------------------------------*/ /** - * @fn static void expat_element_end(void *data, const XML_Char *name) + * @fn static void expat_element_end(void *data, const XML_Char *name) * - * @brief Expat element end. + * @brief Expat element end. * - * @param [in,out] data If non-null, the data. - * @param name The name. + * @param [in,out] data If non-null, the data. + * @param name The name. */ static void expat_element_end(void *data, const XML_Char *name) @@ -892,15 +892,15 @@ static void expat_element_end(void *data, const XML_Char *name) -------------------------------------------------*/ /** - * @fn static xml_data_node *add_child(xml_data_node *parent, const char *name, const char *value) + * @fn static xml_data_node *add_child(xml_data_node *parent, const char *name, const char *value) * - * @brief Adds a child. + * @brief Adds a child. * - * @param [in,out] parent If non-null, the parent. - * @param name The name. - * @param value The value. + * @param [in,out] parent If non-null, the parent. + * @param name The name. + * @param value The value. * - * @return null if it fails, else an xml_data_node*. + * @return null if it fails, else an xml_data_node*. */ static xml_data_node *add_child(xml_data_node *parent, const char *name, const char *value) @@ -946,15 +946,15 @@ static xml_data_node *add_child(xml_data_node *parent, const char *name, const c -------------------------------------------------*/ /** - * @fn static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, const char *value) + * @fn static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, const char *value) * - * @brief Adds an attribute. + * @brief Adds an attribute. * - * @param [in,out] node If non-null, the node. - * @param name The name. - * @param value The value. + * @param [in,out] node If non-null, the node. + * @param name The name. + * @param value The value. * - * @return null if it fails, else an xml_attribute_node*. + * @return null if it fails, else an xml_attribute_node*. */ static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, const char *value) @@ -1001,13 +1001,13 @@ static xml_attribute_node *add_attribute(xml_data_node *node, const char *name, -------------------------------------------------*/ /** - * @fn static void write_node_recursive(xml_data_node *node, int indent, core_file *file) + * @fn static void write_node_recursive(xml_data_node *node, int indent, core_file *file) * - * @brief Writes a node recursive. + * @brief Writes a node recursive. * - * @param [in,out] node If non-null, the node. - * @param indent The indent. - * @param [in,out] file If non-null, the file. + * @param [in,out] node If non-null, the node. + * @param indent The indent. + * @param [in,out] file If non-null, the file. */ static void write_node_recursive(xml_data_node *node, int indent, core_file *file) @@ -1054,11 +1054,11 @@ static void write_node_recursive(xml_data_node *node, int indent, core_file *fil -------------------------------------------------*/ /** - * @fn static void free_node_recursive(xml_data_node *node) + * @fn static void free_node_recursive(xml_data_node *node) * - * @brief Free node recursive. + * @brief Free node recursive. * - * @param [in,out] node If non-null, the node. + * @param [in,out] node If non-null, the node. */ static void free_node_recursive(xml_data_node *node) diff --git a/src/lib/util/zippath.c b/src/lib/util/zippath.c index 8d22952223a..36c9470ed92 100644 --- a/src/lib/util/zippath.c +++ b/src/lib/util/zippath.c @@ -23,23 +23,23 @@ ***************************************************************************/ /** - * @struct zippath_returned_directory + * @struct zippath_returned_directory * - * @brief A zippath returned directory. + * @brief A zippath returned directory. */ struct zippath_returned_directory { - /** @brief The next. */ + /** @brief The next. */ zippath_returned_directory *next; - /** @brief The name. */ + /** @brief The name. */ std::string name; }; /** - * @class zippath_directory + * @class zippath_directory * - * @brief A zippath directory. + * @brief A zippath directory. */ class zippath_directory @@ -53,23 +53,23 @@ public: returned_dirlist(NULL) { } /* common */ - /** @brief true to returned parent. */ + /** @brief true to returned parent. */ bool returned_parent; - /** @brief The returned entry. */ + /** @brief The returned entry. */ osd_directory_entry returned_entry; /* specific to normal directories */ - /** @brief Pathname of the directory. */ + /** @brief Pathname of the directory. */ osd_directory *directory; /* specific to ZIP directories */ - /** @brief true to called zip first. */ + /** @brief true to called zip first. */ bool called_zip_first; - /** @brief The zipfile. */ + /** @brief The zipfile. */ zip_file *zipfile; - /** @brief The zipprefix. */ + /** @brief The zipprefix. */ std::string zipprefix; - /** @brief The returned dirlist. */ + /** @brief The returned dirlist. */ zippath_returned_directory *returned_dirlist; }; @@ -89,15 +89,15 @@ static int is_7z_file(const char *path); ***************************************************************************/ /** - * @fn int is_path_separator(char c) + * @fn int is_path_separator(char c) * - * @brief ============================================================ - * is_path_separator - * ============================================================. + * @brief ============================================================ + * is_path_separator + * ============================================================. * - * @param c The character. + * @param c The character. * - * @return An int. + * @return An int. */ int is_path_separator(char c) @@ -110,13 +110,13 @@ int is_path_separator(char c) -------------------------------------------------*/ /** - * @fn static void parse_parent_path(const char *path, int *beginpos, int *endpos) + * @fn static void parse_parent_path(const char *path, int *beginpos, int *endpos) * - * @brief Parse parent path. + * @brief Parse parent path. * - * @param path Full pathname of the file. - * @param [in,out] beginpos If non-null, the beginpos. - * @param [in,out] endpos If non-null, the endpos. + * @param path Full pathname of the file. + * @param [in,out] beginpos If non-null, the beginpos. + * @param [in,out] endpos If non-null, the endpos. */ static void parse_parent_path(const char *path, int *beginpos, int *endpos) @@ -149,14 +149,14 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos) -------------------------------------------------*/ /** - * @fn std::string &zippath_parent(std::string &dst, const char *path) + * @fn std::string &zippath_parent(std::string &dst, const char *path) * - * @brief Zippath parent. + * @brief Zippath parent. * - * @param [in,out] dst Destination for the. - * @param path Full pathname of the file. + * @param [in,out] dst Destination for the. + * @param path Full pathname of the file. * - * @return A std::string& + * @return A std::string& */ std::string &zippath_parent(std::string &dst, const char *path) @@ -182,14 +182,14 @@ std::string &zippath_parent(std::string &dst, const char *path) -------------------------------------------------*/ /** - * @fn std::string &zippath_parent_basename(std::string &dst, const char *path) + * @fn std::string &zippath_parent_basename(std::string &dst, const char *path) * - * @brief Zippath parent basename. + * @brief Zippath parent basename. * - * @param [in,out] dst Destination for the. - * @param path Full pathname of the file. + * @param [in,out] dst Destination for the. + * @param path Full pathname of the file. * - * @return A std::string& + * @return A std::string& */ std::string &zippath_parent_basename(std::string &dst, const char *path) @@ -207,15 +207,15 @@ std::string &zippath_parent_basename(std::string &dst, const char *path) -------------------------------------------------*/ /** - * @fn std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) + * @fn std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) * - * @brief Zippath combine. + * @brief Zippath combine. * - * @param [in,out] dst Destination for the. - * @param path1 The first path. - * @param path2 The second path. + * @param [in,out] dst Destination for the. + * @param path1 The first path. + * @param path2 The second path. * - * @return A std::string& + * @return A std::string& */ std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) @@ -255,13 +255,13 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa -------------------------------------------------*/ /** - * @fn static file_error file_error_from_zip_error(zip_error ziperr) + * @fn static file_error file_error_from_zip_error(zip_error ziperr) * - * @brief File error from zip error. + * @brief File error from zip error. * - * @param ziperr The ziperr. + * @param ziperr The ziperr. * - * @return A file_error. + * @return A file_error. */ static file_error file_error_from_zip_error(zip_error ziperr) @@ -298,15 +298,15 @@ static file_error file_error_from_zip_error(zip_error ziperr) -------------------------------------------------*/ /** - * @fn static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, core_file *&file) + * @fn static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, core_file *&file) * - * @brief Creates core file from zip. + * @brief Creates core file from zip. * - * @param [in,out] zip If non-null, the zip. - * @param header The header. - * @param [in,out] file [in,out] If non-null, the file. + * @param [in,out] zip If non-null, the zip. + * @param header The header. + * @param [in,out] file [in,out] If non-null, the file. * - * @return The new core file from zip. + * @return The new core file from zip. */ static file_error create_core_file_from_zip(zip_file *zip, const zip_file_header *header, core_file *&file) @@ -345,16 +345,16 @@ done: -------------------------------------------------*/ /** - * @fn file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&file, std::string &revised_path) + * @fn file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&file, std::string &revised_path) * - * @brief Zippath fopen. + * @brief Zippath fopen. * - * @param filename Filename of the file. - * @param openflags The openflags. - * @param [in,out] file [in,out] If non-null, the file. - * @param [in,out] revised_path Full pathname of the revised file. + * @param filename Filename of the file. + * @param openflags The openflags. + * @param [in,out] file [in,out] If non-null, the file. + * @param [in,out] revised_path Full pathname of the revised file. * - * @return A file_error. + * @return A file_error. */ file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&file, std::string &revised_path) @@ -487,13 +487,13 @@ done: -------------------------------------------------*/ /** - * @fn static int is_root(const char *path) + * @fn static int is_root(const char *path) * - * @brief Is root. + * @brief Is root. * - * @param path Full pathname of the file. + * @param path Full pathname of the file. * - * @return An int. + * @return An int. */ static int is_root(const char *path) @@ -519,13 +519,13 @@ static int is_root(const char *path) -------------------------------------------------*/ /** - * @fn static int is_7z_file(const char *path) + * @fn static int is_7z_file(const char *path) * - * @brief Is 7z file. + * @brief Is 7z file. * - * @param path Full pathname of the file. + * @param path Full pathname of the file. * - * @return An int. + * @return An int. */ static int is_7z_file(const char *path) @@ -541,13 +541,13 @@ static int is_7z_file(const char *path) -------------------------------------------------*/ /** - * @fn static int is_zip_file(const char *path) + * @fn static int is_zip_file(const char *path) * - * @brief Is zip file. + * @brief Is zip file. * - * @param path Full pathname of the file. + * @param path Full pathname of the file. * - * @return An int. + * @return An int. */ static int is_zip_file(const char *path) @@ -564,13 +564,13 @@ static int is_zip_file(const char *path) -------------------------------------------------*/ /** - * @fn static int is_zip_file_separator(char c) + * @fn static int is_zip_file_separator(char c) * - * @brief Is zip file separator. + * @brief Is zip file separator. * - * @param c The character. + * @param c The character. * - * @return An int. + * @return An int. */ static int is_zip_file_separator(char c) @@ -586,13 +586,13 @@ static int is_zip_file_separator(char c) -------------------------------------------------*/ /** - * @fn static int is_zip_path_separator(char c) + * @fn static int is_zip_path_separator(char c) * - * @brief Is zip path separator. + * @brief Is zip path separator. * - * @param c The character. + * @param c The character. * - * @return An int. + * @return An int. */ static int is_zip_path_separator(char c) @@ -608,14 +608,14 @@ static int is_zip_path_separator(char c) -------------------------------------------------*/ /** - * @fn static char next_path_char(const char *s, int *pos) + * @fn static char next_path_char(const char *s, int *pos) * - * @brief Next path character. + * @brief Next path character. * - * @param s The const char * to process. - * @param [in,out] pos If non-null, the position. + * @param s The const char * to process. + * @param [in,out] pos If non-null, the position. * - * @return A char. + * @return A char. */ static char next_path_char(const char *s, int *pos) @@ -661,15 +661,15 @@ static char next_path_char(const char *s, int *pos) -------------------------------------------------*/ /** - * @fn static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type) + * @fn static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type) * - * @brief Zippath find sub path. + * @brief Zippath find sub path. * - * @param [in,out] zipfile If non-null, the zipfile. - * @param subpath The subpath. - * @param [in,out] type If non-null, the type. + * @param [in,out] zipfile If non-null, the zipfile. + * @param subpath The subpath. + * @param [in,out] type If non-null, the type. * - * @return null if it fails, else a zip_file_header*. + * @return null if it fails, else a zip_file_header*. */ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type) @@ -726,16 +726,16 @@ static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const cha -------------------------------------------------*/ /** - * @fn static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath) + * @fn static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath) * - * @brief Zippath resolve. + * @brief Zippath resolve. * - * @param path Full pathname of the file. - * @param [in,out] entry_type Type of the entry. - * @param [in,out] zipfile [in,out] If non-null, the zipfile. - * @param [in,out] newpath The newpath. + * @param path Full pathname of the file. + * @param [in,out] entry_type Type of the entry. + * @param [in,out] zipfile [in,out] If non-null, the zipfile. + * @param [in,out] newpath The newpath. * - * @return A file_error. + * @return A file_error. */ static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, zip_file *&zipfile, std::string &newpath) @@ -834,14 +834,14 @@ done: -------------------------------------------------*/ /** - * @fn file_error zippath_opendir(const char *path, zippath_directory **directory) + * @fn file_error zippath_opendir(const char *path, zippath_directory **directory) * - * @brief Zippath opendir. + * @brief Zippath opendir. * - * @param path Full pathname of the file. - * @param [in,out] directory If non-null, pathname of the directory. + * @param path Full pathname of the file. + * @param [in,out] directory If non-null, pathname of the directory. * - * @return A file_error. + * @return A file_error. */ file_error zippath_opendir(const char *path, zippath_directory **directory) @@ -905,11 +905,11 @@ done: -------------------------------------------------*/ /** - * @fn void zippath_closedir(zippath_directory *directory) + * @fn void zippath_closedir(zippath_directory *directory) * - * @brief Zippath closedir. + * @brief Zippath closedir. * - * @param [in,out] directory If non-null, pathname of the directory. + * @param [in,out] directory If non-null, pathname of the directory. */ void zippath_closedir(zippath_directory *directory) @@ -938,14 +938,14 @@ void zippath_closedir(zippath_directory *directory) -------------------------------------------------*/ /** - * @fn static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header) + * @fn static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header) * - * @brief Gets relative path. + * @brief Gets relative path. * - * @param [in,out] directory If non-null, pathname of the directory. - * @param header The header. + * @param [in,out] directory If non-null, pathname of the directory. + * @param header The header. * - * @return null if it fails, else the relative path. + * @return null if it fails, else the relative path. */ static const char *get_relative_path(zippath_directory *directory, const zip_file_header *header) @@ -970,13 +970,13 @@ static const char *get_relative_path(zippath_directory *directory, const zip_fil -------------------------------------------------*/ /** - * @fn const osd_directory_entry *zippath_readdir(zippath_directory *directory) + * @fn const osd_directory_entry *zippath_readdir(zippath_directory *directory) * - * @brief Zippath readdir. + * @brief Zippath readdir. * - * @param [in,out] directory If non-null, pathname of the directory. + * @param [in,out] directory If non-null, pathname of the directory. * - * @return null if it fails, else an osd_directory_entry*. + * @return null if it fails, else an osd_directory_entry*. */ const osd_directory_entry *zippath_readdir(zippath_directory *directory) @@ -1086,13 +1086,13 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory) -------------------------------------------------*/ /** - * @fn int zippath_is_zip(zippath_directory *directory) + * @fn int zippath_is_zip(zippath_directory *directory) * - * @brief Zippath is zip. + * @brief Zippath is zip. * - * @param [in,out] directory If non-null, pathname of the directory. + * @param [in,out] directory If non-null, pathname of the directory. * - * @return An int. + * @return An int. */ int zippath_is_zip(zippath_directory *directory) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index aec6fa01461..7f53d7e3342 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -1465,8 +1465,9 @@ invadrmr // (c) 1978 Model Racing claybust // (c) 1978 Model Racing gunchamp // (c) 1980 Model Racing gunchamps // (c) 1980 Model Racing (sshot.c) -spaceatt // (c) 1978 Video Games GMBH -spaceatt2k // (c) 1978 Video Games GMBH +spaceatt // (c) 1978 Video Games GmbH +spaceattbp // (c) 1978 Video Games GmbH +spaceatt2k // (c) 1978 Video Games GmbH galmonst // (c) Laguna S.A. spaceat2 // (c) 1980 Zenitone-Microsec Ltd spacecom // bootleg @@ -1794,8 +1795,8 @@ vigilantb // (c) 1988 (US Rev B) vigilantc // (c) 1988 (World Rev C) vigilantd // (c) 1988 (Japan Rev D) vigilantg // (c) 1988 (US Rev G) -vigilano // (c) 1988 (US) -vigilanbl // bootleg +vigilanto // (c) 1988 (US) +vigilantbl // bootleg kikcubic // (c) 1988 (Japan) kikcubicb // bootleg buccanrs // (c) 1989 Duintronic @@ -1900,6 +1901,7 @@ geostorm // (c) 1994 Irem (Japan) airass // (c) 1993 Irem (World) firebarr // (c) 1993 Irem (Japan) dsoccr94 // (c) 1994 Irem (Data East Corporation license) +dsoccr94k // kftgoal // (c) 1994 Jaleco wpksoc // (c) 1995 Jaleco @@ -2655,7 +2657,7 @@ outzoneb // TP-O18 (c) 1990 Toaplan outzonec // TP-O18 (c) 1990 Toaplan vimana // TP-O19 (c) 1991 Toaplan (+ Tecmo license when set to Japan) vimanaj // TP-O19 (c) 1991 Toaplan (+ Tecmo license when set to Japan) -vimanan // TP-O19 (c) 1991 Toaplan (+ Nova Apparate GMBH & Co license) +vimanan // TP-O19 (c) 1991 Toaplan (+ Nova Apparate GmbH & Co license) snowbros // MIN16-02 (c) 1990 Toaplan + Romstar license snowbrosa // MIN16-02 (c) 1990 Toaplan + Romstar license snowbrosb // MIN16-02 (c) 1990 Toaplan + Romstar license @@ -4607,8 +4609,9 @@ cottonja // (c) 1990 (FD1094) ddux // (c) 1989 (FD1094) dduxj // (c) 1989 (FD1094) ddux1 // (c) 1989 (8751) -dunkshot // (c) 1986 (FD1094) -dunkshoto // (c) 1986 (FD1094) +dunkshot // (c) 1986 (FD1089A) +dunkshota // (c) 1986 (FD1089A) +dunkshoto // (c) 1986 (FD1089A) eswat // (c) 1989 (FD1094) eswatu // (c) 1989 (FD1094) eswatj // (c) 1989 (FD1094) @@ -4841,6 +4844,9 @@ quizmeku // 1993.05 Quiz Mekurumeku Story (Japan) mahmajn2 // 1994.05 Tokorosan no Mahmahjong 2 (Japan) qgh // 1994.09 Quiz Ghost Hunter +// M1 board +bingpty // ? + // Sega System 32 games radm // 1991.?? Rad Mobile (World) radmu // 1991.03 Rad Mobile (US) @@ -5714,15 +5720,15 @@ mj2 // 2005.02.02 Sega Network Taisen Mahjong MJ 2 (Rev G) // 2005.03 Sangokushi Taisen gundamos // 2005.03 Gundam Battle Operating Simulator // 2005.04 Quest of D Ver.1.20 - // 2005.04 Wangan Midnight Maximum Tune 2 (Japan) -wangmid2 // 2005.04 Wangan Midnight Maximum Tune 2 (export) +wangmid2 // 2005.04 Wangan Midnight Maximum Tune 2 (Japan) + // 2005.04 Wangan Midnight Maximum Tune 2 (Export) // 2005.06 Sangokushi Taisen Ver.1.002 // 2005.06 Sangokushi Taisen Ver.1.03 // 2005.06 Sega Golf Club Network Pro Tour 2005 // 2005.06 Quest of D Ver.1.20a // 2005.09 Quest of D Ver.1.21 // 2005.10 Sangokushi Taisen Ver.1.100 -wangmd2b // 2005.10 Wangan Midnight Maximum Tune 2 (Japan) (Rev A) +wangmd2b // 2005.10 Wangan Midnight Maximum Tune 2 (Export) (Rev A) // 2005.11 Sangokushi Taisen Ver.1.110 // 2005.12 Quest of D Gofu no Keisyousya Ver.2.00 // 2005.12 Quest of D Gofu no Keisyousya Ver.2.01 @@ -7503,6 +7509,7 @@ mechattu // A8002 'MA' (c) 1989 mechattu1 // A8002 'MA' (c) 1989 bbusters // A9003 'BB' (c) 1989 bbustersu // A9003 'BB' (c) 1989 +bbustersua // A9003 'BB' (c) 1989 // Electrocoin on early SNK hardware dmndrby // G4001 'DD' (c) 1986 @@ -9116,7 +9123,7 @@ keroppi // (c) 1993 Sammy keroppij // (c) 1993 Sammy extdwnhl // (c) 1995 Sammy Japan gundhara // (c) 1995 Banpresto -gundharac // (c) 1995 Banpresto (Chinese, bootleg?) +gundharac // (c) 1995 Banpresto (Chinese, bootleg?) sokonuke // (c) 1995 Sammy Industries zombraid // (c) 1995 American Sammy zombraidp // (c) 1995 American Sammy @@ -9479,9 +9486,9 @@ puzzlet // (c) 2000 Yunizu Corporation (Japan) spcforce // (c) 1980 Venture Line spcforc2 // bootleg meteor // (c) 1981 Venture Line -looping // (c) 1982 Video Games GMBH -loopingv // (c) 1982 Video Games GMBH (Venture Line license) -loopingva // (c) 1982 Video Games GMBH (Venture Line license) +looping // (c) 1982 Video Games GmbH +loopingv // (c) 1982 Video Games GmbH (Venture Line license) +loopingva // (c) 1982 Video Games GmbH (Venture Line license) skybump // (c) 1982 Venture Line suprridr // (c) 1983 Venture Line + Taito license @@ -9601,6 +9608,7 @@ janoh // (c) 1984 Toaplan janoha // (c) 1984 Toaplan jansou // (c) 1985 Dyna jansoua // (c) 1985 Dyna +tahjong // (c) 1985 Bally Pond / Nasco mjsiyoub // (c) 1986 Visco mjsenka // (c) 1986 Visco mjyarou // (c) 1986 Visco / Video System @@ -9661,6 +9669,7 @@ htengoku // 1992 Dynax cdracula // 1994 Y.S.E. mjreach // 1994 Dynax mjdialq2 // "52" (c) 1991 Dynax +mjdialq2a // "52" (c) 1991 Dynax yarunara // "55" Mahjong Yarunara 1991 Dynax mjangels // "61" Mahjong Angels 1991 Dynax quiztvqq // "64" Quiz TV Gassyuukoku Q&Q 1992 Dynax @@ -9722,6 +9731,7 @@ pkgnsh // "505" Pachinko Gindama Shoubu 1998 (Japan) pkgnshdx // "522" Pachinko Gindama Shoubu DX 1998 (Japan) hjingi // "???" 1990 Dynax +hjingia // "???" 1990 Dynax hanayara // "???" mjelctrn // "???" Mahjong Electron Base parts 2 & 4 mjelct3 // "???" Mahjong Electron Base parts 2 & 3 @@ -11225,6 +11235,7 @@ pepp0230 // (c) 1987 IGT - International Game Technology pepp0242 // (c) 1987 IGT - International Game Technology pepp0249 // (c) 1987 IGT - International Game Technology pepp0250 // (c) 1987 IGT - International Game Technology +pepp0250a // (c) 1987 IGT - International Game Technology pepp0265 // (c) 1987 IGT - International Game Technology pepp0265a // (c) 1987 IGT - International Game Technology pepp0265b // (c) 1987 IGT - International Game Technology @@ -11372,6 +11383,7 @@ pex0055po // (c) 1995 IGT - International Game Technology pex0055pp // (c) 1995 IGT - International Game Technology pex0055pq // (c) 1995 IGT - International Game Technology pex0055pr // (c) 1995 IGT - International Game Technology +pex0057p // (c) 1995 IGT - International Game Technology pex0060p // (c) 1995 IGT - International Game Technology pex0124p // (c) 1995 IGT - International Game Technology pex0150p // (c) 1995 IGT - International Game Technology @@ -11421,6 +11433,7 @@ pex2016p // (c) 1995 IGT - International Game Technology pex2017p // (c) 1995 IGT - International Game Technology pex2018p // (c) 1995 IGT - International Game Technology pex2021p // (c) 1995 IGT - International Game Technology +pex2024p // (c) 1995 IGT - International Game Technology pex2025p // (c) 1995 IGT - International Game Technology pex2026p // (c) 1995 IGT - International Game Technology pex2027p // (c) 1995 IGT - International Game Technology @@ -11896,6 +11909,9 @@ nc96 // (c) 1996 Amcoe nc96a // (c) 1996 Amcoe nc96b // (c) 1996 Amcoe nc96c // (c) 1996 Amcoe +nc96d // (c) 1996 Amcoe +nc96e // (c) 1996 Amcoe +nc96f // (c) 1996 Amcoe nc96txt // (c) 2000 Amcoe nfb96 // (c) 1996 Amcoe nfb96a // (c) 1996 Amcoe @@ -12855,7 +12871,7 @@ vpoker // (c) 198? specfrce // (c) 2002 ICE/Play Mechanix jnero // (c) 2004 ICE/Play Mechanix -// Amatic Trading GMBH +// Amatic Trading GmbH suprstar // (c) 1996 Amatic am_mg24 // (c) 2000 Amatic am_mg3 // (c) 2000 Amatic diff --git a/src/mame/audio/cclimber.c b/src/mame/audio/cclimber.c index 80108dddb91..ce8d11832ea 100644 --- a/src/mame/audio/cclimber.c +++ b/src/mame/audio/cclimber.c @@ -14,6 +14,7 @@ SAMPLES_START_CB_MEMBER( cclimber_audio_device::sh_start ) { if (machine().root_device().memregion("samples")->base()) m_sample_buf = auto_alloc_array(machine(), INT16, 2 * machine().root_device().memregion("samples")->bytes()); + save_pointer(NAME(m_sample_buf), 2 * machine().root_device().memregion("samples")->bytes()); } MACHINE_CONFIG_FRAGMENT( cclimber_audio ) @@ -58,6 +59,9 @@ cclimber_audio_device::cclimber_audio_device(const machine_config &mconfig, cons void cclimber_audio_device::device_start() { + save_item(NAME(m_sample_num)); + save_item(NAME(m_sample_freq)); + save_item(NAME(m_sample_volume)); } //------------------------------------------------- diff --git a/src/mame/audio/geebee.c b/src/mame/audio/geebee.c index ab84daf034b..8105b65ac41 100644 --- a/src/mame/audio/geebee.c +++ b/src/mame/audio/geebee.c @@ -29,15 +29,6 @@ geebee_sound_device::geebee_sound_device(const machine_config &mconfig, const ch { } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void geebee_sound_device::device_config_complete() -{ -} //------------------------------------------------- // device_start - device-specific startup diff --git a/src/mame/audio/irem.c b/src/mame/audio/irem.c index c25305148b4..470c66637dd 100644 --- a/src/mame/audio/irem.c +++ b/src/mame/audio/irem.c @@ -19,6 +19,8 @@ irem_audio_device::irem_audio_device(const machine_config &mconfig, const char * device_sound_interface(mconfig, *this), m_port1(0), m_port2(0) + //m_ay_45L(*this, "ay_45l"), + //m_ay_45M(*this, "ay_45m") { } @@ -40,8 +42,14 @@ void irem_audio_device::device_start() { m_adpcm1 = machine().device<msm5205_device>("msm1"); m_adpcm2 = machine().device<msm5205_device>("msm2"); - m_ay1 = machine().device<ay8910_device>("ay1"); - m_ay2 = machine().device<ay8910_device>("ay2"); + m_ay_45L = machine().device<ay8910_device>("ay_45l"); + m_ay_45M = machine().device<ay8910_device>("ay_45m"); + + m_audio_BD = machine().device<netlist_mame_logic_input_t>("snd_nl:ibd"); + m_audio_SD = machine().device<netlist_mame_logic_input_t>("snd_nl:isd"); + m_audio_OH = machine().device<netlist_mame_logic_input_t>("snd_nl:ioh"); + m_audio_CH = machine().device<netlist_mame_logic_input_t>("snd_nl:ich"); + m_audio_SINH = machine().device<netlist_mame_logic_input_t>("snd_nl:sinh"); save_item(NAME(m_port1)); save_item(NAME(m_port2)); @@ -90,17 +98,17 @@ WRITE8_MEMBER( irem_audio_device::m6803_port2_w ) { /* PSG 0 or 1? */ if (m_port2 & 0x08) - m_ay1->address_w(space, 0, m_port1); + m_ay_45M->address_w(space, 0, m_port1); if (m_port2 & 0x10) - m_ay2->address_w(space, 0, m_port1); + m_ay_45L->address_w(space, 0, m_port1); } else { /* PSG 0 or 1? */ if (m_port2 & 0x08) - m_ay1->data_w(space, 0, m_port1); + m_ay_45M->data_w(space, 0, m_port1); if (m_port2 & 0x10) - m_ay2->data_w(space, 0, m_port1); + m_ay_45L->data_w(space, 0, m_port1); } } m_port2 = data; @@ -118,15 +126,20 @@ READ8_MEMBER( irem_audio_device::m6803_port1_r ) { /* PSG 0 or 1? */ if (m_port2 & 0x08) - return m_ay1->data_r(space, 0); + return m_ay_45M->data_r(space, 0); if (m_port2 & 0x10) - return m_ay2->data_r(space, 0); + return m_ay_45L->data_r(space, 0); return 0xff; } READ8_MEMBER( irem_audio_device::m6803_port2_r ) { + /* + * Pin21, 6803 (Port 21) tied with 4.7k to +5V + * + */ + printf("port2 read\n"); return 0; } @@ -138,7 +151,7 @@ READ8_MEMBER( irem_audio_device::m6803_port2_r ) * *************************************/ -WRITE8_MEMBER( irem_audio_device::ay8910_0_portb_w ) +WRITE8_MEMBER( irem_audio_device::ay8910_45M_portb_w ) { /* bits 2-4 select MSM5205 clock & 3b/4b playback mode */ m_adpcm1->playmode_w((data >> 2) & 7); @@ -152,15 +165,19 @@ WRITE8_MEMBER( irem_audio_device::ay8910_0_portb_w ) } -WRITE8_MEMBER( irem_audio_device::ay8910_1_porta_w ) +WRITE8_MEMBER( irem_audio_device::ay8910_45L_porta_w ) { /* - * 45L 21 IOA0 ==> 8D + * 45L 21 IOA0 ==> BD * 45L 20 IOA1 ==> SD * 45L 19 IOA2 ==> OH * 45L 18 IOA3 ==> CH * */ + if (m_audio_BD) m_audio_BD->write_line(data & 0x01 ? 1: 0); + if (m_audio_SD) m_audio_SD->write_line(data & 0x02 ? 1: 0); + if (m_audio_OH) m_audio_OH->write_line(data & 0x04 ? 1: 0); + if (m_audio_CH) m_audio_CH->write_line(data & 0x08 ? 1: 0); #ifdef MAME_DEBUG if (data & 0x0f) popmessage("analog sound %x",data&0x0f); #endif @@ -362,7 +379,119 @@ static ADDRESS_MAP_START( irem_sound_portmap, AS_IO, 8, driver_device ) AM_RANGE(M6801_PORT2, M6801_PORT2) AM_DEVREADWRITE("irem_audio", irem_audio_device, m6803_port2_r, m6803_port2_w) ADDRESS_MAP_END +/* + * Original recordings: + * + * https://www.youtube.com/watch?v=Hr1wZpwP7R4 + * + * This is not an original recording ("drums added") + * + * https://www.youtube.com/watch?v=aarl0xfBQf0 + * + */ +#define USE_FRONTIERS 1 +#define USE_FIXED_STV 1 + +#include "nl_kidniki.c" + +NETLIST_START(kidniki_interface) +#if 0 + SOLVER(Solver, 12000) + PARAM(Solver.ACCURACY, 1e-8) + PARAM(Solver.NR_LOOPS, 300) + PARAM(Solver.GS_LOOPS, 2) +#else + SOLVER(Solver, 12000) + PARAM(Solver.ACCURACY, 1e-9) + PARAM(Solver.NR_LOOPS, 300) + PARAM(Solver.GS_LOOPS, 1) + PARAM(Solver.GS_THRESHOLD, 99) + PARAM(Solver.ITERATIVE, "SOR") +#endif + //PARAM(Solver.GS_THRESHOLD, 99) // Force Gaussian elimination here + PARAM(Solver.SOR_FACTOR, 1.00) + //FIXME proper models! + NET_MODEL(".model 2SC945 NPN(Is=2.04f Xti=3 Eg=1.11 Vaf=6 Bf=400 Ikf=20m Xtb=1.5 Br=3.377 Rc=1 Cjc=1p Mjc=.3333 Vjc=.75 Fc=.5 Cje=25p Mje=.3333 Vje=.75 Tr=450n Tf=20n Itf=0 Vtf=0 Xtf=0 VCEO=45V ICrating=150M MFG=Toshiba)") + NET_MODEL(".model 1S1588 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)") + + LOCAL_SOURCE(kidniki_schematics) + + /* + * Workaround: The simplified opamp model does not correctly + * model the internals of the inputs. + */ + + ANALOG_INPUT(VWORKAROUND, 2.061) + RES(RWORKAROUND, RES_K(27)) + NET_C(VWORKAROUND.Q, RWORKAROUND.1) + NET_C(XU1.6, RWORKAROUND.2) + + ANALOG_INPUT(I_V5, 5) + //ANALOG_INPUT(I_V0, 0) + ALIAS(I_V0.Q, GND) + + /* AY 8910 internal resistors */ + + RES(R_AY45L_A, 1000) + RES(R_AY45L_B, 1000) + RES(R_AY45L_C, 1000) + + RES(R_AY45M_A, 1000) + RES(R_AY45M_B, 1000) + RES(R_AY45M_C, 1000) + NET_C(I_V5, R_AY45L_A.1, R_AY45L_B.1, R_AY45L_C.1, R_AY45M_A.1, R_AY45M_B.1, R_AY45M_C.1) + NET_C(R_AY45L_A.2, R_AY45L_B.2, R_AY45M_A.2, R_AY45M_B.2, R_AY45M_C.2) + + ALIAS(I_SOUNDIC0, R_AY45L_C.2) + ALIAS(I_SOUND0, R_AY45L_A.2) + + /* On M62 boards with pcb pictures available + * D6 is missing, although the pcb print exists. + * We are replacing this with a 10m Resistor. + */ + TTL_INPUT(SINH, 1) +#if 0 + DIODE(D6, "1N914") + NET_C(D6.K, SINH) + ALIAS(I_SINH0, D6.A) +#else + RES(SINH_DUMMY, RES_M(10)) + NET_C(SINH_DUMMY.1, SINH) + ALIAS(I_SINH0, SINH_DUMMY.2) +#endif + + TTL_INPUT(I_SD0, 1) + //CLOCK(I_SD0, 5) + TTL_INPUT(I_BD0, 1) + //CLOCK(I_BD0, 5) + TTL_INPUT(I_CH0, 1) + //CLOCK(I_CH0, 2.2 ) + TTL_INPUT(I_OH0, 1) + //CLOCK(I_OH0, 1.0) + ANALOG_INPUT(I_MSM2K0, 0) + ANALOG_INPUT(I_MSM3K0, 0) + + INCLUDE(kidniki_schematics) + + CAP(C26, CAP_U(1)) + RES(R25, 560) + RES(R26, RES_K(47)) + CAP(C29, CAP_U(0.01)) + + NET_C(RV1.2, C26.1) + NET_C(C26.2, R25.1) + NET_C(R25.2, R26.1, C29.1) + NET_C(R26.2, C29.2, GND) + + #if (USE_FRONTIERS) + OPTIMIZE_FRONTIER(C63.2, RES_K(27), RES_K(1)) + OPTIMIZE_FRONTIER(R31.2, RES_K(5.1), 50) + OPTIMIZE_FRONTIER(R29.2, RES_K(2.7), 50) + OPTIMIZE_FRONTIER(R87.2, RES_K(68), 50) + #endif + +NETLIST_END() /************************************* * @@ -381,27 +510,63 @@ static MACHINE_CONFIG_FRAGMENT( irem_audio_base ) MCFG_SOUND_ADD("irem_audio", IREM_AUDIO, 0) - MCFG_SOUND_ADD("ay1", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT | AY8910_DISCRETE_OUTPUT) - MCFG_AY8910_RES_LOADS(470, 0, 0) + MCFG_SOUND_ADD("ay_45m", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ + MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) + MCFG_AY8910_RES_LOADS(2000.0, 2000.0, 2000.0) MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_0_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - MCFG_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT | AY8910_DISCRETE_OUTPUT) - MCFG_AY8910_RES_LOADS(470, 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_1_porta_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_45M_portb_w)) + MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0) + MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1) + MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2) + + MCFG_SOUND_ADD("ay_45l", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ + MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) + MCFG_AY8910_RES_LOADS(2000.0, 2000.0, 2000.0) + MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_45L_porta_w)) + MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 3) + MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 4) + MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 5) MCFG_SOUND_ADD("msm1", MSM5205, XTAL_384kHz) /* verified on pcb */ MCFG_MSM5205_VCLK_CB(DEVWRITELINE("irem_audio", irem_audio_device, adpcm_int)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) /* default to 4KHz, but can be changed at run time */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 6) MCFG_SOUND_ADD("msm2", MSM5205, XTAL_384kHz) /* verified on pcb */ MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_SEX_4B) /* default to 4KHz, but can be changed at run time, slave */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 7) + + /* NETLIST configuration using internal AY8910 resistor values */ + + MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000) + MCFG_NETLIST_SETUP(kidniki_interface) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "ibd", "I_BD0.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "isd", "I_SD0.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "ich", "I_CH0.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "ioh", "I_OH0.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "sinh", "SINH.IN", 0, 1) + + MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY45M_A.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY45M_B.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY45M_C.R") + + MCFG_NETLIST_STREAM_INPUT("snd_nl", 3, "R_AY45L_A.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 4, "R_AY45L_B.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 5, "R_AY45L_C.R") + + + MCFG_NETLIST_STREAM_INPUT("snd_nl", 6, "I_MSM2K0.IN") + MCFG_NETLIST_ANALOG_MULT_OFFSET(5.0/65535.0, 2.5) + MCFG_NETLIST_STREAM_INPUT("snd_nl", 7, "I_MSM3K0.IN") + MCFG_NETLIST_ANALOG_MULT_OFFSET(5.0/65535.0, 2.5) + + //MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "RV1.1") + //MCFG_NETLIST_ANALOG_MULT_OFFSET(30000.0, -35000.0) + MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "R26.1") + MCFG_NETLIST_ANALOG_MULT_OFFSET(30000.0 * 10.0, 0.0) + MACHINE_CONFIG_END MACHINE_CONFIG_FRAGMENT( m52_sound_c_audio ) @@ -416,17 +581,17 @@ MACHINE_CONFIG_FRAGMENT( m52_sound_c_audio ) MCFG_SOUND_ADD("irem_audio", IREM_AUDIO, 0) - MCFG_SOUND_ADD("ay1", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ + MCFG_SOUND_ADD("ay_45m", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT | AY8910_DISCRETE_OUTPUT) MCFG_AY8910_RES_LOADS(470, 0, 0) MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_0_portb_w)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_45M_portb_w)) MCFG_SOUND_ROUTE_EX(0, "filtermix", 1.0, 0) - MCFG_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ + MCFG_SOUND_ADD("ay_45l", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */ MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT | AY8910_DISCRETE_OUTPUT) MCFG_AY8910_RES_LOADS(470, 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_1_porta_w)) + MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("irem_audio", irem_audio_device, ay8910_45L_porta_w)) MCFG_SOUND_ROUTE_EX(0, "filtermix", 1.0, 1) MCFG_SOUND_ADD("msm1", MSM5205, XTAL_384kHz) /* verified on pcb */ diff --git a/src/mame/audio/irem.h b/src/mame/audio/irem.h index 863fc992c6d..aa59e4e5c63 100644 --- a/src/mame/audio/irem.h +++ b/src/mame/audio/irem.h @@ -2,6 +2,7 @@ // copyright-holders:Couriersud #include "sound/ay8910.h" #include "sound/msm5205.h" +#include "machine/netlist.h" class irem_audio_device : public device_t, public device_sound_interface @@ -15,14 +16,16 @@ public: DECLARE_WRITE8_MEMBER( m6803_port2_w ); DECLARE_READ8_MEMBER( m6803_port1_r ); DECLARE_READ8_MEMBER( m6803_port2_r ); - DECLARE_WRITE8_MEMBER( ay8910_0_portb_w ); - DECLARE_WRITE8_MEMBER( ay8910_1_porta_w ); + DECLARE_WRITE8_MEMBER( ay8910_45M_portb_w ); + DECLARE_WRITE8_MEMBER( ay8910_45L_porta_w ); DECLARE_WRITE8_MEMBER( sound_irq_ack_w ); DECLARE_WRITE8_MEMBER( m52_adpcm_w ); DECLARE_WRITE8_MEMBER( m62_adpcm_w ); void adpcm_int(int st); + netlist_mame_logic_input_t * m_audio_SINH; + protected: // device-level overrides virtual void device_config_complete(); @@ -36,10 +39,18 @@ private: UINT8 m_port1; UINT8 m_port2; - ay8910_device *m_ay1; - ay8910_device *m_ay2; + /* FIXME: using required / optional device would be better */ + // required_device<ay8910_device> m_ay_45L; + // required_device<ay8910_device> m_ay_45M; + ay8910_device *m_ay_45L; + ay8910_device *m_ay_45M; msm5205_device *m_adpcm1; msm5205_device *m_adpcm2; + + netlist_mame_logic_input_t * m_audio_BD; + netlist_mame_logic_input_t * m_audio_SD; + netlist_mame_logic_input_t * m_audio_OH; + netlist_mame_logic_input_t * m_audio_CH; }; MACHINE_CONFIG_EXTERN( m52_sound_c_audio ); diff --git a/src/mame/audio/nl_kidniki.c b/src/mame/audio/nl_kidniki.c new file mode 100644 index 00000000000..5eaea584553 --- /dev/null +++ b/src/mame/audio/nl_kidniki.c @@ -0,0 +1,427 @@ + +#include "netlist/devices/net_lib.h" + +#ifndef USE_FRONTIERS +#define USE_FRONTIERS 0 +#endif + +#ifndef USE_FIXED_STV +#define USE_FIXED_STV 0 +#endif + +NETLIST_EXTERNAL(LM324_DIP) +NETLIST_EXTERNAL(LM358_DIP) + +#ifndef __PLIB_PREPROCESSOR__ +#define MC14584B_GATE(_name) \ + NET_REGISTER_DEV_X(MC14584B_GATE, _name) +#endif + +NETLIST_START(kidniki_lib) + TRUTHTABLE_START(MC14584B_GATE, 1, 1, 0, "A,B") + TT_HEAD(" A | Q ") + TT_LINE(" 0 | 1 |100") + TT_LINE(" 1 | 0 |100") + TT_FAMILY(".model MC14584B FAMILY(IVL=2.1 IVH=2.7 OVL=0.05 OVH=4.95 ORL=10.0 ORH 10.0)") + TRUTHTABLE_END() +NETLIST_END() + +NETLIST_START(MC14584B_DIP) + MC14584B_GATE(s1) + MC14584B_GATE(s2) + MC14584B_GATE(s3) + MC14584B_GATE(s4) + MC14584B_GATE(s5) + MC14584B_GATE(s6) + + ALIAS( 1, s1.A) + ALIAS( 2, s1.Q) + ALIAS( 3, s2.A) + ALIAS( 4, s2.Q) + ALIAS( 5, s3.A) + ALIAS( 6, s3.Q) + + ALIAS( 8, s4.Q) + ALIAS( 9, s4.A) + ALIAS(10, s5.Q) + ALIAS(11, s5.A) + ALIAS(12, s6.Q) + ALIAS(13, s6.A) +NETLIST_END() + +NETLIST_START(kidniki_schematics) + // EESCHEMA NETLIST VERSION 1.1 (SPICE FORMAT) CREATION DATE: SAT 06 JUN 2015 01:06:26 PM CEST + // TO EXCLUDE A COMPONENT FROM THE SPICE NETLIST ADD [SPICE_NETLIST_ENABLED] USER FIELD SET TO: N + // TO REORDER THE COMPONENT SPICE NODE SEQUENCE ADD [SPICE_NODE_SEQUENCE] USER FIELD AND DEFINE SEQUENCE: 2,1,0 + // SHEET NAME:/ + // IGNORED O_AUDIO0: O_AUDIO0 49 0 + // .END + + LOCAL_SOURCE(kidniki_lib) + + INCLUDE(kidniki_lib) + + CAP(C200, CAP_N(100)) + CAP(C28, CAP_U(1)) + CAP(C31, CAP_N(470)) + CAP(C32, CAP_N(3.3)) + CAP(C33, CAP_U(1)) + CAP(C34, CAP_N(1)) + CAP(C35, CAP_N(1)) + CAP(C36, CAP_N(6.5)) + CAP(C37, CAP_N(22)) + CAP(C38, CAP_N(1)) + CAP(C39, CAP_N(1)) + CAP(C40, CAP_P(12)) + CAP(C41, CAP_U(1)) + CAP(C42, CAP_N(1.2)) + CAP(C43, CAP_N(1.2)) + CAP(C44, CAP_U(1)) + CAP(C45, CAP_N(22)) + CAP(C47, CAP_U(1)) + CAP(C48, CAP_N(470)) + CAP(C49, CAP_N(3.3)) + CAP(C50, CAP_N(22)) + CAP(C51, CAP_N(22)) + CAP(C52, CAP_N(27)) + CAP(C53, CAP_N(27)) + CAP(C56, CAP_N(6.8)) + CAP(C57, CAP_N(6.8)) + CAP(C59, CAP_N(6.8)) + CAP(C60, CAP_N(22)) + CAP(C61, CAP_N(22)) + CAP(C62, CAP_N(6.8)) + CAP(C63, CAP_N(1)) + CAP(C64, CAP_N(68)) + CAP(C65, CAP_N(68)) + CAP(C66, CAP_N(68)) + CAP(C67, CAP_N(15)) + CAP(C68, CAP_N(15)) + CAP(C69, CAP_N(10)) + CAP(C70, CAP_N(22)) + CAP(C72, CAP_N(12)) + CAP(C73, CAP_N(10)) + CAP(C76, CAP_N(68)) + CAP(C77, CAP_N(12)) + + DIODE(D3, "1S1588") + DIODE(D4, "1S1588") + DIODE(D5, "1S1588") + + POT(RV1, RES_K(50)) + + QBJT_EB(Q10, "2SC945") + QBJT_EB(Q3, "2SC945") + QBJT_EB(Q4, "2SC945") + QBJT_EB(Q5, "2SC945") + QBJT_EB(Q6, "2SC945") + QBJT_EB(Q7, "2SC945") + QBJT_EB(Q9, "2SC945") + + SUBMODEL(LM324_DIP,XU1) + SUBMODEL(LM358_DIP,XU2) + + SUBMODEL(MC14584B_DIP, XU3) + + RES(R100, RES_K(560)) + RES(R101, RES_K(150)) + RES(R102, RES_K(150)) + RES(R103, RES_K(470)) + RES(R104, RES_K(22)) + RES(R105, RES_K(470)) + RES(R106, RES_K(150)) + RES(R107, RES_K(150)) + RES(R108, RES_K(560)) + RES(R119, RES_K(22)) + RES(R200, RES_K(100)) + RES(R201, RES_K(100)) + RES(R27, RES_K(6.8)) + RES(R28, RES_K(150)) + RES(R29, RES_K(2.7)) + RES(R30, RES_K(10)) + RES(R31, RES_K(5.1)) + RES(R32, RES_K(4.7)) + RES(R34, RES_K(100)) + RES(R35, RES_K(100)) + RES(R36, RES_K(100)) + RES(R37, RES_K(47)) + RES(R38, 820) + RES(R39, RES_K(22)) + RES(R40, RES_K(10)) + RES(R41, RES_K(10)) + RES(R42, RES_K(150)) + RES(R43, 470) + RES(R44, RES_K(100)) + RES(R45, RES_K(1)) + RES(R46, RES_K(12)) + RES(R48, 470) + RES(R48_2, RES_K(100)) + RES(R49, RES_K(10)) + RES(R50, RES_K(2.2)) + RES(R51, RES_K(150)) + RES(R52, RES_K(100)) + RES(R53, RES_K(100)) + RES(R54, RES_K(680)) + RES(R55, RES_K(510)) + RES(R57, 560) + RES(R58, RES_K(39)) + RES(R59, 560) + RES(R60, RES_K(39)) + RES(R61, RES_K(100)) + RES(R62, RES_K(100)) + RES(R63, RES_K(1)) + RES(R65, RES_K(1)) + RES(R65_1, RES_K(27)) + RES(R66, RES_M(1)) + RES(R67, RES_K(100)) + RES(R68, RES_K(100)) + RES(R69, RES_K(1)) + RES(R70, RES_K(10)) + RES(R71, RES_K(100)) + RES(R72, RES_K(100)) + RES(R73, RES_K(10)) + RES(R74, RES_K(10)) + RES(R75, RES_K(10)) + RES(R76, RES_K(10)) + RES(R81, 220) + RES(R82, RES_M(2.2)) + RES(R83, RES_K(12)) + RES(R84, RES_K(1)) + RES(R85, RES_M(2.2)) + RES(R86, RES_K(10)) + RES(R87, RES_K(68)) + RES(R89, RES_K(22)) + RES(R90, RES_K(390)) + RES(R91, RES_K(100)) + RES(R92, RES_K(22)) + RES(R93, RES_K(1)) + RES(R94, RES_K(22)) + RES(R95, RES_K(330)) + RES(R96, RES_K(150)) + RES(R97, RES_K(150)) + RES(R98, RES_K(650)) + + #if USE_FIXED_STV + ANALOG_INPUT(STV, 2) + #else + RES(R78, RES_K(3.3)) + RES(R77, RES_K(2.2)) + CAP(C58, CAP_U(47)) + #endif + + NET_C(R95.1, XU3.2, R96.2) + NET_C(R95.2, XU3.1, C69.1) + NET_C(XU3.3, R103.2, C73.1) + NET_C(XU3.4, R103.1, R102.2) + NET_C(XU3.5, R105.2, C72.1) + NET_C(XU3.6, R105.1, R106.2) + #if USE_FIXED_STV + //FIXME: We should have a NET_C_REMOVE + NET_C(/*XU3.7,*/ C69.2, C73.2, C72.2, C77.2, C67.2, C68.2, R65.2, R38.2, XU1.11, R54.2, Q4.E, R63.2, C47.2, R72.2, R67.2, R71.2, R68.2, C48.2, R46.2, C28.1, C32.1, R43.2, XU2.4, C56.1, C52.1,/* R77.2, C58.1, */ R48.2, R93.2, R94.2, R119.2, R104.2, R53.2, R34.2, R81.2, R92.2, R89.2, C33.1, R37.2, R36.1, R91.1, I_V0.Q, RV1.3) + #else + NET_C(/*XU3.7,*/ C69.2, C73.2, C72.2, C77.2, C67.2, C68.2, R65.2, R38.2, XU1.11, R54.2, Q4.E, R63.2, C47.2, R72.2, R67.2, R71.2, R68.2, C48.2, R46.2, C28.1, C32.1, R43.2, XU2.4, C56.1, C52.1, R77.2, C58.1, R48.2, R93.2, R94.2, R119.2, R104.2, R53.2, R34.2, R81.2, R92.2, R89.2, C33.1, R37.2, R36.1, R91.1, I_V0.Q, RV1.3) + #endif + NET_C(XU3.8, R108.1, R107.2) + NET_C(XU3.9, R108.2, C77.1) + NET_C(XU3.10, R100.1, R101.2) + NET_C(XU3.11, R100.2, C67.1) + NET_C(XU3.12, R98.1, R97.2) + NET_C(XU3.13, R98.2, C68.1) + #if USE_FIXED_STV + NET_C(/*XU3.14,*/ XU1.4, R66.1, R70.1, Q6.C, Q5.C, XU2.8, /* R78.1, */ R86.1, R83.1, Q3.C, I_V5.Q) + #else + NET_C(/*XU3.14,*/ XU1.4, R66.1, R70.1, Q6.C, Q5.C, XU2.8, R78.1, R86.1, R83.1, Q3.C, I_V5.Q) + #endif + NET_C(R96.1, R102.1, R106.1, R107.1, R101.1, R97.1, R65.1, C63.2) + NET_C(C63.1, R65_1.2) + NET_C(R65_1.1, R44.2, C38.2, C40.2, XU1.6) + #if USE_FIXED_STV + NET_C(R30.1, R41.1, R40.1, STV, R76.2, /* R78.2, R77.1, C58.2*/ STV) + #else + NET_C(R30.1, R41.1, R40.1, R76.2, R78.2, R77.1, C58.2) + #endif + NET_C(R30.2, XU1.5) + NET_C(R44.1, C39.1, C40.1, R48_2.2) + NET_C(C38.1, C39.2, R38.1) + NET_C(XU1.1, XU1.2, R39.1, R32.2) + NET_C(XU1.3, C34.1, R41.2) + NET_C(XU1.7, R45.2) + NET_C(XU1.8, XU1.9, R31.2, C36.2) + NET_C(XU1.10, R42.1, C32.2) + NET_C(XU1.12, C49.1, C31.1, R40.2, C61.1, C60.1) + NET_C(XU1.13, R27.1, R28.2) + NET_C(XU1.14, R28.1, R29.2, I_SINH0) + NET_C(R48_2.1, C45.2, R54.1) + NET_C(C45.1, R55.1, Q7.B) + NET_C(R55.2, R90.2, C33.2, R37.1, Q3.E) + NET_C(R45.1, C44.2) + NET_C(C44.1, R66.2, Q4.B) + NET_C(Q4.C, C42.1, C43.1, R46.1, C35.2, D4.K, D5.K) + NET_C(R70.2, R69.2, Q7.C) + NET_C(R63.1, Q7.E) + NET_C(R69.1, C49.2) + NET_C(C42.2, R58.1, D5.A) + NET_C(R58.2, R57.1, C47.1) + NET_C(R57.2, Q6.E) + NET_C(Q6.B, R61.1) + NET_C(C50.1, R67.1, R61.2) + NET_C(C50.2, R72.1, I_OH0.Q) + NET_C(C51.1, R68.1, R62.2) + NET_C(C51.2, R71.1, I_CH0.Q) + NET_C(R62.1, Q5.B) + NET_C(Q5.E, R59.2) + NET_C(R60.1, C43.2, D4.A) + NET_C(R60.2, R59.1, C48.1) + NET_C(C35.1, C34.2, R39.2) + NET_C(R32.1, C31.2) + NET_C(R27.2, C28.2) + NET_C(R29.1, R31.1, R50.2, R49.1, RV1.1) + NET_C(R42.2, R51.1, C36.1) + NET_C(R51.2, C41.1) + NET_C(C41.2, R43.1, I_SOUNDIC0) + NET_C(XU2.1, XU2.2, R73.1) + NET_C(XU2.3, R76.1, C200.2) + NET_C(XU2.5, C56.2, R75.1) + NET_C(XU2.6, XU2.7, R50.1, C53.2) + NET_C(R75.2, R74.1, C53.1) + NET_C(R74.2, C52.2, R73.2) + NET_C(R49.2, R48.1, I_SOUND0) + NET_C(Q9.E, R81.1) + NET_C(Q9.C, R84.2, R83.2, R82.1, C59.1) + NET_C(Q9.B, R82.2, C62.1) + NET_C(Q10.E, R93.1) + NET_C(Q10.C, R87.2, R86.2, R85.1, C76.1) + NET_C(Q10.B, R85.2, C64.1) + NET_C(R84.1, C61.2) + NET_C(C60.2, R87.1) + NET_C(C64.2, C65.1, R94.1, D3.K) + NET_C(C65.2, C66.1, R119.1) + NET_C(C66.2, C76.2, R104.1) + NET_C(R53.1, R52.2, C37.1) + NET_C(R34.1, C37.2, I_BD0.Q) + NET_C(R52.1, D3.A) + NET_C(R92.1, C62.2, C57.1) + NET_C(R89.1, C57.2, C59.2, R90.1) + NET_C(Q3.B, R35.1) + NET_C(R35.2, R36.2, C70.1) + NET_C(R91.2, C70.2, I_SD0.Q) + NET_C(I_MSM3K0.Q, R200.2) + NET_C(I_MSM2K0.Q, R201.2) + NET_C(R200.1, R201.1, C200.1) +NETLIST_END() + +NETLIST_START(opamp) + + /* Opamp model from + * + * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm + * + * Bandwidth 1Mhz + * + */ + + /* Terminal definitions for calling netlists */ + + ALIAS(PLUS, G1.IP) // Positive input + ALIAS(MINUS, G1.IN) // Negative input + ALIAS(OUT, EBUF.OP) // Opamp output ... + + ALIAS(GND, EBUF.ON) // GND terminal + ALIAS(VCC, DUMMY.I) // VCC terminal + DUMMY_INPUT(DUMMY) + + /* The opamp model */ + + VCCS(G1) + PARAM(G1.RI, RES_K(1000)) +#if 1 + PARAM(G1.G, 100) // typical OP-AMP amplification 100 * 1000 = 100000 + RES(RP1, 1000) + CAP(CP1, 1.59e-5) // <== change to 1.59e-3 for 10Khz bandwidth +#else + PARAM(G1.G, 1) // typical OP-AMP amplification 100 * 1000 = 100000 + RES(RP1, 100000) + CAP(CP1, 1.59e-7) // <== change to 1.59e-3 for 10Khz bandwidth +#endif + VCVS(EBUF) + PARAM(EBUF.RO, 50) + PARAM(EBUF.G, 1) + +// PARAM(EBUF.RI, 1e20) +// NET_C(EBUF.ON, GND) + + NET_C(G1.ON, GND) + NET_C(RP1.2, GND) + NET_C(CP1.2, GND) + NET_C(EBUF.IN, GND) + + NET_C(RP1.1, G1.OP) + NET_C(CP1.1, RP1.1) + + DIODE(DP,"1N914") + DIODE(DN,"1N914") + + NET_C(DP.K, VCC) +#if 1 + NET_C(DP.A, DN.K, RP1.1) +#else + RES(RDP, 1000) + RES(RDN, 1000) + NET_C(RDP.1, DP.A) + NET_C(RDN.1, DN.K) + NET_C(RDP.2, RDN.2, RP1.1) +#endif + NET_C(DN.A, GND) + + NET_C(EBUF.IP, RP1.1) + +NETLIST_END() + +NETLIST_START(LM324_DIP) + SUBMODEL(opamp, op1) + SUBMODEL(opamp, op2) + SUBMODEL(opamp, op3) + SUBMODEL(opamp, op4) + + ALIAS( 1, op1.OUT) + ALIAS( 2, op1.MINUS) + ALIAS( 3, op1.PLUS) + + ALIAS( 7, op2.OUT) + ALIAS( 6, op2.MINUS) + ALIAS( 5, op2.PLUS) + + ALIAS( 8, op3.OUT) + ALIAS( 9, op3.MINUS) + ALIAS(10, op3.PLUS) + + ALIAS(14, op4.OUT) + ALIAS(13, op4.MINUS) + ALIAS(12, op4.PLUS) + + NET_C(op1.GND, op2.GND, op3.GND, op4.GND) + NET_C(op1.VCC, op2.VCC, op3.VCC, op4.VCC) + + ALIAS(11, op1.GND) + ALIAS( 4, op1.VCC) +NETLIST_END() + +NETLIST_START(LM358_DIP) + SUBMODEL(opamp, op1) + SUBMODEL(opamp, op2) + + ALIAS( 1, op1.OUT) + ALIAS( 2, op1.MINUS) + ALIAS( 3, op1.PLUS) + + ALIAS( 7, op2.OUT) + ALIAS( 6, op2.MINUS) + ALIAS( 5, op2.PLUS) + + + NET_C(op1.GND, op2.GND) + NET_C(op1.VCC, op2.VCC) + + ALIAS( 4, op1.GND) + ALIAS( 8, op1.VCC) +NETLIST_END() diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index 9e64e9ef6b0..e1a0b0aaa5b 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -83,6 +83,13 @@ seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char m_rst10_irq(0xff), m_rst18_irq(0xff) { + m_encryption_mode = 0; + m_decrypted_opcodes = NULL; +} + +void seibu_sound_device::set_encryption(int mode) +{ + m_encryption_mode = mode; } //------------------------------------------------- @@ -91,6 +98,32 @@ seibu_sound_device::seibu_sound_device(const machine_config &mconfig, const char void seibu_sound_device::device_start() { + int length = memregion(":audiocpu")->bytes(); + UINT8 *rom = memregion(":audiocpu")->base(); + if (length > 0x10000) + { + membank(":seibu_bank1")->configure_entries(0, (length - 0x10000) / 0x8000, rom + 0x10000, 0x8000); + + /* Denjin Makai definitely needs this at start-up, it never writes to the bankswitch */ + membank(":seibu_bank1")->set_entry(0); + } + + switch(m_encryption_mode) { + case 0: break; + case 3: break; + + case 1: + get_custom_decrypt(); + memcpy(m_decrypted_opcodes, rom, length); + apply_decrypt(rom, m_decrypted_opcodes, 0x2000); + break; + + case 2: + get_custom_decrypt(); + apply_decrypt(rom, m_decrypted_opcodes, length); + break; + } + m_main2sub[0] = m_main2sub[1] = 0; m_sub2main[0] = m_sub2main[1] = 0; @@ -108,18 +141,8 @@ void seibu_sound_device::device_start() void seibu_sound_device::device_reset() { - int romlength = machine().root_device().memregion("audiocpu")->bytes(); - UINT8 *rom = machine().root_device().memregion("audiocpu")->base(); - - m_sound_cpu = machine().device("audiocpu"); + m_sound_cpu = machine().device(":audiocpu"); update_irq_lines(VECTOR_INIT); - if (romlength > 0x10000) - { - machine().root_device().membank("bank1")->configure_entries(0, (romlength - 0x10000) / 0x8000, rom + 0x10000, 0x8000); - - /* Denjin Makai definitely needs this at start-up, it never writes to the bankswitch */ - machine().root_device().membank("bank1")->set_entry(0); - } } static UINT8 decrypt_data(int a,int src) @@ -155,25 +178,32 @@ static UINT8 decrypt_opcode(int a,int src) return src; } -void seibu_sound_device::decrypt(const char *cpu,int length) +UINT8 *seibu_sound_device::get_custom_decrypt() { - address_space &space = machine().device(cpu)->memory().space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array_clear(machine(), UINT8, length); - UINT8 *rom = machine().root_device().memregion(cpu)->base(); - int i; - - space.set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt); + if (m_decrypted_opcodes) + return m_decrypted_opcodes; + + int size = memregion(":audiocpu")->bytes(); + m_decrypted_opcodes = auto_alloc_array_clear(machine(), UINT8, size); + membank(":seibu_bank0d")->set_base(m_decrypted_opcodes); + if (size > 0x10000) { + membank(":seibu_bank1d")->configure_entries(0, (size - 0x10000) / 0x8000, m_decrypted_opcodes + 0x10000, 0x8000); + membank(":seibu_bank1d")->set_entry(0); + } else + membank(":seibu_bank1d")->set_base(m_decrypted_opcodes + 0x8000); + + return m_decrypted_opcodes; +} - for (i = 0;i < length;i++) +void seibu_sound_device::apply_decrypt(UINT8 *rom, UINT8 *opcodes, int length) +{ + for (int i = 0;i < length;i++) { UINT8 src = rom[i]; rom[i] = decrypt_data(i,src); - decrypt[i] = decrypt_opcode(i,src); + opcodes[i] = decrypt_opcode(i,src); } - - if (length > 0x10000) - machine().root_device().membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000); } void seibu_sound_device::update_irq_lines(int param) @@ -238,7 +268,9 @@ WRITE_LINE_MEMBER( seibu_sound_device::fm_irqhandler ) WRITE8_MEMBER( seibu_sound_device::bank_w ) { - space.machine().root_device().membank("bank1")->set_entry(data & 1); + membank(":seibu_bank1")->set_entry(data & 1); + if (m_decrypted_opcodes) + membank(":seibu_bank1d")->set_entry(data & 1); } WRITE8_MEMBER( seibu_sound_device::coin_w ) @@ -326,6 +358,11 @@ WRITE16_MEMBER( seibu_sound_device::main_mustb_w ) /***************************************************************************/ +ADDRESS_MAP_START( seibu_sound_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, driver_device ) + AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("seibu_bank0d") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1d") +ADDRESS_MAP_END + ADDRESS_MAP_START( seibu_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x27ff) AM_RAM @@ -341,7 +378,7 @@ ADDRESS_MAP_START( seibu_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x4018, 0x4019) AM_DEVWRITE("seibu_sound", seibu_sound_device, main_data_w) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END ADDRESS_MAP_START( seibu2_airraid_sound_map, AS_PROGRAM, 8, driver_device ) @@ -359,7 +396,7 @@ ADDRESS_MAP_START( seibu2_airraid_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x4018, 0x4019) AM_DEVWRITE("seibu_sound", seibu_sound_device, main_data_w) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) // AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END ADDRESS_MAP_START( seibu2_sound_map, AS_PROGRAM, 8, driver_device ) @@ -377,7 +414,7 @@ ADDRESS_MAP_START( seibu2_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x4018, 0x4019) AM_DEVWRITE("seibu_sound", seibu_sound_device, main_data_w) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END ADDRESS_MAP_START( seibu2_raiden2_sound_map, AS_PROGRAM, 8, driver_device ) @@ -396,7 +433,7 @@ ADDRESS_MAP_START( seibu2_raiden2_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("oki1", okim6295_device, read, write) AM_RANGE(0x6002, 0x6002) AM_DEVREADWRITE("oki2", okim6295_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") AM_RANGE(0x4004, 0x4004) AM_NOP AM_RANGE(0x401a, 0x401a) AM_NOP ADDRESS_MAP_END @@ -416,7 +453,7 @@ ADDRESS_MAP_START( seibu_newzeroteam_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x401a, 0x401a) AM_DEVWRITE("seibu_sound", seibu_sound_device, bank_w) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END ADDRESS_MAP_START( seibu3_sound_map, AS_PROGRAM, 8, driver_device ) @@ -434,7 +471,7 @@ ADDRESS_MAP_START( seibu3_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x4018, 0x4019) AM_DEVWRITE("seibu_sound", seibu_sound_device, main_data_w) AM_RANGE(0x401b, 0x401b) AM_DEVWRITE("seibu_sound", seibu_sound_device, coin_w) AM_RANGE(0x6008, 0x6009) AM_DEVREADWRITE("ym2", ym2203_device, read, write) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END ADDRESS_MAP_START( seibu3_adpcm_sound_map, AS_PROGRAM, 8, driver_device ) @@ -456,7 +493,7 @@ ADDRESS_MAP_START( seibu3_adpcm_sound_map, AS_PROGRAM, 8, driver_device ) AM_RANGE(0x6005, 0x6006) AM_DEVWRITE("adpcm2", seibu_adpcm_device, adr_w) AM_RANGE(0x6008, 0x6009) AM_DEVREADWRITE("ym2", ym2203_device, read, write) AM_RANGE(0x601a, 0x601a) AM_DEVWRITE("adpcm2", seibu_adpcm_device, ctl_w) - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("seibu_bank1") ADDRESS_MAP_END /*************************************************************************** diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index a92ab8a5855..ca3fa2f11c2 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -31,6 +31,7 @@ #include "sound/2203intf.h" #include "sound/okim6295.h" +ADDRESS_MAP_EXTERN(seibu_sound_decrypted_opcodes_map, 8); ADDRESS_MAP_EXTERN(seibu_sound_map, 8); ADDRESS_MAP_EXTERN(seibu2_sound_map, 8); ADDRESS_MAP_EXTERN(seibu2_airraid_sound_map, 8); @@ -58,7 +59,10 @@ public: DECLARE_READ8_MEMBER( main_data_pending_r ); DECLARE_WRITE8_MEMBER( main_data_w ); DECLARE_WRITE8_MEMBER( pending_w ); - void decrypt(const char *cpu,int length); + + static void apply_decrypt(UINT8 *rom, UINT8 *opcodes, int length); + void set_encryption(int mode); + UINT8 *get_custom_decrypt(); void update_irq_lines(int param); protected: @@ -67,6 +71,9 @@ protected: virtual void device_reset(); private: + int m_encryption_mode; + UINT8 *m_decrypted_opcodes; + // internal state device_t *m_sound_cpu; UINT8 m_main2sub[2]; @@ -188,6 +195,24 @@ extern const device_type SEIBU_ADPCM; MCFG_CPU_PROGRAM_MAP(seibu3_adpcm_sound_map) \ MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0) +#define SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW() \ + MCFG_DEVICE_MODIFY("seibu_sound") \ + downcast<seibu_sound_device *>(device)->set_encryption(1); \ + MCFG_DEVICE_MODIFY("audiocpu") \ + MCFG_CPU_DECRYPTED_OPCODES_MAP(seibu_sound_decrypted_opcodes_map) + +#define SEIBU_SOUND_SYSTEM_ENCRYPTED_FULL() \ + MCFG_DEVICE_MODIFY("seibu_sound") \ + downcast<seibu_sound_device *>(device)->set_encryption(2); \ + MCFG_DEVICE_MODIFY("audiocpu") \ + MCFG_CPU_DECRYPTED_OPCODES_MAP(seibu_sound_decrypted_opcodes_map) + +#define SEIBU_SOUND_SYSTEM_ENCRYPTED_CUSTOM() \ + MCFG_DEVICE_MODIFY("seibu_sound") \ + downcast<seibu_sound_device *>(device)->set_encryption(3); \ + MCFG_DEVICE_MODIFY("audiocpu") \ + MCFG_CPU_DECRYPTED_OPCODES_MAP(seibu_sound_decrypted_opcodes_map) + #define SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(freq1,freq2) \ MCFG_SPEAKER_STANDARD_MONO("mono") \ \ diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c index 1f0ea7fc597..5fe1ad7cbfe 100644 --- a/src/mame/audio/suna8.c +++ b/src/mame/audio/suna8.c @@ -29,7 +29,7 @@ SAMPLES_START_CB_MEMBER(suna8_state::sh_start) WRITE8_MEMBER(suna8_state::suna8_samples_number_w) { - m_sample = data & 0xf; + m_sample = data; logerror("%s: sample number = %02X\n", machine().describe_context(), data); } @@ -49,30 +49,27 @@ void suna8_state::play_sample(int index) WRITE8_MEMBER(suna8_state::suna8_play_samples_w) { logerror("%s: play sample = %02X\n", machine().describe_context(), data); - if ( data ) - { - if ( ~data & 0x10 ) - { - play_sample(m_sample); - } - else if ( ~data & 0x08 ) - { - play_sample((m_sample & 3) + 7); - } - else if ( ~data & 0x40 ) // sparkman, second sample rom - { - play_sample(m_sample + 0x10); - } - } + + // At boot: ff (ay reset) -> 00 (game writes ay enable) -> f9 (game writes to port A). + // Then game writes f9 -> f1 -> f9. Is bit 3 stop/reset? + + if ( m_play == 0xe9 && data == 0xf9 ) + play_sample(m_sample & 0x0f); + else if ( m_play == 0xb9 && data == 0xf9 ) // second sample rom + play_sample(((m_sample >> 4) & 0x0f) + 0x10); + + m_play = data; } WRITE8_MEMBER(suna8_state::rranger_play_samples_w) { - if (data) - { - if (( m_sample != 0 ) && ( ~data & 0x30 )) // don't play sample zero when those bits are active - { - play_sample(m_sample); - } - } + logerror("%s: play sample = %02X\n", machine().describe_context(), data); + + // At boot: ff (ay reset) -> 00 (game writes ay enable) -> 30 (game writes to port A). + // Is bit 6 stop/reset? + + if ( m_play == 0x60 && data == 0x70 ) + play_sample(m_sample & 0x0f); + + m_play = data; } diff --git a/src/mame/audio/turrett.c b/src/mame/audio/turrett.c index 29b07dbb4c8..6a2fc150c7b 100644 --- a/src/mame/audio/turrett.c +++ b/src/mame/audio/turrett.c @@ -103,7 +103,7 @@ void turrett_device::sound_stream_update(sound_stream &stream, stream_sample_t * for (int s = 0; s < samples; ++s) { - INT16 sample = m_direct->read_raw_word(addr << 1); + INT16 sample = m_direct->read_word(addr << 1); if ((UINT16)sample == 0x8000) { diff --git a/src/mame/audio/warpwarp.c b/src/mame/audio/warpwarp.c index 8f2130fb4a2..1c3f42f9de4 100644 --- a/src/mame/audio/warpwarp.c +++ b/src/mame/audio/warpwarp.c @@ -40,15 +40,7 @@ warpwarp_sound_device::warpwarp_sound_device(const machine_config &mconfig, cons { } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- -void warpwarp_sound_device::device_config_complete() -{ -} //------------------------------------------------- // device_start - device-specific startup diff --git a/src/mame/audio/warpwarp.h b/src/mame/audio/warpwarp.h index 9e4352c792f..593208d8939 100644 --- a/src/mame/audio/warpwarp.h +++ b/src/mame/audio/warpwarp.h @@ -15,7 +15,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); // sound stream update overrides @@ -59,7 +58,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); // sound stream update overrides diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index cbfca8caeff..ec488e6c447 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -3307,7 +3307,6 @@ ROM_START( searthie ) ROM_LOAD( "searthie.e", 0x1800, 0x0800, CRC(baf949b0) SHA1(bfda97a3ef59fcdf87814afc6918507190c3e315) ) ROM_END - ROM_START( invadrmr ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "11.1t", 0x0000, 0x0400, CRC(389d44b6) SHA1(5d2581b8bc0da918ce57cf319e06b5b31989c681) ) @@ -3318,7 +3317,6 @@ ROM_START( invadrmr ) ROM_LOAD( "sv06.1g", 0x1c00, 0x0400, CRC(2c68e0b4) SHA1(a5e5357120102ad32792bf3ef6362f45b7ba7070) ) ROM_END - ROM_START( claybust ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "0.a1", 0x0000, 0x0400, CRC(90810582) SHA1(a5c3655bae6f92a3cd0eae3a5a3c25e414d4fdf0) ) @@ -3329,7 +3327,6 @@ ROM_START( claybust ) ROM_LOAD( "5.a8", 0x1400, 0x0400, CRC(92cd4da8) SHA1(217e00012a52c479bf0b0cf37ce556387755740d) ) ROM_END - ROM_START( gunchamp ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "251.a1", 0x0000, 0x0400, CRC(f27a8c1e) SHA1(510debd1ac2c0986f99c217e3078208a39d7837c) ) @@ -3342,7 +3339,6 @@ ROM_START( gunchamp ) ROM_LOAD( "258.a10", 0x1c00, 0x0400, CRC(471d4052) SHA1(c8ccda2eba44c2ab49f5fc2874fe70c2bdae35d3) ) ROM_END - ROM_START( spaceatt ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "h", 0x0000, 0x0400, CRC(d0c32d72) SHA1(b3bd950b1ba940fbeb5d95e55113ed8f4c311434) ) // == SV01 @@ -3353,6 +3349,23 @@ ROM_START( spaceatt ) ROM_LOAD( "a", 0x1c00, 0x0400, CRC(211ac4a3) SHA1(e08e90a4e77cfa30400626a484c9f37c87ea13f9) ) ROM_END +/* SPACE ATTACK set is from Video Game GmbH - 1010 A / Top board shows Video-Games - 6302 LICH - 1034 + Roms are set up as 1k bproms (82S137) and data is 1 rom top 4 bits, another bottom 4. This data once assembled matches original spaceatt set */ +ROM_START( spaceattbp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROMX_LOAD( "06e.bin", 0x0000, 0x0400, CRC(68301d05) SHA1(b0c33a982b42378da828281e74356d58fbea1d86), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "12l.bin", 0x0000, 0x0400, CRC(c5a5228f) SHA1(7861b5567d44e972d728551d47aab9b92d71ffc7), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "05de.bin", 0x0400, 0x0400, CRC(42032c14) SHA1(753948e7f52b88655c894b48d419b76de07c14f2), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "11hl.bin", 0x0400, 0x0400, CRC(d5d3811a) SHA1(7d2d983fa88b0349a90a6331ca3e18583125d21e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "04d.bin", 0x0800, 0x0400, CRC(5f5e540c) SHA1(9092794a878494dbe34c2f05a212ff7b9d00fc55), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "10h.bin", 0x0800, 0x0400, CRC(9d5ef6f1) SHA1(ef584678373375a7f13307d7c4597639a5f6010e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "03b.bin", 0x1400, 0x0400, CRC(89e13008) SHA1(1ad82ae0607af27925b42758f8c86a0e89079620), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "09g.bin", 0x1400, 0x0400, CRC(c16f5503) SHA1(cf36beac472c5c405342193b7ef434d32b37a4a8), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "02ab.bin", 0x1800, 0x0400, CRC(ffa166c2) SHA1(10496fcbb272130cc200dfb1886808559be8d6ea), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "08f.bin", 0x1800, 0x0400, CRC(b5fa1a2b) SHA1(7eab1cb9a9f95520a37ee4fb2b246ef072dedcbd), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "01a.bin", 0x1c00, 0x0400, CRC(44f8e99c) SHA1(9adecdadb16edaebde02892e30f9f87fb98f4ae1), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "07ef.bin", 0x1c00, 0x0400, CRC(9560880d) SHA1(866d6c3714b939814ce48707be53a69ef8355b34), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) +ROM_END /* SPACE ATTACK set is from Video Games GmbH - Board Typ 1010 C / Top board shows Video-Games - 6302 LICH - 1034B Contains same data as spaceatt but with added 00 fill to make larger roms (b+a=E1, 00fill+c=F1, f+00fill=G1, h+sv02=H1) */ @@ -3382,12 +3395,6 @@ ROM_START( galmonst ) ROM_LOAD( "a.5v", 0x1c00, 0x0400, CRC(05a6806b) SHA1(ea884110d0ea6463801cbc2f87ce9c4921b49e33) ) ROM_END - - - - - - ROM_START( spacecom ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1f.ic67", 0x0000, 0x0400, BAD_DUMP CRC(703f2cbe) SHA1(b183f9fbedd8658399555c0ba21ecab6370e86cb) ) @@ -4707,6 +4714,7 @@ GAMEL(1979, cosmicm2, invaders, cosmicmo, cosmicmo, driver_device, 0, ROT270 GAMEL(1980?,sinvzen, invaders, invaders, sinvzen, driver_device, 0, ROT270, "Taito / Zenitone-Microsec Ltd.", "Super Invaders (Zenitone-Microsec)", GAME_SUPPORTS_SAVE, layout_invaders ) // unclassified, licensed or bootleg? GAMEL(1980, ultrainv, invaders, invaders, sicv, driver_device, 0, ROT270, "Taito / Konami", "Ultra Invaders", GAME_SUPPORTS_SAVE, layout_invaders ) // unclassified, licensed or bootleg? GAMEL(1978, spaceatt, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) +GAMEL(1978, spaceattbp, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (bproms)(bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1978, spaceatt2k, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (2k roms)(bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1978, galmonst, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Laguna S.A.)", "Galaxy Monsters (Laguna S.A. Spanish bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1980, spaceat2, invaders, invaders, spaceat2, driver_device, 0, ROT270, "bootleg (Video Games UK)", "Space Attack II (bootleg of Super Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) // bootleg of Zenitone-Microsec Super Invaders diff --git a/src/mame/drivers/acesp.c b/src/mame/drivers/acesp.c index 55762c4e582..aa052919ad1 100644 --- a/src/mame/drivers/acesp.c +++ b/src/mame/drivers/acesp.c @@ -3848,9 +3848,25 @@ ROM_START( sp_cpal ) SP_CPAL_SOUND ROM_END -// mpu4.c -extern void descramble_crystal( UINT8* region, int start, int end, UINT8 extra_xor); - +static void descramble_crystal( UINT8* region, int start, int end, UINT8 extra_xor) +{ + for (int i=start;i<end;i++) + { + UINT8 x = region[i]; + switch (i & 0x58) + { + case 0x00: // same as 0x08 + case 0x08: x = BITSWAP8( x^0xca , 3,2,1,0,7,4,6,5 ); break; + case 0x10: x = BITSWAP8( x^0x30 , 3,0,4,6,1,5,7,2 ); break; + case 0x18: x = BITSWAP8( x^0x89 , 4,1,2,5,7,0,6,3 ); break; + case 0x40: x = BITSWAP8( x^0x14 , 6,1,4,3,2,5,0,7 ); break; + case 0x48: x = BITSWAP8( x^0x40 , 1,0,3,2,5,4,7,6 ); break; + case 0x50: x = BITSWAP8( x^0xcb , 3,2,1,0,7,6,5,4 ); break; + case 0x58: x = BITSWAP8( x^0xc0 , 2,3,6,0,5,1,7,4 ); break; + } + region[i] = x ^ extra_xor; + } +} DRIVER_INIT_MEMBER(ace_sp_state,ace_cr) { descramble_crystal(memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00); diff --git a/src/mame/drivers/aleisttl.c b/src/mame/drivers/aleisttl.c index 1192b740f2f..3f2fca3b479 100644 --- a/src/mame/drivers/aleisttl.c +++ b/src/mame/drivers/aleisttl.c @@ -7,7 +7,7 @@ Chase (aka Chase1) (1976) Deluxe Soccer (1973) Fire Power (1975) - Fütsball (1975) + F??tsball (1975) Galaxy Raider (1974) Hesitation (1974) AL-6500? Hockey, Soccer, Tennis (1974) diff --git a/src/mame/drivers/angelkds.c b/src/mame/drivers/angelkds.c index 47e225f680f..8bd36d7b37c 100644 --- a/src/mame/drivers/angelkds.c +++ b/src/mame/drivers/angelkds.c @@ -212,6 +212,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, angelkds_state ) AM_RANGE(0xf005, 0xf005) AM_WRITE(angelkds_layer_ctrl_write) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, angelkds_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") +ADDRESS_MAP_END + static ADDRESS_MAP_START( main_portmap, AS_IO, 8, angelkds_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITENOP // 00 on start-up, not again @@ -628,6 +633,12 @@ static MACHINE_CONFIG_START( angelkds, angelkds_state ) MCFG_SOUND_ROUTE(3, "mono", 0.45) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( spcpostn, angelkds ) + /* encryption */ + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + /*** Rom Loading "maincpu" for the main code @@ -643,7 +654,7 @@ MACHINE_CONFIG_END ROM_START( angelkds ) /* Nasco X090-PC-A (Sega 837-6600) */ - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "11428.c10", 0x00000, 0x08000, CRC(90daacd2) SHA1(7e50ad1cbed0c1e6bad04ef1611cad25538c905f) ) ROM_REGION( 0x20000, "user1", 0 ) /* Banked Code */ @@ -690,7 +701,7 @@ ROM_END ROM_START( spcpostn ) /* X090-PC-A 171-5383 */ - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* D317-0005 (NEC Z80 Custom) */ + ROM_REGION( 0x8000, "maincpu", 0 ) /* D317-0005 (NEC Z80 Custom) */ ROM_LOAD( "epr10125.c10", 0x00000, 0x08000, CRC(bffd38c6) SHA1(af02907124343ddecd21439d25f1ebb81ef9f51a) ) /* encrypted */ ROM_REGION( 0x28000, "user1", 0 ) /* Banked Code */ @@ -736,10 +747,12 @@ DRIVER_INIT_MEMBER(angelkds_state,spcpostn) { UINT8 *RAM = memregion("user1")->base(); - sega_317_0005_decode(machine(), "maincpu"); + // 317-0005 + sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 1); + membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000); } GAME( 1988, angelkds, 0, angelkds, angelkds, angelkds_state, angelkds, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , GAME_SUPPORTS_SAVE) /* Nasco not displayed but 'Exa Planning' is */ -GAME( 1986, spcpostn, 0, angelkds, spcpostn, angelkds_state, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , GAME_SUPPORTS_SAVE) /* encrypted */ +GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, spcpostn, ROT90, "Sega / Nasco", "Space Position (Japan)" , GAME_SUPPORTS_SAVE) /* encrypted */ diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c index b3ab3aba401..6c99c38dad5 100644 --- a/src/mame/drivers/appoooh.c +++ b/src/mame/drivers/appoooh.c @@ -227,6 +227,12 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, appoooh_state ) AM_RANGE(0xf000, 0xffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, appoooh_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0x9fff) AM_ROM AM_REGION("maincpu", 0x8000) + AM_RANGE(0xa000, 0xdfff) AM_ROMBANK("bank1") +ADDRESS_MAP_END + static ADDRESS_MAP_START( main_portmap, AS_IO, 8, appoooh_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_DEVWRITE("sn1", sn76489_device, write) @@ -455,6 +461,9 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( robowres, appoooh_common ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -577,13 +586,48 @@ ROM_END DRIVER_INIT_MEMBER(appoooh_state,robowres) { - sega_315_5179_decode(machine(), "maincpu"); + static const UINT8 xor_table[128] = + { + 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04, + 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04, + 0x00,0x45,0x41,0x14,0x50, + 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, + 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04, + 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04, + 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04, + 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41, + }; + + static const int swap_table[128] = + { + 8, 9,11,13,15, 0, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8, 9,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 2, 4, 6, + 8,10,11,13,15, 1, 3, 4, 6, + 8, + 7, 1, 2, 4, 6, 0, 1, 3, 5, + 7, 1, 2, 4, 6, 0, 1, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 2, 4, 6, 0, 2, 3, 5, + 7, 1, 3, 4, 6, 0, 2, 3, 5, + 7, 1, 3, 4, 6, 0, 2, 4, 5, + 7, + }; + + sega_decode_2(memregion("maincpu")->base(), m_decrypted_opcodes, xor_table, swap_table); } DRIVER_INIT_MEMBER(appoooh_state,robowresb) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x1c000); + memcpy(m_decrypted_opcodes, memregion("maincpu")->base() + 0x1c000, 0x8000); } diff --git a/src/mame/drivers/armedf.c b/src/mame/drivers/armedf.c index 1773e1eaf26..05bc05f6c58 100644 --- a/src/mame/drivers/armedf.c +++ b/src/mame/drivers/armedf.c @@ -2184,7 +2184,7 @@ DRIVER_INIT_MEMBER(bigfghtr_state,bigfghtr) /* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */ GAME( 1987, legion, 0, legion, legion, armedf_state, legion, ROT270, "Nichibutsu", "Legion - Spinner-87 (World ver 2.03)", GAME_SUPPORTS_SAVE ) GAME( 1987, legionj, legion, legion, legion, armedf_state, legion, ROT270, "Nichibutsu", "Chouji Meikyuu Legion (Japan ver 1.05)", GAME_SUPPORTS_SAVE ) -GAME( 1987, legionjb, legion, legionjb, legion, armedf_state, legionjb, ROT270, "Nichibutsu", "Chouji Meikyuu Legion (Japan ver 1.05, bootleg)", GAME_SUPPORTS_SAVE) /* blitter protection removed */ +GAME( 1987, legionjb, legion, legionjb, legion, armedf_state, legionjb, ROT270, "bootleg", "Chouji Meikyuu Legion (Japan ver 1.05, bootleg)", GAME_SUPPORTS_SAVE) /* blitter protection removed */ GAME( 1987, terraf, 0, terraf, terraf, armedf_state, terrafu, ROT0, "Nichibutsu", "Terra Force", GAME_SUPPORTS_SAVE ) GAME( 1987, terrafu, terraf, terraf, terraf, armedf_state, terrafu, ROT0, "Nichibutsu USA", "Terra Force (US)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index 62ce11f1657..243426f143e 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -194,18 +194,6 @@ void atarisy2_state::scanline_update(screen_device &screen, int scanline) * *************************************/ -DIRECT_UPDATE_MEMBER( atarisy2_state::atarisy2_direct_handler ) -{ - /* make sure slapstic area looks like ROM */ - if (address >= 0x8000 && address < 0x8200) - { - direct.explicit_configure(0x8000, 0x81ff, 0x1ff, reinterpret_cast<UINT8 *>(m_slapstic_base.target())); - return ~0; - } - return address; -} - - MACHINE_START_MEMBER(atarisy2_state,atarisy2) { atarigen_state::machine_start(); @@ -224,8 +212,6 @@ MACHINE_RESET_MEMBER(atarisy2_state,atarisy2) m_slapstic->slapstic_reset(); scanline_timer_reset(*m_screen, 64); - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this)); - m_p2portwr_state = 0; m_p2portrd_state = 0; diff --git a/src/mame/drivers/battlera.c b/src/mame/drivers/battlera.c index 792ce0ceb01..00f9bcebbda 100644 --- a/src/mame/drivers/battlera.c +++ b/src/mame/drivers/battlera.c @@ -24,14 +24,20 @@ #include "emu.h" #include "cpu/h6280/h6280.h" #include "sound/2203intf.h" -#include "sound/msm5205.h" #include "sound/c6280.h" #include "includes/battlera.h" +void battlera_state::machine_start() +{ + save_item(NAME(m_control_port_select)); + save_item(NAME(m_msm5205next)); + save_item(NAME(m_toggle)); +} + /******************************************************************************/ -WRITE8_MEMBER(battlera_state::battlera_sound_w) +WRITE8_MEMBER(battlera_state::sound_w) { if (offset == 0) { @@ -65,7 +71,7 @@ READ8_MEMBER(battlera_state::control_data_r) static ADDRESS_MAP_START( battlera_map, AS_PROGRAM, 8, battlera_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM - AM_RANGE(0x1e0800, 0x1e0801) AM_WRITE(battlera_sound_w) + AM_RANGE(0x1e0800, 0x1e0801) AM_WRITE(sound_w) AM_RANGE(0x1e1000, 0x1e13ff) AM_DEVREADWRITE( "huc6260", huc6260_device, palette_direct_read, palette_direct_write) AM_SHARE("paletteram") AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8") /* Main ram */ AM_RANGE(0x1ff000, 0x1ff001) AM_READWRITE(control_data_r, control_data_w) @@ -84,7 +90,7 @@ ADDRESS_MAP_END /******************************************************************************/ -WRITE_LINE_MEMBER(battlera_state::battlera_adpcm_int) +WRITE_LINE_MEMBER(battlera_state::adpcm_int) { m_msm->data_w(m_msm5205next >> 4); m_msm5205next <<= 4; @@ -94,12 +100,12 @@ WRITE_LINE_MEMBER(battlera_state::battlera_adpcm_int) m_audiocpu->set_input_line(1, HOLD_LINE); } -WRITE8_MEMBER(battlera_state::battlera_adpcm_data_w) +WRITE8_MEMBER(battlera_state::adpcm_data_w) { m_msm5205next = data; } -WRITE8_MEMBER(battlera_state::battlera_adpcm_reset_w) +WRITE8_MEMBER(battlera_state::adpcm_reset_w) { m_msm->reset_w(0); } @@ -107,10 +113,10 @@ WRITE8_MEMBER(battlera_state::battlera_adpcm_reset_w) static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, battlera_state ) AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_RANGE(0x040000, 0x040001) AM_DEVWRITE("ymsnd", ym2203_device, write) - AM_RANGE(0x080000, 0x080001) AM_WRITE(battlera_adpcm_data_w) + AM_RANGE(0x080000, 0x080001) AM_WRITE(adpcm_data_w) AM_RANGE(0x1fe800, 0x1fe80f) AM_DEVWRITE("c6280", c6280_device, c6280_w) AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank7") /* Main ram */ - AM_RANGE(0x1ff000, 0x1ff001) AM_READ(soundlatch_byte_r) AM_WRITE(battlera_adpcm_reset_w) + AM_RANGE(0x1ff000, 0x1ff001) AM_READ(soundlatch_byte_r) AM_WRITE(adpcm_reset_w) AM_RANGE(0x1ff400, 0x1ff403) AM_DEVWRITE("audiocpu", h6280_device, irq_status_w) ADDRESS_MAP_END @@ -183,11 +189,6 @@ INPUT_PORTS_END /******************************************************************************/ -WRITE_LINE_MEMBER(battlera_state::pce_irq_changed) -{ - m_maincpu->set_input_line(0, state); -} - UINT32 battlera_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_huc6260->video_update( bitmap, cliprect ); @@ -219,8 +220,7 @@ static MACHINE_CONFIG_START( battlera, battlera_state ) MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 ) MCFG_HUC6270_VRAM_SIZE(0x20000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(battlera_state, pce_irq_changed)) - + MCFG_HUC6270_IRQ_CHANGED_CB(INPUTLINE("maincpu", 0)) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -230,7 +230,7 @@ static MACHINE_CONFIG_START( battlera, battlera_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.40) MCFG_SOUND_ADD("msm", MSM5205, 384000) - MCFG_MSM5205_VCLK_CB(WRITELINE(battlera_state, battlera_adpcm_int)) /* interrupt function */ + MCFG_MSM5205_VCLK_CB(WRITELINE(battlera_state, adpcm_int)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8KHz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.85) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.85) @@ -301,6 +301,6 @@ ROM_END /******************************************************************************/ -GAME( 1988, battlera, 0, battlera, battlera, driver_device, 0, ROT0, "Data East Corporation", "Battle Rangers (World)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1988, bldwolf, battlera, battlera, battlera, driver_device, 0, ROT0, "Data East USA", "Bloody Wolf (US)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1988, bldwolfj, battlera, battlera, battlera, driver_device, 0, ROT0, "Data East Corporation", "Narazumono Sentoubutai Bloody Wolf (Japan)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAME( 1988, battlera, 0, battlera, battlera, driver_device, 0, ROT0, "Data East Corporation", "Battle Rangers (World)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1988, bldwolf, battlera, battlera, battlera, driver_device, 0, ROT0, "Data East USA", "Bloody Wolf (US)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1988, bldwolfj, battlera, battlera, battlera, driver_device, 0, ROT0, "Data East Corporation", "Narazumono Sentoubutai Bloody Wolf (Japan)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c index 0077139e261..8d615cd422a 100644 --- a/src/mame/drivers/bbusters.c +++ b/src/mame/drivers/bbusters.c @@ -788,10 +788,58 @@ ROM_END ROM_START( bbustersu ) ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "bbv2-3.k10", 0x000000, 0x20000, CRC(6930088b) SHA1(265f0b584d81b6fdcda5c3a2e0bd15d56443bb35) ) - ROM_LOAD16_BYTE( "bbv2-5.k12", 0x000001, 0x20000, CRC(cfdb2c6c) SHA1(54a837dc84b74d12e931f607f3dc9ee06a7e4d31) ) - ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) - ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) + ROM_LOAD16_BYTE( "bb-ver3-u3.k10", 0x000000, 0x20000, CRC(c80ec3bc) SHA1(81cccc920c6dc58ccd20fb38bfede717f534986f) ) + ROM_LOAD16_BYTE( "bb-ver3-u5.k12", 0x000001, 0x20000, CRC(5ded86d1) SHA1(de2ce91b85a1d74e60a7093211c1a7d3c27c1d72) ) + ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) + ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) ) + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "bb-10.l9", 0x000000, 0x20000, CRC(490c0d9b) SHA1(567c25a6d96407259c64061d674305e4117d9fa4) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_LOAD( "bb-f11.m16", 0x000000, 0x80000, CRC(39fdf9c0) SHA1(80392947e3a1831c3ee80139f6f3bdc3bafa4f0d) ) + ROM_LOAD( "bb-f12.m13", 0x080000, 0x80000, CRC(69ee046b) SHA1(5c0435f1ce76b584fa8d154d7617d73c7ab5f62f) ) + ROM_LOAD( "bb-f13.m12", 0x100000, 0x80000, CRC(f5ef840e) SHA1(dd0f630c52076e0d330f47931e68a3ae9a401078) ) + ROM_LOAD( "bb-f14.m11", 0x180000, 0x80000, CRC(1a7df3bb) SHA1(1f27a528e6f89fe56a7342c4f1ff733da0a09327) ) + + ROM_REGION( 0x200000, "gfx3", 0 ) + ROM_LOAD( "bb-f21.l10", 0x000000, 0x80000, CRC(530f595b) SHA1(820898693b878c4423de9c244f943d39ea69515e) ) + ROM_LOAD( "bb-f22.l12", 0x080000, 0x80000, CRC(889c562e) SHA1(d19172d6515ab9793c98de75d6e41687e61a408d) ) + ROM_LOAD( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) + ROM_LOAD( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) + + ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) + + ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) + + ROM_REGION( 0x10000, "user1", 0 ) /* Zoom table */ + /* same rom exists in 4 different locations on the board */ + ROM_LOAD( "bb-6.e7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-7.h7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-8.a14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-9.c14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + + ROM_REGION( 0x80000, "ymsnd", 0 ) + ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) ) + + ROM_REGION( 0x80000, "ymsnd.deltat", 0 ) + ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) ) + + ROM_REGION( 0x100, "eeprom", 0 ) + ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) ) +ROM_END + +ROM_START( bbustersua ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "bb-ver2-u3.k10", 0x000000, 0x20000, CRC(6930088b) SHA1(265f0b584d81b6fdcda5c3a2e0bd15d56443bb35) ) + ROM_LOAD16_BYTE( "bb-ver2-u5.k12", 0x000001, 0x20000, CRC(cfdb2c6c) SHA1(54a837dc84b74d12e931f607f3dc9ee06a7e4d31) ) + ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) + ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) ) @@ -1020,10 +1068,11 @@ ROM_END /******************************************************************************/ // as soon as you calibrate the guns in test mode the game refuses to boot -GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1989, bbustersu,bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) - -GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattu, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattu1,mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US, Version 1, Single Player)", GAME_SUPPORTS_SAVE ) +GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbustersu, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 3)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbustersua, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) + +GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattu, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattu1, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US, Version 1, Single Player)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bionicc.c b/src/mame/drivers/bionicc.c index 42c890e542d..a6a36ea55b0 100644 --- a/src/mame/drivers/bionicc.c +++ b/src/mame/drivers/bionicc.c @@ -569,26 +569,26 @@ ROM_END ROM_START( bioniccbl ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "02l.bin", 0x00000, 0x10000, CRC(b2fe1ddb) SHA1(892f19124993add96edabdba3aafeecc6668c5d9) ) - ROM_LOAD16_BYTE( "03l.bin", 0x00001, 0x10000, CRC(427a003d) SHA1(5a379fe2942e5565810939d5eb843003226222cc) ) - ROM_LOAD16_BYTE( "02u.bin", 0x20000, 0x10000, CRC(27f04bb6) SHA1(41d17b84b34dc8b2e5dfa67794a8df3e898b740b) ) - ROM_LOAD16_BYTE( "03u.bin", 0x20001, 0x10000, CRC(c01547b1) SHA1(563bf6be4f10f5e6eb5b562266accf168f62bf30) ) + ROM_LOAD16_BYTE( "02l.bin", 0x00000, 0x10000, CRC(b2fe1ddb) SHA1(892f19124993add96edabdba3aafeecc6668c5d9) ) + ROM_LOAD16_BYTE( "03l.bin", 0x00001, 0x10000, CRC(427a003d) SHA1(5a379fe2942e5565810939d5eb843003226222cc) ) + ROM_LOAD16_BYTE( "02u.bin", 0x20000, 0x10000, CRC(27f04bb6) SHA1(41d17b84b34dc8b2e5dfa67794a8df3e898b740b) ) + ROM_LOAD16_BYTE( "03u.bin", 0x20001, 0x10000, CRC(c01547b1) SHA1(563bf6be4f10f5e6eb5b562266accf168f62bf30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "01.bin", 0x00000, 0x8000, CRC(8ea07917) SHA1(e9ace70d89482fc3669860450a41aacacbee9083) ) + ROM_LOAD( "01.bin", 0x00000, 0x8000, CRC(8ea07917) SHA1(e9ace70d89482fc3669860450a41aacacbee9083) ) ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP ) // 19.bin (protected) ROM_REGION( 0x08000, "gfx1", 0 ) - ROM_LOAD( "06.bin", 0x00000, 0x4000, CRC(4e6b81d9) SHA1(052784d789b0c9193edf218fa1883b6e3b7df988) ) + ROM_LOAD( "06.bin", 0x00000, 0x4000, CRC(4e6b81d9) SHA1(052784d789b0c9193edf218fa1883b6e3b7df988) ) ROM_REGION( 0x10000, "gfx2", 0 ) - ROM_LOAD( "05.bin", 0x00000, 0x8000, CRC(9bf8dc7f) SHA1(539a52087ed1f58839b6aa8c0b5ed249f4f4041e) ) - ROM_LOAD( "04.bin", 0x08000, 0x8000, CRC(1b43bf63) SHA1(b80d675a07cebd83daf202d1c3d3f7c2dedf5c30) ) + ROM_LOAD( "05.bin", 0x00000, 0x8000, CRC(9bf8dc7f) SHA1(539a52087ed1f58839b6aa8c0b5ed249f4f4041e) ) + ROM_LOAD( "04.bin", 0x08000, 0x8000, CRC(1b43bf63) SHA1(b80d675a07cebd83daf202d1c3d3f7c2dedf5c30) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "ts_12.17f", 0x00000, 0x8000, CRC(e4b4619e) SHA1(3bec8399ffb28fd50ce6ae88d90b091eadf8bda1) ) // 09.bin + ROM_LOAD( "ts_12.17f", 0x00000, 0x8000, CRC(e4b4619e) SHA1(3bec8399ffb28fd50ce6ae88d90b091eadf8bda1) ) // 09.bin ROM_LOAD( "ts_11.15f", 0x08000, 0x8000, CRC(ab30237a) SHA1(ea6c07df992ba48f9eca7daa4ea775faa94358d2) ) // 08.bin ROM_LOAD( "ts_17.17g", 0x10000, 0x8000, CRC(deb657e4) SHA1(b36b468f9bbb7a4937286230d3f6caa14c61d4dd) ) // 13.bin ROM_LOAD( "ts_16.15g", 0x18000, 0x8000, CRC(d363b5f9) SHA1(1dd3991d99db2d6bcbdb12879ba50a01fef95004) ) // 12.bin @@ -598,10 +598,10 @@ ROM_START( bioniccbl ) ROM_LOAD( "ts_24.18k", 0x38000, 0x8000, CRC(f156e564) SHA1(a6cad05bcc6d9ded6294f9b5aa856d05641aed02) ) // 18.bin ROM_REGION( 0x40000, "gfx4", 0 ) - ROM_LOAD( "07.bin", 0x00000, 0x10000, CRC(a0e78996) SHA1(810a54e657c0faaff6a8494acaf803d1d2151893) ) - ROM_LOAD( "11.bin", 0x10000, 0x10000, CRC(37cb11c2) SHA1(af8c2ae4bb6e6c13ea3e8b7c96e5b18f1eb1d5a5) ) - ROM_LOAD( "15.bin", 0x20000, 0x10000, CRC(4e0354ce) SHA1(d3256c891b44c6593b0b44c0d0a3e754ce78c1cb) ) - ROM_LOAD( "16.bin", 0x30000, 0x10000, CRC(ac89e5cc) SHA1(aa7e065ece6d25b7e83fadcd22c09e1f7dc0b86f) ) + ROM_LOAD( "07.bin", 0x00000, 0x10000, CRC(a0e78996) SHA1(810a54e657c0faaff6a8494acaf803d1d2151893) ) + ROM_LOAD( "11.bin", 0x10000, 0x10000, CRC(37cb11c2) SHA1(af8c2ae4bb6e6c13ea3e8b7c96e5b18f1eb1d5a5) ) + ROM_LOAD( "15.bin", 0x20000, 0x10000, CRC(4e0354ce) SHA1(d3256c891b44c6593b0b44c0d0a3e754ce78c1cb) ) + ROM_LOAD( "16.bin", 0x30000, 0x10000, CRC(ac89e5cc) SHA1(aa7e065ece6d25b7e83fadcd22c09e1f7dc0b86f) ) ROM_REGION( 0x0100, "proms", 0 ) ROM_LOAD( "63s141.18f", 0x0000, 0x0100, CRC(b58d0023) SHA1(e8a4a2e2951bf73b3d9eed6957e9ee1e61c9c58a) ) /* priority (not used), Labeled "TSB" */ diff --git a/src/mame/drivers/boogwing.c b/src/mame/drivers/boogwing.c index 10f314ec6af..4a0ecabbf5b 100644 --- a/src/mame/drivers/boogwing.c +++ b/src/mame/drivers/boogwing.c @@ -143,6 +143,9 @@ static ADDRESS_MAP_START( boogwing_map, AS_PROGRAM, 16, boogwing_state ) AM_RANGE(0x3c0000, 0x3c004f) AM_RAM // ? ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, boogwing_state ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, boogwing_state ) AM_RANGE(0x000000, 0x00ffff) AM_ROM @@ -317,6 +320,7 @@ static MACHINE_CONFIG_START( boogwing, boogwing_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 14000000) /* DE102 */ MCFG_CPU_PROGRAM_MAP(boogwing_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", boogwing_state, irq6_line_hold) MCFG_CPU_ADD("audiocpu", H6280, 32220000/4) @@ -635,7 +639,7 @@ DRIVER_INIT_MEMBER(boogwing_state,boogwing) deco56_decrypt_gfx(machine(), "tiles2"); deco56_decrypt_gfx(machine(), "tiles3"); deco56_remap_gfx(machine(), "gfx6"); - deco102_decrypt_cpu(machine(), "maincpu", 0x42ba, 0x00, 0x18); + deco102_decrypt_cpu((UINT16 *)memregion("maincpu")->base(), m_decrypted_opcodes, 0x100000, 0x42ba, 0x00, 0x18); memcpy(dst, src, 0x100000); } diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c index 1ae39175190..54932b10902 100644 --- a/src/mame/drivers/cabal.c +++ b/src/mame/drivers/cabal.c @@ -468,7 +468,7 @@ static GFXDECODE_START( cabal ) GFXDECODE_END -static MACHINE_CONFIG_START( cabal, cabal_state ) +static MACHINE_CONFIG_START( cabal_base, cabal_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb */ @@ -511,6 +511,14 @@ static MACHINE_CONFIG_START( cabal, cabal_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( cabal, cabal_base ) + SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW() +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cabalbl2, cabal_base ) + SEIBU_SOUND_SYSTEM_ENCRYPTED_CUSTOM() +MACHINE_CONFIG_END + /* the bootleg has different sound hardware (2 extra Z80s for ADPCM playback) */ static MACHINE_CONFIG_START( cabalbl, cabal_state ) @@ -787,7 +795,7 @@ ROM_END // based on stickers present on the board it appears to have been manufactured by 'TAB-Austria' and is marked 'CA02' ROM_START( cabalbl2 ) - ROM_REGION( 0x50000, "maincpu", 0 ) /* 64k for cpu code */ + ROM_REGION( 0x40000, "maincpu", 0 ) /* 64k for cpu code */ ROM_LOAD16_BYTE( "c9.bin", 0x00000, 0x10000, CRC(00abbe0c) SHA1(bacf17444abfb4f56248ff56e37b0aa2b1a3800d) ) ROM_LOAD16_BYTE( "c7.bin", 0x00001, 0x10000, CRC(44736281) SHA1(1d6da95ef96d9c02aea70791e1cb87b70097d5ed) ) ROM_LOAD16_BYTE( "c8.bin", 0x20000, 0x10000, CRC(d763a47c) SHA1(146d8082a404b6eddaf2dc9ba41a997949c17f8a) ) @@ -831,33 +839,17 @@ ROM_START( cabalbl2 ) ROM_END - -void cabal_state::seibu_sound_bootleg(const char *cpu,int length) -{ - address_space &space = machine().device(cpu)->memory().space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, length); - UINT8 *rom = memregion(cpu)->base(); - - space.set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt); - - memcpy(decrypt, rom+length, length); - - if (length > 0x10000) - membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000); -} - - - DRIVER_INIT_MEMBER(cabal_state,cabal) { - m_seibu_sound->decrypt("audiocpu",0x2000); m_adpcm1->decrypt("adpcm1"); m_adpcm2->decrypt("adpcm2"); } DRIVER_INIT_MEMBER(cabal_state,cabalbl2) { - seibu_sound_bootleg("audiocpu",0x2000); + UINT8 *decrypt = m_seibu_sound->get_custom_decrypt(); + memcpy(decrypt, memregion("audiocpu")->base()+0x2000, 0x2000); + memcpy(decrypt+0x8000, memregion("audiocpu")->base()+0x8000, 0x8000); m_adpcm1->decrypt("adpcm1"); m_adpcm2->decrypt("adpcm2"); } @@ -866,7 +858,7 @@ DRIVER_INIT_MEMBER(cabal_state,cabalbl2) GAME( 1988, cabal, 0, cabal, cabalj, cabal_state, cabal, ROT0, "TAD Corporation", "Cabal (World, Joystick version)", GAME_SUPPORTS_SAVE ) GAME( 1989, cabala, cabal, cabal, cabalj, cabal_state, cabal, ROT0, "TAD Corporation (Alpha Trading license)", "Cabal (Alpha Trading)", GAME_SUPPORTS_SAVE ) // korea? GAME( 1988, cabalbl, cabal, cabalbl, cabalbl, driver_device, 0, ROT0, "bootleg (Red Corporation)", "Cabal (bootleg of Joystick version, set 1, alternate sound hardware)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1988, cabalbl2,cabal, cabal, cabalj, cabal_state, cabalbl2,ROT0, "bootleg", "Cabal (bootleg of Joystick version, set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1988, cabalbl2,cabal, cabalbl2,cabalj, cabal_state, cabalbl2,ROT0, "bootleg", "Cabal (bootleg of Joystick version, set 2)", GAME_SUPPORTS_SAVE ) GAME( 1988, cabalus, cabal, cabal, cabalt, cabal_state, cabal, ROT0, "TAD Corporation (Fabtek license)", "Cabal (US set 1, Trackball version)", GAME_SUPPORTS_SAVE ) GAME( 1988, cabalus2,cabal, cabal, cabalt, cabal_state, cabal, ROT0, "TAD Corporation (Fabtek license)", "Cabal (US set 2, Trackball version)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c index effedfd8a5f..a5921c03dd8 100644 --- a/src/mame/drivers/calorie.c +++ b/src/mame/drivers/calorie.c @@ -94,7 +94,8 @@ public: m_sprites(*this, "sprites"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_fg_ram; @@ -121,6 +122,7 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; @@ -256,7 +258,7 @@ WRITE8_MEMBER(calorie_state::bogus_w) static ADDRESS_MAP_START( calorie_map, AS_PROGRAM, 8, calorie_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xcfff) AM_RAM + AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(fg_ram_w) AM_SHARE("fg_ram") AM_RANGE(0xd800, 0xdbff) AM_RAM AM_SHARE("sprites") AM_RANGE(0xdc00, 0xdcff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") @@ -269,6 +271,11 @@ static ADDRESS_MAP_START( calorie_map, AS_PROGRAM, 8, calorie_state ) AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_byte_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, calorie_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END static ADDRESS_MAP_START( calorie_sound_map, AS_PROGRAM, 8, calorie_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM @@ -447,6 +454,7 @@ static MACHINE_CONFIG_START( calorie, calorie_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80,4000000) /* 4 MHz */ MCFG_CPU_PROGRAM_MAP(calorie_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", calorie_state, irq0_line_hold) MCFG_CPU_ADD("audiocpu", Z80,3000000) /* 3 MHz */ @@ -555,13 +563,13 @@ ROM_END DRIVER_INIT_MEMBER(calorie_state,calorie) { - sega_317_0004_decode(machine(), "maincpu"); + // 317-0004 + sega_decode_317(memregion("maincpu")->base(), m_decrypted_opcodes, 0); } DRIVER_INIT_MEMBER(calorie_state,calorieb) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x10000); + memcpy(m_decrypted_opcodes, memregion("maincpu")->base() + 0x10000, 0x8000); } diff --git a/src/mame/drivers/cbasebal.c b/src/mame/drivers/cbasebal.c index d3b7bd38cb1..41034ad2d68 100644 --- a/src/mame/drivers/cbasebal.c +++ b/src/mame/drivers/cbasebal.c @@ -98,6 +98,11 @@ static ADDRESS_MAP_START( cbasebal_map, AS_PROGRAM, 8, cbasebal_state ) AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cbasebal_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") +ADDRESS_MAP_END + static ADDRESS_MAP_START( cbasebal_portmap, AS_IO, 8, cbasebal_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(cbasebal_bankswitch_w) @@ -257,6 +262,7 @@ static MACHINE_CONFIG_START( cbasebal, cbasebal_state ) MCFG_CPU_ADD("maincpu", Z80, 6000000) /* ??? */ MCFG_CPU_PROGRAM_MAP(cbasebal_map) MCFG_CPU_IO_MAP(cbasebal_portmap) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", cbasebal_state, irq0_line_hold) /* ??? */ MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -330,7 +336,13 @@ ROM_END DRIVER_INIT_MEMBER(cbasebal_state,cbasebal) { - pang_decode(machine()); + UINT8 *src = memregion("maincpu")->base(); + int size = memregion("maincpu")->bytes(); + UINT8 *dst = auto_alloc_array(machine(), UINT8, size); + pang_decode(src, dst, size); + membank("bank1")->configure_entries(0, 16, src + 0x10000, 0x4000); + membank("bank0d")->set_base(dst); + membank("bank1d")->configure_entries(0, 16, dst + 0x10000, 0x4000); } diff --git a/src/mame/drivers/cclimber.c b/src/mame/drivers/cclimber.c index cec97aea9aa..6cfd1382651 100644 --- a/src/mame/drivers/cclimber.c +++ b/src/mame/drivers/cclimber.c @@ -216,6 +216,11 @@ Dip location verified from manual for: cclimber, guzzler, swimmer #define MASTER_CLOCK XTAL_18_432MHz +void cclimber_state::machine_start() +{ + save_item(NAME(m_nmi_mask)); +} + WRITE8_MEMBER(cclimber_state::swimmer_sh_soundlatch_w) { soundlatch_byte_w(space,offset,data); @@ -249,8 +254,10 @@ WRITE8_MEMBER(cclimber_state::toprollr_rombank_w) m_toprollr_rombank &= ~(1 << offset); m_toprollr_rombank |= (data & 1) << offset; - if (m_toprollr_rombank < 3) + if (m_toprollr_rombank < 3) { membank("bank1")->set_entry(m_toprollr_rombank); + membank("bank1d")->set_entry(m_toprollr_rombank); + } } MACHINE_RESET_MEMBER(cclimber_state,cclimber) @@ -294,6 +301,10 @@ static ADDRESS_MAP_START( cclimber_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0xb800, 0xb800) AM_READ_PORT("SYSTEM") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cclimber_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( cannonb_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0x5045, 0x505f) AM_WRITENOP /* do not errorlog this */ AM_RANGE(0x0000, 0x5fff) AM_ROM @@ -334,6 +345,10 @@ static ADDRESS_MAP_START( swimmer_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1") AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW2") AM_WRITEONLY AM_SHARE("bgcolor") AM_RANGE(0xb880, 0xb880) AM_READ_PORT("SYSTEM") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( guzzler_map, AS_PROGRAM, 8, cclimber_state ) + AM_IMPORT_FROM(swimmer_map) AM_RANGE(0xc000, 0xc7ff) AM_RAM /* ??? used by Guzzler */ AM_RANGE(0xe000, 0xffff) AM_ROM /* Guzzler only */ ADDRESS_MAP_END @@ -362,7 +377,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( toprollr_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0x0000, 0x5fff) AM_ROMBANK("bank1") - AM_RANGE(0x6000, 0x6bff) AM_RAM + AM_RANGE(0x6000, 0x6bff) AM_RAM AM_SHARE("ram") AM_RANGE(0x8800, 0x88ff) AM_RAM AM_SHARE("bigspriteram") AM_RANGE(0x8c00, 0x8fff) AM_RAM AM_SHARE("bg_videoram") AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("videoram") @@ -381,6 +396,10 @@ static ADDRESS_MAP_START( toprollr_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0xc000, 0xffff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( toprollr_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cclimber_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROMBANK("bank1d") + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0xc000) +ADDRESS_MAP_END static ADDRESS_MAP_START( cclimber_portmap, AS_IO, 8, cclimber_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -1014,6 +1033,11 @@ static MACHINE_CONFIG_DERIVED( cclimber, root ) MCFG_CCLIMBER_AUDIO_ADD("cclimber_audio") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( cclimberx, cclimber ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( cannonb, cclimber ) @@ -1032,6 +1056,7 @@ static MACHINE_CONFIG_DERIVED( yamato, root ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(yamato_map) MCFG_CPU_IO_MAP(yamato_portmap) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_ADD("audiocpu", Z80, 3072000) /* 3.072 MHz ? */ MCFG_CPU_PROGRAM_MAP(yamato_audio_map) @@ -1060,6 +1085,7 @@ static MACHINE_CONFIG_DERIVED( toprollr, cclimber ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(toprollr_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(toprollr_decrypted_opcodes_map) /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", toprollr) @@ -1109,6 +1135,12 @@ static MACHINE_CONFIG_START( swimmer, cclimber_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( guzzler, swimmer ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(guzzler_map) +MACHINE_CONFIG_END + /*************************************************************************** @@ -1117,7 +1149,7 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( cclimber ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "cc11", 0x0000, 0x1000, CRC(217ec4ff) SHA1(334604c3a051d57440a9d0bfc34b809418ef1d2d) ) ROM_LOAD( "cc10", 0x1000, 0x1000, CRC(b3c26cef) SHA1(f52cb5482c12a9c5fb56e2e2aec7cab0ed23e5a5) ) ROM_LOAD( "cc09", 0x2000, 0x1000, CRC(6db0879c) SHA1(c0ba1976c1dcd6edadd78073173a26851ae8dd4f) ) @@ -1149,7 +1181,7 @@ ROM_START( cclimber ) ROM_END ROM_START( cclimberj ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "cc11j.bin", 0x0000, 0x1000, CRC(89783959) SHA1(948fa88fcb9e3797b9c10934d36cf6a55cb590fe) ) ROM_LOAD( "cc10j.bin", 0x1000, 0x1000, CRC(14eda506) SHA1(4bc55b4c4ec197952b05ad32584f15f0383cc2df) ) ROM_LOAD( "cc09j.bin", 0x2000, 0x1000, CRC(26489069) SHA1(9be4d4a22dd334e619416e6c846a05003c0d687e) ) @@ -1181,7 +1213,7 @@ ROM_START( cclimberj ) ROM_END ROM_START( ccboot ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "m11.bin", 0x0000, 0x1000, CRC(5efbe180) SHA1(e0c24f21d563da075eb5019d0e76cb01c2598c7a) ) ROM_LOAD( "m10.bin", 0x1000, 0x1000, CRC(be2748c7) SHA1(ae66bc4e5e02bf9944a3ee4b0d2dec073f732260) ) ROM_LOAD( "cc09j.bin", 0x2000, 0x1000, CRC(26489069) SHA1(9be4d4a22dd334e619416e6c846a05003c0d687e) ) @@ -1214,7 +1246,7 @@ ROM_START( ccboot ) ROM_END ROM_START( ccboot2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "11.4k", 0x0000, 0x1000, CRC(b2b17e24) SHA1(1242d64242b3a6fe099457d155ebc508e5482818) ) ROM_LOAD( "10.4j", 0x1000, 0x1000, CRC(8382bc0f) SHA1(2390ee2ec08a074c7bc4b9c7750b979a1d3a8a67) ) ROM_LOAD( "cc09j.bin", 0x2000, 0x1000, CRC(26489069) SHA1(9be4d4a22dd334e619416e6c846a05003c0d687e) ) @@ -1247,7 +1279,7 @@ ROM_START( ccboot2 ) ROM_END ROM_START( ccbootmr ) /* Model Racing bootleg */ - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "211.k4", 0x0000, 0x1000, CRC(b2b17e24) SHA1(1242d64242b3a6fe099457d155ebc508e5482818) ) ROM_LOAD( "210.j4", 0x1000, 0x1000, CRC(8382bc0f) SHA1(2390ee2ec08a074c7bc4b9c7750b979a1d3a8a67) ) ROM_LOAD( "209.f4", 0x2000, 0x1000, CRC(26489069) SHA1(9be4d4a22dd334e619416e6c846a05003c0d687e) ) @@ -1281,7 +1313,7 @@ ROM_END ROM_START( cclimbroper ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "cc5-2532.cpu", 0x0000, 0x1000, CRC(f94b96e8) SHA1(b13dceb0a73d1a4eeb9c3e2d2307f0c82c365393)) ROM_LOAD( "cc4-2532.cpu", 0x1000, 0x1000, CRC(4b1abea6) SHA1(eae7c96fc0b64d313bed4a75bd6d397b37eaac7e) ) ROM_LOAD( "cc3-2532.cpu", 0x2000, 0x1000, CRC(5612bb3c) SHA1(213846bb3393467260f401b00b821cbab7ac9636) ) @@ -1318,7 +1350,7 @@ ROM_END /* Sets below are Crazy Kong Part II and have an extra screen in attract mode, showing a caged Kong and copyright */ ROM_START( ckongpt2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "7.5d", 0x0000, 0x1000, CRC(b27df032) SHA1(57f9be139c610405e3c2fddd7093dfb1277e450e) ) ROM_LOAD( "8.5e", 0x1000, 0x1000, CRC(5dc1aaba) SHA1(42b9e5946ffce7c156d114bde68f37c2c34853c4) ) ROM_LOAD( "9.5h", 0x2000, 0x1000, CRC(c9054c94) SHA1(1aa08d2501ee620759fd5c111e12f6d432c25294) ) @@ -1347,7 +1379,7 @@ ROM_START( ckongpt2 ) ROM_END ROM_START( ckongpt2a ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "7.5d", 0x0000, 0x1000, CRC(b27df032) SHA1(57f9be139c610405e3c2fddd7093dfb1277e450e) ) ROM_LOAD( "8.5e", 0x1000, 0x1000, CRC(5dc1aaba) SHA1(42b9e5946ffce7c156d114bde68f37c2c34853c4) ) ROM_LOAD( "9.5h", 0x2000, 0x1000, CRC(c9054c94) SHA1(1aa08d2501ee620759fd5c111e12f6d432c25294) ) @@ -1376,7 +1408,7 @@ ROM_START( ckongpt2a ) ROM_END ROM_START( ckongpt2j ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "7.5d", 0x0000, 0x1000, CRC(b27df032) SHA1(57f9be139c610405e3c2fddd7093dfb1277e450e) ) ROM_LOAD( "8.5e", 0x1000, 0x1000, CRC(5dc1aaba) SHA1(42b9e5946ffce7c156d114bde68f37c2c34853c4) ) ROM_LOAD( "9.5h", 0x2000, 0x1000, CRC(c9054c94) SHA1(1aa08d2501ee620759fd5c111e12f6d432c25294) ) @@ -1405,7 +1437,7 @@ ROM_START( ckongpt2j ) ROM_END ROM_START( ckongpt2jeu ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "7.5d", 0x0000, 0x1000, CRC(b27df032) SHA1(57f9be139c610405e3c2fddd7093dfb1277e450e) ) ROM_LOAD( "8.5e", 0x1000, 0x1000, CRC(5dc1aaba) SHA1(42b9e5946ffce7c156d114bde68f37c2c34853c4) ) ROM_LOAD( "9.5h", 0x2000, 0x1000, CRC(c9054c94) SHA1(1aa08d2501ee620759fd5c111e12f6d432c25294) ) @@ -1435,7 +1467,7 @@ ROM_END ROM_START( ckongpt2b ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "d05-7.rom", 0x0000, 0x1000, CRC(5d96ee9a) SHA1(f531d251fd3469edd3b5b5e7c26ff9cef7006ce8) ) ROM_LOAD( "f05-8.rom", 0x1000, 0x1000, CRC(74a8435b) SHA1(465ad96009d3ba939eee13ba0d5fd6d9dec118bc) ) ROM_LOAD( "h05-9.rom", 0x2000, 0x1000, CRC(e06ca575) SHA1(cd5a32fac614902e136e522ac188616c72d65571) ) @@ -1468,7 +1500,7 @@ ROM_END /* Sets below are 'Crazy Kong' without the extra Falcon screen or Pt. 2 subtitle, they also have worse colours */ ROM_START( ckong ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "falcon7", 0x0000, 0x1000, CRC(2171cac3) SHA1(7b18bfe44c32fb64b675bbbe2136344522c79b09) ) ROM_LOAD( "falcon8", 0x1000, 0x1000, CRC(88b83ff7) SHA1(4afc494cc264aaa4614da6aed02ce062d9c20850) ) ROM_LOAD( "falcon9", 0x2000, 0x1000, CRC(cff2af47) SHA1(1757428cefad13855a623162101ec01c04006c94) ) @@ -1498,7 +1530,7 @@ ROM_END ROM_START( ckongo ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "o55a-1", 0x0000, 0x1000, CRC(8bfb4623) SHA1(1b8e12d1f337756bbfa9c3d736db7513d571c1b3) ) ROM_LOAD( "o55a-2", 0x1000, 0x1000, CRC(9ae8089b) SHA1(e50864bb77dce24ba6d10c4fc16ccaa593962442) ) ROM_LOAD( "o55a-3", 0x2000, 0x1000, CRC(e82b33c8) SHA1(27befba696cd1a9453fb49e8e4ddd46eab41b30d) ) @@ -1532,7 +1564,7 @@ ROM_START( ckongo ) ROM_END ROM_START( ckongalc ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "ck7.bin", 0x0000, 0x1000, CRC(2171cac3) SHA1(7b18bfe44c32fb64b675bbbe2136344522c79b09) ) ROM_LOAD( "ck8.bin", 0x1000, 0x1000, CRC(88b83ff7) SHA1(4afc494cc264aaa4614da6aed02ce062d9c20850) ) ROM_LOAD( "ck9.bin", 0x2000, 0x1000, CRC(cff2af47) SHA1(1757428cefad13855a623162101ec01c04006c94) ) @@ -1561,7 +1593,7 @@ ROM_START( ckongalc ) ROM_END ROM_START( bigkong ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "dk01f7_2532.d5", 0x0000, 0x1000, CRC(4c9102f1) SHA1(845b48fa1e6ad82dc797520f7ff7daffc1a47c39) ) ROM_LOAD( "dk02f8_2532.f5", 0x1000, 0x1000, CRC(1683e9ae) SHA1(4690c8be70c0cc0e7d78d2ff205eed3f4ead7278) ) ROM_LOAD( "dk03f9_2532.h5", 0x2000, 0x1000, CRC(073eea32) SHA1(de7889df04f8a279a0864748298e5ccdce0578f1) ) @@ -1590,7 +1622,7 @@ ROM_START( bigkong ) ROM_END ROM_START( monkeyd ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "ck7.bin", 0x0000, 0x1000, CRC(2171cac3) SHA1(7b18bfe44c32fb64b675bbbe2136344522c79b09) ) ROM_LOAD( "ck8.bin", 0x1000, 0x1000, CRC(88b83ff7) SHA1(4afc494cc264aaa4614da6aed02ce062d9c20850) ) ROM_LOAD( "ck9.bin", 0x2000, 0x1000, CRC(cff2af47) SHA1(1757428cefad13855a623162101ec01c04006c94) ) @@ -1761,7 +1793,7 @@ Dip Switch - Donkey King ROM_START( dking ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "d11.r2", 0x0800, 0x0800, CRC(f7cace41) SHA1(981dbb1cddd66a0cbc8fe147172ffe7eb5b7fa21) ) ROM_CONTINUE( 0x0000, 0x800 ) ROM_LOAD( "d7.1n", 0x1000, 0x1000, CRC(fe89dea4) SHA1(c39372ebe9950808ebc1ff7909c291496b206026) ) @@ -1793,7 +1825,7 @@ ROM_END ROM_START( ckongdks ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "ck13.bin", 0x0800, 0x0800, CRC(f97ba8ae) SHA1(ae4a578ad77a8d3252f2f99a1afa6f38bc00471e) ) // 97.509766% ROM_CONTINUE( 0x0000, 0x0800 ) ROM_LOAD( "ck09.bin", 0x1000, 0x1000, CRC(fe89dea4) SHA1(c39372ebe9950808ebc1ff7909c291496b206026) ) @@ -1830,7 +1862,7 @@ ROM_END of Silver Land so I'm loading the River Patrol GFX instead as they fit better */ ROM_START( rpatrol ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "sci1.bin", 0x0000, 0x1000, CRC(33b01c90) SHA1(9c8da6dd963bfb0544ef99b8fdedcf86c32cdb6b) ) ROM_LOAD( "sci2.bin", 0x1000, 0x1000, CRC(03f53340) SHA1(35336945f4b634fc4c7791ac9c9e6643c8cd8006) ) ROM_LOAD( "sci3.bin", 0x2000, 0x1000, CRC(8fa300df) SHA1(5c3ba1ef6c1ce8df437b4fa464293208630b5e8d) ) @@ -1881,7 +1913,7 @@ ROM_START( rpatrol ) ROM_END ROM_START( rpatrolb ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "rp1.4l", 0x0000, 0x1000, CRC(bfd7ae7a) SHA1(a06d1cc2674ed40d0bfa67dd6d724964c1e40600) ) ROM_LOAD( "rp2.4j", 0x1000, 0x1000, CRC(03f53340) SHA1(35336945f4b634fc4c7791ac9c9e6643c8cd8006) ) ROM_LOAD( "rp3.4f", 0x2000, 0x1000, CRC(8fa300df) SHA1(5c3ba1ef6c1ce8df437b4fa464293208630b5e8d) ) @@ -1912,7 +1944,7 @@ ROM_START( rpatrolb ) ROM_END ROM_START( silvland ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "7.2r", 0x0000, 0x1000, CRC(57e6be62) SHA1(c1d47970f8209256c9ccd6512b921dec6c276998) ) ROM_LOAD( "8.1n", 0x1000, 0x1000, CRC(bbb2b287) SHA1(93cd4ebe238c189c80be8b8ab1ec2649256dd6ea) ) ROM_LOAD( "rp3.4f", 0x2000, 0x1000, CRC(8fa300df) SHA1(5c3ba1ef6c1ce8df437b4fa464293208630b5e8d) ) @@ -1985,7 +2017,7 @@ ROM_START( cannonb ) ROM_END ROM_START( cannonb2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "cb1.bin", 0x0000, 0x1000, CRC(7a3cba7c) SHA1(08b8b356fdbe642e80d42b5ab4164a1bd6ad93ba) ) ROM_LOAD( "cb2.bin", 0x1000, 0x1000, CRC(58ef3118) SHA1(51ae36c21147e99d4060034520f6eebf3210937c) ) ROM_LOAD( "cb3.bin", 0x2000, 0x1000, CRC(e18a836b) SHA1(19b90a55db82914c5db18486e05d9f59aba1b442) ) @@ -2016,7 +2048,7 @@ ROM_START( cannonb2 ) ROM_END ROM_START( cannonb3 ) - ROM_REGION( 0x11000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "1 pos e5 2532.bin", 0x0000, 0x1000, CRC(4b482e80) SHA1(4c0e52016ed760d399e8d49f600d38c1b6ccf256) ) ROM_LOAD( "2 pos f5 2532.bin", 0x1000, 0x1000, CRC(1fa050af) SHA1(00244e19aee14ce980697136cddb6cb72a4d80da) ) ROM_LOAD( "3 pos h5 2532.bin", 0x2000, 0x1000, CRC(e18a836b) SHA1(19b90a55db82914c5db18486e05d9f59aba1b442) ) @@ -2058,7 +2090,7 @@ ROM_END */ ROM_START( bagmanf ) - ROM_REGION( 0x11000, "maincpu", 0 ) + ROM_REGION( 0x6000, "maincpu", 0 ) ROM_LOAD( "01.d5.bin", 0x0000, 0x1000, CRC(e0156191) SHA1(bb5f16d49fbe48f3bac118acd1fea51ec4bc5355) ) ROM_LOAD( "02.f5.bin", 0x1000, 0x1000, CRC(7b758982) SHA1(c8460023b43fed4aca9c6b987faea334832c5e30) ) ROM_LOAD( "03.h5.bin", 0x2000, 0x1000, CRC(302a077b) SHA1(916c4a6ea1e631cc72bdb91ff9d263dcbaf08bb2) ) @@ -2099,7 +2131,7 @@ ROM_END ROM_START( swimmer ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "sw1", 0x0000, 0x1000, CRC(f12481e7) SHA1(4e8ee509043fd57ec1579594f0b2c543f270bead) ) ROM_LOAD( "sw2", 0x1000, 0x1000, CRC(a0b6fdd2) SHA1(7d3603de6c282224869824c7572868fc85599ea2) ) ROM_LOAD( "sw3", 0x2000, 0x1000, CRC(ec93d7de) SHA1(e225c6b98eb3c32825c1cc1fcf69dec7e340460c) ) @@ -2109,7 +2141,7 @@ ROM_START( swimmer ) ROM_LOAD( "sw7", 0x6000, 0x1000, CRC(37efb64e) SHA1(0ed4d678895c17b37df605990acd096c538e3675) ) ROM_LOAD( "sw8", 0x7000, 0x1000, CRC(33d6001e) SHA1(749b746d018e74e364fd6974e4522c8a18915774) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "sw12.4k", 0x0000, 0x1000, CRC(2eee9bcb) SHA1(ceafdf750a8af0c1c9abbbf437c3e9d9ae09f72b) ) ROM_REGION( 0x3000, "gfx1", 0 ) @@ -2132,7 +2164,7 @@ ROM_START( swimmer ) ROM_END ROM_START( swimmera ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "swa1", 0x0000, 0x1000, CRC(42c2b6c5) SHA1(13688e1ee08308b13ead5af7b4f65043dae4e40f) ) ROM_LOAD( "swa2", 0x1000, 0x1000, CRC(49bac195) SHA1(a5d2cc2cdd10003f69014c4799f5f59e47a44260) ) ROM_LOAD( "swa3", 0x2000, 0x1000, CRC(a6d8cb01) SHA1(80ab0ffaee6e0edf19b767229865722c2af6112c) ) @@ -2142,7 +2174,7 @@ ROM_START( swimmera ) ROM_LOAD( "swa7", 0x6000, 0x1000, CRC(7090e5ee) SHA1(d1e0ca38c3d1e4a7b7efa3696e47fb36ad3f8aa0) ) ROM_LOAD( "swa8", 0x7000, 0x1000, CRC(ab86efa9) SHA1(5b5a80ae285c7e9f4c51e646116edf789d4dba39) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "sw12.4k", 0x0000, 0x1000, CRC(2eee9bcb) SHA1(ceafdf750a8af0c1c9abbbf437c3e9d9ae09f72b) ) ROM_REGION( 0x3000, "gfx1", 0 ) @@ -2165,7 +2197,7 @@ ROM_START( swimmera ) ROM_END ROM_START( swimmerb ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "sw1.9l", 0x0000, 0x1000, CRC(b045be08) SHA1(52187e1daebec521a98157f22960637393e40e62) ) ROM_LOAD( "sw2.9k", 0x1000, 0x1000, CRC(163d65e5) SHA1(b505f05af96f241285f0f7082ed03fa07bbde7de) ) ROM_LOAD( "sw3.9j", 0x2000, 0x1000, CRC(631d74e9) SHA1(b6adba9445264de80f5daf33dad1c90b23617648) ) @@ -2175,7 +2207,7 @@ ROM_START( swimmerb ) ROM_LOAD( "sw7.9c", 0x6000, 0x1000, CRC(88266f2e) SHA1(4ad15f9ba7b45a6c1c3637f8d0fd8be9c04b495f) ) ROM_LOAD( "sw8.9a", 0x7000, 0x1000, CRC(191a16e4) SHA1(75d3f49e2f4ea04d3a7cc88662c023768bf48365) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "sw12.4k", 0x0000, 0x1000, CRC(2eee9bcb) SHA1(ceafdf750a8af0c1c9abbbf437c3e9d9ae09f72b) ) ROM_REGION( 0x3000, "gfx1", 0 ) @@ -2205,7 +2237,7 @@ ROM_START( guzzler ) ROM_LOAD( "guzz-04.bin", 0x6000, 0x2000, CRC(45be42f5) SHA1(578943afdb6ceca34ca7c19c2fd1164ca3aa57bd) ) ROM_LOAD( "guzz-16.bin", 0xe000, 0x2000, CRC(61ee00b7) SHA1(ea8516c8dfb2de32a8034f94c7d0c086e3596740) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "guzz-12.bin", 0x0000, 0x1000, CRC(f3754d9e) SHA1(bb30832aba4e82ab0ecce40fc1223d9771ff7dd2) ) ROM_REGION( 0x3000, "gfx1", 0 ) @@ -2236,7 +2268,7 @@ ROM_START( guzzlers ) /* Swimmer Conversion, 1k vs 2k romsize in maincpu */ ROM_LOAD( "guzz8.a9", 0x7000, 0x1000, CRC(8d44f5f8) SHA1(957f1b880f6f815ac31c1a37c40cdff75dd119cf) ) ROM_LOAD( "guzz-16.bin", 0xe000, 0x2000, CRC(61ee00b7) SHA1(ea8516c8dfb2de32a8034f94c7d0c086e3596740) ) // 16. - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "guzz-12.bin", 0x0000, 0x1000, CRC(f3754d9e) SHA1(bb30832aba4e82ab0ecce40fc1223d9771ff7dd2) ) // GUZZ12.L4 ROM_REGION( 0x3000, "gfx1", 0 ) /* chars */ @@ -2256,14 +2288,14 @@ ROM_START( guzzlers ) /* Swimmer Conversion, 1k vs 2k romsize in maincpu */ ROM_END ROM_START( yamato ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "2.5de", 0x0000, 0x2000, CRC(20895096) SHA1(af76786e3c519e710899f143d46c53087e9817c7) ) ROM_LOAD( "3.5f", 0x2000, 0x2000, CRC(57a696f9) SHA1(28ea80fb100ac92295fc3eb318617d7cb014408d) ) ROM_LOAD( "4.5jh", 0x4000, 0x2000, CRC(59a468e8) SHA1(a79cdee6efefd87a356cc8d710f8050bc12e07c3) ) /* hole at 6000-6fff */ ROM_LOAD( "11.5a", 0x7000, 0x1000, CRC(35987485) SHA1(1f0cb545bbd52982cbf801bc1dd2c4087af2f5f7) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x800, "audiocpu", 0 ) ROM_LOAD( "1.5v", 0x0000, 0x0800, CRC(3aad9e3c) SHA1(37b0414b265397881bb45b166ecab85880d1358d) ) ROM_REGION( 0x4000, "gfx1", 0 ) @@ -2287,14 +2319,14 @@ ROM_START( yamato ) ROM_END ROM_START( yamato2 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "2-2.5de", 0x0000, 0x2000, CRC(93da1d52) SHA1(21b72856ebbd969e4e075b52719e6acdbd1bc4c5) ) ROM_LOAD( "3-2.5f", 0x2000, 0x2000, CRC(31e73821) SHA1(e582c9fcea1b29d43f65b6aa67e1895c38d2736c) ) ROM_LOAD( "4-2.5jh", 0x4000, 0x2000, CRC(fd7bcfc3) SHA1(5037170cb3a9824794e90d74def92b0b25d45caa) ) /* hole at 6000-6fff */ /* 7000-7fff not present here */ - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "1.5v", 0x0000, 0x0800, CRC(3aad9e3c) SHA1(37b0414b265397881bb45b166ecab85880d1358d) ) ROM_REGION( 0x4000, "gfx1", 0 ) @@ -2318,7 +2350,7 @@ ROM_START( yamato2 ) ROM_END ROM_START( toprollr ) - ROM_REGION( 0x10000*2, "maincpu", 0 ) + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "10.k3", 0xc000, 0x2000, CRC(1e8914a6) SHA1(ec17f185f890d04ce75a5d8edf8b32da60e7a8d8) ) ROM_LOAD( "11.l3", 0xe000, 0x2000, CRC(b20a9fa2) SHA1(accd3296447eca002b0808e7b02832f5e35407e8) ) @@ -2361,13 +2393,69 @@ ROM_END DRIVER_INIT_MEMBER(cclimber_state,yamato) { - yamato_decode(machine(),"maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable); + + save_item(NAME(m_yamato_p0)); + save_item(NAME(m_yamato_p1)); } DRIVER_INIT_MEMBER(cclimber_state,toprollr) { - toprollr_decode(machine(), "maincpu", "user1"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + UINT8 *opcodes = auto_alloc_array(machine(), UINT8, 0x6000*3); + sega_decode(memregion("user1")->base(), opcodes, 0, convtable, 3, 0x6000); + + membank("bank1")->configure_entries(0, 3, memregion("user1")->base(), 0x6000); + membank("bank1d")->configure_entries(0, 3, opcodes, 0x6000); + + membank("bank1")->set_entry(0); + membank("bank1d")->set_entry(0); + + save_item(NAME(m_toprollr_rombank)); } DRIVER_INIT_MEMBER(cclimber_state,dking) @@ -2385,56 +2473,56 @@ DRIVER_INIT_MEMBER(cclimber_state,dking) } -GAME( 1980, cclimber, 0, cclimber, cclimber, cclimber_state, cclimber, ROT0, "Nichibutsu", "Crazy Climber (US)", 0 ) -GAME( 1980, cclimberj, cclimber, cclimber, cclimberj, cclimber_state,cclimberj,ROT0, "Nichibutsu", "Crazy Climber (Japan)", 0 ) -GAME( 1980, ccboot, cclimber, cclimber, cclimber, cclimber_state, cclimberj,ROT0, "bootleg", "Crazy Climber (bootleg set 1)", 0 ) -GAME( 1980, ccboot2, cclimber, cclimber, cclimber, cclimber_state, cclimberj,ROT0, "bootleg", "Crazy Climber (bootleg set 2)", 0 ) -GAME( 1980, ccbootmr, cclimber, cclimber, cclimber, cclimber_state, cclimberj,ROT0, "bootleg (Model Racing)", "Crazy Climber (Model Racing bootleg)", 0 ) -GAME( 1980, cclimbroper, cclimber, cclimber, cclimber, driver_device, 0, ROT0, "bootleg (Operamatic)", "Crazy Climber (Spanish, Operamatic bootleg)", 0 ) +GAME( 1980, cclimber, 0, cclimberx, cclimber, cclimber_state, cclimber, ROT0, "Nichibutsu", "Crazy Climber (US)", GAME_SUPPORTS_SAVE ) +GAME( 1980, cclimberj, cclimber, cclimberx, cclimberj, cclimber_state,cclimberj,ROT0, "Nichibutsu", "Crazy Climber (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1980, ccboot, cclimber, cclimberx, cclimber, cclimber_state, cclimberj,ROT0, "bootleg", "Crazy Climber (bootleg set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1980, ccboot2, cclimber, cclimberx, cclimber, cclimber_state, cclimberj,ROT0, "bootleg", "Crazy Climber (bootleg set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1980, ccbootmr, cclimber, cclimberx, cclimber, cclimber_state, cclimberj,ROT0, "bootleg (Model Racing)", "Crazy Climber (Model Racing bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1980, cclimbroper, cclimber, cclimber, cclimber, driver_device, 0, ROT0, "bootleg (Operamatic)", "Crazy Climber (Spanish, Operamatic bootleg)", GAME_SUPPORTS_SAVE ) /* these sets have ugly colours, no extra attract screen, and no graphics for the extra attract screen in the BG roms - there is a Falcon logo in the text roms which is unused - does the code to display the extra screen still exist in the roms? */ -GAME( 1981, ckong, 0, cclimber, ckong, driver_device, 0, ROT270, "Kyoei / Falcon", "Crazy Kong", 0 ) // on a Falcon FCK-01 PCB, but doesn't display any Falcon copyright -GAME( 1981, ckongalc, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Alca)", "Crazy Kong (Alca bootleg)", 0 ) -GAME( 1981, monkeyd, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Monkey Donkey", 0 ) -GAME( 1981, dking, ckong, cclimber, ckong, cclimber_state, dking, ROT270, "bootleg", "Donkey King", 0 ) // supposedly, possibly by Hafasonic? -GAME( 1981, ckongdks, ckong, cclimber, ckong, cclimber_state, dking, ROT270, "bootleg", "Donkey Kong (Spanish Crazy Kong bootleg)", 0 ) +GAME( 1981, ckong, 0, cclimber, ckong, driver_device, 0, ROT270, "Kyoei / Falcon", "Crazy Kong", GAME_SUPPORTS_SAVE ) // on a Falcon FCK-01 PCB, but doesn't display any Falcon copyright +GAME( 1981, ckongalc, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Alca)", "Crazy Kong (Alca bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1981, monkeyd, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Monkey Donkey", GAME_SUPPORTS_SAVE ) +GAME( 1981, dking, ckong, cclimber, ckong, cclimber_state, dking, ROT270, "bootleg", "Donkey King", GAME_SUPPORTS_SAVE ) // supposedly, possibly by Hafasonic? +GAME( 1981, ckongdks, ckong, cclimber, ckong, cclimber_state, dking, ROT270, "bootleg", "Donkey Kong (Spanish Crazy Kong bootleg)", GAME_SUPPORTS_SAVE ) /* these sets have correct colours, and also contain the graphics used for the extra attract screen in the BG roms, but it is unused - the Falcon logo in the text roms is still unused - does the code to display the extra screen still exist in the roms? */ -GAME( 1981, ckongo, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Orca)", "Crazy Kong (Orca bootleg)", 0 ) -GAME( 1981, bigkong, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Big Kong", 0 ) +GAME( 1981, ckongo, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Orca)", "Crazy Kong (Orca bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1981, bigkong, ckong, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Big Kong", GAME_SUPPORTS_SAVE ) /* these sets have correct colours, and the extra attract screen, they also make use of the Falcon logo, some sets hack out the Falcon text on the extra screen */ -GAME( 1981, ckongpt2, 0, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (set 1)", 0 ) -GAME( 1981, ckongpt2a, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (set 2)", 0 ) -GAME( 1981, ckongpt2j, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (Japan)", 0 ) -GAME( 1981, ckongpt2jeu, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Jeutel)", "Crazy Kong Part II (Jeutel bootleg)", 0 ) -GAME( 1981, ckongpt2b, ckongpt2, cclimber, ckongb, cclimber_state, ckongb, ROT270, "bootleg", "Crazy Kong Part II (alternative levels)", 0 ) +GAME( 1981, ckongpt2, 0, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, ckongpt2a, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1981, ckongpt2j, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "Falcon", "Crazy Kong Part II (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1981, ckongpt2jeu, ckongpt2, cclimber, ckong, driver_device, 0, ROT270, "bootleg (Jeutel)", "Crazy Kong Part II (Jeutel bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1981, ckongpt2b, ckongpt2, cclimber, ckongb, cclimber_state, ckongb, ROT270, "bootleg", "Crazy Kong Part II (alternative levels)", GAME_SUPPORTS_SAVE ) // see bagman.c for parent -GAME( 1981, bagmanf, bagman, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Bagman (bootleg on Crazy Kong hardware)", GAME_NOT_WORKING ) +GAME( 1981, bagmanf, bagman, cclimber, ckong, driver_device, 0, ROT270, "bootleg", "Bagman (bootleg on Crazy Kong hardware)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) -GAME( 1981, rpatrol, 0, cclimber, rpatrol, driver_device, 0, ROT0, "Orca", "River Patrol (Orca)", 0 ) -GAME( 1981, rpatrolb, rpatrol, cclimber, rpatrol, driver_device, 0, ROT0, "bootleg", "River Patrol (bootleg)", 0 ) -GAME( 1981, silvland, rpatrol, cclimber, rpatrol, driver_device, 0, ROT0, "Falcon", "Silver Land", 0 ) +GAME( 1981, rpatrol, 0, cclimber, rpatrol, driver_device, 0, ROT0, "Orca", "River Patrol (Orca)", GAME_SUPPORTS_SAVE ) +GAME( 1981, rpatrolb, rpatrol, cclimber, rpatrol, driver_device, 0, ROT0, "bootleg", "River Patrol (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1981, silvland, rpatrol, cclimber, rpatrol, driver_device, 0, ROT0, "Falcon", "Silver Land", GAME_SUPPORTS_SAVE ) // see pacman.c for parent -GAME( 1985, cannonb, cannonbp, cannonb, cannonb, cclimber_state, cannonb, ROT90, "bootleg (Soft)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 1, buggy)" , GAME_IMPERFECT_GRAPHICS ) // bootleggers missed protection after bonus game -GAME( 1985, cannonb2, cannonbp, cannonb, cannonb, cclimber_state, cannonb2, ROT90, "bootleg (TV Game Gruenberg)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 2, buggy)", 0 ) // bootleggers missed protection after bonus game -GAME( 1985, cannonb3, cannonbp, cannonb, cannonb, cclimber_state, cannonb2, ROT90, "bootleg (Soft)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 3, no bonus game)", 0 ) // the bonus game is patched out, thus avoiding the protection issue +GAME( 1985, cannonb, cannonbp, cannonb, cannonb, cclimber_state, cannonb, ROT90, "bootleg (Soft)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 1, buggy)" , GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // bootleggers missed protection after bonus game +GAME( 1985, cannonb2, cannonbp, cannonb, cannonb, cclimber_state, cannonb2, ROT90, "bootleg (TV Game Gruenberg)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 2, buggy)", GAME_SUPPORTS_SAVE ) // bootleggers missed protection after bonus game +GAME( 1985, cannonb3, cannonbp, cannonb, cannonb, cclimber_state, cannonb2, ROT90, "bootleg (Soft)", "Cannon Ball (bootleg on Crazy Kong hardware) (set 3, no bonus game)", GAME_SUPPORTS_SAVE ) // the bonus game is patched out, thus avoiding the protection issue -GAME( 1982, swimmer, 0, swimmer, swimmer, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 1)", 0 ) -GAME( 1982, swimmera, swimmer, swimmer, swimmer, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 2)", 0 ) -GAME( 1982, swimmerb, swimmer, swimmer, swimmerb, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 3)", 0 ) +GAME( 1982, swimmer, 0, swimmer, swimmer, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, swimmera, swimmer, swimmer, swimmer, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, swimmerb, swimmer, swimmer, swimmerb, driver_device, 0, ROT0, "Tehkan", "Swimmer (set 3)", GAME_SUPPORTS_SAVE ) -GAME( 1983, guzzler, 0, swimmer, guzzler, driver_device, 0, ROT90, "Tehkan", "Guzzler", 0 ) -GAME( 1983, guzzlers, guzzler, swimmer, guzzler, driver_device, 0, ROT90, "Tehkan", "Guzzler (Swimmer Conversion)", 0 ) +GAME( 1983, guzzler, 0, guzzler, guzzler, driver_device, 0, ROT90, "Tehkan", "Guzzler", GAME_SUPPORTS_SAVE ) +GAME( 1983, guzzlers, guzzler, guzzler, guzzler, driver_device, 0, ROT90, "Tehkan", "Guzzler (Swimmer Conversion)", GAME_SUPPORTS_SAVE ) -GAME( 1983, yamato, 0, yamato, yamato, cclimber_state, yamato, ROT90, "Sega", "Yamato (US)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1983, yamato2, yamato, yamato, yamato, cclimber_state, yamato, ROT90, "Sega", "Yamato (World?)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1983, yamato, 0, yamato, yamato, cclimber_state, yamato, ROT90, "Sega", "Yamato (US)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1983, yamato2, yamato, yamato, yamato, cclimber_state, yamato, ROT90, "Sega", "Yamato (World?)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) -GAME( 1983, toprollr, 0, toprollr, toprollr, cclimber_state, toprollr, ROT90, "Jaleco", "Top Roller", GAME_IMPERFECT_COLORS ) +GAME( 1983, toprollr, 0, toprollr, toprollr, cclimber_state, toprollr, ROT90, "Jaleco", "Top Roller", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c index 8f58e73b59e..1584247309c 100644 --- a/src/mame/drivers/chihiro.c +++ b/src/mame/drivers/chihiro.c @@ -13,9 +13,9 @@ Games on this system include.... |*| 2003 | Crazy Taxi High Roller (Rev B) | Sega / Hitmaker | GDROM | GDX-0002B | 317-0353-COM | | | 2003 | Virtua Cop 3 | Sega | GDROM | GDX-0003 | 317-0354-COM | |*| 2003 | Virtua Cop 3 (Rev A) | Sega | GDROM | GDX-0003A | 317-0354-COM | -| | 2003 | Out Run 2 | Sega | GDROM | GDX-0004 | 317-0372-COM | -|*| 2003 | Out Run 2 (Rev A) | Sega | GDROM | GDX-0004A | 317-0372-COM | -| | 2003 | Out Run 2 prototype (Rev P) | Sega | GDROM | GDX-0004P | | +| | 2003 | OutRun 2 | Sega | GDROM | GDX-0004 | 317-0372-COM | +|*| 2003 | OutRun 2 (Rev A) | Sega | GDROM | GDX-0004A | 317-0372-COM | +| | 2003 | OutRun 2 prototype (Rev P ) | Sega | GDROM | GDX-0004P | | | | 2004 | Sega Golf Club Network Pro Tour | Sega | GDROM | GDX-0005 | | | | 2004 | Sega Network Taisen Mahjong MJ 2 | Sega | GDROM | GDX-0006 | | | | 2004 | Sega Network Taisen Mahjong MJ 2 (Rev A) | Sega | GDROM | GDX-0006A | | @@ -32,15 +32,15 @@ Games on this system include.... | | 2004 | Wangan Midnight Maximum Tune (Export) | Namco | GDROM | GDX-0009 | 317-5101-COM | | | 2004 | Wangan Midnight Maximum Tune (Export) (Rev A) | Namco | GDROM | GDX-0009A | 317-5101-COM | |*| 2004 | Wangan Midnight Maximum Tune (Export) (Rev B) | Namco | GDROM | GDX-0009B | 317-5101-COM | -| | 2004 | Outrun 2 SP (Japan) | Sega | GDROM | GDX-0011 | | +| | 2004 | OutRun 2 SP (Japan) | Sega | GDROM | GDX-0011 | | |*| 2004 | Ghost Squad | Sega | GDROM | GDX-0012 | 317-0398-COM | |*| 2004 | Ghost Squad (Rev A) | Sega | GDROM | GDX-0012A | 317-0398-COM | |*| 2005 | Gundam Battle Operating Simulator | Banpresto | GDROM | GDX-0013 | 317-0400-JPN | -| | 2004 | Outrun 2 Special Tours | Sega | GDROM | GDX-0014 | 317-0xxx-COM | -|*| 2004 | Outrun 2 Special Tours (Rev A) | Sega | GDROM | GDX-0014A | 317-0xxx-COM | +| | 2004 | OutRun 2 Special Tours | Sega | GDROM | GDX-0014 | 317-0xxx-COM | +|*| 2004 | OutRun 2 Special Tours (Rev A) | Sega | GDROM | GDX-0014A | 317-0xxx-COM | |*| 2005 | Wangan Midnight Maximum Tune 2 (Japan) | Namco | GDROM | GDX-0015 | 317-5106-JPN | -|*| 2005 | Wangan Midnight Maximum Tune 2 (Japan) (Rev A) | Namco | GDROM | GDX-0015A | 317-5106-JPN | -|*| 2005 | Wangan Midnight Maximum Tune 2 (Export) | Namco | GDROM | GDX-0016 | 317-5106-COM | +| | 2005 | Wangan Midnight Maximum Tune 2 (Export) | Namco | GDROM | GDX-0016 | 317-5106-COM | +|*| 2005 | Wangan Midnight Maximum Tune 2 (Export) | Namco | GDROM | GDX-0016A | 317-5106-COM | | | 2005 | Sega Network Taisen Mahjong MJ 3 | Sega | GDROM | GDX-0017 | 317-0414-JPN | | | 2005 | Sega Network Taisen Mahjong MJ 3 (Rev A) | Sega | GDROM | GDX-0017A | 317-0414-JPN | | | 2005 | Sega Network Taisen Mahjong MJ 3 (Rev B) | Sega | GDROM | GDX-0017B | 317-0414-JPN | @@ -2347,8 +2347,8 @@ ROM_START( mj2c ) DISK_REGION( "gdrom" ) DISK_IMAGE_READONLY( "gdx-0006c", 0, BAD_DUMP SHA1(505653117a73ed8b256ccf19450e7573a4dc57e9) ) - ROM_REGION( 0x50, "pic", ROMREGION_ERASE) // key was missing - ROM_LOAD("317-0374-jpn.data", 0x00, 0x50, NO_DUMP ) + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + ROM_LOAD( "317-0374-jpn.pic", 0x000000, 0x004000, CRC(004f77a1) SHA1(bc5c6950293f3bff60bf7913d20a2046aa19ea69) ) ROM_END ROM_START( mj2f ) @@ -2357,8 +2357,8 @@ ROM_START( mj2f ) DISK_REGION( "gdrom" ) DISK_IMAGE_READONLY( "gdx-0006f", 0, SHA1(d3900ca5135f9001e642c78b4d323d353880b41b) ) - ROM_REGION( 0x50, "pic", ROMREGION_ERASE) // key was missing - ROM_LOAD("317-0374-jpn.data", 0x00, 0x50, NO_DUMP ) + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + ROM_LOAD( "317-0374-jpn.pic", 0x000000, 0x004000, CRC(004f77a1) SHA1(bc5c6950293f3bff60bf7913d20a2046aa19ea69) ) ROM_END /* @@ -2383,8 +2383,8 @@ ROM_START( mj2 ) DISK_REGION( "gdrom" ) DISK_IMAGE_READONLY( "gdx-0006g", 0, SHA1(e306837d5c093fdf1e9ff02239a8563535b1c181) ) - ROM_REGION( 0x50, "pic", ROMREGION_ERASE) // key was missing - ROM_LOAD("317-0374-jpn.data", 0x00, 0x50, NO_DUMP ) + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + ROM_LOAD( "317-0374-jpn.pic", 0x000000, 0x004000, CRC(004f77a1) SHA1(bc5c6950293f3bff60bf7913d20a2046aa19ea69) ) ROM_END ROM_START( ollie ) @@ -2463,21 +2463,21 @@ ROM_START( outr2st ) ROM_LOAD( "317-0xxx-com.pic", 0x000000, 0x004000, CRC(f94cf26f) SHA1(dd4af2b52935c7b2d8cd196ec1a30c0ef0993322) ) ROM_END -ROM_START( wangmd2b ) +ROM_START( wangmid2 ) CHIHIRO_BIOS DISK_REGION( "gdrom" ) - DISK_IMAGE_READONLY( "gdx-0015a", 0, BAD_DUMP SHA1(cb306df60550bbd8df312634cb97014bb39f1631) ) + DISK_IMAGE_READONLY( "gdx-0015", 0, BAD_DUMP SHA1(259483fd211a70c23205ffd852316d616c5a2740) ) ROM_REGION( 0x50, "pic", ROMREGION_ERASE) ROM_LOAD("317-5106-jpn.data", 0x00, 0x50, CRC(75c716aa) SHA1(5c2bcf3d28a80b336c6882d5aeb010d04327f8c1) ) ROM_END -ROM_START( wangmid2 ) +ROM_START( wangmd2b ) CHIHIRO_BIOS DISK_REGION( "gdrom" ) - DISK_IMAGE_READONLY( "gdx-0016", 0, BAD_DUMP SHA1(259483fd211a70c23205ffd852316d616c5a2740) ) + DISK_IMAGE_READONLY( "gdx-0016a", 0, BAD_DUMP SHA1(cb306df60550bbd8df312634cb97014bb39f1631) ) ROM_REGION( 0x50, "pic", ROMREGION_ERASE) ROM_LOAD("317-5106-com.data", 0x00, 0x50, CRC(75c716aa) SHA1(5c2bcf3d28a80b336c6882d5aeb010d04327f8c1) ) @@ -2489,8 +2489,8 @@ ROM_START( mj3d ) DISK_REGION( "gdrom" ) DISK_IMAGE_READONLY( "gdx-0017d", 0, BAD_DUMP SHA1(cfbbd452c8f4efe0e99f398f5521fc3574b913bb) ) - ROM_REGION( 0x50, "pic", ROMREGION_ERASE) // key was missing - ROM_LOAD("317-0414-jpn.data", 0x00, 0x50, NO_DUMP ) + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + ROM_LOAD( "317-0414-jpn.pic", 0x000000, 0x004000, CRC(27d1c541) SHA1(c85a8229dd769af02ab43c97f09f995743cdb315) ) ROM_END ROM_START( mj3 ) @@ -2499,8 +2499,8 @@ ROM_START( mj3 ) DISK_REGION( "gdrom" ) DISK_IMAGE_READONLY( "gdx-0017f", 0, SHA1(8641be9b2e1d8eb33cf27d3444956c0117debc2f) ) - ROM_REGION( 0x50, "pic", ROMREGION_ERASE) // key was missing - ROM_LOAD("317-0414-jpn.data", 0x00, 0x50, NO_DUMP ) + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + ROM_LOAD( "317-0414-jpn.pic", 0x000000, 0x004000, CRC(27d1c541) SHA1(c85a8229dd769af02ab43c97f09f995743cdb315) ) ROM_END ROM_START( scg06nt ) @@ -2552,8 +2552,8 @@ ROM_END /* 0002B */ GAME( 2003, crtaxihr, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega / Hitmaker", "Crazy Taxi High Roller (Rev B) (GDX-0002B)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0003 GAME( 2003, vcop3o, vcop3, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Virtua Cop 3 (GDX-0003)", GAME_NO_SOUND|GAME_NOT_WORKING ) /* 0003A */ GAME( 2003, vcop3, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Virtua Cop 3 (Rev A) (GDX-0003A)", GAME_NO_SOUND|GAME_NOT_WORKING ) -// 0004 GAME( 2003, outr2o, outr2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Out Run 2 (GDX-0004)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) -/* 0004A */ GAME( 2003, outr2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Out Run 2 (Rev A) (GDX-0004A)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) +// 0004 GAME( 2003, outr2o, outr2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "OutRun 2 (GDX-0004)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) +/* 0004A */ GAME( 2003, outr2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "OutRun 2 (Rev A) (GDX-0004A)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) // 0005 GAME( 2004, sgolcnpt, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Golf Club Network Pro Tour (GDX-0005)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) // 0006 GAME( 2004, mj2o, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (GDX-0006)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0006A GAME( 2004, mj2a, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev A) (GDX-0006A)", GAME_NO_SOUND|GAME_NOT_WORKING ) @@ -2571,15 +2571,15 @@ ROM_END // 0009A GAME( 2004, wangmida, wangmid, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune (Export) (Rev A) (GDX-0009A)", GAME_NO_SOUND|GAME_NOT_WORKING ) /* 0009B */ GAME( 2004, wangmid, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune (Export) (Rev B) (GDX-0009B)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0010 -// 0011 GAME( 2004, outr2sp, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Out Run 2 SP (Japan) (GDX-0011)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) +// 0011 GAME( 2004, outr2sp, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "OutRun 2 SP (Japan) (GDX-0011)", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) /* 0012 */ GAME( 2004, ghostsqo, ghostsqu, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Ghost Squad (GDX-0012)", GAME_NO_SOUND|GAME_NOT_WORKING ) /* 0012A */ GAME( 2004, ghostsqu, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Ghost Squad (Rev A) (GDX-0012A)", GAME_NO_SOUND|GAME_NOT_WORKING ) /* 0013 */ GAME( 2005, gundamos, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Gundam Battle Operating Simulator (GDX-0013)", GAME_NO_SOUND|GAME_NOT_WORKING ) -// 0014 GAME( 2004, outr2sto, outr2st, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Out Run 2 Special Tours (GDX-0014)", GAME_NO_SOUND|GAME_NOT_WORKING ) -/* 0014A */ GAME( 2004, outr2st, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Out Run 2 Special Tours (Rev A) (GDX-0014A)", GAME_NO_SOUND|GAME_NOT_WORKING ) -// 0015 GAME( 2005, wanmd2bo, wangmd2b, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Japan) (GDX-0015)", GAME_NO_SOUND|GAME_NOT_WORKING ) -/* 0015A */ GAME( 2005, wangmd2b, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Japan) (Rev A) (GDX-0015A)", GAME_NO_SOUND|GAME_NOT_WORKING ) -/* 0016 */ GAME( 2005, wangmid2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Export) (GDX-0016)", GAME_NO_SOUND|GAME_NOT_WORKING ) +// 0014 GAME( 2004, outr2sto, outr2st, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "OutRun 2 Special Tours (GDX-0014)", GAME_NO_SOUND|GAME_NOT_WORKING ) +/* 0014A */ GAME( 2004, outr2st, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "OutRun 2 Special Tours (Rev A) (GDX-0014A)", GAME_NO_SOUND|GAME_NOT_WORKING ) +/* 0015 */ GAME( 2005, wangmid2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Japan) (GDX-0015)", GAME_NO_SOUND|GAME_NOT_WORKING ) +// 0016 GAME( 2005, wanmd2bo, wangmd2b, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Export) (GDX-0016)", GAME_NO_SOUND|GAME_NOT_WORKING ) +/* 0016A */ GAME( 2005, wangmd2b, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune 2 (Export) (Rev A) (GDX-0016A)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0017 GAME( 2005, mj3o, mj3, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 3 (GDX-0017)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0017A GAME( 2005, mj3a, mj3, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 3 (Rev A) (GDX-0017A)", GAME_NO_SOUND|GAME_NOT_WORKING ) // 0017B GAME( 2005, mj3b, mj3, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 3 (Rev B) (GDX-0017B)", GAME_NO_SOUND|GAME_NOT_WORKING ) diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c index 33031e08dac..fca2227d2be 100644 --- a/src/mame/drivers/chinsan.c +++ b/src/mame/drivers/chinsan.c @@ -87,6 +87,7 @@ public: required_device<msm5205_device> m_adpcm; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + UINT8 *m_decrypted_opcodes; }; @@ -139,6 +140,7 @@ UINT32 chinsan_state::screen_update_chinsan(screen_device &screen, bitmap_ind16 WRITE8_MEMBER(chinsan_state::ctrl_w) { membank("bank1")->set_entry(data >> 6); + membank("bank1d")->set_entry(data >> 6); } WRITE8_MEMBER(chinsan_state::ym_port_w1) @@ -248,6 +250,11 @@ static ADDRESS_MAP_START( chinsan_map, AS_PROGRAM, 8, chinsan_state ) AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("video") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, chinsan_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") +ADDRESS_MAP_END + static ADDRESS_MAP_START( chinsan_io, AS_IO, 8, chinsan_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(chinsan_port00_w) @@ -564,7 +571,9 @@ WRITE_LINE_MEMBER(chinsan_state::chin_adpcm_int) void chinsan_state::machine_start() { - membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); + membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x8000, 0x4000); + membank("bank0d")->set_base(m_decrypted_opcodes); + membank("bank1d")->configure_entries(0, 4, m_decrypted_opcodes + 0x8000, 0x4000); save_item(NAME(m_adpcm_idle)); save_item(NAME(m_port_select)); @@ -589,6 +598,7 @@ static MACHINE_CONFIG_START( chinsan, chinsan_state ) MCFG_CPU_ADD("maincpu", Z80,10000000/2) /* ? MHz */ MCFG_CPU_PROGRAM_MAP(chinsan_map) MCFG_CPU_IO_MAP(chinsan_io) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", chinsan_state, irq0_line_hold) @@ -633,10 +643,10 @@ MACHINE_CONFIG_END *************************************/ ROM_START( chinsan ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* encrypted code / data */ + ROM_REGION( 0x18000, "maincpu", 0 ) /* encrypted code / data */ ROM_LOAD( "mm00.7d", 0x00000, 0x08000, CRC(f7a4414f) SHA1(f65223b2928f610ab97fda2f2c008806cf2420e5) ) ROM_CONTINUE( 0x00000, 0x08000 ) // first half is blank - ROM_LOAD( "mm01.8d", 0x10000, 0x10000, CRC(c69ddbf5) SHA1(9533365c1761b113174d53a2e23ce6a7baca7dfe) ) + ROM_LOAD( "mm01.8d", 0x08000, 0x10000, CRC(c69ddbf5) SHA1(9533365c1761b113174d53a2e23ce6a7baca7dfe) ) ROM_REGION( 0x2000, "user1", 0 ) /* MC8123 key */ ROM_LOAD( "317-5012.key", 0x0000, 0x2000, CRC(2ecfb132) SHA1(3110ef82080dd7d908cc6bf34c6643f187f90b29) ) @@ -667,7 +677,8 @@ ROM_END DRIVER_INIT_MEMBER(chinsan_state,chinsan) { - mc8123_decrypt_rom(machine(), "maincpu", "user1", "bank1", 4); + m_decrypted_opcodes = auto_alloc_array(machine(), UINT8, 0x18000); + mc8123_decode(memregion("maincpu")->base(), m_decrypted_opcodes, memregion("user1")->base(), 0x18000); } diff --git a/src/mame/drivers/chsuper.c b/src/mame/drivers/chsuper.c index 78fdc8f0238..70f99cb2d77 100644 --- a/src/mame/drivers/chsuper.c +++ b/src/mame/drivers/chsuper.c @@ -135,21 +135,21 @@ WRITE8_MEMBER( chsuper_state::chsuper_vram_w ) */ -WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh +WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh { coin_counter_w(machine(), 0, data & 0x01); // Coin counter - output_set_lamp_value(0, (data >> 1) & 1); // Hold 1 / Black (Nero) lamp. - coin_counter_w(machine(), 1, data & 0x04); // Payout / Ticket Out pulse - output_set_lamp_value(1, (data >> 3) & 1); // Hold 2 / Low (Bassa) lamp. + output_set_lamp_value(0, (data >> 1) & 1); // Hold 1 / Black (Nero) lamp. + coin_counter_w(machine(), 1, data & 0x04); // Payout / Ticket Out pulse + output_set_lamp_value(1, (data >> 3) & 1); // Hold 2 / Low (Bassa) lamp. // D4: unused... - output_set_lamp_value(5, (data >> 5) & 1); // BET lamp + output_set_lamp_value(5, (data >> 5) & 1); // BET lamp // D6: ticket motor... // D7: unused... /* Workaround to get the HOLD 3 lamp line active, from the HOLD 1 and HOLD 5 lamps status... */ - m_blacklamp = (data >> 1) & 1; // latching the BLACK lamp status... + m_blacklamp = (data >> 1) & 1; // latching the BLACK lamp status... if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { @@ -161,29 +161,29 @@ WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh } } -WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh +WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh { // D0: unknown... // D1: unused... - output_set_lamp_value(3, (data >> 2) & 1); // Hold 4 / High (Alta) lamp. + output_set_lamp_value(3, (data >> 2) & 1); // Hold 4 / High (Alta) lamp. // D3: unused... // D4: unused... - output_set_lamp_value(4, (data >> 5) & 1); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. - output_set_lamp_value(6, (data >> 6) & 1); // Start / Gamble (Raddoppio) lamp. + output_set_lamp_value(4, (data >> 5) & 1); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. + output_set_lamp_value(6, (data >> 6) & 1); // Start / Gamble (Raddoppio) lamp. // D7: unused... /* Workaround to get the HOLD 3 lamp line active, from the HOLD 1 and HOLD 5 lamps status... */ - m_redlamp = (data >> 5) & 1; // latching the RED lamp status... + m_redlamp = (data >> 5) & 1; // latching the RED lamp status... - if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... + if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { - output_set_lamp_value(2, 1); // Hold 3 ON + output_set_lamp_value(2, 1); // Hold 3 ON } else { - output_set_lamp_value(2, 0); // Hold 3 OFF + output_set_lamp_value(2, 0); // Hold 3 OFF } } @@ -208,7 +208,7 @@ static ADDRESS_MAP_START( chsuper_portmap, AS_IO, 8, chsuper_state ) AM_RANGE( 0x00fc, 0x00fc ) AM_DEVWRITE("ramdac", ramdac_device, index_w) AM_RANGE( 0x00fd, 0x00fd ) AM_DEVWRITE("ramdac", ramdac_device, pal_w) AM_RANGE( 0x00fe, 0x00fe ) AM_DEVWRITE("ramdac", ramdac_device, mask_w) - AM_RANGE( 0x8300, 0x8300 ) AM_READ_PORT("IN2") // valid input port present in test mode. + AM_RANGE( 0x8300, 0x8300 ) AM_READ_PORT("IN2") // valid input port present in test mode. AM_RANGE( 0xff20, 0xff3f ) AM_DEVWRITE("dac", dac_device, write_unsigned8) // unk writes ADDRESS_MAP_END @@ -263,7 +263,7 @@ static INPUT_PORTS_START( chsuper ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) PORT_NAME("IN1-3") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) PORT_NAME("IN1-4") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) PORT_NAME("IN1-5") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) // ticket-in in chmpnum + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) // ticket-in in chmpnum PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_T) PORT_NAME("IN1-7") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) // ticket out / payout in chsuper2 diff --git a/src/mame/drivers/circusc.c b/src/mame/drivers/circusc.c index 238fd9b002c..1bd909c2d09 100644 --- a/src/mame/drivers/circusc.c +++ b/src/mame/drivers/circusc.c @@ -334,7 +334,7 @@ INTERRUPT_GEN_MEMBER(circusc_state::vblank_irq) static MACHINE_CONFIG_START( circusc, circusc_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 2048000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", KONAMI1, 2048000) /* 2 MHz? */ MCFG_CPU_PROGRAM_MAP(circusc_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", circusc_state, vblank_irq) MCFG_WATCHDOG_VBLANK_INIT(8) @@ -567,7 +567,6 @@ ROM_END DRIVER_INIT_MEMBER(circusc_state,circusc) { - konami1_decode(machine(), "maincpu"); } diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c index bbfa5ec4b13..2552f56300b 100644 --- a/src/mame/drivers/cobra.c +++ b/src/mame/drivers/cobra.c @@ -323,7 +323,7 @@ #include "machine/timekpr.h" #include "video/k001604.h" #include "video/poly.h" -#include "video/rgbgen.h" +#include "video/rgbutil.h" #include "sound/rf5c400.h" #include "sound/dmadac.h" @@ -895,7 +895,7 @@ void cobra_renderer::render_texture_scan(INT32 scanline, const extent_t &extent, rgb_t texel10 = texture_fetch(&m_texture_ram[tex_address], iu, iv+1, texture_width, tex_format); rgb_t texel11 = texture_fetch(&m_texture_ram[tex_address], iu+1, iv+1, texture_width, tex_format); - rgb_t texel = rgba_bilinear_filter(texel00, texel01, texel10, texel11, (int)(lerp_u * 255), (int)(lerp_v * 255)); + rgb_t texel = rgbaint_t::bilinear_filter(texel00, texel01, texel10, texel11, (int)(lerp_u * 255), (int)(lerp_v * 255)); #endif diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c index 42507a52015..012e6ac0171 100644 --- a/src/mame/drivers/commando.c +++ b/src/mame/drivers/commando.c @@ -72,6 +72,10 @@ static ADDRESS_MAP_START( commando_map, AS_PROGRAM, 8, commando_state ) AM_RANGE(0xff80, 0xffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, commando_state ) + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, commando_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM @@ -245,6 +249,7 @@ static MACHINE_CONFIG_START( commando, commando_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, PHI_MAIN) // ??? MCFG_CPU_PROGRAM_MAP(commando_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", commando_state, commando_interrupt) MCFG_CPU_ADD("audiocpu", Z80, PHI_B) // 3 MHz @@ -281,7 +286,7 @@ MACHINE_CONFIG_END /* ROMs */ ROM_START( commando ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "cm04.9m", 0x0000, 0x8000, CRC(8438b694) SHA1(e154478d8f1b635355bd777370acabe49cb9d309) ) ROM_LOAD( "cm03.8m", 0x8000, 0x4000, CRC(35486542) SHA1(531a85c9e03970ce037be84f2240c2df6f6e3ec1) ) @@ -317,7 +322,7 @@ ROM_START( commando ) ROM_END ROM_START( commandou ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "u4-f.9m", 0x0000, 0x8000, CRC(a6118935) SHA1(d5811968b23d61e344e151747bcc3c0ed2b9497b) ) ROM_LOAD( "u3-f.8m", 0x8000, 0x4000, CRC(24f49684) SHA1(d38a7bd9f3b506747a03f6b94c3f8a2d9fc59166) ) @@ -353,7 +358,7 @@ ROM_START( commandou ) ROM_END ROM_START( commandoj ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "so04.9m", 0x0000, 0x8000, CRC(d3f2bfb3) SHA1(738a5673ac6a907cb04cfb125e8aab3f7437b9d2) ) ROM_LOAD( "so03.8m", 0x8000, 0x4000, CRC(ed01f472) SHA1(fa181293ae8f0fee78d412259eb81f6de1e1307a) ) @@ -389,7 +394,7 @@ ROM_START( commandoj ) ROM_END ROM_START( commandob ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "commandob_04_9m_27256.bin", 0x0000, 0x8000, CRC(348a7654) SHA1(f3668c47c154a9c7d7afeabb0259c9bc56e847ac) ) ROM_LOAD( "cm03.8m", 0x8000, 0x4000, CRC(35486542) SHA1(531a85c9e03970ce037be84f2240c2df6f6e3ec1) ) @@ -433,7 +438,7 @@ ROM_START( commandob ) ROM_END ROM_START( commandob2 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "10", 0x0000, 0x8000, CRC(ab5d1469) SHA1(05935155365bef3c40823101303a3857af1c71e6) ) ROM_LOAD( "11", 0x8000, 0x4000, CRC(d1a43ba1) SHA1(dbaedcd3a1b489a01b7f783fda6fcad203758717) ) @@ -507,7 +512,7 @@ ROM_START( commandob2 ) ROM_END ROM_START( commandou2 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "uc4.9m", 0x0000, 0x8000, CRC(89ee8e17) SHA1(68db271af8b0f400ca95df5672983bfb87f3f84a) ) ROM_LOAD( "uc3.8m", 0x8000, 0x4000, CRC(72a1a529) SHA1(fe7797206e38bd78e817b6c351d5cb943720fe6c) ) @@ -543,7 +548,7 @@ ROM_START( commandou2 ) ROM_END ROM_START( sinvasn ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "sp04.9m", 0x0000, 0x8000, CRC(33f9601e) SHA1(71182227b77fccbbc1d89b5828aa86dcc64ca05e) ) ROM_LOAD( "sp03.8m", 0x8000, 0x4000, CRC(c7fb43b3) SHA1(36d0dffdacc36a6b6a77101d942c0821846f3275) ) @@ -579,7 +584,7 @@ ROM_START( sinvasn ) ROM_END ROM_START( sinvasnb ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "u4", 0x0000, 0x8000, CRC(834ba0de) SHA1(85f40559e6a436f3f752b6e862a419a5b9481fa8) ) ROM_LOAD( "u3", 0x8000, 0x4000, CRC(07e4ee3a) SHA1(6d7665b3072f075893ef37e55147b10271d069ef) ) @@ -618,40 +623,26 @@ ROM_END DRIVER_INIT_MEMBER(commando_state,commando) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000); - int A; - - space.set_decrypted_region(0x0000, 0xbfff, decrypt); // the first opcode is *not* encrypted - decrypt[0] = rom[0]; - for (A = 1; A < 0xc000; A++) + m_decrypted_opcodes[0] = rom[0]; + for (int A = 1; A < 0xc000; A++) { - int src; - - src = rom[A]; - decrypt[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); + UINT8 src = rom[A]; + m_decrypted_opcodes[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); } } DRIVER_INIT_MEMBER(commando_state,spaceinv) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000); - int A; - - space.set_decrypted_region(0x0000, 0xbfff, decrypt); // the first opcode *is* encrypted - for (A = 0; A < 0xc000; A++) + for (int A = 0; A < 0xc000; A++) { - int src; - - src = rom[A]; - decrypt[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); + UINT8 src = rom[A]; + m_decrypted_opcodes[A] = (src & 0x11) | ((src & 0xe0) >> 4) | ((src & 0x0e) << 4); } } diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 1206481492b..cf3055a71ce 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -622,6 +622,10 @@ ADDRESS_MAP_START( qsound_sub_map, AS_PROGRAM, 8, cps_state ) // used by cps2. AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("qsound_ram2") ADDRESS_MAP_END +ADDRESS_MAP_START( qsound_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cps_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("decrypted") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sf2m3_map, AS_PROGRAM, 16, cps_state ) AM_RANGE(0x000000, 0x3fffff) AM_ROM AM_RANGE(0x800010, 0x800011) AM_READ_PORT("IN1") /* Player input ports */ @@ -3238,6 +3242,7 @@ static MACHINE_CONFIG_DERIVED( qsound, cps1_12MHz ) MCFG_CPU_REPLACE("audiocpu", Z80, XTAL_8MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(qsound_sub_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(qsound_decrypted_opcodes_map) MCFG_CPU_PERIODIC_INT_DRIVER(cps_state, irq0_line_hold, 250) // measured (cps2.c) MCFG_MACHINE_START_OVERRIDE(cps_state, qsound) @@ -11551,27 +11556,35 @@ DRIVER_INIT_MEMBER( cps_state, sf2m8 ) DRIVER_INIT_CALL(cps1); } +void cps_state::kabuki_setup(void (*decode)(UINT8 *src, UINT8 *dst)) +{ + UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); + UINT8 *rom = memregion("audiocpu")->base(); + decode(rom, decrypt); + membank("decrypted")->set_base(decrypt); +} + DRIVER_INIT_MEMBER(cps_state,wof) { - wof_decode(machine()); + kabuki_setup(wof_decode); DRIVER_INIT_CALL(cps1); } DRIVER_INIT_MEMBER(cps_state,dino) { - dino_decode(machine()); + kabuki_setup(dino_decode); DRIVER_INIT_CALL(cps1); } DRIVER_INIT_MEMBER(cps_state,punisher) { - punisher_decode(machine()); + kabuki_setup(punisher_decode); DRIVER_INIT_CALL(cps1); } DRIVER_INIT_MEMBER(cps_state,slammast) { - slammast_decode(machine()); + kabuki_setup(slammast_decode); DRIVER_INIT_CALL(cps1); } diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index aba0c3e76e7..8d51c75b272 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -884,6 +884,9 @@ static ADDRESS_MAP_START( cps2_map, AS_PROGRAM, 16, cps_state ) AM_RANGE(0xff0000, 0xffffff) AM_RAM /* RAM */ ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, cps_state ) + AM_RANGE(0x000000, 0x3fffff) AM_ROM AM_SHARE("decrypted_opcodes") /* 68000 ROM */ +ADDRESS_MAP_END static ADDRESS_MAP_START( dead_cps2_map, AS_PROGRAM, 16, cps_state ) AM_RANGE(0x000000, 0x3fffff) AM_ROM /* 68000 ROM */ @@ -1215,6 +1218,7 @@ static MACHINE_CONFIG_START( cps2, cps_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) MCFG_CPU_PROGRAM_MAP(cps2_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cps_state, cps2_interrupt, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, XTAL_8MHz) @@ -1251,6 +1255,7 @@ static MACHINE_CONFIG_DERIVED( dead_cps2, cps2 ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(dead_cps2_map) + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gigaman2, cps2 ) @@ -1259,6 +1264,8 @@ static MACHINE_CONFIG_DERIVED( gigaman2, cps2 ) MCFG_DEVICE_REMOVE("qsound") + MCFG_CPU_MODIFY("maincpu") + MCFG_OKIM6295_ADD("oki", XTAL_32MHz/32, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47) @@ -8660,8 +8667,6 @@ void cps_state::gigaman2_gfx_reorder() DRIVER_INIT_MEMBER(cps_state,gigaman2) { address_space &space = m_maincpu->space(AS_PROGRAM); - UINT16 *rom = (UINT16 *)memregion("maincpu")->base(); - int length = memregion("maincpu")->bytes(); gigaman2_gfx_reorder(); @@ -8671,8 +8676,8 @@ DRIVER_INIT_MEMBER(cps_state,gigaman2) save_pointer(NAME(m_gigaman2_dummyqsound_ram), 0x20000 / 2); space.install_readwrite_handler(0x618000, 0x619fff, read16_delegate(FUNC(cps_state::gigaman2_dummyqsound_r),this), write16_delegate(FUNC(cps_state::gigaman2_dummyqsound_w), this)); // no qsound.. - space.set_decrypted_region(0x000000, (length) - 1, &rom[length/4]); - m_maincpu->set_encrypted_opcode_range(0, length); + + memcpy(m_decrypted_opcodes, memregion("maincpu")->base()+0x200000, 0x200000); /* no digital volume switches on this? */ m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index bb025a6995b..d9b3c214524 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -745,13 +745,11 @@ void cps3_state::cps3_decrypt_bios() int i; UINT32 *coderegion = (UINT32*)memregion("bios")->base(); - m_decrypted_bios = (UINT32*)memregion("bios")->base(); - for (i=0;i<0x80000;i+=4) { UINT32 dword = coderegion[i/4]; UINT32 xormask = cps3_mask(i, m_key1, m_key2); - m_decrypted_bios[i/4] = dword ^ xormask; + coderegion[i/4] = dword ^ xormask; } #if 0 /* Dump to file */ @@ -811,13 +809,6 @@ void cps3_state::init_crypt(UINT32 key1, UINT32 key2, int altEncryption) m_maincpu->sh2drc_add_fastram(0x040C0030, 0x040C003b, 0, &m_tilemap30_regs_base[0]); cps3_decrypt_bios(); - m_decrypted_gamerom = auto_alloc_array(machine(), UINT32, 0x1000000/4); - - - m_0xc0000000_ram_decrypted = auto_alloc_array(machine(), UINT32, 0x400/4); - - address_space &main = m_maincpu->space(AS_PROGRAM); - main.set_direct_update_handler(direct_update_delegate(FUNC(cps3_state::cps3_direct_handler), this)); init_common(); } @@ -1358,43 +1349,6 @@ WRITE32_MEMBER(cps3_state::cps3_0xc0000000_ram_w) m_0xc0000000_ram_decrypted[offset] = m_0xc0000000_ram[offset]^cps3_mask(offset*4+0xc0000000, m_key1, m_key2); } - - -DIRECT_UPDATE_MEMBER(cps3_state::cps3_direct_handler) -{ -// if(DEBUG_PRINTF) printf("address %04x\n",address); - - /* BIOS ROM */ - if (address < 0x80000) - { - direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, m_decrypted_bios); - return ~0; - } - /* RAM */ - else if (address >= 0x06000000 && address <= 0x06ffffff) - { - UINT8 *decrypted = (UINT8*)m_decrypted_gamerom; - UINT8 *raw = decrypted; - - if (m_altEncryption) raw = (UINT8*) m_user4region; - - direct.explicit_configure(0x06000000, 0x06ffffff, 0x00ffffff, raw, decrypted); - - return ~0; - } - else if (address >= 0xc0000000 && address <= 0xc00003ff) - { - //direct->decrypted = (void*)m_0xc0000000_ram_decrypted; - direct.explicit_configure(0xc0000000, 0xc00003ff, 0x3ff, (UINT8*)m_0xc0000000_ram.target(), (UINT8*)m_0xc0000000_ram_decrypted); - return ~0; - } - - /* anything else falls through to NOPs */ - direct.explicit_configure(address, address, 0, (UINT8*)m_nops, (UINT8*)m_nops); - return ~0; -} - - WRITE32_MEMBER(cps3_state::cram_bank_w) { if (ACCESSING_BITS_0_7) @@ -2249,6 +2203,12 @@ static ADDRESS_MAP_START( cps3_map, AS_PROGRAM, 32, cps3_state ) AM_RANGE(0xc0000000, 0xc00003ff) AM_RAM_WRITE(cps3_0xc0000000_ram_w ) AM_SHARE("0xc0000000_ram") /* Executes code from here */ ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 32, cps3_state ) + AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_REGION("bios", 0) // Bios ROM + AM_RANGE(0x06000000, 0x06ffffff) AM_ROM AM_SHARE("decrypted_gamerom") + AM_RANGE(0xc0000000, 0xc00003ff) AM_ROM AM_SHARE("0xc0000000_ram_decrypted") +ADDRESS_MAP_END + static INPUT_PORTS_START( cps3 ) PORT_START("INPUTS") PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) @@ -2551,8 +2511,9 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( cps3, cps3_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SH2, 6250000*4) // external clock is 6.25 Mhz, it sets the intenral multiplier to 4x (this should probably be handled in the core..) + MCFG_CPU_ADD("maincpu", SH2, 6250000*4) // external clock is 6.25 Mhz, it sets the internal multiplier to 4x (this should probably be handled in the core..) MCFG_CPU_PROGRAM_MAP(cps3_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", cps3_state, cps3_vbl_interrupt) MCFG_CPU_PERIODIC_INT_DRIVER(cps3_state, cps3_other_interrupt, 80) /* ?source? */ MCFG_SH2_DMA_KLUDGE_CB(cps3_state, dma_callback) diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c index 597acba64aa..aeacb6e31be 100644 --- a/src/mame/drivers/cshooter.c +++ b/src/mame/drivers/cshooter.c @@ -4,7 +4,7 @@ TS 01.05.2006: - - added sprites, bgmap reading and few ixes here and there + - added sprites, bgmap reading and few fixes here and there airraid and cshootere are a bit "playable" ;) without gfx @@ -103,7 +103,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_generic_paletteram_8(*this, "paletteram"), - m_generic_paletteram2_8(*this, "paletteram2") { } + m_generic_paletteram2_8(*this, "paletteram2"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; optional_device<seibu_sound_device> m_seibu_sound; @@ -114,6 +115,7 @@ public: required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_generic_paletteram_8; required_shared_ptr<UINT8> m_generic_paletteram2_8; + required_shared_ptr<UINT8> m_decrypted_opcodes; tilemap_t *m_txtilemap; int m_coin_stat; @@ -253,7 +255,7 @@ WRITE8_MEMBER(cshooter_state::cshooter_c700_w) WRITE8_MEMBER(cshooter_state::bank_w) { - membank("bank1")->set_base(&memregion("user1")->base()[0x4000*((data>>4)&3)]); + membank("bank1")->set_entry((data>>4)&3); } @@ -313,6 +315,10 @@ static ADDRESS_MAP_START( airraid_map, AS_PROGRAM, 8, cshooter_state ) AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cshooter_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + #if 0 /* Sound CPU */ @@ -440,9 +446,11 @@ static MACHINE_CONFIG_START( airraid, cshooter_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(airraid_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cshooter_state, cshooter_scanline, "screen", 0, 1) SEIBU2_AIRRAID_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */ + SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW() MCFG_QUANTUM_TIME(attotime::from_hz(6000)) @@ -595,29 +603,24 @@ DRIVER_INIT_MEMBER(cshooter_state,cshooter) DRIVER_INIT_MEMBER(cshooter_state,cshootere) { - address_space &space = m_maincpu->space(AS_PROGRAM); - int A; UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); - space.set_decrypted_region(0x0000, 0x7fff, decrypt); - - for (A = 0x0000;A < 0x8000;A++) + for (int A = 0x0000;A < 0x8000;A++) { /* decode the opcodes */ - decrypt[A] = rom[A]; + m_decrypted_opcodes[A] = rom[A]; if (BIT(A,5) && !BIT(A,3)) - decrypt[A] ^= 0x40; + m_decrypted_opcodes[A] ^= 0x40; if (BIT(A,10) && !BIT(A,9) && BIT(A,3)) - decrypt[A] ^= 0x20; + m_decrypted_opcodes[A] ^= 0x20; if ((BIT(A,10) ^ BIT(A,9)) && BIT(A,1)) - decrypt[A] ^= 0x02; + m_decrypted_opcodes[A] ^= 0x02; if (BIT(A,9) || !BIT(A,5) || BIT(A,3)) - decrypt[A] = BITSWAP8(decrypt[A],7,6,1,4,3,2,5,0); + m_decrypted_opcodes[A] = BITSWAP8(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0); /* decode the data */ if (BIT(A,5)) @@ -627,8 +630,7 @@ DRIVER_INIT_MEMBER(cshooter_state,cshootere) rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0); } - membank("bank1")->set_base(&memregion("user1")->base()[0]); - m_seibu_sound->decrypt("audiocpu",0x2000); + membank("bank1")->configure_entries(0, 4, memregion("user1")->base(), 0x4000); } diff --git a/src/mame/drivers/cv1k.c b/src/mame/drivers/cv1k.c index f107fe809eb..9258b51dac4 100644 --- a/src/mame/drivers/cv1k.c +++ b/src/mame/drivers/cv1k.c @@ -35,6 +35,8 @@ CA019B Do-Don-Pachi Dai-Fukkatsu Black Label CA021 Akai Katana CMDL01 Medal Mahjong Moukari Bancho + Pirates of Gappori http://web.archive.org/web/20090907145501/http://www.cave.co.jp/gameonline/gappori/ + Oooku http://web.archive.org/web/20141104001322/http://www.cave.co.jp/gameonline/oooku/ Note: CA018 - Deathsmiles II: Makai no Merry Christmas on unknown custom platform CA020 - Do-Don-Pachi Dai-ou-jou Tamashii on PGM2 platform diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c index eb5d5589b41..35419344046 100644 --- a/src/mame/drivers/darkmist.c +++ b/src/mame/drivers/darkmist.c @@ -29,11 +29,15 @@ TODO: #include "cpu/z80/z80.h" #include "includes/darkmist.h" +void darkmist_state::machine_start() +{ + membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000); +} WRITE8_MEMBER(darkmist_state::hw_w) { m_hw=data; - membank("bank1")->set_base(&memregion("maincpu")->base()[0x010000+((data&0x80)?0x4000:0)]); + membank("bank1")->set_entry((data&0x80)?1:0); } static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, darkmist_state ) @@ -60,6 +64,10 @@ static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, darkmist_state ) AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, darkmist_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") +ADDRESS_MAP_END static INPUT_PORTS_START( darkmist ) PORT_START("P1") @@ -228,6 +236,7 @@ static MACHINE_CONFIG_START( darkmist, darkmist_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80,4000000) /* ? MHz */ MCFG_CPU_PROGRAM_MAP(memmap) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkmist_state, scanline, "screen", 0, 1) MCFG_DEVICE_ADD("t5182", T5182, 0) @@ -389,20 +398,17 @@ void darkmist_state::decrypt_gfx() void darkmist_state::decrypt_snd() { - int i; UINT8 *ROM = memregion("t5182_z80")->base(); - for(i=0x0000;i<0x2000;i++) - ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0); + for (int i = 0x0000; i < 0x8000; i++) + ROM[i] = BITSWAP8(ROM[i], 7, 1, 2, 3, 4, 5, 6, 0); } DRIVER_INIT_MEMBER(darkmist_state,darkmist) { - address_space &space = m_maincpu->space(AS_PROGRAM); int i, len; UINT8 *ROM = memregion("maincpu")->base(); dynamic_buffer buffer(0x10000); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); decrypt_gfx(); @@ -429,10 +435,9 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist) } ROM[i] = d; - decrypt[i] = p; + m_decrypted_opcodes[i] = p; } - space.set_decrypted_region(0x0000, 0x7fff, decrypt); membank("bank1")->set_base(&ROM[0x010000]); /* adr line swaps */ diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c index 17379f137f3..ba14b7a932a 100644 --- a/src/mame/drivers/darkseal.c +++ b/src/mame/drivers/darkseal.c @@ -7,7 +7,7 @@ Dark Seal (Rev 4) (c) 1990 Data East Corporation (Japanese version) Gate Of Doom (Rev 4) (c) 1990 Data East Corporation (USA version) Gate of Doom (Rev 1) (c) 1990 Data East Corporation (USA version) - + Board: DE-0332-2 Emulation by Bryan McPhail, mish@tendril.co.uk diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index bfb9b470842..9663f217f9d 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -89,7 +89,8 @@ public: m_sprgen(*this, "spritegen"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_deco_tilegen1(*this, "tilegen1") + m_deco_tilegen1(*this, "tilegen1"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } optional_device<deco104_device> m_deco104; /* memory pointers */ @@ -106,6 +107,7 @@ public: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; required_device<deco16ic_device> m_deco_tilegen1; + required_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_WRITE_LINE_MEMBER(sound_irq); DECLARE_READ16_MEMBER(dblewing_prot_r); DECLARE_WRITE16_MEMBER(dblewing_prot_w); @@ -179,6 +181,10 @@ static ADDRESS_MAP_START( dblewing_map, AS_PROGRAM, 16, dblewing_state ) AM_RANGE(0xff0000, 0xff3fff) AM_MIRROR(0xc000) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, dblewing_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + READ8_MEMBER(dblewing_state::irq_latch_r) { /* bit 1 of dblewing_sound_irq specifies IRQ command writes */ @@ -362,6 +368,7 @@ static MACHINE_CONFIG_START( dblewing, dblewing_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_28MHz/2) /* DE102 */ MCFG_CPU_PROGRAM_MAP(dblewing_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", dblewing_state, irq6_line_hold) MCFG_CPU_ADD("audiocpu", Z80, XTAL_32_22MHz/9) @@ -450,7 +457,7 @@ ROM_END DRIVER_INIT_MEMBER(dblewing_state,dblewing) { deco56_decrypt_gfx(machine(), "gfx1"); - deco102_decrypt_cpu(machine(), "maincpu", 0x399d, 0x25, 0x3d); + deco102_decrypt_cpu((UINT16 *)memregion("maincpu")->base(), m_decrypted_opcodes, 0x80000, 0x399d, 0x25, 0x3d); } diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c index e685c4267d0..f7e6b872502 100644 --- a/src/mame/drivers/deadang.c +++ b/src/mame/drivers/deadang.c @@ -244,6 +244,7 @@ static MACHINE_CONFIG_START( deadang, deadang_state ) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer2", deadang_state, sub_scanline, "screen", 0, 1) SEIBU3A_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) + SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW() MCFG_QUANTUM_TIME(attotime::from_hz(60)) // the game stops working with higher interleave rates.. @@ -413,14 +414,12 @@ ROM_END DRIVER_INIT_MEMBER(deadang_state,deadang) { - m_seibu_sound->decrypt("audiocpu", 0x2000); m_adpcm1->decrypt("adpcm1"); m_adpcm2->decrypt("adpcm2"); } DRIVER_INIT_MEMBER(deadang_state,ghunter) { - m_seibu_sound->decrypt("audiocpu", 0x2000); m_adpcm1->decrypt("adpcm1"); m_adpcm2->decrypt("adpcm2"); diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c index ce9ac1a75ff..c26414b78a8 100644 --- a/src/mame/drivers/dietgo.c +++ b/src/mame/drivers/dietgo.c @@ -60,6 +60,10 @@ static ADDRESS_MAP_START( dietgo_map, AS_PROGRAM, 16, dietgo_state ) AM_RANGE(0x380000, 0x38ffff) AM_RAM // mainram ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, dietgo_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + /* Physical memory map (21 bits) */ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, dietgo_state ) @@ -205,6 +209,7 @@ static MACHINE_CONFIG_START( dietgo, dietgo_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_28MHz/2) /* DE102 (verified on pcb) */ MCFG_CPU_PROGRAM_MAP(dietgo_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", dietgo_state, irq6_line_hold) MCFG_CPU_ADD("audiocpu", H6280, XTAL_32_22MHz/4/3) /* Custom chip 45; XIN is 32.220MHZ/4, verified on pcb */ @@ -365,7 +370,7 @@ ROM_END DRIVER_INIT_MEMBER(dietgo_state,dietgo) { deco56_decrypt_gfx(machine(), "gfx1"); - deco102_decrypt_cpu(machine(), "maincpu", 0xe9ba, 0x01, 0x19); + deco102_decrypt_cpu((UINT16 *)memregion("maincpu")->base(), m_decrypted_opcodes, 0x80000, 0xe9ba, 0x01, 0x19); } GAME( 1992, dietgo, 0, dietgo, dietgo, dietgo_state, dietgo, ROT0, "Data East Corporation", "Diet Go Go (Euro v1.1 1992.09.26)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index b6c4216cb8c..d4ff582740c 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -2659,7 +2659,7 @@ static INPUT_PORTS_START( mjdialq2 ) PORT_DIPNAME( 0x40, 0x40, "Select Special Item" ) /* Allows to select which one of the nine special items you want. */ PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x80, 0x80, "Debug" ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -5501,6 +5501,27 @@ ROM_START( mjdialq2 ) ROM_LOAD( "d52-1.8e", 0x200, 0x200, CRC(8868247a) SHA1(97652025c411b379dfab576dc7f2d8d0d61d0828) ) ROM_END +// Program roms from a non-working pcb. The other roms match the parent. +ROM_START( mjdialq2a ) + ROM_REGION( 0x78000, "maincpu", 0 ) // Z80 Code + ROM_LOAD( "5201.2b", 0x00000, 0x10000, CRC(6b735bb0) SHA1(2756e8711cf3be45ec0ca97bce621135df71e9fc) ) + ROM_RELOAD( 0x10000, 0x08000 ) // 1 + ROM_CONTINUE( 0x20000, 0x08000 ) // 3 + ROM_LOAD( "5202.2c", 0x30000, 0x08000, CRC(7819521f) SHA1(57a385b4ff3343dfa47499ddc25db26b3b64a441) ) // 5 + ROM_CONTINUE( 0x70000, 0x08000 ) // d + + ROM_REGION( 0xa0000, "gfx1", 0 ) // blitter data + ROM_LOAD( "5207.2h", 0x00000, 0x20000, CRC(7794cd62) SHA1(7fa2fd50d7c975c381dda36f505df0e152196bb5) ) + ROM_LOAD( "5206.2g", 0x20000, 0x20000, CRC(9e810021) SHA1(cf1052c96b9da3abb263be1ce8481aeded2c5d00) ) + ROM_LOAD( "5205.2f", 0x40000, 0x20000, CRC(8c05572f) SHA1(544a5eb8b989fb1195986ed856da04350941ef59) ) + ROM_LOAD( "5204.2e", 0x60000, 0x20000, CRC(958ef9ab) SHA1(ec768c587dc9e6b691564b6b35abbece252bcd28) ) + ROM_LOAD( "5203.2d", 0x80000, 0x20000, CRC(706072d7) SHA1(d4692296d234b824961a94390e6d646ed9a7d5fd) ) + + ROM_REGION( 0x400, "proms", 0 ) // Color PROMs + ROM_LOAD( "d52-2.9e", 0x000, 0x200, CRC(18585ce3) SHA1(7f2e20bb09c1d810910094a6b19e5151666d74ac) ) // FIXED BITS (0xxxxxxx) + ROM_LOAD( "d52-1.8e", 0x200, 0x200, CRC(8868247a) SHA1(97652025c411b379dfab576dc7f2d8d0d61d0828) ) +ROM_END + /*************************************************************************** @@ -7213,6 +7234,25 @@ ROM_START( hjingi ) ROM_LOAD( "h09.6", 0x00000, 0x20000, CRC(86bde64d) SHA1(d9b79184697044ae8a4d04ea22deca2e14162065) ) ROM_END +// dump of the program roms only? +ROM_START( hjingia ) + ROM_REGION( 0x30000, "maincpu", 0 ) + ROM_LOAD( "h10b.4a", 0x00000, 0x20000, CRC(a77a062a) SHA1(cae76effd573c20e20172829220587a5d200eb9e) ) + ROM_RELOAD( 0x10000, 0x20000 ) + + ROM_REGION( 0x100000, "gfx1", 0 ) // blitter data + ROM_LOAD( "h02.21", 0x00000, 0x20000, CRC(9dde2d59) SHA1(96df4ba97ee9611d9a3c7bcaae9cd97815a7b8a5) ) + ROM_LOAD( "h03.22", 0x20000, 0x20000, CRC(1ac59443) SHA1(e70fe6184e7090cf7229d83b87db65f7715de2a8) ) + ROM_LOAD( "h01.20", 0x40000, 0x20000, CRC(24391ddc) SHA1(6a2e3fae4b6d0b1d8073306f37c9fdaa04b69eb8) ) + ROM_LOAD( "h04.1", 0x60000, 0x20000, CRC(3756c745) SHA1(f275a72d6e07f21148900d24a8018d03504f249f) ) + ROM_LOAD( "h05.2", 0x80000, 0x20000, CRC(249d360a) SHA1(688fced1298c345a18314d2c88664c757a2de35c) ) + ROM_LOAD( "h06.3", 0xa0000, 0x20000, CRC(014a4945) SHA1(0cd747787a81226fd4937616a6ce45af731a4049) ) + ROM_LOAD( "h07.4", 0xc0000, 0x20000, CRC(8b6f8a2d) SHA1(c5f3ec64a7ea3edc556182f42e6da4842d88e0ba) ) + ROM_LOAD( "h08.5", 0xe0000, 0x20000, CRC(6f996e6e) SHA1(c2b916afbfd257417f0383ad261f3720a027fdd9) ) + + ROM_REGION( 0x20000, "gfx2", 0 ) // blitter data + ROM_LOAD( "h09.6", 0x00000, 0x20000, CRC(86bde64d) SHA1(d9b79184697044ae8a4d04ea22deca2e14162065) ) +ROM_END /*************************************************************************** @@ -7294,7 +7334,8 @@ ROM_END GAME( 1988, janyuki, 0, janyuki, janyuki, driver_device, 0, ROT0, "Dynax", "Jong Yu Ki (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1989, hnkochou, 0, hanamai, hnkochou, driver_device, 0, ROT180, "Dynax", "Hana Kochou (Japan, Bet)", GAME_SUPPORTS_SAVE ) GAME( 1988, hanamai, hnkochou, hanamai, hanamai, driver_device, 0, ROT180, "Dynax", "Hana no Mai (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1990, hjingi, 0, hjingi, hjingi, driver_device, 0, ROT180, "Dynax", "Hana Jingi (Japan, Bet)", GAME_SUPPORTS_SAVE ) +GAME( 1990, hjingi, 0, hjingi, hjingi, driver_device, 0, ROT180, "Dynax", "Hana Jingi (Japan, Bet)", GAME_SUPPORTS_SAVE ) // 1990 05/01 11:58:24 +GAME( 1990, hjingia, hjingi, hjingi, hjingi, driver_device, 0, ROT180, "Dynax", "Hana Jingi (Japan, Bet, alt.)", GAME_SUPPORTS_SAVE ) // 1990 05/01 11:58:24 GAME( 1989, hnoridur, hjingi, hnoridur, hnoridur, driver_device, 0, ROT180, "Dynax", "Hana Oriduru (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1989, drgpunch, 0, sprtmtch, drgpunch, driver_device, 0, ROT0, "Dynax", "Dragon Punch (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1989, sprtmtch, drgpunch, sprtmtch, sprtmtch, driver_device, 0, ROT0, "Dynax (Fabtek license)", "Sports Match", GAME_SUPPORTS_SAVE ) @@ -7311,6 +7352,7 @@ GAME( 1990, mcnpshnt, 0, mcnpshnt, mcnpshnt, driver_device, 0, ROT GAME( 1990, 7jigen, 0, nanajign, nanajign, driver_device, 0, ROT180, "Dynax", "7jigen no Youseitachi - Mahjong 7 Dimensions (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) GAME( 1990, jantouki, 0, jantouki, jantouki, driver_device, 0, ROT0, "Dynax", "Jong Tou Ki (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1991, mjdialq2, 0, mjdialq2, mjdialq2, driver_device, 0, ROT180, "Dynax", "Mahjong Dial Q2 (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1991, mjdialq2a,mjdialq2, mjdialq2, mjdialq2, driver_device, 0, ROT180, "Dynax", "Mahjong Dial Q2 (Japan, alt.)", GAME_SUPPORTS_SAVE ) GAME( 1991, yarunara, 0, yarunara, yarunara, driver_device, 0, ROT180, "Dynax", "Mahjong Yarunara (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1991, mjangels, 0, yarunara, yarunara, driver_device, 0, ROT180, "Dynax", "Mahjong Angels - Comic Theater Vol.2 (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1992, quiztvqq, 0, quiztvqq, quiztvqq, driver_device, 0, ROT180, "Dynax", "Quiz TV Gassyuukoku Q&Q (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/dynduke.c b/src/mame/drivers/dynduke.c index 8d0329907c2..200175fa2a7 100644 --- a/src/mame/drivers/dynduke.c +++ b/src/mame/drivers/dynduke.c @@ -283,6 +283,7 @@ static MACHINE_CONFIG_START( dynduke, dynduke_state ) MCFG_CPU_VBLANK_INT_DRIVER("screen", dynduke_state, interrupt) SEIBU_SOUND_SYSTEM_CPU(14318180/4) + SEIBU_SOUND_SYSTEM_ENCRYPTED_FULL() MCFG_QUANTUM_TIME(attotime::from_hz(3600)) @@ -607,7 +608,6 @@ ROM_END DRIVER_INIT_MEMBER(dynduke_state,dynduke) { - m_seibu_sound->decrypt("audiocpu",0x20000); } /* Game Drivers */ diff --git a/src/mame/drivers/expro02.c b/src/mame/drivers/expro02.c index 0fb97421ae6..9a68c8193b9 100644 --- a/src/mame/drivers/expro02.c +++ b/src/mame/drivers/expro02.c @@ -1621,28 +1621,28 @@ ROM_START( fantsia2a ) ROM_END /* sole change seems to be copyright date, PCB has chip references instead of grid references. Not correcting all labels in other sets in case these are legitimate labels */ -ROM_START( fantsia2n ) - ROM_REGION( 0x500000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "prog2.g17", 0x000000, 0x80000, CRC(57c59972) SHA1(4b1da928b537cf340a67026d07bc3dfc078b0d0f) ) - ROM_LOAD16_BYTE( "prog1.f17", 0x000001, 0x80000, CRC(bf2d9a26) SHA1(92f0c1bd32f1e5e0ede3ba847242a212dfae4986) ) - ROM_LOAD16_BYTE( "scr2.g16", 0x100000, 0x80000, CRC(887b1bc5) SHA1(b6fcdc8a56ea25758f363224d256e9b6c8e30244) ) - ROM_LOAD16_BYTE( "scr1.f16", 0x100001, 0x80000, CRC(cbba3182) SHA1(a484819940fa1ef18ce679465c31075798748bac) ) - ROM_LOAD16_BYTE( "scr4.g15", 0x200000, 0x80000, CRC(ce97e411) SHA1(be0ed41362db03f384229c708f2ba4146e5cb501) ) - ROM_LOAD16_BYTE( "scr3.f15", 0x200001, 0x80000, CRC(480cc2e8) SHA1(38fe57ba1e34537f8be65fcc023ccd43369a5d94) ) - ROM_LOAD16_BYTE( "scr6.g14", 0x300000, 0x80000, CRC(b29d49de) SHA1(854b76755acf58fb8a4648a0ce72ea6bdf26c555) ) - ROM_LOAD16_BYTE( "scr5.f14", 0x300001, 0x80000, CRC(d5f88b83) SHA1(518a1f6732149f2851bbedca61f7313c39beb91b) ) - ROM_LOAD16_BYTE( "scr8.g20", 0x400000, 0x80000, CRC(694ae2b3) SHA1(82b7a565290fce07c8393af4718fd1e6136928e9) ) - ROM_LOAD16_BYTE( "scr7.f20", 0x400001, 0x80000, CRC(6068712c) SHA1(80a136d76dca566772e34d832ac11b8c7d6ce9ab) ) - - ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ - ROM_LOAD( "23_OBJ1.U5", 0x00000, 0x80000, CRC(b45c9234) SHA1(b5eeec91b9c6952b338130458405997e1a51bf2f) ) - ROM_LOAD( "obj2.2i", 0x80000, 0x80000, CRC(ea6e3861) SHA1(463b40f5441231a0451571a0b8afe1ed0fd4b164) ) - - ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */ - /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ - ROM_LOAD( "music2.1b", 0x00000, 0x80000, CRC(23cc4f9c) SHA1(06b5342c25de966ce590917c571e5b19af1fef7d) ) - ROM_RELOAD( 0x40000, 0x80000 ) - ROM_LOAD( "music1.1a", 0xc0000, 0x80000, CRC(864167c2) SHA1(c454b26b6dea993e6bd64546f92beef05e46d7d7) ) +ROM_START( fantsia2n ) + ROM_REGION( 0x500000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_BYTE( "prog2.g17", 0x000000, 0x80000, CRC(57c59972) SHA1(4b1da928b537cf340a67026d07bc3dfc078b0d0f) ) + ROM_LOAD16_BYTE( "prog1.f17", 0x000001, 0x80000, CRC(bf2d9a26) SHA1(92f0c1bd32f1e5e0ede3ba847242a212dfae4986) ) + ROM_LOAD16_BYTE( "scr2.g16", 0x100000, 0x80000, CRC(887b1bc5) SHA1(b6fcdc8a56ea25758f363224d256e9b6c8e30244) ) + ROM_LOAD16_BYTE( "scr1.f16", 0x100001, 0x80000, CRC(cbba3182) SHA1(a484819940fa1ef18ce679465c31075798748bac) ) + ROM_LOAD16_BYTE( "scr4.g15", 0x200000, 0x80000, CRC(ce97e411) SHA1(be0ed41362db03f384229c708f2ba4146e5cb501) ) + ROM_LOAD16_BYTE( "scr3.f15", 0x200001, 0x80000, CRC(480cc2e8) SHA1(38fe57ba1e34537f8be65fcc023ccd43369a5d94) ) + ROM_LOAD16_BYTE( "scr6.g14", 0x300000, 0x80000, CRC(b29d49de) SHA1(854b76755acf58fb8a4648a0ce72ea6bdf26c555) ) + ROM_LOAD16_BYTE( "scr5.f14", 0x300001, 0x80000, CRC(d5f88b83) SHA1(518a1f6732149f2851bbedca61f7313c39beb91b) ) + ROM_LOAD16_BYTE( "scr8.g20", 0x400000, 0x80000, CRC(694ae2b3) SHA1(82b7a565290fce07c8393af4718fd1e6136928e9) ) + ROM_LOAD16_BYTE( "scr7.f20", 0x400001, 0x80000, CRC(6068712c) SHA1(80a136d76dca566772e34d832ac11b8c7d6ce9ab) ) + + ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ + ROM_LOAD( "23_OBJ1.U5", 0x00000, 0x80000, CRC(b45c9234) SHA1(b5eeec91b9c6952b338130458405997e1a51bf2f) ) + ROM_LOAD( "obj2.2i", 0x80000, 0x80000, CRC(ea6e3861) SHA1(463b40f5441231a0451571a0b8afe1ed0fd4b164) ) + + ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */ + /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ + ROM_LOAD( "music2.1b", 0x00000, 0x80000, CRC(23cc4f9c) SHA1(06b5342c25de966ce590917c571e5b19af1fef7d) ) + ROM_RELOAD( 0x40000, 0x80000 ) + ROM_LOAD( "music1.1a", 0xc0000, 0x80000, CRC(864167c2) SHA1(c454b26b6dea993e6bd64546f92beef05e46d7d7) ) ROM_END ROM_START( wownfant) diff --git a/src/mame/drivers/finalizr.c b/src/mame/drivers/finalizr.c index f1d84e8e59f..cfd7a23f96f 100644 --- a/src/mame/drivers/finalizr.c +++ b/src/mame/drivers/finalizr.c @@ -260,7 +260,7 @@ void finalizr_state::machine_reset() static MACHINE_CONFIG_START( finalizr, finalizr_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809,XTAL_18_432MHz/6) /* ??? */ + MCFG_CPU_ADD("maincpu", KONAMI1, XTAL_18_432MHz/6) /* ??? */ MCFG_CPU_PROGRAM_MAP(main_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", finalizr_state, finalizr_scanline, "screen", 0, 1) @@ -352,7 +352,6 @@ ROM_END DRIVER_INIT_MEMBER(finalizr_state,finalizr) { - konami1_decode(machine(), "maincpu"); } diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c index f9043a736f7..25b5a7b6764 100644 --- a/src/mame/drivers/freekick.c +++ b/src/mame/drivers/freekick.c @@ -81,7 +81,9 @@ READ8_MEMBER(freekick_state::spinner_r) WRITE8_MEMBER(freekick_state::pbillrd_bankswitch_w) { - membank("bank1")->set_entry(data & 1); + m_bank1->set_entry(data & 1); + if(m_bank1d) + m_bank1d->set_entry(data & 1); } WRITE8_MEMBER(freekick_state::nmi_enable_w) @@ -187,6 +189,11 @@ static ADDRESS_MAP_START( pbillrd_map, AS_PROGRAM, 8, freekick_state ) AM_RANGE(0xfc03, 0xfc03) AM_DEVWRITE("sn4", sn76489a_device, write) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, freekick_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") +ADDRESS_MAP_END + static ADDRESS_MAP_START( freekickb_map, AS_PROGRAM, 8, freekick_state ) AM_RANGE(0x0000, 0xcfff) AM_ROM AM_RANGE(0xd000, 0xdfff) AM_RAM @@ -582,7 +589,7 @@ MACHINE_RESET_MEMBER(freekick_state,freekick) MACHINE_START_MEMBER(freekick_state,pbillrd) { - membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 2, memregion("maincpu")->base() + 0x8000, 0x4000); MACHINE_START_CALL_MEMBER(freekick); } @@ -645,6 +652,11 @@ static MACHINE_CONFIG_DERIVED( pbillrd, base ) MCFG_MACHINE_RESET_OVERRIDE(freekick_state,freekick) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( pbillrdm, pbillrd ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( freekickb, base ) /* basic machine hardware */ @@ -676,6 +688,7 @@ static MACHINE_CONFIG_DERIVED( gigas, base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(gigas_map) MCFG_CPU_IO_MAP(gigas_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_MACHINE_START_OVERRIDE(freekick_state,freekick) MCFG_MACHINE_RESET_OVERRIDE(freekick_state,freekick) @@ -704,11 +717,10 @@ MACHINE_CONFIG_END *************************************/ ROM_START( pbillrd ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* Z80 Code */ - ROM_LOAD( "pb.18", 0x00000, 0x4000, CRC(9e6275ac) SHA1(482e845e7fb4190da483155bd908ad470373cd5c) ) - ROM_LOAD( "pb.7", 0x04000, 0x4000, CRC(dd438431) SHA1(07a950e38b3f627ecf95e5831e5480abb337a010) ) - ROM_CONTINUE( 0x10000, 0x4000 ) - ROM_LOAD( "pb.9", 0x14000, 0x4000, CRC(089ce80a) SHA1(779be9ba2277a26fbebf4acf9e2f5319a934b0f5) ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 Code */ + ROM_LOAD( "pb.18", 0x0000, 0x4000, CRC(9e6275ac) SHA1(482e845e7fb4190da483155bd908ad470373cd5c) ) + ROM_LOAD( "pb.7", 0x4000, 0x8000, CRC(dd438431) SHA1(07a950e38b3f627ecf95e5831e5480abb337a010) ) + ROM_LOAD( "pb.9", 0xc000, 0x4000, CRC(089ce80a) SHA1(779be9ba2277a26fbebf4acf9e2f5319a934b0f5) ) ROM_REGION( 0xc000, "gfx1", 0 ) /* GFX */ ROM_LOAD( "pb.4", 0x000000, 0x04000, CRC(2f4d4dd3) SHA1(ee4facabf591c235c270db4f4d3f612b8c474e57) ) @@ -730,11 +742,10 @@ ROM_START( pbillrd ) ROM_END ROM_START( pbillrds ) /* Encrytped with a Sega MC-8123 (317-0030) CPU module */ - ROM_REGION( 0x18000, "maincpu", 0 ) /* Z80 Code */ - ROM_LOAD( "10626.8n", 0x00000, 0x4000, CRC(51d725e6) SHA1(d7007c983530780e7fa3686cb7a6d7c382c802fa) ) /* encrypted */ - ROM_LOAD( "10625.8r", 0x04000, 0x4000, CRC(8977c724) SHA1(f00835a04dc6fa7d8c1e382dace515f2aa7d6f44) ) /* encrypted */ - ROM_CONTINUE( 0x10000, 0x4000 ) - ROM_LOAD( "10627.10n", 0x14000, 0x4000, CRC(2335e6dd) SHA1(82352b6f4abea88aad3a96ca63cccccb6e278f48) ) /* encrypted */ + ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 Code */ + ROM_LOAD( "10626.8n", 0x0000, 0x4000, CRC(51d725e6) SHA1(d7007c983530780e7fa3686cb7a6d7c382c802fa) ) /* encrypted */ + ROM_LOAD( "10625.8r", 0x4000, 0x8000, CRC(8977c724) SHA1(f00835a04dc6fa7d8c1e382dace515f2aa7d6f44) ) /* encrypted */ + ROM_LOAD( "10627.10n", 0xc000, 0x4000, CRC(2335e6dd) SHA1(82352b6f4abea88aad3a96ca63cccccb6e278f48) ) /* encrypted */ ROM_REGION( 0x2000, "user1", 0 ) /* MC8123 key */ ROM_LOAD( "317-0030.key", 0x0000, 0x2000, CRC(9223f06d) SHA1(51a22a4c80fe273526bde68918c13c6476cec383) ) @@ -761,11 +772,10 @@ ROM_END // all ROMs were HN4827128G-25, except 17, HN27256G-25 // CPU module marked 3?7-500B, but seems to act the same as above ROM_START( pbillrdsa ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* Z80 Code */ - ROM_LOAD( "29", 0x00000, 0x4000, CRC(da020258) SHA1(172276061c2e06bcf3477488734a72598412181b) ) /* encrypted */ // label scraped off, might be 20 - ROM_LOAD( "17", 0x04000, 0x4000, CRC(9bb3d467) SHA1(5d61c80c920363cbcb548f4a08434e2a05b3d5f3) ) /* encrypted */ - ROM_CONTINUE( 0x10000, 0x4000 ) - ROM_LOAD( "19", 0x14000, 0x4000, CRC(2335e6dd) SHA1(82352b6f4abea88aad3a96ca63cccccb6e278f48) ) /* encrypted */ + ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 Code */ + ROM_LOAD( "29", 0x0000, 0x4000, CRC(da020258) SHA1(172276061c2e06bcf3477488734a72598412181b) ) /* encrypted */ // label scraped off, might be 20 + ROM_LOAD( "17", 0x4000, 0x8000, CRC(9bb3d467) SHA1(5d61c80c920363cbcb548f4a08434e2a05b3d5f3) ) /* encrypted */ + ROM_LOAD( "19", 0xc000, 0x4000, CRC(2335e6dd) SHA1(82352b6f4abea88aad3a96ca63cccccb6e278f48) ) /* encrypted */ ROM_REGION( 0x2000, "user1", 0 ) /* MC8123 key */ ROM_LOAD( "317-0030.key", 0x0000, 0x2000, CRC(9223f06d) SHA1(51a22a4c80fe273526bde68918c13c6476cec383) ) @@ -1034,12 +1044,12 @@ ROM_START( countrunb2 ) ROM_END ROM_START( gigasm2b ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) - ROM_LOAD( "8.rom", 0x10000, 0x4000, CRC(c00a4a6c) SHA1(0d1bb849c9bfe4e92ad70e4ef19da494c0bd7ba8) ) + ROM_REGION( 2*0xc000, "maincpu", 0 ) + ROM_LOAD( "8.rom", 0x0c000, 0x4000, CRC(c00a4a6c) SHA1(0d1bb849c9bfe4e92ad70e4ef19da494c0bd7ba8) ) ROM_CONTINUE( 0x00000, 0x4000 ) - ROM_LOAD( "7.rom", 0x14000, 0x4000, CRC(92bd9045) SHA1(e4d8a94deeb795bb284ca0bd211ed40ed498b172) ) + ROM_LOAD( "7.rom", 0x10000, 0x4000, CRC(92bd9045) SHA1(e4d8a94deeb795bb284ca0bd211ed40ed498b172) ) ROM_CONTINUE( 0x04000, 0x4000 ) - ROM_LOAD( "9.rom", 0x18000, 0x4000, CRC(a3ef809c) SHA1(6d4098658aa124e10e5edb8e8e3abe0aa26741a1) ) + ROM_LOAD( "9.rom", 0x14000, 0x4000, CRC(a3ef809c) SHA1(6d4098658aa124e10e5edb8e8e3abe0aa26741a1) ) ROM_CONTINUE( 0x08000, 0x4000 ) ROM_REGION( 0xc000, "gfx1", 0 ) /* GFX */ @@ -1111,10 +1121,10 @@ Note: MCU dump has fixed bits, but read is good. If not correct, it's protected. */ ROM_START( gigasb ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) - ROM_LOAD( "g-7", 0x10000, 0x4000, CRC(daf4e88d) SHA1(391dff914ce8e9b7975fc8827c066d7db16c4171) ) + ROM_REGION( 2*0xc000, "maincpu", 0 ) + ROM_LOAD( "g-7", 0x0c000, 0x4000, CRC(daf4e88d) SHA1(391dff914ce8e9b7975fc8827c066d7db16c4171) ) ROM_CONTINUE( 0x00000, 0x4000 ) - ROM_LOAD( "g-8", 0x14000, 0x8000, CRC(4ab4c1f1) SHA1(63d8f489c7a8271e99a66d97e6eb0eb252cb2b67) ) + ROM_LOAD( "g-8", 0x10000, 0x8000, CRC(4ab4c1f1) SHA1(63d8f489c7a8271e99a66d97e6eb0eb252cb2b67) ) ROM_CONTINUE( 0x04000, 0x8000 ) ROM_REGION( 0xc000, "gfx1", 0 ) /* GFX */ @@ -1137,8 +1147,8 @@ ROM_START( gigasb ) ROM_END ROM_START( oigas ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) - ROM_LOAD( "rom.7", 0x10000, 0x4000, CRC(e5bc04cc) SHA1(ffbd416313a9e49d2f9a7268d5ef48a8b641e480) ) + ROM_REGION( 2*0xc000, "maincpu", 0 ) + ROM_LOAD( "rom.7", 0x0c000, 0x4000, CRC(e5bc04cc) SHA1(ffbd416313a9e49d2f9a7268d5ef48a8b641e480) ) ROM_CONTINUE( 0x00000, 0x4000) ROM_LOAD( "rom.8", 0x04000, 0x8000, CRC(c199060d) SHA1(de8f1e0f941533abbbed25b595b1d51fadbb428d) ) @@ -1174,19 +1184,25 @@ ROM_END DRIVER_INIT_MEMBER(freekick_state,gigasb) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0xbfff, memregion("maincpu")->base() + 0x10000); + membank("bank0d")->set_base(memregion("maincpu")->base() + 0xc000); + m_bank1d->set_base(memregion("maincpu")->base() + 0x14000); } DRIVER_INIT_MEMBER(freekick_state,pbillrds) { - mc8123_decrypt_rom(machine(), "maincpu", "user1", "bank1", 2); + UINT8 *decrypted_opcodes = auto_alloc_array(machine(), UINT8, 0x10000); + mc8123_decode(memregion("maincpu")->base(), decrypted_opcodes, memregion("user1")->base(), 0x10000); + membank("bank0d")->set_base(decrypted_opcodes); + m_bank1d->configure_entries(0, 2, decrypted_opcodes + 0x8000, 0x4000); } DRIVER_INIT_MEMBER(freekick_state,gigas) { - mc8123_decrypt_rom(machine(), "maincpu", "user1", NULL, 1); + UINT8 *decrypted_opcodes = auto_alloc_array(machine(), UINT8, 0xc000); + mc8123_decode(memregion("maincpu")->base(), decrypted_opcodes, memregion("user1")->base(), 0xc000); + membank("bank0d")->set_base(decrypted_opcodes); + m_bank1d->set_base(decrypted_opcodes + 0x8000); } @@ -1203,8 +1219,8 @@ GAME( 1986, gigasb, gigas, gigas, gigas, freekick_state, gigasb, R GAME( 1986, oigas, gigas , oigas, gigas, freekick_state, gigasb, ROT270, "bootleg", "Oigas (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1986, gigasm2b, 0, gigas, gigasm2, freekick_state, gigasb, ROT270, "bootleg", "Gigas Mark II (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1987, pbillrd, 0, pbillrd, pbillrd, driver_device, 0, ROT0, "Nihon System", "Perfect Billiard", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1987, pbillrds, pbillrd, pbillrd, pbillrd, freekick_state, pbillrds,ROT0, "Nihon System", "Perfect Billiard (MC-8123, 317-0030)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1987, pbillrdsa, pbillrd, pbillrd, pbillrd, freekick_state, pbillrds,ROT0, "Nihon System", "Perfect Billiard (MC-8123, 317-5008)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // sticker on CPU module different (wrong?) functionality the same +GAME( 1987, pbillrds, pbillrd, pbillrdm, pbillrd, freekick_state, pbillrds,ROT0, "Nihon System", "Perfect Billiard (MC-8123, 317-0030)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1987, pbillrdsa, pbillrd, pbillrdm, pbillrd, freekick_state, pbillrds,ROT0, "Nihon System", "Perfect Billiard (MC-8123, 317-5008)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // sticker on CPU module different (wrong?) functionality the same GAME( 1987, freekick, 0, freekickb, freekck, driver_device, 0, ROT270, "Nihon System (Merit license)", "Free Kick (NS6201-A 1987.10)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1987, freekicka, freekick, freekickb, freekck, driver_device, 0, ROT270, "Nihon System", "Free Kick (NS6201-A 1987.9)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1987, freekickb1,freekick, freekickb, freekck, driver_device, 0, ROT270, "bootleg", "Free Kick (bootleg set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index 33f2bd74e39..f144bb80cff 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -5954,7 +5954,6 @@ DRIVER_INIT_MEMBER(funworld_state, multiwin) ******************************************************/ { UINT8 *ROM = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); int x; @@ -5971,8 +5970,6 @@ DRIVER_INIT_MEMBER(funworld_state, multiwin) ROM[x+0x10000] = code; } - - space.set_decrypted_region(0x8000, 0xffff, memregion("maincpu")->base() + 0x18000); } @@ -5988,7 +5985,6 @@ DRIVER_INIT_MEMBER(funworld_state, royalcdc) ******************************************************/ UINT8 *ROM = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); int x; @@ -6025,8 +6021,6 @@ DRIVER_INIT_MEMBER(funworld_state, royalcdc) ROM[x+0x10000] = code; } - - space.set_decrypted_region(0x6000, 0xffff, memregion("maincpu")->base() + 0x16000); } diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index 3accadfaf72..f9276d41095 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -1355,6 +1355,10 @@ static ADDRESS_MAP_START( mooncrst_map_base, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0xb800, 0xb800) AM_MIRROR(0x07ff) AM_READ(watchdog_reset_r) ADDRESS_MAP_END +static ADDRESS_MAP_START( moonqsr_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, galaxian_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( mooncrst_map, AS_PROGRAM, 8, galaxian_state ) AM_IMPORT_FROM(mooncrst_map_base) AM_IMPORT_FROM(mooncrst_map_discrete) @@ -1670,6 +1674,10 @@ static ADDRESS_MAP_START( mshuttle_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0xb800, 0xb800) AM_READ(watchdog_reset_r) ADDRESS_MAP_END +static ADDRESS_MAP_START( mshuttle_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, galaxian_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( mshuttle_portmap, AS_IO, 8, galaxian_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x0f) @@ -5192,6 +5200,11 @@ static MACHINE_CONFIG_DERIVED( mooncrst, galaxian_base ) MCFG_FRAGMENT_ADD(mooncrst_audio) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( moonqsr, mooncrst ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(moonqsr_decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( fantastc, galaxian_base ) @@ -5289,6 +5302,7 @@ static MACHINE_CONFIG_DERIVED( mshuttle, galaxian_base ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(mshuttle_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(mshuttle_decrypted_opcodes_map) MCFG_CPU_IO_MAP(mshuttle_portmap) /* sound hardware */ @@ -5965,7 +5979,7 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrst) common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(0x8000, memregion("maincpu")->base()); + decode_mooncrst(0x4000, memregion("maincpu")->base()); } @@ -5990,15 +6004,11 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrgx) DRIVER_INIT_MEMBER(galaxian_state,moonqsr) { - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); - /* video extensions */ common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::moonqsr_extend_tile_info, &galaxian_state::moonqsr_extend_sprite_info); /* decrypt program code */ - decode_mooncrst(0x8000, decrypt); - space.set_decrypted_region(0x0000, 0x7fff, decrypt); + decode_mooncrst(0x4000, m_decrypted_opcodes); } WRITE8_MEMBER(galaxian_state::artic_gfxbank_w) @@ -6253,14 +6263,9 @@ DRIVER_INIT_MEMBER(galaxian_state,kong) void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16]) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000); - int A; - space.set_decrypted_region(0x0000, 0xffff, decrypt); - - for (A = 0x0000;A < 0x10000;A++) + for (int A = 0x0000;A < 0x8000;A++) { int i,j; UINT8 src = rom[A]; @@ -6273,7 +6278,7 @@ void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16]) j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3); /* decode the opcodes */ - decrypt[A] = (src & 0xaa) | convtable[i][j]; + m_decrypted_opcodes[A] = (src & 0xaa) | convtable[i][j]; } } @@ -9151,7 +9156,7 @@ ROM_END ROM_START( mshuttle ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "my05", 0x0000, 0x1000, CRC(83574af1) SHA1(d69c2a0538a49d6c72c3346ac4e3959d91da6c98) ) ROM_LOAD( "my04", 0x1000, 0x1000, CRC(1cfae2c8) SHA1(6c7eeee70e91b8498c41525dcc60f8086cff8da7) ) ROM_LOAD( "my03", 0x2000, 0x1000, CRC(c8b8a368) SHA1(140ba60f55285d1e9f7a262634f5ce5c3470ab71) ) @@ -9173,7 +9178,7 @@ ROM_START( mshuttle ) ROM_END ROM_START( mshuttle2 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "my05", 0x0000, 0x1000, CRC(83574af1) SHA1(d69c2a0538a49d6c72c3346ac4e3959d91da6c98) ) ROM_LOAD( "my04", 0x1000, 0x1000, CRC(1cfae2c8) SHA1(6c7eeee70e91b8498c41525dcc60f8086cff8da7) ) ROM_LOAD( "my03", 0x2000, 0x1000, CRC(c8b8a368) SHA1(140ba60f55285d1e9f7a262634f5ce5c3470ab71) ) @@ -9197,7 +9202,7 @@ ROM_END ROM_START( mshuttlej ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "mcs.5", 0x0000, 0x1000, CRC(a5a292b4) SHA1(b4e9d969c762f4114eba88051917df122fc7181f) ) ROM_LOAD( "mcs.4", 0x1000, 0x1000, CRC(acdc0f9e) SHA1(8cd6d6566fe3f4090ccb625c3c1e5850a371826f) ) ROM_LOAD( "mcs.3", 0x2000, 0x1000, CRC(c1e3f5d8) SHA1(d3af89d485b1ca21ac879dbe15490dcd1cd64f2a) ) @@ -9220,7 +9225,7 @@ ROM_START( mshuttlej ) ROM_END ROM_START( mshuttlej2 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "ali5.bin", 0x0000, 0x1000, CRC(320fe630) SHA1(df4fe25989783c8851f41c9b4b63dedfa365c1e9) ) ROM_LOAD( "mcs.4", 0x1000, 0x1000, CRC(acdc0f9e) SHA1(8cd6d6566fe3f4090ccb625c3c1e5850a371826f) ) ROM_LOAD( "mcs.3", 0x2000, 0x1000, CRC(c1e3f5d8) SHA1(d3af89d485b1ca21ac879dbe15490dcd1cd64f2a) ) @@ -10859,7 +10864,7 @@ GAME( 1980, mooncreg, mooncrst, mooncrst, mooncreg, galaxian_state, moonc GAME( 1980, mooncrsl, mooncrst, mooncrst, mooncrsl, galaxian_state, mooncrsu, ROT90, "bootleg (Laguna S.A.)", "Cresta Mundo (Laguna S.A. Spanish Moon Cresta bootleg)", GAME_SUPPORTS_SAVE ) GAME( 1980, stera, mooncrst, mooncrst, smooncrs, galaxian_state, mooncrsu, ROT90, "bootleg", "Steraranger (Moon Cresta bootleg)", GAME_SUPPORTS_SAVE ) GAME( 1980, mooncrgx, mooncrst, galaxian, mooncrgx, galaxian_state, mooncrgx, ROT270, "bootleg", "Moon Cresta (Galaxian hardware)", GAME_SUPPORTS_SAVE ) -GAME( 1980, moonqsr, 0, mooncrst, moonqsr, galaxian_state, moonqsr, ROT90, "Nichibutsu", "Moon Quasar", GAME_SUPPORTS_SAVE ) +GAME( 1980, moonqsr, 0, moonqsr, moonqsr, galaxian_state, moonqsr, ROT90, "Nichibutsu", "Moon Quasar", GAME_SUPPORTS_SAVE ) GAME( 1980, moonal2, galaxian, mooncrst, moonal2, galaxian_state, galaxian, ROT90, "Namco / Nichibutsu", "Moon Alien Part 2", GAME_SUPPORTS_SAVE ) GAME( 1980, moonal2b, galaxian, mooncrst, moonal2, galaxian_state, galaxian, ROT90, "Namco / Nichibutsu", "Moon Alien Part 2 (older version)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/gaplus.c b/src/mame/drivers/gaplus.c index 92015063994..29c03b69b77 100644 --- a/src/mame/drivers/gaplus.c +++ b/src/mame/drivers/gaplus.c @@ -144,7 +144,7 @@ TODO: - schematics show 4 lines going from the 58XX I/O chip to the 26XX (starfield generator). Function and operation unknown. -- Add 62XX custom to machine/namcoio.c (though it's quite different from 56XX and 58XX). +- Complete 62XX custom emulation (machine/namco62.c) (though it's quite different from 56XX and 58XX). - Is the sprite generator the same as Phozon? This isn't clear yet. They are very similar, especially in the way the size flags are layed out. @@ -158,17 +158,7 @@ TODO: #include "includes/gaplus.h" -READ8_MEMBER(gaplus_state::gaplus_spriteram_r) -{ - return m_spriteram[offset]; -} - -WRITE8_MEMBER(gaplus_state::gaplus_spriteram_w) -{ - m_spriteram[offset] = data; -} - -WRITE8_MEMBER(gaplus_state::gaplus_irq_1_ctrl_w) +WRITE8_MEMBER(gaplus_state::irq_1_ctrl_w) { int bit = !BIT(offset, 11); m_main_irq_mask = bit & 1; @@ -176,7 +166,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_irq_1_ctrl_w) m_maincpu->set_input_line(0, CLEAR_LINE); } -WRITE8_MEMBER(gaplus_state::gaplus_irq_2_ctrl_w) +WRITE8_MEMBER(gaplus_state::irq_2_ctrl_w) { int bit = offset & 1; m_sub_irq_mask = bit & 1; @@ -184,7 +174,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_irq_2_ctrl_w) m_subcpu->set_input_line(0, CLEAR_LINE); } -WRITE8_MEMBER(gaplus_state::gaplus_irq_3_ctrl_w) +WRITE8_MEMBER(gaplus_state::irq_3_ctrl_w) { int bit = !BIT(offset, 13); m_sub2_irq_mask = bit & 1; @@ -192,7 +182,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_irq_3_ctrl_w) m_subcpu2->set_input_line(0, CLEAR_LINE); } -WRITE8_MEMBER(gaplus_state::gaplus_sreset_w) +WRITE8_MEMBER(gaplus_state::sreset_w) { int bit = !BIT(offset, 11); m_subcpu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); @@ -200,7 +190,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_sreset_w) m_namco_15xx->mappy_sound_enable(bit); } -WRITE8_MEMBER(gaplus_state::gaplus_freset_w) +WRITE8_MEMBER(gaplus_state::freset_w) { int bit = !BIT(offset, 11); @@ -242,7 +232,7 @@ TIMER_CALLBACK_MEMBER(gaplus_state::namcoio_run) } } -INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_main_irq) +INTERRUPT_GEN_MEMBER(gaplus_state::vblank_main_irq) { if(m_main_irq_mask) m_maincpu->set_input_line(0, ASSERT_LINE); @@ -266,13 +256,13 @@ INTERRUPT_GEN_MEMBER(gaplus_state::gapluso_vblank_main_irq) timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 0); } -INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub_irq) +INTERRUPT_GEN_MEMBER(gaplus_state::vblank_sub_irq) { if(m_sub_irq_mask) m_subcpu->set_input_line(0, ASSERT_LINE); } -INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub2_irq) +INTERRUPT_GEN_MEMBER(gaplus_state::vblank_sub2_irq) { if(m_sub2_irq_mask) m_subcpu2->set_input_line(0, ASSERT_LINE); @@ -280,32 +270,32 @@ INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub2_irq) static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, gaplus_state ) - AM_RANGE(0x0000, 0x07ff) AM_READWRITE(gaplus_videoram_r, gaplus_videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #2) */ - AM_RANGE(0x0800, 0x1fff) AM_READWRITE(gaplus_spriteram_r, gaplus_spriteram_w) AM_SHARE("spriteram") /* shared RAM with CPU #2 (includes sprite RAM) */ + AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #2) */ + AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* shared RAM with CPU #2 (includes sprite RAM) */ AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with CPU #3 */ AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */ - AM_RANGE(0x6820, 0x682f) AM_READWRITE(gaplus_customio_3_r, gaplus_customio_3_w) AM_SHARE("customio_3") /* custom I/O chip #3 interface */ - AM_RANGE(0x7000, 0x7fff) AM_WRITE(gaplus_irq_1_ctrl_w) /* main CPU irq control */ + AM_RANGE(0x6820, 0x682f) AM_READWRITE(customio_3_r, customio_3_w) AM_SHARE("customio_3") /* custom I/O chip #3 interface */ + AM_RANGE(0x7000, 0x7fff) AM_WRITE(irq_1_ctrl_w) /* main CPU irq control */ AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) /* watchdog */ - AM_RANGE(0x8000, 0x8fff) AM_WRITE(gaplus_sreset_w) /* reset CPU #2 & #3, enable sound */ - AM_RANGE(0x9000, 0x9fff) AM_WRITE(gaplus_freset_w) /* reset I/O chips */ - AM_RANGE(0xa000, 0xa7ff) AM_WRITE(gaplus_starfield_control_w) /* starfield control */ + AM_RANGE(0x8000, 0x8fff) AM_WRITE(sreset_w) /* reset CPU #2 & #3, enable sound */ + AM_RANGE(0x9000, 0x9fff) AM_WRITE(freset_w) /* reset I/O chips */ + AM_RANGE(0xa000, 0xa7ff) AM_WRITE(starfield_control_w) /* starfield control */ AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END static ADDRESS_MAP_START( cpu2_map, AS_PROGRAM, 8, gaplus_state ) - AM_RANGE(0x0000, 0x07ff) AM_READWRITE(gaplus_videoram_r, gaplus_videoram_w) /* tilemap RAM (shared with CPU #1) */ - AM_RANGE(0x0800, 0x1fff) AM_READWRITE(gaplus_spriteram_r, gaplus_spriteram_w) /* shared RAM with CPU #1 */ + AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #1) */ + AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* shared RAM with CPU #1 */ // AM_RANGE(0x500f, 0x500f) AM_WRITENOP /* ??? written 256 times on startup */ - AM_RANGE(0x6000, 0x6fff) AM_WRITE(gaplus_irq_2_ctrl_w) /* IRQ 2 control */ + AM_RANGE(0x6000, 0x6fff) AM_WRITE(irq_2_ctrl_w) /* IRQ 2 control */ AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END static ADDRESS_MAP_START( cpu3_map, AS_PROGRAM, 8, gaplus_state ) AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU + sound registers */ AM_RANGE(0x2000, 0x3fff) AM_READWRITE(watchdog_reset_r, watchdog_reset_w) /* watchdog? */ - AM_RANGE(0x4000, 0x7fff) AM_WRITE(gaplus_irq_3_ctrl_w) /* interrupt enable/disable */ + AM_RANGE(0x4000, 0x7fff) AM_WRITE(irq_3_ctrl_w) /* interrupt enable/disable */ AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END @@ -495,7 +485,7 @@ WRITE8_MEMBER(gaplus_state::out_lamps1) coin_counter_w(machine(), 1, ~data & 1); } -MACHINE_START_MEMBER(gaplus_state,gaplus) +void gaplus_state::machine_start() { switch (m_type) { @@ -509,6 +499,10 @@ MACHINE_START_MEMBER(gaplus_state,gaplus) m_namco56xx = machine().device<namco56xx_device>("namcoio_2"); break; } + + save_item(NAME(m_main_irq_mask)); + save_item(NAME(m_sub_irq_mask)); + save_item(NAME(m_sub2_irq_mask)); } @@ -517,17 +511,16 @@ static MACHINE_CONFIG_START( gaplus, gaplus_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6809, 24576000/16) /* 1.536 MHz */ MCFG_CPU_PROGRAM_MAP(cpu1_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, gaplus_vblank_main_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, vblank_main_irq) MCFG_CPU_ADD("sub", M6809, 24576000/16) /* 1.536 MHz */ MCFG_CPU_PROGRAM_MAP(cpu2_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, gaplus_vblank_sub_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, vblank_sub_irq) MCFG_CPU_ADD("sub2", M6809, 24576000/16) /* 1.536 MHz */ MCFG_CPU_PROGRAM_MAP(cpu3_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, gaplus_vblank_sub2_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", gaplus_state, vblank_sub2_irq) - MCFG_MACHINE_START_OVERRIDE(gaplus_state, gaplus) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* a high value to ensure proper synchronization of the CPUs */ MCFG_DEVICE_ADD("namcoio_1", NAMCO56XX, 0) @@ -558,8 +551,8 @@ static MACHINE_CONFIG_START( gaplus, gaplus_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(36*8, 28*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1) - MCFG_SCREEN_UPDATE_DRIVER(gaplus_state, screen_update_gaplus) - MCFG_SCREEN_VBLANK_DRIVER(gaplus_state, screen_eof_gaplus) + MCFG_SCREEN_UPDATE_DRIVER(gaplus_state, screen_update) + MCFG_SCREEN_VBLANK_DRIVER(gaplus_state, screen_eof) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", gaplus) @@ -1011,16 +1004,16 @@ DRIVER_INIT_MEMBER(gaplus_state,galaga3) /* These sets are on revision 2 or 3 PCBs AKA "Namco" PCBs */ -GAME( 1984, gaplus, 0, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2 rev. B)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, gaplusa, gaplus, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, gaplusd, gaplus, gaplusd, gapluso, gaplus_state, gaplusd, ROT90, "Namco", "Gaplus (GP2 rev D, alternate hardware)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, galaga3, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. D)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, galaga3a, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. C)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, galaga3b, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAME( 1984, gaplus, 0, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2 rev. B)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, gaplusa, gaplus, gapluso, gapluso, gaplus_state, gaplus, ROT90, "Namco", "Gaplus (GP2)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, gaplusd, gaplus, gaplusd, gapluso, gaplus_state, gaplusd, ROT90, "Namco", "Gaplus (GP2 rev D, alternate hardware)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, galaga3, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. D)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, galaga3a, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3 rev. C)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, galaga3b, gaplus, gaplus, gaplus, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (GP3)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) /* These sets are on older revision (AKA Midway) 1 PCBs */ -GAME( 1984, galaga3c, gaplus, gaplus, galaga3a, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 4)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, galaga3m, gaplus, gaplus, galaga3m, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 5)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAME( 1984, galaga3c, gaplus, gaplus, galaga3a, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 4)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1984, galaga3m, gaplus, gaplus, galaga3m, gaplus_state, galaga3, ROT90, "Namco", "Galaga 3 (set 5)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) /* This is an odd mix of Galaga3 and Gaplus, main code seems closest to galaga3m but still has significant changes, copyright is modified to 1992, has Galaga 3 style high scores, PARSEF spelling error on high score table */ -GAME( 1992, gaplust, gaplus, gaplus, galaga3m, gaplus_state, galaga3, ROT90, "bootleg (Tecfri)", "Gaplus (Tecfri PCB)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAME( 1992, gaplust, gaplus, gaplus, galaga3m, gaplus_state, galaga3, ROT90, "bootleg (Tecfri)", "Gaplus (Tecfri PCB)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 0e32dedf6b9..51d4291ef4d 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -10817,7 +10817,7 @@ ROM_END ROM_START( nc96 ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "ch363c1.bin", 0x00000, 0x1000, CRC(e566cea3) SHA1(be81b21267ae2ff64c4dbc58e99a9ff4bf1d21aa) ) // v3.63, C1 Sub-PCB + ROM_LOAD( "ch363c1.prom", 0x00000, 0x1000, CRC(e566cea3) SHA1(be81b21267ae2ff64c4dbc58e99a9ff4bf1d21aa) ) // v3.63, C1 Sub-PCB ROM_CONTINUE(0x4000, 0x1000) ROM_CONTINUE(0x3000, 0x1000) ROM_CONTINUE(0x7000, 0x1000) @@ -10828,8 +10828,8 @@ ROM_START( nc96 ) ROM_CONTINUE(0x8000, 0x8000) ROM_REGION( 0x20000, "graphics", 0 ) - ROM_LOAD( "chseh.bin", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) - ROM_LOAD( "chsel.bin", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) + ROM_LOAD( "ch96seh.bin", 0x00000, 0x10000, CRC(65dee6ba) SHA1(77f5769ed0b745a4735576e9f0ce90dcdd9b5410) ) /* Correct graphics for this set, shows (R)COPYRIGHT(C) 1996 */ + ROM_LOAD( "ch96sel.bin", 0x10000, 0x10000, CRC(c21cc114) SHA1(f7b6ff5ac34dc1a7332e8c1b9cc40f3b65deac05) ) /* the other set shows a currupted TM graphic */ ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) @@ -10847,13 +10847,9 @@ ROM_START( nc96 ) ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) - // no proms present, using nfb96 ones ROM_REGION( 0x200, "proms", 0 ) // palette - ROM_LOAD( "chu19.bin", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) - ROM_LOAD( "chu20.bin", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) - - ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? - ROM_LOAD( "chu1920.bin", 0x0000, 0x0100, CRC(71b0e11d) SHA1(1d2a2a31d8571f580c0cb7f4833823841072b31f) ) + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples // none? @@ -10862,7 +10858,7 @@ ROM_END ROM_START( nc96a ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "ch362c1.bin", 0x00000, 0x1000, CRC(10fa984b) SHA1(92ed9838db28deca038c4a5c080a723075ae0c53) ) // v3.62, C1 Sub-PCB + ROM_LOAD( "ch362c1.prom", 0x00000, 0x1000, CRC(10fa984b) SHA1(92ed9838db28deca038c4a5c080a723075ae0c53) ) // v3.62, C1 Sub-PCB ROM_CONTINUE(0x4000, 0x1000) ROM_CONTINUE(0x3000, 0x1000) ROM_CONTINUE(0x7000, 0x1000) @@ -10873,8 +10869,8 @@ ROM_START( nc96a ) ROM_CONTINUE(0x8000, 0x8000) ROM_REGION( 0x20000, "graphics", 0 ) - ROM_LOAD( "chseh.bin", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) - ROM_LOAD( "chsel.bin", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) + ROM_LOAD( "ch96se-h.vrom2", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) + ROM_LOAD( "ch96se-l.vrom1", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) @@ -10892,13 +10888,9 @@ ROM_START( nc96a ) ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) - // no proms present, using nfb96 ones ROM_REGION( 0x200, "proms", 0 ) // palette - ROM_LOAD( "chu19.bin", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) - ROM_LOAD( "chu20.bin", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) - - ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? - ROM_LOAD( "chu1920.bin", 0x0000, 0x0100, CRC(71b0e11d) SHA1(1d2a2a31d8571f580c0cb7f4833823841072b31f) ) + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples // none? @@ -10907,6 +10899,47 @@ ROM_END ROM_START( nc96b ) ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "ch361c1.prom", 0x00000, 0x1000, CRC(dfdd3869) SHA1(e512dd9370b40285a35d12ba7a05e65ab1c693ab) ) // v3.61, C1 Sub-PCB + ROM_CONTINUE(0x4000, 0x1000) + ROM_CONTINUE(0x3000, 0x1000) + ROM_CONTINUE(0x7000, 0x1000) + ROM_CONTINUE(0x1000, 0x1000) + ROM_CONTINUE(0x6000, 0x1000) + ROM_CONTINUE(0x2000, 0x1000) + ROM_CONTINUE(0x5000, 0x1000) + ROM_CONTINUE(0x8000, 0x8000) + + ROM_REGION( 0x20000, "graphics", 0 ) + ROM_LOAD( "ch96se-h.vrom2", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) + ROM_LOAD( "ch96se-l.vrom1", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_COPY( "graphics", 0x18000, 0x00000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x08000, 0x08000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x04000, 0x10000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x1c000, 0x04000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x0c000, 0x0c000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x14000, 0x14000, 0x4000 ) // 2 + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "graphics", 0x02000, 0x00000, 0x2000 ) + ROM_COPY( "graphics", 0x12000, 0x02000, 0x2000 ) + ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) + ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) + + ROM_REGION( 0x200, "proms", 0 ) // palette + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) + + ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples + // none? +ROM_END + + +ROM_START( nc96c ) + ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "chse354d.bin", 0x00000, 0x1000, CRC(160f7b78) SHA1(537a91317e613676b748d4e4ec7015183872814b) ) // v3.54, D Sub-PCB ROM_CONTINUE(0x4000, 0x1000) ROM_CONTINUE(0x3000, 0x1000) @@ -10918,7 +10951,7 @@ ROM_START( nc96b ) ROM_CONTINUE(0x8000, 0x8000) ROM_REGION( 0x20000, "graphics", 0 ) - ROM_LOAD( "ch96seh.bin", 0x00000, 0x10000, CRC(65dee6ba) SHA1(77f5769ed0b745a4735576e9f0ce90dcdd9b5410) ) + ROM_LOAD( "ch96seh.bin", 0x00000, 0x10000, CRC(65dee6ba) SHA1(77f5769ed0b745a4735576e9f0ce90dcdd9b5410) ) /* Correct graphics for this set, shows TM COPYRIGHT(C) 1996 */ ROM_LOAD( "ch96sel.bin", 0x10000, 0x10000, CRC(c21cc114) SHA1(f7b6ff5ac34dc1a7332e8c1b9cc40f3b65deac05) ) ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) @@ -10937,20 +10970,98 @@ ROM_START( nc96b ) ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) - // no proms present, using nfb96 ones ROM_REGION( 0x200, "proms", 0 ) // palette - ROM_LOAD( "chu19.bin", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) - ROM_LOAD( "chu20.bin", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) - ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? - ROM_LOAD( "chu1920.bin", 0x0000, 0x0100, CRC(71b0e11d) SHA1(1d2a2a31d8571f580c0cb7f4833823841072b31f) ) + ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples + // none? +ROM_END + + +ROM_START( nc96d ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "chse353d.prom", 0x00000, 0x1000, CRC(fc56f84f) SHA1(a98746ef0dc919ced201c98c835ef0cbd5c18627) ) // v3.54, D Sub-PCB + ROM_CONTINUE(0x4000, 0x1000) + ROM_CONTINUE(0x3000, 0x1000) + ROM_CONTINUE(0x7000, 0x1000) + ROM_CONTINUE(0x1000, 0x1000) + ROM_CONTINUE(0x6000, 0x1000) + ROM_CONTINUE(0x2000, 0x1000) + ROM_CONTINUE(0x5000, 0x1000) + ROM_CONTINUE(0x8000, 0x8000) + + ROM_REGION( 0x20000, "graphics", 0 ) + ROM_LOAD( "ch96se-h.vrom2", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) + ROM_LOAD( "ch96se-l.vrom1", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_COPY( "graphics", 0x18000, 0x00000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x08000, 0x08000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x04000, 0x10000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x1c000, 0x04000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x0c000, 0x0c000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x14000, 0x14000, 0x4000 ) // 2 + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "graphics", 0x02000, 0x00000, 0x2000 ) + ROM_COPY( "graphics", 0x12000, 0x02000, 0x2000 ) + ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) + ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) + + ROM_REGION( 0x200, "proms", 0 ) // palette + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples // none? ROM_END -ROM_START( nc96c ) +ROM_START( nc96e ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "chsesep3_3.40.prom", 0x00000, 0x1000, CRC(0eec1fd1) SHA1(93e096f471376f5efc3b229fd226c48cd623c48d) ) // v3.40, D Sub-PCB + ROM_CONTINUE(0x4000, 0x1000) + ROM_CONTINUE(0x3000, 0x1000) + ROM_CONTINUE(0x7000, 0x1000) + ROM_CONTINUE(0x1000, 0x1000) + ROM_CONTINUE(0x6000, 0x1000) + ROM_CONTINUE(0x2000, 0x1000) + ROM_CONTINUE(0x5000, 0x1000) + ROM_CONTINUE(0x8000, 0x8000) + + ROM_REGION( 0x20000, "graphics", 0 ) + ROM_LOAD( "ch96se-h.vrom2", 0x00000, 0x10000, CRC(fb90df1d) SHA1(84ec1f40a014a0043b3c3c999428dd274caba1b8) ) + ROM_LOAD( "ch96se-l.vrom1", 0x10000, 0x10000, CRC(e0166f3e) SHA1(27e180fe6e03f48771b540e34415eee54951788f) ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_COPY( "graphics", 0x18000, 0x00000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x08000, 0x08000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x04000, 0x10000, 0x4000 ) // 1 + ROM_COPY( "graphics", 0x1c000, 0x04000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x0c000, 0x0c000, 0x4000 ) // 2 + ROM_COPY( "graphics", 0x14000, 0x14000, 0x4000 ) // 2 + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "graphics", 0x02000, 0x00000, 0x2000 ) + ROM_COPY( "graphics", 0x12000, 0x02000, 0x2000 ) + ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) + ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) + + ROM_REGION( 0x200, "proms", 0 ) // palette + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) + + ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples + // none? +ROM_END + + +ROM_START( nc96f ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "chse362dk.bin", 0x00000, 0x1000, CRC(66df35d3) SHA1(da33f6413b8cf7b472023abc3e5cfe6d52ed1418) ) // v3.62, DK Sub-PCB ROM_CONTINUE(0x4000, 0x1000) @@ -10982,13 +11093,9 @@ ROM_START( nc96c ) ROM_COPY( "graphics", 0x00000, 0x04000, 0x2000 ) ROM_COPY( "graphics", 0x10000, 0x06000, 0x2000 ) - // no proms present, using nfb96 ones ROM_REGION( 0x200, "proms", 0 ) // palette - ROM_LOAD( "chu19.bin", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) - ROM_LOAD( "chu20.bin", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) - - ROM_REGION( 0x100, "sku1920.bin", 0 ) // colours again? - ROM_LOAD( "chu1920.bin", 0x0000, 0x0100, CRC(71b0e11d) SHA1(1d2a2a31d8571f580c0cb7f4833823841072b31f) ) + ROM_LOAD( "82s129a.u84", 0x0000, 0x0100, CRC(fafc43ad) SHA1(e94592b83f19e5f9b6205473c1e06b36405ebfc2) ) + ROM_LOAD( "82s129a.u79", 0x0100, 0x0100, CRC(05224f73) SHA1(051c3ee9c63f5436e4f6c355fc308f37910a88ef) ) ROM_REGION( 0x80000, "oki", ROMREGION_ERASEFF ) // samples // none? @@ -13146,8 +13253,11 @@ GAMEL( 2000, nfb96txt, nfb96, amcoe2, nfb96tx, cmaster_state, nfb96_c2, GAMEL( 1996, nc96, 0, amcoe2, nfb96, cmaster_state, nfb96_c1, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.63, C1 PCB)", 0, layout_nfb96 ) /* C1 Sub-PCB */ GAMEL( 1996, nc96a, nc96, amcoe2, nfb96, cmaster_state, nfb96_c1, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.62, C1 PCB)", 0, layout_nfb96 ) /* C1 Sub-PCB */ -GAMEL( 1996, nc96b, nc96, amcoe2, nfb96, cmaster_state, nfb96_d, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.54, D PCB)", 0, layout_nfb96 ) /* D Sub-PCB */ -GAMEL( 1996, nc96c, nc96, amcoe2, nfb96, cmaster_state, nfb96_dk, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.62, DK PCB)", 0, layout_nfb96 ) /* DK Sub-PCB */ +GAMEL( 1996, nc96b, nc96, amcoe2, nfb96, cmaster_state, nfb96_c1, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.61, C1 PCB)", 0, layout_nfb96 ) /* C1 Sub-PCB */ +GAMEL( 1996, nc96c, nc96, amcoe2, nfb96, cmaster_state, nfb96_d, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.54, D PCB)", 0, layout_nfb96 ) /* D Sub-PCB */ +GAMEL( 1996, nc96d, nc96, amcoe2, nfb96, cmaster_state, nfb96_d, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.53, D PCB)", 0, layout_nfb96 ) /* D Sub-PCB */ +GAMEL( 1996, nc96e, nc96, amcoe2, nfb96, cmaster_state, nfb96_d, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.40, D PCB)", 0, layout_nfb96 ) /* D Sub-PCB */ +GAMEL( 1996, nc96f, nc96, amcoe2, nfb96, cmaster_state, nfb96_dk, ROT0, "Amcoe", "New Cherry '96 Special Edition (v3.62, DK PCB)", 0, layout_nfb96 ) /* DK Sub-PCB */ GAMEL( 2000, nc96txt, nc96, amcoe2, nfb96tx, cmaster_state, nfb96_c2, ROT0, "Amcoe", "New Cherry '96 Special Edition (v1.32 Texas XT, C2 PCB)", 0, layout_nfb96tx ) /* ver. tc1.32axt C2 Sub-PCB */ GAME( 2009, fb2010, 0, amcoe2, nfb96tx, cmaster_state, fb2010, ROT0, "Amcoe", "Fruit Bonus 2010", GAME_NOT_WORKING ) // no gfx dumped diff --git a/src/mame/drivers/gradius3.c b/src/mame/drivers/gradius3.c index 9868e367ba2..099ab8690d8 100644 --- a/src/mame/drivers/gradius3.c +++ b/src/mame/drivers/gradius3.c @@ -412,50 +412,50 @@ ROM_START( gradius3j ) ROM_END ROM_START( gradius3js ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "945_s13.f15", 0x00000, 0x20000, CRC(70c240a2) SHA1(82dc391572e1f61b0182cb031654d71adcdd5f6e) ) - ROM_LOAD16_BYTE( "945_s12.e15", 0x00001, 0x20000, CRC(bbc300d4) SHA1(e1ca98bc591575285d7bd2d4fefdf35fed10dcb6) ) - - ROM_REGION( 0x100000, "sub", 0 ) - ROM_LOAD16_BYTE( "945_m09.r17", 0x000000, 0x20000, CRC(b4a6df25) SHA1(85533cf140d28f6f81c0b49b8061bda0924a613a) ) - ROM_LOAD16_BYTE( "945_m08.n17", 0x000001, 0x20000, CRC(74e981d2) SHA1(e7b47a2da01ff73293d2100c48fdf00b33125af5) ) - ROM_LOAD16_BYTE( "945_l06b.r11", 0x040000, 0x20000, CRC(83772304) SHA1(a90c75a3de670b6ec5e0fc201876d463b4a76766) ) - ROM_LOAD16_BYTE( "945_l06a.n11", 0x040001, 0x20000, CRC(e1fd75b6) SHA1(6160d80a2f1bf550e85d6253cf521a96f5a644cc) ) - ROM_LOAD16_BYTE( "945_l07c.r15", 0x080000, 0x20000, CRC(c1e399b6) SHA1(e95bd478dd3beea0175bf9ee4cededb111c4ace1) ) - ROM_LOAD16_BYTE( "945_l07a.n15", 0x080001, 0x20000, CRC(96222d04) SHA1(b55700f683a556b0e73dbac9c7b4ce485420d21c) ) - ROM_LOAD16_BYTE( "945_l07d.r13", 0x0c0000, 0x20000, CRC(4c16d4bd) SHA1(01dcf169b78a1e495214b10181401d1920b0c924) ) - ROM_LOAD16_BYTE( "945_l07b.n13", 0x0c0001, 0x20000, CRC(5e209d01) SHA1(0efa1bbfdc7e2ba1e0bb96245e2bfe961258b446) ) - - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "945_m05.d9", 0x00000, 0x10000, CRC(c8c45365) SHA1(b9a7b736b52bca42c7b8c8ed64c8df73e0116158) ) - - ROM_REGION( 0x200000, "k051960", 0 ) /* graphics (addressable by the main CPU) */ + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "945_s13.f15", 0x00000, 0x20000, CRC(70c240a2) SHA1(82dc391572e1f61b0182cb031654d71adcdd5f6e) ) + ROM_LOAD16_BYTE( "945_s12.e15", 0x00001, 0x20000, CRC(bbc300d4) SHA1(e1ca98bc591575285d7bd2d4fefdf35fed10dcb6) ) + + ROM_REGION( 0x100000, "sub", 0 ) + ROM_LOAD16_BYTE( "945_m09.r17", 0x000000, 0x20000, CRC(b4a6df25) SHA1(85533cf140d28f6f81c0b49b8061bda0924a613a) ) + ROM_LOAD16_BYTE( "945_m08.n17", 0x000001, 0x20000, CRC(74e981d2) SHA1(e7b47a2da01ff73293d2100c48fdf00b33125af5) ) + ROM_LOAD16_BYTE( "945_l06b.r11", 0x040000, 0x20000, CRC(83772304) SHA1(a90c75a3de670b6ec5e0fc201876d463b4a76766) ) + ROM_LOAD16_BYTE( "945_l06a.n11", 0x040001, 0x20000, CRC(e1fd75b6) SHA1(6160d80a2f1bf550e85d6253cf521a96f5a644cc) ) + ROM_LOAD16_BYTE( "945_l07c.r15", 0x080000, 0x20000, CRC(c1e399b6) SHA1(e95bd478dd3beea0175bf9ee4cededb111c4ace1) ) + ROM_LOAD16_BYTE( "945_l07a.n15", 0x080001, 0x20000, CRC(96222d04) SHA1(b55700f683a556b0e73dbac9c7b4ce485420d21c) ) + ROM_LOAD16_BYTE( "945_l07d.r13", 0x0c0000, 0x20000, CRC(4c16d4bd) SHA1(01dcf169b78a1e495214b10181401d1920b0c924) ) + ROM_LOAD16_BYTE( "945_l07b.n13", 0x0c0001, 0x20000, CRC(5e209d01) SHA1(0efa1bbfdc7e2ba1e0bb96245e2bfe961258b446) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "945_m05.d9", 0x00000, 0x10000, CRC(c8c45365) SHA1(b9a7b736b52bca42c7b8c8ed64c8df73e0116158) ) + + ROM_REGION( 0x200000, "k051960", 0 ) /* graphics (addressable by the main CPU) */ ROM_LOAD32_BYTE( "945_A02A.K2", 0x000000, 0x20000, CRC(fbb81511) SHA1(e7988d52e323e46117f5080c469daf9b119f28a0) ) - ROM_LOAD32_BYTE( "945_A02C.M2", 0x000001, 0x20000, CRC(031b55e8) SHA1(64ed8dee60bf012df7c1ed496af1c75263c052a6) ) - ROM_LOAD32_BYTE( "945_A01A.E2", 0x000002, 0x20000, CRC(bace5abb) SHA1(b32df63294c0730f463335b1b760494389c60062) ) - ROM_LOAD32_BYTE( "945_A01C.H2", 0x000003, 0x20000, CRC(d91b29a6) SHA1(0c3027a08996f4c2b86dd88695241b21c8dffd64) ) - ROM_LOAD32_BYTE( "945_A02B.K4", 0x080000, 0x20000, CRC(c0fed4ab) SHA1(f01975b13759cae7c8dfd24f9b3f4ac960d32957) ) - ROM_LOAD32_BYTE( "945_A02D.M4", 0x080001, 0x20000, CRC(d462817c) SHA1(00137e38454e7c3548a1a9553c5ee644916b3959) ) - ROM_LOAD32_BYTE( "945_A01B.E4", 0x080002, 0x20000, CRC(b426090e) SHA1(06a671a648e3255146fe0c325d5451d4f75f08aa) ) - ROM_LOAD32_BYTE( "945_A01D.H4", 0x080003, 0x20000, CRC(3990c09a) SHA1(1f6a089c1d03fb95d4d96fecc0379bde26ee2b9d) ) - - ROM_LOAD32_BYTE( "945_l04a.k6", 0x100000, 0x20000, CRC(884e21ee) SHA1(ce86dd3a06775e5b1aa09db010dcb674e67828e7) ) - ROM_LOAD32_BYTE( "945_l04c.m6", 0x100001, 0x20000, CRC(45bcd921) SHA1(e51a8a71362a6fb55124aa1dce74519c0a3c6e3f) ) - ROM_LOAD32_BYTE( "945_l03a.e6", 0x100002, 0x20000, CRC(a67ef087) SHA1(fd63474f3bbde5dfc53ed4c1db25d6411a8b54d2) ) - ROM_LOAD32_BYTE( "945_l03c.h6", 0x100003, 0x20000, CRC(a56be17a) SHA1(1d387736144c30fcb5de54235331ab1ff70c356e) ) - ROM_LOAD32_BYTE( "945_l04b.k8", 0x180000, 0x20000, CRC(843bc67d) SHA1(cdf8421083f24ab27867ed5d08d8949da192b2b9) ) - ROM_LOAD32_BYTE( "945_l04d.m8", 0x180001, 0x20000, CRC(0a98d08e) SHA1(1e0ca51a2d45c01fa3f11950ddd387f41ddae691) ) - ROM_LOAD32_BYTE( "945_l03b.e8", 0x180002, 0x20000, CRC(933e68b9) SHA1(f3a39446ca77d17fdbd938bd5f718ae9d5570879) ) - ROM_LOAD32_BYTE( "945_l03d.h8", 0x180003, 0x20000, CRC(f375e87b) SHA1(6427b966795c907c8e516244872fe52217da62c4) ) - - ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "945l14.j28", 0x0000, 0x0100, CRC(c778c189) SHA1(847eaf379ba075c25911c6f83dd63ff390534f60) ) /* priority encoder (not used) */ - - ROM_REGION( 0x80000, "k007232", 0 ) /* 007232 samples */ + ROM_LOAD32_BYTE( "945_A02C.M2", 0x000001, 0x20000, CRC(031b55e8) SHA1(64ed8dee60bf012df7c1ed496af1c75263c052a6) ) + ROM_LOAD32_BYTE( "945_A01A.E2", 0x000002, 0x20000, CRC(bace5abb) SHA1(b32df63294c0730f463335b1b760494389c60062) ) + ROM_LOAD32_BYTE( "945_A01C.H2", 0x000003, 0x20000, CRC(d91b29a6) SHA1(0c3027a08996f4c2b86dd88695241b21c8dffd64) ) + ROM_LOAD32_BYTE( "945_A02B.K4", 0x080000, 0x20000, CRC(c0fed4ab) SHA1(f01975b13759cae7c8dfd24f9b3f4ac960d32957) ) + ROM_LOAD32_BYTE( "945_A02D.M4", 0x080001, 0x20000, CRC(d462817c) SHA1(00137e38454e7c3548a1a9553c5ee644916b3959) ) + ROM_LOAD32_BYTE( "945_A01B.E4", 0x080002, 0x20000, CRC(b426090e) SHA1(06a671a648e3255146fe0c325d5451d4f75f08aa) ) + ROM_LOAD32_BYTE( "945_A01D.H4", 0x080003, 0x20000, CRC(3990c09a) SHA1(1f6a089c1d03fb95d4d96fecc0379bde26ee2b9d) ) + + ROM_LOAD32_BYTE( "945_l04a.k6", 0x100000, 0x20000, CRC(884e21ee) SHA1(ce86dd3a06775e5b1aa09db010dcb674e67828e7) ) + ROM_LOAD32_BYTE( "945_l04c.m6", 0x100001, 0x20000, CRC(45bcd921) SHA1(e51a8a71362a6fb55124aa1dce74519c0a3c6e3f) ) + ROM_LOAD32_BYTE( "945_l03a.e6", 0x100002, 0x20000, CRC(a67ef087) SHA1(fd63474f3bbde5dfc53ed4c1db25d6411a8b54d2) ) + ROM_LOAD32_BYTE( "945_l03c.h6", 0x100003, 0x20000, CRC(a56be17a) SHA1(1d387736144c30fcb5de54235331ab1ff70c356e) ) + ROM_LOAD32_BYTE( "945_l04b.k8", 0x180000, 0x20000, CRC(843bc67d) SHA1(cdf8421083f24ab27867ed5d08d8949da192b2b9) ) + ROM_LOAD32_BYTE( "945_l04d.m8", 0x180001, 0x20000, CRC(0a98d08e) SHA1(1e0ca51a2d45c01fa3f11950ddd387f41ddae691) ) + ROM_LOAD32_BYTE( "945_l03b.e8", 0x180002, 0x20000, CRC(933e68b9) SHA1(f3a39446ca77d17fdbd938bd5f718ae9d5570879) ) + ROM_LOAD32_BYTE( "945_l03d.h8", 0x180003, 0x20000, CRC(f375e87b) SHA1(6427b966795c907c8e516244872fe52217da62c4) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "945l14.j28", 0x0000, 0x0100, CRC(c778c189) SHA1(847eaf379ba075c25911c6f83dd63ff390534f60) ) /* priority encoder (not used) */ + + ROM_REGION( 0x80000, "k007232", 0 ) /* 007232 samples */ ROM_LOAD( "945_A10A.C14", 0x00000, 0x20000, CRC(ec717414) SHA1(8c63d5fe01d0833529fca91bc80cdbd8a04174c0) ) ROM_LOAD( "945_A10B.C16", 0x20000, 0x20000, CRC(709e30e4) SHA1(27fcea720cd2498f1870c9290d30dcb3dd81d5e5) ) - ROM_LOAD( "945_l11a.c18", 0x40000, 0x20000, CRC(6043f4eb) SHA1(1c2e9ace1cfdde504b7b6158e3c3f54dc5ae33d4) ) - ROM_LOAD( "945_l11b.c20", 0x60000, 0x20000, CRC(89ea3baf) SHA1(8edcbaa7969185cfac48c02559826d1b8b081f3f) ) + ROM_LOAD( "945_l11a.c18", 0x40000, 0x20000, CRC(6043f4eb) SHA1(1c2e9ace1cfdde504b7b6158e3c3f54dc5ae33d4) ) + ROM_LOAD( "945_l11b.c20", 0x60000, 0x20000, CRC(89ea3baf) SHA1(8edcbaa7969185cfac48c02559826d1b8b081f3f) ) ROM_END ROM_START( gradius3a ) diff --git a/src/mame/drivers/grchamp.c b/src/mame/drivers/grchamp.c index d10424246a8..216a17ad5f0 100644 --- a/src/mame/drivers/grchamp.c +++ b/src/mame/drivers/grchamp.c @@ -91,7 +91,7 @@ void grchamp_state::machine_start() save_item(NAME(m_collmode)); } - void grchamp_state::machine_reset() + void grchamp_state::machine_reset() { /* if the coin system is 1 way, lock Coin B (Page 40) */ coin_lockout_w(machine(), 1, (ioport("DSWB")->read() & 0x10) ? 1 : 0); diff --git a/src/mame/drivers/gyruss.c b/src/mame/drivers/gyruss.c index 0001553790b..e894a93edd2 100644 --- a/src/mame/drivers/gyruss.c +++ b/src/mame/drivers/gyruss.c @@ -466,7 +466,7 @@ static MACHINE_CONFIG_START( gyruss, gyruss_state ) MCFG_CPU_PROGRAM_MAP(main_cpu1_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", gyruss_state, master_vblank_irq) - MCFG_CPU_ADD("sub", M6809, MASTER_CLOCK/12) /* 1.536 MHz */ + MCFG_CPU_ADD("sub", KONAMI1, MASTER_CLOCK/12) /* 1.536 MHz */ MCFG_CPU_PROGRAM_MAP(main_cpu2_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", gyruss_state, slave_vblank_irq) @@ -681,7 +681,6 @@ ROM_END DRIVER_INIT_MEMBER(gyruss_state,gyruss) { - konami1_decode(machine(), "sub"); } diff --git a/src/mame/drivers/hyperspt.c b/src/mame/drivers/hyperspt.c index 826e5e278c0..bbbe2f74a26 100644 --- a/src/mame/drivers/hyperspt.c +++ b/src/mame/drivers/hyperspt.c @@ -292,7 +292,7 @@ INTERRUPT_GEN_MEMBER(hyperspt_state::vblank_irq) static MACHINE_CONFIG_START( hyperspt, hyperspt_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, XTAL_18_432MHz/12) /* verified on pcb */ + MCFG_CPU_ADD("maincpu", KONAMI1, XTAL_18_432MHz/12) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(hyperspt_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", hyperspt_state, vblank_irq) @@ -544,7 +544,6 @@ ROM_END DRIVER_INIT_MEMBER(hyperspt_state,hyperspt) { - konami1_decode(machine(), "maincpu"); } diff --git a/src/mame/drivers/igs017.c b/src/mame/drivers/igs017.c index 2a76f9ecc59..c049153dde3 100644 --- a/src/mame/drivers/igs017.c +++ b/src/mame/drivers/igs017.c @@ -72,7 +72,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_generic_paletteram_8(*this, "paletteram"), - m_generic_paletteram_16(*this, "paletteram") + m_generic_paletteram_16(*this, "paletteram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } int m_input_addr; @@ -89,6 +90,7 @@ public: required_device<palette_device> m_palette; optional_shared_ptr<UINT8> m_generic_paletteram_8; optional_shared_ptr<UINT16> m_generic_paletteram_16; + optional_shared_ptr<UINT8> m_decrypted_opcodes; void igs025_to_igs022_callback( void ); @@ -847,14 +849,12 @@ DRIVER_INIT_MEMBER(igs017_state,starzan) int size = 0x040000; UINT8 *data = memregion("maincpu")->base(); - UINT8 *code = auto_alloc_array(machine(), UINT8, size); + UINT8 *code = m_decrypted_opcodes; memcpy(code, data, size); starzan_decrypt(data, size, false); // data starzan_decrypt(code, size, true); // opcodes - m_maincpu->space(AS_PROGRAM).set_decrypted_region(0x00000, 0x3ffff, code); - mgcs_flip_sprites(); } @@ -1349,6 +1349,10 @@ static ADDRESS_MAP_START( iqblocka_map, AS_PROGRAM, 8, igs017_state ) AM_RANGE( 0x10000, 0x3ffff ) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, igs017_state ) + AM_RANGE( 0x00000, 0x3ffff ) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + WRITE8_MEMBER(igs017_state::nmi_enable_w) { m_nmi_enable = data & 1; @@ -3706,6 +3710,10 @@ static MACHINE_CONFIG_START( iqblocka, igs017_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( starzan, iqblocka ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END // mgcs @@ -4669,5 +4677,5 @@ GAME( 1998, lhzb2a, lhzb2, lhzb2a, lhzb2a, igs017_state, lhzb2a, ROT GAME( 1998, slqz2, 0, slqz2, slqz2, igs017_state, slqz2, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 2 (VS203J)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) GAME( 1999?, tarzan, 0, iqblocka, iqblocka, igs017_state, tarzan, ROT0, "IGS", "Tarzan (V109C)", GAME_NOT_WORKING ) GAME( 1999?, tarzana, tarzan, iqblocka, iqblocka, igs017_state, tarzana, ROT0, "IGS", "Tarzan (V107)", GAME_NOT_WORKING ) -GAME( 2000?, starzan, 0, iqblocka, iqblocka, igs017_state, starzan, ROT0, "IGS / G.F. Gioca", "Super Tarzan (Italy, V100I)", GAME_NOT_WORKING ) +GAME( 2000?, starzan, 0, starzan, iqblocka, igs017_state, starzan, ROT0, "IGS / G.F. Gioca", "Super Tarzan (Italy, V100I)", GAME_NOT_WORKING ) GAME( ????, spkrform, spk116it, spkrform, spkrform, igs017_state, spkrform, ROT0, "IGS", "Super Poker (v100xD03) / Formosa", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index 79148e92564..9b5d0132922 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -192,6 +192,10 @@ static ADDRESS_MAP_START( jack_map, AS_PROGRAM, 8, jack_state ) AM_RANGE(0xc000, 0xffff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, jack_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( striv_map, AS_PROGRAM, 8, jack_state ) AM_RANGE(0xb000, 0xb0ff) AM_WRITENOP AM_RANGE(0xc000, 0xcfff) AM_READ(striv_question_r) @@ -929,6 +933,11 @@ static MACHINE_CONFIG_START( jack, jack_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( treahunt, jack ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( striv, jack ) @@ -1442,23 +1451,17 @@ DRIVER_INIT_MEMBER(jack_state,zzyzzyxx) void jack_state::treahunt_decode( ) { - int A; - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x4000); - int data; - - space.set_decrypted_region(0x0000, 0x3fff, decrypt); /* Thanks to Mike Balfour for helping out with the decryption */ - for (A = 0; A < 0x4000; A++) + for (int A = 0; A < 0x4000; A++) { - data = rom[A]; + UINT8 data = rom[A]; if (A & 0x1000) { /* unencrypted = D0 D2 D5 D1 D3 D6 D4 D7 */ - decrypt[A] = + m_decrypted_opcodes[A] = ((data & 0x01) << 7) | ((data & 0x02) << 3) | ((data & 0x04) << 4) | @@ -1469,12 +1472,12 @@ void jack_state::treahunt_decode( ) if ((A & 0x04) == 0) /* unencrypted = !D0 D2 D5 D1 D3 D6 D4 !D7 */ - decrypt[A] ^= 0x81; + m_decrypted_opcodes[A] ^= 0x81; } else { /* unencrypted = !D7 D2 D5 D1 D3 D6 D4 !D0 */ - decrypt[A] = + m_decrypted_opcodes[A] = (~data & 0x81) | ((data & 0x02) << 3) | ((data & 0x04) << 4) | @@ -1555,7 +1558,7 @@ DRIVER_INIT_MEMBER(jack_state,striv) GAME( 1982, jack, 0, jack, jack, jack_state, jack, ROT90, "Hara Industries (Cinematronics license)", "Jack the Giantkiller (set 1)", GAME_SUPPORTS_SAVE ) GAME( 1982, jack2, jack, jack, jack2, jack_state, jack, ROT90, "Hara Industries (Cinematronics license)", "Jack the Giantkiller (set 2)", GAME_SUPPORTS_SAVE ) GAME( 1982, jack3, jack, jack, jack3, jack_state, jack, ROT90, "Hara Industries (Cinematronics license)", "Jack the Giantkiller (set 3)", GAME_SUPPORTS_SAVE ) -GAME( 1982, treahunt, jack, jack, treahunt, jack_state, treahunt, ROT90, "Hara Industries", "Treasure Hunt", GAME_SUPPORTS_SAVE ) +GAME( 1982, treahunt, jack, treahunt, treahunt, jack_state, treahunt, ROT90, "Hara Industries", "Treasure Hunt", GAME_SUPPORTS_SAVE ) GAME( 1982, zzyzzyxx, 0, jack, zzyzzyxx, jack_state, zzyzzyxx, ROT90, "Cinematronics / Advanced Microcomputer Systems", "Zzyzzyxx (set 1)", GAME_SUPPORTS_SAVE ) GAME( 1982, zzyzzyxx2, zzyzzyxx, jack, zzyzzyxx, jack_state, zzyzzyxx, ROT90, "Cinematronics / Advanced Microcomputer Systems", "Zzyzzyxx (set 2)", GAME_SUPPORTS_SAVE ) GAME( 1982, brix, zzyzzyxx, jack, zzyzzyxx, jack_state, zzyzzyxx, ROT90, "Cinematronics / Advanced Microcomputer Systems", "Brix", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/jailbrek.c b/src/mame/drivers/jailbrek.c index 0142f42e7a9..2a58c3df652 100644 --- a/src/mame/drivers/jailbrek.c +++ b/src/mame/drivers/jailbrek.c @@ -246,7 +246,7 @@ void jailbrek_state::machine_reset() static MACHINE_CONFIG_START( jailbrek, jailbrek_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/12) + MCFG_CPU_ADD("maincpu", KONAMI1, MASTER_CLOCK/12) MCFG_CPU_PROGRAM_MAP(jailbrek_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", jailbrek_state, jb_interrupt) MCFG_CPU_PERIODIC_INT_DRIVER(jailbrek_state, jb_interrupt_nmi, 500) /* ? */ @@ -414,8 +414,6 @@ DRIVER_INIT_MEMBER(jailbrek_state,jailbrek) SPEECH_ROM[ind] = SPEECH_ROM[ind + 0x2000]; } } - - konami1_decode(machine(), "maincpu"); } GAME( 1986, jailbrek, 0, jailbrek, jailbrek, jailbrek_state, jailbrek, ROT0, "Konami", "Jail Break", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/jankenmn.c b/src/mame/drivers/jankenmn.c index 2f70aaaac9b..580e3ad2353 100644 --- a/src/mame/drivers/jankenmn.c +++ b/src/mame/drivers/jankenmn.c @@ -263,7 +263,7 @@ ADDRESS_MAP_END /* Writes to port 30h.... - + They are coming from different code chunks, but seems that at least they have different functions. Writes from 00B6h are unknown, whilst others coming from 00D6h are counters. Sometimes whilst one increase, @@ -276,7 +276,7 @@ ADDRESS_MAP_END is written to the port. Maybe is a leftover, or just a connector to hook the multiplier's 'roulette style' matrix lamps for other Janken Man games... - + ':maincpu' (00B6): unmapped io memory write to 0030 = 01 & FF ':maincpu' (00D6): unmapped io memory write to 0030 = 2F & FF ':maincpu' (0103): unmapped io memory write to 0030 = 00 & FF diff --git a/src/mame/drivers/jongkyo.c b/src/mame/drivers/jongkyo.c index 5b13a9ee921..4536391be9b 100644 --- a/src/mame/drivers/jongkyo.c +++ b/src/mame/drivers/jongkyo.c @@ -139,6 +139,7 @@ WRITE8_MEMBER(jongkyo_state::bank_select_w) m_rom_bank |= mask; membank("bank1")->set_entry(m_rom_bank); + membank("bank1d")->set_entry(m_rom_bank); } WRITE8_MEMBER(jongkyo_state::mux_w) @@ -243,6 +244,11 @@ static ADDRESS_MAP_START( jongkyo_memmap, AS_PROGRAM, 8, jongkyo_state ) AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, jongkyo_state ) + AM_RANGE(0x0000, 0x6bff) AM_ROMBANK("bank0d") + AM_RANGE(0x6c00, 0x6fff) AM_ROMBANK("bank1d") +ADDRESS_MAP_END + static ADDRESS_MAP_START( jongkyo_portmap, AS_IO, 8, jongkyo_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -488,6 +494,7 @@ static MACHINE_CONFIG_START( jongkyo, jongkyo_state ) MCFG_CPU_ADD("maincpu", Z80,JONGKYO_CLOCK/4) MCFG_CPU_PROGRAM_MAP(jongkyo_memmap) MCFG_CPU_IO_MAP(jongkyo_portmap) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", jongkyo_state, irq0_line_hold) @@ -518,12 +525,13 @@ MACHINE_CONFIG_END *************************************/ ROM_START( jongkyo ) - ROM_REGION( 0x9000, "maincpu", 0 ) + ROM_REGION( 0x8c00, "maincpu", 0 ) ROM_LOAD( "epr-6258", 0x00000, 0x02000, CRC(fb8b7bcc) SHA1(8ece7c2c82c237b4b51829d412b2109b96ccd0e7) ) ROM_LOAD( "epr-6259", 0x02000, 0x02000, CRC(e46cde5d) SHA1(1cbe1677cfb3fa9f76ad90d5b1446ce9cefee6b7) ) ROM_LOAD( "epr-6260", 0x04000, 0x02000, CRC(369a5365) SHA1(037a2971a59ab339595b333cbdfd4cbb104de2be) ) - ROM_LOAD( "epr-6262", 0x06000, 0x01000, CRC(ecf50f34) SHA1(ecfa1a9360d8fbcbed457d46e53bae77f6d78c1d) ) - ROM_LOAD( "epr-6261", 0x07000, 0x02000, CRC(9c475ae1) SHA1(b993c2636dafed9f80fa87e71921c3c85c039e45) ) // banked at 6c00-6fff + ROM_LOAD( "epr-6262", 0x06000, 0x00c00, CRC(ecf50f34) SHA1(ecfa1a9360d8fbcbed457d46e53bae77f6d78c1d) ) + ROM_IGNORE(0x400) + ROM_LOAD( "epr-6261", 0x06c00, 0x02000, CRC(9c475ae1) SHA1(b993c2636dafed9f80fa87e71921c3c85c039e45) ) // banked at 6c00-6fff ROM_REGION( 0x300, "proms", 0 ) /* colours */ @@ -544,17 +552,44 @@ ROM_END DRIVER_INIT_MEMBER(jongkyo_state,jongkyo) { - int i; + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0x08,0xa8,0x88 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...0...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x20,0xa0,0x00,0x80 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...1...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 } /* ...1...1...1...1 */ + }; + UINT8 *rom = memregion("maincpu")->base(); /* first of all, do a simple bitswap */ - for (i = 0x6000; i < 0x9000; ++i) + for (int i = 0x6000; i < 0x8c00; ++i) { rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0); } + UINT8 *opcodes = auto_alloc_array(machine(), UINT8, 0x6c00+0x400*8); + /* then do the standard Sega decryption */ - jongkyo_decode(machine(), "maincpu"); + sega_decode(rom, opcodes, 0x6c00, convtable, 8, 0x400); + + membank("bank1")->configure_entries(0, 8, rom+0x6c00, 0x400); + membank("bank1d")->configure_entries(0, 8, opcodes+0x6c00, 0x400); + membank("bank0d")->set_base(opcodes); } diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c index a5f0180aefd..57bc3dfb294 100644 --- a/src/mame/drivers/junofrst.c +++ b/src/mame/drivers/junofrst.c @@ -409,7 +409,7 @@ INTERRUPT_GEN_MEMBER(junofrst_state::_30hz_irq) static MACHINE_CONFIG_START( junofrst, junofrst_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1500000) /* 1.5 MHz ??? */ + MCFG_CPU_ADD("maincpu", KONAMI1, 1500000) /* 1.5 MHz ??? */ MCFG_CPU_PROGRAM_MAP(main_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", junofrst_state, _30hz_irq) @@ -507,10 +507,7 @@ ROM_END DRIVER_INIT_MEMBER(junofrst_state,junofrst) { - UINT8 *decrypted = konami1_decode(machine(), "maincpu"); - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x1000); - membank("bank1")->configure_decrypted_entries(0, 16, decrypted + 0x10000, 0x1000); } diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index 754b464929f..79f2260bffd 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -115,6 +115,10 @@ static ADDRESS_MAP_START( kchampvs_map, AS_PROGRAM, 8, kchamp_state ) AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, kchamp_state ) + AM_RANGE(0x0000, 0xffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( kchampvs_io_map, AS_IO, 8, kchamp_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_WRITE(kchamp_flipscreen_w) @@ -400,6 +404,7 @@ static MACHINE_CONFIG_START( kchampvs, kchamp_state ) MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/4) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(kchampvs_map) MCFG_CPU_IO_MAP(kchampvs_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", kchamp_state, kc_interrupt) MCFG_CPU_ADD("audiocpu", Z80, XTAL_12MHz/4) /* verified on pcb */ @@ -701,26 +706,19 @@ ROM_START( karatevs ) ROM_END -UINT8 *kchamp_state::decrypt_code() +void kchamp_state::decrypt_code() { - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000); UINT8 *rom = memregion("maincpu")->base(); - int A; - - space.set_decrypted_region(0x0000, 0xffff, decrypted); - - for (A = 0; A < 0x10000; A++) - decrypted[A] = (rom[A] & 0x55) | ((rom[A] & 0x88) >> 2) | ((rom[A] & 0x22) << 2); - - return decrypted; + for (int A = 0; A < 0x10000; A++) + m_decrypted_opcodes[A] = (rom[A] & 0x55) | ((rom[A] & 0x88) >> 2) | ((rom[A] & 0x22) << 2); } DRIVER_INIT_MEMBER(kchamp_state,kchampvs) { + decrypt_code(); + UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypted = decrypt_code(); int A; /* @@ -732,14 +730,14 @@ DRIVER_INIT_MEMBER(kchamp_state,kchampvs) turns the encryption on, but this doesn't explain the encrypted address for the jump. */ - decrypted[0] = rom[0]; /* this is a jump */ + m_decrypted_opcodes[0] = rom[0]; /* this is a jump */ A = rom[1] + 256 * rom[2]; - decrypted[A] = rom[A]; /* fix opcode on first jump address (again, a jump) */ + m_decrypted_opcodes[A] = rom[A]; /* fix opcode on first jump address (again, a jump) */ rom[A+1] ^= 0xee; /* fix address of the second jump */ A = rom[A+1] + 256 * rom[A+2]; - decrypted[A] = rom[A]; /* fix third opcode (ld a,$xx) */ + m_decrypted_opcodes[A] = rom[A]; /* fix third opcode (ld a,$xx) */ A += 2; - decrypted[A] = rom[A]; /* fix fourth opcode (ld ($xxxx),a */ + m_decrypted_opcodes[A] = rom[A]; /* fix fourth opcode (ld ($xxxx),a */ /* and from here on, opcodes are encrypted */ m_counter = 0; diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c index 51613cf3235..6f12067e4f9 100644 --- a/src/mame/drivers/ladybug.c +++ b/src/mame/drivers/ladybug.c @@ -142,6 +142,10 @@ static ADDRESS_MAP_START( ladybug_map, AS_PROGRAM, 8, ladybug_state ) AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN2") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, ladybug_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sraider_cpu1_map, AS_PROGRAM, 8, ladybug_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM @@ -786,6 +790,10 @@ static MACHINE_CONFIG_START( ladybug, ladybug_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( dorodon, ladybug ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END static MACHINE_CONFIG_START( sraider, ladybug_state ) @@ -1043,15 +1051,11 @@ DRIVER_INIT_MEMBER(ladybug_state,dorodon) /* decode the opcodes */ offs_t i; - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000); UINT8 *rom = memregion("maincpu")->base(); UINT8 *table = memregion("user1")->base(); - space.set_decrypted_region(0x0000, 0x5fff, decrypted); - for (i = 0; i < 0x6000; i++) - decrypted[i] = table[rom[i]]; + m_decrypted_opcodes[i] = table[rom[i]]; } @@ -1059,7 +1063,7 @@ GAME( 1981, cavenger, 0, ladybug, cavenger, driver_device, 0, ROT0, GAME( 1981, ladybug, 0, ladybug, ladybug, driver_device, 0, ROT270, "Universal", "Lady Bug", GAME_SUPPORTS_SAVE ) GAME( 1981, ladybugb, ladybug, ladybug, ladybug, driver_device, 0, ROT270, "bootleg", "Lady Bug (bootleg set 1)", GAME_SUPPORTS_SAVE ) GAME( 1981, ladybgb2, ladybug, ladybug, ladybug, driver_device, 0, ROT270, "bootleg", "Lady Bug (bootleg set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1982, dorodon, 0, ladybug, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 1)", GAME_SUPPORTS_SAVE ) // license or bootleg? -GAME( 1982, dorodon2, dorodon, ladybug, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 2)", GAME_SUPPORTS_SAVE ) // " +GAME( 1982, dorodon, 0, dorodon, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 1)", GAME_SUPPORTS_SAVE ) // license or bootleg? +GAME( 1982, dorodon2, dorodon, dorodon, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 2)", GAME_SUPPORTS_SAVE ) // " GAME( 1982, snapjack, 0, ladybug, snapjack, driver_device, 0, ROT0, "Universal", "Snap Jack", GAME_SUPPORTS_SAVE ) GAME( 1982, sraider, 0, sraider, sraider, driver_device, 0, ROT270, "Universal", "Space Raider", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 182adf5e154..42a67e605df 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -263,6 +263,10 @@ static ADDRESS_MAP_START( liberate_map, AS_PROGRAM, 8, liberate_state ) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, liberate_state ) + AM_RANGE(0x8000, 0xffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( prosoccr_map, AS_PROGRAM, 8, liberate_state ) AM_RANGE(0x0000, 0x0fff) AM_RAM AM_RANGE(0x1000, 0x3fff) AM_ROM /* Mirror of main rom */ @@ -373,54 +377,43 @@ static INPUT_PORTS_START( generic_input ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW1:3,4") PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "DSW1:5") + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "DSW1:6") + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("DSW1:7") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x80, 0x00, "Manufacturer" ) + PORT_DIPNAME( 0x80, 0x00, "Manufacturer" ) PORT_DIPLOCATION("DSW1:8") PORT_DIPSETTING( 0x00, "Data East USA" ) PORT_DIPSETTING( 0x80, "Data East Corporation" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:1,2") + PORT_DIPSETTING( 0x01, "5" ) + PORT_DIPSETTING( 0x02, "4" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x00, DEF_STR( Infinite ) ) + PORT_DIPNAME( 0x0c, 0x0c, "Bonus" ) PORT_DIPLOCATION("DSW2:3,4") + PORT_DIPSETTING( 0x00, "20000 only" ) + PORT_DIPSETTING( 0x0c, "20000, every 40000 after" ) + PORT_DIPSETTING( 0x08, "30000, every 50000 after" ) + PORT_DIPSETTING( 0x04, "50000, every 70000 after" ) + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:5,6") + PORT_DIPSETTING( 0x30, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "DSW2:7") + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "DSW2:8") PORT_START("TILT") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_TILT ) @@ -437,25 +430,10 @@ static INPUT_PORTS_START( boomrang ) PORT_INCLUDE( generic_input ) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x01, "4" ) - PORT_DIPSETTING( 0x02, "5" ) - PORT_DIPSETTING( 0x00, DEF_STR( Infinite ) ) - PORT_DIPNAME( 0x0c, 0x0c, "Bonus" ) - PORT_DIPSETTING( 0x00, "20K Only" ) - PORT_DIPSETTING( 0x0c, "20K & Every 30K" ) - PORT_DIPSETTING( 0x08, "30K & Every 50K" ) - PORT_DIPSETTING( 0x04, "50K & Every 70K" ) - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x30, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Invincibility" ) /* Manual calls it "Hit Check Of Boomer" */ + PORT_DIPNAME( 0x80, 0x80, "Invincibility" ) PORT_DIPLOCATION("DSW2:8") /* Manual calls it "Hit Check Of Boomer" */ PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -464,22 +442,17 @@ static INPUT_PORTS_START( kamikcab ) PORT_INCLUDE( generic_input ) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:1,2") + PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x00, DEF_STR( Infinite ) ) - PORT_DIPNAME( 0x0c, 0x0c, "Bonus" ) - PORT_DIPSETTING( 0x00, "20000" ) - PORT_DIPSETTING( 0x0c, "20000 Every 30000" ) - PORT_DIPSETTING( 0x08, "30000 Every 40000" ) - PORT_DIPSETTING( 0x04, "40000 Every 50000" ) - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x30, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x80, 0x80, "Invincibility (Cheat)" ) + PORT_DIPNAME( 0x0c, 0x0c, "Bonus" ) PORT_DIPLOCATION("DSW2:3,4") + PORT_DIPSETTING( 0x00, "20000 only" ) + PORT_DIPSETTING( 0x0c, "20000, every 30000 after" ) + PORT_DIPSETTING( 0x08, "30000, every 40000 after" ) + PORT_DIPSETTING( 0x04, "40000, every 50000 after" ) + PORT_DIPNAME( 0x80, 0x80, "Invincibility (Cheat)" ) PORT_DIPLOCATION("DSW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -500,67 +473,35 @@ static INPUT_PORTS_START( liberate ) PORT_MODIFY("DSW1") PORT_DIPNAME( 0x80, 0x80, "Manufacturer" ) - PORT_DIPSETTING( 0x00, "(INVALID) Data East USA (Dual Assault)" ) + PORT_DIPSETTING( 0x00, "(INVALID) Data East USA (Dual Assault)" ) PORT_DIPLOCATION("DSW1:8") PORT_DIPSETTING( 0x80, "Data East Corporation (Liberation)" ) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x01, "4" ) - PORT_DIPSETTING( 0x02, "5" ) - PORT_DIPSETTING( 0x00, DEF_STR( Infinite ) ) - PORT_DIPNAME( 0x0c, 0x0c, "Bonus" ) - PORT_DIPSETTING( 0x00, "20000" ) - PORT_DIPSETTING( 0x0c, "20000 30000" ) - PORT_DIPSETTING( 0x08, "30000 50000" ) - PORT_DIPSETTING( 0x04, "50000 70000" ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) /* Difficulty? */ - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) /* Difficulty? */ - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "DSW2:7") + PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "DSW2:8") INPUT_PORTS_END static INPUT_PORTS_START( prosport ) PORT_INCLUDE( generic_input ) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Service" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "DSW1:3") + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "DSW1:4") + PORT_DIPNAME( 0x10, 0x10, "Service" ) PORT_DIPLOCATION("DSW1:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Test Mode" ) + PORT_DIPNAME( 0x20, 0x20, "Test Mode" ) PORT_DIPLOCATION("DSW1:6") PORT_DIPSETTING( 0x00, "ROM Test" ) PORT_DIPSETTING( 0x20, "Maping Test" ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "DSW1:8") PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "DSW2:1") + PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "DSW2:2") + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "DSW2:3") + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "DSW2:4") + PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "DSW2:5") + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "DSW2:6") INPUT_PORTS_END static INPUT_PORTS_START( dualaslt ) @@ -581,9 +522,7 @@ static INPUT_PORTS_START( liberatb ) PORT_BIT( 0xf9, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "DSW1:8") PORT_MODIFY("TILT") PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -593,54 +532,25 @@ static INPUT_PORTS_START( prosoccr ) PORT_INCLUDE( generic_input ) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) ) //maybe reversed coins actually? - PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "DSW1:7") + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "DSW1:8") + + PORT_MODIFY("DSW2") // Imported from decocass version "cpsoccer" + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:1") /* Listed as "Number of Balls" */ + PORT_DIPSETTING( 0x01, "3" ) + PORT_DIPSETTING( 0x00, "5" ) + PORT_DIPNAME( 0x06, 0x06, "Number of Nice Goal" ) PORT_DIPLOCATION("DSW2:2,3") + PORT_DIPSETTING( 0x00, DEF_STR( None ) ) + PORT_DIPSETTING( 0x06, "5" ) + PORT_DIPSETTING( 0x04, "10" ) + PORT_DIPSETTING( 0x02, "20" ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:4") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:5") /* Listed as "Class" */ + PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "DSW2:6") INPUT_PORTS_END /************************************* @@ -813,7 +723,7 @@ MACHINE_RESET_MEMBER(liberate_state,liberate) m_bank = 0; } -static MACHINE_CONFIG_START( liberate, liberate_state ) +static MACHINE_CONFIG_START( liberate_base, liberate_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu",DECO16, 2000000) @@ -855,7 +765,12 @@ static MACHINE_CONFIG_START( liberate, liberate_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( liberatb, liberate ) +static MACHINE_CONFIG_DERIVED( liberate, liberate_base ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( liberatb, liberate_base ) /* basic machine hardware */ MCFG_CPU_REPLACE("maincpu", M6502, 2000000) @@ -863,14 +778,14 @@ static MACHINE_CONFIG_DERIVED( liberatb, liberate ) MCFG_CPU_VBLANK_INT_DRIVER("screen", liberate_state, deco16_interrupt) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( boomrang, liberate ) +static MACHINE_CONFIG_DERIVED( boomrang, liberate_base ) MCFG_VIDEO_START_OVERRIDE(liberate_state,boomrang) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(liberate_state, screen_update_boomrang) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( prosoccr, liberate ) +static MACHINE_CONFIG_DERIVED( prosoccr, liberate_base ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -1362,21 +1277,14 @@ DRIVER_INIT_MEMBER(liberate_state,yellowcb) DRIVER_INIT_MEMBER(liberate_state,liberate) { - int A; - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000); UINT8 *ROM = memregion("maincpu")->base(); - space.set_decrypted_region(0x0000, 0xffff, decrypted); - /* Swap bits for opcodes only, not data */ - for (A = 0; A < 0x10000; A++) { - decrypted[A] = (ROM[A] & 0xd7) | ((ROM[A] & 0x08) << 2) | ((ROM[A] & 0x20) >> 2); - decrypted[A] = (decrypted[A] & 0xbb) | ((decrypted[A] & 0x04) << 4) | ((decrypted[A] & 0x40) >> 4); - decrypted[A] = (decrypted[A] & 0x7d) | ((decrypted[A] & 0x02) << 6) | ((decrypted[A] & 0x80) >> 6); + for (int A = 0; A < 0x8000; A++) { + m_decrypted_opcodes[A] = (ROM[A+0x8000] & 0xd7) | ((ROM[A+0x8000] & 0x08) << 2) | ((ROM[A+0x8000] & 0x20) >> 2); + m_decrypted_opcodes[A] = (m_decrypted_opcodes[A] & 0xbb) | ((m_decrypted_opcodes[A] & 0x04) << 4) | ((m_decrypted_opcodes[A] & 0x40) >> 4); + m_decrypted_opcodes[A] = (m_decrypted_opcodes[A] & 0x7d) | ((m_decrypted_opcodes[A] & 0x02) << 6) | ((m_decrypted_opcodes[A] & 0x80) >> 6); } - - membank("bank1")->configure_decrypted_entry(0, decrypted + 0x8000); } /************************************* diff --git a/src/mame/drivers/lindbergh.c b/src/mame/drivers/lindbergh.c index b9a8f6855e9..9d14f057a39 100644 --- a/src/mame/drivers/lindbergh.c +++ b/src/mame/drivers/lindbergh.c @@ -573,7 +573,7 @@ GAME(2005, hotd4, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "H GAME(2005, vf5, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Virtua Fighter 5 (Export)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) GAME(2006, abclimax, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "After Burner Climax (Export)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) GAME(2006, letsgoju, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Let's Go Jungle (Export)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) -GAME(2006, outr2sdx, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Outrun 2 SP SDX", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) +GAME(2006, outr2sdx, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "OutRun 2 SP SDX", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) GAME(2006, psmash3, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Power Smash 3 / Virtua Tennis 3 (Export)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) GAME(2006, vtennis3, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Virtua Tennis 3 (Japan)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) GAME(2007, 2spicy, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "2 Spicy", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION|GAME_NO_SOUND) diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index cf5397ac5c9..bc1bd16490b 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -920,6 +920,34 @@ ROM_START( dsoccr94 ) ROM_LOAD( "ds_da0.ic24", 0x000000, 0x100000, CRC(67fc52fd) SHA1(5771e948115af8fe4a6d3f448c03a2a9b42b6f20) ) ROM_END +ROM_START( dsoccr94k ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "ic59_h0.bin", 0x000001, 0x040000, CRC(7b26d8a3) SHA1(03b4a5f0c7bd72bee24065feb22b837b373d936c) ) + ROM_LOAD16_BYTE( "ic61_l0.bin", 0x000000, 0x040000, CRC(b13f0ff4) SHA1(01d4241019abb16364090b2d00b93864d228ab98) ) + ROM_LOAD16_BYTE( "ic60_h1.bin", 0x080001, 0x040000, CRC(6109041b) SHA1(063898a88f8a6a9f1510aa55e53a39f037b02903) ) + ROM_LOAD16_BYTE( "ic62_l1.bin", 0x080000, 0x040000, CRC(97a01f6b) SHA1(e188e28f880f5f3f4d7b49eca639d643989b1468) ) + + ROM_REGION( 0x20000, "soundcpu", 0 ) + ROM_LOAD16_BYTE( "a3-sh0-c-0.ic31", 0x00001, 0x10000, CRC(23fe6ffc) SHA1(896377961cafc19e44d9d889f9fbfdbaedd556da) ) + ROM_LOAD16_BYTE( "a3-sl0-c-0.ic37", 0x00000, 0x10000, CRC(768132e5) SHA1(1bb64516eb58d3b246f08e1c07f091e78085689f) ) + + ROM_REGION( 0x400000, "gfx1", 0 ) /* chars */ + ROM_LOAD16_BYTE( "ds_c00.ic29", 0x000000, 0x100000, CRC(2d31d418) SHA1(6cd0e362bc2e3f2b20d96ee97a04bff46ee3016a) ) /* MASK ROMs with no "official" rom label */ + ROM_LOAD16_BYTE( "ds_c10.ic28", 0x000001, 0x100000, CRC(57f7bcd3) SHA1(a38e7cdfdea72d882fba414cae391ba09443e73c) ) + ROM_LOAD16_BYTE( "ds_c01.ic21", 0x200000, 0x100000, CRC(9d31a464) SHA1(1e38ac296f64d77fabfc0d5f7921a9b7a8424875) ) + ROM_LOAD16_BYTE( "ds_c11.ic20", 0x200001, 0x100000, CRC(a372e79f) SHA1(6b0889cfc2970028832566e25257927ddc461ea6) ) + + ROM_REGION( 0x400000, "gfx2", 0 ) /* sprites */ + ROM_LOAD( "ds_000.ic11", 0x000000, 0x100000, CRC(366b3e29) SHA1(cb016dcbdc6e8ea56c28c00135263666b07df991) ) /* MASK ROMs with no "official" rom label */ + ROM_LOAD( "ds_010.ic12", 0x100000, 0x100000, CRC(28a4cc40) SHA1(7f4e1ef995eaadf1945ee22ab3270cb8a21c601d) ) + ROM_LOAD( "ds_020.ic13", 0x200000, 0x100000, CRC(5a310f7f) SHA1(21969e4247c8328d27118d00604096deaf6700af) ) + ROM_LOAD( "ds_030.ic14", 0x300000, 0x100000, CRC(328b1f45) SHA1(4cbbd4d9be4fc151d426175bdbd35d8481bf2966) ) + + ROM_REGION( 0x100000, "irem", 0 ) /* ADPCM samples */ + ROM_LOAD( "ds_da0.ic24", 0x000000, 0x100000, CRC(67fc52fd) SHA1(5771e948115af8fe4a6d3f448c03a2a9b42b6f20) ) +ROM_END + + ROM_START( wpksoc ) ROM_REGION( 0x100000, "maincpu", 0 ) ROM_LOAD16_BYTE( "pk-h0-eur-d.h0", 0x000001, 0x040000, CRC(b4917788) SHA1(673294c518eaf28354fa6a3058f9325c6d9ddde6) ) @@ -1016,6 +1044,7 @@ GAME( 1993, airass, 0, airass, firebarr, m107_state, fireba GAME( 1993, firebarr, airass, firebarr, firebarr, m107_state, firebarr, ROT270, "Irem", "Fire Barrel (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1994, dsoccr94, 0, dsoccr94, dsoccr94, m107_state, dsoccr94, ROT0, "Irem (Data East Corporation license)", "Dream Soccer '94 (World, M107 hardware)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1994, dsoccr94k, dsoccr94, dsoccr94, dsoccr94, m107_state, dsoccr94, ROT0, "Irem (Data East Corporation license)", "Dream Soccer '94 (Korea, M107 hardware)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // default team selected is Korea, so likely a Korean set GAME( 1995, wpksoc, 0, wpksoc, wpksoc, m107_state, wpksoc, ROT0, "Jaleco", "World PK Soccer", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_MECHANICAL | GAME_SUPPORTS_SAVE ) GAME( 1994, kftgoal, wpksoc, wpksoc, wpksoc, m107_state, wpksoc, ROT0, "Jaleco", "Kick for the Goal", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_MECHANICAL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c index 00c5fbfbc44..e94b189791d 100644 --- a/src/mame/drivers/m62.c +++ b/src/mame/drivers/m62.c @@ -71,7 +71,6 @@ other supported games as well. #include "emu.h" #include "cpu/z80/z80.h" -#include "audio/irem.h" #include "includes/iremipt.h" #include "includes/m62.h" @@ -2182,7 +2181,7 @@ GAME( 1984, kungfumd, kungfum, kungfum, kungfum, driver_device, 0, ROT GAME( 1984, spartanx, kungfum, kungfum, kungfum, driver_device, 0, ROT0, "Irem", "Spartan X (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1984, kungfub, kungfum, kungfum, kungfum, driver_device, 0, ROT0, "bootleg", "Kung-Fu Master (bootleg set 1)", GAME_SUPPORTS_SAVE ) GAME( 1984, kungfub2, kungfum, kungfum, kungfum, driver_device, 0, ROT0, "bootleg", "Kung-Fu Master (bootleg set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1984, battroad, 0, battroad, battroad, m62_state, battroad, ROT90, "Irem", "The Battle-Road", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE ) +GAME( 1984, battroad, 0, battroad, battroad, m62_state, battroad, ROT90, "Irem", "The Battle-Road", GAME_SUPPORTS_SAVE ) GAME( 1984, ldrun, 0, ldrun, ldrun, driver_device, 0, ROT0, "Irem (licensed from Broderbund)", "Lode Runner (set 1)", GAME_SUPPORTS_SAVE ) GAME( 1984, ldruna, ldrun, ldrun, ldrun, driver_device, 0, ROT0, "Irem (licensed from Broderbund, Digital Controls Inc. license)", "Lode Runner (set 2)", GAME_SUPPORTS_SAVE ) GAME( 1984, ldrun2, 0, ldrun2, ldrun2, m62_state, ldrun2, ROT0, "Irem (licensed from Broderbund)", "Lode Runner II - The Bungeling Strikes Back", GAME_SUPPORTS_SAVE ) /* Japanese version is called Bangeringu Teikoku No Gyakushuu */ diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 3463556bd2d..0b183331047 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -3275,76 +3275,69 @@ f0012->84204 f0014->8420c f0016->8400c ROM_START( rodland ) ROM_REGION( 0x60000, "maincpu", 0 ) /* Main CPU Code */ - ROM_LOAD16_BYTE( "rl_02.rom", 0x000000, 0x020000, CRC(c7e00593) SHA1(055b7bcabf90ed6d5edc2797d0f85a5d49b8693b) ) - ROM_LOAD16_BYTE( "rl_01.rom", 0x000001, 0x020000, CRC(2e748ca1) SHA1(285414af11aad36f3bd7020365ff90eb696d2de3) ) - ROM_LOAD16_BYTE( "rl_03.rom", 0x040000, 0x010000, CRC(62fdf6d7) SHA1(ffde7e7f5b3b548bc980b9dee767f693046ecab2) ) - ROM_LOAD16_BYTE( "rl_04.rom", 0x040001, 0x010000, CRC(44163c86) SHA1(1c56d79531af0312e7cd3dc66cf61b55dd1a6e51) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_2.ROM2", 0x000000, 0x020000, CRC(c7e00593) SHA1(055b7bcabf90ed6d5edc2797d0f85a5d49b8693b) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_1.ROM1", 0x000001, 0x020000, CRC(2e748ca1) SHA1(285414af11aad36f3bd7020365ff90eb696d2de3) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_3.ROM3", 0x040000, 0x010000, CRC(62fdf6d7) SHA1(ffde7e7f5b3b548bc980b9dee767f693046ecab2) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_4.ROM4", 0x040001, 0x010000, CRC(44163c86) SHA1(1c56d79531af0312e7cd3dc66cf61b55dd1a6e51) ) - ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU Code */ - ROM_LOAD16_BYTE( "rl_05.rom", 0x000000, 0x010000, CRC(c1617c28) SHA1(1b3440055c083b74270fe06b5f42e7d1337efeca) ) - ROM_LOAD16_BYTE( "rl_06.rom", 0x000001, 0x010000, CRC(663392b2) SHA1(99052639e934d1ca18888c9c7fa061c1d3508fd4) ) + ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU Code */ + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_5.ROM5", 0x000000, 0x010000, CRC(c1617c28) SHA1(1b3440055c083b74270fe06b5f42e7d1337efeca) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_6.ROM6", 0x000001, 0x010000, CRC(663392b2) SHA1(99052639e934d1ca18888c9c7fa061c1d3508fd4) ) ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ - ROM_LOAD( "rl_23.rom", 0x000000, 0x020000, CRC(ac60e771) SHA1(97c2ac1ed89c171a0db98befa6c3c10754d64880) ) - ROM_CONTINUE( 0x030000, 0x010000 ) - ROM_CONTINUE( 0x050000, 0x010000 ) - ROM_CONTINUE( 0x020000, 0x010000 ) - ROM_CONTINUE( 0x040000, 0x010000 ) - ROM_CONTINUE( 0x060000, 0x020000 ) + ROM_LOAD( "LH534H31.ROM14", 0x000000, 0x080000, CRC(8201e1bb) SHA1(3304100dcab7b67cee021869a50f4295c8635814) ) ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ - ROM_LOAD( "rl_18.rom", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) + ROM_LOAD( "LH534H32.ROM18", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ - ROM_LOAD( "rl_19.bin", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) + ROM_LOAD( "LH2311J0.ROM19", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ - ROM_LOAD( "rl_14.rom", 0x000000, 0x080000, CRC(08d01bf4) SHA1(b9333d11572f46992cdd668908fbc1c33d841f8d) ) + ROM_LOAD( "LH534H33.ROM23", 0x000000, 0x080000, CRC(936db174) SHA1(4dfb2c31bc4bbf659184fe18e320d19f326b3ec5) ) ROM_REGION( 0x040000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "rl_10.rom", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) + ROM_LOAD( "LH5321T5.ROM10", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ - ROM_LOAD( "rl_08.rom", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) + ROM_LOAD( "S202000DR.ROM8", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ - ROM_LOAD( "rl.bin", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) + ROM_LOAD( "PS89013A.M14", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) ROM_END ROM_START( rodlandj ) ROM_REGION( 0x60000, "maincpu", 0 ) /* Main CPU Code */ - ROM_LOAD16_BYTE( "rl_2.bin", 0x000000, 0x020000, CRC(b1d2047e) SHA1(75d282b7614c5f4b76ab44e34fea9e87ab8b992c) ) - ROM_LOAD16_BYTE( "rl_1.bin", 0x000001, 0x020000, CRC(3c47c2a3) SHA1(62e66a2f53aeacf92551ba64ae4ce14c2e982bb0) ) - ROM_LOAD16_BYTE( "rl_3.bin", 0x040000, 0x010000, CRC(c5b1075f) SHA1(a8bcc0e9dbb4b731bc0b7e5a8e0efc3d142505b9) ) - ROM_LOAD16_BYTE( "rl_4.bin", 0x040001, 0x010000, CRC(9ec61048) SHA1(71b6af054a528af04e23affff635a9358537cd3b) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_2.ROM2", 0x000000, 0x020000, CRC(b1d2047e) SHA1(75d282b7614c5f4b76ab44e34fea9e87ab8b992c) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_1.ROM1", 0x000001, 0x020000, CRC(3c47c2a3) SHA1(62e66a2f53aeacf92551ba64ae4ce14c2e982bb0) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_3.ROM3", 0x040000, 0x010000, CRC(c5b1075f) SHA1(a8bcc0e9dbb4b731bc0b7e5a8e0efc3d142505b9) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_4.ROM4", 0x040001, 0x010000, CRC(9ec61048) SHA1(71b6af054a528af04e23affff635a9358537cd3b) ) ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU Code */ - ROM_LOAD16_BYTE( "rl_05.rom", 0x000000, 0x010000, CRC(c1617c28) SHA1(1b3440055c083b74270fe06b5f42e7d1337efeca) ) - ROM_LOAD16_BYTE( "rl_06.rom", 0x000001, 0x010000, CRC(663392b2) SHA1(99052639e934d1ca18888c9c7fa061c1d3508fd4) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_5.ROM5", 0x000000, 0x010000, CRC(c1617c28) SHA1(1b3440055c083b74270fe06b5f42e7d1337efeca) ) + ROM_LOAD16_BYTE( "JALECO_ROD_LAND_6.ROM6", 0x000001, 0x010000, CRC(663392b2) SHA1(99052639e934d1ca18888c9c7fa061c1d3508fd4) ) ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ - /* address and data lines are mangled, but otherwise identical to rl_23.rom */ - ROM_LOAD( "rl_14.bin", 0x000000, 0x080000, CRC(8201e1bb) SHA1(3304100dcab7b67cee021869a50f4295c8635814) ) + ROM_LOAD( "LH534H31.ROM14", 0x000000, 0x080000, CRC(8201e1bb) SHA1(3304100dcab7b67cee021869a50f4295c8635814) ) ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ - ROM_LOAD( "rl_18.rom", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) + ROM_LOAD( "LH534H32.ROM18", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ - ROM_LOAD( "rl_19.bin", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) + ROM_LOAD( "LH2311J0.ROM19", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) - ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ - /* was a bad dump (first and second half identical), reconstructed from rl_14.rom */ - ROM_LOAD( "rl_23.bin", 0x000000, 0x080000, CRC(936db174) SHA1(4dfb2c31bc4bbf659184fe18e320d19f326b3ec5) ) + ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ + ROM_LOAD( "LH534H33.ROM23", 0x000000, 0x080000, CRC(936db174) SHA1(4dfb2c31bc4bbf659184fe18e320d19f326b3ec5) ) ROM_REGION( 0x040000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "rl_10.rom", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) + ROM_LOAD( "LH5321T5.ROM10", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ - ROM_LOAD( "rl_08.rom", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) + ROM_LOAD( "S202000DR.ROM8", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ - ROM_LOAD( "rl.bin", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) + ROM_LOAD( "PS89013A.M14", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) ROM_END /* 100% identical to rodlandj, but not encrypted */ @@ -3361,31 +3354,26 @@ ROM_START( rodlandjb ) ROM_LOAD16_BYTE( "rl02.bin", 0x000000, 0x010000, CRC(d26eae8f) SHA1(1c6d514e6d006f78fa7b24d18a3eb4c5a4c5cbce) ) ROM_LOAD16_BYTE( "rl01.bin", 0x000001, 0x010000, CRC(04cf24bc) SHA1(e754cce3c83a7088daf90e753fbb0df9ef7fc9be) ) - ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ - ROM_LOAD( "rl_23.rom", 0x000000, 0x020000, CRC(ac60e771) SHA1(97c2ac1ed89c171a0db98befa6c3c10754d64880) ) - ROM_CONTINUE( 0x030000, 0x010000 ) - ROM_CONTINUE( 0x050000, 0x010000 ) - ROM_CONTINUE( 0x020000, 0x010000 ) - ROM_CONTINUE( 0x040000, 0x010000 ) - ROM_CONTINUE( 0x060000, 0x020000 ) + ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ + ROM_LOAD( "LH534H31.ROM14", 0x000000, 0x080000, CRC(8201e1bb) SHA1(3304100dcab7b67cee021869a50f4295c8635814) ) - ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ - ROM_LOAD( "rl_18.rom", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) + ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ + ROM_LOAD( "LH534H32.ROM18", 0x000000, 0x080000, CRC(f3b30ca6) SHA1(f2f88c24a009b6695f7548aebd37b25d1fd19892) ) - ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ - ROM_LOAD( "rl_19.bin", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) + ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ + ROM_LOAD( "LH2311J0.ROM19", 0x000000, 0x020000, CRC(124d7e8f) SHA1(d7885a10085cc3389bd0e26e9d54adb8929218c0) ) - ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ - ROM_LOAD( "rl_14.rom", 0x000000, 0x080000, CRC(08d01bf4) SHA1(b9333d11572f46992cdd668908fbc1c33d841f8d) ) + ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ + ROM_LOAD( "LH534H33.ROM23", 0x000000, 0x080000, CRC(936db174) SHA1(4dfb2c31bc4bbf659184fe18e320d19f326b3ec5) ) - ROM_REGION( 0x040000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "rl_10.rom", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) + ROM_REGION( 0x040000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "LH5321T5.ROM10", 0x000000, 0x040000, CRC(e1d1cd99) SHA1(6604111d37455c1bd59c1469d9ee7841e7dec913) ) - ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ - ROM_LOAD( "rl_08.rom", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) + ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ + ROM_LOAD( "S202000DR.ROM8", 0x000000, 0x040000, CRC(8a49d3a7) SHA1(68cb8cf2753b39c253d0edaa8ef2c54fd1f6ebe5) ) ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ - ROM_LOAD( "rl.bin", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) + ROM_LOAD( "PS89013A.M14", 0x0000, 0x0200, CRC(8914e72d) SHA1(80a664471f14c8ed8544a5e226fdca425ab3c657) ) ROM_END @@ -3679,7 +3667,7 @@ ROM_START( tshingen ) ROM_END -void megasys1_state::rodlandj_gfx_unmangle(const char *region) +void megasys1_state::rodland_gfx_unmangle(const char *region) { UINT8 *rom = memregion(region)->base(); int size = memregion(region)->bytes(); @@ -4003,17 +3991,26 @@ DRIVER_INIT_MEMBER(megasys1_state,phantasm) DRIVER_INIT_MEMBER(megasys1_state,rodland) { + rodland_gfx_unmangle("gfx1"); + rodland_gfx_unmangle("gfx4"); + rodland_rom_decode(machine(), "maincpu"); } DRIVER_INIT_MEMBER(megasys1_state,rodlandj) { - rodlandj_gfx_unmangle("gfx1"); - rodlandj_gfx_unmangle("gfx4"); + rodland_gfx_unmangle("gfx1"); + rodland_gfx_unmangle("gfx4"); astyanax_rom_decode(machine(), "maincpu"); } +DRIVER_INIT_MEMBER(megasys1_state,rodlandjb) +{ + rodland_gfx_unmangle("gfx1"); + rodland_gfx_unmangle("gfx4"); +} + READ16_MEMBER(megasys1_state::soldamj_spriteram16_r) { return m_spriteram[offset]; @@ -4150,7 +4147,7 @@ GAME( 1989, stdragon, 0, system_A, stdragon, megasys1_state, std GAME( 1989, stdragona,stdragon, system_A, stdragon, megasys1_state, stdragona,ROT0, "Jaleco", "Saint Dragon (set 2)", 0 ) GAME( 1990, rodland, 0, system_A, rodland, megasys1_state, rodland, ROT0, "Jaleco", "Rod-Land (World)", 0 ) GAME( 1990, rodlandj, rodland, system_A, rodland, megasys1_state, rodlandj, ROT0, "Jaleco", "Rod-Land (Japan)", 0 ) -GAME( 1990, rodlandjb,rodland, system_A, rodland, driver_device, 0, ROT0, "bootleg","Rod-Land (Japan bootleg)", 0 ) +GAME( 1990, rodlandjb,rodland, system_A, rodland, megasys1_state, rodlandjb, ROT0, "bootleg","Rod-Land (Japan bootleg)", 0 ) GAME( 1991, avspirit, 0, system_B, avspirit, megasys1_state, avspirit, ROT0, "Jaleco", "Avenging Spirit", 0 ) GAME( 1990, phantasm, avspirit, system_A, phantasm, megasys1_state, phantasm, ROT0, "Jaleco", "Phantasm (Japan)", 0 ) GAME( 1990, monkelf, avspirit, system_B, avspirit, megasys1_state, monkelf, ROT0, "bootleg","Monky Elf (Korean bootleg of Avenging Spirit)", 0 ) diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 02a61342eca..ff7994cdc4d 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -791,7 +791,11 @@ MACHINE_CONFIG_END ROM_SYSTEM_BIOS( 1, "ver0a", "Ver 0 Rev A" ) \ ROMX_LOAD( "epr-12263a.20", 0x000000, 0x8000, CRC(07c3f423) SHA1(50c28bbc2d4349c820d988ae3f20aae3f808545f), ROM_BIOS(2)) \ ROM_SYSTEM_BIOS( 2, "ver0b", "Ver 0 Rev B" ) \ - ROMX_LOAD( "epr-12263b.20", 0x000000, 0x8000, CRC(ca26c87a) SHA1(987a18bede6e54cd73c4434426eb6c302a37cdc5), ROM_BIOS(3)) + ROMX_LOAD( "epr-12263b.20", 0x000000, 0x8000, CRC(ca26c87a) SHA1(987a18bede6e54cd73c4434426eb6c302a37cdc5), ROM_BIOS(3)) \ + ROM_SYSTEM_BIOS( 3, "ver0aa","Ver 0 Rev B (alt?)" ) \ + ROMX_LOAD( "epr-12604a.20", 0x000000, 0x8000, CRC(884e4aa5) SHA1(c9008c431a937c084fb475273093ca0b434b5f47), ROM_BIOS(4)) + + /* no games */ ROM_START( megatech ) MEGATECH_BIOS diff --git a/src/mame/drivers/megazone.c b/src/mame/drivers/megazone.c index 5a82b24de3a..e5bc1f41ff9 100644 --- a/src/mame/drivers/megazone.c +++ b/src/mame/drivers/megazone.c @@ -234,7 +234,7 @@ INTERRUPT_GEN_MEMBER(megazone_state::vblank_irq) static MACHINE_CONFIG_START( megazone, megazone_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 18432000/9) /* 2 MHz */ + MCFG_CPU_ADD("maincpu", KONAMI1, 18432000/9) /* 2 MHz */ MCFG_CPU_PROGRAM_MAP(megazone_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", megazone_state, vblank_irq) @@ -506,7 +506,6 @@ ROM_END DRIVER_INIT_MEMBER(megazone_state,megazone) { - konami1_decode(machine(), "maincpu"); } GAME( 1983, megazone, 0, megazone, megazone, megazone_state, megazone, ROT90, "Konami", "Mega Zone (Konami set 1)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index c1ce0a6e4e4..432166aa12c 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -121,6 +121,7 @@ WRITE8_MEMBER(mitchell_state::eeprom_serial_w) WRITE8_MEMBER(mitchell_state::pang_bankswitch_w) { membank("bank1")->set_entry(data & 0x0f); + membank("bank1d")->set_entry(data & 0x0f); } /************************************* @@ -277,7 +278,13 @@ static ADDRESS_MAP_START( mitchell_map, AS_PROGRAM, 8, mitchell_state ) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(pang_paletteram_r,pang_paletteram_w) /* Banked palette RAM */ AM_RANGE(0xc800, 0xcfff) AM_READWRITE(pang_colorram_r,pang_colorram_w) AM_SHARE("colorram") /* Attribute RAM */ AM_RANGE(0xd000, 0xdfff) AM_READWRITE(pang_videoram_r,pang_videoram_w) AM_SHARE("videoram")/* Banked char / OBJ RAM */ - AM_RANGE(0xe000, 0xffff) AM_RAM /* Work RAM */ + AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("ram") /* Work RAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, mitchell_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") + AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("ram") /* Work RAM */ ADDRESS_MAP_END static ADDRESS_MAP_START( mitchell_io_map, AS_IO, 8, mitchell_state ) @@ -1115,6 +1122,7 @@ static MACHINE_CONFIG_START( pang, mitchell_state ) MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(mitchell_map) MCFG_CPU_IO_MAP(mitchell_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mitchell_state, mitchell_irq, "screen", 0, 1) MCFG_MACHINE_START_OVERRIDE(mitchell_state,mitchell) @@ -1187,6 +1195,7 @@ static MACHINE_CONFIG_DERIVED( spangbl, pangnv ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(spangbl_map) MCFG_CPU_IO_MAP(spangbl_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", mitchell_state, irq0_line_hold) MCFG_DEVICE_REMOVE("scantimer") @@ -1215,6 +1224,7 @@ static MACHINE_CONFIG_START( mstworld, mitchell_state ) MCFG_CPU_ADD("maincpu", Z80, 6000000*4) MCFG_CPU_PROGRAM_MAP(mitchell_map) MCFG_CPU_IO_MAP(mstworld_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", mitchell_state, irq0_line_hold) MCFG_CPU_ADD("audiocpu", Z80,6000000) /* 6 MHz? */ @@ -1253,6 +1263,7 @@ static MACHINE_CONFIG_START( marukin, mitchell_state ) MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(mitchell_map) MCFG_CPU_IO_MAP(mitchell_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mitchell_state, mitchell_irq, "screen", 0, 1) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -1307,6 +1318,7 @@ static MACHINE_CONFIG_START( pkladiesbl, mitchell_state ) MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(mitchell_map) MCFG_CPU_IO_MAP(mitchell_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mitchell_state, mitchell_irq, "screen", 0, 1) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2085,58 +2097,58 @@ ROM_END * *************************************/ -void mitchell_state::bootleg_decode( ) +void mitchell_state::bootleg_decode() { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x50000); - membank("bank1")->configure_decrypted_entries(0, 16, memregion("maincpu")->base() + 0x60000, 0x4000); + membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + membank("bank0d")->set_base(memregion("maincpu")->base() + 0x50000); + membank("bank1d")->configure_entries(0, 16, memregion("maincpu")->base() + 0x60000, 0x4000); } -void mitchell_state::configure_banks( ) +void mitchell_state::configure_banks(void (*decode)(UINT8 *src, UINT8 *dst, int size)) { - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + UINT8 *src = memregion("maincpu")->base(); + int size = memregion("maincpu")->bytes(); + UINT8 *dst = auto_alloc_array(machine(), UINT8, size); + decode(src, dst, size); + membank("bank1")->configure_entries(0, 16, src + 0x10000, 0x4000); + membank("bank0d")->set_base(dst); + membank("bank1d")->configure_entries(0, 16, dst + 0x10000, 0x4000); } DRIVER_INIT_MEMBER(mitchell_state,dokaben) { m_input_type = 0; - mgakuen2_decode(machine()); - configure_banks(); + configure_banks(mgakuen2_decode); } DRIVER_INIT_MEMBER(mitchell_state,pang) { m_input_type = 0; - pang_decode(machine()); - configure_banks(); + configure_banks(pang_decode); } DRIVER_INIT_MEMBER(mitchell_state,pangb) { m_input_type = 0; bootleg_decode(); - configure_banks(); if (m_nvram != NULL) m_nvram->set_base(&m_dummy_nvram, sizeof(m_dummy_nvram)); /* for pangba */ } DRIVER_INIT_MEMBER(mitchell_state,cworld) { m_input_type = 0; - cworld_decode(machine()); - configure_banks(); + configure_banks(cworld_decode); } DRIVER_INIT_MEMBER(mitchell_state,hatena) { m_input_type = 0; - hatena_decode(machine()); - configure_banks(); + configure_banks(hatena_decode); } DRIVER_INIT_MEMBER(mitchell_state,spang) { m_input_type = 3; m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ - spang_decode(machine()); - configure_banks(); + configure_banks(spang_decode); } DRIVER_INIT_MEMBER(mitchell_state,spangbl) @@ -2144,79 +2156,69 @@ DRIVER_INIT_MEMBER(mitchell_state,spangbl) m_input_type = 3; m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ bootleg_decode(); - configure_banks(); } DRIVER_INIT_MEMBER(mitchell_state,spangj) { m_input_type = 3; m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ - spangj_decode(machine()); - configure_banks(); + configure_banks(spangj_decode); } DRIVER_INIT_MEMBER(mitchell_state,sbbros) { m_input_type = 3; m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ - sbbros_decode(machine()); - configure_banks(); + configure_banks(sbbros_decode); } DRIVER_INIT_MEMBER(mitchell_state,qtono1) { m_input_type = 0; - qtono1_decode(machine()); - configure_banks(); + configure_banks(qtono1_decode); } DRIVER_INIT_MEMBER(mitchell_state,qsangoku) { m_input_type = 0; - qsangoku_decode(machine()); - configure_banks(); + configure_banks(qsangoku_decode); } + DRIVER_INIT_MEMBER(mitchell_state,mgakuen) { m_input_type = 1; - configure_banks(); + membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); m_maincpu->space(AS_IO).install_read_port(0x03, 0x03, "DSW0"); m_maincpu->space(AS_IO).install_read_port(0x04, 0x04, "DSW1"); } DRIVER_INIT_MEMBER(mitchell_state,mgakuen2) { m_input_type = 1; - mgakuen2_decode(machine()); - configure_banks(); + configure_banks(mgakuen2_decode); } DRIVER_INIT_MEMBER(mitchell_state,pkladies) { m_input_type = 1; - mgakuen2_decode(machine()); - configure_banks(); + configure_banks(mgakuen2_decode); } DRIVER_INIT_MEMBER(mitchell_state,pkladiesbl) { m_input_type = 1; bootleg_decode(); - configure_banks(); } DRIVER_INIT_MEMBER(mitchell_state,marukin) { m_input_type = 1; - marukin_decode(machine()); - configure_banks(); + configure_banks(marukin_decode); } DRIVER_INIT_MEMBER(mitchell_state,block) { m_input_type = 2; m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */ - block_decode(machine()); - configure_banks(); + configure_banks(block_decode); } DRIVER_INIT_MEMBER(mitchell_state,blockbl) { m_input_type = 2; m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */ bootleg_decode(); - configure_banks(); } DRIVER_INIT_MEMBER(mitchell_state,mstworld) @@ -2262,7 +2264,6 @@ DRIVER_INIT_MEMBER(mitchell_state,mstworld) } bootleg_decode(); - configure_banks(); } diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index 933abf5e37e..8b34dbb22ce 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -742,9 +742,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(model1_state::model1_interrupt) irq_raise(m_sound_irq); m_m1audio->check_fifo_irq(); - + if (m_m1comm != NULL) - m_m1comm->check_vint_irq(); + m_m1comm->check_vint_irq(); } } @@ -960,7 +960,7 @@ static ADDRESS_MAP_START( model1_vr_mem, AS_PROGRAM, 16, model1_state ) AM_RANGE(0xb00000, 0xb00fff) AM_DEVREADWRITE8("m1comm", m1comm_device, share_r, share_w, 0xffff) AM_RANGE(0xb01000, 0xb01001) AM_DEVREADWRITE8("m1comm", m1comm_device, cn_r, cn_w, 0x00ff) AM_RANGE(0xb01002, 0xb01003) AM_DEVREADWRITE8("m1comm", m1comm_device, fg_r, fg_w, 0x00ff) - + AM_RANGE(0xc00000, 0xc0003f) AM_READWRITE(io_r, io_w) AM_RANGE(0xc00040, 0xc00043) AM_READWRITE(network_ctl_r, network_ctl_w) @@ -1599,7 +1599,7 @@ static MACHINE_CONFIG_START( model1_vr, model1_state ) MCFG_VIDEO_START_OVERRIDE(model1_state,model1) MCFG_SEGAM1AUDIO_ADD("m1audio") - + MCFG_M1COMM_ADD("m1comm") MACHINE_CONFIG_END diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index f20f4901166..8509fb90664 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -1192,7 +1192,7 @@ static void configure_fast_ram(running_machine &machine) { model3_state *state = machine.driver_data<model3_state>(); /* set conservative DRC options */ - machine.device<ppc_device>("maincpu")->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS - PPCDRC_ACCURATE_SINGLES); + machine.device<ppc_device>("maincpu")->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS); /* configure fast RAM regions for DRC */ machine.device<ppc_device>("maincpu")->ppcdrc_add_fastram(0x00000000, 0x007fffff, FALSE, state->m_work_ram); @@ -1556,7 +1556,7 @@ WRITE64_MEMBER(model3_state::model3_sys_w) m_crom_bank = data >> 56; data >>= 56; - data = (~data) & 0x7; + data = (~data) & 0xf; membank("bank1")->set_base(memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */ } @@ -2047,7 +2047,7 @@ INPUT_PORTS_END #define ROM_LOAD_VROM(name, offset, length, hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(14) ) ROM_START( lemans24 ) /* step 1.5, Sega game ID# is 833-13159, ROM board ID# 834-13160 GAME BD LEMANS 24 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19887b.17", 0x600006, 0x080000, CRC(2842bb87) SHA1(2acabf3f7281acaf6bab4d3bae9701df3909cf81) ) ROM_LOAD64_WORD_SWAP( "epr-19888b.18", 0x600004, 0x080000, CRC(800d763d) SHA1(4f2865a64d6dda638840d359db3bd2f22b6d1404) ) @@ -2117,7 +2117,7 @@ ROM_END ROM_START( scud ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-13072 SPG COMM AUS */ /* There is known to be a ROM board ID# 834-13034 SPG DX AUS with program roms EPR-19634 to EPR-19637 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19731.17", 0x0600006, 0x80000, CRC(3ee6447e) SHA1(124697791d90c1b352dd6e33bd3b45535aa92bb5) ) ROM_LOAD64_WORD_SWAP( "epr-19732.18", 0x0600004, 0x80000, CRC(23e864bb) SHA1(0f34d963ee681ca1006f3dec12b593d961e3e442) ) @@ -2192,7 +2192,7 @@ ROM_START( scud ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-1 ROM_END ROM_START( scudj ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 12934 SPG DX */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19610.17a", 0x0600006, 0x80000, CRC(53f5cd94) SHA1(e27609165087ef7000b61ce628883561ffe64b22) ) ROM_LOAD64_WORD_SWAP( "epr-19609.18a", 0x0600004, 0x80000, CRC(ec418b68) SHA1(8455db7e174ea00db30b7e61681ac7b7fcd9ba1c) ) @@ -2267,7 +2267,7 @@ ROM_START( scudj ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 12934 ROM_END ROM_START( scuda ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-13042 SPG FOR COMMUNICATION */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19688.17", 0x0600006, 0x80000, CRC(a4c85103) SHA1(b2e57f86d0a49e3e88fa7d6a77bbd99039c034bb) ) ROM_LOAD64_WORD_SWAP( "epr-19689.18", 0x0600004, 0x80000, CRC(cbce6d62) SHA1(b6051af013ee80406cfadb0c8acf24b8825ccaf2) ) @@ -2342,7 +2342,7 @@ ROM_START( scuda ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-1 ROM_END ROM_START( scudplus ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM board ID# 834-13261 SCUD PLUS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20092a.17", 0x0600006, 0x80000, CRC(a94ec57e) SHA1(bda1d9cb38e10a25f7cdde38f30ae13541fdbc5e) ) ROM_LOAD64_WORD_SWAP( "epr-20093a.18", 0x0600004, 0x80000, CRC(4ed2e35d) SHA1(ac149b369db9fc80e63e1ed943d42ccd056dab1b) ) @@ -2423,7 +2423,7 @@ ROM_START( scudplus ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM b ROM_END ROM_START( scudplusa ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM board ID# 834-13261 SCUD PLUS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20092.17", 0x0600006, 0x80000, CRC(6f9161c1) SHA1(b1c66eeb1bb67664aafa78ad62515204f231f09b) ) ROM_LOAD64_WORD_SWAP( "epr-20093.18", 0x0600004, 0x80000, CRC(9a85c611) SHA1(fb21c29584b205ec14f82318110ecf5821a95c23) ) @@ -2504,7 +2504,7 @@ ROM_START( scudplusa ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM b ROM_END ROM_START( vf3 ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-12821 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19227c.17", 0x600006, 0x080000, CRC(a7df4d75) SHA1(1b1186227f830556c5e2b6ca4c2bf20673b22f94) ) ROM_LOAD64_WORD_SWAP( "epr-19228c.18", 0x600004, 0x080000, CRC(9c5727e2) SHA1(f9f8b8cf27fdce08ab2975dbaa8c7a03f5c064fb) ) @@ -2579,7 +2579,7 @@ ROM_START( vf3 ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_END ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-12821 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr19227a.17", 0x600006, 0x080000, CRC(7139931a) SHA1(57eec80361726143017b1adbfaafbeef0bc4109d) ) ROM_LOAD64_WORD_SWAP( "epr19228a.18", 0x600004, 0x080000, CRC(82f17ab5) SHA1(64714d14e64d97ebeedd1c6e1e832969df9e2324) ) @@ -2654,7 +2654,7 @@ ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_END ROM_START( vf3tb ) /* step 1.0? */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20126.17", 0x600006, 0x080000, CRC(27ecd3b0) SHA1(a9b913294ac925adb501d3b47f346006b70dfcd6) ) ROM_LOAD64_WORD_SWAP( "epr-20127.18", 0x600004, 0x080000, CRC(5c0f694b) SHA1(ca346d6b249bb7a3015f016d25bfb3050360c8ec) ) @@ -2729,7 +2729,7 @@ ROM_START( vf3tb ) /* step 1.0? */ ROM_END ROM_START( bass ) /* step 1.0, Sega game ID# is 833-13317, ROM board ID# 834-13318 BSS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20643.17", 0x600006, 0x080000, CRC(daf02716) SHA1(b968f8ca602c78b9ca49969ff01f9440f175049a) ) ROM_LOAD64_WORD_SWAP( "epr-20644.18", 0x600004, 0x080000, CRC(c28db2b6) SHA1(0b12fe9e5189714b1aca79c4bba4be57a9e0d5fd) ) @@ -2798,7 +2798,7 @@ ROM_START( bass ) /* step 1.0, Sega game ID# is 833-13317, ROM board ID# 834-1 ROM_END ROM_START( bassdx ) /* step 1.0, Sega game ID# is 833-13476 BSS DX JPN, ROM board ID# 834-13477 BSS DX JPN */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20834.17", 0x600006, 0x080000, CRC(17f466a6) SHA1(2abdc432891cc79733fc29903df87af9eba11b32) ) ROM_LOAD64_WORD_SWAP( "epr-20835.18", 0x600004, 0x080000, CRC(f8f19bb2) SHA1(8f1704e532e494086fb5989d0c358ea0a0f6aae5) ) @@ -2892,7 +2892,7 @@ gal16v8d (sega 315-6126) */ ROM_START( getbass ) /* step 1.0, Sega game ID# is 833-13416 GET BASS STD, ROM board ID# 834-13417 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20309.17", 0x600006, 0x080000, CRC(a42e1033) SHA1(a834eb973e9529338413220a2d8e66ce98d6cb31) ) ROM_LOAD64_WORD_SWAP( "epr-20310.18", 0x600004, 0x080000, CRC(4efcddc9) SHA1(d1362c2a844b605901083e875a6aad817401eb0a) ) @@ -2964,7 +2964,7 @@ ROM_START( getbass ) /* step 1.0, Sega game ID# is 833-13416 GET BASS STD, RO ROM_END ROM_START( lostwsga ) /* Step 1.5, PCB cage labeled 834-13172 THE LOST WORLD U/R. Sega game ID# is 833-13171, ROM board ID# 834-13172 REV.A */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19939a.17", 0x600006, 0x080000, CRC(8788b939) SHA1(30932057f763545568526f85977aa0afc4b66e7d) ) ROM_LOAD64_WORD_SWAP( "epr-19938a.18", 0x600004, 0x080000, CRC(38afe27a) SHA1(718a238ee246eeed9fa698b58493806932d0e7cb) ) @@ -3039,7 +3039,7 @@ ROM_START( lostwsga ) /* Step 1.5, PCB cage labeled 834-13172 THE LOST WORLD U ROM_END ROM_START( vs2 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20467.17", 0x400006, 0x100000, CRC(25d7ae73) SHA1(433a7c1dac1bd5524b018da2ed09f937d527ac3e) ) ROM_LOAD64_WORD_SWAP( "epr-20468.18", 0x400004, 0x100000, CRC(f0f0b6ea) SHA1(b3f545e5a4dd45b97df938093251cc7845c2a1f9) ) @@ -3114,7 +3114,7 @@ ROM_START( vs2 ) /* Step 2.0 */ ROM_END ROM_START( vs215 ) /* Step 1.5 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19900.17", 0x600006, 0x080000, CRC(8fb6045d) SHA1(88497eafc23ba70ab4a43de552a16caccd8dccbe) ) ROM_LOAD64_WORD_SWAP( "epr-19899.18", 0x600004, 0x080000, CRC(8cc2be9f) SHA1(ec82b1312c8d58adb200f4d7f6f9a9c8214415d5) ) @@ -3189,7 +3189,7 @@ ROM_START( vs215 ) /* Step 1.5 */ ROM_END ROM_START( vs215o ) /* Step 1.5, original release.. might even be for Step 1.0??? */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19806.17", 0x600006, 0x080000, CRC(95e1b970) SHA1(bcc914088cd08cb0032349b71904757760d947f3) ) ROM_LOAD64_WORD_SWAP( "epr-19805.18", 0x600004, 0x080000, CRC(d9e40606) SHA1(b305e607ffe4226c825a73973a5c8ec1322e8b58) ) @@ -3264,7 +3264,7 @@ ROM_START( vs215o ) /* Step 1.5, original release.. might even be for Step 1.0?? ROM_END ROM_START( vs298 ) /* Step 2.0, Sega ID# 833-13346, ROM board ID# 834-13347 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20917.17", 0x400006, 0x100000, CRC(c3bbb270) SHA1(16b2342031ff72408f2290e775df5c8aa344c2e4) ) ROM_LOAD64_WORD_SWAP( "epr-20918.18", 0x400004, 0x100000, CRC(0e9cdc5b) SHA1(356816d0380c791b9d812ce17fa95123d15bb5e9) ) @@ -3342,7 +3342,7 @@ ROM_START( vs298 ) /* Step 2.0, Sega ID# 833-13346, ROM board ID# 834-13347 */ ROM_END ROM_START( vs29815 ) /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20909.17", 0x600006, 0x080000, CRC(3dff0d7e) SHA1(c6a6a103f499cd451796ae2480b8c38c3e87a143) ) ROM_LOAD64_WORD_SWAP( "epr-20910.18", 0x600004, 0x080000, CRC(dc75a2e3) SHA1(f1b13674ae20b5b964be593171b9d6008d5a51b7) ) @@ -3417,7 +3417,7 @@ ROM_START( vs29815 ) /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 ROM_END ROM_START( vs2v991 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535b.17", 0x400006, 0x100000, CRC(76c5fa8e) SHA1(862438198cb7fdd20beeba53e707a7c59e618ad9) ) ROM_LOAD64_WORD_SWAP( "epr-21536b.18", 0x400004, 0x100000, CRC(1f2bd190) SHA1(19843e6c5626de03eba3cba79c03ce9f2471c183) ) @@ -3495,7 +3495,7 @@ ROM_START( vs2v991 ) /* Step 2.0 */ ROM_END ROM_START( vs299b ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21550b.17", 0x400006, 0x100000, CRC(c508e488) SHA1(3134d418beaee9f824a0bd0e5441a997b5911d16) ) ROM_LOAD64_WORD_SWAP( "epr-21551b.18", 0x400004, 0x100000, CRC(0bbc40f7) SHA1(4437c7eab621349b826dcc03d1377731260417e8) ) @@ -3573,7 +3573,7 @@ ROM_START( vs299b ) /* Step 2.0 */ ROM_END ROM_START( vs299a ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535a.17", 0x400006, 0x100000, CRC(8e4ec341) SHA1(973c71e7a48e728cbcb2465b56e90669fee0ec53) ) ROM_LOAD64_WORD_SWAP( "epr-21536a.18", 0x400004, 0x100000, CRC(95d49d6e) SHA1(80b6655c1ee0f76620e3e2e9425719819a96ccf7) ) @@ -3651,7 +3651,7 @@ ROM_START( vs299a ) /* Step 2.0 */ ROM_END ROM_START( vs299 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535.17", 0x400006, 0x100000, CRC(976a00bf) SHA1(d4be52ff59faa877b169f96ac509a2196cefb908) ) ROM_LOAD64_WORD_SWAP( "epr-21536.18", 0x400004, 0x100000, CRC(9af2b0d5) SHA1(6ec296014228782f372611fe774014d252956b63) ) @@ -3729,7 +3729,7 @@ ROM_START( vs299 ) /* Step 2.0 */ ROM_END ROM_START( von2 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20683b.17", 0x000006, 0x200000, CRC(59d9c974) SHA1(c45594ed474a9e8fd074e0d9d5fa6662bc88dee6) ) ROM_LOAD64_WORD_SWAP( "epr-20684b.18", 0x000004, 0x200000, CRC(1fc15431) SHA1(c68c77dfcf5e2702214d64095ce07076d3702a5e) ) @@ -3808,7 +3808,7 @@ ROM_START( von2 ) /* Step 2.0 */ ROM_END ROM_START( von254g ) /* Step 2.0, Sega game ID# is 833-13789 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21788.17", 0x000006, 0x200000, CRC(97066bcf) SHA1(234c45ee1f23b22f61893825eebf31d867cf420f) ) ROM_LOAD64_WORD_SWAP( "epr-21789.18", 0x000004, 0x200000, CRC(3069108f) SHA1(f4e82da677458423abcf07c9c5a837005ed8f1c4) ) @@ -3887,7 +3887,7 @@ ROM_START( von254g ) /* Step 2.0, Sega game ID# is 833-13789 */ ROM_END ROM_START( skichamp ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20352.17", 0x000006, 0x200000, CRC(c92c2545) SHA1(612c39c935b403484fcda6d36fca50cc5ef726fc) ) ROM_LOAD64_WORD_SWAP( "epr-20353.19", 0x000004, 0x200000, CRC(badf5f04) SHA1(65a502a3fada114a699d0bf22e004d5bf1f5edf5) ) @@ -3959,7 +3959,7 @@ ROM_START( skichamp ) /* Step 2.0 */ ROM_END ROM_START( swtrilgy ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 834-13587 STAR WARS TRILOGY, Security board ID# 837-13588-COM */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21379a.17", 0x000006, 0x200000, CRC(24dc1555) SHA1(0a4b458bb09238de0f38ba2805512b5dbee7d58e) ) ROM_LOAD64_WORD_SWAP( "epr-21380a.18", 0x000004, 0x200000, CRC(780fb4e7) SHA1(6650e114bad0e4c3f67b744599dba9845da82f11) ) @@ -4034,7 +4034,7 @@ ROM_START( swtrilgy ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 8 ROM_END ROM_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 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21379.17", 0x000006, 0x200000, CRC(61ad51d9) SHA1(b27ea929702bb94c86d03d6c1f479af32230b4d0) ) ROM_LOAD64_WORD_SWAP( "epr-21380.18", 0x000004, 0x200000, CRC(49b182f2) SHA1(9a4e3180f2661c95976963ab17e66a5184bca9a3) ) @@ -4106,7 +4106,7 @@ ROM_START( swtrilgya ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 8 ROM_END ROM_START( dirtdvls ) /* Step 2.1 - Export version, Sega game ID# is 833-13427, ROM board ID# 834-13528 DRT */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21062a.17", 0x000006, 0x200000, CRC(64b55254) SHA1(0e5de3786edad77dde08652ac837dc9125e7851c) ) ROM_LOAD64_WORD_SWAP( "epr-21063a.18", 0x000004, 0x200000, CRC(6ab7eb32) SHA1(3a4226d4c786e7b64688af3b8883b4039b8c8407) ) @@ -4170,7 +4170,7 @@ ROM_START( dirtdvls ) /* Step 2.1 - Export version, Sega game ID# is 833-13427 ROM_END ROM_START( dirtdvlsa ) /* Step 2.1 - Australia version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21058a", 0x000006, 0x200000, CRC(4d7fdc8d) SHA1(c45031b4e3ea65519de671e0e11f87e0965e3c93) ) ROM_LOAD64_WORD_SWAP( "epr-21059a", 0x000004, 0x200000, CRC(f31a2aa4) SHA1(b7398db217372885f763efdb909f3e43ccbac34a) ) @@ -4400,7 +4400,7 @@ ROM_START( dayto2pe ) /* Step 2.1, Sega game ID# is 833-13610 DAYTONA USA2 SP, ROM_END ROM_START( srally2 ) /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 834-13374 SRT TWIN */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20632.17", 0x000006, 0x200000, CRC(6829a801) SHA1(2aa3834f6a8c53f5db57ab52994b8ab3fde2d7c2) ) ROM_LOAD64_WORD_SWAP( "epr-20633.18", 0x000004, 0x200000, CRC(f5a24f24) SHA1(6f741bc53d51ff4b5535dbee35aa490f159945ec) ) @@ -4472,7 +4472,7 @@ ROM_START( srally2 ) /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 8 ROM_END ROM_START( srally2x ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20502.17", 0x000006, 0x200000, CRC(af16846d) SHA1(a0babc4dc3809ca1e71eaad4dc2f8c1597575e8b) ) ROM_LOAD64_WORD_SWAP( "epr-20503.18", 0x000004, 0x200000, CRC(6e238b3d) SHA1(78da9abf39a2371d74d6b72b00f2467dfe86c4d5) ) @@ -4541,7 +4541,7 @@ ROM_START( srally2x ) /* Step 2.0 */ ROM_END ROM_START( harley ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-13326 HARLEY DAVIDSON */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20393b.17", 0x000006, 0x200000, CRC(7d712105) SHA1(35e0849f498de48fcb357495b6e8039740b8e881) ) ROM_LOAD64_WORD_SWAP( "epr-20394b.18", 0x000004, 0x200000, CRC(b4312135) SHA1(79c4306acd8c20f86d16a18de696783f7da9df84) ) @@ -4609,7 +4609,7 @@ ROM_START( harley ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-1 ROM_END ROM_START( harleya ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-13326 HARLEY DAVIDSON */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20393a.17", 0x000006, 0x200000, CRC(b5646556) SHA1(4bff0e140e1d1df7459f7194aa4a335bc4592203) ) ROM_LOAD64_WORD_SWAP( "epr-20394a.18", 0x000004, 0x200000, CRC(ce29e2b6) SHA1(482aaf5480b219b8ac6e4e36a6d64359e1834f44) ) @@ -4677,7 +4677,7 @@ ROM_START( harleya ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 8 ROM_END ROM_START( fvipers2 ) /* Step 2.0 - Japan version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20596a.17", 0x000006, 0x200000, CRC(969ab801) SHA1(a7a2aa71204d1c38a6a8c0605331fd859cb224f1) ) ROM_LOAD64_WORD_SWAP( "epr-20597a.18", 0x000004, 0x200000, CRC(6fcee322) SHA1(d65303f2551902ac5446a35656241628d67f4a63) ) @@ -4915,7 +4915,7 @@ ROM_START( spikeofe ) /* Step 2.1, Sega game ID# is 833-13746, ROM board ID# 8 ROM_END ROM_START( eca ) /* Step 2.1 Export version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-22903.17", 0x000006, 0x200000, CRC(53882217) SHA1(163cbc92ff88671882cc1af377ceec80ba9f36db) ) ROM_LOAD64_WORD_SWAP( "epr-22904.18", 0x000004, 0x200000, CRC(0ff828a8) SHA1(2a74414891ceb5989e6ccb6e9d597f7d2e31fec4) ) // == epr-22896.18 @@ -4986,7 +4986,7 @@ ROM_START( eca ) /* Step 2.1 Export version */ ROM_END ROM_START( ecau ) /* Step 2.1, ROM board ID# 834-13946-01 ECA */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-22895.17", 0x000006, 0x200000, CRC(07df16a0) SHA1(a9ad2b229854a5f4f761565141db738adde28720) ) ROM_LOAD64_WORD_SWAP( "epr-22896.18", 0x000004, 0x200000, CRC(0ff828a8) SHA1(2a74414891ceb5989e6ccb6e9d597f7d2e31fec4) ) @@ -5057,7 +5057,7 @@ ROM_START( ecau ) /* Step 2.1, ROM board ID# 834-13946-01 ECA */ ROM_END ROM_START( ecap ) /* Step 2.1 - Proto or Location test - No security dongle */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM // Hand written SEGA labels in this form: TITLE: QQ ROM NO: IC17 CHECK SUM: 551B 9/12-'99 ROM_LOAD64_WORD_SWAP( "qq.ic17", 0x000006, 0x200000, BAD_DUMP CRC(1db889e0) SHA1(b9a5f344685e1d8b5711d8ab426bb886c1008e48) ) /* Check sum: 551B, dated "9/12-'99" */ @@ -5131,7 +5131,7 @@ ROM_START( ecap ) /* Step 2.1 - Proto or Location test - No security dongle */ ROM_END ROM_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 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21435.17", 0x000006, 0x200000, CRC(9b169446) SHA1(285cbe5afd439d83c50f0499a878f71b8e5b94e5) ) ROM_LOAD64_WORD_SWAP( "epr-21433.18", 0x000004, 0x200000, CRC(60aa9d76) SHA1(b27741568a4fd0494b2254e468faea569e2d9fef) ) @@ -5261,7 +5261,7 @@ ROM_START( oceanhun ) /* Step 2.0, Sega game ID# is 833-13571, ROM board ID# 8 ROM_END ROM_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) */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21483.17", 0x000006, 0x200000, CRC(940637c2) SHA1(89894b603c17d27f57500ec8030eaa7e0e991479) ) ROM_LOAD64_WORD_SWAP( "epr-21484.18", 0x000004, 0x200000, CRC(58102168) SHA1(38dd9a41f653c0a84ac927b476f014c949454ffa) ) @@ -5690,6 +5690,9 @@ DRIVER_INIT_MEMBER(model3_state,scud) DRIVER_INIT_CALL(model3_15); /* TODO: network device at 0xC0000000 - FF */ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this)); + +// UINT32 *rom = (UINT32*)memregion("user1")->base(); +// rom[(0x799de8^4)/4] = 0x00050208; // secret debug menu } DRIVER_INIT_MEMBER(model3_state,scudplus) @@ -5822,6 +5825,15 @@ DRIVER_INIT_MEMBER(model3_state,harley) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); } +DRIVER_INIT_MEMBER(model3_state,harleya) +{ + DRIVER_INIT_CALL(model3_20); + + m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); +} + + DRIVER_INIT_MEMBER(model3_state,srally2) { DRIVER_INIT_CALL(model3_20); @@ -5937,6 +5949,16 @@ DRIVER_INIT_MEMBER(model3_state,eca) { DRIVER_INIT_CALL(model3_20); DRIVER_INIT_CALL(genprot); + + // base = 0xffc80000 + UINT32 *rom = (UINT32*)memregion("user1")->base(); + + // cabinet network error + rom[(0x4a45e4^4)/4] = 0x60000000; + + // this code sometimes gets stuck waiting for [0x1e0064], changed by the sound irq (sound FIFO overflow?) + rom[(0x5523b4^4)/4] = 0x60000000; + rom[(0x5523d4^4)/4] = 0x60000000; } DRIVER_INIT_MEMBER(model3_state,skichamp) @@ -6002,7 +6024,7 @@ GAME( 1998, vs29815, vs298, model3_15, model3, model3_state, vs29815, ROT0 /* Model 3 Step 2.0 */ GAME( 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 ) GAME( 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 ) -GAME( 1997, harleya, harley, model3_20, harley, model3_state, harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 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 ) GAME( 1998, lamachin, 0, model3_20_5881, model3, model3_state, lamachin, ROT0, "Sega", "L.A. Machineguns (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1998, oceanhun, 0, model3_20_5881, model3, model3_state, oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1998, skichamp, 0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/mouser.c b/src/mame/drivers/mouser.c index a953d8f4e73..477b2469d5d 100644 --- a/src/mame/drivers/mouser.c +++ b/src/mame/drivers/mouser.c @@ -75,9 +75,12 @@ static ADDRESS_MAP_START( mouser_map, AS_PROGRAM, 8, mouser_state ) AM_RANGE(0xb800, 0xb800) AM_READ_PORT("P2") AM_WRITE(mouser_sound_interrupt_w) /* byte to sound cpu */ ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, mouser_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END static ADDRESS_MAP_START( mouser_sound_map, AS_PROGRAM, 8, mouser_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x2000, 0x23ff) AM_RAM AM_RANGE(0x3000, 0x3000) AM_READ(mouser_sound_byte_r) AM_RANGE(0x4000, 0x4000) AM_WRITE(mouser_sound_nmi_clear_w) @@ -199,6 +202,7 @@ static MACHINE_CONFIG_START( mouser, mouser_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz ? */ MCFG_CPU_PROGRAM_MAP(mouser_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", mouser_state, mouser_nmi_interrupt) /* NMI is masked externally */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ @@ -232,12 +236,12 @@ MACHINE_CONFIG_END ROM_START( mouser ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 64K for data, 64K for encrypted opcodes */ + ROM_REGION( 0x6000, "maincpu", 0 ) /* 64K for data, 64K for encrypted opcodes */ ROM_LOAD( "m0.5e", 0x0000, 0x2000, CRC(b56e00bc) SHA1(f3b23212590d91f1d19b1c7a98c560fbe5943185) ) ROM_LOAD( "m1.5f", 0x2000, 0x2000, CRC(ae375d49) SHA1(8422f5a4d8560425f0c8612cf6f76029fcfe267c) ) ROM_LOAD( "m2.5j", 0x4000, 0x2000, CRC(ef5817e4) SHA1(5cadc19f20fadf97c95852b280305fe4c75f1d19) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "m5.3v", 0x0000, 0x1000, CRC(50705eec) SHA1(252cea3498722318638f0c98ae929463ffd7d0d6) ) ROM_REGION( 0x4000, "gfx1", 0 ) @@ -256,12 +260,12 @@ ROM_END ROM_START( mouserc ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 64K for data, 64K for encrypted opcodes */ + ROM_REGION( 0x6000, "maincpu", 0 ) /* 64K for data, 64K for encrypted opcodes */ ROM_LOAD( "83001.0", 0x0000, 0x2000, CRC(e20f9601) SHA1(f559a470784bda0bee9cab257a548238365acaa6) ) ROM_LOAD( "m1.5f", 0x2000, 0x2000, CRC(ae375d49) SHA1(8422f5a4d8560425f0c8612cf6f76029fcfe267c) ) // 83001.1 ROM_LOAD( "m2.5j", 0x4000, 0x2000, CRC(ef5817e4) SHA1(5cadc19f20fadf97c95852b280305fe4c75f1d19) ) // 83001.2 - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x1000, "audiocpu", 0 ) ROM_LOAD( "m5.3v", 0x0000, 0x1000, CRC(50705eec) SHA1(252cea3498722318638f0c98ae929463ffd7d0d6) ) // 83001.5 ROM_REGION( 0x4000, "gfx1", 0 ) @@ -284,16 +288,12 @@ DRIVER_INIT_MEMBER(mouser_state,mouser) /* Decode the opcodes */ offs_t i; - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000); UINT8 *table = memregion("user1")->base(); - space.set_decrypted_region(0x0000, 0x5fff, decrypted); - for (i = 0; i < 0x6000; i++) { - decrypted[i] = table[rom[i]]; + m_decrypted_opcodes[i] = table[rom[i]]; } } diff --git a/src/mame/drivers/mpu4hw.c b/src/mame/drivers/mpu4hw.c index 33efa218e90..50a7d20ce98 100644 --- a/src/mame/drivers/mpu4hw.c +++ b/src/mame/drivers/mpu4hw.c @@ -2394,7 +2394,7 @@ DRIVER_INIT_MEMBER(mpu4_state,m_frkstn) } // thanks to Project Amber for descramble information -void descramble_crystal( UINT8* region, int start, int end, UINT8 extra_xor) +static void descramble_crystal( UINT8* region, int start, int end, UINT8 extra_xor) { for (int i=start;i<end;i++) { diff --git a/src/mame/drivers/mustache.c b/src/mame/drivers/mustache.c index 885c1b2acdf..d08e2d2195c 100644 --- a/src/mame/drivers/mustache.c +++ b/src/mame/drivers/mustache.c @@ -191,8 +191,6 @@ static MACHINE_CONFIG_START( mustache, mustache_state ) MCFG_PALETTE_INIT_OWNER(mustache_state, mustache) /* sound hardware */ - MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0) // for seibu_sound_decrypt on the MAIN cpu (not sound) - MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_YM2151_ADD("ymsnd", YM_CLOCK) @@ -272,7 +270,7 @@ DRIVER_INIT_MEMBER(mustache_state,mustache) for (i = 0; i < 2*G2; i++) gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)]; - m_cpu_decrypt->decrypt("maincpu",0x8000); + seibu_sound_device::apply_decrypt(NULL, NULL, 0xc000); } diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c index 7449c64837c..013aeb3c448 100644 --- a/src/mame/drivers/namcos86.c +++ b/src/mame/drivers/namcos86.c @@ -323,7 +323,7 @@ void namcos86_state::machine_start() membank("bank1")->configure_entries(0, 32, memregion("user1")->base(), 0x2000); membank("bank2")->configure_entries(0, 4, memregion("cpu2")->base() + 0x10000, 0x2000); - + save_item(NAME(m_wdog)); } diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 7ee377c9d67..e28abe21c2b 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -7386,8 +7386,8 @@ ROM_START( shaktam ) DISK_IMAGE_READONLY( "gds-0002b", 0, SHA1(c656497b44d5ca4743aa1a8d836af2bfa3484dd5) ) ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) - // key PIC is missing - ROM_LOAD("317-xxxx-com.pic", 0x00, 0x4000, BAD_DUMP CRC(034b7299) SHA1(45118d5f65b21ae599e3ca8e35df847135708d44) ) + // PIC label is unknown + ROM_LOAD("317-xxxx-com.pic", 0x00, 0x4000, CRC(9e1a8971) SHA1(022a1781b5d7346b61defe921dbabf11331834d7) ) ROM_END ROM_START( sprtjam ) diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c index b1c780d6235..25d8f386d1c 100644 --- a/src/mame/drivers/ninjakd2.c +++ b/src/mame/drivers/ninjakd2.c @@ -374,7 +374,6 @@ static ADDRESS_MAP_START( ninjakd2_main_cpu, AS_PROGRAM, 8, ninjakd2_state ) AM_RANGE(0xfa00, 0xffff) AM_RAM AM_SHARE("spriteram") ADDRESS_MAP_END - static ADDRESS_MAP_START( mnight_main_cpu, AS_PROGRAM, 8, ninjakd2_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") @@ -454,6 +453,12 @@ static ADDRESS_MAP_START( ninjakd2_sound_cpu, AS_PROGRAM, 8, ninjakd2_state ) AM_RANGE(0xf000, 0xf000) AM_WRITE(ninjakd2_pcm_play_w) ADDRESS_MAP_END + +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, ninjakd2_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("soundcpu", 0x8000) +ADDRESS_MAP_END + static ADDRESS_MAP_START( ninjakd2_sound_io, AS_IO, 8, ninjakd2_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_DEVWRITE("2203.1", ym2203_device, write) @@ -909,7 +914,7 @@ MACHINE_RESET_MEMBER(ninjakd2_state,omegaf) /*****************************************************************************/ -static MACHINE_CONFIG_START( ninjakd2, ninjakd2_state ) +static MACHINE_CONFIG_START( ninjakd2_core, ninjakd2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK_12/2) /* verified */ @@ -956,7 +961,12 @@ static MACHINE_CONFIG_START( ninjakd2, ninjakd2_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( mnight, ninjakd2 ) +static MACHINE_CONFIG_DERIVED( ninjakd2, ninjakd2_core ) + MCFG_CPU_MODIFY("soundcpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mnight, ninjakd2_core ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -969,7 +979,7 @@ static MACHINE_CONFIG_DERIVED( mnight, ninjakd2 ) MCFG_DEVICE_REMOVE("pcm") MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( arkarea, ninjakd2 ) +static MACHINE_CONFIG_DERIVED( arkarea, ninjakd2_core ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -1469,15 +1479,14 @@ void ninjakd2_state::gfx_unscramble() DRIVER_INIT_MEMBER(ninjakd2_state,ninjakd2) { - mc8123_decrypt_rom(machine(), "soundcpu", "user1", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_decrypted_opcodes, memregion("user1")->base(), 0x8000); gfx_unscramble(); } DRIVER_INIT_MEMBER(ninjakd2_state,bootleg) { - address_space &space = m_soundcpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("soundcpu")->base() + 0x10000); + memcpy(m_decrypted_opcodes, memregion("soundcpu")->base() + 0x10000, 0x8000); gfx_unscramble(); } diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c index b383c600a91..ae90b65de19 100644 --- a/src/mame/drivers/nmk16.c +++ b/src/mame/drivers/nmk16.c @@ -2337,7 +2337,7 @@ static INPUT_PORTS_START( airattck ) PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5") @@ -2345,10 +2345,10 @@ static INPUT_PORTS_START( airattck ) PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3") PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1") @@ -2362,13 +2362,13 @@ static INPUT_PORTS_START( airattck ) PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0200, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1") diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index 17772c0a202..7c6b1cd941e 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -982,6 +982,10 @@ ADDRESS_MAP_END // The Pacman code uses $5004 and $5005 for LED's and $5007 for coin lockout. This hardware does not // exist on any Pacman or Puckman board I have seen. DW +static ADDRESS_MAP_START( patched_opcodes_map, AS_DECRYPTED_OPCODES, 8, pacman_state ) + AM_RANGE(0x0000, 0x3fff) AM_MIRROR(0x8000) AM_ROM AM_SHARE("patched_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( birdiy_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x0000, 0x3fff) AM_MIRROR(0x8000) AM_ROM @@ -3462,6 +3466,11 @@ static MACHINE_CONFIG_START( pacman, pacman_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( pacmanp, pacman ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(patched_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( pengojpm, pacman ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(pengojpm_map) @@ -6371,25 +6380,22 @@ ROM_END void pacman_state::maketrax_rom_decode() { - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000); UINT8 *rom = memregion("maincpu")->base(); /* patch protection using a copy of the opcodes so ROM checksum */ /* tests will not fail */ - space.set_decrypted_region(0x0000, 0x3fff, decrypted); - - memcpy(decrypted,rom,0x4000); - - decrypted[0x0415] = 0xc9; - decrypted[0x1978] = 0x18; - decrypted[0x238e] = 0xc9; - decrypted[0x3ae5] = 0xe6; - decrypted[0x3ae7] = 0x00; - decrypted[0x3ae8] = 0xc9; - decrypted[0x3aed] = 0x86; - decrypted[0x3aee] = 0xc0; - decrypted[0x3aef] = 0xb0; + + memcpy(m_patched_opcodes,rom,0x4000); + + m_patched_opcodes[0x0415] = 0xc9; + m_patched_opcodes[0x1978] = 0x18; + m_patched_opcodes[0x238e] = 0xc9; + m_patched_opcodes[0x3ae5] = 0xe6; + m_patched_opcodes[0x3ae7] = 0x00; + m_patched_opcodes[0x3ae8] = 0xc9; + m_patched_opcodes[0x3aed] = 0x86; + m_patched_opcodes[0x3aee] = 0xc0; + m_patched_opcodes[0x3aef] = 0xb0; } DRIVER_INIT_MEMBER(pacman_state,maketrax) @@ -6403,25 +6409,22 @@ DRIVER_INIT_MEMBER(pacman_state,maketrax) void pacman_state::korosuke_rom_decode() { - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000); UINT8 *rom = memregion("maincpu")->base(); /* patch protection using a copy of the opcodes so ROM checksum */ /* tests will not fail */ - space.set_decrypted_region(0x0000, 0x3fff, decrypted); - - memcpy(decrypted,rom,0x4000); - - decrypted[0x044c] = 0xc9; - decrypted[0x1973] = 0x18; - decrypted[0x238c] = 0xc9; - decrypted[0x3ae9] = 0xe6; /* not changed */ - decrypted[0x3aeb] = 0x00; - decrypted[0x3aec] = 0xc9; - decrypted[0x3af1] = 0x86; - decrypted[0x3af2] = 0xc0; - decrypted[0x3af3] = 0xb0; + + memcpy(m_patched_opcodes,rom,0x4000); + + m_patched_opcodes[0x044c] = 0xc9; + m_patched_opcodes[0x1973] = 0x18; + m_patched_opcodes[0x238c] = 0xc9; + m_patched_opcodes[0x3ae9] = 0xe6; /* not changed */ + m_patched_opcodes[0x3aeb] = 0x00; + m_patched_opcodes[0x3aec] = 0xc9; + m_patched_opcodes[0x3af1] = 0x86; + m_patched_opcodes[0x3af2] = 0xc0; + m_patched_opcodes[0x3af3] = 0xb0; } DRIVER_INIT_MEMBER(pacman_state,korosuke) @@ -6869,18 +6872,18 @@ GAME( 1985, jumpshotp,jumpshot, pacman, jumpshotp,pacman_state, jumpshot, ROT GAME( 1985, shootbul, 0, pacman, shootbul, pacman_state, jumpshot, ROT90, "Bally Midway", "Shoot the Bull", GAME_SUPPORTS_SAVE ) -GAME( 1981, crush, 0, pacman, maketrax, pacman_state, maketrax, ROT90, "Alpha Denshi Co. / Kural Samno Electric, Ltd.", "Crush Roller (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, crush, 0, pacmanp, maketrax, pacman_state, maketrax, ROT90, "Alpha Denshi Co. / Kural Samno Electric, Ltd.", "Crush Roller (set 1)", GAME_SUPPORTS_SAVE ) GAME( 1981, crush2, crush, pacman, maketrax, driver_device, 0, ROT90, "Alpha Denshi Co. / Kural Esco Electric, Ltd.", "Crush Roller (set 2)", GAME_SUPPORTS_SAVE ) GAME( 1981, crush3, crush, pacman, maketrax, pacman_state, eyes, ROT90, "Alpha Denshi Co. / Kural Electric, Ltd.", "Crush Roller (set 3)", GAME_SUPPORTS_SAVE ) GAME( 1981, crush4, crush, crush4, crush4, driver_device, 0, ROT90, "Alpha Denshi Co. / Kural TWT", "Crush Roller (set 4)", GAME_SUPPORTS_SAVE ) -GAME( 1981, maketrax, crush, pacman, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1981, maketrxb, crush, pacman, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1981, korosuke, crush, pacman, korosuke, pacman_state, korosuke, ROT90, "Alpha Denshi Co. / Kural Electric, Ltd.", "Korosuke Roller (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1981, maketrax, crush, pacmanp, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, maketrxb, crush, pacmanp, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1981, korosuke, crush, pacmanp, korosuke, pacman_state, korosuke, ROT90, "Alpha Denshi Co. / Kural Electric, Ltd.", "Korosuke Roller (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1981, crushbl, crush, pacman, maketrax, driver_device, 0, ROT90, "bootleg", "Crush Roller (bootleg set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1981, crushbl2, crush, pacman, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1981, crushbl3, crush, pacman, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 3)", GAME_SUPPORTS_SAVE ) +GAME( 1981, crushbl2, crush, pacmanp, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1981, crushbl3, crush, pacmanp, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 3)", GAME_SUPPORTS_SAVE ) GAME( 1981, crushs, crush, crushs, crushs, driver_device, 0, ROT90, "bootleg (Sidam)", "Crush Roller (bootleg set 4)", GAME_SUPPORTS_SAVE ) // Sidam PCB, no Sidam text -GAME( 1981, mbrush, crush, pacman, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Magic Brush (bootleg of Crush Roller)", GAME_SUPPORTS_SAVE ) +GAME( 1981, mbrush, crush, pacmanp, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Magic Brush (bootleg of Crush Roller)", GAME_SUPPORTS_SAVE ) GAME( 1981, paintrlr, crush, pacman, paintrlr, driver_device, 0, ROT90, "bootleg", "Paint Roller (bootleg of Crush Roller)", GAME_SUPPORTS_SAVE ) GAME( 1982, eyes, 0, pacman, eyes, pacman_state, eyes, ROT90, "Techstar (Rock-Ola license)", "Eyes (US set 1)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/paradise.c b/src/mame/drivers/paradise.c index 3a3b05b38e4..c78d0adec2b 100644 --- a/src/mame/drivers/paradise.c +++ b/src/mame/drivers/paradise.c @@ -805,7 +805,7 @@ YS-1604 | | |---------------------------------------------------------| -Year is assumed to be 1994 based on 94*41 factory sticker and 19/1/95 +Year is assumed to be 1994 based on 94*41 factory sticker and 19/1/95 operator sticker on a revised version PCB. The year is not shown but must be >= 1994, since the development system (cross compiler?) they used left a "1994.8-1989" in the rom @@ -815,7 +815,7 @@ Paradise (set 2): No board ID, although some tracks which are wire hacks on Except for the program rom all other data matches Paradise (set 1). NOTE: on this version of the PCB the above listed 4MHz OSC is replaced with a 3.579545MHz OSC - + The Escape version might be the newest revision due to improved slot machine animation on 'girl select' compared to other sets. Except for the program rom all other data matches Paradise (set 1). @@ -848,55 +848,55 @@ ROM_START( paradise ) ROM_END ROM_START( paradisea ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* Z80 Code */ - ROM_LOAD( "a-19.U128", 0x00000, 0x40000, CRC(d47ecb7e) SHA1(74e7a33f2fc4c7c830c53c50541c3d0efd152e98) ) + ROM_REGION( 0x40000, "maincpu", 0 ) /* Z80 Code */ + ROM_LOAD( "a-19.U128", 0x00000, 0x40000, CRC(d47ecb7e) SHA1(74e7a33f2fc4c7c830c53c50541c3d0efd152e98) ) - ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT) /* 16x16x8 Sprites */ - ROM_LOAD( "a-19.u114", 0x00000, 0x40000, CRC(c748ba3b) SHA1(ad23bda4e001ca539f849c1ca256de5daf7c233b) ) - ROM_LOAD( "a-19.u115", 0x40000, 0x40000, CRC(0d517bbb) SHA1(5bf7c5036f3d660901e26f14baaea1a3c0327dfe) ) + ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT) /* 16x16x8 Sprites */ + ROM_LOAD( "a-19.u114", 0x00000, 0x40000, CRC(c748ba3b) SHA1(ad23bda4e001ca539f849c1ca256de5daf7c233b) ) + ROM_LOAD( "a-19.u115", 0x40000, 0x40000, CRC(0d517bbb) SHA1(5bf7c5036f3d660901e26f14baaea1a3c0327dfe) ) - ROM_REGION( 0x20000, "gfx2", ROMREGION_INVERT) /* 8x8x4 Background */ - ROM_LOAD( "a-19.u94", 0x00000, 0x20000, CRC(e3a99209) SHA1(5db79dc1a38d93b458b043499a58516285c65aa8) ) + ROM_REGION( 0x20000, "gfx2", ROMREGION_INVERT) /* 8x8x4 Background */ + ROM_LOAD( "a-19.u94", 0x00000, 0x20000, CRC(e3a99209) SHA1(5db79dc1a38d93b458b043499a58516285c65aa8) ) - ROM_REGION( 0x100000, "gfx3", ROMREGION_INVERT) /* 8x8x8 Foreground */ - ROM_LOAD( "a-19.u92", 0x00000, 0x80000, CRC(633d24f0) SHA1(26b25ec1014fba1a3d0d2bdba0c867c57034647d) ) - ROM_LOAD( "a-19.u93", 0x80000, 0x80000, CRC(bbf5c632) SHA1(9d31e136f014c2dd7dd988c3aee0adfcfea91bc9) ) + ROM_REGION( 0x100000, "gfx3", ROMREGION_INVERT) /* 8x8x8 Foreground */ + ROM_LOAD( "a-19.u92", 0x00000, 0x80000, CRC(633d24f0) SHA1(26b25ec1014fba1a3d0d2bdba0c867c57034647d) ) + ROM_LOAD( "a-19.u93", 0x80000, 0x80000, CRC(bbf5c632) SHA1(9d31e136f014c2dd7dd988c3aee0adfcfea91bc9) ) - ROM_REGION( 0x40000, "gfx4", ROMREGION_INVERT) /* 8x8x8 Midground */ - ROM_LOAD( "a-19.u110", 0x00000, 0x20000, CRC(9807a7e6) SHA1(30e2a741a93954cfe672c61c93a990d0c3b25145) ) - ROM_LOAD( "a-19.u111", 0x20000, 0x20000, CRC(bc9f93f0) SHA1(dd4cfc849a0c0f918ac0dfeb7f00a67aae5a1c13) ) + ROM_REGION( 0x40000, "gfx4", ROMREGION_INVERT) /* 8x8x8 Midground */ + ROM_LOAD( "a-19.u110", 0x00000, 0x20000, CRC(9807a7e6) SHA1(30e2a741a93954cfe672c61c93a990d0c3b25145) ) + ROM_LOAD( "a-19.u111", 0x20000, 0x20000, CRC(bc9f93f0) SHA1(dd4cfc849a0c0f918ac0dfeb7f00a67aae5a1c13) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "a-19.u85", 0x00000, 0x40000, CRC(bf3c3065) SHA1(54dd7ffea2fb3f31ed575e982b82691cddc2581a) ) + ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "a-19.u85", 0x00000, 0x40000, CRC(bf3c3065) SHA1(54dd7ffea2fb3f31ed575e982b82691cddc2581a) ) - ROM_REGION( 0x80000, "oki2", 0 ) /* Samples (banked) */ - ROM_LOAD( "a-19.u113", 0x00000, 0x80000, CRC(53de6025) SHA1(c94b3778b57ff7f46ce4cff661841019fb187d5d) ) + ROM_REGION( 0x80000, "oki2", 0 ) /* Samples (banked) */ + ROM_LOAD( "a-19.u113", 0x00000, 0x80000, CRC(53de6025) SHA1(c94b3778b57ff7f46ce4cff661841019fb187d5d) ) ROM_END ROM_START( paradisee ) /* YS-1600 PCB. All labels are simply labeled "Escape" */ - ROM_REGION( 0x40000, "maincpu", 0 ) /* Z80 Code */ - ROM_LOAD( "escape.U128", 0x00000, 0x40000, CRC(19b4e854) SHA1(7d7292017df67b7ed3a3e0059334866890c58b83) ) + ROM_REGION( 0x40000, "maincpu", 0 ) /* Z80 Code */ + ROM_LOAD( "escape.U128", 0x00000, 0x40000, CRC(19b4e854) SHA1(7d7292017df67b7ed3a3e0059334866890c58b83) ) - ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT) /* 16x16x8 Sprites */ - ROM_LOAD( "escape.u114", 0x00000, 0x40000, CRC(c748ba3b) SHA1(ad23bda4e001ca539f849c1ca256de5daf7c233b) ) - ROM_LOAD( "escape.u115", 0x40000, 0x40000, CRC(0d517bbb) SHA1(5bf7c5036f3d660901e26f14baaea1a3c0327dfe) ) + ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT) /* 16x16x8 Sprites */ + ROM_LOAD( "escape.u114", 0x00000, 0x40000, CRC(c748ba3b) SHA1(ad23bda4e001ca539f849c1ca256de5daf7c233b) ) + ROM_LOAD( "escape.u115", 0x40000, 0x40000, CRC(0d517bbb) SHA1(5bf7c5036f3d660901e26f14baaea1a3c0327dfe) ) - ROM_REGION( 0x20000, "gfx2", ROMREGION_INVERT) /* 8x8x4 Background */ - ROM_LOAD( "escape.u94", 0x00000, 0x20000, CRC(e3a99209) SHA1(5db79dc1a38d93b458b043499a58516285c65aa8) ) + ROM_REGION( 0x20000, "gfx2", ROMREGION_INVERT) /* 8x8x4 Background */ + ROM_LOAD( "escape.u94", 0x00000, 0x20000, CRC(e3a99209) SHA1(5db79dc1a38d93b458b043499a58516285c65aa8) ) - ROM_REGION( 0x100000, "gfx3", ROMREGION_INVERT) /* 8x8x8 Foreground */ - ROM_LOAD( "escape.u92", 0x00000, 0x80000, CRC(633d24f0) SHA1(26b25ec1014fba1a3d0d2bdba0c867c57034647d) ) - ROM_LOAD( "escape.u93", 0x80000, 0x80000, CRC(bbf5c632) SHA1(9d31e136f014c2dd7dd988c3aee0adfcfea91bc9) ) + ROM_REGION( 0x100000, "gfx3", ROMREGION_INVERT) /* 8x8x8 Foreground */ + ROM_LOAD( "escape.u92", 0x00000, 0x80000, CRC(633d24f0) SHA1(26b25ec1014fba1a3d0d2bdba0c867c57034647d) ) + ROM_LOAD( "escape.u93", 0x80000, 0x80000, CRC(bbf5c632) SHA1(9d31e136f014c2dd7dd988c3aee0adfcfea91bc9) ) - ROM_REGION( 0x40000, "gfx4", ROMREGION_INVERT) /* 8x8x8 Midground */ - ROM_LOAD( "escape.u110", 0x00000, 0x20000, CRC(9807a7e6) SHA1(30e2a741a93954cfe672c61c93a990d0c3b25145) ) - ROM_LOAD( "escape.u111", 0x20000, 0x20000, CRC(bc9f93f0) SHA1(dd4cfc849a0c0f918ac0dfeb7f00a67aae5a1c13) ) + ROM_REGION( 0x40000, "gfx4", ROMREGION_INVERT) /* 8x8x8 Midground */ + ROM_LOAD( "escape.u110", 0x00000, 0x20000, CRC(9807a7e6) SHA1(30e2a741a93954cfe672c61c93a990d0c3b25145) ) + ROM_LOAD( "escape.u111", 0x20000, 0x20000, CRC(bc9f93f0) SHA1(dd4cfc849a0c0f918ac0dfeb7f00a67aae5a1c13) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "escape.u85", 0x00000, 0x40000, CRC(bf3c3065) SHA1(54dd7ffea2fb3f31ed575e982b82691cddc2581a) ) + ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "escape.u85", 0x00000, 0x40000, CRC(bf3c3065) SHA1(54dd7ffea2fb3f31ed575e982b82691cddc2581a) ) - ROM_REGION( 0x80000, "oki2", 0 ) /* Samples (banked) */ - ROM_LOAD( "escape.u113", 0x00000, 0x80000, CRC(53de6025) SHA1(c94b3778b57ff7f46ce4cff661841019fb187d5d) ) + ROM_REGION( 0x80000, "oki2", 0 ) /* Samples (banked) */ + ROM_LOAD( "escape.u113", 0x00000, 0x80000, CRC(53de6025) SHA1(c94b3778b57ff7f46ce4cff661841019fb187d5d) ) ROM_END ROM_START( paradlx ) diff --git a/src/mame/drivers/pbaction.c b/src/mame/drivers/pbaction.c index 6c7daa53a91..5e28dda1937 100644 --- a/src/mame/drivers/pbaction.c +++ b/src/mame/drivers/pbaction.c @@ -84,8 +84,7 @@ WRITE8_MEMBER(pbaction_state::nmi_mask_w) } static ADDRESS_MAP_START( pbaction_map, AS_PROGRAM, 8, pbaction_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("work_ram") AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(pbaction_videoram2_w) AM_SHARE("videoram2") AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(pbaction_colorram2_w) AM_SHARE("colorram2") @@ -102,6 +101,11 @@ static ADDRESS_MAP_START( pbaction_map, AS_PROGRAM, 8, pbaction_state ) AM_RANGE(0xe800, 0xe800) AM_WRITE(pbaction_sh_command_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, pbaction_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("maincpu", 0x8000) +ADDRESS_MAP_END + static ADDRESS_MAP_START( pbaction_sound_map, AS_PROGRAM, 8, pbaction_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM @@ -312,6 +316,11 @@ static MACHINE_CONFIG_START( pbaction, pbaction_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( pbactionx, pbaction ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + /*************************************************************************** @@ -377,7 +386,7 @@ ROM_START( pbaction2 ) ROM_END ROM_START( pbaction3 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "14.bin", 0x0000, 0x4000, CRC(f17a62eb) SHA1(8dabfc0ad127c154c0293a65df32d52d57dd9755) ) ROM_LOAD( "12.bin", 0x4000, 0x4000, CRC(ec3c64c6) SHA1(6130b80606d717f95e219316c2d3fa0a1980ea1d) ) ROM_LOAD( "13.bin", 0x8000, 0x4000, CRC(c93c851e) SHA1(b41077708fce4ccbcecdeae32af8821ca5322e87) ) @@ -403,7 +412,7 @@ ROM_START( pbaction3 ) ROM_END ROM_START( pbaction4 ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "pinball_09.bin", 0x0000, 0x4000, CRC(c8e81ece) SHA1(04eafbd79263225f6c6fb5f04951b54179144f17) ) ROM_IGNORE(0x4000) ROM_LOAD( "pinball_10.bin", 0x4000, 0x8000, CRC(04b56c7c) SHA1(d09c22fd0235e1c6a9b1978ba69338bb1ae5667d) ) @@ -433,7 +442,7 @@ ROM_START( pbaction4 ) ROM_END ROM_START( pbaction5 ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "p16.bin", 0x0000, 0x4000, CRC(ad20b360) SHA1(91e3cdceb1c170580d926b2ed8359c3100f71b11) ) ROM_LOAD( "c15.bin", 0x4000, 0x4000, CRC(057acfe3) SHA1(49c184d7caea0c0e9f0d0e163f2ef42bb9aebf16) ) ROM_LOAD( "p14.bin", 0x8000, 0x2000, CRC(e7412d68) SHA1(e75731d9bea80e0dc09798dd46e3b947fdb54aaa) ) @@ -479,7 +488,7 @@ DRIVER_INIT_MEMBER(pbaction_state,pbactio3) } /* then do the standard Sega decryption */ - pbaction_decode(machine(), "maincpu"); + DRIVER_INIT_CALL(pbactio4); /* install a protection (?) workaround */ m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xc000, read8_delegate(FUNC(pbaction_state::pbactio3_prot_kludge_r),this) ); @@ -487,14 +496,36 @@ DRIVER_INIT_MEMBER(pbaction_state,pbactio3) DRIVER_INIT_MEMBER(pbaction_state,pbactio4) { + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa8,0xa0,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...0...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0x28,0xa0,0x20 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0x28,0xa0,0x20 } /* ...1...1...1...1 */ + }; + /* this one only has the Sega decryption */ - pbaction_decode(machine(), "maincpu"); + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); } -GAME( 1985, pbaction, 0, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pbaction2, pbaction, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pbaction3, pbaction, pbaction, pbaction, pbaction_state, pbactio3, ROT90, "Tehkan", "Pinball Action (set 3, encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pbaction4, pbaction, pbaction, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 4, encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pbaction5, pbaction, pbaction, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 5, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pbaction, 0, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pbaction2, pbaction, pbaction, pbaction, driver_device, 0, ROT90, "Tehkan", "Pinball Action (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pbaction3, pbaction, pbactionx, pbaction, pbaction_state, pbactio3, ROT90, "Tehkan", "Pinball Action (set 3, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pbaction4, pbaction, pbactionx, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 4, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pbaction5, pbaction, pbactionx, pbaction, pbaction_state, pbactio4, ROT90, "Tehkan", "Pinball Action (set 5, encrypted)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c index 3548c5b2580..c5e952f88eb 100644 --- a/src/mame/drivers/pengo.c +++ b/src/mame/drivers/pengo.c @@ -73,12 +73,14 @@ class pengo_state : public pacman_state { public: pengo_state(const machine_config &mconfig, device_type type, const char *tag) - : pacman_state(mconfig, type, tag) { } + : pacman_state(mconfig, type, tag), m_decrypted_opcodes(*this, "decrypted_opcodes") { } DECLARE_WRITE8_MEMBER(pengo_coin_counter_w); DECLARE_WRITE8_MEMBER(irq_mask_w); DECLARE_DRIVER_INIT(penta); DECLARE_DRIVER_INIT(pengo); INTERRUPT_GEN_MEMBER(vblank_irq); + + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; @@ -125,7 +127,7 @@ static ADDRESS_MAP_START( pengo_map, AS_PROGRAM, 8, pengo_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pacman_videoram_w) AM_SHARE("videoram") /* video and color RAM, scratchpad RAM, sprite codes */ AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pacman_colorram_w) AM_SHARE("colorram") - AM_RANGE(0x8800, 0x8fef) AM_RAM + AM_RANGE(0x8800, 0x8fef) AM_RAM AM_SHARE("mainram") AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x9000, 0x901f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x9020, 0x902f) AM_WRITEONLY AM_SHARE("spriteram2") @@ -144,6 +146,13 @@ static ADDRESS_MAP_START( pengo_map, AS_PROGRAM, 8, pengo_state ) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, pengo_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8800, 0x8fef) AM_RAM AM_SHARE("mainram") + AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_SHARE("spriteram") +ADDRESS_MAP_END + + static ADDRESS_MAP_START( jrpacmbl_map, AS_PROGRAM, 8, pengo_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(jrpacman_videoram_w) AM_SHARE("videoram") @@ -366,6 +375,7 @@ static MACHINE_CONFIG_START( pengo, pengo_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) MCFG_CPU_PROGRAM_MAP(pengo_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", pengo_state, vblank_irq) /* video hardware */ @@ -397,6 +407,7 @@ static MACHINE_CONFIG_DERIVED( jrpacmbl, pengo ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(jrpacmbl_map) + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) MCFG_VIDEO_START_OVERRIDE(pengo_state,jrpacman) MACHINE_CONFIG_END @@ -631,7 +642,29 @@ ROM_END DRIVER_INIT_MEMBER(pengo_state,pengo) { - pengo_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...0 */ + { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...1...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ + { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...0...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */ + { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ + { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...1...1...0 */ + { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); } @@ -677,14 +710,10 @@ DRIVER_INIT_MEMBER(pengo_state,penta) { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, /* ...1...1...0.... */ { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } /* ...1...1...1.... */ }; - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); - UINT8 *rom = memregion("maincpu")->base(); - int A; - space.set_decrypted_region(0x0000, 0x7fff, decrypt); + UINT8 *rom = memregion("maincpu")->base(); - for (A = 0x0000;A < 0x8000;A++) + for (int A = 0x0000;A < 0x8000;A++) { int i,j; UINT8 src; @@ -706,7 +735,7 @@ DRIVER_INIT_MEMBER(pengo_state,penta) /* now decode the opcodes */ /* pick the translation table from bits 4, 8 and 12 of the address */ i = ((A >> 4) & 1) + (((A >> 8) & 1) << 1) + (((A >> 12) & 1) << 2); - decrypt[A] = src ^ opcode_xortable[i][j]; + m_decrypted_opcodes[A] = src ^ opcode_xortable[i][j]; } } diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index 3649a493178..4ab389ab393 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -1622,12 +1622,12 @@ PayTable Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) BA 1 2 3 4 5 8 25 50 250 800 % Range: 93.8-95.8% Optimum: 97.8% Hit Frequency: 45.3% Programs Available: PP0021 - + NOTE: REQUIRES Progressive link which is not currently supported */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0021_723-703.u68", 0x00000, 0x10000, CRC(58f2a68b) SHA1(72c0a29016b17f7e308a9e9b2d724771b5e26560) ) /* Game Version: 723, Library Version: 703 */ - + ROM_REGION( 0x020000, "gfx1", 0 ) ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) @@ -2074,7 +2074,7 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ------------------------------------------------------------ P34A 1 2 2 3 5 9 15 25 200 250 800 % Range: 96.8-98.8% Optimum: 100.8% Hit Frequency: 45.3% - Programs Available: PP0057 + Programs Available: PP0057, X000057P */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0057_a47-a76.u68", 0x00000, 0x10000, CRC(44ebb68d) SHA1(4864ba62c225a3ecd576d1a82fcbe1e30d65244d) ) /* Game Version: A47, Library Version: A76 */ @@ -2096,7 +2096,7 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ------------------------------------------------------------ P34A 1 2 2 3 5 9 15 25 200 250 800 % Range: 96.8-98.8% Optimum: 100.8% Hit Frequency: 45.3% - Programs Available: PP0057 + Programs Available: PP0057, X000057P */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0057_540-508.u68", 0x00000, 0x8000, CRC(9a8281c2) SHA1(d411294062d7896a7f68a1c4a6295e18787dc7d6) ) /* Game Version: 540, Library Version: 508, Video Lib Ver: 508 */ @@ -3375,13 +3375,40 @@ ROM_START( pepp0250 ) /* Normal board : Double Down Stud Poker (PP0250) */ /* PayTable 6s-10s Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) ------------------------------------------------------------------ - ???? 1 2 3 4 6 6 12 50 200 1000 4000 + ???? 1 2 3 4 6 9 12 50 200 1000 4000 + % Range: 94.3-96.3% Optimum: 98.3% Hit Frequency: ??.?% + Programs Available: PP0250 + +NOTE: Newer version with DBV support and requires newer CG2015 instead of CG1019 +*/ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "pp0250_a1l-a23.u68", 0x00000, 0x10000, CRC(ae4f1fb8) SHA1(473d1acb8549f86b9da17f9fbbceafc3a3efc6fe) ) /* Game Version: A1L, Library Version: A23 */ + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "mro-cg2015.u72", 0x00000, 0x8000, CRC(7f73ee5c) SHA1(b6c5d423c8176555c1f32605c328ffbfcf94b656) ) /* Verified CG set for this version of PP0250 */ + ROM_LOAD( "mgo-cg2015.u73", 0x08000, 0x8000, CRC(de270e0e) SHA1(41b207f9380f623ab64dc42224275cccd43417ee) ) + ROM_LOAD( "mbo-cg2015.u74", 0x10000, 0x8000, CRC(02e623d9) SHA1(4c689293f5c5a8eb0b17861cf433ae1e01d83545) ) + ROM_LOAD( "mxo-cg2015.u75", 0x18000, 0x8000, CRC(0c96b7fc) SHA1(adde93f08db0b957daf77d57a7ab60af3b667f25) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) /* BPROM type DM74LS471 (compatible with N82S135N) verified */ +ROM_END + +ROM_START( pepp0250a ) /* Normal board : Double Down Stud Poker (PP0250) */ +/* +PayTable 6s-10s Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) +------------------------------------------------------------------ + ???? 1 2 3 4 6 9 12 50 200 1000 4000 + % Range: 94.3-96.3% Optimum: 98.3% Hit Frequency: ??.?% + Programs Available: PP0250 + +NOTE: No DBV option and requires CG1019 */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0250_733-778.u68", 0x00000, 0x10000, CRC(4c919598) SHA1(fe73503c6ccb3c5746fb96be58cd5b740c819713) ) /* Game Version: 733, Library Version: 778 */ ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD( "mro-cg1019.u72", 0x00000, 0x8000, CRC(9086dc3c) SHA1(639baef8a9b347015d21817d69265700ff205774) ) /* Verified CG set for PP0250 set */ + ROM_LOAD( "mro-cg1019.u72", 0x00000, 0x8000, CRC(9086dc3c) SHA1(639baef8a9b347015d21817d69265700ff205774) ) /* Verified CG set for this version of PP0250 */ ROM_LOAD( "mgo-cg1019.u73", 0x08000, 0x8000, CRC(fb538a19) SHA1(1ed480ebdf3ad210511e7e0a0dd4e28466219ae9) ) /* Superseded by CG2015 which also works */ ROM_LOAD( "mbo-cg1019.u74", 0x10000, 0x8000, CRC(493bf604) SHA1(9cbce26ed328e6878ec5f6531ea140e1c17e6753) ) ROM_LOAD( "mxo-cg1019.u75", 0x18000, 0x8000, CRC(064a5c80) SHA1(4d21a7a424258f74d4a1e78c123288799e316228) ) @@ -4739,7 +4766,15 @@ PayTable Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) ROM_LOAD( "cap904.u50", 0x0000, 0x0100, CRC(0eec8336) SHA1(a6585c978dbc2f4f3818e3a5b92f8c28be23c4c0) ) /* BPROM type N82S135N verified */ ROM_END -ROM_START( pepp0757 ) /* Normal board : Double Down Stud Joker Poker (PP0757) */ +ROM_START( pepp0757 ) /* Normal board : Double Down Stud Joker Poker (Eights or Better) (PP0757) */ +/* + w/J w/oJ +PayTable 8s+ 2P 3K STR FL FH 4K SF RF 5K RF (Bonus) +---------------------------------------------------------------- + ???? 1 2 3 6 9 15 60 100 400 1000 1000 2000 + % Range: 90.3-92.3% Optimum: 94.3% Hit Frequency: ??.?% + Programs Available: PP0757 +*/ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0757_a5v-a6d.u68", 0x00000, 0x10000, CRC(dcf3004f) SHA1(c095a874a8813f7100ec430e034530eeb93c4117) ) /* Game Version: A5V, Library Version: A6D */ @@ -4758,6 +4793,8 @@ ROM_START( pepp0760 ) /* Normal board : Double Down Stud Poker (PP0760) */ PayTable 8s-10s Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) ------------------------------------------------------------------ ???? 1 2 3 4 6 9 12 50 200 1000 4000 + % Range: 86.8-88.8% Optimum: 90.8% Hit Frequency: ??.?% + Programs Available: PP0760 */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "pp0760_a4v-a6d.u68", 0x00000, 0x10000, CRC(1c26076c) SHA1(612ac66bbb0827b81dc9c6bc23fa7558445481bc) ) /* Game Version: A4V, Library Version: A6D */ @@ -6553,6 +6590,31 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END +ROM_START( pex0057p ) /* Superboard : Deuces Wild Poker (X000057P+XP000038) */ +/* + w/D w/oD +PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) +------------------------------------------------------------ + P34A 1 2 2 3 5 9 15 25 200 250 800 + % Range: 96.8-98.8% Optimum: 100.8% Hit Frequency: 45.3% + Programs Available: PP0057, X000057P +*/ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "xp000038.u67", 0x00000, 0x10000, CRC(8707ab9e) SHA1(3e00a2ad8017e1495c6d6fe900d0efa68a1772b8) ) /* 09/05/95 @ IGT L95-2452 */ + + ROM_REGION( 0x10000, "user1", 0 ) + ROM_LOAD( "x000057p.u66", 0x00000, 0x10000, CRC(2046710a) SHA1(3fcc7c3069ea54d0e4982814aca1d7b327bb2074) ) /* Deuces Wild Poker - 05/04/95 @ IGT L95-1143 */ + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "mro-cg2185.u77", 0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) /* 07/10/95 @ IGT L95-1506 */ + ROM_LOAD( "mgo-cg2185.u78", 0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) ) + ROM_LOAD( "mbo-cg2185.u79", 0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) ) + ROM_LOAD( "mxo-cg2185.u80", 0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) ) + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) +ROM_END + ROM_START( pex0060p ) /* Superboard : Standard Draw Poker (X000060P+XP000038) */ /* PayTable Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) @@ -7247,7 +7309,7 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END -ROM_START( pex0514p ) /* Superboard : Double Double Bonus Poker (X000514P+XP000038) */ +ROM_START( pex0514p ) /* Superboard : Double Bonus Poker (X000514P+XP000038) */ /* 5-K 2-4 PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) @@ -7272,7 +7334,7 @@ PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END -ROM_START( pex0515p ) /* Superboard : Double Double Bonus Poker (X000515P+XP000038) */ +ROM_START( pex0515p ) /* Superboard : Double Bonus Poker (X000515P+XP000038) */ /* 5-K 2-4 PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) @@ -7297,12 +7359,12 @@ PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END -ROM_START( pex0516p ) /* Superboard : Double Double Bonus Poker (X000516P+XP000038) */ +ROM_START( pex0516p ) /* Superboard : Double Bonus Poker (X000516P+XP000038) */ /* 5-K 2-4 PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) ----------------------------------------------------------------- - P325A 1 2 3 4 5 8 50 80 160 50 250 800 + P325A 1 2 3 4 5 9 50 80 160 50 250 800 % Range: 93.8-95.8% Optimum: 97.8% Hit Frequency: 44.5% Programs Available: PP0516, X000516P & PP0540 - Non Double-up Only */ @@ -7778,6 +7840,33 @@ Straights or Better on the initial deal PAY DOUBLE! ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END +ROM_START( pex2024p ) /* Superboard : Double Bonus Poker (X002024P+XP000038) */ +/* + 5-K 2-4 +PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) +----------------------------------------------------------------- + P325A 1 2 3 4 5 9 50 80 160 50 250 800 + % Range: 93.8-95.8% Optimum: 97.8% Hit Frequency: 44.5% + Programs Available: X002024P + +NOTE: Same as X000516P, except MAX Coin (set to 5) CANNOT be changed +*/ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "xp000038.u67", 0x00000, 0x10000, CRC(8707ab9e) SHA1(3e00a2ad8017e1495c6d6fe900d0efa68a1772b8) ) /* 09/05/95 @ IGT L95-2452 */ + + ROM_REGION( 0x10000, "user1", 0 ) + ROM_LOAD( "x002024p.u66", 0x00000, 0x10000, CRC(8f9ab38c) SHA1(703f1f5c5ca1ab7032019e41da6ffac6fc47929a) ) /* Double Bonus Poker */ + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "mro-cg2185.u77", 0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) /* 07/10/95 @ IGT L95-1506 */ + ROM_LOAD( "mgo-cg2185.u78", 0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) ) + ROM_LOAD( "mbo-cg2185.u79", 0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) ) + ROM_LOAD( "mxo-cg2185.u80", 0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) ) + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) +ROM_END + ROM_START( pex2025p ) /* Superboard : Deuces Wild Bonus Poker (X002025P+XP000019) */ /* w/D 6-K 3-5 w/A w/oD @@ -9160,7 +9249,7 @@ PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END -ROM_START( pex2412p ) /* Superboard : Standard Draw with 5 decks (X002412P+XP000096) */ +ROM_START( pex2412p ) /* Superboard : Standard Draw with 5 decks - Two Pair or Better (X002412P+XP000096) */ /* % Range: 93.7-95.7% Optimum: 97.7% Hit Frequency: 44.6% Programs Available: X002412P @@ -9322,7 +9411,7 @@ ROM_START( pex2474p ) /* Superboard : Double Double Bonus Plus (X002474P+XP00003 QQQ55 88844 5-K 2-4 or with with PayTable Js+ 2PR 3K STR FL FH KKK55 TTT55 4K 4K 44422 4A A,2-4 2-4 SF RF (Bonus) -------------------------------------------------------------------------------------------------- - P505A 1 1 3 4 5 7 25 25 50 80 85 160 160 400 50 250 800 + ???? 1 1 3 4 5 7 25 25 50 80 85 160 160 400 50 250 800 % Range: 94.1-96.1% Optimum: 98.1% Hit Frequency: 44.8% Programs Available: X002474P @@ -10428,7 +10517,8 @@ GAMEL(1987, pepp0224a, pepp0055, peplus, peplus_poker, peplus_state, peplus, GAMEL(1987, pepp0230, pepp0002, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0230) Standard Draw Poker", 0, layout_pe_poker ) GAMEL(1987, pepp0242, pepp0055, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0242) Deuces Wild Poker (International English/Spanish)", 0, layout_pe_poker ) GAMEL(1987, pepp0249, pepp0055, peplus, peplus_poker, peplus_state, nonplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0249) Deuces Wild Poker", 0, layout_pe_poker ) -GAMEL(1987, pepp0250, 0, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0250) Double Down Stud Poker", 0, layout_pe_poker ) +GAMEL(1987, pepp0250, 0, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0250) Double Down Stud Poker (set 1)", 0, layout_pe_poker ) +GAMEL(1987, pepp0250a, pepp0250, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0250) Double Down Stud Poker (set 2)", 0, layout_pe_poker ) GAMEL(1987, pepp0265, pepp0158, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0265) 4 of a Kind Bonus Poker (set 1)", 0, layout_pe_poker ) GAMEL(1987, pepp0265a, pepp0158, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0265) 4 of a Kind Bonus Poker (set 2)", 0, layout_pe_poker ) GAMEL(1987, pepp0265b, pepp0158, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0265) 4 of a Kind Bonus Poker (International)", 0, layout_pe_poker ) @@ -10588,6 +10678,7 @@ GAMEL(1995, pex0055po, pex0055p, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex0055pp, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000104) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pq, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000112) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pr, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000126) Deuces Wild Poker", 0, layout_pe_poker ) +GAMEL(1995, pex0057p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000057P+XP000038) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0060p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000060P+XP000038) Standard Draw Poker", 0, layout_pe_poker ) GAMEL(1995, pex0124p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000124P+XP000053) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0150p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000150P+XP000038) Standard Draw Poker", 0, layout_pe_poker ) @@ -10637,6 +10728,7 @@ GAMEL(1995, pex2016p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex2017p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002017P+XP000038) Full House Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2018p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002018P+XP000038) Full House Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2021p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002021P+XP000112) Lucky Deal Poker", 0, layout_pe_poker ) +GAMEL(1995, pex2024p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002024P+XP000038) Double Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2025p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002025P+XP000019) Deuces Wild Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2026p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002026P+XP000019) Deuces Wild Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2027p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002027P+XP000019) Deuces Wild Bonus Poker", 0, layout_pe_poker ) @@ -10690,7 +10782,7 @@ GAMEL(1995, pex2314p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(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 ) GAMEL(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 ) GAMEL(1995, pex2386p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002386P+XP000038) 4 of a Kind Bonus Poker", 0,layout_pe_poker ) -GAMEL(1995, pex2412p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002412P+XP000096) Standard Draw Poker (5 Decks)", 0, layout_pe_poker ) +GAMEL(1995, pex2412p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002412P+XP000096) Standard Draw with 5 decks (Two Pair or Better)", 0, layout_pe_poker ) GAMEL(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 ) GAMEL(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 ) GAMEL(1995, pex2421p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002421P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker ) diff --git a/src/mame/drivers/pktgaldx.c b/src/mame/drivers/pktgaldx.c index c29d8089f28..7dd4af0c82b 100644 --- a/src/mame/drivers/pktgaldx.c +++ b/src/mame/drivers/pktgaldx.c @@ -109,6 +109,10 @@ static ADDRESS_MAP_START( pktgaldx_map, AS_PROGRAM, 16, pktgaldx_state ) AM_RANGE(0x170000, 0x17ffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, pktgaldx_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + /* Pocket Gal Deluxe (bootleg!) */ @@ -320,6 +324,7 @@ static MACHINE_CONFIG_START( pktgaldx, pktgaldx_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 14000000) MCFG_CPU_PROGRAM_MAP(pktgaldx_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", pktgaldx_state, irq6_line_hold) @@ -474,7 +479,7 @@ ROM_END DRIVER_INIT_MEMBER(pktgaldx_state,pktgaldx) { deco56_decrypt_gfx(machine(), "gfx1"); - deco102_decrypt_cpu(machine(), "maincpu", 0x42ba, 0x00, 0x00); + deco102_decrypt_cpu((UINT16 *)memregion("maincpu")->base(), m_decrypted_opcodes, 0x80000, 0x42ba, 0x00, 0x00); } GAME( 1992, pktgaldx, 0, pktgaldx, pktgaldx, pktgaldx_state, pktgaldx, ROT0, "Data East Corporation", "Pocket Gal Deluxe (Euro v3.00)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index de3714e9768..eceb82dbefd 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -314,30 +314,6 @@ READ16_MEMBER(polygonet_state::dsp56k_bootload_r) return 0x7fff; } -DIRECT_UPDATE_MEMBER(polygonet_state::plygonet_dsp56k_direct_handler) -{ - /* Call the dsp's update handler first */ - if (!m_dsp56k_update_handler.isnull()) - { - if (m_dsp56k_update_handler(direct, address) == ~0) - return ~0; - } - - /* If the requested region wasn't in there, see if it needs to be caught driver-side */ - if (address >= (0x7000<<1) && address <= (0x7fff<<1)) - { - direct.explicit_configure(0x7000<<1, 0x7fff<<1, (0xfff<<1) | 1, m_dsp56k_p_mirror); - return ~0; - } - else if (address >= (0x8000<<1) && address <= (0x87ff<<1)) - { - direct.explicit_configure(0x8000<<1, 0x87ff<<1, (0x7ff<<1) | 1, m_dsp56k_p_8000); - return ~0; - } - - return address; -} - /* The dsp56k's Port C Data register (0xffe3) : Program code (function 4e) configures it as general purpose output I/O pins (ffc1 = 0000 & ffc3 = 0fff). @@ -756,10 +732,6 @@ DRIVER_INIT_MEMBER(polygonet_state,polygonet) memset(m_dsp56k_bank02_ram, 0, sizeof(m_dsp56k_bank02_ram)); memset(m_dsp56k_shared_ram_16, 0, sizeof(m_dsp56k_shared_ram_16)); memset(m_dsp56k_bank04_ram, 0, sizeof(m_dsp56k_bank04_ram)); - - /* The dsp56k occasionally executes out of mapped memory */ - address_space &space = machine().device<dsp56k_device>("dsp")->space(AS_PROGRAM); - m_dsp56k_update_handler = space.set_direct_update_handler(direct_update_delegate(FUNC(polygonet_state::plygonet_dsp56k_direct_handler), this)); } diff --git a/src/mame/drivers/raiden.c b/src/mame/drivers/raiden.c index 2ffeb0a93d6..dcc96275db7 100644 --- a/src/mame/drivers/raiden.c +++ b/src/mame/drivers/raiden.c @@ -301,7 +301,11 @@ static MACHINE_CONFIG_START( raiden, raiden_state ) SEIBU_SOUND_SYSTEM_YM3812_RAIDEN_INTERFACE(XTAL_14_31818MHz/4,XTAL_12MHz/12) // frequency and pin 7 verified (pin set in audio\seibu.h) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( raidenu, raiden ) +static MACHINE_CONFIG_DERIVED( raidene, raiden ) + SEIBU_SOUND_SYSTEM_ENCRYPTED_FULL() +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( raidenu, raidene ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -616,7 +620,6 @@ void raiden_state::common_decrypt() DRIVER_INIT_MEMBER(raiden_state,raiden) { common_decrypt(); - m_seibu_sound->decrypt("audiocpu",0x20000); } DRIVER_INIT_MEMBER(raiden_state,raidenk) @@ -626,17 +629,16 @@ DRIVER_INIT_MEMBER(raiden_state,raidenk) DRIVER_INIT_MEMBER(raiden_state,raidenu) { - m_seibu_sound->decrypt("audiocpu",0x20000); } /***************************************************************************/ /* Same PCB, differ by region byte(s) */ -GAME( 1990, raiden, 0, raiden, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu", "Raiden (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1990, raidena, raiden, raiden, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu", "Raiden (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1990, raidenu, raiden, raiden, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden (US set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1990, raident, raiden, raiden, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu (Liang HWA Electronics license)", "Raiden (Taiwan)", GAME_SUPPORTS_SAVE ) +GAME( 1990, raiden, 0, raidene, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu", "Raiden (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1990, raidena, raiden, raidene, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu", "Raiden (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1990, raidenu, raiden, raidene, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden (US set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1990, raident, raiden, raidene, raiden, raiden_state, raiden, ROT270, "Seibu Kaihatsu (Liang HWA Electronics license)", "Raiden (Taiwan)", GAME_SUPPORTS_SAVE ) /* Same as above, but the sound CPU code is not encrypted */ GAME( 1990, raidenk, raiden, raiden, raiden, raiden_state, raidenk, ROT270, "Seibu Kaihatsu (IBL Corporation license)", "Raiden (Korea)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/rocnrope.c b/src/mame/drivers/rocnrope.c index 16c5fd25116..cd39c4af89e 100644 --- a/src/mame/drivers/rocnrope.c +++ b/src/mame/drivers/rocnrope.c @@ -199,7 +199,7 @@ INTERRUPT_GEN_MEMBER(rocnrope_state::vblank_irq) static MACHINE_CONFIG_START( rocnrope, rocnrope_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK / 3 / 4) /* Verified in schematics */ + MCFG_CPU_ADD("maincpu", KONAMI1, MASTER_CLOCK / 3 / 4) /* Verified in schematics */ MCFG_CPU_PROGRAM_MAP(rocnrope_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", rocnrope_state, vblank_irq) @@ -356,14 +356,11 @@ ROM_END DRIVER_INIT_MEMBER(rocnrope_state,rocnrope) { - UINT8 *decrypted = konami1_decode(machine(), "maincpu"); - - decrypted[0x703d] = 0x98; /* fix one instruction */ + memregion("maincpu")->base()[0x703d] = 0x98^0x88; /* fix one instruction */ } DRIVER_INIT_MEMBER(rocnrope_state,rocnropk) { - konami1_decode(machine(), "maincpu"); } diff --git a/src/mame/drivers/rohga.c b/src/mame/drivers/rohga.c index a49de5c47a3..8f423eb1ea8 100644 --- a/src/mame/drivers/rohga.c +++ b/src/mame/drivers/rohga.c @@ -1454,7 +1454,9 @@ ROM_START( wizdfire ) ROM_LOAD16_BYTE( "mas09", 0x000000, 0x080000, CRC(5f6deb41) SHA1(850d0e157b4355e866ec770a2012293b2c55648f) ) ROM_REGION(0x100000, "oki1", 0 ) /* Oki samples */ - ROM_LOAD( "mas10", 0x00000, 0x100000, CRC(f4b4c8a1) SHA1(c9e80c55e42a78e358b6b14dadc3be7b28bd5d62) ) + // hack, sample banks 0/1 are used for the Japanese version and 2/3 are used for the English version, I can't find the bankswitch, so swap the halves. + ROM_LOAD( "mas10", 0x80000, 0x80000, CRC(f4b4c8a1) SHA1(c9e80c55e42a78e358b6b14dadc3be7b28bd5d62) ) + ROM_CONTINUE(0x00000, 0x80000) ROM_REGION(0x080000, "oki2", 0 ) /* Oki samples */ ROM_LOAD( "mas11", 0x00000, 0x080000, CRC(c2f0a4f2) SHA1(af71d649aea273c17d7fbcf8693e8a1d4b31f7f8) ) @@ -1498,7 +1500,9 @@ ROM_START( wizdfireu ) ROM_LOAD16_BYTE( "mas09", 0x000000, 0x080000, CRC(5f6deb41) SHA1(850d0e157b4355e866ec770a2012293b2c55648f) ) ROM_REGION(0x100000, "oki1", 0 ) /* Oki samples */ - ROM_LOAD( "mas10", 0x00000, 0x100000, CRC(f4b4c8a1) SHA1(c9e80c55e42a78e358b6b14dadc3be7b28bd5d62) ) + // hack, sample banks 0/1 are used for the Japanese version and 2/3 are used for the English version, I can't find the bankswitch, so swap the halves + ROM_LOAD( "mas10", 0x80000, 0x80000, CRC(f4b4c8a1) SHA1(c9e80c55e42a78e358b6b14dadc3be7b28bd5d62) ) + ROM_CONTINUE(0x00000, 0x80000) ROM_REGION(0x080000, "oki2", 0 ) /* Oki samples */ ROM_LOAD( "mas11", 0x00000, 0x080000, CRC(c2f0a4f2) SHA1(af71d649aea273c17d7fbcf8693e8a1d4b31f7f8) ) diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index b2fcac39f6e..8ba70c82847 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -132,9 +132,10 @@ public: UINT8 m_flip_screen; DECLARE_WRITE8_MEMBER(royalmah_palbank_w); + DECLARE_WRITE8_MEMBER(royalmah_rom_w); + DECLARE_WRITE8_MEMBER(tahjong_bank_w); DECLARE_WRITE8_MEMBER(mjderngr_coin_w); DECLARE_WRITE8_MEMBER(mjderngr_palbank_w); - DECLARE_WRITE8_MEMBER(royalmah_rom_w); DECLARE_WRITE8_MEMBER(input_port_select_w); DECLARE_READ8_MEMBER(majs101b_dsw_r); DECLARE_READ8_MEMBER(suzume_dsw_r); @@ -404,6 +405,21 @@ READ8_MEMBER(royalmah_state::suzume_dsw_r) } } +WRITE8_MEMBER(royalmah_state::tahjong_bank_w) +{ + UINT8 *rom = memregion("maincpu")->base(); + int address; + +logerror("%04x: bank %02x\n",space.device().safe_pc(),data); + + data &= 0x01; + + address = 0x10000 + data * 0x4000; + + membank("bank1")->set_base(&rom[address]); +} + + WRITE8_MEMBER(royalmah_state::suzume_bank_w) { UINT8 *rom = memregion("maincpu")->base(); @@ -541,7 +557,6 @@ static ADDRESS_MAP_START( royalmah_map, AS_PROGRAM, 8, royalmah_state ) AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram") ADDRESS_MAP_END - static ADDRESS_MAP_START( mjapinky_map, AS_PROGRAM, 8, royalmah_state ) AM_RANGE( 0x0000, 0x6fff ) AM_ROM AM_WRITE(royalmah_rom_w ) AM_RANGE( 0x7000, 0x77ff ) AM_RAM AM_SHARE("nvram") @@ -551,6 +566,13 @@ static ADDRESS_MAP_START( mjapinky_map, AS_PROGRAM, 8, royalmah_state ) AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram") ADDRESS_MAP_END +static ADDRESS_MAP_START( tahjong_map, AS_PROGRAM, 8, royalmah_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_ROM AM_WRITE(royalmah_rom_w ) + AM_RANGE( 0x4000, 0x6fff ) AM_ROMBANK( "bank1" ) AM_WRITE(royalmah_rom_w ) + AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram") + AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram") +ADDRESS_MAP_END + @@ -572,6 +594,16 @@ static ADDRESS_MAP_START( ippatsu_iomap, AS_IO, 8, royalmah_state ) AM_RANGE( 0x13, 0x13 ) AM_READ_PORT("DSW3") ADDRESS_MAP_END +static ADDRESS_MAP_START( tahjong_iomap, AS_IO, 8, royalmah_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x01, 0x01 ) AM_DEVREAD("aysnd", ay8910_device, data_r) + AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) + AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE(royalmah_palbank_w ) + AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE(input_port_select_w ) + AM_RANGE( 0x12, 0x12 ) AM_WRITE(tahjong_bank_w) + AM_RANGE( 0x13, 0x13 ) AM_READ_PORT("DSW2") +ADDRESS_MAP_END + static ADDRESS_MAP_START( suzume_iomap, AS_IO, 8, royalmah_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE( 0x01, 0x01 ) AM_DEVREAD("aysnd", ay8910_device, data_r) @@ -676,7 +708,6 @@ static ADDRESS_MAP_START( mjapinky_iomap, AS_IO, 8, royalmah_state ) AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE(input_port_select_w ) ADDRESS_MAP_END - static ADDRESS_MAP_START( janoh_map, AS_PROGRAM, 8, royalmah_state ) AM_RANGE( 0x0000, 0x6fff ) AM_ROM AM_WRITE(royalmah_rom_w ) AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram") @@ -1415,6 +1446,58 @@ static INPUT_PORTS_START( royalmah ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( tahjong ) + PORT_INCLUDE( mjctrl1 ) + + PORT_MODIFY("KEY5") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // "COIN2" + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // "COIN1", but not working + + PORT_START("DSW1") // port $10 + PORT_DIPNAME( 0x07, 0x07, "SWB:1,2,3" ) PORT_DIPLOCATION("SWB:1,2,3") // only with bets on + PORT_DIPSETTING( 0x00, "0" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "5 (6)" ) + PORT_DIPSETTING( 0x07, "5 (7)" ) + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SWB:4") + PORT_DIPUNKNOWN_DIPLOC(0x10, 0x10, "SWB:5") + PORT_DIPNAME( 0x60, 0x60, "Winnings" ) PORT_DIPLOCATION("SWB:6,7") + PORT_DIPSETTING( 0x40, "30 30 10 10 5 5 1 1" ) + PORT_DIPSETTING( 0x20, "32 24 16 12 8 4 2 1" ) + PORT_DIPSETTING( 0x60, "100 50 30 10 5 4 3 2" ) + PORT_DIPSETTING( 0x00, "200 50 30 10 5 4 3 2" ) + PORT_DIPUNKNOWN_DIPLOC(0x80, 0x80, "SWB:8") + + PORT_START("DSW2") // port $13 + PORT_DIPNAME( 0x07, 0x07, "Pay Out Rate" ) PORT_DIPLOCATION("SWA:1,2,3") + PORT_DIPSETTING( 0x00, "50%" ) + PORT_DIPSETTING( 0x04, "62%" ) + PORT_DIPSETTING( 0x02, "68%" ) + PORT_DIPSETTING( 0x06, "71%" ) + PORT_DIPSETTING( 0x01, "75%" ) + PORT_DIPSETTING( 0x05, "78%" ) + PORT_DIPSETTING( 0x03, "81%" ) + PORT_DIPSETTING( 0x07, "90%" ) + PORT_DIPNAME( 0x18, 0x18, "Maximum Bet" ) PORT_DIPLOCATION("SWA:4,5") + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x08, "5" ) + PORT_DIPSETTING( 0x10, "10" ) + PORT_DIPSETTING( 0x18, "20" ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:6") + PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x40, 0x40, "Allow Bets" ) PORT_DIPLOCATION("SWA:7") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x80, 0x80, "Note Rate" ) PORT_DIPLOCATION("SWA:8") + PORT_DIPSETTING( 0x00, "5" ) + PORT_DIPSETTING( 0x80, "10" ) +INPUT_PORTS_END + static INPUT_PORTS_START( janyoup2 ) PORT_INCLUDE( royalmah ) @@ -3280,6 +3363,13 @@ static MACHINE_CONFIG_DERIVED( dondenmj, royalmah ) MCFG_CPU_IO_MAP(dondenmj_iomap) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( tahjong, royalmah ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(8000000/2) /* 4 MHz ? */ + MCFG_CPU_PROGRAM_MAP(tahjong_map) + MCFG_CPU_IO_MAP(tahjong_iomap) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( makaijan, royalmah ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_CLOCK(8000000/2) /* 4 MHz ? */ @@ -3509,6 +3599,22 @@ ROM_START( openmj ) ROM_LOAD( "82s123.prm", 0x00, 0x20, CRC(d3007282) SHA1(e4d863ab193e49208ed0f59dcddb1da0492314f6) ) ROM_END +ROM_START( tahjong ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "p1.bin", 0x00000, 0x1000, CRC(49c922b3) SHA1(6672a4f739d428b722ab22e7ca93064211557abc) ) + ROM_LOAD( "p2.bin", 0x01000, 0x1000, CRC(c33e3cc3) SHA1(707c437f180ddd2916b5806f208e0a478207d528) ) + ROM_LOAD( "p3.bin", 0x02000, 0x1000, CRC(9e741a74) SHA1(6c8e8eb04331d48b72e2be270c13dbf8deb76005) ) + ROM_LOAD( "p4.bin", 0x03000, 0x1000, CRC(dc6ae62b) SHA1(d0c51047f734c885b7f19972c1bf0408199fde51) ) + ROM_LOAD( "p5.bin", 0x04000, 0x1000, CRC(cc9123a3) SHA1(75276045247a0c9ac5810be01f3b58ad63101f9b) ) // same as royalmj (unused) + ROM_LOAD( "p6.bin", 0x05000, 0x1000, CRC(92150a0f) SHA1(5c97ba5014abdba4afc78e02e7d90e6ca4d777ac) ) // "" + + ROM_LOAD( "s1.bin", 0x10000, 0x4000, CRC(beff21af) SHA1(4dc40a1ac4e36401b1ad8ae3954af6e5001e0a67) ) + ROM_LOAD( "s2.bin", 0x14000, 0x4000, CRC(fed42e7c) SHA1(31136dff07bd1883dc2d107823ba83a34abf003d) ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "18s030n.6k", 0x0000, 0x0020, NO_DUMP ) +ROM_END + ROM_START( janputer ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "1.bin", 0x0000, 0x2000, CRC(f36f4222) SHA1(ce18c273a59f86cb17ea6ba8a3daefc3d750df1e) ) @@ -4800,40 +4906,41 @@ DRIVER_INIT_MEMBER(royalmah_state,janptr96) machine().device<nvram_device>("nvram")->set_base(m_janptr96_nvram, 0x1000 * 9); } -GAME( 1981, royalmj, 0, royalmah, royalmah, driver_device, 0, ROT0, "Nichibutsu", "Royal Mahjong (Japan, v1.13)", 0 ) -GAME( 1981?, openmj, royalmj, royalmah, royalmah, driver_device, 0, ROT0, "Sapporo Mechanic", "Open Mahjong [BET] (Japan)", 0 ) -GAME( 1982, royalmah, royalmj, royalmah, royalmah, driver_device, 0, ROT0, "bootleg", "Royal Mahjong (Falcon bootleg, v1.01)", 0 ) -GAME( 1983, janyoup2, royalmj, ippatsu, janyoup2, driver_device, 0, ROT0, "Cosmo Denshi", "Janyou Part II (ver 7.03, July 1 1983)",0 ) -GAME( 1981, janputer, 0, royalmah, royalmah, driver_device, 0, ROT0, "bootleg (Public Software Ltd. / Mes)", "New Double Bet Mahjong (bootleg of Janputer)", 0 ) // the original Janputer (Sanritsu) is not yet dumped -GAME( 1984, janoh, 0, royalmah, royalmah, driver_device, 0, ROT0, "Toaplan", "Jan Oh (set 1)", GAME_NOT_WORKING ) -GAME( 1984, janoha, janoh, janoh, royalmah, driver_device, 0, ROT0, "Toaplan", "Jan Oh (set 2)", GAME_NOT_WORKING ) // this one is complete? -GAME( 1985, jansou, 0, jansou, jansou, driver_device, 0, ROT0, "Dyna", "Jansou (set 1)", GAME_NOT_WORKING|GAME_NO_SOUND ) -GAME( 1985, jansoua, jansou, jansou, jansou, driver_device, 0, ROT0, "Dyna", "Jansou (set 2)", 0 ) -GAME( 1986, dondenmj, 0, dondenmj, majs101b, driver_device, 0, ROT0, "Dyna Electronics", "Don Den Mahjong [BET] (Japan)", 0 ) -GAME( 1986, ippatsu, 0, ippatsu, ippatsu, royalmah_state, ippatsu, ROT0, "Public Software / Paradais", "Ippatsu Gyakuten [BET] (Japan)", 0 ) -GAME( 1986, suzume, 0, suzume, suzume, driver_device, 0, ROT0, "Dyna Electronics", "Watashiha Suzumechan (Japan)", 0 ) -GAME( 1986, mjsiyoub, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco", "Mahjong Shiyou (Japan)", GAME_NOT_WORKING ) -GAME( 1986, mjsenka, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco", "Mahjong Senka (Japan)", GAME_NOT_WORKING ) -GAME( 1986, mjyarou, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco / Video System", "Mahjong Yarou [BET] (Japan)", GAME_NOT_WORKING ) -GAME( 1986?, mjclub, 0, mjclub, mjclub, driver_device, 0, ROT0, "Xex", "Mahjong Club [BET] (Japan)", 0 ) -GAME( 1987, mjdiplob, 0, mjdiplob, mjdiplob, driver_device, 0, ROT0, "Dynax", "Mahjong Diplomat [BET] (Japan)", 0 ) -GAME( 1987, tontonb, 0, tontonb, tontonb, driver_device, 0, ROT0, "Dynax", "Tonton [BET] (Japan set 1)", 0 ) -GAME( 1987, makaijan, 0, makaijan, makaijan, driver_device, 0, ROT0, "Dynax", "Makaijan [BET] (Japan)", 0 ) -GAME( 1988, majs101b, 0, majs101b, majs101b, driver_device, 0, ROT0, "Dynax", "Mahjong Studio 101 [BET] (Japan)", 0 ) -GAME( 1988, mjapinky, 0, mjapinky, mjapinky, driver_device, 0, ROT0, "Dynax", "Almond Pinky [BET] (Japan)", 0 ) -GAME( 1989, mjdejavu, 0, mjdejavu, mjdejavu, driver_device, 0, ROT0, "Dynax", "Mahjong Shinkirou Deja Vu (Japan)", 0 ) -GAME( 1989, mjdejav2, mjdejavu, mjdejavu, mjdejavu, driver_device, 0, ROT0, "Dynax", "Mahjong Shinkirou Deja Vu 2 (Japan)", 0 ) -GAME( 1989, mjderngr, 0, mjderngr, mjderngr, driver_device, 0, ROT0, "Dynax", "Mahjong Derringer (Japan)", 0 ) -GAME( 1989, daisyari, 0, daisyari, daisyari, driver_device, 0, ROT0, "Best System", "Daisyarin [BET] (Japan)", 0 ) -GAME( 1990, mjifb, 0, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET]", 0 ) -GAME( 1990, mjifb2, mjifb, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET](2921)", 0 ) -GAME( 1990, mjifb3, mjifb, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET](2931)", 0 ) -GAME( 1991, mjvegasa, 0, mjvegasa, mjvegasa, driver_device, 0, ROT0, "Dynax", "Mahjong Vegas (Japan, unprotected)", 0 ) -GAME( 1991, mjvegas, mjvegasa, mjvegasa, mjvegasa, driver_device, 0, ROT0, "Dynax", "Mahjong Vegas (Japan)", GAME_NOT_WORKING ) -GAME( 1992, cafetime, 0, cafetime, cafetime, driver_device, 0, ROT0, "Dynax", "Mahjong Cafe Time", 0 ) -GAME( 1993, cafedoll, 0, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong Cafe Doll (Japan)", GAME_NOT_WORKING ) -GAME( 1995, mjtensin, 0, mjtensin, mjtensin, driver_device, 0, ROT0, "Dynax", "Mahjong Tensinhai (Japan)", GAME_NOT_WORKING ) +GAME( 1981, royalmj, 0, royalmah, royalmah, driver_device, 0, ROT0, "Nichibutsu", "Royal Mahjong (Japan, v1.13)", 0 ) +GAME( 1981?, openmj, royalmj, royalmah, royalmah, driver_device, 0, ROT0, "Sapporo Mechanic", "Open Mahjong [BET] (Japan)", 0 ) +GAME( 1982, royalmah, royalmj, royalmah, royalmah, driver_device, 0, ROT0, "bootleg", "Royal Mahjong (Falcon bootleg, v1.01)", 0 ) +GAME( 1983, janyoup2, royalmj, ippatsu, janyoup2, driver_device, 0, ROT0, "Cosmo Denshi", "Janyou Part II (ver 7.03, July 1 1983)",0 ) +GAME( 1985, tahjong, royalmj, tahjong, tahjong, driver_device, 0, ROT0, "Bally Pond / Nasco", "Tahjong Yakitori (ver. 2-1)", GAME_WRONG_COLORS ) // 1985 Jun. 17 +GAME( 1981, janputer, 0, royalmah, royalmah, driver_device, 0, ROT0, "bootleg (Public Software Ltd. / Mes)", "New Double Bet Mahjong (bootleg of Janputer)", 0 ) // the original Janputer (Sanritsu) is not yet dumped +GAME( 1984, janoh, 0, royalmah, royalmah, driver_device, 0, ROT0, "Toaplan", "Jan Oh (set 1)", GAME_NOT_WORKING ) +GAME( 1984, janoha, janoh, janoh, royalmah, driver_device, 0, ROT0, "Toaplan", "Jan Oh (set 2)", GAME_NOT_WORKING ) // this one is complete? +GAME( 1985, jansou, 0, jansou, jansou, driver_device, 0, ROT0, "Dyna", "Jansou (set 1)", GAME_NOT_WORKING|GAME_NO_SOUND ) +GAME( 1985, jansoua, jansou, jansou, jansou, driver_device, 0, ROT0, "Dyna", "Jansou (set 2)", 0 ) +GAME( 1986, dondenmj, 0, dondenmj, majs101b, driver_device, 0, ROT0, "Dyna Electronics", "Don Den Mahjong [BET] (Japan)", 0 ) +GAME( 1986, ippatsu, 0, ippatsu, ippatsu, royalmah_state, ippatsu, ROT0, "Public Software / Paradais", "Ippatsu Gyakuten [BET] (Japan)", 0 ) +GAME( 1986, suzume, 0, suzume, suzume, driver_device, 0, ROT0, "Dyna Electronics", "Watashiha Suzumechan (Japan)", 0 ) +GAME( 1986, mjsiyoub, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco", "Mahjong Shiyou (Japan)", GAME_NOT_WORKING ) +GAME( 1986, mjsenka, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco", "Mahjong Senka (Japan)", GAME_NOT_WORKING ) +GAME( 1986, mjyarou, 0, royalmah, royalmah, driver_device, 0, ROT0, "Visco / Video System", "Mahjong Yarou [BET] (Japan)", GAME_NOT_WORKING ) +GAME( 1986?, mjclub, 0, mjclub, mjclub, driver_device, 0, ROT0, "Xex", "Mahjong Club [BET] (Japan)", 0 ) +GAME( 1987, mjdiplob, 0, mjdiplob, mjdiplob, driver_device, 0, ROT0, "Dynax", "Mahjong Diplomat [BET] (Japan)", 0 ) +GAME( 1987, tontonb, 0, tontonb, tontonb, driver_device, 0, ROT0, "Dynax", "Tonton [BET] (Japan set 1)", 0 ) +GAME( 1987, makaijan, 0, makaijan, makaijan, driver_device, 0, ROT0, "Dynax", "Makaijan [BET] (Japan)", 0 ) +GAME( 1988, majs101b, 0, majs101b, majs101b, driver_device, 0, ROT0, "Dynax", "Mahjong Studio 101 [BET] (Japan)", 0 ) +GAME( 1988, mjapinky, 0, mjapinky, mjapinky, driver_device, 0, ROT0, "Dynax", "Almond Pinky [BET] (Japan)", 0 ) +GAME( 1989, mjdejavu, 0, mjdejavu, mjdejavu, driver_device, 0, ROT0, "Dynax", "Mahjong Shinkirou Deja Vu (Japan)", 0 ) +GAME( 1989, mjdejav2, mjdejavu, mjdejavu, mjdejavu, driver_device, 0, ROT0, "Dynax", "Mahjong Shinkirou Deja Vu 2 (Japan)", 0 ) +GAME( 1989, mjderngr, 0, mjderngr, mjderngr, driver_device, 0, ROT0, "Dynax", "Mahjong Derringer (Japan)", 0 ) +GAME( 1989, daisyari, 0, daisyari, daisyari, driver_device, 0, ROT0, "Best System", "Daisyarin [BET] (Japan)", 0 ) +GAME( 1990, mjifb, 0, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET]", 0 ) +GAME( 1990, mjifb2, mjifb, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET](2921)", 0 ) +GAME( 1990, mjifb3, mjifb, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong If...? [BET](2931)", 0 ) +GAME( 1991, mjvegasa, 0, mjvegasa, mjvegasa, driver_device, 0, ROT0, "Dynax", "Mahjong Vegas (Japan, unprotected)", 0 ) +GAME( 1991, mjvegas, mjvegasa, mjvegasa, mjvegasa, driver_device, 0, ROT0, "Dynax", "Mahjong Vegas (Japan)", GAME_NOT_WORKING ) +GAME( 1992, cafetime, 0, cafetime, cafetime, driver_device, 0, ROT0, "Dynax", "Mahjong Cafe Time", 0 ) +GAME( 1993, cafedoll, 0, mjifb, mjifb, driver_device, 0, ROT0, "Dynax", "Mahjong Cafe Doll (Japan)", GAME_NOT_WORKING ) +GAME( 1995, mjtensin, 0, mjtensin, mjtensin, driver_device, 0, ROT0, "Dynax", "Mahjong Tensinhai (Japan)", GAME_NOT_WORKING ) GAME( 1996, janptr96, 0, janptr96, janptr96, royalmah_state, janptr96, ROT0, "Dynax", "Janputer '96 (Japan)", 0 ) GAME( 1997, janptrsp, 0, janptr96, janptr96, royalmah_state, janptr96, ROT0, "Dynax", "Janputer Special (Japan)", 0 ) -GAME( 1999, cafebrk, 0, mjifb, mjifb, driver_device, 0, ROT0, "Nakanihon / Dynax", "Mahjong Cafe Break", GAME_NOT_WORKING ) -GAME( 1999, cafepara, 0, mjifb, mjifb, driver_device, 0, ROT0, "Techno-Top", "Mahjong Cafe Paradise", GAME_NOT_WORKING ) +GAME( 1999, cafebrk, 0, mjifb, mjifb, driver_device, 0, ROT0, "Nakanihon / Dynax", "Mahjong Cafe Break", GAME_NOT_WORKING ) +GAME( 1999, cafepara, 0, mjifb, mjifb, driver_device, 0, ROT0, "Techno-Top", "Mahjong Cafe Paradise", GAME_NOT_WORKING ) diff --git a/src/mame/drivers/sbasketb.c b/src/mame/drivers/sbasketb.c index b59065aec78..707d2be2c77 100644 --- a/src/mame/drivers/sbasketb.c +++ b/src/mame/drivers/sbasketb.c @@ -184,7 +184,7 @@ INTERRUPT_GEN_MEMBER(sbasketb_state::vblank_irq) static MACHINE_CONFIG_START( sbasketb, sbasketb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1400000) /* 1.400 MHz ??? */ + MCFG_CPU_ADD("maincpu", KONAMI1, 1400000) /* 1.400 MHz ??? */ MCFG_CPU_PROGRAM_MAP(sbasketb_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", sbasketb_state, vblank_irq) @@ -220,6 +220,13 @@ static MACHINE_CONFIG_START( sbasketb, sbasketb_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +MACHINE_CONFIG_DERIVED(sbasketbu, sbasketb) + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_ADD("maincpu", M6809, 1400000) /* 1.400 MHz ??? */ + MCFG_CPU_PROGRAM_MAP(sbasketb_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", sbasketb_state, vblank_irq) +MACHINE_CONFIG_END + /*************************************************************************** @@ -396,10 +403,9 @@ ROM_END DRIVER_INIT_MEMBER(sbasketb_state,sbasketb) { - konami1_decode(machine(), "maincpu"); } -GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version I, encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1984, sbasketh, sbasketb, sbasketb, sbasketb, driver_device, 0, ROT90, "Konami", "Super Basketball (version H, unprotected)", GAME_SUPPORTS_SAVE ) -GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version G, encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version E, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version I, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbasketh, sbasketb, sbasketbu, sbasketb, driver_device, 0, ROT90, "Konami", "Super Basketball (version H, unprotected)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version G, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb_state, sbasketb, ROT90, "Konami", "Super Basketball (version E, encrypted)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/scramble.c b/src/mame/drivers/scramble.c index bbe27542d99..ad73e39448f 100644 --- a/src/mame/drivers/scramble.c +++ b/src/mame/drivers/scramble.c @@ -405,6 +405,11 @@ static ADDRESS_MAP_START( harem_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("rombank") // bitswapped rom ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, scramble_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("rombank_decrypted") +ADDRESS_MAP_END + static ADDRESS_MAP_START( harem_sound_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x0000, 0x2fff) AM_ROM AM_RANGE(0x6000, 0x6000) AM_READNOP @@ -1675,6 +1680,7 @@ static MACHINE_CONFIG_DERIVED( harem, scramble ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(harem_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_MODIFY("audiocpu") MCFG_CPU_PROGRAM_MAP(harem_sound_map) diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index da14bf458ad..0b5aa9676a6 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -109,9 +109,6 @@ public: required_shared_ptr<UINT16> m_paletteram; - /* internal states */ - UINT8 m_misc_io_data[0x10]; /* holds values written to the I/O chip */ - /* protection-related tracking */ segac2_prot_delegate m_prot_func; /* emulation of protection chip */ UINT8 m_prot_write_buf; /* remembers what was written */ @@ -172,10 +169,10 @@ public: DECLARE_WRITE16_MEMBER( segac2_upd7759_w ); DECLARE_READ16_MEMBER( palette_r ); DECLARE_WRITE16_MEMBER( palette_w ); - DECLARE_WRITE16_MEMBER( control_w ); - DECLARE_READ16_MEMBER( prot_r ); - DECLARE_WRITE16_MEMBER( prot_w ); - DECLARE_WRITE16_MEMBER( counter_timer_w ); + DECLARE_WRITE8_MEMBER( control_w ); + DECLARE_READ8_MEMBER( prot_r ); + DECLARE_WRITE8_MEMBER( prot_w ); + DECLARE_WRITE8_MEMBER( counter_timer_w ); DECLARE_READ16_MEMBER( printer_r ); DECLARE_WRITE16_MEMBER( print_club_camera_w ); DECLARE_READ16_MEMBER(ichirjbl_prot_r); @@ -220,7 +217,6 @@ public: MACHINE_START_MEMBER(segac2_state,segac2) { - save_item(NAME(m_misc_io_data)); save_item(NAME(m_prot_write_buf)); save_item(NAME(m_prot_read_buf)); @@ -476,11 +472,8 @@ WRITE8_MEMBER(segac2_state::io_porth_w) ******************************************************************************/ -WRITE16_MEMBER(segac2_state::control_w ) +WRITE8_MEMBER(segac2_state::control_w) { - /* skip if not LSB */ - if (!ACCESSING_BITS_0_7) - return; data &= 0x0f; /* bit 0 controls display enable */ @@ -511,7 +504,7 @@ WRITE16_MEMBER(segac2_state::control_w ) ******************************************************************************/ /* protection chip reads */ -READ16_MEMBER(segac2_state::prot_r ) +READ8_MEMBER(segac2_state::prot_r) { if (LOG_PROTECTION) logerror("%06X:protection r=%02X\n", space.device().safe_pcbase(), m_prot_read_buf); return m_prot_read_buf | 0xf0; @@ -519,16 +512,12 @@ READ16_MEMBER(segac2_state::prot_r ) /* protection chip writes */ -WRITE16_MEMBER(segac2_state::prot_w ) +WRITE8_MEMBER(segac2_state::prot_w) { int new_sp_palbase = (data >> 2) & 3; int new_bg_palbase = data & 3; int table_index; - /* only works for the LSB */ - if (!ACCESSING_BITS_0_7) - return; - /* compute the table index */ table_index = (m_prot_write_buf << 4) | m_prot_read_buf; @@ -562,42 +551,38 @@ WRITE16_MEMBER(segac2_state::prot_w ) ******************************************************************************/ -WRITE16_MEMBER(segac2_state::counter_timer_w ) +WRITE8_MEMBER(segac2_state::counter_timer_w) { - /* only LSB matters */ - if (ACCESSING_BITS_0_7) + /*int value = data & 1;*/ + switch (data & 0x1e) { - /*int value = data & 1;*/ - switch (data & 0x1e) - { - case 0x00: /* player 1 start/stop */ - case 0x02: /* player 2 start/stop */ - case 0x04: /* ??? */ - case 0x06: /* ??? */ - case 0x08: /* player 1 game timer? */ - case 0x0a: /* player 2 game timer? */ - case 0x0c: /* ??? */ - case 0x0e: /* ??? */ - break; - - case 0x10: /* coin counter */ -// coin_counter_w(space.machine(), 0,1); -// coin_counter_w(space.machine(), 0,0); - break; - - case 0x12: /* set coinage info -- followed by two 4-bit values */ - break; - - case 0x14: /* game timer? (see Tant-R) */ - case 0x16: /* intro timer? (see Tant-R) */ - case 0x18: /* ??? */ - case 0x1a: /* ??? */ - case 0x1c: /* ??? */ - break; - - case 0x1e: /* reset */ - break; - } + case 0x00: /* player 1 start/stop */ + case 0x02: /* player 2 start/stop */ + case 0x04: /* ??? */ + case 0x06: /* ??? */ + case 0x08: /* player 1 game timer? */ + case 0x0a: /* player 2 game timer? */ + case 0x0c: /* ??? */ + case 0x0e: /* ??? */ + break; + + case 0x10: /* coin counter */ +// coin_counter_w(space.machine(), 0,1); +// coin_counter_w(space.machine(), 0,0); + break; + + case 0x12: /* set coinage info -- followed by two 4-bit values */ + break; + + case 0x14: /* game timer? (see Tant-R) */ + case 0x16: /* intro timer? (see Tant-R) */ + case 0x18: /* ??? */ + case 0x1a: /* ??? */ + case 0x1c: /* ??? */ + break; + + case 0x1e: /* reset */ + break; } } @@ -610,12 +595,12 @@ WRITE16_MEMBER(segac2_state::counter_timer_w ) ******************************************************************************/ -READ16_MEMBER(segac2_state::printer_r ) +READ16_MEMBER(segac2_state::printer_r) { return m_cam_data; } -WRITE16_MEMBER(segac2_state::print_club_camera_w ) +WRITE16_MEMBER(segac2_state::print_club_camera_w) { m_cam_data = data; } @@ -633,11 +618,11 @@ WRITE16_MEMBER(segac2_state::print_club_camera_w ) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segac2_state ) AM_RANGE(0x000000, 0x1fffff) AM_ROM - AM_RANGE(0x800000, 0x800001) AM_MIRROR(0x13fdfe) AM_READWRITE(prot_r, prot_w) - AM_RANGE(0x800200, 0x800201) AM_MIRROR(0x13fdfe) AM_WRITE(control_w) + AM_RANGE(0x800000, 0x800001) AM_MIRROR(0x13fdfe) AM_READWRITE8(prot_r, prot_w, 0x00ff) + AM_RANGE(0x800200, 0x800201) AM_MIRROR(0x13fdfe) AM_WRITE8(control_w, 0x00ff) AM_RANGE(0x840000, 0x84001f) AM_MIRROR(0x13fee0) AM_DEVREADWRITE8("io", sega_315_5296_device, read, write, 0x00ff) AM_RANGE(0x840100, 0x840107) AM_MIRROR(0x13fef8) AM_DEVREADWRITE8("ymsnd", ym3438_device, read, write, 0x00ff) - AM_RANGE(0x880100, 0x880101) AM_MIRROR(0x13fefe) AM_WRITE(counter_timer_w) + AM_RANGE(0x880100, 0x880101) AM_MIRROR(0x13fefe) AM_WRITE8(counter_timer_w, 0x00ff) AM_RANGE(0x8c0000, 0x8c0fff) AM_MIRROR(0x13f000) AM_READWRITE(palette_r, palette_w) AM_SHARE("paletteram") AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x18ff00) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) AM_RANGE(0xe00000, 0xe0ffff) AM_MIRROR(0x1f0000) AM_RAM AM_SHARE("nvram") diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c index eb824bc8d54..e02daa3d88d 100644 --- a/src/mame/drivers/segae.c +++ b/src/mame/drivers/segae.c @@ -311,7 +311,12 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_vdp1(*this, "vdp1"), - m_vdp2(*this, "vdp2") { } + m_vdp2(*this, "vdp2"), + m_decrypted_opcodes(*this, "decrypted_opcodes"), + m_maincpu_region(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank0d(*this, "bank0d"), + m_bank1d(*this, "bank1d") { } DECLARE_WRITE8_MEMBER( bank_write ); DECLARE_WRITE_LINE_MEMBER( int_callback ); @@ -332,6 +337,12 @@ public: required_device<sega315_5124_device> m_vdp1; required_device<sega315_5124_device> m_vdp2; + optional_shared_ptr<UINT8> m_decrypted_opcodes; + required_memory_region m_maincpu_region; + required_memory_bank m_bank1; + optional_memory_bank m_bank0d; + optional_memory_bank m_bank1d; + // Analog input related UINT8 m_port_select; UINT16 m_last1; @@ -358,7 +369,19 @@ public: static ADDRESS_MAP_START( systeme_map, AS_PROGRAM, 8, systeme_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM /* Fixed ROM */ AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank1") AM_WRITE_BANK("vram_write") /* Banked ROM */ - AM_RANGE(0xc000, 0xffff) AM_RAM + AM_RANGE(0xc000, 0xffff) AM_RAM AM_SHARE("mainram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, systeme_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xffff) AM_RAM AM_SHARE("mainram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( banked_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, systeme_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") + AM_RANGE(0xc000, 0xffff) AM_RAM AM_SHARE("mainram") ADDRESS_MAP_END @@ -396,7 +419,9 @@ WRITE8_MEMBER( systeme_state::bank_write ) membank("vdp1_bank")->set_entry((data >> 7) & 1); membank("vdp2_bank")->set_entry((data >> 6) & 1); membank("vram_write")->set_entry(data >> 5); - membank("bank1")->set_entry(data & 0x0f); + m_bank1->set_entry(data & 0x0f); + if(m_bank1d) + m_bank1d->set_entry(data & 0x0f); } @@ -404,7 +429,7 @@ void systeme_state::machine_start() { membank("vdp1_bank")->configure_entries(0, 2, m_vram[0], 0x4000); membank("vdp2_bank")->configure_entries(0, 2, m_vram[1], 0x4000); - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16, m_maincpu_region->base() + 0x10000, 0x4000); for (int i = 7; i >= 0; i--) { @@ -909,7 +934,7 @@ ROM_START( fantzn2 ) ROM_LOAD( "epr-11414.ic4", 0x30000, 0x10000, CRC(6f7a9f5f) SHA1(b53aa2eded781c80466a79b7d81383b9a875d0be) ) ROM_LOAD( "epr-11412.ic2", 0x40000, 0x10000, CRC(b14db5af) SHA1(04c7fb659385438b3d8f9fb66800eb7b6373bda9) ) - ROM_REGION( 0x2000, "user1", 0 ) /* MC8123 key */ + ROM_REGION( 0x2000, "key", 0 ) /* MC8123 key */ ROM_LOAD( "317-0057.key", 0x0000, 0x2000, CRC(ee43d0f0) SHA1(72cb75a4d8352fe372db12046a59ea044360d5c3) ) ROM_END @@ -923,7 +948,7 @@ ROM_START( opaopa ) ROM_LOAD( "epr11221.ic3", 0x20000, 0x08000, CRC(4ca132a2) SHA1(cb4e4c01b6ab070eef37c0603190caafe6236ccd) ) /* encrypted */ ROM_LOAD( "epr11220.ic2", 0x28000, 0x08000, CRC(a165e2ef) SHA1(498ff4c5d3a2658567393378c56be6ed86ac0384) ) /* encrypted */ - ROM_REGION( 0x2000, "user1", 0 ) /* MC8123 key */ + ROM_REGION( 0x2000, "key", 0 ) /* MC8123 key */ ROM_LOAD( "317-0042.key", 0x0000, 0x2000, CRC(d6312538) SHA1(494ac7f080775c21dc7d369e6ea78f3299e6975a) ) ROM_END @@ -988,6 +1013,16 @@ static MACHINE_CONFIG_START( systeme, systeme_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( systemex, systeme ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( systemeb, systeme ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map) +MACHINE_CONFIG_END + DRIVER_INIT_MEMBER(systeme_state, hangonjr) { m_maincpu->space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::hangonjr_port_f8_read), this)); @@ -997,7 +1032,58 @@ DRIVER_INIT_MEMBER(systeme_state, hangonjr) DRIVER_INIT_MEMBER(systeme_state, astrofl) { - sega_315_5177_decode(machine(), "maincpu"); + // 315-5177 + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const int swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + + sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); } @@ -1010,21 +1096,25 @@ DRIVER_INIT_MEMBER(systeme_state, ridleofp) DRIVER_INIT_MEMBER(systeme_state, opaopa) { - mc8123_decrypt_rom(machine(), "maincpu", "user1", "bank1", 8); + UINT8 *banked_decrypted_opcodes = auto_alloc_array(machine(), UINT8, m_maincpu_region->bytes()); + mc8123_decode(m_maincpu_region->base(), banked_decrypted_opcodes, memregion("key")->base(), m_maincpu_region->bytes()); + + m_bank0d->set_base(banked_decrypted_opcodes); + m_bank1d->configure_entries(0, 16, banked_decrypted_opcodes + 0x10000, 0x4000); } DRIVER_INIT_MEMBER(systeme_state, fantzn2) { - mc8123_decrypt_rom(machine(), "maincpu", "user1", NULL, 0); + mc8123_decode(m_maincpu_region->base(), m_decrypted_opcodes, memregion("key")->base(), 0x8000); } -// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1985, hangonjr, 0, systeme, hangonjr, systeme_state, hangonjr, ROT0, "Sega", "Hang-On Jr.", GAME_SUPPORTS_SAVE ) -GAME( 1986, transfrm, 0, systeme, transfrm, driver_device, 0, ROT0, "Sega", "Transformer", GAME_SUPPORTS_SAVE ) -GAME( 1986, astrofl, transfrm, systeme, transfrm, systeme_state, astrofl, ROT0, "Sega", "Astro Flash (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1986, ridleofp, 0, systeme, ridleofp, systeme_state, ridleofp, ROT90, "Sega / Nasco", "Riddle of Pythagoras (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1987, opaopa, 0, systeme, opaopa, systeme_state, opaopa, ROT0, "Sega", "Opa Opa (MC-8123, 317-0042)", GAME_SUPPORTS_SAVE ) -GAME( 1988, fantzn2, 0, systeme, fantzn2, systeme_state, fantzn2, ROT0, "Sega", "Fantasy Zone II - The Tears of Opa-Opa (MC-8123, 317-0057)", GAME_SUPPORTS_SAVE ) -GAME( 1988, tetrisse, 0, systeme, tetrisse, driver_device, 0, ROT0, "Sega", "Tetris (Japan, System E)", GAME_SUPPORTS_SAVE ) +// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS +GAME( 1985, hangonjr, 0, systeme, hangonjr, systeme_state, hangonjr, ROT0, "Sega", "Hang-On Jr.", GAME_SUPPORTS_SAVE ) +GAME( 1986, transfrm, 0, systeme, transfrm, driver_device, 0, ROT0, "Sega", "Transformer", GAME_SUPPORTS_SAVE ) +GAME( 1986, astrofl, transfrm, systemex, transfrm, systeme_state, astrofl, ROT0, "Sega", "Astro Flash (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1986, ridleofp, 0, systeme, ridleofp, systeme_state, ridleofp, ROT90, "Sega / Nasco", "Riddle of Pythagoras (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1987, opaopa, 0, systemeb, opaopa, systeme_state, opaopa, ROT0, "Sega", "Opa Opa (MC-8123, 317-0042)", GAME_SUPPORTS_SAVE ) +GAME( 1988, fantzn2, 0, systemex, fantzn2, systeme_state, fantzn2, ROT0, "Sega", "Fantasy Zone II - The Tears of Opa-Opa (MC-8123, 317-0057)", GAME_SUPPORTS_SAVE ) +GAME( 1988, tetrisse, 0, systeme, tetrisse, driver_device, 0, ROT0, "Sega", "Tetris (Japan, System E)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c index ea0f834432a..490bee85605 100644 --- a/src/mame/drivers/segag80r.c +++ b/src/mame/drivers/segag80r.c @@ -322,6 +322,13 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, segag80r_state ) AM_RANGE(0xe000, 0xffff) AM_RAM_WRITE(vidram_w) AM_SHARE("videoram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, segag80r_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("maincpu", 0x8000) + AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(mainram_w) AM_SHARE("mainram") + AM_RANGE(0xe000, 0xffff) AM_RAM_WRITE(vidram_w) AM_SHARE("videoram") +ADDRESS_MAP_END + /* complete memory map derived from schematics */ static ADDRESS_MAP_START( main_portmap, AS_IO, 8, segag80r_state ) @@ -877,6 +884,10 @@ static MACHINE_CONFIG_DERIVED( monsterb, g80r_base ) MCFG_FRAGMENT_ADD(monsterb_sound_board) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( monster2, monsterb ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pignewt, g80r_base ) @@ -897,6 +908,7 @@ static MACHINE_CONFIG_DERIVED( sindbadm, g80r_base ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_IO_MAP(sindbadm_portmap) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", segag80r_state, sindbadm_vblank_start) MCFG_DEVICE_ADD("ppi8255", I8255A, 0) @@ -1497,11 +1509,34 @@ DRIVER_INIT_MEMBER(segag80r_state,monsterb) DRIVER_INIT_MEMBER(segag80r_state,monster2) { + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */ + { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */ + { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); + address_space &iospace = m_maincpu->space(AS_IO); address_space &pgmspace = m_maincpu->space(AS_PROGRAM); /* configure the 315-5006 security chip */ - spatter_decode(machine(), "maincpu"); m_decrypt = segag80_security(0); /* configure video */ @@ -1546,11 +1581,34 @@ DRIVER_INIT_MEMBER(segag80r_state,pignewt) DRIVER_INIT_MEMBER(segag80r_state,sindbadm) { + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ + { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); + address_space &iospace = m_maincpu->space(AS_IO); address_space &pgmspace = m_maincpu->space(AS_PROGRAM); /* configure the encrypted Z80 */ - sindbadm_decode(machine(), "maincpu"); m_decrypt = segag80_security(0); /* configure video */ @@ -1585,7 +1643,7 @@ GAME( 1981, spaceod2, spaceod, spaceod, spaceod, segag80r_state, spaceod, R GAME( 1982, monsterb, 0, monsterb, monsterb, segag80r_state, monsterb, ROT270, "Sega", "Monster Bash", GAME_IMPERFECT_SOUND ) /* 2-board G-80 system */ -GAME( 1982, monsterb2, monsterb, monsterb, monsterb, segag80r_state, monster2, ROT270, "Sega", "Monster Bash (2 board version)", GAME_IMPERFECT_SOUND ) +GAME( 1982, monsterb2, monsterb, monster2, monsterb, segag80r_state, monster2, ROT270, "Sega", "Monster Bash (2 board version)", GAME_IMPERFECT_SOUND ) GAME( 1983, pignewt, 0, pignewt, pignewt, segag80r_state, pignewt, ROT270, "Sega", "Pig Newton (version C)", GAME_IMPERFECT_SOUND ) GAME( 1983, pignewta, pignewt, pignewt, pignewta, segag80r_state, pignewt, ROT270, "Sega", "Pig Newton (version A)", GAME_IMPERFECT_SOUND ) GAME( 1983, sindbadm, 0, sindbadm, sindbadm, segag80r_state, sindbadm, ROT270, "Sega", "Sindbad Mystery", 0 ) diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index d1dd85fc686..fdd896e745c 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -426,6 +426,11 @@ static ADDRESS_MAP_START( hangon_map, AS_PROGRAM, 16, segahang_state ) AM_RANGE(0xe00000, 0xffffff) AM_READWRITE(hangon_io_r, hangon_io_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, segahang_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sharrier_map, AS_PROGRAM, 16, segahang_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_ROM @@ -959,11 +964,17 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( endurobl, sharrier_base ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_FRAGMENT_ADD(sound_board_2203) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( endurob2, sharrier_base ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + MCFG_FRAGMENT_ADD(sound_board_2203x2) MACHINE_CONFIG_END @@ -1777,13 +1788,10 @@ DRIVER_INIT_MEMBER(segahang_state,enduror) DRIVER_INIT_MEMBER(segahang_state,endurobl) { DRIVER_INIT_CALL(enduror); - // assemble decrypted half of ROM and register it UINT16 *rom = reinterpret_cast<UINT16 *>(memregion("maincpu")->base()); - UINT16 *decrypt = auto_alloc_array(machine(), UINT16, 0x40000/2); - memcpy(decrypt + 0x00000/2, rom + 0x30000/2, 0x10000); - memcpy(decrypt + 0x10000/2, rom + 0x10000/2, 0x20000); - m_maincpu->space(AS_PROGRAM).set_decrypted_region(0x000000, 0x03ffff, decrypt); + memcpy(m_decrypted_opcodes + 0x00000/2, rom + 0x30000/2, 0x10000); + memcpy(m_decrypted_opcodes + 0x10000/2, rom + 0x10000/2, 0x20000); } DRIVER_INIT_MEMBER(segahang_state,endurob2) @@ -1792,9 +1800,7 @@ DRIVER_INIT_MEMBER(segahang_state,endurob2) // assemble decrypted half of ROM and register it UINT16 *rom = reinterpret_cast<UINT16 *>(memregion("maincpu")->base()); - UINT16 *decrypt = auto_alloc_array(machine(), UINT16, 0x40000/2); - memcpy(decrypt, rom, 0x30000); - m_maincpu->space(AS_PROGRAM).set_decrypted_region(0x000000, 0x03ffff, decrypt); + memcpy(m_decrypted_opcodes, rom, 0x30000); } diff --git a/src/mame/drivers/segam1.c b/src/mame/drivers/segam1.c new file mode 100644 index 00000000000..a39ada35922 --- /dev/null +++ b/src/mame/drivers/segam1.c @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* + +Sega M1 hardware (837-7571) (PCB) + +Sega Bingo Multicart (837-10675) (Sticker on PCB) + +used for redemption / gambling style machines in a satellite setup + +based on Caribbean Boule the following hardware setup is used + +One X-Board (segaxbd.c) drives a large rear-projection monitor which all players view to see the main game progress. + +Multiple M1 boards ("satellite" board) for each player for them to view information privately. + +One 'link' board which connects everything together. The link board has audio hardware, a 68K, and a Z80 as +well as a huge bank of UARTS and toslink connectors, but no video. it's possible the main game logic runs +on the 'link' board. + + +Unfortunately we don't have any dumps of anything other than an M1 board right now. + +--- + +is this related to (or a component of?) bingoc.c, the EPR numbers are much lower there tho +so it's probably an earlier version of the same thing or one of the 'link' boards? + +uses s24 style tilemaps (ram based?) + + +*/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + + +class segam1_state : public driver_device +{ +public: + segam1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + virtual void video_start(); + UINT32 screen_update_segam1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device<cpu_device> m_maincpu; +}; + +void segam1_state::video_start() +{ +} + +UINT32 segam1_state::screen_update_segam1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +static ADDRESS_MAP_START( segam1_map, AS_PROGRAM, 16, segam1_state ) + AM_RANGE(0x000000, 0x03ffff) AM_ROM +ADDRESS_MAP_END + + +static INPUT_PORTS_START( segam1 ) +INPUT_PORTS_END + + + + +static MACHINE_CONFIG_START( segam1, segam1_state ) + + MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) + MCFG_CPU_PROGRAM_MAP(segam1_map) +// MCFG_CPU_VBLANK_INT_DRIVER("screen", segam1_state, irq1_line_hold) + + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(segam1_state, screen_update_segam1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + + +ROM_START( bingpty ) + ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "epr-16648b.bin", 0x00000, 0x20000, CRC(e4fceb4c) SHA1(0a248bb328d2f6d72d540baefbe62838f4b76585) ) + ROM_LOAD16_BYTE( "epr-16649b.bin", 0x00001, 0x20000, CRC(736d8bbd) SHA1(c359ad513d4a7693cbb1a27ce26f89849e894d05) ) + + ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 Code */ + ROM_LOAD( "epr-14845.bin", 0x00000, 0x20000, CRC(90d47101) SHA1(7bc002c104e3dbde1986aaec54112d5658eab523) ) + + ROM_REGION( 0x8000, "m1comm", 0 ) /* Z80 Code */ + ROM_LOAD( "epr-14221a.bin", 0x00000, 0x8000, CRC(a13e67a4) SHA1(4cd269c7f04a64ae7806c8784f86bf6553a25d85) ) + + // dumps of the X-Board part, and the LINK PCB are missing. +ROM_END + +GAME( 199?, bingpty, 0, segam1, segam1, driver_device, 0, ROT0, "Sega", "Bingo Party Multicart (Rev B) (M1 Satellite board)", GAME_NOT_WORKING | GAME_NO_SOUND ) diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index c80dc050f02..7181c1a848c 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -465,7 +465,7 @@ void segaorun_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in case 0: mapper.map_as_ram(0x60000, 0x08000, 0xf98000, "workram", write16_delegate()); - mapper.map_as_rom(0x00000, 0x60000, 0xf80000, "rom0base", 0x00000, write16_delegate()); + mapper.map_as_rom(0x00000, 0x60000, 0xf80000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); break; } } diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c index 2001e28b832..6313f3dee38 100644 --- a/src/mame/drivers/segas16a.c +++ b/src/mame/drivers/segas16a.c @@ -974,6 +974,10 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas16a_state ) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( sound_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, segas16a_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("sound_decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas16a_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -1964,6 +1968,11 @@ static MACHINE_CONFIG_DERIVED( system16a_no7751, system16a ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( system16a_no7751p, system16a_no7751 ) + MCFG_DEVICE_MODIFY("soundcpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(sound_decrypted_opcodes_map) +MACHINE_CONFIG_END + /* static MACHINE_CONFIG_DERIVED( system16a_i8751_no7751, system16a_i8751 ) MCFG_DEVICE_REMOVE("n7751") @@ -3503,7 +3512,59 @@ DRIVER_INIT_MEMBER(segas16a_state,quartet) DRIVER_INIT_MEMBER(segas16a_state,fantzonep) { DRIVER_INIT_CALL(generic); - sega_315_5177_decode(machine(), "soundcpu"); + + // 315-5177 + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const int swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + + sega_decode_2(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, xor_table, swap_table); } DRIVER_INIT_MEMBER(segas16a_state,sdi) @@ -3545,7 +3606,7 @@ GAME( 1986, alexkidd, 0, system16a, alexkidd, segas16a GAME( 1986, alexkidd1, alexkidd, system16a_fd1089a, alexkidd, segas16a_state,generic, ROT0, "Sega", "Alex Kidd: The Lost Stars (set 1, FD1089A 317-0021)", GAME_SUPPORTS_SAVE ) GAME( 1986, fantzone, 0, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (Rev A, unprotected)", GAME_SUPPORTS_SAVE ) GAME( 1986, fantzone1, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (unprotected)", GAME_SUPPORTS_SAVE ) -GAME( 1986, fantzonep, fantzone, system16a_no7751, fantzone, segas16a_state,fantzonep, ROT0, "Sega", "Fantasy Zone (317-5000)", GAME_SUPPORTS_SAVE ) +GAME( 1986, fantzonep, fantzone, system16a_no7751p, fantzone, segas16a_state,fantzonep, ROT0, "Sega", "Fantasy Zone (317-5000)", GAME_SUPPORTS_SAVE ) GAME( 1986, fantzonepr, fantzone, system16a_no7751, fantzone, segas16a_state,generic, ROT0, "Sega", "Fantasy Zone (prototype)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // bad / missing gfx roms GAME( 1988, passsht16a, passsht, system16a_fd1094, passsht16a, segas16a_state,passsht16a, ROT270, "Sega", "Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071)", GAME_SUPPORTS_SAVE ) GAME( 1987, sdi, 0, system16a_fd1089b_no7751, sdi, segas16a_state,sdi, ROT0, "Sega", "SDI - Strategic Defense Initiative (Japan, newer, System 16A, FD1089B 317-0027)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 6b2206f5bbf..d028409837a 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -926,8 +926,8 @@ void segas16b_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in case 2: // 3rd ROM base, or board-specific banking switch (m_romboard) { - case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom2base", 0x20000, write16_delegate()); break; - case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom2base", 0x40000, write16_delegate()); break; + case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom2base", "decrypted_rom2base", 0x20000, write16_delegate()); break; + case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom2base", "decrypted_rom2base", 0x40000, write16_delegate()); break; case ROM_BOARD_171_5521: case ROM_BOARD_171_5704: mapper.map_as_handler(0x00000, 0x10000, 0xff0000, read16_delegate(), write16_delegate(FUNC(segas16b_state::rom_5704_bank_w), this)); break; case ROM_BOARD_171_5797: mapper.map_as_handler(0x00000, 0x10000, 0xff0000, read16_delegate(FUNC(segas16b_state::unknown_rgn2_r), this), write16_delegate(FUNC(segas16b_state::unknown_rgn2_w), this)); break; @@ -939,10 +939,10 @@ void segas16b_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in case 1: // 2nd ROM base, banking & math, or sound for Korean games switch (m_romboard) { - case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom1base", 0x10000, write16_delegate()); break; - case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom1base", 0x20000, write16_delegate()); break; + case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom1base", "decrypted_rom1base", 0x10000, write16_delegate()); break; + case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom1base", "decrypted_rom1base", 0x20000, write16_delegate()); break; case ROM_BOARD_171_5521: - case ROM_BOARD_171_5704: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom1base", 0x40000, write16_delegate()); break; + case ROM_BOARD_171_5704: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom1base", "decrypted_rom1base", 0x40000, write16_delegate()); break; case ROM_BOARD_KOREAN: mapper.map_as_handler(0x00000, 0x10000, 0xff0000, read16_delegate(), write16_delegate(FUNC(segas16b_state::atomicp_sound_w), this)); break; case ROM_BOARD_171_5797: mapper.map_as_handler(0x00000, 0x04000, 0xffc000, read16_delegate(FUNC(segas16b_state::rom_5797_bank_math_r), this), write16_delegate(FUNC(segas16b_state::rom_5797_bank_math_w), this)); break; default: assert(false); @@ -952,12 +952,12 @@ void segas16b_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in case 0: // 1st ROM base switch (m_romboard) { - case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom0base", 0x00000, write16_delegate()); break; - case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom0base", 0x00000, write16_delegate()); break; + case ROM_BOARD_171_5358_SMALL: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); break; + case ROM_BOARD_171_5358: mapper.map_as_rom(0x00000, 0x20000, 0xfe0000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); break; case ROM_BOARD_171_5521: - case ROM_BOARD_171_5704: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom0base", 0000000, write16_delegate()); break; - case ROM_BOARD_KOREAN: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom0base", 0000000, write16_delegate()); break; - case ROM_BOARD_171_5797: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", 0000000, write16_delegate()); break; + case ROM_BOARD_171_5704: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom0base", "decrypted_rom0base", 0000000, write16_delegate()); break; + case ROM_BOARD_KOREAN: mapper.map_as_rom(0x00000, 0x40000, 0xfc0000, "rom0base", "decrypted_rom0base", 0000000, write16_delegate()); break; + case ROM_BOARD_171_5797: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", "decrypted_rom0base", 0000000, write16_delegate()); break; default: assert(false); } break; @@ -1742,6 +1742,12 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas16b_state ) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( sound_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, segas16b_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("sound_decrypted_opcodes") + AM_RANGE(0x8000, 0xdfff) AM_ROMBANK("soundbank") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas16b_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -3320,6 +3326,10 @@ static MACHINE_CONFIG_START( system16b, segas16b_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.48) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( system16b_mc8123, system16b ) + MCFG_CPU_MODIFY("soundcpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(sound_decrypted_opcodes_map) +MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system16b_fd1089a, system16b ) MCFG_CPU_REPLACE("maincpu", FD1089A, MASTER_CLOCK_10MHz) @@ -4538,6 +4548,48 @@ ROM_START( dunkshot ) ROM_LOAD( "317-0022.key", 0x0000, 0x2000, CRC(4eedc66d) SHA1(50588fa13bf25a2d1322579cdc9937450543c978) ) ROM_END +ROM_START( dunkshota ) // several roms had replacement? (different style to others) labels with 'T' markings, content identical. + ROM_REGION( 0x30000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "epr-10520a.a1", 0x000001, 0x8000, CRC(16e213ba) SHA1(efddff17d1802ccbea9eac69cedef62fa6b9a640) ) + ROM_LOAD16_BYTE( "epr-10523a.a4", 0x000000, 0x8000, CRC(22e3f074) SHA1(acdb6952308957244355bedb9cc627314a0139ef) ) + ROM_LOAD16_BYTE( "epr-10521.a2", 0x010001, 0x8000, CRC(e2d5f97a) SHA1(bf7b4a029580633fee65be89d5c9c83ff76a8484) ) // == epr-10468.a2 + ROM_LOAD16_BYTE( "epr-10524.a5", 0x010000, 0x8000, CRC(22777314) SHA1(fbc35505a94c8d4bdb44ee058e9e2e9e9b377c5c) ) // == epr-10471.a5 + ROM_LOAD16_BYTE( "epr-10522.a3", 0x020001, 0x8000, CRC(e5b5f754) SHA1(af02c46437e3cf62331753dc405211b7f90e3f62) ) + ROM_LOAD16_BYTE( "epr-10525.a6", 0x020000, 0x8000, CRC(7f41f334) SHA1(631f6113f3c0c47f2dd1ee0ea6e7db4321d7366d) ) + + ROM_REGION( 0x18000, "gfx1", 0 ) // tiles + ROM_LOAD( "epr-10528.b9", 0x00000, 0x8000, CRC(a8a3762d) SHA1(af75df6eda0df903e2b3f9680cd128da4227961d) ) + ROM_LOAD( "epr-10529.b10", 0x08000, 0x8000, CRC(80cbff50) SHA1(3641ee337194d56d774bf1be91939d03f3c0f77b) ) + ROM_LOAD( "epr-10530.b11", 0x10000, 0x8000, CRC(2dbe1e52) SHA1(a6b74f88e2f47322fbde1f6682cae58caf79f6c8) ) + + ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites + ROM_LOAD16_BYTE( "epr-10481.b5", 0x00000, 0x8000, CRC(feb04bc9) SHA1(233dc8e3b887a88ac114723d58a909a58f0ae771) ) + ROM_RELOAD( 0x10000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10477.b1", 0x00001, 0x8000, CRC(f9d3b2cb) SHA1(b530fe16882c718122bfd1de098f39e54993de28) ) + ROM_RELOAD( 0x10001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10482.b6", 0x20000, 0x8000, CRC(5bc07618) SHA1(f4c88f81b407d467f958181770ea4fd32aab3daf) ) + ROM_RELOAD( 0x30000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10478.b2", 0x20001, 0x8000, CRC(5b5c5c92) SHA1(1c6f1cafa0788678c80ade11560f4a8d8bb7272a) ) + ROM_RELOAD( 0x30001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10483.b7", 0x40000, 0x8000, CRC(7cab4f9e) SHA1(2310a9fe604f78d74d84bea301c95e6f0e6a6085) ) + ROM_RELOAD( 0x50000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10479.b3", 0x40001, 0x8000, CRC(e84190a0) SHA1(23a8799adf81e1884a8c6b4c55397b8bca2f1850) ) + ROM_RELOAD( 0x50001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10527.b8", 0x60000, 0x8000, CRC(39b1a242) SHA1(cf0c0768d006a18345b66dd389acba1e8192ec53) ) + ROM_RELOAD( 0x70000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10526.b4", 0x60001, 0x8000, CRC(bf200754) SHA1(60900d80cfea147b011813dde558c1d39fdd274c) ) + ROM_RELOAD( 0x70001, 0x8000 ) + + ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU + ROM_LOAD( "epr-10473.a7", 0x00000, 0x08000, CRC(7f1f5a27) SHA1(7ff91b95c883b395ab4ff5e440d78e553a09e623) ) + ROM_LOAD( "epr-10474.a8", 0x10000, 0x08000, CRC(419a656e) SHA1(aa734ae835761badeb069f99acc5fded2a19b3a3) ) + ROM_LOAD( "epr-10475.a9", 0x20000, 0x08000, CRC(17d55e85) SHA1(0c414bafecbfaa82679cc155f15f5255c186358d) ) + ROM_LOAD( "epr-10476.a10", 0x30000, 0x08000, CRC(a6be0956) SHA1(fc4d6e25e0b46679f94fddbb1850fb0b02f8d84b) ) + + ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key + ROM_LOAD( "317-0022.key", 0x0000, 0x2000, CRC(4eedc66d) SHA1(50588fa13bf25a2d1322579cdc9937450543c978) ) +ROM_END + ROM_START( dunkshoto ) ROM_REGION( 0x30000, "maincpu", 0 ) // 68000 code @@ -6717,7 +6769,7 @@ DRIVER_INIT_MEMBER(segas16b_state,aceattac_5358) DRIVER_INIT_MEMBER(segas16b_state,aliensyn7_5358_small) { DRIVER_INIT_CALL(generic_5358_small); - mc8123_decrypt_rom(machine(), "soundcpu", "mcu", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, memregion("mcu")->base(), 0x8000); } DRIVER_INIT_MEMBER(segas16b_state,altbeast_5521) @@ -6741,7 +6793,7 @@ DRIVER_INIT_MEMBER(segas16b_state,altbeas5_5521) DRIVER_INIT_MEMBER(segas16b_state,altbeas4_5521) { DRIVER_INIT_CALL(generic_5521); - mc8123_decrypt_rom(machine(), "soundcpu", "mcu", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, memregion("mcu")->base(), 0x8000); } DRIVER_INIT_MEMBER(segas16b_state,ddux_5704) @@ -6799,7 +6851,7 @@ DRIVER_INIT_MEMBER(segas16b_state,passshtj_5358) DRIVER_INIT_MEMBER(segas16b_state,cencourt_5358) { DRIVER_INIT_CALL(passshtj_5358); - mc8123_decrypt_rom(machine(), "soundcpu", "mcu", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, memregion("mcu")->base(), 0x8000); } DRIVER_INIT_MEMBER(segas16b_state,sdi_5358_small) @@ -6817,13 +6869,13 @@ DRIVER_INIT_MEMBER(segas16b_state,defense_5358_small) DRIVER_INIT_MEMBER(segas16b_state,shinobi4_5521) { DRIVER_INIT_CALL(generic_5521); - mc8123_decrypt_rom(machine(), "soundcpu", "mcu", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, memregion("mcu")->base(), 0x8000); } DRIVER_INIT_MEMBER(segas16b_state,shinobi3_5358) { DRIVER_INIT_CALL(generic_5358); - mc8123_decrypt_rom(machine(), "soundcpu", "mcu", NULL, 0); + mc8123_decode(memregion("soundcpu")->base(), m_sound_decrypted_opcodes, memregion("mcu")->base(), 0x8000); } DRIVER_INIT_MEMBER(segas16b_state,sjryuko_5358_small) @@ -6868,7 +6920,7 @@ DRIVER_INIT_MEMBER(segas16b_state,snapper) GAME( 1988, aceattac, 0, system16b_fd1094, aceattac, segas16b_state,aceattac_5358, ROT270, "Sega", "Ace Attacker (FD1094 317-0059)", 0 ) GAME( 1987, aliensyn, 0, system16b, aliensyn, segas16b_state,generic_5358_small, ROT0, "Sega", "Alien Syndrome (set 4, System 16B, unprotected)", 0 ) -GAME( 1987, aliensyn7, aliensyn, system16b, aliensyn, segas16b_state,aliensyn7_5358_small, ROT0, "Sega", "Alien Syndrome (set 7, System 16B, MC-8123B 317-00xx)", 0 ) +GAME( 1987, aliensyn7, aliensyn, system16b_mc8123, aliensyn, segas16b_state,aliensyn7_5358_small, ROT0, "Sega", "Alien Syndrome (set 7, System 16B, MC-8123B 317-00xx)", 0 ) GAME( 1987, aliensyn3, aliensyn, system16b_fd1089a, aliensyn, segas16b_state,generic_5358_small, ROT0, "Sega", "Alien Syndrome (set 3, System 16B, FD1089A 317-0033)", 0 ) GAME( 1987, aliensynj, aliensyn, system16b_fd1089a, aliensynj,segas16b_state,generic_5358_small, ROT0, "Sega", "Alien Syndrome (set 6, Japan, new, System 16B, FD1089A 317-0033)", 0 ) @@ -6876,7 +6928,7 @@ GAME( 1988, altbeast, 0, system16b_i8751, altbeast, segas16b_state, GAME( 1988, altbeastj, altbeast, system16b_i8751, altbeast, segas16b_state,altbeasj_5521, ROT0, "Sega", "Juuouki (set 7, Japan, 8751 317-0077)", 0 ) GAME( 1988, altbeast6, altbeast, system16b_i8751, altbeast, segas16b_state,altbeas5_5521, ROT0, "Sega", "Altered Beast (set 6, 8751 317-0076)", 0 ) GAME( 1988, altbeast5, altbeast, system16b_fd1094, altbeast, segas16b_state,generic_5521, ROT0, "Sega", "Altered Beast (set 5, FD1094 317-0069)", 0 ) -GAME( 1988, altbeast4, altbeast, system16b, altbeast, segas16b_state,altbeas4_5521, ROT0, "Sega", "Altered Beast (set 4, MC-8123B 317-0066)", 0 ) +GAME( 1988, altbeast4, altbeast, system16b_mc8123, altbeast, segas16b_state,altbeas4_5521, ROT0, "Sega", "Altered Beast (set 4, MC-8123B 317-0066)", 0 ) GAME( 1988, altbeastj3, altbeast, system16b_fd1094, altbeast, segas16b_state,generic_5521, ROT0, "Sega", "Juuouki (set 3, Japan, FD1094 317-0068)", 0 ) GAME( 1988, altbeast2, altbeast, system16b, altbeast, segas16b_state,altbeas4_5521, ROT0, "Sega", "Altered Beast (set 2, MC-8123B 317-0066)", 0 ) GAME( 1988, altbeastj1, altbeast, system16b_fd1094, altbeast, segas16b_state,generic_5521, ROT0, "Sega", "Juuouki (set 1, Japan, FD1094 317-0065)", 0 ) @@ -6903,6 +6955,7 @@ GAME( 1988, dduxj, ddux, system16b_fd1094, ddux, segas16b_state, GAME( 1988, ddux1, ddux, system16b_i8751, ddux, segas16b_state,ddux_5704, ROT0, "Sega", "Dynamite Dux (set 1, 8751 317-0095)", 0 ) GAME( 1987, dunkshot, 0, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (Rev C, FD1089A 317-0022)", 0 ) +GAME( 1987, dunkshota, dunkshot, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (Rev A, FD1089A 317-0022)", 0 ) GAME( 1986, dunkshoto, dunkshot, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (FD1089A 317-0022)", 0 ) GAME( 1989, eswat, 0, system16b_fd1094_5797,eswat, segas16b_state,generic_5797, ROT0, "Sega", "E-Swat - Cyber Police (set 4, World, FD1094 317-0130)", 0 ) @@ -6931,7 +6984,7 @@ GAME( 1989, mvpj, mvp, system16b_fd1094, mvp, segas16b_state, GAME( 1988, passsht, 0, system16b_fd1094, passsht, segas16b_state,generic_5358, ROT270, "Sega", "Passing Shot (World, 2 Players, FD1094 317-0080)", 0 ) GAME( 1988, passshta, passsht, system16b_fd1094, passshtj, segas16b_state,passshtj_5358, ROT270, "Sega", "Passing Shot (World, 4 Players, FD1094 317-0074)", 0 ) GAME( 1988, passshtj, passsht, system16b_fd1094, passshtj, segas16b_state,passshtj_5358, ROT270, "Sega", "Passing Shot (Japan, 4 Players, FD1094 317-0070)", 0 ) -GAME( 1988, cencourt, passsht, system16b, cencourt, segas16b_state,cencourt_5358, ROT270, "Sega", "Center Court (World, 4 Players, prototype, MC-8123B)", 0 ) +GAME( 1988, cencourt, passsht, system16b_mc8123, cencourt, segas16b_state,cencourt_5358, ROT270, "Sega", "Center Court (World, 4 Players, prototype, MC-8123B)", 0 ) GAME( 1991, riotcity, 0, system16b, riotcity, segas16b_state,generic_5704, ROT0, "Sega / Westone", "Riot City (Japan)", 0 ) @@ -6942,8 +6995,8 @@ GAME( 1987, sdib, sdi, system16b_fd1089a, sdi, segas16b_state, GAME( 1987, sdibl, sdi, system16b, sdi, segas16b_state,sdi_5358_small, ROT0, "bootleg", "SDI - Strategic Defense Initiative (bootleg)", 0 ) GAME( 1987, shinobi5, shinobi, system16b, shinobi, segas16b_state,generic_5521, ROT0, "Sega", "Shinobi (set 5, System 16B, unprotected)", 0 ) -GAME( 1987, shinobi4, shinobi, system16b, shinobi, segas16b_state,shinobi4_5521, ROT0, "Sega", "Shinobi (set 4, System 16B, MC-8123B 317-0054)", 0 ) -GAME( 1987, shinobi3, shinobi, system16b, shinobi, segas16b_state,shinobi3_5358, ROT0, "Sega", "Shinobi (set 3, System 16B, MC-8123B 317-0054)", 0 ) +GAME( 1987, shinobi4, shinobi, system16b_mc8123, shinobi, segas16b_state,shinobi4_5521, ROT0, "Sega", "Shinobi (set 4, System 16B, MC-8123B 317-0054)", 0 ) +GAME( 1987, shinobi3, shinobi, system16b_mc8123, shinobi, segas16b_state,shinobi3_5358, ROT0, "Sega", "Shinobi (set 3, System 16B, MC-8123B 317-0054)", 0 ) GAME( 1987, shinobi2, shinobi, system16b_fd1094, shinobi, segas16b_state,generic_5358, ROT0, "Sega", "Shinobi (set 2, System 16B, FD1094 317-0049)", 0 ) GAME( 1987, sonicbom, 0, system16b_fd1094, sonicbom, segas16b_state,generic_5358, ROT270, "Sega", "Sonic Boom (FD1094 317-0053)", 0 ) diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index afd68a1d736..609a0509227 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -84,13 +84,13 @@ void segas18_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 ind switch (m_romboard) { case ROM_BOARD_171_SHADOW: mapper.map_as_handler(0x00000, 0x00010, 0xfffff0, read16_delegate(FUNC(segas18_state::genesis_vdp_r), this), write16_delegate(FUNC(segas18_state::genesis_vdp_w), this)); break; - case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", 0x80000, write16_delegate()); break; + case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", "decrypted_rom1base", 0x80000, write16_delegate()); break; case ROM_BOARD_171_5987: if (romsize <= 0x100000) - mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", 0x80000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); + mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", "decrypted_rom1base", 0x80000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); else - mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom1base",0x100000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); + mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom1base", "decrypted_rom1base",0x100000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); break; - case ROM_BOARD_837_7525: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", 0x80000, write16_delegate(FUNC(segas18_state::rom_837_7525_bank_w), this)); + case ROM_BOARD_837_7525: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", "decrypted_rom1base", 0x80000, write16_delegate(FUNC(segas18_state::rom_837_7525_bank_w), this)); break; default: assert(false); @@ -101,12 +101,12 @@ void segas18_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 ind switch (m_romboard) { case ROM_BOARD_171_SHADOW: - case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", 0x00000, write16_delegate()); break; + case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); break; case ROM_BOARD_837_7525: case ROM_BOARD_171_5987: if (romsize <= 0x100000) - mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", 0x00000, write16_delegate()); + mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); else - mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom0base", 0x00000, write16_delegate()); + mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom0base", "decrypted_rom0base", 0x00000, write16_delegate()); break; default: assert(false); } diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index 129326a83d0..e35307e027e 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -9,10 +9,10 @@ Still to do: * fix protection * fix jpark correctly - * priorities in multi32 appear wrong - stadium cross map screen - and title fight ingame backgrounds - * should f1lap be set up as a twin cabinet / direct link or can it - be operated as a single screen, unlike f1en/air rescue + * priorities in multi32 appear wrong - stadium cross map screen + and title fight ingame backgrounds + * should f1lap be set up as a twin cabinet / direct link or can it + be operated as a single screen, unlike f1en/air rescue **************************************************************************** @@ -1827,7 +1827,7 @@ static INPUT_PORTS_START( f1en ) PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_NAME("mainpcb:Steering Wheel") PORT_START("mainpcb:ANALOG2") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_NAME("mainpcb:Gas Pedal") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_NAME("mainpcb:Gas Pedal") PORT_START("mainpcb:ANALOG3") PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_NAME("mainpcb:Brake Pedal") @@ -5109,26 +5109,26 @@ READ16_MEMBER(segas32_new_state::dual_pcb_slave) -DRIVER_INIT_MEMBER(segas32_new_state,titlef) { m_mainpcb->init_titlef(); } -DRIVER_INIT_MEMBER(segas32_new_state,slipstrm) { m_mainpcb->init_slipstrm(); } -DRIVER_INIT_MEMBER(segas32_new_state,radm) { m_mainpcb->init_radm(); } -DRIVER_INIT_MEMBER(segas32_new_state,holo) { m_mainpcb->init_holo(); } -DRIVER_INIT_MEMBER(segas32_new_state,svf) { m_mainpcb->init_svf(); } -DRIVER_INIT_MEMBER(segas32_new_state,jleague) { m_mainpcb->init_jleague(); } -DRIVER_INIT_MEMBER(segas32_new_state,jpark) { m_mainpcb->init_jpark(); } -DRIVER_INIT_MEMBER(segas32_new_state,ga2) { m_mainpcb->init_ga2(); } -DRIVER_INIT_MEMBER(segas32_new_state,scross) { m_mainpcb->init_scross(); } -DRIVER_INIT_MEMBER(segas32_new_state,spidman) { m_mainpcb->init_spidman(); } -DRIVER_INIT_MEMBER(segas32_new_state,sonicp) { m_mainpcb->init_sonicp(); } -DRIVER_INIT_MEMBER(segas32_new_state,dbzvrvs) { m_mainpcb->init_dbzvrvs(); } -DRIVER_INIT_MEMBER(segas32_new_state,brival) { m_mainpcb->init_brival(); } -DRIVER_INIT_MEMBER(segas32_new_state,harddunk) { m_mainpcb->init_harddunk(); } -DRIVER_INIT_MEMBER(segas32_new_state,arabfgt) { m_mainpcb->init_arabfgt(); } -DRIVER_INIT_MEMBER(segas32_new_state,sonic) { m_mainpcb->init_sonic(); } -DRIVER_INIT_MEMBER(segas32_new_state,alien3) { m_mainpcb->init_alien3(); } -DRIVER_INIT_MEMBER(segas32_new_state,darkedge) { m_mainpcb->init_darkedge(); } -DRIVER_INIT_MEMBER(segas32_new_state,radr) { m_mainpcb->init_radr(); } -DRIVER_INIT_MEMBER(segas32_new_state,orunners) { m_mainpcb->init_orunners(); } +DRIVER_INIT_MEMBER(segas32_new_state,titlef) { m_mainpcb->init_titlef(); } +DRIVER_INIT_MEMBER(segas32_new_state,slipstrm) { m_mainpcb->init_slipstrm(); } +DRIVER_INIT_MEMBER(segas32_new_state,radm) { m_mainpcb->init_radm(); } +DRIVER_INIT_MEMBER(segas32_new_state,holo) { m_mainpcb->init_holo(); } +DRIVER_INIT_MEMBER(segas32_new_state,svf) { m_mainpcb->init_svf(); } +DRIVER_INIT_MEMBER(segas32_new_state,jleague) { m_mainpcb->init_jleague(); } +DRIVER_INIT_MEMBER(segas32_new_state,jpark) { m_mainpcb->init_jpark(); } +DRIVER_INIT_MEMBER(segas32_new_state,ga2) { m_mainpcb->init_ga2(); } +DRIVER_INIT_MEMBER(segas32_new_state,scross) { m_mainpcb->init_scross(); } +DRIVER_INIT_MEMBER(segas32_new_state,spidman) { m_mainpcb->init_spidman(); } +DRIVER_INIT_MEMBER(segas32_new_state,sonicp) { m_mainpcb->init_sonicp(); } +DRIVER_INIT_MEMBER(segas32_new_state,dbzvrvs) { m_mainpcb->init_dbzvrvs(); } +DRIVER_INIT_MEMBER(segas32_new_state,brival) { m_mainpcb->init_brival(); } +DRIVER_INIT_MEMBER(segas32_new_state,harddunk) { m_mainpcb->init_harddunk(); } +DRIVER_INIT_MEMBER(segas32_new_state,arabfgt) { m_mainpcb->init_arabfgt(); } +DRIVER_INIT_MEMBER(segas32_new_state,sonic) { m_mainpcb->init_sonic(); } +DRIVER_INIT_MEMBER(segas32_new_state,alien3) { m_mainpcb->init_alien3(); } +DRIVER_INIT_MEMBER(segas32_new_state,darkedge) { m_mainpcb->init_darkedge(); } +DRIVER_INIT_MEMBER(segas32_new_state,radr) { m_mainpcb->init_radr(); } +DRIVER_INIT_MEMBER(segas32_new_state,orunners) { m_mainpcb->init_orunners(); } DRIVER_INIT_MEMBER(segas32_new_state, arescue) { @@ -5144,7 +5144,6 @@ DRIVER_INIT_MEMBER(segas32_new_state, arescue) } DRIVER_INIT_MEMBER(segas32_new_state,f1en) { - m_mainpcb->init_f1en(); m_slavepcb->init_f1en(); @@ -5174,7 +5173,7 @@ void segas32_state::init_arescue(int m_hasdsp) { segas32_common_init(read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this)); if (m_hasdsp) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00007, read16_delegate(FUNC(segas32_state::arescue_dsp_r),this), write16_delegate(FUNC(segas32_state::arescue_dsp_w),this)); - + for (int i = 0; i < 6; i++) m_arescue_dsp_io[i] = 0x00; diff --git a/src/mame/drivers/seicross.c b/src/mame/drivers/seicross.c index 4a6294e52ba..380023ace2d 100644 --- a/src/mame/drivers/seicross.c +++ b/src/mame/drivers/seicross.c @@ -127,7 +127,7 @@ static ADDRESS_MAP_START( mcu_nvram_map, AS_PROGRAM, 8, seicross_state ) AM_RANGE(0x0000, 0x007f) AM_RAM AM_RANGE(0x1000, 0x10ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x2000, 0x2000) AM_DEVWRITE("dac", dac_device, write_unsigned8) - AM_RANGE(0x8000, 0xf7ff) AM_ROM + AM_RANGE(0x8000, 0xf7ff) AM_ROM AM_REGION("maincpu", 0) AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("share1") ADDRESS_MAP_END @@ -137,10 +137,14 @@ static ADDRESS_MAP_START( mcu_no_nvram_map, AS_PROGRAM, 8, seicross_state ) AM_RANGE(0x1005, 0x1005) AM_READ_PORT("DSW2") /* DSW2 */ AM_RANGE(0x1006, 0x1006) AM_READ_PORT("DSW3") /* DSW3 */ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE("dac", dac_device, write_unsigned8) - AM_RANGE(0x8000, 0xf7ff) AM_ROM + AM_RANGE(0x8000, 0xf7ff) AM_ROM AM_REGION("maincpu", 0) AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("share1") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, seicross_state ) + AM_RANGE(0x8000, 0xf7ff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("share1") +ADDRESS_MAP_END @@ -427,6 +431,11 @@ static MACHINE_CONFIG_DERIVED( nvram, no_nvram ) MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", seicross_state, nvram_init) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( friskytb, nvram ) + MCFG_CPU_MODIFY("mcu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + /*************************************************************************** @@ -435,7 +444,7 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( friskyt ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "ftom.01", 0x0000, 0x1000, CRC(bce5d486) SHA1(b3226d5737490f18092227a663e89ad48f39d82c) ) ROM_LOAD( "ftom.02", 0x1000, 0x1000, CRC(63157d6e) SHA1(2792f3d918ffee3818eca98f52192a069ab60678) ) ROM_LOAD( "ftom.03", 0x2000, 0x1000, CRC(c8d9ef2c) SHA1(43dd6bfd93188004b977b97120df28c028e8582b) ) @@ -445,9 +454,6 @@ ROM_START( friskyt ) ROM_LOAD( "ftom.07", 0x6000, 0x1000, CRC(b2ef303a) SHA1(a7150457b454e15c06fa832d42dd1f0e165fcd6e) ) ROM_LOAD( "ft8_8.rom", 0x7000, 0x0800, CRC(10461a24) SHA1(c1f98316a4e90a2a6ef4953708b90c9546caaedd) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "ftom.11", 0x0000, 0x1000, CRC(1ec6ff65) SHA1(aab589c89cd14549b35f4dece5d3c231033c0c1a) ) ROM_LOAD( "ftom.12", 0x1000, 0x1000, CRC(3b8f40b5) SHA1(08e0c1fce11ee6c507c28b0d659c5b010f2f2b6f) ) @@ -460,7 +466,7 @@ ROM_START( friskyt ) ROM_END ROM_START( friskyta ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "ft.01", 0x0000, 0x1000, CRC(0ea46e19) SHA1(3feb3ee882926c0efa602cf92e6879e84a6050ed) ) ROM_LOAD( "ft.02", 0x1000, 0x1000, CRC(4f7b8662) SHA1(400c47d7ab5f3a749dbadb2286255b969ec48348) ) ROM_LOAD( "ft.03", 0x2000, 0x1000, CRC(1eb1b77c) SHA1(c08d6c1f1bbe2d41b0f6336a0c53ec993556e6b4) ) @@ -470,9 +476,6 @@ ROM_START( friskyta ) ROM_LOAD( "ft.07", 0x6000, 0x1000, CRC(0ba02b2e) SHA1(1260c16d589fca37bf58ee28a4795f4b6333d0b9) ) ROM_LOAD( "ft8_8.rom", 0x7000, 0x0800, CRC(10461a24) SHA1(c1f98316a4e90a2a6ef4953708b90c9546caaedd) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "ft.11", 0x0000, 0x1000, CRC(956d924a) SHA1(e61bf5f187932c6cb676b4120cd95fe422f6a1a6) ) ROM_LOAD( "ft.12", 0x1000, 0x1000, CRC(c028d3b8) SHA1(9e8768b9658f8b05ade4dd5fb2ecde4a52627bc1) ) @@ -486,7 +489,7 @@ ROM_END ROM_START( friskytb ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "1.3a", 0x0000, 0x1000, CRC(554bdb0f) SHA1(d56a421329c5191599983009e841cd84d5b7c710) ) ROM_LOAD( "2.3b", 0x1000, 0x1000, CRC(0658633a) SHA1(3bf09e0d77bd8fcb66563c82c849c0cc45d9cacf) ) ROM_LOAD( "3.3d", 0x2000, 0x1000, CRC(c8de15ff) SHA1(1bb2108700e9f8aa9c5416324a2d0bdd05e8ff25) ) @@ -496,9 +499,6 @@ ROM_START( friskytb ) ROM_LOAD( "7.3i", 0x6000, 0x1000, CRC(aa36a6b8) SHA1(bf8af71313459a775b07dcfdce455077c4f499bf) ) ROM_LOAD( "8.3j", 0x7000, 0x0800, CRC(10461a24) SHA1(c1f98316a4e90a2a6ef4953708b90c9546caaedd) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "11.7l", 0x0000, 0x1000, CRC(caa93315) SHA1(af8fd135c0a9c0278705975c127a91f246341da1) ) // 99.707031% - tile 0x69 is blank vs ft.11 (it's the symbol used for lives, instead this set shows lives to the left of the HIGH SCORE text using different gfx) ROM_LOAD( "12.7n", 0x1000, 0x1000, CRC(c028d3b8) SHA1(9e8768b9658f8b05ade4dd5fb2ecde4a52627bc1) ) @@ -511,7 +511,7 @@ ROM_START( friskytb ) ROM_END ROM_START( radrad ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "1.3a", 0x0000, 0x1000, CRC(b1e958ca) SHA1(3ab5fc3314f202ba527470eacbb76d52fe969bca) ) ROM_LOAD( "2.3b", 0x1000, 0x1000, CRC(30ba76b3) SHA1(e6af1fc35fdc71d5436f0d29e5722cbcb4409196) ) ROM_LOAD( "3.3c", 0x2000, 0x1000, CRC(1c9f397b) SHA1(7f556c5bef5309d5048c3b9671b88ad646a8b648) ) @@ -521,9 +521,6 @@ ROM_START( radrad ) ROM_LOAD( "7.3g", 0x6000, 0x1000, CRC(02b1f9c9) SHA1(6b857ae477d3c92a58494140ffa3337dba8e77cc) ) ROM_LOAD( "8.3h", 0x7000, 0x0800, CRC(911c90e8) SHA1(94fa91e767ab27a1616f1768f97a44a59a3f3294) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "11.l7", 0x0000, 0x1000, CRC(4ace7afb) SHA1(3c495f106505d5dfed93393db1f1b3842f603448) ) ROM_LOAD( "12.n7", 0x1000, 0x1000, CRC(b19b8473) SHA1(42160f978f8e209a89be097b5cfc7ac0aeec49c5) ) @@ -539,7 +536,7 @@ ROM_START( radrad ) ROM_END ROM_START( seicross ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "smc1", 0x0000, 0x1000, CRC(f6c3aeca) SHA1(d57019e80f7e3d47ca74f54604e92d40ba9819fc) ) ROM_LOAD( "smc2", 0x1000, 0x1000, CRC(0ec6c218) SHA1(d8cffea48d8afd229f2008399afe3858c13653e5) ) ROM_LOAD( "smc3", 0x2000, 0x1000, CRC(ceb3c8f4) SHA1(e49f834637b4addcf362cd010e31802c3e145cbe) ) @@ -549,9 +546,6 @@ ROM_START( seicross ) ROM_LOAD( "smc7", 0x6000, 0x1000, CRC(13052b03) SHA1(2866f2533a788f734310a74789f762f3fa17a57a) ) ROM_LOAD( "smc8", 0x7000, 0x0800, CRC(2093461d) SHA1(0d640bc7ee1e9ffe32580e3143677475145b06d2) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "sz11.7k", 0x0000, 0x1000, CRC(fbd9b91d) SHA1(6b3581f4b518c058b970d569ced07dd7dc6a87e6) ) ROM_LOAD( "smcd", 0x1000, 0x1000, CRC(c3c953c4) SHA1(a96937a48b59b7e992e53d279c10a5f3ea7f9a6f) ) @@ -567,7 +561,7 @@ ROM_START( seicross ) ROM_END ROM_START( sectrzon ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x7800, "maincpu", 0 ) ROM_LOAD( "sz1.3a", 0x0000, 0x1000, CRC(f0a45cb4) SHA1(ab3b8d78e25cdbb2fd6a6c0718ae13767364994d) ) ROM_LOAD( "sz2.3c", 0x1000, 0x1000, CRC(fea68ddb) SHA1(b9ed0cad9a2ded04bcc7042d975b77be63313070) ) ROM_LOAD( "sz3.3d", 0x2000, 0x1000, CRC(baad4294) SHA1(e7fc3ccc940de6df8d786c986b602127c9db9ebb) ) @@ -577,9 +571,6 @@ ROM_START( sectrzon ) ROM_LOAD( "sz7.3i", 0x6000, 0x1000, CRC(7b34dc1c) SHA1(fb163a908c991cd214e0d2d685e74563a460a929) ) ROM_LOAD( "sz8.3j", 0x7000, 0x0800, CRC(9933526a) SHA1(2178ef8653f1d60be28bcaebe1033ef7ae480157) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* 64k for the protection mcu */ - ROM_COPY( "maincpu", 0x0000, 0x8000, 0x8000 ) /* shares the main program ROMs and RAM with the main CPU. */ - ROM_REGION( 0x4000, "gfx1", 0 ) ROM_LOAD( "sz11.7k", 0x0000, 0x1000, CRC(fbd9b91d) SHA1(6b3581f4b518c058b970d569ced07dd7dc6a87e6) ) ROM_LOAD( "sz12.7m", 0x1000, 0x1000, CRC(2bdef9ad) SHA1(50fe41e81c1307317b4fb6b47bf0619d141c42ff) ) @@ -596,21 +587,18 @@ ROM_END DRIVER_INIT_MEMBER(seicross_state,friskytb) { - UINT8 *ROM = memregion("mcu")->base(); - address_space &space = m_mcu->space(AS_PROGRAM); + UINT8 *ROM = memregion("maincpu")->base(); // this code is in ROM 6.3h, maps to MCU at dxxx - for (int i = 0; i < 0x8000; i++) + for (int i = 0; i < 0x7800; i++) { - ROM[i] = BITSWAP8(ROM[i + 0x8000], 6, 7, 5, 4, 3, 2, 0, 1); + m_decrypted_opcodes[i] = BITSWAP8(ROM[i], 6, 7, 5, 4, 3, 2, 0, 1); } - - space.set_decrypted_region(0x8000, 0xffff, ROM); } GAME( 1981, friskyt, 0, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1981, friskyta, friskyt, nvram, friskyt, driver_device, 0, ROT0, "Nichibutsu", "Frisky Tom (set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1981, friskytb, friskyt, nvram, friskyt, seicross_state, friskytb, ROT0, "Nichibutsu", "Frisky Tom (set 3, encrypted)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // protection mcu runs encrypted opcodes +GAME( 1981, friskytb, friskyt, friskytb, friskyt, seicross_state, friskytb, ROT0, "Nichibutsu", "Frisky Tom (set 3, encrypted)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // protection mcu runs encrypted opcodes GAME( 1982, radrad, 0, no_nvram, radrad, driver_device, 0, ROT0, "Nichibutsu USA", "Radical Radial", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1984, seicross, 0, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Seicross", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1984, sectrzon, seicross, no_nvram, seicross, driver_device, 0, ROT90, "Nichibutsu / Alice", "Sector Zone", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/senjyo.c b/src/mame/drivers/senjyo.c index 16b3440d986..decc626fc7d 100644 --- a/src/mame/drivers/senjyo.c +++ b/src/mame/drivers/senjyo.c @@ -166,8 +166,12 @@ static ADDRESS_MAP_START( senjyo_map, AS_PROGRAM, 8, senjyo_state ) AM_RANGE(0xd005, 0xd005) AM_READ_PORT("DSW2") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, senjyo_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( senjyo_sound_map, AS_PROGRAM, 8, senjyo_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_RAM AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("sn1", sn76496_device, write) AM_RANGE(0x9000, 0x9000) AM_DEVWRITE("sn2", sn76496_device, write) @@ -233,7 +237,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( starforb_sound_map, AS_PROGRAM, 8, senjyo_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_RAM AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("sn1", sn76496_device, write) AM_RANGE(0x9000, 0x9000) AM_DEVWRITE("sn2", sn76496_device, write) @@ -606,8 +610,12 @@ static MACHINE_CONFIG_START( senjyo, senjyo_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( senjyox, senjyo ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( starforb, senjyo ) +static MACHINE_CONFIG_DERIVED( starforb, senjyox ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -625,13 +633,13 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( senjyo ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "08m_05t.bin", 0x0000, 0x2000, CRC(b1f3544d) SHA1(59997164dfb740fce1862d89754be7517303161a) ) ROM_LOAD( "08k_04t.bin", 0x2000, 0x2000, CRC(e34468a8) SHA1(1931788e4ebe0dab9525f795b639be6544a6b31a) ) ROM_LOAD( "08j_03t.bin", 0x4000, 0x2000, CRC(c33aedee) SHA1(5adf83268ef7b91194dea41204bdb931a14f2158) ) ROM_LOAD( "08f_02t.bin", 0x6000, 0x2000, CRC(0ef4db9e) SHA1(0dcb216495f4328c44cc0af87ffb0bd255b7dc1a) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "02h_01t.bin", 0x0000, 0x2000, CRC(c1c24455) SHA1(24a2ab9e4df793f68f51bbe6a1313f38d951a8af) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -666,11 +674,11 @@ ROM_START( senjyo ) ROM_END ROM_START( starforc ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "3.3p", 0x0000, 0x4000, CRC(8ba27691) SHA1(2b8b1e634ef5bed5c61a078e64a6dda77f84cdf5) ) ROM_LOAD( "2.3mn", 0x4000, 0x4000, CRC(0fc4d2d6) SHA1(0743e3928d5cc0e3f1bcdaf4b0cc83aeb7a2f7a8) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) /* 64k for sound board */ ROM_LOAD( "1.3hj", 0x0000, 0x2000, CRC(2735bb22) SHA1(1bd0558e05b41aebab3911991969512df904fea5) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -703,13 +711,13 @@ ROM_START( starforc ) ROM_END ROM_START( starforcb ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "a2.8m", 0x0000, 0x2000, CRC(e81e8b7d) SHA1(829a082a335a0cf5bf8cc97bee96e62271f03ff4) ) ROM_LOAD( "a3.8k", 0x2000, 0x2000, CRC(7e98f0ab) SHA1(76eb387fbf5d04b7951a115d29076d1fd21346c4) ) ROM_LOAD( "a4.8j", 0x4000, 0x2000, CRC(285bc599) SHA1(c2f294a5e3ca39084e8f8503d6e9e00885ad0609) ) ROM_LOAD( "a5.8f", 0x6000, 0x2000, CRC(74d328b1) SHA1(3098438d47f650507de8b1d0aecfca81663cbe9c) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "a0.2e", 0x0000, 0x2000, CRC(5ab0e2fa) SHA1(78f0290d1e006a39bb8ee5a29cf229ed2c1f2b09) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -745,13 +753,13 @@ ROM_START( starforcb ) ROM_END ROM_START( starforca ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "5.bin", 0x0000, 0x2000, CRC(7691bbd4) SHA1(efcab11ea0ed58b6a47c9d7a994c921dfaa1b47e) ) ROM_LOAD( "4.bin", 0x2000, 0x2000, CRC(32f3c34e) SHA1(9ecaa46fe296c2f2e9c8faf3d40085c0f10acbe1) ) ROM_LOAD( "3.bin", 0x4000, 0x2000, CRC(5e99cfa0) SHA1(d16d5247f4afb7abb5b8331ad7ae9d4d1f6d6554) ) ROM_LOAD( "2.bin", 0x6000, 0x2000, CRC(311c6e59) SHA1(ff3ba96ffade7602d3b150dae4bdc1c02a148576) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "0.bin", 0x0000, 0x2000, CRC(a277c268) SHA1(99ed8439119fa4b850ad8aadb7ff3e54d4cd40be) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -787,13 +795,13 @@ ROM_START( starforca ) ROM_END ROM_START( starforce ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "starfore.005", 0x0000, 0x2000, CRC(825f7ebe) SHA1(d63fd516e075bcc28d42189216b95bbf491a4cd1) ) ROM_LOAD( "starfore.004", 0x2000, 0x2000, CRC(fbcecb65) SHA1(0406ae134915539a171603ecdd1b549f98dd048c) ) ROM_LOAD( "starfore.003", 0x4000, 0x2000, CRC(9f8013b9) SHA1(5398c97d84b4458ff926e07d6189d60565fbd8f1) ) ROM_LOAD( "starfore.002", 0x6000, 0x2000, CRC(f8111eba) SHA1(cf3295ffae4e36e87aea4332613f2cafb51522ce) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "starfore.000", 0x0000, 0x2000, CRC(a277c268) SHA1(99ed8439119fa4b850ad8aadb7ff3e54d4cd40be) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -826,11 +834,11 @@ ROM_START( starforce ) ROM_END ROM_START( megaforc ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "mf3.bin", 0x0000, 0x4000, CRC(d3ea82ec) SHA1(e15fda65ba24517cc04abc55b5d079a33327553c) ) ROM_LOAD( "mf2.bin", 0x4000, 0x4000, CRC(aa320718) SHA1(cbbf8e4d06a1ecf77d776058d965afdaa7f5b47f) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "1.3hj", 0x0000, 0x2000, CRC(2735bb22) SHA1(1bd0558e05b41aebab3911991969512df904fea5) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -863,11 +871,11 @@ ROM_START( megaforc ) ROM_END ROM_START( baluba ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "0", 0x0000, 0x4000, CRC(0e2ebe32) SHA1(d5cac260b19dc4e8d2064a7e3de5d52ab0eb95d0) ) ROM_LOAD( "1", 0x4000, 0x4000, CRC(cde97076) SHA1(ef47851b2ed0d820e1564545795b707d00d5c6ce) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for sound board */ + ROM_REGION( 0x2000, "sub", 0 ) ROM_LOAD( "2", 0x0000, 0x2000, CRC(441fbc64) SHA1(3853f80043e28e06a3ee399e3cd261b3ee94e0b9) ) ROM_REGION( 0x03000, "gfx1", 0 ) @@ -907,8 +915,29 @@ DRIVER_INIT_MEMBER(senjyo_state,starforc) } DRIVER_INIT_MEMBER(senjyo_state,starfore) { - /* encrypted CPU */ - suprloco_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); m_is_senjyo = 0; m_scrollhack = 0; @@ -916,8 +945,29 @@ DRIVER_INIT_MEMBER(senjyo_state,starfore) DRIVER_INIT_MEMBER(senjyo_state,starfora) { - /* encrypted CPU */ - yamato_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */ + { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); m_is_senjyo = 0; m_scrollhack = 1; @@ -932,8 +982,8 @@ DRIVER_INIT_MEMBER(senjyo_state,senjyo) GAME( 1983, senjyo, 0, senjyo, senjyo, senjyo_state, senjyo, ROT90, "Tehkan", "Senjyo", GAME_SUPPORTS_SAVE ) GAME( 1984, starforc, 0, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan", "Star Force", GAME_SUPPORTS_SAVE ) -GAME( 1984, starforce,starforc, senjyo, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1984, starforce,starforc, senjyox, starforc, senjyo_state, starfore, ROT90, "Tehkan", "Star Force (encrypted, set 1)", GAME_SUPPORTS_SAVE ) GAME( 1984, starforcb,starforc, starforb,starforc, senjyo_state, starfore, ROT90, "bootleg", "Star Force (encrypted, bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1984, starforca,starforc, senjyo, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1984, starforca,starforc, senjyox, starforc, senjyo_state, starfora, ROT90, "Tehkan", "Star Force (encrypted, set 2)", GAME_SUPPORTS_SAVE ) GAME( 1985, megaforc, starforc, senjyo, starforc, senjyo_state, starforc, ROT90, "Tehkan (Video Ware license)", "Mega Force", GAME_SUPPORTS_SAVE ) GAME( 1986, baluba, 0, senjyo, baluba, senjyo_state, starforc, ROT90, "Able Corp, Ltd.", "Baluba-louk no Densetsu (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c index 08c7af95f61..07ea0c4ced3 100644 --- a/src/mame/drivers/seta.c +++ b/src/mame/drivers/seta.c @@ -1996,7 +1996,7 @@ static ADDRESS_MAP_START( wrofaero_map, AS_PROGRAM, 16, seta_state ) #else AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP // ? #endif - AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP // ? VBlank IRQ Ack + AM_RANGE(0xe00000, 0xe00001) AM_WRITE(watchdog_reset16_w) AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP // ? Sound IRQ Ack ADDRESS_MAP_END @@ -10843,44 +10843,44 @@ ROM_END same factory as normal boards same as daiohc. Modified layout allowing split ROMs */ ROM_START( gundharac ) - ROM_REGION( 0x200000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "4.U3", 0x000000, 0x080000, CRC(14e9970a) SHA1(31964bd290cc94c40684adf3a5d129b1c3addc3b) ) - ROM_LOAD16_BYTE( "2.U4", 0x000001, 0x080000, CRC(96dfc658) SHA1(f570bc49758535eb00d93ecce9f75832f97a0d8d) ) - ROM_LOAD16_BYTE( "3.U103", 0x100000, 0x080000, CRC(312f58e2) SHA1(a74819d2f84a00c233489893f12c9ab1a98459cf) ) - ROM_LOAD16_BYTE( "1.U102", 0x100001, 0x080000, CRC(8d23a23c) SHA1(9e9a6488db424c81a97edcb7115cc070fe35c077) ) + ROM_REGION( 0x200000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "4.U3", 0x000000, 0x080000, CRC(14e9970a) SHA1(31964bd290cc94c40684adf3a5d129b1c3addc3b) ) + ROM_LOAD16_BYTE( "2.U4", 0x000001, 0x080000, CRC(96dfc658) SHA1(f570bc49758535eb00d93ecce9f75832f97a0d8d) ) + ROM_LOAD16_BYTE( "3.U103", 0x100000, 0x080000, CRC(312f58e2) SHA1(a74819d2f84a00c233489893f12c9ab1a98459cf) ) + ROM_LOAD16_BYTE( "1.U102", 0x100001, 0x080000, CRC(8d23a23c) SHA1(9e9a6488db424c81a97edcb7115cc070fe35c077) ) - ROM_REGION( 0x800000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x800000, "gfx1", 0 ) /* Sprites */ ROM_LOAD16_BYTE( "19.U140", 0x000000, 0x080000, CRC(32d92c28) SHA1(7ba67f715f094aacf2dc2399809e4dfc7e4ca241) ) - ROM_LOAD16_BYTE( "23.U142", 0x000001, 0x080000, CRC(ff44db9b) SHA1(76ecd3ce3b6b33f3ae0b0454d58cf37d545dd72c) ) - ROM_LOAD16_BYTE( "21.U141", 0x100000, 0x080000, CRC(1901dc08) SHA1(b19428a7510d6e28a39bdf6ecc9732e3c2d19214) ) - ROM_LOAD16_BYTE( "25.U143", 0x100001, 0x080000, CRC(877289a2) SHA1(7482320e319d7b641fabba5aeeaa1237b693a219) ) + ROM_LOAD16_BYTE( "23.U142", 0x000001, 0x080000, CRC(ff44db9b) SHA1(76ecd3ce3b6b33f3ae0b0454d58cf37d545dd72c) ) + ROM_LOAD16_BYTE( "21.U141", 0x100000, 0x080000, CRC(1901dc08) SHA1(b19428a7510d6e28a39bdf6ecc9732e3c2d19214) ) + ROM_LOAD16_BYTE( "25.U143", 0x100001, 0x080000, CRC(877289a2) SHA1(7482320e319d7b641fabba5aeeaa1237b693a219) ) ROM_LOAD16_BYTE( "18.U140-B", 0x200000, 0x080000, CRC(4f023fb0) SHA1(815765c9783e44762bf57a3fbfad4385c316343a) ) ROM_LOAD16_BYTE( "22.U142-B", 0x200001, 0x080000, CRC(6f3fe7e7) SHA1(71bc347c06678f4ae7850799da6346c6447bf3c0) ) ROM_LOAD16_BYTE( "20.U141-B", 0x300000, 0x080000, CRC(7f1932e0) SHA1(13262a7322ad29cf7c85461204a3518e900c6145) ) ROM_LOAD16_BYTE( "24.U143-B", 0x300001, 0x080000, CRC(066a2e2b) SHA1(186729918a89535484ab86dd58caf20ccce81501) ) - ROM_LOAD16_BYTE( "9.U144", 0x400000, 0x080000, CRC(6b4a531f) SHA1(701d6b2d87a742c8a2ab36331bd843dcd3309eae) ) - ROM_LOAD16_BYTE( "13.U146", 0x400001, 0x080000, CRC(45be3df4) SHA1(36667bf5e4b80d17a9d7b6ce4df7498f94681c46) ) - ROM_LOAD16_BYTE( "11.U145", 0x500000, 0x080000, CRC(f5210aa5) SHA1(4834d905f699dbec1cdacea6b320271c291aa2a7) ) - ROM_LOAD16_BYTE( "15.U147", 0x500001, 0x080000, CRC(17003119) SHA1(a2edd65c98bc654b541dad3e3783d90931c97597) ) - ROM_LOAD16_BYTE( "8.U144-B", 0x600000, 0x080000, CRC(ad9d9338) SHA1(33d6c881a20e2150017cc26f929473291e561718) ) - ROM_LOAD16_BYTE( "12.U146-B", 0x600001, 0x080000, CRC(0fd4c062) SHA1(7f418d43d9ba884c504f6fe3c04b11724412ac6b) ) - ROM_LOAD16_BYTE( "10.U145-B", 0x700000, 0x080000, CRC(7c5d12b9) SHA1(6ee45c4da6994540852153752e2818a8ea8ecf1a) ) - ROM_LOAD16_BYTE( "14.U147-B", 0x700001, 0x080000, CRC(5a8af50f) SHA1(3b7937ba720fcbbc5e29c1b95a97c29e8ff5490a) ) - - ROM_REGION( 0x200000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "5.U148", 0x000000, 0x080000, CRC(0c740f9b) SHA1(f6d135c3318ff0d50d40921aa108b1b332c1a086) ) - ROM_LOAD16_BYTE( "6.U150", 0x000001, 0x080000, CRC(ba60eb98) SHA1(7204269816332bbb3401d9f20a513372ffe78500) ) - ROM_LOAD16_BYTE( "7.U154", 0x100000, 0x080000, CRC(b768e666) SHA1(473fa52c16c0a9f321e6429947a3e0fc1ef22f7e) ) - - ROM_REGION( 0x400000, "gfx3", 0 ) /* Layer 2 */ - ROM_LOAD16_BYTE( "26.U164", 0x000000, 0x080000, CRC(be3ccaba) SHA1(98f8b83cbed00932866375d21f86ee5c9bddb2a6) ) - ROM_LOAD16_BYTE( "28.U166", 0x000001, 0x080000, CRC(8a650a4e) SHA1(1f6eda27b39ad052e3d9a8a72cb0a072e7be4487) ) - ROM_LOAD16_BYTE( "27.U165", 0x100000, 0x080000, CRC(47994ff0) SHA1(25211a9af01f77788578bb524619d95b5b86e241) ) - ROM_LOAD16_BYTE( "29.U167", 0x100001, 0x080000, CRC(453c3d3f) SHA1(151528b6b1e7f8c059d67dbaca61e7c382e9ce04) ) + ROM_LOAD16_BYTE( "9.U144", 0x400000, 0x080000, CRC(6b4a531f) SHA1(701d6b2d87a742c8a2ab36331bd843dcd3309eae) ) + ROM_LOAD16_BYTE( "13.U146", 0x400001, 0x080000, CRC(45be3df4) SHA1(36667bf5e4b80d17a9d7b6ce4df7498f94681c46) ) + ROM_LOAD16_BYTE( "11.U145", 0x500000, 0x080000, CRC(f5210aa5) SHA1(4834d905f699dbec1cdacea6b320271c291aa2a7) ) + ROM_LOAD16_BYTE( "15.U147", 0x500001, 0x080000, CRC(17003119) SHA1(a2edd65c98bc654b541dad3e3783d90931c97597) ) + ROM_LOAD16_BYTE( "8.U144-B", 0x600000, 0x080000, CRC(ad9d9338) SHA1(33d6c881a20e2150017cc26f929473291e561718) ) + ROM_LOAD16_BYTE( "12.U146-B", 0x600001, 0x080000, CRC(0fd4c062) SHA1(7f418d43d9ba884c504f6fe3c04b11724412ac6b) ) + ROM_LOAD16_BYTE( "10.U145-B", 0x700000, 0x080000, CRC(7c5d12b9) SHA1(6ee45c4da6994540852153752e2818a8ea8ecf1a) ) + ROM_LOAD16_BYTE( "14.U147-B", 0x700001, 0x080000, CRC(5a8af50f) SHA1(3b7937ba720fcbbc5e29c1b95a97c29e8ff5490a) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) /* Layer 1 */ + ROM_LOAD16_BYTE( "5.U148", 0x000000, 0x080000, CRC(0c740f9b) SHA1(f6d135c3318ff0d50d40921aa108b1b332c1a086) ) + ROM_LOAD16_BYTE( "6.U150", 0x000001, 0x080000, CRC(ba60eb98) SHA1(7204269816332bbb3401d9f20a513372ffe78500) ) + ROM_LOAD16_BYTE( "7.U154", 0x100000, 0x080000, CRC(b768e666) SHA1(473fa52c16c0a9f321e6429947a3e0fc1ef22f7e) ) + + ROM_REGION( 0x400000, "gfx3", 0 ) /* Layer 2 */ + ROM_LOAD16_BYTE( "26.U164", 0x000000, 0x080000, CRC(be3ccaba) SHA1(98f8b83cbed00932866375d21f86ee5c9bddb2a6) ) + ROM_LOAD16_BYTE( "28.U166", 0x000001, 0x080000, CRC(8a650a4e) SHA1(1f6eda27b39ad052e3d9a8a72cb0a072e7be4487) ) + ROM_LOAD16_BYTE( "27.U165", 0x100000, 0x080000, CRC(47994ff0) SHA1(25211a9af01f77788578bb524619d95b5b86e241) ) + ROM_LOAD16_BYTE( "29.U167", 0x100001, 0x080000, CRC(453c3d3f) SHA1(151528b6b1e7f8c059d67dbaca61e7c382e9ce04) ) ROM_LOAD16_BYTE( "16.U152", 0x200000, 0x080000, CRC(5ccc500b) SHA1(d3a2a5658cac8d788e0a1189c184309b8394b10a) ) ROM_LOAD16_BYTE( "17.U153", 0x300000, 0x080000, CRC(5586d086) SHA1(e43d5e8834701f40389400f68a99353e67598f6d) ) - ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ + ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ ROM_LOAD( "30.U69", 0x000000, 0x080000, CRC(3111a98a) SHA1(75e17a0113060a10551b2b8c17b19890eb7aa0a6) ) ROM_LOAD( "31.U70", 0x080000, 0x080000, CRC(30cb2524) SHA1(85deb83262bbe481404705e163e5eb9362985b01) ) ROM_END diff --git a/src/mame/drivers/sg1000a.c b/src/mame/drivers/sg1000a.c index dbee65b80ea..2da7f13e8f1 100644 --- a/src/mame/drivers/sg1000a.c +++ b/src/mame/drivers/sg1000a.c @@ -126,13 +126,15 @@ class sg1000a_state : public driver_device public: sg1000a_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } DECLARE_WRITE_LINE_MEMBER(vdp_interrupt); DECLARE_WRITE8_MEMBER(sg1000a_coin_counter_w); DECLARE_DRIVER_INIT(sg1000a); DECLARE_DRIVER_INIT(chwrestl); required_device<cpu_device> m_maincpu; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; @@ -143,11 +145,15 @@ public: *************************************/ static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, sg1000a_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM // separate region needed for decrypting - AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_MIRROR(0x400) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, sg1000a_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("maincpu", 0x8000) +ADDRESS_MAP_END + static ADDRESS_MAP_START( io_map, AS_IO, 8, sg1000a_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("snsnd", sn76489_device, write) @@ -285,6 +291,11 @@ static MACHINE_CONFIG_START( sg1000a, sg1000a_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sg1000ax, sg1000a ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + /************************************* * * ROM definitions @@ -324,8 +335,30 @@ DRIVER_INIT_MEMBER(sg1000a_state,sg1000a) DRIVER_INIT_MEMBER(sg1000a_state,chwrestl) { + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + DRIVER_INIT_CALL(sg1000a); - regulus_decode(machine(), "maincpu"); + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); } /************************************* @@ -334,6 +367,6 @@ DRIVER_INIT_MEMBER(sg1000a_state,chwrestl) * *************************************/ -GAME( 1984, chboxing, 0, sg1000a, chboxing, sg1000a_state, sg1000a, ROT0, "Sega", "Champion Boxing", 0 ) -GAME( 1985, chwrestl, 0, sg1000a, chwrestl, sg1000a_state, chwrestl, ROT0, "Sega", "Champion Pro Wrestling", 0 ) -GAME( 1985, dokidoki, 0, sg1000a, dokidoki, sg1000a_state, sg1000a, ROT0, "Sega", "Doki Doki Penguin Land", 0 ) +GAME( 1984, chboxing, 0, sg1000a, chboxing, sg1000a_state, sg1000a, ROT0, "Sega", "Champion Boxing", 0 ) +GAME( 1985, chwrestl, 0, sg1000ax, chwrestl, sg1000a_state, chwrestl, ROT0, "Sega", "Champion Pro Wrestling", 0 ) +GAME( 1985, dokidoki, 0, sg1000a, dokidoki, sg1000a_state, sg1000a, ROT0, "Sega", "Doki Doki Penguin Land", 0 ) diff --git a/src/mame/drivers/sidearms.c b/src/mame/drivers/sidearms.c index 3b082deff16..cdcfac70ddb 100644 --- a/src/mame/drivers/sidearms.c +++ b/src/mame/drivers/sidearms.c @@ -978,7 +978,7 @@ ROM_START( turtshipk ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "t-4.8a", 0x00000, 0x08000, CRC(1cbe48e8) SHA1(6ac5981d36a44595bb8dc847c54c7be7b374f82c) ) - ROM_REGION( 0x04000, "gfx1", 0 ) /* Really a 27128? */ + ROM_REGION( 0x04000, "gfx1", 0 ) /* Really a 27128? */ ROM_LOAD( "turtship.005", 0x00000, 0x04000, CRC(651fef75) SHA1(9c821a2ee30c222987f0d4192133776490d6a4e0) ) /* characters */ ROM_REGION( 0x80000, "gfx2", 0 ) @@ -1002,69 +1002,69 @@ ROM_START( turtshipk ) ROM_END ROM_START( turtshipko ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + banked ROMs images */ - ROM_LOAD( "T-3.G5", 0x00000, 0x08000, CRC(cd789535) SHA1(3c4f94c751645b61066177fbf3157924ad177c32) ) - ROM_LOAD( "T-2.G3", 0x08000, 0x08000, CRC(253678c0) SHA1(1470fd936003462d480c759658628ea085d4bd71) ) - ROM_LOAD( "T-1.E3", 0x10000, 0x08000, CRC(d6fdc376) SHA1(3f4e1fde8b83e3762f9499dfe291309efe940093) ) - - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "T-4.A8", 0x00000, 0x08000, CRC(1cbe48e8) SHA1(6ac5981d36a44595bb8dc847c54c7be7b374f82c) ) - - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "T-5.K8", 0x00000, 0x04000, CRC(35c3dbc5) SHA1(6700c72e5e0f7bd1429d342cb5d3daccd6b1b70f) ) /* characters */ - ROM_CONTINUE( 0x00000, 0x04000 ) /* A14 tied high, only upper half is used */ - - ROM_REGION( 0x80000, "gfx2", 0 ) - ROM_LOAD( "T-8.D1", 0x00000, 0x10000, CRC(2f0b2336) SHA1(a869e0a50aab7d29afbca46fa04bd470488a8eeb) ) /* tiles */ - ROM_LOAD( "T-10.C3", 0x10000, 0x10000, CRC(6a0072f4) SHA1(d74b53ed90a4d01020a179f263a39b7547b8f82e) ) - ROM_RELOAD( 0x30000, 0x10000) - ROM_LOAD( "T-11.D3", 0x20000, 0x10000, CRC(53da6cb1) SHA1(52720746298adb01828f959f81b385d268c94343) ) - ROM_LOAD( "T-6.A1", 0x40000, 0x10000, CRC(a7cce654) SHA1(f6c99622dcacc1d76021ca29b0bbceefbb75c499) ) - ROM_LOAD( "T-7.C1", 0x50000, 0x10000, CRC(90dd8415) SHA1(8e9d43ff9164fb287ab82df7da8890976b9d21c7) ) - ROM_RELOAD( 0x70000, 0x10000) - ROM_LOAD( "T-9.A3", 0x60000, 0x10000, CRC(44762916) SHA1(3427066fc02d1b9b71a59ac41d3332d5cd8d1423) ) - - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "T-13.I1", 0x00000, 0x10000, CRC(1cc87f50) SHA1(d7d8a4376b556675dafa0a407bb34b6017f17e7d) ) /* sprites */ - ROM_LOAD( "T-15.I3", 0x10000, 0x10000, CRC(775ee5d9) SHA1(e39eb558cc2d5cdf4c87b96f85af72e5600b995e) ) - ROM_LOAD( "T-12.G1", 0x20000, 0x10000, CRC(57783312) SHA1(57942e8c3b7be63ea62bae3c104cb2842eb6b755) ) - ROM_LOAD( "T-14.G3", 0x30000, 0x10000, CRC(a30e3346) SHA1(150a837fb5d4705df9e8e9a94f78cff0e1c57d64) ) - - ROM_REGION( 0x08000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "T-16.F9", 0x00000, 0x08000, CRC(9b377277) SHA1(4858560e35144727aea958023f3df785baa994a8) ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + banked ROMs images */ + ROM_LOAD( "T-3.G5", 0x00000, 0x08000, CRC(cd789535) SHA1(3c4f94c751645b61066177fbf3157924ad177c32) ) + ROM_LOAD( "T-2.G3", 0x08000, 0x08000, CRC(253678c0) SHA1(1470fd936003462d480c759658628ea085d4bd71) ) + ROM_LOAD( "T-1.E3", 0x10000, 0x08000, CRC(d6fdc376) SHA1(3f4e1fde8b83e3762f9499dfe291309efe940093) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "T-4.A8", 0x00000, 0x08000, CRC(1cbe48e8) SHA1(6ac5981d36a44595bb8dc847c54c7be7b374f82c) ) + + ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_LOAD( "T-5.K8", 0x00000, 0x04000, CRC(35c3dbc5) SHA1(6700c72e5e0f7bd1429d342cb5d3daccd6b1b70f) ) /* characters */ + ROM_CONTINUE( 0x00000, 0x04000 ) /* A14 tied high, only upper half is used */ + + ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_LOAD( "T-8.D1", 0x00000, 0x10000, CRC(2f0b2336) SHA1(a869e0a50aab7d29afbca46fa04bd470488a8eeb) ) /* tiles */ + ROM_LOAD( "T-10.C3", 0x10000, 0x10000, CRC(6a0072f4) SHA1(d74b53ed90a4d01020a179f263a39b7547b8f82e) ) + ROM_RELOAD( 0x30000, 0x10000) + ROM_LOAD( "T-11.D3", 0x20000, 0x10000, CRC(53da6cb1) SHA1(52720746298adb01828f959f81b385d268c94343) ) + ROM_LOAD( "T-6.A1", 0x40000, 0x10000, CRC(a7cce654) SHA1(f6c99622dcacc1d76021ca29b0bbceefbb75c499) ) + ROM_LOAD( "T-7.C1", 0x50000, 0x10000, CRC(90dd8415) SHA1(8e9d43ff9164fb287ab82df7da8890976b9d21c7) ) + ROM_RELOAD( 0x70000, 0x10000) + ROM_LOAD( "T-9.A3", 0x60000, 0x10000, CRC(44762916) SHA1(3427066fc02d1b9b71a59ac41d3332d5cd8d1423) ) + + ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_LOAD( "T-13.I1", 0x00000, 0x10000, CRC(1cc87f50) SHA1(d7d8a4376b556675dafa0a407bb34b6017f17e7d) ) /* sprites */ + ROM_LOAD( "T-15.I3", 0x10000, 0x10000, CRC(775ee5d9) SHA1(e39eb558cc2d5cdf4c87b96f85af72e5600b995e) ) + ROM_LOAD( "T-12.G1", 0x20000, 0x10000, CRC(57783312) SHA1(57942e8c3b7be63ea62bae3c104cb2842eb6b755) ) + ROM_LOAD( "T-14.G3", 0x30000, 0x10000, CRC(a30e3346) SHA1(150a837fb5d4705df9e8e9a94f78cff0e1c57d64) ) + + ROM_REGION( 0x08000, "gfx4", 0 ) /* background tilemaps */ + ROM_LOAD( "T-16.F9", 0x00000, 0x08000, CRC(9b377277) SHA1(4858560e35144727aea958023f3df785baa994a8) ) ROM_END ROM_START( turtshipkn ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + banked ROMs images */ - ROM_LOAD( "T-3.G5", 0x00000, 0x08000, CRC(529b091c) SHA1(9a3a885dbf1f9d3c3c326418efdcb4f6f96eb4ae) ) - ROM_LOAD( "T-2.G3", 0x08000, 0x08000, CRC(d2f30195) SHA1(d64f088ed776658563943e8cde086842d0d899f8) ) - ROM_LOAD( "T-1.E3", 0x10000, 0x08000, CRC(2d02da90) SHA1(5cf059e04e145861f9877cefa2c7168e6ded19ac) ) - - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "T-4.A8", 0x00000, 0x08000, CRC(1cbe48e8) SHA1(6ac5981d36a44595bb8dc847c54c7be7b374f82c) ) - - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "T-5.K8", 0x00000, 0x04000, CRC(5c2ee02d) SHA1(c8d3dbdaab943c1639795915cf275951501a2a77) ) /* characters */ - ROM_CONTINUE( 0x00000, 0x04000 ) /* A14 tied high, only upper half is used */ - - ROM_REGION( 0x80000, "gfx2", 0 ) - ROM_LOAD( "T-8.D1", 0x00000, 0x10000, CRC(2f0b2336) SHA1(a869e0a50aab7d29afbca46fa04bd470488a8eeb) ) /* tiles */ - ROM_LOAD( "T-10.C3", 0x10000, 0x10000, CRC(6a0072f4) SHA1(d74b53ed90a4d01020a179f263a39b7547b8f82e) ) - ROM_RELOAD( 0x30000, 0x10000) - ROM_LOAD( "T-11.D3", 0x20000, 0x10000, CRC(53da6cb1) SHA1(52720746298adb01828f959f81b385d268c94343) ) - ROM_LOAD( "T-6.A1", 0x40000, 0x10000, CRC(a7cce654) SHA1(f6c99622dcacc1d76021ca29b0bbceefbb75c499) ) - ROM_LOAD( "T-7.C1", 0x50000, 0x10000, CRC(90dd8415) SHA1(8e9d43ff9164fb287ab82df7da8890976b9d21c7) ) - ROM_RELOAD( 0x70000, 0x10000) - ROM_LOAD( "T-9.A3", 0x60000, 0x10000, CRC(44762916) SHA1(3427066fc02d1b9b71a59ac41d3332d5cd8d1423) ) - - ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "T-13.I1", 0x00000, 0x10000, CRC(1cc87f50) SHA1(d7d8a4376b556675dafa0a407bb34b6017f17e7d) ) /* sprites */ - ROM_LOAD( "T-15.I3", 0x10000, 0x10000, CRC(3bf91fb8) SHA1(1c8368dc8d52c3c48a85391f00c91a80fa5d781d) ) - ROM_LOAD( "T-12.G1", 0x20000, 0x10000, CRC(57783312) SHA1(57942e8c3b7be63ea62bae3c104cb2842eb6b755) ) - ROM_LOAD( "T-14.G3", 0x30000, 0x10000, CRC(ee162dc0) SHA1(127b3cb3ddd47aa8ee70cad2d54b1306ad8f10e8) ) - - ROM_REGION( 0x08000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "T-16.F9", 0x00000, 0x08000, CRC(9b377277) SHA1(4858560e35144727aea958023f3df785baa994a8) ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + banked ROMs images */ + ROM_LOAD( "T-3.G5", 0x00000, 0x08000, CRC(529b091c) SHA1(9a3a885dbf1f9d3c3c326418efdcb4f6f96eb4ae) ) + ROM_LOAD( "T-2.G3", 0x08000, 0x08000, CRC(d2f30195) SHA1(d64f088ed776658563943e8cde086842d0d899f8) ) + ROM_LOAD( "T-1.E3", 0x10000, 0x08000, CRC(2d02da90) SHA1(5cf059e04e145861f9877cefa2c7168e6ded19ac) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "T-4.A8", 0x00000, 0x08000, CRC(1cbe48e8) SHA1(6ac5981d36a44595bb8dc847c54c7be7b374f82c) ) + + ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_LOAD( "T-5.K8", 0x00000, 0x04000, CRC(5c2ee02d) SHA1(c8d3dbdaab943c1639795915cf275951501a2a77) ) /* characters */ + ROM_CONTINUE( 0x00000, 0x04000 ) /* A14 tied high, only upper half is used */ + + ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_LOAD( "T-8.D1", 0x00000, 0x10000, CRC(2f0b2336) SHA1(a869e0a50aab7d29afbca46fa04bd470488a8eeb) ) /* tiles */ + ROM_LOAD( "T-10.C3", 0x10000, 0x10000, CRC(6a0072f4) SHA1(d74b53ed90a4d01020a179f263a39b7547b8f82e) ) + ROM_RELOAD( 0x30000, 0x10000) + ROM_LOAD( "T-11.D3", 0x20000, 0x10000, CRC(53da6cb1) SHA1(52720746298adb01828f959f81b385d268c94343) ) + ROM_LOAD( "T-6.A1", 0x40000, 0x10000, CRC(a7cce654) SHA1(f6c99622dcacc1d76021ca29b0bbceefbb75c499) ) + ROM_LOAD( "T-7.C1", 0x50000, 0x10000, CRC(90dd8415) SHA1(8e9d43ff9164fb287ab82df7da8890976b9d21c7) ) + ROM_RELOAD( 0x70000, 0x10000) + ROM_LOAD( "T-9.A3", 0x60000, 0x10000, CRC(44762916) SHA1(3427066fc02d1b9b71a59ac41d3332d5cd8d1423) ) + + ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_LOAD( "T-13.I1", 0x00000, 0x10000, CRC(1cc87f50) SHA1(d7d8a4376b556675dafa0a407bb34b6017f17e7d) ) /* sprites */ + ROM_LOAD( "T-15.I3", 0x10000, 0x10000, CRC(3bf91fb8) SHA1(1c8368dc8d52c3c48a85391f00c91a80fa5d781d) ) + ROM_LOAD( "T-12.G1", 0x20000, 0x10000, CRC(57783312) SHA1(57942e8c3b7be63ea62bae3c104cb2842eb6b755) ) + ROM_LOAD( "T-14.G3", 0x30000, 0x10000, CRC(ee162dc0) SHA1(127b3cb3ddd47aa8ee70cad2d54b1306ad8f10e8) ) + + ROM_REGION( 0x08000, "gfx4", 0 ) /* background tilemaps */ + ROM_LOAD( "T-16.F9", 0x00000, 0x08000, CRC(9b377277) SHA1(4858560e35144727aea958023f3df785baa994a8) ) ROM_END diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c index 3a1b602f9c0..f804ae18664 100644 --- a/src/mame/drivers/slapshot.c +++ b/src/mame/drivers/slapshot.c @@ -453,7 +453,7 @@ GFXDECODE_END void slapshot_state::machine_start() { membank("z80bank")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000); - + m_int6_timer = timer_alloc(TIMER_SLAPSHOT_INTERRUPT6); } diff --git a/src/mame/drivers/snk68.c b/src/mame/drivers/snk68.c index 53353339b11..351dde82014 100644 --- a/src/mame/drivers/snk68.c +++ b/src/mame/drivers/snk68.c @@ -50,14 +50,9 @@ Notes: /******************************************************************************/ -READ16_MEMBER(snk68_state::sound_status_r) +void snk68_state::machine_start() { - return (m_sound_status << 8); -} - -WRITE8_MEMBER(snk68_state::sound_status_w) -{ - m_sound_status = data; + save_item(NAME(m_invert_controls)); } READ16_MEMBER(snk68_state::control_1_r) @@ -65,11 +60,6 @@ READ16_MEMBER(snk68_state::control_1_r) return (ioport("P1")->read() + (ioport("P2")->read() << 8)); } -READ16_MEMBER(snk68_state::control_2_r) -{ - return ioport("SYSTEM")->read(); -} - READ16_MEMBER(snk68_state::rotary_1_r) { return (( ~(1 << ioport("ROT1")->read()) )<<8)&0xff00; @@ -119,16 +109,16 @@ static ADDRESS_MAP_START( pow_map, AS_PROGRAM, 16, snk68_state ) AM_RANGE(0x040000, 0x043fff) AM_RAM AM_RANGE(0x080000, 0x080001) AM_READ(control_1_r) AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w) - AM_RANGE(0x0c0000, 0x0c0001) AM_READ(control_2_r) - AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(pow_flipscreen16_w) // + char bank + AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("SYSTEM") + AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(pow_flipscreen_w) // + char bank AM_RANGE(0x0e0000, 0x0e0001) AM_READNOP /* Watchdog or IRQ ack */ AM_RANGE(0x0e8000, 0x0e8001) AM_READNOP /* Watchdog or IRQ ack */ AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1") AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2") // AM_RANGE(0x0f0008, 0x0f0009) AM_WRITENOP /* ?? */ AM_RANGE(0x100000, 0x100fff) AM_READWRITE(pow_fg_videoram_r, pow_fg_videoram_w) AM_MIRROR(0x1000) AM_SHARE("pow_fg_videoram") // 8-bit - AM_RANGE(0x200000, 0x207fff) AM_READWRITE(pow_spriteram_r, pow_spriteram_w) AM_SHARE("spriteram") // only partially populated - AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(pow_paletteram16_word_w) AM_SHARE("paletteram") + AM_RANGE(0x200000, 0x207fff) AM_READWRITE(spriteram_r, spriteram_w) AM_SHARE("spriteram") // only partially populated + AM_RANGE(0x400000, 0x400fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") ADDRESS_MAP_END static ADDRESS_MAP_START( searchar_map, AS_PROGRAM, 16, snk68_state ) @@ -137,7 +127,7 @@ static ADDRESS_MAP_START( searchar_map, AS_PROGRAM, 16, snk68_state ) AM_RANGE(0x080000, 0x080005) AM_READ(protcontrols_r) /* Player 1 & 2 */ AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w) AM_RANGE(0x080006, 0x080007) AM_WRITE(protection_w) /* top byte unknown, bottom is protection in ikari3 and streetsm */ - AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(searchar_flipscreen16_w) + AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(searchar_flipscreen_w) AM_RANGE(0x0c0000, 0x0c0001) AM_READ(rotary_1_r) /* Player 1 rotary */ AM_RANGE(0x0c8000, 0x0c8001) AM_READ(rotary_2_r) /* Player 2 rotary */ AM_RANGE(0x0d0000, 0x0d0001) AM_READ(rotary_lsb_r) /* Extra rotary bits */ @@ -146,11 +136,11 @@ static ADDRESS_MAP_START( searchar_map, AS_PROGRAM, 16, snk68_state ) // AM_RANGE(0x0f0000, 0x0f0001) AM_WRITENOP /* ?? */ AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1") AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2") - AM_RANGE(0x0f8000, 0x0f8001) AM_READ(sound_status_r) - AM_RANGE(0x100000, 0x107fff) AM_READWRITE(pow_spriteram_r, pow_spriteram_w) AM_SHARE("spriteram") // only partially populated + AM_RANGE(0x0f8000, 0x0f8001) AM_READ8(soundlatch2_byte_r, 0xff00) + AM_RANGE(0x100000, 0x107fff) AM_READWRITE(spriteram_r, spriteram_w) AM_SHARE("spriteram") // only partially populated AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(searchar_fg_videoram_w) AM_MIRROR(0x1000) AM_SHARE("pow_fg_videoram") /* Mirror is used by Ikari 3 */ - AM_RANGE(0x300000, 0x33ffff) AM_ROMBANK("bank1") /* Extra code bank */ - AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(pow_paletteram16_word_w) AM_SHARE("paletteram") + AM_RANGE(0x300000, 0x33ffff) AM_ROM AM_REGION("user1", 0) /* Extra code bank */ + AM_RANGE(0x400000, 0x400fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") ADDRESS_MAP_END /******************************************************************************/ @@ -158,7 +148,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, snk68_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(sound_status_w) + AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(soundlatch2_byte_w) ADDRESS_MAP_END WRITE8_MEMBER(snk68_state::D7759_write_port_0_w) @@ -588,12 +578,12 @@ static MACHINE_CONFIG_START( pow, snk68_state ) // give a theoretical refresh rate of 59.1856Hz while the measured // rate on a SAR board is 59.16Hz. MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 384, 0, 256, 264, 16, 240) - MCFG_SCREEN_UPDATE_DRIVER(snk68_state, screen_update_pow) + MCFG_SCREEN_UPDATE_DRIVER(snk68_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", pow) MCFG_PALETTE_ADD("palette", 0x800) - + MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -745,6 +735,8 @@ ROM_START( streetsm1 ) ROM_REGION( 0x20000, "upd", 0 ) /* UPD7759 samples */ ROM_LOAD( "s2-6.18d", 0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) ) + + ROM_REGION16_BE( 0x40000, "user1", ROMREGION_ERASE00 ) /* Extra code bank */ ROM_END ROM_START( streetsmw ) @@ -771,6 +763,8 @@ ROM_START( streetsmw ) ROM_REGION( 0x20000, "upd", 0 ) /* UPD7759 samples */ ROM_LOAD( "s2-6.18d", 0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) ) + + ROM_REGION16_BE( 0x40000, "user1", ROMREGION_ERASE00 ) /* Extra code bank */ ROM_END ROM_START( streetsmj ) @@ -797,6 +791,8 @@ ROM_START( streetsmj ) ROM_REGION( 0x20000, "upd", 0 ) /* UPD7759 samples */ ROM_LOAD( "s2-6.18d", 0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) ) + + ROM_REGION16_BE( 0x40000, "user1", ROMREGION_ERASE00 ) /* Extra code bank */ ROM_END ROM_START( ikari3 ) @@ -1067,23 +1063,16 @@ ROM_END /******************************************************************************/ -DRIVER_INIT_MEMBER(snk68_state,searchar) -{ - membank("bank1")->set_base(memregion("user1")->base()); -} - -/******************************************************************************/ - -GAME( 1988, pow, 0, pow, pow, driver_device, 0, ROT0, "SNK", "P.O.W. - Prisoners of War (US version 1)", 0 ) -GAME( 1988, powj, pow, pow, powj, driver_device, 0, ROT0, "SNK", "Datsugoku - Prisoners of War (Japan)", 0 ) -GAME( 1989, streetsm, 0, pow, streetsm, driver_device, 0, ROT0, "SNK", "Street Smart (US version 2)", 0 ) -GAME( 1989, streetsm1, streetsm, searchar, streetsm, driver_device, 0, ROT0, "SNK", "Street Smart (US version 1)", 0 ) -GAME( 1989, streetsmw, streetsm, searchar, streetsj, driver_device, 0, ROT0, "SNK", "Street Smart (World version 1)", 0 ) -GAME( 1989, streetsmj, streetsm, searchar, streetsj, driver_device, 0, ROT0, "SNK", "Street Smart (Japan version 1)", 0 ) -GAME( 1989, ikari3, 0, searchar, ikari3, snk68_state, searchar, ROT0, "SNK", "Ikari III - The Rescue (World, 8-Way Joystick)", 0 ) -GAME( 1989, ikari3u, ikari3, searchar, ikari3, snk68_state, searchar, ROT0, "SNK", "Ikari III - The Rescue (US, Rotary Joystick)", 0 ) -GAME( 1989, ikari3j, ikari3, searchar, ikari3, snk68_state, searchar, ROT0, "SNK", "Ikari Three (Japan, Rotary Joystick)", 0 ) -GAME( 1989, ikari3k, ikari3, searchar, ikari3, snk68_state, searchar, ROT0, "SNK", "Ikari Three (Korea, 8-Way Joystick)", 0 ) -GAME( 1989, searchar, 0, searchar, searchar, snk68_state, searchar, ROT90, "SNK", "SAR - Search And Rescue (World)", 0 ) -GAME( 1989, searcharu, searchar, searchar, searchar, snk68_state, searchar, ROT90, "SNK", "SAR - Search And Rescue (US)", 0 ) -GAME( 1989, searcharj, searchar, searchar, searchar, snk68_state, searchar, ROT90, "SNK", "SAR - Search And Rescue (Japan)", 0 ) +GAME( 1988, pow, 0, pow, pow, driver_device, 0, ROT0, "SNK", "P.O.W. - Prisoners of War (US version 1)", GAME_SUPPORTS_SAVE ) +GAME( 1988, powj, pow, pow, powj, driver_device, 0, ROT0, "SNK", "Datsugoku - Prisoners of War (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1989, streetsm, 0, pow, streetsm, driver_device, 0, ROT0, "SNK", "Street Smart (US version 2)", GAME_SUPPORTS_SAVE ) +GAME( 1989, streetsm1, streetsm, searchar, streetsm, driver_device, 0, ROT0, "SNK", "Street Smart (US version 1)", GAME_SUPPORTS_SAVE ) +GAME( 1989, streetsmw, streetsm, searchar, streetsj, driver_device, 0, ROT0, "SNK", "Street Smart (World version 1)", GAME_SUPPORTS_SAVE ) +GAME( 1989, streetsmj, streetsm, searchar, streetsj, driver_device, 0, ROT0, "SNK", "Street Smart (Japan version 1)", GAME_SUPPORTS_SAVE ) +GAME( 1989, ikari3, 0, searchar, ikari3, driver_device, 0, ROT0, "SNK", "Ikari III - The Rescue (World, 8-Way Joystick)", GAME_SUPPORTS_SAVE ) +GAME( 1989, ikari3u, ikari3, searchar, ikari3, driver_device, 0, ROT0, "SNK", "Ikari III - The Rescue (US, Rotary Joystick)", GAME_SUPPORTS_SAVE ) +GAME( 1989, ikari3j, ikari3, searchar, ikari3, driver_device, 0, ROT0, "SNK", "Ikari Three (Japan, Rotary Joystick)", GAME_SUPPORTS_SAVE ) +GAME( 1989, ikari3k, ikari3, searchar, ikari3, driver_device, 0, ROT0, "SNK", "Ikari Three (Korea, 8-Way Joystick)", GAME_SUPPORTS_SAVE ) +GAME( 1989, searchar, 0, searchar, searchar, driver_device, 0, ROT90, "SNK", "SAR - Search And Rescue (World)", GAME_SUPPORTS_SAVE ) +GAME( 1989, searcharu, searchar, searchar, searchar, driver_device, 0, ROT90, "SNK", "SAR - Search And Rescue (US)", GAME_SUPPORTS_SAVE ) +GAME( 1989, searcharj, searchar, searchar, searchar, driver_device, 0, ROT90, "SNK", "SAR - Search And Rescue (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/spacefb.c b/src/mame/drivers/spacefb.c index 1cdb1cc1559..6dfb2178091 100644 --- a/src/mame/drivers/spacefb.c +++ b/src/mame/drivers/spacefb.c @@ -137,7 +137,7 @@ void spacefb_state::device_timer(emu_timer &timer, device_timer_id id, int param assert_always(FALSE, "Unknown id in spacefb_state::device_timer"); } } - + TIMER_CALLBACK_MEMBER(spacefb_state::interrupt_callback) { int next_vpos; @@ -172,7 +172,7 @@ void spacefb_state::start_interrupt_timer() void spacefb_state::machine_start() { m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); - + save_item(NAME(m_sound_latch)); } diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c index 0dfb244cc01..45b231384f8 100644 --- a/src/mame/drivers/sprcros2.c +++ b/src/mame/drivers/sprcros2.c @@ -252,7 +252,7 @@ void sprcros2_state::machine_start() { membank("masterbank")->configure_entries(0, 2, memregion("master")->base() + 0x10000, 0x2000); membank("slavebank")->configure_entries(0, 2, memregion("slave")->base() + 0x10000, 0x2000); - + save_item(NAME(m_port7)); save_item(NAME(m_s_port3)); } diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index 842340882b8..14d281bdcd8 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -243,7 +243,7 @@ UINT32 srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &bit void srmp5_state::machine_start() { membank("bank1")->configure_entries(0, 256, memregion("maincpu")->base(), 0x4000); - + save_item(NAME(m_input_select)); save_item(NAME(m_cmd1)); save_item(NAME(m_cmd2)); diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c index 75467910f10..9a2d235754b 100644 --- a/src/mame/drivers/stfight.c +++ b/src/mame/drivers/stfight.c @@ -275,6 +275,10 @@ static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, stfight_state ) AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("sprite_ram") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, stfight_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( cshooter_cpu1_map, AS_PROGRAM, 8, stfight_state ) AM_RANGE(0xc801, 0xc801) AM_WRITE(stfight_bank_w) AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_text_w) AM_SHARE("tx_vram") @@ -536,6 +540,7 @@ static MACHINE_CONFIG_START( stfight, stfight_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 4) MCFG_CPU_PROGRAM_MAP(cpu1_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", stfight_state, stfight_vb_interrupt) MCFG_CPU_ADD("audiocpu", Z80, XTAL_12MHz / 4) @@ -589,6 +594,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( cshooter, stfight ) MCFG_CPU_REPLACE("maincpu", Z80, XTAL_12MHz / 2) MCFG_CPU_PROGRAM_MAP(cshooter_cpu1_map) + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) MCFG_CPU_VBLANK_INT_DRIVER("screen", stfight_state, stfight_vb_interrupt) MCFG_CPU_REPLACE("audiocpu", Z80, XTAL_12MHz / 2) diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index 1c0c379e343..6c587027dae 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -73,15 +73,15 @@ DRIVER_INIT_MEMBER(suna8_state,hardhead) rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58; } - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank0d->set_base(memregion("maincpu")->base()); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } /* Non encrypted bootleg */ DRIVER_INIT_MEMBER(suna8_state,hardhedb) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x48000); - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank0d->set_base(memregion("maincpu")->base() + 0x48000); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } /*************************************************************************** @@ -137,14 +137,13 @@ DRIVER_INIT_MEMBER(suna8_state, brickzn_common) m_decrypt = brickzn_decrypt(); // Non-banked opcodes - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, m_decrypt); + m_bank0d->set_base(m_decrypt); // Data banks: 00-0f normal data decryption, 10-1f alternate data decryption: - membank("bank1")->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000); // Opcode banks: 00-1f normal opcode decryption: - membank("bank1")->configure_decrypted_entries(0, 16, m_decrypt + 0x10000, 0x4000); - membank("bank1")->configure_decrypted_entries(16, 16, m_decrypt + 0x10000, 0x4000); + m_bank1d->configure_entries(0, 16, m_decrypt + 0x10000, 0x4000); + m_bank1d->configure_entries(16, 16, m_decrypt + 0x10000, 0x4000); } DRIVER_INIT_MEMBER(suna8_state,brickzn) @@ -203,14 +202,7 @@ DRIVER_INIT_MEMBER(suna8_state,brickznv4) DRIVER_INIT_MEMBER(suna8_state,brickzn11) { - // No encryption - UINT8 *decrypt = memregion("maincpu")->base(); - - // Data banks: 00-0f normal data decryption, 10-1f alternate data decryption: - membank("bank1")->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000); - // Opcode banks: 00-1f normal opcode decryption: - membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000); - membank("bank1")->configure_decrypted_entries(16, 16, decrypt + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000); } @@ -220,14 +212,13 @@ DRIVER_INIT_MEMBER(suna8_state,brickzn11) DRIVER_INIT_MEMBER(suna8_state,hardhea2) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *RAM = memregion("maincpu")->base(); size_t size = memregion("maincpu")->bytes(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); UINT8 x; int i; - space.set_decrypted_region(0x0000, 0x7fff, decrypt); + m_bank0d->set_base(decrypt); /* Address lines scrambling */ memcpy(decrypt, RAM, size); @@ -296,7 +287,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes) RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41; } - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); membank("bank2")->configure_entries(0, 2, auto_alloc_array(machine(), UINT8, 0x2000 * 2), 0x2000); } @@ -307,14 +298,13 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes) DRIVER_INIT_MEMBER(suna8_state,starfigh) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *RAM = memregion("maincpu")->base(); size_t size = memregion("maincpu")->bytes(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); UINT8 x; int i; - space.set_decrypted_region(0x0000, 0x7fff, decrypt); + m_bank0d->set_base(decrypt); /* Address lines scrambling */ memcpy(decrypt, RAM, size); @@ -383,7 +373,7 @@ DRIVER_INIT_MEMBER(suna8_state,starfigh) decrypt[0x2696] = 0xc9; // work ram writes disable, corrupt next routine decrypt[0x4e9a] = 0x00; // work ram writes disable, flip background sprite - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } @@ -393,14 +383,13 @@ DRIVER_INIT_MEMBER(suna8_state,starfigh) DRIVER_INIT_MEMBER(suna8_state,sparkman) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *RAM = memregion("maincpu")->base(); size_t size = memregion("maincpu")->bytes(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); UINT8 x; int i; - space.set_decrypted_region(0x0000, 0x7fff, decrypt); + m_bank0d->set_base(decrypt); /* Address lines scrambling */ memcpy(decrypt, RAM, size); @@ -467,7 +456,7 @@ DRIVER_INIT_MEMBER(suna8_state,sparkman) decrypt[0x1ac4] = 0x00; decrypt[0x1ac5] = 0x00; - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } /*************************************************************************** @@ -538,7 +527,7 @@ WRITE8_MEMBER(suna8_state::hardhead_bankswitch_w) int bank = data & 0x0f; if (data & ~0xef) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data); - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); } @@ -571,7 +560,6 @@ static ADDRESS_MAP_START( hardhead_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xe000, 0xffff) AM_RAM_WRITE(suna8_spriteram_w) AM_SHARE("spriteram") // Sprites ADDRESS_MAP_END - static ADDRESS_MAP_START( hardhead_io_map, AS_IO, 8, suna8_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READNOP // ? IRQ Ack @@ -595,7 +583,7 @@ WRITE8_MEMBER(suna8_state::rranger_bankswitch_w) if (data & ~0xf7) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data); - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); flip_screen_set(data & 0x20); coin_lockout_w ( machine(), 0, data & 0x40); @@ -694,7 +682,9 @@ WRITE8_MEMBER(suna8_state::brickzn_rombank_w) if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data); - membank("bank1")->set_entry(bank + (membank("bank1")->entry() & 0x10)); + m_bank1->set_entry(bank + (m_bank1->entry() & 0x10)); + if(m_bank1d) + m_bank1d->set_entry(m_bank1->entry()); m_rombank = data; } @@ -812,13 +802,11 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w) if (m_prot_opcode_toggle == 0) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, m_decrypt); + m_bank0d->set_base(m_decrypt); } else { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base()); + m_bank0d->set_base(memregion("maincpu")->base()); } } } @@ -838,7 +826,9 @@ WRITE8_MEMBER(suna8_state::brickzn_prot2_w) m_remap_sound = ((m_prot2 ^ data) == 0xf8) ? 1 : 0; // Select alternate data decryption, see code at 787e: - membank("bank1")->set_entry((membank("bank1")->entry() & 0x0f) + ((m_prot2 == (data | 0xdc)) ? 0x10 : 0)); + m_bank1->set_entry((m_bank1->entry() & 0x0f) + ((m_prot2 == (data | 0xdc)) ? 0x10 : 0)); + if(m_bank1d) + m_bank1d->set_entry(m_bank1->entry()); m_prot2_prev = m_prot2; m_prot2 = data; @@ -885,6 +875,11 @@ static ADDRESS_MAP_START( brickzn_map, AS_PROGRAM, 8, suna8_state ) AM_RANGE(0xe000, 0xffff) AM_READWRITE(suna8_banked_spriteram_r, suna8_banked_spriteram_w) // Sprites (Banked) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, suna8_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") +ADDRESS_MAP_END + static ADDRESS_MAP_START( brickzn_io_map, AS_IO, 8, suna8_state ) AM_RANGE(0x0000, 0x0000) AM_WRITE(brickzn_disab_palram_w ) // Disable Palette RAM AM_RANGE(0x00a1, 0x00a1) AM_WRITE(brickzn_enab_palram_w ) // Enable Palette RAM @@ -940,7 +935,7 @@ WRITE8_MEMBER(suna8_state::hardhea2_rombank_w) if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data); - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); m_rombank = data; } @@ -1079,7 +1074,7 @@ WRITE8_MEMBER(suna8_state::starfigh_leds_w) int bank = m_rombank_latch & 0x0f; - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); m_rombank = m_rombank_latch; logerror("CPU #0 - PC %04X: rom bank = %02X\n",space.device().safe_pc(), m_rombank); @@ -1192,7 +1187,7 @@ WRITE8_MEMBER(suna8_state::sparkman_rombank_w) int bank = m_rombank_latch & 0x0f; - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); m_rombank = m_rombank_latch; logerror("CPU #0 - PC %04X: rom bank = %02X\n",space.device().safe_pc(), m_rombank); @@ -1868,6 +1863,7 @@ static MACHINE_CONFIG_START( hardhead, suna8_state ) MCFG_CPU_ADD("maincpu", Z80, SUNA8_MASTER_CLOCK / 4) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(hardhead_map) MCFG_CPU_IO_MAP(hardhead_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", suna8_state, irq0_line_hold) /* No NMI */ MCFG_CPU_ADD("audiocpu", Z80, SUNA8_MASTER_CLOCK / 8) /* verified on pcb */ @@ -1892,23 +1888,20 @@ static MACHINE_CONFIG_START( hardhead, suna8_state ) MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_textdim12) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("aysnd", AY8910, SUNA8_MASTER_CLOCK / 16) /* verified on pcb */ MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MCFG_SOUND_ADD("samples", SAMPLES, 0) MCFG_SAMPLES_CHANNELS(1) MCFG_SAMPLES_START_CB(suna8_state, sh_start) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -1925,6 +1918,7 @@ static MACHINE_CONFIG_START( rranger, suna8_state ) MCFG_CPU_ADD("maincpu", Z80, SUNA8_MASTER_CLOCK / 4) /* ? */ MCFG_CPU_PROGRAM_MAP(rranger_map) MCFG_CPU_IO_MAP(rranger_io_map) +// MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", suna8_state, irq0_line_hold) /* IRQ & NMI ! */ MCFG_CPU_ADD("audiocpu", Z80, SUNA8_MASTER_CLOCK / 8) /* verified on pcb */ @@ -1948,23 +1942,20 @@ static MACHINE_CONFIG_START( rranger, suna8_state ) MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_textdim8) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ym1", YM2203, SUNA8_MASTER_CLOCK / 16) /* verified on pcb */ MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, rranger_play_samples_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.90) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.90) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) MCFG_SOUND_ADD("ym2", YM2203, SUNA8_MASTER_CLOCK / 16) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.90) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.90) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) MCFG_SOUND_ADD("samples", SAMPLES, 0) MCFG_SAMPLES_CHANNELS(1) MCFG_SAMPLES_START_CB(suna8_state, sh_start) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -1979,7 +1970,9 @@ MACHINE_RESET_MEMBER(suna8_state,brickzn) m_protection_val = m_prot2 = m_prot2_prev = 0xff; m_paletteram_enab = 1; // for brickzn11 m_remap_sound = 0; - membank("bank1")->set_entry(0); + m_bank1->set_entry(0); + if(m_bank1d) + m_bank1d->set_entry(0); } static MACHINE_CONFIG_START( brickzn11, suna8_state ) @@ -2015,34 +2008,33 @@ static MACHINE_CONFIG_START( brickzn11, suna8_state ) MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_brickzn) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) // 3MHz (measured) MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("aysnd", AY8910, SUNA8_MASTER_CLOCK / 16) // 1.5MHz (measured) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) MCFG_DAC_ADD("dac1") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.17) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.17) MCFG_DAC_ADD("dac2") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.17) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.17) MCFG_DAC_ADD("dac3") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.17) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.17) MCFG_DAC_ADD("dac4") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.17) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.17) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( brickzn, brickzn11 ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(brickzn_map) MCFG_CPU_IO_MAP(brickzn_io_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MACHINE_CONFIG_END @@ -2073,6 +2065,7 @@ static MACHINE_CONFIG_DERIVED( hardhea2, brickzn ) MCFG_CPU_ADD("maincpu", Z80, SUNA8_MASTER_CLOCK / 4) /* SUNA T568009 */ MCFG_CPU_PROGRAM_MAP(hardhea2_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", suna8_state, hardhea2_interrupt, "screen", 0, 1) MCFG_MACHINE_RESET_OVERRIDE(suna8_state,hardhea2) @@ -2092,6 +2085,7 @@ static MACHINE_CONFIG_START( starfigh, suna8_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, SUNA8_MASTER_CLOCK / 4) /* ? */ MCFG_CPU_PROGRAM_MAP(starfigh_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", suna8_state, hardhea2_interrupt, "screen", 0, 1) /* The sound section is identical to that of hardhead */ @@ -2117,23 +2111,20 @@ static MACHINE_CONFIG_START( starfigh, suna8_state ) MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_starfigh) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 6) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("aysnd", AY8910, SUNA8_MASTER_CLOCK / 16) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ADD("samples", SAMPLES, 0) MCFG_SAMPLES_CHANNELS(1) MCFG_SAMPLES_START_CB(suna8_state, sh_start) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -2146,6 +2137,7 @@ static MACHINE_CONFIG_START( sparkman, suna8_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, SUNA8_MASTER_CLOCK / 4) /* ? */ MCFG_CPU_PROGRAM_MAP(sparkman_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", suna8_state, hardhea2_interrupt, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, SUNA8_MASTER_CLOCK / 4) /* ? */ @@ -2170,23 +2162,20 @@ static MACHINE_CONFIG_START( sparkman, suna8_state ) MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_sparkman) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 6) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_SOUND_ADD("ymsnd", YM3812, SUNA8_MASTER_CLOCK / 8) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("aysnd", AY8910, SUNA8_MASTER_CLOCK / 16) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suna8_state, suna8_play_samples_w)) // two sample roms MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suna8_state, suna8_samples_number_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MCFG_SOUND_ADD("samples", SAMPLES, 0) MCFG_SAMPLES_CHANNELS(1) MCFG_SAMPLES_START_CB(suna8_state, sh_start) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -2232,6 +2221,9 @@ Sound processor - Z80 ***************************************************************************/ +// The sample rom is from srange with 1 byte changed (first byte is FF here, instead of 77) +// (laugh sound used when scoring a goal at the end of level 1) + ROM_START( hardhead ) ROM_REGION( 0x48000, "maincpu", 0 ) /* Main Z80 Code */ ROM_LOAD( "p1", 0x00000, 0x8000, CRC(c6147926) SHA1(8d1609aaeac344c6aec102e92d34caab22a8ec64) ) // 1988,9,14 @@ -2926,7 +2918,7 @@ ROM_END DRIVER_INIT_MEMBER(suna8_state,suna8) { - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); } GAME( 1988, sranger, 0, rranger, rranger, suna8_state, suna8, ROT0, "SunA", "Super Ranger (v2.0)", 0 ) diff --git a/src/mame/drivers/suprloco.c b/src/mame/drivers/suprloco.c index 587fdb4e004..2779544ffa9 100644 --- a/src/mame/drivers/suprloco.c +++ b/src/mame/drivers/suprloco.c @@ -36,8 +36,7 @@ WRITE8_MEMBER(suprloco_state::soundport_w) } static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprloco_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc1ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xc800, 0xc800) AM_READ_PORT("SYSTEM") AM_RANGE(0xd000, 0xd000) AM_READ_PORT("P1") @@ -52,6 +51,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprloco_state ) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, suprloco_state ) + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, suprloco_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM @@ -165,6 +168,7 @@ static MACHINE_CONFIG_START( suprloco, suprloco_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz (?) */ MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", suprloco_state, irq0_line_hold) MCFG_CPU_ADD("audiocpu", Z80, 4000000) @@ -202,7 +206,7 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( suprloco ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "epr-5226a.37", 0x0000, 0x4000, CRC(33b02368) SHA1(c6e3116ad4b52bcc3174de5770f7a7ce024790d5) ) /* encrypted */ ROM_LOAD( "epr-5227a.15", 0x4000, 0x4000, CRC(a5e67f50) SHA1(1dd52e4cf00ce414fe1db8259c9976cdc23513b4) ) /* encrypted */ ROM_LOAD( "epr-5228.28", 0x8000, 0x4000, CRC(a597828a) SHA1(61004d112591fd2d752c39df71c1304d9308daae) ) @@ -231,7 +235,7 @@ ROM_START( suprloco ) ROM_END ROM_START( suprlocoo ) - ROM_REGION( 2*0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "epr-5226.37", 0x0000, 0x4000, CRC(57f514dd) SHA1(707800b90a22547a56b01d1e11775e9ee5555d23) ) /* encrypted */ ROM_LOAD( "epr-5227.15", 0x4000, 0x4000, CRC(5a1d2fb0) SHA1(fdb9416e5530718245fd597073a63feddb233c3c) ) /* encrypted */ ROM_LOAD( "epr-5228.28", 0x8000, 0x4000, CRC(a597828a) SHA1(61004d112591fd2d752c39df71c1304d9308daae) ) @@ -292,9 +296,30 @@ DRIVER_INIT_MEMBER(suprloco_state,suprloco) } } + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; /* decrypt program ROMs */ - suprloco_decode(machine(), "maincpu"); + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0xc000, convtable); } diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c index e21fa0d4987..6cbaa042973 100644 --- a/src/mame/drivers/system1.c +++ b/src/mame/drivers/system1.c @@ -358,13 +358,20 @@ static const UINT8 cc_ex[0x100] = { void system1_state::machine_start() { - UINT32 numbanks = (memregion("maincpu")->bytes() - 0x10000) / 0x4000; + UINT32 numbanks = (m_maincpu_region->bytes() - 0x10000) / 0x4000; if (numbanks > 0) - membank("bank1")->configure_entries(0, numbanks, memregion("maincpu")->base() + 0x10000, 0x4000); + m_bank1->configure_entries(0, numbanks, m_maincpu_region->base() + 0x10000, 0x4000); else - membank("bank1")->configure_entry(0, memregion("maincpu")->base() + 0x8000); - membank("bank1")->set_entry(0); + m_bank1->configure_entry(0, m_maincpu_region->base() + 0x8000); + m_bank1->set_entry(0); + + if (m_banked_decrypted_opcodes) + { + m_bank0d->set_base(m_banked_decrypted_opcodes); + m_bank1d->configure_entries(0, numbanks, m_banked_decrypted_opcodes + 0x10000, 0x4000); + m_bank1d->set_entry(0); + } m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex); @@ -400,14 +407,16 @@ void system1_state::machine_reset() void system1_state::bank44_custom_w(UINT8 data, UINT8 prevdata) { /* bank bits are bits 6 and 2 */ - membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2)); + m_bank1->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2)); } void system1_state::bank0c_custom_w(UINT8 data, UINT8 prevdata) { /* bank bits are bits 3 and 2 */ - membank("bank1")->set_entry((data & 0x0c) >> 2); + m_bank1->set_entry((data & 0x0c) >> 2); + if(m_bank1d) + m_bank1d->set_entry((data & 0x0c) >> 2); } @@ -592,7 +601,7 @@ READ8_MEMBER(system1_state::mcu_io_r) return m_maincpu->space(AS_PROGRAM).read_byte(offset); case 1: - return memregion("maincpu")->base()[offset + 0x10000]; + return m_maincpu_region->base()[offset + 0x10000]; case 2: return m_maincpu->space(AS_IO).read_byte(offset); @@ -733,6 +742,22 @@ static ADDRESS_MAP_START( system1_map, AS_PROGRAM, 8, system1_state ) AM_RANGE(0xfc00, 0xffff) AM_WRITE(system1_sprite_collision_reset_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, system1_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( banked_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, system1_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank0d") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") + AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") +ADDRESS_MAP_END + /* same as normal System 1 except address map is shuffled (RAM/collision are swapped) */ static ADDRESS_MAP_START( nobo_map, AS_PROGRAM, 8, system1_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM @@ -2146,6 +2171,12 @@ static MACHINE_CONFIG_START( sys1ppi, system1_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys1ppix, sys1ppi ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + + /* reduced visible area for scrolling games */ static MACHINE_CONFIG_DERIVED( sys1ppis, sys1ppi ) @@ -2154,6 +2185,10 @@ static MACHINE_CONFIG_DERIVED( sys1ppis, sys1ppi ) MCFG_SCREEN_VISIBLE_AREA(2*(0*8+8), 2*(32*8-1-8), 0*8, 28*8-1) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys1ppisx, sys1ppis ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END /* revised board with 128kbit ROMs and a Z80 PIO for outputs */ @@ -2169,6 +2204,11 @@ static MACHINE_CONFIG_DERIVED( sys1pio, sys1ppi ) MCFG_Z80PIO_OUT_PB_CB(WRITE8(system1_state, videomode_w)) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys1piox, sys1pio ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + /* reduced visible area for scrolling games */ static MACHINE_CONFIG_DERIVED( sys1pios, sys1pio ) @@ -2177,6 +2217,10 @@ static MACHINE_CONFIG_DERIVED( sys1pios, sys1pio ) MCFG_SCREEN_VISIBLE_AREA(2*(0*8+8), 2*(32*8-1-8), 0*8, 28*8-1) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys1piosx, sys1pios ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END /* this describes the additional 8751 MCU when present */ @@ -2223,6 +2267,16 @@ static MACHINE_CONFIG_DERIVED( sys2, sys1ppi ) MCFG_SCREEN_UPDATE_DRIVER(system1_state, screen_update_system2) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys2x, sys2 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys2xb, sys2 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( sys2m, sys2 ) MCFG_FRAGMENT_ADD( mcu ) MACHINE_CONFIG_END @@ -2235,6 +2289,11 @@ static MACHINE_CONFIG_DERIVED( sys2row, sys2 ) MCFG_SCREEN_UPDATE_DRIVER(system1_state, screen_update_system2_rowscroll) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sys2rowxb, sys2row ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(banked_decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( sys2rowm, sys2row ) MCFG_FRAGMENT_ADD( mcu ) MACHINE_CONFIG_END @@ -4688,55 +4747,704 @@ ROM_END DRIVER_INIT_MEMBER(system1_state,bank00) { m_videomode_custom = NULL; + m_banked_decrypted_opcodes = NULL; } + DRIVER_INIT_MEMBER(system1_state,bank44) { m_videomode_custom = &system1_state::bank44_custom_w; + m_banked_decrypted_opcodes = NULL; } DRIVER_INIT_MEMBER(system1_state,bank0c) { m_videomode_custom = &system1_state::bank0c_custom_w; + m_banked_decrypted_opcodes = NULL; +} + +DRIVER_INIT_MEMBER(system1_state,regulus) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,mrviking) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,swat) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */ + { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,flicky) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */ + { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */ + { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */ + { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,wmatch) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */ + { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */ + { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,bullfgtj) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */ + { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ + { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ + { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ + { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,spatter) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ + { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */ + { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */ + { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */ + { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */ + { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,pitfall2) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,nprinces) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,seganinj) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,imsorry) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */ + { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ + { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */ + { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ + { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */ + { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ + { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */ + { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */ + { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,teddybb) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */ + { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ + { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ + { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ + { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,myheroj) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,4dwarrio) +{ + // 315-5162 + static const UINT8 xor_table[128] = + { + 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, + 0x00, + }; + + static const int swap_table[128] = + { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 12, + }; + + DRIVER_INIT_CALL(bank00); + sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); +} + +DRIVER_INIT_MEMBER(system1_state,wboy) +{ + // 315-5177 + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const int swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + + DRIVER_INIT_CALL(bank00); + sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); +} + +DRIVER_INIT_MEMBER(system1_state,wboy2) +{ + // 315-5178 + static const UINT8 xor_table[128] = + { + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, + 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, + 0x40,0x55,0x15,0x05,0x51,0x11, + 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, + 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, + 0x41,0x54,0x14,0x04,0x50,0x10, + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, + + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, + 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, + 0x40,0x55,0x15,0x05,0x51,0x11, + 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, + 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, + 0x41,0x54,0x14,0x04,0x50,0x10, + 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, + }; + + static const int swap_table[128] = + { + 2, + 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, + 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4, + 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, + 4, 6, 0, 2, 4, 6, 0, 2, 4, 6, + 8, + 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, + 6, 0, 2, 4, 6, 0, 2, + + 10, + 11,13,15, 9,11,13,15, 9,11,13,15, + 8,10,12,14, 8,10,12,14, 8,10,12, + 13,15, 9,11,13,15, 9,11,13,15, 9,11, + 12,14, 8,10,12,14, 8,10,12,14, + 16, + 9,11,13,15, 9,11,13,15, 9,11,13, + 14, 8,10,12,14, 8,10, + }; + + DRIVER_INIT_CALL(bank00); + sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); +} + +DRIVER_INIT_MEMBER(system1_state,wboyo) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank00); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,blockgal) +{ + DRIVER_INIT_CALL(bank00); + mc8123_decode(m_maincpu_region->base(), m_decrypted_opcodes, memregion("key")->base(), 0x8000); +} + +DRIVER_INIT_MEMBER(system1_state,hvymetal) +{ + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ + { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */ + { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */ + { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */ + }; + + DRIVER_INIT_CALL(bank44); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); +} + +DRIVER_INIT_MEMBER(system1_state,gardia) +{ + // 317-0006 + DRIVER_INIT_CALL(bank44); + sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 2); +} + +DRIVER_INIT_MEMBER(system1_state,gardiab) +{ + // 317-0007 + DRIVER_INIT_CALL(bank44); + sega_decode_317(m_maincpu_region->base(), m_decrypted_opcodes, 3); +} + +DRIVER_INIT_MEMBER(system1_state,wbml) +{ + DRIVER_INIT_CALL(bank0c); + m_banked_decrypted_opcodes = auto_alloc_array(machine(), UINT8, m_maincpu_region->bytes()); + mc8123_decode(m_maincpu_region->base(), m_banked_decrypted_opcodes, memregion("key")->base(), m_maincpu_region->bytes()); +} + +DRIVER_INIT_MEMBER(system1_state,ufosensi) +{ + DRIVER_INIT_CALL(bank0c); + m_banked_decrypted_opcodes = auto_alloc_array(machine(), UINT8, m_maincpu_region->bytes()); + mc8123_decode(m_maincpu_region->base(), m_banked_decrypted_opcodes, memregion("key")->base(), m_maincpu_region->bytes()); +} + +DRIVER_INIT_MEMBER(system1_state,wboysys2) +{ + // 315-5177 + static const UINT8 xor_table[128] = + { + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, + 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, + 0x05,0x55,0x50,0x14, + }; + + static const int swap_table[128] = + { + 0,0,0,0, + 1,1,1,1,1, + 2,2,2,2,2, + 3,3,3,3, + 4,4,4,4,4, + 5,5,5,5,5, + 6,6,6,6,6, + 7,7,7,7,7, + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11,11, + 12,12,12,12,12, + 13,13, + + 8,8,8,8, + 9,9,9,9,9, + 10,10,10,10,10, + 11,11,11,11, + 12,12,12,12,12, + 13,13,13,13,13, + 14,14,14,14,14, + 15,15,15,15,15, + 16,16,16,16, + 17,17,17,17,17, + 18,18,18,18,18, + 19,19,19,19,19, + 20,20,20,20,20, + 21,21, + }; + + DRIVER_INIT_CALL(bank0c); + sega_decode_2(m_maincpu_region->base(), m_decrypted_opcodes, xor_table, swap_table); } -DRIVER_INIT_MEMBER(system1_state,regulus) { DRIVER_INIT_CALL(bank00); regulus_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,mrviking) { DRIVER_INIT_CALL(bank00); mrviking_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,swat) { DRIVER_INIT_CALL(bank00); swat_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,flicky) { DRIVER_INIT_CALL(bank00); flicky_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,wmatch) { DRIVER_INIT_CALL(bank00); wmatch_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,bullfgtj) { DRIVER_INIT_CALL(bank00); bullfgtj_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,spatter) { DRIVER_INIT_CALL(bank00); spatter_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,pitfall2) { DRIVER_INIT_CALL(bank00); pitfall2_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,nprinces) { DRIVER_INIT_CALL(bank00); nprinces_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,seganinj) { DRIVER_INIT_CALL(bank00); seganinj_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,imsorry) { DRIVER_INIT_CALL(bank00); imsorry_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,teddybb) { DRIVER_INIT_CALL(bank00); teddybb_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,myheroj) { DRIVER_INIT_CALL(bank00); myheroj_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,4dwarrio) { DRIVER_INIT_CALL(bank00); sega_315_5162_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,wboy) { DRIVER_INIT_CALL(bank00); sega_315_5177_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,wboy2) { DRIVER_INIT_CALL(bank00); sega_315_5178_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,wboyo) { DRIVER_INIT_CALL(bank00); hvymetal_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,blockgal) { DRIVER_INIT_CALL(bank00); mc8123_decrypt_rom(machine(), "maincpu", "key", NULL, 0); } - -DRIVER_INIT_MEMBER(system1_state,hvymetal) { DRIVER_INIT_CALL(bank44); hvymetal_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,gardia) { DRIVER_INIT_CALL(bank44); sega_317_0006_decode(machine(), "maincpu"); } -DRIVER_INIT_MEMBER(system1_state,gardiab) { DRIVER_INIT_CALL(bank44); sega_317_0007_decode(machine(), "maincpu"); } - -DRIVER_INIT_MEMBER(system1_state,wbml) { DRIVER_INIT_CALL(bank0c); mc8123_decrypt_rom(machine(), "maincpu", "key", "bank1", 4); } -DRIVER_INIT_MEMBER(system1_state,ufosensi) { DRIVER_INIT_CALL(bank0c); mc8123_decrypt_rom(machine(), "maincpu", "key", "bank1", 4); } -DRIVER_INIT_MEMBER(system1_state,wboysys2) { DRIVER_INIT_CALL(bank0c); sega_315_5177_decode(machine(), "maincpu"); } DRIVER_INIT_MEMBER(system1_state,dakkochn) { m_videomode_custom = &system1_state::dakkochn_custom_w; - - mc8123_decrypt_rom(machine(), "maincpu", "key", "bank1", 4); + m_banked_decrypted_opcodes = auto_alloc_array(machine(), UINT8, m_maincpu_region->bytes()); + mc8123_decode(m_maincpu_region->base(), m_banked_decrypted_opcodes, memregion("key")->base(), m_maincpu_region->bytes()); } DRIVER_INIT_MEMBER(system1_state,myherok) { + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ + { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ + { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ + { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ + { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ + { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ + { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ + { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ + }; + + int A; UINT8 *rom; @@ -4744,7 +5452,7 @@ DRIVER_INIT_MEMBER(system1_state,myherok) /* additionally to the usual protection, all the program ROMs have data lines */ /* D0 and D1 swapped. */ - rom = memregion("maincpu")->base(); + rom = m_maincpu_region->base(); for (A = 0;A < 0xc000;A++) rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1); @@ -4778,13 +5486,13 @@ DRIVER_INIT_MEMBER(system1_state,myherok) } } - myheroj_decode(machine(), "maincpu"); + sega_decode(m_maincpu_region->base(), m_decrypted_opcodes, 0x8000, convtable); } READ8_MEMBER(system1_state::nob_start_r) { /* in reality, it's likely some M1-dependent behavior */ - return (space.device().safe_pc() <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1]; + return (space.device().safe_pc() <= 0x0003) ? 0x80 : m_maincpu_region->base()[1]; } DRIVER_INIT_MEMBER(system1_state,nob) @@ -4809,7 +5517,7 @@ DRIVER_INIT_MEMBER(system1_state,nobb) /* Patch to get PRG ROMS ('T', 'R' and 'S) status as "GOOD" in the "test mode" */ /* not really needed */ -// UINT8 *ROM = memregion("maincpu")->base(); +// UINT8 *ROM = m_maincpu_region->base(); // ROM[0x3296] = 0x18; // 'jr' instead of 'jr z' - 'T' (PRG Main ROM) // ROM[0x32be] = 0x18; // 'jr' instead of 'jr z' - 'R' (Banked ROM 1) @@ -4837,18 +5545,16 @@ DRIVER_INIT_MEMBER(system1_state,nobb) DRIVER_INIT_MEMBER(system1_state,bootleg) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x10000); DRIVER_INIT_CALL(bank00); + memcpy(m_decrypted_opcodes, m_maincpu_region->base() + 0x10000, 0x8000); } DRIVER_INIT_MEMBER(system1_state,bootsys2) { - address_space &space = m_maincpu->space(AS_PROGRAM); - space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x20000); - membank("bank1")->configure_decrypted_entries(0, 4, memregion("maincpu")->base() + 0x30000, 0x4000); DRIVER_INIT_CALL(bank0c); + m_bank0d->set_base(m_maincpu_region->base() + 0x20000); + m_bank1d->configure_entries(0, 4, m_maincpu_region->base() + 0x30000, 0x4000); } DRIVER_INIT_MEMBER(system1_state,choplift) @@ -4882,84 +5588,84 @@ DRIVER_INIT_MEMBER(system1_state,shtngmst) *************************************/ /* PPI-based System 1 */ -GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", GAME_SUPPORTS_SAVE ) -GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", GAME_SUPPORTS_SAVE ) -GAME( 1983, upndown, 0, sys1ppi, upndown, system1_state, nprinces, ROT270, "Sega", "Up'n Down (315-5030)", GAME_SUPPORTS_SAVE ) -GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1983, regulus, 0, sys1ppi, regulus, system1_state, regulus, ROT270, "Sega", "Regulus (315-5033, Rev A.)", GAME_SUPPORTS_SAVE ) -GAME( 1983, reguluso, regulus, sys1ppi, reguluso, system1_state, regulus, ROT270, "Sega", "Regulus (315-5033)", GAME_SUPPORTS_SAVE ) -GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1984, mrviking, 0, sys1ppis, mrviking, system1_state, mrviking, ROT270, "Sega", "Mister Viking (315-5041)", GAME_SUPPORTS_SAVE ) -GAME( 1984, mrvikingj, mrviking, sys1ppis, mrvikingj, system1_state, mrviking, ROT270, "Sega", "Mister Viking (315-5041, Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1984, swat, 0, sys1ppi, swat, system1_state, swat, ROT270, "Coreland / Sega", "SWAT (315-5048)", GAME_SUPPORTS_SAVE ) -GAME( 1984, flickyo, flicky, sys1ppi, flicky, system1_state, flicky, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1984, flickys1, flicky, sys1ppi, flickys1, system1_state, flicky, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1984, wmatch, 0, sys1ppis, wmatch, system1_state, wmatch, ROT270, "Sega", "Water Match (315-5064)", GAME_SUPPORTS_SAVE ) -GAME( 1984, bullfgt, 0, sys1ppi, bullfgt, system1_state, bullfgtj, ROT0, "Coreland / Sega", "Bullfight (315-5065)", GAME_SUPPORTS_SAVE ) -GAME( 1985, nprinces, seganinj, sys1ppi, seganinj, system1_state, flicky, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", GAME_SUPPORTS_SAVE ) -GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboy2, wboy, sys1ppi, wboy, system1_state, wboy2, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", GAME_SUPPORTS_SAVE ) -GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1983, starjack, 0, sys1ppis, starjack, system1_state, bank00, ROT270, "Sega", "Star Jacker (Sega)", GAME_SUPPORTS_SAVE ) +GAME( 1983, starjacks, starjack, sys1ppis, starjacks, system1_state, bank00, ROT270, "Sega (Stern Electronics license)", "Star Jacker (Stern Electronics)", GAME_SUPPORTS_SAVE ) +GAME( 1983, upndown, 0, sys1ppix, upndown, system1_state, nprinces, ROT270, "Sega", "Up'n Down (315-5030)", GAME_SUPPORTS_SAVE ) +GAME( 1983, upndownu, upndown, sys1ppi, upndown, system1_state, bank00, ROT270, "Sega", "Up'n Down (not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1983, regulus, 0, sys1ppix, regulus, system1_state, regulus, ROT270, "Sega", "Regulus (315-5033, Rev A.)", GAME_SUPPORTS_SAVE ) +GAME( 1983, reguluso, regulus, sys1ppix, reguluso, system1_state, regulus, ROT270, "Sega", "Regulus (315-5033)", GAME_SUPPORTS_SAVE ) +GAME( 1983, regulusu, regulus, sys1ppi, regulus, system1_state, bank00, ROT270, "Sega", "Regulus (not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, mrviking, 0, sys1ppisx, mrviking, system1_state, mrviking, ROT270, "Sega", "Mister Viking (315-5041)", GAME_SUPPORTS_SAVE ) +GAME( 1984, mrvikingj, mrviking, sys1ppisx, mrvikingj, system1_state, mrviking, ROT270, "Sega", "Mister Viking (315-5041, Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1984, swat, 0, sys1ppix, swat, system1_state, swat, ROT270, "Coreland / Sega", "SWAT (315-5048)", GAME_SUPPORTS_SAVE ) +GAME( 1984, flickyo, flicky, sys1ppix, flicky, system1_state, flicky, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1984, flickys1, flicky, sys1ppix, flickys1, system1_state, flicky, ROT0, "Sega", "Flicky (64k Version, System 1, 315-5051, set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1984, wmatch, 0, sys1ppisx, wmatch, system1_state, wmatch, ROT270, "Sega", "Water Match (315-5064)", GAME_SUPPORTS_SAVE ) +GAME( 1984, bullfgt, 0, sys1ppix, bullfgt, system1_state, bullfgtj, ROT0, "Coreland / Sega", "Bullfight (315-5065)", GAME_SUPPORTS_SAVE ) +GAME( 1985, nprinces, seganinj, sys1ppix, seganinj, system1_state, flicky, ROT0, "bootleg?", "Ninja Princess (315-5051, 64k Ver. bootleg?)", GAME_SUPPORTS_SAVE ) +GAME( 1985, nprincesu, seganinj, sys1ppi, seganinj, system1_state, bank00, ROT0, "Sega", "Ninja Princess (64k Ver. not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboy2, wboy, sys1ppix, wboy, system1_state, wboy2, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, 315-5178)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboy2u, wboy, sys1ppi, wboy, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (set 2, not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wbdeluxe, wboy, sys1ppi, wbdeluxe, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy Deluxe", GAME_SUPPORTS_SAVE ) +GAME( 1986, nob, 0, nobm, nob, system1_state, nob, ROT270, "Coreland / Data East Corporation", "Noboranka (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1986, nobb, nob, nob, nob, system1_state, nobb, ROT270, "bootleg (Game Electronics)", "Noboranka (Japan, bootleg)", GAME_SUPPORTS_SAVE ) /* PIO-based System 1 */ -GAME( 1984, flicky, 0, sys1pio, flicky, system1_state, flicky, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", GAME_SUPPORTS_SAVE ) -GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1984, thetogyu, bullfgt, sys1pio, bullfgt, system1_state, bullfgtj, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1984, spatter, 0, sys1pios, spatter, system1_state, spatter, ROT0, "Sega", "Spatter (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1984, spattera, spatter, sys1pios, spatter, system1_state, spatter, ROT0, "Sega", "Spatter (315-5099)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) -GAME( 1984, ssanchan, spatter, sys1pios, spatter, system1_state, spatter, ROT0, "Sega", "Sanrin San Chan (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pitfall2, 0, sys1pio, pitfall2, system1_state, pitfall2, ROT0, "Sega", "Pitfall II (315-5093)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pitfall2a, pitfall2, sys1pio, pitfall2, system1_state, pitfall2, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", GAME_SUPPORTS_SAVE ) -GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1985, seganinj, 0, sys1pio, seganinj, system1_state, seganinj, ROT0, "Sega", "Sega Ninja (315-5102)", GAME_SUPPORTS_SAVE ) -GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1985, ninja, seganinj, sys1pio, seganinj, system1_state, seganinj, ROT0, "Sega", "Ninja (315-5102)", GAME_SUPPORTS_SAVE ) -GAME( 1985, nprinceso, seganinj, sys1pio, seganinj, system1_state, nprinces, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", GAME_SUPPORTS_SAVE ) -GAME( 1985, nprincesb, seganinj, sys1pio, seganinj, system1_state, flicky, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", GAME_SUPPORTS_SAVE ) -GAME( 1985, imsorry, 0, sys1pio, imsorry, system1_state, imsorry, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", GAME_SUPPORTS_SAVE ) -GAME( 1985, imsorryj, imsorry, sys1pio, imsorry, system1_state, imsorry, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1985, teddybb, 0, sys1pio, teddybb, system1_state, teddybb, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", GAME_SUPPORTS_SAVE ) -GAME( 1985, teddybbo, teddybb, sys1pio, teddybb, system1_state, teddybb, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", GAME_SUPPORTS_SAVE ) -GAME( 1985, teddybbobl, teddybb, sys1pio, teddybb, system1_state, teddybb, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1985, sscandal, myhero, sys1pio, myhero, system1_state, myheroj, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1985, myherok, myhero, sys1pio, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", GAME_SUPPORTS_SAVE ) -GAME( 1985, 4dwarrio, 0, sys1pio, 4dwarrio, system1_state, 4dwarrio, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", GAME_SUPPORTS_SAVE ) -GAME( 1986, raflesia, 0, sys1pio, raflesia, system1_state, 4dwarrio, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboy, 0, sys1pio, wboy, system1_state, wboy, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboyo, wboy, sys1pio, wboy, system1_state, wboyo, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5135)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboy3, wboy, sys1pio, wboy3, system1_state, wboyo, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboy4, wboy, sys1pio, wboy, system1_state, 4dwarrio, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", GAME_SUPPORTS_SAVE ) // appears to be a very early / unfinished version. -GAME( 1986, wboy5, wboy, sys1pio, wboy3, system1_state, wboyo, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1986, wboyub, wboy, sys1pio, wboy, system1_state, wboyo, ROT0, "bootleg", "Wonder Boy (US bootleg)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) -GAME( 1987, blockgal, 0, sys1pio, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", GAME_SUPPORTS_SAVE) +GAME( 1984, flicky, 0, sys1piox, flicky, system1_state, flicky, ROT0, "Sega", "Flicky (128k Version, System 2, 315-5051)", GAME_SUPPORTS_SAVE ) +GAME( 1984, flickys2, flicky, sys1pio, flickys2, system1_state, bank00, ROT0, "Sega", "Flicky (128k Version, System 2, not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, thetogyu, bullfgt, sys1piox, bullfgt, system1_state, bullfgtj, ROT0, "Coreland / Sega", "The Togyu (315-5065, Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1984, spatter, 0, sys1piosx, spatter, system1_state, spatter, ROT0, "Sega", "Spatter (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1984, spattera, spatter, sys1piosx, spatter, system1_state, spatter, ROT0, "Sega", "Spatter (315-5099)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) +GAME( 1984, ssanchan, spatter, sys1piosx, spatter, system1_state, spatter, ROT0, "Sega", "Sanrin San Chan (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pitfall2, 0, sys1piox, pitfall2, system1_state, pitfall2, ROT0, "Sega", "Pitfall II (315-5093)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pitfall2a, pitfall2, sys1piox, pitfall2, system1_state, pitfall2, ROT0, "Sega", "Pitfall II (315-5093, Flicky Conversion)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pitfall2u, pitfall2, sys1pio, pitfall2u, system1_state, bank00, ROT0, "Sega", "Pitfall II (not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, seganinj, 0, sys1piox, seganinj, system1_state, seganinj, ROT0, "Sega", "Sega Ninja (315-5102)", GAME_SUPPORTS_SAVE ) +GAME( 1985, seganinju, seganinj, sys1pio, seganinj, system1_state, bank00, ROT0, "Sega", "Sega Ninja (not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, ninja, seganinj, sys1piox, seganinj, system1_state, seganinj, ROT0, "Sega", "Ninja (315-5102)", GAME_SUPPORTS_SAVE ) +GAME( 1985, nprinceso, seganinj, sys1piox, seganinj, system1_state, nprinces, ROT0, "Sega", "Ninja Princess (315-5098, 128k Ver.)", GAME_SUPPORTS_SAVE ) +GAME( 1985, nprincesb, seganinj, sys1piox, seganinj, system1_state, flicky, ROT0, "bootleg?", "Ninja Princess (315-5051?, 128k Ver. bootleg?)", GAME_SUPPORTS_SAVE ) +GAME( 1985, imsorry, 0, sys1piox, imsorry, system1_state, imsorry, ROT0, "Coreland / Sega", "I'm Sorry (315-5110, US)", GAME_SUPPORTS_SAVE ) +GAME( 1985, imsorryj, imsorry, sys1piox, imsorry, system1_state, imsorry, ROT0, "Coreland / Sega", "Gonbee no I'm Sorry (315-5110, Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1985, teddybb, 0, sys1piox, teddybb, system1_state, teddybb, ROT0, "Sega", "TeddyBoy Blues (315-5115, New Ver.)", GAME_SUPPORTS_SAVE ) +GAME( 1985, teddybbo, teddybb, sys1piox, teddybb, system1_state, teddybb, ROT0, "Sega", "TeddyBoy Blues (315-5115, Old Ver.)", GAME_SUPPORTS_SAVE ) +GAME( 1985, teddybbobl, teddybb, sys1piox, teddybb, system1_state, teddybb, ROT0, "bootleg", "TeddyBoy Blues (Old Ver. bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1985, myhero, 0, sys1pio, myhero, system1_state, bank00, ROT0, "Coreland / Sega", "My Hero (US, not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, sscandal, myhero, sys1piox, myhero, system1_state, myheroj, ROT0, "Coreland / Sega", "Seishun Scandal (315-5132, Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1985, myherok, myhero, sys1piox, myhero, system1_state, myherok, ROT0, "Coreland / Sega", "My Hero (Korea)", GAME_SUPPORTS_SAVE ) +GAME( 1985, 4dwarrio, 0, sys1piox, 4dwarrio, system1_state, 4dwarrio, ROT0, "Coreland / Sega", "4-D Warriors (315-5162)", GAME_SUPPORTS_SAVE ) +GAME( 1986, raflesia, 0, sys1piox, raflesia, system1_state, 4dwarrio, ROT270, "Coreland / Sega", "Rafflesia (315-5162)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboy, 0, sys1piox, wboy, system1_state, wboy, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5177)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboyo, wboy, sys1piox, wboy, system1_state, wboyo, ROT0, "Escape (Sega license)", "Wonder Boy (set 1, 315-5135)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboy3, wboy, sys1piox, wboy3, system1_state, wboyo, ROT0, "Escape (Sega license)", "Wonder Boy (set 3, 315-5135)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboy4, wboy, sys1piox, wboy, system1_state, 4dwarrio, ROT0, "Escape (Sega license)", "Wonder Boy (315-5162, 4-D Warriors Conversion)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboyu, wboy, sys1pio, wboyu, system1_state, bank00, ROT0, "Escape (Sega license)", "Wonder Boy (prototype?)", GAME_SUPPORTS_SAVE ) // appears to be a very early / unfinished version. +GAME( 1986, wboy5, wboy, sys1piox, wboy3, system1_state, wboyo, ROT0, "bootleg", "Wonder Boy (set 5, bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1986, wboyub, wboy, sys1piox, wboy, system1_state, wboyo, ROT0, "bootleg", "Wonder Boy (US bootleg)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) +GAME( 1987, blockgal, 0, sys1piox, blockgal, system1_state, blockgal, ROT90, "Sega / Vic Tokai","Block Gal (MC-8123B, 317-0029)", GAME_SUPPORTS_SAVE) /* PIO-based System 1 with ROM banking */ -GAME( 1985, hvymetal, 0, sys1pio, hvymetal, system1_state, hvymetal, ROT0, "Sega", "Heavy Metal (315-5135)", GAME_SUPPORTS_SAVE ) -GAME( 1986, gardia, 0, sys1pio, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (317-0006)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE) -GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", GAME_SUPPORTS_SAVE ) +GAME( 1985, hvymetal, 0, sys1piox, hvymetal, system1_state, hvymetal, ROT0, "Sega", "Heavy Metal (315-5135)", GAME_SUPPORTS_SAVE ) +GAME( 1986, gardia, 0, sys1piox, gardia, system1_state, gardia, ROT270, "Coreland / Sega", "Gardia (317-0006)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE) +GAME( 1986, brain, 0, sys1pio, brain, system1_state, bank44, ROT0, "Coreland / Sega", "Brain", GAME_SUPPORTS_SAVE ) /* System 2 */ -GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", GAME_SUPPORTS_SAVE ) -GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", GAME_SUPPORTS_SAVE ) -GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) -GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", GAME_SUPPORTS_SAVE ) -GAME( 1986, gardiab, gardia, sys2, gardia, system1_state, gardiab, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) -GAME( 1986, wboysys2, wboy, sys2, wboysys2, system1_state, wboysys2, ROT0, "Escape (Sega license)", "Wonder Boy (system 2)", GAME_SUPPORTS_SAVE ) -GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", GAME_SUPPORTS_SAVE ) -GAME( 1987, wbml, 0, sys2, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", GAME_SUPPORTS_SAVE ) -GAME( 1987, wbmljo, wbml, sys2, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", GAME_SUPPORTS_SAVE ) -GAME( 1987, wbmljb, wbml, sys2, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1987, wbmlb, wbml, sys2, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", GAME_SUPPORTS_SAVE) -GAME( 1987, wbmlbg, wbml, sys2, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1987, wbmlbge, wbml, sys2, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", GAME_SUPPORTS_SAVE ) -GAME( 2009, wbmlvc, wbml, sys2, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", GAME_SUPPORTS_SAVE ) -GAME( 1987, dakkochn, 0, sys2, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", GAME_SUPPORTS_SAVE ) -GAME( 1987, blockgalb, blockgal, sys2, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", GAME_SUPPORTS_SAVE ) -GAME( 1988, ufosensi, 0, sys2row, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", GAME_SUPPORTS_SAVE ) -GAME( 1988, ufosensib, ufosensi, sys2row, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1985, choplift, 0, sys2rowm, choplift, system1_state, choplift, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (8751 315-5151)", GAME_SUPPORTS_SAVE ) +GAME( 1985, chopliftu, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "Sega (licensed from Dan Gorlin)", "Choplifter (unprotected)", GAME_SUPPORTS_SAVE ) +GAME( 1985, chopliftbl, choplift, sys2row, choplift, system1_state, bank0c, ROT0, "bootleg", "Choplifter (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1985, shtngmst, 0, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega", "Shooting Master (8751 315-5159)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) +GAME( 1985, shtngmste, shtngmst, sys2m, shtngmst, system1_state, shtngmst, ROT0, "Sega / EVG", "Shooting Master (EVG, 8751 315-5159a)", GAME_SUPPORTS_SAVE ) +GAME( 1986, gardiab, gardia, sys2x, gardia, system1_state, gardiab, ROT270, "bootleg", "Gardia (317-0007?, bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1986, wboysys2, wboy, sys2x, wboysys2, system1_state, wboysys2, ROT0, "Escape (Sega license)", "Wonder Boy (system 2)", GAME_SUPPORTS_SAVE ) +GAME( 1987, tokisens, 0, sys2, tokisens, system1_state, bank0c, ROT90, "Sega", "Toki no Senshi - Chrono Soldier", GAME_SUPPORTS_SAVE ) +GAME( 1987, wbml, 0, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan New Ver., MC-8123, 317-0043)", GAME_SUPPORTS_SAVE ) +GAME( 1987, wbmljo, wbml, sys2xb, wbml, system1_state, wbml, ROT0, "Sega / Westone", "Wonder Boy in Monster Land (Japan Old Ver., MC-8123, 317-0043)", GAME_SUPPORTS_SAVE ) +GAME( 1987, wbmljb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (Japan bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1987, wbmlb, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg", "Wonder Boy in Monster Land (English bootleg set 1)", GAME_SUPPORTS_SAVE) +GAME( 1987, wbmlbg, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Galaxy Electronics)", "Wonder Boy in Monster Land (English bootleg set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1987, wbmlbge, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "bootleg (Gecas)", "Wonder Boy in Monster Land (English bootleg set 3)", GAME_SUPPORTS_SAVE ) +GAME( 2009, wbmlvc, wbml, sys2xb, wbml, system1_state, bootsys2, ROT0, "Sega", "Wonder Boy in Monster Land (English, Virtual Console)", GAME_SUPPORTS_SAVE ) +GAME( 1987, dakkochn, 0, sys2xb, dakkochn, system1_state, dakkochn, ROT0, "White Board", "DakkoChan House (MC-8123B, 317-5014)", GAME_SUPPORTS_SAVE ) +GAME( 1987, blockgalb, blockgal, sys2x, blockgal, system1_state, bootleg, ROT90, "bootleg", "Block Gal (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1988, ufosensi, 0, sys2rowxb, ufosensi, system1_state, ufosensi, ROT0, "Sega", "Ufo Senshi Yohko Chan (MC-8123, 317-0064)", GAME_SUPPORTS_SAVE ) +GAME( 1988, ufosensib, ufosensi, sys2rowxb, ufosensi, system1_state, bootsys2, ROT0, "bootleg", "Ufo Senshi Yohko Chan (bootleg, not encrypted)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index 692c99e659f..2c0723f6f18 100644 --- a/src/mame/drivers/system16.c +++ b/src/mame/drivers/system16.c @@ -625,6 +625,10 @@ static ADDRESS_MAP_START( bayrouteb1_map, AS_PROGRAM, 16, segas1x_bootleg_state AM_RANGE(0x902002, 0x902003) AM_READ_PORT("DSW1") ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, segas1x_bootleg_state ) + AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + void segas1x_bootleg_state::datsu_set_pages( ) { UINT16 page; @@ -2159,6 +2163,7 @@ static MACHINE_CONFIG_START( goldnaxeb1, segas1x_bootleg_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 10000000) MCFG_CPU_PROGRAM_MAP(goldnaxeb1_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", segas1x_bootleg_state, sys16_interrupt) @@ -2187,6 +2192,7 @@ static MACHINE_CONFIG_DERIVED( goldnaxeb2, goldnaxeb1 ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(goldnaxeb2_map) + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) MACHINE_CONFIG_END @@ -2202,6 +2208,7 @@ static MACHINE_CONFIG_DERIVED( bayrouteb2, goldnaxeb1 ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(bayrouteb2_map) + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) MCFG_FRAGMENT_ADD(system16_datsu_sound) @@ -3462,29 +3469,24 @@ DRIVER_INIT_MEMBER(segas1x_bootleg_state,wb3bbl) DRIVER_INIT_MEMBER(segas1x_bootleg_state,goldnaxeb1) { int i; - UINT8 *ROM = memregion("maincpu")->base(); + UINT16 *ROM = (UINT16 *)memregion("maincpu")->base(); UINT8 *KEY = memregion("decryption")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 data[0x1000]; + UINT16 data[0x800]; // the decryption key is in a rom (part of an MSDOS executable...) for (i = 0; i < 0x800; i++) { - KEY[i] = KEY[i] ^ 0xff; - data[(i * 2) + 0] = ((KEY[i] & 0x80) >> 1) | ((KEY[i] & 0x40) >> 2) | ((KEY[i] & 0x20) >> 3) | ((KEY[i] & 0x10) >> 4); - data[(i * 2) + 1] = ((KEY[i] & 0x08) << 3) | ((KEY[i] & 0x04) << 2) | ((KEY[i] & 0x02) << 1) | ((KEY[i] & 0x01) << 0); + UINT8 k = KEY[i] ^ 0xff; + data[i] = ((k & 0x80) << 7) | ((k & 0x40) << 6) | ((k & 0x20) << 5) | ((k & 0x10) << 4) | ((k & 0x08) << 3) | ((k & 0x04) << 2) | ((k & 0x02) << 1) | ((k & 0x01) << 0); } - m_decrypted_region = auto_alloc_array(machine(), UINT8, 0xc0000); - memcpy(m_decrypted_region, ROM, 0xc0000); + memcpy(m_decrypted_opcodes, ROM, 0xc0000); - for (i = 0; i < 0x40000; i++) + for (i = 0; i < 0x20000; i++) { - m_decrypted_region[i] = ROM[i] ^ data[(i & 0xfff) ^ 1]; + m_decrypted_opcodes[i] = ROM[i] ^ data[i & 0x7ff]; } - space.set_decrypted_region(0x00000, 0xbffff, m_decrypted_region); - DRIVER_INIT_CALL(common); m_spritebank_type = 1; @@ -3499,23 +3501,20 @@ DRIVER_INIT_MEMBER(segas1x_bootleg_state,bayrouteb1) // // for now we use the code which is present in the unprotected bootleg set // and modify the rom to use it - UINT16 *ROM2; - UINT16 *decrypted_region2; // decrypt DRIVER_INIT_CALL(goldnaxeb1); - ROM2 = (UINT16*)memregion("maincpu")->base(); - decrypted_region2 = (UINT16*)m_decrypted_region; + UINT16 *ROM = (UINT16*)memregion("maincpu")->base(); // patch interrupt vector - ROM2[0x0070/2] = 0x000b; - ROM2[0x0072/2] = 0xf000; + ROM[0x0070/2] = 0x000b; + ROM[0x0072/2] = 0xf000; // patch check for code in RAM - decrypted_region2[0x107e/2] = 0x48e7; - decrypted_region2[0x1080/2] = 0x000b; - decrypted_region2[0x1082/2] = 0xf000; + m_decrypted_opcodes[0x107e/2] = 0x48e7; + m_decrypted_opcodes[0x1080/2] = 0x000b; + m_decrypted_opcodes[0x1082/2] = 0xf000; } DRIVER_INIT_MEMBER(segas1x_bootleg_state,bayrouteb2) diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c index 237616a349a..fa679bf4576 100644 --- a/src/mame/drivers/taitoair.c +++ b/src/mame/drivers/taitoair.c @@ -138,7 +138,9 @@ the TMS320C25 is being used as a co-processor to relieve the along with the 68000. Gradiation RAM is used to display a rotatable gradient background. -The rotation is most likely handled by the TC0430GRW ROZ chip. +The rotation is handled by the TC0430GRW ROZ chip which outputs +coordinates for a X=a1+b1*x+c1*y, Y=a2+b2*x+c2*y mapping. The +coordinates are used unconventionally as indices in a color palette. "Power common ram" is for communication with a processor controlling the sit-in-cabinet (deluxe mechanized version only). @@ -160,7 +162,7 @@ DIPs are the same as topland, which is clearly wrong if you try them ("SWB:7,8" do not set Coin B to multiple credits for each coin!) -Therefore, some verificiation could still be needed, once the +Therefore, some verification could still be needed, once the emulation is complete. @@ -241,6 +243,7 @@ WRITE16_MEMBER(taitoair_state::system_control_w) m_dsp->set_input_line(INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); + m_gradbank = (data & 0x40); logerror("68K:%06x writing %04x to TMS32025. %s HOLD , %s RESET\n", space.device().safe_pcbase(), data, ((data & 4) ? "Clear" : "Assert"), ((data & 1) ? "Clear" : "Assert")); } @@ -313,15 +316,6 @@ WRITE16_MEMBER(taitoair_state::airsys_gradram_w) g = (g << 1) | (g & 1); b = (b << 1) | (b & 1); - /* TODO: I'm sure that normal paletteram and gradiation ram mixes in some way ... */ - //pal_r = ((m_paletteram[(offset >> 7) + 0x300] & 0x000f) >> 0) * 0x11; - //pal_g = ((m_paletteram[(offset >> 7) + 0x300] & 0x01e0) >> 5) * 0x11; - //pal_b = ((m_paletteram[(offset >> 7) + 0x300] & 0x7c00) >> 10) * 0x11; - - //if(r == 0) { r = (pal_r); } - //if(g == 0) { g = (pal_g); } - //if(b == 0) { b = (pal_b); } - m_palette->set_pen_color(offset+0x2000, r, g, b); } @@ -385,13 +379,13 @@ static ADDRESS_MAP_START( airsys_map, AS_PROGRAM, 16, taitoair_state ) AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("m68000_mainram") AM_RANGE(0x140000, 0x140001) AM_WRITE(system_control_w) /* Pause the TMS32025 */ - AM_RANGE(0x180000, 0x187fff) AM_RAM_WRITE(airsys_gradram_w) AM_SHARE("gradram") /* "gradiation ram (0/1)" */ + AM_RANGE(0x180000, 0x187fff) AM_RAM_WRITE(airsys_gradram_w) AM_SHARE("gradram") /* "gradiation ram (0/1)" */ AM_RANGE(0x188000, 0x189fff) AM_MIRROR(0x2000) AM_RAM_WRITE(airsys_paletteram16_w) AM_SHARE("paletteram") AM_RANGE(0x800000, 0x820fff) AM_DEVREADWRITE("tc0080vco", tc0080vco_device, word_r, word_w) /* tilemaps, sprites */ AM_RANGE(0x906000, 0x906007) AM_RAM // DMA? AM_RANGE(0x908000, 0x90ffff) AM_RAM AM_SHARE("line_ram") /* "line ram" */ AM_RANGE(0x910000, 0x91ffff) AM_RAM AM_SHARE("dsp_ram") /* "dsp common ram" (TMS320C25) */ - AM_RANGE(0x980000, 0x98000f) AM_RAM AM_SHARE("backregs") /* TC0430GRW? */ + AM_RANGE(0x980000, 0x98000f) AM_RAM AM_SHARE("tc0430grw") /* TC0430GRW roz transform coefficients */ AM_RANGE(0xa00000, 0xa00007) AM_READ(stick_input_r) AM_RANGE(0xa00100, 0xa00107) AM_READ(stick2_input_r) AM_RANGE(0xa00200, 0xa0020f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_device, read, write, 0x00ff) /* other I/O */ @@ -685,7 +679,7 @@ static MACHINE_CONFIG_START( airsys, taitoair_state ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*16, 64*16) + MCFG_SCREEN_SIZE(64*16, 32*16) MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 3*16, 28*16-1) MCFG_SCREEN_UPDATE_DRIVER(taitoair_state, screen_update_taitoair) MCFG_SCREEN_PALETTE("palette") diff --git a/src/mame/drivers/tcl.c b/src/mame/drivers/tcl.c index 2c975602f4d..48a5b93c25f 100644 --- a/src/mame/drivers/tcl.c +++ b/src/mame/drivers/tcl.c @@ -173,7 +173,6 @@ DRIVER_INIT_MEMBER(tcl_state,tcl) { /* only the first part is decrypted (and verified)*/ - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *dest = memregion("maincpu")->base(); int len = memregion("maincpu")->bytes(); dynamic_buffer src(len); @@ -197,8 +196,6 @@ DRIVER_INIT_MEMBER(tcl_state,tcl) WRITEDEST((src[idx]^0x11)^0xf0); // abcdefgh -> ABCdefgH } } - - space.set_decrypted_region(0x0000, 0x7fff, dest+0x10000); } GAME( 1995, tcl, 0, tcl, tcl, tcl_state, tcl, ROT0, "Uniwang", "Taiwan Chess Legend", GAME_NOT_WORKING ) diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index 883a874179e..8ce3409f286 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -2236,7 +2236,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( blswhstl, tmnt_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) /* Confirmed */ MCFG_CPU_PROGRAM_MAP(blswhstl_main_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", tmnt_state, punkshot_interrupt) diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c index fc6d7cdf076..aad35f84649 100644 --- a/src/mame/drivers/toki.c +++ b/src/mame/drivers/toki.c @@ -403,6 +403,13 @@ static MACHINE_CONFIG_START( toki, toki_state ) /* KOYO 20.000MHz near the cpu * SEIBU_SOUND_SYSTEM_YM3812_RAIDEN_INTERFACE(XTAL_14_31818MHz/4,XTAL_12MHz/12) /* verifed on pcb */ MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( tokie, toki ) + SEIBU_SOUND_SYSTEM_ENCRYPTED_LOW() +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tokic, toki ) + SEIBU_SOUND_SYSTEM_ENCRYPTED_CUSTOM() +MACHINE_CONFIG_END static MACHINE_CONFIG_START( tokib, toki_state ) @@ -757,8 +764,6 @@ DRIVER_INIT_MEMBER(toki_state,toki) { ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)]; } - - m_seibu_sound->decrypt("audiocpu",0x2000); } @@ -821,16 +826,12 @@ DRIVER_INIT_MEMBER(toki_state,jujuba) /* Decrypt data for z80 program */ { - address_space &space = m_audiocpu->space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x20000); + UINT8 *decrypt = m_seibu_sound->get_custom_decrypt(); UINT8 *rom = memregion("audiocpu")->base(); - int i; memcpy(decrypt,rom,0x20000); - space.set_decrypted_region(0x0000, 0x1fff, decrypt); - - for (i = 0;i < 0x2000;i++) + for (int i = 0;i < 0x2000;i++) { UINT8 src = decrypt[i]; rom[i] = src^0x55; @@ -852,15 +853,15 @@ DRIVER_INIT_MEMBER(toki_state,jujuba) // these 2 are both unique revisions -GAME( 1989, toki, 0, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1989, tokiu, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1989, toki, 0, tokie, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1989, tokiu, toki, tokie, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 1)", GAME_SUPPORTS_SAVE ) // these 3 are all the same revision, only the region byte differs -GAME( 1989, tokia, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1989, tokiua,toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1989, juju, toki, toki, toki, toki_state, toki, ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1989, tokia, toki, tokie, toki, toki_state, toki, ROT0, "TAD Corporation", "Toki (World, set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1989, tokiua,toki, tokie, toki, toki_state, toki, ROT0, "TAD Corporation (Fabtek license)", "Toki (US, set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1989, juju, toki, tokie, toki, toki_state, toki, ROT0, "TAD Corporation", "JuJu Densetsu (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1990, tokib, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Datsu)", "Toki (Datsu bootleg)", GAME_SUPPORTS_SAVE ) GAME( 1990, jujub, toki, tokib, tokib, toki_state, tokib, ROT0, "bootleg (Playmark)", "JuJu Densetsu (Playmark bootleg)", GAME_SUPPORTS_SAVE ) /* Sound hardware seems to have been slightly modified, the coins are handled ok, but there is no music and bad sfx. Program roms have a slight bitswap, Flipscreen also seems to be ignored */ -GAME( 1989, jujuba, toki, toki, toki, toki_state, jujuba, ROT180, "bootleg", "JuJu Densetsu (Japan, bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // bootleg of tokia/juju revison +GAME( 1989, jujuba, toki, tokic, toki, toki_state, jujuba, ROT180, "bootleg", "JuJu Densetsu (Japan, bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // bootleg of tokia/juju revison diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c index 7ff93fb34ca..2aa78acb812 100644 --- a/src/mame/drivers/trackfld.c +++ b/src/mame/drivers/trackfld.c @@ -892,7 +892,7 @@ INTERRUPT_GEN_MEMBER(trackfld_state::vblank_nmi) static MACHINE_CONFIG_START( trackfld, trackfld_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/6/2) /* a guess for now */ + MCFG_CPU_ADD("maincpu", KONAMI1, MASTER_CLOCK/6/2) /* a guess for now */ MCFG_CPU_PROGRAM_MAP(main_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", trackfld_state, vblank_irq) @@ -1010,8 +1010,11 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mastkin, trackfld ) /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") + MCFG_DEVICE_REMOVE("maincpu") + + MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/6/2) /* a guess for now */ MCFG_CPU_PROGRAM_MAP(mastkin_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", trackfld_state, vblank_irq) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( wizzquiz, trackfld ) @@ -1421,24 +1424,14 @@ ROM_END DRIVER_INIT_MEMBER(trackfld_state,trackfld) { - konami1_decode(machine(), "maincpu"); } DRIVER_INIT_MEMBER(trackfld_state,atlantol) { address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt; - int A; - - /* "konami1" encrypted opcodes */ - decrypt = konami1_decode(machine(), "maincpu"); - - /* not encrypted opcodes */ - for (A = 0; A < 0x6000; A++) - decrypt[A] = rom[A]; - space.set_decrypted_region(0x0000, 0xffff, decrypt); + machine().device<konami1_device>("maincpu")->set_encryption_boundary(0x6000); space.install_write_handler(0x0800, 0x0800, write8_delegate(FUNC(trackfld_state::atlantol_gfxbank_w),this)); space.nop_write(0x1000, 0x1000); diff --git a/src/mame/drivers/turbo.c b/src/mame/drivers/turbo.c index 29c981cee60..b9ec462b66d 100644 --- a/src/mame/drivers/turbo.c +++ b/src/mame/drivers/turbo.c @@ -539,7 +539,6 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( buckrog_map, AS_PROGRAM, 8, turbo_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(turbo_videoram_w) AM_SHARE("videoram") // FIX PAGE AM_RANGE(0xc800, 0xc803) AM_MIRROR(0x07fc) AM_DEVREAD("i8255_0", i8255_device, read) AM_WRITE(buckrog_i8255_0_w) // 8255 AM_RANGE(0xd000, 0xd003) AM_MIRROR(0x07fc) AM_DEVREADWRITE("i8255_1", i8255_device, read, write) // 8255 @@ -555,6 +554,9 @@ static ADDRESS_MAP_START( buckrog_map, AS_PROGRAM, 8, turbo_state ) AM_RANGE(0xf800, 0xffff) AM_RAM // SCRATCH ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, turbo_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END static ADDRESS_MAP_START( buckrog_cpu2_map, AS_PROGRAM, 8, turbo_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM @@ -919,6 +921,7 @@ static MACHINE_CONFIG_START( buckrog, turbo_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(buckrog_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", turbo_state, irq0_line_hold) MCFG_CPU_ADD("subcpu", Z80, MASTER_CLOCK/4) @@ -1178,7 +1181,7 @@ ROM_END ROM_START( buckrog ) /* CPU BOARD Sega ID# 834-5158-01, ROM BOARD Sega ID# 834-5152-01 */ - ROM_REGION( 0xc000, "maincpu", 0 ) + ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "epr-5265.cpu-ic3", 0x0000, 0x4000, CRC(f0055e97) SHA1(f6ee2afd6fef710949087d1cb04cbc242d1fa9f5) ) /* encrypted Z80 code, SEGA 315-5014 CPU */ ROM_LOAD( "epr-5266.cpu-ic4", 0x4000, 0x4000, CRC(7d084c39) SHA1(ef2c0a2a59e14d9e196fd3837139fc5acf0f63be) ) /* encrypted Z80 code, SEGA 315-5014 CPU */ @@ -1584,7 +1587,28 @@ DRIVER_INIT_MEMBER(turbo_state,turbo_enc) DRIVER_INIT_MEMBER(turbo_state,buckrog_enc) { - buckrog_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...0...0 */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...1 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */ + { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ + }; + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x8000, convtable); } diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index 2fe2ec733a7..ecb0bd1ea9e 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -32,7 +32,7 @@ - dquizgo2: bugged video test Notes: - + Mr Kicker: The F-E1-16-010 PCB version still needs proper speed ups Mr Kicker: Doesn't boot without a valid default eeprom, but no longer seems to fail @@ -140,7 +140,8 @@ public: DECLARE_READ32_MEMBER(wyvernwg_speedup_r); DECLARE_READ32_MEMBER(wyvernwga_speedup_r); DECLARE_READ32_MEMBER(finalgdr_speedup_r); - DECLARE_READ32_MEMBER(mrkicker_speedup_r); + DECLARE_READ32_MEMBER(mrkickera_speedup_r); + DECLARE_READ16_MEMBER(mrkicker_speedup_r); DECLARE_READ16_MEMBER(dquizgo2_speedup_r); DECLARE_READ32_MEMBER(aoh_speedup_r); DECLARE_READ16_MEMBER(jmpbreak_speedup_r); @@ -161,7 +162,7 @@ public: DECLARE_WRITE32_MEMBER(finalgdr_oki_bank_w); DECLARE_WRITE32_MEMBER(aoh_oki_bank_w); DECLARE_WRITE16_MEMBER(boonggab_oki_bank_w); - DECLARE_WRITE16_MEMBER(mrkickera_oki_bank_w); + DECLARE_WRITE16_MEMBER(mrkicker_oki_bank_w); DECLARE_WRITE32_MEMBER(wyvernwg_snd_w); DECLARE_WRITE16_MEMBER(misncrft_snd_w); DECLARE_READ8_MEMBER(qs1000_p1_r); @@ -171,7 +172,7 @@ public: DECLARE_DRIVER_INIT(vamphalf); DECLARE_DRIVER_INIT(vamphafk); DECLARE_DRIVER_INIT(coolmini); - DECLARE_DRIVER_INIT(mrkicker); + DECLARE_DRIVER_INIT(mrkickera); DECLARE_DRIVER_INIT(mrdig); DECLARE_DRIVER_INIT(jmpbreak); DECLARE_DRIVER_INIT(dtfamily); @@ -187,7 +188,7 @@ public: DECLARE_DRIVER_INIT(boonggab); DECLARE_DRIVER_INIT(wyvernwg); DECLARE_DRIVER_INIT(yorijori); - DECLARE_DRIVER_INIT(mrkickera); + DECLARE_DRIVER_INIT(mrkicker); UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -341,7 +342,7 @@ WRITE16_MEMBER(vamphalf_state::boonggab_oki_bank_w) } -WRITE16_MEMBER(vamphalf_state::mrkickera_oki_bank_w) +WRITE16_MEMBER(vamphalf_state::mrkicker_oki_bank_w) { m_oki->set_bank_base(0x40000 * (data & 0x3)); } @@ -457,7 +458,7 @@ static ADDRESS_MAP_START( misncrft_io, AS_IO, 16, vamphalf_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( coolmini_io, AS_IO, 16, vamphalf_state ) -// AM_RANGE(0x002, 0x003) AM_WRITE(mrkickera_oki_bank_w) // not coolmini?, installed on init +// AM_RANGE(0x002, 0x003) AM_WRITE(mrkicker_oki_bank_w) // not coolmini?, installed on init AM_RANGE(0x200, 0x203) AM_WRITE(flipscreen_w) AM_RANGE(0x300, 0x303) AM_READ_PORT("SYSTEM") AM_RANGE(0x304, 0x307) AM_READ_PORT("P1_P2") @@ -507,7 +508,7 @@ static ADDRESS_MAP_START( finalgdr_io, AS_IO, 32, vamphalf_state ) AM_RANGE(0x60a0, 0x60a3) AM_WRITE(finalgdr_oki_bank_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( mrkicker_io, AS_IO, 32, vamphalf_state ) +static ADDRESS_MAP_START( mrkickera_io, AS_IO, 32, vamphalf_state ) AM_RANGE(0x2400, 0x2403) AM_READ(eeprom32_r) AM_RANGE(0x4000, 0x4003) AM_READNOP //? AM_RANGE(0x4000, 0x4003) AM_WRITE(finalgdr_eeprom_w) @@ -985,8 +986,9 @@ static MACHINE_CONFIG_START( common, vamphalf_state ) MCFG_CPU_VBLANK_INT_DRIVER("screen", vamphalf_state, irq1_line_hold) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") - MCFG_EEPROM_ERASE_TIME(attotime::from_usec(250)) // coolmini requires fast erase - MCFG_EEPROM_WRITE_TIME(attotime::from_usec(250)) // dtfamily requires fast write + // various games require fast timing to save settings, probably because our Hyperstone core timings are incorrect + MCFG_EEPROM_ERASE_TIME(attotime::from_usec(1)) + MCFG_EEPROM_WRITE_TIME(attotime::from_usec(1)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1105,10 +1107,10 @@ static MACHINE_CONFIG_DERIVED( finalgdr, common ) MCFG_FRAGMENT_ADD(sound_ym_oki) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( mrkicker, common ) +static MACHINE_CONFIG_DERIVED( mrkickera, common ) MCFG_CPU_REPLACE("maincpu", E132T, XTAL_50MHz) /* 50 MHz */ MCFG_CPU_PROGRAM_MAP(common_32bit_map) - MCFG_CPU_IO_MAP(mrkicker_io) + MCFG_CPU_IO_MAP(mrkickera_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", vamphalf_state, irq1_line_hold) MCFG_NVRAM_ADD_0FILL("nvram") @@ -2262,7 +2264,7 @@ ROMs: */ -ROM_START( mrkicker ) +ROM_START( mrkickera ) ROM_REGION32_BE( 0x100000, "user1", ROMREGION_ERASE00 ) /* Hyperstone CPU Code */ /* rom0 empty */ ROM_LOAD( "2-semicom.rom1", 0x080000, 0x080000, CRC(d3da29ca) SHA1(b843c650096a1c6d50f99e354ec0c93eb4406c5b) ) /* SEMICOM-003b PCB */ @@ -2288,11 +2290,11 @@ ROM_START( mrkicker ) ROM_COPY( "user2", 0x000000, 0x0c0000, 0x020000) ROM_COPY( "user2", 0x060000, 0x0e0000, 0x020000) - ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* Default EEPROM (it doesn't boot without and the game code crashes) */ + ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* Default EEPROM (it doesn't boot without and the game code crashes) (game also refuses to boot if program attempts to rewrite it, CPU bug or protection?) */ ROM_LOAD( "eeprom-mrkicker.bin", 0x0000, 0x0080, CRC(87afb8f7) SHA1(444203b793c1d7929fc5916f18b510198719cd38) ) ROM_END -ROM_START( mrkickera ) +ROM_START( mrkicker ) ROM_REGION16_BE( 0x100000, "user1", ROMREGION_ERASE00 ) /* Hyperstone CPU Code */ /* rom1 empty */ ROM_LOAD( "3-semicom.rom2", 0x080000, 0x080000, CRC(3f7fa08b) SHA1(dbffd44d8387e6ed1a4b5ec85ccf64d69a108d88) ) /* F-E1-16-010 PCB */ @@ -2321,9 +2323,6 @@ ROM_START( mrkickera ) ROM_COPY( "user2", 0x040000, 0x0a0000, 0x020000) ROM_COPY( "user2", 0x000000, 0x0c0000, 0x020000) ROM_COPY( "user2", 0x060000, 0x0e0000, 0x020000) - - ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* Default EEPROM (it doesn't boot without and the game code crashes) */ - ROM_LOAD( "eeprom-mrkicker.bin", 0x0000, 0x0080, CRC(87afb8f7) SHA1(444203b793c1d7929fc5916f18b510198719cd38) ) ROM_END /* @@ -2657,7 +2656,7 @@ READ32_MEMBER(vamphalf_state::finalgdr_speedup_r) return m_wram32[0x005e874/4]; } -READ32_MEMBER(vamphalf_state::mrkicker_speedup_r) +READ32_MEMBER(vamphalf_state::mrkickera_speedup_r) { UINT32 pc = space.device().safe_pc(); if(pc == 0x469de || pc == 0x46a36) @@ -2671,6 +2670,17 @@ READ32_MEMBER(vamphalf_state::mrkicker_speedup_r) return m_wram32[0x00701a4/4]; } +READ16_MEMBER(vamphalf_state::mrkicker_speedup_r) +{ + UINT32 pc = space.device().safe_pc(); + if(pc == 0x41ec6) + { + space.device().execute().eat_cycles(50); + } + + return m_wram[0x00063fc0/2]; +} + READ16_MEMBER(vamphalf_state::dquizgo2_speedup_r) { @@ -2793,10 +2803,10 @@ DRIVER_INIT_MEMBER(vamphalf_state,coolmini) m_flip_bit = 1; } -DRIVER_INIT_MEMBER(vamphalf_state,mrkickera) +DRIVER_INIT_MEMBER(vamphalf_state,mrkicker) { -// m_maincpu->space(AS_PROGRAM).install_read_handler(0x000d2e80, 0x000d2e83, read16_delegate(FUNC(vamphalf_state::mrkickera_speedup_r), this)); - m_maincpu->space(AS_IO).install_write_handler(0x002, 0x003, write16_delegate(FUNC(vamphalf_state::mrkickera_oki_bank_w), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x00063fc0, 0x00063fc1, read16_delegate(FUNC(vamphalf_state::mrkicker_speedup_r), this)); + m_maincpu->space(AS_IO).install_write_handler(0x002, 0x003, write16_delegate(FUNC(vamphalf_state::mrkicker_oki_bank_w), this)); m_palshift = 0; m_flip_bit = 1; @@ -2899,12 +2909,12 @@ DRIVER_INIT_MEMBER(vamphalf_state,finalgdr) save_item(NAME(m_semicom_prot_which)); } -DRIVER_INIT_MEMBER(vamphalf_state,mrkicker) +DRIVER_INIT_MEMBER(vamphalf_state,mrkickera) { // backup ram isn't used m_finalgdr_backupram_bank = 1; m_finalgdr_backupram = auto_alloc_array(machine(), UINT8, 0x80*0x100); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x00701a4, 0x00701a7, read32_delegate(FUNC(vamphalf_state::mrkicker_speedup_r), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x00701a4, 0x00701a7, read32_delegate(FUNC(vamphalf_state::mrkickera_speedup_r), this)); machine().device<nvram_device>("nvram")->set_base(m_finalgdr_backupram, 0x80*0x100); m_palshift = 0; @@ -2992,8 +3002,8 @@ GAME( 2000, misncrfta, misncrft, misncrft, common, vamphalf_state, misncrft, R GAME( 2000, mrdig, 0, mrdig, common, vamphalf_state, mrdig, ROT0, "Sun", "Mr. Dig", GAME_SUPPORTS_SAVE ) GAME( 2001, dtfamily, 0, coolmini, common, vamphalf_state, dtfamily, ROT0, "SemiCom", "Diet Family", GAME_SUPPORTS_SAVE ) GAME( 2001, finalgdr, 0, finalgdr, finalgdr, vamphalf_state, finalgdr, ROT0, "SemiCom", "Final Godori (Korea, version 2.20.5915)", GAME_SUPPORTS_SAVE ) -GAME( 2001, mrkicker, 0, mrkicker, finalgdr, vamphalf_state, mrkicker, ROT0, "SemiCom", "Mr. Kicker (SEMICOM-003b PCB)", GAME_SUPPORTS_SAVE ) -GAME( 2001, mrkickera, mrkicker, coolmini, common, vamphalf_state, mrkickera,ROT0, "SemiCom", "Mr. Kicker (F-E1-16-010 PCB)", GAME_SUPPORTS_SAVE ) +GAME( 2001, mrkicker, 0, coolmini, common, vamphalf_state, mrkicker,ROT0, "SemiCom", "Mr. Kicker (F-E1-16-010 PCB)", GAME_SUPPORTS_SAVE ) +GAME( 2001, mrkickera, mrkicker, mrkickera,finalgdr, vamphalf_state, mrkickera, ROT0, "SemiCom", "Mr. Kicker (SEMICOM-003b PCB)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) // if you allow eeprom saving works then this set corrupts the eeprom and then won't boot GAME( 2001, toyland, 0, coolmini, common, vamphalf_state, toyland, ROT0, "SemiCom", "Toy Land Adventure", GAME_SUPPORTS_SAVE ) GAME( 2001, wivernwg, 0, wyvernwg, common, vamphalf_state, wyvernwg, ROT270, "SemiCom", "Wivern Wings", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 2001, wyvernwg, wivernwg, wyvernwg, common, vamphalf_state, wyvernwg, ROT270, "SemiCom (Game Vision license)", "Wyvern Wings (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/vastar.c b/src/mame/drivers/vastar.c index 891e030878a..105dc168696 100644 --- a/src/mame/drivers/vastar.c +++ b/src/mame/drivers/vastar.c @@ -105,6 +105,12 @@ Vsync : 60.58hz #include "sound/ay8910.h" #include "includes/vastar.h" + +void vastar_state::machine_start() +{ + save_item(NAME(m_nmi_mask)); +} + void vastar_state::machine_reset() { /* we must start with the second CPU halted */ @@ -119,7 +125,7 @@ void vastar_state::machine_reset() m_spriteram3 = m_fgvideoram + 0x800; } -WRITE8_MEMBER(vastar_state::vastar_hold_cpu2_w) +WRITE8_MEMBER(vastar_state::hold_cpu2_w) { /* I'm not sure that this works exactly like this */ m_subcpu->set_input_line(INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); @@ -138,10 +144,10 @@ WRITE8_MEMBER(vastar_state::nmi_mask_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, vastar_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(vastar_bg2videoram_w) AM_SHARE("bg2videoram") AM_MIRROR(0x2000) - AM_RANGE(0x9000, 0x9fff) AM_RAM_WRITE(vastar_bg1videoram_w) AM_SHARE("bg1videoram") AM_MIRROR(0x2000) + AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(bg2videoram_w) AM_SHARE("bg2videoram") AM_MIRROR(0x2000) + AM_RANGE(0x9000, 0x9fff) AM_RAM_WRITE(bg1videoram_w) AM_SHARE("bg1videoram") AM_MIRROR(0x2000) AM_RANGE(0xc000, 0xc000) AM_WRITEONLY AM_SHARE("sprite_priority") /* sprite/BG priority */ - AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(vastar_fgvideoram_w) AM_SHARE("fgvideoram") // fg videoram + sprites + AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") // fg videoram + sprites AM_RANGE(0xe000, 0xe000) AM_READWRITE(watchdog_reset_r, watchdog_reset_w) AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("sharedram") ADDRESS_MAP_END @@ -150,7 +156,7 @@ static ADDRESS_MAP_START( main_port_map, AS_IO, 8, vastar_state ) ADDRESS_MAP_GLOBAL_MASK(0x0f) AM_RANGE(0x00, 0x00) AM_WRITE(nmi_mask_w) AM_RANGE(0x01, 0x01) AM_WRITE(flip_screen_w) - AM_RANGE(0x02, 0x02) AM_WRITE(vastar_hold_cpu2_w) + AM_RANGE(0x02, 0x02) AM_WRITE(hold_cpu2_w) ADDRESS_MAP_END @@ -432,7 +438,7 @@ static MACHINE_CONFIG_START( vastar, vastar_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vastar_state, screen_update_vastar) + MCFG_SCREEN_UPDATE_DRIVER(vastar_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", vastar) @@ -643,8 +649,8 @@ ROM_START( pprobe ) ROM_END -GAME( 1983, vastar, 0, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 1)", 0 ) // Sesame Japan was a brand of Fujikousan -GAME( 1983, vastar2, vastar, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 2)", 0 ) -GAME( 1983, vastar3, vastar, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 3)", 0 ) -GAME( 1983, vastar4, vastar, vastar, vastar4,driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 4)", 0 ) -GAME( 1985, pprobe, 0, vastar, pprobe, driver_device, 0, ROT90, "Crux / Kyugo?", "Planet Probe (prototype?)", 0 ) // has no Copyright, probably because Crux didn't have a trading name at this point? +GAME( 1983, vastar, 0, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 1)", GAME_SUPPORTS_SAVE ) // Sesame Japan was a brand of Fujikousan +GAME( 1983, vastar2, vastar, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1983, vastar3, vastar, vastar, vastar, driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 3)", GAME_SUPPORTS_SAVE ) +GAME( 1983, vastar4, vastar, vastar, vastar4,driver_device, 0, ROT90, "Orca (Sesame Japan license)", "Vastar (set 4)", GAME_SUPPORTS_SAVE ) +GAME( 1985, pprobe, 0, vastar, pprobe, driver_device, 0, ROT90, "Crux / Kyugo?", "Planet Probe (prototype?)", GAME_SUPPORTS_SAVE ) // has no Copyright, probably because Crux didn't have a trading name at this point? diff --git a/src/mame/drivers/vcombat.c b/src/mame/drivers/vcombat.c index 895e9c6f8cf..59f2e785435 100644 --- a/src/mame/drivers/vcombat.c +++ b/src/mame/drivers/vcombat.c @@ -98,8 +98,6 @@ public: vcombat_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_tlc34076(*this, "tlc34076"), - m_vid_0_shared_ram(*this, "vid_0_ram"), - m_vid_1_shared_ram(*this, "vid_1_ram"), m_framebuffer_ctrl(*this, "fb_control"), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), @@ -110,8 +108,6 @@ public: UINT16* m_m68k_framebuffer[2]; UINT16* m_i860_framebuffer[2][2]; required_device<tlc34076_device> m_tlc34076; - required_shared_ptr<UINT16> m_vid_0_shared_ram; - required_shared_ptr<UINT16> m_vid_1_shared_ram; required_shared_ptr<UINT16> m_framebuffer_ctrl; int m_crtc_select; DECLARE_WRITE16_MEMBER(main_video_write); @@ -125,8 +121,6 @@ public: DECLARE_WRITE64_MEMBER(v0_fb_w); DECLARE_WRITE64_MEMBER(v1_fb_w); DECLARE_WRITE16_MEMBER(crtc_w); - DECLARE_DIRECT_UPDATE_MEMBER(vcombat_vid_0_direct_handler); - DECLARE_DIRECT_UPDATE_MEMBER(vcombat_vid_1_direct_handler); DECLARE_WRITE16_MEMBER(vcombat_dac_w); DECLARE_WRITE_LINE_MEMBER(sound_update); DECLARE_DRIVER_INIT(shadfgtr); @@ -435,38 +429,10 @@ MACHINE_RESET_MEMBER(vcombat_state,shadfgtr) } -DIRECT_UPDATE_MEMBER(vcombat_state::vcombat_vid_0_direct_handler) -{ - if (address >= 0xfffc0000 && address <= 0xffffffff) - { - direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, m_vid_0_shared_ram); - return ~0; - } - return address; -} - -DIRECT_UPDATE_MEMBER(vcombat_state::vcombat_vid_1_direct_handler) -{ - if (address >= 0xfffc0000 && address <= 0xffffffff) - { - direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, m_vid_1_shared_ram); - return ~0; - } - return address; -} - - DRIVER_INIT_MEMBER(vcombat_state,vcombat) { UINT8 *ROM = memregion("maincpu")->base(); - /* The two i860s execute out of RAM */ - address_space &v0space = m_vid_0->space(AS_PROGRAM); - v0space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_0_direct_handler), this)); - - address_space &v1space = m_vid_1->space(AS_PROGRAM); - v1space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_1_direct_handler), this)); - /* Allocate the 68000 framebuffers */ m_m68k_framebuffer[0] = auto_alloc_array(machine(), UINT16, 0x8000); m_m68k_framebuffer[1] = auto_alloc_array(machine(), UINT16, 0x8000); @@ -506,10 +472,6 @@ DRIVER_INIT_MEMBER(vcombat_state,shadfgtr) m_i860_framebuffer[0][1] = auto_alloc_array(machine(), UINT16, 0x8000); m_i860_framebuffer[1][0] = NULL; m_i860_framebuffer[1][1] = NULL; - - /* The i860 executes out of RAM */ - address_space &space = m_vid_0->space(AS_PROGRAM); - space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_0_direct_handler), this)); } diff --git a/src/mame/drivers/vigilant.c b/src/mame/drivers/vigilant.c index 3afcf8c8fdc..b5bbe84a920 100644 --- a/src/mame/drivers/vigilant.c +++ b/src/mame/drivers/vigilant.c @@ -689,7 +689,7 @@ ROM_START( vigilantg ) // US Rev G ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) ROM_END -ROM_START( vigilano ) // US (earliest base version) +ROM_START( vigilanto ) // US (earliest base version) ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for bankswitching */ ROM_LOAD( "VG_A-8H-.ic55", 0x00000, 0x08000, CRC(8d15109e) SHA1(9ef57047a0b53cd0143a260193b33e3d5680ca71) ) ROM_LOAD( "VG_A-8L-.ic57", 0x10000, 0x10000, CRC(7f95799b) SHA1(a371671c3c26976314aaac4e410bff0f13a8a085) ) @@ -884,7 +884,7 @@ ROM_START( vigilantd ) // Japan Rev D ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) ROM_END -ROM_START( vigilanbl ) /* Bootleg */ +ROM_START( vigilantbl ) /* Bootleg */ ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for bankswitching */ ROM_LOAD( "g07_c03.bin", 0x00000, 0x08000, CRC(9dcca081) SHA1(6d086b70e6bf1fbafa746ef5c82334645f199be9) ) ROM_LOAD( "j07_c04.bin", 0x10000, 0x10000, CRC(e0159105) SHA1(da6d74ec075863c67c0ce21b07a54029d138f688) ) @@ -1055,17 +1055,17 @@ ROM_START( buccanrsa ) ROM_LOAD( "prom2.u99", 0x0300, 0x0100, CRC(e0aa8869) SHA1(ac8bdfeba69420ba56ec561bf3d0f1229d02cea2) ) ROM_END -GAME( 1988, vigilant, 0, vigilant, vigilant, driver_device, 0, ROT0, "Irem", "Vigilante (World, Rev E)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1988, vigilant, 0, vigilant, vigilant, driver_device, 0, ROT0, "Irem", "Vigilante (World, Rev E)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1988, vigilantg, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem (Data East license)", "Vigilante (US, Rev G)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1988, vigilano, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem (Data East license)", "Vigilante (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1988, vigilanto, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem (Data East license)", "Vigilante (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1988, vigilanta, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem", "Vigilante (World, Rev A)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1988, vigilantb, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem (Data East license)", "Vigilante (US, Rev B)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1988, vigilantc, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem", "Vigilante (World, Rev C)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1988, vigilantd, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "Irem", "Vigilante (Japan, Rev D)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1988, vigilanbl, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "bootleg", "Vigilante (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1988, vigilantbl, vigilant, vigilant, vigilant, driver_device, 0, ROT0, "bootleg", "Vigilante (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1988, kikcubic, 0, kikcubic, kikcubic, driver_device, 0, ROT0, "Irem", "Meikyu Jima (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) /* English title is Kickle Cubicle */ -GAME( 1988, kikcubicb, kikcubic, kikcubic, kikcubic, driver_device, 0, ROT0, "bootleg", "Kickle Cubele", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1988, kikcubic, 0, kikcubic, kikcubic, driver_device, 0, ROT0, "Irem", "Meikyu Jima (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) /* English title is Kickle Cubicle */ +GAME( 1988, kikcubicb, kikcubic, kikcubic, kikcubic, driver_device, 0, ROT0, "bootleg", "Kickle Cubele", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1989, buccanrs, 0, buccanrs, buccanrs, driver_device, 0, ROT0, "Duintronic", "Buccaneers (set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) -GAME( 1989, buccanrsa, buccanrs, buccanrs, buccanra, driver_device, 0, ROT0, "Duintronic", "Buccaneers (set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1989, buccanrs, 0, buccanrs, buccanrs, driver_device, 0, ROT0, "Duintronic", "Buccaneers (set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1989, buccanrsa, buccanrs, buccanrs, buccanra, driver_device, 0, ROT0, "Duintronic", "Buccaneers (set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/warpwarp.c b/src/mame/drivers/warpwarp.c index 4e868343715..69a95f87cd1 100644 --- a/src/mame/drivers/warpwarp.c +++ b/src/mame/drivers/warpwarp.c @@ -135,6 +135,13 @@ Notes: #define MASTER_CLOCK XTAL_18_432MHz +void warpwarp_state::machine_start() +{ + save_item(NAME(m_geebee_bgw)); + save_item(NAME(m_ball_on)); + save_item(NAME(m_ball_h)); + save_item(NAME(m_ball_v)); +} /* Interrupt Gen */ INTERRUPT_GEN_MEMBER(warpwarp_state::vblank_irq) @@ -733,7 +740,7 @@ static MACHINE_CONFIG_START( geebee, warpwarp_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224) - MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update_geebee) + MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1k) @@ -770,7 +777,7 @@ static MACHINE_CONFIG_START( bombbee, warpwarp_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224) - MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update_geebee) + MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", color) @@ -986,18 +993,18 @@ DRIVER_INIT_MEMBER(warpwarp_state,warpwarp) /* B & W games */ -GAMEL(1978, geebee, 0, geebee, geebee, warpwarp_state, geebee, ROT90, "Namco", "Gee Bee (Japan)", 0, layout_geebee ) -GAMEL(1978, geebeeb, geebee, geebee, geebeeb, warpwarp_state, geebee, ROT90, "Namco (F.lli Bertolino license)", "Gee Bee (Europe)", 0, layout_geebee ) // Fratelli Bertolino -GAMEL(1978, geebeeg, geebee, geebee, geebee, warpwarp_state, geebee, ROT90, "Namco (Gremlin license)", "Gee Bee (US)", 0, layout_geebee ) +GAMEL(1978, geebee, 0, geebee, geebee, warpwarp_state, geebee, ROT90, "Namco", "Gee Bee (Japan)", GAME_SUPPORTS_SAVE, layout_geebee ) +GAMEL(1978, geebeeb, geebee, geebee, geebeeb, warpwarp_state, geebee, ROT90, "Namco (F.lli Bertolino license)", "Gee Bee (Europe)", GAME_SUPPORTS_SAVE, layout_geebee ) // Fratelli Bertolino +GAMEL(1978, geebeeg, geebee, geebee, geebee, warpwarp_state, geebee, ROT90, "Namco (Gremlin license)", "Gee Bee (US)", GAME_SUPPORTS_SAVE, layout_geebee ) -GAMEL(1980, navarone, 0, navarone, navarone, warpwarp_state, navarone, ROT90, "Namco", "Navarone", GAME_IMPERFECT_SOUND, layout_navarone ) -GAME( 1980, kaitein, kaitei, navarone, kaitein, warpwarp_state, kaitein, ROT90, "K.K. Tokki (Namco license)", "Kaitei Takara Sagashi (Namco license)", 0 ) // pretty sure it didn't have a color overlay -GAME( 1980, kaitei, 0, navarone, kaitei, warpwarp_state, kaitei, ROT90, "K.K. Tokki", "Kaitei Takara Sagashi", 0 ) // " -GAME( 1980, sos, 0, navarone, sos, warpwarp_state, sos, ROT90, "Namco", "SOS", GAME_IMPERFECT_SOUND ) // developed by Shoei? +GAMEL(1980, navarone, 0, navarone, navarone, warpwarp_state, navarone, ROT90, "Namco", "Navarone", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_navarone ) +GAME( 1980, kaitein, kaitei, navarone, kaitein, warpwarp_state, kaitein, ROT90, "K.K. Tokki (Namco license)", "Kaitei Takara Sagashi (Namco license)", GAME_SUPPORTS_SAVE ) // pretty sure it didn't have a color overlay +GAME( 1980, kaitei, 0, navarone, kaitei, warpwarp_state, kaitei, ROT90, "K.K. Tokki", "Kaitei Takara Sagashi", GAME_SUPPORTS_SAVE ) // " +GAME( 1980, sos, 0, navarone, sos, warpwarp_state, sos, ROT90, "Namco", "SOS", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // developed by Shoei? /* Color games */ -GAME( 1979, bombbee, 0, bombbee, bombbee, warpwarp_state, bombbee, ROT90, "Namco", "Bomb Bee", 0 ) -GAME( 1979, cutieq, 0, bombbee, cutieq, warpwarp_state, bombbee, ROT90, "Namco", "Cutie Q", 0 ) -GAME( 1981, warpwarp, 0, warpwarp, warpwarp, warpwarp_state, warpwarp, ROT90, "Namco", "Warp & Warp", 0 ) -GAME( 1981, warpwarpr, warpwarp, warpwarp, warpwarpr, warpwarp_state, warpwarp, ROT90, "Namco (Rock-Ola license)", "Warp Warp (Rock-Ola set 1)", 0 ) -GAME( 1981, warpwarpr2, warpwarp, warpwarp, warpwarpr, warpwarp_state, warpwarp, ROT90, "Namco (Rock-Ola license)", "Warp Warp (Rock-Ola set 2)", 0 ) +GAME( 1979, bombbee, 0, bombbee, bombbee, warpwarp_state, bombbee, ROT90, "Namco", "Bomb Bee", GAME_SUPPORTS_SAVE ) +GAME( 1979, cutieq, 0, bombbee, cutieq, warpwarp_state, bombbee, ROT90, "Namco", "Cutie Q", GAME_SUPPORTS_SAVE ) +GAME( 1981, warpwarp, 0, warpwarp, warpwarp, warpwarp_state, warpwarp, ROT90, "Namco", "Warp & Warp", GAME_SUPPORTS_SAVE ) +GAME( 1981, warpwarpr, warpwarp, warpwarp, warpwarpr, warpwarp_state, warpwarp, ROT90, "Namco (Rock-Ola license)", "Warp Warp (Rock-Ola set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, warpwarpr2, warpwarp, warpwarp, warpwarpr, warpwarp_state, warpwarp, ROT90, "Namco (Rock-Ola license)", "Warp Warp (Rock-Ola set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c index a0490bbd343..ab881a9a3e1 100644 --- a/src/mame/drivers/wiz.c +++ b/src/mame/drivers/wiz.c @@ -328,6 +328,10 @@ static ADDRESS_MAP_START( kungfut_main_map, AS_PROGRAM, 8, wiz_state ) AM_RANGE(0xf818, 0xf818) AM_WRITE(wiz_bgcolor_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, wiz_state ) + AM_RANGE(0x0000, 0xbfff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END + static ADDRESS_MAP_START( wiz_main_map, AS_PROGRAM, 8, wiz_state ) AM_RANGE(0xc800, 0xc801) AM_WRITE(wiz_coin_counter_w) AM_RANGE(0xd400, 0xd400) AM_READ(wiz_protection_r) @@ -830,6 +834,7 @@ static MACHINE_CONFIG_DERIVED( stinger, kungfut ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(stinger_main_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) /* basic machine hardware */ MCFG_CPU_MODIFY("audiocpu") @@ -849,6 +854,9 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( scion, stinger ) + MCFG_CPU_MODIFY("maincpu") + MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_DECRYPTED_OPCODES) + /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_VISIBLE_AREA(2*8, 32*8-1, 2*8, 30*8-1) @@ -863,12 +871,12 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( kungfut ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "p1.bin", 0x0000, 0x4000, CRC(b1e56960) SHA1(993388bbb663412110d1012be9ffc00b06fce4d0) ) ROM_LOAD( "p3.bin", 0x4000, 0x4000, CRC(6fc346f8) SHA1(bd1663fa780e41eafd668bf502b40c9750270e55) ) ROM_LOAD( "p2.bin", 0x8000, 0x4000, CRC(042cc9c5) SHA1(09f87e240c2aaa19fe7b8cb548ded828ab67b18b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "1.bin", 0x0000, 0x2000, CRC(68028a5d) SHA1(2fabf5e55e09a34cd090d123737d31970e4086e8) ) ROM_REGION( 0x6000, "gfx1", 0 ) @@ -888,12 +896,12 @@ ROM_START( kungfut ) ROM_END ROM_START( kungfuta ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "kungfu.01", 0x0000, 0x4000, CRC(48dada70) SHA1(a90901d2aef73d4fa9d9c80769b82a3fead0a0f9) ) ROM_LOAD( "kungfu.02", 0x4000, 0x4000, CRC(c08c5152) SHA1(c5db3ee1ee165708d93d296b51a5bb43265ac75f) ) ROM_LOAD( "kungfu.03", 0x8000, 0x4000, CRC(09b8670c) SHA1(170e7cbf87727d940e959fa7a0328b4cc1aba195) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "kungfu.04", 0x0000, 0x2000, CRC(352bff48) SHA1(87d2408d31e1326ec810debcb2c724d1f003ae7b) ) ROM_REGION( 0x6000, "gfx1", 0 ) @@ -913,12 +921,12 @@ ROM_START( kungfuta ) ROM_END ROM_START( wiz ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "ic07_01.bin", 0x0000, 0x4000, CRC(c05f2c78) SHA1(98b93234684a3a228552ef41a08512fef1befedd) ) ROM_LOAD( "ic05_03.bin", 0x4000, 0x4000, CRC(7978d879) SHA1(866efdff3c111793d5a3cc2fa0b03a2b4e371c49) ) ROM_LOAD( "ic06_02.bin", 0x8000, 0x4000, CRC(9c406ad2) SHA1(cd82c3dc622886b6ebb30ba565f3c34d5a4e229b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "ic57_10.bin", 0x0000, 0x2000, CRC(8a7575bd) SHA1(5470c4c3a40139f45db7a9e260f40b5244f10123) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -941,12 +949,12 @@ ROM_START( wiz ) ROM_END ROM_START( wizt ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "wiz1.bin", 0x0000, 0x4000, CRC(5a6d3c60) SHA1(faeb7e7ddeee9638ec046655e87f866d81fdbee0) ) ROM_LOAD( "ic05_03.bin", 0x4000, 0x4000, CRC(7978d879) SHA1(866efdff3c111793d5a3cc2fa0b03a2b4e371c49) ) ROM_LOAD( "ic06_02.bin", 0x8000, 0x4000, CRC(9c406ad2) SHA1(cd82c3dc622886b6ebb30ba565f3c34d5a4e229b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "ic57_10.bin", 0x0000, 0x2000, CRC(8a7575bd) SHA1(5470c4c3a40139f45db7a9e260f40b5244f10123) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -970,12 +978,12 @@ ROM_END /* was marked as Wiz Alt Sound */ ROM_START( wizta ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "ic7", 0x0000, 0x4000, CRC(b2ec49ad) SHA1(f1624995e9d426dd69d6567a91713aa023e716ad) ) ROM_LOAD( "ic5", 0x4000, 0x4000, CRC(f7e8f792) SHA1(2c1f82e6f6b2573d8bf0a27fb344fe86f475ddef) ) ROM_LOAD( "ic6", 0x8000, 0x4000, CRC(9c406ad2) SHA1(cd82c3dc622886b6ebb30ba565f3c34d5a4e229b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "ic57", 0x0000, 0x2000, CRC(8a7575bd) SHA1(5470c4c3a40139f45db7a9e260f40b5244f10123) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -998,14 +1006,14 @@ ROM_START( wizta ) ROM_END ROM_START( stinger ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "1-5j.bin", 0x0000, 0x2000, CRC(1a2ca600) SHA1(473e89f2c49f6e6f38df5d6fc2267ffecf84c6c8) ) /* encrypted */ ROM_LOAD( "2-6j.bin", 0x2000, 0x2000, CRC(957cd39c) SHA1(38bb589b3bfd962415b31d1151adf4bdb661122f) ) /* encrypted */ ROM_LOAD( "3-8j.bin", 0x4000, 0x2000, CRC(404c932e) SHA1(c23eac49e06ff38564062c0e8c8cdadf877f1d6a) ) /* encrypted */ ROM_LOAD( "4-9j.bin", 0x6000, 0x2000, CRC(2d570f91) SHA1(31d54d9fd5254c33f07c605bd6112c7eb53c42a1) ) /* encrypted */ ROM_LOAD( "5-10j.bin", 0x8000, 0x2000, CRC(c841795c) SHA1(e03860813c03ca1c737935accc2b5fe87c6b624a) ) /* encrypted */ - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "6-9f.bin", 0x0000, 0x2000, CRC(79757f0c) SHA1(71be938c32c6a84618763761786ecc5d7d47581a) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -1025,14 +1033,14 @@ ROM_START( stinger ) ROM_END ROM_START( stinger2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + 64k for decrypted opcodes */ + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "n1.bin", 0x0000, 0x2000, CRC(f2d2790c) SHA1(0e5e92ef45b5bc27b0818f83c89b3bda0e701403) ) /* encrypted */ ROM_LOAD( "n2.bin", 0x2000, 0x2000, CRC(8fd2d8d8) SHA1(d3318a81fddeb3fa50d01569c1e1145e26ce7277) ) /* encrypted */ ROM_LOAD( "n3.bin", 0x4000, 0x2000, CRC(f1794d36) SHA1(7954500f489c0bc58cda8e7ffc2e4474759fdc33) ) /* encrypted */ ROM_LOAD( "n4.bin", 0x6000, 0x2000, CRC(230ba682) SHA1(c419ffebd021d41b3f5021948007fb6bcdb1cdf7) ) /* encrypted */ ROM_LOAD( "n5.bin", 0x8000, 0x2000, CRC(a03a01da) SHA1(28fecac7a821ac4718242919840266a907160df0) ) /* encrypted */ - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "6-9f.bin", 0x0000, 0x2000, CRC(79757f0c) SHA1(71be938c32c6a84618763761786ecc5d7d47581a) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -1052,14 +1060,14 @@ ROM_START( stinger2 ) ROM_END ROM_START( scion ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "sc1", 0x0000, 0x2000, CRC(8dcad575) SHA1(3f194ece25e730b1cbbf3f332bbdebc3a6a72b0f) ) ROM_LOAD( "sc2", 0x2000, 0x2000, CRC(f608e0ba) SHA1(e55b0ad4dc117339d45a999e13760f4ab3ca4ce0) ) ROM_LOAD( "sc3", 0x4000, 0x2000, CRC(915289b9) SHA1(b32b40f93de4501619486a8c5a8367d3b2e357a6) ) ROM_LOAD( "4.9j", 0x6000, 0x2000, CRC(0f40d002) SHA1(13b04f3902ebdda02670fcb667e181cf70594c37) ) ROM_LOAD( "5.10j", 0x8000, 0x2000, CRC(dc4923b7) SHA1(ec5c22ef1f9ba0fe4da3de62a63a44aa3ff850f4) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "sc6", 0x0000, 0x2000, CRC(09f5f9c1) SHA1(83e489f32597880fb1a13f0bafedd275facb21f7) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -1079,14 +1087,14 @@ ROM_START( scion ) ROM_END ROM_START( scionc ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0xc000, "maincpu", 0 ) ROM_LOAD( "1.5j", 0x0000, 0x2000, CRC(5aaf571e) SHA1(53becfad13e95012dce6597625c64dcba9ac4433) ) ROM_LOAD( "2.6j", 0x2000, 0x2000, CRC(d5a66ac9) SHA1(3192da12b2d6a07e203999ed97cdba16d4917a98) ) ROM_LOAD( "3.8j", 0x4000, 0x2000, CRC(6e616f28) SHA1(ea32add6173251152ca84426c098c92ace123878) ) ROM_LOAD( "4.9j", 0x6000, 0x2000, CRC(0f40d002) SHA1(13b04f3902ebdda02670fcb667e181cf70594c37) ) ROM_LOAD( "5.10j", 0x8000, 0x2000, CRC(dc4923b7) SHA1(ec5c22ef1f9ba0fe4da3de62a63a44aa3ff850f4) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x2000, "audiocpu", 0 ) ROM_LOAD( "6.9f", 0x0000, 0x2000, CRC(a66a0ce6) SHA1(b2d6a8ded007c362c58496ead33d1561a982440a) ) ROM_REGION( 0x6000, "gfx1", 0 ) /* sprites/chars */ @@ -1115,15 +1123,11 @@ DRIVER_INIT_MEMBER(wiz_state,stinger) { 5,3,7, 0x80 }, { 5,7,3, 0x28 } }; - address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = memregion("maincpu")->base(); - int size = memregion("maincpu")->bytes(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); const UINT8 *tbl; - space.set_decrypted_region(0x0000, 0xffff, decrypt); - - for (int a = 0x0000; a < 0x10000; a++) + for (int a = 0x0000; a < 0xc000; a++) { int row; UINT8 src; @@ -1131,7 +1135,7 @@ DRIVER_INIT_MEMBER(wiz_state,stinger) if (a & 0x2040) { /* not encrypted */ - decrypt[a] = rom[a]; + m_decrypted_opcodes[a] = rom[a]; } else { @@ -1142,7 +1146,7 @@ DRIVER_INIT_MEMBER(wiz_state,stinger) /* decode the opcodes */ tbl = swap_xor_table[row]; - decrypt[a] = BITSWAP8(src, tbl[0], 6, tbl[1], 4, tbl[2], 2, 1, 0) ^ tbl[3]; + m_decrypted_opcodes[a] = BITSWAP8(src, tbl[0], 6, tbl[1], 4, tbl[2], 2, 1, 0) ^ tbl[3]; } } } diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c index 0b09caa8cab..54089a18c4d 100644 --- a/src/mame/drivers/zaxxon.c +++ b/src/mame/drivers/zaxxon.c @@ -438,6 +438,9 @@ static ADDRESS_MAP_START( zaxxon_map, AS_PROGRAM, 8, zaxxon_state ) AM_RANGE(0xe0fb, 0xe0fb) AM_MIRROR(0x1f00) AM_WRITE(zaxxon_bg_enable_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, zaxxon_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_SHARE("decrypted_opcodes") +ADDRESS_MAP_END /* derived from Zaxxon, different sound hardware */ static ADDRESS_MAP_START( ixion_map, AS_PROGRAM, 8, zaxxon_state ) @@ -939,9 +942,20 @@ static MACHINE_CONFIG_DERIVED( zaxxon, root ) MCFG_FRAGMENT_ADD(zaxxon_samples) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( szaxxon, zaxxon ) + + /* encryption */ + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( futspy, root ) + /* encryption */ + MCFG_DEVICE_MODIFY("maincpu") + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) + /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(zaxxon_state, screen_update_futspy) @@ -956,6 +970,7 @@ static MACHINE_CONFIG_DERIVED( razmataz, root ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(ixion_map) + MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) MCFG_DEVICE_REMOVE("ppi8255") @@ -1429,14 +1444,13 @@ ROM_START( tiptop ) /* 3 board stack */ ROM_END - /************************************* * - * ROM decryption + * Driver initialization * *************************************/ -void zaxxon_state::zaxxonj_decode(const char *cputag) +DRIVER_INIT_MEMBER(zaxxon_state,zaxxonj) { /* the values vary, but the translation mask is always laid out like this: @@ -1480,15 +1494,9 @@ void zaxxon_state::zaxxonj_decode(const char *cputag) { 0x02,0x08,0x2a,0x20,0x20,0x2a,0x08,0x02 } /* .......1...1...1 */ }; - int A; - address_space &space = machine().device(cputag)->memory().space(AS_PROGRAM); - UINT8 *rom = memregion(cputag)->base(); - int size = memregion(cputag)->bytes(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); - - space.set_decrypted_region(0x0000, size - 1, decrypt); + UINT8 *rom = memregion("maincpu")->base(); - for (A = 0x0000; A < size; A++) + for (int A = 0x0000; A < 0x6000; A++) { int i,j; UINT8 src; @@ -1509,41 +1517,96 @@ void zaxxon_state::zaxxonj_decode(const char *cputag) /* now decode the opcodes */ /* pick the translation table from bits 0, 4, and 8 of the address */ i = ((A >> 0) & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2); - decrypt[A] = src ^ opcode_xortable[i][j]; + m_decrypted_opcodes[A] = src ^ opcode_xortable[i][j]; } } - -/************************************* - * - * Driver initialization - * - *************************************/ - -DRIVER_INIT_MEMBER(zaxxon_state,zaxxonj) -{ - zaxxonj_decode("maincpu"); -} - - DRIVER_INIT_MEMBER(zaxxon_state,szaxxon) { - szaxxon_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */ + { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ + { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ + { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ + { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */ + { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ + { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */ + { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...1 */ + { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...0 */ + { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable); } DRIVER_INIT_MEMBER(zaxxon_state,futspy) { - futspy_decode(machine(), "maincpu"); + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...0...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...1...0 */ + { 0xa0,0x80,0x20,0x00 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...1 */ + { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0xa8,0xa0 }, /* ...0...1...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */ + { 0x88,0x80,0xa8,0xa0 }, { 0x28,0x08,0x20,0x00 }, /* ...1...0...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...1 */ + { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...1...0...1...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ + { 0x88,0x80,0xa8,0xa0 }, { 0x88,0x80,0xa8,0xa0 }, /* ...1...1...0...0 */ + { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ + { 0x80,0x00,0xa0,0x20 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ + { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */ + }; + + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable); } DRIVER_INIT_MEMBER(zaxxon_state,razmataz) { - address_space &pgmspace = m_maincpu->space(AS_PROGRAM); + // Note: same as nprinces + static const UINT8 convtable[32][4] = + { + /* opcode data address */ + /* A B C D A B C D */ + { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */ + { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ + { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ + { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */ + { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ + { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ + }; + - nprinces_decode(machine(), "maincpu"); + sega_decode(memregion("maincpu")->base(), m_decrypted_opcodes, 0x6000, convtable); + + address_space &pgmspace = m_maincpu->space(AS_PROGRAM); /* additional input ports are wired */ pgmspace.install_read_port(0xc004, 0xc004, 0, 0x18f3, "SW04"); @@ -1570,19 +1633,19 @@ DRIVER_INIT_MEMBER(zaxxon_state,razmataz) GAME( 1982, zaxxon, 0, zaxxon, zaxxon, driver_device, 0, ROT90, "Sega", "Zaxxon (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 1982, zaxxon2, zaxxon, zaxxon, zaxxon, driver_device, 0, ROT90, "Sega", "Zaxxon (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 1982, zaxxon3, zaxxon, zaxxon, zaxxon, driver_device, 0, ROT90, "Sega", "Zaxxon (set 3)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1982, zaxxonj, zaxxon, zaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90, "Sega", "Zaxxon (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1982, zaxxonb, zaxxon, zaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90, "bootleg", "Jackson", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1982, zaxxonj, zaxxon, szaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90, "Sega", "Zaxxon (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1982, zaxxonb, zaxxon, zaxxon, zaxxon, zaxxon_state, zaxxonj, ROT90, "bootleg", "Jackson", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) /* standard Zaxxon hardware but extra sound board plugged into 8255 PPI socket and encrypted cpu */ -GAME( 1982, szaxxon, 0, zaxxon, szaxxon, zaxxon_state, szaxxon, ROT90, "Sega", "Super Zaxxon (315-5013)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1982, szaxxon, 0, szaxxon, szaxxon, zaxxon_state, szaxxon, ROT90, "Sega", "Super Zaxxon (315-5013)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) /* standard Zaxxon hardware? but encrypted cpu */ -GAME( 1984, futspy, 0, futspy, futspy, zaxxon_state, futspy, ROT90, "Sega", "Future Spy (315-5061)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1984, futspy, 0, futspy, futspy, zaxxon_state, futspy, ROT90, "Sega", "Future Spy (315-5061)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) /* these games run on modified Zaxxon hardware with no skewing, extra inputs, and a */ /* G-80 Universal Sound Board */ -GAME( 1983, razmataz, 0, razmataz, razmataz, zaxxon_state, razmataz, ROT90, "Sega", "Razzmatazz", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1983, ixion, 0, razmataz, ixion, zaxxon_state, szaxxon, ROT270, "Sega", "Ixion (prototype)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE) +GAME( 1983, razmataz, 0, razmataz, razmataz, zaxxon_state, razmataz, ROT90, "Sega", "Razzmatazz", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1983, ixion, 0, razmataz, ixion, zaxxon_state, szaxxon, ROT270, "Sega", "Ixion (prototype)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE) /* these games run on a slightly newer Zaxxon hardware with more ROM space and a */ /* custom sprite DMA chip */ diff --git a/src/mame/etc/doxy_driver.h b/src/mame/etc/doxy_driver.h index 906af7379d4..66e90c178b8 100644 --- a/src/mame/etc/doxy_driver.h +++ b/src/mame/etc/doxy_driver.h @@ -1,11 +1,11 @@ /*! @file doxy_driver.h @license BSD-3-Clause @copyright Angelo Salese & the MAME team - + @basehw 4enraya Main CPU: Z80 Sound Chip: AY8910 - + @memmap 4enraya,Z80 0x0000-0xbfff ROM 0xc000-0xcfff work RAM @@ -27,14 +27,13 @@ */ -/** +/** template for Doxygen commenting style for drivers All accepted special commands that aren't in Doxygen needs to be hooked up into the ini file. memmap/iomap/irq -> [%s,%s] -> [name_of_romset,cpu_name] irqnum -> type of irq, might accept one or two commands (for vectors) irqname -> A description of the irq used, might use brief and extended description. - + @sa http://www.stack.nl/~dimitri/doxygen/manual/commands.html @todo needs discussion for accepted standardized syntax */ - diff --git a/src/mame/includes/angelkds.h b/src/mame/includes/angelkds.h index d40f622a265..96009b248c9 100644 --- a/src/mame/includes/angelkds.h +++ b/src/mame/includes/angelkds.h @@ -19,7 +19,8 @@ public: m_subcpu(*this, "sub"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_bgtopvideoram; @@ -71,4 +72,5 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h index 85036346278..01c34c16dff 100644 --- a/src/mame/includes/appoooh.h +++ b/src/mame/includes/appoooh.h @@ -16,7 +16,8 @@ public: m_msm(*this, "msm"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_spriteram; @@ -65,6 +66,7 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; #define CHR1_OFST 0x00 /* palette page of char set #1 */ diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 05345676cbe..3b98eab32a8 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -94,7 +94,6 @@ public: DECLARE_WRITE8_MEMBER(tms5220_w); DECLARE_WRITE8_MEMBER(tms5220_strobe_w); DECLARE_WRITE8_MEMBER(coincount_w); - DECLARE_DIRECT_UPDATE_MEMBER(atarisy2_direct_handler); DECLARE_DRIVER_INIT(ssprint); DECLARE_DRIVER_INIT(apb); DECLARE_DRIVER_INIT(csprint); diff --git a/src/mame/includes/battlera.h b/src/mame/includes/battlera.h index 6ab2b1dbe3f..f7fb769e464 100644 --- a/src/mame/includes/battlera.h +++ b/src/mame/includes/battlera.h @@ -3,7 +3,6 @@ #include "sound/msm5205.h" #include "video/huc6260.h" #include "video/huc6270.h" -#include "video/huc6202.h" #define MAIN_CLOCK 21477270 @@ -19,30 +18,24 @@ public: m_huc6260(*this, "huc6260") { } + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_audiocpu; + required_device<msm5205_device> m_msm; + required_device<screen_device> m_screen; + required_device<huc6260_device> m_huc6260; + int m_control_port_select; int m_msm5205next; int m_toggle; - int m_inc_value; - int m_irq_enable; - int m_rcr_enable; - int m_sb_enable; - int m_bb_enable; - int m_bldwolf_vblank; - required_device<cpu_device> m_maincpu; - DECLARE_WRITE8_MEMBER(battlera_sound_w); + DECLARE_WRITE8_MEMBER(sound_w); DECLARE_WRITE8_MEMBER(control_data_w); DECLARE_READ8_MEMBER(control_data_r); - DECLARE_WRITE8_MEMBER(battlera_adpcm_data_w); - - DECLARE_WRITE8_MEMBER(battlera_adpcm_reset_w); + DECLARE_WRITE8_MEMBER(adpcm_data_w); + DECLARE_WRITE8_MEMBER(adpcm_reset_w); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); + virtual void machine_start(); - DECLARE_WRITE_LINE_MEMBER(battlera_adpcm_int); - required_device<cpu_device> m_audiocpu; - required_device<msm5205_device> m_msm; - required_device<screen_device> m_screen; - optional_device<huc6260_device> m_huc6260; UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(pce_irq_changed); }; diff --git a/src/mame/includes/boogwing.h b/src/mame/includes/boogwing.h index 2941973ac05..0c7a9a7d317 100644 --- a/src/mame/includes/boogwing.h +++ b/src/mame/includes/boogwing.h @@ -35,7 +35,8 @@ public: m_pf4_rowscroll(*this, "pf4_rowscroll"), m_sprgen1(*this, "spritegen1"), m_sprgen2(*this, "spritegen2"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* devices */ @@ -57,6 +58,7 @@ public: required_device<decospr_device> m_sprgen1; required_device<decospr_device> m_sprgen2; required_device<palette_device> m_palette; + required_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_WRITE8_MEMBER(sound_bankswitch_w); DECLARE_DRIVER_INIT(boogwing); diff --git a/src/mame/includes/cclimber.h b/src/mame/includes/cclimber.h index 9939d71fe13..14489ef1f5f 100644 --- a/src/mame/includes/cclimber.h +++ b/src/mame/includes/cclimber.h @@ -5,6 +5,10 @@ class cclimber_state : public driver_device public: cclimber_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), m_bigsprite_videoram(*this, "bigspriteram"), m_videoram(*this, "videoram"), m_column_scroll(*this, "column_scroll"), @@ -17,10 +21,12 @@ public: m_swimmer_background_color(*this, "bgcolor"), m_toprollr_bg_videoram(*this, "bg_videoram"), m_toprollr_bg_coloram(*this, "bg_coloram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_decrypted_opcodes(*this, "decrypted_opcodes") { } + + required_device<cpu_device> m_maincpu; + optional_device<cpu_device> m_audiocpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_bigsprite_videoram; required_shared_ptr<UINT8> m_videoram; @@ -34,6 +40,7 @@ public: optional_shared_ptr<UINT8> m_swimmer_background_color; optional_shared_ptr<UINT8> m_toprollr_bg_videoram; optional_shared_ptr<UINT8> m_toprollr_bg_coloram; + optional_shared_ptr<UINT8> m_decrypted_opcodes; UINT8 m_yamato_p0; UINT8 m_yamato_p1; @@ -42,6 +49,7 @@ public: tilemap_t *m_pf_tilemap; tilemap_t *m_bs_tilemap; tilemap_t *m_toproller_bg_tilemap; + DECLARE_WRITE8_MEMBER(swimmer_sh_soundlatch_w); DECLARE_WRITE8_MEMBER(yamato_p0_w); DECLARE_WRITE8_MEMBER(yamato_p1_w); @@ -51,6 +59,8 @@ public: DECLARE_WRITE8_MEMBER(nmi_mask_w); DECLARE_WRITE8_MEMBER(cclimber_colorram_w); DECLARE_WRITE8_MEMBER(cannonb_flip_screen_w); + + virtual void machine_start(); DECLARE_DRIVER_INIT(cclimber); DECLARE_DRIVER_INIT(yamato); DECLARE_DRIVER_INIT(ckongb); @@ -59,12 +69,6 @@ public: DECLARE_DRIVER_INIT(cannonb2); DECLARE_DRIVER_INIT(cannonb); DECLARE_DRIVER_INIT(dking); - TILE_GET_INFO_MEMBER(cclimber_get_pf_tile_info); - TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info); - TILE_GET_INFO_MEMBER(toprollr_get_pf_tile_info); - TILE_GET_INFO_MEMBER(cclimber_get_bs_tile_info); - TILE_GET_INFO_MEMBER(toprollr_get_bs_tile_info); - TILE_GET_INFO_MEMBER(toproller_get_bg_tile_info); DECLARE_MACHINE_RESET(cclimber); DECLARE_VIDEO_START(cclimber); DECLARE_PALETTE_INIT(cclimber); @@ -73,11 +77,18 @@ public: DECLARE_PALETTE_INIT(yamato); DECLARE_VIDEO_START(toprollr); DECLARE_PALETTE_INIT(toprollr); + + TILE_GET_INFO_MEMBER(cclimber_get_pf_tile_info); + TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info); + TILE_GET_INFO_MEMBER(toprollr_get_pf_tile_info); + TILE_GET_INFO_MEMBER(cclimber_get_bs_tile_info); + TILE_GET_INFO_MEMBER(toprollr_get_bs_tile_info); + TILE_GET_INFO_MEMBER(toproller_get_bg_tile_info); + UINT32 screen_update_cclimber(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_toprollr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); void swimmer_set_background_pen(); void draw_playfield(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void cclimber_draw_bigsprite(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -87,8 +98,6 @@ public: void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); void cclimber_decode(const UINT8 convtable[8][16]); void cannonb_patch(); - required_device<cpu_device> m_maincpu; - optional_device<cpu_device> m_audiocpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; + + INTERRUPT_GEN_MEMBER(vblank_irq); }; diff --git a/src/mame/includes/commando.h b/src/mame/includes/commando.h index 0d3f78f873a..ad7fe963494 100644 --- a/src/mame/includes/commando.h +++ b/src/mame/includes/commando.h @@ -21,7 +21,8 @@ public: m_audiocpu(*this, "audiocpu"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_device<buffered_spriteram8_device> m_spriteram; @@ -58,4 +59,5 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index 6f5ee69fb46..3a917e812d8 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -116,7 +116,8 @@ public: m_msm_2(*this, "msm2"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ // cps1 @@ -212,6 +213,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + optional_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_READ16_MEMBER(cps1_hack_dsw_r); DECLARE_READ16_MEMBER(cps1_in1_r); @@ -301,6 +303,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(cps2_interrupt); TIMER_CALLBACK_MEMBER(cps2_update_digital_volume); + void kabuki_setup(void (*decode)(UINT8 *src, UINT8 *dst)); /* fcrash handlers */ DECLARE_DRIVER_INIT(kodb); diff --git a/src/mame/includes/cps3.h b/src/mame/includes/cps3.h index efbde9ea77d..2ff488f0445 100644 --- a/src/mame/includes/cps3.h +++ b/src/mame/includes/cps3.h @@ -28,7 +28,9 @@ public: m_tilemap40_regs_base(*this, "tmap40_regs"), m_tilemap50_regs_base(*this, "tmap50_regs"), m_fullscreenzoom(*this, "fullscreenzoom"), - m_0xc0000000_ram(*this, "0xc0000000_ram") + m_0xc0000000_ram(*this, "0xc0000000_ram"), + m_decrypted_gamerom(*this, "decrypted_gamerom"), + m_0xc0000000_ram_decrypted(*this, "0xc0000000_ram_decrypted") { } required_device<sh2_device> m_maincpu; @@ -45,13 +47,12 @@ public: required_shared_ptr<UINT32> m_tilemap50_regs_base; required_shared_ptr<UINT32> m_fullscreenzoom; required_shared_ptr<UINT32> m_0xc0000000_ram; + required_shared_ptr<UINT32> m_decrypted_gamerom; + required_shared_ptr<UINT32> m_0xc0000000_ram_decrypted; fujitsu_29f016a_device *m_simm[7][8]; - UINT32* m_decrypted_bios; - UINT32* m_decrypted_gamerom; UINT32 m_cram_gfxflash_bank; UINT32* m_nops; - UINT32* m_0xc0000000_ram_decrypted; UINT32* m_char_ram; UINT32* m_eeprom; UINT32 m_ss_pal_base; @@ -111,7 +112,6 @@ public: DECLARE_WRITE32_MEMBER(cps3_unk_vidregs_w); DECLARE_READ32_MEMBER(cps3_colourram_r); DECLARE_WRITE32_MEMBER(cps3_colourram_w); - DECLARE_DIRECT_UPDATE_MEMBER(cps3_direct_handler); DECLARE_DRIVER_INIT(sfiii3); DECLARE_DRIVER_INIT(sfiii); DECLARE_DRIVER_INIT(redearth); diff --git a/src/mame/includes/darkmist.h b/src/mame/includes/darkmist.h index f7f0e0704bf..07b63ff6108 100644 --- a/src/mame/includes/darkmist.h +++ b/src/mame/includes/darkmist.h @@ -15,7 +15,8 @@ public: m_scroll(*this, "scroll"), m_videoram(*this, "videoram"), m_workram(*this, "workram"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; required_device<t5182_device> m_t5182; @@ -27,6 +28,7 @@ public: required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_workram; required_shared_ptr<UINT8> m_spriteram; + optional_shared_ptr<UINT8> m_decrypted_opcodes; int m_hw; tilemap_t *m_bgtilemap; @@ -39,6 +41,7 @@ public: TILE_GET_INFO_MEMBER(get_fgtile_info); TILE_GET_INFO_MEMBER(get_txttile_info); + virtual void machine_start(); DECLARE_DRIVER_INIT(darkmist); virtual void video_start(); DECLARE_PALETTE_INIT(darkmist); diff --git a/src/mame/includes/decocrpt.h b/src/mame/includes/decocrpt.h index 3bfcd1c6e8a..6ea05a3b7a0 100644 --- a/src/mame/includes/decocrpt.h +++ b/src/mame/includes/decocrpt.h @@ -9,7 +9,7 @@ void deco56_remap_gfx(running_machine &machine, const char *tag); /*----------- defined in machine/deco102.c -----------*/ -void deco102_decrypt_cpu(running_machine &machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor); +void deco102_decrypt_cpu(UINT16 *rom, UINT16 *opcodes, int size, int address_xor, int data_select_xor, int opcode_select_xor); /*----------- defined in machine/deco156.c -----------*/ diff --git a/src/mame/includes/dietgo.h b/src/mame/includes/dietgo.h index 8211cec1b8e..12c47ebf49e 100644 --- a/src/mame/includes/dietgo.h +++ b/src/mame/includes/dietgo.h @@ -24,7 +24,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_deco_tilegen1(*this, "tilegen1"), - m_decocomn(*this, "deco_common") + m_decocomn(*this, "deco_common"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } optional_device<deco104_device> m_deco104; @@ -40,6 +41,7 @@ public: required_device<cpu_device> m_audiocpu; required_device<deco16ic_device> m_deco_tilegen1; required_device<decocomn_device> m_decocomn; + required_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_DRIVER_INIT(dietgo); virtual void machine_start(); UINT32 screen_update_dietgo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/includes/freekick.h b/src/mame/includes/freekick.h index f2bb788d160..514cbfb7c2b 100644 --- a/src/mame/includes/freekick.h +++ b/src/mame/includes/freekick.h @@ -11,7 +11,9 @@ public: m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_bank1(*this, "bank1"), + m_bank1d(*this, "bank1d") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -63,4 +65,5 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_memory_bank m_bank1, m_bank1d; }; diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index 871581a0c06..500a419e203 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -54,7 +54,8 @@ public: m_videoram(*this, "videoram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; optional_device<cpu_device> m_audiocpu; @@ -73,6 +74,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; int m_bullets_base; int m_sprites_base; diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h index b4b63246d50..42ec05e4fb4 100644 --- a/src/mame/includes/gaplus.h +++ b/src/mame/includes/gaplus.h @@ -34,27 +34,28 @@ public: m_subcpu2(*this, "sub2"), m_namco_15xx(*this, "namco"), m_samples(*this, "samples") , - m_customio_3(*this,"customio_3"), - m_videoram(*this,"videoram"), - m_spriteram(*this,"spriteram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_customio_3(*this,"customio_3"), + m_videoram(*this,"videoram"), + m_spriteram(*this,"spriteram") { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_subcpu; required_device<cpu_device> m_subcpu2; required_device<namco_15xx_device> m_namco_15xx; required_device<samples_device> m_samples; - required_shared_ptr<UINT8> m_customio_3; - required_shared_ptr<UINT8> m_videoram; - required_shared_ptr<UINT8> m_spriteram; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; namco58xx_device *m_namco58xx; namco56xx_device *m_namco56xx; + required_shared_ptr<UINT8> m_customio_3; + required_shared_ptr<UINT8> m_videoram; + required_shared_ptr<UINT8> m_spriteram; + int m_type; tilemap_t *m_bg_tilemap; @@ -64,36 +65,38 @@ public: UINT8 m_main_irq_mask; UINT8 m_sub_irq_mask; UINT8 m_sub2_irq_mask; - DECLARE_READ8_MEMBER(gaplus_spriteram_r); - DECLARE_WRITE8_MEMBER(gaplus_spriteram_w); - DECLARE_WRITE8_MEMBER(gaplus_irq_1_ctrl_w); - DECLARE_WRITE8_MEMBER(gaplus_irq_2_ctrl_w); - DECLARE_WRITE8_MEMBER(gaplus_irq_3_ctrl_w); - DECLARE_WRITE8_MEMBER(gaplus_sreset_w); - DECLARE_WRITE8_MEMBER(gaplus_freset_w); - DECLARE_WRITE8_MEMBER(gaplus_customio_3_w); - DECLARE_READ8_MEMBER(gaplus_customio_3_r); - DECLARE_READ8_MEMBER(gaplus_videoram_r); - DECLARE_WRITE8_MEMBER(gaplus_videoram_w); - DECLARE_WRITE8_MEMBER(gaplus_starfield_control_w); + + DECLARE_WRITE8_MEMBER(irq_1_ctrl_w); + DECLARE_WRITE8_MEMBER(irq_2_ctrl_w); + DECLARE_WRITE8_MEMBER(irq_3_ctrl_w); + DECLARE_WRITE8_MEMBER(sreset_w); + DECLARE_WRITE8_MEMBER(freset_w); + DECLARE_WRITE8_MEMBER(customio_3_w); + DECLARE_READ8_MEMBER(customio_3_r); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(starfield_control_w); DECLARE_WRITE8_MEMBER(out_lamps0); DECLARE_WRITE8_MEMBER(out_lamps1); - DECLARE_MACHINE_START(gaplus); + DECLARE_DRIVER_INIT(gaplus); DECLARE_DRIVER_INIT(gaplusd); DECLARE_DRIVER_INIT(galaga3); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(get_tile_info); + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); DECLARE_PALETTE_INIT(gaplus); - UINT32 screen_update_gaplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_gaplus(screen_device &screen, bool state); - INTERRUPT_GEN_MEMBER(gaplus_vblank_main_irq); + + TILEMAP_MAPPER_MEMBER(tilemap_scan); + TILE_GET_INFO_MEMBER(get_tile_info); + + INTERRUPT_GEN_MEMBER(vblank_main_irq); INTERRUPT_GEN_MEMBER(gapluso_vblank_main_irq); - INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq); - INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq); + INTERRUPT_GEN_MEMBER(vblank_sub_irq); + INTERRUPT_GEN_MEMBER(vblank_sub2_irq); TIMER_CALLBACK_MEMBER(namcoio_run); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof(screen_device &screen, bool state); void starfield_init(); void starfield_render(bitmap_ind16 &bitmap); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); diff --git a/src/mame/includes/jack.h b/src/mame/includes/jack.h index 968eec9b8df..c108a89eaef 100644 --- a/src/mame/includes/jack.h +++ b/src/mame/includes/jack.h @@ -18,7 +18,8 @@ public: m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* device- and memory pointers */ @@ -30,6 +31,7 @@ public: required_shared_ptr<UINT8> m_colorram; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/kchamp.h b/src/mame/includes/kchamp.h index 6ef9a7ddb13..6e44d71bc80 100644 --- a/src/mame/includes/kchamp.h +++ b/src/mame/includes/kchamp.h @@ -19,7 +19,8 @@ public: m_maincpu(*this, "maincpu"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -62,10 +63,11 @@ public: INTERRUPT_GEN_MEMBER(sound_int); void kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - UINT8 *decrypt_code(); + void decrypt_code(); DECLARE_WRITE_LINE_MEMBER(msmint); required_device<cpu_device> m_maincpu; optional_device<msm5205_device> m_msm; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; }; diff --git a/src/mame/includes/ladybug.h b/src/mame/includes/ladybug.h index 5a4b4561387..8b7308edf5c 100644 --- a/src/mame/includes/ladybug.h +++ b/src/mame/includes/ladybug.h @@ -22,7 +22,8 @@ public: m_palette(*this, "palette"), m_port_dsw0(*this, "DSW0"), m_p1_control(*this, "CONTP1"), - m_p2_control(*this, "CONTP2") { } + m_p2_control(*this, "CONTP2"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -54,9 +55,10 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - required_ioport m_port_dsw0; + optional_ioport m_port_dsw0; optional_ioport m_p1_control; optional_ioport m_p2_control; + optional_shared_ptr<UINT8> m_decrypted_opcodes; DECLARE_READ8_MEMBER(sraider_sound_low_r); DECLARE_READ8_MEMBER(sraider_sound_high_r); diff --git a/src/mame/includes/liberate.h b/src/mame/includes/liberate.h index 487792089b0..442c5ca5b70 100644 --- a/src/mame/includes/liberate.h +++ b/src/mame/includes/liberate.h @@ -14,7 +14,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } optional_shared_ptr<UINT8> m_paletteram; optional_shared_ptr<UINT8> m_bg_vram; /* prosport */ @@ -40,6 +41,7 @@ public: required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; DECLARE_READ8_MEMBER(deco16_bank_r); DECLARE_READ8_MEMBER(deco16_io_r); diff --git a/src/mame/includes/m62.h b/src/mame/includes/m62.h index 9a508876b61..5b48f4bfaef 100644 --- a/src/mame/includes/m62.h +++ b/src/mame/includes/m62.h @@ -1,5 +1,8 @@ // license:BSD-3-Clause // copyright-holders:smf, David Haywood + +#include "audio/irem.h" + class m62_state : public driver_device { public: @@ -11,7 +14,9 @@ public: m_scrollram(*this, "scrollram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_audio(*this, "irem_audio") + { } /* memory pointers */ required_shared_ptr<UINT8> m_spriteram; @@ -119,4 +124,5 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<irem_audio_device> m_audio; }; diff --git a/src/mame/includes/megasys1.h b/src/mame/includes/megasys1.h index a86bf170484..23ab6ca7f56 100644 --- a/src/mame/includes/megasys1.h +++ b/src/mame/includes/megasys1.h @@ -126,6 +126,7 @@ public: DECLARE_DRIVER_INIT(iganinju); DECLARE_DRIVER_INIT(cybattlr); DECLARE_DRIVER_INIT(rodlandj); + DECLARE_DRIVER_INIT(rodlandjb); DECLARE_DRIVER_INIT(avspirit); DECLARE_DRIVER_INIT(monkelf); DECLARE_DRIVER_INIT(edf); @@ -150,7 +151,7 @@ public: void create_tilemaps(); void megasys1_priority_create(); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect); - void rodlandj_gfx_unmangle(const char *region); + void rodland_gfx_unmangle(const char *region); void jitsupro_gfx_unmangle(const char *region); void stdragona_gfx_unmangle(const char *region); DECLARE_WRITE_LINE_MEMBER(irqhandler); diff --git a/src/mame/includes/mitchell.h b/src/mame/includes/mitchell.h index 497c50460d5..34369c3e767 100644 --- a/src/mame/includes/mitchell.h +++ b/src/mame/includes/mitchell.h @@ -117,7 +117,7 @@ public: UINT32 screen_update_pang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(mitchell_irq); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void bootleg_decode( ); - void configure_banks( ); + void bootleg_decode(); + void configure_banks(void (*decode)(UINT8 *src, UINT8 *dst, int size)); DECLARE_WRITE_LINE_MEMBER(spangbl_adpcm_int); }; diff --git a/src/mame/includes/model3.h b/src/mame/includes/model3.h index 096691a831a..f2b63678309 100644 --- a/src/mame/includes/model3.h +++ b/src/mame/includes/model3.h @@ -22,14 +22,6 @@ struct cached_texture rgb_t data[1]; }; -struct m3_plane -{ - float x; - float y; - float z; - float d; -}; - struct m3_vertex { float x; @@ -47,9 +39,11 @@ struct m3_clip_vertex float x; float y; float z; + float w; float u; float v; float i; + float s; }; struct m3_triangle @@ -149,7 +143,7 @@ public: UINT8 m_id_data[32]; INT32 m_id_size; int m_tdo; - UINT8 m_layer_priority; + UINT16 m_layer_priority; UINT32 m_layer_modulate_r; UINT32 m_layer_modulate_g; UINT32 m_layer_modulate_b; @@ -175,12 +169,13 @@ public: int m_list_depth; MATRIX *m_matrix_stack; MATRIX m_coordinate_system; - float m_viewport_focal_length; - int m_viewport_region_x; - int m_viewport_region_y; - int m_viewport_region_width; - int m_viewport_region_height; - m3_plane m_clip_plane[5]; + MATRIX m_projection_matrix; + float m_viewport_x; + float m_viewport_y; + float m_viewport_width; + float m_viewport_height; + float m_viewport_near; + float m_viewport_far; UINT32 m_matrix_base_address; cached_texture *m_texcache[2][1024/32][2048/32]; @@ -249,6 +244,7 @@ public: DECLARE_DRIVER_INIT(daytona2); DECLARE_DRIVER_INIT(eca); DECLARE_DRIVER_INIT(srally2); + DECLARE_DRIVER_INIT(harleya); DECLARE_DRIVER_INIT(skichamp); DECLARE_DRIVER_INIT(spikeofe); DECLARE_DRIVER_INIT(scud); @@ -302,11 +298,12 @@ public: void reset_triangle_buffers(); m3_triangle* push_triangle(bool alpha); void draw_layers(bitmap_rgb32 &bitmap, const rectangle &cliprect); - void draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int bitdepth, int sx, int sy); + void draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int sx, int sy, int prio); void draw_3d_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect); void invalidate_texture(int page, int texx, int texy, int texwidth, int texheight); cached_texture *get_texture(int page, int texx, int texy, int texwidth, int texheight, int format); inline void write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data); + inline void write_texture8(int xpos, int ypos, int width, int height, int page, int upper, int lower, UINT16 *data); void real3d_upload_texture(UINT32 header, UINT32 *data); void init_matrix_stack(); void get_top_matrix(MATRIX *out); @@ -316,6 +313,7 @@ public: void translate_matrix_stack(float x, float y, float z); void draw_model(UINT32 addr); UINT32 *get_memory_pointer(UINT32 address); + void set_projection(float left, float right, float top, float bottom, float near, float far); void load_matrix(int matrix_num, MATRIX *out); void traverse_list4(int lod_num, UINT32 address); void traverse_list(UINT32 address); diff --git a/src/mame/includes/mouser.h b/src/mame/includes/mouser.h index 4b103f80d22..3fb99eb8877 100644 --- a/src/mame/includes/mouser.h +++ b/src/mame/includes/mouser.h @@ -17,7 +17,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -33,6 +34,7 @@ public: required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; DECLARE_WRITE8_MEMBER(mouser_nmi_enable_w); DECLARE_WRITE8_MEMBER(mouser_sound_interrupt_w); diff --git a/src/mame/includes/namcos1.h b/src/mame/includes/namcos1.h index bd7b320bdb8..8a5296ca76f 100644 --- a/src/mame/includes/namcos1.h +++ b/src/mame/includes/namcos1.h @@ -68,9 +68,6 @@ public: int m_copy_sprites; UINT8 m_drawmode_table[16]; - DECLARE_DIRECT_UPDATE_MEMBER(direct_handler_main); - DECLARE_DIRECT_UPDATE_MEMBER(direct_handler_sub); - DECLARE_WRITE_LINE_MEMBER(subres_w); DECLARE_WRITE8_MEMBER(irq_ack_w); DECLARE_READ8_MEMBER(dsw_r); @@ -138,6 +135,5 @@ public: void init_DACs(); private: - inline offs_t direct_handler(int whichcpu, direct_read_data &direct, offs_t address); inline void get_tile_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram); }; diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h index 5534a95dcf7..61a0830fa96 100644 --- a/src/mame/includes/namcos22.h +++ b/src/mame/includes/namcos22.h @@ -93,9 +93,9 @@ struct namcos22_scenenode struct namcos22_object_data { /* poly / sprites */ - rgbint fogcolor; - rgbint fadecolor; - rgbint polycolor; + rgbaint_t fogcolor; + rgbaint_t fadecolor; + rgbaint_t polycolor; const pen_t *pens; bitmap_rgb32 *destbase; bitmap_ind8 *primap; diff --git a/src/mame/includes/namcos86.h b/src/mame/includes/namcos86.h index 683e746d1b5..3915293b9f4 100644 --- a/src/mame/includes/namcos86.h +++ b/src/mame/includes/namcos86.h @@ -63,7 +63,7 @@ public: TILE_GET_INFO_MEMBER(get_tile_info2); TILE_GET_INFO_MEMBER(get_tile_info3); - DECLARE_DRIVER_INIT(namco86); + DECLARE_DRIVER_INIT(namco86); virtual void machine_start(); virtual void video_start(); DECLARE_PALETTE_INIT(namcos86); diff --git a/src/mame/includes/nbmj8991.h b/src/mame/includes/nbmj8991.h index 309041968cc..d5bfab76958 100644 --- a/src/mame/includes/nbmj8991.h +++ b/src/mame/includes/nbmj8991.h @@ -70,7 +70,7 @@ public: void gfxdraw(); void postload(); - + protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/ninjakd2.h b/src/mame/includes/ninjakd2.h index ed38065f97a..f8a5f950604 100644 --- a/src/mame/includes/ninjakd2.h +++ b/src/mame/includes/ninjakd2.h @@ -21,7 +21,8 @@ public: m_spriteram(*this, "spriteram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; @@ -33,6 +34,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; const INT16* m_sampledata; UINT8 m_omegaf_io_protection[3]; diff --git a/src/mame/includes/pacman.h b/src/mame/includes/pacman.h index 06c6c4d995b..d62272914f5 100644 --- a/src/mame/includes/pacman.h +++ b/src/mame/includes/pacman.h @@ -23,7 +23,8 @@ public: m_s2650games_tileram(*this, "s2650_tileram"), m_rocktrv2_prot_data(*this, "rocktrv2_prot"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_patched_opcodes(*this, "patched_opcodes") { } required_device<cpu_device> m_maincpu; @@ -37,6 +38,7 @@ public: optional_shared_ptr<UINT8> m_rocktrv2_prot_data; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_patched_opcodes; UINT8 m_cannonb_bit_to_read; int m_mystery; diff --git a/src/mame/includes/pbaction.h b/src/mame/includes/pbaction.h index a6e7e74fcf2..13fc38633c6 100644 --- a/src/mame/includes/pbaction.h +++ b/src/mame/includes/pbaction.h @@ -20,7 +20,8 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -41,6 +42,7 @@ public: required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; UINT8 m_nmi_mask; DECLARE_WRITE8_MEMBER(pbaction_sh_command_w); diff --git a/src/mame/includes/pktgaldx.h b/src/mame/includes/pktgaldx.h index b185d8f2727..02b1143ff21 100644 --- a/src/mame/includes/pktgaldx.h +++ b/src/mame/includes/pktgaldx.h @@ -28,7 +28,8 @@ public: m_deco_tilegen1(*this, "tilegen1"), m_decocomn(*this, "deco_common"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } optional_device<deco104_device> m_deco104; @@ -49,6 +50,7 @@ public: optional_device<decocomn_device> m_decocomn; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + optional_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_READ16_MEMBER(pckgaldx_unknown_r); DECLARE_READ16_MEMBER(pckgaldx_protection_r); diff --git a/src/mame/includes/plygonet.h b/src/mame/includes/plygonet.h index 7c1175e06f2..033cce2a1b3 100644 --- a/src/mame/includes/plygonet.h +++ b/src/mame/includes/plygonet.h @@ -48,8 +48,6 @@ public: UINT8 m_sys0; UINT8 m_sys1; - direct_update_delegate m_dsp56k_update_handler; - /* TTL text plane stuff */ int m_ttl_gfx_index; tilemap_t *m_ttl_tilemap; @@ -95,7 +93,6 @@ public: DECLARE_WRITE32_MEMBER(polygonet_ttl_ram_w); DECLARE_READ32_MEMBER(polygonet_roz_ram_r); DECLARE_WRITE32_MEMBER(polygonet_roz_ram_w); - DIRECT_UPDATE_MEMBER(plygonet_dsp56k_direct_handler); DECLARE_DRIVER_INIT(polygonet); TILE_GET_INFO_MEMBER(ttl_get_tile_info); TILE_GET_INFO_MEMBER(roz_get_tile_info); diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index e6477326079..eaa3107ec3a 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -35,7 +35,8 @@ public: m_005snd(*this, "005"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_shared_ptr<UINT8> m_mainram; required_shared_ptr<UINT8> m_videoram; @@ -51,6 +52,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + optional_shared_ptr<UINT8> m_decrypted_opcodes; std::vector<UINT8> m_paletteram; diff --git a/src/mame/includes/segahang.h b/src/mame/includes/segahang.h index 664841e7983..7d6e6e84813 100644 --- a/src/mame/includes/segahang.h +++ b/src/mame/includes/segahang.h @@ -35,7 +35,8 @@ public: m_segaic16road(*this, "segaic16road"), m_workram(*this, "workram"), m_sharrier_video(false), - m_adc_select(0) + m_adc_select(0), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } // PPI read/write callbacks @@ -107,5 +108,6 @@ protected: // internal state UINT8 m_adc_select; bool m_shadow; + optional_shared_ptr<UINT16> m_decrypted_opcodes; TIMER_DEVICE_CALLBACK_MEMBER(hangon_irq); }; diff --git a/src/mame/includes/segas16a.h b/src/mame/includes/segas16a.h index 2a76c10dbaf..0656dd391a9 100644 --- a/src/mame/includes/segas16a.h +++ b/src/mame/includes/segas16a.h @@ -38,6 +38,7 @@ public: m_segaic16vid(*this, "segaic16vid"), m_sprites(*this, "sprites"), m_workram(*this, "nvram"), + m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes"), m_video_control(0), m_mcu_control(0), m_n7751_command(0), @@ -136,6 +137,7 @@ protected: // memory pointers required_shared_ptr<UINT16> m_workram; + optional_shared_ptr<UINT8> m_sound_decrypted_opcodes; // configuration read16_delegate m_custom_io_r; diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h index c3df7a7fe44..33c74ae4f99 100644 --- a/src/mame/includes/segas16b.h +++ b/src/mame/includes/segas16b.h @@ -49,7 +49,8 @@ public: m_hwc_input_value(0), m_mj_input_num(0), m_mj_last_val(0), - m_gfxdecode(*this, "gfxdecode") + m_gfxdecode(*this, "gfxdecode"), + m_sound_decrypted_opcodes(*this, "sound_decrypted_opcodes") { } // memory mapping @@ -203,6 +204,7 @@ protected: UINT8 m_mj_last_val; required_device<gfxdecode_device> m_gfxdecode; + optional_shared_ptr<UINT8> m_sound_decrypted_opcodes; }; diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index 07bc22714ba..30e5f1b9063 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -32,7 +32,7 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - + required_device<timer_device> m_irq_timer_0; required_device<timer_device> m_irq_timer_1; optional_device<s32comm_device> m_s32comm; @@ -271,7 +271,7 @@ public: protected: virtual machine_config_constructor device_mconfig_additions() const; -// virtual void device_start(); +// virtual void device_start(); // virtual void device_reset(); }; @@ -301,4 +301,3 @@ protected: extern const UINT8 ga2_v25_opcode_table[]; extern const device_type SEGA_S32_PCB; - diff --git a/src/mame/includes/seicross.h b/src/mame/includes/seicross.h index 3093784d8f8..d54177825fe 100644 --- a/src/mame/includes/seicross.h +++ b/src/mame/includes/seicross.h @@ -16,7 +16,8 @@ public: m_videoram(*this, "videoram"), m_row_scroll(*this, "row_scroll"), m_spriteram2(*this, "spriteram2"), - m_colorram(*this, "colorram") { } + m_colorram(*this, "colorram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_mcu; @@ -29,6 +30,7 @@ public: required_shared_ptr<UINT8> m_row_scroll; required_shared_ptr<UINT8> m_spriteram2; required_shared_ptr<UINT8> m_colorram; + optional_shared_ptr<UINT8> m_decrypted_opcodes; UINT8 m_portb; tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/senjyo.h b/src/mame/includes/senjyo.h index 524b75d8a67..7ed3af920b9 100644 --- a/src/mame/includes/senjyo.h +++ b/src/mame/includes/senjyo.h @@ -30,7 +30,8 @@ public: m_bg3videoram(*this, "bg3videoram"), m_radarram(*this, "radarram"), m_bgstripesram(*this, "bgstripesram"), - m_generic_paletteram_8(*this, "paletteram") { } + m_generic_paletteram_8(*this, "paletteram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* devices */ required_device<cpu_device> m_maincpu; @@ -56,6 +57,7 @@ public: required_shared_ptr<UINT8> m_radarram; required_shared_ptr<UINT8> m_bgstripesram; required_shared_ptr<UINT8> m_generic_paletteram_8; + optional_shared_ptr<UINT8> m_decrypted_opcodes; // game specific initialization int m_is_senjyo; diff --git a/src/mame/includes/slapshot.h b/src/mame/includes/slapshot.h index 75f5607f1af..61c541b0759 100644 --- a/src/mame/includes/slapshot.h +++ b/src/mame/includes/slapshot.h @@ -49,7 +49,7 @@ public: required_device<tc0640fio_device> m_tc0640fio; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - + /* memory pointers */ required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_spriteext; diff --git a/src/mame/includes/snk68.h b/src/mame/includes/snk68.h index f85bacc549d..c9b5334303e 100644 --- a/src/mame/includes/snk68.h +++ b/src/mame/includes/snk68.h @@ -7,59 +7,58 @@ class snk68_state : public driver_device public: snk68_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_pow_fg_videoram(*this, "pow_fg_videoram"), - m_spriteram(*this, "spriteram"), - m_paletteram(*this, "paletteram"), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), m_upd7759(*this, "upd"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_pow_fg_videoram(*this, "pow_fg_videoram"), + m_spriteram(*this, "spriteram") { } - int m_invert_controls; - int m_sound_status; + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_soundcpu; + required_device<upd7759_device> m_upd7759; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; required_shared_ptr<UINT16> m_pow_fg_videoram; - required_shared_ptr<UINT16> m_spriteram; - required_shared_ptr<UINT16> m_paletteram; - int m_sprite_flip_axis; + + UINT8 m_invert_controls; + bool m_sprite_flip_axis; tilemap_t *m_fg_tilemap; - int m_flipscreen; UINT32 m_fg_tile_offset; - DECLARE_READ16_MEMBER(sound_status_r); - DECLARE_WRITE8_MEMBER(sound_status_w); - DECLARE_READ16_MEMBER(control_1_r); - DECLARE_READ16_MEMBER(control_2_r); - DECLARE_READ16_MEMBER(rotary_1_r); - DECLARE_READ16_MEMBER(rotary_2_r); - DECLARE_READ16_MEMBER(rotary_lsb_r); - DECLARE_READ16_MEMBER(protcontrols_r); - DECLARE_WRITE16_MEMBER(protection_w); + + // common DECLARE_WRITE16_MEMBER(sound_w); - DECLARE_READ16_MEMBER(pow_spriteram_r); - DECLARE_WRITE16_MEMBER(pow_spriteram_w); + DECLARE_READ16_MEMBER(spriteram_r); + DECLARE_WRITE16_MEMBER(spriteram_w); + DECLARE_WRITE8_MEMBER(D7759_write_port_0_w); + DECLARE_WRITE8_MEMBER(D7759_upd_reset_w); + + // pow and streetsm DECLARE_READ16_MEMBER(pow_fg_videoram_r); DECLARE_WRITE16_MEMBER(pow_fg_videoram_w); + DECLARE_WRITE16_MEMBER(pow_flipscreen_w); + DECLARE_READ16_MEMBER(control_1_r); + + // searchar and ikari3 DECLARE_WRITE16_MEMBER(searchar_fg_videoram_w); - DECLARE_WRITE16_MEMBER(pow_flipscreen16_w); - DECLARE_WRITE16_MEMBER(searchar_flipscreen16_w); - DECLARE_WRITE16_MEMBER(pow_paletteram16_word_w); - DECLARE_WRITE8_MEMBER(D7759_write_port_0_w); - DECLARE_WRITE8_MEMBER(D7759_upd_reset_w); - DECLARE_DRIVER_INIT(searchar); + DECLARE_WRITE16_MEMBER(searchar_flipscreen_w); + DECLARE_READ16_MEMBER(protcontrols_r); + DECLARE_WRITE16_MEMBER(protection_w); + DECLARE_READ16_MEMBER(rotary_1_r); + DECLARE_READ16_MEMBER(rotary_2_r); + DECLARE_READ16_MEMBER(rotary_lsb_r); + TILE_GET_INFO_MEMBER(get_pow_tile_info); TILE_GET_INFO_MEMBER(get_searchar_tile_info); + + virtual void machine_start(); virtual void video_start(); DECLARE_VIDEO_START(searchar); - UINT32 screen_update_pow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void common_video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int group); - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_soundcpu; - required_device<upd7759_device> m_upd7759; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; }; diff --git a/src/mame/includes/spacefb.h b/src/mame/includes/spacefb.h index aa141e635ac..513c3a1679c 100644 --- a/src/mame/includes/spacefb.h +++ b/src/mame/includes/spacefb.h @@ -75,14 +75,14 @@ public: void draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip); void draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip); void draw_objects(bitmap_rgb32 &bitmap, const rectangle &cliprect); - + protected: enum { TIMER_INTERRUPT }; - + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index 48e66bdd91c..07a0669fd9d 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -22,7 +22,8 @@ public: m_text_attr_ram(*this, "text_attr_ram"), m_tx_vram(*this, "tx_vram"), m_vh_latch_ram(*this, "vh_latch_ram"), - m_sprite_ram(*this, "sprite_ram") { } + m_sprite_ram(*this, "sprite_ram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -36,6 +37,7 @@ public: optional_shared_ptr<UINT8> m_tx_vram; required_shared_ptr<UINT8> m_vh_latch_ram; required_shared_ptr<UINT8> m_sprite_ram; + optional_shared_ptr<UINT8> m_decrypted_opcodes; UINT8 *m_decrypt; UINT8 m_fm_data; diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h index 41ff298e1ab..379250fae09 100644 --- a/src/mame/includes/suna8.h +++ b/src/mame/includes/suna8.h @@ -19,7 +19,9 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - + m_bank0d(*this, "bank0d"), + m_bank1(*this, "bank1"), + m_bank1d(*this, "bank1d"), m_prot_opcode_toggle(0), m_remap_sound(0) { } @@ -34,6 +36,9 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + optional_memory_bank m_bank0d; + required_memory_bank m_bank1; + optional_memory_bank m_bank1d; UINT8 m_rombank; UINT8 m_rombank_latch; @@ -63,7 +68,7 @@ public: // samples INT16 *m_samplebuf; - int m_sample; + int m_sample, m_play; int m_numsamples; #if TILEMAPS diff --git a/src/mame/includes/suprloco.h b/src/mame/includes/suprloco.h index 2b3e99190dd..7d7f84d9b3b 100644 --- a/src/mame/includes/suprloco.h +++ b/src/mame/includes/suprloco.h @@ -10,7 +10,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), - m_scrollram(*this, "scrollram") { } + m_scrollram(*this, "scrollram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -19,6 +20,7 @@ public: required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_scrollram; + required_shared_ptr<UINT8> m_decrypted_opcodes; tilemap_t *m_bg_tilemap; int m_control; diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h index fabb4bb0848..c6d7e437841 100644 --- a/src/mame/includes/system1.h +++ b/src/mame/includes/system1.h @@ -19,7 +19,12 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_generic_paletteram_8(*this, "paletteram") { } + m_generic_paletteram_8(*this, "paletteram"), + m_decrypted_opcodes(*this, "decrypted_opcodes"), + m_maincpu_region(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank0d(*this, "bank0d"), + m_bank1d(*this, "bank1d") { } optional_device<i8255_device> m_ppi8255; required_shared_ptr<UINT8> m_ram; @@ -137,4 +142,11 @@ public: required_device<screen_device> m_screen; required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_generic_paletteram_8; + optional_shared_ptr<UINT8> m_decrypted_opcodes; + required_memory_region m_maincpu_region; + required_memory_bank m_bank1; + optional_memory_bank m_bank0d; + optional_memory_bank m_bank1d; + + UINT8 *m_banked_decrypted_opcodes; }; diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index f2171e180ce..91ad78b88d8 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -24,7 +24,8 @@ public: m_soundcpu(*this, "soundcpu"), m_msm(*this, "5205"), m_upd7759(*this, "7759"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_shared_ptr<UINT16> m_textram; optional_shared_ptr<UINT16> m_bg0_tileram; @@ -121,6 +122,7 @@ public: optional_device<msm5205_device> m_msm; optional_device<upd7759_device> m_upd7759; required_device<gfxdecode_device> m_gfxdecode; + optional_shared_ptr<UINT16> m_decrypted_opcodes; DECLARE_WRITE16_MEMBER(sound_command_nmi_w); DECLARE_WRITE16_MEMBER(sound_command_w); diff --git a/src/mame/includes/taitoair.h b/src/mame/includes/taitoair.h index 66a373e83e9..e7de60e9fa1 100644 --- a/src/mame/includes/taitoair.h +++ b/src/mame/includes/taitoair.h @@ -32,7 +32,7 @@ public: m_dsp_ram(*this, "dsp_ram"), m_paletteram(*this, "paletteram"), m_gradram(*this, "gradram"), - m_backregs(*this, "backregs"), + m_tc0430grw(*this, "tc0430grw"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_dsp(*this, "dsp"), @@ -49,7 +49,7 @@ public: required_shared_ptr<UINT16> m_dsp_ram; // Shared 68000/TMS32025 RAM required_shared_ptr<UINT16> m_paletteram; required_shared_ptr<UINT16> m_gradram; - required_shared_ptr<UINT16> m_backregs; + required_shared_ptr<UINT16> m_tc0430grw; /* video-related */ taitoair_poly m_q; @@ -74,6 +74,8 @@ public: INT16 m_frustumBottom; INT16 m_eyecoordBuffer[4]; /* homogeneous */ + bool m_gradbank; + //bitmap_ind16 *m_buffer3d; DECLARE_WRITE16_MEMBER(system_control_w); DECLARE_READ16_MEMBER(lineram_r); @@ -100,7 +102,9 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_taitoair(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); + int draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + int draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int start_offset ); + void fill_slope( bitmap_ind16 &bitmap, const rectangle &cliprect, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2 ); void multVecMtx(const INT16* vec4, const float* m, float* result); void airInfernoFrustum(const INT16 leftExtent, const INT16 bottomExtent, float* m); diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h index d2d72d99b22..c982ca3b7e4 100644 --- a/src/mame/includes/turbo.h +++ b/src/mame/includes/turbo.h @@ -34,6 +34,7 @@ public: m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), m_sprite_position(*this, "spritepos"), + m_decrypted_opcodes(*this, "decrypted_opcodes"), m_samples(*this, "samples"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen") @@ -55,6 +56,7 @@ public: required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_sprite_position; + optional_shared_ptr<UINT8> m_decrypted_opcodes; required_device<samples_device> m_samples; diff --git a/src/mame/includes/vastar.h b/src/mame/includes/vastar.h index bc9edc51d7e..24a4c4f3630 100644 --- a/src/mame/includes/vastar.h +++ b/src/mame/includes/vastar.h @@ -5,15 +5,20 @@ class vastar_state : public driver_device public: vastar_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), m_bg1videoram(*this, "bg1videoram"), m_bg2videoram(*this, "bg2videoram"), m_fgvideoram(*this, "fgvideoram"), m_sprite_priority(*this, "sprite_priority"), - m_sharedram(*this, "sharedram"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_sharedram(*this, "sharedram") { } + + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_subcpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_bg1videoram; required_shared_ptr<UINT8> m_bg2videoram; @@ -31,25 +36,25 @@ public: tilemap_t *m_fg_tilemap; tilemap_t *m_bg1_tilemap; tilemap_t *m_bg2_tilemap; - - UINT8 m_nmi_mask; - DECLARE_WRITE8_MEMBER(vastar_hold_cpu2_w); + + DECLARE_WRITE8_MEMBER(hold_cpu2_w); DECLARE_WRITE8_MEMBER(flip_screen_w); DECLARE_WRITE8_MEMBER(nmi_mask_w); - DECLARE_WRITE8_MEMBER(vastar_fgvideoram_w); - DECLARE_WRITE8_MEMBER(vastar_bg1videoram_w); - DECLARE_WRITE8_MEMBER(vastar_bg2videoram_w); + DECLARE_WRITE8_MEMBER(fgvideoram_w); + DECLARE_WRITE8_MEMBER(bg1videoram_w); + DECLARE_WRITE8_MEMBER(bg2videoram_w); + TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_bg1_tile_info); TILE_GET_INFO_MEMBER(get_bg2_tile_info); + + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - UINT32 screen_update_vastar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_subcpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; + + INTERRUPT_GEN_MEMBER(vblank_irq); }; diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h index da3eb75ac29..d50cf1cef5f 100644 --- a/src/mame/includes/warpwarp.h +++ b/src/mame/includes/warpwarp.h @@ -8,19 +8,20 @@ public: warpwarp_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), m_warpwarp_sound(*this, "warpwarp_custom"), m_geebee_sound(*this, "geebee_custom"), m_geebee_videoram(*this, "geebee_videoram"), - m_videoram(*this, "videoram"), - m_gfxdecode(*this, "gfxdecode") + m_videoram(*this, "videoram") { } required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; optional_device<warpwarp_sound_device> m_warpwarp_sound; optional_device<geebee_sound_device> m_geebee_sound; optional_shared_ptr<UINT8> m_geebee_videoram; optional_shared_ptr<UINT8> m_videoram; - required_device<gfxdecode_device> m_gfxdecode; + int m_geebee_bgw; int m_ball_on; int m_ball_h; @@ -30,16 +31,22 @@ public: int m_ball_sizey; int m_handle_joystick; tilemap_t *m_bg_tilemap; - DECLARE_READ8_MEMBER(geebee_in_r); - DECLARE_WRITE8_MEMBER(geebee_out6_w); - DECLARE_WRITE8_MEMBER(geebee_out7_w); + + // warpwarp and bombbee DECLARE_READ8_MEMBER(warpwarp_sw_r); DECLARE_WRITE8_MEMBER(warpwarp_out0_w); DECLARE_WRITE8_MEMBER(warpwarp_out3_w); - DECLARE_WRITE8_MEMBER(geebee_videoram_w); DECLARE_WRITE8_MEMBER(warpwarp_videoram_w); DECLARE_READ8_MEMBER(warpwarp_dsw1_r); DECLARE_READ8_MEMBER(warpwarp_vol_r); + + //geebee and navarone + DECLARE_READ8_MEMBER(geebee_in_r); + DECLARE_WRITE8_MEMBER(geebee_out6_w); + DECLARE_WRITE8_MEMBER(geebee_out7_w); + DECLARE_WRITE8_MEMBER(geebee_videoram_w); + + virtual void machine_start(); DECLARE_DRIVER_INIT(navarone); DECLARE_DRIVER_INIT(geebee); DECLARE_DRIVER_INIT(kaitein); @@ -47,18 +54,21 @@ public: DECLARE_DRIVER_INIT(sos); DECLARE_DRIVER_INIT(kaitei); DECLARE_DRIVER_INIT(bombbee); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(geebee_get_tile_info); - TILE_GET_INFO_MEMBER(navarone_get_tile_info); - TILE_GET_INFO_MEMBER(warpwarp_get_tile_info); DECLARE_VIDEO_START(geebee); DECLARE_PALETTE_INIT(geebee); DECLARE_VIDEO_START(warpwarp); DECLARE_PALETTE_INIT(warpwarp); DECLARE_VIDEO_START(navarone); DECLARE_PALETTE_INIT(navarone); - UINT32 screen_update_geebee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - inline void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen); + + TILEMAP_MAPPER_MEMBER(tilemap_scan); + TILE_GET_INFO_MEMBER(geebee_get_tile_info); + TILE_GET_INFO_MEMBER(navarone_get_tile_info); + TILE_GET_INFO_MEMBER(warpwarp_get_tile_info); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + inline void plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen); void draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen); + + INTERRUPT_GEN_MEMBER(vblank_irq); }; diff --git a/src/mame/includes/wiz.h b/src/mame/includes/wiz.h index 4b132a697c5..e68dd786b0d 100644 --- a/src/mame/includes/wiz.h +++ b/src/mame/includes/wiz.h @@ -25,7 +25,8 @@ public: m_attrram(*this, "attrram"), m_attrram2(*this, "attrram2"), m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2") + m_spriteram2(*this, "spriteram2"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; @@ -42,6 +43,7 @@ public: required_shared_ptr<UINT8> m_attrram2; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_spriteram2; + optional_shared_ptr<UINT8> m_decrypted_opcodes; INT32 m_flipx; INT32 m_flipy; diff --git a/src/mame/includes/zaxxon.h b/src/mame/includes/zaxxon.h index e89aeacea1b..ffea0ee6c61 100644 --- a/src/mame/includes/zaxxon.h +++ b/src/mame/includes/zaxxon.h @@ -19,7 +19,8 @@ public: m_dials(*this, "DIAL"), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), - m_colorram(*this, "colorram") { } + m_colorram(*this, "colorram"), + m_decrypted_opcodes(*this, "decrypted_opcodes") { } required_device<cpu_device> m_maincpu; optional_device<samples_device> m_samples; @@ -31,6 +32,7 @@ public: required_shared_ptr<UINT8> m_videoram; optional_shared_ptr<UINT8> m_spriteram; optional_shared_ptr<UINT8> m_colorram; + optional_shared_ptr<UINT8> m_decrypted_opcodes; UINT8 m_int_enabled; UINT8 m_coin_status[3]; diff --git a/src/mame/layout/chsuper.lay b/src/mame/layout/chsuper.lay index c3a385ebb24..7fa3f452215 100644 --- a/src/mame/layout/chsuper.lay +++ b/src/mame/layout/chsuper.lay @@ -173,7 +173,7 @@ <color red="0.1" green="0.05" blue="0.0" /> </rect> </element> - + <element name="start_b" defstate="0"> <rect state="1"> <color red="0.0" green="0.8" blue="0.0" /> @@ -257,6 +257,6 @@ <bezel name="lamp6" element="start" inputtag="IN0" inputmask="0x08"> <bounds x="3.57" y="3.07" width="0.31" height="0.20" /> </bezel> - + </view> </mamelayout> diff --git a/src/mame/layout/radr.lay b/src/mame/layout/radr.lay index 799496138de..29b5a3e4f48 100644 --- a/src/mame/layout/radr.lay +++ b/src/mame/layout/radr.lay @@ -52,7 +52,7 @@ <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <bezel element="shifter" inputtag="P1_A" inputmask="0x01"> + <bezel element="shifter" inputtag="mainpcb:P1_A" inputmask="0x01"> <bounds x="606" y="414" width="32" height="64" /> <color alpha="0.6" /> </bezel> @@ -61,7 +61,7 @@ <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <bezel element="shifter" inputtag="P1_A" inputmask="0x01"> + <bezel element="shifter" inputtag="mainpcb:P1_A" inputmask="0x01"> <bounds x="2" y="414" width="32" height="64" /> <color alpha="0.6" /> </bezel> diff --git a/src/mame/machine/cclimber.c b/src/mame/machine/cclimber.c index 803d1c00947..8eb1b531d63 100644 --- a/src/mame/machine/cclimber.c +++ b/src/mame/machine/cclimber.c @@ -8,14 +8,9 @@ void cclimber_state::cclimber_decode(const UINT8 convtable[8][16]) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000); - int A; - - space.set_decrypted_region(0x0000, 0xffff, decrypt); - for (A = 0x0000;A < 0x10000;A++) + for (int A = 0x0000;A < 0x6000;A++) { int i,j; UINT8 src = rom[A]; @@ -28,7 +23,7 @@ void cclimber_state::cclimber_decode(const UINT8 convtable[8][16]) j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3); /* decode the opcodes */ - decrypt[A] = (src & 0xaa) | convtable[i][j]; + m_decrypted_opcodes[A] = (src & 0xaa) | convtable[i][j]; } } diff --git a/src/mame/machine/cps2crpt.c b/src/mame/machine/cps2crpt.c index 9af7cf4d248..0dc76c7e5aa 100644 --- a/src/mame/machine/cps2crpt.c +++ b/src/mame/machine/cps2crpt.c @@ -632,12 +632,8 @@ static void optimise_sboxes(struct optimised_sbox* out, const struct sbox* in) -static void cps2_decrypt(running_machine &machine, const UINT32 *master_key, UINT32 upper_limit) +static void cps2_decrypt(running_machine &machine, UINT16 *rom, UINT16 *dec, int length, const UINT32 *master_key, UINT32 upper_limit) { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); - UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); - int length = machine.root_device().memregion("maincpu")->bytes(); - UINT16 *dec = auto_alloc_array(machine, UINT16, length/2); int i; UINT32 key1[4]; struct optimised_sbox sboxes1[4*4]; @@ -714,16 +710,13 @@ static void cps2_decrypt(running_machine &machine, const UINT32 *master_key, UIN &sboxes2[0*4], &sboxes2[1*4], &sboxes2[2*4], &sboxes2[3*4], key2[0], key2[1], key2[2], key2[3]); } - // copy the unencrypted part (not really needed) + // copy the unencrypted part while (a < length/2) { dec[a] = rom[a]; a += 0x10000; } } - - space.set_decrypted_region(0x000000, length - 1, dec); - ((m68000_base_device*)machine.device("maincpu"))->set_encrypted_opcode_range(0, length); } @@ -1017,7 +1010,7 @@ DRIVER_INIT_MEMBER(cps_state,cps2crpt) if (strcmp(k->name, gamename) == 0) { // we have a proper key so use it to decrypt - cps2_decrypt(machine(), k->keys, k->upper_limit ? k->upper_limit : 0x400000); + cps2_decrypt(machine(), (UINT16 *)memregion("maincpu")->base(), m_decrypted_opcodes, memregion("maincpu")->bytes(), k->keys, k->upper_limit ? k->upper_limit : 0x400000); break; } diff --git a/src/mame/machine/deco102.c b/src/mame/machine/deco102.c index 5441ae9b0a6..3f0c79143f3 100644 --- a/src/mame/machine/deco102.c +++ b/src/mame/machine/deco102.c @@ -49,21 +49,13 @@ static UINT16 decrypt(UINT16 data, int address, int select_xor) bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]); } -void deco102_decrypt_cpu(running_machine &machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor) +void deco102_decrypt_cpu(UINT16 *rom, UINT16 *opcodes, int size, int address_xor, int data_select_xor, int opcode_select_xor) { - int i; - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - UINT16 *rom = (UINT16 *)machine.root_device().memregion(cputag)->base(); - int size = machine.root_device().memregion(cputag)->bytes(); - UINT16 *opcodes = auto_alloc_array(machine, UINT16, size / 2); std::vector<UINT16> buf(size / 2); memcpy(&buf[0], rom, size); - space.set_decrypted_region(0, size - 1, opcodes); - ((m68000_base_device*)machine.device(cputag))->set_encrypted_opcode_range(0, size); - - for (i = 0; i < size / 2; i++) + for (int i = 0; i < size / 2; i++) { int src; diff --git a/src/mame/machine/deco222.c b/src/mame/machine/deco222.c index ebc6dc46f9a..1df8a720dd2 100644 --- a/src/mame/machine/deco222.c +++ b/src/mame/machine/deco222.c @@ -25,9 +25,9 @@ void deco_222_device::device_reset() static_cast<mi_decrypt *>(mintf)->had_written = false; } -UINT8 deco_222_device::mi_decrypt::read_decrypted(UINT16 adr) +UINT8 deco_222_device::mi_decrypt::read_sync(UINT16 adr) { - return BITSWAP8(direct->read_raw_byte(adr) ,7,5,6,4,3,2,1,0); + return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0); } @@ -49,7 +49,7 @@ void deco_c10707_device::device_reset() static_cast<mi_decrypt *>(mintf)->had_written = false; } -UINT8 deco_c10707_device::mi_decrypt::read_decrypted(UINT16 adr) +UINT8 deco_c10707_device::mi_decrypt::read_sync(UINT16 adr) { - return BITSWAP8(direct->read_raw_byte(adr) ,7,5,6,4,3,2,1,0); + return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0); } diff --git a/src/mame/machine/deco222.h b/src/mame/machine/deco222.h index d221d59b91e..042e2bbbd98 100644 --- a/src/mame/machine/deco222.h +++ b/src/mame/machine/deco222.h @@ -14,7 +14,7 @@ protected: bool had_written; virtual ~mi_decrypt() {} - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); }; virtual void device_start(); @@ -36,7 +36,7 @@ protected: bool had_written; virtual ~mi_decrypt() {} - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); }; virtual void device_start(); diff --git a/src/mame/machine/decocpu6.c b/src/mame/machine/decocpu6.c index 98542ff12fb..957c602976f 100644 --- a/src/mame/machine/decocpu6.c +++ b/src/mame/machine/decocpu6.c @@ -24,10 +24,10 @@ void deco_cpu6_device::device_reset() m6502_device::device_reset(); } -UINT8 deco_cpu6_device::mi_decrypt::read_decrypted(UINT16 adr) +UINT8 deco_cpu6_device::mi_decrypt::read_sync(UINT16 adr) { if (adr&1) - return BITSWAP8(direct->read_raw_byte(adr),6,4,7,5,3,2,1,0); + return BITSWAP8(direct->read_byte(adr),6,4,7,5,3,2,1,0); else - return direct->read_raw_byte(adr); + return direct->read_byte(adr); } diff --git a/src/mame/machine/decocpu6.h b/src/mame/machine/decocpu6.h index 6e6fc64effa..678338027fc 100644 --- a/src/mame/machine/decocpu6.h +++ b/src/mame/machine/decocpu6.h @@ -13,7 +13,7 @@ protected: class mi_decrypt : public mi_default_normal { public: virtual ~mi_decrypt() {} - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); }; virtual void device_start(); diff --git a/src/mame/machine/decocpu7.c b/src/mame/machine/decocpu7.c index e77f47b057f..dc6bb85dff8 100644 --- a/src/mame/machine/decocpu7.c +++ b/src/mame/machine/decocpu7.c @@ -20,9 +20,9 @@ void deco_cpu7_device::device_reset() static_cast<mi_decrypt *>(mintf)->had_written = false; } -UINT8 deco_cpu7_device::mi_decrypt::read_decrypted(UINT16 adr) +UINT8 deco_cpu7_device::mi_decrypt::read_sync(UINT16 adr) { - UINT8 res = direct->read_raw_byte(adr); + UINT8 res = direct->read_byte(adr); if(had_written) { had_written = false; if((adr & 0x0104) == 0x0104) diff --git a/src/mame/machine/decocpu7.h b/src/mame/machine/decocpu7.h index 0cf2dbf4bfd..26f67a11fc1 100644 --- a/src/mame/machine/decocpu7.h +++ b/src/mame/machine/decocpu7.h @@ -14,7 +14,7 @@ protected: bool had_written; virtual ~mi_decrypt() {} - virtual UINT8 read_decrypted(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); virtual void write(UINT16 adr, UINT8 val); }; diff --git a/src/mame/machine/fd1089.c b/src/mame/machine/fd1089.c index c9cea731f83..c273c4949b4 100644 --- a/src/mame/machine/fd1089.c +++ b/src/mame/machine/fd1089.c @@ -208,6 +208,9 @@ const fd1089_base_device::decrypt_parameters fd1089_base_device::s_data_params_a { 0xac, 1,6,3,5,0,7,4,2 }, }; +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, fd1094_device ) + AM_RANGE(0x00000, 0xfffff) AM_ROM AM_SHARE(":fd1089_decrypted_opcodes") +ADDRESS_MAP_END //************************************************************************** @@ -219,10 +222,14 @@ const fd1089_base_device::decrypt_parameters fd1089_base_device::s_data_params_a //------------------------------------------------- fd1089_base_device::fd1089_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : m68000_device(mconfig, tag, owner, clock, shortname, source) + : m68000_device(mconfig, tag, owner, clock, shortname, source), + m_decrypted_opcodes(*this, ":fd1089_decrypted_opcodes") { // override the name after the m68000 initializes m_name.assign(name); + + // add the decrypted opcodes map + m_address_map[AS_DECRYPTED_OPCODES] = ADDRESS_MAP_NAME(decrypted_opcodes_map); } fd1089a_device::fd1089a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -257,18 +264,12 @@ void fd1089_base_device::device_start() // determine length and resize our internal buffers UINT32 romsize = region()->bytes(); m_plaintext.resize(romsize/2); - m_decrypted_opcodes.resize(romsize/2); // copy the plaintext memcpy(&m_plaintext[0], rombase, romsize); // decrypt it, overwriting original data with the decrypted data decrypt(0x000000, romsize, &m_plaintext[0], &m_decrypted_opcodes[0], rombase); - - // mark the ROM region as decrypted, pointing to the opcodes (if it is mapped) - address_space &program = space(AS_PROGRAM); - if (program.get_read_ptr(0) != NULL) - program.set_decrypted_region(0x000000, romsize - 1, &m_decrypted_opcodes[0]); } diff --git a/src/mame/machine/fd1089.h b/src/mame/machine/fd1089.h index 0e66d1e2bdc..e8e106b5136 100644 --- a/src/mame/machine/fd1089.h +++ b/src/mame/machine/fd1089.h @@ -57,7 +57,7 @@ protected: // internal state const UINT8 * m_key; std::vector<UINT16> m_plaintext; - std::vector<UINT16> m_decrypted_opcodes; + required_shared_ptr<UINT16> m_decrypted_opcodes; // internal types struct decrypt_parameters diff --git a/src/mame/machine/fd1094.c b/src/mame/machine/fd1094.c index 32c369ef221..7391ae4c006 100644 --- a/src/mame/machine/fd1094.c +++ b/src/mame/machine/fd1094.c @@ -35,8 +35,8 @@ if bit 13 of the current value is 1; the fourth one is executed whenever one of the first three has been executed; the fifth one is always executed. Every step can be thought as consisting of a serie of operations, with some steps - avoiding some of them: a uncondicional bitswap, some conditional XORs, - a unconditional XOR and some condicional bitswaps. + avoiding some of them: a unconditional bitswap, some conditional XORs, + a unconditional XOR and some conditional bitswaps. In the end, the decryption of a value at a given address is controlled by 32 boolean variables; 8 of them change at every address (repeating after 0x2000 @@ -472,6 +472,9 @@ const UINT16 fd1094_device::s_masked_opcodes[] = 0xde3a,0xde7a,0xdeba,0xdefa, 0xdffa }; +static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, fd1094_device ) + AM_RANGE(0x00000, 0xfffff) AM_ROMBANK(":fd1094_decrypted_opcodes") +ADDRESS_MAP_END //************************************************************************** @@ -534,7 +537,8 @@ UINT16 *fd1094_decryption_cache::decrypted_opcodes(UINT8 state) return &m_decrypted_opcodes[state][0]; // otherwise, allocate and decrypt - m_decrypted_opcodes[state].resize(m_size); + m_decrypted_opcodes[state].resize(0x100000/2); + memset(&m_decrypted_opcodes[state][0], 0, 0x100000); m_fd1094.decrypt(m_baseaddress, m_size, m_rgnoffset, &m_decrypted_opcodes[state][0], state); return &m_decrypted_opcodes[state][0]; } @@ -552,6 +556,7 @@ UINT16 *fd1094_decryption_cache::decrypted_opcodes(UINT8 state) fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : m68000_device(mconfig, tag, owner, clock, "fd1094", __FILE__), + m_decrypted_opcodes_bank(*this, ":fd1094_decrypted_opcodes"), m_state(0x00), m_irqmode(false), m_cache(*this), @@ -562,6 +567,9 @@ fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, dev // override the name after the m68000 initializes m_name.assign("FD1094"); + // add the decrypted opcodes map + m_address_map[AS_DECRYPTED_OPCODES] = ADDRESS_MAP_NAME(decrypted_opcodes_map); + // create the initial masked opcode table memset(m_masked_opcodes_lookup, 0, sizeof(m_masked_opcodes_lookup)); for (int index = 0; index < ARRAY_LENGTH(s_masked_opcodes); index++) @@ -575,6 +583,8 @@ fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, dev for (int opcode = 0; opcode < 65536; opcode += 2) if ((opcode & 0xff80) == 0x4e80 || (opcode & 0xf0f8) == 0x50c8 || (opcode & 0xf000) == 0x6000) m_masked_opcodes_lookup[1][opcode >> 4] |= 1 << ((opcode >> 1) & 7); + + m_state_change = state_change_delegate(FUNC(fd1094_device::default_state_change), this); } @@ -625,9 +635,6 @@ void fd1094_device::change_state(int newstate) void fd1094_device::device_start() { - // start the base device - m68000_device::device_start(); - // find the key m_key = memregion("key")->base(); if (m_key == NULL) @@ -655,13 +662,12 @@ void fd1094_device::device_start() if (m_srcbase == NULL) throw emu_fatalerror("FD1094 found no data to decrypt!"); - // if address 0 is mapped to ROM, assume this is a state memory mapping and - // use the internal state change callback - if (space(AS_PROGRAM).get_read_ptr(0) != NULL) - m_state_change = state_change_delegate(FUNC(fd1094_device::default_state_change), this); - // determine length and configure our cache m_cache.configure(0x000000, m_srcbytes, 0x000000); + change_state(STATE_RESET); + + // start the base device + m68000_device::device_start(); // register for the state changing callbacks we need in the m68000 set_cmpild_callback(write32_delegate(FUNC(fd1094_device::cmp_callback),this)); @@ -683,7 +689,7 @@ void fd1094_device::device_reset() // flush the cache and switch to the reset state m_cache.reset(); change_state(STATE_RESET); - + fprintf(stderr, "reset done\n"); // reset the parent m68000_device::device_reset(); } @@ -913,7 +919,7 @@ void fd1094_device::decrypt(offs_t baseaddr, UINT32 size, const UINT16 *srcptr, void fd1094_device::default_state_change(UINT8 state) { - space(AS_PROGRAM).set_decrypted_region(0x000000, m_srcbytes - 1, m_cache.decrypted_opcodes(state)); + m_decrypted_opcodes_bank->set_base(m_cache.decrypted_opcodes(state)); } diff --git a/src/mame/machine/fd1094.h b/src/mame/machine/fd1094.h index 3439a4c288c..db5eb5cb83e 100644 --- a/src/mame/machine/fd1094.h +++ b/src/mame/machine/fd1094.h @@ -88,6 +88,8 @@ public: }; protected: + required_memory_bank m_decrypted_opcodes_bank; + // device overrides virtual void device_start(); virtual void device_reset(); diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index 9abaec03ef2..0a78590cb5c 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -442,7 +442,7 @@ INLINE int pc_is_valid(address_space &space, UINT32 pc, UINT32 flags) return 0; if (pc & 0xff000000) return 0; - if (space.direct().read_decrypted_ptr(pc) == NULL) + if (space.direct().read_ptr(pc) == NULL) return 0; return 1; } diff --git a/src/mame/machine/gaplus.c b/src/mame/machine/gaplus.c index a89f6505ced..377ea6f6233 100644 --- a/src/mame/machine/gaplus.c +++ b/src/mame/machine/gaplus.c @@ -2,7 +2,7 @@ // copyright-holders:Manuel Abadia, Ernesto Corvi, Nicola Salmoria /*************************************************************************** - machine.c + gaplus.c Functions to emulate general aspects of the machine (RAM, ROM, interrupts, I/O ports) @@ -20,7 +20,7 @@ * * ************************************************************************************/ -WRITE8_MEMBER(gaplus_state::gaplus_customio_3_w) +WRITE8_MEMBER(gaplus_state::customio_3_w) { if ((offset == 0x09) && (data >= 0x0f)) m_samples->start(0,0); @@ -29,7 +29,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_customio_3_w) } -READ8_MEMBER(gaplus_state::gaplus_customio_3_r) +READ8_MEMBER(gaplus_state::customio_3_r) { int mode = m_customio_3[8]; diff --git a/src/mame/machine/kabuki.c b/src/mame/machine/kabuki.c index 038c1f5f422..4be230bc609 100644 --- a/src/mame/machine/kabuki.c +++ b/src/mame/machine/kabuki.c @@ -160,58 +160,37 @@ static void kabuki_decode(UINT8 *src,UINT8 *dest_op,UINT8 *dest_data, -static void mitchell_decode(running_machine &machine, int swap_key1,int swap_key2,int addr_key,int xor_key) +static void mitchell_decode(UINT8 *src, UINT8 *dst, int size, int swap_key1,int swap_key2,int addr_key,int xor_key) { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion("maincpu")->base(); - UINT8 *decrypt = auto_alloc_array(machine, UINT8, machine.root_device().memregion("maincpu")->bytes()); - int numbanks = (machine.root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000; - int i; - - space.set_decrypted_region(0x0000, 0x7fff, decrypt); - kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key); - - rom += 0x10000; - decrypt += 0x10000; - for (i = 0; i < numbanks; i++) - kabuki_decode(rom+i*0x4000,decrypt+i*0x4000,rom+i*0x4000,0x8000,0x4000, swap_key1,swap_key2,addr_key,xor_key); - - machine.root_device().membank("bank1")->configure_decrypted_entries(0, numbanks, decrypt, 0x4000); -/* - { - FILE *f; - f = fopen("a","wb"); - fwrite(rom,1,0x8000,f); - fwrite(rom+0x10000,1,0x40000,f); - fclose(f); - } -*/ + int numbanks = (size - 0x10000) / 0x4000; + + kabuki_decode(src,dst,src,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key); + + src += 0x10000; + dst += 0x10000; + for (int i = 0; i < numbanks; i++) + kabuki_decode(src+i*0x4000,dst+i*0x4000,src+i*0x4000,0x8000,0x4000, swap_key1,swap_key2,addr_key,xor_key); } -void mgakuen2_decode(running_machine &machine) { mitchell_decode(machine,0x76543210,0x01234567,0xaa55,0xa5); } -void pang_decode(running_machine &machine) { mitchell_decode(machine,0x01234567,0x76543210,0x6548,0x24); } -void cworld_decode(running_machine &machine) { mitchell_decode(machine,0x04152637,0x40516273,0x5751,0x43); } -void hatena_decode(running_machine &machine) { mitchell_decode(machine,0x45670123,0x45670123,0x5751,0x43); } -void spang_decode(running_machine &machine) { mitchell_decode(machine,0x45670123,0x45670123,0x5852,0x43); } -void spangj_decode(running_machine &machine) { mitchell_decode(machine,0x45123670,0x67012345,0x55aa,0x5a); } -void sbbros_decode(running_machine &machine) { mitchell_decode(machine,0x45670123,0x45670123,0x2130,0x12); } -void marukin_decode(running_machine &machine) { mitchell_decode(machine,0x54321076,0x54321076,0x4854,0x4f); } -void qtono1_decode(running_machine &machine) { mitchell_decode(machine,0x12345670,0x12345670,0x1111,0x11); } -void qsangoku_decode(running_machine &machine) { mitchell_decode(machine,0x23456701,0x23456701,0x1828,0x18); } -void block_decode(running_machine &machine) { mitchell_decode(machine,0x02461357,0x64207531,0x0002,0x01); } +void mgakuen2_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x76543210,0x01234567,0xaa55,0xa5); } +void pang_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x01234567,0x76543210,0x6548,0x24); } +void cworld_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x04152637,0x40516273,0x5751,0x43); } +void hatena_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x45670123,0x45670123,0x5751,0x43); } +void spang_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x45670123,0x45670123,0x5852,0x43); } +void spangj_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x45123670,0x67012345,0x55aa,0x5a); } +void sbbros_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x45670123,0x45670123,0x2130,0x12); } +void marukin_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x54321076,0x54321076,0x4854,0x4f); } +void qtono1_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x12345670,0x12345670,0x1111,0x11); } +void qsangoku_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x23456701,0x23456701,0x1828,0x18); } +void block_decode(UINT8 *src, UINT8 *dst, int size) { mitchell_decode(src,dst,size,0x02461357,0x64207531,0x0002,0x01); } -static void cps1_decode(running_machine &machine,int swap_key1,int swap_key2,int addr_key,int xor_key) +static void cps1_decode(UINT8 *src, UINT8 *dst,int swap_key1,int swap_key2,int addr_key,int xor_key) { - address_space &space = machine.device("audiocpu")->memory().space(AS_PROGRAM); - UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000); - UINT8 *rom = machine.root_device().memregion("audiocpu")->base(); - - space.set_decrypted_region(0x0000, 0x7fff, decrypt); - kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key); + kabuki_decode(src,dst,src,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key); } -void wof_decode(running_machine &machine) { cps1_decode(machine,0x01234567,0x54163072,0x5151,0x51); } -void dino_decode(running_machine &machine) { cps1_decode(machine,0x76543210,0x24601357,0x4343,0x43); } -void punisher_decode(running_machine &machine) { cps1_decode(machine,0x67452103,0x75316024,0x2222,0x22); } -void slammast_decode(running_machine &machine) { cps1_decode(machine,0x54321076,0x65432107,0x3131,0x19); } +void wof_decode(UINT8 *src, UINT8 *dst) { cps1_decode(src,dst,0x01234567,0x54163072,0x5151,0x51); } +void dino_decode(UINT8 *src, UINT8 *dst) { cps1_decode(src,dst,0x76543210,0x24601357,0x4343,0x43); } +void punisher_decode(UINT8 *src, UINT8 *dst) { cps1_decode(src,dst,0x67452103,0x75316024,0x2222,0x22); } +void slammast_decode(UINT8 *src, UINT8 *dst) { cps1_decode(src,dst,0x54321076,0x65432107,0x3131,0x19); } diff --git a/src/mame/machine/kabuki.h b/src/mame/machine/kabuki.h index e5e1b9bfc76..1b9165bea07 100644 --- a/src/mame/machine/kabuki.h +++ b/src/mame/machine/kabuki.h @@ -2,18 +2,18 @@ // copyright-holders:Nicola Salmoria #include "emu.h" -void mgakuen2_decode(running_machine &machine); -void pang_decode(running_machine &machine); -void cworld_decode(running_machine &machine); -void hatena_decode(running_machine &machine); -void spang_decode(running_machine &machine); -void spangj_decode(running_machine &machine); -void sbbros_decode(running_machine &machine); -void marukin_decode(running_machine &machine); -void qtono1_decode(running_machine &machine); -void qsangoku_decode(running_machine &machine); -void block_decode(running_machine &machine); -void wof_decode(running_machine &machine); -void dino_decode(running_machine &machine); -void punisher_decode(running_machine &machine); -void slammast_decode(running_machine &machine); +void mgakuen2_decode(UINT8 *src, UINT8 *dst, int size); +void pang_decode(UINT8 *src, UINT8 *dst, int size); +void cworld_decode(UINT8 *src, UINT8 *dst, int size); +void hatena_decode(UINT8 *src, UINT8 *dst, int size); +void spang_decode(UINT8 *src, UINT8 *dst, int size); +void spangj_decode(UINT8 *src, UINT8 *dst, int size); +void sbbros_decode(UINT8 *src, UINT8 *dst, int size); +void marukin_decode(UINT8 *src, UINT8 *dst, int size); +void qtono1_decode(UINT8 *src, UINT8 *dst, int size); +void qsangoku_decode(UINT8 *src, UINT8 *dst, int size); +void block_decode(UINT8 *src, UINT8 *dst, int size); +void wof_decode(UINT8 *src, UINT8 *dst); +void dino_decode(UINT8 *src, UINT8 *dst); +void punisher_decode(UINT8 *src, UINT8 *dst); +void slammast_decode(UINT8 *src, UINT8 *dst); diff --git a/src/mame/machine/konami1.c b/src/mame/machine/konami1.c index 75d4a2b01b4..c0240bcbc78 100644 --- a/src/mame/machine/konami1.c +++ b/src/mame/machine/konami1.c @@ -1,60 +1,50 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Chris Hardy +// copyright-holders:Olivier Galibert /*************************************************************************** - The Konami_1 CPU is a 6809 with opcodes scrambled. Here is how to - descramble them. + The Konami_1 CPU is a 6809 with opcodes scrambled. ***************************************************************************/ #include "emu.h" #include "konami1.h" +const device_type KONAMI1 = &device_creator<konami1_device>; -static UINT8 konami1_decodebyte( UINT8 opcode, UINT16 address ) +konami1_device::konami1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m6809_base_device(mconfig, "KONAMI-1", tag, owner, clock, KONAMI1, 1, "konami1", __FILE__) { -/* -> -> CPU_D7 = (EPROM_D7 & ~ADDRESS_1) | (~EPROM_D7 & ADDRESS_1) > -> CPU_D6 = EPROM_D6 -> -> CPU_D5 = (EPROM_D5 & ADDRESS_1) | (~EPROM_D5 & ~ADDRESS_1) > -> CPU_D4 = EPROM_D4 -> -> CPU_D3 = (EPROM_D3 & ~ADDRESS_3) | (~EPROM_D3 & ADDRESS_3) > -> CPU_D2 = EPROM_D2 -> -> CPU_D1 = (EPROM_D1 & ADDRESS_3) | (~EPROM_D1 & ~ADDRESS_3) > -> CPU_D0 = EPROM_D0 -> -*/ - UINT8 xormask; - - - xormask = 0; - if (address & 0x02) xormask |= 0x80; - else xormask |= 0x20; - if (address & 0x08) xormask |= 0x08; - else xormask |= 0x02; - - return opcode ^ xormask; + m_boundary = 0x0000; } +void konami1_device::device_start() +{ + m_mintf = new mi_konami1(m_boundary); + m6809_base_device::device_start(); +} - -UINT8 *konami1_decode(running_machine &machine, const char *cpu) +void konami1_device::set_encryption_boundary(UINT16 adr) { - address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM); - const UINT8 *rom = machine.root_device().memregion(cpu)->base(); - int size = machine.root_device().memregion(cpu)->bytes(); - int A; + m_boundary = adr; + if(m_mintf) + static_cast<mi_konami1 *>(m_mintf)->m_boundary = adr; +} - UINT8 *decrypted = auto_alloc_array(machine, UINT8, size); - space.set_decrypted_region(0x0000, 0xffff, decrypted); +konami1_device::mi_konami1::mi_konami1(UINT16 adr) +{ + m_boundary = adr; +} - for (A = 0;A < size;A++) - { - decrypted[A] = konami1_decodebyte(rom[A],A); +UINT8 konami1_device::mi_konami1::read_opcode(UINT16 adr) +{ + UINT8 val = m_sdirect->read_byte(adr); + if(adr < m_boundary) + return val; + switch(adr & 0xa) { + default: + case 0x0: return val ^ 0x22; + case 0x2: return val ^ 0x82; + case 0x8: return val ^ 0x28; + case 0xa: return val ^ 0x88; } - return decrypted; } diff --git a/src/mame/machine/konami1.h b/src/mame/machine/konami1.h index 00697959658..1efadd4eee4 100644 --- a/src/mame/machine/konami1.h +++ b/src/mame/machine/konami1.h @@ -1,3 +1,26 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Chris Hardy -UINT8 *konami1_decode(running_machine &machine, const char *cpu); +// copyright-holders:Olivier Galibert + +#include "cpu/m6809/m6809.h" + +class konami1_device : public m6809_base_device { +public: + konami1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void set_encryption_boundary(UINT16 adr); + +protected: + class mi_konami1 : public mi_default { + public: + UINT16 m_boundary; + mi_konami1(UINT16 boundary); + virtual ~mi_konami1() {} + virtual UINT8 read_opcode(UINT16 adr); + }; + + UINT16 m_boundary; + + virtual void device_start(); +}; + +extern const device_type KONAMI1; diff --git a/src/mame/machine/m1comm.c b/src/mame/machine/m1comm.c index 9b3c0758c6a..09f0116ff69 100644 --- a/src/mame/machine/m1comm.c +++ b/src/mame/machine/m1comm.c @@ -159,7 +159,7 @@ void m1comm_device::device_reset() m_zfg = 0; m_cn = 0; m_fg = 0; - + m_commcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } @@ -172,7 +172,7 @@ READ8_MEMBER(m1comm_device::dlc_reg_r) return 0xFF; } // dirty hack to keep Z80 in RESET state - + UINT8 result = m_dlc_reg[offset]; #ifdef __M1COMM_VERBOSE__ printf("m1comm-dlc_reg_r: read register %02x for value %02x\n", offset, result); @@ -224,11 +224,11 @@ WRITE8_MEMBER(m1comm_device::syn_w) case 0x00: printf("m1comm-syn_w: VINT disabled\n"); break; - + case 0x02: printf("m1comm-syn_w: VINT enabled\n"); break; - + default: printf("m1comm-syn_w: %02x\n", data); break; @@ -306,7 +306,7 @@ WRITE8_MEMBER(m1comm_device::fg_w) { if (!m_cn) return; - + m_fg = data & 0x01; } @@ -327,7 +327,7 @@ void m1comm_device::check_vint_irq() #ifdef __M1COMM_SIMULATION__ void m1comm_device::comm_tick(){ - if (m_linkenable == 0x01) + if (m_linkenable == 0x01) { int frameStart = 0x0010; int frameOffset = 0x0000; @@ -350,14 +350,14 @@ void m1comm_device::comm_tick(){ printf("M1COMM: listen on %s\n", m_localhost); m_line_rx.open(m_localhost); } - + // check tx socket if (!m_line_tx.is_open()) { printf("M1COMM: connect to %s\n", m_remotehost); m_line_tx.open(m_remotehost); } - + // if both sockets are there check ring if ((m_line_rx.is_open()) && (m_line_tx.is_open())) { @@ -394,7 +394,7 @@ void m1comm_device::comm_tick(){ m_line_tx.write(m_buffer, dataSize); } } - + // 0xFE - link size else if (idx == 0xFE) { @@ -405,11 +405,11 @@ void m1comm_device::comm_tick(){ // slave and relay forward message m_line_tx.write(m_buffer, dataSize); } - + // consider it done printf("M1COMM: link established - id %02x of %02x\n", m_linkid, m_linkcount); m_linkalive = 0x01; - + // write to shared mem m_shared[0] = 0x01; m_shared[2] = m_linkid; @@ -427,13 +427,13 @@ void m1comm_device::comm_tick(){ } printf("M1COMM: droped a message...\n"); } - + if (m_linkalive == 0x00) recv = m_line_rx.read(m_buffer, dataSize); else recv = 0; } - + // if we are master and link is not yet established if (isMaster && (m_linkalive == 0x00)) { @@ -461,7 +461,7 @@ void m1comm_device::comm_tick(){ m_shared[2] = m_linkid; m_shared[3] = m_linkcount; } - + else if (m_linktimer > 0x02) { // decrease delay timer @@ -471,7 +471,7 @@ void m1comm_device::comm_tick(){ } } } - } + } // update "ring buffer" if link established if (m_linkalive == 0x01) @@ -526,7 +526,7 @@ void m1comm_device::comm_tick(){ } recv = m_line_rx.read(m_buffer, dataSize); } - + // update "ring buffer" if link established // live relay does not send data if (m_linkid != 0x00 && m_shared[5] == 0x01) @@ -542,7 +542,7 @@ void m1comm_device::comm_tick(){ // push message to other nodes m_line_tx.write(m_buffer, dataSize); - // master sends some additional status bytes + // master sends some additional status bytes if (isMaster){ m_buffer[0] = 0xF0; for (int j = 0x00 ; j < frameSize ; j++) @@ -562,4 +562,4 @@ void m1comm_device::comm_tick(){ } } #endif -}
\ No newline at end of file +} diff --git a/src/mame/machine/m1comm.h b/src/mame/machine/m1comm.h index 02cfceb3078..85c0b3eb834 100644 --- a/src/mame/machine/m1comm.h +++ b/src/mame/machine/m1comm.h @@ -12,7 +12,7 @@ #define MCFG_M1COMM_ADD(_tag ) \ MCFG_DEVICE_ADD(_tag, M1COMM, 0) - + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -57,7 +57,7 @@ public: DECLARE_READ8_MEMBER(fg_r); DECLARE_WRITE8_MEMBER(fg_w); - // IRQ logic - 5 = VINT, 7 = DLC + // IRQ logic - 5 = VINT, 7 = DLC void check_vint_irq(); protected: @@ -68,26 +68,26 @@ protected: private: UINT8 m_shared[0x1000]; // 2x 2k = 4k; model1 accesses this with 16bit data and 11bit address (A0 to A10) - UINT8 m_dlc_reg[0x20]; // MB89374 registers - UINT8 m_dma_reg[0x20]; // MB89237A registers - UINT8 m_syn; // bit0 is stored; purpose unknown, bit1 is used to enable/disable VINT/IRQ5 - UINT8 m_zfg; // z80 flip gate? purpose unknown, bit0 is stored - UINT8 m_cn; // bit0 is used to enable/disable the comm board - UINT8 m_fg; // flip gate? purpose unknown, bit0 is stored, bit7 is connected to ZFG bit 0 - + UINT8 m_dlc_reg[0x20]; // MB89374 registers + UINT8 m_dma_reg[0x20]; // MB89237A registers + UINT8 m_syn; // bit0 is stored; purpose unknown, bit1 is used to enable/disable VINT/IRQ5 + UINT8 m_zfg; // z80 flip gate? purpose unknown, bit0 is stored + UINT8 m_cn; // bit0 is used to enable/disable the comm board + UINT8 m_fg; // flip gate? purpose unknown, bit0 is stored, bit7 is connected to ZFG bit 0 + emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink emu_file m_line_tx; // tx line - is differential, simple serial and toslink char m_localhost[256]; char m_remotehost[256]; UINT8 m_buffer[0x1000]; - + #ifdef __M1COMM_SIMULATION__ UINT8 m_linkenable; UINT16 m_linktimer; UINT8 m_linkalive; UINT8 m_linkid; UINT8 m_linkcount; - + void comm_tick(); #endif }; diff --git a/src/mame/machine/mc8123.c b/src/mame/machine/mc8123.c index a82c841347d..a6327cf0895 100644 --- a/src/mame/machine/mc8123.c +++ b/src/mame/machine/mc8123.c @@ -377,46 +377,17 @@ static UINT8 mc8123_decrypt(offs_t addr,UINT8 val,const UINT8 *key,int opcode) return decrypt(val,key[tbl_num + (opcode ? 0 : 0x1000)],opcode); } - -void mc8123_decrypt_rom(running_machine &machine, const char *cpu, const char *keyrgn, const char *bankname, int numbanks) +void mc8123_decode(UINT8 *rom, UINT8 *opcodes, const UINT8 *key, int length) { - address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM); - int fixed_length = numbanks == 1 ? 0xc000 : 0x8000; - UINT8 *decrypted1 = auto_alloc_array(machine, UINT8, fixed_length); - UINT8 *decrypted2 = numbanks > 1 ? auto_alloc_array(machine, UINT8, 0x4000 * numbanks) : 0; - UINT8 *rom = machine.root_device().memregion(cpu)->base(); - UINT8 *key = machine.root_device().memregion(keyrgn)->base(); - int A, bank; - - space.set_decrypted_region(0x0000, fixed_length-1, decrypted1); - - for (A = 0x0000;A < fixed_length;A++) + for (int A = 0x0000;A < length;A++) { + int adr = A >= 0xc000 ? (A & 0x3fff) | 0x8000 : A; UINT8 src = rom[A]; /* decode the opcodes */ - decrypted1[A] = mc8123_decrypt(A,src,key,1); + opcodes[A] = mc8123_decrypt(adr,src,key,1); /* decode the data */ - rom[A] = mc8123_decrypt(A,src,key,0); - } - - if (bankname != NULL) - { - machine.root_device().membank(bankname)->configure_decrypted_entries(0, numbanks, decrypted2, 0x4000); - - for (bank = 0; bank < numbanks; ++bank) - { - for (A = 0x8000;A < 0xc000;A++) - { - UINT8 src = rom[0x8000 + 0x4000*bank + A]; - - /* decode the opcodes */ - decrypted2[0x4000 * bank + (A-0x8000)] = mc8123_decrypt(A,src,key,1); - - /* decode the data */ - rom[0x8000 + 0x4000*bank + A] = mc8123_decrypt(A,src,key,0); - } - } + rom[A] = mc8123_decrypt(adr,src,key,0); } } diff --git a/src/mame/machine/mc8123.h b/src/mame/machine/mc8123.h index 02caa2cbe0f..6887b4f644c 100644 --- a/src/mame/machine/mc8123.h +++ b/src/mame/machine/mc8123.h @@ -8,6 +8,6 @@ // this function assumes a fixed portion of ROM at 0000-7FFF, and // an arbitrary amount of banks at 8000-BFFF. -// numbanks may be 0, meaning there is no ROM to decrypt at 8000-BFFF, -// or 1, meaning 0000-BFFF will be decrypted as a single unit. -void mc8123_decrypt_rom(running_machine &machine, const char *cpu, const char *keyrgn, const char *bankname, int numbanks); + +void mc8123_decode(UINT8 *rom, UINT8 *opcodes, const UINT8 *key, int length); + diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index b4f1d044c42..6c6667bd8b8 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -488,34 +488,6 @@ WRITE8_MEMBER(namcos1_state::sound_bankswitch_w) * * *******************************************************************************/ -// These direct handlers are merely for speed - taking two trips -// through the memory system for every opcode fetch is rather slow - -DIRECT_UPDATE_MEMBER(namcos1_state::direct_handler_main) -{ - return direct_handler(0, direct, address); -} - -DIRECT_UPDATE_MEMBER(namcos1_state::direct_handler_sub) -{ - return direct_handler(1, direct, address); -} - -inline offs_t namcos1_state::direct_handler(int whichcpu, direct_read_data &direct, offs_t address) -{ - offs_t remapped_address = m_c117->remap(whichcpu, address); - - // if not in ROM, return - if (remapped_address < 0x400000) return address; - - // calculate the base of the 8KB ROM page - remapped_address &= 0x3fe000; - - direct.explicit_configure(address & 0xe000, address | 0x1fff, 0x1fff, &m_rom[remapped_address]); - return ~0; -} - - WRITE_LINE_MEMBER(namcos1_state::subres_w) { // logerror("reset control pc=%04x %02x\n",space.device().safe_pc(),data); @@ -641,9 +613,6 @@ void namcos1_state::driver_init() } } - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(namcos1_state::direct_handler_main), this)); - m_subcpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(namcos1_state::direct_handler_sub), this)); - // kludge! see notes m_mcu->space(AS_PROGRAM).install_write_handler(0xc000, 0xc000, write8_delegate(FUNC(namcos1_state::mcu_patch_w), this)); diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index e51701679ab..eeea8613ee1 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -624,7 +624,7 @@ WRITE8_MEMBER(scramble_state::harem_decrypt_clk_w) } membank("rombank")->set_base (m_harem_decrypted_data + 0x2000 * bank); - membank("rombank")->set_base_decrypted (m_harem_decrypted_opcodes + 0x2000 * bank); + membank("rombank_decrypted")->set_base (m_harem_decrypted_opcodes + 0x2000 * bank); // logerror("%s: decrypt mode = %02x (bank %x) active\n", machine().describe_context(), m_harem_decrypt_mode, bank); @@ -674,5 +674,5 @@ DRIVER_INIT_MEMBER(scramble_state,harem) } membank("rombank")->set_base (m_harem_decrypted_data); - membank("rombank")->set_base_decrypted (m_harem_decrypted_opcodes); + membank("rombank_decrypted")->set_base (m_harem_decrypted_opcodes); } diff --git a/src/mame/machine/segacrp2.c b/src/mame/machine/segacrp2.c index e0d128363ad..b5cff3a5d0e 100644 --- a/src/mame/machine/segacrp2.c +++ b/src/mame/machine/segacrp2.c @@ -47,10 +47,9 @@ #include "segacrp2.h" -static void sega_decode_2(running_machine &machine,const char *cputag, - const UINT8 xor_table[128],const int swap_table[128]) +void sega_decode_2(UINT8 *rom, UINT8 *decrypted, + const UINT8 xor_table[128],const int swap_table[128]) { - int A; static const UINT8 swaptable[24][4] = { { 6,4,2,0 }, { 4,6,2,0 }, { 2,4,6,0 }, { 0,4,2,6 }, @@ -62,14 +61,7 @@ static void sega_decode_2(running_machine &machine,const char *cputag, }; - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion(cputag)->base(); - UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x8000); - - space.set_decrypted_region(0x0000, 0x7fff, decrypted); - - - for (A = 0x0000;A < 0x8000;A++) + for (int A = 0x0000;A < 0x8000;A++) { int row; UINT8 src; @@ -93,187 +85,6 @@ static void sega_decode_2(running_machine &machine,const char *cputag, } - -void sega_315_5162_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 xor_table[128] = - { - 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00,0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55, - 0x00, - }; - - static const int swap_table[128] = - { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 12, - }; - - - sega_decode_2(machine,cputag,xor_table,swap_table); -} - - -void sega_315_5177_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 xor_table[128] = - { - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40, - 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41, - 0x05,0x55,0x50,0x14, - }; - - static const int swap_table[128] = - { - 0,0,0,0, - 1,1,1,1,1, - 2,2,2,2,2, - 3,3,3,3, - 4,4,4,4,4, - 5,5,5,5,5, - 6,6,6,6,6, - 7,7,7,7,7, - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11,11, - 12,12,12,12,12, - 13,13, - - 8,8,8,8, - 9,9,9,9,9, - 10,10,10,10,10, - 11,11,11,11, - 12,12,12,12,12, - 13,13,13,13,13, - 14,14,14,14,14, - 15,15,15,15,15, - 16,16,16,16, - 17,17,17,17,17, - 18,18,18,18,18, - 19,19,19,19,19, - 20,20,20,20,20, - 21,21, - }; - - - sega_decode_2(machine,cputag,xor_table,swap_table); -} - - -void sega_315_5178_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 xor_table[128] = - { - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, - 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, - 0x40,0x55,0x15,0x05,0x51,0x11, - 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, - 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, - 0x41,0x54,0x14,0x04,0x50,0x10, - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, - - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10, - 0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10, - 0x40,0x55,0x15,0x05,0x51,0x11, - 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11, - 0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11, - 0x41,0x54,0x14,0x04,0x50,0x10, - 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14, - }; - - static const int swap_table[128] = - { - 2, - 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, - 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4, - 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, - 4, 6, 0, 2, 4, 6, 0, 2, 4, 6, - 8, - 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, - 6, 0, 2, 4, 6, 0, 2, - - 10, - 11,13,15, 9,11,13,15, 9,11,13,15, - 8,10,12,14, 8,10,12,14, 8,10,12, - 13,15, 9,11,13,15, 9,11,13,15, 9,11, - 12,14, 8,10,12,14, 8,10,12,14, - 16, - 9,11,13,15, 9,11,13,15, 9,11,13, - 14, 8,10,12,14, 8,10, - }; - - - sega_decode_2(machine,cputag,xor_table,swap_table); -} - - -void sega_315_5179_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 xor_table[128] = - { - 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04, - 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04, - 0x00,0x45,0x41,0x14,0x50, - 0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50, - 0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04, - 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,0x04, - 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04, - 0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41, - }; - - static const int swap_table[128] = - { - 8, 9,11,13,15, 0, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8, 9,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 2, 4, 6, - 8,10,11,13,15, 1, 3, 4, 6, - 8, - 7, 1, 2, 4, 6, 0, 1, 3, 5, - 7, 1, 2, 4, 6, 0, 1, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 2, 4, 6, 0, 2, 3, 5, - 7, 1, 3, 4, 6, 0, 2, 3, 5, - 7, 1, 3, 4, 6, 0, 2, 4, 5, - 7, - }; - - - sega_decode_2(machine,cputag,xor_table,swap_table); -} - - /****************************************************************************** These games (all 317-000x CPUs) use the same algorithm, but the key doesn't @@ -281,7 +92,7 @@ void sega_315_5179_decode(running_machine &machine, const char *cputag) ******************************************************************************/ -static void sega_decode_317(running_machine &machine, const char *cputag, int shift) +void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift) { static const UINT8 xor_table[128+3] = { @@ -309,10 +120,5 @@ static void sega_decode_317(running_machine &machine, const char *cputag, int sh 10,20, 1, }; - sega_decode_2( machine, cputag, xor_table + shift, swap_table + shift ); + sega_decode_2(rom, decrypted, xor_table + shift, swap_table + shift); } - -void sega_317_0004_decode(running_machine &machine, const char *cputag) { sega_decode_317( machine, cputag, 0 ); } -void sega_317_0005_decode(running_machine &machine, const char *cputag) { sega_decode_317( machine, cputag, 1 ); } -void sega_317_0006_decode(running_machine &machine, const char *cputag) { sega_decode_317( machine, cputag, 2 ); } -void sega_317_0007_decode(running_machine &machine, const char *cputag) { sega_decode_317( machine, cputag, 3 ); } diff --git a/src/mame/machine/segacrp2.h b/src/mame/machine/segacrp2.h index 36493c9edf0..a842ef8096b 100644 --- a/src/mame/machine/segacrp2.h +++ b/src/mame/machine/segacrp2.h @@ -1,10 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria -void sega_315_5162_decode(running_machine &machine, const char *cputag); -void sega_315_5177_decode(running_machine &machine, const char *cputag); -void sega_315_5178_decode(running_machine &machine, const char *cputag); -void sega_315_5179_decode(running_machine &machine, const char *cputag); -void sega_317_0004_decode(running_machine &machine, const char *cputag); -void sega_317_0005_decode(running_machine &machine, const char *cputag); -void sega_317_0006_decode(running_machine &machine, const char *cputag); -void sega_317_0007_decode(running_machine &machine, const char *cputag); + +void sega_decode_2(UINT8 *rom, UINT8 *decrypted, + const UINT8 xor_table[128],const int swap_table[128]); + +void sega_decode_317(UINT8 *rom, UINT8 *decrypted, int shift); diff --git a/src/mame/machine/segacrpt.c b/src/mame/machine/segacrpt.c index 48c152a7ed6..e577ac786c8 100644 --- a/src/mame/machine/segacrpt.c +++ b/src/mame/machine/segacrpt.c @@ -215,26 +215,21 @@ static void look_for_known_plaintext(void) } #endif -static void sega_decode(running_machine &machine, const char *cputag, const UINT8 convtable[32][4]) +void sega_decode(UINT8 *data, UINT8 *opcodes, int size, const UINT8 convtable[32][4], int bank_count, int bank_size) { - int A; - - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - int length = machine.root_device().memregion(cputag)->bytes(); - int cryptlen = MIN(length, 0x8000); - UINT8 *rom = machine.root_device().memregion(cputag)->base(); - UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0xc000); - - space.set_decrypted_region(0x0000, cryptlen - 1, decrypted); - - for (A = 0x0000;A < cryptlen;A++) + for (int A = 0x0000;A < size + bank_count*bank_size;A++) { int xorval = 0; - UINT8 src = rom[A]; + UINT8 src = data[A]; + int adr; + if(A < size || !bank_count) + adr = A; + else + adr = size + ((A - size) % bank_size); /* pick the translation table from bits 0, 4, 8 and 12 of the address */ - int row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); + int row = (adr & 1) + (((adr >> 4) & 1) << 1) + (((adr >> 8) & 1) << 2) + (((adr >> 12) & 1) << 3); /* pick the offset in the table from bits 3 and 5 of the source data */ int col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); @@ -246,826 +241,14 @@ static void sega_decode(running_machine &machine, const char *cputag, const UINT } /* decode the opcodes */ - decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); + opcodes[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); /* decode the data */ - rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); + data[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */ - decrypted[A] = 0xee; + opcodes[A] = 0xee; if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */ - rom[A] = 0xee; - } - - /* this is a kludge to catch anyone who has code that crosses the encrypted/ */ - /* decrypted boundary. ssanchan does it */ - if (length > 0x8000) - { - int bytes = MIN(length - 0x8000, 0x4000); - memcpy(&decrypted[0x8000], &rom[0x8000], bytes); - } -} - - - -void buckrog_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...0...0 */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */ - { 0x80,0x00,0x88,0x08 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void pengo_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...0 */ - { 0x08,0x28,0x88,0xa8 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x08,0x00,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...1...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ - { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...0...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...1 */ - { 0x08,0x00,0x88,0x80 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ - { 0x00,0x08,0x20,0x28 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ - { 0x08,0x28,0x88,0xa8 }, { 0x08,0x28,0x88,0xa8 }, /* ...1...1...1...0 */ - { 0x08,0x00,0x88,0x80 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void szaxxon_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...0...0 */ - { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ - { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ - { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */ - { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ - { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...1...0 */ - { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...1 */ - { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...0 */ - { 0xa8,0x28,0xa0,0x20 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...0...1 */ - { 0x08,0x28,0x88,0xa8 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void suprloco_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void yamato_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - -void toprollr_decode(running_machine &machine, const char *cputag, const char *regiontag) -{ - /* same tables as in Yamato, but encrypted ROM is banked */ - UINT8 *decrypted; - - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */ - { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ - }; - - int A; - - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion(regiontag)->base(); - int bankstart; - decrypted = auto_alloc_array(machine, UINT8, 0x6000*3); - - - for(bankstart=0;bankstart<0x6000*3;bankstart+=0x6000) - for (A = 0x0000;A < 0x6000;A++) - { - int xorval = 0; - - UINT8 src = rom[A+bankstart]; - - /* pick the translation table from bits 0, 4, 8 and 12 of the address */ - int row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); - - /* pick the offset in the table from bits 3 and 5 of the source data */ - int col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); - /* the bottom half of the translation table is the mirror image of the top */ - if (src & 0x80) - { - col = 3 - col; - xorval = 0xa8; - } - - /* decode the opcodes */ - decrypted[A+bankstart] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); - - /* decode the data */ - rom[A+bankstart] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); - } - - machine.root_device().membank("bank1")->configure_entries(0,3, machine.root_device().memregion(regiontag)->base(),0x6000); - machine.root_device().membank("bank1")->configure_decrypted_entries(0,3,decrypted,0x6000); - space.set_decrypted_region(0x0000, 0x5fff, decrypted); - space.machine().root_device().membank("bank1")->set_entry(0); -} - - -void sindbadm_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ - { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x00,0x20,0x80,0xa0 }, /* ...1...0...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ - { 0xa8,0x88,0xa0,0x80 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void regulus_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x80,0xa0,0x00,0x20 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ - { 0x80,0xa0,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ - { 0x80,0xa0,0x00,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void mrviking_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void swat_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x80,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...1...1...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...0 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...1...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...1...0...1 */ - { 0xa0,0xa8,0x80,0x88 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0xa8,0x80,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void flicky_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x08,0x88,0x00,0x80 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...1...0 */ - { 0x28,0x08,0x20,0x00 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...1...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...1...1...0 */ - { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0x88,0x28,0x08 }, /* ...1...0...0...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...0 */ - { 0xa8,0x88,0x28,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...1...0...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x88,0x80,0x08,0x00 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void futspy_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0x08,0x20,0x00 }, { 0x28,0x08,0x20,0x00 }, /* ...0...0...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...0...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...0...1...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...1 */ - { 0x28,0x08,0x20,0x00 }, { 0x88,0x80,0xa8,0xa0 }, /* ...0...1...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */ - { 0x88,0x80,0xa8,0xa0 }, { 0x28,0x08,0x20,0x00 }, /* ...1...0...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 }, /* ...1...0...1...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ - { 0x88,0x80,0xa8,0xa0 }, { 0x88,0x80,0xa8,0xa0 }, /* ...1...1...0...0 */ - { 0x80,0x00,0xa0,0x20 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x28,0x08,0x20,0x00 }, /* ...1...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void wmatch_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...0...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...1...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...0...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void bullfgtj_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa0,0xa8,0x20,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...0...0...0...0 */ - { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...0...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...0...1...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x28,0x00,0x08 }, /* ...0...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x08,0x28,0x00,0x20 }, /* ...0...1...1...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...0...1 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...0...1...1 */ - { 0x20,0x28,0x00,0x08 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ - { 0x88,0x08,0xa8,0x28 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x80,0xa0,0x00,0x20 }, /* ...1...1...1...0 */ - { 0x08,0x28,0x00,0x20 }, { 0x88,0x08,0xa8,0x28 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void pbaction_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa8,0xa0,0x88,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...1...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...0...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...0...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0xa8,0x28,0xa0,0x20 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0x28,0xa0,0x20 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void spatter_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0x00,0x08,0x20,0x28 }, /* ...0...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...1...1 */ - { 0x00,0x08,0x20,0x28 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...0 */ - { 0xa0,0x80,0x20,0x00 }, { 0x80,0x88,0x00,0x08 }, /* ...0...1...0...1 */ - { 0x88,0x08,0x80,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x28,0x20,0xa8,0xa0 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x80,0x88,0x00,0x08 }, /* ...1...0...0...0 */ - { 0x80,0x88,0x00,0x08 }, { 0x00,0x08,0x20,0x28 }, /* ...1...0...0...1 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...0 */ - { 0x00,0x08,0x20,0x28 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ - { 0x80,0x88,0x00,0x08 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...0 */ - { 0x80,0xa0,0x88,0xa8 }, { 0xa0,0x80,0x20,0x00 }, /* ...1...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...1...1...0 */ - { 0x28,0x20,0xa8,0xa0 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void jongkyo_decode(running_machine &machine, const char *cputag) -{ - /* encrypted ROM is banked */ - UINT8 *decrypted; - - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x28,0x08,0xa8,0x88 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...0...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ - { 0x20,0xa0,0x00,0x80 }, { 0x20,0xa0,0x00,0x80 }, /* ...0...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...1...1 */ - { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x20,0xa0,0x00,0x80 }, /* ...1...1...1...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x08,0x88,0x00,0x80 } /* ...1...1...1...1 */ - }; - - int A; - - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion(cputag)->base(); - decrypted = auto_alloc_array(machine, UINT8, 0x9000); - - for (A = 0x0000;A < 0x9000;A++) - { - int xorval = 0; - - UINT8 src = rom[A]; - - /* pick the translation table from bits 0, 4, 8 and 12 of the address */ - int row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3); - - /* pick the offset in the table from bits 3 and 5 of the source data */ - int col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1); - /* the bottom half of the translation table is the mirror image of the top */ - if (src & 0x80) - { - col = 3 - col; - xorval = 0xa8; - } - - /* special handling for banked area */ - if (A >= 0x7000) - row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2); - - /* decode the opcodes */ - decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval); - - /* decode the data */ - rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval); + data[A] = 0xee; } - - machine.root_device().membank("bank1")->configure_entries(0,8, machine.root_device().memregion(cputag)->base()+0x7000,0x0400); - machine.root_device().membank("bank1")->configure_decrypted_entries(0,8,decrypted+0x7000,0x0400); - space.set_decrypted_region(0x0000, 0x6bff, decrypted); - machine.root_device().membank("bank1")->set_entry(0); -} - - -void pitfall2_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x08,0x88,0x28,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0x20,0x00,0xa0,0x80 }, /* ...0...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...0 */ - { 0x28,0xa8,0x20,0xa0 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...0...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 }, /* ...1...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0x88,0xa0,0xa8 }, /* ...1...1...0...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...1...0...1 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0x80,0x88,0xa0,0xa8 }, { 0x28,0xa8,0x20,0xa0 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void nprinces_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x08,0x88,0x00,0x80 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...0...0...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x20,0x80,0x00 }, /* ...0...1...0...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */ - { 0xa0,0x20,0x80,0x00 }, { 0xa0,0x20,0x80,0x00 }, /* ...1...0...0...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void seganinj_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x28,0x20 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...0...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0xa8,0x80,0x88 }, /* ...0...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0x88,0x08,0x80,0x00 }, /* ...0...1...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x28,0x20 }, /* ...0...1...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0xa0,0xa8,0x80,0x88 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...0...1 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...0...1...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...0...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...1...0...1 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...1...1...0 */ - { 0xa8,0xa0,0x28,0x20 }, { 0x28,0x08,0xa8,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void imsorry_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0x08,0x80,0x00 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...0...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0x80,0x00 }, /* ...0...0...0...1 */ - { 0x88,0x08,0xa8,0x28 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...0...1...1 */ - { 0x00,0x20,0x80,0xa0 }, { 0x08,0x00,0x88,0x80 }, /* ...0...1...0...0 */ - { 0x00,0x20,0x80,0xa0 }, { 0x20,0x28,0xa0,0xa8 }, /* ...0...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x00,0x20,0x80,0xa0 }, /* ...0...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x88,0x08,0xa8,0x28 }, /* ...0...1...1...1 */ - { 0x88,0x08,0x80,0x00 }, { 0x08,0x00,0x88,0x80 }, /* ...1...0...0...0 */ - { 0x08,0x00,0x88,0x80 }, { 0x88,0x08,0x80,0x00 }, /* ...1...0...0...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...0 */ - { 0x88,0x08,0x80,0x00 }, { 0x08,0x28,0x00,0x20 }, /* ...1...0...1...1 */ - { 0x08,0x28,0x00,0x20 }, { 0x08,0x00,0x88,0x80 }, /* ...1...1...0...0 */ - { 0x08,0x28,0x00,0x20 }, { 0x20,0x28,0xa0,0xa8 }, /* ...1...1...0...1 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 }, /* ...1...1...1...0 */ - { 0x20,0x28,0xa0,0xa8 }, { 0x08,0x28,0x00,0x20 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void teddybb_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x28,0x00,0x08 }, { 0x80,0x00,0xa0,0x20 }, /* ...0...0...0...0 */ - { 0x20,0x28,0x00,0x08 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...0...0...1 */ - { 0x28,0x08,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...1...1 */ - { 0x20,0x28,0x00,0x08 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...0...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x80,0x00,0xa0,0x20 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0xa8,0x20,0x28 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...0 */ - { 0xa0,0x80,0xa8,0x88 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0x20,0x28,0x00,0x08 }, /* ...1...1...0...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...1 */ - { 0x80,0x00,0xa0,0x20 }, { 0xa0,0x80,0xa8,0x88 }, /* ...1...1...1...0 */ - { 0xa0,0xa8,0x20,0x28 }, { 0xa0,0x20,0xa8,0x28 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void myheroj_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...0...1 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...0...0...1...1 */ - { 0x20,0x00,0xa0,0x80 }, { 0x28,0xa8,0x08,0x88 }, /* ...0...1...0...0 */ - { 0x20,0x00,0xa0,0x80 }, { 0x08,0x88,0x00,0x80 }, /* ...0...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...0 */ - { 0x08,0x88,0x00,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...1...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...0 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x20,0x00,0xa0,0x80 }, /* ...1...0...0...1 */ - { 0x80,0xa0,0x88,0xa8 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0x80,0xa0,0x88,0xa8 }, /* ...1...0...1...1 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x08,0x88,0x00,0x80 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 }, /* ...1...1...1...0 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0xa0,0x88,0x80 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void hvymetal_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0x88,0xa8,0x80,0xa0 }, { 0xa0,0x80,0xa8,0x88 }, /* ...0...0...0...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x88,0x80,0x08,0x00 }, /* ...0...0...1...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0xa8,0x88 }, { 0x88,0x80,0x08,0x00 }, /* ...0...1...1...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x28,0x08,0xa8,0x88 }, /* ...0...1...1...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...0...1 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...1...0...1...0 */ - { 0x88,0xa8,0x80,0xa0 }, { 0x28,0x08,0xa8,0x88 }, /* ...1...0...1...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...0...0 */ - { 0xa0,0x20,0xa8,0x28 }, { 0x28,0xa8,0x08,0x88 }, /* ...1...1...0...1 */ - { 0x28,0xa8,0x08,0x88 }, { 0xa0,0x20,0xa8,0x28 }, /* ...1...1...1...0 */ - { 0x28,0x08,0xa8,0x88 }, { 0x28,0xa8,0x08,0x88 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); -} - - -void lvcards_decode(running_machine &machine, const char *cputag) -{ - static const UINT8 convtable[32][4] = - { - /* opcode data address */ - /* A B C D A B C D */ - { 0xa8,0x88,0xa0,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...0...0...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...0...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...0...1...0 */ - { 0xa8,0xa0,0x88,0x80 }, { 0xa8,0xa0,0x88,0x80 }, /* ...0...0...1...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0xa0,0x20 }, /* ...0...1...0...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...0...1...0...1 */ - { 0xa0,0x80,0x20,0x00 }, { 0xa0,0x80,0x20,0x00 }, /* ...0...1...1...0 */ - { 0xa8,0x88,0xa0,0x80 }, { 0xa8,0x88,0xa0,0x80 }, /* ...0...1...1...1 */ - { 0xa8,0x88,0xa0,0x80 }, { 0xa8,0x28,0x88,0x08 }, /* ...1...0...0...0 */ - { 0x88,0x80,0x08,0x00 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...0...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0x88,0x80,0x08,0x00 }, /* ...1...0...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x28,0x88,0x08 }, /* ...1...0...1...1 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x88,0xa0,0x80 }, /* ...1...1...0...0 */ - { 0xa8,0x88,0xa0,0x80 }, { 0x88,0x80,0x08,0x00 }, /* ...1...1...0...1 */ - { 0x88,0x80,0x08,0x00 }, { 0xa8,0x28,0x88,0x08 }, /* ...1...1...1...0 */ - { 0xa8,0x28,0x88,0x08 }, { 0xa8,0x88,0xa0,0x80 } /* ...1...1...1...1 */ - }; - - - sega_decode(machine, cputag, convtable); } diff --git a/src/mame/machine/segacrpt.h b/src/mame/machine/segacrpt.h index c0d42bad383..ba6fc16ca72 100644 --- a/src/mame/machine/segacrpt.h +++ b/src/mame/machine/segacrpt.h @@ -1,27 +1,4 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria -void buckrog_decode(running_machine &machine, const char *cputag); -void pengo_decode(running_machine &machine, const char *cputag); -void szaxxon_decode(running_machine &machine, const char *cputag); -void suprloco_decode(running_machine &machine, const char *cputag); -void yamato_decode(running_machine &machine, const char *cputag); -void toprollr_decode(running_machine &machine, const char *cputag, const char *regiontag); -void sindbadm_decode(running_machine &machine, const char *cputag); -void regulus_decode(running_machine &machine, const char *cputag); -void mrviking_decode(running_machine &machine, const char *cputag); -void swat_decode(running_machine &machine, const char *cputag); -void flicky_decode(running_machine &machine, const char *cputag); -void futspy_decode(running_machine &machine, const char *cputag); -void wmatch_decode(running_machine &machine, const char *cputag); -void bullfgtj_decode(running_machine &machine, const char *cputag); -void pbaction_decode(running_machine &machine, const char *cputag); -void spatter_decode(running_machine &machine, const char *cputag); -void jongkyo_decode(running_machine &machine, const char *cputag); -void pitfall2_decode(running_machine &machine, const char *cputag); -void nprinces_decode(running_machine &machine, const char *cputag); -void seganinj_decode(running_machine &machine, const char *cputag); -void imsorry_decode(running_machine &machine, const char *cputag); -void teddybb_decode(running_machine &machine, const char *cputag); -void myheroj_decode(running_machine &machine, const char *cputag); -void hvymetal_decode(running_machine &machine, const char *cputag); -void lvcards_decode(running_machine &machine, const char *cputag); + +void sega_decode(UINT8 *data, UINT8 *opcodes, int size, const UINT8 convtable[32][4], int bank_count = 0, int bank_size = 0); diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 5976fbc1be8..19ab5ef6906 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -179,6 +179,7 @@ sega_315_5195_mapper_device::sega_315_5195_mapper_device(const machine_config &m m_cputag(NULL), m_cpu(NULL), m_space(NULL), + m_decrypted_space(NULL), m_curregion(0) { } @@ -354,7 +355,7 @@ READ8_MEMBER( sega_315_5195_mapper_device::read ) // map_as_rom - map a region as ROM data //------------------------------------------------- -void sega_315_5195_mapper_device::map_as_rom(UINT32 offset, UINT32 length, offs_t mirror, const char *bank_name, offs_t rgnoffset, write16_delegate whandler) +void sega_315_5195_mapper_device::map_as_rom(UINT32 offset, UINT32 length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler) { // determine parameters region_info info; @@ -377,14 +378,17 @@ void sega_315_5195_mapper_device::map_as_rom(UINT32 offset, UINT32 length, offs_ // map now m_space->install_read_bank(info.start, romend, 0, info.mirror, bank_name); + if (m_decrypted_space) + m_decrypted_space->install_read_bank(info.start, romend, 0, info.mirror, decrypted_bank_name); // configure the bank memory_bank *bank = owner()->membank(bank_name); + memory_bank *decrypted_bank = owner()->membank(decrypted_bank_name); UINT8 *memptr = m_cpu->region()->base() + rgnoffset; bank->set_base(memptr); // remember this bank, and decrypt if necessary - m_banks[m_curregion].set(bank, info.start, romend, rgnoffset, memptr); + m_banks[m_curregion].set(bank, decrypted_bank, info.start, romend, rgnoffset, memptr); } // either install a write handler if provided or unmap the region @@ -524,6 +528,8 @@ void sega_315_5195_mapper_device::device_start() if (m_space == NULL) throw emu_fatalerror("Unable to find program address space on device '%s'", m_cputag); + m_decrypted_space = m_cpu->has_space(AS_DECRYPTED_OPCODES) ? &m_cpu->space(AS_DECRYPTED_OPCODES) : NULL; + // register for saves save_item(NAME(m_regs)); } @@ -597,6 +603,7 @@ void sega_315_5195_mapper_device::update_mapping() sega_315_5195_mapper_device::decrypt_bank::decrypt_bank() : m_bank(NULL), + m_decrypted_bank(NULL), m_start(0), m_end(0), m_rgnoffs(~0), @@ -647,7 +654,7 @@ void sega_315_5195_mapper_device::decrypt_bank::set_decrypt(fd1094_device *fd109 // a change //------------------------------------------------- -void sega_315_5195_mapper_device::decrypt_bank::set(memory_bank *bank, offs_t start, offs_t end, offs_t rgnoffs, UINT8 *src) +void sega_315_5195_mapper_device::decrypt_bank::set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, UINT8 *src) { // ignore if not encrypted if (m_fd1089 == NULL && m_fd1094_cache == NULL) @@ -662,6 +669,7 @@ void sega_315_5195_mapper_device::decrypt_bank::set(memory_bank *bank, offs_t st // update to the current state m_bank = bank; + m_decrypted_bank = decrypted_bank; m_start = start; m_end = end; m_rgnoffs = rgnoffs; @@ -692,12 +700,12 @@ void sega_315_5195_mapper_device::decrypt_bank::update() { m_fd1089_decrypted.resize((m_end + 1 - m_start) / 2); m_fd1089->decrypt(m_start, m_end + 1 - m_start, m_rgnoffs, &m_fd1089_decrypted[0], reinterpret_cast<UINT16 *>(m_srcptr)); - m_bank->set_base_decrypted(&m_fd1089_decrypted[0]); + m_decrypted_bank->set_base(&m_fd1089_decrypted[0]); } // fd1094 case if (m_fd1094_cache != NULL) - m_bank->set_base_decrypted(m_fd1094_cache->decrypted_opcodes(m_fd1094_cache->fd1094().state())); + m_decrypted_bank->set_base(m_fd1094_cache->decrypted_opcodes(m_fd1094_cache->fd1094().state())); } diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h index 4472e24d3db..58d772975a3 100644 --- a/src/mame/machine/segaic16.h +++ b/src/mame/machine/segaic16.h @@ -101,7 +101,7 @@ public: DECLARE_WRITE8_MEMBER( write ); // mapping helpers - void map_as_rom(UINT32 offset, UINT32 length, offs_t mirror, const char *bank_name, offs_t rgnoffset, write16_delegate whandler); + void map_as_rom(UINT32 offset, UINT32 length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler); void map_as_ram(UINT32 offset, UINT32 length, offs_t mirror, const char *bank_share_name, write16_delegate whandler); void map_as_handler(UINT32 offset, UINT32 length, offs_t mirror, read16_delegate rhandler, write16_delegate whandler); @@ -135,8 +135,8 @@ private: // configuration void set_decrypt(fd1089_base_device *fd1089); void set_decrypt(fd1094_device *fd1094); - void clear() { set(NULL, 0, 0, ~0, NULL); } - void set(memory_bank *bank, offs_t start, offs_t end, offs_t rgnoffs, UINT8 *src); + void clear() { set(NULL, NULL, 0, 0, ~0, NULL); } + void set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, UINT8 *src); // updating void update(); @@ -145,6 +145,7 @@ private: private: // internal state memory_bank * m_bank; + memory_bank * m_decrypted_bank; offs_t m_start; offs_t m_end; offs_t m_rgnoffs; @@ -168,6 +169,7 @@ private: // internal state m68000_device * m_cpu; address_space * m_space; + address_space * m_decrypted_space; UINT8 m_regs[0x20]; UINT8 m_curregion; decrypt_bank m_banks[8]; diff --git a/src/mame/machine/slapstic.c b/src/mame/machine/slapstic.c index 60f6a26233d..5adf0c91d7f 100644 --- a/src/mame/machine/slapstic.c +++ b/src/mame/machine/slapstic.c @@ -821,7 +821,7 @@ int atari_slapstic_device::alt2_kludge(address_space &space, offs_t offset) if (MATCHES_MASK_VALUE(space.device().safe_pc() >> 1, slapstic.alt1)) { /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */ - UINT16 opcode = space.direct().read_decrypted_word(space.device().safe_pcbase() & 0xffffff); + UINT16 opcode = space.direct().read_word(space.device().safe_pcbase() & 0xffffff); if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148) { /* fetch the value of the register for the second operand, and see */ diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index ff6e07476a5..f0aba6a01c3 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -39,18 +39,14 @@ Encryption PAL 16R4 on CPU board DRIVER_INIT_MEMBER(stfight_state,empcity) { - address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); - m_decrypt = auto_alloc_array(machine(), UINT8, 0x8000); - space.set_decrypted_region(0x0000, 0x7fff, m_decrypt); - for (UINT32 A = 0; A < 0x8000; ++A) { UINT8 src = rom[A]; // decode opcode - m_decrypt[A] = + m_decrypted_opcodes[A] = ( src & 0xA6 ) | ( ( ( ( src << 2 ) ^ src ) << 3 ) & 0x40 ) | ( ~( ( src ^ ( A >> 1 ) ) >> 2 ) & 0x10 ) | diff --git a/src/mame/mess.lst b/src/mame/mess.lst index a9c1ac317bd..53391328d72 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -423,8 +423,11 @@ dsp5500 // Apollo Server DSP5500 (1991) apple1 // Jul 1976 Apple 1 apple2 // Apr 1977 Apple ][ apple2p // Jun 1979 Apple ][+ +elppa // 198? Victor do Brasil Elppa II+ prav82 // Pravetz 82 prav8m // Pravetz 8M +uniap2en // 1982 Unitron AP II (in English) +uniap2pt // 1982 Unitron AP II (in Brazilian Portuguese) apple2jp // ??? ???? Apple ][j+ apple2e // Jan 1983 Apple //e apple2euk // Jan 1983 Apple //e (UK) diff --git a/src/mame/nl.lst b/src/mame/nl.lst index 904db249b13..67723374e4b 100644 --- a/src/mame/nl.lst +++ b/src/mame/nl.lst @@ -29,4 +29,3 @@ pong // (c) 1972 Atari pongd // (c) 1975 Atari pongf // (c) 1972 Atari breakout // (c) 1976 Atari - diff --git a/src/mame/video/battlera.c b/src/mame/video/battlera.c deleted file mode 100644 index 2e3489c3610..00000000000 --- a/src/mame/video/battlera.c +++ /dev/null @@ -1,3 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -// delete me diff --git a/src/mame/video/cclimber.c b/src/mame/video/cclimber.c index 80c614148aa..f8574855a67 100644 --- a/src/mame/video/cclimber.c +++ b/src/mame/video/cclimber.c @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria /*************************************************************************** - video.c + cclimber.c Functions to emulate the video hardware of the machine. diff --git a/src/mame/video/gaelco3d.c b/src/mame/video/gaelco3d.c index 4b445d40234..f0b45a94ee9 100644 --- a/src/mame/video/gaelco3d.c +++ b/src/mame/video/gaelco3d.c @@ -224,11 +224,11 @@ void gaelco3d_renderer::render_noz_noperspective(INT32 scanline, const extent_t int pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; if (pixeloffs >= m_texmask_size || !m_texmask[pixeloffs]) { - rgb_t rgb00 = palsource[m_texture[pixeloffs]]; - rgb_t rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; - rgb_t rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; - rgb_t rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - UINT32 filtered = rgb_bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); + UINT32 rgb00 = palsource[m_texture[pixeloffs]]; + UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; + UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; + UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); dest[x] = (filtered & 0x1f) | ((filtered & 0x1ff800) >> 6); zbuf[x] = zbufval; } @@ -271,11 +271,11 @@ void gaelco3d_renderer::render_normal(INT32 scanline, const extent_t &extent, co int pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; if (pixeloffs >= m_texmask_size || !m_texmask[pixeloffs]) { - rgb_t rgb00 = palsource[m_texture[pixeloffs]]; - rgb_t rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; - rgb_t rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; - rgb_t rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - UINT32 filtered = rgb_bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); + UINT32 rgb00 = palsource[m_texture[pixeloffs]]; + UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; + UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; + UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); dest[x] = (filtered & 0x1f) | ((filtered & 0x1ff800) >> 6); zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; } @@ -321,11 +321,11 @@ void gaelco3d_renderer::render_alphablend(INT32 scanline, const extent_t &extent int pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; if (pixeloffs >= m_texmask_size || !m_texmask[pixeloffs]) { - rgb_t rgb00 = palsource[m_texture[pixeloffs]]; - rgb_t rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; - rgb_t rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; - rgb_t rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - UINT32 filtered = rgb_bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v) >> 1; + UINT32 rgb00 = palsource[m_texture[pixeloffs]]; + UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; + UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; + UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v) >> 1; dest[x] = ((filtered & 0x0f) | ((filtered & 0x0f7800) >> 6)) + ((dest[x] >> 1) & 0x3def); zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; } diff --git a/src/mame/video/gaplus.c b/src/mame/video/gaplus.c index 58ceda4e4b3..491316ae7ac 100644 --- a/src/mame/video/gaplus.c +++ b/src/mame/video/gaplus.c @@ -2,7 +2,7 @@ // copyright-holders:Manuel Abadia, Ernesto Corvi, Nicola Salmoria /*************************************************************************** - video.c + gaplus.c Functions to emulate the video hardware of the machine. @@ -183,6 +183,15 @@ void gaplus_state::video_start() m_bg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0xff); starfield_init(); + + save_item(NAME(m_starfield_control)); + + for (int i = 0; i < MAX_STARS; i++) + { + save_item(NAME(m_stars[i].x), i); + save_item(NAME(m_stars[i].y), i); + // col and set aren't changed after init + } } @@ -193,18 +202,13 @@ void gaplus_state::video_start() ***************************************************************************/ -READ8_MEMBER(gaplus_state::gaplus_videoram_r) -{ - return m_videoram[offset]; -} - -WRITE8_MEMBER(gaplus_state::gaplus_videoram_w) +WRITE8_MEMBER(gaplus_state::videoram_w) { m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE8_MEMBER(gaplus_state::gaplus_starfield_control_w) +WRITE8_MEMBER(gaplus_state::starfield_control_w) { offset &= 3; m_starfield_control[offset] = data; @@ -298,7 +302,7 @@ void gaplus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect } } -UINT32 gaplus_state::screen_update_gaplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 gaplus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* flip screen control is embedded in RAM */ flip_screen_set(m_spriteram[0x1f7f-0x800] & 1); @@ -319,7 +323,7 @@ UINT32 gaplus_state::screen_update_gaplus(screen_device &screen, bitmap_ind16 &b } -void gaplus_state::screen_eof_gaplus(screen_device &screen, bool state)/* update starfields */ +void gaplus_state::screen_eof(screen_device &screen, bool state)/* update starfields */ { // falling edge if (!state) diff --git a/src/mame/video/m62.c b/src/mame/video/m62.c index 87b994a0cd1..50c8cd2356a 100644 --- a/src/mame/video/m62.c +++ b/src/mame/video/m62.c @@ -92,14 +92,14 @@ static const res_net_info m62_sprite_net_info = }; -/* this is a complete guess */ static const res_net_info battroad_char_net_info = { RES_NET_VCC_5V | RES_NET_VIN_TTL_OUT, { + { RES_NET_AMP_NONE, 0, 0, 2, { 470, 220 } }, { RES_NET_AMP_NONE, 0, 0, 3, { 1000, 470, 220 } }, - { RES_NET_AMP_NONE, 0, 0, 3, { 1000, 470, 220 } }, - { RES_NET_AMP_NONE, 0, 0, 2, { 470, 220 } } + { RES_NET_AMP_NONE, 0, 0, 3, { 1000, 470, 220 } } + } }; @@ -155,8 +155,8 @@ static const res_net_decode_info battroad_char_decode_info = 0x000, 0x01f, /* start/end */ /* R G B */ { 0x600, 0x600, 0x600 }, /* offsets */ - { 0, 3, 6 }, /* shifts */ - { 0x07, 0x07, 0x03 } /* masks */ + { 6, 3, 0 }, /* shifts */ + { 0x03, 0x07, 0x07 } /* masks */ }; @@ -292,7 +292,7 @@ void m62_state::register_savestate( ) WRITE8_MEMBER(m62_state::m62_flipscreen_w) { /* screen flip is handled both by software and hardware */ - data ^= ~ioport("DSW2")->read() & 1; + data ^= ((~ioport("DSW2")->read()) & 1); m_flipscreen = data & 0x01; if (m_flipscreen) @@ -302,6 +302,10 @@ WRITE8_MEMBER(m62_state::m62_flipscreen_w) coin_counter_w(machine(), 0, data & 2); coin_counter_w(machine(), 1, data & 4); + + /* Sound inhibit ... connected to D6 which is not present on any board */ + if (m_audio->m_audio_SINH != NULL) + m_audio->m_audio_SINH->write((data >> 3) & 1); } WRITE8_MEMBER(m62_state::m62_hscroll_low_w) diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index 28582266053..da34aa8da44 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -1305,12 +1305,11 @@ static void render_poly_texture(void *dest, INT32 scanline, const poly_extent *e rgb_t color1 = WAVERAM_READ16(palbase, texel1); rgb_t color2 = WAVERAM_READ16(palbase, texel2); rgb_t color3 = WAVERAM_READ16(palbase, texel3); - rgb_t filtered; color0 = ((color0 & 0x7fe0) << 6) | (color0 & 0x1f); color1 = ((color1 & 0x7fe0) << 6) | (color1 & 0x1f); color2 = ((color2 & 0x7fe0) << 6) | (color2 & 0x1f); color3 = ((color3 & 0x7fe0) << 6) | (color3 & 0x1f); - filtered = rgb_bilinear_filter(color0, color1, color2, color3, curu, curv); + rgb_t filtered = rgbaint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f)); *depthptr = depth; } diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index 99da14a5275..db96c9bf8e4 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -1289,16 +1289,15 @@ static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *exte UINT8 texel3 = get_texel_8bit(texbase, v1, u1, texwidth); if (texel0 != transcolor) { - rgb_t color0 = WAVERAM_READ16(palbase, texel0); - rgb_t color1 = WAVERAM_READ16(palbase, texel1); - rgb_t color2 = WAVERAM_READ16(palbase, texel2); - rgb_t color3 = WAVERAM_READ16(palbase, texel3); - rgb_t filtered; + UINT32 color0 = WAVERAM_READ16(palbase, texel0); + UINT32 color1 = WAVERAM_READ16(palbase, texel1); + UINT32 color2 = WAVERAM_READ16(palbase, texel2); + UINT32 color3 = WAVERAM_READ16(palbase, texel3); color0 = ((color0 & 0x7c00) << 9) | ((color0 & 0x3e0) << 6) | ((color0 & 0x1f) << 3); color1 = ((color1 & 0x7c00) << 9) | ((color1 & 0x3e0) << 6) | ((color1 & 0x1f) << 3); color2 = ((color2 & 0x7c00) << 9) | ((color2 & 0x3e0) << 6) | ((color2 & 0x1f) << 3); color3 = ((color3 & 0x7c00) << 9) | ((color3 & 0x3e0) << 6) | ((color3 & 0x1f) << 3); - filtered = rgb_bilinear_filter(color0, color1, color2, color3, curu, curv); + rgb_t filtered = rgbaint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, filtered); *depthptr = depth; } diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c index 70da1deaacf..4a1458d533a 100644 --- a/src/mame/video/model3.c +++ b/src/mame/video/model3.c @@ -5,6 +5,18 @@ #include "video/rgbutil.h" #include "includes/model3.h" +/* + TODO: + - Tilemap flash effect + - Fog + - Mipmapping + - Mipmap uploads smaller than a tile + - Some of the 4-bit and 8-bit textures need their alpha values rechecked + - Spotlights + - Recheck normal vector transform + +*/ + #define ENABLE_BILINEAR 1 #define TRI_PARAM_TEXTURE_PAGE 0x1 @@ -12,8 +24,9 @@ #define TRI_PARAM_TEXTURE_MIRROR_V 0x4 #define TRI_PARAM_TEXTURE_ENABLE 0x8 #define TRI_PARAM_ALPHA_TEST 0x10 +#define TRI_PARAM_COLOR_MOD 0x20 -#define TRI_BUFFER_SIZE 35000 +#define TRI_BUFFER_SIZE 50000 #define TRI_ALPHA_BUFFER_SIZE 15000 struct model3_polydata @@ -41,7 +54,9 @@ public: void clear_fb(); void clear_zb(); void draw_scanline_solid(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); + void draw_scanline_solid_trans(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); + void draw_scanline_tex_colormod(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_contour(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_trans(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_alpha(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); @@ -136,7 +151,7 @@ void model3_state::video_start() static const gfx_layout char4_layout = { 8, 8, - 30720, + 31744, 4, { 0,1,2,3 }, { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, @@ -147,7 +162,7 @@ void model3_state::video_start() static const gfx_layout char8_layout = { 8, 8, - 15360, + 15872, 8, { 0,1,2,3,4,5,6,7 }, { 4*8, 5*8, 6*8, 7*8, 0*8, 1*8, 2*8, 3*8 }, @@ -183,12 +198,6 @@ void model3_state::video_start() m_vid_reg0 = 0; - m_viewport_focal_length = 300.; - m_viewport_region_x = 0; - m_viewport_region_y = 0; - m_viewport_region_width = 496; - m_viewport_region_height = 384; - m_layer4[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer0_4bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_layer8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer0_8bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_layer4[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer1_4bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); @@ -253,14 +262,18 @@ void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cli } #endif -void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int bitdepth, int sx, int sy) +void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int sx, int sy, int prio) { + int bitdepth = (m_layer_priority & (0x10 << layer)) ? 1 : 0; +// int layer_prio = (m_layer_priority & (0x1 << layer)) ? 1 : 0; + tilemap_t *tmap = bitdepth ? m_layer4[layer] : m_layer8[layer]; bitmap_ind16 &pixmap = tmap->pixmap(); const pen_t *pens = m_palette->pens(); UINT32* palram = (UINT32*)&m_paletteram64[0]; UINT16* rowscroll_ram = (UINT16*)&m_m3_char_ram[0x1ec00]; + UINT32* rowmask_ram = (UINT32*)&m_m3_char_ram[0x1ee00]; int x1 = cliprect.min_x; int y1 = cliprect.min_y; @@ -287,6 +300,12 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i if (rowscroll & 0x100) rowscroll |= ~0x1ff; + UINT16 rowmask; + if (prio && (layer == 1 || layer == 2)) + rowmask = BYTE_REVERSE32(rowmask_ram[(y & 0x1ff) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]) & 0xffff; + else + rowmask = 0xffff; + int iix = ix & 0x1ff; int rx1 = x1 - (rowscroll * 2); @@ -302,10 +321,15 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i for (int x = rx1; x <= rx2; x++) { - UINT16 p0 = src[iix & 0x1ff]; - if ((palram[p0^NATIVE_ENDIAN_VALUE_LE_BE(1,0)] & NATIVE_ENDIAN_VALUE_LE_BE(0x00800000,0x00008000)) == 0) + UINT32 mask = rowmask & (1 << ((iix & 0x1ff) >> 5)); + + if (mask) { - dst[x] = pens[p0]; + UINT16 p0 = src[iix & 0x1ff]; + if ((palram[p0^NATIVE_ENDIAN_VALUE_LE_BE(1,0)] & NATIVE_ENDIAN_VALUE_LE_BE(0x00800000,0x00008000)) == 0) + { + dst[x] = pens[p0]; + } } iix++; } @@ -339,26 +363,26 @@ UINT32 model3_state::screen_update_model3(screen_device &screen, bitmap_rgb32 &b // render enabled layers with priority 0 if ((layer_data[3] & 0x80000000) && (m_layer_priority & 0x8) == 0) - draw_layer(bitmap, cliprect, 3, m_layer_priority & 0x80, layer_scroll_x[3], layer_scroll_y[3]); + draw_layer(bitmap, cliprect, 3, layer_scroll_x[3], layer_scroll_y[3], 0); if ((layer_data[2] & 0x80000000) && (m_layer_priority & 0x4) == 0) - draw_layer(bitmap, cliprect, 2, m_layer_priority & 0x40, layer_scroll_x[2], layer_scroll_y[2]); + draw_layer(bitmap, cliprect, 2, layer_scroll_x[2], layer_scroll_y[2], 0); if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) == 0) - draw_layer(bitmap, cliprect, 1, m_layer_priority & 0x20, layer_scroll_x[1], layer_scroll_y[1]); + draw_layer(bitmap, cliprect, 1, layer_scroll_x[1], layer_scroll_y[1], 0); if ((layer_data[0] & 0x80000000) && (m_layer_priority & 0x1) == 0) - draw_layer(bitmap, cliprect, 0, m_layer_priority & 0x10, layer_scroll_x[0], layer_scroll_y[0]); + draw_layer(bitmap, cliprect, 0, layer_scroll_x[0], layer_scroll_y[0], 0); // render 3D m_renderer->draw(bitmap, cliprect); // render enabled layers with priority 1 if ((layer_data[3] & 0x80000000) && (m_layer_priority & 0x8) != 0) - draw_layer(bitmap, cliprect, 3, m_layer_priority & 0x80, layer_scroll_x[3], layer_scroll_y[3]); + draw_layer(bitmap, cliprect, 3, layer_scroll_x[3], layer_scroll_y[3], 1); if ((layer_data[2] & 0x80000000) && (m_layer_priority & 0x4) != 0) - draw_layer(bitmap, cliprect, 2, m_layer_priority & 0x40, layer_scroll_x[2], layer_scroll_y[2]); - if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) != 0) - draw_layer(bitmap, cliprect, 1, m_layer_priority & 0x20, layer_scroll_x[1], layer_scroll_y[1]); + draw_layer(bitmap, cliprect, 2, layer_scroll_x[2], layer_scroll_y[2], 1); if ((layer_data[0] & 0x80000000) && (m_layer_priority & 0x1) != 0) - draw_layer(bitmap, cliprect, 0, m_layer_priority & 0x10, layer_scroll_x[0], layer_scroll_y[0]); + draw_layer(bitmap, cliprect, 0, layer_scroll_x[0], layer_scroll_y[0], 1); + if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) != 0) + draw_layer(bitmap, cliprect, 1, layer_scroll_x[1], layer_scroll_y[1], 1); return 0; } @@ -422,7 +446,8 @@ WRITE64_MEMBER(model3_state::model3_tile_w) 0xF1180010: VBL IRQ acknowledge - 0xF1180020: -------- x------- -------- -------- Layer 3 bitdepth (0 = 8-bit, 1 = 4-bit) + 0xF1180020: xxxxxxxx -------- -------- -------- ? + -------- x------- -------- -------- Layer 3 bitdepth (0 = 8-bit, 1 = 4-bit) -------- -x------ -------- -------- Layer 2 bitdepth (0 = 8-bit, 1 = 4-bit) -------- --x----- -------- -------- Layer 1 bitdepth (0 = 8-bit, 1 = 4-bit) -------- ---x---- -------- -------- Layer 0 bitdepth (0 = 8-bit, 1 = 4-bit) @@ -571,50 +596,53 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw } break; - case 1: /* 4-bit grayscale in low nibble */ + case 1: /* A4L4 interleaved */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 0); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit(texsrc[x] & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 4) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; - case 2: /* 4-bit grayscale in 2nd nibble */ + case 2: /* A4L4? */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 4); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit((texsrc[x] >> 0) & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 4) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; - case 3: /* 4-bit grayscale in 3rd nibble */ + case 3: /* A4L4 interleaved */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 8); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit((texsrc[x] >> 8) & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 12) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; case 4: /* 8-bit A4L4 */ for (x = 0; x < pixwidth; x++) { - UINT8 pixdata = texsrc[x / 2] >> ((~x & 1) * 8); - alpha &= dest[x] = rgb_t(pal4bit(pixdata >> 4), pal4bit(~pixdata), pal4bit(~pixdata), pal4bit(~pixdata)); + UINT8 pixdata = texsrc[x] >> 8; + alpha &= dest[x] = rgb_t(pal4bit(pixdata), pal4bit(pixdata >> 4), pal4bit(pixdata >> 4), pal4bit(pixdata >> 4)); } break; - case 5: /* 8-bit grayscale */ + case 5: /* L8 */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = texsrc[x / 2] >> ((~x & 1) * 8); + UINT8 grayvalue = texsrc[x]; alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); } break; - case 6: /* 4-bit grayscale in high nibble */ + case 6: /* L8 */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 12); + UINT8 grayvalue = texsrc[x] >> 8; alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); } break; @@ -688,23 +716,23 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw 0x01: Child node pointer (inherits parameters from this node) 0x02: Sibling node pointer - 0x03: Unknown (float) + 0x03: (float) Focal length? Affected by frustum angles and viewport size 0x04: Sun light vector Z-component (float) 0x05: Sun light vector X-component (float) 0x06: Sun light vector Y-component (float) 0x07: Sun light intensity (float) - 0x08: Far Clip plane Z - 0x09: Far Clip plane Distance - 0x0a: Near Clip plane Z - 0x0b: Near Clip plane Distance - 0x0c: Left Clip plane Z - 0x0d: Left Clip plane X - 0x0e: Top Clip plane Z - 0x0f: Top Clip plane Y - 0x10: Right Clip plane Z - 0x11: Right Clip plane X - 0x12: Bottom Clip plane Z - 0x13: Bottom Clip plane Y + 0x08: ? (float) Affected by left and right angle + 0x09: ? (float) Affected by top and bottom angle + 0x0a: ? (float) Affected by top and bottom angle + 0x0b: ? (float) Affected by left and right angle + 0x0c: (float) Frustum Left Angle Y (these angles are defined in polar coordinates) + 0x0d: (float) Frustum Left Angle X + 0x0e: (float) Frustum Top Angle Y + 0x0f: (float) Frustum Top Angle X + 0x10: (float) Frustum Right Angle Y + 0x11: (float) Frustum Right Angle X + 0x12: (float) Frustum Bottom Angle Y + 0x13: (float) Frustum Bottom Angle X 0x14: xxxxxxxx xxxxxxxx -------- -------- Viewport height (14.2 fixed-point) -------- -------- xxxxxxxx xxxxxxxx Viewport width (14.2 fixed-point) @@ -735,7 +763,7 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw -------- -------- -----xxx -------- Light RGB Fog (RGB111?) -------- -------- -------- xxxxxxxx Scroll Fog (0.8 fixed-point?) What is this??? - 0x21: ? + 0x21: ? seen 8.0, 0.125, 1000000000.0 0x22: Fog Color (RGB888) 0x23: Fog Density (float) @@ -818,19 +846,24 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw Polygon Data - 0x00: -------- xxxxxxxx xxxxxx-- -------- Polygon ID + 0x00: x------- -------- -------- -------- Supermodel says specular enable + -xxxxx-- -------- -------- -------- ? + ------xx xxxxxxxx xxxxxx-- -------- Polygon ID -------- -------- -------- -x------ 0 = Triangle, 1 = Quad -------- -------- -------- ----x--- Vertex 3 shared from previous polygon -------- -------- -------- -----x-- Vertex 2 shared from previous polygon -------- -------- -------- ------x- Vertex 1 shared from previous polygon -------- -------- -------- -------x Vertex 0 shared from previous polygon - xxxxxxxx -------- -------- x-xx---- ? + -------- -------- -------- x-xx---- ? -------- -------- ------xx -------- Broken polygons in srally2 set these (a way to mark them for HW to not render?) 0x01: xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal X coordinate (2.22 fixed point) -------- -------- -------- -x------ UV format (0 = 13.3, 1 = 16.0) + -------- -------- -------- ---x---- 1 = Double-sided polygon -------- -------- -------- -----x-- If set, this is the last polygon - -------- -------- -------- x-xxx-xx ? + -------- -------- -------- ------x- Poly color, 1 = RGB, 0 = color table + -------- -------- -------- x-x-x--x ? + 0x02: xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Y coordinate (2.22 fixed point) -------- -------- -------- ------x- Texture U mirror enable @@ -844,7 +877,8 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw 0x04: xxxxxxxx xxxxxxxx xxxxxxxx -------- Color (RGB888) -------- -------- -------- -x------ Texture page -------- -------- -------- ---xxxxx Upper 5 bits of texture U coordinate - -------- -------- -------- x-x----- ? + -------- -------- -------- x------- ? + -------- -------- -------- --x----- ? 0x05: xxxxxxxx xxxxxxxx xxxxxxxx -------- Specular color? -------- -------- -------- x------- Low bit of texture U coordinate @@ -852,15 +886,28 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw -------- -------- -------- -xx----- ? 0x06: x------- -------- -------- -------- Texture contour enable - -xxxxxxx -------- -------- -------- Specularity? + -xxxxx-- -------- -------- -------- Fixed shading? + ------x- -------- -------- -------- Enable fixed shading? + -------x -------- -------- -------- Could be high priority polygon? -------- x------- -------- -------- 1 = disable transparency? - -------- -xxxxx-- -------- -------- Polygon transparency (0 = fully transparent) + -------- -xxxxx-- -------- -------- Polygon translucency (0 = fully transparent) -------- -------x -------- -------- 1 = disable lighting - -------- -------- xxxxx--- -------- Polygon luminosity + -------- -------- xxxxx--- -------- Polygon light modifier (Amount that a luminous polygon will burn through fog. + Valid range is 0.0 to 1.0. 0.0 is completely fogged; + 1.0 has no fog.) -------- -------- -----x-- -------- Texture enable -------- -------- ------xx x------- Texture format -------- -------- -------- -------x Alpha enable? - -------- ------x- -------- -xxxxxx- ? + -------- ------x- -------- -------- Never seen set? + -------- -------- -------- -----xx- Always set? + -------- -------- -------- -xxxx--- ? + + TODO: Bits to find (from Real3D dev guide): + SetHighPriority(): Indicates that the polygon has higher priority than others in scene + PolygonIsLayered(): Indicates a stencil polygon. + DoSmoothShading(): Indicates that the polygon will be smooth shaded + void SetNPScale ( float np_scale ) ; Sets the texture lod scale for the polygon. A value greater than 1 will increase the + range of the transition of texture level of detail. Vertex entry @@ -904,7 +951,7 @@ WRITE64_MEMBER(model3_state::real3d_polygon_ram_w) } } -static const UINT8 texture_decode[64] = +static const UINT8 texture_decode16[64] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15, @@ -916,6 +963,18 @@ static const UINT8 texture_decode[64] = 50, 51, 54, 55, 58, 59, 62, 63 }; +static const UINT8 texture_decode8[32] = +{ + 1, 3, 5, 7, + 0, 2, 4, 6, + 9, 11, 13, 15, + 8, 10, 12, 14, + 17, 19, 21, 23, + 16, 18, 20, 22, + 25, 27, 29, 31, + 24, 26, 28, 30 +}; + inline void model3_state::write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data) { int x,y,i,j; @@ -928,7 +987,7 @@ inline void model3_state::write_texture16(int xpos, int ypos, int width, int hei int b = 0; for(j=y; j < y+8; j++) { for(i=x; i < x+8; i++) { - *texture++ = data[texture_decode[b^1]]; + *texture++ = data[texture_decode16[b^1]]; ++b; } texture += 2048-8; @@ -938,28 +997,76 @@ inline void model3_state::write_texture16(int xpos, int ypos, int width, int hei } } -#ifdef UNUSED_FUNCTION -inline void model3_state::write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data) +inline void model3_state::write_texture8(int xpos, int ypos, int width, int height, int page, int upper, int lower, UINT16 *data) { int x,y,i,j; - UINT16 color = 0x7c00; - for(y=ypos; y < ypos+(height/2); y+=4) + for(y=ypos; y < ypos+height; y+=8) { for(x=xpos; x < xpos+width; x+=8) { UINT16 *texture = &m_texture_ram[page][y*2048+x]; - for(j=y; j < y+4; j++) { - for(i=x; i < x+8; i++) { - *texture = color; + int b = 0; + for(j=y; j < y+8; j++) + { + for(i=x; i < x+8; i+=2) + { + UINT16 d = data[texture_decode8[b]]; + + if (upper) + *texture = (*texture & 0xff) | (d & 0xff00); + if (lower) + *texture = (*texture & 0xff00) | ((d >> 8) & 0xff); + texture++; + + if (upper) + *texture = (*texture & 0xff) | ((d & 0xff) << 8); + if (lower) + *texture = (*texture & 0xff00) | (d & 0xff); texture++; + + ++b; } texture += 2048-8; } + data += 32; } } } -#endif + +/* + Texture header: + + -------- -------- -------- --xxxxxx X-position + -------- -------- ----xxxx x------- Y-position + -------- -------x xx------ -------- Width + -------- ----xxx- -------- -------- Height + -------- ---x---- -------- -------- Texture page + -------- --x----- -------- -------- Write 8-bit data to the lower byte of texel + -------- -x------ -------- -------- Write 8-bit data to the upper byte of texel + -------- x------- -------- -------- Bitdepth, 0 = 8-bit, 1 = 16-bit + xxxxxxxx -------- -------- -------- Texture type + 0x00 = texture with mipmaps + 0x01 = texture without mipmaps + 0x02 = only mipmaps + 0x80 = possibly gamma table + +*/ + +static const int mipmap_coords[9][2] = +{ + { 1024, 512 }, + { 1536, 768 }, + { 1792, 896 }, + { 1920, 960 }, + { 1984, 992 }, + { 2016, 1008 }, + { 2032, 1016 }, + { 2040, 1020 }, + { 2044, 1022 }, +}; + +static const int mipmap_divider[9] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; void model3_state::real3d_upload_texture(UINT32 header, UINT32 *data) { @@ -968,36 +1075,100 @@ void model3_state::real3d_upload_texture(UINT32 header, UINT32 *data) int xpos = (header & 0x3f) * 32; int ypos = ((header >> 7) & 0x1f) * 32; int page = (header >> 20) & 0x1; - //int bitdepth = (header >> 23) & 0x1; + int bitdepth = (header >> 23) & 0x1; + int upper_byte = (header >> 22) & 0x1; + int lower_byte = (header >> 21) & 0x1; + + //printf("write tex: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); switch(header >> 24) { case 0x00: /* Texture with mipmaps */ - //if(bitdepth) { - write_texture16(xpos, ypos, width, height, page, (UINT16*)data); - invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); - //} else { - /* TODO: 8-bit textures are weird. need to figure out some additional bits */ - //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header); - //write_texture8(xpos, ypos, width, height, page, (UINT16*)data); - //} + { + int x = xpos; + int y = ypos; + int w = width; + int h = height; + + int mipmap = 0; + + while (w >= 8 && h >= 8) + { + if (bitdepth) + { + write_texture16(x, y, w, h, page, (UINT16*)data); + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(x, y, w, h, page, upper_byte, lower_byte, (UINT16*)data); + } + + data += (w * h * (bitdepth ? 2 : 1)) / 4; + w /= 2; + h /= 2; + + x = mipmap_coords[mipmap][0] + (xpos / mipmap_divider[mipmap]); + y = mipmap_coords[mipmap][1] + (ypos / mipmap_divider[mipmap]); + mipmap++; + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x01: /* Texture without mipmaps */ - //if(bitdepth) { + { + if (bitdepth) + { write_texture16(xpos, ypos, width, height, page, (UINT16*)data); - invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); - //} else { - /* TODO: 8-bit textures are weird. need to figure out some additional bits */ - //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header); - //write_texture8(xpos, ypos, width, height, page, (UINT16*)data); - //} + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(xpos, ypos, width, height, page, upper_byte, lower_byte, (UINT16*)data); + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x02: /* Only mipmaps */ + { + int x = mipmap_coords[0][0] + (xpos / mipmap_divider[0]); + int y = mipmap_coords[0][1] + (ypos / mipmap_divider[0]); + int w = width / 2; + int h = height / 2; + + int mipmap = 1; + + while (w >= 8 && h >= 8) + { + if (bitdepth) + { + write_texture16(x, y, w, h, page, (UINT16*)data); + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(x, y, w, h, page, upper_byte, lower_byte, (UINT16*)data); + } + + data += (w * h * (bitdepth ? 2 : 1)) / 4; + w /= 2; + h /= 2; + + x = mipmap_coords[mipmap][0] + (xpos / mipmap_divider[mipmap]); + y = mipmap_coords[mipmap][1] + (ypos / mipmap_divider[mipmap]); + mipmap++; + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x80: /* Gamma-table ? */ break; default: - fatalerror("Unknown texture type: %02X\n", header >> 24); + fatalerror("Unknown texture type: %02X (%08X)\n", header >> 24, header); + break; } } @@ -1022,13 +1193,6 @@ void model3_state::real3d_display_list_end() reset_triangle_buffers(); real3d_traverse_display_list(); - /* - m_renderer->draw_opaque_triangles(m_tri_buffer, m_tri_buffer_ptr); - m_renderer->draw_alpha_triangles(m_tri_alpha_buffer, m_tri_alpha_buffer_ptr); - - m_renderer->wait_for_polys(); - */ - for (int i=0; i < 4; i++) { int ticount, tiacount; @@ -1241,78 +1405,145 @@ void model3_state::translate_matrix_stack(float x, float y, float z) matrix_multiply(tm, m_matrix_stack[m_matrix_stack_ptr], &m_matrix_stack[m_matrix_stack_ptr]); } +void model3_state::set_projection(float left, float right, float top, float bottom, float near, float far) +{ + float l = near * tanf(left * 0.5f); + float r = near * tanf(right * 0.5f); + float t = near * tanf(top * 0.5f ); + float b = near * tanf(bottom * 0.5f); + + m_projection_matrix[0][0] = (2.0f * near) / (l - r); + m_projection_matrix[0][1] = 0.0f; + m_projection_matrix[0][2] = (r + l) / (r - l); + m_projection_matrix[0][3] = 0.0f; + m_projection_matrix[1][0] = 0.0f; + m_projection_matrix[1][1] = (2.0f * near) / (t - b); + m_projection_matrix[1][2] = (t + b) / (t - b); + m_projection_matrix[1][3] = 0.0f; + m_projection_matrix[2][0] = 0.0f; + m_projection_matrix[2][1] = 0.0f; + m_projection_matrix[2][2] = -(far + near) / (far - near); + m_projection_matrix[2][3] = -(2.0f * far * near) / (far - near); + m_projection_matrix[3][0] = 0.0f; + m_projection_matrix[3][1] = 0.0f; + m_projection_matrix[3][2] = -1.0f; + m_projection_matrix[3][3] = 0.0f; +} + /*****************************************************************************/ /* transformation and rasterizing */ -INLINE bool is_point_inside(float x, float y, float z, m3_plane cp) +static int clip_w(const m3_clip_vertex* v, int num_vertices, m3_clip_vertex* out) { - float s = (x * cp.x) + (y * cp.y) + (z * cp.z) + cp.d; - if (s >= 0.0f) - return true; - else - return false; -} + if (num_vertices <= 0) + return 0; -INLINE float line_plane_intersection(const m3_clip_vertex *v1, const m3_clip_vertex *v2, m3_plane cp) -{ - float x = v1->x - v2->x; - float y = v1->y - v2->y; - float z = v1->z - v2->z; - float t = ((cp.x * v1->x) + (cp.y * v1->y) + (cp.z * v1->z)) / ((cp.x * x) + (cp.y * y) + (cp.z * z)); - return t; -} + const float W_PLANE = 0.000001f; -static int clip_polygon(const m3_clip_vertex *v, int num_vertices, m3_plane cp, m3_clip_vertex *vout) -{ m3_clip_vertex clipv[10]; int clip_verts = 0; - float t; - int i; int previ = num_vertices - 1; - for (i=0; i < num_vertices; i++) + for (int i=0; i < num_vertices; i++) { - bool v1_in = is_point_inside(v[i].x, v[i].y, v[i].z, cp); - bool v2_in = is_point_inside(v[previ].x, v[previ].y, v[previ].z, cp); + int v1_side = (v[i].w < W_PLANE) ? -1 : 1; + int v2_side = (v[previ].w < W_PLANE) ? -1 : 1; - if (v1_in && v2_in) /* edge is completely inside the volume */ + if ((v1_side * v2_side) < 0) // edge goes through W plane { - clipv[clip_verts] = v[i]; + // insert vertex at intersection point + float wdiv = v[previ].w - v[i].w; + if (wdiv == 0.0f) // 0 edge means degenerate polygon + return 0; + + float t = fabs((W_PLANE - v[previ].w) / wdiv); + + clipv[clip_verts].x = v[previ].x + ((v[i].x - v[previ].x) * t); + clipv[clip_verts].y = v[previ].y + ((v[i].y - v[previ].y) * t); + clipv[clip_verts].z = v[previ].z + ((v[i].z - v[previ].z) * t); + clipv[clip_verts].w = v[previ].w + ((v[i].w - v[previ].w) * t); + clipv[clip_verts].u = v[previ].u + ((v[i].u - v[previ].u) * t); + clipv[clip_verts].v = v[previ].v + ((v[i].v - v[previ].v) * t); + clipv[clip_verts].i = v[previ].i + ((v[i].i - v[previ].i) * t); + clipv[clip_verts].s = v[previ].s + ((v[i].s - v[previ].s) * t); ++clip_verts; } - else if (!v1_in && v2_in) /* edge is entering the volume */ + if (v1_side > 0) // current point is inside { - /* insert vertex at intersection point */ - t = line_plane_intersection(&v[i], &v[previ], cp); - clipv[clip_verts].x = v[i].x + ((v[previ].x - v[i].x) * t); - clipv[clip_verts].y = v[i].y + ((v[previ].y - v[i].y) * t); - clipv[clip_verts].z = v[i].z + ((v[previ].z - v[i].z) * t); - clipv[clip_verts].u = v[i].u + ((v[previ].u - v[i].u) * t); - clipv[clip_verts].v = v[i].v + ((v[previ].v - v[i].v) * t); - clipv[clip_verts].i = v[i].i + ((v[previ].i - v[i].i) * t); + clipv[clip_verts] = v[i]; ++clip_verts; } - else if (v1_in && !v2_in) /* edge is leaving the volume */ + + previ = i; + } + + memcpy(&out[0], &clipv[0], sizeof(out[0]) * clip_verts); + return clip_verts; +} + +static int clip(const m3_clip_vertex* v, int num_vertices, m3_clip_vertex* out, int axis, int sign) +{ + if (num_vertices <= 0) + return 0; + + m3_clip_vertex clipv[10]; + int clip_verts = 0; + + int previ = num_vertices - 1; + + for (int i=0; i < num_vertices; i++) + { + int v1_side, v2_side; + float* v1a = (float*)&v[i]; + float* v2a = (float*)&v[previ]; + + float v1_axis, v2_axis; + + if (sign) // +axis + { + v1_axis = v1a[axis]; + v2_axis = v2a[axis]; + } + else // -axis { - /* insert vertex at intersection point */ - t = line_plane_intersection(&v[i], &v[previ], cp); - clipv[clip_verts].x = v[i].x + ((v[previ].x - v[i].x) * t); - clipv[clip_verts].y = v[i].y + ((v[previ].y - v[i].y) * t); - clipv[clip_verts].z = v[i].z + ((v[previ].z - v[i].z) * t); - clipv[clip_verts].u = v[i].u + ((v[previ].u - v[i].u) * t); - clipv[clip_verts].v = v[i].v + ((v[previ].v - v[i].v) * t); - clipv[clip_verts].i = v[i].i + ((v[previ].i - v[i].i) * t); - ++clip_verts; + v1_axis = -v1a[axis]; + v2_axis = -v2a[axis]; + } + + v1_side = (v1_axis <= v[i].w) ? 1 : -1; + v2_side = (v2_axis <= v[previ].w) ? 1 : -1; - /* insert the existing vertex */ + if ((v1_side * v2_side) < 0) // edge goes through W plane + { + // insert vertex at intersection point + float wdiv = ((v[previ].w - v2_axis) - (v[i].w - v1_axis)); + + if (wdiv == 0.0f) // 0 edge means degenerate polygon + return 0; + + float t = fabs((v[previ].w - v2_axis) / wdiv); + + clipv[clip_verts].x = v[previ].x + ((v[i].x - v[previ].x) * t); + clipv[clip_verts].y = v[previ].y + ((v[i].y - v[previ].y) * t); + clipv[clip_verts].z = v[previ].z + ((v[i].z - v[previ].z) * t); + clipv[clip_verts].w = v[previ].w + ((v[i].w - v[previ].w) * t); + clipv[clip_verts].u = v[previ].u + ((v[i].u - v[previ].u) * t); + clipv[clip_verts].v = v[previ].v + ((v[i].v - v[previ].v) * t); + clipv[clip_verts].i = v[previ].i + ((v[i].i - v[previ].i) * t); + clipv[clip_verts].s = v[previ].s + ((v[i].s - v[previ].s) * t); + ++clip_verts; + } + if (v1_side > 0) // current point is inside + { clipv[clip_verts] = v[i]; ++clip_verts; } previ = i; } - memcpy(&vout[0], &clipv[0], sizeof(vout[0]) * clip_verts); + + memcpy(&out[0], &clipv[0], sizeof(out[0]) * clip_verts); return clip_verts; } @@ -1368,7 +1599,14 @@ void model3_state::draw_model(UINT32 addr) m3_clip_vertex clip_vert[10]; MATRIX transform_matrix; - float center_x, center_y; + MATRIX vp_matrix; + MATRIX coord_matrix; + + memset(&coord_matrix, 0, sizeof(coord_matrix)); + coord_matrix[0][0] = m_coordinate_system[0][1]; + coord_matrix[1][1] = m_coordinate_system[1][2]; + coord_matrix[2][2] = -m_coordinate_system[2][0]; + coord_matrix[3][3] = 1.0f; if (m_step < 0x15) // position coordinates are 17.7 fixed-point in Step 1.0 fixed_point_fraction = 1.0f / 128.0f; @@ -1377,9 +1615,9 @@ void model3_state::draw_model(UINT32 addr) get_top_matrix(&transform_matrix); - /* current viewport center coordinates on screen */ - center_x = (float)(m_viewport_region_x + (m_viewport_region_width / 2)); - center_y = (float)(m_viewport_region_y + (m_viewport_region_height / 2)); + // make view-projection matrix + matrix_multiply(transform_matrix, coord_matrix, &transform_matrix); + matrix_multiply(transform_matrix, m_projection_matrix, &vp_matrix); memset(prev_vertex, 0, sizeof(prev_vertex)); @@ -1448,24 +1686,29 @@ void model3_state::draw_model(UINT32 addr) /* Copy current vertices as previous vertices */ memcpy(prev_vertex, vertex, sizeof(m3_vertex) * 4); - color = (header[4] >> 8) & 0xffffff; + if (header[1] & 0x2) + { + color = (header[4] >> 8) & 0xffffff; + } + else + { + int ci = (header[4] >> 8) & 0x7ff; + color = m_polygon_ram[0x400 + ci]; + } + polygon_transparency = (header[6] & 0x800000) ? 32 : ((header[6] >> 18) & 0x1f); /* transform polygon normal to view-space */ sn[0] = (normal[0] * transform_matrix[0][0]) + - (normal[1] * transform_matrix[1][0]) + - (normal[2] * transform_matrix[2][0]); - sn[1] = (normal[0] * transform_matrix[0][1]) + + (normal[1] * transform_matrix[0][1]) + + (normal[2] * transform_matrix[0][2]); + sn[1] = (normal[0] * transform_matrix[1][0]) + (normal[1] * transform_matrix[1][1]) + - (normal[2] * transform_matrix[2][1]); - sn[2] = (normal[0] * transform_matrix[0][2]) + - (normal[1] * transform_matrix[1][2]) + + (normal[2] * transform_matrix[1][2]); + sn[2] = (normal[0] * transform_matrix[2][0]) + + (normal[1] * transform_matrix[2][1]) + (normal[2] * transform_matrix[2][2]); - sn[0] *= m_coordinate_system[0][1]; - sn[1] *= m_coordinate_system[1][2]; - sn[2] *= m_coordinate_system[2][0]; - // TODO: depth bias // transform and light vertices for (i = 0; i < num_vertices; i++) @@ -1477,36 +1720,38 @@ void model3_state::draw_model(UINT32 addr) vect[2] = vertex[i].z; vect[3] = 1.0f; - // transform to world-space - matrix_multiply_vector(transform_matrix, vect, &p[i]); + // transform to projection space + matrix_multiply_vector(vp_matrix, vect, &p[i]); - // apply coordinate system - clip_vert[i].x = p[i][0] * m_coordinate_system[0][1]; - clip_vert[i].y = p[i][1] * m_coordinate_system[1][2]; - clip_vert[i].z = p[i][2] * m_coordinate_system[2][0]; - clip_vert[i].u = vertex[i].u * texture_coord_scale; - clip_vert[i].v = vertex[i].v * texture_coord_scale; + clip_vert[i].x = p[i][0]; + clip_vert[i].y = p[i][1]; + clip_vert[i].z = p[i][2]; + clip_vert[i].w = p[i][3]; + + clip_vert[i].u = vertex[i].u * texture_coord_scale * 256.0f; // 8 bits of subtexel accuracy for bilinear filtering + clip_vert[i].v = vertex[i].v * texture_coord_scale * 256.0f; // transform vertex normal VECTOR3 n; n[0] = (vertex[i].nx * transform_matrix[0][0]) + - (vertex[i].ny * transform_matrix[1][0]) + - (vertex[i].nz * transform_matrix[2][0]); - n[0] *= m_coordinate_system[0][1]; - n[1] = (vertex[i].nx * transform_matrix[0][1]) + + (vertex[i].ny * transform_matrix[0][1]) + + (vertex[i].nz * transform_matrix[0][2]); + n[1] = (vertex[i].nx * transform_matrix[1][0]) + (vertex[i].ny * transform_matrix[1][1]) + - (vertex[i].nz * transform_matrix[2][1]); - n[1] *= m_coordinate_system[1][2]; - n[2] = (vertex[i].nx * transform_matrix[0][2]) + - (vertex[i].ny * transform_matrix[1][2]) + + (vertex[i].nz * transform_matrix[1][2]); + n[2] = (vertex[i].nx * transform_matrix[2][0]) + + (vertex[i].ny * transform_matrix[2][1]) + (vertex[i].nz * transform_matrix[2][2]); - n[2] *= m_coordinate_system[2][0]; // lighting float intensity; if ((header[6] & 0x10000) == 0) { float dot = dot_product3(n, m_parallel_light); + + if (header[1] & 0x10) + dot = fabs(dot); + intensity = ((dot * m_parallel_light_intensity) + m_ambient_light_intensity) * 255.0f; if (intensity > 255.0f) { @@ -1519,43 +1764,55 @@ void model3_state::draw_model(UINT32 addr) } else { - // apply luminosity - intensity = ((float)((header[6] >> 11) & 0x1f) / 31.0f) * 255.0f; + intensity = 255.0f; } clip_vert[i].i = intensity; } /* clip against view frustum */ - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[0], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[1], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[2], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[3], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[4], clip_vert); + num_vertices = clip_w(clip_vert, num_vertices, clip_vert); + num_vertices = clip(clip_vert, num_vertices, clip_vert, 0, 0); // W <= -X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 0, 1); // W <= +X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 1, 0); // W <= -Y + num_vertices = clip(clip_vert, num_vertices, clip_vert, 1, 1); // W <= +X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 2, 0); // W <= -Z + num_vertices = clip(clip_vert, num_vertices, clip_vert, 2, 1); // W <= +Z + + /* divide by W, transform to screen coords */ + for(i=0; i < num_vertices; i++) + { + float oow = 1.0f / clip_vert[i].w; + + clip_vert[i].x *= oow; + clip_vert[i].y *= oow; + clip_vert[i].z *= oow; + clip_vert[i].u *= oow; + clip_vert[i].v *= oow; + + clip_vert[i].x = (((clip_vert[i].x * 0.5f) + 0.5f) * m_viewport_width) + m_viewport_x; + clip_vert[i].y = (((clip_vert[i].y * 0.5f) + 0.5f) * m_viewport_height) + m_viewport_y; + clip_vert[i].z = (((clip_vert[i].z * 0.5f) + 0.5f) * (m_viewport_far - m_viewport_near)) + m_viewport_near; + } /* backface culling */ - if( (header[6] & 0x800000) && (!(header[1] & 0x0010)) ) { - if(sn[0]*clip_vert[0].x + sn[1]*clip_vert[0].y + sn[2]*clip_vert[0].z >0) + if( (header[6] & 0x800000) && (!(header[1] & 0x0010)) ) + { + if (sn[0]*clip_vert[0].x + sn[1]*clip_vert[0].y + sn[2]*clip_vert[0].z > 0) back_face = 1; else back_face = 0; } else + { back_face = 0; //no culling for transparent or two-sided polygons + } + + back_face = 0; if (!back_face) { - /* homogeneous Z-divide, screen-space transformation */ - for(i=0; i < num_vertices; i++) - { - float ooz = 1.0f / clip_vert[i].z; - clip_vert[i].x = ((clip_vert[i].x * ooz) * m_viewport_focal_length) + center_x; - clip_vert[i].y = ((clip_vert[i].y * ooz) * m_viewport_focal_length) + center_y; - clip_vert[i].u *= ooz; - clip_vert[i].v *= ooz; - } - - + bool colormod = false; cached_texture* texture; if (header[6] & 0x0000400) @@ -1566,6 +1823,9 @@ void model3_state::draw_model(UINT32 addr) int tex_height = (header[3] & 0x7); int tex_format = (header[6] >> 7) & 0x7; + if (tex_format != 0 && tex_format != 7) // enable color modulation if this is not a color texture + colormod = true; + if (tex_width >= 6 || tex_height >= 6) // srally2 poly ram has degenerate polys with 2k tex size (cpu bug or intended?) return; @@ -1578,7 +1838,7 @@ void model3_state::draw_model(UINT32 addr) for (i=2; i < num_vertices; i++) { - bool alpha = (header[6] & 0x1) || (header[6] & 0x80000000); // put to alpha buffer if there's any transparency involved + bool alpha = (header[6] & 0x1) || ((header[6] & 0x800000) == 0); // put to alpha buffer if there's any transparency involved m3_triangle* tri = push_triangle(alpha); // bail out if tri buffer is maxed out (happens during harley boot) @@ -1593,12 +1853,13 @@ void model3_state::draw_model(UINT32 addr) tri->transparency = polygon_transparency; tri->color = color; - tri->param = 0; - tri->param |= (header[4] & 0x40) ? TRI_PARAM_TEXTURE_PAGE : 0; - tri->param |= (header[6] & 0x00000400) ? TRI_PARAM_TEXTURE_ENABLE : 0; - tri->param |= (header[2] & 0x2) ? TRI_PARAM_TEXTURE_MIRROR_U : 0; - tri->param |= (header[2] & 0x1) ? TRI_PARAM_TEXTURE_MIRROR_V : 0; - tri->param |= (header[6] & 0x80000000) ? TRI_PARAM_ALPHA_TEST : 0; + tri->param = 0; + tri->param |= (header[4] & 0x40) ? TRI_PARAM_TEXTURE_PAGE : 0; + tri->param |= (header[6] & 0x00000400) ? TRI_PARAM_TEXTURE_ENABLE : 0; + tri->param |= (header[2] & 0x2) ? TRI_PARAM_TEXTURE_MIRROR_U : 0; + tri->param |= (header[2] & 0x1) ? TRI_PARAM_TEXTURE_MIRROR_V : 0; + tri->param |= (header[6] & 0x80000000) ? TRI_PARAM_ALPHA_TEST : 0; + tri->param |= (colormod) ? TRI_PARAM_COLOR_MOD : 0; } } } @@ -1754,8 +2015,6 @@ void model3_state::draw_viewport(int pri, UINT32 address) { const UINT32 *node = get_memory_pointer(address); UINT32 link_address; - float /*viewport_left, viewport_right, */viewport_top, viewport_bottom; - float /*fov_x,*/ fov_y; link_address = node[1]; @@ -1769,28 +2028,33 @@ void model3_state::draw_viewport(int pri, UINT32 address) return; /* set viewport parameters */ - m_viewport_region_x = (node[26] & 0xffff) >> 4; /* 12.4 fixed point */ - m_viewport_region_y = ((node[26] >> 16) & 0xffff) >> 4; - m_viewport_region_width = (node[20] & 0xffff) >> 2; /* 14.2 fixed point */ - m_viewport_region_height = ((node[20] >> 16) & 0xffff) >> 2; - - /* frustum plane angles */ - //viewport_left = RADIAN_TO_DEGREE(asin(*(float *)&node[12])); - //viewport_right = RADIAN_TO_DEGREE(asin(*(float *)&node[16])); - viewport_top = RADIAN_TO_DEGREE(asin(*(float *)&node[14])); - viewport_bottom = RADIAN_TO_DEGREE(asin(*(float *)&node[18])); - - /* build clipping planes */ - m_clip_plane[0].x = *(float *)&node[13]; m_clip_plane[0].y = 0.0f; m_clip_plane[0].z = *(float *)&node[12]; m_clip_plane[0].d = 0.0f; - m_clip_plane[1].x = *(float *)&node[17]; m_clip_plane[1].y = 0.0f; m_clip_plane[1].z = *(float *)&node[16]; m_clip_plane[1].d = 0.0f; - m_clip_plane[2].x = 0.0f; m_clip_plane[2].y = *(float *)&node[15]; m_clip_plane[2].z = *(float *)&node[14]; m_clip_plane[2].d = 0.0f; - m_clip_plane[3].x = 0.0f; m_clip_plane[3].y = *(float *)&node[19]; m_clip_plane[3].z = *(float *)&node[18]; m_clip_plane[3].d = 0.0f; - m_clip_plane[4].x = 0.0f; m_clip_plane[4].y = 0.0f; m_clip_plane[4].z = 1.0f; m_clip_plane[4].d = 1.0f; - - /* compute field of view */ - //fov_x = viewport_left + viewport_right; - fov_y = viewport_top + viewport_bottom; - m_viewport_focal_length = (m_viewport_region_height / 2) / tan( (fov_y * M_PI / 180.0f) / 2.0f ); + m_viewport_x = (float)(node[26] & 0xffff) / 16.0f; /* 12.4 fixed point */ + m_viewport_y = (float)((node[26] >> 16) & 0xffff) / 16.0f; + m_viewport_width = (float)(node[20] & 0xffff) / 4.0f; /* 14.2 fixed point */ + m_viewport_height = (float)((node[20] >> 16) & 0xffff) / 4.0f; + + m_viewport_near = 1.0f; + m_viewport_far = 100000.0f; + + /* set up frustum */ + float frustum_left = atan2(*(float *)&node[12], *(float *)&node[13]); + float frustum_right = -atan2(*(float *)&node[16], -*(float *)&node[17]); + float frustum_top = atan2(*(float *)&node[14], *(float *)&node[15]); + float frustum_bottom = -atan2(*(float *)&node[18], -*(float *)&node[19]); +// float frustum_1 = atan2(*(float *)&node[9], *(float *)&node[8]); +// float frustum_2 = atan2(*(float *)&node[11], *(float *)&node[10]); + + /* + printf("%f\n", *(float *)&node[3]); + printf("0: %f, 1: %f, 2: %f, 3: %f\n", *(float *)&node[8], *(float *)&node[9], *(float *)&node[10], *(float *)&node[11]); + printf("4: %f, 5: %f, 6: %f, 7: %f\n", *(float *)&node[12], *(float *)&node[13], *(float *)&node[14], *(float *)&node[15]); + printf("8: %f, 9: %f, A: %f, B: %f\n", *(float *)&node[16], *(float *)&node[17], *(float *)&node[18], *(float *)&node[19]); + printf("fl = %f, fr = %f, ft = %f, fb = %f\n", RADIAN_TO_DEGREE(frustum_left), RADIAN_TO_DEGREE(frustum_right), RADIAN_TO_DEGREE(frustum_top), RADIAN_TO_DEGREE(frustum_bottom)); + printf("f1 = %f, f2 = %f\n", RADIAN_TO_DEGREE(frustum_1), RADIAN_TO_DEGREE(frustum_2)); + */ + + set_projection(frustum_left, frustum_right, frustum_top, frustum_bottom, m_viewport_near, m_viewport_far); + m_matrix_base_address = node[22]; /* TODO: where does node[23] point to ? LOD table ? */ @@ -1798,7 +2062,7 @@ void model3_state::draw_viewport(int pri, UINT32 address) /* set lighting parameters */ m_parallel_light[0] = *(float *)&node[5]; m_parallel_light[1] = *(float *)&node[6]; - m_parallel_light[2] = -*(float *)&node[4]; + m_parallel_light[2] = *(float *)&node[4]; m_parallel_light_intensity = *(float *)&node[7]; m_ambient_light_intensity = (UINT8)(node[36] >> 8) / 256.0f; @@ -1893,10 +2157,10 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; - v[i].p[1] = 1.0f / tri->v[i].z; - v[i].p[2] = tri->v[i].u * 256.0f; // 8 bits of subtexel precision for bilinear filtering - v[i].p[3] = tri->v[i].v * 256.0f; + v[i].p[0] = tri->v[i].w; + v[i].p[1] = 1.0f / tri->v[i].w; + v[i].p[2] = tri->v[i].u; + v[i].p[3] = tri->v[i].v; v[i].p[4] = tri->v[i].i; } @@ -1904,8 +2168,19 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri extra.texture = tri->texture; extra.transparency = tri->transparency; extra.texture_param = tri->param; + extra.color = tri->color; - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex), this), 5, v[0], v[1], v[2]); + if (tri->param & TRI_PARAM_ALPHA_TEST) + { + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_contour), this), 5, v[0], v[1], v[2]); + } + else + { + if (tri->param & TRI_PARAM_COLOR_MOD) + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_colormod), this), 5, v[0], v[1], v[2]); + else + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex), this), 5, v[0], v[1], v[2]); + } } else { @@ -1913,7 +2188,7 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; + v[i].p[0] = tri->v[i].w; v[i].p[1] = tri->v[i].i; } @@ -1947,10 +2222,10 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; - v[i].p[1] = 1.0f / tri->v[i].z; - v[i].p[2] = tri->v[i].u * 256.0f; // 8 bits of subtexel precision for bilinear filtering - v[i].p[3] = tri->v[i].v * 256.0f; + v[i].p[0] = tri->v[i].w; + v[i].p[1] = 1.0f / tri->v[i].w; + v[i].p[2] = tri->v[i].u; + v[i].p[3] = tri->v[i].v; v[i].p[4] = tri->v[i].i; } @@ -1959,14 +2234,7 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris extra.transparency = tri->transparency; extra.texture_param = tri->param; - if (tri->param & TRI_PARAM_ALPHA_TEST) - { - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_contour), this), 5, v[0], v[1], v[2]); - } - else - { - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_alpha), this), 5, v[0], v[1], v[2]); - } + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_alpha), this), 5, v[0], v[1], v[2]); } else { @@ -1974,15 +2242,15 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; + v[i].p[0] = tri->v[i].w; v[i].p[1] = tri->v[i].i; } model3_polydata &extra = object_data_alloc(); extra.color = tri->color; + extra.transparency = tri->transparency; - // TODO: scanline renderer for solid /w transparency - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_solid), this), 2, v[0], v[1], v[2]); + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_solid_trans), this), 2, v[0], v[1], v[2]); } } } @@ -1998,36 +2266,54 @@ void model3_renderer::draw_scanline_solid(INT32 scanline, const extent_t &extent float in = extent.param[1].start; float inz = extent.param[1].dpdx; - int pr = polydata.color & 0xff0000; - int pg = polydata.color & 0xff00; - int pb = polydata.color & 0xff; + rgbaint_t color(polydata.color); + + for (int x = extent.startx; x < extent.stopx; x++) + { + if (z <= zb[x]) + { + rgbaint_t c(color); + + c.scale_imm_and_clamp((int)in); - int srctrans = polydata.transparency; - int desttrans = 32 - polydata.transparency; + fb[x] = 0xff000000 | c.to_rgba_clamp(); + zb[x] = z; + } + + in += inz; + z += dz; + } +} + +void model3_renderer::draw_scanline_solid_trans(INT32 scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) +{ + UINT32 *fb = &m_fb->pix32(scanline); + float *zb = (float*)&m_zb->pix32(scanline); + + float z = extent.param[0].start; + float dz = extent.param[0].dpdx; + + float in = extent.param[1].start; + float inz = extent.param[1].dpdx; + + rgbaint_t color(polydata.color); + + int trans = (polydata.transparency << 3) | (polydata.transparency >> 2); for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { - int ii = (int)(in); + rgbaint_t c(color); - int r = (pr * ii) >> 8; - int g = (pg * ii) >> 8; - int b = (pb * ii) >> 8; + c.scale_imm_and_clamp((int)in); - if (srctrans != 0x1f) + if (trans != 0xff) { - UINT32 orig = fb[x]; - r = (r * srctrans) >> 5; - g = (g * srctrans) >> 5; - b = (b * srctrans) >> 5; - r += ((orig & 0x00ff0000) * desttrans) >> 5; - g += ((orig & 0x0000ff00) * desttrans) >> 5; - b += ((orig & 0x000000ff) * desttrans) >> 5; + c.blend(rgbaint_t(fb[x]), trans); } - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); - zb[x] = z; + fb[x] = 0xff000000 | c.to_rgba_clamp(); } in += inz; @@ -2058,7 +2344,7 @@ do { UINT32 pix01 = texture->data[(v1 << width) + u2]; \ UINT32 pix10 = texture->data[(v2 << width) + u1]; \ UINT32 pix11 = texture->data[(v2 << width) + u2]; \ - texel = rgba_bilinear_filter(pix00, pix01, pix10, pix11, u, v); \ + texel = rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, u, v); \ } while(0); #if ENABLE_BILINEAR @@ -2090,18 +2376,63 @@ void model3_renderer::draw_scanline_tex(INT32 scanline, const extent_t &extent, for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; - TEX_FETCH(); + TEX_FETCH(); // TODO fetch rgbaint_t instead - int ii = in; + rgbaint_t color(texel); - UINT32 r = ((texel & 0xff0000) * ii) >> 8; - UINT32 g = ((texel & 0xff00) * ii) >> 8; - UINT32 b = ((texel & 0xff) * ii) >> 8; + color.scale_imm_and_clamp((int)in); - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | color.to_rgba_clamp(); + zb[x] = z; + } + + ooz += dooz; + uoz += duoz; + voz += dvoz; + in += inz; + z += dz; + } +} + +void model3_renderer::draw_scanline_tex_colormod(INT32 scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) +{ + UINT32 *fb = &m_fb->pix32(scanline); + float *zb = (float*)&m_zb->pix32(scanline); + const cached_texture *texture = polydata.texture; + + float z = extent.param[0].start; + float dz = extent.param[0].dpdx; + float ooz = extent.param[1].start; + float dooz = extent.param[1].dpdx; + float uoz = extent.param[2].start; + float duoz = extent.param[2].dpdx; + float voz = extent.param[3].start; + float dvoz = extent.param[3].dpdx; + float in = extent.param[4].start; + float inz = extent.param[4].dpdx; + + UINT32 umask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1; + UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; + UINT32 width = 6 + texture->width; + + rgbaint_t polycolor(polydata.color); + + for (int x = extent.startx; x < extent.stopx; x++) + { + if (z <= zb[x]) + { + UINT32 texel; + TEX_FETCH(); // TODO fetch rgbaint_t instead + + rgbaint_t color(texel); + + color.scale_and_clamp(polycolor); + color.scale_imm_and_clamp((int)in); + + fb[x] = 0xff000000 | color.to_rgba_clamp(); zb[x] = z; } @@ -2134,9 +2465,11 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t & UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; UINT32 width = 6 + texture->width; + rgbaint_t polycolor(polydata.color); + for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); @@ -2144,19 +2477,13 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t & UINT32 fa = texel >> 24; if (fa >= 0xf8) { - UINT32 r = ((texel & 0x00ff0000) * fa) >> 8; - UINT32 g = ((texel & 0x0000ff00) * fa) >> 8; - UINT32 b = ((texel & 0x000000ff) * fa) >> 8; - - UINT32 orig = fb[x]; - - int minalpha = 255 - fa; + rgbaint_t color(texel); - r += ((orig & 0x00ff0000) * minalpha) >> 8; - g += ((orig & 0x0000ff00) * minalpha) >> 8; - b += ((orig & 0x000000ff) * minalpha) >> 8; + color.scale_and_clamp(polycolor); + color.scale_imm_and_clamp((int)in); + color.blend(rgbaint_t(fb[x]), fa); - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | color.to_rgba_clamp(); zb[x] = z; } } @@ -2186,37 +2513,28 @@ void model3_renderer::draw_scanline_tex_trans(INT32 scanline, const extent_t &ex float in = extent.param[4].start; float inz = extent.param[4].dpdx; - int srctrans = polydata.transparency; - int desttrans = 32 - polydata.transparency; + int trans = (polydata.transparency << 3) | (polydata.transparency >> 2); UINT32 umask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1; UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; UINT32 width = 6 + texture->width; + rgbaint_t polycolor(polydata.color); + for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); - int ii = (int)in; - - UINT32 r = ((texel & 0x00ff0000) * ii) >> 8; - UINT32 g = ((texel & 0x0000ff00) * ii) >> 8; - UINT32 b = ((texel & 0x000000ff) * ii) >> 8; - - r = (r * srctrans) >> 5; - g = (g * srctrans) >> 5; - b = (b * srctrans) >> 5; - - UINT32 orig = fb[x]; + rgbaint_t color(texel); - r += ((orig & 0x00ff0000) * desttrans) >> 5; - g += ((orig & 0x0000ff00) * desttrans) >> 5; - b += ((orig & 0x000000ff) * desttrans) >> 5; + color.scale_and_clamp(polycolor); + color.scale_imm_and_clamp((int)in); + color.blend(rgbaint_t(fb[x]), trans); - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | color.to_rgba_clamp(); } ooz += dooz; @@ -2253,7 +2571,7 @@ void model3_renderer::draw_scanline_tex_alpha(INT32 scanline, const extent_t &ex for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); @@ -2261,24 +2579,12 @@ void model3_renderer::draw_scanline_tex_alpha(INT32 scanline, const extent_t &ex UINT32 fa = texel >> 24; if (fa != 0) { - int ii = (int)in; - - UINT32 r = ((texel & 0x00ff0000) * ii) >> 8; - UINT32 g = ((texel & 0x0000ff00) * ii) >> 8; - UINT32 b = ((texel & 0x000000ff) * ii) >> 8; - - r = (r * fa) >> 8; - g = (g * fa) >> 8; - b = (b * fa) >> 8; - - UINT32 orig = fb[x]; + rgbaint_t color(texel); - int minalpha = 255 - fa; - r += ((orig & 0x00ff0000) * minalpha) >> 8; - g += ((orig & 0x0000ff00) * minalpha) >> 8; - b += ((orig & 0x000000ff) * minalpha) >> 8; + color.scale_imm_and_clamp((int)in); + color.blend(rgbaint_t(fb[x]), fa); - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | color.to_rgba_clamp(); } } diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c index 4a8e0027194..f27743f3a52 100644 --- a/src/mame/video/n64.c +++ b/src/mame/video/n64.c @@ -26,6 +26,10 @@ TODO: #include "emu.h" #include "video/n64.h" +#include "video/rdpblend.h" +#include "video/rdptpipe.h" + +#include <algorithm> #define LOG_RDP_EXECUTION 0 @@ -61,9 +65,9 @@ bool n64_rdp::rdp_range_check(UINT32 addr) // The functions in this file should be moved into the parent Processor class. #include "rdpfiltr.inc" -void n64_rdp::get_alpha_cvg(UINT8* comb_alpha, rdp_span_aux* userdata, const rdp_poly_state &object) +INT32 n64_rdp::get_alpha_cvg(INT32 comb_alpha, rdp_span_aux* userdata, const rdp_poly_state &object) { - INT32 temp = *comb_alpha; + INT32 temp = comb_alpha; INT32 temp2 = userdata->m_current_pix_cvg; INT32 temp3 = 0; @@ -80,7 +84,7 @@ void n64_rdp::get_alpha_cvg(UINT8* comb_alpha, rdp_span_aux* userdata, const rdp { temp = 0xff; } - *comb_alpha = temp; + return temp; } /*****************************************************************************/ @@ -152,90 +156,13 @@ void n64_rdp::video_update16(n64_periphs* n64, bitmap_rgb32 &bitmap) for(INT32 i = 0; i < hres; i++) { - color_t c; - //INT32 r, g, b; - UINT16 pix = frame_buffer[pixels ^ WORD_ADDR_XOR]; - //m_misc_state.m_current_pix_cvg = ((pix & 1) << 2) | (hidden_buffer[pixels ^ BYTE_ADDR_XOR] & 3); - - //if(divot) - //{ - // if(i > 0 && i < (hres - 1)) - // { - // prev_cvg = ((frame_buffer[(pixels - 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels - 1)^BYTE_ADDR_XOR] & 3); - // next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3); - // } - //} - c.i.r = ((pix >> 8) & 0xf8) | (pix >> 13); - c.i.g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07); - c.i.b = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07); - - //if(fsaa) - //{ - //if (/*!vibuffering &&*/ state->m_rdp.m_misc_state.m_current_pix_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2)) - //{ - //video_filter16(&c.i.r, &c.i.g, &c.i.b, &frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64->vi_width); - //} - //} - //else if (dither_filter && state->m_rdp.m_misc_state.m_current_pix_cvg == 7 && i > 0 && j > 0 && i < (hres - 1) && j < (vres - 1)) - //{ - //if (vibuffering) - //{ - // restore_filter16_buffer(&r, &g, &b, &ViBuffer[i][j], n64->vi_width); - //} - //else - //{ - //restore_filter16(&c.i.r, &c.i.g, &c.i.b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR, n64->vi_width); - //} - //} - //if(divot) - //{ - //if (i > 0 && i < (hres - 1) && (m_misc_state.m_current_pix_cvg != 7 || prev_cvg != 7 || next_cvg != 7)) - //{ - //if (vibuffering) - //{ - // divot_filter16_buffer(&r, &g, &b, &ViBuffer[i][j]); - //} - //else - //{ - //divot_filter16(&c.i.r, &c.i.g, &c.i.b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR); - //} - //} - //} - - /* - if (gamma_dither) - { - dith = screen.machine().rand() & 0x3f; - } - if (gamma) - { - if (gamma_dither) - { - r = m_gamma_dither_table[(r << 6)|dith]; - g = m_gamma_dither_table[(g << 6)|dith]; - b = m_gamma_dither_table[(b << 6)|dith]; - } - else - { - r = m_gamma_table[r]; - g = m_gamma_table[g]; - b = m_gamma_table[b]; - } - } - else if (gamma_dither) - { - if (r < 255) - r += (dith & 1); - if (g < 255) - g += (dith & 1); - if (b < 255) - b += (dith & 1); - } - */ - pixels++; - d[i] = c.c >> 8;//(r << 16) | (g << 8) | b; // Fix me for endianness + const UINT8 r = ((pix >> 8) & 0xf8) | (pix >> 13); + const UINT8 g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07); + const UINT8 b = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07); + d[i] = (r << 16) | (g << 8) | b; + pixels++; } pixels +=invisiblewidth; } @@ -432,181 +359,156 @@ INT32 n64_rdp::alpha_combiner_equation(INT32 a, INT32 b, INT32 c, INT32 d) return a; } -void n64_rdp::set_suba_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_suba_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0xf) { - case 0: *input_r = &userdata->m_combined_color.i.r; *input_g = &userdata->m_combined_color.i.g; *input_b = &userdata->m_combined_color.i.b; break; - case 1: *input_r = &userdata->m_texel0_color.i.r; *input_g = &userdata->m_texel0_color.i.g; *input_b = &userdata->m_texel0_color.i.b; break; - case 2: *input_r = &userdata->m_texel1_color.i.r; *input_g = &userdata->m_texel1_color.i.g; *input_b = &userdata->m_texel1_color.i.b; break; - case 3: *input_r = &userdata->m_prim_color.i.r; *input_g = &userdata->m_prim_color.i.g; *input_b = &userdata->m_prim_color.i.b; break; - case 4: *input_r = &userdata->m_shade_color.i.r; *input_g = &userdata->m_shade_color.i.g; *input_b = &userdata->m_shade_color.i.b; break; - case 5: *input_r = &userdata->m_env_color.i.r; *input_g = &userdata->m_env_color.i.g; *input_b = &userdata->m_env_color.i.b; break; - case 6: *input_r = &m_one.i.r; *input_g = &m_one.i.g; *input_b = &m_one.i.b; break; - case 7: *input_r = &userdata->m_noise_color.i.r; *input_g = &userdata->m_noise_color.i.g; *input_b = &userdata->m_noise_color.i.b; break; + case 0: *input = &userdata->m_combined_color; break; + case 1: *input = &userdata->m_texel0_color; break; + case 2: *input = &userdata->m_texel1_color; break; + case 3: *input = &userdata->m_prim_color; break; + case 4: *input = &userdata->m_shade_color; break; + case 5: *input = &userdata->m_env_color; break; + case 6: *input = &m_one; break; + case 7: *input = &userdata->m_noise_color; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: { - *input_r = &m_zero.i.r; *input_g = &m_zero.i.g; *input_b = &m_zero.i.b; break; + *input = &m_zero; break; } } } -void n64_rdp::set_subb_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_subb_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0xf) { - case 0: *input_r = &userdata->m_combined_color.i.r; *input_g = &userdata->m_combined_color.i.g; *input_b = &userdata->m_combined_color.i.b; break; - case 1: *input_r = &userdata->m_texel0_color.i.r; *input_g = &userdata->m_texel0_color.i.g; *input_b = &userdata->m_texel0_color.i.b; break; - case 2: *input_r = &userdata->m_texel1_color.i.r; *input_g = &userdata->m_texel1_color.i.g; *input_b = &userdata->m_texel1_color.i.b; break; - case 3: *input_r = &userdata->m_prim_color.i.r; *input_g = &userdata->m_prim_color.i.g; *input_b = &userdata->m_prim_color.i.b; break; - case 4: *input_r = &userdata->m_shade_color.i.r; *input_g = &userdata->m_shade_color.i.g; *input_b = &userdata->m_shade_color.i.b; break; - case 5: *input_r = &userdata->m_env_color.i.r; *input_g = &userdata->m_env_color.i.g; *input_b = &userdata->m_env_color.i.b; break; + case 0: *input = &userdata->m_combined_color; break; + case 1: *input = &userdata->m_texel0_color; break; + case 2: *input = &userdata->m_texel1_color; break; + case 3: *input = &userdata->m_prim_color; break; + case 4: *input = &userdata->m_shade_color; break; + case 5: *input = &userdata->m_env_color; break; case 6: fatalerror("SET_SUBB_RGB_INPUT: key_center\n"); - case 7: *input_r = (UINT8*)&m_k4; *input_g = (UINT8*)&m_k4; *input_b = (UINT8*)&m_k4; break; + case 7: *input = &userdata->m_k4; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: { - *input_r = &m_zero.i.r; *input_g = &m_zero.i.g; *input_b = &m_zero.i.b; break; + *input = &m_zero; break; } } } -void n64_rdp::set_mul_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_mul_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0x1f) { - case 0: *input_r = &userdata->m_combined_color.i.r; *input_g = &userdata->m_combined_color.i.g; *input_b = &userdata->m_combined_color.i.b; break; - case 1: *input_r = &userdata->m_texel0_color.i.r; *input_g = &userdata->m_texel0_color.i.g; *input_b = &userdata->m_texel0_color.i.b; break; - case 2: *input_r = &userdata->m_texel1_color.i.r; *input_g = &userdata->m_texel1_color.i.g; *input_b = &userdata->m_texel1_color.i.b; break; - case 3: *input_r = &userdata->m_prim_color.i.r; *input_g = &userdata->m_prim_color.i.g; *input_b = &userdata->m_prim_color.i.b; break; - case 4: *input_r = &userdata->m_shade_color.i.r; *input_g = &userdata->m_shade_color.i.g; *input_b = &userdata->m_shade_color.i.b; break; - case 5: *input_r = &userdata->m_env_color.i.r; *input_g = &userdata->m_env_color.i.g; *input_b = &userdata->m_env_color.i.b; break; - case 6: *input_r = &userdata->m_key_scale.i.r; *input_g = &userdata->m_key_scale.i.g; *input_b = &userdata->m_key_scale.i.b; break; - case 7: *input_r = &userdata->m_combined_color.i.a; *input_g = &userdata->m_combined_color.i.a; *input_b = &userdata->m_combined_color.i.a; break; - case 8: *input_r = &userdata->m_texel0_color.i.a; *input_g = &userdata->m_texel0_color.i.a; *input_b = &userdata->m_texel0_color.i.a; break; - case 9: *input_r = &userdata->m_texel1_color.i.a; *input_g = &userdata->m_texel1_color.i.a; *input_b = &userdata->m_texel1_color.i.a; break; - case 10: *input_r = &userdata->m_prim_color.i.a; *input_g = &userdata->m_prim_color.i.a; *input_b = &userdata->m_prim_color.i.a; break; - case 11: *input_r = &userdata->m_shade_color.i.a; *input_g = &userdata->m_shade_color.i.a; *input_b = &userdata->m_shade_color.i.a; break; - case 12: *input_r = &userdata->m_env_color.i.a; *input_g = &userdata->m_env_color.i.a; *input_b = &userdata->m_env_color.i.a; break; - case 13: *input_r = &userdata->m_lod_fraction; *input_g = &userdata->m_lod_fraction; *input_b = &userdata->m_lod_fraction; break; - case 14: *input_r = &userdata->m_prim_lod_fraction; *input_g = &userdata->m_prim_lod_fraction; *input_b = &userdata->m_prim_lod_fraction; break; - case 15: *input_r = (UINT8*)&m_k5; *input_g = (UINT8*)&m_k5; *input_b = (UINT8*)&m_k5; break; + case 0: *input = &userdata->m_combined_color; break; + case 1: *input = &userdata->m_texel0_color; break; + case 2: *input = &userdata->m_texel1_color; break; + case 3: *input = &userdata->m_prim_color; break; + case 4: *input = &userdata->m_shade_color; break; + case 5: *input = &userdata->m_env_color; break; + case 6: *input = &userdata->m_key_scale; break; + case 7: *input = &userdata->m_combined_alpha; break; + case 8: *input = &userdata->m_texel0_alpha; break; + case 9: *input = &userdata->m_texel1_alpha; break; + case 10: *input = &userdata->m_prim_alpha; break; + case 11: *input = &userdata->m_shade_alpha; break; + case 12: *input = &userdata->m_env_alpha; break; + case 13: *input = &userdata->m_lod_fraction; break; + case 14: *input = &userdata->m_prim_lod_fraction; break; + case 15: *input = &userdata->m_k5; break; case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: { - *input_r = &m_zero.i.r; *input_g = &m_zero.i.g; *input_b = &m_zero.i.b; break; + *input = &m_zero; break; } } } -void n64_rdp::set_add_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_add_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0x7) { - case 0: *input_r = &userdata->m_combined_color.i.r; *input_g = &userdata->m_combined_color.i.g; *input_b = &userdata->m_combined_color.i.b; break; - case 1: *input_r = &userdata->m_texel0_color.i.r; *input_g = &userdata->m_texel0_color.i.g; *input_b = &userdata->m_texel0_color.i.b; break; - case 2: *input_r = &userdata->m_texel1_color.i.r; *input_g = &userdata->m_texel1_color.i.g; *input_b = &userdata->m_texel1_color.i.b; break; - case 3: *input_r = &userdata->m_prim_color.i.r; *input_g = &userdata->m_prim_color.i.g; *input_b = &userdata->m_prim_color.i.b; break; - case 4: *input_r = &userdata->m_shade_color.i.r; *input_g = &userdata->m_shade_color.i.g; *input_b = &userdata->m_shade_color.i.b; break; - case 5: *input_r = &userdata->m_env_color.i.r; *input_g = &userdata->m_env_color.i.g; *input_b = &userdata->m_env_color.i.b; break; - case 6: *input_r = &m_one.i.r; *input_g = &m_one.i.g; *input_b = &m_one.i.b; break; - case 7: *input_r = &m_zero.i.r; *input_g = &m_zero.i.g; *input_b = &m_zero.i.b; break; + case 0: *input = &userdata->m_combined_color; break; + case 1: *input = &userdata->m_texel0_color; break; + case 2: *input = &userdata->m_texel1_color; break; + case 3: *input = &userdata->m_prim_color; break; + case 4: *input = &userdata->m_shade_color; break; + case 5: *input = &userdata->m_env_color; break; + case 6: *input = &m_one; break; + case 7: *input = &m_zero; break; } } -void n64_rdp::set_sub_input_alpha(UINT8** input, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_sub_input_alpha(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0x7) { - case 0: *input = &userdata->m_combined_color.i.a; break; - case 1: *input = &userdata->m_texel0_color.i.a; break; - case 2: *input = &userdata->m_texel1_color.i.a; break; - case 3: *input = &userdata->m_prim_color.i.a; break; - case 4: *input = &userdata->m_shade_color.i.a; break; - case 5: *input = &userdata->m_env_color.i.a; break; - case 6: *input = &m_one.i.a; break; - case 7: *input = &m_zero.i.a; break; + case 0: *input = &userdata->m_combined_alpha; break; + case 1: *input = &userdata->m_texel0_alpha; break; + case 2: *input = &userdata->m_texel1_alpha; break; + case 3: *input = &userdata->m_prim_alpha; break; + case 4: *input = &userdata->m_shade_alpha; break; + case 5: *input = &userdata->m_env_alpha; break; + case 6: *input = &m_one; break; + case 7: *input = &m_zero; break; } } -void n64_rdp::set_mul_input_alpha(UINT8** input, INT32 code, rdp_span_aux* userdata) +void n64_rdp::set_mul_input_alpha(color_t** input, INT32 code, rdp_span_aux* userdata) { switch (code & 0x7) { case 0: *input = &userdata->m_lod_fraction; break; - case 1: *input = &userdata->m_texel0_color.i.a; break; - case 2: *input = &userdata->m_texel1_color.i.a; break; - case 3: *input = &userdata->m_prim_color.i.a; break; - case 4: *input = &userdata->m_shade_color.i.a; break; - case 5: *input = &userdata->m_env_color.i.a; break; + case 1: *input = &userdata->m_texel0_alpha; break; + case 2: *input = &userdata->m_texel1_alpha; break; + case 3: *input = &userdata->m_prim_alpha; break; + case 4: *input = &userdata->m_shade_alpha; break; + case 5: *input = &userdata->m_env_alpha; break; case 6: *input = &userdata->m_prim_lod_fraction; break; - case 7: *input = &m_zero.i.a; break; + case 7: *input = &m_zero; break; } } -void n64_rdp::set_blender_input(INT32 cycle, INT32 which, UINT8** input_r, UINT8** input_g, UINT8** input_b, UINT8** input_a, INT32 a, INT32 b, rdp_span_aux* userdata) +void n64_rdp::set_blender_input(INT32 cycle, INT32 which, color_t** input_rgb, color_t** input_a, INT32 a, INT32 b, rdp_span_aux* userdata) { switch (a & 0x3) { case 0: - { - if (cycle == 0) - { - *input_r = &userdata->m_pixel_color.i.r; - *input_g = &userdata->m_pixel_color.i.g; - *input_b = &userdata->m_pixel_color.i.b; - } - else - { - *input_r = &userdata->m_blended_pixel_color.i.r; - *input_g = &userdata->m_blended_pixel_color.i.g; - *input_b = &userdata->m_blended_pixel_color.i.b; - } + *input_rgb = cycle == 0 ? &userdata->m_pixel_color : &userdata->m_blended_pixel_color; break; - } case 1: - { - *input_r = &userdata->m_memory_color.i.r; - *input_g = &userdata->m_memory_color.i.g; - *input_b = &userdata->m_memory_color.i.b; + *input_rgb = &userdata->m_memory_color; break; - } case 2: - { - *input_r = &userdata->m_blend_color.i.r; - *input_g = &userdata->m_blend_color.i.g; - *input_b = &userdata->m_blend_color.i.b; + *input_rgb = &userdata->m_blend_color; break; - } case 3: - { - *input_r = &userdata->m_fog_color.i.r; - *input_g = &userdata->m_fog_color.i.g; - *input_b = &userdata->m_fog_color.i.b; + *input_rgb = &userdata->m_fog_color; break; - } } if (which == 0) { switch (b & 0x3) { - case 0: *input_a = &userdata->m_pixel_color.i.a; break; - case 1: *input_a = &userdata->m_fog_color.i.a; break; - case 2: *input_a = &userdata->m_shade_color.i.a; break; - case 3: *input_a = &m_zero.i.a; break; + case 0: *input_a = &userdata->m_pixel_color; break; + case 1: *input_a = &userdata->m_fog_color; break; + case 2: *input_a = &userdata->m_shade_color; break; + case 3: *input_a = &m_zero; break; } } else { switch (b & 0x3) { - case 0: *input_a = &userdata->m_inv_pixel_color.i.a; break; - case 1: *input_a = &userdata->m_memory_color.i.a; break; - case 2: *input_a = &m_one.i.a; break; - case 3: *input_a = &m_zero.i.a; break; + case 0: *input_a = &userdata->m_inv_pixel_color; break; + case 1: *input_a = &userdata->m_memory_color; break; + case 2: *input_a = &m_one; break; + case 3: *input_a = &m_zero; break; } } } @@ -2067,287 +1969,145 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect) rdp_poly_state* object = NULL; bool valid = false; - if(flip) + INT32* minx = flip ? &minxhx : &minxmx; + INT32* maxx = flip ? &maxxmx : &maxxhx; + INT32* startx = flip ? maxx : minx; + INT32* endx = flip ? minx : maxx; + + for (INT32 k = ycur; k <= ylfar; k++) { - for (INT32 k = ycur; k <= ylfar; k++) + if (k == ym) { - if (k == ym) - { - xleft = xl & ~1; - xleft_inc = (dxldy >> 2) & ~1; - } + xleft = xl & ~1; + xleft_inc = (dxldy >> 2) & ~1; + } - const INT32 xstart = xleft >> 16; // 319 - const INT32 xend = xright >> 16; // 0 - const INT32 j = k >> 2; - const INT32 spanidx = (k - ycur) >> 2; - const INT32 spix = k & 3; - const bool valid_y = !(k < yh || k >= yl); + const INT32 xstart = xleft >> 16; + const INT32 xend = xright >> 16; + const INT32 j = k >> 2; + const INT32 spanidx = (k - ycur) >> 2; + const INT32 spix = k & 3; + bool valid_y = !(k < yh || k >= yl); - if (spanidx >= 0 && spanidx < 2048) + if (spanidx >= 0 && spanidx < 2048) + { + majorxint[spix] = xend; + minorxint[spix] = xstart; + majorx[spix] = xright; + minorx[spix] = xleft; + + if (spix == 0) { - majorxint[spix] = xend; // 0 - minorxint[spix] = xstart; // 319 - majorx[spix] = xright; // 0x00000000 - minorx[spix] = xleft; // 0x013f0000 + *maxx = 0; + *minx = 0xfff; + } - if (spix == 0) + if (valid_y) + { + if (flip) { - maxxmx = 0; - minxhx = 0xfff; + *maxx = std::max(xstart, *maxx); + *minx = std::min(xend, *minx); } - - if (valid_y) + else { - maxxmx = (xstart > maxxmx) ? xstart : maxxmx; - minxhx = (xend < minxhx) ? xend : minxhx; + *minx = std::min(xstart, *minx); + *maxx = std::max(xend, *maxx); } + } - if (spix == 0) + if (spix == 0) + { + if(new_object) { - if(new_object) - { - object = &object_data_alloc(); - memcpy(object->m_tmem, m_tmem, 0x1000); - new_object = false; - } - - spans[spanidx].userdata = (void*)((UINT8*)m_aux_buf + m_aux_buf_ptr); - m_aux_buf_ptr += sizeof(rdp_span_aux); - - if(m_aux_buf_ptr >= EXTENT_AUX_COUNT) - { - fatalerror("n64_rdp::draw_triangle: span aux buffer overflow\n"); - } - - rdp_span_aux* userdata = (rdp_span_aux*)spans[spanidx].userdata; - valid = true; - - userdata->m_tmem = object->m_tmem; - - userdata->m_blend_color = m_blend_color; - userdata->m_prim_color = m_prim_color; - userdata->m_env_color = m_env_color; - userdata->m_fog_color = m_fog_color; - userdata->m_key_scale = m_key_scale; - userdata->m_lod_fraction = m_lod_fraction; - userdata->m_prim_lod_fraction = m_prim_lod_fraction; - - // Setup blender data for this scanline - set_blender_input(0, 0, &userdata->m_color_inputs.blender1a_r[0], - &userdata->m_color_inputs.blender1a_g[0], - &userdata->m_color_inputs.blender1a_b[0], - &userdata->m_color_inputs.blender1b_a[0], m_other_modes.blend_m1a_0, m_other_modes.blend_m1b_0, userdata); - set_blender_input(0, 1, &userdata->m_color_inputs.blender2a_r[0], - &userdata->m_color_inputs.blender2a_g[0], - &userdata->m_color_inputs.blender2a_b[0], - &userdata->m_color_inputs.blender2b_a[0], m_other_modes.blend_m2a_0, m_other_modes.blend_m2b_0, userdata); - set_blender_input(1, 0, &userdata->m_color_inputs.blender1a_r[1], - &userdata->m_color_inputs.blender1a_g[1], - &userdata->m_color_inputs.blender1a_b[1], - &userdata->m_color_inputs.blender1b_a[1], m_other_modes.blend_m1a_1, m_other_modes.blend_m1b_1, userdata); - set_blender_input(1, 1, &userdata->m_color_inputs.blender2a_r[1], - &userdata->m_color_inputs.blender2a_g[1], - &userdata->m_color_inputs.blender2a_b[1], - &userdata->m_color_inputs.blender2b_a[1], m_other_modes.blend_m2a_1, m_other_modes.blend_m2b_1, userdata); - - // Setup color combiner data for this scanline - set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a_r[0], &userdata->m_color_inputs.combiner_rgbsub_a_g[0], &userdata->m_color_inputs.combiner_rgbsub_a_b[0], m_combine.sub_a_rgb0, userdata); - set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b_r[0], &userdata->m_color_inputs.combiner_rgbsub_b_g[0], &userdata->m_color_inputs.combiner_rgbsub_b_b[0], m_combine.sub_b_rgb0, userdata); - set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul_r[0], &userdata->m_color_inputs.combiner_rgbmul_g[0], &userdata->m_color_inputs.combiner_rgbmul_b[0], m_combine.mul_rgb0, userdata); - set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd_r[0], &userdata->m_color_inputs.combiner_rgbadd_g[0], &userdata->m_color_inputs.combiner_rgbadd_b[0], m_combine.add_rgb0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[0], m_combine.sub_a_a0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[0], m_combine.sub_b_a0, userdata); - set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[0], m_combine.mul_a0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[0], m_combine.add_a0, userdata); - - set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a_r[1], &userdata->m_color_inputs.combiner_rgbsub_a_g[1], &userdata->m_color_inputs.combiner_rgbsub_a_b[1], m_combine.sub_a_rgb1, userdata); - set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b_r[1], &userdata->m_color_inputs.combiner_rgbsub_b_g[1], &userdata->m_color_inputs.combiner_rgbsub_b_b[1], m_combine.sub_b_rgb1, userdata); - set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul_r[1], &userdata->m_color_inputs.combiner_rgbmul_g[1], &userdata->m_color_inputs.combiner_rgbmul_b[1], m_combine.mul_rgb1, userdata); - set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd_r[1], &userdata->m_color_inputs.combiner_rgbadd_g[1], &userdata->m_color_inputs.combiner_rgbadd_b[1], m_combine.add_rgb1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[1], m_combine.sub_a_a1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[1], m_combine.sub_b_a1, userdata); - set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[1], m_combine.mul_a1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[1], m_combine.add_a1, userdata); + object = &object_data_alloc(); + memcpy(object->m_tmem, m_tmem, 0x1000); + new_object = false; } - if (spix == 3) - { - spans[spanidx].startx = maxxmx; - spans[spanidx].stopx = minxhx; - compute_cvg_flip(spans, majorx, minorx, majorxint, minorxint, j, yh, yl, ycur >> 2); - } + spans[spanidx].userdata = (void*)((UINT8*)m_aux_buf + m_aux_buf_ptr); + valid = true; + m_aux_buf_ptr += sizeof(rdp_span_aux); - if (spix == ldflag) + if(m_aux_buf_ptr >= EXTENT_AUX_COUNT) { - ((rdp_span_aux*)spans[spanidx].userdata)->m_unscissored_rx = xend; - xfrac = ((xright >> 8) & 0xff); - spans[spanidx].param[SPAN_R].start = ((r >> 9) << 9) + drdiff - (xfrac * drdxh); - spans[spanidx].param[SPAN_G].start = ((g >> 9) << 9) + dgdiff - (xfrac * dgdxh); - spans[spanidx].param[SPAN_B].start = ((b >> 9) << 9) + dbdiff - (xfrac * dbdxh); - spans[spanidx].param[SPAN_A].start = ((a >> 9) << 9) + dadiff - (xfrac * dadxh); - spans[spanidx].param[SPAN_S].start = (((s >> 9) << 9) + dsdiff - (xfrac * dsdxh)) & ~0x1f; - spans[spanidx].param[SPAN_T].start = (((t >> 9) << 9) + dtdiff - (xfrac * dtdxh)) & ~0x1f; - spans[spanidx].param[SPAN_W].start = (((w >> 9) << 9) + dwdiff - (xfrac * dwdxh)) & ~0x1f; - spans[spanidx].param[SPAN_Z].start = ((z >> 9) << 9) + dzdiff - (xfrac * dzdxh); + fatalerror("n64_rdp::draw_triangle: span aux buffer overflow\n"); } - } - if (spix == 3) - { - r += drde; - g += dgde; - b += dbde; - a += dade; - s += dsde; - t += dtde; - w += dwde; - z += dzde; + rdp_span_aux* userdata = (rdp_span_aux*)spans[spanidx].userdata; + userdata->m_tmem = object->m_tmem; + + userdata->m_blend_color = m_blend_color; + userdata->m_prim_color = m_prim_color; + userdata->m_env_color = m_env_color; + userdata->m_fog_color = m_fog_color; + userdata->m_prim_alpha = m_prim_alpha; + userdata->m_env_alpha = m_env_alpha; + userdata->m_key_scale = m_key_scale; + userdata->m_lod_fraction = m_lod_fraction; + userdata->m_prim_lod_fraction = m_prim_lod_fraction; + + // Setup blender data for this scanline + set_blender_input(0, 0, &userdata->m_color_inputs.blender1a_rgb[0], &userdata->m_color_inputs.blender1b_a[0], m_other_modes.blend_m1a_0, m_other_modes.blend_m1b_0, userdata); + set_blender_input(0, 1, &userdata->m_color_inputs.blender2a_rgb[0], &userdata->m_color_inputs.blender2b_a[0], m_other_modes.blend_m2a_0, m_other_modes.blend_m2b_0, userdata); + set_blender_input(1, 0, &userdata->m_color_inputs.blender1a_rgb[1], &userdata->m_color_inputs.blender1b_a[1], m_other_modes.blend_m1a_1, m_other_modes.blend_m1b_1, userdata); + set_blender_input(1, 1, &userdata->m_color_inputs.blender2a_rgb[1], &userdata->m_color_inputs.blender2b_a[1], m_other_modes.blend_m2a_1, m_other_modes.blend_m2b_1, userdata); + + // Setup color combiner data for this scanline + set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a[0], m_combine.sub_a_rgb0, userdata); + set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b[0], m_combine.sub_b_rgb0, userdata); + set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul[0], m_combine.mul_rgb0, userdata); + set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd[0], m_combine.add_rgb0, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[0], m_combine.sub_a_a0, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[0], m_combine.sub_b_a0, userdata); + set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[0], m_combine.mul_a0, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[0], m_combine.add_a0, userdata); + + set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a[1], m_combine.sub_a_rgb1, userdata); + set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b[1], m_combine.sub_b_rgb1, userdata); + set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul[1], m_combine.mul_rgb1, userdata); + set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd[1], m_combine.add_rgb1, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[1], m_combine.sub_a_a1, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[1], m_combine.sub_b_a1, userdata); + set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[1], m_combine.mul_a1, userdata); + set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[1], m_combine.add_a1, userdata); } - xleft += xleft_inc; - xright += xright_inc; - } - } - else - { - for (INT32 k = ycur; k <= ylfar; k++) - { - if (k == ym) + if (spix == 3) { - xleft = xl & ~1; - xleft_inc = (dxldy >> 2) & ~1; + spans[spanidx].startx = *startx; + spans[spanidx].stopx = *endx; + ((this)->*(m_compute_cvg[flip]))(spans, majorx, minorx, majorxint, minorxint, j, yh, yl, ycur >> 2); } - const INT32 xstart = xleft >> 16; - const INT32 xend = xright >> 16; - const INT32 j = k >> 2; - const INT32 spanidx = j - (ycur >> 2); - const INT32 spix = k & 3; - bool valid_y = !(k < yh || k >= yl); - - if (k >= 0 && k < 0x1000) + if (spix == ldflag) { - majorxint[spix] = xend; - minorxint[spix] = xstart; - majorx[spix] = xright; - minorx[spix] = xleft; - - if (spix == 0) - { - maxxhx = 0; - minxmx = 0xfff; - } - - if (valid_y) - { - minxmx = (xstart < minxmx) ? xstart : minxmx; - maxxhx = (xend > maxxhx) ? xend : maxxhx; - } - - if (spix == 0) - { - if(new_object) - { - object = &object_data_alloc(); - memcpy(object->m_tmem, m_tmem, 0x1000); - new_object = false; - } - - spans[spanidx].userdata = (void*)((UINT8*)m_aux_buf + m_aux_buf_ptr); - valid = true; - m_aux_buf_ptr += sizeof(rdp_span_aux); - - if(m_aux_buf_ptr >= EXTENT_AUX_COUNT) - { - fatalerror("n64_rdp::draw_triangle: span aux buffer overflow\n"); - } - - rdp_span_aux* userdata = (rdp_span_aux*)spans[spanidx].userdata; - userdata->m_tmem = object->m_tmem; - - userdata->m_blend_color = m_blend_color; - userdata->m_prim_color = m_prim_color; - userdata->m_env_color = m_env_color; - userdata->m_fog_color = m_fog_color; - userdata->m_key_scale = m_key_scale; - userdata->m_lod_fraction = m_lod_fraction; - userdata->m_prim_lod_fraction = m_prim_lod_fraction; - - // Setup blender data for this scanline - set_blender_input(0, 0, &userdata->m_color_inputs.blender1a_r[0], - &userdata->m_color_inputs.blender1a_g[0], - &userdata->m_color_inputs.blender1a_b[0], - &userdata->m_color_inputs.blender1b_a[0], m_other_modes.blend_m1a_0, m_other_modes.blend_m1b_0, userdata); - set_blender_input(0, 1, &userdata->m_color_inputs.blender2a_r[0], - &userdata->m_color_inputs.blender2a_g[0], - &userdata->m_color_inputs.blender2a_b[0], - &userdata->m_color_inputs.blender2b_a[0], m_other_modes.blend_m2a_0, m_other_modes.blend_m2b_0, userdata); - set_blender_input(1, 0, &userdata->m_color_inputs.blender1a_r[1], - &userdata->m_color_inputs.blender1a_g[1], - &userdata->m_color_inputs.blender1a_b[1], - &userdata->m_color_inputs.blender1b_a[1], m_other_modes.blend_m1a_1, m_other_modes.blend_m1b_1, userdata); - set_blender_input(1, 1, &userdata->m_color_inputs.blender2a_r[1], - &userdata->m_color_inputs.blender2a_g[1], - &userdata->m_color_inputs.blender2a_b[1], - &userdata->m_color_inputs.blender2b_a[1], m_other_modes.blend_m2a_1, m_other_modes.blend_m2b_1, userdata); - - // Setup color combiner data for this scanline - set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a_r[0], &userdata->m_color_inputs.combiner_rgbsub_a_g[0], &userdata->m_color_inputs.combiner_rgbsub_a_b[0], m_combine.sub_a_rgb0, userdata); - set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b_r[0], &userdata->m_color_inputs.combiner_rgbsub_b_g[0], &userdata->m_color_inputs.combiner_rgbsub_b_b[0], m_combine.sub_b_rgb0, userdata); - set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul_r[0], &userdata->m_color_inputs.combiner_rgbmul_g[0], &userdata->m_color_inputs.combiner_rgbmul_b[0], m_combine.mul_rgb0, userdata); - set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd_r[0], &userdata->m_color_inputs.combiner_rgbadd_g[0], &userdata->m_color_inputs.combiner_rgbadd_b[0], m_combine.add_rgb0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[0], m_combine.sub_a_a0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[0], m_combine.sub_b_a0, userdata); - set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[0], m_combine.mul_a0, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[0], m_combine.add_a0, userdata); - - set_suba_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_a_r[1], &userdata->m_color_inputs.combiner_rgbsub_a_g[1], &userdata->m_color_inputs.combiner_rgbsub_a_b[1], m_combine.sub_a_rgb1, userdata); - set_subb_input_rgb(&userdata->m_color_inputs.combiner_rgbsub_b_r[1], &userdata->m_color_inputs.combiner_rgbsub_b_g[1], &userdata->m_color_inputs.combiner_rgbsub_b_b[1], m_combine.sub_b_rgb1, userdata); - set_mul_input_rgb(&userdata->m_color_inputs.combiner_rgbmul_r[1], &userdata->m_color_inputs.combiner_rgbmul_g[1], &userdata->m_color_inputs.combiner_rgbmul_b[1], m_combine.mul_rgb1, userdata); - set_add_input_rgb(&userdata->m_color_inputs.combiner_rgbadd_r[1], &userdata->m_color_inputs.combiner_rgbadd_g[1], &userdata->m_color_inputs.combiner_rgbadd_b[1], m_combine.add_rgb1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_a[1], m_combine.sub_a_a1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphasub_b[1], m_combine.sub_b_a1, userdata); - set_mul_input_alpha(&userdata->m_color_inputs.combiner_alphamul[1], m_combine.mul_a1, userdata); - set_sub_input_alpha(&userdata->m_color_inputs.combiner_alphaadd[1], m_combine.add_a1, userdata); - } - - if (spix == 3) - { - spans[spanidx].startx = minxmx; - spans[spanidx].stopx = maxxhx; - compute_cvg_noflip(spans, majorx, minorx, majorxint, minorxint, j, yh, yl, ycur >> 2); - } - - if (spix == ldflag) - { - ((rdp_span_aux*)spans[spanidx].userdata)->m_unscissored_rx = xend; - xfrac = ((xright >> 8) & 0xff); - spans[spanidx].param[SPAN_R].start = ((r >> 9) << 9) + drdiff - (xfrac * drdxh); - spans[spanidx].param[SPAN_G].start = ((g >> 9) << 9) + dgdiff - (xfrac * dgdxh); - spans[spanidx].param[SPAN_B].start = ((b >> 9) << 9) + dbdiff - (xfrac * dbdxh); - spans[spanidx].param[SPAN_A].start = ((a >> 9) << 9) + dadiff - (xfrac * dadxh); - spans[spanidx].param[SPAN_S].start = (((s >> 9) << 9) + dsdiff - (xfrac * dsdxh)) & ~0x1f; - spans[spanidx].param[SPAN_T].start = (((t >> 9) << 9) + dtdiff - (xfrac * dtdxh)) & ~0x1f; - spans[spanidx].param[SPAN_W].start = (((w >> 9) << 9) + dwdiff - (xfrac * dwdxh)) & ~0x1f; - spans[spanidx].param[SPAN_Z].start = ((z >> 9) << 9) + dzdiff - (xfrac * dzdxh); - } + ((rdp_span_aux*)spans[spanidx].userdata)->m_unscissored_rx = xend; + xfrac = ((xright >> 8) & 0xff); + spans[spanidx].param[SPAN_R].start = ((r >> 9) << 9) + drdiff - (xfrac * drdxh); + spans[spanidx].param[SPAN_G].start = ((g >> 9) << 9) + dgdiff - (xfrac * dgdxh); + spans[spanidx].param[SPAN_B].start = ((b >> 9) << 9) + dbdiff - (xfrac * dbdxh); + spans[spanidx].param[SPAN_A].start = ((a >> 9) << 9) + dadiff - (xfrac * dadxh); + spans[spanidx].param[SPAN_S].start = (((s >> 9) << 9) + dsdiff - (xfrac * dsdxh)) & ~0x1f; + spans[spanidx].param[SPAN_T].start = (((t >> 9) << 9) + dtdiff - (xfrac * dtdxh)) & ~0x1f; + spans[spanidx].param[SPAN_W].start = (((w >> 9) << 9) + dwdiff - (xfrac * dwdxh)) & ~0x1f; + spans[spanidx].param[SPAN_Z].start = ((z >> 9) << 9) + dzdiff - (xfrac * dzdxh); } + } - if (spix == 3) - { - r += drde; - g += dgde; - b += dbde; - a += dade; - s += dsde; - t += dtde; - w += dwde; - z += dzde; - } - xleft += xleft_inc; - xright += xright_inc; + if (spix == 3) + { + r += drde; + g += dgde; + b += dbde; + a += dade; + s += dsde; + t += dtde; + w += dwde; + z += dzde; } + xleft += xleft_inc; + xright += xright_inc; } if(!new_object && valid) @@ -2547,13 +2307,13 @@ void n64_rdp::cmd_sync_full(UINT32 w1, UINT32 w2) void n64_rdp::cmd_set_key_gb(UINT32 w1, UINT32 w2) { - m_key_scale.i.b = w2 & 0xff; - m_key_scale.i.g = (w2 >> 16) & 0xff; + m_key_scale.set_b(w2 & 0xff); + m_key_scale.set_g((w2 >> 16) & 0xff); } void n64_rdp::cmd_set_key_r(UINT32 w1, UINT32 w2) { - m_key_scale.i.r = w2 & 0xff; + m_key_scale.set_r(w2 & 0xff); } void n64_rdp::cmd_set_fill_color32(UINT32 w1, UINT32 w2) @@ -2565,19 +2325,19 @@ void n64_rdp::cmd_set_fill_color32(UINT32 w1, UINT32 w2) void n64_rdp::cmd_set_convert(UINT32 w1, UINT32 w2) { if(!m_pipe_clean) { m_pipe_clean = true; wait("SetConvert"); } - INT32 k0 = (w1 >> 13) & 0xff; - INT32 k1 = (w1 >> 4) & 0xff; - INT32 k2 = ((w1 & 7) << 5) | ((w2 >> 27) & 0x1f); - INT32 k3 = (w2 >> 18) & 0xff; - INT32 k4 = (w2 >> 9) & 0xff; - INT32 k5 = w2 & 0xff; - k0 = ((w1 >> 21) & 1) ? (-(0x100 - k0)) : k0; - k1 = ((w1 >> 12) & 1) ? (-(0x100 - k1)) : k1; - k2 = (w1 & 0xf) ? (-(0x100 - k2)) : k2; - k3 = ((w2 >> 26) & 1) ? (-(0x100 - k3)) : k3; - k4 = ((w2 >> 17) & 1) ? (-(0x100 - k4)) : k4; - k5 = ((w2 >> 8) & 1) ? (-(0x100 - k5)) : k5; - set_yuv_factors(k0, k1, k2, k3, k4, k5); + INT32 k0 = (w1 >> 13) & 0x1ff; + INT32 k1 = (w1 >> 4) & 0x1ff; + INT32 k2 = ((w1 & 0xf) << 5) | ((w2 >> 27) & 0x1f); + INT32 k3 = (w2 >> 18) & 0x1ff; + INT32 k4 = (w2 >> 9) & 0x1ff; + INT32 k5 = w2 & 0x1ff; + + k0 = (SIGN9(k0) << 1) + 1; + k1 = (SIGN9(k1) << 1) + 1; + k2 = (SIGN9(k2) << 1) + 1; + k3 = (SIGN9(k3) << 1) + 1; + + set_yuv_factors(rgbaint_t(0, k0, k2, k3), rgbaint_t(0, 0, k1, 0), rgbaint_t(k4, k4, k4, k4), rgbaint_t(k5, k5, k5, k5)); } void n64_rdp::cmd_set_scissor(UINT32 w1, UINT32 w2) @@ -2685,6 +2445,9 @@ void n64_rdp::cmd_load_tlut(UINT32 w1, UINT32 w2) } default: fatalerror("RDP: load_tlut: size = %d\n", m_misc_state.m_ti_size); } + + m_tiles[tilenum].sth = rgbaint_t(0, m_tiles[tilenum].sh, 0, m_tiles[tilenum].th); + m_tiles[tilenum].stl = rgbaint_t(0, m_tiles[tilenum].sl, 0, m_tiles[tilenum].tl); } void n64_rdp::cmd_set_tile_size(UINT32 w1, UINT32 w2) @@ -2697,6 +2460,9 @@ void n64_rdp::cmd_set_tile_size(UINT32 w1, UINT32 w2) m_tiles[tilenum].tl = (w1 >> 0) & 0xfff; m_tiles[tilenum].sh = (w2 >> 12) & 0xfff; m_tiles[tilenum].th = (w2 >> 0) & 0xfff; + + m_tiles[tilenum].sth = rgbaint_t(0, m_tiles[tilenum].sh, 0, m_tiles[tilenum].th); + m_tiles[tilenum].stl = rgbaint_t(0, m_tiles[tilenum].sl, 0, m_tiles[tilenum].tl); } void n64_rdp::cmd_load_block(UINT32 w1, UINT32 w2) @@ -2859,6 +2625,9 @@ void n64_rdp::cmd_load_block(UINT32 w1, UINT32 w2) } tile[tilenum].th = tl; } + + m_tiles[tilenum].sth = rgbaint_t(0, m_tiles[tilenum].sh, 0, m_tiles[tilenum].th); + m_tiles[tilenum].stl = rgbaint_t(0, m_tiles[tilenum].sl, 0, m_tiles[tilenum].tl); } void n64_rdp::cmd_load_tile(UINT32 w1, UINT32 w2) @@ -2978,6 +2747,9 @@ void n64_rdp::cmd_load_tile(UINT32 w1, UINT32 w2) default: fatalerror("RDP: load_tile: size = %d\n", m_misc_state.m_ti_size); } + + m_tiles[tilenum].sth = rgbaint_t(0, m_tiles[tilenum].sh, 0, m_tiles[tilenum].th); + m_tiles[tilenum].stl = rgbaint_t(0, m_tiles[tilenum].sl, 0, m_tiles[tilenum].tl); } void n64_rdp::cmd_set_tile(UINT32 w1, UINT32 w2) @@ -3007,8 +2779,15 @@ void n64_rdp::cmd_set_tile(UINT32 w1, UINT32 w2) tex_tile->rshift_t = (tex_tile->shift_t < 11) ? tex_tile->shift_t : 0; tex_tile->wrapped_mask_s = (tex_tile->mask_s > 10 ? 10 : tex_tile->mask_s); tex_tile->wrapped_mask_t = (tex_tile->mask_t > 10 ? 10 : tex_tile->mask_t); + tex_tile->wrapped_mask = rgbaint_t(tex_tile->wrapped_mask_s, tex_tile->wrapped_mask_s, tex_tile->wrapped_mask_t, tex_tile->wrapped_mask_t); tex_tile->clamp_s = tex_tile->cs || !tex_tile->mask_s; tex_tile->clamp_t = tex_tile->ct || !tex_tile->mask_t; + tex_tile->mm = rgbaint_t(tex_tile->ms ? ~0 : 0, tex_tile->ms ? ~0 : 0, tex_tile->mt ? ~0 : 0, tex_tile->mt ? ~0 : 0); + tex_tile->invmm = rgbaint_t(tex_tile->ms ? 0 : ~0, tex_tile->ms ? 0 : ~0, tex_tile->mt ? 0 : ~0, tex_tile->mt ? 0 : ~0); + tex_tile->mask = rgbaint_t(tex_tile->mask_s, tex_tile->mask_s, tex_tile->mask_t, tex_tile->mask_t); + tex_tile->lshift = rgbaint_t(0, tex_tile->lshift_s, 0, tex_tile->lshift_t); + tex_tile->rshift = rgbaint_t(0, tex_tile->rshift_s, 0, tex_tile->rshift_t); + tex_tile->clamp_st = rgbaint_t(0, tex_tile->clamp_s ? ~0 : 0, 0, tex_tile->clamp_t ? ~0 : 0); if (tex_tile->format == FORMAT_I && tex_tile->size > PIXEL_SIZE_8BIT) { @@ -3060,24 +2839,28 @@ void n64_rdp::cmd_fill_rect(UINT32 w1, UINT32 w2) void n64_rdp::cmd_set_fog_color(UINT32 w1, UINT32 w2) { - m_fog_color.c = w2; + m_fog_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); } void n64_rdp::cmd_set_blend_color(UINT32 w1, UINT32 w2) { - m_blend_color.c = w2; + m_blend_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); } void n64_rdp::cmd_set_prim_color(UINT32 w1, UINT32 w2) { m_misc_state.m_min_level = (w1 >> 8) & 0x1f; - m_prim_lod_fraction = w1 & 0xff; - m_prim_color.c = w2; + const UINT8 prim_lod_fraction = w1 & 0xff; + m_prim_lod_fraction.set(prim_lod_fraction, prim_lod_fraction, prim_lod_fraction, prim_lod_fraction); + + m_prim_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_prim_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); } void n64_rdp::cmd_set_env_color(UINT32 w1, UINT32 w2) { - m_env_color.c = w2; + m_env_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_env_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); } void n64_rdp::cmd_set_combine(UINT32 w1, UINT32 w2) @@ -3277,8 +3060,8 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320 m_tiles[i].num = i; } - m_one.c = 0xffffffff; - m_zero.c = 0x00000000; + m_one.set(0xff, 0xff, 0xff, 0xff); + m_zero.set(0, 0, 0, 0); m_tmem = NULL; @@ -3286,7 +3069,7 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320 //memset(m_hidden_bits, 3, 8388608); - m_prim_lod_fraction = 0; + m_prim_lod_fraction.set(0, 0, 0, 0); for (INT32 i = 0; i < 256; i++) { @@ -3337,6 +3120,9 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320 { m_dzpix_normalize[i] = (UINT16)normalize_dzpix(i & 0xffff); } + + m_compute_cvg[0] = &n64_rdp::compute_cvg_noflip; + m_compute_cvg[1] = &n64_rdp::compute_cvg_flip; } void n64_state::video_start() diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h index b17445e00d8..ae7231c9dd0 100644 --- a/src/mame/video/n64.h +++ b/src/mame/video/n64.h @@ -6,8 +6,6 @@ #include "emu.h" #include "includes/n64.h" #include "video/poly.h" -#include "video/rdpblend.h" -#include "video/rdptpipe.h" /*****************************************************************************/ @@ -119,8 +117,6 @@ #define SPAN_W (6) #define SPAN_Z (7) -#define RDP_CVG_SPAN_MAX (1024) - #define EXTENT_AUX_COUNT (sizeof(rdp_span_aux)*(480*192)) // Screen coverage *192, more or less /*****************************************************************************/ @@ -128,291 +124,9 @@ class n64_periphs; class n64_rdp; -struct misc_state_t; -struct other_modes_t; -struct combine_mdoes_t; -struct color_inputs_t; -struct span_base_t; -struct rectangle_t; - -class color_t -{ - public: - color_t() - { - c = 0; - } - - union - { - UINT32 c; -#ifdef LSB_FIRST - struct { UINT8 a, b, g, r; } i; -#else - struct { UINT8 r, g, b, a; } i; -#endif - }; -}; - -enum -{ - BIT_DEPTH_32 = 0, - BIT_DEPTH_16, - - BIT_DEPTH_COUNT -}; - -class SpanParam -{ - public: - union - { - UINT32 w; -#ifdef LSB_FIRST - struct { UINT16 l; INT16 h; } h; -#else - struct { INT16 h; UINT16 l; } h; -#endif - }; -}; - -struct n64_tile_t -{ - INT32 format; // Image data format: RGBA, YUV, CI, IA, I - INT32 size; // Size of texel element: 4b, 8b, 16b, 32b - INT32 line; // Size of tile line in bytes - INT32 tmem; // Starting tmem address for this tile in bytes - INT32 palette; // Palette number for 4b CI texels - INT32 ct, mt, cs, ms; // Clamp / mirror enable bits for S / T direction - INT32 mask_t, shift_t, mask_s, shift_s; // Mask values / LOD shifts - INT32 lshift_s, rshift_s, lshift_t, rshift_t; - INT32 wrapped_mask_s, wrapped_mask_t; - bool clamp_s, clamp_t; - UINT16 sl, tl, sh, th; // 10.2 fixed-point, starting and ending texel row / column - INT32 num; -}; - -struct span_base_t -{ - INT32 m_span_dr; - INT32 m_span_dg; - INT32 m_span_db; - INT32 m_span_da; - INT32 m_span_ds; - INT32 m_span_dt; - INT32 m_span_dw; - INT32 m_span_dz; - INT32 m_span_dymax; - INT32 m_span_dzpix; - INT32 m_span_drdy; - INT32 m_span_dgdy; - INT32 m_span_dbdy; - INT32 m_span_dady; - INT32 m_span_dzdy; -}; - -struct misc_state_t -{ - misc_state_t() - { - m_max_level = 0; - m_min_level = 0; - } - - INT32 m_fb_format; // Framebuffer pixel format index (0 - I, 1 - IA, 2 - CI, 3 - RGBA) - INT32 m_fb_size; // Framebuffer pixel size index (0 - 4bpp, 1 - 8bpp, 2 - 16bpp, 3 - 32bpp) - INT32 m_fb_width; // Framebuffer width, in pixels - INT32 m_fb_height; // Framebuffer height, in pixels - UINT32 m_fb_address; // Framebuffer source address offset (in bytes) from start of RDRAM - - UINT32 m_zb_address; // Z-buffer source address offset (in bytes) from start of RDRAM - - INT32 m_ti_format; // Format for Texture Interface (TI) transfers - INT32 m_ti_size; // Size (in bytes) of TI transfers - INT32 m_ti_width; // Width (in pixels) of TI transfers - UINT32 m_ti_address; // Destination address for TI transfers - - UINT8 m_random_seed; // %HACK%, adds 19 each time it's read and is more or less random - - UINT32 m_max_level; // Maximum LOD level for texture filtering - UINT32 m_min_level; // Minimum LOD level for texture filtering - - UINT16 m_primitive_z; // Forced Z value for current primitive, if applicable - UINT16 m_primitive_dz; // Forced Delta-Z value for current primitive, if applicable -}; - -struct combine_modes_t -{ - INT32 sub_a_rgb0; - INT32 sub_b_rgb0; - INT32 mul_rgb0; - INT32 add_rgb0; - INT32 sub_a_a0; - INT32 sub_b_a0; - INT32 mul_a0; - INT32 add_a0; - - INT32 sub_a_rgb1; - INT32 sub_b_rgb1; - INT32 mul_rgb1; - INT32 add_rgb1; - INT32 sub_a_a1; - INT32 sub_b_a1; - INT32 mul_a1; - INT32 add_a1; -}; - -struct other_modes_t -{ - INT32 cycle_type; - bool persp_tex_en; - bool detail_tex_en; - bool sharpen_tex_en; - bool tex_lod_en; - bool en_tlut; - bool tlut_type; - bool sample_type; - bool mid_texel; - bool bi_lerp0; - bool bi_lerp1; - bool convert_one; - bool key_en; - INT32 rgb_dither_sel; - INT32 alpha_dither_sel; - INT32 blend_m1a_0; - INT32 blend_m1a_1; - INT32 blend_m1b_0; - INT32 blend_m1b_1; - INT32 blend_m2a_0; - INT32 blend_m2a_1; - INT32 blend_m2b_0; - INT32 blend_m2b_1; - INT32 tex_edge; - INT32 force_blend; - INT32 blend_shift; - bool alpha_cvg_select; - bool cvg_times_alpha; - INT32 z_mode; - INT32 cvg_dest; - bool color_on_cvg; - UINT8 image_read_en; - bool z_update_en; - bool z_compare_en; - bool antialias_en; - bool z_source_sel; - INT32 dither_alpha_en; - INT32 alpha_compare_en; - INT32 alpha_dither_mode; -}; - -struct color_inputs_t -{ - // combiner inputs - UINT8* combiner_rgbsub_a_r[2]; - UINT8* combiner_rgbsub_a_g[2]; - UINT8* combiner_rgbsub_a_b[2]; - UINT8* combiner_rgbsub_b_r[2]; - UINT8* combiner_rgbsub_b_g[2]; - UINT8* combiner_rgbsub_b_b[2]; - UINT8* combiner_rgbmul_r[2]; - UINT8* combiner_rgbmul_g[2]; - UINT8* combiner_rgbmul_b[2]; - UINT8* combiner_rgbadd_r[2]; - UINT8* combiner_rgbadd_g[2]; - UINT8* combiner_rgbadd_b[2]; - - UINT8* combiner_alphasub_a[2]; - UINT8* combiner_alphasub_b[2]; - UINT8* combiner_alphamul[2]; - UINT8* combiner_alphaadd[2]; - - // blender input - UINT8* blender1a_r[2]; - UINT8* blender1a_g[2]; - UINT8* blender1a_b[2]; - UINT8* blender1b_a[2]; - UINT8* blender2a_r[2]; - UINT8* blender2a_g[2]; - UINT8* blender2a_b[2]; - UINT8* blender2b_a[2]; -}; - -// This is enormous and horrible -struct rdp_span_aux -{ - UINT32 m_unscissored_rx; - UINT16 m_cvg[RDP_CVG_SPAN_MAX]; - color_t m_memory_color; - color_t m_pixel_color; - color_t m_inv_pixel_color; - color_t m_blended_pixel_color; - color_t m_combined_color; - color_t m_texel0_color; - color_t m_texel1_color; - color_t m_next_texel_color; - color_t m_blend_color; /* constant blend color */ - color_t m_prim_color; /* flat primitive color */ - color_t m_env_color; /* generic color constant ('environment') */ - color_t m_fog_color; /* generic color constant ('fog') */ - color_t m_shade_color; /* gouraud-shaded color */ - color_t m_key_scale; /* color-keying constant */ - color_t m_noise_color; /* noise */ - UINT8 m_lod_fraction; /* Z-based LOD fraction for this poly */ - UINT8 m_prim_lod_fraction; /* fixed LOD fraction for this poly */ - color_inputs_t m_color_inputs; - UINT32 m_current_pix_cvg; - UINT32 m_current_mem_cvg; - UINT32 m_current_cvg_bit; - INT32 m_shift_a; - INT32 m_shift_b; - INT32 m_precomp_s; - INT32 m_precomp_t; - INT32 m_blend_enable; - bool m_pre_wrap; - INT32 m_dzpix_enc; - UINT8* m_tmem; /* pointer to texture cache for this polygon */ - bool m_start_span; - INT32 m_clamp_s_diff[8]; - INT32 m_clamp_t_diff[8]; -}; - -struct rectangle_t -{ - UINT16 m_xl; // 10.2 fixed-point - UINT16 m_yl; // 10.2 fixed-point - UINT16 m_xh; // 10.2 fixed-point - UINT16 m_yh; // 10.2 fixed-point -}; - -struct z_decompress_entry_t -{ - UINT32 shift; - UINT32 add; -}; - -struct cv_mask_derivative_t -{ - UINT8 cvg; - UINT8 cvbit; - UINT8 xoff; - UINT8 yoff; -}; - -struct rdp_poly_state -{ - n64_rdp* m_rdp; /* pointer back to the RDP state */ - - misc_state_t m_misc_state; /* miscellaneous rasterizer bits */ - other_modes_t m_other_modes; /* miscellaneous rasterizer bits (2) */ - span_base_t m_span_base; /* span initial values for triangle rasterization */ - rectangle_t m_scissor; /* screen-space scissor bounds */ - UINT32 m_fill_color; /* poly fill color */ - n64_tile_t m_tiles[8]; /* texture tile state */ - UINT8 m_tmem[0x1000]; /* texture cache */ - INT32 tilenum; /* texture tile index */ - bool flip; /* left-major / right-major flip */ - bool rect; /* primitive is rectangle (vs. triangle) */ -}; +#include "video/n64types.h" +#include "video/rdpblend.h" +#include "video/rdptpipe.h" typedef void (*rdp_command_t)(UINT32 w1, UINT32 w2); @@ -463,12 +177,12 @@ public: // Color Combiner INT32 color_combiner_equation(INT32 a, INT32 b, INT32 c, INT32 d); INT32 alpha_combiner_equation(INT32 a, INT32 b, INT32 c, INT32 d); - void set_suba_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata); - void set_subb_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata); - void set_mul_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata); - void set_add_input_rgb(UINT8** input_r, UINT8** input_g, UINT8** input_b, INT32 code, rdp_span_aux* userdata); - void set_sub_input_alpha(UINT8** input, INT32 code, rdp_span_aux* userdata); - void set_mul_input_alpha(UINT8** input, INT32 code, rdp_span_aux* userdata); + void set_suba_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata); + void set_subb_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata); + void set_mul_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata); + void set_add_input_rgb(color_t** input, INT32 code, rdp_span_aux* userdata); + void set_sub_input_alpha(color_t** input, INT32 code, rdp_span_aux* userdata); + void set_mul_input_alpha(color_t** input, INT32 code, rdp_span_aux* userdata); // Texture memory UINT8* get_tmem8() { return m_tmem; } @@ -478,16 +192,12 @@ public: UINT8 get_random() { return m_misc_state.m_random_seed += 0x13; } // YUV Factors - void set_yuv_factors(INT32 k0, INT32 k1, INT32 k2, INT32 k3, INT32 k4, INT32 k5) { m_k0 = k0; m_k1 = k1; m_k2 = k2; m_k3 = k3; m_k4 = k4; m_k5 = k5; } - INT32 get_k0() const { return m_k0; } - INT32 get_k1() const { return m_k1; } - INT32 get_k2() const { return m_k2; } - INT32 get_k3() const { return m_k3; } - INT32* get_k4() { return &m_k4; } - INT32* get_k5() { return &m_k5; } + void set_yuv_factors(color_t k023, color_t k1, color_t k4, color_t k5) { m_k023 = k023; m_k1 = k1; m_k4 = k4; m_k5 = k5; } + color_t& get_k023() { return m_k023; } + color_t& get_k1() { return m_k1; } // Blender-related (move into RDP::Blender) - void set_blender_input(INT32 cycle, INT32 which, UINT8** input_r, UINT8** input_g, UINT8** input_b, UINT8** input_a, INT32 a, INT32 b, rdp_span_aux* userdata); + void set_blender_input(INT32 cycle, INT32 which, color_t** input_rgb, color_t** input_a, INT32 a, INT32 b, rdp_span_aux* userdata); // Span rasterization void span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp_poly_state &object, INT32 threadid); @@ -500,7 +210,7 @@ public: void tc_div_no_perspective(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst); UINT32 get_log2(UINT32 lod_clamp); void render_spans(INT32 start, INT32 end, INT32 tilenum, bool flip, extent_t* spans, bool rect, rdp_poly_state* object); - void get_alpha_cvg(UINT8* comb_alpha, rdp_span_aux* userdata, const rdp_poly_state &object); + INT32 get_alpha_cvg(INT32 comb_alpha, rdp_span_aux* userdata, const rdp_poly_state &object); void z_store(const rdp_poly_state &object, UINT32 zcurpixel, UINT32 dzcurpixel, UINT32 z, UINT32 enc); UINT32 z_decompress(UINT32 zcurpixel); @@ -566,11 +276,13 @@ public: // Color constants color_t m_blend_color; /* constant blend color */ color_t m_prim_color; /* flat primitive color */ + color_t m_prim_alpha; /* flat primitive alpha */ color_t m_env_color; /* generic color constant ('environment') */ + color_t m_env_alpha; /* generic alpha constant ('environment') */ color_t m_fog_color; /* generic color constant ('fog') */ color_t m_key_scale; /* color-keying constant */ - UINT8 m_lod_fraction; /* Z-based LOD fraction for this poly */ - UINT8 m_prim_lod_fraction; /* fixed LOD fraction for this poly */ + color_t m_lod_fraction; /* Z-based LOD fraction for this poly */ + color_t m_prim_lod_fraction; /* fixed LOD fraction for this poly */ color_t m_one; color_t m_zero; @@ -595,8 +307,6 @@ public: rectangle m_visarea; void draw_triangle(bool shade, bool texture, bool zbuffer, bool rect); - void compute_cvg_noflip(extent_t* spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base); - void compute_cvg_flip(extent_t* spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base); void* m_aux_buf; UINT32 m_aux_buf_ptr; @@ -607,9 +317,12 @@ public: n64_tile_t m_tiles[8]; private: - void write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp_span_aux* userdata, const rdp_poly_state &object); + void compute_cvg_noflip(extent_t* spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base); + void compute_cvg_flip(extent_t* spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base); + + void write_pixel(UINT32 curpixel, color_t& color, rdp_span_aux* userdata, const rdp_poly_state &object); void read_pixel(UINT32 curpixel, rdp_span_aux* userdata, const rdp_poly_state &object); - void copy_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, INT32 m_current_pix_cvg, const rdp_poly_state &object); + void copy_pixel(UINT32 curpixel, color_t& color, const rdp_poly_state &object); void fill_pixel(UINT32 curpixel, const rdp_poly_state &object); void precalc_cvmask_derivatives(void); @@ -618,6 +331,9 @@ private: void video_update16(n64_periphs* n64, bitmap_rgb32 &bitmap); void video_update32(n64_periphs* n64, bitmap_rgb32 &bitmap); + typedef void (n64_rdp::*compute_cvg_t) (extent_t* spans, INT32* majorx, INT32* minorx, INT32* majorxint, INT32* minorxint, INT32 scanline, INT32 yh, INT32 yl, INT32 base); + compute_cvg_t m_compute_cvg[2]; + running_machine* m_machine; combine_modes_t m_combine; @@ -644,12 +360,10 @@ private: UINT8* m_tmem; // YUV factors - INT32 m_k0; - INT32 m_k1; - INT32 m_k2; - INT32 m_k3; - INT32 m_k4; - INT32 m_k5; + color_t m_k023; + color_t m_k1; + color_t m_k4; + color_t m_k5; // Texture perspective division INT32 m_norm_point_rom[64]; diff --git a/src/mame/video/n64types.h b/src/mame/video/n64types.h new file mode 100644 index 00000000000..625ffd520f8 --- /dev/null +++ b/src/mame/video/n64types.h @@ -0,0 +1,334 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz + +#ifndef _VIDEO_N64TYPES_H_ +#define _VIDEO_N64TYPES_H_ + +#include "video/rgbutil.h" + +struct misc_state_t +{ + misc_state_t() + { + m_max_level = 0; + m_min_level = 0; + } + + INT32 m_fb_format; // Framebuffer pixel format index (0 - I, 1 - IA, 2 - CI, 3 - RGBA) + INT32 m_fb_size; // Framebuffer pixel size index (0 - 4bpp, 1 - 8bpp, 2 - 16bpp, 3 - 32bpp) + INT32 m_fb_width; // Framebuffer width, in pixels + INT32 m_fb_height; // Framebuffer height, in pixels + UINT32 m_fb_address; // Framebuffer source address offset (in bytes) from start of RDRAM + + UINT32 m_zb_address; // Z-buffer source address offset (in bytes) from start of RDRAM + + INT32 m_ti_format; // Format for Texture Interface (TI) transfers + INT32 m_ti_size; // Size (in bytes) of TI transfers + INT32 m_ti_width; // Width (in pixels) of TI transfers + UINT32 m_ti_address; // Destination address for TI transfers + + UINT8 m_random_seed; // %HACK%, adds 19 each time it's read and is more or less random + + UINT32 m_max_level; // Maximum LOD level for texture filtering + UINT32 m_min_level; // Minimum LOD level for texture filtering + + UINT16 m_primitive_z; // Forced Z value for current primitive, if applicable + UINT16 m_primitive_dz; // Forced Delta-Z value for current primitive, if applicable +}; + +#if 0 +class color_t +{ + public: + color_t() + { + c = 0; + } + + color_t(UINT32 color) + { + set(color); + } + + color_t(UINT8 a, UINT8 r, UINT8 g, UINT8 b) + { + set(a, r, g, b); + } + + inline void set(color_t& other) + { + c = other.c; + } + + inline void set(UINT32 color) + { + i.a = (color >> 24) & 0xff; + i.r = (color >> 16) & 0xff; + i.g = (color >> 8) & 0xff; + i.b = color & 0xff; + } + + void set(UINT8 a, UINT8 r, UINT8 g, UINT8 b) + { + i.a = a; + i.r = r; + i.g = g; + i.b = b; + } + + inline void set_direct(UINT32 color) + { + c = color; + } + + UINT32 get() + { + return i.a << 24 | i.r << 16 | i.g << 8 | i.b; + } + + union + { + UINT32 c; +#ifdef LSB_FIRST + struct { UINT8 a, b, g, r; } i; +#else + struct { UINT8 r, g, b, a; } i; +#endif + }; +}; +#else +#define color_t rgbaint_t +#endif + +enum +{ + BIT_DEPTH_32 = 0, + BIT_DEPTH_16, + + BIT_DEPTH_COUNT +}; + +struct n64_tile_t +{ + INT32 format; // Image data format: RGBA, YUV, CI, IA, I + INT32 size; // Size of texel element: 4b, 8b, 16b, 32b + INT32 line; // Size of tile line in bytes + INT32 tmem; // Starting tmem address for this tile in bytes + INT32 palette; // Palette number for 4b CI texels + INT32 ct, mt, cs, ms; // Clamp / mirror enable bits for S / T direction + INT32 mask_t, shift_t, mask_s, shift_s; // Mask values / LOD shifts + INT32 lshift_s, rshift_s, lshift_t, rshift_t; + INT32 wrapped_mask_s, wrapped_mask_t; + bool clamp_s, clamp_t; + rgbaint_t mm, invmm; + rgbaint_t wrapped_mask, mask, lshift, rshift, sth, stl, clamp_st; + UINT16 sl, tl, sh, th; // 10.2 fixed-point, starting and ending texel row / column + INT32 num; +}; + +struct span_base_t +{ + INT32 m_span_dr; + INT32 m_span_dg; + INT32 m_span_db; + INT32 m_span_da; + INT32 m_span_ds; + INT32 m_span_dt; + INT32 m_span_dw; + INT32 m_span_dz; + INT32 m_span_dymax; + INT32 m_span_dzpix; + INT32 m_span_drdy; + INT32 m_span_dgdy; + INT32 m_span_dbdy; + INT32 m_span_dady; + INT32 m_span_dzdy; +}; + +struct combine_modes_t +{ + INT32 sub_a_rgb0; + INT32 sub_b_rgb0; + INT32 mul_rgb0; + INT32 add_rgb0; + INT32 sub_a_a0; + INT32 sub_b_a0; + INT32 mul_a0; + INT32 add_a0; + + INT32 sub_a_rgb1; + INT32 sub_b_rgb1; + INT32 mul_rgb1; + INT32 add_rgb1; + INT32 sub_a_a1; + INT32 sub_b_a1; + INT32 mul_a1; + INT32 add_a1; +}; + +struct color_inputs_t +{ + // combiner inputs + color_t* combiner_rgbsub_a[2]; + color_t* combiner_rgbsub_b[2]; + color_t* combiner_rgbmul[2]; + color_t* combiner_rgbadd[2]; + + color_t* combiner_alphasub_a[2]; + color_t* combiner_alphasub_b[2]; + color_t* combiner_alphamul[2]; + color_t* combiner_alphaadd[2]; + + // blender input + color_t* blender1a_rgb[2]; + color_t* blender1b_a[2]; + color_t* blender2a_rgb[2]; + color_t* blender2b_a[2]; +}; + +struct other_modes_t +{ + INT32 cycle_type; + bool persp_tex_en; + bool detail_tex_en; + bool sharpen_tex_en; + bool tex_lod_en; + bool en_tlut; + bool tlut_type; + bool sample_type; + bool mid_texel; + bool bi_lerp0; + bool bi_lerp1; + bool convert_one; + bool key_en; + INT32 rgb_dither_sel; + INT32 alpha_dither_sel; + INT32 blend_m1a_0; + INT32 blend_m1a_1; + INT32 blend_m1b_0; + INT32 blend_m1b_1; + INT32 blend_m2a_0; + INT32 blend_m2a_1; + INT32 blend_m2b_0; + INT32 blend_m2b_1; + INT32 tex_edge; + INT32 force_blend; + INT32 blend_shift; + bool alpha_cvg_select; + bool cvg_times_alpha; + INT32 z_mode; + INT32 cvg_dest; + bool color_on_cvg; + UINT8 image_read_en; + bool z_update_en; + bool z_compare_en; + bool antialias_en; + bool z_source_sel; + INT32 dither_alpha_en; + INT32 alpha_compare_en; + INT32 alpha_dither_mode; +}; + +struct rectangle_t +{ + UINT16 m_xl; // 10.2 fixed-point + UINT16 m_yl; // 10.2 fixed-point + UINT16 m_xh; // 10.2 fixed-point + UINT16 m_yh; // 10.2 fixed-point +}; + +struct rdp_poly_state +{ + n64_rdp* m_rdp; /* pointer back to the RDP state */ + + misc_state_t m_misc_state; /* miscellaneous rasterizer bits */ + other_modes_t m_other_modes; /* miscellaneous rasterizer bits (2) */ + span_base_t m_span_base; /* span initial values for triangle rasterization */ + rectangle_t m_scissor; /* screen-space scissor bounds */ + UINT32 m_fill_color; /* poly fill color */ + n64_tile_t m_tiles[8]; /* texture tile state */ + UINT8 m_tmem[0x1000]; /* texture cache */ + INT32 tilenum; /* texture tile index */ + bool flip; /* left-major / right-major flip */ + bool rect; /* primitive is rectangle (vs. triangle) */ +}; + +#define RDP_CVG_SPAN_MAX (1024) + +// This is enormous and horrible +struct rdp_span_aux +{ + UINT32 m_unscissored_rx; + UINT16 m_cvg[RDP_CVG_SPAN_MAX]; + color_t m_memory_color; + color_t m_pixel_color; + color_t m_inv_pixel_color; + color_t m_blended_pixel_color; + + color_t m_combined_color; + color_t m_combined_alpha; + color_t m_texel0_color; + color_t m_texel0_alpha; + color_t m_texel1_color; + color_t m_texel1_alpha; + color_t m_next_texel_color; + color_t m_next_texel_alpha; + color_t m_blend_color; /* constant blend color */ + color_t m_prim_color; /* flat primitive color */ + color_t m_prim_alpha; /* flat primitive alpha */ + color_t m_env_color; /* generic color constant ('environment') */ + color_t m_env_alpha; /* generic alpha constant ('environment') */ + color_t m_fog_color; /* generic color constant ('fog') */ + color_t m_shade_color; /* gouraud-shaded color */ + color_t m_shade_alpha; /* gouraud-shaded alpha */ + color_t m_key_scale; /* color-keying constant */ + color_t m_noise_color; /* noise */ + color_t m_lod_fraction; /* Z-based LOD fraction for this poly */ + color_t m_prim_lod_fraction; /* fixed LOD fraction for this poly */ + color_t m_k4; + color_t m_k5; + color_inputs_t m_color_inputs; + UINT32 m_current_pix_cvg; + UINT32 m_current_mem_cvg; + UINT32 m_current_cvg_bit; + INT32 m_shift_a; + INT32 m_shift_b; + INT32 m_precomp_s; + INT32 m_precomp_t; + INT32 m_blend_enable; + bool m_pre_wrap; + INT32 m_dzpix_enc; + UINT8* m_tmem; /* pointer to texture cache for this polygon */ + bool m_start_span; + rgbaint_t m_clamp_diff[8]; +}; + +struct z_decompress_entry_t +{ + UINT32 shift; + UINT32 add; +}; + +struct cv_mask_derivative_t +{ + UINT8 cvg; + UINT8 cvbit; + UINT8 xoff; + UINT8 yoff; +}; + +class span_param_t +{ + public: + union + { + UINT32 w; +#ifdef LSB_FIRST + struct { UINT16 l; INT16 h; } h; +#else + struct { INT16 h; UINT16 l; } h; +#endif + }; +}; + +#endif // _VIDEO_N64TYPES_H_ diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index 83e13a33a80..8801fa0a10b 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -83,9 +83,9 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & int fogfactor = 0xff - extra.fogfactor; int fadefactor = 0xff - extra.fadefactor; int alphafactor = 0xff - m_state.m_poly_translucency; - rgbint fogcolor = extra.fogcolor; - rgbint fadecolor = extra.fadecolor; - rgbint polycolor = extra.polycolor; + rgbaint_t fogcolor = extra.fogcolor; + rgbaint_t fadecolor = extra.fadecolor; + rgbaint_t polycolor = extra.polycolor; int polyfade_enabled = extra.pfade_enabled; int penmask = 0xff; int penshift = 0; @@ -118,18 +118,17 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & for (int x = extent.startx; x < extent.stopx; x++) { float ooz = 1.0f / z; - int tx = (int)(u * ooz); - int ty = (int)(v * ooz) + bn; - int to = ((ty & 0xfff0) << 4) | ((tx & 0xff0) >> 4); - int pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[ttattr[to] << 8 | (ty << 4 & 0xf0) | (tx & 0xf)]]; + INT32 tx = (int)(u * ooz); + INT32 ty = (int)(v * ooz) + bn; + INT32 to = ((ty & 0xfff0) << 4) | ((tx & 0xff0) >> 4); + INT32 pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[ttattr[to] << 8 | (ty << 4 & 0xf0) | (tx & 0xf)]]; // pen = 0x55; // debug: disable textures - rgbint rgb; - rgb_to_rgbint(&rgb, pens[pen >> penshift & penmask]); + rgbaint_t rgb(pens[pen >> penshift & penmask]); // apply shading before fog - int shade = i*ooz; - rgbint_scale_immediate_and_clamp(&rgb, shade << 2); + INT32 shade = i*ooz; + rgb.scale_imm_and_clamp(shade << 2); // per-z distance fogging if (zfog_enabled) @@ -142,26 +141,30 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & if (fogfactor > 0) { if (fogfactor > 0xff) fogfactor = 0xff; - rgbint_blend(&rgb, &fogcolor, 0xff - fogfactor); + rgb.blend(fogcolor, 0xff - fogfactor); } } else if (fogfactor != 0xff) // direct - rgbint_blend(&rgb, &fogcolor, fogfactor); + { + rgb.blend(fogcolor, fogfactor); + } if (polyfade_enabled) - rgbint_scale_channel_and_clamp(&rgb, &polycolor); + { + rgb.scale_and_clamp(polycolor); + } if (fadefactor != 0xff) - rgbint_blend(&rgb, &fadecolor, fadefactor); + { + rgb.blend(fadecolor, fadefactor); + } if (alphafactor != 0xff) { - rgbint mix; - rgb_to_rgbint(&mix, dest[x]); - rgbint_blend(&rgb, &mix, alphafactor); + rgb.blend(rgbaint_t(dest[x]), alphafactor); } - dest[x] = rgbint_to_rgb(&rgb); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; u += du; @@ -181,8 +184,7 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & int pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[ttattr[to] << 8 | (ty << 4 & 0xf0) | (tx & 0xf)]]; // pen = 0x55; // debug: disable textures - rgbint rgb; - rgb_to_rgbint(&rgb, pens[pen >> penshift & penmask]); + rgbaint_t rgb(pens[pen >> penshift & penmask]); // per-z distance fogging if (zfog_enabled) @@ -193,19 +195,25 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & else cz = (cz < 0) ? 0 : 0x1fff; fogfactor = czram[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ cz]; if (fogfactor != 0) - rgbint_blend(&rgb, &fogcolor, 0xff - fogfactor); + { + rgb.blend(fogcolor, 0xff - fogfactor); + } } else if (fogfactor != 0xff) // direct - rgbint_blend(&rgb, &fogcolor, fogfactor); + { + rgb.blend(fogcolor, fogfactor); + } // apply shading after fog int shade = i*ooz; - rgbint_scale_immediate_and_clamp(&rgb, shade << 2); + rgb.scale_imm_and_clamp(shade << 2); if (polyfade_enabled) - rgbint_scale_channel_and_clamp(&rgb, &polycolor); + { + rgb.scale_and_clamp(polycolor); + } - dest[x] = rgbint_to_rgb(&rgb); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; u += du; @@ -227,8 +235,8 @@ void namcos22_renderer::renderscanline_sprite(INT32 scanline, const extent_t &ex int alphafactor = extra.alpha; int fogfactor = 0xff - extra.fogfactor; int fadefactor = 0xff - extra.fadefactor; - rgbint fogcolor = extra.fogcolor; - rgbint fadecolor = extra.fadecolor; + rgbaint_t fogcolor(extra.fogcolor); + rgbaint_t fadecolor(extra.fadecolor); UINT8 *source = (UINT8 *)extra.source + y_index * extra.line_modulo; UINT32 *dest = &extra.destbase->pix32(scanline); UINT8 *primap = &extra.primap->pix8(scanline); @@ -238,23 +246,24 @@ void namcos22_renderer::renderscanline_sprite(INT32 scanline, const extent_t &ex int pen = source[(int)x_index]; if (pen != 0xff) { - rgbint rgb; - rgb_to_rgbint(&rgb, pal[pen]); + rgbaint_t rgb(pal[pen]); if (fogfactor != 0xff) - rgbint_blend(&rgb, &fogcolor, fogfactor); + { + rgb.blend(fogcolor, fogfactor); + } if (fadefactor != 0xff) - rgbint_blend(&rgb, &fadecolor, fadefactor); + { + rgb.blend(fadecolor, fadefactor); + } if (alphafactor != 0xff) { - rgbint mix; - rgb_to_rgbint(&mix, dest[x]); - rgbint_blend(&rgb, &mix, alphafactor); + rgb.blend(rgbaint_t(dest[x]), alphafactor); } - dest[x] = rgbint_to_rgb(&rgb); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; } x_index += dx; @@ -356,12 +365,12 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (m_state.m_mixer_flags & 1) { extra.fadefactor = m_state.m_screen_fade_factor; - rgb_comp_to_rgbint(&extra.fadecolor, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); + extra.fadecolor.set(0, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); } // poly fade extra.pfade_enabled = m_state.m_poly_fade_enabled; - rgb_comp_to_rgbint(&extra.polycolor, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); + extra.polycolor.set(0, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); /* poly fog (not completely accurate yet) @@ -432,7 +441,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (nthword(m_state.m_czattr, 4) & (4 << (cztype * 4))) { int delta = (INT16)nthword(m_state.m_czattr, cztype); - rgb_comp_to_rgbint(&extra.fogcolor, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); + extra.fogcolor.set(0, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); if (direct) { int cz = ((flags & 0x1fff00) + cz_adjust) >> 8; @@ -462,7 +471,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (m_state.m_mixer_flags & 1) { extra.pfade_enabled = m_state.m_poly_fade_enabled; - rgb_comp_to_rgbint(&extra.polycolor, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); + extra.polycolor.set(0, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); } // poly fog @@ -470,7 +479,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit { int cztype = flags & 3; int czcolor = cztype & nthbyte(&m_state.m_fog_colormask, cztype); - rgb_comp_to_rgbint(&extra.fogcolor, m_state.m_fog_r_per_cztype[czcolor], m_state.m_fog_g_per_cztype[czcolor], m_state.m_fog_b_per_cztype[czcolor]); + extra.fogcolor.set(0, m_state.m_fog_r_per_cztype[czcolor], m_state.m_fog_g_per_cztype[czcolor], m_state.m_fog_b_per_cztype[czcolor]); if (direct) { @@ -555,7 +564,7 @@ void namcos22_renderer::poly3d_drawsprite( if (m_state.m_mixer_flags & 2) { extra.fadefactor = m_state.m_screen_fade_factor; - rgb_comp_to_rgbint(&extra.fadecolor, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); + extra.fadecolor.set(0, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); } // fog, 0xfe is a special case for sprite priority over textlayer @@ -563,7 +572,7 @@ void namcos22_renderer::poly3d_drawsprite( { // or does it fetch from poly-cz ram? that will break timecris though extra.fogfactor = cz_factor; - rgb_comp_to_rgbint(&extra.fogcolor, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); + extra.fogcolor.set(0, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); } render_triangle_fan(m_cliprect, render_delegate(FUNC(namcos22_renderer::renderscanline_sprite), this), 2, 4, vert); @@ -1883,8 +1892,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 // prepare fader bool fade_enabled = (m_mixer_flags & 2) && m_screen_fade_factor; int fade_factor = 0xff - m_screen_fade_factor; - rgbint fade_color; - rgb_comp_to_rgbint(&fade_color, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); + rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); // mix textlayer with poly/sprites for (int y = cliprect.min_y; y <= cliprect.max_y; y++) @@ -1897,8 +1905,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 // skip if transparent or under poly/sprite if (pri[x] == prival) { - rgbint rgb; - rgb_to_rgbint(&rgb, pens[src[x]]); + rgbaint_t rgb(pens[src[x]]); // apply alpha if (alpha_factor) @@ -1906,9 +1913,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 UINT8 pen = src[x] & 0xff; if ((pen & 0xf) == alpha_mask || pen == alpha_check12 || pen == alpha_check13) { - rgbint mix; - rgb_to_rgbint(&mix, dest[x]); - rgbint_blend(&rgb, &mix, 0xff - alpha_factor); + rgb.blend(rgbaint_t(dest[x]), 0xff - alpha_factor); } } @@ -1916,29 +1921,27 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 if (spot_enabled) { UINT8 pen = src[x] & 0xff; - rgbint mix; - rgb_to_rgbint(&mix, dest[x]); + rgbaint_t mix(dest[x]); if (spot_flags & 8) { // mix with per-channel brightness - rgbint shade; - rgb_comp_to_rgbint(&shade, - (0xff - (m_spotram[pen << 2 | 1] & 0xff)) << 2, - (0xff - (m_spotram[pen << 2 | 2] & 0xff)) << 2, - (0xff - (m_spotram[pen << 2 | 3] & 0xff)) << 2 - ); - rgbint_scale_channel_and_clamp(&mix, &shade); + rgbaint_t shade(0, (0xff - (m_spotram[pen << 2 | 1] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 2] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 3] & 0xff)) << 2); + mix.scale_and_clamp(shade); } int spot_factor = 0xff - (m_spotram[pen << 2] & 0xff); if (spot_factor < spot_limit) - rgbint_blend(&rgb, &mix, spot_factor); + { + rgb.blend(mix, spot_factor); + } } if (fade_enabled) - rgbint_blend(&rgb, &fade_color, fade_factor); + { + rgb.blend(fade_color, fade_factor); + } - dest[x] = rgbint_to_rgb(&rgb); + dest[x] = rgb.to_rgba(); } } } @@ -1954,12 +1957,13 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 // prepare fader and shadow factor bool fade_enabled = m_mixer_flags & 2 && m_poly_fade_enabled; bool shadow_enabled = (m_mixer_flags & 0x100) != 0; // ? (ridgerac is the only game not using shadow) - rgbint fade_color, rgb_mix[3]; - rgb_comp_to_rgbint(&fade_color, m_poly_fade_r, m_poly_fade_g, m_poly_fade_b); - rgb_comp_to_rgbint(&rgb_mix[0], nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)); // pen c - rgb_comp_to_rgbint(&rgb_mix[1], nthbyte(m_mixer, 0x0b), nthbyte(m_mixer, 0x0c), nthbyte(m_mixer, 0x0d)); // pen d - rgb_comp_to_rgbint(&rgb_mix[2], nthbyte(m_mixer, 0x0e), nthbyte(m_mixer, 0x0f), nthbyte(m_mixer, 0x10)); // pen e + rgbaint_t fade_color(0, m_poly_fade_r, m_poly_fade_g, m_poly_fade_b); + rgbaint_t rgb_mix[3] = { + rgbaint_t(0, nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)), // pen c + rgbaint_t(0, nthbyte(m_mixer, 0x0b), nthbyte(m_mixer, 0x0c), nthbyte(m_mixer, 0x0d)), // pen d + rgbaint_t(0, nthbyte(m_mixer, 0x0e), nthbyte(m_mixer, 0x0f), nthbyte(m_mixer, 0x10)) // pen e + }; // mix textlayer with poly/sprites for (int y = cliprect.min_y; y <= cliprect.max_y; y++) @@ -1973,7 +1977,7 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 if (pri[x] == 2) { // apply shadow - rgbint rgb; + rgbaint_t rgb; switch (src[x] & 0xff) { case 0xfc: @@ -1981,24 +1985,26 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 case 0xfe: if (shadow_enabled) { - rgb_to_rgbint(&rgb, dest[x]); - rgbint_scale_channel_and_clamp(&rgb, &rgb_mix[(src[x] & 0xf) - 0xc]); + rgb.set(dest[x]); + rgb.scale_and_clamp(rgb_mix[(src[x] & 0xf) - 0xc]); break; } // (fall through) default: - rgb_to_rgbint(&rgb, pens[src[x]]); + rgb.set(pens[src[x]]); break; } if (fade_enabled) - rgbint_scale_channel_and_clamp(&rgb, &fade_color); + { + rgb.scale_and_clamp(fade_color); + } // BTANB note: fading to white does not affect color channels set to 00, // eg. a rr-gg-bb of 3f-7f-00 will fade to ff-ff-00 and not ff-ff-ff // seen in victlapw attract mode - dest[x] = rgbint_to_rgb(&rgb); + dest[x] = rgb.to_rgba(); } } } @@ -2279,15 +2285,13 @@ UINT32 namcos22_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb screen.priority().fill(0, cliprect); // background color - rgbint bg_color; - rgb_comp_to_rgbint(&bg_color, nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)); + rgbaint_t bg_color(0, nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)); if (m_mixer_flags & 1 && m_screen_fade_factor) { - rgbint fade_color; - rgb_comp_to_rgbint(&fade_color, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); - rgbint_blend(&bg_color, &fade_color, 0xff - m_screen_fade_factor); + rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); + bg_color.blend(fade_color, 0xff - m_screen_fade_factor); } - bitmap.fill(rgbint_to_rgb(&bg_color), cliprect); + bitmap.fill(bg_color.to_rgba(), cliprect); // layers UINT8 layer = nthbyte(m_mixer, 0x1f); diff --git a/src/mame/video/namcos86.c b/src/mame/video/namcos86.c index 0b2e31e3b9f..2878127fd33 100644 --- a/src/mame/video/namcos86.c +++ b/src/mame/video/namcos86.c @@ -148,7 +148,7 @@ void namcos86_state::video_start() } m_spriteram = m_rthunder_spriteram + 0x1800; - + save_item(NAME(m_tilebank)); save_item(NAME(m_xscroll)); save_item(NAME(m_yscroll)); diff --git a/src/mame/video/nbmj8991.c b/src/mame/video/nbmj8991.c index c07a598c27c..cc688e9d1ab 100644 --- a/src/mame/video/nbmj8991.c +++ b/src/mame/video/nbmj8991.c @@ -289,7 +289,7 @@ void nbmj8991_state::gfxdraw() void nbmj8991_state::video_start() { m_blitter_timer = timer_alloc(TIMER_BLITTER); - + int width = m_screen->width(); int height = m_screen->height(); @@ -297,9 +297,9 @@ void nbmj8991_state::video_start() m_videoram = auto_alloc_array(machine(), UINT8, width * height); m_clut = auto_alloc_array(machine(), UINT8, 0x800); memset(m_videoram, 0x00, (width * height * sizeof(UINT8))); - + m_screen_refresh = 1; - + save_item(NAME(m_scrollx)); save_item(NAME(m_scrolly)); save_item(NAME(m_blitter_destx)); @@ -316,7 +316,7 @@ void nbmj8991_state::video_start() save_pointer(NAME(m_videoram), width * height); save_pointer(NAME(m_clut), 0x800); save_item(NAME(m_flipscreen_old)); - + machine().save().register_postload(save_prepost_delegate(FUNC(nbmj8991_state::postload), this)); } diff --git a/src/mame/video/powervr2.c b/src/mame/video/powervr2.c index fb5319ff8c6..95638a3681d 100644 --- a/src/mame/video/powervr2.c +++ b/src/mame/video/powervr2.c @@ -119,9 +119,9 @@ inline INT32 powervr2_device::clamp(INT32 in, INT32 min, INT32 max) // Perform a standard bilinear filter across four pixels inline UINT32 powervr2_device::bilinear_filter(UINT32 c0, UINT32 c1, UINT32 c2, UINT32 c3, float u, float v) { - UINT32 ui = (u * 256.0f); - UINT32 vi = (v * 256.0f); - return rgba_bilinear_filter(c0, c1, c3, c2, ui, vi); + const UINT32 ui = (u * 256.0f); + const UINT32 vi = (v * 256.0f); + return rgbaint_t::bilinear_filter(c0, c1, c3, c2, ui, vi); } // Multiply with alpha value in bits 31-24 diff --git a/src/mame/video/rdpblend.c b/src/mame/video/rdpblend.c index 98030ee11fb..f71cda4599f 100644 --- a/src/mame/video/rdpblend.c +++ b/src/mame/video/rdpblend.c @@ -88,428 +88,368 @@ bool n64_blender_t::alpha_reject(rdp_span_aux* userdata, const rdp_poly_state& o return false; case 2: - return userdata->m_pixel_color.i.a < userdata->m_blend_color.i.a; + return userdata->m_pixel_color.get_a() < userdata->m_blend_color.get_a(); case 3: - return userdata->m_pixel_color.i.a < (rand() & 0xff); + return userdata->m_pixel_color.get_a() < (rand() & 0xff); default: return false; } } -bool n64_blender_t::cycle1_noblend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_noblend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - *fr = *userdata->m_color_inputs.blender1a_r[0]; - *fg = *userdata->m_color_inputs.blender1a_g[0]; - *fb = *userdata->m_color_inputs.blender1a_b[0]; + blended_pixel.set(*userdata->m_color_inputs.blender1a_rgb[0]); return true; } -bool n64_blender_t::cycle1_noblend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_noblend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - *fr = m_color_dither[((*userdata->m_color_inputs.blender1a_r[0] & 0xff) << 3) | dith]; - *fg = m_color_dither[((*userdata->m_color_inputs.blender1a_g[0] & 0xff) << 3) | dith]; - *fb = m_color_dither[((*userdata->m_color_inputs.blender1a_b[0] & 0xff) << 3) | dith]; + + rgbaint_t index(*userdata->m_color_inputs.blender1a_rgb[0]); + index.shl_imm(3); + index.or_imm(dith); + index.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } -bool n64_blender_t::cycle1_noblend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_noblend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - *fr = *userdata->m_color_inputs.blender1a_r[0]; - *fg = *userdata->m_color_inputs.blender1a_g[0]; - *fb = *userdata->m_color_inputs.blender1a_b[0]; + blended_pixel.set(*userdata->m_color_inputs.blender1a_rgb[0]); return true; } -bool n64_blender_t::cycle1_noblend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_noblend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - *fr = m_color_dither[((*userdata->m_color_inputs.blender1a_r[0] & 0xff) << 3) | dith]; - *fg = m_color_dither[((*userdata->m_color_inputs.blender1a_g[0] & 0xff) << 3) | dith]; - *fb = m_color_dither[((*userdata->m_color_inputs.blender1a_b[0] & 0xff) << 3) | dith]; + + rgbaint_t index(*userdata->m_color_inputs.blender1a_rgb[0]); + index.shl_imm(3); + index.or_imm(dith); + index.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } -bool n64_blender_t::cycle1_blend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_blend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object); - - *fr = r; - *fg = g; - *fb = b; + blend_with_partial_reject(blended_pixel, 0, partialreject, sel0, userdata, object); return true; } -bool n64_blender_t::cycle1_blend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_blend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object); + color_t rgb; + blend_with_partial_reject(rgb, 0, partialreject, sel0, userdata, object); - *fr = m_color_dither[((r & 0xff) << 3) | dith]; - *fg = m_color_dither[((g & 0xff) << 3) | dith]; - *fb = m_color_dither[((b & 0xff) << 3) | dith]; + rgb.shl_imm(3); + rgb.or_imm(dith); + rgb.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } -bool n64_blender_t::cycle1_blend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_blend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object); - - *fr = r; - *fg = g; - *fb = b; + blend_with_partial_reject(blended_pixel, 0, partialreject, sel0, userdata, object); return true; } -bool n64_blender_t::cycle1_blend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle1_blend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - blend_with_partial_reject(&r, &g, &b, 0, partialreject, sel0, userdata, object); + color_t rgb; + blend_with_partial_reject(rgb, 0, partialreject, sel0, userdata, object); - *fr = m_color_dither[((r & 0xff) << 3) | dith]; - *fg = m_color_dither[((g & 0xff) << 3) | dith]; - *fb = m_color_dither[((b & 0xff) << 3) | dith]; + rgb.shl_imm(3); + rgb.or_imm(dith); + rgb.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } -bool n64_blender_t::cycle2_noblend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_noblend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; - *fr = *userdata->m_color_inputs.blender1a_r[1]; - *fg = *userdata->m_color_inputs.blender1a_g[1]; - *fb = *userdata->m_color_inputs.blender1a_b[1]; + blended_pixel.set(*userdata->m_color_inputs.blender1a_rgb[1]); return true; } -bool n64_blender_t::cycle2_noblend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_noblend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - (UINT8)userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; - *fr = m_color_dither[((*userdata->m_color_inputs.blender1a_r[1] & 0xff) << 3) | dith]; - *fg = m_color_dither[((*userdata->m_color_inputs.blender1a_g[1] & 0xff) << 3) | dith]; - *fb = m_color_dither[((*userdata->m_color_inputs.blender1a_b[1] & 0xff) << 3) | dith]; + rgbaint_t index(*userdata->m_color_inputs.blender1a_rgb[1]); + index.shl_imm(3); + index.or_imm(dith); + index.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } -bool n64_blender_t::cycle2_noblend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_noblend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; - *fr = *userdata->m_color_inputs.blender1a_r[1]; - *fg = *userdata->m_color_inputs.blender1a_g[1]; - *fb = *userdata->m_color_inputs.blender1a_b[1]; + blended_pixel.set(*userdata->m_color_inputs.blender1a_rgb[1]); return true; } -bool n64_blender_t::cycle2_noblend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_noblend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; - *fr = m_color_dither[((*userdata->m_color_inputs.blender1a_r[1] & 0xff) << 3) | dith]; - *fg = m_color_dither[((*userdata->m_color_inputs.blender1a_g[1] & 0xff) << 3) | dith]; - *fb = m_color_dither[((*userdata->m_color_inputs.blender1a_b[1] & 0xff) << 3) | dith]; + rgbaint_t index(*userdata->m_color_inputs.blender1a_rgb[1]); + index.shl_imm(3); + index.or_imm(dith); + index.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } -bool n64_blender_t::cycle2_blend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_blend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[((UINT8)userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[((UINT8)userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); - - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object); - - *fr = r; - *fg = g; - *fb = b; + blend_with_partial_reject(blended_pixel, 1, partialreject, sel1, userdata, object); return true; } -bool n64_blender_t::cycle2_blend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_blend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_pixel_color.i.a = m_alpha_dither[(userdata->m_pixel_color.i.a << 3) | adseed]; - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_pixel_color.set_a(m_alpha_dither[(userdata->m_pixel_color.get_a() << 3) | adseed]); + userdata->m_shade_color.set_a(m_alpha_dither[(userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); - - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object); + color_t rgb; + blend_with_partial_reject(rgb, 1, partialreject, sel1, userdata, object); - *fr = m_color_dither[((r & 0xff) << 3) | dith]; - *fg = m_color_dither[((g & 0xff) << 3) | dith]; - *fb = m_color_dither[((b & 0xff) << 3) | dith]; + rgb.shl_imm(3); + rgb.or_imm(dith); + rgb.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } -bool n64_blender_t::cycle2_blend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_blend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[(userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); - - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; - - blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - *fr = r; - *fg = g; - *fb = b; + blend_with_partial_reject(blended_pixel, 1, partialreject, sel1, userdata, object); return true; } -bool n64_blender_t::cycle2_blend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) +bool n64_blender_t::cycle2_blend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object) { - INT32 r, g, b; - - userdata->m_shade_color.i.a = m_alpha_dither[(userdata->m_shade_color.i.a << 3) | adseed]; + userdata->m_shade_color.set_a(m_alpha_dither[(userdata->m_shade_color.get_a() << 3) | adseed]); if (test_for_reject(userdata, object)) { return false; } - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[0]; - blend_pipe(0, sel0, &r, &g, &b, userdata, object); - - userdata->m_blended_pixel_color.i.r = r; - userdata->m_blended_pixel_color.i.g = g; - userdata->m_blended_pixel_color.i.b = b; - userdata->m_blended_pixel_color.i.a = userdata->m_pixel_color.i.a; + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[0]->get_a()); + blend_pipe(0, sel0, userdata->m_blended_pixel_color, userdata, object); + userdata->m_blended_pixel_color.set_a(userdata->m_pixel_color.get_a()); - blend_with_partial_reject(&r, &g, &b, 1, partialreject, sel1, userdata, object); + color_t rgb; + blend_with_partial_reject(rgb, 1, partialreject, sel1, userdata, object); - *fr = m_color_dither[((r & 0xff) << 3) | dith]; - *fg = m_color_dither[((g & 0xff) << 3) | dith]; - *fb = m_color_dither[((b & 0xff) << 3) | dith]; + rgb.shl_imm(3); + rgb.or_imm(dith); + rgb.and_imm(0x7ff); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } -void n64_blender_t::blend_with_partial_reject(INT32* r, INT32* g, INT32* b, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux* userdata, const rdp_poly_state& object) +void n64_blender_t::blend_with_partial_reject(color_t& out, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux* userdata, const rdp_poly_state& object) { - if (partialreject && userdata->m_pixel_color.i.a >= 0xff) + if (partialreject && userdata->m_pixel_color.get_a() >= 0xff) { - *r = *userdata->m_color_inputs.blender1a_r[cycle]; - *g = *userdata->m_color_inputs.blender1a_g[cycle]; - *b = *userdata->m_color_inputs.blender1a_b[cycle]; + out.set(*userdata->m_color_inputs.blender1a_rgb[cycle]); } else { - userdata->m_inv_pixel_color.i.a = 0xff - *userdata->m_color_inputs.blender1b_a[cycle]; - blend_pipe(cycle, select, r, g, b, userdata, object); + userdata->m_inv_pixel_color.set_a(0xff - userdata->m_color_inputs.blender1b_a[cycle]->get_a()); + blend_pipe(cycle, select, out, userdata, object); } } -void n64_blender_t::blend_pipe(const int cycle, const int special, int* r_out, int* g_out, int* b_out, rdp_span_aux* userdata, const rdp_poly_state& object) +void n64_blender_t::blend_pipe(const int cycle, const int special, color_t& out, rdp_span_aux* userdata, const rdp_poly_state& object) { const INT32 mask = 0xff &~ (0x73 * special); const INT32 shift_a = 3 + userdata->m_shift_a * special; const INT32 shift_b = 3 + userdata->m_shift_b * special; - const INT32 blend1a = (*userdata->m_color_inputs.blender1b_a[cycle] >> shift_a) & mask; - const INT32 blend2a = (*userdata->m_color_inputs.blender2b_a[cycle] >> shift_b) & mask; + const INT32 blend1a = (userdata->m_color_inputs.blender1b_a[cycle]->get_a() >> shift_a) & mask; + const INT32 blend2a = (userdata->m_color_inputs.blender2b_a[cycle]->get_a() >> shift_b) & mask; const INT32 special_shift = special << 1; - INT32 r = (((int)(*userdata->m_color_inputs.blender1a_r[cycle]) * (int)(blend1a))) + (((int)(*userdata->m_color_inputs.blender2a_r[cycle]) * (int)(blend2a))); - INT32 g = (((int)(*userdata->m_color_inputs.blender1a_g[cycle]) * (int)(blend1a))) + (((int)(*userdata->m_color_inputs.blender2a_g[cycle]) * (int)(blend2a))); - INT32 b = (((int)(*userdata->m_color_inputs.blender1a_b[cycle]) * (int)(blend1a))) + (((int)(*userdata->m_color_inputs.blender2a_b[cycle]) * (int)(blend2a))); + rgbaint_t temp(*userdata->m_color_inputs.blender1a_rgb[cycle]); + temp.mul_imm(blend1a); - r += ((int)*userdata->m_color_inputs.blender2a_r[cycle]) << special_shift; - g += ((int)*userdata->m_color_inputs.blender2a_g[cycle]) << special_shift; - b += ((int)*userdata->m_color_inputs.blender2a_b[cycle]) << special_shift; + rgbaint_t secondary(*userdata->m_color_inputs.blender2a_rgb[cycle]); + rgbaint_t other(*userdata->m_color_inputs.blender2a_rgb[cycle]); + other.mul_imm(blend2a); - r >>= object.m_other_modes.blend_shift; - g >>= object.m_other_modes.blend_shift; - b >>= object.m_other_modes.blend_shift; + temp.add(other); + secondary.shl_imm(special_shift); + temp.add(secondary); + temp.shr_imm(object.m_other_modes.blend_shift); + INT32 factor_sum = 0; if (!object.m_other_modes.force_blend) { - INT32 factor_sum = ((blend1a >> 2) + (blend2a >> 2) + 1) & 0xf; + factor_sum = ((blend1a >> 2) + (blend2a >> 2) + 1) & 0xf; if (factor_sum) { - r /= factor_sum; - g /= factor_sum; - b /= factor_sum; + temp.set_r(temp.get_r32() / factor_sum); + temp.set_g(temp.get_g32() / factor_sum); + temp.set_b(temp.get_b32() / factor_sum); } else { - r = g = b = 0xff; + temp.set(0, 0xff, 0xff, 0xff); } } - *r_out = min(r, 255); - *g_out = min(g, 255); - *b_out = min(b, 255); + temp.min(255); + out.set(temp); } inline INT32 n64_blender_t::min(const INT32 x, const INT32 min) diff --git a/src/mame/video/rdpblend.h b/src/mame/video/rdpblend.h index 89d97e7a5c3..75f51cea7ea 100644 --- a/src/mame/video/rdpblend.h +++ b/src/mame/video/rdpblend.h @@ -17,19 +17,13 @@ #define _VIDEO_RDPBLEND_H_ #include "emu.h" - -struct other_modes_t; -struct misc_state_t; -class n64_rdp; -struct rdp_span_aux; -class color_t; -struct rdp_poly_state; +#include "video/n64.h" class n64_blender_t { public: - typedef bool (n64_blender_t::*blender1)(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - typedef bool (n64_blender_t::*blender2)(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + typedef bool (n64_blender_t::*blender1)(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + typedef bool (n64_blender_t::*blender2)(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); n64_blender_t(); @@ -48,26 +42,26 @@ class n64_blender_t INT32 min(const INT32 x, const INT32 min); bool alpha_reject(rdp_span_aux* userdata, const rdp_poly_state& object); bool test_for_reject(rdp_span_aux* userdata, const rdp_poly_state& object); - void blend_pipe(const int cycle, const int special, int* r_out, int* g_out, int* b_out, rdp_span_aux* userdata, const rdp_poly_state& object); - void blend_with_partial_reject(INT32* r, INT32* g, INT32* b, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux* userdata, const rdp_poly_state& object); - - bool cycle1_noblend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_noblend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_noblend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_noblend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_blend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_blend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_blend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle1_blend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); - - bool cycle2_noblend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_noblend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_noblend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_noblend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_blend_noacvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_blend_noacvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_blend_acvg_nodither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); - bool cycle2_blend_acvg_dither(INT32* fr, INT32* fg, INT32* fb, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + void blend_pipe(const int cycle, const int special, color_t& out, rdp_span_aux* userdata, const rdp_poly_state& object); + void blend_with_partial_reject(color_t& out, INT32 cycle, INT32 partialreject, INT32 select, rdp_span_aux* userdata, const rdp_poly_state& object); + + bool cycle1_noblend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_noblend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_noblend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_noblend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_blend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_blend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_blend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle1_blend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, rdp_span_aux* userdata, const rdp_poly_state& object); + + bool cycle2_noblend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_noblend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_noblend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_noblend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_blend_noacvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_blend_noacvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_blend_acvg_nodither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); + bool cycle2_blend_acvg_dither(color_t& blended_pixel, int dith, int adseed, int partialreject, int sel0, int sel1, rdp_span_aux* userdata, const rdp_poly_state& object); INT32 dither_alpha(INT32 alpha, INT32 dither); INT32 dither_color(INT32 color, INT32 dither); diff --git a/src/mame/video/rdpfiltr.inc b/src/mame/video/rdpfiltr.inc index c70dfb50e19..31f10f4858a 100644 --- a/src/mame/video/rdpfiltr.inc +++ b/src/mame/video/rdpfiltr.inc @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +#if 0 INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UINT8* hbuff, const UINT32 hres); INLINE void divot_filter16(UINT8* r, UINT8* g, UINT8* b, UINT16* fbuff, UINT32 fbuff_index); INLINE void restore_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index, UINT32 hres); @@ -613,3 +614,4 @@ INLINE UINT32 ge_two(UINT32 enb) } return 0; } +#endif diff --git a/src/mame/video/rdpspn16.c b/src/mame/video/rdpspn16.c index d36e14f7733..dab36695736 100644 --- a/src/mame/video/rdpspn16.c +++ b/src/mame/video/rdpspn16.c @@ -16,6 +16,7 @@ #include "emu.h" #include "includes/n64.h" #include "video/n64.h" +#include "video/rgbutil.h" void n64_rdp::render_spans(INT32 start, INT32 end, INT32 tilenum, bool flip, extent_t* spans, bool rect, rdp_poly_state* object) { @@ -81,10 +82,10 @@ void n64_rdp::render_spans(INT32 start, INT32 end, INT32 tilenum, bool flip, ext void n64_rdp::rgbaz_clip(INT32 sr, INT32 sg, INT32 sb, INT32 sa, INT32* sz, rdp_span_aux* userdata) { - userdata->m_shade_color.i.r = s_special_9bit_clamptable[sr & 0x1ff]; - userdata->m_shade_color.i.g = s_special_9bit_clamptable[sg & 0x1ff]; - userdata->m_shade_color.i.b = s_special_9bit_clamptable[sb & 0x1ff]; - userdata->m_shade_color.i.a = s_special_9bit_clamptable[sa & 0x1ff]; + userdata->m_shade_color.set(sa, sr, sg, sb); + userdata->m_shade_color.clamp_and_clear(0xfffffe00); + UINT32 a = userdata->m_shade_color.get_a(); + userdata->m_shade_alpha.set(a, a, a, a); INT32 zanded = (*sz) & 0x60000; @@ -130,7 +131,7 @@ void n64_rdp::rgbaz_correct_triangle(INT32 offx, INT32 offy, INT32* r, INT32* g, } } -inline void n64_rdp::write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp_span_aux* userdata, const rdp_poly_state &object) +inline void n64_rdp::write_pixel(UINT32 curpixel, color_t& color, rdp_span_aux* userdata, const rdp_poly_state &object) { if (object.m_misc_state.m_fb_size == 2) // 16-bit framebuffer { @@ -143,7 +144,8 @@ inline void n64_rdp::write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp } else { - finalcolor = ((r >> 3) << 11) | ((g >> 3) << 6) | ((b >> 3) << 1); + color.shr_imm(3); + finalcolor = (color.get_r() << 11) | (color.get_g() << 6) | (color.get_b() << 1); } switch (object.m_other_modes.cvg_dest) @@ -194,7 +196,7 @@ inline void n64_rdp::write_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, rdp } else { - finalcolor = (r << 24) | (g << 16) | (b << 8); + finalcolor = (color.get_r() << 24) | (color.get_g() << 16) | (color.get_b() << 8); } switch (object.m_other_modes.cvg_dest) @@ -232,59 +234,52 @@ inline void n64_rdp::read_pixel(UINT32 curpixel, rdp_span_aux* userdata, const r { if (object.m_misc_state.m_fb_size == 2) // 16-bit framebuffer { - UINT16 fword; + const UINT16 fword = RREADIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel); + userdata->m_memory_color.set(0, GETHICOL(fword), GETMEDCOL(fword), GETLOWCOL(fword)); if (object.m_other_modes.image_read_en) { - fword = RREADIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel); UINT8 hbyte = HREADADDR8((object.m_misc_state.m_fb_address >> 1) + curpixel); - userdata->m_memory_color.i.a = userdata->m_current_mem_cvg << 5; + userdata->m_memory_color.set_a(userdata->m_current_mem_cvg << 5); userdata->m_current_mem_cvg = ((fword & 1) << 2) | (hbyte & 3); } else { - fword = RREADIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel); - userdata->m_memory_color.i.a = 0xff; + userdata->m_memory_color.set_a(0xff); userdata->m_current_mem_cvg = 7; } - - userdata->m_memory_color.i.r = GETHICOL(fword); - userdata->m_memory_color.i.g = GETMEDCOL(fword); - userdata->m_memory_color.i.b = GETLOWCOL(fword); } else // 32-bit framebuffer { - UINT32 mem; - + const UINT32 mem = RREADIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel); + userdata->m_memory_color.set(0, (mem >> 24) & 0xff, (mem >> 16) & 0xff, (mem >> 8) & 0xff); if (object.m_other_modes.image_read_en) { - mem = RREADIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel); - userdata->m_memory_color.i.a = (mem) & 0xff; + userdata->m_memory_color.set_a(mem & 0xff); userdata->m_current_mem_cvg = (mem >> 5) & 7; } else { - mem = RREADIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel); - userdata->m_memory_color.i.a = 0xff; + userdata->m_memory_color.set_a(0xff); userdata->m_current_mem_cvg = 7; } - - userdata->m_memory_color.i.r = (mem >> 24) & 0xff; - userdata->m_memory_color.i.g = (mem >> 16) & 0xff; - userdata->m_memory_color.i.b = (mem >> 8) & 0xff; } } -inline void n64_rdp::copy_pixel(UINT32 curpixel, INT32 r, INT32 g, INT32 b, INT32 m_current_pix_cvg, const rdp_poly_state &object) +inline void n64_rdp::copy_pixel(UINT32 curpixel, color_t& color, const rdp_poly_state &object) { + const UINT32 current_pix_cvg = color.get_a() ? 7 : 0; + const UINT8 r = color.get_r(); // Vectorize me + const UINT8 g = color.get_g(); + const UINT8 b = color.get_b(); if (object.m_misc_state.m_fb_size == 2) // 16-bit framebuffer { - RWRITEIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel, ((r >> 3) << 11) | ((g >> 3) << 6) | ((b >> 3) << 1) | ((m_current_pix_cvg >> 2) & 1)); - HWRITEADDR8((object.m_misc_state.m_fb_address >> 1) + curpixel, m_current_pix_cvg & 3); + RWRITEIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel, ((r >> 3) << 11) | ((g >> 3) << 6) | ((b >> 3) << 1) | ((current_pix_cvg >> 2) & 1)); + HWRITEADDR8((object.m_misc_state.m_fb_address >> 1) + curpixel, current_pix_cvg & 3); } else // 32-bit framebuffer { - RWRITEIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel, (r << 24) | (g << 16) | (b << 8) | (m_current_pix_cvg << 5)); + RWRITEIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel, (r << 24) | (g << 16) | (b << 8) | (current_pix_cvg << 5)); } } @@ -321,14 +316,14 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp const INT32 tilenum = object.tilenum; const bool flip = object.flip; - SpanParam r; r.w = extent.param[SPAN_R].start; - SpanParam g; g.w = extent.param[SPAN_G].start; - SpanParam b; b.w = extent.param[SPAN_B].start; - SpanParam a; a.w = extent.param[SPAN_A].start; - SpanParam z; z.w = extent.param[SPAN_Z].start; - SpanParam s; s.w = extent.param[SPAN_S].start; - SpanParam t; t.w = extent.param[SPAN_T].start; - SpanParam w; w.w = extent.param[SPAN_W].start; + span_param_t r; r.w = extent.param[SPAN_R].start; + span_param_t g; g.w = extent.param[SPAN_G].start; + span_param_t b; b.w = extent.param[SPAN_B].start; + span_param_t a; a.w = extent.param[SPAN_A].start; + span_param_t z; z.w = extent.param[SPAN_Z].start; + span_param_t s; s.w = extent.param[SPAN_S].start; + span_param_t t; t.w = extent.param[SPAN_T].start; + span_param_t w; w.w = extent.param[SPAN_W].start; const UINT32 zb = object.m_misc_state.m_zb_address >> 1; const UINT32 zhb = object.m_misc_state.m_zb_address; @@ -342,8 +337,8 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp m_tex_pipe.calculate_clamp_diffs(tilenum, userdata, object); - const bool partialreject = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[0] == &userdata->m_pixel_color.i.a); - const INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0; + const bool partialreject = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_inv_pixel_color && userdata->m_color_inputs.blender1b_a[0] == &userdata->m_pixel_color); + const INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color) ? 1 : 0; INT32 drinc, dginc, dbinc, dainc; INT32 dzinc, dzpix; @@ -384,7 +379,6 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp INT32 x = xend; const INT32 length = flip ? (xstart - xend) : (xend - xstart); - INT32 fir, fig, fib; if(object.m_other_modes.z_source_sel) { @@ -436,17 +430,38 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp rgbaz_clip(sr, sg, sb, sa, &sz, userdata); ((m_tex_pipe).*(m_tex_pipe.m_cycle[cycle0]))(&userdata->m_texel0_color, &userdata->m_texel0_color, sss, sst, tilenum, 0, userdata, object); - //m_tex_pipe.Cycle(&userdata->m_texel0_color, &userdata->m_texel0_color, sss, sst, tilenum, 0, userdata, object); + UINT32 t0a = userdata->m_texel0_color.get_a(); + userdata->m_texel0_alpha.set(t0a, t0a, t0a, t0a); + + const UINT8 noise = rand() << 3; // Not accurate + userdata->m_noise_color.set(0, noise, noise, noise); + + rgbaint_t rgbsub_a(*userdata->m_color_inputs.combiner_rgbsub_a[1]); + rgbaint_t rgbsub_b(*userdata->m_color_inputs.combiner_rgbsub_b[1]); + rgbaint_t rgbmul(*userdata->m_color_inputs.combiner_rgbmul[1]); + rgbaint_t rgbadd(*userdata->m_color_inputs.combiner_rgbadd[1]); + + rgbsub_a.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_a[1]); + rgbsub_b.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_b[1]); + rgbmul.merge_alpha(*userdata->m_color_inputs.combiner_alphamul[1]); + rgbadd.merge_alpha(*userdata->m_color_inputs.combiner_alphaadd[1]); - userdata->m_noise_color.i.r = userdata->m_noise_color.i.g = userdata->m_noise_color.i.b = rand() << 3; // Not accurate + rgbsub_a.sign_extend(0x180, 0xfffffe00); + rgbsub_b.sign_extend(0x180, 0xfffffe00); + rgbadd.sign_extend(0x180, 0xfffffe00); - userdata->m_pixel_color.i.r = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_r[1],*userdata->m_color_inputs.combiner_rgbsub_b_r[1],*userdata->m_color_inputs.combiner_rgbmul_r[1],*userdata->m_color_inputs.combiner_rgbadd_r[1]); - userdata->m_pixel_color.i.g = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_g[1],*userdata->m_color_inputs.combiner_rgbsub_b_g[1],*userdata->m_color_inputs.combiner_rgbmul_g[1],*userdata->m_color_inputs.combiner_rgbadd_g[1]); - userdata->m_pixel_color.i.b = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_b[1],*userdata->m_color_inputs.combiner_rgbsub_b_b[1],*userdata->m_color_inputs.combiner_rgbmul_b[1],*userdata->m_color_inputs.combiner_rgbadd_b[1]); - userdata->m_pixel_color.i.a = alpha_combiner_equation(*userdata->m_color_inputs.combiner_alphasub_a[1],*userdata->m_color_inputs.combiner_alphasub_b[1],*userdata->m_color_inputs.combiner_alphamul[1],*userdata->m_color_inputs.combiner_alphaadd[1]); + rgbadd.shl_imm(8); + rgbsub_a.sub(rgbsub_b); + rgbsub_a.mul(rgbmul); + rgbsub_a.add(rgbadd); + rgbsub_a.add_imm(0x0080); + rgbsub_a.sra_imm(8); + rgbsub_a.clamp_and_clear(0xfffffe00); + + userdata->m_pixel_color = rgbsub_a; //Alpha coverage combiner - get_alpha_cvg(&userdata->m_pixel_color.i.a, userdata, object); + userdata->m_pixel_color.set_a(get_alpha_cvg(userdata->m_pixel_color.get_a(), userdata, object)); const UINT32 curpixel = fb_index + x; const UINT32 zbcur = zb + curpixel; @@ -460,15 +475,12 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp INT32 adith = 0; get_dither_values(scanline, j, &cdith, &adith, object); - if (((userdata->m_blend_enable << 2) | blend_index) != 5 && machine().input().code_pressed(KEYCODE_B)) - { - printf("1:%d\n", (userdata->m_blend_enable << 2) | blend_index); - } - bool rendered = ((&m_blender)->*(m_blender.blend1[(userdata->m_blend_enable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, userdata, object); + color_t blended_pixel; + bool rendered = ((&m_blender)->*(m_blender.blend1[(userdata->m_blend_enable << 2) | blend_index]))(blended_pixel, cdith, adith, partialreject, sel0, userdata, object); if (rendered) { - write_pixel(curpixel, fir, fig, fib, userdata, object); + write_pixel(curpixel, blended_pixel, userdata, object); if (object.m_other_modes.z_update_en) { z_store(object, zbcur, zhbcur, sz, userdata->m_dzpix_enc); @@ -502,14 +514,14 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp const INT32 tilenum = object.tilenum; const bool flip = object.flip; - SpanParam r; r.w = extent.param[SPAN_R].start; - SpanParam g; g.w = extent.param[SPAN_G].start; - SpanParam b; b.w = extent.param[SPAN_B].start; - SpanParam a; a.w = extent.param[SPAN_A].start; - SpanParam z; z.w = extent.param[SPAN_Z].start; - SpanParam s; s.w = extent.param[SPAN_S].start; - SpanParam t; t.w = extent.param[SPAN_T].start; - SpanParam w; w.w = extent.param[SPAN_W].start; + span_param_t r; r.w = extent.param[SPAN_R].start; + span_param_t g; g.w = extent.param[SPAN_G].start; + span_param_t b; b.w = extent.param[SPAN_B].start; + span_param_t a; a.w = extent.param[SPAN_A].start; + span_param_t z; z.w = extent.param[SPAN_Z].start; + span_param_t s; s.w = extent.param[SPAN_S].start; + span_param_t t; t.w = extent.param[SPAN_T].start; + span_param_t w; w.w = extent.param[SPAN_W].start; const UINT32 zb = object.m_misc_state.m_zb_address >> 1; const UINT32 zhb = object.m_misc_state.m_zb_address; @@ -531,9 +543,9 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp m_tex_pipe.calculate_clamp_diffs(tile1, userdata, object); - bool partialreject = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_inv_pixel_color.i.a && userdata->m_color_inputs.blender1b_a[1] == &userdata->m_pixel_color.i.a); - INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color.i.a) ? 1 : 0; - INT32 sel1 = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_memory_color.i.a) ? 1 : 0; + bool partialreject = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_inv_pixel_color && userdata->m_color_inputs.blender1b_a[1] == &userdata->m_pixel_color); + INT32 sel0 = (userdata->m_color_inputs.blender2b_a[0] == &userdata->m_memory_color) ? 1 : 0; + INT32 sel1 = (userdata->m_color_inputs.blender2b_a[1] == &userdata->m_memory_color) ? 1 : 0; INT32 drinc, dginc, dbinc, dainc; INT32 dzinc, dzpix; @@ -577,7 +589,6 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp INT32 x = xend; const INT32 length = flip ? (xstart - xend) : (xend - xstart); - INT32 fir, fig, fib; if(object.m_other_modes.z_source_sel) { @@ -644,46 +655,74 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp ((m_tex_pipe).*(m_tex_pipe.m_cycle[cycle1]))(&userdata->m_texel1_color, &userdata->m_texel0_color, sss, sst, tile2, 1, userdata, object); ((m_tex_pipe).*(m_tex_pipe.m_cycle[cycle1]))(&userdata->m_next_texel_color, &userdata->m_next_texel_color, sss, sst, tile2, 1, userdata, object); - userdata->m_noise_color.i.r = userdata->m_noise_color.i.g = userdata->m_noise_color.i.b = rand() << 3; // Not accurate - userdata->m_combined_color.i.r = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_r[0], - *userdata->m_color_inputs.combiner_rgbsub_b_r[0], - *userdata->m_color_inputs.combiner_rgbmul_r[0], - *userdata->m_color_inputs.combiner_rgbadd_r[0]); - userdata->m_combined_color.i.g = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_g[0], - *userdata->m_color_inputs.combiner_rgbsub_b_g[0], - *userdata->m_color_inputs.combiner_rgbmul_g[0], - *userdata->m_color_inputs.combiner_rgbadd_g[0]); - userdata->m_combined_color.i.b = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_b[0], - *userdata->m_color_inputs.combiner_rgbsub_b_b[0], - *userdata->m_color_inputs.combiner_rgbmul_b[0], - *userdata->m_color_inputs.combiner_rgbadd_b[0]); - userdata->m_combined_color.i.a = alpha_combiner_equation(*userdata->m_color_inputs.combiner_alphasub_a[0], - *userdata->m_color_inputs.combiner_alphasub_b[0], - *userdata->m_color_inputs.combiner_alphamul[0], - *userdata->m_color_inputs.combiner_alphaadd[0]); - - userdata->m_texel0_color = userdata->m_texel1_color; - userdata->m_texel1_color = userdata->m_next_texel_color; - - userdata->m_pixel_color.i.r = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_r[1], - *userdata->m_color_inputs.combiner_rgbsub_b_r[1], - *userdata->m_color_inputs.combiner_rgbmul_r[1], - *userdata->m_color_inputs.combiner_rgbadd_r[1]); - userdata->m_pixel_color.i.g = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_g[1], - *userdata->m_color_inputs.combiner_rgbsub_b_g[1], - *userdata->m_color_inputs.combiner_rgbmul_g[1], - *userdata->m_color_inputs.combiner_rgbadd_g[1]); - userdata->m_pixel_color.i.b = color_combiner_equation(*userdata->m_color_inputs.combiner_rgbsub_a_b[1], - *userdata->m_color_inputs.combiner_rgbsub_b_b[1], - *userdata->m_color_inputs.combiner_rgbmul_b[1], - *userdata->m_color_inputs.combiner_rgbadd_b[1]); - userdata->m_pixel_color.i.a = alpha_combiner_equation(*userdata->m_color_inputs.combiner_alphasub_a[1], - *userdata->m_color_inputs.combiner_alphasub_b[1], - *userdata->m_color_inputs.combiner_alphamul[1], - *userdata->m_color_inputs.combiner_alphaadd[1]); + UINT32 t0a = userdata->m_texel0_color.get_a(); + UINT32 t1a = userdata->m_texel1_color.get_a(); + UINT32 tna = userdata->m_next_texel_color.get_a(); + userdata->m_texel0_alpha.set(t0a, t0a, t0a, t0a); + userdata->m_texel1_alpha.set(t1a, t1a, t1a, t1a); + userdata->m_next_texel_alpha.set(tna, tna, tna, tna); + + const UINT8 noise = rand() << 3; // Not accurate + userdata->m_noise_color.set(0, noise, noise, noise); + + rgbaint_t rgbsub_a(*userdata->m_color_inputs.combiner_rgbsub_a[0]); + rgbaint_t rgbsub_b(*userdata->m_color_inputs.combiner_rgbsub_b[0]); + rgbaint_t rgbmul(*userdata->m_color_inputs.combiner_rgbmul[0]); + rgbaint_t rgbadd(*userdata->m_color_inputs.combiner_rgbadd[0]); + + rgbsub_a.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_a[0]); + rgbsub_b.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_b[0]); + rgbmul.merge_alpha(*userdata->m_color_inputs.combiner_alphamul[0]); + rgbadd.merge_alpha(*userdata->m_color_inputs.combiner_alphaadd[0]); + + rgbsub_a.sign_extend(0x180, 0xfffffe00); + rgbsub_b.sign_extend(0x180, 0xfffffe00); + rgbadd.sign_extend(0x180, 0xfffffe00); + + rgbadd.shl_imm(8); + rgbsub_a.sub(rgbsub_b); + rgbsub_a.mul(rgbmul); + + rgbsub_a.add(rgbadd); + rgbsub_a.add_imm(0x0080); + rgbsub_a.sra_imm(8); + rgbsub_a.clamp_and_clear(0xfffffe00); + + userdata->m_combined_color.set(rgbsub_a); + userdata->m_texel0_color.set(userdata->m_texel1_color); + userdata->m_texel1_color.set(userdata->m_next_texel_color); + + UINT32 ca = userdata->m_combined_color.get_a(); + userdata->m_combined_alpha.set(ca, ca, ca, ca); + userdata->m_texel0_alpha.set(userdata->m_texel1_alpha); + userdata->m_texel1_alpha.set(userdata->m_next_texel_alpha); + + rgbsub_a.set(*userdata->m_color_inputs.combiner_rgbsub_a[1]); + rgbsub_b.set(*userdata->m_color_inputs.combiner_rgbsub_b[1]); + rgbmul.set(*userdata->m_color_inputs.combiner_rgbmul[1]); + rgbadd.set(*userdata->m_color_inputs.combiner_rgbadd[1]); + + rgbsub_a.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_a[1]); + rgbsub_b.merge_alpha(*userdata->m_color_inputs.combiner_alphasub_b[1]); + rgbmul.merge_alpha(*userdata->m_color_inputs.combiner_alphamul[1]); + rgbadd.merge_alpha(*userdata->m_color_inputs.combiner_alphaadd[1]); + + rgbsub_a.sign_extend(0x180, 0xfffffe00); + rgbsub_b.sign_extend(0x180, 0xfffffe00); + rgbadd.sign_extend(0x180, 0xfffffe00); + + rgbadd.shl_imm(8); + rgbsub_a.sub(rgbsub_b); + rgbsub_a.mul(rgbmul); + rgbsub_a.add(rgbadd); + rgbsub_a.add_imm(0x0080); + rgbsub_a.sra_imm(8); + rgbsub_a.clamp_and_clear(0xfffffe00); + + userdata->m_pixel_color.set(rgbsub_a); //Alpha coverage combiner - get_alpha_cvg(&userdata->m_pixel_color.i.a, userdata, object); + userdata->m_pixel_color.set_a(get_alpha_cvg(userdata->m_pixel_color.get_a(), userdata, object)); const UINT32 curpixel = fb_index + x; const UINT32 zbcur = zb + curpixel; @@ -695,15 +734,12 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp { get_dither_values(scanline, j, &cdith, &adith, object); - if (((userdata->m_blend_enable << 2) | blend_index) != 5 && machine().input().code_pressed(KEYCODE_B)) - { - printf("2:%d\n", (userdata->m_blend_enable << 2) | blend_index); - } - bool rendered = ((&m_blender)->*(m_blender.blend2[(userdata->m_blend_enable << 2) | blend_index]))(&fir, &fig, &fib, cdith, adith, partialreject, sel0, sel1, userdata, object); + color_t blended_pixel; + bool rendered = ((&m_blender)->*(m_blender.blend2[(userdata->m_blend_enable << 2) | blend_index]))(blended_pixel, cdith, adith, partialreject, sel0, sel1, userdata, object); if (rendered) { - write_pixel(curpixel, fir, fig, fib, userdata, object); + write_pixel(curpixel, blended_pixel, userdata, object); if (object.m_other_modes.z_update_en) { z_store(object, zbcur, zhbcur, sz, userdata->m_dzpix_enc); @@ -741,8 +777,8 @@ void n64_rdp::span_draw_copy(INT32 scanline, const extent_t &extent, const rdp_p const INT32 xinc = flip ? 1 : -1; const INT32 length = flip ? (xstart - xend) : (xend - xstart); - SpanParam s; s.w = extent.param[SPAN_S].start; - SpanParam t; t.w = extent.param[SPAN_T].start; + span_param_t s; s.w = extent.param[SPAN_S].start; + span_param_t t; t.w = extent.param[SPAN_T].start; const INT32 ds = object.m_span_base.m_span_ds / 4; const INT32 dt = object.m_span_base.m_span_dt / 4; @@ -764,9 +800,9 @@ void n64_rdp::span_draw_copy(INT32 scanline, const extent_t &extent, const rdp_p m_tex_pipe.copy(&userdata->m_texel0_color, sss, sst, tilenum, object, userdata); UINT32 curpixel = fb_index + x; - if ((userdata->m_texel0_color.i.a != 0) || (!object.m_other_modes.alpha_compare_en)) + if ((userdata->m_texel0_color.get_a() != 0) || (!object.m_other_modes.alpha_compare_en)) { - copy_pixel(curpixel, userdata->m_texel0_color.i.r, userdata->m_texel0_color.i.g, userdata->m_texel0_color.i.b, userdata->m_texel0_color.i.a ? 7 : 0, object); + copy_pixel(curpixel, userdata->m_texel0_color, object); } } diff --git a/src/mame/video/rdptpipe.c b/src/mame/video/rdptpipe.c index e4b04bb6a42..3f84265e963 100644 --- a/src/mame/video/rdptpipe.c +++ b/src/mame/video/rdptpipe.c @@ -15,10 +15,14 @@ #include "emu.h" #include "includes/n64.h" +#include "video/rdptpipe.h" #include "video/n64.h" +#include "video/rgbutil.h" #define RELATIVE(x, y) ((((x) >> 3) - (y)) << 3) | (x & 7); +#define USE_SIMD (1) + void n64_texture_pipe_t::set_machine(running_machine &machine) { n64_state* state = machine.driver_data<n64_state>(); @@ -27,12 +31,7 @@ void n64_texture_pipe_t::set_machine(running_machine &machine) for(INT32 i = 0; i < 0x10000; i++) { - color_t c; - c.i.r = m_rdp->m_replicated_rgba[(i >> 11) & 0x1f]; - c.i.g = m_rdp->m_replicated_rgba[(i >> 6) & 0x1f]; - c.i.b = m_rdp->m_replicated_rgba[(i >> 1) & 0x1f]; - c.i.a = (i & 1) ? 0xff : 0x00; - m_expand_16to32_table[i] = c.c; + m_expand_16to32_table[i] = color_t((i & 1) ? 0xff : 0x00, m_rdp->m_replicated_rgba[(i >> 11) & 0x1f], m_rdp->m_replicated_rgba[(i >> 6) & 0x1f], m_rdp->m_replicated_rgba[(i >> 1) & 0x1f]); } for(UINT32 i = 0; i < 0x80000; i++) @@ -61,413 +60,324 @@ void n64_texture_pipe_t::set_machine(running_machine &machine) } } } + + m_st2_add.set(1, 0, 1, 0); + m_v1.set(1, 1, 1, 1); } -void n64_texture_pipe_t::mask(INT32* S, INT32* T, const n64_tile_t& tile) +void n64_texture_pipe_t::mask(rgbaint_t& st, const n64_tile_t& tile) { - if (tile.mask_s) - { - INT32 wrap = *S >> tile.wrapped_mask_s; - wrap &= 1; - if (tile.ms && wrap) - { - *S = (~(*S)); - } - *S &= m_maskbits_table[tile.mask_s]; - } - - if (tile.mask_t) - { - INT32 wrap = *T >> tile.wrapped_mask_t; - wrap &= 1; - if (tile.mt && wrap) - { - *T = (~(*T)); - } - *T &= m_maskbits_table[tile.mask_t]; - } + UINT32 s_mask_bits = m_maskbits_table[tile.mask_s]; + UINT32 t_mask_bits = m_maskbits_table[tile.mask_t]; + rgbaint_t maskbits(s_mask_bits, s_mask_bits, t_mask_bits, t_mask_bits); + + rgbaint_t wrap(st); + wrap.sra(tile.wrapped_mask); + wrap.and_reg(m_v1); + wrap.cmpeq(m_v1); + wrap.and_reg(tile.mm); + st.xor_reg(wrap); + st.and_reg(maskbits); } -void n64_texture_pipe_t::mask_coupled(INT32* S, INT32* S1, INT32* T, INT32* T1, const n64_tile_t& tile) +void n64_texture_pipe_t::mask_coupled(rgbaint_t& sstt, const n64_tile_t& tile) { - if (tile.mask_s) - { - const INT32 maskbits_s = m_maskbits_table[tile.mask_s]; - if (tile.ms) - { - const INT32 swrapthreshold = tile.mask_s > 10 ? 10 : tile.mask_s; - const INT32 wrap = (*S >> swrapthreshold) & 1; - const INT32 wrap1 = (*S1 >> swrapthreshold) & 1; - if (wrap) - { - *S = (~(*S)); - } - if (wrap1) - { - *S1 = (~(*S1)); - } - } - *S &= maskbits_s; - *S1 &= maskbits_s; - } - - if (tile.mask_t) - { - const INT32 maskbits_t = m_maskbits_table[tile.mask_t]; - if (tile.mt) - { - const INT32 twrapthreshold = tile.mask_t > 10 ? 10 : tile.mask_t; - const INT32 wrap = (*T >> twrapthreshold) & 1; - const INT32 wrap1 = (*T1 >> twrapthreshold) & 1; - if (wrap) - { - *T = (~(*T)); - } - if (wrap1) - { - *T1 = (~(*T1)); - } - } - *T &= maskbits_t; - *T1 &= maskbits_t; - } + UINT32 s_mask_bits = m_maskbits_table[tile.mask_s]; + UINT32 t_mask_bits = m_maskbits_table[tile.mask_t]; + rgbaint_t maskbits(s_mask_bits, s_mask_bits, t_mask_bits, t_mask_bits); + + rgbaint_t wrap(sstt); + wrap.sra(tile.wrapped_mask); + wrap.and_reg(m_v1); + wrap.cmpeq(m_v1); + wrap.and_reg(tile.mm); + sstt.xor_reg(wrap); + sstt.and_reg(maskbits); } -void n64_texture_pipe_t::shift_cycle(INT32* S, INT32* T, bool* maxs, bool* maxt, const n64_tile_t& tile) +rgbaint_t n64_texture_pipe_t::shift_cycle(rgbaint_t& st, const n64_tile_t& tile) { - INT32 sss = (INT32)(INT16)*S; - sss >>= tile.rshift_s; - sss <<= tile.lshift_s; - sss = (INT32)(INT16)sss; - *maxs = ((sss >> 3) >= tile.sh); - *S = (((sss >> 3) - tile.sl) << 3) | (sss & 7); - - INT32 sst = (INT32)(INT16)*T; - sst >>= tile.rshift_t; - sst <<= tile.lshift_t; - *T = (INT32)(INT16)sst; - *maxt = ((*T >> 3) >= tile.th); - *T = (((sst >> 3) - tile.tl) << 3) | (sst & 7); + st.sign_extend(0x00008000, 0xffff8000); + st.sra(tile.rshift); + st.shl(tile.lshift); + + rgbaint_t maxst(st); + maxst.sra_imm(3); + rgbaint_t maxst_eq(maxst); + maxst.cmpgt(tile.sth); + maxst_eq.cmpeq(tile.sth); + maxst.or_reg(maxst_eq); + + rgbaint_t stlsb(st); + stlsb.and_imm(7); + + st.sra_imm(3); + st.sub(tile.stl); + st.shl_imm(3); + st.or_reg(stlsb); + + return maxst; } -void n64_texture_pipe_t::shift_copy(INT32* S, INT32* T, const n64_tile_t& tile) +inline void n64_texture_pipe_t::shift_copy(rgbaint_t& st, const n64_tile_t& tile) { - INT32 sss = (INT32)(INT16)*S; - sss >>= tile.rshift_s; - sss <<= tile.lshift_s; - *S = (INT32)(INT16)sss; - - INT32 sst = (INT32)(INT16)*T; - sst >>= tile.rshift_t; - sst <<= tile.lshift_t; - *T = (INT32)(INT16)sst; + st.shr(tile.rshift); + st.shl(tile.lshift); } -void n64_texture_pipe_t::clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata) +void n64_texture_pipe_t::clamp_cycle(rgbaint_t& st, rgbaint_t& stfrac, rgbaint_t& maxst, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata) { - if (tile.clamp_s) - { - if (*S & 0x10000) - { - *S = 0; - *SFRAC = 0; - } - else if (maxs) - { - *S = userdata->m_clamp_s_diff[tilenum]; - *SFRAC = 0; - } - else - { - *S = (SIGN17(*S) >> 5) & 0x1fff; - } - } - else - { - *S = (SIGN17(*S) >> 5) & 0x1fff; - } - - if (tile.clamp_t) - { - if (*T & 0x10000) - { - *T = 0; - *TFRAC = 0; - } - else if (maxt) - { - *T = userdata->m_clamp_t_diff[tilenum]; - *TFRAC = 0; - } - else - { - *T = (SIGN17(*T) >> 5) & 0x1fff; - } - } - else - { - *T = (SIGN17(*T) >> 5) & 0x1fff; - } + rgbaint_t not_clamp(tile.clamp_st); + not_clamp.xor_imm(0xffffffff); + + rgbaint_t highbit_mask(0x10000, 0x10000, 0x10000, 0x10000); + rgbaint_t highbit(st); + highbit.and_reg(highbit_mask); + highbit.cmpeq(highbit_mask); + + rgbaint_t not_highbit(highbit); + not_highbit.xor_imm(0xffffffff); + + rgbaint_t not_maxst(maxst); + not_maxst.xor_imm(0xffffffff); + not_maxst.and_reg(not_highbit); + not_maxst.or_reg(not_clamp); + + rgbaint_t shifted_st(st); + shifted_st.sign_extend(0x00010000, 0xffff0000); + shifted_st.shr_imm(5); + shifted_st.and_imm(0x1fff); + shifted_st.and_reg(not_maxst); + stfrac.and_reg(not_maxst); + + rgbaint_t clamp_diff(userdata->m_clamp_diff[tilenum]); + clamp_diff.and_reg(tile.clamp_st); + clamp_diff.and_reg(maxst); + + st.set(shifted_st); + st.or_reg(clamp_diff); } -void n64_texture_pipe_t::clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata) +void n64_texture_pipe_t::clamp_cycle_light(rgbaint_t& st, rgbaint_t& maxst, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata) { - if (tile.clamp_s) - { - if (*S & 0x10000) - { - *S = 0; - } - else if (maxs) - { - *S = userdata->m_clamp_s_diff[tilenum]; - } - else - { - *S = (SIGN17(*S) >> 5) & 0x1fff; - } - } - else - { - *S = (SIGN17(*S) >> 5) & 0x1fff; - } - - if (tile.clamp_t) - { - if (*T & 0x10000) - { - *T = 0; - } - else if (maxt) - { - *T = userdata->m_clamp_t_diff[tilenum]; - } - else - { - *T = (SIGN17(*T) >> 5) & 0x1fff; - } - } - else - { - *T = (SIGN17(*T) >> 5) & 0x1fff; - } + rgbaint_t not_clamp(tile.clamp_st); + not_clamp.xor_imm(0xffffffff); + + rgbaint_t highbit_mask(0x10000, 0x10000, 0x10000, 0x10000); + rgbaint_t highbit(st); + highbit.and_reg(highbit_mask); + highbit.cmpeq(highbit_mask); + + rgbaint_t not_highbit(highbit); + not_highbit.xor_imm(0xffffffff); + + rgbaint_t not_maxst(maxst); + not_maxst.xor_imm(0xffffffff); + not_maxst.and_reg(not_highbit); + not_maxst.or_reg(not_clamp); + + rgbaint_t shifted_st(st); + shifted_st.sign_extend(0x00010000, 0xffff0000); + shifted_st.shr_imm(5); + shifted_st.and_imm(0x1fff); + shifted_st.and_reg(not_maxst); + + rgbaint_t clamp_diff(userdata->m_clamp_diff[tilenum]); + clamp_diff.and_reg(tile.clamp_st); + clamp_diff.and_reg(maxst); + + st.set(shifted_st); + st.or_reg(clamp_diff); } void n64_texture_pipe_t::cycle_nearest(color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object) { - // const n64_tile_t* tiles = object.m_tiles; const n64_tile_t& tile = object.m_tiles[tilenum]; - const UINT32 tformat = tile.format; - const UINT32 tsize = tile.size; - const UINT32 tpal = tile.palette; - const UINT32 index = (tformat << 4) | (tsize << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - - color_t t0; - - INT32 sss1 = SSS, sst1 = SST; - bool maxs, maxt; - shift_cycle(&sss1, &sst1, &maxs, &maxt, tile); - clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile, userdata); - mask(&sss1, &sst1, tile); - - UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff); - - t0.c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, tbase, tpal, userdata); - - const INT32 newk0 = SIGN9(m_rdp->get_k0()); - const INT32 newk1 = SIGN9(m_rdp->get_k1()); - const INT32 newk2 = SIGN9(m_rdp->get_k2()); - const INT32 newk3 = SIGN9(m_rdp->get_k3()); - const INT32 invk0 = ~newk0; - const INT32 invk1 = ~newk1; - const INT32 invk2 = ~newk2; - const INT32 invk3 = ~newk3; + const UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; + + rgbaint_t st(0, SSS, 0, SST); + rgbaint_t maxst = shift_cycle(st, tile); + clamp_cycle_light(st, maxst, tilenum, tile, userdata); + mask(st, tile); + + UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); + + rgbaint_t t0; + ((this)->*(m_texel_fetch[index]))(t0, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); if (object.m_other_modes.convert_one && cycle) { - t0 = *prev; + t0.set(*prev); } - t0.i.r = SIGN9(t0.i.r); - t0.i.g = SIGN9(t0.i.g); - t0.i.b = SIGN9(t0.i.b); - TEX->i.r = t0.i.b + (((newk0 - invk0) * t0.i.g + 0x80) >> 8); - TEX->i.g = t0.i.b + (((newk1 - invk1) * t0.i.r + (newk2 - invk2) * t0.i.g + 0x80) >> 8); - TEX->i.b = t0.i.b + (((newk3 - invk3) * t0.i.r + 0x80) >> 8); - TEX->i.a = t0.i.b; - TEX->i.r &= 0x1ff; - TEX->i.g &= 0x1ff; - TEX->i.b &= 0x1ff; - TEX->i.a &= 0x1ff; + + t0.sign_extend(0x00000100, 0xffffff00); + + rgbaint_t k1r(m_rdp->get_k1()); + k1r.mul_imm(t0.get_r32()); + + TEX->set(m_rdp->get_k023()); + TEX->mul_imm(t0.get_g32()); + TEX->add(k1r); + TEX->add_imm(0x80); + TEX->shr_imm(8); + TEX->add_imm(t0.get_b32()); + TEX->and_imm(0x1ff); } void n64_texture_pipe_t::cycle_nearest_lerp(color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object) { - const n64_tile_t* tiles = object.m_tiles; - const n64_tile_t& tile = tiles[tilenum]; - const UINT32 tformat = tile.format; - const UINT32 tsize = tile.size; - const UINT32 tpal = tile.palette; - const UINT32 index = (tformat << 4) | (tsize << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - - color_t t0; + const n64_tile_t& tile = object.m_tiles[tilenum]; + const UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - INT32 sss1 = SSS, sst1 = SST; - bool maxs, maxt; - shift_cycle(&sss1, &sst1, &maxs, &maxt, tile); - clamp_cycle_light(&sss1, &sst1, maxs, maxt, tilenum, tile, userdata); - mask(&sss1, &sst1, tile); + rgbaint_t st(0, SSS, 0, SST); + rgbaint_t maxst = shift_cycle(st, tile); + clamp_cycle_light(st, maxst, tilenum, tile, userdata); + mask(st, tile); - UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff); + UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); - (*TEX).c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, tbase, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); } void n64_texture_pipe_t::cycle_linear(color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object) { - const n64_tile_t* tiles = object.m_tiles; - const n64_tile_t& tile = tiles[tilenum]; - - const UINT32 tpal = tile.palette; + const n64_tile_t& tile = object.m_tiles[tilenum]; const UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - INT32 sss1 = SSS, sst1 = SST; - bool maxs, maxt; - shift_cycle(&sss1, &sst1, &maxs, &maxt, tile); - - INT32 sfrac = sss1 & 0x1f; - INT32 tfrac = sst1 & 0x1f; + rgbaint_t st(0, SSS, 0, SST); + rgbaint_t maxst = shift_cycle(st, tile); + rgbaint_t stfrac(st); + stfrac.and_imm(0x1f); - clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile, userdata); + clamp_cycle(st, stfrac, maxst, tilenum, tile, userdata); - INT32 sss2 = sss1 + 1; - INT32 sst2 = sst1 + 1; + mask_coupled(st, tile); - mask_coupled(&sss1, &sss2, &sst1, &sst2, tile); + const UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); - const UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff); + bool upper = ((stfrac.get_r32() + stfrac.get_b32()) >= 0x20); - bool upper = ((sfrac + tfrac) >= 0x20); - - INT32 invsf = 0; - INT32 invtf = 0; + rgbaint_t invstf; if (upper) { - invsf = 0x20 - sfrac; - invsf <<= 3; - - invtf = 0x20 - tfrac; - invtf <<= 3; + invstf.set(stfrac); + invstf.subr_imm(0x20); + invstf.shl_imm(3); + } + else + { + invstf.set(0, 0, 0, 0); } - sfrac <<= 3; - tfrac <<= 3; - - color_t t0; - t0.c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, tbase, tpal, userdata); - const INT32 newk0 = SIGN9(m_rdp->get_k0()); - const INT32 newk1 = SIGN9(m_rdp->get_k1()); - const INT32 newk2 = SIGN9(m_rdp->get_k2()); - const INT32 newk3 = SIGN9(m_rdp->get_k3()); - const INT32 invk0 = ~newk0; - const INT32 invk1 = ~newk1; - const INT32 invk2 = ~newk2; - const INT32 invk3 = ~newk3; + stfrac.shl_imm(3); + + rgbaint_t t0; + ((this)->*(m_texel_fetch[index]))(t0, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); if (object.m_other_modes.convert_one && cycle) { - t0 = *prev; + t0.set(*prev); } - t0.i.r = SIGN9(t0.i.r); t0.i.g = SIGN9(t0.i.g); t0.i.b = SIGN9(t0.i.b); - TEX->i.r = t0.i.b + (((newk0 - invk0) * t0.i.g + 0x80) >> 8); - TEX->i.g = t0.i.b + (((newk1 - invk1) * t0.i.r + (newk2 - invk2) * t0.i.g + 0x80) >> 8); - TEX->i.b = t0.i.b + (((newk3 - invk3) * t0.i.r + 0x80) >> 8); - TEX->i.a = t0.i.b; - TEX->i.r &= 0x1ff; - TEX->i.g &= 0x1ff; - TEX->i.b &= 0x1ff; - TEX->i.a &= 0x1ff; + + t0.sign_extend(0x00000100, 0xffffff00); + + rgbaint_t k1r(m_rdp->get_k1()); + k1r.mul_imm(t0.get_r32()); + + TEX->set(m_rdp->get_k023()); + TEX->mul_imm(t0.get_g32()); + TEX->add(k1r); + TEX->add_imm(0x80); + TEX->shr_imm(8); + TEX->add_imm(t0.get_b32()); + TEX->and_imm(0x1ff); } void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object) { - const n64_tile_t* tiles = object.m_tiles; - const n64_tile_t& tile = tiles[tilenum]; + const n64_tile_t& tile = object.m_tiles[tilenum]; UINT32 tpal = tile.palette; UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - INT32 sss1 = SSS, sst1 = SST; - bool maxs, maxt; - shift_cycle(&sss1, &sst1, &maxs, &maxt, tile); - - INT32 sfrac = sss1 & 0x1f; - INT32 tfrac = sst1 & 0x1f; + rgbaint_t sstt(SSS, SSS, SST, SST); + rgbaint_t maxst = shift_cycle(sstt, tile); + rgbaint_t stfrac = sstt; + stfrac.and_imm(0x1f); - clamp_cycle(&sss1, &sst1, &sfrac, &tfrac, maxs, maxt, tilenum, tile, userdata); + clamp_cycle(sstt, stfrac, maxst, tilenum, tile, userdata); - INT32 sss2 = sss1 + 1; - INT32 sst2 = sst1 + 1; + sstt.add(m_st2_add); - mask_coupled(&sss1, &sss2, &sst1, &sst2, tile); + mask_coupled(sstt, tile); - const UINT32 tbase1 = tile.tmem + ((tile.line * sst1) & 0x1ff); - const UINT32 tbase2 = tile.tmem + ((tile.line * sst2) & 0x1ff); + const UINT32 tbase1 = tile.tmem + ((tile.line * sstt.get_b32()) & 0x1ff); + const UINT32 tbase2 = tile.tmem + ((tile.line * sstt.get_g32()) & 0x1ff); - bool upper = ((sfrac + tfrac) >= 0x20); + bool upper = ((stfrac.get_r32() + stfrac.get_b32()) >= 0x20); - INT32 invsf = 0; - INT32 invtf = 0; + rgbaint_t invstf; if (upper) { - invsf = 0x20 - sfrac; - invsf <<= 3; - - invtf = 0x20 - tfrac; - invtf <<= 3; + invstf.set(stfrac); + invstf.subr_imm(0x20); + invstf.shl_imm(3); } + else + { + invstf.set(0, 0, 0, 0); + } + + stfrac.shl_imm(3); - INT32 center = (sfrac == 0x10) && (tfrac == 0x10) && object.m_other_modes.mid_texel; + bool center = (stfrac.get_r32() == 0x10) && (stfrac.get_b32() == 0x10) && object.m_other_modes.mid_texel; - sfrac <<= 3; - tfrac <<= 3; + rgbaint_t t2; + ((this)->*(m_texel_fetch[index]))(*TEX, sstt.get_a32(), sstt.get_b32(), tbase1, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t2, sstt.get_r32(), sstt.get_g32(), tbase2, tpal, userdata); - color_t t1; - color_t t2; - t1.c = ((this)->*(m_texel_fetch[index]))(sss2, sst1, tbase1, tpal, userdata); - t2.c = ((this)->*(m_texel_fetch[index]))(sss1, sst2, tbase2, tpal, userdata); if (!center) { if (upper) { - color_t t3; - t3.c = ((this)->*(m_texel_fetch[index]))(sss2, sst2, tbase2, tpal, userdata); - TEX->i.r = t3.i.r + (((invsf * (t2.i.r - t3.i.r)) + (invtf * (t1.i.r - t3.i.r)) + 0x80) >> 8); - TEX->i.g = t3.i.g + (((invsf * (t2.i.g - t3.i.g)) + (invtf * (t1.i.g - t3.i.g)) + 0x80) >> 8); - TEX->i.b = t3.i.b + (((invsf * (t2.i.b - t3.i.b)) + (invtf * (t1.i.b - t3.i.b)) + 0x80) >> 8); - TEX->i.a = t3.i.a + (((invsf * (t2.i.a - t3.i.a)) + (invtf * (t1.i.a - t3.i.a)) + 0x80) >> 8); + rgbaint_t t3; + ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a32(), sstt.get_g32(), tbase2, tpal, userdata); + + TEX->sub(t3); + t2.sub(t3); + + TEX->mul_imm(invstf.get_b32()); + t2.mul_imm(invstf.get_r32()); + + TEX->add(t2); + TEX->add_imm(0x0080); + TEX->sra_imm(8); + TEX->add(t3); } else { - color_t t0; - t0.c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, tbase1, tpal, userdata); - TEX->i.r = t0.i.r + (((sfrac * (t1.i.r - t0.i.r)) + (tfrac * (t2.i.r - t0.i.r)) + 0x80) >> 8); - TEX->i.g = t0.i.g + (((sfrac * (t1.i.g - t0.i.g)) + (tfrac * (t2.i.g - t0.i.g)) + 0x80) >> 8); - TEX->i.b = t0.i.b + (((sfrac * (t1.i.b - t0.i.b)) + (tfrac * (t2.i.b - t0.i.b)) + 0x80) >> 8); - TEX->i.a = t0.i.a + (((sfrac * (t1.i.a - t0.i.a)) + (tfrac * (t2.i.a - t0.i.a)) + 0x80) >> 8); + rgbaint_t t0; + ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r32(), sstt.get_b32(), tbase1, tpal, userdata); + + TEX->sub(t0); + t2.sub(t0); + + TEX->mul_imm(stfrac.get_r32()); + t2.mul_imm(stfrac.get_b32()); + + TEX->add(t2); + TEX->add_imm(0x80); + TEX->sra_imm(8); + TEX->add(t0); } - TEX->i.r &= 0x1ff; - TEX->i.g &= 0x1ff; - TEX->i.b &= 0x1ff; - TEX->i.a &= 0x1ff; } else { - color_t t0; - color_t t3; - t0.c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, 1, tpal, userdata); - t3.c = ((this)->*(m_texel_fetch[index]))(sss2, sst2, tbase2, tpal, userdata); - TEX->i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2; - TEX->i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2; - TEX->i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2; - TEX->i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2; + rgbaint_t t0, t3; + ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r32(), sstt.get_b32(), tbase1, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a32(), sstt.get_g32(), tbase2, tpal, userdata); + TEX->add(t0); + TEX->add(t2); + TEX->add(t3); + TEX->sra(2); } } @@ -476,19 +386,22 @@ void n64_texture_pipe_t::copy(color_t* TEX, INT32 SSS, INT32 SST, UINT32 tilenum const n64_tile_t* tiles = object.m_tiles; const n64_tile_t& tile = tiles[tilenum]; - INT32 sss1 = SSS; - INT32 sst1 = SST; - shift_copy(&sss1, &sst1, tile); - sss1 = (((sss1 >> 3) - tile.sl) << 3) | (sss1 & 7); - sss1 = (SIGN17(sss1) >> 5) & 0x1fff; - - sst1 = (((sst1 >> 3) - tile.tl) << 3) | (sst1 & 7); - sst1 = (SIGN17(sst1) >> 5) & 0x1fff; - mask(&sss1, &sst1, tile); + rgbaint_t st(0, SSS, 0, SST); + shift_copy(st, tile); + rgbaint_t stlsb(st); + stlsb.and_imm(7); + st.shr_imm(3); + st.sub(rgbaint_t(0, tile.sl, 0, tile.tl)); + st.shl_imm(3); + st.add(stlsb); + st.sign_extend(0x00010000, 0xffff0000); + st.shr_imm(5); + st.and_imm(0x1fff); + mask(st, tile); const UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - const UINT32 tbase = tile.tmem + ((tile.line * sst1) & 0x1ff); - TEX->c = ((this)->*(m_texel_fetch[index]))(sss1, sst1, tbase, tile.palette, userdata); + const UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); + ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); } void n64_texture_pipe_t::lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, rdp_span_aux* userdata, const rdp_poly_state& object) @@ -541,24 +454,27 @@ void n64_texture_pipe_t::lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const const bool magnify = (lod < 32); const bool distant = ((lod & 0x6000) || (l_tile >= object.m_misc_state.m_max_level)); - userdata->m_lod_fraction = ((lod << 3) >> l_tile) & 0xff; + UINT8 lod_fraction = ((lod << 3) >> l_tile) & 0xff; if(!object.m_other_modes.sharpen_tex_en && !object.m_other_modes.detail_tex_en) { if (distant) { - userdata->m_lod_fraction = 0xff; + lod_fraction = 0xff; } else if (magnify) { - userdata->m_lod_fraction = 0; + lod_fraction = 0; } } + userdata->m_lod_fraction.set(lod_fraction, lod_fraction, lod_fraction, lod_fraction); + /* FIXME: ??? if(object.m_other_modes.sharpen_tex_en && magnify) { - userdata->m_lod_fraction |= 0x100; + userdata->m_lod_fraction |= 0x100; } + */ } void n64_texture_pipe_t::lod_2cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, const INT32 prim_tile, INT32* t1, INT32* t2, rdp_span_aux* userdata, const rdp_poly_state& object) @@ -611,24 +527,27 @@ void n64_texture_pipe_t::lod_2cycle(INT32* sss, INT32* sst, const INT32 s, const const bool magnify = (lod < 32); const bool distant = ((lod & 0x6000) || (l_tile >= object.m_misc_state.m_max_level)); - userdata->m_lod_fraction = ((lod << 3) >> l_tile) & 0xff; + UINT8 lod_fraction = ((lod << 3) >> l_tile) & 0xff; if(!object.m_other_modes.sharpen_tex_en && !object.m_other_modes.detail_tex_en) { if (distant) { - userdata->m_lod_fraction = 0xff; + lod_fraction = 0xff; } else if (magnify) { - userdata->m_lod_fraction = 0; + lod_fraction = 0; } } + userdata->m_lod_fraction.set(lod_fraction, lod_fraction, lod_fraction, lod_fraction); + + /* FIXME: ??? if(object.m_other_modes.sharpen_tex_en && magnify) { - userdata->m_lod_fraction |= 0x100; - } + userdata->m_lod_fraction |= 0x100; + }*/ if (object.m_other_modes.tex_lod_en) { @@ -751,24 +670,20 @@ void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, rdp_span_aux* u { for (INT32 start = 0; start <= 7; start++) { - userdata->m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2); - userdata->m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2); + userdata->m_clamp_diff[start].set(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); } } else { const INT32 start = prim_tile; const INT32 end = (prim_tile + 1) & 7; - userdata->m_clamp_s_diff[start] = (tiles[start].sh >> 2) - (tiles[start].sl >> 2); - userdata->m_clamp_t_diff[start] = (tiles[start].th >> 2) - (tiles[start].tl >> 2); - userdata->m_clamp_s_diff[end] = (tiles[end].sh >> 2) - (tiles[end].sl >> 2); - userdata->m_clamp_t_diff[end] = (tiles[end].th >> 2) - (tiles[end].tl >> 2); + userdata->m_clamp_diff[start].set(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); + userdata->m_clamp_diff[end].set(0, (tiles[end].sh >> 2) - (tiles[end].sl >> 2), 0, (tiles[end].th >> 2) - (tiles[end].tl >> 2)); } } else//1-cycle or copy { - userdata->m_clamp_s_diff[prim_tile] = (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2); - userdata->m_clamp_t_diff[prim_tile] = (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2); + userdata->m_clamp_diff[prim_tile].set(0, (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2), 0, (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2)); } } @@ -777,7 +692,7 @@ void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, rdp_span_aux* u static INT32 sTexAddrSwap16[2] = { WORD_ADDR_XOR, WORD_XOR_DWORD_SWAP }; static INT32 sTexAddrSwap8[2] = { BYTE_ADDR_XOR, BYTE_XOR_DWORD_SWAP }; -UINT32 n64_texture_pipe_t::fetch_rgba16_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x7ff; @@ -785,48 +700,37 @@ UINT32 n64_texture_pipe_t::fetch_rgba16_tlut0(INT32 s, INT32 t, INT32 tbase, INT c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_rgba16_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba16_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x7ff; UINT16 c = ((UINT16*)userdata->m_tmem)[taddr]; c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_rgba16_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x7ff; + const UINT16 c = ((UINT16*)userdata->m_tmem)[taddr]; + #if USE_64K_LUT - return m_expand_16to32_table[((UINT16*)userdata->m_tmem)[taddr]]; + out.set(m_expand_16to32_table[c]); #else - const UINT16 c = ((UINT16*)userdata->m_tmem)[taddr]; - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_rgba32_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba32_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT32 *tc = ((UINT32*)userdata->m_tmem); const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x3ff; @@ -835,18 +739,13 @@ UINT32 n64_texture_pipe_t::fetch_rgba32_tlut0(INT32 s, INT32 t, INT32 tbase, INT c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 24) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_rgba32_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba32_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT32 *tc = ((UINT32*)userdata->m_tmem); const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x3ff; @@ -854,31 +753,23 @@ UINT32 n64_texture_pipe_t::fetch_rgba32_tlut1(INT32 s, INT32 t, INT32 tbase, INT UINT32 c = tc[taddr]; c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 24) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_rgba32_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_rgba32_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x3ff; - UINT32 c = ((UINT16*)userdata->m_tmem)[taddr]; - color_t color; - color.i.r = (c >> 8) & 0xff; - color.i.g = c & 0xff; - c = ((UINT16*)userdata->m_tmem)[taddr | 0x400]; - color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; + const UINT16 cl = ((UINT16*)userdata->m_tmem)[taddr]; + const UINT16 ch = ((UINT16*)userdata->m_tmem)[taddr | 0x400]; - return color.c; + out.set(ch & 0xff, cl >> 8, cl & 0xff, ch >> 8); } -UINT32 n64_texture_pipe_t::fetch_nop(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { return 0; } +void n64_texture_pipe_t::fetch_nop(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { } -UINT32 n64_texture_pipe_t::fetch_yuv(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_yuv(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT16 *tc = ((UINT16*)userdata->m_tmem); @@ -895,16 +786,10 @@ UINT32 n64_texture_pipe_t::fetch_yuv(INT32 s, INT32 t, INT32 tbase, INT32 tpal, u |= ((u & 0x80) << 1); v |= ((v & 0x80) << 1); - color_t color; - color.i.r = u; - color.i.g = v; - color.i.b = y; - color.i.a = y; - - return color.c; + out.set(y, y, u, v); } -UINT32 n64_texture_pipe_t::fetch_ci4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -913,18 +798,13 @@ UINT32 n64_texture_pipe_t::fetch_ci4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_ci4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -932,14 +812,11 @@ UINT32 n64_texture_pipe_t::fetch_ci4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 const UINT8 p = (s & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4); const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_ci4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0xfff; @@ -947,13 +824,10 @@ UINT32 n64_texture_pipe_t::fetch_ci4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tp UINT8 p = (s & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4); p = (tpal << 4) | p; - color_t color; - color.i.r = color.i.g = color.i.b = color.i.a = p; - - return color.c; + out.set(p, p, p, p); } -UINT32 n64_texture_pipe_t::fetch_ci8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -962,18 +836,13 @@ UINT32 n64_texture_pipe_t::fetch_ci8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_ci8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -981,25 +850,20 @@ UINT32 n64_texture_pipe_t::fetch_ci8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 const UINT8 p = tc[taddr]; const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_ci8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ci8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0xfff; - color_t color; - color.i.r = color.i.g = color.i.b = color.i.a = tc[taddr]; - - return color.c; + const UINT8 p = tc[taddr]; + out.set(p, p, p, p); } -UINT32 n64_texture_pipe_t::fetch_ia4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1008,18 +872,13 @@ UINT32 n64_texture_pipe_t::fetch_ia4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_ia4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1027,14 +886,11 @@ UINT32 n64_texture_pipe_t::fetch_ia4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 const UINT8 p = ((s) & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4); const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_ia4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0xfff; @@ -1043,16 +899,10 @@ UINT32 n64_texture_pipe_t::fetch_ia4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tp UINT8 i = p & 0xe; i = (i << 4) | (i << 1) | (i >> 2); - color_t color; - color.i.r = i; - color.i.g = i; - color.i.b = i; - color.i.a = (p & 1) * 0xff; - - return color.c; + out.set((p & 1) * 0xff, i, i, i); } -UINT32 n64_texture_pipe_t::fetch_ia8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1061,18 +911,13 @@ UINT32 n64_texture_pipe_t::fetch_ia8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_ia8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1080,14 +925,11 @@ UINT32 n64_texture_pipe_t::fetch_ia8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 const UINT8 p = tc[taddr]; const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_ia8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0xfff; @@ -1096,16 +938,10 @@ UINT32 n64_texture_pipe_t::fetch_ia8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tp UINT8 i = p & 0xf0; i |= (i >> 4); - color_t color; - color.i.r = i; - color.i.g = i; - color.i.b = i; - color.i.a = ((p & 0xf) << 4) | (p & 0xf); - - return color.c; + out.set((p << 4) | (p & 0xf), i, i, i); } -UINT32 n64_texture_pipe_t::fetch_ia16_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT16 *tc = ((UINT16*)userdata->m_tmem); const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x3ff; @@ -1114,18 +950,13 @@ UINT32 n64_texture_pipe_t::fetch_ia16_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[c]; + out.set(m_expand_16to32_table[c]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(c); - color.i.g = GET_MED_RGBA16_TMEM(c); - color.i.b = GET_LOW_RGBA16_TMEM(c); - color.i.a = (c & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_ia16_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia16_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT16 *tc = ((UINT16*)userdata->m_tmem); const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x3ff; @@ -1133,31 +964,21 @@ UINT32 n64_texture_pipe_t::fetch_ia16_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 UINT16 c = tc[taddr]; c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff; - color.i.a = c & 0xff; - - return color.c; + const UINT8 k = (c >> 8) & 0xff; + out.set(c & 0xff, k, k, k); } -UINT32 n64_texture_pipe_t::fetch_ia16_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_ia16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT16 *tc = ((UINT16*)userdata->m_tmem); const INT32 taddr = (((tbase << 2) + s) ^ sTexAddrSwap16[t & 1]) & 0x7ff; const UINT16 c = tc[taddr]; const UINT8 i = (c >> 8); - - color_t color; - color.i.r = i; - color.i.g = i; - color.i.b = i; - color.i.a = c & 0xff; - - return color.c; + out.set(c & 0xff, i, i, i); } -UINT32 n64_texture_pipe_t::fetch_i4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1167,18 +988,13 @@ UINT32 n64_texture_pipe_t::fetch_i4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 t const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | c) << 2]; #if USE_64K_LUT - return m_expand_16to32_table[k]; + out.set(m_expand_16to32_table[k]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(k); - color.i.g = GET_MED_RGBA16_TMEM(k); - color.i.b = GET_LOW_RGBA16_TMEM(k); - color.i.a = (k & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_i4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1187,14 +1003,11 @@ UINT32 n64_texture_pipe_t::fetch_i4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 t const UINT8 c = ((s & 1)) ? (byteval & 0xf) : ((byteval >> 4) & 0xf); const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | c) << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (k >> 8) & 0xff; - color.i.a = k & 0xff; - - return color.c; + const UINT8 i = (k >> 8) & 0xff; + out.set(k & 0xff, i, i, i); } -UINT32 n64_texture_pipe_t::fetch_i4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = ((((tbase << 4) + s) >> 1) ^ sTexAddrSwap8[t & 1]) & 0xfff; @@ -1203,16 +1016,10 @@ UINT32 n64_texture_pipe_t::fetch_i4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpa UINT8 c = ((s & 1)) ? (byteval & 0xf) : ((byteval >> 4) & 0xf); c |= (c << 4); - color_t color; - color.i.r = c; - color.i.g = c; - color.i.b = c; - color.i.a = c; - - return color.c; + out.set(c, c, c, c); } -UINT32 n64_texture_pipe_t::fetch_i8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1221,18 +1028,13 @@ UINT32 n64_texture_pipe_t::fetch_i8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 t const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[c << 2]; #if USE_64K_LUT - return m_expand_16to32_table[k]; + out.set(m_expand_16to32_table[k]); #else - color_t color; - color.i.r = GET_HI_RGBA16_TMEM(k); - color.i.g = GET_MED_RGBA16_TMEM(k); - color.i.b = GET_LOW_RGBA16_TMEM(k); - color.i.a = (k & 1) * 0xff; - return color.c; + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } -UINT32 n64_texture_pipe_t::fetch_i8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0x7ff; @@ -1240,25 +1042,16 @@ UINT32 n64_texture_pipe_t::fetch_i8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 t const UINT8 c = tc[taddr]; const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[c << 2]; - color_t color; - color.i.r = color.i.g = color.i.b = (k >> 8) & 0xff; - color.i.a = k & 0xff; - - return color.c; + const UINT8 i = (k >> 8) & 0xff; + out.set(k & 0xff, i, i, i); } -UINT32 n64_texture_pipe_t::fetch_i8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) +void n64_texture_pipe_t::fetch_i8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { const UINT8 *tc = userdata->m_tmem; const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0xfff; const UINT8 c = tc[taddr]; - color_t color; - color.i.r = c; - color.i.g = c; - color.i.b = c; - color.i.a = c; - - return color.c; + out.set(c, c, c, c); } diff --git a/src/mame/video/rdptpipe.h b/src/mame/video/rdptpipe.h index 3142d511b01..f190f8fee0e 100644 --- a/src/mame/video/rdptpipe.h +++ b/src/mame/video/rdptpipe.h @@ -17,18 +17,12 @@ #define _VIDEO_RDPTEXPIPE_H_ #include "emu.h" - -struct other_modes_t; -struct misc_state_t; -class color_t; -struct rdp_span_aux; -struct rdp_poly_state; -struct n64_tile_t; +#include "video/n64types.h" class n64_texture_pipe_t { public: - typedef UINT32 (n64_texture_pipe_t::*texel_fetcher_t) (INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + typedef void (n64_texture_pipe_t::*texel_fetcher_t) (rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); typedef void (n64_texture_pipe_t::*texel_cycler_t) (color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object); n64_texture_pipe_t() @@ -114,57 +108,60 @@ class n64_texture_pipe_t bool m_start_span; private: - void mask(INT32* S, INT32* T, const n64_tile_t& tile); - void mask_coupled(INT32* S, INT32* S1, INT32* T, INT32* T1, const n64_tile_t& tile); - - void shift_cycle(INT32* S, INT32* T, bool* maxs, bool* maxt, const n64_tile_t& tile); - void shift_copy(INT32* S, INT32* T, const n64_tile_t& tile); - - void clamp_cycle(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata); - void clamp_cycle_light(INT32* S, INT32* T, const bool maxs, const bool maxt, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata); - - UINT32 fetch_nop(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - - UINT32 fetch_rgba16_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_rgba16_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_rgba16_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_rgba32_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_rgba32_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_rgba32_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - - UINT32 fetch_yuv(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - - UINT32 fetch_ci4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ci4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ci4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ci8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ci8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ci8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - - UINT32 fetch_ia4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia16_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia16_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_ia16_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - - UINT32 fetch_i4_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_i4_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_i4_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_i8_tlut0(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_i8_tlut1(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); - UINT32 fetch_i8_raw(INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void mask(rgbaint_t& st, const n64_tile_t& tile); + void mask_coupled(rgbaint_t& sstt, const n64_tile_t& tile); + + rgbaint_t shift_cycle(rgbaint_t& st, const n64_tile_t& tile); + void shift_copy(rgbaint_t& st, const n64_tile_t& tile); + + void clamp_cycle(rgbaint_t& st, rgbaint_t& stfrac, rgbaint_t& maxst, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata); + void clamp_cycle_light(rgbaint_t& st, rgbaint_t& maxst, const INT32 tilenum, const n64_tile_t& tile, rdp_span_aux* userdata); + + void fetch_nop(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + + void fetch_rgba16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_rgba16_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_rgba16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_rgba32_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_rgba32_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_rgba32_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + + void fetch_yuv(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + + void fetch_ci4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ci4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ci4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ci8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ci8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ci8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + + void fetch_ia4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia16_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_ia16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + + void fetch_i4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_i4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_i4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_i8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_i8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); + void fetch_i8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata); texel_fetcher_t m_texel_fetch[16*5]; n64_rdp* m_rdp; INT32 m_maskbits_table[16]; - UINT32 m_expand_16to32_table[0x10000]; + color_t m_expand_16to32_table[0x10000]; UINT16 m_lod_lookup[0x80000]; + + rgbaint_t m_st2_add; + rgbaint_t m_v1; }; #endif // _VIDEO_RDPTEXPIPE_H_ diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index b04df8b8a26..dd9627f481d 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -43,7 +43,7 @@ ---- -t-- ---- ---- : Tile banking related ---- --f- ---- ---- : 1= Global X/Y flip? (most games?) ---- ---f ---- ---- : 1= prohbit Y flip? (Air Rescue 2nd screen title, also gets set on one of the intro sequence screens) - ---- ---- ---- 4--- : 1= X+Y flip for NBG3 + ---- ---- ---- 4--- : 1= X+Y flip for NBG3 ---- ---- ---- -2-- : 1= X+Y flip for NBG2 ---- ---- ---- --1- : 1= X+Y flip for NBG1 ---- ---- ---- ---0 : 1= X+Y flip for NBG0 @@ -210,6 +210,9 @@ void segas32_state::common_start(int multi32) { + if(!m_gfxdecode->started()) + throw device_missing_dependencies(); + int tmap; /* remember whether or not we are multi32 */ @@ -253,7 +256,7 @@ void segas32_state::common_start(int multi32) memset(m_mixer_control, 0xff, sizeof(m_mixer_control[0][0]) * 0x80 ); - + } @@ -881,11 +884,11 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st /* determine if we're flipped */ int global_flip = (m_system32_videoram[0x1ff00 / 2] >> 9)&1; - + int flipx = global_flip; int flipy = global_flip; - + int layer_flip = (m_system32_videoram[0x1ff00 / 2] >> bgnum) & 1; flipy ^= layer_flip; diff --git a/src/mame/video/snk68.c b/src/mame/video/snk68.c index 520365b070e..7cc4faf59b0 100644 --- a/src/mame/video/snk68.c +++ b/src/mame/video/snk68.c @@ -53,9 +53,7 @@ TILE_GET_INFO_MEMBER(snk68_state::get_searchar_tile_info) void snk68_state::common_video_start() { m_fg_tilemap->set_transparent_pen(0); - - m_fg_tilemap->set_scrolldx(0, m_screen->width() - 256); - m_fg_tilemap->set_scrolldy(0, m_screen->height() - 256); + save_item(NAME(m_sprite_flip_axis)); } void snk68_state::video_start() @@ -64,6 +62,8 @@ void snk68_state::video_start() m_fg_tile_offset = 0; common_video_start(); + + save_item(NAME(m_fg_tile_offset)); } VIDEO_START_MEMBER(snk68_state,searchar) @@ -79,7 +79,7 @@ VIDEO_START_MEMBER(snk68_state,searchar) ***************************************************************************/ -READ16_MEMBER(snk68_state::pow_spriteram_r) +READ16_MEMBER(snk68_state::spriteram_r) { // streetsj expects the MSB of every 32-bit word to be FF. Presumably RAM // exists only for 3 bytes out of 4 and the fourth is unmapped. @@ -89,24 +89,23 @@ READ16_MEMBER(snk68_state::pow_spriteram_r) return m_spriteram[offset]; } -WRITE16_MEMBER(snk68_state::pow_spriteram_w) +WRITE16_MEMBER(snk68_state::spriteram_w) { - UINT16 *spriteram16 = m_spriteram; - UINT16 newword = spriteram16[offset]; + UINT16 newword = m_spriteram[offset]; if (!(offset & 1)) data |= 0xff00; COMBINE_DATA(&newword); - if (spriteram16[offset] != newword) + if (m_spriteram[offset] != newword) { int vpos = m_screen->vpos(); if (vpos > 0) m_screen->update_partial(vpos - 1); - spriteram16[offset] = newword; + m_spriteram[offset] = newword; } } @@ -130,12 +129,11 @@ WRITE16_MEMBER(snk68_state::searchar_fg_videoram_w) m_fg_tilemap->mark_tile_dirty(offset >> 1); } -WRITE16_MEMBER(snk68_state::pow_flipscreen16_w) +WRITE16_MEMBER(snk68_state::pow_flipscreen_w) { if (ACCESSING_BITS_0_7) { - m_flipscreen = data & 0x08; - machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); + flip_screen_set(data & 0x08); m_sprite_flip_axis = data & 0x04; // for streetsm? though might not be present on this board @@ -147,32 +145,15 @@ WRITE16_MEMBER(snk68_state::pow_flipscreen16_w) } } -WRITE16_MEMBER(snk68_state::searchar_flipscreen16_w) +WRITE16_MEMBER(snk68_state::searchar_flipscreen_w) { if (ACCESSING_BITS_0_7) { - m_flipscreen = data & 0x08; - machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); - + flip_screen_set(data & 0x08); m_sprite_flip_axis = data & 0x04; } } -WRITE16_MEMBER(snk68_state::pow_paletteram16_word_w) -{ - UINT16 newword; - int r,g,b; - - COMBINE_DATA(&m_paletteram[offset]); - newword = m_paletteram[offset]; - - r = ((newword >> 7) & 0x1e) | ((newword >> 14) & 0x01); - g = ((newword >> 3) & 0x1e) | ((newword >> 13) & 0x01) ; - b = ((newword << 1) & 0x1e) | ((newword >> 12) & 0x01) ; - - m_palette->set_pen_color(offset,pal5bit(r),pal5bit(g),pal5bit(b)); -} - /*************************************************************************** @@ -182,21 +163,18 @@ WRITE16_MEMBER(snk68_state::pow_paletteram16_word_w) void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int group) { - UINT16 *spriteram16 = m_spriteram; - int flipscreen = m_flipscreen; - int sprite_flip_axis = m_sprite_flip_axis; - const UINT16* tiledata = &spriteram16[0x800*group]; + const UINT16* tiledata = &m_spriteram[0x800*group]; // pow has 0x4000 tiles and independent x/y flipping // the other games have > 0x4000 tiles and flipping in only one direction // (globally selected) - int const is_pow = (m_gfxdecode->gfx(1)->elements() <= 0x4000); - int offs; + bool const is_pow = (m_gfxdecode->gfx(1)->elements() <= 0x4000); + bool const flip = flip_screen(); - for (offs = 0; offs < 0x800; offs += 0x40) + for (int offs = 0; offs < 0x800; offs += 0x40) { - int mx = (spriteram16[offs + 2*group] & 0xff) << 4; - int my = spriteram16[offs + 2*group + 1]; + int mx = (m_spriteram[offs + 2*group] & 0xff) << 4; + int my = m_spriteram[offs + 2*group + 1]; int i; mx = mx | (my >> 12); @@ -204,7 +182,7 @@ void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, mx = ((mx + 16) & 0x1ff) - 16; my = -my; - if (flipscreen) + if (flip) { mx = 240 - mx; my = 240 - my; @@ -229,7 +207,7 @@ void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, } else { - if (sprite_flip_axis) + if (m_sprite_flip_axis) { fx = 0; fy = tile & 0x8000; @@ -242,7 +220,7 @@ void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, tile &= 0x7fff; } - if (flipscreen) + if (flip) { fx = !fx; fy = !fy; @@ -259,7 +237,7 @@ void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, tiledata += 2; } - if (flipscreen) + if (flip) my -= 16; else my += 16; @@ -268,7 +246,7 @@ void snk68_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, } -UINT32 snk68_state::screen_update_pow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 snk68_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(0x7ff, cliprect); diff --git a/src/mame/video/spacefb.c b/src/mame/video/spacefb.c index 2a6eca758b0..c663655dc32 100644 --- a/src/mame/video/spacefb.c +++ b/src/mame/video/spacefb.c @@ -88,7 +88,7 @@ void spacefb_state::video_start() but most likely, the actual star position is random as the hardware uses whatever value is on the shift register on power-up */ m_star_shift_reg = 0x18f89; - + save_pointer(NAME(m_object_present_map), width * height); save_item(NAME(m_port_0)); save_item(NAME(m_port_2)); diff --git a/src/mame/video/suna8.c b/src/mame/video/suna8.c index da80dfedab8..df18140d405 100644 --- a/src/mame/video/suna8.c +++ b/src/mame/video/suna8.c @@ -381,7 +381,7 @@ void suna8_state::draw_normal_sprites(bitmap_ind16 &bitmap,const rectangle &clip m_gfxdecode->gfx(which)->transpen(bitmap,cliprect, tile + (attr & 0x3)*0x100 + gfxbank, - (((attr >> 2) & 0xf) | colorbank) + 0x10 * m_palettebank, // hardhea2 player2 + (((attr >> 2) & 0xf) ^ colorbank) + 0x10 * m_palettebank, // player2 in hardhea2 and sparkman tile_flipx, tile_flipy, sx, sy, 0xf); } diff --git a/src/mame/video/taitoair.c b/src/mame/video/taitoair.c index 6993721bbd5..acd52281e01 100644 --- a/src/mame/video/taitoair.c +++ b/src/mame/video/taitoair.c @@ -70,11 +70,20 @@ static const int zoomy_conv_table[] = Screen refresh ***************************************************************************/ -void taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +int taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + return draw_sprites(bitmap,cliprect, 0x3f8 / 2); +} + +/*! + @param start_offset DMA sprite offset source + @return value acquired by a pause flag acquisition. + */ +int taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int start_offset ) { /* Y chain size is 16/32?/64/64? pixels. X chain size is always 64 pixels. */ - + //const UINT16 stop_values[4] = { 0xc00, 0, 0, 0 }; address_space &space = machine().driver_data()->generic_space(); static const int size[] = { 1, 2, 4, 4 }; int x0, y0, x, y, dx, dy, ex, ey, zx, zy; @@ -84,12 +93,19 @@ void taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre int tile_offs; /* sprite chain offset */ int zoomx, zoomy; /* zoom value */ - for (offs = 0x03f8 / 2; offs >= 0; offs -= 0x008 / 2) + for (offs = start_offset; offs >= 0; offs -= 0x008 / 2) { - /* TODO: remove this aberration of nature */ - if (offs < 0x01b0 && priority == 0) continue; - if (offs >= 0x01b0 && priority == 1) continue; - + /*! + Starting at a particular sequence, sprite DMA seems to stop there and resume via "something", + effectively drawing any other sprite with better priority in the framebuffer scheme of things. + + @todo reported sequence for DMA pause flag is 0x0c** 0x0000 0x0000 0x0000. + Verify how exactly via HW test. Continuing may be determined by a DMA bit write. + */ + if(m_tc0080vco->sprram_r(space, offs + 0, 0xffff) == 0xc00 || + m_tc0080vco->sprram_r(space, offs + 0, 0xffff) == 0xcff) // Air Inferno + return offs - 8/2; + x0 = m_tc0080vco->sprram_r(space, offs + 1, 0xffff) & 0x3ff; y0 = m_tc0080vco->sprram_r(space, offs + 0, 0xffff) & 0x3ff; zoomx = (m_tc0080vco->sprram_r(space, offs + 2, 0xffff) & 0x7f00) >> 8; @@ -97,6 +113,7 @@ void taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre tile_offs = (m_tc0080vco->sprram_r(space, offs + 3, 0xffff) & 0x1fff) << 2; ysize = size[(m_tc0080vco->sprram_r(space, offs, 0xffff) & 0x0c00) >> 10]; + if (tile_offs) { /* Convert zoomy value to real value as zoomx */ @@ -181,6 +198,8 @@ void taitoair_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre } } } + + return 0; } void taitoair_state::fill_slope( bitmap_ind16 &bitmap, const rectangle &cliprect, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2 ) @@ -240,7 +259,12 @@ void taitoair_state::fill_slope( bitmap_ind16 &bitmap, const rectangle &cliprect if (xx2 > cliprect.max_x) xx2 = cliprect.max_x; - if(color & 0x40) + if(machine().input().code_pressed(KEYCODE_Q)) + { + base_color = machine().rand() & 0x3fff; + grad_col = 0; + } + else if(color & 0x40) { /* Non-terrain elements are colored with this. */ base_color = (color & 0x3f) + 0x340; @@ -249,7 +273,7 @@ void taitoair_state::fill_slope( bitmap_ind16 &bitmap, const rectangle &cliprect else { /* Terrain elements, with a gradient applied. */ - /* TODO: it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */ + /*! @todo it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */ base_color = ((color & 0x3f) * 0x80) + 0x2040; grad_col = (y1 >> 3) & 0x3f; } @@ -573,51 +597,62 @@ void taitoair_state::video_start() UINT32 taitoair_state::screen_update_taitoair(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + int sprite_ptr; m_tc0080vco->tilemap_update(); - bitmap.fill(0, cliprect); - - { - int x,y; - - /* - [0x980000-3] dword for Y 0 - [0x980004-7] dword for rotation param 0 - [0x980008-b] dword for Y 1 - [0x98000c-f] dword for rotation param 1 - */ - - for(y=cliprect.min_y;y<cliprect.max_y/2;y++) - { - for(x=cliprect.min_x;x<cliprect.max_x;x++) - { - bitmap.pix16(y, x) = 0x2000 + (0x3f - ((y >> 2) & 0x3f)); - } - } - - #if 0 - for(y=cliprect.max_y/2;y<cliprect.max_y;y++) - { - for(x=cliprect.min_x;x<cliprect.max_x;x++) - { - bitmap.pix16(y, x) = 0x2040 + (0x3f - ((y >> 2) & 0x3f)); + UINT32 counter1 = (m_tc0430grw[0] << 16) | m_tc0430grw[1]; + UINT32 inc1x = INT16(m_tc0430grw[2]); + UINT32 inc1y = INT16(m_tc0430grw[3]); + UINT32 counter2 = (m_tc0430grw[4] << 16) | m_tc0430grw[5]; + UINT32 inc2x = INT16(m_tc0430grw[6]); + UINT32 inc2y = INT16(m_tc0430grw[7]); + + // Deltas are 118/31 + int dx = cliprect.min_x + 118; + int dy = cliprect.min_y - 48 + 31; + + counter1 += dx*inc1x + dy*inc1y; + counter2 += dx*inc2x + dy*inc2y; + + for(int y = cliprect.min_y; y <= cliprect.max_y; y++) { + UINT32 c1b = counter1; + UINT32 c2b = counter2; + UINT16 *dest = &bitmap.pix(y, cliprect.min_x); + for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { + UINT16 base = 0; + UINT32 cntr = 0; + if(c2b & 0x800000) { + base = 0x2040; + cntr = c2b; + } else if(c1b & 0x800000) { + base = 0x2000; + cntr = c1b; } + if(m_gradbank == true) + base|= 0x1000; + + *dest++ = base | (cntr >= 0x83f000 ? 0x3f : (cntr >> 12) & 0x3f); + + c1b += inc1x; + c2b += inc2x; } - #endif + counter1 += inc1y; + counter2 += inc2y; } + m_tc0080vco->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); - draw_sprites(bitmap, cliprect, 0); - copybitmap_trans(bitmap, *m_framebuffer[1], 0, 0, 0, 0, cliprect, 0); + sprite_ptr = draw_sprites(bitmap, cliprect); + m_tc0080vco->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); - - draw_sprites(bitmap, cliprect, 1); - + m_tc0080vco->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0); + draw_sprites(bitmap, cliprect, sprite_ptr); + /* Hacky 3d bitmap */ //copybitmap_trans(bitmap, m_buffer3d, 0, 0, 0, 0, cliprect, 0); //m_buffer3d->fill(0, cliprect); diff --git a/src/mame/video/vastar.c b/src/mame/video/vastar.c index 20581773470..b9b869707a8 100644 --- a/src/mame/video/vastar.c +++ b/src/mame/video/vastar.c @@ -2,7 +2,7 @@ // copyright-holders:Allard van der Bas /*************************************************************************** - video.c + vastar.c Functions to emulate the video hardware of the machine. @@ -20,12 +20,9 @@ TILE_GET_INFO_MEMBER(vastar_state::get_fg_tile_info) { - UINT8 *videoram = m_fgvideoram; - int code, color, fxy; - - code = videoram[tile_index + 0x800] | (videoram[tile_index + 0x400] << 8); - color = videoram[tile_index]; - fxy = (code & 0xc00) >> 10; // maybe, based on the other layers + int code = m_fgvideoram[tile_index + 0x800] | (m_fgvideoram[tile_index + 0x400] << 8); + int color = m_fgvideoram[tile_index]; + int fxy = (code & 0xc00) >> 10; // maybe, based on the other layers SET_TILE_INFO_MEMBER(0, code, color & 0x3f, @@ -34,12 +31,9 @@ TILE_GET_INFO_MEMBER(vastar_state::get_fg_tile_info) TILE_GET_INFO_MEMBER(vastar_state::get_bg1_tile_info) { - UINT8 *videoram = m_bg1videoram; - int code, color, fxy; - - code = videoram[tile_index + 0x800] | (videoram[tile_index] << 8); - color = videoram[tile_index + 0xc00]; - fxy = (code & 0xc00) >> 10; + int code = m_bg1videoram[tile_index + 0x800] | (m_bg1videoram[tile_index] << 8); + int color = m_bg1videoram[tile_index + 0xc00]; + int fxy = (code & 0xc00) >> 10; SET_TILE_INFO_MEMBER(4, code, color & 0x3f, @@ -48,12 +42,9 @@ TILE_GET_INFO_MEMBER(vastar_state::get_bg1_tile_info) TILE_GET_INFO_MEMBER(vastar_state::get_bg2_tile_info) { - UINT8 *videoram = m_bg2videoram; - int code, color, fxy; - - code = videoram[tile_index + 0x800] | (videoram[tile_index] << 8); - color = videoram[tile_index + 0xc00]; - fxy = (code & 0xc00) >> 10; + int code = m_bg2videoram[tile_index + 0x800] | (m_bg2videoram[tile_index] << 8); + int color = m_bg2videoram[tile_index + 0xc00]; + int fxy = (code & 0xc00) >> 10; SET_TILE_INFO_MEMBER(3, code, color & 0x3f, @@ -88,19 +79,19 @@ void vastar_state::video_start() ***************************************************************************/ -WRITE8_MEMBER(vastar_state::vastar_fgvideoram_w) +WRITE8_MEMBER(vastar_state::fgvideoram_w) { m_fgvideoram[offset] = data; m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE8_MEMBER(vastar_state::vastar_bg1videoram_w) +WRITE8_MEMBER(vastar_state::bg1videoram_w) { m_bg1videoram[offset] = data; m_bg1_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE8_MEMBER(vastar_state::vastar_bg2videoram_w) +WRITE8_MEMBER(vastar_state::bg2videoram_w) { m_bg2videoram[offset] = data; m_bg2_tilemap->mark_tile_dirty(offset & 0x3ff); @@ -123,25 +114,17 @@ WRITE8_MEMBER(vastar_state::vastar_bg2videoram_w) // forward order instead void vastar_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { - UINT8 *spriteram = m_spriteram1; - UINT8 *spriteram_2 = m_spriteram2; - UINT8 *spriteram_3 = m_spriteram3; - int offs; - -// for (offs = 0; offs < 0x40; offs += 2) - for (offs = 0x40-2; offs >=0; offs -= 2) +// for (int offs = 0; offs < 0x40; offs += 2) + for (int offs = 0x40-2; offs >=0; offs -= 2) { - int code, sx, sy, color, flipx, flipy; - - - code = ((spriteram_3[offs] & 0xfc) >> 2) + ((spriteram_2[offs] & 0x01) << 6) + int code = ((m_spriteram3[offs] & 0xfc) >> 2) + ((m_spriteram2[offs] & 0x01) << 6) + ((offs & 0x20) << 2); - sx = spriteram_3[offs + 1]; - sy = spriteram[offs]; - color = spriteram[offs + 1] & 0x3f; - flipx = spriteram_3[offs] & 0x02; - flipy = spriteram_3[offs] & 0x01; + int sx = m_spriteram3[offs + 1]; + int sy = m_spriteram1[offs]; + int color = m_spriteram1[offs + 1] & 0x3f; + int flipx = m_spriteram3[offs] & 0x02; + int flipy = m_spriteram3[offs] & 0x01; if (flip_screen()) { @@ -149,7 +132,7 @@ void vastar_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) flipy = !flipy; } - if (spriteram_2[offs] & 0x08) /* double width */ + if (m_spriteram2[offs] & 0x08) /* double width */ { if (!flip_screen()) sy = 224 - sy; @@ -180,11 +163,9 @@ void vastar_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) } } -UINT32 vastar_state::screen_update_vastar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 vastar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - - for (i = 0;i < 32;i++) + for (int i = 0;i < 32;i++) { m_bg1_tilemap->set_scrolly(i,m_bg1_scroll[i]); m_bg2_tilemap->set_scrolly(i,m_bg2_scroll[i]); diff --git a/src/mame/video/warpwarp.c b/src/mame/video/warpwarp.c index ada74e22dab..de018da6033 100644 --- a/src/mame/video/warpwarp.c +++ b/src/mame/video/warpwarp.c @@ -2,7 +2,7 @@ // copyright-holders:Chris Hardy /*************************************************************************** - video.c + warpwarp.c Functions to emulate the video hardware of the machine. @@ -63,7 +63,6 @@ PALETTE_INIT_MEMBER(warpwarp_state,navarone) PALETTE_INIT_MEMBER(warpwarp_state,warpwarp) { - int i; static const int resistances_tiles_rg[] = { 1600, 820, 390 }; static const int resistances_tiles_b[] = { 820, 390 }; static const int resistance_ball[] = { 220 }; @@ -75,7 +74,7 @@ PALETTE_INIT_MEMBER(warpwarp_state,warpwarp) 2, resistances_tiles_b, weights_tiles_b, 150, 0, 1, resistance_ball, weight_ball, 150, 0); - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) { int bit0, bit1, bit2; int r,g,b; @@ -206,7 +205,7 @@ WRITE8_MEMBER(warpwarp_state::warpwarp_videoram_w) ***************************************************************************/ -inline void warpwarp_state::geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) +inline void warpwarp_state::plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { if (cliprect.contains(x, y)) bitmap.pix16(y, x) = pen; @@ -229,11 +228,11 @@ void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,p for (i = m_ball_sizey;i > 0;i--) for (j = m_ball_sizex;j > 0;j--) - geebee_plot(bitmap, cliprect, x-j, y-i, pen); + plot(bitmap, cliprect, x-j, y-i, pen); } } -UINT32 warpwarp_state::screen_update_geebee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 warpwarp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); diff --git a/src/mess/drivers/a310.c b/src/mess/drivers/a310.c index e262865d15c..91018398b42 100644 --- a/src/mess/drivers/a310.c +++ b/src/mess/drivers/a310.c @@ -377,7 +377,7 @@ static MACHINE_CONFIG_START( a310, a310_state ) MCFG_RAM_DEFAULT_SIZE("2M") MCFG_RAM_EXTRA_OPTIONS("512K, 1M, 4M, 8M, 16M") - MCFG_WD1772x_ADD("fdc", 8000000 / 1) // TODO: frequency + MCFG_WD1772_ADD("fdc", 8000000 / 1) // TODO: frequency MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE( a310_state, a310_wd177x_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(a310_state, a310_wd177x_drq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", a310_floppies, "35dd", a310_state::floppy_formats) diff --git a/src/mess/drivers/abc1600.c b/src/mess/drivers/abc1600.c index f12862cc3e5..57580466632 100644 --- a/src/mess/drivers/abc1600.c +++ b/src/mess/drivers/abc1600.c @@ -895,7 +895,7 @@ static MACHINE_CONFIG_START( abc1600, abc1600_state ) MCFG_NMC9306_ADD(NMC9306_TAG) MCFG_E0516_ADD(E050_C16PC_TAG, XTAL_32_768kHz) - MCFG_FD1797x_ADD(SAB1797_02P_TAG, XTAL_64MHz/64) + MCFG_FD1797_ADD(SAB1797_02P_TAG, XTAL_64MHz/64) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pb7_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(abc1600_state, fdc_drq_w)) diff --git a/src/mess/drivers/altos5.c b/src/mess/drivers/altos5.c index c58741feeb1..db9876fc1d0 100644 --- a/src/mess/drivers/altos5.c +++ b/src/mess/drivers/altos5.c @@ -430,7 +430,7 @@ static MACHINE_CONFIG_START( altos5, altos5_state ) MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80sio", z80dart_device, ctsb_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", altos5_state, ctc_tick, attotime::from_hz(XTAL_8MHz / 4)) - MCFG_FD1797x_ADD("fdc", XTAL_8MHz / 8) + MCFG_FD1797_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(altos5_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/ampro.c b/src/mess/drivers/ampro.c index 6e17ad92ffb..8dccc887192 100644 --- a/src/mess/drivers/ampro.c +++ b/src/mess/drivers/ampro.c @@ -179,7 +179,7 @@ static MACHINE_CONFIG_START( ampro, ampro_state ) MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", ampro_state, ctc_tick, attotime::from_hz(XTAL_16MHz / 8)) - MCFG_WD1772x_ADD("fdc", XTAL_16MHz / 2) + MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) MCFG_FLOPPY_DRIVE_ADD("fdc:0", ampro_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_SOFTWARE_LIST_ADD("flop_list", "ampro") MACHINE_CONFIG_END diff --git a/src/mess/drivers/amstrad.c b/src/mess/drivers/amstrad.c index b6ed946e1e9..6919e0c2867 100644 --- a/src/mess/drivers/amstrad.c +++ b/src/mess/drivers/amstrad.c @@ -808,6 +808,7 @@ SLOT_INTERFACE_START(cpc_exp_cards) SLOT_INTERFACE("playcity", CPC_PLAYCITY) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) + SLOT_INTERFACE("hd20", CPC_HD20) SLOT_INTERFACE_END SLOT_INTERFACE_START(cpcplus_exp_cards) @@ -821,6 +822,7 @@ SLOT_INTERFACE_START(cpcplus_exp_cards) SLOT_INTERFACE("amdrum", CPC_AMDRUM) SLOT_INTERFACE("playcity", CPC_PLAYCITY) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) + SLOT_INTERFACE("hd20", CPC_HD20) SLOT_INTERFACE_END SLOT_INTERFACE_START(amstrad_centronics_devices) diff --git a/src/mess/drivers/apf.c b/src/mess/drivers/apf.c index 4b3c4c4da21..c46b7dd3701 100644 --- a/src/mess/drivers/apf.c +++ b/src/mess/drivers/apf.c @@ -560,7 +560,7 @@ static MACHINE_CONFIG_DERIVED( apfimag, apfm1000 ) MCFG_CASSETTE_FORMATS(apf_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - MCFG_FD1771x_ADD("fdc", 1000000) // guess + MCFG_FD1771_ADD("fdc", 1000000) // guess MCFG_FLOPPY_DRIVE_ADD("fdc:0", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index 4c06eac3b7b..bc6cf968274 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -1372,6 +1372,19 @@ ROM_START(apple2p) /* the autoboot apple2+ with applesoft (microsoft-written) ba ROM_LOAD ( "341-0020-00.f8", 0x3800, 0x0800, CRC(079589c4) SHA1(a28852ff997b4790e53d8d0352112c4b1a395098)) /* 341-0020-00: Autostart Monitor/Applesoft Basic $f800; Was sometimes mounted on Language card; Label(from Apple Language Card - Front.jpg): S 8115 // C68018 // 341-0020-00 */ ROM_END +ROM_START(elppa) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "elppa.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // Taken from 341-0036.chr used in apple2p + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "elppa.d0", 0x1000, 0x0800, CRC(ce5b0e7e) SHA1(2c1a0aa023ae6deb2bddb8937345ee354028aeef)) + ROM_LOAD ( "elppa.d8", 0x1800, 0x0800, CRC(bd409bad) SHA1(5145d238042938efbb9b71e0a4ef9a980b0e38de)) + ROM_LOAD ( "elppa.e0", 0x2000, 0x0800, CRC(4c997c88) SHA1(70b639d8cbafcd5367d2f9dfd6890e5d1c6890f0)) + ROM_LOAD ( "elppa.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "elppa.f0", 0x3000, 0x0800, CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) + ROM_LOAD ( "elppa.f8", 0x3800, 0x0800, CRC(62c0c761) SHA1(19f28544fd5021a2d72e6015b3183c462c0e86f8)) +ROM_END + ROM_START(prav82) ROM_REGION(0x0800,"gfx1",0) ROM_LOAD ( "pravetz82.chr", 0x0000, 0x0800, BAD_DUMP CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) // Taken from Agat computer @@ -1397,6 +1410,26 @@ ROM_START(prav8m) ROM_LOAD ( "pravetz8m.f8", 0x3800, 0x0800, CRC(5bab0a46) SHA1(f6c0817ce37d2e2c43f482c339acaede0a73359b)) ROM_END +ROM_START(uniap2pt) + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "unitron_pt.d0", 0x1000, 0x1000, CRC(311beae6) SHA1(f6379aba9ac982850edc314c93a393844a3349ef)) + ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) +ROM_END + +ROM_START(uniap2en) + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "unitron_en.d0", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425)) + ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) +ROM_END + /* J-Plus ROM numbers confirmed by: http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20II%20j-plus/Photos/Apple%20II%20j-plus%20-%20Motherboard.jpg @@ -1519,8 +1552,11 @@ ROM_END COMP( 1977, apple2, 0, 0, apple2, apple2, driver_device, 0, "Apple Computer", "Apple ][", GAME_SUPPORTS_SAVE ) COMP( 1979, apple2p, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][+", GAME_SUPPORTS_SAVE ) COMP( 1980, apple2jp, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][ J-Plus", GAME_SUPPORTS_SAVE ) +COMP( 198?, elppa, apple2, 0, apple2p, apple2p, driver_device, 0, "Victor do Brasil", "Elppa II+", GAME_SUPPORTS_SAVE ) COMP( 1982, prav82, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 82", GAME_SUPPORTS_SAVE ) COMP( 1982, ace100, apple2, 0, apple2, apple2p, driver_device, 0, "Franklin Computer", "Franklin Ace 100", GAME_SUPPORTS_SAVE ) +COMP( 1982, uniap2en, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletrônica", "Unitron AP II (in English)", GAME_SUPPORTS_SAVE ) +COMP( 1982, uniap2pt, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletrônica", "Unitron AP II (in Brazilian Portuguese)", GAME_SUPPORTS_SAVE ) COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-7", GAME_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :( // reverse font direction -\/ COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, driver_device, 0, "Ivasim", "Ivel Ultra", GAME_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/applix.c b/src/mess/drivers/applix.c index c3914a1ced1..752a9b8af2c 100644 --- a/src/mess/drivers/applix.c +++ b/src/mess/drivers/applix.c @@ -884,7 +884,7 @@ static MACHINE_CONFIG_START( applix, applix_state ) MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - MCFG_WD1772x_ADD("fdc", XTAL_16MHz / 2) //connected to Z80H clock pin + MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) //connected to Z80H clock pin MCFG_FLOPPY_DRIVE_ADD("fdc:0", applix_floppies, "35dd", applix_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", applix_floppies, "35dd", applix_state::floppy_formats) MCFG_TIMER_DRIVER_ADD_PERIODIC("applix_c", applix_state, cass_timer, attotime::from_hz(100000)) diff --git a/src/mess/drivers/apricot.c b/src/mess/drivers/apricot.c index 15f5f1d5982..943acc251d2 100644 --- a/src/mess/drivers/apricot.c +++ b/src/mess/drivers/apricot.c @@ -401,6 +401,7 @@ static MACHINE_CONFIG_START( apricot, apricot_state ) MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") MCFG_MC6845_ADD("ic30", MC6845, "screen", XTAL_15MHz / 10) + MCFG_MC6845_INTERLACE_ADJUST(1) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(10) MCFG_MC6845_UPDATE_ROW_CB(apricot_state, crtc_update_row) @@ -465,7 +466,7 @@ static MACHINE_CONFIG_START( apricot, apricot_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") // floppy - MCFG_WD2797x_ADD("ic68", XTAL_4MHz / 2) + MCFG_WD2797_ADD("ic68", XTAL_4MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(apricot_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("ic71", i8089_device, drq1_w)) MCFG_FLOPPY_DRIVE_ADD("ic68:0", apricot_floppies, "d32w", apricot_state::floppy_formats) diff --git a/src/mess/drivers/apricotf.c b/src/mess/drivers/apricotf.c index 2aa58759f8c..bd9cec58e96 100644 --- a/src/mess/drivers/apricotf.c +++ b/src/mess/drivers/apricotf.c @@ -384,7 +384,7 @@ static MACHINE_CONFIG_START( act_f1, f1_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) // floppy - MCFG_WD2797x_ADD(WD2797_TAG, XTAL_4MHz / 2 /* ? */) + MCFG_WD2797_ADD(WD2797_TAG, XTAL_4MHz / 2 /* ? */) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_NMI)) MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_TEST)) diff --git a/src/mess/drivers/apricotp.c b/src/mess/drivers/apricotp.c index 86073ccda98..d9132dfd2bd 100644 --- a/src/mess/drivers/apricotp.c +++ b/src/mess/drivers/apricotp.c @@ -632,7 +632,7 @@ static MACHINE_CONFIG_START( fp, fp_state ) MCFG_Z80SIO0_ADD(Z80SIO0_TAG, 2500000, 0, 0, 0, 0) MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir4_w)) - MCFG_WD2797x_ADD(WD2797_TAG, 2000000) + MCFG_WD2797_ADD(WD2797_TAG, 2000000) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir1_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq1_w)) diff --git a/src/mess/drivers/atarist.c b/src/mess/drivers/atarist.c index a7b56d5dcc9..719433bd0ad 100644 --- a/src/mess/drivers/atarist.c +++ b/src/mess/drivers/atarist.c @@ -2099,7 +2099,7 @@ static MACHINE_CONFIG_START( st, st_state ) // devices - MCFG_WD1772x_ADD(WD1772_TAG, Y2/4) + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) @@ -2190,7 +2190,7 @@ static MACHINE_CONFIG_START( megast, megast_state ) // devices MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) - MCFG_WD1772x_ADD(WD1772_TAG, Y2/4) + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) @@ -2288,7 +2288,7 @@ static MACHINE_CONFIG_START( ste, ste_state ) // devices - MCFG_WD1772x_ADD(WD1772_TAG, Y2/4) + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) @@ -2401,7 +2401,7 @@ static MACHINE_CONFIG_START( stbook, stbook_state ) MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_WD1772x_ADD(WD1772_TAG, U517/2) + MCFG_WD1772_ADD(WD1772_TAG, U517/2) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", 0, st_state::floppy_formats) diff --git a/src/mess/drivers/b2m.c b/src/mess/drivers/b2m.c index 1c4d9c66546..724dfb4fadf 100644 --- a/src/mess/drivers/b2m.c +++ b/src/mess/drivers/b2m.c @@ -234,7 +234,7 @@ static MACHINE_CONFIG_START( b2m, b2m_state ) /* uart */ MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(b2m_state, b2m_fdc_drq)) MCFG_FLOPPY_DRIVE_ADD("fd0", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats) diff --git a/src/mess/drivers/bbc.c b/src/mess/drivers/bbc.c index de7f17dee44..5dfce63e4ef 100644 --- a/src/mess/drivers/bbc.c +++ b/src/mess/drivers/bbc.c @@ -776,7 +776,7 @@ static MACHINE_CONFIG_DERIVED( bbcb, bbca ) MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(bbc_floppy_interface) - MCFG_WD1770x_ADD("wd177x", XTAL_16MHz / 2) + MCFG_WD1770_ADD("wd177x", XTAL_16MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) @@ -840,7 +840,7 @@ static MACHINE_CONFIG_DERIVED( bbcb_us, bbca ) MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(bbc_floppy_interface) - MCFG_WD1770x_ADD("wd177x", XTAL_16MHz / 2) + MCFG_WD1770_ADD("wd177x", XTAL_16MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) @@ -1001,7 +1001,7 @@ static MACHINE_CONFIG_START( bbcm, bbc_state ) MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_user_irq_w)) /* fdc */ - MCFG_WD1770x_ADD("wd177x", XTAL_16MHz / 2) + MCFG_WD1770_ADD("wd177x", XTAL_16MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) @@ -1089,8 +1089,8 @@ static MACHINE_CONFIG_DERIVED( bbcmc, bbcm ) /* fdc */ MCFG_DEVICE_REMOVE("wd177x") -// MCFG_WD1772x_ADD("wd177x", XTAL_16MHz / 2) - MCFG_WD1770x_ADD("wd177x", XTAL_16MHz / 2) +// MCFG_WD1772_ADD("wd177x", XTAL_16MHz / 2) + MCFG_WD1770_ADD("wd177x", XTAL_16MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) diff --git a/src/mess/drivers/bigbord2.c b/src/mess/drivers/bigbord2.c index 7131483b3df..c12e0b7832c 100644 --- a/src/mess/drivers/bigbord2.c +++ b/src/mess/drivers/bigbord2.c @@ -584,7 +584,7 @@ static MACHINE_CONFIG_START( bigbord2, bigbord2_state ) // ZC0 = SIO channel B clock, ZC1 = SIO channel A clock MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTCB_TAG, z80ctc_device, trg3)) - MCFG_MB8877x_ADD("fdc", XTAL_16MHz / 16) + MCFG_MB8877_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/bullet.c b/src/mess/drivers/bullet.c index 714b071b135..9b073983797 100644 --- a/src/mess/drivers/bullet.c +++ b/src/mess/drivers/bullet.c @@ -1137,7 +1137,7 @@ static MACHINE_CONFIG_START( bullet, bullet_state ) MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) MCFG_Z80PIO_IN_PB_CB(READ8(bullet_state, pio_pb_r)) - MCFG_MB8877x_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) @@ -1219,7 +1219,7 @@ static MACHINE_CONFIG_START( bulletf, bulletf_state ) MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(bulletf_state, cstrb_w)) - MCFG_MB8877x_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, rib_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/bw2.c b/src/mess/drivers/bw2.c index 21565d88333..dc7765e4e6c 100644 --- a/src/mess/drivers/bw2.c +++ b/src/mess/drivers/bw2.c @@ -632,7 +632,7 @@ static MACHINE_CONFIG_START( bw2, bw2_state ) MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - MCFG_WD2797x_ADD(WD2797_TAG, XTAL_16MHz/16) + MCFG_WD2797_ADD(WD2797_TAG, XTAL_16MHz/16) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bw2_state, fdc_drq_w)) diff --git a/src/mess/drivers/ccs2810.c b/src/mess/drivers/ccs2810.c index fda1decef49..1121a6f2991 100644 --- a/src/mess/drivers/ccs2810.c +++ b/src/mess/drivers/ccs2810.c @@ -354,7 +354,7 @@ static MACHINE_CONFIG_START( ccs2422, ccs_state ) MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs_state, kbd_put)) /* Devices */ - MCFG_MB8877x_ADD("fdc", XTAL_16MHz / 8) // UB1793 or MB8877 + MCFG_MB8877_ADD("fdc", XTAL_16MHz / 8) // UB1793 or MB8877 MCFG_FLOPPY_DRIVE_ADD("fdc:0", ccs_floppies, "8sssd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/crvision.c b/src/mess/drivers/crvision.c index 97b67a9b292..08250767a2e 100644 --- a/src/mess/drivers/crvision.c +++ b/src/mess/drivers/crvision.c @@ -699,7 +699,7 @@ void crvision_state::machine_start() void laser2001_state::machine_start() { crvision_state::machine_start(); - + // zerofill/state saving m_joylatch = 0; m_centronics_busy = 0; diff --git a/src/mess/drivers/dgn_beta.c b/src/mess/drivers/dgn_beta.c index 31135e6632b..3566313dade 100644 --- a/src/mess/drivers/dgn_beta.c +++ b/src/mess/drivers/dgn_beta.c @@ -368,7 +368,7 @@ static MACHINE_CONFIG_START( dgnbeta, dgn_beta_state ) MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_a)) MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_b)) - MCFG_WD2797x_ADD(FDC_TAG, XTAL_1MHz) + MCFG_WD2797_ADD(FDC_TAG, XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_drq_w)) diff --git a/src/mess/drivers/dragon.c b/src/mess/drivers/dragon.c index 2b22531f63c..61375867d28 100644 --- a/src/mess/drivers/dragon.c +++ b/src/mess/drivers/dragon.c @@ -245,7 +245,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( dgnalpha, dragon_base, dragon_alpha_state ) MCFG_MOS6551_XTAL(XTAL_1_8432MHz) // floppy - MCFG_WD2797x_ADD(WD2797_TAG, XTAL_1MHz) + MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_drq_w)) diff --git a/src/mess/drivers/dvk_ksm.c b/src/mess/drivers/dvk_ksm.c index 2a4532956d8..118fdef57e7 100644 --- a/src/mess/drivers/dvk_ksm.c +++ b/src/mess/drivers/dvk_ksm.c @@ -288,8 +288,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) UINT16 offset; DBG_LOG(2,"scanline_cb", - ("addr %02x frame %" I64FMT "d x %.4d y %.3d row %.2d\n", - m_video.line, m_screen->frame_number(), m_screen->hpos(), y, y%11)); + ("addr %02x frame %d x %.4d y %.3d row %.2d\n", + m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11)); if (y < KSM_VERT_START) return; y -= KSM_VERT_START; diff --git a/src/mess/drivers/einstein.c b/src/mess/drivers/einstein.c index b0ce919519f..3be299ab83c 100644 --- a/src/mess/drivers/einstein.c +++ b/src/mess/drivers/einstein.c @@ -734,7 +734,7 @@ static MACHINE_CONFIG_START( einstein, einstein_state ) /* uart */ MCFG_DEVICE_ADD(IC_I060, I8251, 0) - MCFG_WD1770x_ADD(IC_I042, XTAL_X002) + MCFG_WD1770_ADD(IC_I042, XTAL_X002) MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":0", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":1", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/esq1.c b/src/mess/drivers/esq1.c index 8f960de0d07..3dc7b9535ec 100644 --- a/src/mess/drivers/esq1.c +++ b/src/mess/drivers/esq1.c @@ -625,7 +625,7 @@ static MACHINE_CONFIG_DERIVED(sq80, esq1) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(sq80_map) - MCFG_WD1772x_ADD(WD1772_TAG, 4000000) + MCFG_WD1772_ADD(WD1772_TAG, 4000000) MACHINE_CONFIG_END static INPUT_PORTS_START( esq1 ) diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c index af644777eec..f4ec6522e24 100644 --- a/src/mess/drivers/esq5505.c +++ b/src/mess/drivers/esq5505.c @@ -657,7 +657,7 @@ static MACHINE_CONFIG_DERIVED(eps, vfx) MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) - MCFG_WD1772x_ADD("wd1772", 8000000) + MCFG_WD1772_ADD("wd1772", 8000000) MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) MCFG_DEVICE_ADD("mc68450", HD63450, 0) // MC68450 compatible @@ -674,7 +674,7 @@ static MACHINE_CONFIG_DERIVED(vfxsd, vfx) MCFG_CPU_MODIFY( "maincpu" ) MCFG_CPU_PROGRAM_MAP(vfxsd_map) - MCFG_WD1772x_ADD("wd1772", 8000000) + MCFG_WD1772_ADD("wd1772", 8000000) MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) MACHINE_CONFIG_END @@ -724,7 +724,7 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state) MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6) MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7) - MCFG_WD1772x_ADD("wd1772", 8000000) + MCFG_WD1772_ADD("wd1772", 8000000) MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/excali64.c b/src/mess/drivers/excali64.c index ef7770a648d..b68d0e1f67e 100644 --- a/src/mess/drivers/excali64.c +++ b/src/mess/drivers/excali64.c @@ -592,7 +592,7 @@ static MACHINE_CONFIG_START( excali64, excali64_state ) /* Devices */ MCFG_CASSETTE_ADD( "cassette" ) - MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD2793_ADD("fdc", XTAL_16MHz / 16) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "drive0", excali64_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "drive1", excali64_state::floppy_formats) diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c index f37afdb25e1..2247deec612 100644 --- a/src/mess/drivers/fm7.c +++ b/src/mess/drivers/fm7.c @@ -2095,7 +2095,7 @@ static MACHINE_CONFIG_START( fm7, fm7_state ) MCFG_SOFTWARE_LIST_ADD("cass_list","fm7_cass") - MCFG_MB8877x_ADD("fdc", XTAL_8MHz / 8) + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) @@ -2151,7 +2151,7 @@ static MACHINE_CONFIG_START( fm8, fm7_state ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) MCFG_CASSETTE_INTERFACE("fm7_cass") - MCFG_MB8877x_ADD("fdc", XTAL_8MHz / 8) + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) @@ -2228,7 +2228,7 @@ static MACHINE_CONFIG_START( fm77av, fm7_state ) MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_list", "fm7_cass") - MCFG_MB8877x_ADD("fdc", XTAL_8MHz / 8) + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) @@ -2305,7 +2305,7 @@ static MACHINE_CONFIG_START( fm11, fm7_state ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) MCFG_CASSETTE_INTERFACE("fm7_cass") - MCFG_MB8877x_ADD("fdc", XTAL_8MHz / 8) + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) @@ -2358,7 +2358,7 @@ static MACHINE_CONFIG_START( fm16beta, fm7_state ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) MCFG_CASSETTE_INTERFACE("fm7_cass") - MCFG_MB8877x_ADD("fdc", XTAL_8MHz / 8) + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) diff --git a/src/mess/drivers/fmtowns.c b/src/mess/drivers/fmtowns.c index 1b002428d48..fa6235e04d2 100644 --- a/src/mess/drivers/fmtowns.c +++ b/src/mess/drivers/fmtowns.c @@ -2725,7 +2725,7 @@ static MACHINE_CONFIG_FRAGMENT( towns_base ) MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL) - MCFG_MB8877x_ADD("fdc",XTAL_8MHz/4) // clock unknown + MCFG_MB8877_ADD("fdc",XTAL_8MHz/4) // clock unknown MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(towns_state,mb8877a_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(towns_state,mb8877a_drq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", towns_floppies, "35hd", towns_state::floppy_formats) diff --git a/src/mess/drivers/gimix.c b/src/mess/drivers/gimix.c index 1e6e1a00372..4588f8006a4 100644 --- a/src/mess/drivers/gimix.c +++ b/src/mess/drivers/gimix.c @@ -586,7 +586,7 @@ static MACHINE_CONFIG_START( gimix, gimix_state ) MCFG_PTM6840_IRQ_CB(WRITELINE(gimix_state,irq_w)) // PCB pictures show both the RTC and timer set to generate IRQs (are jumper configurable) /* floppy disks */ - MCFG_FD1797x_ADD("fdc",XTAL_8MHz / 4) + MCFG_FD1797_ADD("fdc",XTAL_8MHz / 4) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(gimix_state,fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(gimix_state,fdc_drq_w)) MCFG_WD_FDC_FORCE_READY diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c index e1381d33a63..0553958fcfa 100644 --- a/src/mess/drivers/hec2hrp.c +++ b/src/mess/drivers/hec2hrp.c @@ -570,7 +570,7 @@ static MACHINE_CONFIG_START( hec2mdhrx, hec2hrp_state ) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx) /* Mini Disc */ - MCFG_FD1793x_ADD("wd179x", XTAL_1MHz) + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats) diff --git a/src/mess/drivers/hh_melps4.c b/src/mess/drivers/hh_melps4.c index a5a8efb9180..2fc3291e383 100644 --- a/src/mess/drivers/hh_melps4.c +++ b/src/mess/drivers/hh_melps4.c @@ -345,4 +345,4 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1981, cfrogger, 0, 0, cfrogger, cfrogger, driver_device, 0, "Coleco", "Frogger (Coleco)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK | GAME_NOT_WORKING ) +CONS( 1981, cfrogger, 0, 0, cfrogger, cfrogger, driver_device, 0, "Coleco", "Frogger (Coleco)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c index 5cf0d2ba650..8504f383829 100644 --- a/src/mess/drivers/hh_tms1k.c +++ b/src/mess/drivers/hh_tms1k.c @@ -4073,7 +4073,7 @@ void tbreakup_state::prepare_display() m_display_segmask[y] = 0x7f; m_display_state[y] = (m_r >> y & 1) ? (m_o & 0x7f) : 0; } - + // 22 round leds from O2-O7 and expander port 7 for (int y = 2; y < 8; y++) m_display_state[y] = (m_o >> y & 1) ? m_exp_port[6] : 0; @@ -4081,7 +4081,7 @@ void tbreakup_state::prepare_display() // 24 rectangular leds from expander ports 1-6 (not strobed) for (int y = 0; y < 6; y++) m_display_state[y+8] = m_exp_port[y]; - + set_display_size(8, 14); display_update(); } @@ -4099,7 +4099,7 @@ WRITE16_MEMBER(tbreakup_state::write_r) // R7,R8: input mux m_inp_mux = data >> 7 & 3; - + // R3-R5: TMS1025 port S // R2: TMS1025 STD pin m_expander->write_s(space, 0, data >> 3 & 7); @@ -4114,7 +4114,7 @@ WRITE16_MEMBER(tbreakup_state::write_o) { // O0-O3: TMS1025 port H m_expander->write_h(space, 0, data & 0xf); - + // O0-O7: led state m_o = data; prepare_display(); @@ -4182,7 +4182,7 @@ static MACHINE_CONFIG_START( tbreakup, tbreakup_state ) MCFG_TMS1XXX_READ_K_CB(READ8(tbreakup_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tbreakup_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tbreakup_state, write_o)) - + MCFG_DEVICE_ADD("expander", TMS1025, 0) MCFG_TMS1024_WRITE_PORT_CB(1, WRITE8(tbreakup_state, expander_w)) MCFG_TMS1024_WRITE_PORT_CB(2, WRITE8(tbreakup_state, expander_w)) diff --git a/src/mess/drivers/hp64k.c b/src/mess/drivers/hp64k.c index 641a7e30c88..61f3141c589 100644 --- a/src/mess/drivers/hp64k.c +++ b/src/mess/drivers/hp64k.c @@ -20,447 +20,447 @@ #include "cpu/hphybrid/hphybrid.h" #include "video/i8275.h" -#define BIT_MASK(n) (1U << (n)) +#define BIT_MASK(n) (1U << (n)) // Macros to clear/set single bits -#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) -#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) +#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) +#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) class hp64k_state : public driver_device { public: - hp64k_state(const machine_config &mconfig, device_type type, const char *tag); + hp64k_state(const machine_config &mconfig, device_type type, const char *tag); - //virtual void driver_start(); - //virtual void machine_start(); - virtual void video_start(); - virtual void machine_reset(); + //virtual void driver_start(); + //virtual void machine_start(); + virtual void video_start(); + virtual void machine_reset(); - UINT8 hp64k_crtc_filter(UINT8 data); - DECLARE_WRITE16_MEMBER(hp64k_crtc_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_drq_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_vrtc_w); + UINT8 hp64k_crtc_filter(UINT8 data); + DECLARE_WRITE16_MEMBER(hp64k_crtc_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_drq_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_vrtc_w); - I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); + I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); - DECLARE_READ16_MEMBER(hp64k_rear_sw_r); + DECLARE_READ16_MEMBER(hp64k_rear_sw_r); - IRQ_CALLBACK_MEMBER(hp64k_irq_callback); - void hp64k_update_irl(void); - DECLARE_WRITE16_MEMBER(hp64k_irl_mask_w); + IRQ_CALLBACK_MEMBER(hp64k_irq_callback); + void hp64k_update_irl(void); + DECLARE_WRITE16_MEMBER(hp64k_irl_mask_w); - TIMER_DEVICE_CALLBACK_MEMBER(hp64k_kb_scan); - DECLARE_READ16_MEMBER(hp64k_kb_r); + TIMER_DEVICE_CALLBACK_MEMBER(hp64k_kb_scan); + DECLARE_READ16_MEMBER(hp64k_kb_r); private: - required_device<hp_5061_3011_cpu_device> m_cpu; - required_device<i8275_device> m_crtc; - required_device<palette_device> m_palette; - required_ioport m_io_key0; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - - // Character generator - const UINT8 *m_chargen; - - UINT32 m_crtc_ptr; - bool m_crtc_drq; - bool m_vrtc; - - // Interrupt handling - UINT8 m_irl_mask; - UINT8 m_irl_pending; - - // State of keyboard - ioport_value m_kb_state[ 4 ]; - UINT8 m_kb_row_col; - bool m_kb_scan_on; - bool m_kb_pressed; + required_device<hp_5061_3011_cpu_device> m_cpu; + required_device<i8275_device> m_crtc; + required_device<palette_device> m_palette; + required_ioport m_io_key0; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + + // Character generator + const UINT8 *m_chargen; + + UINT32 m_crtc_ptr; + bool m_crtc_drq; + bool m_vrtc; + + // Interrupt handling + UINT8 m_irl_mask; + UINT8 m_irl_pending; + + // State of keyboard + ioport_value m_kb_state[ 4 ]; + UINT8 m_kb_row_col; + bool m_kb_scan_on; + bool m_kb_pressed; }; static ADDRESS_MAP_START(cpu_mem_map , AS_PROGRAM , 16 , hp64k_state) - AM_RANGE(0x0000 , 0x3fff) AM_ROM - AM_RANGE(0x8000 , 0x8001) AM_WRITE(hp64k_crtc_w) - AM_RANGE(0x8002 , 0xffff) AM_RAM + AM_RANGE(0x0000 , 0x3fff) AM_ROM + AM_RANGE(0x8000 , 0x8001) AM_WRITE(hp64k_crtc_w) + AM_RANGE(0x8002 , 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START(cpu_io_map , AS_IO , 16 , hp64k_state) - // PA = 0, IC = [0..3] - // Keyboard input - AM_RANGE(HP_MAKE_IOADDR(0 , 0) , HP_MAKE_IOADDR(0 , 3)) AM_READ(hp64k_kb_r) - // PA = 7, IC = 2 - // Rear-panel switches - AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READ(hp64k_rear_sw_r) - // PA = 12, IC = [0..3] - // Interrupt mask - AM_RANGE(HP_MAKE_IOADDR(12 , 0) , HP_MAKE_IOADDR(12 , 3)) AM_WRITE(hp64k_irl_mask_w) + // PA = 0, IC = [0..3] + // Keyboard input + AM_RANGE(HP_MAKE_IOADDR(0 , 0) , HP_MAKE_IOADDR(0 , 3)) AM_READ(hp64k_kb_r) + // PA = 7, IC = 2 + // Rear-panel switches + AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READ(hp64k_rear_sw_r) + // PA = 12, IC = [0..3] + // Interrupt mask + AM_RANGE(HP_MAKE_IOADDR(12 , 0) , HP_MAKE_IOADDR(12 , 3)) AM_WRITE(hp64k_irl_mask_w) ADDRESS_MAP_END hp64k_state::hp64k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig , type , tag), - m_cpu(*this , "cpu"), - m_crtc(*this , "crtc"), - m_palette(*this , "palette"), - m_io_key0(*this , "KEY0"), - m_io_key1(*this , "KEY1"), - m_io_key2(*this , "KEY2"), - m_io_key3(*this , "KEY3") + : driver_device(mconfig , type , tag), + m_cpu(*this , "cpu"), + m_crtc(*this , "crtc"), + m_palette(*this , "palette"), + m_io_key0(*this , "KEY0"), + m_io_key1(*this , "KEY1"), + m_io_key2(*this , "KEY2"), + m_io_key3(*this , "KEY3") { } void hp64k_state::video_start() { - m_chargen = memregion("chargen")->base(); + m_chargen = memregion("chargen")->base(); } void hp64k_state::machine_reset() { - m_crtc_drq = false; - m_vrtc = false; - m_crtc_ptr = 0; - m_irl_mask = 0; - m_irl_pending = 0; - memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state)); - m_kb_row_col = 0; - m_kb_scan_on = true; + m_crtc_drq = false; + m_vrtc = false; + m_crtc_ptr = 0; + m_irl_mask = 0; + m_irl_pending = 0; + memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state)); + m_kb_row_col = 0; + m_kb_scan_on = true; } UINT8 hp64k_state::hp64k_crtc_filter(UINT8 data) { - bool inv = (data & 0xe0) == 0xe0; + bool inv = (data & 0xe0) == 0xe0; - return inv ? (data & 0xf2) : data; + return inv ? (data & 0xf2) : data; } WRITE16_MEMBER(hp64k_state::hp64k_crtc_w) { - m_crtc->write(space , offset == 0 , hp64k_crtc_filter((UINT8)data)); + m_crtc->write(space , offset == 0 , hp64k_crtc_filter((UINT8)data)); } WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_drq_w) { - bool crtc_drq = state != 0; - bool prev_crtc = m_crtc_drq; - m_crtc_drq = crtc_drq; + bool crtc_drq = state != 0; + bool prev_crtc = m_crtc_drq; + m_crtc_drq = crtc_drq; - if (!prev_crtc && crtc_drq) { - address_space& prog_space = m_cpu->space(AS_PROGRAM); + if (!prev_crtc && crtc_drq) { + address_space& prog_space = m_cpu->space(AS_PROGRAM); - UINT8 data = prog_space.read_byte(m_crtc_ptr); - m_crtc_ptr++; + UINT8 data = prog_space.read_byte(m_crtc_ptr); + m_crtc_ptr++; - m_crtc->dack_w(prog_space , 0 , hp64k_crtc_filter(data)); - } + m_crtc->dack_w(prog_space , 0 , hp64k_crtc_filter(data)); + } } WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) { - bool vrtc = state != 0; + bool vrtc = state != 0; - if (!m_vrtc && vrtc) { - m_crtc_ptr = 0xf9f0 << 1; - } - m_vrtc = vrtc; + if (!m_vrtc && vrtc) { + m_crtc_ptr = 0xf9f0 << 1; + } + m_vrtc = vrtc; } I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; - bool lvid , livid; - UINT16 pixels_lvid , pixels_livid; - unsigned i; - - if (vsp) { - pixels_lvid = pixels_livid = ~0; - } else if (lten) { - pixels_livid = ~0; - if (rvv) { - pixels_lvid = ~0; - } else { - pixels_lvid = 0; - } - } else if (rvv) { - pixels_lvid = ~0; - pixels_livid = (UINT16)chargen_byte << 1; - } else { - pixels_lvid = ~((UINT16)chargen_byte << 1); - pixels_livid = ~0; - } - - for (i = 0; i < 9; i++) { - lvid = (pixels_lvid & (1U << (8 - i))) != 0; - livid = (pixels_livid & (1U << (8 - i))) != 0; - - if (!lvid) { - // Normal brightness - bitmap.pix32(y , x + i) = palette[ 2 ]; - } else if (livid) { - // Black - bitmap.pix32(y , x + i) = palette[ 0 ]; - } else { - // Half brightness - bitmap.pix32(y , x + i) = palette[ 1 ]; - } - } + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; + bool lvid , livid; + UINT16 pixels_lvid , pixels_livid; + unsigned i; + + if (vsp) { + pixels_lvid = pixels_livid = ~0; + } else if (lten) { + pixels_livid = ~0; + if (rvv) { + pixels_lvid = ~0; + } else { + pixels_lvid = 0; + } + } else if (rvv) { + pixels_lvid = ~0; + pixels_livid = (UINT16)chargen_byte << 1; + } else { + pixels_lvid = ~((UINT16)chargen_byte << 1); + pixels_livid = ~0; + } + + for (i = 0; i < 9; i++) { + lvid = (pixels_lvid & (1U << (8 - i))) != 0; + livid = (pixels_livid & (1U << (8 - i))) != 0; + + if (!lvid) { + // Normal brightness + bitmap.pix32(y , x + i) = palette[ 2 ]; + } else if (livid) { + // Black + bitmap.pix32(y , x + i) = palette[ 0 ]; + } else { + // Half brightness + bitmap.pix32(y , x + i) = palette[ 1 ]; + } + } } READ16_MEMBER(hp64k_state::hp64k_rear_sw_r) { - // TEST - return ~0; + // TEST + return ~0; } IRQ_CALLBACK_MEMBER(hp64k_state::hp64k_irq_callback) { - if (irqline == HPHYBRID_IRL) { - return 0xff00 | (m_irl_mask & m_irl_pending); - } else { - return ~0; - } + if (irqline == HPHYBRID_IRL) { + return 0xff00 | (m_irl_mask & m_irl_pending); + } else { + return ~0; + } } void hp64k_state::hp64k_update_irl(void) { - m_cpu->set_input_line(HPHYBRID_IRL , (m_irl_mask & m_irl_pending) != 0); + m_cpu->set_input_line(HPHYBRID_IRL , (m_irl_mask & m_irl_pending) != 0); } WRITE16_MEMBER(hp64k_state::hp64k_irl_mask_w) { - m_irl_mask = (UINT8)data; - hp64k_update_irl(); + m_irl_mask = (UINT8)data; + hp64k_update_irl(); } TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_kb_scan) { - if (m_kb_scan_on) { - unsigned i; - - ioport_value input[ 4 ]; - input[ 0 ] = m_io_key0->read(); - input[ 1 ] = m_io_key1->read(); - input[ 2 ] = m_io_key2->read(); - input[ 3 ] = m_io_key3->read(); - - for (i = 0; i < 128; i++) { - if (++m_kb_row_col >= 128) { - m_kb_row_col = 0; - } - - ioport_value mask = BIT_MASK(m_kb_row_col & 0x1f); - unsigned idx = m_kb_row_col >> 5; - - if ((input[ idx ] ^ m_kb_state[ idx ]) & mask) { - // key changed state - m_kb_state[ idx ] ^= mask; - m_kb_pressed = (m_kb_state[ idx ] & mask) != 0; - m_kb_scan_on = false; - BIT_SET(m_irl_pending , 0); - hp64k_update_irl(); - break; - } - } - } + if (m_kb_scan_on) { + unsigned i; + + ioport_value input[ 4 ]; + input[ 0 ] = m_io_key0->read(); + input[ 1 ] = m_io_key1->read(); + input[ 2 ] = m_io_key2->read(); + input[ 3 ] = m_io_key3->read(); + + for (i = 0; i < 128; i++) { + if (++m_kb_row_col >= 128) { + m_kb_row_col = 0; + } + + ioport_value mask = BIT_MASK(m_kb_row_col & 0x1f); + unsigned idx = m_kb_row_col >> 5; + + if ((input[ idx ] ^ m_kb_state[ idx ]) & mask) { + // key changed state + m_kb_state[ idx ] ^= mask; + m_kb_pressed = (m_kb_state[ idx ] & mask) != 0; + m_kb_scan_on = false; + BIT_SET(m_irl_pending , 0); + hp64k_update_irl(); + break; + } + } + } } READ16_MEMBER(hp64k_state::hp64k_kb_r) { - UINT16 ret = 0xff00 | m_kb_row_col; + UINT16 ret = 0xff00 | m_kb_row_col; - if (m_kb_pressed) { - BIT_SET(ret , 7); - } + if (m_kb_pressed) { + BIT_SET(ret , 7); + } - m_kb_scan_on = true; - BIT_CLR(m_irl_pending , 0); - hp64k_update_irl(); + m_kb_scan_on = true; + BIT_CLR(m_irl_pending , 0); + hp64k_update_irl(); - return ret; + return ret; } static INPUT_PORTS_START(hp64k) - // Keyboard is arranged in a 8 x 16 matrix. Of the 128 possible positions, only 77 are used. - // For key arrangement on the matrix, see [1] pg 334 - // Keys are mapped on bit b of KEYn - // where b = (row & 1) << 4 + column, n = row >> 1 - // column = [0..15] - // row = [0..7] - PORT_START("KEY0") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) - - PORT_START("KEY1") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("RECALL") - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("CLRLINE") - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("CAPS") - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("RESET") - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("SK1") - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("SK2") - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("SK3") - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SK4") - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("SK5") - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("SK6") - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("SK7") - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("SK8") - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) - - PORT_START("KEY2") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INSCHAR") - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DELCHAR") - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('_') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ROLLUP") - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("NEXTPG") - - PORT_START("KEY3") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("ROLLDN") - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("PREVPG") + // Keyboard is arranged in a 8 x 16 matrix. Of the 128 possible positions, only 77 are used. + // For key arrangement on the matrix, see [1] pg 334 + // Keys are mapped on bit b of KEYn + // where b = (row & 1) << 4 + column, n = row >> 1 + // column = [0..15] + // row = [0..7] + PORT_START("KEY0") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) + + PORT_START("KEY1") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("RECALL") + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("CLRLINE") + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("CAPS") + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("RESET") + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("SK1") + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("SK2") + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("SK3") + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SK4") + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("SK5") + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("SK6") + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("SK7") + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("SK8") + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) + + PORT_START("KEY2") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INSCHAR") + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DELCHAR") + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('_') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ROLLUP") + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("NEXTPG") + + PORT_START("KEY3") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("ROLLDN") + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("PREVPG") INPUT_PORTS_END static MACHINE_CONFIG_START(hp64k , hp64k_state) - MCFG_CPU_ADD("cpu" , HP_5061_3011 , 6250000) - MCFG_CPU_PROGRAM_MAP(cpu_mem_map) - MCFG_CPU_IO_MAP(cpu_io_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(hp64k_state , hp64k_irq_callback) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - // Actual keyboard refresh rate should be between 1 and 2 kHz - MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp64k_state , hp64k_kb_scan , attotime::from_hz(100)) - - // Clock = 25 MHz / 9 * (112/114) - MCFG_DEVICE_ADD("crtc" , I8275 , 2729045) - MCFG_I8275_CHARACTER_WIDTH(9) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(hp64k_state , crtc_display_pixels) - MCFG_I8275_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_drq_w)) - MCFG_I8275_VRTC_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_vrtc_w)) - - MCFG_SCREEN_ADD("screen" , RASTER) - MCFG_SCREEN_UPDATE_DEVICE("crtc" , i8275_device , screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + MCFG_CPU_ADD("cpu" , HP_5061_3011 , 6250000) + MCFG_CPU_PROGRAM_MAP(cpu_mem_map) + MCFG_CPU_IO_MAP(cpu_io_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(hp64k_state , hp64k_irq_callback) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + // Actual keyboard refresh rate should be between 1 and 2 kHz + MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp64k_state , hp64k_kb_scan , attotime::from_hz(100)) + + // Clock = 25 MHz / 9 * (112/114) + MCFG_DEVICE_ADD("crtc" , I8275 , 2729045) + MCFG_I8275_CHARACTER_WIDTH(9) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(hp64k_state , crtc_display_pixels) + MCFG_I8275_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_drq_w)) + MCFG_I8275_VRTC_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_vrtc_w)) + + MCFG_SCREEN_ADD("screen" , RASTER) + MCFG_SCREEN_UPDATE_DEVICE("crtc" , i8275_device , screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") MACHINE_CONFIG_END ROM_START(hp64k) - ROM_REGION(0x8000 , "cpu" , ROMREGION_16BIT | ROMREGION_BE | ROMREGION_INVERT) - ROM_LOAD16_BYTE("64100_80022.bin" , 0x0000 , 0x1000 , CRC(38b2aae5) SHA1(bfd0f126bfaf3724dc501979ad2d46afc41913aa)) - ROM_LOAD16_BYTE("64100_80020.bin" , 0x0001 , 0x1000 , CRC(ac01b436) SHA1(be1e827ea1393a95abb02a52ab5cc35dc2cd96e4)) - ROM_LOAD16_BYTE("64100_80023.bin" , 0x2000 , 0x1000 , CRC(6b4bc2ce) SHA1(00e6c58ccae9640dc81cb3e92db90a8c69b02a93)) - ROM_LOAD16_BYTE("64100_80021.bin" , 0x2001 , 0x1000 , CRC(74f9d33c) SHA1(543a845a992b0ceac3e0491acdfb178df0adeb1f)) - ROM_LOAD16_BYTE("64100_80026.bin" , 0x4000 , 0x1000 , CRC(a74e834b) SHA1(a2ff9765628985d9bab4cb44ba23257a9b8d0965)) - ROM_LOAD16_BYTE("64100_80024.bin" , 0x4001 , 0x1000 , CRC(2e15a1d2) SHA1(ce4330f8f8015a26c02f0965b95baf7dfd615512)) - ROM_LOAD16_BYTE("64100_80027.bin" , 0x6000 , 0x1000 , CRC(b93c0e7a) SHA1(b239446d3d6e9d3dba6c0278b2771abe1623e1ad)) - ROM_LOAD16_BYTE("64100_80025.bin" , 0x6001 , 0x1000 , CRC(e6353085) SHA1(48d78835c798f2caf6ee539057676d4f3c8a4df9)) - - ROM_REGION(0x800 , "chargen" , 0) - ROM_LOAD("1816_1496_82S191.bin" , 0 , 0x800 , CRC(32a52664) SHA1(8b2a49a32510103ff424e8481d5ed9887f609f2f)) + ROM_REGION(0x8000 , "cpu" , ROMREGION_16BIT | ROMREGION_BE | ROMREGION_INVERT) + ROM_LOAD16_BYTE("64100_80022.bin" , 0x0000 , 0x1000 , CRC(38b2aae5) SHA1(bfd0f126bfaf3724dc501979ad2d46afc41913aa)) + ROM_LOAD16_BYTE("64100_80020.bin" , 0x0001 , 0x1000 , CRC(ac01b436) SHA1(be1e827ea1393a95abb02a52ab5cc35dc2cd96e4)) + ROM_LOAD16_BYTE("64100_80023.bin" , 0x2000 , 0x1000 , CRC(6b4bc2ce) SHA1(00e6c58ccae9640dc81cb3e92db90a8c69b02a93)) + ROM_LOAD16_BYTE("64100_80021.bin" , 0x2001 , 0x1000 , CRC(74f9d33c) SHA1(543a845a992b0ceac3e0491acdfb178df0adeb1f)) + ROM_LOAD16_BYTE("64100_80026.bin" , 0x4000 , 0x1000 , CRC(a74e834b) SHA1(a2ff9765628985d9bab4cb44ba23257a9b8d0965)) + ROM_LOAD16_BYTE("64100_80024.bin" , 0x4001 , 0x1000 , CRC(2e15a1d2) SHA1(ce4330f8f8015a26c02f0965b95baf7dfd615512)) + ROM_LOAD16_BYTE("64100_80027.bin" , 0x6000 , 0x1000 , CRC(b93c0e7a) SHA1(b239446d3d6e9d3dba6c0278b2771abe1623e1ad)) + ROM_LOAD16_BYTE("64100_80025.bin" , 0x6001 , 0x1000 , CRC(e6353085) SHA1(48d78835c798f2caf6ee539057676d4f3c8a4df9)) + + ROM_REGION(0x800 , "chargen" , 0) + ROM_LOAD("1816_1496_82S191.bin" , 0 , 0x800 , CRC(32a52664) SHA1(8b2a49a32510103ff424e8481d5ed9887f609f2f)) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ diff --git a/src/mess/drivers/ht68k.c b/src/mess/drivers/ht68k.c index e8ba7cdcf81..5d4bbafb67a 100644 --- a/src/mess/drivers/ht68k.c +++ b/src/mess/drivers/ht68k.c @@ -137,7 +137,7 @@ static MACHINE_CONFIG_START( ht68k, ht68k_state ) MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart68681", mc68681_device, rx_a_w)) - MCFG_WD1770x_ADD("wd1770", XTAL_8MHz ) + MCFG_WD1770_ADD("wd1770", XTAL_8MHz ) MCFG_FLOPPY_DRIVE_ADD("wd1770:0", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1770:1", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/i7000.c b/src/mess/drivers/i7000.c index e0f160ed985..de363e40998 100644 --- a/src/mess/drivers/i7000.c +++ b/src/mess/drivers/i7000.c @@ -51,9 +51,9 @@ class i7000_state : public driver_device public: i7000_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_card(*this, "cardslot"), - m_videoram(*this, "videoram") - { } + m_card(*this, "cardslot"), + m_videoram(*this, "videoram") + { } virtual void video_start(); @@ -62,8 +62,8 @@ public: UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT8 *m_char_rom; -// DECLARE_READ8_MEMBER( i7000_io_r ); -// DECLARE_WRITE8_MEMBER( i7000_io_w ); +// DECLARE_READ8_MEMBER( i7000_io_r ); +// DECLARE_WRITE8_MEMBER( i7000_io_w ); DECLARE_DRIVER_INIT(i7000); DECLARE_PALETTE_INIT(i7000); @@ -88,42 +88,42 @@ void i7000_state::video_start() UINT32 i7000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t addr = 0; - - for (int sy = 0; sy < 25; sy++) - { - for (int sx = 0; sx < 40; sx++) - { - UINT8 data = m_videoram[addr++]; - for (int y = 0; y < 8; y++) - { - int color = m_char_rom[data*8 + y]; - for (int x = 0; x < 8; x++) - { - bitmap.pix16(sy*8 + y, sx*8 + 7 - x) = (color & 1); - color >>= 1; - } - } - } - } - - return 0; + offs_t addr = 0; + + for (int sy = 0; sy < 25; sy++) + { + for (int sx = 0; sx < 40; sx++) + { + UINT8 data = m_videoram[addr++]; + for (int y = 0; y < 8; y++) + { + int color = m_char_rom[data*8 + y]; + for (int x = 0; x < 8; x++) + { + bitmap.pix16(sy*8 + y, sx*8 + 7 - x) = (color & 1); + color >>= 1; + } + } + } + } + + return 0; } /*FIXME: we still need to figure out the proper memory map for the maincpu and where the cartridge slot maps to. */ static ADDRESS_MAP_START(i7000_mem, AS_PROGRAM, 8, i7000_state) - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x1000, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0xffff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x1000, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0xffff) AM_RAM AM_SHARE("videoram") // AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("cardslot", 0) ADDRESS_MAP_END /* static ADDRESS_MAP_START( i7000_io , AS_IO, 8, i7000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK (0xff) - AM_RANGE(0x00, 0xff) AM_READWRITE(i7000_io_r, i7000_io_w) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK (0xff) + AM_RANGE(0x00, 0xff) AM_READWRITE(i7000_io_r, i7000_io_w) ADDRESS_MAP_END */ @@ -161,7 +161,7 @@ static MACHINE_CONFIG_START( i7000, i7000_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NSC800, XTAL_4MHz) MCFG_CPU_PROGRAM_MAP(i7000_mem) -// MCFG_CPU_IO_MAP(i7000_io) +// MCFG_CPU_IO_MAP(i7000_io) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -175,7 +175,7 @@ static MACHINE_CONFIG_START( i7000, i7000_state ) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(i7000_state, i7000) -// MCFG_GFXDECODE_ADD("gfxdecode", "palette", i7000) +// MCFG_GFXDECODE_ADD("gfxdecode", "palette", i7000) /* Cartridge slot */ MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "i7000_card") diff --git a/src/mess/drivers/ie15.c b/src/mess/drivers/ie15.c index 4533388c8de..80eec85421e 100644 --- a/src/mess/drivers/ie15.c +++ b/src/mess/drivers/ie15.c @@ -561,8 +561,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(ie15_state::scanline_callback) UINT16 y = m_screen->vpos(); DBG_LOG(3,"scanline_cb", - ("addr %03x frame %" I64FMT "d x %.4d y %.3d row %.2d e:c:s %d:%d:%d\n", - m_video.ptr2, m_screen->frame_number(), m_screen->hpos(), y, + ("addr %03x frame %d x %.4d y %.3d row %.2d e:c:s %d:%d:%d\n", + m_video.ptr2, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11, m_video.enable, m_video.cursor, m_video.line25)); if (y < IE15_VERT_START) return; diff --git a/src/mess/drivers/itt3030.c b/src/mess/drivers/itt3030.c index 498a215cc58..9df2e81432b 100644 --- a/src/mess/drivers/itt3030.c +++ b/src/mess/drivers/itt3030.c @@ -777,7 +777,7 @@ static MACHINE_CONFIG_START( itt3030, itt3030_state ) MCFG_DEVICE_ADD("crt5027", CRT5027, XTAL_6MHz) MCFG_TMS9927_CHAR_WIDTH(16) - MCFG_FD1791x_ADD("fdc", XTAL_20MHz / 20) + MCFG_FD1791_ADD("fdc", XTAL_20MHz / 20) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(itt3030_state, fdcirq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(itt3030_state, fdcdrq_w)) MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(itt3030_state, fdchld_w)) diff --git a/src/mess/drivers/jupiter.c b/src/mess/drivers/jupiter.c index fc5df6a5636..1bce61303a6 100644 --- a/src/mess/drivers/jupiter.c +++ b/src/mess/drivers/jupiter.c @@ -225,7 +225,7 @@ static MACHINE_CONFIG_START( jupiter, jupiter2_state ) MCFG_CPU_IO_MAP(jupiter_m6800_io) // devices - MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771x, 1000000) + MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) @@ -259,7 +259,7 @@ static MACHINE_CONFIG_START( jupiter3, jupiter3_state ) MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") // devices - MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771x, 1000000) + MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/kaypro.c b/src/mess/drivers/kaypro.c index 923fb65c0a7..a6a82c0f166 100644 --- a/src/mess/drivers/kaypro.c +++ b/src/mess/drivers/kaypro.c @@ -241,7 +241,7 @@ static MACHINE_CONFIG_START( kayproii, kaypro_state ) MCFG_Z80SIO0_ADD("z80sio", XTAL_20MHz / 8, 0, 0, 0, 0) MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_FD1793x_ADD("fdc", XTAL_20MHz / 20) + MCFG_FD1793_ADD("fdc", XTAL_20MHz / 20) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) MCFG_WD_FDC_FORCE_READY @@ -304,7 +304,7 @@ static MACHINE_CONFIG_START( kaypro2x, kaypro_state ) MCFG_Z80SIO0_ADD("z80sio_2x", XTAL_16MHz / 4, 0, 0, 0, 0) /* extra sio for modem and printer */ MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) // WD1943, SMC8116 - MCFG_FD1793x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) MCFG_WD_FDC_FORCE_READY diff --git a/src/mess/drivers/m20.c b/src/mess/drivers/m20.c index dc4c20ea2b5..b5de310407e 100644 --- a/src/mess/drivers/m20.c +++ b/src/mess/drivers/m20.c @@ -804,7 +804,7 @@ static MACHINE_CONFIG_START( m20, m20_state ) MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") /* Devices */ - MCFG_FD1797x_ADD("fd1797", 1000000) + MCFG_FD1797_ADD("fd1797", 1000000) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("i8259", pic8259_device, ir0_w)) MCFG_FLOPPY_DRIVE_ADD("fd1797:0", m20_floppies, "5dd", m20_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1797:1", m20_floppies, "5dd", m20_state::floppy_formats) diff --git a/src/mess/drivers/mbc200.c b/src/mess/drivers/mbc200.c index 6a7f02e4bb2..5c9ee51937a 100644 --- a/src/mess/drivers/mbc200.c +++ b/src/mess/drivers/mbc200.c @@ -244,7 +244,7 @@ static MACHINE_CONFIG_START( mbc200, mbc200_state ) MCFG_DEVICE_ADD("i8251_1", I8251, 0) // INS8251N MCFG_DEVICE_ADD("i8251_2", I8251, 0) // INS8251A - MCFG_MB8876x_ADD("fdc", XTAL_8MHz / 8) // guess + MCFG_MB8876_ADD("fdc", XTAL_8MHz / 8) // guess MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/mbc55x.c b/src/mess/drivers/mbc55x.c index 2ff26f364f6..d5b1c2b7a06 100644 --- a/src/mess/drivers/mbc55x.c +++ b/src/mess/drivers/mbc55x.c @@ -292,7 +292,7 @@ static MACHINE_CONFIG_START( mbc55x, mbc55x_state ) MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(mbc55x_state, vid_vsync_changed)) /* Backing storage */ - MCFG_FD1793x_ADD(FDC_TAG, XTAL_1MHz) + MCFG_FD1793_ADD(FDC_TAG, XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) diff --git a/src/mess/drivers/mbee.c b/src/mess/drivers/mbee.c index 681e38a6f4b..7d40de85c95 100644 --- a/src/mess/drivers/mbee.c +++ b/src/mess/drivers/mbee.c @@ -762,7 +762,7 @@ static MACHINE_CONFIG_DERIVED( mbee56, mbeeic ) MCFG_CPU_PROGRAM_MAP(mbee56_mem) MCFG_CPU_IO_MAP(mbee56_io) MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee56) - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 2) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) MCFG_WD_FDC_ENMF_CALLBACK(GND) @@ -784,7 +784,7 @@ static MACHINE_CONFIG_DERIVED( mbee128p, mbeeppc ) MCFG_CPU_PROGRAM_MAP(mbee256_mem) MCFG_CPU_IO_MAP(mbee128_io) MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 2) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) MCFG_WD_FDC_ENMF_CALLBACK(GND) diff --git a/src/mess/drivers/mirage.c b/src/mess/drivers/mirage.c index 14b6868c637..dc39d620897 100644 --- a/src/mess/drivers/mirage.c +++ b/src/mess/drivers/mirage.c @@ -229,7 +229,7 @@ static MACHINE_CONFIG_START( mirage, mirage_state ) MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, firq_line)) - MCFG_WD1772x_ADD("wd1772", 8000000) + MCFG_WD1772_ADD("wd1772", 8000000) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE("maincpu", M6809_IRQ_LINE)) diff --git a/src/mess/drivers/ms0515.c b/src/mess/drivers/ms0515.c index fdbf1ba5686..54086c019db 100644 --- a/src/mess/drivers/ms0515.c +++ b/src/mess/drivers/ms0515.c @@ -220,7 +220,7 @@ static MACHINE_CONFIG_START( ms0515, ms0515_state ) MCFG_T11_INITIAL_MODE(0xf2ff) MCFG_CPU_PROGRAM_MAP(ms0515_mem) - MCFG_DEVICE_ADD("vg93", FD1793x, 1000000) + MCFG_DEVICE_ADD("vg93", FD1793, 1000000) MCFG_FLOPPY_DRIVE_ADD("vg93:0", ms0515_floppies, "525qd", floppy_image_device::default_floppy_formats) /* video hardware */ diff --git a/src/mess/drivers/msx.c b/src/mess/drivers/msx.c index 063b022b835..f8d076d2d22 100644 --- a/src/mess/drivers/msx.c +++ b/src/mess/drivers/msx.c @@ -1281,7 +1281,7 @@ static SLOT_INTERFACE_START( msx_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( msx_fd1793 ) - MCFG_FD1793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_FD1793_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY MACHINE_CONFIG_END @@ -1289,19 +1289,19 @@ static MACHINE_CONFIG_FRAGMENT( msx_wd2793_force_ready ) // From NMS8245 schematics: // READY + HLT - pulled high // SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( msx_wd2793 ) - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( msx_mb8877a ) // From CF-3300 FDC schematic: // READY + HLT - pulled high // -DDEN - pulled low - MCFG_MB8877x_ADD("fdc", XTAL_4MHz / 4) + MCFG_MB8877_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY MACHINE_CONFIG_END @@ -1310,7 +1310,7 @@ static MACHINE_CONFIG_FRAGMENT( msx_tc8566af ) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( msx_microsol ) - MCFG_WD2793x_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) MCFG_WD_FDC_FORCE_READY MACHINE_CONFIG_END diff --git a/src/mess/drivers/myb3k.c b/src/mess/drivers/myb3k.c index 8c98133d67b..0d467cbdfe1 100644 --- a/src/mess/drivers/myb3k.c +++ b/src/mess/drivers/myb3k.c @@ -269,7 +269,7 @@ static MACHINE_CONFIG_START( myb3k, myb3k_state ) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) - MCFG_DEVICE_ADD("fdc", MB8877x, 2000000) // unknown type + MCFG_DEVICE_ADD("fdc", MB8877, 2000000) // unknown type MCFG_FLOPPY_DRIVE_ADD("fdc:0", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/mycom.c b/src/mess/drivers/mycom.c index be5e44bff65..c90bc44c2a6 100644 --- a/src/mess/drivers/mycom.c +++ b/src/mess/drivers/mycom.c @@ -550,7 +550,7 @@ static MACHINE_CONFIG_START( mycom, mycom_state ) /* Devices */ MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) MCFG_CASSETTE_ADD( "cassette" ) - MCFG_FD1771x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1771_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c index 7f86fd940a0..f12c3e309b1 100644 --- a/src/mess/drivers/mz2000.c +++ b/src/mess/drivers/mz2000.c @@ -833,7 +833,7 @@ static MACHINE_CONFIG_START( mz2000, mz2000_state ) MCFG_PIT8253_CLK1(31250) /* needed by "Art Magic" to boot */ MCFG_PIT8253_CLK2(31250) - MCFG_MB8877x_ADD("mb8877a", XTAL_1MHz) + MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2000_floppies, "dd", mz2000_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2000_floppies, "dd", mz2000_state::floppy_formats) diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c index a7112dc8c78..6d904bd5bbd 100644 --- a/src/mess/drivers/mz2500.c +++ b/src/mess/drivers/mz2500.c @@ -2108,7 +2108,7 @@ static MACHINE_CONFIG_START( mz2500, mz2500_state ) MCFG_PIT8253_CLK2(16) //CH2, used by Super MZ demo / The Black Onyx and a few others (TODO: timing of this) MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit", pit8253_device, write_clk1)) - MCFG_MB8877x_ADD("mb8877a", XTAL_1MHz) + MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/ngen.c b/src/mess/drivers/ngen.c index 487b9e0c4ae..9050da436a8 100644 --- a/src/mess/drivers/ngen.c +++ b/src/mess/drivers/ngen.c @@ -916,7 +916,7 @@ static MACHINE_CONFIG_START( ngen, ngen_state ) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) - MCFG_WD2797x_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w)) MCFG_WD_FDC_FORCE_READY @@ -1026,7 +1026,7 @@ static MACHINE_CONFIG_START( ngen386, ngen386_state ) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) - MCFG_WD2797x_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) // MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("i386cpu",i80186_cpu_device,drq1_w)) MCFG_WD_FDC_FORCE_READY diff --git a/src/mess/drivers/oric.c b/src/mess/drivers/oric.c index deda51ee0c5..5ef4b1a19de 100644 --- a/src/mess/drivers/oric.c +++ b/src/mess/drivers/oric.c @@ -847,7 +847,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( telstrat, oric, telestrat_state ) MCFG_VIA6522_IRQ_HANDLER(WRITELINE(telestrat_state, via2_irq_w)) /* microdisc */ - MCFG_FD1793x_ADD("fdc", XTAL_8MHz/8) + MCFG_FD1793_ADD("fdc", XTAL_8MHz/8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(telestrat_state, fdc_irq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(telestrat_state, fdc_drq_w)) MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(telestrat_state, fdc_hld_w)) diff --git a/src/mess/drivers/orion.c b/src/mess/drivers/orion.c index 40752d62d3d..ac3d9ab8430 100644 --- a/src/mess/drivers/orion.c +++ b/src/mess/drivers/orion.c @@ -123,7 +123,7 @@ static MACHINE_CONFIG_START( orion128, orion_state ) MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) @@ -202,7 +202,7 @@ static MACHINE_CONFIG_START( orionz80, orion_state ) MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) @@ -277,7 +277,7 @@ static MACHINE_CONFIG_START( orionpro, orion_state ) MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) diff --git a/src/mess/drivers/osbexec.c b/src/mess/drivers/osbexec.c index 04479245194..e5889c40fe2 100644 --- a/src/mess/drivers/osbexec.c +++ b/src/mess/drivers/osbexec.c @@ -558,7 +558,7 @@ static MACHINE_CONFIG_START( osbexec, osbexec_state ) MCFG_Z80SIO2_ADD("sio", MAIN_CLOCK/6, 0, 0, 0, 0) - MCFG_DEVICE_ADD("mb8877", MB8877x, MAIN_CLOCK/24) + MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pia_1", pia6821_device, cb1_w)) MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/osborne1.c b/src/mess/drivers/osborne1.c index 2dfb9d67f05..4910ee5e0cc 100644 --- a/src/mess/drivers/osborne1.c +++ b/src/mess/drivers/osborne1.c @@ -221,7 +221,7 @@ static MACHINE_CONFIG_START( osborne1, osborne1_state ) MCFG_PIA_CB2_HANDLER(WRITELINE(osborne1_state, video_pia_out_cb2_dummy)) MCFG_PIA_IRQA_HANDLER(WRITELINE(osborne1_state, video_pia_irq_a_func)) - MCFG_DEVICE_ADD("mb8877", MB8877x, MAIN_CLOCK/16) + MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/16) MCFG_WD_FDC_FORCE_READY MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/partner.c b/src/mess/drivers/partner.c index 27ed71a4c43..224f17fc2a3 100644 --- a/src/mess/drivers/partner.c +++ b/src/mess/drivers/partner.c @@ -212,7 +212,7 @@ static MACHINE_CONFIG_START( partner, partner_state ) MCFG_SOFTWARE_LIST_ADD("cass_list","partner_cass") - MCFG_FD1793x_ADD("wd1793", XTAL_16MHz / 16) + MCFG_FD1793_ADD("wd1793", XTAL_16MHz / 16) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma8257", i8257_device, dreq0_w)) MCFG_FLOPPY_DRIVE_ADD("wd1793:0", partner_floppies, "525qd", partner_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1793:1", partner_floppies, "525qd", partner_state::floppy_formats) diff --git a/src/mess/drivers/pcd.c b/src/mess/drivers/pcd.c index 3460beb278e..691c8b3e324 100644 --- a/src/mess/drivers/pcd.c +++ b/src/mess/drivers/pcd.c @@ -469,7 +469,7 @@ static MACHINE_CONFIG_START( pcd, pcd_state ) MCFG_NVRAM_ADD_1FILL("nvram") // floppy disk controller - MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 8) + MCFG_WD2793_ADD("fdc", XTAL_16MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic1", pic8259_device, ir6_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) MCFG_WD_FDC_ENMF_CALLBACK(GND) diff --git a/src/mess/drivers/pk8020.c b/src/mess/drivers/pk8020.c index 49d8faec173..1b8e83ef527 100644 --- a/src/mess/drivers/pk8020.c +++ b/src/mess/drivers/pk8020.c @@ -215,7 +215,7 @@ static MACHINE_CONFIG_START( pk8020, pk8020_state ) MCFG_DEVICE_ADD("rs232", I8251, 0) MCFG_DEVICE_ADD("lan", I8251, 0) - MCFG_FD1793x_ADD("wd1793", XTAL_20MHz / 20) + MCFG_FD1793_ADD("wd1793", XTAL_20MHz / 20) MCFG_FLOPPY_DRIVE_ADD("wd1793:0", pk8020_floppies, "qd", pk8020_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1793:1", pk8020_floppies, "qd", pk8020_state::floppy_formats) diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c index 5d57d1c74e1..0cf0318d43f 100644 --- a/src/mess/drivers/psx.c +++ b/src/mess/drivers/psx.c @@ -44,18 +44,10 @@ public: UINT8 m_cd_io_status; UINT8 m_cd_param[8]; UINT8 m_cd_result[8]; - DECLARE_DIRECT_UPDATE_MEMBER(psx_default); - DECLARE_DIRECT_UPDATE_MEMBER(psx_setopbase); DECLARE_MACHINE_RESET(psx); inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); - void psxexe_conv32( UINT32 *p_uint32 ); - int load_psxexe( cpu_device *cpu, unsigned char *p_n_file, int n_len ); - void cpe_set_register( cpu_device *cpu, int n_reg, int n_value ); - int load_cpe( cpu_device *cpu, unsigned char *p_n_file, int n_len ); - int load_psf( cpu_device *cpu, unsigned char *p_n_file, int n_len ); void cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); void cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); - DECLARE_QUICKLOAD_LOAD_MEMBER( psx_exe_load ); required_device<psxcpu_device> m_maincpu; required_device<ram_device> m_ram; }; @@ -77,397 +69,6 @@ inline void ATTR_PRINTF(3,4) psx1_state::verboselog( int n_level, const char *s } -void psx1_state::psxexe_conv32( UINT32 *p_uint32 ) -{ - UINT8 *p_uint8; - - p_uint8 = (UINT8 *)p_uint32; - - *( p_uint32 ) = p_uint8[ 0 ] | - ( p_uint8[ 1 ] << 8 ) | - ( p_uint8[ 2 ] << 16 ) | - ( p_uint8[ 3 ] << 24 ); -} - -int psx1_state::load_psxexe( cpu_device *cpu, unsigned char *p_n_file, int n_len ) -{ - struct PSXEXE_HEADER - { - UINT8 id[ 8 ]; - UINT32 text; /* SCE only */ - UINT32 data; /* SCE only */ - UINT32 pc0; - UINT32 gp0; /* SCE only */ - UINT32 t_addr; - UINT32 t_size; - UINT32 d_addr; /* SCE only */ - UINT32 d_size; /* SCE only */ - UINT32 b_addr; /* SCE only */ - UINT32 b_size; /* SCE only */ - UINT32 s_addr; - UINT32 s_size; - UINT32 SavedSP; - UINT32 SavedFP; - UINT32 SavedGP; - UINT32 SavedRA; - UINT32 SavedS0; - UINT8 dummy[ 0x800 - 76 ]; - }; - - struct PSXEXE_HEADER *psxexe_header = (struct PSXEXE_HEADER *)p_n_file; - - if( n_len >= sizeof( struct PSXEXE_HEADER ) && - memcmp( psxexe_header->id, "PS-X EXE", 8 ) == 0 ) - { - psxexe_conv32( &psxexe_header->text ); - psxexe_conv32( &psxexe_header->data ); - psxexe_conv32( &psxexe_header->pc0 ); - psxexe_conv32( &psxexe_header->gp0 ); - psxexe_conv32( &psxexe_header->t_addr ); - psxexe_conv32( &psxexe_header->t_size ); - psxexe_conv32( &psxexe_header->d_addr ); - psxexe_conv32( &psxexe_header->d_size ); - psxexe_conv32( &psxexe_header->b_addr ); - psxexe_conv32( &psxexe_header->b_size ); - psxexe_conv32( &psxexe_header->s_addr ); - psxexe_conv32( &psxexe_header->s_size ); - psxexe_conv32( &psxexe_header->SavedSP ); - psxexe_conv32( &psxexe_header->SavedFP ); - psxexe_conv32( &psxexe_header->SavedGP ); - psxexe_conv32( &psxexe_header->SavedRA ); - psxexe_conv32( &psxexe_header->SavedS0 ); - - /* todo: check size.. */ - - logerror( "psx_exe_load: pc %08x\n", psxexe_header->pc0 ); - logerror( "psx_exe_load: org %08x\n", psxexe_header->t_addr ); - logerror( "psx_exe_load: len %08x\n", psxexe_header->t_size ); - logerror( "psx_exe_load: sp %08x\n", psxexe_header->s_addr ); - logerror( "psx_exe_load: len %08x\n", psxexe_header->s_size ); - - UINT8 *p_ram = m_ram->pointer(); - UINT32 n_ram = m_ram->size(); - - UINT8 *p_psxexe = p_n_file + sizeof( struct PSXEXE_HEADER ); - - UINT32 n_address = psxexe_header->t_addr; - UINT32 n_size = psxexe_header->t_size; - while( n_size != 0 ) - { - p_ram[ BYTE4_XOR_LE( n_address ) % n_ram ] = *( p_psxexe ); - n_address++; - p_psxexe++; - n_size--; - } - - cpu->set_state_int( PSXCPU_PC, psxexe_header->pc0 ); - cpu->set_state_int( PSXCPU_R28, psxexe_header->gp0 ); - UINT32 n_stack = psxexe_header->s_addr + psxexe_header->s_size; - if( n_stack != 0 ) - { - cpu->set_state_int( PSXCPU_R29, n_stack ); - cpu->set_state_int( PSXCPU_R30, n_stack ); - } - - return 1; - } - return 0; -} - -void psx1_state::cpe_set_register( cpu_device *cpu, int n_reg, int n_value ) -{ - if( n_reg < 0x80 && ( n_reg % 4 ) == 0 ) - { - logerror( "psx_exe_load: r%-2d %08x\n", n_reg / 4, n_value ); - cpu->set_state_int( PSXCPU_R0 + ( n_reg / 4 ), n_value ); - } - else if( n_reg == 0x80 ) - { - logerror( "psx_exe_load: lo %08x\n", n_value ); - cpu->set_state_int( PSXCPU_LO, n_value ); - } - else if( n_reg == 0x84 ) - { - logerror( "psx_exe_load: hi %08x\n", n_value ); - cpu->set_state_int( PSXCPU_HI, n_value ); - } - else if( n_reg == 0x88 ) - { - logerror( "psx_exe_load: sr %08x\n", n_value ); - cpu->set_state_int( PSXCPU_CP0R12, n_value ); - } - else if( n_reg == 0x8c ) - { - logerror( "psx_exe_load: cause %08x\n", n_value ); - cpu->set_state_int( PSXCPU_CP0R13, n_value ); - } - else if( n_reg == 0x90 ) - { - logerror( "psx_exe_load: pc %08x\n", n_value ); - cpu->set_state_int( PSXCPU_PC, n_value ); - } - else if( n_reg == 0x94 ) - { - logerror( "psx_exe_load: prid %08x\n", n_value ); - cpu->set_state_int( PSXCPU_CP0R15, n_value ); - } - else - { - logerror( "psx_exe_load: invalid register %04x/%08x\n", n_reg, n_value ); - } -} - -int psx1_state::load_cpe( cpu_device *cpu, unsigned char *p_n_file, int n_len ) -{ - if( n_len >= 4 && - memcmp( p_n_file, "CPE\001", 4 ) == 0 ) - { - int n_offset = 4; - - for( ;; ) - { - if( n_offset >= n_len || p_n_file[ n_offset ] > 8 ) - { - break; - } - - switch( p_n_file[ n_offset++ ] ) - { - case 0: - /* end of file */ - return 1; - case 1: - /* read bytes */ - { - int n_address = ( (int)p_n_file[ n_offset + 0 ] << 0 ) | - ( (int)p_n_file[ n_offset + 1 ] << 8 ) | - ( (int)p_n_file[ n_offset + 2 ] << 16 ) | - ( (int)p_n_file[ n_offset + 3 ] << 24 ); - int n_size = ( (int)p_n_file[ n_offset + 4 ] << 0 ) | - ( (int)p_n_file[ n_offset + 5 ] << 8 ) | - ( (int)p_n_file[ n_offset + 6 ] << 16 ) | - ( (int)p_n_file[ n_offset + 7 ] << 24 ); - - UINT8 *p_ram = m_ram->pointer(); - UINT32 n_ram = m_ram->size(); - - n_offset += 8; - - logerror( "psx_exe_load: org %08x\n", n_address ); - logerror( "psx_exe_load: len %08x\n", n_size ); - - while( n_size > 0 ) - { - p_ram[ BYTE4_XOR_LE( n_address ) % n_ram ] = p_n_file[ n_offset++ ]; - n_address++; - n_size--; - } - break; - } - case 2: - /* run address: not tested */ - { - int n_value = ( (int)p_n_file[ n_offset + 2 ] << 0 ) | - ( (int)p_n_file[ n_offset + 3 ] << 8 ) | - ( (int)p_n_file[ n_offset + 4 ] << 16 ) | - ( (int)p_n_file[ n_offset + 5 ] << 24 ); - - n_offset += 4; - - cpe_set_register( cpu, 0x90, n_value ); - break; - } - case 3: - /* set reg to longword */ - { - int n_reg = ( (int)p_n_file[ n_offset + 0 ] << 0 ) | - ( (int)p_n_file[ n_offset + 1 ] << 8 ); - int n_value = ( (int)p_n_file[ n_offset + 2 ] << 0 ) | - ( (int)p_n_file[ n_offset + 3 ] << 8 ) | - ( (int)p_n_file[ n_offset + 4 ] << 16 ) | - ( (int)p_n_file[ n_offset + 5 ] << 24 ); - - n_offset += 6; - - cpe_set_register( cpu, n_reg, n_value ); - break; - } - case 4: - /* set reg to word: not tested */ - { - int n_reg = ( (int)p_n_file[ n_offset + 0 ] << 0 ) | - ( (int)p_n_file[ n_offset + 1 ] << 8 ); - int n_value = ( (int)p_n_file[ n_offset + 2 ] << 0 ) | - ( (int)p_n_file[ n_offset + 3 ] << 8 ); - - n_offset += 4; - - cpe_set_register( cpu, n_reg, n_value ); - break; - } - case 5: - /* set reg to byte: not tested */ - { - int n_reg = ( (int)p_n_file[ n_offset + 0 ] << 0 ) | - ( (int)p_n_file[ n_offset + 1 ] << 8 ); - int n_value = ( (int)p_n_file[ n_offset + 2 ] << 0 ); - - n_offset += 3; - - cpe_set_register( cpu, n_reg, n_value ); - break; - } - case 6: - /* set reg to 3-byte: not tested */ - { - int n_reg = ( (int)p_n_file[ n_offset + 0 ] << 0 ) | - ( (int)p_n_file[ n_offset + 1 ] << 8 ); - int n_value = ( (int)p_n_file[ n_offset + 2 ] << 0 ) | - ( (int)p_n_file[ n_offset + 3 ] << 8 ) | - ( (int)p_n_file[ n_offset + 4 ] << 16 ); - - n_offset += 5; - - cpe_set_register( cpu, n_reg, n_value ); - break; - } - case 7: - /* workspace: not tested */ - n_offset += 4; - break; - case 8: - /* unit */ - { - int n_unit = p_n_file[ n_offset + 0 ]; - - n_offset++; - - logerror( "psx_exe_load: unit %08x\n", n_unit ); - } - break; - } - } - } - return 0; -} - -int psx1_state::load_psf( cpu_device *cpu, unsigned char *p_n_file, int n_len ) -{ - int n_return; - unsigned long n_crc; - unsigned long n_compressed; - unsigned char *p_n_compressed; - unsigned long n_uncompressed; - dynamic_buffer p_n_uncompressed; - - struct PSF_HEADER - { - unsigned char id[ 4 ]; - UINT32 reserved_size; - UINT32 exe_size; - UINT32 exe_crc; - }; - - struct PSF_HEADER *psf_header = (struct PSF_HEADER *)p_n_file; - - n_return = 0; - - if( n_len >= sizeof( struct PSF_HEADER ) && - memcmp( p_n_file, "PSF", 3 ) == 0 ) - { - psxexe_conv32( &psf_header->reserved_size ); - psxexe_conv32( &psf_header->exe_size ); - psxexe_conv32( &psf_header->exe_crc ); - - logerror( "psx_exe_load: reserved_size %08x\n", psf_header->reserved_size ); - logerror( "psx_exe_load: exe_size %08x\n", psf_header->exe_size ); - logerror( "psx_exe_load: exe_crc %08x\n", psf_header->exe_crc ); - - n_compressed = psf_header->exe_size; - p_n_compressed = p_n_file + sizeof( struct PSF_HEADER ) + psf_header->reserved_size; - - n_crc = crc32( crc32( 0L, Z_NULL, 0 ), p_n_compressed, n_compressed ); - if( n_crc != psf_header->exe_crc ) - { - logerror( "psx_exe_load: psf invalid crc\n" ); - return 0; - } - - n_uncompressed = 0x200000; - p_n_uncompressed.resize( n_uncompressed ); - - if( uncompress( &p_n_uncompressed[0], &n_uncompressed, p_n_compressed, n_compressed ) != Z_OK ) - { - logerror( "psx_exe_load: psf uncompress failed\n" ); - } - else if( !load_psxexe( cpu, &p_n_uncompressed[0], n_uncompressed ) ) - { - logerror( "psx_exe_load: psf load failed\n" ); - } - else - { - n_return = 1; - } - } - return n_return; -} - -DIRECT_UPDATE_MEMBER(psx1_state::psx_default) -{ - return address; -} - -DIRECT_UPDATE_MEMBER(psx1_state::psx_setopbase) -{ - if( address == 0x80030000 ) - { - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(psx1_state::psx_default), this)); - - if( load_psxexe( m_maincpu, m_exe_buffer, m_exe_size ) || - load_cpe( m_maincpu, m_exe_buffer, m_exe_size ) || - load_psf( m_maincpu, m_exe_buffer, m_exe_size ) ) - { -/* DEBUGGER_BREAK; */ - - address = m_maincpu->state_int( PSXCPU_PC ); - m_maincpu->set_state_int( PSXCPU_DELAYR, PSXCPU_DELAYR_PC ); - m_maincpu->set_state_int( PSXCPU_DELAYV, address ); - } - else - { - logerror( "psx_exe_load: invalid exe\n" ); - } - - m_exe_size = 0; - global_free_array( m_exe_buffer ); - } - return address; -} - -QUICKLOAD_LOAD_MEMBER( psx1_state, psx_exe_load ) -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - m_exe_size = 0; - m_exe_buffer = global_alloc_array( UINT8, quickload_size ); - if( m_exe_buffer == NULL ) - { - logerror( "psx_exe_load: out of memory\n" ); - return IMAGE_INIT_FAIL; - } - if( image.fread( m_exe_buffer, quickload_size ) != quickload_size ) - { - global_free_array( m_exe_buffer ); - return IMAGE_INIT_FAIL; - } - m_exe_size = quickload_size; - space.set_direct_update_handler(direct_update_delegate(FUNC(psx1_state::psx_setopbase), this)); - - return IMAGE_INIT_PASS; -} - -/* ----------------------------------------------------------------------- */ - void psx1_state::cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) { UINT8 *psxram = (UINT8 *) p_n_psxram; @@ -515,9 +116,6 @@ static MACHINE_CONFIG_START( psj, psx1_state ) MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", psx1_state, psx_exe_load, "cpe,exe,psf,psx", 0) - MCFG_SOFTWARE_LIST_ADD("cd_list","psx") MCFG_DEVICE_MODIFY( "maincpu" ) @@ -564,9 +162,6 @@ static MACHINE_CONFIG_START( pse, psx1_state ) MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", psx1_state, psx_exe_load, "cpe,exe,psf,psx", 0) - MCFG_SOFTWARE_LIST_ADD("cd_list","psx") MCFG_DEVICE_MODIFY( "maincpu" ) diff --git a/src/mess/drivers/pt68k4.c b/src/mess/drivers/pt68k4.c index 34dcd687d47..0546a94c4fa 100644 --- a/src/mess/drivers/pt68k4.c +++ b/src/mess/drivers/pt68k4.c @@ -397,7 +397,7 @@ static MACHINE_CONFIG_START( pt68k2, pt68k4_state ) MCFG_M48T02_ADD(TIMEKEEPER_TAG) - MCFG_WD1772x_ADD(WDFDC_TAG, XTAL_16MHz / 2) + MCFG_WD1772_ADD(WDFDC_TAG, XTAL_16MHz / 2) MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":0", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":1", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) diff --git a/src/mess/drivers/pulsar.c b/src/mess/drivers/pulsar.c index a8f5f17c9a8..609e17013e8 100644 --- a/src/mess/drivers/pulsar.c +++ b/src/mess/drivers/pulsar.c @@ -247,7 +247,7 @@ static MACHINE_CONFIG_START( pulsar, pulsar_state ) MCFG_COM8116_FR_HANDLER(WRITELINE(pulsar_state, fr_w)) MCFG_COM8116_FT_HANDLER(WRITELINE(pulsar_state, ft_w)) - MCFG_FD1797x_ADD("fdc", XTAL_4MHz / 2) + MCFG_FD1797_ADD("fdc", XTAL_4MHz / 2) MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c index 9930b42ff22..a403e40ef9d 100644 --- a/src/mess/drivers/rainbow.c +++ b/src/mess/drivers/rainbow.c @@ -2312,7 +2312,7 @@ MCFG_VT_CHARGEN("chargen") MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r)) MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt)) -MCFG_FD1793x_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz +MCFG_FD1793_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz //MCFG_WD_FDC_FORCE_READY MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":0", rainbow_floppies, "525qd0", rainbow_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":1", rainbow_floppies, "525qd1", rainbow_state::floppy_formats) diff --git a/src/mess/drivers/rc759.c b/src/mess/drivers/rc759.c index 405817cfb5b..cfe48a89093 100644 --- a/src/mess/drivers/rc759.c +++ b/src/mess/drivers/rc759.c @@ -4,12 +4,12 @@ Regnecentralen RC759 - TODO: - - Emulate the Intel 82730 CRT controller and figure out the rest - - Connect iSBX bus - - (much later) move floppy/external printer to the slot interface + TODO: + - Emulate the Intel 82730 CRT controller and figure out the rest + - Connect iSBX bus + - (much later) move floppy/external printer to the slot interface - Status: Hangs waiting for an answer from the 82730 + Status: Hangs waiting for an answer from the 82730 ***************************************************************************/ @@ -256,27 +256,27 @@ static ADDRESS_MAP_START( rc759_io, AS_IO, 16, rc759_state ) AM_RANGE(0x000, 0x003) AM_DEVREADWRITE8("pic", pic8259_device, read, write, 0x00ff) AM_RANGE(0x020, 0x021) AM_READ8(keyboard_r, 0x00ff) AM_RANGE(0x050, 0x05f) AM_READWRITE8(rtc_r, rtc_w, 0x00ff) // and sound -// AM_RANGE(0x060, 0x06f) AM_WRITE8(crt_control_w, 0x00ff) +// AM_RANGE(0x060, 0x06f) AM_WRITE8(crt_control_w, 0x00ff) AM_RANGE(0x070, 0x077) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) AM_RANGE(0x080, 0x0ff) AM_READWRITE8(nvram_r, nvram_w, 0x00ff) -// AM_RANGE(0x100, 0x101) net +// AM_RANGE(0x100, 0x101) net AM_RANGE(0x180, 0x1bf) AM_READWRITE8(palette_r, palette_w, 0x00ff) -// AM_RANGE(0x230, 0x231) crt reset -// AM_RANGE(0x240, 0x241) crt ch. att. -// AM_RANGE(0x250, 0x251) local printer data (centronics) -// AM_RANGE(0x260, 0x261) local printer control (centronics) +// AM_RANGE(0x230, 0x231) crt reset +// AM_RANGE(0x240, 0x241) crt ch. att. +// AM_RANGE(0x250, 0x251) local printer data (centronics) +// AM_RANGE(0x260, 0x261) local printer control (centronics) AM_RANGE(0x280, 0x287) AM_DEVREADWRITE8("fdc", wd2797_t, read, write, 0x00ff) AM_RANGE(0x288, 0x289) AM_WRITE8(floppy_control_w, 0x00ff) -// AM_RANGE(0x28a, 0x28b) external printer data -// AM_RANGE(0x28d, 0x28d) external printer control +// AM_RANGE(0x28a, 0x28b) external printer data +// AM_RANGE(0x28d, 0x28d) external printer control AM_RANGE(0x28e, 0x28f) AM_READWRITE8(floppy_ack_r, floppy_reserve_w, 0x00ff) AM_RANGE(0x290, 0x291) AM_WRITE8(floppy_release_w, 0x00ff) -// AM_RANGE(0x292, 0x293) AM_READWRITE8(printer_ack_r, printer_reserve_w, 0x00ff) -// AM_RANGE(0x294, 0x295) AM_WRITE8(printer_release_w, 0x00ff) -// AM_RANGE(0x300, 0x30f) isbx1 -// AM_RANGE(0x310, 0x31f) isbx2 -// AM_RANGE(0x320, 0x321) isbx dma ack -// AM_RANGE(0x330, 0x331) isbx tc +// AM_RANGE(0x292, 0x293) AM_READWRITE8(printer_ack_r, printer_reserve_w, 0x00ff) +// AM_RANGE(0x294, 0x295) AM_WRITE8(printer_release_w, 0x00ff) +// AM_RANGE(0x300, 0x30f) isbx1 +// AM_RANGE(0x310, 0x31f) isbx2 +// AM_RANGE(0x320, 0x321) isbx dma ack +// AM_RANGE(0x330, 0x331) isbx tc ADDRESS_MAP_END @@ -304,7 +304,7 @@ static MACHINE_CONFIG_START( rc759, rc759_state ) MCFG_I8255_OUT_PORTC_CB(WRITE8(rc759_state, ppi_portc_w)) // floppy disk controller - MCFG_WD2797x_ADD("fdc", 1000000) + MCFG_WD2797_ADD("fdc", 1000000) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic", pic8259_device, ir0_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) diff --git a/src/mess/drivers/rm380z.c b/src/mess/drivers/rm380z.c index e14d6586a59..5c9ee061081 100644 --- a/src/mess/drivers/rm380z.c +++ b/src/mess/drivers/rm380z.c @@ -151,7 +151,7 @@ static MACHINE_CONFIG_START( rm380z, rm380z_state ) MCFG_RAM_DEFAULT_SIZE("56K") /* floppy disk */ - MCFG_FD1771x_ADD("wd1771", XTAL_1MHz) + MCFG_FD1771_ADD("wd1771", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("wd1771:0", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1771:1", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/rmnimbus.c b/src/mess/drivers/rmnimbus.c index 4236521a9cc..94a34ff7b6f 100644 --- a/src/mess/drivers/rmnimbus.c +++ b/src/mess/drivers/rmnimbus.c @@ -123,7 +123,7 @@ static MACHINE_CONFIG_START( nimbus, rmnimbus_state ) MCFG_PALETTE_ADD("palette", 16) /* Backing storage */ - MCFG_WD2793x_ADD(FDC_TAG, 1000000) + MCFG_WD2793_ADD(FDC_TAG, 1000000) MCFG_WD_FDC_FORCE_READY MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_drq_w)) diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c index 5e417004795..7c96130e3a7 100644 --- a/src/mess/drivers/samcoupe.c +++ b/src/mess/drivers/samcoupe.c @@ -560,7 +560,7 @@ static MACHINE_CONFIG_START( samcoupe, samcoupe_state ) MCFG_SOFTWARE_LIST_ADD("cass_list","samcoupe_cass") - MCFG_WD1772x_ADD("wd1772", SAMCOUPE_XTAL_X1/3) + MCFG_WD1772_ADD("wd1772", SAMCOUPE_XTAL_X1/3) MCFG_FLOPPY_DRIVE_ADD("wd1772:0", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1772:1", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) MCFG_SOFTWARE_LIST_ADD("flop_list","samcoupe_flop") diff --git a/src/mess/drivers/sbrain.c b/src/mess/drivers/sbrain.c index 4de6abe4f83..8c2660f3d88 100644 --- a/src/mess/drivers/sbrain.c +++ b/src/mess/drivers/sbrain.c @@ -357,7 +357,7 @@ static MACHINE_CONFIG_START( sbrain, sbrain_state ) MCFG_COM8116_FR_HANDLER(WRITELINE(sbrain_state, fr_w)) MCFG_COM8116_FT_HANDLER(WRITELINE(sbrain_state, ft_w)) - MCFG_FD1791x_ADD("fdc", XTAL_16MHz / 16) + MCFG_FD1791_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/slicer.c b/src/mess/drivers/slicer.c index 8af9b1a609b..ee5327ff006 100644 --- a/src/mess/drivers/slicer.c +++ b/src/mess/drivers/slicer.c @@ -113,7 +113,7 @@ static MACHINE_CONFIG_START( slicer, slicer_state ) MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL) MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_b_w)) - MCFG_FD1797x_ADD("fdc", XTAL_16MHz/2/8) + MCFG_FD1797_ADD("fdc", XTAL_16MHz/2/8) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", slicer_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c index 3408d590cc5..92523d7d569 100644 --- a/src/mess/drivers/smc777.c +++ b/src/mess/drivers/smc777.c @@ -1043,7 +1043,7 @@ static MACHINE_CONFIG_START( smc777, smc777_state ) MCFG_MC6845_CHAR_WIDTH(8) // floppy controller - MCFG_MB8876x_ADD("fdc", XTAL_1MHz) + MCFG_MB8876_ADD("fdc", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(smc777_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(smc777_state, fdc_drq_w)) diff --git a/src/mess/drivers/spc1000.c b/src/mess/drivers/spc1000.c index 959e6e4e4a7..d8f49a029e6 100644 --- a/src/mess/drivers/spc1000.c +++ b/src/mess/drivers/spc1000.c @@ -24,6 +24,7 @@ NOTE: 2014-09-13: added code from someone's modified MESS driver for floppy 2014-10-11: Replaced above code with MESS-compliant code [Meeso Kim] +2015-06-19: Added code for the centronics printer port IMPORTANT NOTE for tape usage: you *FIRST* press PLAY on the tape drive (e.g. by pressing F2 in partial emulated keyboard mode) and *THEN* you @@ -140,6 +141,7 @@ IMPORTANT NOTE for tape usage: you *FIRST* press PLAY on the tape drive #include "video/mc6847.h" #include "imagedev/cassette.h" #include "formats/spc1000_cas.h" +#include "bus/centronics/ctronics.h" #include "bus/spc1000/exp.h" #include "bus/spc1000/fdd.h" @@ -159,6 +161,7 @@ public: , m_p_videoram(*this, "videoram") , m_io_kb(*this, "LINE") , m_io_joy(*this, "JOY") + , m_centronics(*this, "centronics") {} DECLARE_WRITE8_MEMBER(iplk_w); @@ -167,6 +170,7 @@ public: DECLARE_WRITE8_MEMBER(gmode_w); DECLARE_READ8_MEMBER(gmode_r); DECLARE_READ8_MEMBER(porta_r); + DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ) { m_centronics_busy = state; } DECLARE_READ8_MEMBER(mc6847_videoram_r); DECLARE_WRITE8_MEMBER(cass_w); DECLARE_READ8_MEMBER(keyboard_r); @@ -181,6 +185,7 @@ private: UINT16 m_page; UINT8 *m_work_ram; bool m_motor; + bool m_centronics_busy; virtual void machine_start(); virtual void machine_reset(); required_device<z80_device> m_maincpu; @@ -190,6 +195,7 @@ private: required_shared_ptr<UINT8> m_p_videoram; required_ioport_array<10> m_io_kb; required_ioport m_io_joy; + required_device<centronics_device> m_centronics; }; static ADDRESS_MAP_START(spc1000_mem, AS_PROGRAM, 8, spc1000_state ) @@ -221,6 +227,7 @@ WRITE8_MEMBER( spc1000_state::cass_w ) if (m && !m_motor) m_cass->change_state(m_cass->get_state() & CASSETTE_MASK_MOTOR ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); m_motor = m; + m_centronics->write_strobe(BIT(data, 2) ? true : false); } WRITE8_MEMBER(spc1000_state::gmode_w) @@ -431,7 +438,7 @@ READ8_MEMBER( spc1000_state::porta_r ) data |= (m_cass->input() > 0.0038) ? 0x80 : 0; data |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) && ((m_cass->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED) ? 0x00 : 0x40; data &= ~(m_io_joy->read() & 0x3f); - + data &= ~((m_centronics_busy == 0)<< 5); return data; } @@ -470,6 +477,7 @@ static MACHINE_CONFIG_START( spc1000, spc1000_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ay8910", AY8910, XTAL_4MHz / 1) MCFG_AY8910_PORT_A_READ_CB(READ8(spc1000_state, porta_r)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) @@ -477,6 +485,11 @@ static MACHINE_CONFIG_START( spc1000, spc1000_state ) MCFG_DEVICE_ADD("ext1", SPC1000_EXP_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(spc1000_exp, NULL, false) + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(spc1000_state, centronics_busy_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_FORMATS(spc1000_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) diff --git a/src/mess/drivers/special.c b/src/mess/drivers/special.c index 72263f3d18e..e424042e466 100644 --- a/src/mess/drivers/special.c +++ b/src/mess/drivers/special.c @@ -456,7 +456,7 @@ static MACHINE_CONFIG_DERIVED( specimx, special ) MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) @@ -509,7 +509,7 @@ static MACHINE_CONFIG_START( erik, special_state ) MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) - MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) diff --git a/src/mess/drivers/super6.c b/src/mess/drivers/super6.c index 43e4fd3063d..0a6e9b90b67 100644 --- a/src/mess/drivers/super6.c +++ b/src/mess/drivers/super6.c @@ -505,7 +505,7 @@ static MACHINE_CONFIG_START( super6, super6_state ) MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_24MHz/4) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_WD2793x_ADD(WD2793_TAG, 1000000) + MCFG_WD2793_ADD(WD2793_TAG, 1000000) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(super6_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(super6_state, fdc_drq_w)) diff --git a/src/mess/drivers/super80.c b/src/mess/drivers/super80.c index 74943211ce5..2cf1e75c8e8 100644 --- a/src/mess/drivers/super80.c +++ b/src/mess/drivers/super80.c @@ -837,7 +837,7 @@ static MACHINE_CONFIG_DERIVED( super80r, super80v ) MCFG_Z80DMA_IN_IORQ_CB(READ8(super80_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(super80_state, io_write_byte)) - MCFG_WD2793x_ADD("fdc", XTAL_2MHz) + MCFG_WD2793_ADD("fdc", XTAL_2MHz) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/svi318.c b/src/mess/drivers/svi318.c index 147252b2cb1..e09a8bf7daf 100644 --- a/src/mess/drivers/svi318.c +++ b/src/mess/drivers/svi318.c @@ -310,7 +310,7 @@ static MACHINE_CONFIG_START( svi318, svi318_state ) MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") - MCFG_FD1793x_ADD("wd179x", XTAL_1MHz) + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) @@ -439,7 +439,7 @@ static MACHINE_CONFIG_START( svi328_806, svi318_state ) MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") - MCFG_FD1793x_ADD("wd179x", XTAL_1MHz) + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) diff --git a/src/mess/drivers/swtpc09.c b/src/mess/drivers/swtpc09.c index df533c1f3f4..c45666f860c 100644 --- a/src/mess/drivers/swtpc09.c +++ b/src/mess/drivers/swtpc09.c @@ -127,7 +127,7 @@ static MACHINE_CONFIG_START( swtpc09, swtpc09_state ) MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - MCFG_FD1793x_ADD("fdc", XTAL_1MHz) + MCFG_FD1793_ADD("fdc", XTAL_1MHz) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_drq_w)) @@ -168,7 +168,7 @@ static MACHINE_CONFIG_START( swtpc09i, swtpc09_state ) MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - MCFG_FD1793x_ADD("fdc", XTAL_1MHz) + MCFG_FD1793_ADD("fdc", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) @@ -218,7 +218,7 @@ static MACHINE_CONFIG_START( swtpc09d3, swtpc09_state ) MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - MCFG_FD1793x_ADD("fdc", XTAL_1MHz) + MCFG_FD1793_ADD("fdc", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) diff --git a/src/mess/drivers/tavernie.c b/src/mess/drivers/tavernie.c index beba6c63099..06a4efcbfc8 100644 --- a/src/mess/drivers/tavernie.c +++ b/src/mess/drivers/tavernie.c @@ -371,7 +371,7 @@ static MACHINE_CONFIG_DERIVED( ivg09, cpu09 ) MCFG_PIA_WRITEPA_HANDLER(WRITE8(tavernie_state, pa_ivg_w)) MCFG_PIA_CB2_HANDLER(DEVWRITELINE("beeper", beep_device, set_state)) - MCFG_FD1795x_ADD("fdc", XTAL_8MHz / 8) + MCFG_FD1795_ADD("fdc", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("fdc:0", ifd09_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/tdv2324.c b/src/mess/drivers/tdv2324.c index 09a69054036..2597c11dd85 100644 --- a/src/mess/drivers/tdv2324.c +++ b/src/mess/drivers/tdv2324.c @@ -287,7 +287,7 @@ static MACHINE_CONFIG_START( tdv2324, tdv2324_state ) MCFG_Z80SIO2_ADD(MK3887N4_TAG, 8000000/2, 0, 0, 0, 0) - MCFG_FD1797x_ADD(FD1797PL02_TAG, 8000000/4) + MCFG_FD1797_ADD(FD1797PL02_TAG, 8000000/4) MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":0", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":1", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c index f68b45762f6..663dbaf3140 100644 --- a/src/mess/drivers/thomson.c +++ b/src/mess/drivers/thomson.c @@ -661,7 +661,7 @@ static MACHINE_CONFIG_START( to7, thomson_state ) /* floppy */ MCFG_DEVICE_ADD("mc6843", MC6843, 0) - MCFG_WD2793x_ADD("wd2793", XTAL_1MHz) + MCFG_WD2793_ADD("wd2793", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) diff --git a/src/mess/drivers/tiki100.c b/src/mess/drivers/tiki100.c index ccc25745e70..b10d277eab5 100644 --- a/src/mess/drivers/tiki100.c +++ b/src/mess/drivers/tiki100.c @@ -676,7 +676,7 @@ static MACHINE_CONFIG_START( tiki100, tiki100_state ) MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(XTAL_8MHz/4)) - MCFG_FD1797x_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL + MCFG_FD1797_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", tiki100_floppies, "525qd", tiki100_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", tiki100_floppies, "525qd", tiki100_state::floppy_formats) diff --git a/src/mess/drivers/trs80.c b/src/mess/drivers/trs80.c index cccffe4f349..629b13e1467 100644 --- a/src/mess/drivers/trs80.c +++ b/src/mess/drivers/trs80.c @@ -600,7 +600,7 @@ static MACHINE_CONFIG_DERIVED( model1, trs80 ) // model I, level II MCFG_QUICKLOAD_ADD("quickload", trs80_state, trs80_cmd, "cmd", 0.5) - MCFG_FD1793x_ADD("fdc", XTAL_1MHz) // todo: should be fd1771 + MCFG_FD1793_ADD("fdc", XTAL_1MHz) // todo: should be fd1771 MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(trs80_state,trs80_fdc_intrq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", trs80_floppies, "sssd", trs80_state::floppy_formats) diff --git a/src/mess/drivers/trs80m2.c b/src/mess/drivers/trs80m2.c index 4d18448d9c3..3698a937458 100644 --- a/src/mess/drivers/trs80m2.c +++ b/src/mess/drivers/trs80m2.c @@ -722,7 +722,7 @@ static MACHINE_CONFIG_START( trs80m2, trs80m2_state ) MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) // devices - MCFG_FD1791x_ADD(FD1791_TAG, XTAL_8MHz/4) + MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) @@ -812,7 +812,7 @@ static MACHINE_CONFIG_START( trs80m16, trs80m16_state ) MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) // devices - MCFG_FD1791x_ADD(FD1791_TAG, XTAL_8MHz/4) + MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/ts802.c b/src/mess/drivers/ts802.c index 89e1bb79679..0c8dea9a3ca 100644 --- a/src/mess/drivers/ts802.c +++ b/src/mess/drivers/ts802.c @@ -211,7 +211,7 @@ static MACHINE_CONFIG_START( ts802, ts802_state ) MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_FD1793x_ADD("fdc", XTAL_4MHz / 2) // unknown clock + MCFG_FD1793_ADD("fdc", XTAL_4MHz / 2) // unknown clock MCFG_FLOPPY_DRIVE_ADD("fdc:0", ts802_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/unixpc.c b/src/mess/drivers/unixpc.c index 3b8be7c72e6..87899d29dcf 100644 --- a/src/mess/drivers/unixpc.c +++ b/src/mess/drivers/unixpc.c @@ -208,7 +208,7 @@ static MACHINE_CONFIG_START( unixpc, unixpc_state ) MCFG_RAM_EXTRA_OPTIONS("2M") // floppy - MCFG_DEVICE_ADD("wd2797", WD2797x, 1000000) + MCFG_DEVICE_ADD("wd2797", WD2797, 1000000) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_drq_w)) MCFG_FLOPPY_DRIVE_ADD("wd2797:0", unixpc_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/uzebox.c b/src/mess/drivers/uzebox.c index a3b09b7621e..2193f129146 100644 --- a/src/mess/drivers/uzebox.c +++ b/src/mess/drivers/uzebox.c @@ -14,7 +14,7 @@ #include "emu.h" #include "cpu/avr8/avr8.h" -#include "sound/dac.h" +#include "sound/speaker.h" #include "bus/generic/slot.h" #include "bus/generic/carts.h" #include "bus/snes_ctrl/ctrl.h" @@ -32,13 +32,15 @@ public: m_maincpu(*this, "maincpu"), m_cart(*this, "cartslot"), m_ctrl1(*this, "ctrl1"), - m_ctrl2(*this, "ctrl2") + m_ctrl2(*this, "ctrl2"), + m_speaker(*this, "speaker") { } required_device<avr8_device> m_maincpu; required_device<generic_slot_device> m_cart; required_device<snes_control_port_device> m_ctrl1; required_device<snes_control_port_device> m_ctrl2; + required_device<speaker_sound_device> m_speaker; DECLARE_READ8_MEMBER(port_a_r); DECLARE_WRITE8_MEMBER(port_a_w); @@ -168,7 +170,10 @@ WRITE8_MEMBER(uzebox_state::port_d_w) // --x- x--- NC // ---- -x-- power // ---- --xx UART MIDI - + if ((m_port_d ^ data) & 0x80) + { + m_speaker->level_w(data & 0x80); + } m_port_d = data; } @@ -280,9 +285,9 @@ static MACHINE_CONFIG_START( uzebox, uzebox_state ) MCFG_SCREEN_UPDATE_DRIVER(uzebox_state, screen_update_uzebox) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("avr8") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(0, "avr8", 1.00) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(0, "mono", 1.00) MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "uzebox") MCFG_GENERIC_EXTENSIONS("bin,uze") @@ -302,4 +307,4 @@ ROM_START( uzebox ) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS(2010, uzebox, 0, 0, uzebox, uzebox, driver_device, 0, "Belogic", "Uzebox", GAME_NO_SOUND | GAME_NOT_WORKING) +CONS(2010, uzebox, 0, 0, uzebox, uzebox, driver_device, 0, "Belogic", "Uzebox", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING) diff --git a/src/mess/drivers/v1050.c b/src/mess/drivers/v1050.c index 71b1d06018d..09cd375fc23 100644 --- a/src/mess/drivers/v1050.c +++ b/src/mess/drivers/v1050.c @@ -1091,7 +1091,7 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_DEVICE_ADD(CLOCK_SIO_TAG, CLOCK, XTAL_16MHz/4) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v1050_state, write_sio_clock)) - MCFG_MB8877x_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(v1050_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(v1050_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/v6809.c b/src/mess/drivers/v6809.c index 36ef0a7663e..be3572e17b7 100644 --- a/src/mess/drivers/v6809.c +++ b/src/mess/drivers/v6809.c @@ -358,7 +358,7 @@ static MACHINE_CONFIG_START( v6809, v6809_state ) MCFG_MM58274C_MODE24(0) // 12 hour MCFG_MM58274C_DAY1(1) // monday - MCFG_MB8876x_ADD("fdc", XTAL_16MHz / 16) + MCFG_MB8876_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END diff --git a/src/mess/drivers/vector06.c b/src/mess/drivers/vector06.c index 444692617a5..b283c590f51 100644 --- a/src/mess/drivers/vector06.c +++ b/src/mess/drivers/vector06.c @@ -171,7 +171,7 @@ static MACHINE_CONFIG_START( vector06, vector06_state ) MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_FD1793x_ADD("wd1793", XTAL_1MHz) + MCFG_FD1793_ADD("wd1793", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("wd1793:0", vector06_floppies, "qd", vector06_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1793:1", vector06_floppies, "qd", vector06_state::floppy_formats) diff --git a/src/mess/drivers/vixen.c b/src/mess/drivers/vixen.c index 9e7eabdb57c..bc6f0230bf4 100644 --- a/src/mess/drivers/vixen.c +++ b/src/mess/drivers/vixen.c @@ -790,7 +790,7 @@ static MACHINE_CONFIG_START( vixen, vixen_state ) MCFG_RS232_RXD_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_dsr)) - MCFG_FD1797x_ADD(FDC1797_TAG, XTAL_23_9616MHz/24) + MCFG_FD1797_ADD(FDC1797_TAG, XTAL_23_9616MHz/24) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(vixen_state, fdc_intrq_w)) MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":0", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":1", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/wicat.c b/src/mess/drivers/wicat.c index b556c83cda9..534bc3b5de5 100644 --- a/src/mess/drivers/wicat.c +++ b/src/mess/drivers/wicat.c @@ -895,7 +895,7 @@ static MACHINE_CONFIG_START( wicat, wicat_state ) MCFG_CPU_ADD("wd1kcpu",N8X300,XTAL_8MHz) MCFG_CPU_PROGRAM_MAP(wicat_wd1000_mem) MCFG_CPU_IO_MAP(wicat_wd1000_io) - MCFG_FD1795x_ADD("fdc",XTAL_8MHz) + MCFG_FD1795_ADD("fdc",XTAL_8MHz) MACHINE_CONFIG_END diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index 753783ff436..41e11b4e876 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -2483,7 +2483,7 @@ static MACHINE_CONFIG_START( x1, x1_state ) MCFG_VIDEO_START_OVERRIDE(x1_state,x1) - MCFG_MB8877x_ADD("fdc", MAIN_CLOCK / 16) + MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c index c6a14a5ac36..ee9841d1ae4 100644 --- a/src/mess/drivers/x1twin.c +++ b/src/mess/drivers/x1twin.c @@ -457,7 +457,7 @@ static MACHINE_CONFIG_START( x1twin, x1twin_state ) MCFG_VIDEO_START_OVERRIDE(x1twin_state,x1) - MCFG_MB8877x_ADD("fdc", MAIN_CLOCK / 16) + MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c index bb832463abe..68bad92a04c 100644 --- a/src/mess/drivers/xerox820.c +++ b/src/mess/drivers/xerox820.c @@ -38,11 +38,11 @@ 8-inch formats 77 tracks, 1 head, 26 sectors, 128 bytes sector length, first sector id 1 - 77 tracks, 1 head, 26 sectors, 256 bytes sector length, first sector id 1 + 77 tracks, 1 head, 26 sectors, 256 bytes sector length, first sector id 1 - 5.25-inch formats - 40 tracks, 1 head, 18 sectors, 128 bytes sector length, first sector id 1 - 40 tracks, 2 heads, 18 sectors, 128 bytes sector length, first sector id 1 + 5.25-inch formats + 40 tracks, 1 head, 18 sectors, 128 bytes sector length, first sector id 1 + 40 tracks, 2 heads, 18 sectors, 128 bytes sector length, first sector id 1 */ @@ -571,7 +571,7 @@ static MACHINE_CONFIG_START( xerox820, xerox820_state ) MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_20MHz/8)) - MCFG_FD1771x_ADD(FD1771_TAG, XTAL_20MHz/20) + MCFG_FD1771_ADD(FD1771_TAG, XTAL_20MHz/20) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(FD1771_TAG":0", xerox820_floppies, "sa400", floppy_image_device::default_floppy_formats) @@ -658,7 +658,7 @@ static MACHINE_CONFIG_START( xerox820ii, xerox820ii_state ) MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_16MHz/4)) - MCFG_FD1797x_ADD(FD1797_TAG, XTAL_16MHz/8) + MCFG_FD1797_ADD(FD1797_TAG, XTAL_16MHz/8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", xerox820_floppies, "sa450", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/xor100.c b/src/mess/drivers/xor100.c index b45d095d94c..e3c596d61a9 100644 --- a/src/mess/drivers/xor100.c +++ b/src/mess/drivers/xor100.c @@ -552,7 +552,7 @@ static MACHINE_CONFIG_START( xor100, xor100_state ) MCFG_Z80CTC_ZC1_CB(WRITELINE(xor100_state, ctc_z1_w)) MCFG_Z80CTC_ZC2_CB(WRITELINE(xor100_state, ctc_z2_w)) - MCFG_FD1795x_ADD(WD1795_TAG, XTAL_8MHz/4) + MCFG_FD1795_ADD(WD1795_TAG, XTAL_8MHz/4) MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":0", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":1", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":2", xor100_floppies, NULL, floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/z100.c b/src/mess/drivers/z100.c index 56b1ebb5b99..cf60317f96c 100644 --- a/src/mess/drivers/z100.c +++ b/src/mess/drivers/z100.c @@ -697,7 +697,7 @@ static MACHINE_CONFIG_START( z100, z100_state ) MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_FD1797x_ADD("z207_fdc", XTAL_1MHz) + MCFG_FD1797_ADD("z207_fdc", XTAL_1MHz) MCFG_FLOPPY_DRIVE_ADD("z207_fdc:0", z100_floppies, "dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("z207_fdc:1", z100_floppies, "dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/z80ne.c b/src/mess/drivers/z80ne.c index 019c9ef4364..e135a03197e 100644 --- a/src/mess/drivers/z80ne.c +++ b/src/mess/drivers/z80ne.c @@ -528,7 +528,7 @@ static MACHINE_CONFIG_START( z80netf, z80ne_state ) // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND // other lines not connected - MCFG_FD1771x_ADD("wd1771", XTAL_2MHz / 2) + MCFG_FD1771_ADD("wd1771", XTAL_2MHz / 2) MCFG_FLOPPY_DRIVE_ADD("wd1771:0", z80ne_floppies, "sssd", z80ne_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1771:1", z80ne_floppies, "sssd", z80ne_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd1771:2", z80ne_floppies, NULL, z80ne_state::floppy_formats) diff --git a/src/mess/drivers/zorba.c b/src/mess/drivers/zorba.c index 149fa10004a..be61e42f06e 100644 --- a/src/mess/drivers/zorba.c +++ b/src/mess/drivers/zorba.c @@ -400,7 +400,7 @@ static MACHINE_CONFIG_START( zorba, zorba_state ) MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr) MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) MCFG_I8275_IRQ_CALLBACK(WRITELINE(zorba_state, irq0_w)) - MCFG_FD1793x_ADD("fdc", XTAL_24MHz / 24) + MCFG_FD1793_ADD("fdc", XTAL_24MHz / 24) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(zorba_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) //MCFG_WD_FDC_FORCE_READY diff --git a/src/mess/includes/amstrad.h b/src/mess/includes/amstrad.h index 61ded7b08a5..c3a875d92c1 100644 --- a/src/mess/includes/amstrad.h +++ b/src/mess/includes/amstrad.h @@ -27,6 +27,7 @@ #include "bus/cpc/playcity.h" #include "bus/cpc/smartwatch.h" #include "bus/cpc/brunword4.h" +#include "bus/cpc/hd20.h" #include "machine/ram.h" #include "imagedev/cassette.h" #include "bus/centronics/ctronics.h" diff --git a/src/mess/includes/apple2gs.h b/src/mess/includes/apple2gs.h index dbda83919df..eddd8445cd5 100644 --- a/src/mess/includes/apple2gs.h +++ b/src/mess/includes/apple2gs.h @@ -167,8 +167,6 @@ public: UINT32 m_a2_palette[16]; UINT32 m_shr_palette[256]; - DECLARE_DIRECT_UPDATE_MEMBER(apple2gs_opbase); - READ8_MEMBER( apple2gs_c0xx_r ); WRITE8_MEMBER( apple2gs_c0xx_w ); WRITE8_MEMBER( apple2gs_main0400_w ); diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c index b432920450d..537375b17cc 100644 --- a/src/mess/machine/apple2gs.c +++ b/src/mess/machine/apple2gs.c @@ -1772,42 +1772,6 @@ void apple2gs_state::apple2gs_xxCxxx_w(address_space &space, offs_t address, UIN -DIRECT_UPDATE_MEMBER(apple2gs_state::apple2gs_opbase) -{ - UINT8 *opptr = NULL; - int slot; - - if (((address & 0xFEF000) == 0x00C000) || ((address & 0xFEF000) == 0xE0C000)) - { - if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) - { - opptr = &m_ram->pointer()[address]; - } - else if ((address & 0x000F00) == 0x000000) - { - if (((address & 0xFF) >= 0x71) && ((address & 0xFF) <= 0x7F)) - opptr = apple2gs_getslotmem(address); - } - else - { - slot = (address & 0x000F00) / 0x100; - - if ((slot > 7) || ((m_sltromsel & (1 << slot)) == 0)) - opptr = apple2gs_getslotmem(address); - } - - if (opptr != NULL) - { - direct.explicit_configure(address, address, ~0, opptr - address); - - address = ~0; - } - } - return address; -} - - - READ8_MEMBER( apple2gs_state::apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x00C000); } READ8_MEMBER( apple2gs_state::apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x01C000); } READ8_MEMBER( apple2gs_state::apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0xE0C000); } @@ -1910,7 +1874,6 @@ void apple2gs_state::apple2gs_setup_memory() space.install_write_handler(0xe0c000, 0xe0cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E0Cxxx_w),this)); space.install_read_handler(0xe1c000, 0xe1cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_r),this)); space.install_write_handler(0xe1c000, 0xe1cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_w),this)); - space.set_direct_update_handler(direct_update_delegate(FUNC(apple2gs_state::apple2gs_opbase), this)); /* install aux memory writes (for shadowing) */ diff --git a/src/mess/machine/apricotkb_hle.c b/src/mess/machine/apricotkb_hle.c index e40677e5078..6950033c79f 100644 --- a/src/mess/machine/apricotkb_hle.c +++ b/src/mess/machine/apricotkb_hle.c @@ -256,8 +256,8 @@ void apricot_keyboard_hle_device::rcv_complete() m_data_in = get_received_char(); // reset command? send keyboard ready (likely needs a delay, just disable for now) -// if (m_data_in == 0xe8) -// transmit_register_setup(0xfb); +// if (m_data_in == 0xe8) +// transmit_register_setup(0xfb); } WRITE_LINE_MEMBER( apricot_keyboard_hle_device::rxd_w ) diff --git a/src/mess/machine/beta.c b/src/mess/machine/beta.c index 6774281e26a..ef9ec771805 100644 --- a/src/mess/machine/beta.c +++ b/src/mess/machine/beta.c @@ -182,7 +182,7 @@ static SLOT_INTERFACE_START( beta_disk_floppies ) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( beta_disk ) - MCFG_KR1818VG93x_ADD("wd179x", XTAL_8MHz / 8) + MCFG_KR1818VG93_ADD("wd179x", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats) diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index afa4f473cda..471a29c2139 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -1519,7 +1519,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge ) else { std::string errmsg; - strprintf(errmsg,"Invalid cartridge size %" I64FMT "d", size); + strprintf(errmsg,"Invalid cartridge size %d", (int)size); image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); return IMAGE_INIT_FAIL; } diff --git a/src/mess/machine/ti99/990_dk.h b/src/mess/machine/ti99/990_dk.h index eb044b2974f..2f83660ae75 100644 --- a/src/mess/machine/ti99/990_dk.h +++ b/src/mess/machine/ti99/990_dk.h @@ -52,10 +52,10 @@ private: int m_buf_pos; buf_mode_t m_buf_mode; int m_unit; -// int m_head; +// int m_head; int m_sector; /*int m_non_seq_mode;*/ -// int m_ddam; +// int m_ddam; struct { diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index 903ee072d36..1f37c0a335c 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -17,6 +17,13 @@ extern bool g_print_verbose; const options_entry osd_options::s_option_entries[] = { + { NULL, NULL, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" }, +#ifdef SDLMAME_MACOSX + { OSDOPTION_UIMODEKEY, "DEL", OPTION_STRING, "Key to toggle keyboard mode" }, +#else + { OSDOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "Key to toggle keyboard mode" }, +#endif // SDLMAME_MACOSX + { NULL, NULL, OPTION_HEADER, "OSD FONT OPTIONS" }, { OSD_FONT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for ui font: " }, @@ -24,20 +31,17 @@ const options_entry osd_options::s_option_entries[] = { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" }, { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" }, - // debugging options { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used: " }, { OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, OPTION_STRING, "specifies the font to use for debugging" }, { OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", OPTION_FLOAT, "specifies the font size to use for debugging" }, - { OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" }, - // performance options { NULL, NULL, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" }, { OSDOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" }, { OSDOPTION_NUMPROCESSORS ";np", OSDOPTVAL_AUTO, OPTION_STRING, "number of processors; this overrides the number the system reports" }, { OSDOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" }, - // video options + { NULL, NULL, OPTION_HEADER, "OSD VIDEO OPTIONS" }, // OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience { OSDOPTION_VIDEO, OSDOPTVAL_AUTO, OPTION_STRING, "video output method: " }, @@ -85,7 +89,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" }, #if USE_OPENGL - // OpenGL specific options { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, { OSDOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, { OSDOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, @@ -115,7 +118,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SHADER_SCREEN "9", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" }, #endif - // sound options { NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " }, { OSDOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches, decrease for responsiveness)" }, diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index d46463b414d..ddbc8c974d4 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -26,6 +26,8 @@ // Defines //============================================================ +#define OSDOPTION_UIMODEKEY "uimodekey" + #define OSDCOMMAND_LIST_MIDI_DEVICES "listmidi" #define OSDCOMMAND_LIST_NETWORK_ADAPTERS "listnetwork" @@ -54,9 +56,6 @@ #define OSDOPTION_SWITCHRES "switchres" -#define OSDOPTION_SOUND "sound" -#define OSDOPTION_AUDIO_LATENCY "audio_latency" - #define OSDOPTION_FILTER "filter" #define OSDOPTION_PRESCALE "prescale" @@ -69,6 +68,9 @@ #define OSDOPTION_GL_NOTEXTURERECT "gl_notexturerect" #define OSDOPTION_GL_FORCEPOW2TEXTURE "gl_forcepow2texture" +#define OSDOPTION_SOUND "sound" +#define OSDOPTION_AUDIO_LATENCY "audio_latency" + #define OSDOPTION_AUDIO_OUTPUT "audio_output" #define OSDOPTION_AUDIO_EFFECT "audio_effect" @@ -87,6 +89,9 @@ public: // construction/destruction osd_options(); + // keyboard mapping + const char *ui_mode_key() const { return value(OSDOPTION_UIMODEKEY); } + // debugging options const char *debugger() const { return value(OSDOPTION_DEBUGGER); } const char *debugger_font() const { return value(OSDOPTION_DEBUGGER_FONT); } @@ -121,11 +126,7 @@ public: // full screen options bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); } - // sound options - const char *sound() const { return value(OSDOPTION_SOUND); } - int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); } - - // video options + // accelerated video options bool filter() const { return bool_value(OSDOPTION_FILTER); } int prescale() const { return int_value(OSDOPTION_PRESCALE); } @@ -139,6 +140,10 @@ public: const char *shader_mame(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_MAME, index); return value(temp.c_str()); } const char *shader_screen(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_SCREEN, index); return value(temp.c_str()); } + // sound options + const char *sound() const { return value(OSDOPTION_SOUND); } + int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); } + // CoreAudio specific options const char *audio_output() const { return value(OSDOPTION_AUDIO_OUTPUT); } const char *audio_effect(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_AUDIO_EFFECT, index); return value(temp.c_str()); } diff --git a/src/osd/modules/opengl/gl_shader_tool.c b/src/osd/modules/opengl/gl_shader_tool.c index 5d308882ed8..203869e308e 100644 --- a/src/osd/modules/opengl/gl_shader_tool.c +++ b/src/osd/modules/opengl/gl_shader_tool.c @@ -374,11 +374,6 @@ errout: int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shader_file, int verbose ) { - int err = 0, i, c; - FILE * file = NULL; - int buffer_len = 8192; - GLcharARB *buffer=NULL; - if(shader==NULL || shader_file==NULL) { if(shader==NULL) @@ -388,7 +383,7 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade return -1; } - file = fopen(shader_file, "r"); + FILE *const file = fopen(shader_file, "r"); if(!file) { osd_printf_warning("cannot open shader_file: %s\n", shader_file); @@ -397,23 +392,20 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade // get the real file size fseek(file, 0, SEEK_END); - buffer_len = (int)ftell(file); + int const buffer_len = (int)ftell(file); fseek(file, 0, SEEK_SET); - buffer = (GLcharARB *) malloc(buffer_len); - memset(buffer, 0, buffer_len); + GLcharARB *const buffer = (GLcharARB *)malloc(buffer_len + 1); + memset(buffer, 0, buffer_len + 1); - /* Load Shader Sources */ - i=0; - while( i<buffer_len-1 && EOF!=(c=fgetc(file)) ) - buffer[i++]=(char)c; + /* Load Shader Sources */ + for( int i = 0, c = 0; i<buffer_len && EOF!=(c=fgetc(file)); i++ ) + buffer[i]=(char)c; fclose(file); - buffer[i]='\0'; - - err=gl_compile_shader_source(shader, type, buffer, verbose); - if(err) goto errout; + int const err=gl_compile_shader_source(shader, type, buffer, verbose); free(buffer); + if(err) goto errout; if(verbose) osd_printf_warning("shader file: %s\n", shader_file); @@ -421,9 +413,8 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade return 0; errout: - free(buffer); osd_printf_warning("failed to process shader_file: %s\n", shader_file); - return err; + return err; } diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 7d4e9adb375..8f70ba1e0ee 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -2067,7 +2067,7 @@ void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry> input_item_id mameid_code; input_code ui_code; input_type_entry *entry; - const char* uimode; + const char* uimode; char fullmode[64]; // loop over the defaults diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 8b8ebeb4444..22a3aad60b9 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -48,7 +48,6 @@ #define SDLOPTION_SYNCREFRESH "syncrefresh" #define SDLOPTION_KEYMAP "keymap" #define SDLOPTION_KEYMAP_FILE "keymap_file" -#define SDLOPTION_UIMODEKEY "uimodekey" #define SDLOPTION_SIXAXIS "sixaxis" #define SDLOPTION_JOYINDEX "joy_idx" @@ -118,7 +117,6 @@ public: // keyboard mapping bool keymap() const { return bool_value(SDLOPTION_KEYMAP); } const char *keymap_file() const { return value(SDLOPTION_KEYMAP_FILE); } - const char *ui_mode_key() const { return value(SDLOPTION_UIMODEKEY); } // joystick mapping const char *joy_index(int index) const { std::string temp; return value(strformat(temp, "%s%d", SDLOPTION_JOYINDEX, index).c_str()); } diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index e022c9d59b4..14ff93ecaf5 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -117,11 +117,6 @@ const options_entry sdl_options::s_option_entries[] = { NULL, NULL, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, { SDLOPTION_KEYMAP, "0", OPTION_BOOLEAN, "enable keymap" }, { SDLOPTION_KEYMAP_FILE, "keymap.dat", OPTION_STRING, "keymap filename" }, -#ifdef SDLMAME_MACOSX - { SDLOPTION_UIMODEKEY, "DEL", OPTION_STRING, "Key to toggle keyboard mode" }, -#else - { SDLOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "Key to toggle keyboard mode" }, -#endif // SDLMAME_MACOSX // joystick mapping { NULL, NULL, OPTION_HEADER, "SDL JOYSTICK MAPPING" }, diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index f6c46d87f15..ec08277bcf4 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -52,11 +52,6 @@ enum #define MAX_KEYS 256 -#define MAME_KEY 0 -#define DI_KEY 1 -#define VIRTUAL_KEY 2 -#define ASCII_KEY 3 - //============================================================ @@ -270,118 +265,126 @@ static const TCHAR *default_pov_name(int which); //============================================================ // master keyboard translation table -static const int win_key_trans_table[][4] = +struct key_trans_entry { + input_item_id mame_key; + INT32 di_key; + unsigned char virtual_key; + char ascii_key; + char const * mame_key_name; +}; +#define KEY_TRANS_ENTRY(mame, di, virtual, ascii) { ITEM_ID_##mame, DIK_##di, virtual, ascii, "ITEM_ID_"#mame } +static const key_trans_entry win_key_trans_table[] = { - // MAME key dinput key virtual key ascii - { ITEM_ID_ESC, DIK_ESCAPE, VK_ESCAPE, 27 }, - { ITEM_ID_1, DIK_1, '1', '1' }, - { ITEM_ID_2, DIK_2, '2', '2' }, - { ITEM_ID_3, DIK_3, '3', '3' }, - { ITEM_ID_4, DIK_4, '4', '4' }, - { ITEM_ID_5, DIK_5, '5', '5' }, - { ITEM_ID_6, DIK_6, '6', '6' }, - { ITEM_ID_7, DIK_7, '7', '7' }, - { ITEM_ID_8, DIK_8, '8', '8' }, - { ITEM_ID_9, DIK_9, '9', '9' }, - { ITEM_ID_0, DIK_0, '0', '0' }, - { ITEM_ID_MINUS, DIK_MINUS, VK_OEM_MINUS, '-' }, - { ITEM_ID_EQUALS, DIK_EQUALS, VK_OEM_PLUS, '=' }, - { ITEM_ID_BACKSPACE, DIK_BACK, VK_BACK, 8 }, - { ITEM_ID_TAB, DIK_TAB, VK_TAB, 9 }, - { ITEM_ID_Q, DIK_Q, 'Q', 'Q' }, - { ITEM_ID_W, DIK_W, 'W', 'W' }, - { ITEM_ID_E, DIK_E, 'E', 'E' }, - { ITEM_ID_R, DIK_R, 'R', 'R' }, - { ITEM_ID_T, DIK_T, 'T', 'T' }, - { ITEM_ID_Y, DIK_Y, 'Y', 'Y' }, - { ITEM_ID_U, DIK_U, 'U', 'U' }, - { ITEM_ID_I, DIK_I, 'I', 'I' }, - { ITEM_ID_O, DIK_O, 'O', 'O' }, - { ITEM_ID_P, DIK_P, 'P', 'P' }, - { ITEM_ID_OPENBRACE, DIK_LBRACKET, VK_OEM_4, '[' }, - { ITEM_ID_CLOSEBRACE, DIK_RBRACKET, VK_OEM_6, ']' }, - { ITEM_ID_ENTER, DIK_RETURN, VK_RETURN, 13 }, - { ITEM_ID_LCONTROL, DIK_LCONTROL, VK_LCONTROL, 0 }, - { ITEM_ID_A, DIK_A, 'A', 'A' }, - { ITEM_ID_S, DIK_S, 'S', 'S' }, - { ITEM_ID_D, DIK_D, 'D', 'D' }, - { ITEM_ID_F, DIK_F, 'F', 'F' }, - { ITEM_ID_G, DIK_G, 'G', 'G' }, - { ITEM_ID_H, DIK_H, 'H', 'H' }, - { ITEM_ID_J, DIK_J, 'J', 'J' }, - { ITEM_ID_K, DIK_K, 'K', 'K' }, - { ITEM_ID_L, DIK_L, 'L', 'L' }, - { ITEM_ID_COLON, DIK_SEMICOLON, VK_OEM_1, ';' }, - { ITEM_ID_QUOTE, DIK_APOSTROPHE, VK_OEM_7, '\'' }, - { ITEM_ID_TILDE, DIK_GRAVE, VK_OEM_3, '`' }, - { ITEM_ID_LSHIFT, DIK_LSHIFT, VK_LSHIFT, 0 }, - { ITEM_ID_BACKSLASH, DIK_BACKSLASH, VK_OEM_5, '\\' }, - { ITEM_ID_BACKSLASH2, DIK_OEM_102, VK_OEM_102, '<' }, - { ITEM_ID_Z, DIK_Z, 'Z', 'Z' }, - { ITEM_ID_X, DIK_X, 'X', 'X' }, - { ITEM_ID_C, DIK_C, 'C', 'C' }, - { ITEM_ID_V, DIK_V, 'V', 'V' }, - { ITEM_ID_B, DIK_B, 'B', 'B' }, - { ITEM_ID_N, DIK_N, 'N', 'N' }, - { ITEM_ID_M, DIK_M, 'M', 'M' }, - { ITEM_ID_COMMA, DIK_COMMA, VK_OEM_COMMA, ',' }, - { ITEM_ID_STOP, DIK_PERIOD, VK_OEM_PERIOD, '.' }, - { ITEM_ID_SLASH, DIK_SLASH, VK_OEM_2, '/' }, - { ITEM_ID_RSHIFT, DIK_RSHIFT, VK_RSHIFT, 0 }, - { ITEM_ID_ASTERISK, DIK_MULTIPLY, VK_MULTIPLY, '*' }, - { ITEM_ID_LALT, DIK_LMENU, VK_LMENU, 0 }, - { ITEM_ID_SPACE, DIK_SPACE, VK_SPACE, ' ' }, - { ITEM_ID_CAPSLOCK, DIK_CAPITAL, VK_CAPITAL, 0 }, - { ITEM_ID_F1, DIK_F1, VK_F1, 0 }, - { ITEM_ID_F2, DIK_F2, VK_F2, 0 }, - { ITEM_ID_F3, DIK_F3, VK_F3, 0 }, - { ITEM_ID_F4, DIK_F4, VK_F4, 0 }, - { ITEM_ID_F5, DIK_F5, VK_F5, 0 }, - { ITEM_ID_F6, DIK_F6, VK_F6, 0 }, - { ITEM_ID_F7, DIK_F7, VK_F7, 0 }, - { ITEM_ID_F8, DIK_F8, VK_F8, 0 }, - { ITEM_ID_F9, DIK_F9, VK_F9, 0 }, - { ITEM_ID_F10, DIK_F10, VK_F10, 0 }, - { ITEM_ID_NUMLOCK, DIK_NUMLOCK, VK_NUMLOCK, 0 }, - { ITEM_ID_SCRLOCK, DIK_SCROLL, VK_SCROLL, 0 }, - { ITEM_ID_7_PAD, DIK_NUMPAD7, VK_NUMPAD7, 0 }, - { ITEM_ID_8_PAD, DIK_NUMPAD8, VK_NUMPAD8, 0 }, - { ITEM_ID_9_PAD, DIK_NUMPAD9, VK_NUMPAD9, 0 }, - { ITEM_ID_MINUS_PAD, DIK_SUBTRACT, VK_SUBTRACT, 0 }, - { ITEM_ID_4_PAD, DIK_NUMPAD4, VK_NUMPAD4, 0 }, - { ITEM_ID_5_PAD, DIK_NUMPAD5, VK_NUMPAD5, 0 }, - { ITEM_ID_6_PAD, DIK_NUMPAD6, VK_NUMPAD6, 0 }, - { ITEM_ID_PLUS_PAD, DIK_ADD, VK_ADD, 0 }, - { ITEM_ID_1_PAD, DIK_NUMPAD1, VK_NUMPAD1, 0 }, - { ITEM_ID_2_PAD, DIK_NUMPAD2, VK_NUMPAD2, 0 }, - { ITEM_ID_3_PAD, DIK_NUMPAD3, VK_NUMPAD3, 0 }, - { ITEM_ID_0_PAD, DIK_NUMPAD0, VK_NUMPAD0, 0 }, - { ITEM_ID_DEL_PAD, DIK_DECIMAL, VK_DECIMAL, 0 }, - { ITEM_ID_F11, DIK_F11, VK_F11, 0 }, - { ITEM_ID_F12, DIK_F12, VK_F12, 0 }, - { ITEM_ID_F13, DIK_F13, VK_F13, 0 }, - { ITEM_ID_F14, DIK_F14, VK_F14, 0 }, - { ITEM_ID_F15, DIK_F15, VK_F15, 0 }, - { ITEM_ID_ENTER_PAD, DIK_NUMPADENTER, VK_RETURN, 0 }, - { ITEM_ID_RCONTROL, DIK_RCONTROL, VK_RCONTROL, 0 }, - { ITEM_ID_SLASH_PAD, DIK_DIVIDE, VK_DIVIDE, 0 }, - { ITEM_ID_PRTSCR, DIK_SYSRQ, 0, 0 }, - { ITEM_ID_RALT, DIK_RMENU, VK_RMENU, 0 }, - { ITEM_ID_HOME, DIK_HOME, VK_HOME, 0 }, - { ITEM_ID_UP, DIK_UP, VK_UP, 0 }, - { ITEM_ID_PGUP, DIK_PRIOR, VK_PRIOR, 0 }, - { ITEM_ID_LEFT, DIK_LEFT, VK_LEFT, 0 }, - { ITEM_ID_RIGHT, DIK_RIGHT, VK_RIGHT, 0 }, - { ITEM_ID_END, DIK_END, VK_END, 0 }, - { ITEM_ID_DOWN, DIK_DOWN, VK_DOWN, 0 }, - { ITEM_ID_PGDN, DIK_NEXT, VK_NEXT, 0 }, - { ITEM_ID_INSERT, DIK_INSERT, VK_INSERT, 0 }, - { ITEM_ID_DEL, DIK_DELETE, VK_DELETE, 0 }, - { ITEM_ID_LWIN, DIK_LWIN, VK_LWIN, 0 }, - { ITEM_ID_RWIN, DIK_RWIN, VK_RWIN, 0 }, - { ITEM_ID_MENU, DIK_APPS, VK_APPS, 0 }, - { ITEM_ID_PAUSE, DIK_PAUSE, VK_PAUSE, 0 }, - { ITEM_ID_CANCEL, 0, VK_CANCEL, 0 }, + // MAME key dinput key virtual key ascii + KEY_TRANS_ENTRY(ESC, ESCAPE, VK_ESCAPE, 27), + KEY_TRANS_ENTRY(1, 1, '1', '1'), + KEY_TRANS_ENTRY(2, 2, '2', '2'), + KEY_TRANS_ENTRY(3, 3, '3', '3'), + KEY_TRANS_ENTRY(4, 4, '4', '4'), + KEY_TRANS_ENTRY(5, 5, '5', '5'), + KEY_TRANS_ENTRY(6, 6, '6', '6'), + KEY_TRANS_ENTRY(7, 7, '7', '7'), + KEY_TRANS_ENTRY(8, 8, '8', '8'), + KEY_TRANS_ENTRY(9, 9, '9', '9'), + KEY_TRANS_ENTRY(0, 0, '0', '0'), + KEY_TRANS_ENTRY(MINUS, MINUS, VK_OEM_MINUS, '-'), + KEY_TRANS_ENTRY(EQUALS, EQUALS, VK_OEM_PLUS, '='), + KEY_TRANS_ENTRY(BACKSPACE, BACK, VK_BACK, 8), + KEY_TRANS_ENTRY(TAB, TAB, VK_TAB, 9), + KEY_TRANS_ENTRY(Q, Q, 'Q', 'Q'), + KEY_TRANS_ENTRY(W, W, 'W', 'W'), + KEY_TRANS_ENTRY(E, E, 'E', 'E'), + KEY_TRANS_ENTRY(R, R, 'R', 'R'), + KEY_TRANS_ENTRY(T, T, 'T', 'T'), + KEY_TRANS_ENTRY(Y, Y, 'Y', 'Y'), + KEY_TRANS_ENTRY(U, U, 'U', 'U'), + KEY_TRANS_ENTRY(I, I, 'I', 'I'), + KEY_TRANS_ENTRY(O, O, 'O', 'O'), + KEY_TRANS_ENTRY(P, P, 'P', 'P'), + KEY_TRANS_ENTRY(OPENBRACE, LBRACKET, VK_OEM_4, '['), + KEY_TRANS_ENTRY(CLOSEBRACE, RBRACKET, VK_OEM_6, ']'), + KEY_TRANS_ENTRY(ENTER, RETURN, VK_RETURN, 13), + KEY_TRANS_ENTRY(LCONTROL, LCONTROL, VK_LCONTROL, 0), + KEY_TRANS_ENTRY(A, A, 'A', 'A'), + KEY_TRANS_ENTRY(S, S, 'S', 'S'), + KEY_TRANS_ENTRY(D, D, 'D', 'D'), + KEY_TRANS_ENTRY(F, F, 'F', 'F'), + KEY_TRANS_ENTRY(G, G, 'G', 'G'), + KEY_TRANS_ENTRY(H, H, 'H', 'H'), + KEY_TRANS_ENTRY(J, J, 'J', 'J'), + KEY_TRANS_ENTRY(K, K, 'K', 'K'), + KEY_TRANS_ENTRY(L, L, 'L', 'L'), + KEY_TRANS_ENTRY(COLON, SEMICOLON, VK_OEM_1, ';'), + KEY_TRANS_ENTRY(QUOTE, APOSTROPHE, VK_OEM_7, '\''), + KEY_TRANS_ENTRY(TILDE, GRAVE, VK_OEM_3, '`'), + KEY_TRANS_ENTRY(LSHIFT, LSHIFT, VK_LSHIFT, 0), + KEY_TRANS_ENTRY(BACKSLASH, BACKSLASH, VK_OEM_5, '\\'), + KEY_TRANS_ENTRY(BACKSLASH2, OEM_102, VK_OEM_102, '<'), + KEY_TRANS_ENTRY(Z, Z, 'Z', 'Z'), + KEY_TRANS_ENTRY(X, X, 'X', 'X'), + KEY_TRANS_ENTRY(C, C, 'C', 'C'), + KEY_TRANS_ENTRY(V, V, 'V', 'V'), + KEY_TRANS_ENTRY(B, B, 'B', 'B'), + KEY_TRANS_ENTRY(N, N, 'N', 'N'), + KEY_TRANS_ENTRY(M, M, 'M', 'M'), + KEY_TRANS_ENTRY(COMMA, COMMA, VK_OEM_COMMA, ','), + KEY_TRANS_ENTRY(STOP, PERIOD, VK_OEM_PERIOD, '.'), + KEY_TRANS_ENTRY(SLASH, SLASH, VK_OEM_2, '/'), + KEY_TRANS_ENTRY(RSHIFT, RSHIFT, VK_RSHIFT, 0), + KEY_TRANS_ENTRY(ASTERISK, MULTIPLY, VK_MULTIPLY, '*'), + KEY_TRANS_ENTRY(LALT, LMENU, VK_LMENU, 0), + KEY_TRANS_ENTRY(SPACE, SPACE, VK_SPACE, ' '), + KEY_TRANS_ENTRY(CAPSLOCK, CAPITAL, VK_CAPITAL, 0), + KEY_TRANS_ENTRY(F1, F1, VK_F1, 0), + KEY_TRANS_ENTRY(F2, F2, VK_F2, 0), + KEY_TRANS_ENTRY(F3, F3, VK_F3, 0), + KEY_TRANS_ENTRY(F4, F4, VK_F4, 0), + KEY_TRANS_ENTRY(F5, F5, VK_F5, 0), + KEY_TRANS_ENTRY(F6, F6, VK_F6, 0), + KEY_TRANS_ENTRY(F7, F7, VK_F7, 0), + KEY_TRANS_ENTRY(F8, F8, VK_F8, 0), + KEY_TRANS_ENTRY(F9, F9, VK_F9, 0), + KEY_TRANS_ENTRY(F10, F10, VK_F10, 0), + KEY_TRANS_ENTRY(NUMLOCK, NUMLOCK, VK_NUMLOCK, 0), + KEY_TRANS_ENTRY(SCRLOCK, SCROLL, VK_SCROLL, 0), + KEY_TRANS_ENTRY(7_PAD, NUMPAD7, VK_NUMPAD7, 0), + KEY_TRANS_ENTRY(8_PAD, NUMPAD8, VK_NUMPAD8, 0), + KEY_TRANS_ENTRY(9_PAD, NUMPAD9, VK_NUMPAD9, 0), + KEY_TRANS_ENTRY(MINUS_PAD, SUBTRACT, VK_SUBTRACT, 0), + KEY_TRANS_ENTRY(4_PAD, NUMPAD4, VK_NUMPAD4, 0), + KEY_TRANS_ENTRY(5_PAD, NUMPAD5, VK_NUMPAD5, 0), + KEY_TRANS_ENTRY(6_PAD, NUMPAD6, VK_NUMPAD6, 0), + KEY_TRANS_ENTRY(PLUS_PAD, ADD, VK_ADD, 0), + KEY_TRANS_ENTRY(1_PAD, NUMPAD1, VK_NUMPAD1, 0), + KEY_TRANS_ENTRY(2_PAD, NUMPAD2, VK_NUMPAD2, 0), + KEY_TRANS_ENTRY(3_PAD, NUMPAD3, VK_NUMPAD3, 0), + KEY_TRANS_ENTRY(0_PAD, NUMPAD0, VK_NUMPAD0, 0), + KEY_TRANS_ENTRY(DEL_PAD, DECIMAL, VK_DECIMAL, 0), + KEY_TRANS_ENTRY(F11, F11, VK_F11, 0), + KEY_TRANS_ENTRY(F12, F12, VK_F12, 0), + KEY_TRANS_ENTRY(F13, F13, VK_F13, 0), + KEY_TRANS_ENTRY(F14, F14, VK_F14, 0), + KEY_TRANS_ENTRY(F15, F15, VK_F15, 0), + KEY_TRANS_ENTRY(ENTER_PAD, NUMPADENTER, VK_RETURN, 0), + KEY_TRANS_ENTRY(RCONTROL, RCONTROL, VK_RCONTROL, 0), + KEY_TRANS_ENTRY(SLASH_PAD, DIVIDE, VK_DIVIDE, 0), + KEY_TRANS_ENTRY(PRTSCR, SYSRQ, 0, 0), + KEY_TRANS_ENTRY(RALT, RMENU, VK_RMENU, 0), + KEY_TRANS_ENTRY(HOME, HOME, VK_HOME, 0), + KEY_TRANS_ENTRY(UP, UP, VK_UP, 0), + KEY_TRANS_ENTRY(PGUP, PRIOR, VK_PRIOR, 0), + KEY_TRANS_ENTRY(LEFT, LEFT, VK_LEFT, 0), + KEY_TRANS_ENTRY(RIGHT, RIGHT, VK_RIGHT, 0), + KEY_TRANS_ENTRY(END, END, VK_END, 0), + KEY_TRANS_ENTRY(DOWN, DOWN, VK_DOWN, 0), + KEY_TRANS_ENTRY(PGDN, NEXT, VK_NEXT, 0), + KEY_TRANS_ENTRY(INSERT, INSERT, VK_INSERT, 0), + KEY_TRANS_ENTRY(DEL, DELETE, VK_DELETE, 0), + KEY_TRANS_ENTRY(LWIN, LWIN, VK_LWIN, 0), + KEY_TRANS_ENTRY(RWIN, RWIN, VK_RWIN, 0), + KEY_TRANS_ENTRY(MENU, APPS, VK_APPS, 0), + KEY_TRANS_ENTRY(PAUSE, PAUSE, VK_PAUSE, 0), + { ITEM_ID_CANCEL, 0, VK_CANCEL, 0, "ITEM_ID_CANCEL" }, // New keys introduced in Windows 2000. These have no MAME codes to // preserve compatibility with old config files that may refer to them @@ -391,18 +394,18 @@ static const int win_key_trans_table[][4] = // paused). Some codes are missing because the mapping to vkey codes // isn't clear, and MapVirtualKey is no help. - { ITEM_ID_OTHER_SWITCH, DIK_MUTE, VK_VOLUME_MUTE, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_VOLUMEDOWN, VK_VOLUME_DOWN, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_VOLUMEUP, VK_VOLUME_UP, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBHOME, VK_BROWSER_HOME, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBSEARCH, VK_BROWSER_SEARCH, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBFAVORITES, VK_BROWSER_FAVORITES, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBREFRESH, VK_BROWSER_REFRESH, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBSTOP, VK_BROWSER_STOP, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBFORWARD, VK_BROWSER_FORWARD, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBBACK, VK_BROWSER_BACK, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_MAIL, VK_LAUNCH_MAIL, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_MEDIASELECT, VK_LAUNCH_MEDIA_SELECT, 0 }, + KEY_TRANS_ENTRY(OTHER_SWITCH, MUTE, VK_VOLUME_MUTE, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, VOLUMEDOWN, VK_VOLUME_DOWN, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, VOLUMEUP, VK_VOLUME_UP, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBHOME, VK_BROWSER_HOME, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBSEARCH, VK_BROWSER_SEARCH, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBFAVORITES, VK_BROWSER_FAVORITES, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBREFRESH, VK_BROWSER_REFRESH, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBSTOP, VK_BROWSER_STOP, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBFORWARD, VK_BROWSER_FORWARD, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBBACK, VK_BROWSER_BACK, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, MAIL, VK_LAUNCH_MAIL, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, MEDIASELECT, VK_LAUNCH_MEDIA_SELECT, 0), }; @@ -424,8 +427,8 @@ INLINE input_item_id keyboard_map_scancode_to_itemid(int scancode) // scan the table for a match for (tablenum = 0; tablenum < ARRAY_LENGTH(win_key_trans_table); tablenum++) - if (win_key_trans_table[tablenum][DI_KEY] == scancode) - return (input_item_id)win_key_trans_table[tablenum][MAME_KEY]; + if (win_key_trans_table[tablenum].di_key == scancode) + return (input_item_id)win_key_trans_table[tablenum].mame_key; // default to an "other" switch return ITEM_ID_OTHER_SWITCH; @@ -706,20 +709,45 @@ int wininput_vkey_for_mame_code(input_code code) // scan the table for a match for (tablenum = 0; tablenum < ARRAY_LENGTH(win_key_trans_table); tablenum++) - if (win_key_trans_table[tablenum][MAME_KEY] == id) - return win_key_trans_table[tablenum][VIRTUAL_KEY]; + if (win_key_trans_table[tablenum].mame_key == id) + return win_key_trans_table[tablenum].virtual_key; } return 0; } //============================================================ +// lookup_mame_code +//============================================================ + +static int lookup_mame_index(const char *scode) +{ + for (int i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++) + { + if (!strcmp(scode, win_key_trans_table[i].mame_key_name)) + return i; + } + return -1; +} + +static input_item_id lookup_mame_code(const char *scode) +{ + int const index = lookup_mame_index(scode); + if (index >= 0) + return win_key_trans_table[index].mame_key; + else + return ITEM_ID_INVALID; +} + + +//============================================================ // customize_input_type_list //============================================================ void windows_osd_interface::customize_input_type_list(simple_list<input_type_entry> &typelist) { input_type_entry *entry; + const char* uimode; // loop over the defaults for (entry = typelist.first(); entry != NULL; entry = entry->next()) @@ -731,6 +759,22 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT); break; + // configurable UI mode switch + case IPT_UI_TOGGLE_UI: + uimode = options().ui_mode_key(); + if (strcmp(uimode,"auto")) + { + std::string fullmode = "ITEM_ID_"; + fullmode += uimode; + input_item_id const mameid_code = lookup_mame_code(fullmode.c_str()); + if (ITEM_ID_INVALID != mameid_code) + { + input_code const ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code)); + entry->defseq(SEQ_TYPE_STANDARD).set(ui_code); + } + } + break; + // alt-enter for fullscreen case IPT_OSD_1: entry->configure_osd("TOGGLE_FULLSCREEN", "Toggle Fullscreen"); @@ -1010,10 +1054,10 @@ static void win32_keyboard_poll(device_info *devinfo) // iterate over keys for (keynum = 0; keynum < ARRAY_LENGTH(win_key_trans_table); keynum++) { - int vk = win_key_trans_table[keynum][VIRTUAL_KEY]; + int vk = win_key_trans_table[keynum].virtual_key; if (vk != 0 && (GetAsyncKeyState(vk) & 0x8000) != 0) { - int dik = win_key_trans_table[keynum][DI_KEY]; + int dik = win_key_trans_table[keynum].di_key; // conver the VK code to a scancode (DIK code) if (dik != 0) diff --git a/src/tools/nltool.c b/src/tools/nltool.c index 4bf6abefde0..97d3204579a 100644 --- a/src/tools/nltool.c +++ b/src/tools/nltool.c @@ -183,7 +183,7 @@ public: void init() { - m_setup = palloc(netlist::netlist_setup_t, this); + m_setup = palloc(netlist::setup_t, this); this->init_object(*this, "netlist"); m_setup->init(); } @@ -244,7 +244,7 @@ protected: } private: - netlist::netlist_setup_t *m_setup; + netlist::setup_t *m_setup; }; @@ -275,7 +275,7 @@ static void run(tool_options_t &opts) printf("runnning ...\n"); t = osd_ticks(); - nt.process_queue(netlist_time::from_double(ttr)); + nt.process_queue(netlist::netlist_time::from_double(ttr)); nt.stop(); double emutime = (double) (osd_ticks() - t) / (double) osd_ticks_per_second(); @@ -292,7 +292,7 @@ static void listdevices() nt.init(); const netlist::factory_list_t::list_t &list = nt.setup().factory().list(); - nt.setup().register_source(palloc(netlist::netlist_source_proc_t, "dummy", &netlist_dummy)); + nt.setup().register_source(palloc(netlist::source_proc_t, "dummy", &netlist_dummy)); nt.setup().include("dummy"); nt.setup().start_devices(); diff --git a/src/version.c b/src/version.c index ac911975594..5343ee091de 100644 --- a/src/version.c +++ b/src/version.c @@ -8,7 +8,7 @@ ***************************************************************************/ -#define BARE_BUILD_VERSION "0.162" +#define BARE_BUILD_VERSION "0.163" extern const char bare_build_version[]; extern const char build_version[]; |